mirror of
https://github.com/stablyai/orca.git
synced 2026-11-16 19:07:41 +00:00
Merge pull request #349 from nwparker/core-ui-ra/ja04-signin-sheet
feat(cloud): JA-04 focused Orca Cloud sign-in sheet; no duplicate Orca Cloud host row
This commit is contained in:
@@ -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 {
|
||||
<CloudMoveToComputerDialogMount />
|
||||
<CloudSecretsAskDialogHost />
|
||||
<AgentHostPanel />
|
||||
<OrcaCloudSignInSheet />
|
||||
<SecretRequestUnseenNotifier />
|
||||
<TeamDialogHost />
|
||||
<TeammateProfileDialog />
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -153,8 +153,8 @@ export function OrcaCloudAccountsView({
|
||||
<SettingsGroupHeader
|
||||
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.'
|
||||
)}
|
||||
/>
|
||||
)}
|
||||
|
||||
+5
-46
@@ -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<string, OverviewHost>(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 (
|
||||
<AgentAccountsOverview
|
||||
rows={rows}
|
||||
signedOutOfOrca={signedOutOfOrca}
|
||||
signedOutOfOrca={false}
|
||||
hideHeader={hideHeader}
|
||||
summary={summary}
|
||||
onOpenRow={(row) => open(row)}
|
||||
|
||||
+75
@@ -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 (
|
||||
<SheetContent side="right" className="w-[600px] sm:max-w-[600px]" aria-labelledby={titleId}>
|
||||
<div className="border-b border-border pe-8">
|
||||
<SheetHeader>
|
||||
<SheetTitle id={titleId}>
|
||||
{t('orcaCloudSignInSheet.title', 'Agents in Orca Cloud')}
|
||||
</SheetTitle>
|
||||
<SheetDescription>
|
||||
{t(
|
||||
'orcaCloudSignInSheet.description',
|
||||
'Set up Claude and Codex once. Every cloud workspace uses them, including new, cloned and restarted ones.'
|
||||
)}
|
||||
</SheetDescription>
|
||||
</SheetHeader>
|
||||
</div>
|
||||
<div className="scrollbar-sleek min-h-0 flex-1 overflow-y-auto px-5 py-5">{body}</div>
|
||||
<nav
|
||||
aria-label={t('orcaCloudSignInSheet.footerLabel', 'Related settings')}
|
||||
className="border-t border-border px-5 py-3 text-xs"
|
||||
>
|
||||
<button
|
||||
type="button"
|
||||
className="text-muted-foreground underline underline-offset-2 hover:text-foreground focus-visible:outline-[var(--focus-ring)]"
|
||||
onClick={openAllAgentAccounts}
|
||||
>
|
||||
{t('orcaCloudSignInSheet.allAccounts', 'All agent accounts')}
|
||||
</button>
|
||||
</nav>
|
||||
</SheetContent>
|
||||
)
|
||||
}
|
||||
|
||||
/** Mounted once in App; opened by openOrcaCloudSignInSheet(). */
|
||||
export function OrcaCloudSignInSheet(): React.JSX.Element {
|
||||
const open = useOrcaCloudSignInSheetOpen()
|
||||
return (
|
||||
<Sheet open={open} onOpenChange={(next) => !next && closeOrcaCloudSignInSheet()}>
|
||||
{open ? <OrcaCloudSignInSheetView body={<OrcaCloudAccountsSection hideHeader />} /> : null}
|
||||
</Sheet>
|
||||
)
|
||||
}
|
||||
+37
@@ -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
|
||||
)
|
||||
}
|
||||
+2
-2
@@ -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: <OrcaCloudAccountsSection hideHeader />
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user