diff --git a/src/renderer/src/App.tsx b/src/renderer/src/App.tsx index f640e779c0d..3ba4f821685 100644 --- a/src/renderer/src/App.tsx +++ b/src/renderer/src/App.tsx @@ -8,6 +8,7 @@ import { BrowserExtensionInstallDialog } from './components/browser-extension-in import { PlansDialogHost } from './components/billing/plans/PlansDialogHost' import { CloudMoveToComputerDialogMount } from './components/orca-cloud/CloudMoveToComputerDialogMount' import { CloudSecretsAskDialogHost } from './components/cloud-secrets-ask/CloudSecretsMissingNotice' +import { OrcaCloudSignInSheet } from './components/settings/agent-accounts/sign-in-sheet/OrcaCloudSignInSheet' import { AgentHostPanel } from './components/agent-host-panel/AgentHostPanel' import { SecretRequestUnseenNotifier } from './components/agent-pane/SecretRequestUnseenNotifier' import { TeamDialogHost } from './components/billing/team/TeamDialogHost' @@ -129,6 +130,7 @@ function App(): React.JSX.Element { + diff --git a/src/renderer/src/components/agent-host-panel/open-agent-host-settings.ts b/src/renderer/src/components/agent-host-panel/open-agent-host-settings.ts index 3585214c722..b5634b5bdc2 100644 --- a/src/renderer/src/components/agent-host-panel/open-agent-host-settings.ts +++ b/src/renderer/src/components/agent-host-panel/open-agent-host-settings.ts @@ -1,6 +1,7 @@ // The panel's footer links and row actions open Settings over it; the panel closes first so focus // lands in Settings rather than behind the sheet. import { useAppStore } from '@/store' +import { openOrcaCloudSignInSheet } from '@/components/settings/agent-accounts/sign-in-sheet/orca-cloud-sign-in-sheet-store' import type { AgentHostFooterLink } from './agent-host-capabilities' import { closeAgentHostPanel } from './agent-host-panel-store' @@ -16,6 +17,10 @@ const TARGET = { export function openAgentHostSettings(link: AgentHostFooterLink): void { closeAgentHostPanel() + if (link === 'agentAccounts') { + openOrcaCloudSignInSheet() + return + } const target: { pane: (typeof TARGET)[AgentHostFooterLink]['pane']; sectionId?: string } = TARGET[link] const store = useAppStore.getState() diff --git a/src/renderer/src/components/agent-sign-in-strip/CloudAgentSignInStripPortals.tsx b/src/renderer/src/components/agent-sign-in-strip/CloudAgentSignInStripPortals.tsx index 7999809739f..24cf1ee152c 100644 --- a/src/renderer/src/components/agent-sign-in-strip/CloudAgentSignInStripPortals.tsx +++ b/src/renderer/src/components/agent-sign-in-strip/CloudAgentSignInStripPortals.tsx @@ -2,6 +2,7 @@ // private launch hold waits, or #40228's per-workspace gate while the Orca-account path is paused or // never offered. It overlays the top 56 px of the pane while the agent hasn't started, so the // terminal's size never changes. SSH, WSL and paired hosts keep #40228's card. +import { openOrcaCloudSignInSheet } from '@/components/settings/agent-accounts/sign-in-sheet/orca-cloud-sign-in-sheet-store' import React, { useEffect, useSyncExternalStore } from 'react' import { createPortal } from 'react-dom' import { useAppStore } from '@/store' @@ -51,7 +52,7 @@ export function useCloudGatePaneKeys(controller: TerminalPaneController): Readon return new Set(joined ? joined.split('\u0000') : []) } -function openSettings(pane: 'accounts' | 'cloud-secrets', sectionId?: string): void { +function openSettings(pane: 'cloud-secrets', sectionId?: string): void { const store = useAppStore.getState() store.openSettingsTarget({ pane, repoId: null, ...(sectionId ? { sectionId } : {}) }) store.openSettingsPage() @@ -119,7 +120,7 @@ function CloudStripPortal({ primary: (action) => { switch (action.kind) { case 'renew': - openSettings('accounts', 'orca-cloud') + openOrcaCloudSignInSheet() return case 'signIn': gateActions.signIn() diff --git a/src/renderer/src/components/new-workspace/OrcaCloudAgentSetupRow.tsx b/src/renderer/src/components/new-workspace/OrcaCloudAgentSetupRow.tsx index 4c4de67f66f..5c0ed699d05 100644 --- a/src/renderer/src/components/new-workspace/OrcaCloudAgentSetupRow.tsx +++ b/src/renderer/src/components/new-workspace/OrcaCloudAgentSetupRow.tsx @@ -2,8 +2,8 @@ // Later" hint: it says how the composer's agent will sign in, links to the one-time setup in // Settings → Agent accounts, and never blocks Start or signs in per sandbox. import { useEffect } from 'react' +import { openOrcaCloudSignInSheet } from '@/components/settings/agent-accounts/sign-in-sheet/orca-cloud-sign-in-sheet-store' import { CircleCheck, CircleDashed, Info, TriangleAlert } from 'lucide-react' -import { useAppStore } from '@/store/index' import { useTranslate, type Translate } from '@/i18n/use-translate' import { Button } from '@/components/ui/button' import { Skeleton } from '@/components/ui/skeleton' @@ -19,12 +19,9 @@ import { noteComposerAgentCoverage } from '@/lib/orca-cloud/cloud-first-start-ag import type { OrcaCloudRunTargetAccess } from './orca-cloud-run-target-access' import { agentName, keySourceLabel } from '../settings/agent-accounts/orca-cloud-accounts-copy' -/** Settings → Agent accounts, scrolled to the Orca Cloud section (S0). The composer stays open. */ +/** The focused Orca Cloud sign-in sheet (JA-04), over the composer, which stays open. */ export function openOrcaCloudAgentAccounts(): void { - const state = useAppStore.getState() - state.openSettingsTarget({ pane: 'accounts', repoId: null, sectionId: 'orca-cloud' }) - // The target alone only pre-selects the pane; the page has to open too (Neil, P0: "does nothing"). - state.openSettingsPage() + openOrcaCloudSignInSheet() } export function orcaCloudAgentCoveredLabel( diff --git a/src/renderer/src/components/orca-cloud/CloudAgentRowSignInTarget.tsx b/src/renderer/src/components/orca-cloud/CloudAgentRowSignInTarget.tsx index daba491c714..03c6030286a 100644 --- a/src/renderer/src/components/orca-cloud/CloudAgentRowSignInTarget.tsx +++ b/src/renderer/src/components/orca-cloud/CloudAgentRowSignInTarget.tsx @@ -1,7 +1,6 @@ // The status (dot and text) of a cloud agent row that needs sign-in: clicking it opens // Settings → Agent accounts, where the fix lives. The rest of the row still opens the pane. import React, { useCallback } from 'react' -import { useAppStore } from '@/store' import { cn } from '@/lib/utils' import { AgentStateDot } from '@/components/AgentStateDot' import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip' @@ -11,10 +10,9 @@ import { openOrcaCloudAgentAccounts } from '@/components/new-workspace/OrcaCloud /** What the status shows: its label, the agent's catalog name, and the tooltip naming the fix. */ export type CloudAgentRowStatusText = { label: string; agentName: string; tooltip: string | null } -/** The composer's "Set up once" target, plus opening Settings, which the sidebar has closed. */ +/** The sidebar row's "Set up once": the focused Orca Cloud sign-in sheet (JA-04). */ export function openCloudAgentAccountsSettings(): void { openOrcaCloudAgentAccounts() - useAppStore.getState().openSettingsPage() } /** diff --git a/src/renderer/src/components/settings/agent-accounts/OrcaCloudAccounts.tsx b/src/renderer/src/components/settings/agent-accounts/OrcaCloudAccounts.tsx index 893a54ebcd9..66c70cab1ec 100644 --- a/src/renderer/src/components/settings/agent-accounts/OrcaCloudAccounts.tsx +++ b/src/renderer/src/components/settings/agent-accounts/OrcaCloudAccounts.tsx @@ -153,8 +153,8 @@ export function OrcaCloudAccountsView({ )} diff --git a/src/renderer/src/components/settings/agent-accounts/overview/AgentAccountsOverviewSection.tsx b/src/renderer/src/components/settings/agent-accounts/overview/AgentAccountsOverviewSection.tsx index 362ca159749..74951c2e387 100644 --- a/src/renderer/src/components/settings/agent-accounts/overview/AgentAccountsOverviewSection.tsx +++ b/src/renderer/src/components/settings/agent-accounts/overview/AgentAccountsOverviewSection.tsx @@ -1,11 +1,9 @@ -// Wires S3 to the renderer's host list, the per-host sign-in probes and the Orca account. Rows open -// the A16 panel; the Orca Cloud row scrolls to S0 below (one row stands for every cloud workspace). -import React, { useEffect, useMemo, useState } from 'react' +// Wires S3 to the renderer's host list and the per-host sign-in probes. Rows open the A16 panel. +// No Orca Cloud row (JA-04): the page's own Orca Cloud part right below is the one place for it. +import React, { useMemo } from 'react' import { useAppStore } from '@/store' import { useTranslate } from '@/i18n/use-translate' -import { useOrcaCloudAgentAccounts } from '@/lib/orca-cloud/orca-cloud-agent-accounts-store' import { openAgentHostPanel } from '../../../agent-host-panel/agent-host-panel-store' -import { ORCA_CLOUD_ACCOUNTS_SECTION_ID } from '../OrcaCloudAccounts' import { overviewRows, type OverviewAction, @@ -22,28 +20,6 @@ function openSettings(pane: 'accounts', sectionId?: string): void { store.openSettingsPage() } -/** A member can't change team keys: their key cells say "set by your team". */ -function useIsCloudMember(enabled: boolean): boolean { - const [member, setMember] = useState(false) - useEffect(() => { - if (!enabled) { - return - } - let cancelled = false - void (window.api.cloudSecrets?.effective({}) ?? Promise.resolve(null)) - .catch(() => null) - .then((result) => { - if (!cancelled && result?.ok) { - setMember(!result.value.caller.canWrite.org) - } - }) - return () => { - cancelled = true - } - }, [enabled]) - return member -} - export function AgentAccountsOverviewSection({ hideHeader = false }: { @@ -52,28 +28,11 @@ export function AgentAccountsOverviewSection({ const t = useTranslate() const hosts = useOverviewHosts() const { probes, checkAgain, firstPassDone } = useOverviewProbes(hosts) - const accounts = useOrcaCloudAgentAccounts() - const ready = accounts.load.kind === 'ready' - const member = useIsCloudMember(ready) - const signedOutOfOrca = accounts.load.kind === 'failed' && accounts.load.error === 'signed_out' - const rows = useMemo( - () => - overviewRows({ - hosts, - probes, - cloud: - accounts.load.kind === 'ready' - ? { status: accounts.load.status, keyKinds: accounts.keyKinds, member } - : null - }), - [hosts, probes, accounts.load, accounts.keyKinds, member] - ) + const rows = useMemo(() => overviewRows({ hosts, probes, cloud: null }), [hosts, probes]) const hostById = new Map(hosts.map((host) => [host.hostId, host])) const open = (row: OverviewRow, focus?: 'claude' | 'codex'): void => { const host = row.hostId ? hostById.get(row.hostId) : undefined if (!host) { - // Orca Cloud: S0 below owns setup and the Source for every cloud workspace. - document.getElementById(ORCA_CLOUD_ACCOUNTS_SECTION_ID)?.scrollIntoView({ block: 'start' }) return } openAgentHostPanel({ @@ -111,7 +70,7 @@ export function AgentAccountsOverviewSection({ return ( open(row)} diff --git a/src/renderer/src/components/settings/agent-accounts/sign-in-sheet/OrcaCloudSignInSheet.tsx b/src/renderer/src/components/settings/agent-accounts/sign-in-sheet/OrcaCloudSignInSheet.tsx new file mode 100644 index 00000000000..ebec6ee976d --- /dev/null +++ b/src/renderer/src/components/settings/agent-accounts/sign-in-sheet/OrcaCloudSignInSheet.tsx @@ -0,0 +1,75 @@ +// JA-04: the focused Orca Cloud sign-in sheet. Only Claude and Codex, each with its one action and +// status (S0's rows), so "Set up once" never lands on this computer's provider accounts. +import React from 'react' +import { useAppStore } from '@/store' +import { useTranslate } from '@/i18n/use-translate' +import { + Sheet, + SheetContent, + SheetDescription, + SheetHeader, + SheetTitle +} from '@/components/ui/sheet' +import { OrcaCloudAccountsSection } from '../OrcaCloudAccountsSection' +import { + closeOrcaCloudSignInSheet, + useOrcaCloudSignInSheetOpen +} from './orca-cloud-sign-in-sheet-store' + +function openAllAgentAccounts(): void { + closeOrcaCloudSignInSheet() + const store = useAppStore.getState() + store.openSettingsTarget({ pane: 'accounts', repoId: null, sectionId: 'orca-cloud' }) + store.openSettingsPage() +} + +/** The sheet's contents; the host owns the Sheet so fixtures can render it open. */ +export function OrcaCloudSignInSheetView({ + body +}: { + /** S0's rows; fixtures pass a fixed view. */ + body: React.ReactNode +}): React.JSX.Element { + const t = useTranslate() + const titleId = React.useId() + return ( + +
+ + + {t('orcaCloudSignInSheet.title', 'Agents in Orca Cloud')} + + + {t( + 'orcaCloudSignInSheet.description', + 'Set up Claude and Codex once. Every cloud workspace uses them, including new, cloned and restarted ones.' + )} + + +
+
{body}
+ +
+ ) +} + +/** Mounted once in App; opened by openOrcaCloudSignInSheet(). */ +export function OrcaCloudSignInSheet(): React.JSX.Element { + const open = useOrcaCloudSignInSheetOpen() + return ( + !next && closeOrcaCloudSignInSheet()}> + {open ? } /> : null} + + ) +} diff --git a/src/renderer/src/components/settings/agent-accounts/sign-in-sheet/orca-cloud-sign-in-sheet-store.ts b/src/renderer/src/components/settings/agent-accounts/sign-in-sheet/orca-cloud-sign-in-sheet-store.ts new file mode 100644 index 00000000000..4c5c9c5e1e0 --- /dev/null +++ b/src/renderer/src/components/settings/agent-accounts/sign-in-sheet/orca-cloud-sign-in-sheet-store.ts @@ -0,0 +1,37 @@ +// JA-04: every "Set up once" / "Renew" for Orca Cloud opens one focused sheet (Claude and Codex +// only) instead of Settings, so nobody scrolls past this computer's provider accounts to reach it. +import { useSyncExternalStore } from 'react' + +let open = false +const listeners = new Set<() => void>() + +function set(next: boolean): void { + if (open === next) { + return + } + open = next + for (const listener of listeners) { + listener() + } +} + +export function openOrcaCloudSignInSheet(): void { + set(true) +} + +export function closeOrcaCloudSignInSheet(): void { + set(false) +} + +function subscribe(listener: () => void): () => void { + listeners.add(listener) + return () => listeners.delete(listener) +} + +export function useOrcaCloudSignInSheetOpen(): boolean { + return useSyncExternalStore( + subscribe, + () => open, + () => false + ) +} diff --git a/src/renderer/src/components/settings/page/settings-orca-cloud-agent-accounts-sections.tsx b/src/renderer/src/components/settings/page/settings-orca-cloud-agent-accounts-sections.tsx index 81d7aa181ec..71222c6103b 100644 --- a/src/renderer/src/components/settings/page/settings-orca-cloud-agent-accounts-sections.tsx +++ b/src/renderer/src/components/settings/page/settings-orca-cloud-agent-accounts-sections.tsx @@ -30,8 +30,8 @@ export function orcaCloudAgentAccountsParts( id: 'accounts-orca-cloud', title: t('orcaCloudAccounts.title', 'Orca Cloud'), description: t( - 'orcaCloudAccounts.help', - 'Set up once on this computer. Every cloud workspace uses it, including new, cloned and restarted ones.' + 'orcaCloudAccounts.helpAccountWide', + 'Set up once. Every cloud workspace uses it, including new, cloned and restarted ones.' ), content: } diff --git a/src/renderer/src/i18n/locales/en.json b/src/renderer/src/i18n/locales/en.json index 69dd241e41b..37135bf63c2 100644 --- a/src/renderer/src/i18n/locales/en.json +++ b/src/renderer/src/i18n/locales/en.json @@ -27917,7 +27917,6 @@ "signIn": "Sign in", "loadFailed": "Couldn’t load your agent accounts.", "title": "Orca Cloud", - "help": "Set up once on this computer. Every cloud workspace uses it, including new, cloned and restarted ones.", "policy": "Your Claude and ChatGPT accounts are used only in your own workspaces. Teammates never use them.", "codeCopied": "Code copied", "agent": { @@ -27946,7 +27945,8 @@ "unavailableDetail": "Signing in once with your {{product}} account isn’t available in Orca Cloud yet. Each new cloud workspace asks you to sign in.", "allUnavailable": "Claude and Codex sign in for each cloud workspace for now.", "pasteTokenInstead": "Paste a token instead", - "rowMenu": "{{agent}} account options" + "rowMenu": "{{agent}} account options", + "helpAccountWide": "Set up once. Every cloud workspace uses it, including new, cloned and restarted ones." }, "vmBuildAgents": { "menu": { @@ -28159,5 +28159,11 @@ "header": "Setting up Orca Cloud", "headerFor": "Setting up Orca Cloud for {{name}}", "resumeDraft": "Open draft" + }, + "orcaCloudSignInSheet": { + "title": "Agents in Orca Cloud", + "description": "Set up Claude and Codex once. Every cloud workspace uses them, including new, cloned and restarted ones.", + "footerLabel": "Related settings", + "allAccounts": "All agent accounts" } }