Merge pull request #420 from nwparker/cloud/w2-setup-stepper-web-steps

fix(cloud): setup stepper matches the web (Account · Team · Plan · GitHub); agent glyph in the header (DS-b, NS-04)
This commit is contained in:
Neil
2026-11-11 03:32:37 -08:00
committed by GitHub
7 changed files with 176 additions and 9 deletions
@@ -0,0 +1,94 @@
import { defineFixture } from '../../component-fixtures/component-fixture'
import type { CloudSetupStep } from '@/components/new-workspace/run-on/cloud-start-model'
import { CloudSetupPage } from './CloudSetupPage'
import { cloudSetupPageModel } from './cloud-setup-page-model'
import type { CloudSetupFlow } from './use-cloud-setup-flow'
const noop = (): void => {}
function flow(rows: CloudSetupStep[]): CloudSetupFlow {
return {
...cloudSetupPageModel(rows),
busy: false,
signingIn: false,
signInDidNotFinish: false,
cancelSignIn: noop,
abandon: noop,
inBrowser: false,
error: null,
canManageBilling: true,
teamAction: null,
continueInBrowser: noop,
startTrial: noop,
fixBilling: noop,
installGitHub: noop,
checkAgain: noop,
copyLink: null,
reopenBrowser: noop
}
}
function page(rows: CloudSetupStep[], agent: 'claude' | 'codex', label: string) {
return (
<div className="h-[560px]">
<CloudSetupPage
flow={flow(rows)}
projectName="Hello-World"
prompt="Fix the flaky checkout test"
agentLabel={label}
agent={agent}
onBackToComposer={noop}
onExit={noop}
starting={false}
/>
</div>
)
}
/** DS-b: signed out. The web's four steps from the first page: Account · Team · Plan · GitHub. */
export const signedOut = defineFixture({
width: 1000,
render: () =>
page(
[
{ id: 'account', state: 'needed', need: 'sign-in', canFix: true },
{ id: 'plan', state: 'pending', need: 'trial' },
{ id: 'github', state: 'needed', need: 'github', canFix: true },
{ id: 'agent', state: 'optional' }
],
'claude',
'Claude'
)
})
/** DS-b: signed in on a trial-eligible team. Team ticks with Account; the step reads Plan, not Trial. */
export const trialPlan = defineFixture({
width: 1000,
render: () =>
page(
[
{ id: 'account', state: 'done' },
{ id: 'plan', state: 'needed', need: 'trial', canFix: true, trialSeconds: 7200 },
{ id: 'github', state: 'needed', need: 'github', canFix: true },
{ id: 'agent', state: 'optional' }
],
'codex',
'Codex'
)
})
/** DS-b: only GitHub left. NS-04 (e): the agent's glyph, muted, before its name in the header line. */
export const githubLeft = defineFixture({
width: 1000,
render: () =>
page(
[
{ id: 'account', state: 'done' },
{ id: 'plan', state: 'done' },
{ id: 'github', state: 'needed', need: 'github', canFix: true },
{ id: 'agent', state: 'optional' }
],
'claude',
'Claude'
)
})
@@ -8,6 +8,8 @@ import { Button } from '@/components/ui/button'
import { Skeleton } from '@/components/ui/skeleton'
import { cn } from '@/lib/utils'
import { useTranslate } from '@/i18n/use-translate'
import { AgentIcon } from '@/components/agent/icons/AgentIcon'
import type { TerminalAgent } from '../../../../shared/agent-status/identity/terminal-agent'
import type {
CloudSetupStep,
CloudSetupStepId
@@ -21,6 +23,8 @@ export type CloudSetupPageProps = {
projectName: string | null
prompt: string
agentLabel: string | null
/** The agent the prompt starts with: its glyph sits before its name in the header line (NS-04). */
agent?: TerminalAgent | null
/** Back from the first step: Create workspace again, with the prompt, project and agent kept. */
onBackToComposer: () => void
/** The × in the corner: leave setup, keep the draft (nothing starts). */
@@ -253,6 +257,7 @@ export function CloudSetupPage({
projectName,
prompt,
agentLabel,
agent = null,
onBackToComposer,
onExit,
starting
@@ -304,8 +309,7 @@ export function CloudSetupPage({
prompt.trim()
? t('cloudSetupPage.headerFor', 'Setting up Orca Cloud for {{name}}', { name: prompt.trim() })
: t('cloudSetupPage.header', 'Setting up Orca Cloud'),
projectName,
agentLabel
projectName
]
.filter(Boolean)
.join(' · ')
@@ -326,6 +330,18 @@ export function CloudSetupPage({
data-cloud-setup-context="true"
>
{context}
{agentLabel ? (
<>
{' · '}
{/* NS-04 (e): the agent's glyph, muted like the line (never the coloured mark). */}
{agent ? (
<span aria-hidden="true" className="me-1 inline-flex align-[-2px]">
<AgentIcon agent={agent} size={14} className="[&_path]:fill-current" />
</span>
) : null}
{agentLabel}
</>
) : null}
</span>
<Button
type="button"
@@ -110,6 +110,7 @@ function ActiveCloudSetupPage({ request }: { request: CloudSetupPageRequest }):
projectName={projectName}
prompt={request.prompt}
agentLabel={agentLabel}
agent={isOrcaCloudAccountAgent(request.agent) ? request.agent : null}
onBackToComposer={onBackToComposer}
onExit={onExit}
starting={starting}
@@ -12,9 +12,8 @@ export function stepLabel(step: CloudSetupStep, t: Translate): string {
case 'team':
return t('cloudSetupPage.step.team', 'Team')
case 'plan':
return step.need === 'trial'
? t('cloudSetupPage.step.trial', 'Trial')
: t('cloudSetupPage.step.plan', 'Plan')
// Always "Plan", as on the web (DS-b): a trial is how the plan step gets done, not a step.
return t('cloudSetupPage.step.plan', 'Plan')
case 'github':
return t('cloudSetupPage.step.github', 'GitHub')
case 'agent':
@@ -23,10 +23,52 @@ describe('cloudSetupPageModel', () => {
{ id: 'agent', state: 'optional' }
]
const model = cloudSetupPageModel(steps)
expect(model.steps.map((step) => step.id)).toEqual(['account', 'plan'])
expect(model.steps.map((step) => step.id)).toEqual(['account', 'team', 'plan'])
expect(model).toMatchObject({ current: null, action: 'done' })
})
it('always lists Team after Account, like the web (DS-b): done once signed in', () => {
const signedOut = cloudSetupPageModel([
{ id: 'account', state: 'needed', need: 'sign-in', canFix: true },
{ id: 'plan', state: 'pending', need: 'trial' },
{ id: 'github', state: 'needed', need: 'github', canFix: true }
])
expect(signedOut.steps.map((step) => [step.id, step.state])).toEqual([
['account', 'needed'],
['team', 'pending'],
['plan', 'pending'],
['github', 'needed']
])
expect(signedOut.current?.id).toBe('account')
const signedIn = cloudSetupPageModel([
{ id: 'account', state: 'done' },
{ id: 'plan', state: 'done' },
{ id: 'github', state: 'needed', need: 'github', canFix: true }
])
expect(signedIn.steps.map((step) => [step.id, step.state])).toEqual([
['account', 'done'],
['team', 'done'],
['plan', 'done'],
['github', 'needed']
])
expect(signedIn.current?.id).toBe('github')
// A team switch brings its own Team step: it is kept, not doubled.
const switching = cloudSetupPageModel(
[
{ id: 'account', state: 'done' },
{ id: 'team', state: 'needed' },
{ id: 'plan', state: 'done' }
],
{ teamSwitch: true }
)
expect(switching.steps.map((step) => step.id)).toEqual(['account', 'team', 'plan'])
expect(switching.action).toBe('switch-team')
// No repository (D3): the only row stays the only step.
expect(
cloudSetupPageModel([{ id: 'github', state: 'failed', blocksStart: true }]).steps
).toHaveLength(1)
})
it('maps each blocker to its one action', () => {
expect(actionForStep({ id: 'plan', state: 'pending', need: 'trial' })).toBe('sign-in')
expect(actionForStep({ id: 'plan', state: 'needed', need: 'payment', canFix: true })).toBe(
@@ -92,7 +92,7 @@ export function cloudSetupPageModel(
rows: readonly CloudSetupStep[],
{ teamSwitch = false }: { teamSwitch?: boolean } = {}
): CloudSetupPageModel {
const steps = rows.filter((step) => step.id !== 'agent')
const steps = withTeamStep(rows.filter((step) => step.id !== 'agent'))
const current = steps.find((step) => step.state !== 'done') ?? null
if (!current) {
return { steps, current: null, action: 'done' }
@@ -100,6 +100,22 @@ export function cloudSetupPageModel(
return { steps, current, action: actionForStep(current, { teamSwitch }) }
}
/**
* The web's stepper (stablyai/orca-cloud#730, DS-b) always lists Team right after Account, so the
* count never changes: a team made for you at sign-in ticks with Account. The rows only carry a
* Team step while a team switch is needed; otherwise it is added here, done once signed in.
*/
function withTeamStep(steps: readonly CloudSetupStep[]): readonly CloudSetupStep[] {
const accountIndex = steps.findIndex((step) => step.id === 'account')
if (accountIndex === -1 || steps.some((step) => step.id === 'team')) {
return steps
}
const account = steps[accountIndex]!
const team: CloudSetupStep =
account.state === 'done' ? { id: 'team', state: 'done' } : { id: 'team', state: 'pending' }
return [...steps.slice(0, accountIndex + 1), team, ...steps.slice(accountIndex + 1)]
}
/** Needs that a browser trip (setup session) can cover, from the current step on. */
export function sessionNeedsFrom(steps: readonly CloudSetupStep[]): CloudSetupStep['id'][] {
return steps
+1 -2
View File
@@ -28276,8 +28276,7 @@
"agent": "Agent",
"github": "GitHub",
"plan": "Plan",
"team": "Team",
"trial": "Trial"
"team": "Team"
},
"stepCurrent": "current step",
"stepDone": "done",