mirror of
https://github.com/stablyai/orca.git
synced 2026-11-19 04:23:57 +00:00
fix(cloud): Start in Orca Cloud premerge fixes (localized copy, no casts, derived draft restore, line limits)
This commit is contained in:
@@ -160,7 +160,7 @@ export function EmptyState({
|
||||
: [
|
||||
t('auto.components.cloudWorkspaces.emptyMineTitle', 'No cloud workspaces yet'),
|
||||
t(
|
||||
'auto.components.cloudWorkspaces.emptyMineBody',
|
||||
'components.cloudWorkspaces.emptyMineStartBody',
|
||||
'Start one and it keeps running while your laptop sleeps.'
|
||||
)
|
||||
]
|
||||
@@ -174,7 +174,7 @@ export function EmptyState({
|
||||
<Button
|
||||
type="button"
|
||||
size="sm"
|
||||
className="mt-3 text-xs"
|
||||
className="mt-3"
|
||||
onClick={() => openNewCloudWorkspace(useAppStore.getState(), 'unknown')}
|
||||
>
|
||||
<Cloud className="size-3.5" />
|
||||
|
||||
@@ -73,7 +73,6 @@ export function LandingCloudCard({
|
||||
<Button
|
||||
type="button"
|
||||
size="sm"
|
||||
className="text-xs"
|
||||
onClick={() => openNewCloudWorkspace(useAppStore.getState(), 'unknown')}
|
||||
>
|
||||
{t('keybindings.title.workspaceCreateCloud', 'New cloud workspace')}
|
||||
@@ -81,7 +80,7 @@ export function LandingCloudCard({
|
||||
<span className="ml-1 text-primary-foreground/70">{shortcut}</span>
|
||||
) : null}
|
||||
</Button>
|
||||
<Button type="button" size="sm" variant="ghost" className="text-xs" onClick={dismiss}>
|
||||
<Button type="button" size="sm" variant="ghost" onClick={dismiss}>
|
||||
{t('components.landing.cloudCard.notNow', 'Not now')}
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
@@ -79,7 +79,7 @@ export function NewWorkspaceComposerFooter({
|
||||
type="button"
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
className="ml-auto text-xs"
|
||||
className="ml-auto"
|
||||
onClick={cloudStart.onUseThisComputer}
|
||||
>
|
||||
{t('components.newWorkspace.cloudStart.useThisComputer', 'Use this computer instead')}
|
||||
|
||||
@@ -14,7 +14,8 @@ import {
|
||||
isCloudSetupPanelVisible,
|
||||
type CloudSetupStep
|
||||
} from './cloud-start-model'
|
||||
import { getCloudPrimaryLabel, type CloudStartView } from './use-cloud-start-composer'
|
||||
import type { CloudStartView } from './use-cloud-start-composer'
|
||||
import { getCloudPrimaryLabel } from './cloud-start-actions'
|
||||
import { NewWorkspaceMoreMenu } from '../../sidebar/NewWorkspaceMoreMenu'
|
||||
import { LandingCloudCard } from '../../landing/LandingCloudCard'
|
||||
import { EmptyState } from '../../cloud-workspaces/CloudWorkspacesStates'
|
||||
|
||||
@@ -73,7 +73,14 @@ function planDetail(step: CloudSetupStep, t: Translate): string | null {
|
||||
return t('components.newWorkspace.cloudSetup.spendCap', 'Spend cap reached.') + memberSuffix
|
||||
case 'payment':
|
||||
return t('components.newWorkspace.cloudSetup.paymentFailed', 'Payment failed.') + memberSuffix
|
||||
default:
|
||||
case 'github':
|
||||
return t(
|
||||
'components.newWorkspace.cloudSetup.githubNeeded',
|
||||
'Orca Cloud clones your code from GitHub. Give access to this repository once.'
|
||||
)
|
||||
case 'sign-in':
|
||||
case 'plan':
|
||||
case undefined:
|
||||
return step.canFix === false
|
||||
? t(
|
||||
'components.newWorkspace.cloudSetup.planMember',
|
||||
|
||||
@@ -26,7 +26,7 @@ export type RunOnSegmentedControlProps = RunTargetComboboxProps & {
|
||||
|
||||
/** ⌥⌘1 / ⌥⌘2 (Ctrl+Alt on Windows/Linux) while the composer is open (spec D1, N8). */
|
||||
export function matchRunOnShortcut(
|
||||
event: KeyboardEvent,
|
||||
event: Pick<KeyboardEvent, 'metaKey' | 'ctrlKey' | 'altKey' | 'shiftKey' | 'code'>,
|
||||
mac: boolean
|
||||
): 'local' | 'orca-cloud' | null {
|
||||
const mod = mac ? event.metaKey && !event.ctrlKey : event.ctrlKey && !event.metaKey
|
||||
@@ -153,7 +153,7 @@ export default function RunOnSegmentedControl(
|
||||
label: (
|
||||
<span className="flex items-center gap-1.5">
|
||||
<Cloud className="size-3.5" aria-hidden />
|
||||
Orca Cloud
|
||||
{t('components.newWorkspace.runOn.orcaCloud', 'Orca Cloud')}
|
||||
</span>
|
||||
),
|
||||
disabled: cloudState === 'unreachable',
|
||||
@@ -216,7 +216,7 @@ export default function RunOnSegmentedControl(
|
||||
/>
|
||||
</div>
|
||||
</PopoverAnchor>
|
||||
<PopoverContent align="end" className="w-80 p-2" data-run-on-more="true">
|
||||
<PopoverContent align="end" className="w-80" data-run-on-more="true">
|
||||
<RunTargetCombobox
|
||||
{...props}
|
||||
recipes={otherRecipes}
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
// What the "Start in Orca Cloud" primary button says, and the fix one click runs before a session
|
||||
// exists (sign in first, else the plan/billing action).
|
||||
import { translate } from '@/i18n/i18n'
|
||||
import type { OrcaCloudAvailability } from '../../../../../shared/orca-yaml-hook-types'
|
||||
import { getOrcaCloudPick, type OrcaCloudRunTargetAccess } from '../orca-cloud-run-target-access'
|
||||
import type { CloudPrimaryAction, CloudSetupStep } from './cloud-start-model'
|
||||
|
||||
export function getCloudPrimaryLabel(action: CloudPrimaryAction): string {
|
||||
switch (action) {
|
||||
case 'start':
|
||||
return translate('components.newWorkspace.cloudStart.start', 'Start in Orca Cloud')
|
||||
case 'setUpAndStart':
|
||||
return translate('components.newWorkspace.cloudStart.setUpAndStart', 'Set up and start')
|
||||
case 'choosePlanAndStart':
|
||||
return translate(
|
||||
'components.newWorkspace.cloudStart.choosePlanAndStart',
|
||||
'Choose plan and start'
|
||||
)
|
||||
case 'renewAndStart':
|
||||
return translate('components.newWorkspace.cloudStart.renewAndStart', 'Renew and start')
|
||||
case 'giveAccessAndStart':
|
||||
return translate(
|
||||
'components.newWorkspace.cloudStart.giveAccessAndStart',
|
||||
'Give access and start'
|
||||
)
|
||||
case 'useThisComputer':
|
||||
return translate(
|
||||
'components.newWorkspace.cloudStart.useThisComputer',
|
||||
'Use this computer instead'
|
||||
)
|
||||
case 'checking':
|
||||
return translate('components.newWorkspace.cloudStart.checking', 'Checking Orca Cloud…')
|
||||
}
|
||||
}
|
||||
|
||||
/** The fix one click on the primary button runs: sign in first, else the plan/billing action. */
|
||||
export function setupActionFor(
|
||||
steps: readonly CloudSetupStep[],
|
||||
access: OrcaCloudRunTargetAccess,
|
||||
availability: OrcaCloudAvailability
|
||||
): (() => void) | null {
|
||||
if (steps.some((step) => step.id === 'account' && step.state === 'needed')) {
|
||||
const pick = getOrcaCloudPick({ state: 'signed-out' })
|
||||
return pick.kind === 'act' ? pick.run : null
|
||||
}
|
||||
const effective: OrcaCloudRunTargetAccess =
|
||||
availability === 'needs-capability' && access.state !== 'no-plan'
|
||||
? { state: 'no-plan', lapsed: false, canManageBilling: true }
|
||||
: access
|
||||
const pick = getOrcaCloudPick(effective)
|
||||
return pick.kind === 'act' ? pick.run : null
|
||||
}
|
||||
@@ -57,8 +57,19 @@ describe('Run on segment', () => {
|
||||
})
|
||||
|
||||
it('matches ⌥⌘1 / ⌥⌘2 on mac and Ctrl+Alt elsewhere', () => {
|
||||
const key = (init: Partial<KeyboardEvent>): KeyboardEvent =>
|
||||
({ metaKey: false, ctrlKey: false, altKey: false, shiftKey: false, ...init }) as KeyboardEvent
|
||||
const key = (init: {
|
||||
code: string
|
||||
metaKey?: boolean
|
||||
ctrlKey?: boolean
|
||||
altKey?: boolean
|
||||
shiftKey?: boolean
|
||||
}) => ({
|
||||
metaKey: false,
|
||||
ctrlKey: false,
|
||||
altKey: false,
|
||||
shiftKey: false,
|
||||
...init
|
||||
})
|
||||
expect(matchRunOnShortcut(key({ code: 'Digit1', metaKey: true, altKey: true }), true)).toBe(
|
||||
'local'
|
||||
)
|
||||
|
||||
@@ -2,9 +2,11 @@
|
||||
// setup instead of a build that billing would refuse, starts by itself once setup finishes, keeps
|
||||
// the draft on disk, and remembers where each project last started.
|
||||
import { useCallback, useEffect, useMemo, useRef, useState, useSyncExternalStore } from 'react'
|
||||
import { translate } from '@/i18n/i18n'
|
||||
import { useAppStore } from '@/store/index'
|
||||
import type { ReadyProjectHostSetupOption } from '@/lib/project-host-setup-options'
|
||||
import type {
|
||||
ProjectHostSetupOption,
|
||||
ReadyProjectHostSetupOption
|
||||
} from '@/lib/project-host-setup-options'
|
||||
import {
|
||||
clearCloudStartDraft,
|
||||
readCloudStartDraft,
|
||||
@@ -15,15 +17,16 @@ import {
|
||||
CLOUD_SETUP_AUTO_START,
|
||||
getCloudSetupStarter,
|
||||
readCloudSetupSession,
|
||||
subscribeCloudSetupSession
|
||||
getCloudSetupSessionRevision,
|
||||
subscribeCloudSetupSessionRevision
|
||||
} from '@/lib/orca-cloud/cloud-setup-session-seam'
|
||||
import { readRunOnMemory, recordSuccessfulRunOn } from '@/lib/orca-cloud/run-on-memory'
|
||||
import { LOCAL_EXECUTION_HOST_ID } from '../../../../../shared/execution-host'
|
||||
import { ORCA_CLOUD_RECIPE_ID } from '../../../../../shared/hosted-sandbox/orca-cloud-recipe-id'
|
||||
import type { OrcaCloudAvailability } from '../../../../../shared/orca-yaml-hook-types'
|
||||
import type { ProjectHostSetupOption } from '@/lib/project-host-setup-options'
|
||||
import { useOrcaCloudRunTargetAccess } from '../orca-cloud-billing-cache'
|
||||
import { getOrcaCloudPick, type OrcaCloudRunTargetAccess } from '../orca-cloud-run-target-access'
|
||||
import type { OrcaCloudRunTargetAccess } from '../orca-cloud-run-target-access'
|
||||
import { getCloudPrimaryLabel, setupActionFor } from './cloud-start-actions'
|
||||
import {
|
||||
deriveCloudSetupSteps,
|
||||
getCloudPrimaryAction,
|
||||
@@ -31,7 +34,6 @@ import {
|
||||
getOrcaCloudSegmentState,
|
||||
isCloudSetupPanelVisible,
|
||||
resolveDefaultRunOn,
|
||||
type CloudPrimaryAction,
|
||||
type CloudSetupStep
|
||||
} from './cloud-start-model'
|
||||
|
||||
@@ -46,52 +48,6 @@ export type CloudStartView = {
|
||||
onUseThisComputer?: () => void
|
||||
}
|
||||
|
||||
export function getCloudPrimaryLabel(action: CloudPrimaryAction): string {
|
||||
switch (action) {
|
||||
case 'start':
|
||||
return translate('components.newWorkspace.cloudStart.start', 'Start in Orca Cloud')
|
||||
case 'setUpAndStart':
|
||||
return translate('components.newWorkspace.cloudStart.setUpAndStart', 'Set up and start')
|
||||
case 'choosePlanAndStart':
|
||||
return translate(
|
||||
'components.newWorkspace.cloudStart.choosePlanAndStart',
|
||||
'Choose plan and start'
|
||||
)
|
||||
case 'renewAndStart':
|
||||
return translate('components.newWorkspace.cloudStart.renewAndStart', 'Renew and start')
|
||||
case 'giveAccessAndStart':
|
||||
return translate(
|
||||
'components.newWorkspace.cloudStart.giveAccessAndStart',
|
||||
'Give access and start'
|
||||
)
|
||||
case 'useThisComputer':
|
||||
return translate(
|
||||
'components.newWorkspace.cloudStart.useThisComputer',
|
||||
'Use this computer instead'
|
||||
)
|
||||
case 'checking':
|
||||
return translate('components.newWorkspace.cloudStart.checking', 'Checking Orca Cloud…')
|
||||
}
|
||||
}
|
||||
|
||||
/** The fix one click on the primary button runs: sign in first, else the plan/billing action. */
|
||||
function setupActionFor(
|
||||
steps: readonly CloudSetupStep[],
|
||||
access: OrcaCloudRunTargetAccess,
|
||||
availability: OrcaCloudAvailability
|
||||
): (() => void) | null {
|
||||
if (steps.some((step) => step.id === 'account' && step.state === 'needed')) {
|
||||
const pick = getOrcaCloudPick({ state: 'signed-out' })
|
||||
return pick.kind === 'act' ? pick.run : null
|
||||
}
|
||||
const effective: OrcaCloudRunTargetAccess =
|
||||
availability === 'needs-capability' && access.state !== 'no-plan'
|
||||
? { state: 'no-plan', lapsed: false, canManageBilling: true }
|
||||
: access
|
||||
const pick = getOrcaCloudPick(effective)
|
||||
return pick.kind === 'act' ? pick.run : null
|
||||
}
|
||||
|
||||
function prefersReducedMotion(): boolean {
|
||||
return (
|
||||
typeof window !== 'undefined' &&
|
||||
@@ -99,17 +55,6 @@ function prefersReducedMotion(): boolean {
|
||||
)
|
||||
}
|
||||
|
||||
let sessionRevision = 0
|
||||
function subscribeSessionRevision(listener: () => void): () => void {
|
||||
return subscribeCloudSetupSession(() => {
|
||||
sessionRevision += 1
|
||||
listener()
|
||||
})
|
||||
}
|
||||
function getSessionRevision(): number {
|
||||
return sessionRevision
|
||||
}
|
||||
|
||||
export function useCloudStartComposer({
|
||||
active,
|
||||
availability,
|
||||
@@ -154,10 +99,18 @@ export function useCloudStartComposer({
|
||||
const cloudSelected = selectedRecipeId === ORCA_CLOUD_RECIPE_ID
|
||||
const fetched = useOrcaCloudRunTargetAccess(segment === 'enabled' && !accessOverride)
|
||||
const access = accessOverride ?? fetched
|
||||
const [setupSessionId, setSetupSessionId] = useState<string | null>(null)
|
||||
// Re-read the session after each poll; the poller notifies through the seam.
|
||||
const [startedSessionId, setSetupSessionId] = useState<string | null>(null)
|
||||
// A composer reopened after setup (e.g. the Checkout return) resumes its saved draft: derived,
|
||||
// not copied into state, so it is right on the first render.
|
||||
const restoredDraft = useMemo(
|
||||
() => (active && cloudSelected ? readCloudStartDraft(profileId) : null),
|
||||
[active, cloudSelected, profileId]
|
||||
)
|
||||
const [restoreDone, setRestoreDone] = useState(false)
|
||||
const restored = restoredDraft !== null && restoredDraft.repoId === repoId && !restoreDone
|
||||
const setupSessionId = startedSessionId ?? (restored ? restoredDraft.setupSessionId : null)
|
||||
// Subscribing re-renders on each poll; the read itself is a cheap synchronous lookup.
|
||||
useSyncExternalStore(subscribeSessionRevision, getSessionRevision)
|
||||
useSyncExternalStore(subscribeCloudSetupSessionRevision, getCloudSetupSessionRevision)
|
||||
const session = readCloudSetupSession(setupSessionId)
|
||||
const steps = useMemo(
|
||||
() => session?.steps ?? deriveCloudSetupSteps({ availability, access }),
|
||||
@@ -206,25 +159,26 @@ export function useCloudStartComposer({
|
||||
}, [setRecipeId])
|
||||
|
||||
// "Use this computer instead": switch, then submit once the switch has rendered.
|
||||
const [localSubmitPending, setLocalSubmitPending] = useState(false)
|
||||
const localSubmitPendingRef = useRef(false)
|
||||
const useThisComputer = useCallback(() => {
|
||||
if (!localOption) {
|
||||
return
|
||||
}
|
||||
touchedRef.current = true
|
||||
localSubmitPendingRef.current = true
|
||||
setRecipeId?.(null)
|
||||
onHostChange?.(localOption.id)
|
||||
setLocalSubmitPending(true)
|
||||
}, [localOption, onHostChange, setRecipeId])
|
||||
useEffect(() => {
|
||||
if (localSubmitPending && !cloudSelected) {
|
||||
setLocalSubmitPending(false)
|
||||
if (localSubmitPendingRef.current && !cloudSelected) {
|
||||
localSubmitPendingRef.current = false
|
||||
onCreate()
|
||||
}
|
||||
}, [cloudSelected, localSubmitPending, onCreate])
|
||||
}, [cloudSelected, onCreate])
|
||||
|
||||
// Setup started from this composer: when every required row is done, say "All set" and start.
|
||||
const [setupStarted, setSetupStarted] = useState(false)
|
||||
const [startedHere, setSetupStarted] = useState(false)
|
||||
const setupStarted = startedHere || restored
|
||||
const [allSet, setAllSet] = useState(false)
|
||||
useEffect(() => {
|
||||
const done = action === 'start' || session?.finished === true
|
||||
@@ -235,6 +189,7 @@ export function useCloudStartComposer({
|
||||
const timer = window.setTimeout(
|
||||
() => {
|
||||
setSetupStarted(false)
|
||||
setRestoreDone(true)
|
||||
setAllSet(false)
|
||||
onCreate()
|
||||
},
|
||||
@@ -275,20 +230,6 @@ export function useCloudStartComposer({
|
||||
.catch(() => fallback?.())
|
||||
}, [access, agent, availability, profileId, prompt, repoId, setupSessionId, steps])
|
||||
|
||||
// A composer reopened after setup (e.g. the Checkout return) gets its prompt back.
|
||||
const restoredRef = useRef(false)
|
||||
useEffect(() => {
|
||||
if (restoredRef.current || !active || !cloudSelected) {
|
||||
return
|
||||
}
|
||||
restoredRef.current = true
|
||||
const draft = readCloudStartDraft(profileId)
|
||||
if (draft && draft.repoId === repoId) {
|
||||
setSetupSessionId(draft.setupSessionId)
|
||||
setSetupStarted(true)
|
||||
}
|
||||
}, [active, cloudSelected, profileId, repoId])
|
||||
|
||||
const recordCreated = useCallback(() => {
|
||||
if (!repoId) {
|
||||
return
|
||||
|
||||
@@ -18,7 +18,12 @@ export function getRepositoryRunOnSearchEntry(): SettingsSearchEntry {
|
||||
'components.settings.repository.runOn.description',
|
||||
'Where new workspaces in this project start. Orca Cloud is used only when it can start.'
|
||||
),
|
||||
keywords: ['run on', 'orca cloud', 'this computer', 'default']
|
||||
keywords: [
|
||||
translate('components.settings.repository.runOn.keywordRunOn', 'run on'),
|
||||
translate('components.settings.repository.runOn.keywordCloud', 'orca cloud'),
|
||||
translate('components.settings.repository.runOn.keywordThisComputer', 'this computer'),
|
||||
translate('components.settings.repository.runOn.keywordDefault', 'default')
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,7 +72,10 @@ export function RepositoryRunOnSection({
|
||||
value: 'local',
|
||||
label: translate('components.newWorkspace.runOn.thisComputer', 'This computer')
|
||||
},
|
||||
{ value: 'orca-cloud', label: 'Orca Cloud' }
|
||||
{
|
||||
value: 'orca-cloud',
|
||||
label: translate('components.newWorkspace.runOn.orcaCloud', 'Orca Cloud')
|
||||
}
|
||||
]}
|
||||
/>
|
||||
</SearchableSetting>
|
||||
|
||||
@@ -32,10 +32,10 @@ export function NewWorkspaceMoreMenu({
|
||||
<DropdownMenu>
|
||||
<DropdownMenuTrigger asChild>
|
||||
<Button
|
||||
variant="ghost"
|
||||
variant="quiet"
|
||||
size="icon-xs"
|
||||
type="button"
|
||||
className="-ml-1 w-4 text-muted-foreground"
|
||||
className="-ml-1 w-4"
|
||||
aria-label={t('components.sidebar.newWorkspaceMore', 'More ways to create')}
|
||||
data-workspace-board-preserve-open={preserveWorkspaceBoardOpen ? '' : undefined}
|
||||
>
|
||||
|
||||
@@ -1376,7 +1376,8 @@
|
||||
"copy": "Copy",
|
||||
"selectAll": "Select All",
|
||||
"quitAndStopAllSessions": "Quit Completely...",
|
||||
"quitAndStopAllSessionsTooltip": "Also stops every terminal session, including running agents. Plain Quit keeps them running so Orca reattaches on next launch."
|
||||
"quitAndStopAllSessionsTooltip": "Also stops every terminal session, including running agents. Plain Quit keeps them running so Orca reattaches on next launch.",
|
||||
"newCloudWorkspace": "New cloud workspace"
|
||||
},
|
||||
"tray": {
|
||||
"openOrca": "Open Orca",
|
||||
@@ -20765,7 +20766,6 @@
|
||||
"emptyArchivedTitle": "No archived workspaces",
|
||||
"emptyFilteredBody": "Try another owner or repository.",
|
||||
"emptyFilteredTitle": "Nothing matches these filters",
|
||||
"emptyMineBody": "Create one with Orca Cloud from New workspace. It keeps running while your laptop sleeps.",
|
||||
"emptyMineTitle": "No cloud workspaces yet",
|
||||
"emptyTeamBody": "Share a cloud workspace from its menu and everyone on your team can open it here.",
|
||||
"emptyTeamTitle": "No team workspaces yet",
|
||||
@@ -22893,6 +22893,17 @@
|
||||
},
|
||||
"repositoryHooks": {
|
||||
"availableEnvVars": "Available environment variables"
|
||||
},
|
||||
"repository": {
|
||||
"runOn": {
|
||||
"title": "Default run on",
|
||||
"description": "Where new workspaces in this project start. Orca Cloud is used only when it can start.",
|
||||
"keywordRunOn": "run on",
|
||||
"keywordCloud": "orca cloud",
|
||||
"keywordThisComputer": "this computer",
|
||||
"keywordDefault": "default",
|
||||
"last": "Last used"
|
||||
}
|
||||
}
|
||||
},
|
||||
"agentChildRow": {
|
||||
@@ -22944,6 +22955,54 @@
|
||||
"yamlSource": "orca.yaml",
|
||||
"bothSources": "orca.yaml + local",
|
||||
"localSource": "local settings"
|
||||
},
|
||||
"cloudStart": {
|
||||
"useThisComputer": "Use this computer instead",
|
||||
"start": "Start in Orca Cloud",
|
||||
"setUpAndStart": "Set up and start",
|
||||
"choosePlanAndStart": "Choose plan and start",
|
||||
"renewAndStart": "Renew and start",
|
||||
"giveAccessAndStart": "Give access and start",
|
||||
"checking": "Checking Orca Cloud…"
|
||||
},
|
||||
"cloudSetup": {
|
||||
"account": "Orca account",
|
||||
"accountNeeded": "Sign in or create one",
|
||||
"team": "Team",
|
||||
"plan": "Team plan",
|
||||
"github": "GitHub access",
|
||||
"githubNeeded": "Orca Cloud clones your code from GitHub. Give access to this repository once.",
|
||||
"agent": "Agent",
|
||||
"agentLater": "Sign in once the workspace starts",
|
||||
"planAfterSignIn": "Checked after you sign in",
|
||||
"askOwner": "Ask an owner or admin to fix it.",
|
||||
"planEnded": "Your Team plan ended.",
|
||||
"outOfHours": "Out of sandbox hours.",
|
||||
"spendCap": "Spend cap reached.",
|
||||
"paymentFailed": "Payment failed.",
|
||||
"planMember": "Orca Cloud needs a Team plan. Only owners and admins can choose one.",
|
||||
"planNeeded": "Orca Cloud needs a Team plan.",
|
||||
"stateDone": "Done",
|
||||
"stateOptional": "Optional",
|
||||
"stateNext": "Next",
|
||||
"stateInBrowser": "In browser",
|
||||
"stateFailed": "Didn't finish",
|
||||
"stateChecking": "Checking",
|
||||
"stateNeeded": "Needed",
|
||||
"allSet": "All set",
|
||||
"title": "Set up Orca Cloud",
|
||||
"starting": "Starting your cloud workspace…",
|
||||
"subtitle": "One visit to your browser. Your prompt stays here and starts when you’re done."
|
||||
},
|
||||
"runOn": {
|
||||
"cloudUnreachable": "Can't reach Orca Cloud right now. Check your connection.",
|
||||
"thisComputer": "This computer",
|
||||
"thisComputerTooltip": "{{machine}} · {{shortcut}}",
|
||||
"noLocalCheckout": "This project has no location on this computer.",
|
||||
"orcaCloud": "Orca Cloud",
|
||||
"cloudTooltip": "Hosted sandbox · {{shortcut}}",
|
||||
"moreWithTarget": "More places to run: {{name}}",
|
||||
"more": "More places to run"
|
||||
}
|
||||
},
|
||||
"JiraIssueWorkspace": {
|
||||
@@ -23296,6 +23355,30 @@
|
||||
"showMore_one": "Show {{count}} more",
|
||||
"showMore_other": "Show {{count}} more"
|
||||
}
|
||||
},
|
||||
"landing": {
|
||||
"cloudCard": {
|
||||
"title": "Run agents in Orca Cloud",
|
||||
"body": "Hosted sandboxes keep running while your laptop sleeps. Start one from any project.",
|
||||
"notNow": "Not now"
|
||||
}
|
||||
},
|
||||
"cmdJ": {
|
||||
"newCloudWorkspace": {
|
||||
"description": "Start a workspace in Orca Cloud.",
|
||||
"verbs": {
|
||||
"newCloud": "new cloud workspace",
|
||||
"orcaCloud": "orca cloud",
|
||||
"sandbox": "sandbox"
|
||||
}
|
||||
}
|
||||
},
|
||||
"sidebar": {
|
||||
"newWorkspaceMore": "More ways to create",
|
||||
"newWorkspaceLocal": "New workspace on this computer"
|
||||
},
|
||||
"cloudWorkspaces": {
|
||||
"emptyMineStartBody": "Start one and it keeps running while your laptop sleeps."
|
||||
}
|
||||
},
|
||||
"dashboardPopout": {
|
||||
@@ -25297,7 +25380,8 @@
|
||||
"1524825c2c": "Toggle workspace board",
|
||||
"d286d1ab85": "Clear pane title",
|
||||
"cloudWorkspaceCopyLink": "Copy cloud workspace link",
|
||||
"workspaceRun": "Run or restart the run action"
|
||||
"workspaceRun": "Run or restart the run action",
|
||||
"workspaceCreateCloud": "New cloud workspace"
|
||||
},
|
||||
"group": {
|
||||
"global": "Global",
|
||||
|
||||
@@ -65,3 +65,15 @@ export function subscribeCloudSetupSession(listener: () => void): () => void {
|
||||
listeners.add(listener)
|
||||
return () => listeners.delete(listener)
|
||||
}
|
||||
|
||||
let revision = 0
|
||||
/** useSyncExternalStore pair: each poll bumps the revision so composers re-read their session. */
|
||||
export function subscribeCloudSetupSessionRevision(listener: () => void): () => void {
|
||||
return subscribeCloudSetupSession(() => {
|
||||
revision += 1
|
||||
listener()
|
||||
})
|
||||
}
|
||||
export function getCloudSetupSessionRevision(): number {
|
||||
return revision
|
||||
}
|
||||
|
||||
@@ -46,7 +46,11 @@ export function readCloudStartDraft(
|
||||
if (!raw) {
|
||||
return null
|
||||
}
|
||||
const draft = JSON.parse(raw) as Partial<CloudStartDraft>
|
||||
const parsed: unknown = JSON.parse(raw)
|
||||
if (typeof parsed !== 'object' || parsed === null) {
|
||||
return null
|
||||
}
|
||||
const draft: Partial<Record<keyof CloudStartDraft, unknown>> = parsed
|
||||
if (
|
||||
typeof draft.prompt !== 'string' ||
|
||||
typeof draft.repoId !== 'string' ||
|
||||
|
||||
@@ -28,25 +28,33 @@ const isTarget = (value: unknown): value is RunOnTarget =>
|
||||
const isPreference = (value: unknown): value is RunOnPreference =>
|
||||
value === 'last' || isTarget(value)
|
||||
|
||||
function asRecord(value: unknown): Record<string, unknown> {
|
||||
return typeof value === 'object' && value !== null ? { ...value } : {}
|
||||
}
|
||||
|
||||
function read(profileId: string | null, storage: Storage | undefined): RunOnMemory {
|
||||
try {
|
||||
const raw = storage?.getItem(storageKey(profileId))
|
||||
if (!raw) {
|
||||
return empty()
|
||||
}
|
||||
const parsed = JSON.parse(raw) as Partial<RunOnMemory>
|
||||
const parsed: unknown = JSON.parse(raw)
|
||||
if (typeof parsed !== 'object' || parsed === null) {
|
||||
return empty()
|
||||
}
|
||||
const record: Partial<Record<keyof RunOnMemory, unknown>> = parsed
|
||||
const memory = empty()
|
||||
for (const [repoId, target] of Object.entries(parsed.lastByRepo ?? {})) {
|
||||
for (const [repoId, target] of Object.entries(asRecord(record.lastByRepo))) {
|
||||
if (isTarget(target)) {
|
||||
memory.lastByRepo[repoId] = target
|
||||
}
|
||||
}
|
||||
for (const [repoId, preference] of Object.entries(parsed.preferenceByRepo ?? {})) {
|
||||
for (const [repoId, preference] of Object.entries(asRecord(record.preferenceByRepo))) {
|
||||
if (isPreference(preference)) {
|
||||
memory.preferenceByRepo[repoId] = preference
|
||||
}
|
||||
}
|
||||
memory.globalLast = isTarget(parsed.globalLast) ? parsed.globalLast : null
|
||||
memory.globalLast = isTarget(record.globalLast) ? record.globalLast : null
|
||||
return memory
|
||||
} catch {
|
||||
return empty()
|
||||
|
||||
Reference in New Issue
Block a user