From d1ecfeba58c6e4c7bd642ac1b838c9f02ff15d88 Mon Sep 17 00:00:00 2001 From: Neil Date: Tue, 10 Nov 2026 07:00:28 -0800 Subject: [PATCH 1/4] =?UTF-8?q?feat(cloud):=20cloud=20icon=20rule=20?= =?UTF-8?q?=E2=80=94=20one=20host=20glyph=20slot=20(Monitor/Server/Box/Clo?= =?UTF-8?q?ud)=20with=20state=20as=20a=20badge,=20state=20word=20on=20line?= =?UTF-8?q?=202,=20Cloud=20on=20palette,=20hover=20card,=20composer=20foot?= =?UTF-8?q?er,=20creating=20row=20and=20host=20headers=20(NP-5)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../activity-thread-hover-card-summary.tsx | 21 ++- src/renderer/src/components/host-row-icon.tsx | 83 ++++++++- .../controls/NativeChatComposerWorkspace.tsx | 15 +- .../orca-cloud/CloudArchivedWorkspaceView.tsx | 4 +- .../CloudIconRuleSurfaces.fixture.tsx | 165 ++++++++++++++++++ .../orca-cloud/CloudMoveToComputerView.tsx | 8 +- .../components/orca-cloud/CloudStateDot.tsx | 5 +- .../orca-cloud/CloudWorkspaceMark.tsx | 15 +- .../orca-cloud/CloudWorkspaceStatusPanel.tsx | 18 +- .../CloudWorkspaceSurfaces.test.tsx | 2 +- .../orca-cloud/WorkspaceHostGlyph.tsx | 70 ++++++++ .../runtime-servers-header-actions.tsx | 4 +- .../SessionHistoryComputerRow.tsx | 4 +- .../runtimes/CloudVmSetupGuide.tsx | 4 +- .../WorktreeCloudTransferMenuItem.tsx | 4 +- .../host/WorktreeCardHostMark.fixture.tsx | 132 ++++++++++++++ .../host/WorktreeCardHostMark.test.tsx | 93 ++++++++++ .../host/WorktreeCardHostMark.tsx | 105 +++++++++++ .../metadata/worktree-card-meta-row.tsx | 3 + .../surface/WorktreeCardStatusSlot.tsx | 7 +- .../surface/worktree-card-header.tsx | 54 +++--- .../template/card-identity-parts.tsx | 32 ++-- .../template/default-workspace-card.json | 8 +- .../worktree-list/rows/HostSectionHeader.tsx | 30 ++-- .../worktree-list/rows/PendingWorktreeRow.tsx | 7 +- .../worktree-list/rows/host-header-detail.ts | 10 +- .../worktree-jump-palette-worktree-row.tsx | 20 ++- src/renderer/src/i18n/locales/en.json | 11 +- 28 files changed, 812 insertions(+), 122 deletions(-) create mode 100644 src/renderer/src/components/orca-cloud/CloudIconRuleSurfaces.fixture.tsx create mode 100644 src/renderer/src/components/orca-cloud/WorkspaceHostGlyph.tsx create mode 100644 src/renderer/src/components/sidebar/workspace-card/host/WorktreeCardHostMark.fixture.tsx create mode 100644 src/renderer/src/components/sidebar/workspace-card/host/WorktreeCardHostMark.test.tsx create mode 100644 src/renderer/src/components/sidebar/workspace-card/host/WorktreeCardHostMark.tsx diff --git a/src/renderer/src/components/activity/activity-thread-hover-card-summary.tsx b/src/renderer/src/components/activity/activity-thread-hover-card-summary.tsx index 5fc59eb9962..611b33a6927 100644 --- a/src/renderer/src/components/activity/activity-thread-hover-card-summary.tsx +++ b/src/renderer/src/components/activity/activity-thread-hover-card-summary.tsx @@ -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}
- {parsedHost?.kind === 'runtime' ? ( - - ) : parsedHost?.kind === 'ssh' ? ( - - ) : ( - - )} - {hostDisplayLabel} + + + {isCloud ? t('orcaCloudWorkspace.productName', 'Orca Cloud') : hostDisplayLabel} +
{worktree.path ? ( diff --git a/src/renderer/src/components/host-row-icon.tsx b/src/renderer/src/components/host-row-icon.tsx index 7e7d519f60a..bc18bd3d2e2 100644 --- a/src/renderer/src/components/host-row-icon.tsx +++ b/src/renderer/src/components/host-row-icon.tsx @@ -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 = { + 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 ( + + + ) +} + +/** 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' + default: + return 'running' + } +} /** The local machine isn't a server — a monitor glyph reads as "this computer". */ export function HostRowIcon({ diff --git a/src/renderer/src/components/native-chat/composer/controls/NativeChatComposerWorkspace.tsx b/src/renderer/src/components/native-chat/composer/controls/NativeChatComposerWorkspace.tsx index 494c1ab1da8..4d4bf356a6b 100644 --- a/src/renderer/src/components/native-chat/composer/controls/NativeChatComposerWorkspace.tsx +++ b/src/renderer/src/components/native-chat/composer/controls/NativeChatComposerWorkspace.tsx @@ -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' } > - - {hostId === 'local' ? ( + + {isCloud ? ( + {t('orcaCloudWorkspace.productName', 'Orca Cloud')} + ) : hostId === 'local' ? ( ) : ( diff --git a/src/renderer/src/components/orca-cloud/CloudArchivedWorkspaceView.tsx b/src/renderer/src/components/orca-cloud/CloudArchivedWorkspaceView.tsx index 65c184fb09c..7b2d4ac6548 100644 --- a/src/renderer/src/components/orca-cloud/CloudArchivedWorkspaceView.tsx +++ b/src/renderer/src/components/orca-cloud/CloudArchivedWorkspaceView.tsx @@ -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({ >
({ + 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 => ({ + 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: () => ( +
+ + +
+ ) +}) + +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: () => ( + + + {[cloudRunning, cloudRow, localRow].map((worktree) => ( + + ))} + + + ) +}) + +/** 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: () => ( +
+ +
+ ) +}) diff --git a/src/renderer/src/components/orca-cloud/CloudMoveToComputerView.tsx b/src/renderer/src/components/orca-cloud/CloudMoveToComputerView.tsx index bc51900ed9b..5d1d25e9183 100644 --- a/src/renderer/src/components/orca-cloud/CloudMoveToComputerView.tsx +++ b/src/renderer/src/components/orca-cloud/CloudMoveToComputerView.tsx @@ -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')}
@@ -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', diff --git a/src/renderer/src/components/orca-cloud/CloudStateDot.tsx b/src/renderer/src/components/orca-cloud/CloudStateDot.tsx index 262d0e17835..bfd956ba78c 100644 --- a/src/renderer/src/components/orca-cloud/CloudStateDot.tsx +++ b/src/renderer/src/components/orca-cloud/CloudStateDot.tsx @@ -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 )} diff --git a/src/renderer/src/components/orca-cloud/CloudWorkspaceMark.tsx b/src/renderer/src/components/orca-cloud/CloudWorkspaceMark.tsx index 015f0b2bb0f..8de188f9fd3 100644 --- a/src/renderer/src/components/orca-cloud/CloudWorkspaceMark.tsx +++ b/src/renderer/src/components/orca-cloud/CloudWorkspaceMark.tsx @@ -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 )} > -