Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion apps/daemon/src/integrations/vela-errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ export interface AmrAccountFailure {
actionUrl?: string;
}

export const DEFAULT_AMR_RECHARGE_URL = 'https://open-design.ai/amr/wallet';
// `source=open_design` tags the wallet landing page_view so vela analytics can
// attribute the recharge visit to Open Design.
export const DEFAULT_AMR_RECHARGE_URL =
'https://open-design.ai/amr/wallet?source=open_design';
Comment thread
lefarcen marked this conversation as resolved.

const AMR_AUTH_REQUIRED_MESSAGE =
'AMR sign-in is required. Sign in to AMR Cloud again, then retry this run.';
Expand Down
7 changes: 7 additions & 0 deletions apps/daemon/src/runtimes/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,13 @@ export function spawnEnvForAgent(
if (agentId === 'amr') {
Object.assign(env, amrVelaProfileEnv(env));
Object.assign(env, amrAnalyticsIdentityEnv(env));
// Identify Open Design as the host so the vela CLI tags its command +
// model_request analytics with source=open_design (revenue attribution).
// Not PII (unlike the installation id above), so set it regardless of the
// telemetry-consent gate that amrAnalyticsIdentityEnv applies.
if (!env.AMR_CLIENT_SOURCE?.trim()) {
env.AMR_CLIENT_SOURCE = 'open_design';
}
if (!env.OPENCODE_TEST_HOME?.trim() && env.OD_DATA_DIR?.trim()) {
env.OPENCODE_TEST_HOME = path.join(
env.OD_DATA_DIR.trim(),
Expand Down
2 changes: 1 addition & 1 deletion apps/daemon/tests/amr-acp-integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,7 @@ describe('AMR ACP transport — end-to-end against fake vela stub', () => {
expect(classifyAmrAccountFailure(message)).toMatchObject({
code: 'AMR_INSUFFICIENT_BALANCE',
action: 'recharge',
actionUrl: 'https://open-design.ai/amr/wallet',
actionUrl: 'https://open-design.ai/amr/wallet?source=open_design',
});
});

Expand Down
9 changes: 6 additions & 3 deletions apps/web/src/runtime/amr-guidance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,16 @@
// without a circular dependency.

// AMR model-gateway console wallet (account, balance, recharge).
export const AMR_CONSOLE_URL = 'https://open-design.ai/amr/wallet';
// `source=open_design` tags the landing page_view so vela analytics can
// attribute the visit to Open Design (per-product revenue/traffic attribution).
export const AMR_CONSOLE_URL =
'https://open-design.ai/amr/wallet?source=open_design';
export const AMR_RECHARGE_URL = AMR_CONSOLE_URL;

const AMR_CONSOLE_URL_BY_PROFILE: Record<string, string> = {
prod: AMR_CONSOLE_URL,
test: 'https://vela.powerformer.net/wallet',
local: 'http://localhost:5173/wallet',
test: 'https://vela.powerformer.net/wallet?source=open_design',
local: 'http://localhost:5173/wallet?source=open_design',
};

export function amrConsoleUrlForProfile(profile: string | null | undefined): string {
Expand Down
6 changes: 3 additions & 3 deletions apps/web/tests/components/AmrLoginPill.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ describe('AmrLoginPill', () => {
expect(screen.getByText('leaf@example.com')).toBeTruthy();
expect(screen.getByText('TEST')).toBeTruthy();
expect(screen.getByRole('link', { name: 'AMR Console' }).getAttribute('href')).toBe(
'https://vela.powerformer.net/wallet',
'https://vela.powerformer.net/wallet?source=open_design',
);
});

Expand All @@ -214,7 +214,7 @@ describe('AmrLoginPill', () => {

expect(screen.getByText('LOCAL')).toBeTruthy();
expect(screen.getByRole('link', { name: 'AMR Console' }).getAttribute('href')).toBe(
'http://localhost:5173/wallet',
'http://localhost:5173/wallet?source=open_design',
);
});

Expand All @@ -229,7 +229,7 @@ describe('AmrLoginPill', () => {

expect(screen.queryByText('PROD')).toBeNull();
expect(screen.getByRole('link', { name: 'AMR Console' }).getAttribute('href')).toBe(
'https://open-design.ai/amr/wallet',
'https://open-design.ai/amr/wallet?source=open_design',
);
});

Expand Down
2 changes: 1 addition & 1 deletion apps/web/tests/components/AvatarMenu.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,6 @@ describe('AvatarMenu', () => {
screen
.getByRole('link', { name: 'avatar.amrConsoleavatar.amrConsoleMeta' })
.getAttribute('href'),
).toBe('https://vela.powerformer.net/wallet');
).toBe('https://vela.powerformer.net/wallet?source=open_design');
});
});
16 changes: 12 additions & 4 deletions apps/web/tests/runtime/amr-guidance.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,18 @@ import { amrRechargeUrlForProfile, resolveRunFailureUi } from '../../src/runtime

describe('amrRechargeUrlForProfile', () => {
it('matches the selected AMR profile wallet origin', () => {
expect(amrRechargeUrlForProfile('prod')).toBe('https://open-design.ai/amr/wallet');
expect(amrRechargeUrlForProfile('test')).toBe('https://vela.powerformer.net/wallet');
expect(amrRechargeUrlForProfile('local')).toBe('http://localhost:5173/wallet');
expect(amrRechargeUrlForProfile(' unknown ')).toBe('https://open-design.ai/amr/wallet');
expect(amrRechargeUrlForProfile('prod')).toBe(
'https://open-design.ai/amr/wallet?source=open_design',
);
expect(amrRechargeUrlForProfile('test')).toBe(
'https://vela.powerformer.net/wallet?source=open_design',
);
expect(amrRechargeUrlForProfile('local')).toBe(
'http://localhost:5173/wallet?source=open_design',
);
expect(amrRechargeUrlForProfile(' unknown ')).toBe(
'https://open-design.ai/amr/wallet?source=open_design',
);
});
});

Expand Down
4 changes: 3 additions & 1 deletion e2e/tests/amr/insufficient-balance.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ describe('AMR insufficient balance run failures', () => {

const events = await readRunEvents(webUrl, run.runId);
expect(events).toContain('AMR_INSUFFICIENT_BALANCE');
expect(events).toContain('https://open-design.ai/amr/wallet');
expect(events).toContain(
'https://open-design.ai/amr/wallet?source=open_design',
);

const messages = await listMessages(webUrl, project.project.id, project.conversationId);
const assistant = messages.find((message) => message.id === assistantMessageId);
Expand Down
4 changes: 2 additions & 2 deletions nix/pnpm-deps.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
# 1. Temporarily set the consuming `hash = lib.fakeHash;`
# 2. Run the relevant nix build/flake check
# 3. Copy the expected hash printed by Nix into the matching field below
daemonHash = "sha256-cFElX3G4K+c581UW4F1/JvVI8GcZ4/ZKG6r50RYxKUU=";
webHash = "sha256-Rx/9yiacA2vOfYfWdMnstfdtURKLrWLkGua/64VPKQc=";
daemonHash = "sha256-bPYV6FtDZcUNnCpFbaT3cz07kAqy+2LEiHiwmCU7Qy8=";
webHash = "sha256-yT6dcsP6xPE+5ErNXOPZagj5+4gZVtX9DBcBilKZAm4=";
}
50 changes: 25 additions & 25 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tools/pack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"resedit": "1.7.2"
},
"optionalDependencies": {
"@powerformer/vela-cli": "0.0.13"
"@powerformer/vela-cli": "0.0.15"
},
"devDependencies": {
"@types/node": "24.12.2",
Expand Down
Loading