mirror of
https://github.com/stablyai/orca.git
synced 2026-11-16 19:07:41 +00:00
Merge remote-tracking branch 'private/cloud/integration' into cloud/w6-terminal-identity
# Conflicts: # cloud/apps/sandbox-control/image/vm-scripts.generated.ts
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -24,11 +24,4 @@ if [ -n "${ORCA_WORKSPACE_PATH-}" ] && [ -z "${ORCA_DEFAULT_BRANCH-}" ]; then
|
||||
export ORCA_DEFAULT_BRANCH="${__orca_branch#origin/}" CONDUCTOR_DEFAULT_BRANCH="${__orca_branch#origin/}"
|
||||
fi
|
||||
fi
|
||||
# CR-cmd-quiet: Orca's staged agent launch (` . '/tmp/orca-launch-….sh'`) stays out of zsh history.
|
||||
# zsh records a line before running it, so the hook must exist first; the staged script itself
|
||||
# drops the line from bash's history. eval: bash parses this file too.
|
||||
if [ -n "${ZSH_VERSION-}" ]; then
|
||||
eval '__orca_skip_launch_history() { [[ $1 == *orca-launch-* ]] && return 1; return 0 }
|
||||
(( ${zshaddhistory_functions[(Ie)__orca_skip_launch_history]} )) || zshaddhistory_functions+=(__orca_skip_launch_history)'
|
||||
fi
|
||||
unset __orca_env_file __orca_line __orca_n __orca_names __orca_branch
|
||||
|
||||
@@ -152,6 +152,17 @@
|
||||
--color-jira-priority-low: var(--jira-priority-low);
|
||||
--color-status-warning-background: var(--status-warning-background);
|
||||
--color-status-warning-border: var(--status-warning-border);
|
||||
/* GA-P3t: strips, banners and notices by severity (fill, 1px border, icon, body text). */
|
||||
--color-banner-warning-fill: var(--banner-warning-fill);
|
||||
--color-banner-warning-border: var(--banner-warning-border);
|
||||
--color-banner-warning-icon: var(--banner-warning-icon);
|
||||
--color-banner-error-fill: var(--banner-error-fill);
|
||||
--color-banner-error-border: var(--banner-error-border);
|
||||
--color-banner-error-icon: var(--banner-error-icon);
|
||||
--color-banner-info-fill: var(--banner-info-fill);
|
||||
--color-banner-info-border: var(--banner-info-border);
|
||||
--color-banner-info-icon: var(--banner-info-icon);
|
||||
--color-banner-body: var(--banner-body);
|
||||
--color-callout-note: var(--callout-note);
|
||||
--color-callout-important: var(--callout-important);
|
||||
--color-workspace-status-done: var(--workspace-status-done);
|
||||
@@ -467,6 +478,18 @@
|
||||
--jira-priority-low: var(--callout-note);
|
||||
--status-warning-background: color-mix(in srgb, var(--status-warning) 10%, transparent);
|
||||
--status-warning-border: color-mix(in srgb, var(--status-warning) 25%, transparent);
|
||||
/* GA-P3t (Neil): banners must stand out on white panes. Border >=3:1 on the surface; icon >=3:1
|
||||
and text >=4.5:1 on the fill (measured on #fff and #fafafa). */
|
||||
--banner-warning-fill: color-mix(in srgb, #f59e0b 14%, var(--background));
|
||||
--banner-warning-border: #b45309;
|
||||
--banner-warning-icon: #b45309;
|
||||
--banner-error-fill: color-mix(in srgb, var(--destructive) 8%, var(--background));
|
||||
--banner-error-border: #c20012;
|
||||
--banner-error-icon: #c20012;
|
||||
--banner-info-fill: color-mix(in srgb, var(--foreground) 7.5%, var(--background));
|
||||
--banner-info-border: color-mix(in srgb, var(--foreground) 47%, var(--background));
|
||||
--banner-info-icon: color-mix(in srgb, var(--foreground) 65%, var(--background));
|
||||
--banner-body: color-mix(in srgb, var(--foreground) 70%, var(--background));
|
||||
/* GitHub's own hues for the two callout kinds no status token covers. */
|
||||
--callout-note: #0969da;
|
||||
--callout-important: #8250df;
|
||||
@@ -504,6 +527,17 @@
|
||||
--jira-priority-low: var(--callout-note);
|
||||
--status-warning-background: color-mix(in srgb, var(--status-warning) 10%, transparent);
|
||||
--status-warning-border: color-mix(in srgb, var(--status-warning) 25%, transparent);
|
||||
/* GA-P3t: dark keeps its fills and icons; borders raised to >=3:1 on #0a0a0a (error, info failed). */
|
||||
--banner-warning-fill: color-mix(in srgb, var(--status-warning) 10%, var(--card));
|
||||
--banner-warning-border: color-mix(in srgb, var(--status-warning) 45%, var(--card));
|
||||
--banner-warning-icon: var(--status-warning);
|
||||
--banner-error-fill: color-mix(in srgb, var(--destructive) 10%, var(--card));
|
||||
--banner-error-border: color-mix(in srgb, var(--destructive) 62%, var(--card));
|
||||
--banner-error-icon: var(--destructive);
|
||||
--banner-info-fill: var(--card);
|
||||
--banner-info-border: color-mix(in srgb, var(--foreground) 36%, var(--card));
|
||||
--banner-info-icon: var(--muted-foreground);
|
||||
--banner-body: var(--muted-foreground);
|
||||
--callout-note: #4493f8;
|
||||
--callout-important: #ab7df8;
|
||||
--git-decoration-added: #81b88b;
|
||||
|
||||
@@ -24,6 +24,7 @@ import {
|
||||
} from '@/components/ui/dropdown-menu'
|
||||
import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { BANNER_BODY_TEXT, BANNER_TONE, type BannerSeverity } from '@/components/ui/banner-tone'
|
||||
import { useReservePaneTopSpace } from '../terminal-pane/appearance/pane-top-banner/PaneTopWarningBanner'
|
||||
import type {
|
||||
CloudStripModel,
|
||||
@@ -97,27 +98,32 @@ export type CloudStripActions = {
|
||||
cancel: () => void
|
||||
}
|
||||
|
||||
/** GA-P3t: the strip's severity look; anything that isn't a warning or an error reads as info. */
|
||||
export function stripSeverity(status: CloudStripStatus): BannerSeverity {
|
||||
return status === 'warning' ? 'warning' : status === 'error' ? 'error' : 'info'
|
||||
}
|
||||
|
||||
function StatusSlot({ status }: { status: CloudStripStatus }): React.JSX.Element {
|
||||
const base = 'size-4 shrink-0'
|
||||
switch (status) {
|
||||
case 'need':
|
||||
return <CircleDashed aria-hidden className={cn(base, 'text-muted-foreground')} />
|
||||
return <CircleDashed aria-hidden className={cn(base, BANNER_TONE.info.icon)} />
|
||||
// Not set up yet (or pasting the setup token): neutral, like the agent sheet; nothing is loading.
|
||||
case 'setup':
|
||||
return <Info aria-hidden className={cn(base, 'text-muted-foreground')} />
|
||||
return <Info aria-hidden className={cn(base, BANNER_TONE.info.icon)} />
|
||||
case 'warning':
|
||||
return <TriangleAlert aria-hidden className={cn(base, 'text-status-warning-text')} />
|
||||
return <TriangleAlert aria-hidden className={cn(base, BANNER_TONE.warning.icon)} />
|
||||
case 'busy':
|
||||
return (
|
||||
<Loader2
|
||||
aria-hidden
|
||||
className={cn(base, 'text-muted-foreground motion-safe:animate-spin')}
|
||||
className={cn(base, BANNER_TONE.info.icon, 'motion-safe:animate-spin')}
|
||||
/>
|
||||
)
|
||||
case 'error':
|
||||
return <CircleAlert aria-hidden className={cn(base, 'text-destructive')} />
|
||||
return <CircleAlert aria-hidden className={cn(base, BANNER_TONE.error.icon)} />
|
||||
case 'done':
|
||||
return <CircleCheck aria-hidden className={cn(base, 'text-muted-foreground')} />
|
||||
return <CircleCheck aria-hidden className={cn(base, BANNER_TONE.info.icon)} />
|
||||
}
|
||||
}
|
||||
|
||||
@@ -200,7 +206,11 @@ export function CloudAgentSignInStrip({
|
||||
}
|
||||
}}
|
||||
className={cn(
|
||||
'grid gap-2.5 border-b border-border bg-card px-3 text-foreground outline-none',
|
||||
// GA-P3t: a severity fill and a 1px bottom border that clear contrast on white panes and
|
||||
// separate the strip from the terminal below it.
|
||||
'grid gap-2.5 border-b px-3 text-foreground outline-none',
|
||||
BANNER_TONE[stripSeverity(model.status)].surface,
|
||||
BANNER_TONE[stripSeverity(model.status)].border,
|
||||
wraps ? 'min-h-14 items-start py-2.5 [&>svg]:mt-0.5' : 'h-14 items-center',
|
||||
setupCode ? 'grid-cols-[16px_minmax(0,1fr)_auto]' : GRID[width]
|
||||
)}
|
||||
@@ -221,7 +231,8 @@ export function CloudAgentSignInStrip({
|
||||
id={detailId}
|
||||
className={cn(
|
||||
lineFit,
|
||||
'text-xs leading-4 text-muted-foreground',
|
||||
'text-xs leading-4',
|
||||
BANNER_BODY_TEXT,
|
||||
quietDetail && 'sr-only'
|
||||
)}
|
||||
>
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { CloudStatusGlyph } from '@/components/orca-cloud/CloudStatusGlyph'
|
||||
import React, { useEffect, useId, useRef, useState } from 'react'
|
||||
import { GitBranch, Loader2 } from 'lucide-react'
|
||||
import { Button } from '@/components/ui/button'
|
||||
@@ -8,7 +9,6 @@ import { cn } from '@/lib/utils'
|
||||
import { useAppStore } from '@/store'
|
||||
import { keybindingMatchesAction } from '../../../../shared/keybindings/matching'
|
||||
import type { CloudWorkspace } from '../../../../shared/cloud-workspaces/cloud-workspaces-wire'
|
||||
import { CloudStateDot } from '../orca-cloud/CloudStateDot'
|
||||
import type { CloudDotState } from '@/lib/orca-cloud/orca-cloud-workspace-state'
|
||||
import { MemberAvatar, PresenceStack } from './CloudMemberAvatars'
|
||||
import {
|
||||
@@ -228,13 +228,18 @@ export function CloudWorkspaceRow({
|
||||
aria-describedby={descriptionId}
|
||||
className="flex min-w-0 flex-1 cursor-default items-center gap-3 rounded-lg py-2 pl-3 text-left outline-none focus-visible:outline-2 focus-visible:outline-solid focus-visible:-outline-offset-2 focus-visible:outline-focus-ring"
|
||||
>
|
||||
<span
|
||||
role="img"
|
||||
aria-label={status}
|
||||
className={cn('inline-flex shrink-0', archived && 'opacity-60')}
|
||||
>
|
||||
<CloudStateDot state={dotState(w)} size="md" />
|
||||
</span>
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
<span
|
||||
role="img"
|
||||
aria-label={status}
|
||||
className={cn('inline-flex shrink-0', archived && 'opacity-60')}
|
||||
>
|
||||
<CloudStatusGlyph state={dotState(w)} size={16} />
|
||||
</span>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent side="top">{status}</TooltipContent>
|
||||
</Tooltip>
|
||||
<span className="min-w-0 flex-1">
|
||||
<span className="flex min-w-0 items-center gap-1.5">
|
||||
{/* Archived rows dim only the title and dot, so cost, time and actions stay legible. */}
|
||||
|
||||
@@ -4,6 +4,7 @@ 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 { CloudStatusGlyph, type CloudGlyphState } from '@/components/orca-cloud/CloudStatusGlyph'
|
||||
import { LOCAL_EXECUTION_HOST_ID, type ExecutionHostId } from '../../../shared/execution-host'
|
||||
import type { ExecutionHostVmState } from '../../../shared/execution-host/execution-host-health'
|
||||
|
||||
@@ -21,8 +22,8 @@ const GLYPH: Record<HostGlyphKind, typeof 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.
|
||||
* The one host glyph every surface puts before a workspace name. Orca Cloud shows its state in the
|
||||
* cloud itself (fill and colour, no badge); a recipe VM's state rides on its box as a corner dot.
|
||||
*/
|
||||
export function HostGlyph({
|
||||
kind,
|
||||
@@ -34,7 +35,7 @@ export function HostGlyph({
|
||||
}: {
|
||||
kind: HostGlyphKind
|
||||
size?: 12 | 14 | 16
|
||||
state?: CloudDotState | null
|
||||
state?: CloudGlyphState | null
|
||||
/** The badge sits in a ring of the surface's background; pass that background here. */
|
||||
badgeRingClassName?: string
|
||||
className?: string
|
||||
@@ -42,6 +43,20 @@ export function HostGlyph({
|
||||
label?: string
|
||||
}): React.JSX.Element {
|
||||
const Icon = GLYPH[kind]
|
||||
if (kind === 'orca-cloud' && state) {
|
||||
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', SIZE[size], className)}
|
||||
>
|
||||
<CloudStatusGlyph state={state} size={size} />
|
||||
</span>
|
||||
)
|
||||
}
|
||||
const badgeState = state && isDotState(state) ? state : null
|
||||
return (
|
||||
<span
|
||||
data-host-glyph={kind}
|
||||
@@ -51,7 +66,7 @@ export function HostGlyph({
|
||||
className={cn('relative inline-flex shrink-0 text-muted-foreground', SIZE[size], className)}
|
||||
>
|
||||
<Icon className={SIZE[size]} aria-hidden="true" />
|
||||
{state ? (
|
||||
{badgeState ? (
|
||||
<span
|
||||
className={cn(
|
||||
'absolute -right-1 -bottom-1 inline-flex items-center justify-center rounded-full',
|
||||
@@ -59,13 +74,17 @@ export function HostGlyph({
|
||||
badgeRingClassName
|
||||
)}
|
||||
>
|
||||
<CloudStateDot state={state} size={size === 12 ? 'badge' : 'md'} />
|
||||
<CloudStateDot state={badgeState} size={size === 12 ? 'badge' : 'md'} />
|
||||
</span>
|
||||
) : null}
|
||||
</span>
|
||||
)
|
||||
}
|
||||
|
||||
function isDotState(state: CloudGlyphState): state is CloudDotState {
|
||||
return state !== 'goingToSleep' && state !== 'restarting'
|
||||
}
|
||||
|
||||
/** A recipe VM's lifecycle on the same dot vocabulary as Orca Cloud (null = running). */
|
||||
export function vmStateToDot(state: ExecutionHostVmState | null): CloudDotState {
|
||||
switch (state) {
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
// @vitest-environment happy-dom
|
||||
// JA-25 follow-up (Neil): the Run on menu's Orca Cloud row no longer shows "N sandbox hours left".
|
||||
import { cleanup, render, screen } from '@testing-library/react'
|
||||
import { afterEach, describe, expect, it, vi } from 'vitest'
|
||||
import { TooltipProvider } from '@/components/ui/tooltip'
|
||||
import { RUN_ON_SHOWS_HOURS_LEFT, RunTargetOrcaCloudRow } from './RunTargetOrcaCloudRow'
|
||||
import type { OrcaCloudRunTargetAccess } from './orca-cloud-run-target-access'
|
||||
|
||||
afterEach(cleanup)
|
||||
|
||||
function row(access: OrcaCloudRunTargetAccess) {
|
||||
render(
|
||||
<TooltipProvider>
|
||||
<div role="listbox">
|
||||
<RunTargetOrcaCloudRow
|
||||
recipe={null}
|
||||
access={access}
|
||||
pending={false}
|
||||
armed={false}
|
||||
current={false}
|
||||
optionId="cloud"
|
||||
onArm={vi.fn()}
|
||||
onSelect={vi.fn()}
|
||||
onBlockedAction={vi.fn()}
|
||||
/>
|
||||
</div>
|
||||
</TooltipProvider>
|
||||
)
|
||||
return screen.getByRole('option')
|
||||
}
|
||||
|
||||
describe('Run on → Orca Cloud row', () => {
|
||||
it('is off by default', () => {
|
||||
expect(RUN_ON_SHOWS_HOURS_LEFT).toBe(false)
|
||||
})
|
||||
|
||||
it('entitled (plan or trial): reads "Orca Cloud" / "Sandbox", no hours left', () => {
|
||||
const plan = row({ state: 'entitled', remainingSeconds: 41 * 3600 })
|
||||
expect(plan.textContent).toContain('Orca Cloud')
|
||||
expect(plan.textContent).toContain('Sandbox')
|
||||
expect(plan.textContent).not.toMatch(/hours? left/)
|
||||
cleanup()
|
||||
const trial = row({ state: 'entitled', remainingSeconds: 3 * 3600, trial: true })
|
||||
expect(trial.textContent).not.toMatch(/hours? left/)
|
||||
})
|
||||
|
||||
it('loading: no placeholder where the hours were, only the screen-reader status', () => {
|
||||
const loading = row({ state: 'loading' })
|
||||
expect(loading.querySelector('[data-slot="skeleton"]')).toBeNull()
|
||||
expect(loading.textContent).toContain('Checking your plan…')
|
||||
})
|
||||
|
||||
it('blocked states keep their reason and fix', () => {
|
||||
const out = row({ state: 'out-of-hours', cause: 'hours', canManageBilling: true })
|
||||
expect(out.textContent).toContain('Out of sandbox hours')
|
||||
expect(out.textContent).toContain('Turn on overage')
|
||||
})
|
||||
})
|
||||
@@ -54,7 +54,7 @@ function RowAction({
|
||||
|
||||
/**
|
||||
* "Sandbox · 8 vCPU · 16 GB" in the Run on menu row. The specs never split: below a 28rem
|
||||
* container they drop out whole so "N sandbox hours left" keeps its room.
|
||||
* container they drop out whole rather than wrap.
|
||||
*/
|
||||
export function OrcaCloudSpecs({ t }: { t: Translate }): React.JSX.Element {
|
||||
return (
|
||||
@@ -75,6 +75,13 @@ export function OrcaCloudSpecs({ t }: { t: Translate }): React.JSX.Element {
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the Run on menu's Orca Cloud row shows "N sandbox hours left". Off for now (Neil, JA-25
|
||||
* follow-up): the row reads "Orca Cloud" / "Sandbox"; hours live on Account + Billing and the plan
|
||||
* blocker. Flip to true to bring them back, along with the loading placeholder that holds their place.
|
||||
*/
|
||||
export const RUN_ON_SHOWS_HOURS_LEFT = false
|
||||
|
||||
/** "41 sandbox hours left" (locale number, plural-aware), or null when not entitled. */
|
||||
export function useOrcaCloudHoursLeft(access: OrcaCloudRunTargetAccess): string | null {
|
||||
const t = useTranslate()
|
||||
@@ -204,24 +211,31 @@ function OrcaCloudMeta({
|
||||
const t = useTranslate()
|
||||
const hoursLeft = useOrcaCloudHoursLeft(access)
|
||||
switch (access.state) {
|
||||
case 'loading':
|
||||
return (
|
||||
<span className="ml-2 flex shrink-0 self-center">
|
||||
<Skeleton className="h-3 w-12" />
|
||||
<span className="sr-only">
|
||||
{t(
|
||||
'auto.components.new.workspace.RunTargetCombobox.orcaCloudChecking',
|
||||
'Checking your plan…'
|
||||
)}
|
||||
</span>
|
||||
case 'loading': {
|
||||
const checking = (
|
||||
<span className="sr-only">
|
||||
{t(
|
||||
'auto.components.new.workspace.RunTargetCombobox.orcaCloudChecking',
|
||||
'Checking your plan…'
|
||||
)}
|
||||
</span>
|
||||
)
|
||||
// The placeholder only holds the hours' place; without hours it would just flash.
|
||||
return RUN_ON_SHOWS_HOURS_LEFT ? (
|
||||
<span className="ml-2 flex shrink-0 self-center">
|
||||
<Skeleton className="h-3 w-12" />
|
||||
{checking}
|
||||
</span>
|
||||
) : (
|
||||
checking
|
||||
)
|
||||
}
|
||||
case 'entitled':
|
||||
return (
|
||||
return RUN_ON_SHOWS_HOURS_LEFT ? (
|
||||
<span className="ml-2 shrink-0 self-center text-xs tabular-nums text-muted-foreground">
|
||||
{hoursLeft}
|
||||
</span>
|
||||
)
|
||||
) : null
|
||||
case 'signed-out':
|
||||
return (
|
||||
<RowAction
|
||||
@@ -302,7 +316,7 @@ function showsMetaAfterStart(access: OrcaCloudRunTargetAccess, preflight: boolea
|
||||
}
|
||||
}
|
||||
|
||||
/** Orca Cloud as a first-class Run-on target, with its hours or the fix for what blocks it. */
|
||||
/** Orca Cloud as a first-class Run-on target, with the fix for what blocks it (and hours, behind RUN_ON_SHOWS_HOURS_LEFT). */
|
||||
export function RunTargetOrcaCloudRow({
|
||||
recipe,
|
||||
access,
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
import React from 'react'
|
||||
import { defineFixture } from '../../component-fixtures/component-fixture'
|
||||
import { cloudGlyphStateLabel } from './cloud-state-copy'
|
||||
import { CloudStatusGlyph, type CloudGlyphState } from './CloudStatusGlyph'
|
||||
|
||||
const STATES: CloudGlyphState[] = [
|
||||
'running',
|
||||
'waking',
|
||||
'starting',
|
||||
'restarting',
|
||||
'goingToSleep',
|
||||
'sleeping',
|
||||
'archived',
|
||||
'unresponsive',
|
||||
'failed',
|
||||
'wakeFailed',
|
||||
'unknown'
|
||||
]
|
||||
|
||||
// The sidebar's three row backgrounds: plain, hover and selected.
|
||||
const BACKGROUNDS = [
|
||||
{ name: 'sidebar', className: 'bg-worktree-sidebar' },
|
||||
{ name: 'hover', className: 'bg-worktree-sidebar-accent/55' },
|
||||
{ name: 'selected', className: 'bg-worktree-sidebar-accent' }
|
||||
]
|
||||
|
||||
function Sheet({ greyscale = false }: { greyscale?: boolean }): React.JSX.Element {
|
||||
return (
|
||||
<div
|
||||
className="flex flex-col gap-2 bg-worktree-sidebar p-3 text-[11px] text-worktree-sidebar-foreground"
|
||||
style={greyscale ? { filter: 'grayscale(1)' } : undefined}
|
||||
>
|
||||
{BACKGROUNDS.map((background) => (
|
||||
<div key={background.name} className={`rounded-md p-2 ${background.className}`}>
|
||||
<div className="mb-1.5 text-muted-foreground">{background.name}</div>
|
||||
<div className="grid grid-cols-11 gap-x-2 gap-y-1.5">
|
||||
{STATES.map((state) => (
|
||||
<div key={state} className="flex flex-col items-center gap-1">
|
||||
<div className="flex items-end gap-1.5">
|
||||
<CloudStatusGlyph state={state} size={12} />
|
||||
<CloudStatusGlyph state={state} size={14} />
|
||||
<CloudStatusGlyph state={state} size={16} />
|
||||
</div>
|
||||
{/* Enlarged, to judge the texture and colours. */}
|
||||
<CloudStatusGlyph state={state} size={16} className="size-12" />
|
||||
<span className="w-16 truncate text-center text-[10px] text-muted-foreground">
|
||||
{cloudGlyphStateLabel(state)}
|
||||
</span>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
/** Every state at 12, 14 and 16 px on the sidebar's plain, hover and selected backgrounds. */
|
||||
export const allStates = defineFixture({
|
||||
width: 960,
|
||||
render: () => <Sheet />
|
||||
})
|
||||
|
||||
/** The same sheet in greyscale: fill shape alone must tell every state apart. */
|
||||
export const greyscale = defineFixture({
|
||||
width: 960,
|
||||
render: () => <Sheet greyscale />
|
||||
})
|
||||
@@ -0,0 +1,42 @@
|
||||
import { renderToStaticMarkup } from 'react-dom/server'
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { HostGlyph } from '@/components/host-row-icon'
|
||||
import { CLOUD_GLYPH_SHAPE } from './CloudStatusGlyph'
|
||||
|
||||
describe('cloud status glyph', () => {
|
||||
it('shows a cloud workspace state in the cloud itself, with no dot badge', () => {
|
||||
const html = renderToStaticMarkup(<HostGlyph kind="orca-cloud" state="sleeping" />)
|
||||
expect(html).toContain('data-cloud-glyph-state="sleeping"')
|
||||
expect(html).not.toContain('data-cloud-state=')
|
||||
})
|
||||
|
||||
it('keeps the corner dot for a recipe VM', () => {
|
||||
const html = renderToStaticMarkup(<HostGlyph kind="recipe-vm" state="sleeping" />)
|
||||
expect(html).toContain('data-cloud-state="sleeping"')
|
||||
expect(html).not.toContain('data-cloud-glyph-state')
|
||||
})
|
||||
|
||||
it('keeps one cloud shape for every state but Archived (dashed) and unknown (dotted edge)', () => {
|
||||
const groups = new Map<string, string[]>()
|
||||
for (const [state, shape] of Object.entries(CLOUD_GLYPH_SHAPE)) {
|
||||
const key = `${shape.fill}/${shape.outline}`
|
||||
groups.set(key, [...(groups.get(key) ?? []), state])
|
||||
}
|
||||
// Option A: colour carries state (and the row and accessible name say it); Archived is B's.
|
||||
expect(Object.fromEntries(groups)).toEqual({
|
||||
'full/solid': [
|
||||
'running',
|
||||
'waking',
|
||||
'starting',
|
||||
'restarting',
|
||||
'goingToSleep',
|
||||
'sleeping',
|
||||
'unresponsive',
|
||||
'failed',
|
||||
'wakeFailed'
|
||||
],
|
||||
'none/dashed': ['archived'],
|
||||
'full/dotted': ['unknown']
|
||||
})
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,124 @@
|
||||
import React, { useId } from 'react'
|
||||
import { cn } from '@/lib/utils'
|
||||
import type { CloudDotState } from '@/lib/orca-cloud/orca-cloud-workspace-state'
|
||||
|
||||
/** A cloud workspace's state as the glyph shows it: the dot's vocabulary plus two transitions. */
|
||||
export type CloudGlyphState = CloudDotState | 'goingToSleep' | 'restarting'
|
||||
|
||||
/**
|
||||
* Status is the colour of the whole cloud (Neil's pick, option A): every state fills the cloud
|
||||
* with a fine dot texture tinted by state; no badge and no shape change. Archived alone is a hollow
|
||||
* dashed outline (option B's), and a state not yet known is a paler fill with a dotted edge.
|
||||
* The state is also named in the row and in the accessible label, so colour is never the only signal.
|
||||
*/
|
||||
type GlyphShape = {
|
||||
fill: 'full' | 'none'
|
||||
outline: 'solid' | 'dashed' | 'dotted'
|
||||
/** Text colour, so the outline, fill and texture share it (currentColor). */
|
||||
tone: string
|
||||
/** A paler fill (the outline keeps full strength, so it stays ≥3:1). */
|
||||
faint?: boolean
|
||||
}
|
||||
|
||||
// Contrast ≥3:1 against the sidebar, row hover and selected backgrounds, light and dark. Light
|
||||
// warning is amber nudged toward the foreground (plain amber is 2.4:1 on the selected row).
|
||||
const SUCCESS = 'text-status-success'
|
||||
const WARNING =
|
||||
'text-[color-mix(in_srgb,var(--status-warning)_85%,var(--foreground))] dark:text-status-warning'
|
||||
const DESTRUCTIVE = 'text-destructive'
|
||||
const MUTED = 'text-muted-foreground'
|
||||
const ACCENT = 'text-blue-600 dark:text-blue-400'
|
||||
|
||||
export const CLOUD_GLYPH_SHAPE: Record<CloudGlyphState, GlyphShape> = {
|
||||
running: { fill: 'full', outline: 'solid', tone: SUCCESS },
|
||||
waking: { fill: 'full', outline: 'solid', tone: ACCENT },
|
||||
starting: { fill: 'full', outline: 'solid', tone: ACCENT },
|
||||
restarting: { fill: 'full', outline: 'solid', tone: ACCENT },
|
||||
goingToSleep: { fill: 'full', outline: 'solid', tone: MUTED },
|
||||
sleeping: { fill: 'full', outline: 'solid', tone: MUTED },
|
||||
archived: { fill: 'none', outline: 'dashed', tone: MUTED },
|
||||
unresponsive: { fill: 'full', outline: 'solid', tone: WARNING },
|
||||
failed: { fill: 'full', outline: 'solid', tone: DESTRUCTIVE },
|
||||
wakeFailed: { fill: 'full', outline: 'solid', tone: DESTRUCTIVE },
|
||||
unknown: { fill: 'full', outline: 'dotted', tone: MUTED, faint: true }
|
||||
}
|
||||
|
||||
// Lucide's cloud, so the glyph keeps the shape every other surface uses.
|
||||
const CLOUD_PATH = 'M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z'
|
||||
const DASH: Record<GlyphShape['outline'], string | undefined> = {
|
||||
solid: undefined,
|
||||
dashed: '3.2 2.4',
|
||||
dotted: '0.1 2.6'
|
||||
}
|
||||
|
||||
const SIZE = { 12: 'size-3', 14: 'size-3.5', 16: 'size-4' } as const
|
||||
|
||||
/**
|
||||
* The Orca Cloud glyph with its state in the cloud itself (no corner badge). The filled area is a
|
||||
* fine dot grid on 2x+ screens; at 1x a 12–16 px glyph has no room for a readable grid, so it is a
|
||||
* solid, slightly lighter fill there.
|
||||
*/
|
||||
export function CloudStatusGlyph({
|
||||
state,
|
||||
size = 12,
|
||||
className
|
||||
}: {
|
||||
state: CloudGlyphState
|
||||
size?: 12 | 14 | 16
|
||||
className?: string
|
||||
}): React.JSX.Element {
|
||||
const shape = CLOUD_GLYPH_SHAPE[state]
|
||||
const id = useId().replace(/:/g, '')
|
||||
return (
|
||||
<svg
|
||||
viewBox="0 0 24 24"
|
||||
aria-hidden="true"
|
||||
data-cloud-glyph-state={state}
|
||||
className={cn('shrink-0', SIZE[size], shape.tone, className)}
|
||||
>
|
||||
{shape.fill === 'full' ? (
|
||||
<>
|
||||
<defs>
|
||||
<clipPath id={`${id}-cloud`}>
|
||||
<path d={CLOUD_PATH} />
|
||||
</clipPath>
|
||||
<pattern id={`${id}-grain`} width="2.4" height="2.4" patternUnits="userSpaceOnUse">
|
||||
<circle cx="1.2" cy="1.2" r="0.75" fill="currentColor" />
|
||||
</pattern>
|
||||
</defs>
|
||||
<g clipPath={`url(#${id}-cloud)`}>
|
||||
{/* 1x: solid. 2x+: a light wash under a dot grid, so the fill reads as texture. */}
|
||||
<rect
|
||||
width="24"
|
||||
height="24"
|
||||
fill="currentColor"
|
||||
className={
|
||||
shape.faint
|
||||
? 'opacity-20 [@media(min-resolution:2dppx)]:opacity-10'
|
||||
: 'opacity-55 [@media(min-resolution:2dppx)]:opacity-25'
|
||||
}
|
||||
/>
|
||||
<rect
|
||||
width="24"
|
||||
height="24"
|
||||
fill={`url(#${id}-grain)`}
|
||||
className={cn(
|
||||
'hidden [@media(min-resolution:2dppx)]:inline',
|
||||
shape.faint && 'opacity-45'
|
||||
)}
|
||||
/>
|
||||
</g>
|
||||
</>
|
||||
) : null}
|
||||
<path
|
||||
d={CLOUD_PATH}
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
strokeWidth="2"
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
strokeDasharray={DASH[shape.outline]}
|
||||
/>
|
||||
</svg>
|
||||
)
|
||||
}
|
||||
@@ -1,11 +1,11 @@
|
||||
import React from 'react'
|
||||
import type { LucideIcon } from 'lucide-react'
|
||||
import type { CloudDotState } from '@/lib/orca-cloud/orca-cloud-workspace-state'
|
||||
import { CloudStateDot } from './CloudStateDot'
|
||||
import { CloudStatusGlyph } from './CloudStatusGlyph'
|
||||
|
||||
/**
|
||||
* The one header for full-pane Orca Cloud views (asleep, archived): a small state icon, the workspace name
|
||||
* as the title, a state line led by the state dot, and one primary action.
|
||||
* as the title, a state line led by the cloud showing that state, and one primary action.
|
||||
*/
|
||||
export function CloudWorkspaceHeader({
|
||||
icon: Icon,
|
||||
@@ -42,7 +42,7 @@ export function CloudWorkspaceHeader({
|
||||
{title}
|
||||
</h2>
|
||||
<p className="flex items-center gap-1.5 text-xs text-muted-foreground">
|
||||
<CloudStateDot state={state} size="md" />
|
||||
<CloudStatusGlyph state={state} size={14} />
|
||||
<span className="truncate" title={stateTitle}>
|
||||
{stateLine}
|
||||
</span>
|
||||
|
||||
@@ -4,7 +4,9 @@ import { useTranslate } from '@/i18n/use-translate'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { HostGlyph } from '@/components/host-row-icon'
|
||||
import { FOCUS_RING } from './cloud-focus'
|
||||
import { cloudStateLabel } from './cloud-state-copy'
|
||||
import { cloudGlyphStateLabel } from './cloud-state-copy'
|
||||
import type { CloudGlyphState } from './CloudStatusGlyph'
|
||||
import { useIsWorktreeGoingToSleep } from '@/lib/worktree-sleep-view'
|
||||
import { CloudWorkspaceStatusPanel } from './CloudWorkspaceStatusPanel'
|
||||
import { useCloudStatusPolling, useCloudWorkspaceView } from './use-cloud-workspace-view'
|
||||
import { useCloudPanelActions } from './use-cloud-panel-actions'
|
||||
@@ -52,6 +54,23 @@ export function CloudWorkspaceMark({
|
||||
)
|
||||
}
|
||||
|
||||
const PROBLEM: ReadonlySet<CloudGlyphState> = new Set(['failed', 'wakeFailed'])
|
||||
|
||||
/** The view's state plus the two transitions the cloud shows: going to sleep and restarting. */
|
||||
function useCloudGlyphState(
|
||||
workspaceId: string,
|
||||
view: ReturnType<typeof useCloudWorkspaceView>
|
||||
): CloudGlyphState {
|
||||
const goingToSleep = useIsWorktreeGoingToSleep(workspaceId)
|
||||
if (PROBLEM.has(view.state)) {
|
||||
return view.state
|
||||
}
|
||||
if (goingToSleep) {
|
||||
return 'goingToSleep'
|
||||
}
|
||||
return view.pending === 'restart' ? 'restarting' : view.state
|
||||
}
|
||||
|
||||
function CloudWorkspaceMarkInner({
|
||||
workspaceId,
|
||||
view,
|
||||
@@ -104,8 +123,10 @@ function CloudWorkspaceMarkInner({
|
||||
clearTimer()
|
||||
setOpen((current) => (current === 'hover' ? 'pinned' : current))
|
||||
}, [clearTimer])
|
||||
const glyphState = useCloudGlyphState(workspaceId, view)
|
||||
// The state's name: what the cloud's fill and colour show, said out loud (the card's header shows it too).
|
||||
const label = t('orcaCloudWorkspace.cloudMarkLabel', 'Cloud workspace · {{state}}', {
|
||||
state: cloudStateLabel(view.state, t)
|
||||
state: cloudGlyphStateLabel(glyphState, t)
|
||||
})
|
||||
return (
|
||||
<Popover
|
||||
@@ -143,11 +164,10 @@ function CloudWorkspaceMarkInner({
|
||||
className={cn(
|
||||
// 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
|
||||
)}
|
||||
>
|
||||
<HostGlyph kind="orca-cloud" size={12} state={view.state} className="text-inherit" />
|
||||
<HostGlyph kind="orca-cloud" size={12} state={glyphState} />
|
||||
</button>
|
||||
</PopoverTrigger>
|
||||
<PopoverContent
|
||||
|
||||
@@ -13,6 +13,8 @@ import {
|
||||
} from 'lucide-react'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { useTranslate } from '@/i18n/use-translate'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { BANNER_BODY_TEXT, BANNER_TONE } from '@/components/ui/banner-tone'
|
||||
import type { CloudOomEvent } from '../../../../shared/hosted-sandbox/cloud-workspace-api'
|
||||
|
||||
export type CloudNoticeKind = { kind: 'unresponsive' } | { kind: 'oom'; oom: CloudOomEvent }
|
||||
@@ -43,20 +45,26 @@ function CloudNoticeCard({
|
||||
}): React.JSX.Element {
|
||||
const t = useTranslate()
|
||||
const titleId = useId()
|
||||
// GA-P3t: trouble now reads as a warning; news from a background check as info.
|
||||
const tone = BANNER_TONE[role === 'alert' ? 'warning' : 'info']
|
||||
return (
|
||||
<div
|
||||
role={role}
|
||||
aria-labelledby={titleId}
|
||||
data-cloud-notice={noticeKind}
|
||||
className="pointer-events-auto flex w-[22rem] max-w-[calc(100%-1.5rem)] items-start gap-3 rounded-lg border border-border bg-card p-3 text-card-foreground shadow-[0_8px_24px_rgba(0,0,0,0.12)] dark:shadow-[0_8px_24px_rgba(0,0,0,0.4)] motion-safe:animate-in motion-safe:fade-in-0 motion-safe:slide-in-from-top-1"
|
||||
className={cn(
|
||||
'pointer-events-auto flex w-[22rem] max-w-[calc(100%-1.5rem)] items-start gap-3 rounded-lg border p-3 text-card-foreground shadow-[0_8px_24px_rgba(0,0,0,0.12)] dark:shadow-[0_8px_24px_rgba(0,0,0,0.4)] motion-safe:animate-in motion-safe:fade-in-0 motion-safe:slide-in-from-top-1',
|
||||
tone.surface,
|
||||
tone.border
|
||||
)}
|
||||
>
|
||||
<Icon className="mt-0.5 size-4 shrink-0 text-status-warning-text" aria-hidden="true" />
|
||||
<Icon className={cn('mt-0.5 size-4 shrink-0', tone.icon)} aria-hidden="true" />
|
||||
<div className="min-w-0 flex-1 space-y-2">
|
||||
<div className="space-y-0.5">
|
||||
<div id={titleId} className="text-sm font-medium leading-5">
|
||||
{title}
|
||||
</div>
|
||||
<p className="text-xs text-muted-foreground">{detail}</p>
|
||||
<p className={cn('text-xs', BANNER_BODY_TEXT)}>{detail}</p>
|
||||
</div>
|
||||
{action}
|
||||
</div>
|
||||
|
||||
@@ -35,7 +35,7 @@ import {
|
||||
} from '@/lib/orca-cloud/orca-cloud-workspace-store'
|
||||
import { useCloudSync } from '@/lib/orca-cloud/cloud-sync-store'
|
||||
import type { CloudSyncView } from '../../../../shared/cloud-sync/cloud-sync-contract'
|
||||
import { CloudStateDot } from './CloudStateDot'
|
||||
import { CloudStatusGlyph } from './CloudStatusGlyph'
|
||||
import { cloudStateLabel } from './cloud-state-copy'
|
||||
import { CloudWorkspaceSyncSection } from './CloudWorkspaceSyncSection'
|
||||
import { CloudWorkspaceCardDetails, MeterSkeleton } from './CloudWorkspaceCardDetails'
|
||||
@@ -215,7 +215,10 @@ export function CloudWorkspaceStatusPanel({
|
||||
<div className="truncate text-[13px] font-medium text-foreground">{name}</div>
|
||||
) : null}
|
||||
<div className="mt-0.5 flex min-w-0 items-center gap-1.5 text-muted-foreground">
|
||||
<CloudStateDot state={unavailable ? 'unknown' : state} size="md" />
|
||||
<CloudStatusGlyph
|
||||
state={unavailable ? 'unknown' : restarting ? 'restarting' : state}
|
||||
size={14}
|
||||
/>
|
||||
<span className="min-w-0 truncate">
|
||||
<span className="text-foreground">
|
||||
{unavailable ? (
|
||||
|
||||
@@ -4,6 +4,8 @@ import { useAppStore } from '@/store'
|
||||
import { useTranslate } from '@/i18n/use-translate'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { Textarea } from '@/components/ui/textarea'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { BANNER_BODY_TEXT, BANNER_TONE } from '@/components/ui/banner-tone'
|
||||
import {
|
||||
canQueueVmCreationPrompt,
|
||||
queueVmCreationPrompt,
|
||||
@@ -182,15 +184,28 @@ export function OrcaCloudQueuedPromptView({
|
||||
|
||||
return (
|
||||
<div
|
||||
className="flex items-start gap-2 rounded-md border border-border/60 bg-muted/30 px-3 py-2"
|
||||
// GA-P3t: a held prompt waits on the agent's setup (warning); a queued one is info.
|
||||
className={cn(
|
||||
'flex items-start gap-2 rounded-md border px-3 py-2',
|
||||
BANNER_TONE[held ? 'warning' : 'info'].surface,
|
||||
BANNER_TONE[held ? 'warning' : 'info'].border
|
||||
)}
|
||||
data-orca-cloud-queued-prompt="queued"
|
||||
>
|
||||
<Clock3 className="mt-0.5 size-3.5 shrink-0 text-muted-foreground" aria-hidden="true" />
|
||||
<Clock3
|
||||
className={cn('mt-0.5 size-3.5 shrink-0', BANNER_TONE[held ? 'warning' : 'info'].icon)}
|
||||
aria-hidden="true"
|
||||
/>
|
||||
<div className="min-w-0 flex-1">
|
||||
<p className="text-xs font-medium text-foreground">
|
||||
{queuedTitle(t, agentName, { held, editable, draft: isDraftDelivery })}
|
||||
</p>
|
||||
<p className="mt-0.5 line-clamp-3 text-xs whitespace-pre-wrap break-words text-muted-foreground">
|
||||
<p
|
||||
className={cn(
|
||||
'mt-0.5 line-clamp-3 text-xs whitespace-pre-wrap break-words',
|
||||
BANNER_BODY_TEXT
|
||||
)}
|
||||
>
|
||||
{prompt}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
@@ -2,6 +2,7 @@ import { translate } from '@/i18n/i18n'
|
||||
import type { Translate } from '@/i18n/use-translate'
|
||||
import type { CloudDotState } from '@/lib/orca-cloud/orca-cloud-workspace-state'
|
||||
import { archivedSnapshotLine } from './archive-snapshot-copy'
|
||||
import type { CloudGlyphState } from './CloudStatusGlyph'
|
||||
|
||||
export function cloudStateLabel(state: CloudDotState, t: Translate = translate): string {
|
||||
switch (state) {
|
||||
@@ -26,6 +27,17 @@ export function cloudStateLabel(state: CloudDotState, t: Translate = translate):
|
||||
}
|
||||
}
|
||||
|
||||
/** The cloud glyph's state name: the dot's states plus its two transitions. */
|
||||
export function cloudGlyphStateLabel(state: CloudGlyphState, t: Translate = translate): string {
|
||||
if (state === 'goingToSleep') {
|
||||
return t('orcaCloudWorkspace.state.goingToSleep', 'Going to sleep…')
|
||||
}
|
||||
if (state === 'restarting') {
|
||||
return t('orcaCloudWorkspace.state.restarting', 'Restarting')
|
||||
}
|
||||
return cloudStateLabel(state, t)
|
||||
}
|
||||
|
||||
/** One line under the state in the status panel; null where the state says enough on its own. */
|
||||
export function cloudStateDetail(
|
||||
state: CloudDotState,
|
||||
|
||||
@@ -15,6 +15,7 @@ import { toast } from 'sonner'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { useTranslate } from '@/i18n/use-translate'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { BANNER_BODY_TEXT, BANNER_TONE } from '@/components/ui/banner-tone'
|
||||
import { useAppStore } from '@/store'
|
||||
|
||||
export type CloudToastPriority = 'action' | 'warning' | 'info'
|
||||
@@ -339,7 +340,12 @@ export function CloudToastCard({
|
||||
aria-hidden={quiet || undefined}
|
||||
aria-label={!single ? view.label : undefined}
|
||||
role={single ? undefined : 'group'}
|
||||
className="w-[var(--width,356px)] max-w-full rounded-lg border border-border bg-card font-sans text-card-foreground shadow-[0_8px_24px_rgba(0,0,0,0.12)] dark:shadow-[0_8px_24px_rgba(0,0,0,0.4)]"
|
||||
// GA-P3t: the severity look, so a notice never blends into a white pane under it.
|
||||
className={cn(
|
||||
'w-[var(--width,356px)] max-w-full rounded-lg border font-sans text-card-foreground shadow-[0_8px_24px_rgba(0,0,0,0.12)] dark:shadow-[0_8px_24px_rgba(0,0,0,0.4)]',
|
||||
BANNER_TONE[warning ? 'warning' : 'info'].surface,
|
||||
BANNER_TONE[warning ? 'warning' : 'info'].border
|
||||
)}
|
||||
>
|
||||
<ul className="divide-y divide-border">
|
||||
{view.lines.map((line) => (
|
||||
@@ -347,7 +353,7 @@ export function CloudToastCard({
|
||||
{warning ? (
|
||||
<TriangleAlert
|
||||
aria-hidden
|
||||
className="mt-0.5 size-3.5 shrink-0 text-status-warning-text"
|
||||
className={cn('mt-0.5 size-3.5 shrink-0', BANNER_TONE.warning.icon)}
|
||||
/>
|
||||
) : null}
|
||||
{/* The sentence reads first; its one action sits under it so neither gets squeezed. */}
|
||||
@@ -355,7 +361,7 @@ export function CloudToastCard({
|
||||
<div className="space-y-0.5">
|
||||
<p className="text-xs leading-5 text-foreground">{line.text}</p>
|
||||
{line.description ? (
|
||||
<p className="text-xs text-muted-foreground">{line.description}</p>
|
||||
<p className={cn('text-xs', BANNER_BODY_TEXT)}>{line.description}</p>
|
||||
) : null}
|
||||
</div>
|
||||
{line.action ? (
|
||||
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
import { defineFixture } from '../../../../component-fixtures/component-fixture'
|
||||
import { ManagedDataAccountsSection } from './ManagedDataAccountsSection'
|
||||
|
||||
function Frame(): React.JSX.Element {
|
||||
return (
|
||||
<div className="bg-background p-6">
|
||||
<ManagedDataAccountsSection provider="opencode" target={{ kind: 'local' }} />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
/** The CLI steps start hidden behind "Use from the command line". */
|
||||
export const cliCollapsed = defineFixture({ width: 720, render: () => <Frame /> })
|
||||
|
||||
export const cliOpen = defineFixture({
|
||||
width: 720,
|
||||
render: () => <Frame />,
|
||||
interact: async (frame) => {
|
||||
const trigger = [...frame.querySelectorAll('button')].find((button) =>
|
||||
button.textContent?.includes('Use from the command line')
|
||||
)
|
||||
trigger?.click()
|
||||
await new Promise((resolve) => setTimeout(resolve, 200))
|
||||
}
|
||||
})
|
||||
+37
-15
@@ -6,7 +6,10 @@ import type {
|
||||
ManagedDataAccountProvider,
|
||||
ManagedDataAccountsState
|
||||
} from '../../../../../../shared/managed-account-types'
|
||||
import { ChevronDown } from 'lucide-react'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { Button } from '../../../ui/button'
|
||||
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from '../../../ui/collapsible'
|
||||
import { Badge } from '../../../ui/badge'
|
||||
import {
|
||||
Dialog,
|
||||
@@ -33,6 +36,7 @@ export function ManagedDataAccountsSection({
|
||||
const [busy, setBusy] = useState(false)
|
||||
const [removeId, setRemoveId] = useState<string | null>(null)
|
||||
const [copied, setCopied] = useState(false)
|
||||
const [cliOpen, setCliOpen] = useState(false)
|
||||
const environmentId = target.kind === 'environment' ? target.environmentId : null
|
||||
|
||||
useEffect(() => {
|
||||
@@ -100,22 +104,40 @@ export function ManagedDataAccountsSection({
|
||||
)}
|
||||
>
|
||||
<div className="space-y-3 py-3">
|
||||
<code className="text-xs">{command}</code>
|
||||
<Collapsible open={cliOpen} onOpenChange={setCliOpen}>
|
||||
<CollapsibleTrigger asChild>
|
||||
<Button type="button" variant="quiet" size="xs" className="-ml-2">
|
||||
{t('accounts.managedData.useCli', 'Use from the command line')}
|
||||
<ChevronDown
|
||||
aria-hidden
|
||||
className={cn(
|
||||
'size-3 transition-transform motion-reduce:transition-none',
|
||||
cliOpen && 'rotate-180'
|
||||
)}
|
||||
/>
|
||||
</Button>
|
||||
</CollapsibleTrigger>
|
||||
<CollapsibleContent className="mt-2">
|
||||
<div className="space-y-2">
|
||||
<code className="block text-xs">{command}</code>
|
||||
<Button
|
||||
variant="outline"
|
||||
size="sm"
|
||||
onClick={() => {
|
||||
void window.api.ui
|
||||
.writeClipboardText(command)
|
||||
.then(() => setCopied(true))
|
||||
.catch((cause: unknown) => setError(String(cause)))
|
||||
}}
|
||||
>
|
||||
{copied
|
||||
? t('accounts.managedData.copied', 'Copied')
|
||||
: t('accounts.managedData.add', 'Copy add account command')}
|
||||
</Button>
|
||||
</div>
|
||||
</CollapsibleContent>
|
||||
</Collapsible>
|
||||
<div className="flex gap-2">
|
||||
<Button
|
||||
variant="outline"
|
||||
size="sm"
|
||||
onClick={() => {
|
||||
void window.api.ui
|
||||
.writeClipboardText(command)
|
||||
.then(() => setCopied(true))
|
||||
.catch((cause: unknown) => setError(String(cause)))
|
||||
}}
|
||||
>
|
||||
{copied
|
||||
? t('accounts.managedData.copied', 'Copied')
|
||||
: t('accounts.managedData.add', 'Copy add account command')}
|
||||
</Button>
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
|
||||
@@ -0,0 +1,271 @@
|
||||
import { useId, useState } from 'react'
|
||||
import { Check, CircleDashed, Minus } from 'lucide-react'
|
||||
import { Switch } from '@/components/ui/switch'
|
||||
import { useTranslate } from '@/i18n/use-translate'
|
||||
import { cn } from '@/lib/utils'
|
||||
import type { AgentConfigSyncRow } from '../../../../../../shared/agent-config-sync/agent-config-sync-contract'
|
||||
import { SettingsSegmentedControl } from '../../form-controls/SettingsSegmentedControl'
|
||||
import {
|
||||
cloudSkillsDisplayName,
|
||||
cloudSkillsEntryCount,
|
||||
cloudSkillsEntryKeys,
|
||||
cloudSkillsEntryKindLabel,
|
||||
cloudSkillsKindLabel,
|
||||
cloudSkillsRowIncluded,
|
||||
cloudSkillsRowNote,
|
||||
cloudSkillsRowStateLabel,
|
||||
cloudSkillsRowToggleable,
|
||||
type CloudSkillsEntry,
|
||||
type CloudSkillsGroups
|
||||
} from './cloud-skills-sync-copy'
|
||||
import {
|
||||
cloudSkillsFilterCounts,
|
||||
cloudSkillsFilterGroups,
|
||||
cloudSkillsFilterIsEmpty,
|
||||
type CloudSkillsFilter
|
||||
} from './cloud-skills-filter'
|
||||
|
||||
function RowIcon({
|
||||
row,
|
||||
included
|
||||
}: {
|
||||
row: AgentConfigSyncRow
|
||||
included: boolean
|
||||
}): React.JSX.Element {
|
||||
if (row.state === 'synced' && included) {
|
||||
return <Check aria-hidden className="size-3.5 shrink-0 text-foreground" />
|
||||
}
|
||||
if (row.state === 'pending' && included) {
|
||||
return <CircleDashed aria-hidden className="size-3.5 shrink-0 text-muted-foreground" />
|
||||
}
|
||||
return <Minus aria-hidden className="size-3.5 shrink-0 text-muted-foreground" />
|
||||
}
|
||||
|
||||
function ItemRow({
|
||||
row,
|
||||
included,
|
||||
disabled,
|
||||
isCopy = false,
|
||||
kindLabel,
|
||||
onToggle
|
||||
}: {
|
||||
row: AgentConfigSyncRow
|
||||
included: boolean
|
||||
disabled: boolean
|
||||
/** A copy for the other agent: indented under its original, whose switch it follows. */
|
||||
isCopy?: boolean
|
||||
/** A row standing for the same skill in both agents' folders: "Claude skill, Codex skill". */
|
||||
kindLabel?: string
|
||||
onToggle: (included: boolean) => void
|
||||
}): React.JSX.Element {
|
||||
const t = useTranslate()
|
||||
// Still in the sandbox from an earlier sync, but switched off here: it goes at the next sync.
|
||||
const turnedOff = row.state === 'synced' && !included
|
||||
const note = turnedOff
|
||||
? t('cloudSkillsSync.row.offPending', 'Off. Removed from the sandbox at the next sync')
|
||||
: cloudSkillsRowNote(row, t)
|
||||
const name = cloudSkillsDisplayName(row)
|
||||
const kind = kindLabel ?? cloudSkillsKindLabel(row, t)
|
||||
return (
|
||||
<li className={cn('flex items-center gap-2.5 py-1.5', isCopy && 'pl-6')}>
|
||||
<RowIcon row={row} included={included} />
|
||||
<div className="min-w-0 flex-1">
|
||||
<div className="flex min-w-0 items-baseline gap-2">
|
||||
<span
|
||||
className={cn(
|
||||
'truncate font-medium',
|
||||
row.state === 'synced' && !turnedOff ? 'text-foreground' : 'text-muted-foreground'
|
||||
)}
|
||||
>
|
||||
{name}
|
||||
</span>
|
||||
<span className="sr-only">{cloudSkillsRowStateLabel(row, included, t)}</span>
|
||||
<span className="shrink-0 text-2xs text-muted-foreground">{kind}</span>
|
||||
</div>
|
||||
{note ? <p className="line-clamp-2 text-2xs text-muted-foreground">{note}</p> : null}
|
||||
</div>
|
||||
{!isCopy && cloudSkillsRowToggleable(row) ? (
|
||||
<Switch
|
||||
checked={included}
|
||||
// aria-disabled, not disabled: the switch just pressed keeps focus while its sync runs.
|
||||
aria-disabled={disabled || undefined}
|
||||
title={t('cloudSkillsSync.appliesEverywhere', 'Applies to every cloud workspace')}
|
||||
onCheckedChange={(next) => {
|
||||
if (!disabled) {
|
||||
onToggle(next)
|
||||
}
|
||||
}}
|
||||
aria-label={t(
|
||||
'cloudSkillsSync.toggleItem',
|
||||
'Sync {{name}} ({{kind}}) to cloud workspaces',
|
||||
{
|
||||
name,
|
||||
kind
|
||||
}
|
||||
)}
|
||||
/>
|
||||
) : null}
|
||||
</li>
|
||||
)
|
||||
}
|
||||
|
||||
function Group({
|
||||
title,
|
||||
entries,
|
||||
excluded,
|
||||
disabled,
|
||||
onToggleItem
|
||||
}: {
|
||||
title: string
|
||||
entries: CloudSkillsEntry[]
|
||||
excluded: ReadonlySet<string>
|
||||
disabled: boolean
|
||||
onToggleItem: (entry: CloudSkillsEntry, included: boolean) => void
|
||||
}): React.JSX.Element | null {
|
||||
const t = useTranslate()
|
||||
const headingId = useId()
|
||||
if (entries.length === 0) {
|
||||
return null
|
||||
}
|
||||
return (
|
||||
<section aria-labelledby={headingId}>
|
||||
<h4 id={headingId} className="pt-1 text-2xs font-medium text-muted-foreground">
|
||||
{title} · {cloudSkillsEntryCount(entries)}
|
||||
</h4>
|
||||
<ul>
|
||||
{entries.flatMap((entry) => {
|
||||
const { row, twins, copies } = entry
|
||||
const keys = cloudSkillsEntryKeys(entry)
|
||||
return [
|
||||
<ItemRow
|
||||
key={row.key}
|
||||
row={row}
|
||||
included={keys.every((key) => !excluded.has(key))}
|
||||
disabled={disabled}
|
||||
kindLabel={twins.length > 0 ? cloudSkillsEntryKindLabel(entry, t) : undefined}
|
||||
onToggle={(included) => onToggleItem(entry, included)}
|
||||
/>,
|
||||
...copies.map((copy) => (
|
||||
<ItemRow
|
||||
key={copy.key}
|
||||
row={copy}
|
||||
included={cloudSkillsRowIncluded(copy, excluded)}
|
||||
disabled={disabled}
|
||||
isCopy
|
||||
onToggle={() => {}}
|
||||
/>
|
||||
))
|
||||
]
|
||||
})}
|
||||
</ul>
|
||||
</section>
|
||||
)
|
||||
}
|
||||
|
||||
// The filter outlives one panel for the app session, like other Settings view choices.
|
||||
let sessionFilter: CloudSkillsFilter = 'all'
|
||||
|
||||
/** The list under its filter: a capped, scrolling area so the page never grows with it. */
|
||||
export function CloudSkillsList({
|
||||
groups,
|
||||
excluded,
|
||||
disabled,
|
||||
initialFilter,
|
||||
onToggleItem
|
||||
}: {
|
||||
groups: CloudSkillsGroups
|
||||
excluded: ReadonlySet<string>
|
||||
disabled: boolean
|
||||
initialFilter?: CloudSkillsFilter
|
||||
onToggleItem: (key: string, included: boolean) => void
|
||||
}): React.JSX.Element {
|
||||
const t = useTranslate()
|
||||
const [filter, setFilterState] = useState<CloudSkillsFilter>(initialFilter ?? sessionFilter)
|
||||
// Rows toggled under the current filter, kept in view until it changes.
|
||||
const [pinned, setPinned] = useState<ReadonlySet<string>>(() => new Set())
|
||||
const setFilter = (next: CloudSkillsFilter): void => {
|
||||
sessionFilter = next
|
||||
setFilterState(next)
|
||||
setPinned(new Set())
|
||||
}
|
||||
const counts = cloudSkillsFilterCounts(groups, excluded)
|
||||
const shown = cloudSkillsFilterGroups(groups, filter, excluded, pinned)
|
||||
const empty = cloudSkillsFilterIsEmpty(shown)
|
||||
const emptyText =
|
||||
filter === 'enabled'
|
||||
? t('cloudSkillsSync.empty.enabled', 'No enabled skills.')
|
||||
: filter === 'disabled'
|
||||
? t('cloudSkillsSync.empty.disabled', 'No disabled skills.')
|
||||
: t('cloudSkillsSync.empty.all', 'No skills yet.')
|
||||
const toggle = (entry: CloudSkillsEntry, included: boolean): void => {
|
||||
if (filter !== 'all') {
|
||||
setPinned((current) => new Set(current).add(entry.row.key))
|
||||
}
|
||||
for (const key of cloudSkillsEntryKeys(entry)) {
|
||||
onToggleItem(key, included)
|
||||
}
|
||||
}
|
||||
return (
|
||||
<div className="space-y-1.5">
|
||||
<SettingsSegmentedControl
|
||||
size="sm"
|
||||
value={filter}
|
||||
onChange={setFilter}
|
||||
ariaLabel={t('cloudSkillsSync.filter.label', 'Show skills and commands')}
|
||||
options={[
|
||||
{
|
||||
value: 'all',
|
||||
label: t('cloudSkillsSync.filter.all', 'All {{count}}', { count: counts.all })
|
||||
},
|
||||
{
|
||||
value: 'enabled',
|
||||
label: t('cloudSkillsSync.filter.enabled', 'Enabled {{count}}', {
|
||||
count: counts.enabled
|
||||
})
|
||||
},
|
||||
{
|
||||
value: 'disabled',
|
||||
label: t('cloudSkillsSync.filter.disabled', 'Disabled {{count}}', {
|
||||
count: counts.disabled
|
||||
})
|
||||
}
|
||||
]}
|
||||
/>
|
||||
<div
|
||||
// About ten rows (320px), or 60% of the window when that is smaller; edges ruled so more reads as more.
|
||||
className="max-h-[min(20rem,60vh)] space-y-2 scrollbar-sleek overflow-y-auto overscroll-contain border-y border-border/60 py-1"
|
||||
tabIndex={0}
|
||||
role="region"
|
||||
aria-label={t('cloudSkillsSync.listLabel', 'Skills and commands')}
|
||||
>
|
||||
{empty ? (
|
||||
<p className="py-2 text-2xs text-muted-foreground">{emptyText}</p>
|
||||
) : (
|
||||
<>
|
||||
<Group
|
||||
title={t('cloudSkillsSync.group.synced', 'Synced')}
|
||||
entries={shown.synced}
|
||||
excluded={excluded}
|
||||
disabled={disabled}
|
||||
onToggleItem={toggle}
|
||||
/>
|
||||
<Group
|
||||
title={t('cloudSkillsSync.group.pending', 'Not synced yet')}
|
||||
entries={shown.pending}
|
||||
excluded={excluded}
|
||||
disabled={disabled}
|
||||
onToggleItem={toggle}
|
||||
/>
|
||||
<Group
|
||||
title={t('cloudSkillsSync.group.notSynced', 'Not synced')}
|
||||
entries={shown.notSynced}
|
||||
excluded={excluded}
|
||||
disabled={disabled}
|
||||
onToggleItem={toggle}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
+33
-230
@@ -1,35 +1,22 @@
|
||||
import { useId, useState } from 'react'
|
||||
import { Check, ChevronDown, ChevronRight, CircleDashed, Minus, RefreshCw } from 'lucide-react'
|
||||
import { useId } from 'react'
|
||||
import { ChevronDown, RefreshCw } from 'lucide-react'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { InlineError } from '@/components/ui/inline-error'
|
||||
import { Skeleton } from '@/components/ui/skeleton'
|
||||
import { Switch } from '@/components/ui/switch'
|
||||
import { LoadingSpinner } from '@/components/LoadingSpinner'
|
||||
import { useNow } from '@/hooks/use-now'
|
||||
import { useTranslate } from '@/i18n/use-translate'
|
||||
import { cn } from '@/lib/utils'
|
||||
import type {
|
||||
AgentConfigSyncRow,
|
||||
AgentConfigSyncStatus
|
||||
} from '../../../../../../shared/agent-config-sync/agent-config-sync-contract'
|
||||
import type { AgentConfigSyncStatus } from '../../../../../../shared/agent-config-sync/agent-config-sync-contract'
|
||||
import { formatRelative } from '../../../cloud-workspaces/cloud-workspace-format'
|
||||
import {
|
||||
cloudSkillsDisplayName,
|
||||
cloudSkillsErrorRetryable,
|
||||
cloudSkillsErrorText,
|
||||
cloudSkillsKindLabel,
|
||||
cloudSkillsRowIncluded,
|
||||
cloudSkillsRowNote,
|
||||
cloudSkillsRowStateLabel,
|
||||
cloudSkillsRowToggleable,
|
||||
cloudSkillsEntryCount,
|
||||
cloudSkillsGroupOpen,
|
||||
cloudSkillsEntryKeys,
|
||||
cloudSkillsEntryKindLabel,
|
||||
cloudSkillsGroupRows,
|
||||
type CloudSkillsEntry,
|
||||
cloudSkillsSummary
|
||||
} from './cloud-skills-sync-copy'
|
||||
import { CloudSkillsList } from './CloudSkillsList'
|
||||
import type { CloudSkillsFilter } from './cloud-skills-filter'
|
||||
|
||||
export type CloudSkillsSyncPanelProps = {
|
||||
status: AgentConfigSyncStatus
|
||||
@@ -42,174 +29,8 @@ export type CloudSkillsSyncPanelProps = {
|
||||
onToggleExpanded: () => void
|
||||
onSyncNow: () => void
|
||||
onToggleItem: (key: string, included: boolean) => void
|
||||
}
|
||||
|
||||
function RowIcon({
|
||||
row,
|
||||
included
|
||||
}: {
|
||||
row: AgentConfigSyncRow
|
||||
included: boolean
|
||||
}): React.JSX.Element {
|
||||
if (row.state === 'synced') {
|
||||
return <Check aria-hidden className="size-3.5 shrink-0 text-foreground" />
|
||||
}
|
||||
if (row.state === 'pending' && included) {
|
||||
return <CircleDashed aria-hidden className="size-3.5 shrink-0 text-muted-foreground" />
|
||||
}
|
||||
return <Minus aria-hidden className="size-3.5 shrink-0 text-muted-foreground" />
|
||||
}
|
||||
|
||||
function ItemRow({
|
||||
row,
|
||||
included,
|
||||
disabled,
|
||||
isCopy = false,
|
||||
kindLabel,
|
||||
onToggle
|
||||
}: {
|
||||
row: AgentConfigSyncRow
|
||||
included: boolean
|
||||
disabled: boolean
|
||||
/** A copy for the other agent: indented under its original, whose switch it follows. */
|
||||
isCopy?: boolean
|
||||
/** A row standing for the same skill in both agents' folders: "Claude skill, Codex skill". */
|
||||
kindLabel?: string
|
||||
onToggle: (included: boolean) => void
|
||||
}): React.JSX.Element {
|
||||
const t = useTranslate()
|
||||
const note = cloudSkillsRowNote(row, t)
|
||||
const name = cloudSkillsDisplayName(row)
|
||||
const kind = kindLabel ?? cloudSkillsKindLabel(row, t)
|
||||
return (
|
||||
<li className={cn('flex items-center gap-2.5 py-1.5', isCopy && 'pl-6')}>
|
||||
<RowIcon row={row} included={included} />
|
||||
<div className="min-w-0 flex-1">
|
||||
<div className="flex min-w-0 items-baseline gap-2">
|
||||
<span
|
||||
className={cn(
|
||||
'truncate font-medium',
|
||||
row.state === 'synced' ? 'text-foreground' : 'text-muted-foreground'
|
||||
)}
|
||||
>
|
||||
{name}
|
||||
</span>
|
||||
<span className="sr-only">{cloudSkillsRowStateLabel(row, included, t)}</span>
|
||||
<span className="shrink-0 text-2xs text-muted-foreground">{kind}</span>
|
||||
</div>
|
||||
{note ? <p className="line-clamp-2 text-2xs text-muted-foreground">{note}</p> : null}
|
||||
</div>
|
||||
{!isCopy && cloudSkillsRowToggleable(row) ? (
|
||||
<Switch
|
||||
checked={included}
|
||||
// aria-disabled, not disabled: the switch just pressed keeps focus while its sync runs.
|
||||
aria-disabled={disabled || undefined}
|
||||
title={t('cloudSkillsSync.appliesEverywhere', 'Applies to every cloud workspace')}
|
||||
onCheckedChange={(next) => {
|
||||
if (!disabled) {
|
||||
onToggle(next)
|
||||
}
|
||||
}}
|
||||
aria-label={t(
|
||||
'cloudSkillsSync.toggleItem',
|
||||
'Sync {{name}} ({{kind}}) to cloud workspaces',
|
||||
{
|
||||
name,
|
||||
kind
|
||||
}
|
||||
)}
|
||||
/>
|
||||
) : null}
|
||||
</li>
|
||||
)
|
||||
}
|
||||
|
||||
function Group({
|
||||
title,
|
||||
entries,
|
||||
excluded,
|
||||
disabled,
|
||||
collapsible = false,
|
||||
onToggleItem
|
||||
}: {
|
||||
title: string
|
||||
entries: CloudSkillsEntry[]
|
||||
excluded: ReadonlySet<string>
|
||||
disabled: boolean
|
||||
collapsible?: boolean
|
||||
onToggleItem: (key: string, included: boolean) => void
|
||||
}): React.JSX.Element | null {
|
||||
const t = useTranslate()
|
||||
const headingId = useId()
|
||||
const listId = useId()
|
||||
const count = cloudSkillsEntryCount(entries)
|
||||
// Only the user's own click is remembered; otherwise the current count decides, so a list that
|
||||
// grows past the limit after Sync now collapses like one that opened long.
|
||||
const [choice, setChoice] = useState<boolean | null>(null)
|
||||
const open = cloudSkillsGroupOpen(collapsible, count, choice)
|
||||
if (entries.length === 0) {
|
||||
return null
|
||||
}
|
||||
return (
|
||||
<section aria-labelledby={headingId}>
|
||||
{collapsible ? (
|
||||
<h4 id={headingId} className="pt-1">
|
||||
<Button
|
||||
type="button"
|
||||
variant="quiet"
|
||||
size="statusAction"
|
||||
className="-ml-1"
|
||||
aria-expanded={open}
|
||||
aria-controls={listId}
|
||||
onClick={() => setChoice(!open)}
|
||||
>
|
||||
{title} · {count}
|
||||
<ChevronRight
|
||||
aria-hidden
|
||||
className={cn(
|
||||
'size-3 transition-transform motion-reduce:transition-none',
|
||||
open && 'rotate-90'
|
||||
)}
|
||||
/>
|
||||
</Button>
|
||||
</h4>
|
||||
) : (
|
||||
<h4 id={headingId} className="pt-1 text-2xs font-medium text-muted-foreground">
|
||||
{title} · {count}
|
||||
</h4>
|
||||
)}
|
||||
<ul id={listId} hidden={!open}>
|
||||
{entries.flatMap((entry) => {
|
||||
const { row, twins, copies } = entry
|
||||
const keys = cloudSkillsEntryKeys(entry)
|
||||
return [
|
||||
<ItemRow
|
||||
key={row.key}
|
||||
row={row}
|
||||
included={keys.every((key) => !excluded.has(key))}
|
||||
disabled={disabled}
|
||||
kindLabel={twins.length > 0 ? cloudSkillsEntryKindLabel(entry, t) : undefined}
|
||||
onToggle={(included) => {
|
||||
for (const key of keys) {
|
||||
onToggleItem(key, included)
|
||||
}
|
||||
}}
|
||||
/>,
|
||||
...copies.map((copy) => (
|
||||
<ItemRow
|
||||
key={copy.key}
|
||||
row={copy}
|
||||
included={cloudSkillsRowIncluded(copy, excluded)}
|
||||
disabled={disabled}
|
||||
isCopy
|
||||
onToggle={() => {}}
|
||||
/>
|
||||
))
|
||||
]
|
||||
})}
|
||||
</ul>
|
||||
</section>
|
||||
)
|
||||
/** Fixtures pin a filter; the app uses the one chosen earlier this session. */
|
||||
initialFilter?: CloudSkillsFilter
|
||||
}
|
||||
|
||||
export function CloudSkillsSyncSkeleton(): React.JSX.Element {
|
||||
@@ -239,7 +60,8 @@ export function CloudSkillsSyncPanel({
|
||||
expanded,
|
||||
onToggleExpanded,
|
||||
onSyncNow,
|
||||
onToggleItem
|
||||
onToggleItem,
|
||||
initialFilter
|
||||
}: CloudSkillsSyncPanelProps): React.JSX.Element {
|
||||
const t = useTranslate()
|
||||
// A minute tick keeps "synced 2 minutes ago" honest while Settings stays open.
|
||||
@@ -270,30 +92,26 @@ export function CloudSkillsSyncPanel({
|
||||
return (
|
||||
<div className="mt-2 border-t border-border/60 pt-2 text-xs">
|
||||
<div className="flex min-h-6 items-center gap-2">
|
||||
{hasRows ? (
|
||||
<Button
|
||||
type="button"
|
||||
variant="ghost"
|
||||
size="inlineChip"
|
||||
className="-ml-1.5 min-w-0"
|
||||
aria-expanded={expanded}
|
||||
aria-controls={listId}
|
||||
onClick={onToggleExpanded}
|
||||
>
|
||||
<span className="flex min-w-0 items-center gap-1.5">
|
||||
{title}
|
||||
<ChevronDown
|
||||
aria-hidden
|
||||
className={cn(
|
||||
'size-3 shrink-0 text-muted-foreground transition-transform motion-reduce:transition-none',
|
||||
expanded && 'rotate-180'
|
||||
)}
|
||||
/>
|
||||
</span>
|
||||
</Button>
|
||||
) : (
|
||||
<div className="flex min-w-0 items-center gap-1.5">{title}</div>
|
||||
)}
|
||||
<Button
|
||||
type="button"
|
||||
variant="ghost"
|
||||
size="inlineChip"
|
||||
className="-ml-1.5 min-w-0"
|
||||
aria-expanded={expanded}
|
||||
aria-controls={listId}
|
||||
onClick={onToggleExpanded}
|
||||
>
|
||||
<span className="flex min-w-0 items-center gap-1.5">
|
||||
{title}
|
||||
<ChevronDown
|
||||
aria-hidden
|
||||
className={cn(
|
||||
'size-3 shrink-0 text-muted-foreground transition-transform motion-reduce:transition-none',
|
||||
expanded && 'rotate-180'
|
||||
)}
|
||||
/>
|
||||
</span>
|
||||
</Button>
|
||||
<span className="sr-only" role="status">
|
||||
{status.running
|
||||
? t('cloudSkillsSync.syncing', 'Syncing skills and commands…')
|
||||
@@ -338,27 +156,12 @@ export function CloudSkillsSyncPanel({
|
||||
{t('cloudSkillsSync.manualOnly', 'Not synced automatically. Sync now copies them once.')}
|
||||
</p>
|
||||
) : null}
|
||||
<div id={listId} hidden={!expanded || !hasRows} className="mt-1.5 space-y-2">
|
||||
<Group
|
||||
title={t('cloudSkillsSync.group.synced', 'Synced')}
|
||||
entries={groups.synced}
|
||||
collapsible
|
||||
excluded={excluded}
|
||||
disabled={status.running}
|
||||
onToggleItem={onToggleItem}
|
||||
/>
|
||||
<Group
|
||||
title={t('cloudSkillsSync.group.pending', 'Not synced yet')}
|
||||
entries={groups.pending}
|
||||
excluded={excluded}
|
||||
disabled={status.running}
|
||||
onToggleItem={onToggleItem}
|
||||
/>
|
||||
<Group
|
||||
title={t('cloudSkillsSync.group.notSynced', 'Not synced')}
|
||||
entries={groups.notSynced}
|
||||
<div id={listId} hidden={!expanded} className="mt-1.5">
|
||||
<CloudSkillsList
|
||||
groups={groups}
|
||||
excluded={excluded}
|
||||
disabled={status.running}
|
||||
initialFilter={initialFilter}
|
||||
onToggleItem={onToggleItem}
|
||||
/>
|
||||
</div>
|
||||
|
||||
+28
-3
@@ -94,7 +94,9 @@ function page(
|
||||
preferences: CloudAgentConfigSyncPreferences,
|
||||
workspaces: OrcaCloudMcpWorkspace[] | null | 'failed',
|
||||
status: AgentConfigSyncStatus = STATUS,
|
||||
expanded = true
|
||||
expanded = true,
|
||||
filter: 'all' | 'enabled' | 'disabled' = 'all',
|
||||
excluded: ReadonlySet<string> = EXCLUDED
|
||||
): React.JSX.Element {
|
||||
return (
|
||||
<div className="bg-background px-8 py-6">
|
||||
@@ -113,7 +115,8 @@ function page(
|
||||
renderSync={(workspace) => (
|
||||
<CloudSkillsSyncPanel
|
||||
status={{ ...status, environmentId: workspace.environmentId }}
|
||||
excluded={EXCLUDED}
|
||||
excluded={excluded}
|
||||
initialFilter={filter}
|
||||
autoSync={preferences.autoSync}
|
||||
now={Date.UTC(2026, 10, 10, 16, 44)}
|
||||
expanded={expanded}
|
||||
@@ -220,7 +223,29 @@ const LONG_ROWS: AgentConfigSyncRow[] = [
|
||||
skipReason: 'secret'
|
||||
})
|
||||
]
|
||||
const LONG = { ...STATUS, rows: LONG_ROWS }
|
||||
const LONG_OFF = new Set(['user:agents-skill:electron', 'user:agents-skill:find-skills'])
|
||||
export const longList = defineFixture({
|
||||
width: 784,
|
||||
render: () => page(ON, ONE, { ...STATUS, rows: LONG_ROWS })
|
||||
render: () => page(ON, ONE, LONG, true, 'all', LONG_OFF)
|
||||
})
|
||||
export const longListEnabled = defineFixture({
|
||||
width: 784,
|
||||
render: () => page(ON, ONE, LONG, true, 'enabled', LONG_OFF)
|
||||
})
|
||||
export const longListDisabled = defineFixture({
|
||||
width: 784,
|
||||
render: () => page(ON, ONE, LONG, true, 'disabled', LONG_OFF)
|
||||
})
|
||||
export const emptyEnabled = defineFixture({
|
||||
width: 784,
|
||||
render: () => page(ON, ONE, LONG, true, 'enabled', new Set(LONG_ROWS.map((entry) => entry.key)))
|
||||
})
|
||||
export const emptyDisabled = defineFixture({
|
||||
width: 784,
|
||||
render: () => page(ON, ONE, LONG, true, 'disabled', new Set())
|
||||
})
|
||||
export const emptyAll = defineFixture({
|
||||
width: 784,
|
||||
render: () => page(ON, ONE, { ...STATUS, rows: [], lastSyncedAt: null }, true, 'all')
|
||||
})
|
||||
|
||||
+74
@@ -0,0 +1,74 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import type { AgentConfigSyncRow } from '../../../../../../shared/agent-config-sync/agent-config-sync-contract'
|
||||
import { cloudSkillsFilterCounts, cloudSkillsFilterGroups } from './cloud-skills-filter'
|
||||
import { cloudSkillsGroupRows } from './cloud-skills-sync-copy'
|
||||
|
||||
function row(
|
||||
kind: AgentConfigSyncRow['kind'],
|
||||
name: string,
|
||||
patch: Partial<AgentConfigSyncRow> = {}
|
||||
): AgentConfigSyncRow {
|
||||
return {
|
||||
key: `user:${kind}:${name}`,
|
||||
scope: 'user',
|
||||
kind,
|
||||
name,
|
||||
bytes: 10,
|
||||
fileCount: 1,
|
||||
withheldFiles: 0,
|
||||
included: true,
|
||||
state: 'synced',
|
||||
outcome: 'added',
|
||||
...patch
|
||||
}
|
||||
}
|
||||
|
||||
const groups = () =>
|
||||
cloudSkillsGroupRows([
|
||||
row('claude-skill', 'deploy', { digest: 'a' }),
|
||||
row('agents-skill', 'deploy', { digest: 'a' }),
|
||||
row('claude-skill', 'scratch', {
|
||||
state: 'skipped',
|
||||
outcome: undefined,
|
||||
skipReason: 'turned-off'
|
||||
}),
|
||||
row('claude-skill', 'leaky', { state: 'skipped', outcome: undefined, skipReason: 'secret' }),
|
||||
row('claude-command', 'review')
|
||||
])
|
||||
const names = (g: ReturnType<typeof groups>): string[] =>
|
||||
[...g.synced, ...g.pending, ...g.notSynced].map((e) => e.row.name).sort()
|
||||
|
||||
describe('cloud skills filter', () => {
|
||||
it('Enabled is switched on, Disabled is switched off, and blocked rows show under All only', () => {
|
||||
const excluded = new Set(['user:claude-skill:scratch'])
|
||||
// deploy counts twice (Claude and Codex); leaky has no switch so it is in neither filter.
|
||||
expect(cloudSkillsFilterCounts(groups(), excluded)).toEqual({ all: 5, enabled: 3, disabled: 1 })
|
||||
expect(names(cloudSkillsFilterGroups(groups(), 'enabled', excluded, new Set()))).toEqual([
|
||||
'deploy',
|
||||
'review'
|
||||
])
|
||||
expect(names(cloudSkillsFilterGroups(groups(), 'disabled', excluded, new Set()))).toEqual([
|
||||
'scratch'
|
||||
])
|
||||
expect(names(cloudSkillsFilterGroups(groups(), 'all', excluded, new Set()))).toContain('leaky')
|
||||
})
|
||||
|
||||
it('keeps a row toggled under a filter until the filter changes, with counts already moved', () => {
|
||||
// The user switches "review" off while Enabled is showing.
|
||||
const excluded = new Set(['user:claude-skill:scratch', 'user:claude-command:review'])
|
||||
const pinned = new Set(['user:claude-command:review'])
|
||||
expect(names(cloudSkillsFilterGroups(groups(), 'enabled', excluded, pinned))).toEqual([
|
||||
'deploy',
|
||||
'review'
|
||||
])
|
||||
expect(cloudSkillsFilterCounts(groups(), excluded)).toEqual({ all: 5, enabled: 2, disabled: 2 })
|
||||
// A filter change starts with nothing pinned: review now shows under Disabled only.
|
||||
expect(names(cloudSkillsFilterGroups(groups(), 'enabled', excluded, new Set()))).toEqual([
|
||||
'deploy'
|
||||
])
|
||||
expect(names(cloudSkillsFilterGroups(groups(), 'disabled', excluded, new Set()))).toEqual([
|
||||
'review',
|
||||
'scratch'
|
||||
])
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,66 @@
|
||||
import {
|
||||
cloudSkillsEntryCount,
|
||||
cloudSkillsEntryKeys,
|
||||
cloudSkillsRowToggleable,
|
||||
type CloudSkillsEntry,
|
||||
type CloudSkillsGroups
|
||||
} from './cloud-skills-sync-copy'
|
||||
|
||||
export type CloudSkillsFilter = 'all' | 'enabled' | 'disabled'
|
||||
|
||||
/** Enabled: the switch is on. Disabled: the user switched it off. Rows with no switch (looks like a
|
||||
* key, in the repo, too large…) are neither: they show under All only. */
|
||||
export function cloudSkillsEntryFilter(
|
||||
entry: CloudSkillsEntry,
|
||||
excluded: ReadonlySet<string>
|
||||
): Exclude<CloudSkillsFilter, 'all'> | null {
|
||||
if (!cloudSkillsRowToggleable(entry.row)) {
|
||||
return null
|
||||
}
|
||||
return cloudSkillsEntryKeys(entry).some((key) => excluded.has(key)) ? 'disabled' : 'enabled'
|
||||
}
|
||||
|
||||
const allEntries = (groups: CloudSkillsGroups): CloudSkillsEntry[] => [
|
||||
...groups.synced,
|
||||
...groups.pending,
|
||||
...groups.notSynced
|
||||
]
|
||||
|
||||
/** Item counts (twins and copies count), so "Enabled 9" matches what was copied. */
|
||||
export function cloudSkillsFilterCounts(
|
||||
groups: CloudSkillsGroups,
|
||||
excluded: ReadonlySet<string>
|
||||
): Record<CloudSkillsFilter, number> {
|
||||
const entries = allEntries(groups)
|
||||
const count = (filter: Exclude<CloudSkillsFilter, 'all'>): number =>
|
||||
cloudSkillsEntryCount(entries.filter((e) => cloudSkillsEntryFilter(e, excluded) === filter))
|
||||
return {
|
||||
all: cloudSkillsEntryCount(entries),
|
||||
enabled: count('enabled'),
|
||||
disabled: count('disabled')
|
||||
}
|
||||
}
|
||||
|
||||
/** The groups a filter shows. `pinned` rows were toggled under this filter: they stay until the
|
||||
* filter changes, so a row never vanishes from under the pointer. */
|
||||
export function cloudSkillsFilterGroups(
|
||||
groups: CloudSkillsGroups,
|
||||
filter: CloudSkillsFilter,
|
||||
excluded: ReadonlySet<string>,
|
||||
pinned: ReadonlySet<string>
|
||||
): CloudSkillsGroups {
|
||||
if (filter === 'all') {
|
||||
return groups
|
||||
}
|
||||
const keep = (entry: CloudSkillsEntry): boolean =>
|
||||
pinned.has(entry.row.key) || cloudSkillsEntryFilter(entry, excluded) === filter
|
||||
return {
|
||||
synced: groups.synced.filter(keep),
|
||||
pending: groups.pending.filter(keep),
|
||||
notSynced: groups.notSynced.filter(keep)
|
||||
}
|
||||
}
|
||||
|
||||
export function cloudSkillsFilterIsEmpty(groups: CloudSkillsGroups): boolean {
|
||||
return allEntries(groups).length === 0
|
||||
}
|
||||
-16
@@ -4,7 +4,6 @@ import {
|
||||
cloudSkillsEntryCount,
|
||||
cloudSkillsEntryKeys,
|
||||
cloudSkillsEntryKindLabel,
|
||||
cloudSkillsGroupOpen,
|
||||
cloudSkillsGroupRows
|
||||
} from './cloud-skills-sync-copy'
|
||||
|
||||
@@ -62,18 +61,3 @@ describe('cloudSkillsGroupRows', () => {
|
||||
expect(groups.notSynced).toHaveLength(1)
|
||||
})
|
||||
})
|
||||
|
||||
describe('cloudSkillsGroupOpen', () => {
|
||||
it('collapses a Synced list past 10 whenever it gets there, not only on first open', () => {
|
||||
// Before the first sync the group is empty; after Sync now it holds 31.
|
||||
expect(cloudSkillsGroupOpen(true, 0, null)).toBe(true)
|
||||
expect(cloudSkillsGroupOpen(true, 31, null)).toBe(false)
|
||||
expect(cloudSkillsGroupOpen(true, 10, null)).toBe(true)
|
||||
})
|
||||
|
||||
it('keeps what the user chose, and never collapses a group that is not collapsible', () => {
|
||||
expect(cloudSkillsGroupOpen(true, 31, true)).toBe(true)
|
||||
expect(cloudSkillsGroupOpen(true, 3, false)).toBe(false)
|
||||
expect(cloudSkillsGroupOpen(false, 31, null)).toBe(true)
|
||||
})
|
||||
})
|
||||
|
||||
+3
-16
@@ -295,24 +295,11 @@ export function cloudSkillsRowStateLabel(
|
||||
t: Translate = translate
|
||||
): string {
|
||||
if (row.state === 'synced') {
|
||||
return t('cloudSkillsSync.state.synced', 'Synced')
|
||||
return included
|
||||
? t('cloudSkillsSync.state.synced', 'Synced')
|
||||
: t('cloudSkillsSync.state.offPending', 'Off, removed at the next sync')
|
||||
}
|
||||
return row.state === 'pending' && included
|
||||
? t('cloudSkillsSync.state.pending', 'Not synced yet')
|
||||
: t('cloudSkillsSync.state.skipped', 'Not synced')
|
||||
}
|
||||
|
||||
/** A Synced list longer than this is collapsed; Not synced, the part to act on, never is. */
|
||||
export const CLOUD_SKILLS_COLLAPSE_OVER = 10
|
||||
|
||||
/** Open unless the group is collapsible and past the limit; a user's own expand or collapse wins. */
|
||||
export function cloudSkillsGroupOpen(
|
||||
collapsible: boolean,
|
||||
count: number,
|
||||
userChoice: boolean | null
|
||||
): boolean {
|
||||
if (!collapsible) {
|
||||
return true
|
||||
}
|
||||
return userChoice ?? count <= CLOUD_SKILLS_COLLAPSE_OVER
|
||||
}
|
||||
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { orcaCloudAgentAccountsParts } from './settings-orca-cloud-agent-accounts-sections'
|
||||
import type { SettingsRenderContext } from './settings-render-context'
|
||||
|
||||
function context(model: { showDesktopOnlySettings: boolean; orcaCloudApiAvailable: boolean }) {
|
||||
// oxlint-disable-next-line typescript/consistent-type-assertions -- SAFETY: the parts read only model.showDesktopOnlySettings and model.orcaCloudApiAvailable.
|
||||
return { model } as unknown as SettingsRenderContext
|
||||
}
|
||||
|
||||
describe('Agent accounts: Orca Cloud parts', () => {
|
||||
it('puts Orca Cloud above Hosts, after This computer (JA-04, option A1)', () => {
|
||||
const parts = orcaCloudAgentAccountsParts(
|
||||
context({ showDesktopOnlySettings: true, orcaCloudApiAvailable: true })
|
||||
)
|
||||
expect(parts.map((part) => part.id)).toEqual(['accounts-orca-cloud', 'accounts-hosts'])
|
||||
})
|
||||
|
||||
it('adds nothing without an Orca Cloud control plane or outside the desktop', () => {
|
||||
expect(
|
||||
orcaCloudAgentAccountsParts(
|
||||
context({ showDesktopOnlySettings: true, orcaCloudApiAvailable: false })
|
||||
)
|
||||
).toEqual([])
|
||||
expect(
|
||||
orcaCloudAgentAccountsParts(
|
||||
context({ showDesktopOnlySettings: false, orcaCloudApiAvailable: true })
|
||||
)
|
||||
).toEqual([])
|
||||
})
|
||||
})
|
||||
+7
-7
@@ -6,7 +6,7 @@ import { translate } from '@/i18n/i18n'
|
||||
import type { Translate } from '@/i18n/use-translate'
|
||||
import type { SettingsRenderContext } from './settings-render-context'
|
||||
|
||||
/** Settings → Agent accounts, after "This computer": Hosts (S3) and Orca Cloud (S0). The page
|
||||
/** Settings → Agent accounts, after "This computer": Orca Cloud (S0), then Hosts (S3). The page
|
||||
* titles each part and lists it in its jump row. Desktop only, and only in builds with an Orca
|
||||
* Cloud control plane. */
|
||||
export function orcaCloudAgentAccountsParts(
|
||||
@@ -18,6 +18,12 @@ export function orcaCloudAgentAccountsParts(
|
||||
return []
|
||||
}
|
||||
return [
|
||||
{
|
||||
id: 'accounts-orca-cloud',
|
||||
title: t('orcaCloudAccounts.title', 'Orca Cloud'),
|
||||
description: <OrcaCloudAccountsDescription />,
|
||||
content: <OrcaCloudAccountsSection hideHeader />
|
||||
},
|
||||
{
|
||||
id: 'accounts-hosts',
|
||||
title: t('settings.agentAccounts.hostsTitle', 'Hosts'),
|
||||
@@ -26,12 +32,6 @@ export function orcaCloudAgentAccountsParts(
|
||||
'Where Claude and Codex are signed in, and which key they use. Orca never copies a sign-in between machines.'
|
||||
),
|
||||
content: <AgentAccountsOverviewSection hideHeader />
|
||||
},
|
||||
{
|
||||
id: 'accounts-orca-cloud',
|
||||
title: t('orcaCloudAccounts.title', 'Orca Cloud'),
|
||||
description: <OrcaCloudAccountsDescription />,
|
||||
content: <OrcaCloudAccountsSection hideHeader />
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
+7
-6
@@ -1,6 +1,7 @@
|
||||
import { useEffect, useLayoutEffect, useRef } from 'react'
|
||||
import { TriangleAlert, type LucideIcon } from 'lucide-react'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { BANNER_BODY_TEXT, BANNER_TONE } from '@/components/ui/banner-tone'
|
||||
import { Badge } from '@/components/ui/badge'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { useTranslate } from '@/i18n/use-translate'
|
||||
@@ -63,14 +64,14 @@ export function PaneBannerLearnMore({ onClick }: { onClick: () => void }): React
|
||||
type PaneTopBannerTone = 'warning' | 'neutral' | 'accent'
|
||||
|
||||
const TONE_CLASSES: Record<PaneTopBannerTone, { stripClass: string; iconClass: string }> = {
|
||||
// GA-P3t: the shared banner severity look (fills and borders that hold up on white panes).
|
||||
warning: {
|
||||
stripClass:
|
||||
'border-status-warning-border bg-background bg-[linear-gradient(var(--status-warning-background),var(--status-warning-background))]',
|
||||
iconClass: 'text-status-warning'
|
||||
stripClass: cn(BANNER_TONE.warning.surface, BANNER_TONE.warning.border),
|
||||
iconClass: BANNER_TONE.warning.icon
|
||||
},
|
||||
neutral: {
|
||||
stripClass: 'border-border bg-card',
|
||||
iconClass: 'text-muted-foreground'
|
||||
stripClass: cn(BANNER_TONE.info.surface, BANNER_TONE.info.border),
|
||||
iconClass: BANNER_TONE.info.icon
|
||||
},
|
||||
accent: {
|
||||
stripClass:
|
||||
@@ -139,7 +140,7 @@ export function PaneTopWarningBanner({
|
||||
) : null}
|
||||
{title}
|
||||
</p>
|
||||
{body ? <p className="text-muted-foreground">{body}</p> : null}
|
||||
{body ? <p className={BANNER_BODY_TEXT}>{body}</p> : null}
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
|
||||
@@ -0,0 +1,194 @@
|
||||
// GA-P3t (Neil): every strip, banner and notice variant on the surfaces it sits on, so the contrast
|
||||
// rule is checked in one place. Light default (#fff, the app background), light on #fafafa (sidebar
|
||||
// and lighter surfaces), and dark via --theme both.
|
||||
import React from 'react'
|
||||
import { defineFixture } from '../../component-fixtures/component-fixture'
|
||||
import { CloudAgentSignInStrip } from '../agent-sign-in-strip/CloudAgentSignInStrip'
|
||||
import type {
|
||||
CloudStripModel,
|
||||
CloudStripStatus
|
||||
} from '../agent-sign-in-strip/cloud-agent-strip-model'
|
||||
import { PaneTopWarningBanner } from '../terminal-pane/appearance/pane-top-banner/PaneTopWarningBanner'
|
||||
import { CloudWorkspaceNotice, CloudVersionSkewNotice } from '../orca-cloud/CloudWorkspaceNotice'
|
||||
import { CloudToastCard } from '../orca-cloud/cloud-toast-stack'
|
||||
import { OrcaCloudQueuedPromptView } from '../orca-cloud/OrcaCloudQueuedPrompt'
|
||||
import { Button } from './button'
|
||||
|
||||
const noop = (): void => {}
|
||||
const ACTIONS = {
|
||||
primary: noop,
|
||||
submitCode: noop,
|
||||
pasteCode: noop,
|
||||
useCode: noop,
|
||||
useApiKey: noop,
|
||||
cancel: noop
|
||||
}
|
||||
|
||||
type StripRow = {
|
||||
status: CloudStripStatus
|
||||
title: string
|
||||
detail: string
|
||||
/** The real strip's action for that state; null where it has none (restarting). */
|
||||
action: string | null
|
||||
noClose?: boolean
|
||||
}
|
||||
|
||||
function stripModel(row: StripRow): CloudStripModel {
|
||||
return {
|
||||
status: row.status,
|
||||
title: row.title,
|
||||
detail: row.detail,
|
||||
description: null,
|
||||
primary: row.action
|
||||
? { label: row.action, action: { kind: row.status === 'warning' ? 'renew' : 'setUpOnce' } }
|
||||
: null,
|
||||
code: null,
|
||||
paste: null,
|
||||
otherWays: false,
|
||||
noClose: row.noClose,
|
||||
announcement: row.title
|
||||
}
|
||||
}
|
||||
|
||||
// The real states' copy and actions (sign-in strip, RA-11 restart, PC-3b setup).
|
||||
const STRIPS: StripRow[] = [
|
||||
{
|
||||
status: 'warning',
|
||||
title: 'Your Claude sign-in expired',
|
||||
detail: 'Renew to keep working. Your conversation is kept.',
|
||||
action: 'Renew'
|
||||
},
|
||||
{
|
||||
status: 'setup',
|
||||
title: 'Claude isn’t set up for Orca Cloud',
|
||||
detail: 'Set up once. Every cloud workspace uses it.',
|
||||
action: 'Set up once'
|
||||
},
|
||||
{
|
||||
status: 'error',
|
||||
title: 'Couldn’t restart Claude',
|
||||
detail: 'Your conversation is kept.',
|
||||
action: 'Try again'
|
||||
},
|
||||
{
|
||||
status: 'busy',
|
||||
title: 'Restarting Claude…',
|
||||
detail: 'Your conversation is kept.',
|
||||
action: null,
|
||||
noClose: true
|
||||
}
|
||||
]
|
||||
|
||||
function Variants(): React.JSX.Element {
|
||||
return (
|
||||
<div className="flex flex-col gap-3">
|
||||
{STRIPS.map((row) => (
|
||||
<div key={row.status} className="relative" data-banner-variant={`strip-${row.status}`}>
|
||||
<CloudAgentSignInStrip model={stripModel(row)} prompt={null} actions={ACTIONS} />
|
||||
</div>
|
||||
))}
|
||||
{/* Warning tone: the Codex shared-server notice's real copy. */}
|
||||
<div className="relative [&_.pane-top-banner]:!static" data-banner-variant="pane-warning">
|
||||
<PaneTopWarningBanner
|
||||
title="This Codex is sharing a server with your other Codex tabs"
|
||||
body="Codex sessions that share a server can end together, and agent status can be wrong."
|
||||
primaryAction={
|
||||
<Button size="xs" variant="outline">
|
||||
Fix
|
||||
</Button>
|
||||
}
|
||||
onDismiss={noop}
|
||||
/>
|
||||
</div>
|
||||
{/* Neutral tone: the shipped Woke-up bar (CloudWokeProcessesNotice). */}
|
||||
<div className="relative [&_.pane-top-banner]:!static" data-banner-variant="pane-neutral">
|
||||
<PaneTopWarningBanner
|
||||
tone="neutral"
|
||||
title="Woke up · processes stopped while asleep"
|
||||
primaryAction={
|
||||
<Button size="xs" variant="outline">
|
||||
Rerun <span className="font-mono">pnpm dev</span>
|
||||
</Button>
|
||||
}
|
||||
onDismiss={noop}
|
||||
/>
|
||||
</div>
|
||||
<div className="flex gap-3">
|
||||
<CloudWorkspaceNotice
|
||||
notice={{ kind: 'unresponsive' }}
|
||||
restarting={false}
|
||||
onRestart={noop}
|
||||
/>
|
||||
<CloudVersionSkewNotice
|
||||
direction="desktop-older"
|
||||
onCheckForUpdates={noop}
|
||||
onCreateWorkspace={noop}
|
||||
onDismiss={noop}
|
||||
/>
|
||||
</div>
|
||||
<div className="flex gap-3">
|
||||
<CloudToastCard
|
||||
view={{
|
||||
priority: 'warning',
|
||||
lines: [
|
||||
{
|
||||
key: 'push',
|
||||
text: 'Orca Cloud can read octocat/Hello-World but can’t push yet.',
|
||||
description: 'Install the Orca GitHub App on octocat to push.'
|
||||
}
|
||||
]
|
||||
}}
|
||||
onDismiss={noop}
|
||||
/>
|
||||
<CloudToastCard
|
||||
view={{
|
||||
priority: 'info',
|
||||
lines: [
|
||||
{ key: 'env', text: 'Environment checked', description: 'Node 24 and pnpm ready.' }
|
||||
]
|
||||
}}
|
||||
onDismiss={noop}
|
||||
/>
|
||||
</div>
|
||||
<div className="flex gap-3">
|
||||
<div className="w-80">
|
||||
<OrcaCloudQueuedPromptView
|
||||
agentName="Claude"
|
||||
prompt="Fix the flaky login test"
|
||||
editable={false}
|
||||
held
|
||||
onQueue={noop}
|
||||
/>
|
||||
</div>
|
||||
<div className="w-80">
|
||||
<OrcaCloudQueuedPromptView
|
||||
agentName="Claude"
|
||||
prompt="Fix the flaky login test"
|
||||
editable
|
||||
onQueue={noop}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
/** On the app background (#fff in light: the default and a white pane are the same surface). */
|
||||
export const onBackground = defineFixture({
|
||||
width: 900,
|
||||
render: () => (
|
||||
<div className="bg-background p-4">
|
||||
<Variants />
|
||||
</div>
|
||||
)
|
||||
})
|
||||
|
||||
/** On the lighter-grey surfaces (#fafafa: sidebar, cards); the worst case for fills. */
|
||||
export const onLightGrey = defineFixture({
|
||||
width: 900,
|
||||
render: () => (
|
||||
<div className="bg-[#fafafa] p-4 dark:bg-card">
|
||||
<Variants />
|
||||
</div>
|
||||
)
|
||||
})
|
||||
@@ -0,0 +1,27 @@
|
||||
// GA-P3t (Neil): one look for strips, banners and notices by severity, so none blends into a white
|
||||
// pane. The colours live in main.css (--banner-*), measured for contrast in light and dark.
|
||||
export type BannerSeverity = 'warning' | 'error' | 'info'
|
||||
|
||||
export const BANNER_TONE: Record<
|
||||
BannerSeverity,
|
||||
{ surface: string; border: string; icon: string }
|
||||
> = {
|
||||
warning: {
|
||||
surface: 'bg-banner-warning-fill',
|
||||
border: 'border-banner-warning-border',
|
||||
icon: 'text-banner-warning-icon'
|
||||
},
|
||||
error: {
|
||||
surface: 'bg-banner-error-fill',
|
||||
border: 'border-banner-error-border',
|
||||
icon: 'text-banner-error-icon'
|
||||
},
|
||||
info: {
|
||||
surface: 'bg-banner-info-fill',
|
||||
border: 'border-banner-info-border',
|
||||
icon: 'text-banner-info-icon'
|
||||
}
|
||||
}
|
||||
|
||||
/** Body and detail text inside a banner: darker than muted, so it clears 4.5:1 on any fill. */
|
||||
export const BANNER_BODY_TEXT = 'text-banner-body'
|
||||
@@ -24764,7 +24764,8 @@
|
||||
"remove": "Remove",
|
||||
"removeTitle": "Remove managed account?",
|
||||
"removeDescription": "Stop agents using this profile first. Removal deletes its saved credentials and conversation data. Your system login stays unchanged.",
|
||||
"cancel": "Cancel"
|
||||
"cancel": "Cancel",
|
||||
"useCli": "Use from the command line"
|
||||
},
|
||||
"hostSignIn": {
|
||||
"copied": "Copied",
|
||||
@@ -28421,13 +28422,27 @@
|
||||
"invalid": "Its name or files can’t be copied",
|
||||
"keptHost": "The sandbox has its own {{name}}, so it’s left alone",
|
||||
"noProject": "The sandbox has no project checkout for it",
|
||||
"failed": "Couldn’t write it in the sandbox"
|
||||
"failed": "Couldn’t write it in the sandbox",
|
||||
"offPending": "Off. Removed from the sandbox at the next sync"
|
||||
},
|
||||
"state": {
|
||||
"synced": "Synced",
|
||||
"pending": "Not synced yet",
|
||||
"skipped": "Not synced"
|
||||
}
|
||||
"skipped": "Not synced",
|
||||
"offPending": "Off, removed at the next sync"
|
||||
},
|
||||
"empty": {
|
||||
"enabled": "No enabled skills.",
|
||||
"disabled": "No disabled skills.",
|
||||
"all": "No skills yet."
|
||||
},
|
||||
"filter": {
|
||||
"label": "Show skills and commands",
|
||||
"all": "All {{count}}",
|
||||
"enabled": "Enabled {{count}}",
|
||||
"disabled": "Disabled {{count}}"
|
||||
},
|
||||
"listLabel": "Skills and commands"
|
||||
},
|
||||
"orcaCloudAgentPicker": {
|
||||
"status": {
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
"accounts.managedData.select",
|
||||
"accounts.managedData.system",
|
||||
"accounts.managedData.upgrade",
|
||||
"accounts.managedData.useCli",
|
||||
"auto.components.TaskPageJiraSavedFilters.0ab71bb840",
|
||||
"auto.components.TaskPageJiraSavedFilters.19af906d12",
|
||||
"auto.components.TaskPageJiraSavedFilters.42ce360813",
|
||||
|
||||
Reference in New Issue
Block a user