Merge pull request #271 from nwparker/cloud/w2-np5-icon-rule

feat(cloud): cloud icon rule — one host glyph, state as a badge (NP-5)
This commit is contained in:
Neil
2026-11-10 07:16:22 -08:00
committed by GitHub
29 changed files with 827 additions and 125 deletions
@@ -1,5 +1,7 @@
import React, { useCallback, useMemo } from 'react'
import { Cloud, Copy, FolderGit2, GitBranch, Laptop, LocateFixed, Server } from 'lucide-react'
import { useIsCloudWorkspace } from '@/lib/orca-cloud/orca-cloud-workspace-store'
import { WorkspaceHostGlyph } from '@/components/orca-cloud/WorkspaceHostGlyph'
import { Copy, FolderGit2, GitBranch, LocateFixed } from 'lucide-react'
import { toast } from 'sonner'
import { useAppStore } from '@/store'
import { RepoBadgeMark } from '@/components/repo/RepoBadgeLabel'
@@ -47,6 +49,7 @@ export function ActivityThreadHoverCardSummary({
}): React.JSX.Element {
const t = useTranslate()
const { worktree, repo } = thread
const isCloud = useIsCloudWorkspace(worktree.id)
const sshTargetLabels = useAppStore((s) => s.sshTargetLabels)
const runtimeEnvironments = useAppStore((s) => s.runtimeEnvironments)
const executionHostId = getWorktreeExecutionHostId(worktree, repo ?? undefined)
@@ -210,14 +213,14 @@ export function ActivityThreadHoverCardSummary({
) : null}
<div className="flex min-w-0 items-center gap-1.5 text-[11px] text-muted-foreground">
{parsedHost?.kind === 'runtime' ? (
<Cloud className="size-3 shrink-0" />
) : parsedHost?.kind === 'ssh' ? (
<Server className="size-3 shrink-0" />
) : (
<Laptop className="size-3 shrink-0" />
)}
<span className="truncate font-medium">{hostDisplayLabel}</span>
<WorkspaceHostGlyph
worktreeId={worktree.id}
hostId={executionHostId}
badgeRingClassName="bg-popover"
/>
<span className="truncate font-medium">
{isCloud ? t('orcaCloudWorkspace.productName', 'Orca Cloud') : hostDisplayLabel}
</span>
</div>
{worktree.path ? (
+82 -1
View File
@@ -1,7 +1,88 @@
import React from 'react'
import { Monitor, Server } from 'lucide-react'
import { Box, Cloud, Monitor, Server } from 'lucide-react'
import { cn } from '@/lib/utils'
import type { CloudDotState } from '@/lib/orca-cloud/orca-cloud-workspace-state'
import { CloudStateDot } from '@/components/orca-cloud/CloudStateDot'
import { LOCAL_EXECUTION_HOST_ID, type ExecutionHostId } from '../../../shared/execution-host'
import type { ExecutionHostVmState } from '../../../shared/execution-host/execution-host-health'
/** Where a workspace runs. Cloud means Orca Cloud and nothing else; recipe VMs are a Box. */
export type HostGlyphKind = 'local' | 'ssh' | 'orca-server' | 'recipe-vm' | 'orca-cloud'
const GLYPH: Record<HostGlyphKind, typeof Cloud> = {
local: Monitor,
ssh: Server,
'orca-server': Server,
'recipe-vm': Box,
'orca-cloud': Cloud
}
const SIZE = { 12: 'size-3', 14: 'size-3.5', 16: 'size-4' } as const
/**
* The one host glyph every surface puts before a workspace name: always muted, never swapped by
* state. Lifecycle state rides on it as a CloudStateDot corner badge, so the glyph keeps its shape.
*/
export function HostGlyph({
kind,
size = 12,
state,
badgeRingClassName = 'bg-worktree-sidebar',
className,
label
}: {
kind: HostGlyphKind
size?: 12 | 14 | 16
state?: CloudDotState | null
/** The badge sits in a ring of the surface's background; pass that background here. */
badgeRingClassName?: string
className?: string
/** Accessible name, only where no adjacent text names the host. */
label?: string
}): React.JSX.Element {
const Icon = GLYPH[kind]
return (
<span
data-host-glyph={kind}
role={label ? 'img' : undefined}
aria-label={label}
aria-hidden={label ? undefined : true}
className={cn('relative inline-flex shrink-0 text-muted-foreground', SIZE[size], className)}
>
<Icon className={SIZE[size]} aria-hidden="true" />
{state ? (
<span
className={cn(
'absolute -right-1 -bottom-1 inline-flex items-center justify-center rounded-full',
size === 12 ? 'size-2.5' : 'size-[11px]',
badgeRingClassName
)}
>
<CloudStateDot state={state} size={size === 12 ? 'badge' : 'md'} />
</span>
) : null}
</span>
)
}
/** A recipe VM's lifecycle on the same dot vocabulary as Orca Cloud (null = running). */
export function vmStateToDot(state: ExecutionHostVmState | null): CloudDotState {
switch (state) {
case 'provisioning':
return 'starting'
case 'suspended':
return 'sleeping'
case 'waking':
return 'waking'
case 'resume_failed':
return 'wakeFailed'
case 'provision_failed':
return 'failed'
case null:
return 'running'
}
}
/** The local machine isn't a server — a monitor glyph reads as "this computer". */
export function HostRowIcon({
@@ -1,5 +1,7 @@
import { useMemo } from 'react'
import { Folder, GitBranch, GitCommitHorizontal, Server } from 'lucide-react'
import { useIsCloudWorkspace } from '@/lib/orca-cloud/orca-cloud-workspace-store'
import { WorkspaceHostGlyph } from '@/components/orca-cloud/WorkspaceHostGlyph'
import { Folder, GitBranch, GitCommitHorizontal } from 'lucide-react'
import { useShallow } from 'zustand/react/shallow'
import { toast } from 'sonner'
import { useAppStore } from '@/store'
@@ -53,6 +55,7 @@ export function NativeChatComposerWorkspace({
head
} = useAppStore(useShallow(selector))
const isCloud = useIsCloudWorkspace(rowWorktreeId)
const identity = getWorktreeGitIdentityDisplay({ branch, head })
const label =
identity?.kind === 'branch'
@@ -125,8 +128,14 @@ export function NativeChatComposerWorkspace({
: 'hidden min-w-0 max-w-40 shrink items-center gap-1 @sm:flex'
}
>
<Server className="size-3 shrink-0" aria-hidden />
{hostId === 'local' ? (
<WorkspaceHostGlyph
worktreeId={rowWorktreeId ?? ''}
hostId={hostId}
badgeRingClassName="bg-chat-canvas"
/>
{isCloud ? (
<span className={FOOTER_TEXT}>{t('orcaCloudWorkspace.productName', 'Orca Cloud')}</span>
) : hostId === 'local' ? (
<LocalMachineName name={machine ?? ''} />
) : (
<span className={FOOTER_TEXT} title={machine}>
@@ -1,8 +1,8 @@
import React, { useMemo, useState } from 'react'
import {
Archive,
ArchiveRestore,
ChevronRight,
Cloud,
File,
Folder,
GitPullRequest,
@@ -208,7 +208,7 @@ export function CloudArchivedWorkspaceView({
>
<div className="mx-auto flex max-w-3xl flex-col gap-6 px-6 py-8">
<CloudWorkspaceHeader
icon={Archive}
icon={Cloud}
title={workspaceName ?? t('orcaCloudWorkspace.archived.title', 'Archived workspace')}
state="archived"
stateLine={stateLine}
@@ -0,0 +1,165 @@
import { getDefaultSettings } from '../../../../shared/constants'
import type { Repo } from '../../../../shared/repo-types'
import { defineFixture } from '../../component-fixtures/component-fixture'
import { seedCloudWorkspaceSnapshot } from '@/lib/orca-cloud/orca-cloud-workspace-store'
import type { PendingWorktreeCreation } from '@/lib/workspace/creation/pending-worktree-creation'
import type { HostedWorkspaceStatus } from '../../../../shared/hosted-sandbox/hosted-sandbox-wire'
import { Command, CommandList } from '../ui/command'
import { PendingWorktreeRow } from '../sidebar/worktree-list/rows/PendingWorktreeRow'
import { WorktreeJumpPaletteWorktreeRow } from '../worktree-jump/worktree-jump-palette-worktree-row'
import type { WorktreeJumpPaletteController } from '../worktree-jump/use-worktree-jump-palette-controller'
import type { WorktreePaletteItem } from '../worktree-jump/worktree-jump-palette-model'
import { makeRepo, makeWorktree } from '../worktree-jump/worktree-jump-palette-test-fixtures'
import { NativeChatComposerWorkspace } from '../native-chat/composer/controls/NativeChatComposerWorkspace'
const repo: Repo = { ...makeRepo(), displayName: 'orca' }
const cloudRow = makeWorktree('cloud-asleep', 'Support excalidraw files', {
branch: 'refs/heads/support-excalidraw'
})
const cloudRunning = makeWorktree('cloud-running', 'Fix auth redirect', {
branch: 'refs/heads/fix-auth-redirect'
})
const localRow = makeWorktree('local-a', 'Tidy settings copy', { branch: 'refs/heads/tidy' })
const status = (state: HostedWorkspaceStatus['state']): HostedWorkspaceStatus => ({
state,
metrics: null,
uptimeMs: null,
usage: { totalMs: 3_600_000, centsPerHour: 100, costCents: 100 },
archive: null,
checkedAt: Date.now()
})
function seedCloud(): void {
const entries = { 'cloud-asleep': status('sleeping'), 'cloud-running': status('ready') }
seedCloudWorkspaceSnapshot({
ids: new Set(Object.keys(entries)),
idsLoaded: true,
status: Object.fromEntries(
Object.entries(entries).map(([id, value]) => [
id,
{ status: value, loading: false, error: null, fetchedAt: Date.now() }
])
)
})
}
const request = (name: string): PendingWorktreeCreation['request'] =>
// oxlint-disable-next-line typescript/consistent-type-assertions -- SAFETY: the pending row reads only these fields.
({
repoId: repo.id,
name,
displayName: name,
ephemeralVmRecipe: {
sourceRepoId: repo.id,
recipeId: 'orca-cloud',
projectId: 'proj-1',
provider: 'orca-cloud'
}
}) as unknown as PendingWorktreeCreation['request']
const creation = (
creationId: string,
name: string,
over: Partial<PendingWorktreeCreation> = {}
): PendingWorktreeCreation => ({
creationId,
phase: 'provisioning-vm',
status: 'creating',
startedAt: Date.now() - 18_000,
indeterminate: true,
loaderVisible: false,
request: request(name),
...over
})
/** Creating an Orca Cloud workspace: the Cloud glyph from the first frame, starting / failed badge. */
export const creatingCloudRow = defineFixture({
width: 300,
store: {
settings: getDefaultSettings('/home/fixture'),
repos: [repo],
pendingWorktreeCreations: {
starting: creation('starting', 'Bump Electron'),
failed: creation('failed', 'Migrate billing', {
status: 'error',
error: 'The sandbox could not start.'
})
}
},
render: () => (
<div className="flex flex-col gap-1 bg-worktree-sidebar p-2 text-worktree-sidebar-foreground">
<PendingWorktreeRow creationId="starting" repoName="orca" />
<PendingWorktreeRow creationId="failed" repoName="orca" />
</div>
)
})
const match = (worktreeId: string): WorktreePaletteItem['match'] => ({
worktreeId,
matchedFields: [],
displayNameRanges: [],
branchRanges: [],
repoRanges: [],
hostRanges: [],
supportingText: null,
qualityClass: null,
rank: null,
lastActiveAt: null,
activity: { ageBucket: null, timestamp: 0 }
})
// oxlint-disable-next-line typescript/consistent-type-assertions -- SAFETY: the row reads only these fields.
const controller = {
repoMap: new Map([[repo.id, repo]]),
repoByHostIdentity: new Map(),
activeWorktreeId: null,
sshConnectionStates: new Map(),
hostOptions: [],
hostFilterActive: false,
hasQuery: false,
lastVisitedAtByWorktreeId: {},
paletteNowMs: Date.now(),
activeWorkspaceExecutionHostId: null,
handleSelectItem: () => {}
} as unknown as WorktreeJumpPaletteController
/** Cmd-J rows: cloud workspaces lead with Cloud + state badge; local shows Monitor once mixed. */
export const paletteRows = defineFixture({
width: 560,
store: { settings: getDefaultSettings('/home/fixture'), repos: [repo] },
setup: seedCloud,
render: () => (
<Command>
<CommandList>
{[cloudRunning, cloudRow, localRow].map((worktree) => (
<WorktreeJumpPaletteWorktreeRow
key={worktree.id}
renderKey={worktree.id}
entry={{ id: worktree.id, type: 'worktree', match: match(worktree.id), worktree }}
controller={controller}
/>
))}
</CommandList>
</Command>
)
})
/** Chat composer footer on a cloud workspace: Cloud glyph + "Orca Cloud", not a Server. */
export const composerFooter = defineFixture({
width: 720,
store: {
settings: getDefaultSettings('/home/fixture'),
repos: [repo],
worktreesByRepo: { [repo.id]: [cloudRow] }
},
setup: seedCloud,
render: () => (
<div className="bg-chat-canvas p-3">
<NativeChatComposerWorkspace
terminalTabId="tab-1"
structuredTransport={{ worktreeId: cloudRow.id, runtimeEnvironmentId: null }}
/>
</div>
)
})
@@ -1,7 +1,7 @@
// "Move to this computer" body: confirm what moves, the steps with elapsed time, then the result.
// A plain view (fixtures render it inline); CloudMoveToComputerDialog wraps it in the app's Dialog.
import React, { useRef } from 'react'
import { AlertTriangle, Check, Circle, Laptop, Loader2 } from 'lucide-react'
import { AlertTriangle, Check, Circle, Loader2, Monitor } from 'lucide-react'
import { Button } from '@/components/ui/button'
import { Checkbox } from '@/components/ui/checkbox'
import { InlineError } from '@/components/ui/inline-error'
@@ -154,7 +154,7 @@ export function CloudMoveToComputerView({
{t('orcaCloudMove.cancel', 'Cancel')}
</Button>
<Button ref={primary} size="sm" onClick={onConfirm}>
<Laptop />
<Monitor />
{t('orcaCloudMove.confirm.action', 'Move to this computer')}
</Button>
</div>
@@ -257,8 +257,8 @@ export function CloudMoveToComputerView({
)
: localStarted
? t(
'orcaCloudMove.failedLocalNext',
'Use Move again from the sandbox panel to bring them over. Your files are safe in the cloud workspace.'
'orcaCloudMove.failedLocalNextV2',
'Use Move to this computer from the sandbox panel to bring them over. Your files are safe in the cloud workspace.'
)
: t(
'orcaCloudMove.failedDetail',
@@ -32,7 +32,8 @@ export function CloudStateDot({
className
}: {
state: CloudDotState
size?: 'sm' | 'md'
/** badge: the 7px corner dot on a 12px host glyph. */
size?: 'badge' | 'sm' | 'md'
className?: string
}): React.JSX.Element {
return (
@@ -41,7 +42,7 @@ export function CloudStateDot({
data-cloud-state={state}
className={cn(
'inline-block shrink-0',
size === 'md' ? 'size-2' : 'size-1.5',
size === 'md' ? 'size-2' : size === 'badge' ? 'size-[7px]' : 'size-1.5',
CLOUD_DOT_CLASS[state],
className
)}
@@ -1,9 +1,8 @@
import React, { useCallback, useEffect, useRef, useState } from 'react'
import { Cloud } from 'lucide-react'
import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover'
import { useTranslate } from '@/i18n/use-translate'
import { cn } from '@/lib/utils'
import { CloudStateDot } from './CloudStateDot'
import { HostGlyph } from '@/components/host-row-icon'
import { FOCUS_RING } from './cloud-focus'
import { cloudStateLabel } from './cloud-state-copy'
import { CloudWorkspaceStatusPanel } from './CloudWorkspaceStatusPanel'
@@ -15,7 +14,8 @@ const HOVER_OPEN_MS = 250
const HOVER_CLOSE_MS = 180
/**
* Sidebar mark for an Orca Cloud workspace: a cloud glyph with its live state dot beside it.
* Sidebar mark for an Orca Cloud workspace: the Cloud host glyph with its live state as a corner badge,
* in the same 12px slot as every other host glyph so titles align.
* Hover previews the status panel; click or Enter pins it and moves focus into it.
* Renders nothing for workspaces that are not on Orca Cloud.
*/
@@ -70,7 +70,7 @@ function CloudWorkspaceMarkInner({
useCloudStatusPolling(workspaceId, PANEL_POLL_MS, open !== null)
const close = useCallback(() => setOpen(null), [])
const actions = useCloudPanelActions(workspaceId, close)
const label = t('orcaCloudWorkspace.sandboxMarkLabel', 'Sandbox: {{state}}', {
const label = t('orcaCloudWorkspace.cloudMarkLabel', 'Cloud workspace · {{state}}', {
state: cloudStateLabel(view.state, t)
})
return (
@@ -106,14 +106,13 @@ function CloudWorkspaceMarkInner({
onPointerEnter={hoverIn}
onPointerLeave={hoverOut}
className={cn(
// 24px hit area around the 16px mark, without changing the row's layout.
"relative inline-flex h-4 shrink-0 items-center gap-[3px] rounded px-px text-muted-foreground after:absolute after:-inset-1 after:content-['']",
// 24px hit area around the 12px glyph, without changing the row's layout.
"relative inline-flex size-3 shrink-0 items-center rounded-sm text-muted-foreground after:absolute after:-inset-1.5 after:content-['']",
'hover:text-foreground',
FOCUS_RING
)}
>
<Cloud className="size-3" aria-hidden="true" />
<CloudStateDot state={view.state} size="md" />
<HostGlyph kind="orca-cloud" size={12} state={view.state} className="text-inherit" />
</button>
</PopoverTrigger>
<PopoverContent
@@ -1,5 +1,14 @@
import React from 'react'
import { Archive, ArchiveRestore, Cloud, Laptop, Loader2, Moon, Play, RotateCw } from 'lucide-react'
import {
Archive,
ArchiveRestore,
Cloud,
Loader2,
Monitor,
Moon,
Play,
RotateCw
} from 'lucide-react'
import { Button } from '@/components/ui/button'
import { InlineError } from '@/components/ui/inline-error'
import { cloudWorkspaceMoved } from '@/lib/orca-cloud/orca-cloud-move-store'
@@ -312,13 +321,10 @@ export function CloudWorkspaceStatusPanel({
size="xs"
variant="ghost"
className="text-muted-foreground"
aria-label={t('orcaCloudWorkspace.moveToComputer', 'Move to this computer')}
{...busyProps(false, anyBusy, actions.onMoveToComputer)}
>
<Laptop />
{moved
? t('orcaCloudWorkspace.moveAgain', 'Move again')
: t('orcaCloudWorkspace.moveHere', 'Move here')}
<Monitor />
{t('orcaCloudWorkspace.moveToComputer', 'Move to this computer')}
</Button>
) : null}
{actions.onSleep && state === 'running' && !restarting ? (
@@ -46,7 +46,7 @@ describe('Orca Cloud surfaces', () => {
rerender(<CloudWorkspaceMarkSlot workspaceId="ws" fallback={<span data-testid="server" />} />)
expect(container.querySelector('[data-testid="server"]')).toBeNull()
const mark = container.querySelector('[data-cloud-workspace-mark]')
expect(mark?.getAttribute('aria-label')).toBe('Sandbox: Checking…')
expect(mark?.getAttribute('aria-label')).toBe('Cloud workspace · Checking…')
})
it('the panel: Restart primary only when not responding, Wake when asleep, Unarchive when archived', () => {
@@ -0,0 +1,70 @@
import React from 'react'
import { useAppStore } from '@/store'
import { HostGlyph, vmStateToDot, type HostGlyphKind } from '@/components/host-row-icon'
import { selectEphemeralVmWorkspaceState } from '@/store/slices/ephemeral-vm/ephemeral-vm-lifecycle'
import { parseExecutionHostId } from '../../../../shared/execution-host'
import { isOrcaCloudRuntimeEnvironment } from '../../../../shared/remote-runtime/host-catalog/orca-cloud-environment-name'
import { useCloudWorkspaceView } from './use-cloud-workspace-view'
/** True when the execution host is an Orca Cloud sandbox (an ephemeral-vm runtime named for it). */
export function useIsOrcaCloudHost(hostId: string | null | undefined): boolean {
return useAppStore((state) => {
const parsed = parseExecutionHostId(hostId ?? undefined)
if (parsed?.kind !== 'runtime') {
return false
}
const environment = state.runtimeEnvironments.find((entry) => entry.id === parsed.environmentId)
return environment ? isOrcaCloudRuntimeEnvironment(environment) : false
})
}
/** Host kind for an execution host id, before Orca Cloud and recipe VMs are known. */
export function hostGlyphKindForHostId(hostId: string | null | undefined): HostGlyphKind {
const parsed = parseExecutionHostId(hostId ?? undefined)
return parsed?.kind === 'ssh' ? 'ssh' : parsed?.kind === 'runtime' ? 'orca-server' : 'local'
}
/**
* The host glyph for one workspace outside the sidebar card (palette, hover cards, composer
* footer): Orca Cloud and recipe VMs carry their live state as a badge; the rest by host id.
*/
export function WorkspaceHostGlyph({
worktreeId,
hostId,
size = 12,
hideLocal = false,
badgeRingClassName,
className
}: {
worktreeId: string
hostId?: string | null
size?: 12 | 14 | 16
/** Lists where every workspace is local drop the glyph rather than show Monitor everywhere. */
hideLocal?: boolean
badgeRingClassName?: string
className?: string
}): React.JSX.Element | null {
const cloud = useCloudWorkspaceView(worktreeId)
const vmDot = useAppStore((state) =>
state.ephemeralVmRuntimesByWorkspaceId?.[worktreeId]
? vmStateToDot(selectEphemeralVmWorkspaceState(state, worktreeId))
: null
)
const kind: HostGlyphKind = cloud.isCloud
? 'orca-cloud'
: vmDot
? 'recipe-vm'
: hostGlyphKindForHostId(hostId)
if (kind === 'local' && hideLocal) {
return null
}
return (
<HostGlyph
kind={kind}
size={size}
state={cloud.isCloud ? cloud.state : vmDot}
badgeRingClassName={badgeRingClassName}
className={className}
/>
)
}
@@ -1,4 +1,4 @@
import { ArrowUpRight, ChevronDown, Cloud, Link2, Plus, TerminalSquare } from 'lucide-react'
import { ArrowUpRight, Box, ChevronDown, Link2, Plus, TerminalSquare } from 'lucide-react'
import { useTranslate } from '@/i18n/use-translate'
import { useAppStore } from '@/store/index'
import { LoadingSpinner } from '../../LoadingSpinner'
@@ -129,7 +129,7 @@ export function RuntimeServersHeaderActions({
/>
) : null}
<AddServerMenuItem
icon={<Cloud />}
icon={<Box />}
label={t('auto.components.settings.serverList.cloudVm', 'Cloud VM')}
trailing={<ArrowUpRight className="ml-auto" />}
description={t(
@@ -1,4 +1,4 @@
import { Laptop, Server } from 'lucide-react'
import { Monitor, Server } from 'lucide-react'
import { Button } from '@/components/ui/button'
import { cn } from '@/lib/utils'
import { useTranslate } from '@/i18n/use-translate'
@@ -34,7 +34,7 @@ export function SessionHistoryComputerRow({
action = null
}: SessionHistoryComputerRowProps): React.JSX.Element {
const t = useTranslate()
const Icon = kind === 'local' ? Laptop : Server
const Icon = kind === 'local' ? Monitor : Server
return (
<div
data-settings-row=""
@@ -1,5 +1,5 @@
import type React from 'react'
import { ArrowUpRight, Cloud } from 'lucide-react'
import { ArrowUpRight, Box } from 'lucide-react'
import { useAppStore } from '@/store/index'
import { useTranslate } from '@/i18n/use-translate'
import { Button } from '../../../ui/button'
@@ -14,7 +14,7 @@ export function CloudVmSetupGuide({
return (
<div className="flex items-center gap-3 px-4 py-3" data-settings-section="cloud-vm-setup">
<Cloud className="size-4 shrink-0 text-muted-foreground" />
<Box className="size-4 shrink-0 text-muted-foreground" />
<div className="min-w-0 flex-1">
<div className="text-sm font-medium">
{t('auto.components.settings.CloudVmSetupGuide.cardTitle', 'Cloud VMs')}
@@ -1,5 +1,5 @@
import React, { useEffect, useState } from 'react'
import { Laptop } from 'lucide-react'
import { Monitor } from 'lucide-react'
import { DropdownMenuItem } from '@/components/ui/dropdown-menu'
import { useTranslate } from '@/i18n/use-translate'
import { openMoveToThisComputer } from '@/lib/orca-cloud/orca-cloud-move-store'
@@ -40,7 +40,7 @@ export function WorktreeCloudTransferMenuItem({
)
}
>
<Laptop className="size-3.5" />
<Monitor className="size-3.5" />
{t('auto.components.sidebar.WorktreeContextMenu.moveToThisComputer', 'Move to this computer')}
</DropdownMenuItem>
)
@@ -0,0 +1,132 @@
import { getDefaultSettings } from '../../../../../../shared/constants'
import type { HostedWorkspaceStatus } from '../../../../../../shared/hosted-sandbox/hosted-sandbox-wire'
import type { Repo } from '../../../../../../shared/repo-types'
import type { Worktree } from '../../../../../../shared/worktree/types'
import { defineFixture } from '../../../../component-fixtures/component-fixture'
import { seedCloudWorkspaceSnapshot } from '@/lib/orca-cloud/orca-cloud-workspace-store'
import { makeRepo, makeWorktree } from '../../../worktree-jump/worktree-jump-palette-test-fixtures'
import WorktreeCard from '../surface/WorktreeCard'
const local: Repo = { ...makeRepo(), displayName: 'orca' }
const ssh: Repo = { ...makeRepo(), id: 'repo-ssh', displayName: 'api', connectionId: 'devbox' }
const status = (state: HostedWorkspaceStatus['state']): HostedWorkspaceStatus => ({
state,
metrics: null,
uptimeMs: null,
usage: { totalMs: 3_600_000, centsPerHour: 100, costCents: 100 },
archive: null,
checkedAt: Date.now()
})
const cloud: Record<string, HostedWorkspaceStatus> = {
'cloud-running': status('ready'),
'cloud-asleep': status('sleeping'),
'cloud-waking': status('waking'),
'cloud-unresponsive': status('unresponsive'),
'cloud-failed': status('failed')
}
const row = (id: string, name: string, repo: Repo = local): Worktree =>
makeWorktree(id, name, { repoId: repo.id, branch: `refs/heads/${id}` })
const localRows = [row('local-a', 'Tidy settings copy'), row('local-b', 'Fix flaky e2e test')]
const sshRows = [row('ssh-a', 'Profile slow query', ssh)]
const cloudRows = [
row('cloud-running', 'Fix auth redirect'),
row('cloud-asleep', 'Support excalidraw files'),
row('cloud-waking', 'Bump Electron'),
row('cloud-unresponsive', 'Index rebuild'),
row('cloud-failed', 'Migrate billing')
]
const vmRows = [row('vm-suspended', 'Benchmark recipe VM')]
function setup(): void {
seedCloudWorkspaceSnapshot({
ids: new Set(Object.keys(cloud)),
idsLoaded: true,
status: Object.fromEntries(
Object.entries(cloud).map(([id, value]) => [
id,
{ status: value, loading: false, error: null, fetchedAt: Date.now() }
])
)
})
window.api.orcaCloudWorkspace = {
...window.api.orcaCloudWorkspace,
getStatus: async ({ workspaceId }: { workspaceId: string }) => ({
ok: true as const,
value: cloud[workspaceId] ?? status('ready')
})
}
}
function Rows({ rows }: { rows: { worktree: Worktree; repo: Repo }[] }): React.JSX.Element {
return (
<div className="flex flex-col gap-1 bg-worktree-sidebar p-2 text-worktree-sidebar-foreground">
{rows.map(({ worktree, repo }) => (
<WorktreeCard
key={worktree.id}
worktree={worktree}
repo={repo}
isActive={false}
nativeDragEnabled={false}
/>
))}
</div>
)
}
const vmRuntime = {
id: 'runtime-vm',
workspaceId: 'vm-suspended',
status: 'suspended' as const,
runtimeEnvironmentId: 'env-vm',
canSuspend: true
}
/**
* The cloud icon rule on real cards: one 12px host slot (Monitor, Server, Box, Cloud), state as a
* badge and named on line 2; the status lane shows agents only. A cloud row also registered as a
* VM runtime (as at runtime) must not get the VM badge.
*/
export const mixedSidebar = defineFixture({
width: 320,
store: {
settings: getDefaultSettings('/home/fixture'),
repos: [local, ssh],
worktreesByRepo: {
[local.id]: [...localRows, ...cloudRows, ...vmRows],
[ssh.id]: sshRows
},
worktreeCardProperties: ['status', 'branch'],
ephemeralVmRuntimesByWorkspaceId: {
'vm-suspended': vmRuntime,
'cloud-asleep': { ...vmRuntime, id: 'runtime-cloud', workspaceId: 'cloud-asleep' }
}
},
setup,
render: () => (
<Rows
rows={[
...localRows.map((worktree) => ({ worktree, repo: local })),
...sshRows.map((worktree) => ({ worktree, repo: ssh })),
...cloudRows.map((worktree) => ({ worktree, repo: local })),
...vmRows.map((worktree) => ({ worktree, repo: local }))
]}
/>
)
})
/** Local only: no host slot at all, so nothing changes for people who never leave this computer. */
export const localOnly = defineFixture({
width: 320,
store: {
settings: getDefaultSettings('/home/fixture'),
repos: [local],
worktreesByRepo: { [local.id]: localRows },
worktreeCardProperties: ['status', 'branch']
},
setup: () => seedCloudWorkspaceSnapshot({ ids: new Set(), idsLoaded: true }),
render: () => <Rows rows={localRows.map((worktree) => ({ worktree, repo: local }))} />
})
@@ -0,0 +1,93 @@
// @vitest-environment happy-dom
import { act, cleanup, render } from '@testing-library/react'
import { afterEach, describe, expect, it, vi } from 'vitest'
import { useAppStore } from '@/store'
import { TooltipProvider } from '@/components/ui/tooltip'
import { seedCloudWorkspaceSnapshot } from '@/lib/orca-cloud/orca-cloud-workspace-store'
import { WorktreeCardStatusSlot } from '../surface/WorktreeCardStatusSlot'
import { WorktreeCardHostMark } from './WorktreeCardHostMark'
vi.mock('@/components/sidebar/workspace-actions/sleep/use-worktree-sleep-state', () => ({
useIsSleepingWorktree: () => false,
selectIsSleepingWorktree: () => false
}))
vi.mock('@/components/sidebar/workspace-card/activity/use-worktree-activity-status', () => ({
useWorktreeActivityStatus: () => 'inactive'
}))
const runtime = (workspaceId: string, status: 'suspended' | 'resume_failed') => ({
id: `runtime-${workspaceId}`,
workspaceId,
status,
runtimeEnvironmentId: `env-${workspaceId}`,
canSuspend: true
})
afterEach(() => {
cleanup()
seedCloudWorkspaceSnapshot({})
useAppStore.setState({ ephemeralVmRuntimesByWorkspaceId: {} })
})
const noop = (): void => {}
const slot = (worktreeId: string, newCardStyle: boolean) => (
<TooltipProvider>
<WorktreeCardStatusSlot
worktreeId={worktreeId}
showStatus
showUnreadAction={!newCardStyle}
isUnread={false}
unreadTooltip="Mark as unread"
onToggleUnread={noop}
onPointerDown={noop}
newCardStyle={newCardStyle}
/>
</TooltipProvider>
)
describe('cloud icon rule on the card', () => {
it('a cloud card never renders the VM state badge, even when registered as a VM runtime', () => {
act(() => {
useAppStore.setState({
ephemeralVmRuntimesByWorkspaceId: {
ws: runtime('ws', 'resume_failed'),
vm: runtime('vm', 'resume_failed')
}
})
seedCloudWorkspaceSnapshot({ ids: new Set(['ws']), idsLoaded: true })
})
for (const newCardStyle of [true, false]) {
const cloudCard = render(slot('ws', newCardStyle))
expect(cloudCard.container.querySelector('[data-worktree-vm-state]')).toBeNull()
cloudCard.unmount()
}
// The guard is cloud-only: a recipe VM's failure still shows in the lane.
const vmCard = render(slot('vm', true))
expect(vmCard.container.querySelector('[data-worktree-vm-state]')).not.toBeNull()
})
it('one host slot: Cloud for cloud, Box with a badge for a recipe VM, Monitor only when mixed', () => {
act(() => {
useAppStore.setState({ ephemeralVmRuntimesByWorkspaceId: {} })
seedCloudWorkspaceSnapshot({ ids: new Set(), idsLoaded: true })
})
const local = render(<WorktreeCardHostMark worktreeId="local" />)
expect(local.container.querySelector('[data-host-glyph]')).toBeNull()
local.unmount()
act(() => {
useAppStore.setState({ ephemeralVmRuntimesByWorkspaceId: { vm: runtime('vm', 'suspended') } })
seedCloudWorkspaceSnapshot({ ids: new Set(['ws']), idsLoaded: true })
})
const glyph = (id: string): Element | null =>
render(<WorktreeCardHostMark worktreeId={id} />).container.querySelector('[data-host-glyph]')
expect(glyph('ws')?.getAttribute('data-host-glyph')).toBe('orca-cloud')
const vm = glyph('vm')
expect(vm?.getAttribute('data-host-glyph')).toBe('recipe-vm')
expect(vm?.querySelector('[data-cloud-state]')?.getAttribute('data-cloud-state')).toBe(
'sleeping'
)
expect(glyph('local')?.getAttribute('data-host-glyph')).toBe('local')
})
})
@@ -0,0 +1,106 @@
import React from 'react'
import { useAppStore } from '@/store'
import { useTranslate } from '@/i18n/use-translate'
import { cn } from '@/lib/utils'
import { HostGlyph, vmStateToDot } from '@/components/host-row-icon'
import { CloudWorkspaceMarkSlot } from '@/components/orca-cloud/CloudWorkspaceMarkSlot'
import { cloudStateLabel } from '@/components/orca-cloud/cloud-state-copy'
import { useCloudWorkspaceView } from '@/components/orca-cloud/use-cloud-workspace-view'
import { useCloudWorkspace } from '@/lib/orca-cloud/orca-cloud-workspace-store'
import type { CloudDotState } from '@/lib/orca-cloud/orca-cloud-workspace-state'
import { selectEphemeralVmWorkspaceState } from '@/store/slices/ephemeral-vm/ephemeral-vm-lifecycle'
import { parseExecutionHostId } from '../../../../../../shared/execution-host'
/**
* Local-only users never see a host slot: it appears once any workspace runs elsewhere (SSH,
* an Orca server, a recipe VM or Orca Cloud), and then every row gets one so titles align.
*/
export function useSidebarShowsHostSlot(): boolean {
const anyCloud = useCloudWorkspace((state) => state.ids.size > 0)
const anyRemote = useAppStore(
(state) =>
state.repos.some(
(repo) =>
Boolean(repo.connectionId) ||
parseExecutionHostId(repo.executionHostId)?.kind === 'runtime'
) || Object.keys(state.ephemeralVmRuntimesByWorkspaceId ?? {}).length > 0
)
return anyCloud || anyRemote
}
/** Recipe VM (Box + lifecycle badge) or this computer (Monitor) in the shared 12px slot. */
function LocalOrVmGlyph({ worktreeId }: { worktreeId: string }): React.JSX.Element | null {
// A primitive, so rows re-render only when this VM's state changes.
const vmDot = useAppStore((state) =>
state.ephemeralVmRuntimesByWorkspaceId?.[worktreeId]
? vmStateToDot(selectEphemeralVmWorkspaceState(state, worktreeId))
: null
)
const showSlot = useSidebarShowsHostSlot()
if (vmDot) {
return <HostGlyph kind="recipe-vm" size={12} state={vmDot} />
}
return showSlot ? <HostGlyph kind="local" size={12} /> : null
}
/**
* The card's one host mark: SSH keeps its connection control, Orca Cloud its live mark, an Orca
* server its runtime mark; recipe VMs and this computer get the plain glyph.
*/
export function WorktreeCardHostMark({
worktreeId,
sshControl,
runtimeMark,
onPointerDown
}: {
worktreeId: string
/** Set for SSH repos: the connection control replaces the glyph. */
sshControl?: React.ReactNode
/** Set for Orca server repos. */
runtimeMark?: React.ReactNode
onPointerDown?: React.PointerEventHandler<HTMLButtonElement>
}): React.JSX.Element | null {
if (sshControl) {
// A fixed 12px column (the 16px control overhangs it evenly) so titles line up across hosts.
return <span className="inline-flex w-3 shrink-0 justify-center">{sshControl}</span>
}
return (
<CloudWorkspaceMarkSlot
workspaceId={worktreeId}
onPointerDown={onPointerDown}
fallback={runtimeMark ?? <LocalOrVmGlyph worktreeId={worktreeId} />}
/>
)
}
const PROBLEM: ReadonlySet<CloudDotState> = new Set(['failed', 'wakeFailed'])
/** Line 2 names a cloud or VM row's state when it is not running ("Asleep · branch"). */
export function WorktreeCardHostStateWord({
worktreeId
}: {
worktreeId: string
}): React.JSX.Element | null {
const cloud = useCloudWorkspaceView(worktreeId)
const vmDot = useAppStore((state) =>
state.ephemeralVmRuntimesByWorkspaceId?.[worktreeId]
? vmStateToDot(selectEphemeralVmWorkspaceState(state, worktreeId))
: null
)
const t = useTranslate()
const state = cloud.isCloud ? cloud.state : vmDot
if (!state || state === 'running') {
return null
}
return (
<span
data-host-state-word={state}
className={cn(
'shrink-0 text-[11px] leading-none',
PROBLEM.has(state) ? 'text-destructive' : 'text-muted-foreground'
)}
>
{cloudStateLabel(state, t)} ·
</span>
)
}
@@ -32,6 +32,8 @@ type WorktreeCardSshHostControlProps = {
sshOwnerEnvironmentId: string | null
/** Use only the accessible label when dense rows cannot fit visible text. */
iconOnly: boolean
/** Line 2 of a classic card: only the Connect / Retry action, nothing while connected or removed. */
actionOnly?: boolean
onPointerDown: React.PointerEventHandler<HTMLButtonElement>
}
@@ -76,6 +78,7 @@ export function WorktreeCardSshHostControl({
targetRemoved,
sshOwnerEnvironmentId,
iconOnly,
actionOnly = false,
onPointerDown
}: WorktreeCardSshHostControlProps): React.JSX.Element | null {
const t = useTranslate()
@@ -130,7 +133,7 @@ export function WorktreeCardSshHostControl({
// Live connection outranks stale removal; runtime-owned null status stays passive without claiming disconnection.
if (status === null || status === 'connected') {
return (
return actionOnly ? null : (
<PassiveGlyph
targetLabel={targetLabel}
icon={<Server className="size-3 text-muted-foreground" />}
@@ -149,7 +152,7 @@ export function WorktreeCardSshHostControl({
// Removed hosts cannot reconnect; suppress failing Connect actions and treat removal as settled, not actionable error.
if (targetRemoved) {
return (
return actionOnly ? null : (
<PassiveGlyph
targetLabel={targetLabel}
icon={<ServerOff className="size-3 text-muted-foreground" />}
@@ -1,5 +1,6 @@
import React from 'react'
import { WorktreeCardHostStateWord } from '../host/WorktreeCardHostMark'
import { DetachedHeadBadge } from '@/components/DetachedHeadBadge'
import CacheTimer from '../activity/CacheTimer'
import { WorktreeHostContextBadge } from '../host/WorktreeHostContextBadge'
@@ -61,6 +62,8 @@ export function WorktreeCardMetaRow({
<WorktreeHostContextBadge label={contextLabel ?? ''} />
))}
<WorktreeCardHostStateWord worktreeId={worktree.id} />
{showIdentityInNewCard ? (
<TruncatedSidebarLabel
text={identityDisplay!}
@@ -147,7 +147,12 @@ export function WorktreeCardStatusSlot({
)
// Orca Cloud workspaces show their state on the cloud mark; the VM badge would be a second indicator.
const isCloud = useIsCloudWorkspace(worktreeId)
const vmState = vmRuntime && !isCloud ? getEphemeralVmHostState(vmRuntime.status, vmWaking) : null
const vmHostState =
vmRuntime && !isCloud ? getEphemeralVmHostState(vmRuntime.status, vmWaking) : null
// The host glyph's badge carries suspended, waking and provisioning; the lane keeps only the
// failures, whose badge holds the reason and the recovery actions.
const vmState =
vmHostState === 'resume_failed' || vmHostState === 'provision_failed' ? vmHostState : null
const vmFailure = vmRuntime?.failure ?? null
const statusLabel = getWorktreeStatusLabel(status) || status
// Sleeping remains distinct from quiet done/branch/review states; attention keeps its own glyph.
@@ -12,7 +12,7 @@ import {
WorktreeCardSparseBadge
} from '../identity/worktree-card-header-items'
import { WorktreeCardSshHostControl } from '../host/WorktreeCardSshHostControl'
import { CloudWorkspaceMarkSlot } from '@/components/orca-cloud/CloudWorkspaceMarkSlot'
import { WorktreeCardHostMark } from '../host/WorktreeCardHostMark'
import { WorktreeTitleInlineRename } from '../identity/WorktreeTitleInlineRename'
import type { WorktreeCardController } from '../controller/use-worktree-card-controller'
@@ -67,33 +67,31 @@ export function WorktreeCardHeader({
<div className="flex min-w-0 flex-1 items-center gap-1.5">
{showPinnedRepoIcon && <WorktreeCardRepoChip repo={repo!} />}
{repo?.connectionId && (
<WorktreeCardSshHostControl
targetId={repo.connectionId}
targetLabel={sshTargetLabel || repo.displayName}
status={sshStatus}
targetRemoved={sshTargetRemoved}
sshOwnerEnvironmentId={sshOwnerEnvironmentId}
iconOnly={compactCards || newCardStyle}
onPointerDown={stopQuickActionPointerPropagation}
/>
)}
{!repo?.connectionId && (
// An Orca Cloud workspace shows its cloud mark (live state) in place of the server mark.
<CloudWorkspaceMarkSlot
workspaceId={worktree.id}
onPointerDown={stopQuickActionPointerPropagation}
fallback={
parsedRepoHost?.kind === 'runtime' ? (
<WorktreeCardRuntimeHostMark
disconnected={isRuntimeDisconnected}
hostLabel={runtimeHostLabel}
/>
) : null
}
/>
)}
<WorktreeCardHostMark
worktreeId={worktree.id}
onPointerDown={stopQuickActionPointerPropagation}
sshControl={
repo?.connectionId ? (
<WorktreeCardSshHostControl
targetId={repo.connectionId}
targetLabel={sshTargetLabel || repo.displayName}
status={sshStatus}
targetRemoved={sshTargetRemoved}
sshOwnerEnvironmentId={sshOwnerEnvironmentId}
iconOnly
onPointerDown={stopQuickActionPointerPropagation}
/>
) : undefined
}
runtimeMark={
!repo?.connectionId && parsedRepoHost?.kind === 'runtime' ? (
<WorktreeCardRuntimeHostMark
disconnected={isRuntimeDisconnected}
hostLabel={runtimeHostLabel}
/>
) : undefined
}
/>
{showInlineRepoBadge && <WorktreeCardRepoChip repo={repo!} />}
@@ -22,7 +22,7 @@ import {
import { shouldBeginWorktreeRename } from '../controller/worktree-card-model'
import { WorktreeCardSshHostControl } from '../host/WorktreeCardSshHostControl'
import { WorktreeHostContextBadge } from '../host/WorktreeHostContextBadge'
import { CloudWorkspaceMarkSlot } from '@/components/orca-cloud/CloudWorkspaceMarkSlot'
import { WorktreeCardHostMark, WorktreeCardHostStateWord } from '../host/WorktreeCardHostMark'
import { WorktreeTitleInlineRename } from '../identity/WorktreeTitleInlineRename'
import { cardElement } from './card-template-compiler'
@@ -56,7 +56,11 @@ function title(props: Readonly<Record<string, unknown>>, card: Card): React.Reac
)
}
function sshControl(props: Readonly<Record<string, unknown>>, card: Card): React.ReactNode {
function sshControl(
props: Readonly<Record<string, unknown>>,
card: Card,
actionOnly = false
): React.ReactNode {
const { repo } = card
if (!repo?.connectionId) {
return null
@@ -69,6 +73,7 @@ function sshControl(props: Readonly<Record<string, unknown>>, card: Card): React
targetRemoved={card.sshTargetRemoved}
sshOwnerEnvironmentId={card.sshOwnerEnvironmentId}
iconOnly={props.iconOnly === true}
actionOnly={actionOnly}
onPointerDown={card.stopQuickActionPointerPropagation}
/>
)
@@ -95,26 +100,26 @@ export const CARD_IDENTITY_PARTS = {
RepoChip: part([], (_props, _children, { repo }) =>
repo ? <WorktreeCardRepoChip repo={repo} /> : null
),
SshControl: part(['iconOnly'], (props, _children, card) => sshControl(props, card)),
RuntimeHostMark: part([], (_props, _children, card) => (
<CloudWorkspaceMarkSlot
workspaceId={card.worktree.id}
// The one host mark (SSH, Orca server, recipe VM, Orca Cloud or this computer) in a 12px slot.
HostMark: part(['runtime'], (props, _children, card) => (
<WorktreeCardHostMark
worktreeId={card.worktree.id}
onPointerDown={card.stopQuickActionPointerPropagation}
fallback={
<WorktreeCardRuntimeHostMark
disconnected={card.isRuntimeDisconnected}
hostLabel={card.runtimeHostLabel}
/>
// Always icon-only in the 12px slot; classic cards show Connect on line 2 (SshConnect).
sshControl={sshControl({ iconOnly: true }, card)}
runtimeMark={
props.runtime === true ? (
<WorktreeCardRuntimeHostMark
disconnected={card.isRuntimeDisconnected}
hostLabel={card.runtimeHostLabel}
/>
) : undefined
}
/>
)),
// Cloud workspaces of local projects: the live cloud mark (renders nothing for other workspaces).
CloudMark: part([], (_props, _children, card) => (
<CloudWorkspaceMarkSlot
workspaceId={card.worktree.id}
onPointerDown={card.stopQuickActionPointerPropagation}
fallback={null}
/>
SshConnect: part([], (_props, _children, card) => sshControl({ iconOnly: false }, card, true)),
HostStateWord: part([], (_props, _children, card) => (
<WorktreeCardHostStateWord worktreeId={card.worktree.id} />
)),
RenameError: part([], (_props, _children, card) => (
<WorktreeCardRenameErrorButton
@@ -52,12 +52,9 @@
"children": [
{ "el": "RepoChip", "when": "vars.pinnedRepo" },
{
"el": "SshControl",
"when": "host.kind == 'ssh'",
"props": { "iconOnly": "=!vars.classic" }
"el": "HostMark",
"props": { "runtime": "=host.kind == 'runtime'" }
},
{ "el": "RuntimeHostMark", "when": "host.kind == 'runtime'" },
{ "el": "CloudMark", "when": "host.kind != 'runtime' && host.kind != 'ssh'" },
{ "el": "RepoChip", "when": "vars.inlineRepo" },
{
"el": "Title",
@@ -121,6 +118,8 @@
"when": "vars.hostBadge",
"props": { "label": "=vars.hostLabel" }
},
{ "el": "SshConnect", "when": "vars.classic && host.kind == 'ssh'" },
{ "el": "HostStateWord" },
{
"el": "IdentityLabel",
"when": "vars.identityInMeta",
@@ -7,7 +7,10 @@ import type { HostHeaderRow } from '../../../../../../shared/sidebar-list/host-s
import { HostSectionHeaderMenu } from './HostSectionHeaderMenu'
import { stopRepoHeaderMenuEvent } from './header-event-guards'
import { getHostHeaderDetail } from './host-header-detail'
import { getVmStateLabel, VmStateIcon } from '../../workspace-card/surface/WorktreeCardVmStateBadge'
import { getVmStateLabel } from '../../workspace-card/surface/WorktreeCardVmStateBadge'
import { HostGlyph, vmStateToDot } from '@/components/host-row-icon'
import { cloudStateLabel } from '@/components/orca-cloud/cloud-state-copy'
import { useIsOrcaCloudHost } from '@/components/orca-cloud/WorkspaceHostGlyph'
function SectionMetricsBadge({ count }: { count: number }): React.JSX.Element {
const t = useTranslate()
@@ -51,32 +54,30 @@ function HostHeaderHealthIcon({
return null
}
/** A VM host's server glyph with its lifecycle as a corner badge, like an avatar's status dot. */
/** A VM host's glyph (Box, or Cloud for Orca Cloud) with its lifecycle as a corner badge. */
function VmHostIcon({
state,
muted
isCloud
}: {
state: NonNullable<HostHeaderRow['vmState']>
muted: boolean
isCloud: boolean
}): React.JSX.Element {
const t = useTranslate()
const label = getVmStateLabel(state, t)
const label = isCloud ? cloudStateLabel(vmStateToDot(state), t) : getVmStateLabel(state, t)
return (
<Tooltip>
<TooltipTrigger asChild>
<span
className="relative inline-flex size-3.5 shrink-0"
className="inline-flex shrink-0"
data-host-header-vm-state={state}
aria-label={label}
role="img"
>
<Server
className={cn('size-3.5', muted ? 'text-muted-foreground/80' : 'text-muted-foreground')}
<HostGlyph
kind={isCloud ? 'orca-cloud' : 'recipe-vm'}
size={14}
state={vmStateToDot(state)}
/>
{/* The ring in the sidebar color cuts the badge out of the glyph so it reads at 8px. */}
<span className="absolute -right-1 -bottom-1 inline-flex size-2.5 items-center justify-center rounded-full bg-worktree-sidebar ring-1 ring-worktree-sidebar">
<VmStateIcon state={state} sizeClassName="size-2" />
</span>
</span>
</TooltipTrigger>
<TooltipContent side="bottom" sideOffset={6}>
@@ -102,7 +103,8 @@ export function HostSectionHeader({
const isDisconnected = row.health === 'disconnected'
// A suspended VM is asleep on purpose: muted like disconnected, but never an error.
const isSuspended = row.health === 'suspended'
const detail = getHostHeaderDetail(row, t)
const isCloudHost = useIsOrcaCloudHost(row.hostId)
const detail = getHostHeaderDetail(row, t, isCloudHost)
return (
<div className="px-2 pt-1">
{/* Why: outlined card + server glyph marks hosts as machines, not mere groups. */}
@@ -131,7 +133,7 @@ export function HostSectionHeader({
}}
>
{row.vmState ? (
<VmHostIcon state={row.vmState} muted={isSuspended} />
<VmHostIcon state={row.vmState} isCloud={isCloudHost} />
) : isDisconnected ? (
<ServerOff className="size-3.5 shrink-0 text-muted-foreground/80" />
) : (
@@ -1,6 +1,7 @@
import React from 'react'
import { AlertTriangle, Loader2, X } from 'lucide-react'
import { useAppStore } from '@/store'
import { HostGlyph } from '@/components/host-row-icon'
import { cn } from '@/lib/utils'
import {
getCreationProgressLabel,
@@ -65,6 +66,7 @@ export function PendingWorktreeRow({
}
const isError = entry.status === 'error'
const isOrcaCloud = entry.request.ephemeralVmRecipe?.provider === 'orca-cloud'
return (
<div
className={cn(
@@ -86,7 +88,10 @@ export function PendingWorktreeRow({
className="flex min-w-0 flex-1 items-center gap-2 px-2 py-1.5 text-left"
>
<span className="flex size-4 shrink-0 items-center justify-center">
{isError ? (
{isOrcaCloud ? (
// The row becomes the cloud card: same glyph from the start, state on the badge.
<HostGlyph kind="orca-cloud" size={12} state={isError ? 'failed' : 'starting'} />
) : isError ? (
<AlertTriangle className="size-3.5 text-destructive" />
) : (
<Loader2 className="size-4 animate-spin text-muted-foreground" />
@@ -1,5 +1,7 @@
import { translate } from '@/i18n/i18n'
import type { Translate } from '@/i18n/use-translate'
import { vmStateToDot } from '@/components/host-row-icon'
import { cloudStateLabel } from '@/components/orca-cloud/cloud-state-copy'
import type { HostHeaderRow } from '../../../../../../shared/sidebar-list/host-section-rows'
export function getHostHeaderDetail(
@@ -7,8 +9,14 @@ export function getHostHeaderDetail(
HostHeaderRow,
'health' | 'blockedReason' | 'vmState' | 'connectionStatus' | 'kind' | 'detail'
>,
t: Translate = translate
t: Translate = translate,
/** Orca Cloud hosts use the cloud glossary: Asleep, Waking, Couldn't wake, never "Suspended". */
isOrcaCloud = false
): { text: string; isWarning: boolean } | null {
if (isOrcaCloud && row.vmState) {
const dot = vmStateToDot(row.vmState)
return { text: cloudStateLabel(dot, t), isWarning: dot === 'failed' || dot === 'wakeFailed' }
}
// A VM's lifecycle names the state; suspended is intentional, so only failures warn.
if (row.vmState === 'provision_failed') {
return {
@@ -1,4 +1,6 @@
import type React from 'react'
import { useSidebarShowsHostSlot } from '@/components/sidebar/workspace-card/host/WorktreeCardHostMark'
import { WorkspaceHostGlyph } from '@/components/orca-cloud/WorkspaceHostGlyph'
import { Server, ServerOff } from 'lucide-react'
import { CommandItem } from '@/components/ui/command'
import { PaletteWorktreeStatusDot } from '@/components/cmd-j/palette-live-status'
@@ -40,6 +42,7 @@ export function WorktreeJumpPaletteWorktreeRow({
controller: WorktreeJumpPaletteController
}): React.JSX.Element {
const t = useTranslate()
const showsHostSlot = useSidebarShowsHostSlot()
const {
repoMap,
activeWorktreeId,
@@ -74,11 +77,9 @@ export function WorktreeJumpPaletteWorktreeRow({
? (sshConnectionStates.get(sshConnectionId)?.status ?? 'disconnected')
: null
const isSshDisconnected = sshStatus != null && sshStatus !== 'connected'
const hostBadge = getPaletteHostBadge(
getPaletteWorktreeExecutionHostId(worktree) ?? (repo && getRepoExecutionHostId(repo)),
hostOptions,
hostFilterActive
)
const paletteHostId =
getPaletteWorktreeExecutionHostId(worktree) ?? (repo && getRepoExecutionHostId(repo))
const hostBadge = getPaletteHostBadge(paletteHostId, hostOptions, hostFilterActive)
return (
<CommandItem
@@ -113,6 +114,15 @@ export function WorktreeJumpPaletteWorktreeRow({
)}
</span>
)}
{!sshConnectionId && (
<WorkspaceHostGlyph
worktreeId={worktree.id}
hostId={paletteHostId}
size={14}
hideLocal={!showsHostSlot}
badgeRingClassName="bg-popover group-data-[selected=true]:bg-accent"
/>
)}
<span className="truncate text-[14px] font-semibold text-foreground">
<HighlightedText text={worktreeLabel} matchRanges={entry.match.displayNameRanges} />
</span>
+5 -6
View File
@@ -26695,7 +26695,6 @@
},
"dismiss": "Dismiss",
"restartSandbox": "Restart sandbox",
"sandboxMarkLabel": "Sandbox: {{state}}",
"archive": "Archive",
"oom": {
"titleRan": "{{name}} ran out of memory",
@@ -26767,10 +26766,8 @@
"idleSleptMinutes_one": "{{name}} slept after {{count}} minute idle",
"idleSleptMinutes_other": "{{name}} slept after {{count}} minutes idle",
"moveToComputer": "Move to this computer",
"moveHere": "Move here",
"openLocal": "Open local workspace",
"copiedOn": "Moved to this computer · {{date}}",
"moveAgain": "Move again",
"recovery": {
"reconnectingTitle": "Reconnecting to {{workspaceName}}…",
"reconnectingBody": "The connection dropped. Orca is retrying; your files and chats are safe."
@@ -26798,7 +26795,9 @@
"createWorkspace": "Create workspace"
},
"deletedNamed": "Deleted {{name}}",
"deleteFailedNamed": "Couldn’t delete {{name}}"
"deleteFailedNamed": "Couldn’t delete {{name}}",
"productName": "Orca Cloud",
"cloudMarkLabel": "Cloud workspace · {{state}}"
},
"cloudAgentSetup": {
"loading": "Checking what agents can use…",
@@ -27178,7 +27177,6 @@
"applying": "Applying the changes is taking too long, so Orca stopped waiting."
},
"openFolder": "Open folder",
"failedLocalNext": "Use Move again from the sandbox panel to bring them over. Your files are safe in the cloud workspace.",
"conflicts": "Changed here since: {{files}}",
"failedLocalReapply": "Apply changes again to bring them over. Nothing you changed here is overwritten, and your files are safe in the cloud workspace.",
"reapply": "Apply changes again",
@@ -27188,7 +27186,8 @@
"stillLeft": "Some changes still conflict with edits made here. They stay saved.",
"done": "All changes applied",
"discard": "Discard"
}
},
"failedLocalNextV2": "Use Move to this computer from the sandbox panel to bring them over. Your files are safe in the cloud workspace."
},
"orcaCloud": {
"continueOffer": {