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
7 changes: 4 additions & 3 deletions web/lib/flow-onboarding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,14 @@ export function readFactoryDraft(raw: string | null): FactoryDraft | null {

export function cloudConnectionsHref(draft: FactoryDraft, handoffId: string, journeyId?: string): string {
if (!canContinue(draft, 2)) throw new Error('Choose a workflow before continuing to Cloud.');
// The fragment is read only by Cloud's browser handoff page. Source code and
// ticket filters must not enter OAuth state, cookies, or server access logs.
// The fragment is read only by Cloud's browser deploy page, which keeps it in
// localStorage across Google sign-in. Source code and ticket filters must not
// enter OAuth state, cookies, or server access logs.
const payload = { version: 1, handoffId, ...(journeyId ? { analytics: { journeyId } } : {}), name: 'Software factory', source: factorySource({ ...draft, step: 3 }),
workflow: draft.workflow, sources: draft.sources, sourceSettings: draft.sourceSettings,
agents: draft.agents, otherAgent: draft.otherAgent, otherAgentSelected: otherAgentIsSelected(draft), task: draft.task };
const base = process.env.NEXT_PUBLIC_CLOUD_URL || 'https://agentrelay.com/cloud';
return `${base.replace(/\/$/, '')}/flows/import#${encodeURIComponent(JSON.stringify(payload))}`;
return `${base.replace(/\/$/, '')}/flows/deploy#${encodeURIComponent(JSON.stringify(payload))}`;
}

export function factoryCodeSections(draft: FactoryDraft, target: 'cloud' | 'local' = 'cloud') {
Expand Down
2 changes: 1 addition & 1 deletion web/lib/test/flow-onboarding.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ describe('software factory onboarding', () => {
const draft: FactoryDraft = { ...DEFAULT_FACTORY, sources: ['github'], sourceSettings: { github: { repository: 'org/repo', labels: 'ready' } }, agents: ['codex'], task: 'Keep naïve input & labels', workflow: 'traditional', step: 3 };
const url = new URL(cloudConnectionsHref(draft, '00000000-0000-4000-8000-000000000001'));
expect(url.origin).toBe('https://agentrelay.com');
expect(url.pathname).toBe('/cloud/flows/import');
expect(url.pathname).toBe('/cloud/flows/deploy');
expect(url.search).toBe('');
const payload = JSON.parse(decodeURIComponent(url.hash.slice(1)));
expect(payload.source).toBe(factorySource(draft));
Expand Down
Loading