Merge origin/main to resolve publication import conflict

This commit is contained in:
Brennan Benson
2026-11-10 16:07:36 -08:00
1142 changed files with 12028 additions and 32478 deletions
@@ -191,7 +191,7 @@ export abstract class HostRelayHandshake extends HostRelayBase {
})
// After the ack, which strict shipped parsers must see unchanged; only hosts that asked get it.
if (a.clientKeepalive) { this.send(ws, { type: 'keepalive-offer', v: 1, intervalMs: this.config.pingIntervalMs }) }
metric(this.env, 'control_active', 1, rebind ? 'rebind' : 'new', [], '', a.place)
metric(this.env, 'control_active', 1, rebind ? 'rebind' : 'new', [], a.clientKeepalive ? 'keepalive' : 'legacy', a.place)
await this.reschedule()
}
}
+2 -1
View File
@@ -187,7 +187,8 @@ export class HostRelay extends HostRelayPhones {
// Same order as the cells' heartbeat: expired auth past its grace, then the 6 h lease.
if (now > a.claims.exp + CONTROL_CONTINUITY_LIMITS.expiredAuthExistingSpliceGraceMs) {
const sinceRefreshS = a.lastRefreshAt === undefined ? -1 : Math.round((now - a.lastRefreshAt) / 1000)
metric(this.env, 'auth_expired_close', sinceRefreshS, a.lastRefreshAt === undefined ? 'never' : 'refreshed', [], '', a.place)
const seenAgoS = Math.round((now - seen) / 1000)
metric(this.env, 'auth_expired_close', sinceRefreshS, a.lastRefreshAt === undefined ? 'never' : 'refreshed', [seenAgoS], this.keepalive(a) ? 'keepalive' : 'legacy', a.place)
this.close(ws, RELAY_CLOSE_CODE.BAD_OUTER_CREDENTIAL, 'relay authorization expired')
await this.onSocketGone(ws, RELAY_CLOSE_CODE.BAD_OUTER_CREDENTIAL, '')
continue
+2
View File
@@ -2,6 +2,7 @@
import type { Env } from './env'
export type MetricEvent =
// label 'new' | 'rebind'; reason 'keepalive' | 'legacy' (took the keepalive offer or not).
| 'control_active'
| 'control_close'
| 'phone_open'
@@ -26,6 +27,7 @@ export type MetricEvent =
| 'control_upgrade'
// Control closed 4401 for expired authorization: value = seconds since its last extending
// refresh, label 'refreshed'; -1 and label 'never' when this socket never extended its token.
// double2 = seconds since the host's last inbound frame or keepalive; reason 'keepalive' | 'legacy'.
| 'auth_expired_close'
// Pre-auth socket refused by the per-source limiter: label 'phone' | 'data' | 'health'. Unpushed-host phones: 'not_on_edge'.
| 'preauth_limited'
+3 -3
View File
@@ -50,18 +50,18 @@ export function edgeCohortBucketPermille(relayHostId: string): number {
}
// Mode off or down empties the cohort. Otherwise deny wins, then host allow, then region scope;
// within the region, account allow or the rollout share.
// within the region, account allow or the rollout share. Region 'any' skips the region scope.
export function inEdgeCohort(
config: EdgeRelayConfig,
relayHostId: string,
region: RelayRegion | undefined,
region: RelayRegion | undefined | 'any',
userId?: string
): boolean {
const flags = config.control?.() ?? EDGE_CONTROL_DEFAULTS
if (flags.mode !== 'on') { return false }
if (config.denyHosts.has(relayHostId)) { return false }
if (config.allowHosts.has(relayHostId)) { return true }
if (!config.regions.has(region ?? RELAY_DEFAULT_REGION)) { return false }
if (region !== 'any' && !config.regions.has(region ?? RELAY_DEFAULT_REGION)) { return false }
if (userId !== undefined && config.allowUsers?.has(userId)) { return true }
return edgeCohortBucketPermille(relayHostId) < edgeRolloutPermille(config.rolloutPercent, flags)
}
@@ -108,6 +108,22 @@ describe('edge evacuation under runtime control', () => {
h.evacuation.stop()
})
it('leaves region scope to the assign path: a stored preference outside it drains nobody', async () => {
vi.spyOn(console, 'warn').mockImplementation(() => {})
const flags: EdgeControlFlags = { mode: 'on', rolloutPermille: 1000 }
const h = await harness({ control: () => flags })
// On the edge by its ask (no region, or us-central1); its stored preference says otherwise.
await h.insert(hostId(1))
await h.prefer(hostId(1), 'asia-east2')
await h.insert(hostId(2))
expect(await h.evacuation.sweep()).toBe(0)
expect(h.admin.drained).toEqual([])
// Leaving the cohort still drains, whatever the stored region.
flags.rolloutPermille = 0
expect(await h.evacuation.sweep()).toBe(2)
expect(h.admin.drained.sort()).toEqual([hostId(1), hostId(2)])
})
it(`sends at most ${EDGE_EVACUATION_CONCURRENCY} drains at once`, async () => {
vi.spyOn(console, 'warn').mockImplementation(() => {})
const h = await harness()
@@ -3,7 +3,6 @@
// rows whose host is no longer in the cohort and asks the edge to drain them; the desktop then
// re-asks /v1/assign, and that ask exports its data and places it on a cell (app.ts). Each pass also
// retries fences that did not land after a host left (edge-relay-fence.ts).
import { RELAY_DEFAULT_REGION, RelayRegionSchema } from '@orca-cloud/relay-contract/relay-regions'
import type { RelayDatabase } from './database/database.js'
import { EdgeAdminUnavailableError, type EdgeAdmin } from './edge-admin-client.js'
import { inEdgeCohort, text, type EdgeRelayConfig, type Identity } from './edge-relay-cohort.js'
@@ -116,9 +115,11 @@ export class EdgeEvacuation {
for (const row of rows) {
const identity = { userId: text(row, 'user_id'), relayHostId: text(row, 'relay_host_id') }
pass.cursor = identity
const stored = RelayRegionSchema.safeParse(row.preferred_region)
const region = stored.success ? stored.data : RELAY_DEFAULT_REGION
if (inEdgeCohort(this.config, identity.relayHostId, region, identity.userId)) { continue }
// Region scope is the assign path's call alone: it decides with the region the desktop
// asks for, which the stored preference can miss or lag. Judging it here too drained
// hosts that the next ask put straight back (a drain every few minutes). A host that asks
// for a region outside the scope leaves on that ask.
if (inEdgeCohort(this.config, identity.relayHostId, 'any', identity.userId)) { continue }
if (this.drainedAt.has(drainKey(identity))) { continue }
leaving.push(identity)
// Resume after the last host taken, so the rest of the page is read next tick.
@@ -143,10 +144,8 @@ export class EdgeEvacuation {
private async readPage(pass: Pass) {
const { cursor, origin, wrapped } = pass
return await this.database.query(
`SELECT a.user_id, a.relay_host_id, p.preferred_region
`SELECT a.user_id, a.relay_host_id
FROM relay_assignments a
LEFT JOIN relay_assignment_region_preferences p
ON p.user_id = a.user_id AND p.relay_host_id = a.relay_host_id
WHERE a.cell_id = ? AND (a.user_id > ? OR (a.user_id = ? AND a.relay_host_id > ?))
${wrapped ? 'AND (a.user_id < ? OR (a.user_id = ? AND a.relay_host_id <= ?))' : ''}
ORDER BY a.user_id, a.relay_host_id
+1 -9
View File
@@ -627,12 +627,7 @@
2 test-no-wall-clock:src/renderer/src/components/artifacts/ArtifactCollection.test.tsx
1 test-no-wall-clock:src/renderer/src/components/browser-pane/assemble-chrome/browser-workspace-pane.adoption-chrome.test.tsx
2 test-no-wall-clock:src/renderer/src/components/dashboard/useLiveDashboardSnapshot.test.ts
1 test-no-wall-clock:src/renderer/src/components/native-chat/conversation/slots/NativeChatMessageList.opening-send.test.tsx
1 test-no-wall-clock:src/renderer/src/components/native-chat/conversation/slots/NativeChatMessageList.queued-turn-order.test.tsx
2 test-no-wall-clock:src/renderer/src/components/native-chat/conversation/turns/NativeChatMessageList.turn-indicator.test.tsx
3 test-no-wall-clock:src/renderer/src/components/native-chat/conversation/turns/NativeChatResolvedView.turn-status.test.tsx
1 test-no-wall-clock:src/renderer/src/components/native-chat/session/structured/delivery/NativeChatMessageList.unsent-message.test.tsx
3 test-no-wall-clock:src/renderer/src/components/native-chat/surfaces/integration/NativeChatMessageList.test.tsx
2 test-no-wall-clock:src/renderer/src/components/native-chat/tools/tasks/NativeChatStructuredSessionStatus.test.tsx
1 test-no-wall-clock:src/renderer/src/components/sidebar/workspace-card/review/use-workspace-reference-details.test.tsx
1 test-no-wall-clock:src/renderer/src/components/sidebar/worktree-list/listing/WorktreeList.lineage-agent-expansion-coupling.test.tsx
@@ -642,11 +637,8 @@
1 test-no-wall-clock:src/renderer/src/components/terminal/initial-terminal-structured-launch.test.tsx
2 test-no-wall-clock:src/renderer/src/components/workspace-cleanup/use-workspace-cleanup-removal.agent-stop.test.tsx
1 test-no-wall-clock:src/renderer/src/components/worktree-jump/WorktreeJumpPalette.recent-tabs.behavior.test.tsx
4 test-no-wall-clock:src/renderer/src/components/worktree-jump/WorktreeJumpPalette.recent-tabs.test.tsx
2 test-no-wall-clock:src/renderer/src/hooks/ipc-events/agent-status-terminal-title-tab-write.test.ts
1 test-no-wall-clock:src/renderer/src/lib/paired-runtime-closed-tab-resume.test.ts
2 test-no-wall-clock:src/renderer/src/lib/use-tab-agent-observed-signal-dispatch.test.tsx
2 test-no-wall-clock:src/renderer/src/lib/wake-sleeping-agents-live-unmounted-pane.test.ts
2 test-no-wall-clock:src/renderer/src/lib/agent-session/tab-identity/use-tab-agent-observed-signal-dispatch.test.tsx
1 test-no-wall-clock:src/renderer/src/lib/workspace/ownership/workspace-terminal-host-authority.test.ts
1 test-no-wall-clock:src/renderer/src/lib/workspace/activation/worktree-activation-emptied-workspace-reseed.test.ts
2 test-no-wall-clock:src/renderer/src/store/github/pull-requests/github-pr-branch-linked-pr-divergence.test.ts
+6 -6
View File
@@ -220,20 +220,20 @@
1 src/renderer/src/lib/browser/navigation/http-link-localhost-route.ts # extracted from http-link-routing.ts
1 src/renderer/src/lib/browser/navigation/http-link-routing.ts
2 src/renderer/src/lib/browser/workspace/workspace-browser-tab-open.ts
1 src/renderer/src/lib/client-creation-action-error.ts
2 src/renderer/src/lib/client-creation-action-policy.ts
1 src/renderer/src/lib/workspace/creation/surface-policy/client-creation-action-error.ts
2 src/renderer/src/lib/workspace/creation/surface-policy/client-creation-action-policy.ts
1 src/renderer/src/runtime/hosts/selection/default-creation-host.ts # the sanctioned reader of the default host
1 src/renderer/src/lib/launch-ai-vault-session.ts
1 src/renderer/src/lib/local-preflight-context.ts
1 src/renderer/src/lib/agent-session/resume/history/launch-ai-vault-session.ts
1 src/renderer/src/runtime/hosts/preflight/local-preflight-context.ts
2 src/renderer/src/runtime/hosts/observations/provider-runtime-context.ts
2 src/renderer/src/lib/workspace/ownership/repo-runtime-owner.ts
1 src/renderer/src/lib/workspace/ownership/runtime-session-mirror-owners.ts
1 src/renderer/src/lib/runtime-session-mirror-targets.ts
1 src/renderer/src/runtime/web-session-tabs-sync/subscriptions/runtime-session-mirror-targets.ts
1 src/renderer/src/lib/workspace/ownership/single-runtime-legacy-owner.ts
1 src/renderer/src/lib/skills/runtime/skill-runtime-command.ts
1 src/renderer/src/lib/workspace/ownership/terminal-close-route.ts
4 src/renderer/src/lib/workspace/ownership/terminal-worktree-route.ts # resolveTerminalPtyOwner: teardown, close and PTY identity read spawn's attribution (round 3 F8), which retired the deprecated resolver's readers
3 src/renderer/src/lib/unread-badge-count-selector.ts
3 src/renderer/src/attention/unread/unread-badge-count-selector.ts
1 src/renderer/src/runtime/hosted-terminals/restoration/web-runtime-worktree-terminal-after-wake.ts
1 src/renderer/src/lib/work-items/linear/linear-issue-url-lookup.ts
1 src/renderer/src/lib/work-items/linear/linear-issue-write.ts
+1 -1
View File
@@ -479,7 +479,7 @@
2 src/main/runtime/mobile-cloud-relay/relay-revoke-outbox.ts
1 src/main/runtime/orchestration/db/runtime-orchestration-database-access.ts
2 src/main/runtime/push/push-unregister-outbox.ts
2 src/main/runtime/rpc/methods/mobile-delivery/bundled-mobile-web-bundle.ts
1 src/main/runtime/rpc/methods/mobile-delivery/bundled-mobile-web-bundle.ts
1 src/main/runtime/rpc/server/network-source-policy-store.ts
2 src/main/runtime/rpc/server/pairing/device-registry-corruption.ts
2 src/main/runtime/rpc/server/pairing/device-registry-disk-merge.ts
@@ -42,70 +42,70 @@
"count": 1
},
{
"filePath": "mobile/src/components/accounts-snapshot.ts",
"filePath": "mobile/src/accounts/accounts-snapshot.ts",
"kind": "object-property:message",
"text": "Claude limits use the wrong provider identity",
"dynamic": false,
"count": 1
},
{
"filePath": "mobile/src/components/accounts-snapshot.ts",
"filePath": "mobile/src/accounts/accounts-snapshot.ts",
"kind": "object-property:message",
"text": "Codex limits use the wrong provider identity",
"dynamic": false,
"count": 1
},
{
"filePath": "mobile/src/components/accounts-snapshot.ts",
"filePath": "mobile/src/accounts/accounts-snapshot.ts",
"kind": "object-property:message",
"text": "Host Codex accounts cannot name a WSL distro",
"dynamic": false,
"count": 1
},
{
"filePath": "mobile/src/components/accounts-snapshot.ts",
"filePath": "mobile/src/accounts/accounts-snapshot.ts",
"kind": "object-property:message",
"text": "Host rate-limit targets cannot name a WSL distro",
"dynamic": false,
"count": 1
},
{
"filePath": "mobile/src/components/accounts-snapshot.ts",
"filePath": "mobile/src/accounts/accounts-snapshot.ts",
"kind": "object-property:message",
"text": "Inactive Claude limits use the wrong provider identity",
"dynamic": false,
"count": 1
},
{
"filePath": "mobile/src/components/accounts-snapshot.ts",
"filePath": "mobile/src/accounts/accounts-snapshot.ts",
"kind": "object-property:message",
"text": "Inactive Codex limits use the wrong provider identity",
"dynamic": false,
"count": 1
},
{
"filePath": "mobile/src/components/accounts-snapshot.ts",
"filePath": "mobile/src/accounts/accounts-snapshot.ts",
"kind": "object-property:message",
"text": "WSL Codex accounts require an exact distro",
"dynamic": false,
"count": 1
},
{
"filePath": "mobile/src/components/accounts-snapshot.ts",
"filePath": "mobile/src/accounts/accounts-snapshot.ts",
"kind": "object-property:message",
"text": "WSL rate-limit targets require an exact distro",
"dynamic": false,
"count": 1
},
{
"filePath": "mobile/src/components/codex-reset-credit-reply-schema.ts",
"filePath": "mobile/src/accounts/usage/codex-reset-credit-reply-schema.ts",
"kind": "object-property:message",
"text": "Host reset scopes cannot name a WSL distro",
"dynamic": false,
"count": 1
},
{
"filePath": "mobile/src/components/codex-reset-credit-reply-schema.ts",
"filePath": "mobile/src/accounts/usage/codex-reset-credit-reply-schema.ts",
"kind": "object-property:message",
"text": "WSL reset scopes require an exact distro",
"dynamic": false,
File diff suppressed because one or more lines are too long
+18 -111
View File
@@ -4620,7 +4620,6 @@
"src/preload/ssh-authority-forwarding.test.ts": 1111,
"src/preload/updater-package-recovery.test.ts": 1102,
"src/preload/usage-provider-api.test.ts": 46,
"src/renderer/src/app-shell/app-command-handlers-tab-rename.test.ts": 1786,
"src/renderer/src/app-shell/shutdown-checkpoint-persist.test.ts": 65,
"src/renderer/src/app-shell/startup-window-parity.test.ts": 2306,
"src/renderer/src/app-shell/use-profile-state-save-delay-notice.sonner.test.tsx": 355,
@@ -4775,7 +4774,6 @@
"src/renderer/src/components/browser-pane/workspace-doc/HtmlDocPreview.failure-message.test.tsx": 3251,
"src/renderer/src/components/browser-pane/workspace-doc/HtmlDocPreview.toolbar.test.tsx": 4357,
"src/renderer/src/components/browser-pane/workspace-doc/doc-preview-artifact-share.test.ts": 1754,
"src/renderer/src/components/browser-pane/workspace-doc/doc-preview-document-actions.test.ts": 327,
"src/renderer/src/components/browser-pane/workspace-doc/doc-preview-external-link-confirmation.test.ts": 1057,
"src/renderer/src/components/browser-pane/workspace-doc/doc-preview-webview-attach.test.ts": 200,
"src/renderer/src/components/browser-pane/workspace-doc/use-doc-preview-guest-tools.test.ts": 439,
@@ -4836,7 +4834,6 @@
"src/renderer/src/components/editor/EditorFileLocationMenuItems.test.tsx": 846,
"src/renderer/src/components/editor/EditorPanel.custom-editor-flush.test.tsx": 2478,
"src/renderer/src/components/editor/EditorPanel.diff-rich-owner.test.tsx": 2823,
"src/renderer/src/components/editor/EditorPanelHeaderPath.test.tsx": 2664,
"src/renderer/src/components/editor/notebook/cells/IpynbCellEditor.external-sync.test.tsx": 1660,
"src/renderer/src/components/editor/notebook/kernel/IpynbKernelToolbar.test.tsx": 736,
"src/renderer/src/components/editor/notebook/document/IpynbRendering.test.tsx": 2143,
@@ -5102,7 +5099,6 @@
"src/renderer/src/components/mobile/WindowsFirewallNotice.test.tsx": 691,
"src/renderer/src/components/mobile/paired-mobile-devices.test.ts": 192,
"src/renderer/src/components/mobile/use-mobile-page-paired-devices.test.ts": 475,
"src/renderer/src/components/native-chat-recovery/integration/native-chat-resume-bulk-progress.test.tsx": 3261,
"src/renderer/src/components/native-chat-recovery/offers/native-chat-resume-failed-chat-watch.test.ts": 1954,
"src/renderer/src/components/native-chat-recovery/integration/native-chat-resume-finished-run.test.tsx": 4173,
"src/renderer/src/components/native-chat/messages/rows/NativeChatAgentMessageCard.test.tsx": 3700,
@@ -5124,27 +5120,15 @@
"src/renderer/src/components/native-chat/media/visuals/NativeChatMarkdown.visual.test.tsx": 2860,
"src/renderer/src/components/native-chat/messages/reasoning/NativeChatMessageList.live-reasoning.test.tsx": 20337,
"src/renderer/src/components/native-chat/NativeChatMessageList.new-rows-marker.test.tsx": 4304,
"src/renderer/src/components/native-chat/viewport/history/NativeChatMessageList.older-history.test.tsx": 12659,
"src/renderer/src/components/native-chat/conversation/slots/NativeChatMessageList.opening-send.test.tsx": 3604,
"src/renderer/src/components/native-chat/conversation/slots/NativeChatMessageList.queued-turn-order.test.tsx": 2949,
"src/renderer/src/components/native-chat/viewport/navigation/NativeChatMessageList.rail-history-jump.test.tsx": 23851,
"src/renderer/src/components/native-chat/viewport/scroll/NativeChatMessageList.scroll-behavior.test.tsx": 14260,
"src/renderer/src/components/native-chat/subagents/NativeChatMessageList.subagent-sections.test.tsx": 7517,
"src/renderer/src/components/native-chat/surfaces/integration/NativeChatMessageList.test.tsx": 4252,
"src/renderer/src/components/native-chat/conversation/turns/NativeChatMessageList.turn-indicator.test.tsx": 4070,
"src/renderer/src/components/native-chat/conversation/slots/NativeChatMessageList.turn-membership.test.tsx": 3527,
"src/renderer/src/components/native-chat/session/structured/delivery/NativeChatMessageList.unsent-message.test.tsx": 3069,
"src/renderer/src/components/native-chat/viewport/scroll/NativeChatMessageList.visual-scroll.test.tsx": 6691,
"src/renderer/src/components/native-chat/viewport/virtualization/NativeChatMessageList.windowing.test.tsx": 20958,
"src/renderer/src/components/native-chat/viewport/rail/NativeChatMessageRail.test.tsx": 1134,
"src/renderer/src/components/native-chat/messages/rows/NativeChatMessageRow.test.tsx": 3533,
"src/renderer/src/components/native-chat/NativeChatNewRowsMarker.test.tsx": 3019,
"src/renderer/src/components/native-chat/usage/NativeChatNoticeRow.test.tsx": 3399,
"src/renderer/src/components/native-chat/pane/actions/NativeChatPaneHeader.test.tsx": 2736,
"src/renderer/src/components/native-chat/composer/editor/NativeChatPromptEditor.paragraph-selection.test.tsx": 652,
"src/renderer/src/components/native-chat/composer/editor/NativeChatPromptEditor.test.tsx": 1110,
"src/renderer/src/components/native-chat/prompts/NativeChatQuestionCard.test.tsx": 762,
"src/renderer/src/components/native-chat/queue/NativeChatQueuedMessageList.in-flight.test.tsx": 1865,
"src/renderer/src/components/native-chat/queue/NativeChatQueuedMessageRows.test.tsx": 2691,
"src/renderer/src/components/native-chat/prompts/NativeChatResolutionReceipt.test.tsx": 912,
"src/renderer/src/components/native-chat/media/images/NativeChatResolvedView.context-menu.test.tsx": 4025,
@@ -5201,7 +5185,6 @@
"src/renderer/src/components/native-chat/drafts/native-chat-draft-retention.test.ts": 1415,
"src/renderer/src/components/native-chat/attachments/intake/native-chat-external-attachments-destination.test.tsx": 951,
"src/renderer/src/components/native-chat/links/actions/native-chat-file-link-existence.test.ts": 1937,
"src/renderer/src/components/native-chat/pane/actions/native-chat-header-ownership.test.tsx": 2796,
"src/renderer/src/components/native-chat/links/actions/native-chat-host-file-open.test.ts": 895,
"src/renderer/src/components/native-chat/links/previews/native-chat-hover-preview-cache.test.ts": 49,
"src/renderer/src/components/native-chat/attachments/chips/native-chat-image-references.test.tsx": 2485,
@@ -5245,8 +5228,6 @@
"src/renderer/src/components/native-chat/viewport/rail/structured-agent-session-rail-outline.test.ts": 48,
"src/renderer/src/components/native-chat/session/structured/read/structured-agent-session-read-transport.test.ts": 243,
"src/renderer/src/components/native-chat/session/status/structured-agent-session-status-bridge-clock.test.tsx": 2070,
"src/renderer/src/components/native-chat/session/status/structured-agent-session-status-bridge-failed-start.test.tsx": 2398,
"src/renderer/src/components/native-chat/session/status/structured-agent-session-status-bridge-unconfirmed-start.test.tsx": 2328,
"src/renderer/src/components/native-chat/conversation/projection/structured-agent-session-transcript-order.test.ts": 294,
"src/renderer/src/components/native-chat/session/attention/structured-attention-dispatch.test.ts": 1974,
"src/renderer/src/components/native-chat/session/status/structured-chat-sleep-startup.test.tsx": 2285,
@@ -5309,7 +5290,6 @@
"src/renderer/src/components/new-workspace/use-smart-workspace-name-field-foundation.source.test.tsx": 2290,
"src/renderer/src/components/new-workspace/work-item-source-selection.test.ts": 1736,
"src/renderer/src/components/onboarding/OnboardingLanguageLoading.test.tsx": 2167,
"src/renderer/src/components/onboarding/onboarding-feature-setup.test.ts": 76,
"src/renderer/src/components/pet/pet-blob-cache.test.ts": 64,
"src/renderer/src/components/plain-ssh-terminal/PlainSshTerminalPanels.test.tsx": 2510,
"src/renderer/src/components/plugins/declarative/PluginDeclarativeView.test.tsx": 2804,
@@ -5400,7 +5380,6 @@
"src/renderer/src/components/right-sidebar/file-explorer/watching/file-explorer-watch-reconcile.test.ts": 1906,
"src/renderer/src/components/right-sidebar/folder-workspace-attached-worktrees.test.ts": 70,
"src/renderer/src/components/right-sidebar/source-control/sync/git-status-refresh.test.ts": 553,
"src/renderer/src/components/right-sidebar/source-control/sync/git-status-twin-copy.test.ts": 1841,
"src/renderer/src/components/right-sidebar/hosted-review/folder-checks/parent-pr-checks-rows.test.ts": 374,
"src/renderer/src/components/plugins/frames/plugin-frame-host-declarative.test.ts": 439,
"src/renderer/src/components/right-sidebar/plugin-panels/health/plugin-panel-act-driver.test.ts": 293,
@@ -5470,7 +5449,6 @@
"src/renderer/src/components/settings/repository/worktrees/SparsePresetSettingsSection.test.tsx": 744,
"src/renderer/src/components/settings/ssh/server-actions/SshHostDeltaMoveDialog.test.tsx": 438,
"src/renderer/src/components/settings/ssh/server-actions/SshHostRecoverServerAction.test.tsx": 669,
"src/renderer/src/components/settings/ssh/SshPane.test.tsx": 1699,
"src/renderer/src/components/settings/ssh/targets/SshTargetForm.test.tsx": 1014,
"src/renderer/src/components/settings/ssh/targets/SshTargetList.test.tsx": 2093,
"src/renderer/src/components/settings/tasks/TaskSourceSimpleSetup.test.tsx": 527,
@@ -5573,7 +5551,6 @@
"src/renderer/src/components/sidebar/workspace-board/surface/use-workspace-kanban-drawer-lingering.test.tsx": 262,
"src/renderer/src/components/sidebar/workspace-board/selection/use-workspace-kanban-selection.test.tsx": 243,
"src/renderer/src/components/sidebar/workspace-card/review/use-workspace-reference-details.test.tsx": 1335,
"src/renderer/src/components/sidebar/worktree-list/navigation/use-workspace-reveal-body-redirect.test.tsx": 215,
"src/renderer/src/components/sidebar/workspace-card/activity/use-worktree-activity-status.test.tsx": 565,
"src/renderer/src/components/sidebar/workspace-card/activity/use-worktree-agent-rows-subscriptions.test.tsx": 3635,
"src/renderer/src/components/sidebar/host-admission/wsl/use-wsl-distro-list.test.ts": 542,
@@ -5625,7 +5602,6 @@
"src/renderer/src/components/sidebar/worktree-list/listing/worktree-sort-label-ordering.test.ts": 114,
"src/renderer/src/components/sidebar/wsl-host-offer-move.test.ts": 227,
"src/renderer/src/components/skills/installation/SkillInstallManagementDialog.test.tsx": 3300,
"src/renderer/src/components/skills/sharing/SkillSharedLinkRow.test.tsx": 817,
"src/renderer/src/components/skills/SkillsPage.test.tsx": 3822,
"src/renderer/src/components/skills/catalog/skill-agent-filter.test.ts": 274,
@@ -5635,7 +5611,6 @@
"src/renderer/src/components/stats/usage-overview-model.test.ts": 364,
"src/renderer/src/components/status-bar/ClaudeSwitcherMenu.owner-lifetime.test.tsx": 2317,
"src/renderer/src/components/status-bar/SshStatusSegment.large-host-list.test.tsx": 1838,
"src/renderer/src/components/status-bar/StatusBarUsageChangeNotices.test.tsx": 785,
"src/renderer/src/components/status-bar/UpdateStatusSegment.test.tsx": 2484,
"src/renderer/src/components/status-bar/account-switch-row-keyboard.test.tsx": 2286,
@@ -5662,14 +5637,12 @@
"src/renderer/src/components/tab-bar/TabStripScrollIndicator.test.tsx": 356,
"src/renderer/src/components/tab-bar/cli-chat-resume-close-terminal.test.ts": 598,
"src/renderer/src/components/tab-bar/cli-chat-resume-run-close.test.ts": 3079,
"src/renderer/src/components/tab-bar/cli-chat-resume-run.test.ts": 3848,
"src/renderer/src/components/tab-bar/group-tab-order.test.ts": 2091,
"src/renderer/src/components/tab-bar/host-agent-launch-preferences-source.test.tsx": 3154,
"src/renderer/src/components/tab-bar/recent-tab-switching.test.ts": 1795,
"src/renderer/src/components/tab-bar/tab-agent-launch-options.test.ts": 438,
"src/renderer/src/components/tab-bar/tab-agent-types-by-tab-id.test.ts": 206,
"src/renderer/src/components/tab-bar/tab-bar-layout-owner-props.test.ts": 174,
"src/renderer/src/components/tab-bar/tab-bar-quick-commands-shortcut.test.tsx": 273,
"src/renderer/src/components/tab-bar/tab-context-menu.test.tsx": 5620,
"src/renderer/src/components/tab-bar/tab-create-entry-classifier.test.ts": 510,
"src/renderer/src/components/tab-bar/tab-create-entry-local-path.test.ts": 2614,
@@ -5772,7 +5745,6 @@
"src/renderer/src/components/terminal-pane/pty-connection/agent-identity/foreground-process/pane-foreground-inspect-observation-identity.test.ts": 226,
"src/renderer/src/components/terminal-pane/pty-connection/agent-identity/foreground-process/pane-foreground-process-exit-retire.test.ts": 329,
"src/renderer/src/components/sidebar/workspace-card/activity/structured-chat-activity-status-live.test.tsx": 4146,
"src/renderer/src/components/terminal-pane/parking/output-watchers/parked-terminal-byte-watcher.test.ts": 2837,
"src/renderer/src/components/terminal-pane/parking/output-watchers/parked-terminal-command-status.test.ts": 352,
"src/renderer/src/components/terminal-pane/layout/close/pending-pane-close-confirmation.test.ts": 4695,
"src/renderer/src/components/terminal-pane/layout/close/pending-runtime-pane-close.test.ts": 3487,
@@ -5862,7 +5834,6 @@
"src/renderer/src/components/terminal-pane/pty-transport/remote-runtime/remote-runtime-pty-transport-activation-inventory-fallback.test.ts": 1311,
"src/renderer/src/components/terminal-pane/pty-transport/remote-runtime/remote-runtime-pty-transport-create-handoff.test.ts": 14353,
"src/renderer/src/components/terminal-pane/pty-transport/remote-runtime/remote-runtime-pty-transport-create-outcome-recovery.test.ts": 2041,
"src/renderer/src/components/terminal-pane/pty-transport/remote-runtime/remote-runtime-pty-transport-empty-initial-snapshot.test.ts": 1491,
"src/renderer/src/components/terminal-pane/pty-transport/remote-runtime/remote-runtime-pty-transport-end-verdict.test.ts": 942,
"src/renderer/src/components/terminal-pane/pty-transport/remote-runtime/remote-runtime-pty-transport-expired-pane-recovery.test.ts": 1763,
"src/renderer/src/components/terminal-pane/pty-transport/remote-runtime/remote-runtime-pty-transport-healthy-link-reattach.test.ts": 1595,
@@ -5879,7 +5850,6 @@
"src/renderer/src/components/terminal-pane/pty-transport/remote-runtime/remote-runtime-pty-transport-pending-host-surface-attach.test.ts": 1768,
"src/renderer/src/components/terminal-pane/pty-transport/remote-runtime/remote-runtime-pty-transport-prebind-discard-notice.test.ts": 889,
"src/renderer/src/components/terminal-pane/pty-transport/remote-runtime/remote-runtime-pty-transport-reattach-type-ahead.test.ts": 3894,
"src/renderer/src/components/terminal-pane/pty-transport/remote-runtime/remote-runtime-pty-transport-reveal-round-trips.test.ts": 1023,
"src/renderer/src/components/terminal-pane/pty-transport/remote-runtime/remote-runtime-pty-transport-snapshot-replay.test.ts": 1717,
"src/renderer/src/components/terminal-pane/pty-transport/remote-runtime/remote-runtime-pty-transport-spawn-intent.test.ts": 2215,
"src/renderer/src/components/terminal-pane/pty-transport/remote-runtime/remote-runtime-pty-transport-split-leaf-activation.test.ts": 2034,
@@ -5990,7 +5960,6 @@
"src/renderer/src/components/terminal-pane/viewport/visibility/use-terminal-pane-global-effects-visibility-resume.test.ts": 1951,
"src/renderer/src/components/terminal-pane/viewport/visibility/use-terminal-pane-global-effects-window-focus-recovery.test.ts": 1836,
"src/renderer/src/components/terminal-pane/use-terminal-pane-lifecycle.test.ts": 1806,
"src/renderer/src/components/terminal-pane/viewport/visibility/use-terminal-scroll-visibility-memory.test.ts": 79,
"src/renderer/src/components/terminal-pane/parking/lifecycle/use-terminal-tab-cold-parking.test.ts": 752,
"src/renderer/src/components/terminal-pane/viewport/visibility/use-terminal-window-wake-recovery.test.ts": 494,
"src/renderer/src/components/terminal-pane/links/http/wrapped-terminal-http-link-limits.test.ts": 108,
@@ -6006,7 +5975,6 @@
"src/renderer/src/components/terminal/active-terminal-repair-loop.react185.test.tsx": 1998,
"src/renderer/src/components/terminal/background-terminal-worktree-mount.test.ts": 1707,
"src/renderer/src/components/terminal/background-terminal-worktree-visibility.test.ts": 1790,
"src/renderer/src/components/terminal/initial-terminal-admission-wait.test.tsx": 2444,
"src/renderer/src/components/terminal/initial-terminal-structured-launch.test.tsx": 786,
"src/renderer/src/components/terminal/running-terminal-close-guard.test.ts": 99,
"src/renderer/src/components/terminal/startup-terminal-tab-hold.test.ts": 2118,
@@ -6030,7 +5998,6 @@
"src/renderer/src/components/use-quick-open-interaction.test.tsx": 1987,
"src/renderer/src/components/use-task-creation-draft-retention.test.ts": 3185,
"src/renderer/src/components/use-terminal-bulk-close-actions.frame-flush.test.tsx": 2300,
"src/renderer/src/components/use-terminal-create-actions.test.tsx": 302,
"src/renderer/src/components/use-terminal-editor-close-foundation.window-close.test.tsx": 2105,
"src/renderer/src/components/use-terminal-parking-pass.test.tsx": 2142,
"src/renderer/src/components/use-terminal-window-lifecycle.frame-flush.test.tsx": 2164,
@@ -6053,9 +6020,7 @@
"src/renderer/src/components/workspace-emoji/WorkspaceEmojiPickerPanel.test.tsx": 763,
"src/renderer/src/components/workspace-emoji/useWorkspaceEmojiShortcodeInput.test.tsx": 365,
"src/renderer/src/components/worktree-creation/PendingNativeChatCreation.test.tsx": 4075,
"src/renderer/src/components/worktree-jump/WorktreeJumpPalette.linear-url.test.tsx": 3372,
"src/renderer/src/components/worktree-jump/WorktreeJumpPalette.recent-tabs.behavior.test.tsx": 4445,
"src/renderer/src/components/worktree-jump/WorktreeJumpPalette.recent-tabs.test.tsx": 9384,
"src/renderer/src/components/worktree-jump/WorktreeJumpPalette.test.tsx": 4442,
"src/renderer/src/components/worktree-jump/use-worktree-jump-palette-browser-ownership.test.ts": 2096,
"src/renderer/src/components/worktree-jump/use-worktree-jump-palette-task-search.test.tsx": 2140,
@@ -6161,7 +6126,6 @@
"src/renderer/src/hooks/useIpcEvents-client-hosted-browser-rows.test.ts": 1894,
"src/renderer/src/hooks/useIpcEvents-close-routing-active-browser-tab.test.ts": 4572,
"src/renderer/src/hooks/useIpcEvents-close-routing-session-tabs.test.ts": 5812,
"src/renderer/src/hooks/useIpcEvents-cmd-j-digit-chord.test.ts": 2703,
"src/renderer/src/hooks/useIpcEvents-lifecycle.test.ts": 2326,
"src/renderer/src/hooks/useIpcEvents-new-workspace-shortcut.test.ts": 72,
"src/renderer/src/hooks/useIpcEvents-runtime-environment-selectors.test.ts": 530,
@@ -6179,7 +6143,6 @@
"src/renderer/src/hooks/useReadOnScreenAttention.test.ts": 1915,
"src/renderer/src/hooks/useRetiredWorktreeNames.test.ts": 593,
"src/renderer/src/hooks/useUnreadDockBadge.test.ts": 2126,
"src/renderer/src/hooks/virtualized-hidden-row-measurement.test.ts": 199,
"src/renderer/src/hooks/worktree-change-refresh-queue.test.ts": 59,
"src/renderer/src/i18n/I18nProvider.test.tsx": 2101,
@@ -6189,12 +6152,11 @@
"src/renderer/src/i18n/plugin-pack-plurals.test.ts": 191,
"src/renderer/src/i18n/relative-time-format.test.ts": 53,
"src/renderer/src/i18n/ui-intl-formatters.test.ts": 208,
"src/renderer/src/lib/activate-ai-vault-structured-session-host.test.ts": 589,
"src/renderer/src/lib/activate-ai-vault-structured-session-reveal.test.ts": 2099,
"src/renderer/src/lib/agent-session/open/activate-ai-vault-structured-session-reveal.test.ts": 2099,
"src/renderer/src/lib/workspace/tabs/activate-tab-and-focus-pane.test.ts": 54,
"src/renderer/src/lib/agent-session/messaging/terminal/active-agent-note-send-explicit-target.test.ts": 980,
"src/renderer/src/lib/agent-session/messaging/terminal/active-agent-note-send-focused-session.test.ts": 536,
"src/renderer/src/lib/activity-thread-display.test.ts": 134,
"src/renderer/src/lib/workspace/activity/activity-thread-display.test.ts": 134,
"src/renderer/src/lib/agent-account-restart-startup.test.ts": 1780,
"src/renderer/src/lib/agent-session/launch/background/agent-background-session-launch-host.test.ts": 1910,
"src/renderer/src/lib/agent-draft-readiness.test.ts": 245,
@@ -6204,7 +6166,6 @@
"src/renderer/src/lib/agent-session/hibernation/agent-hibernation-runtime-liveness-race.test.ts": 1914,
"src/renderer/src/lib/agent-session/launch/pane/agent-launch-pane-verdict-application.test.ts": 1869,
"src/renderer/src/lib/agent-session/launch/routing/agent-launch-route-input.test.ts": 1659,
"src/renderer/src/lib/agent-session/launch/routing/agent-launch-route-registered-agents.test.ts": 1749,
"src/renderer/src/lib/agent-session/launch/pane/agent-launch-tab-main-written.test.ts": 2084,
"src/renderer/src/lib/agent-session/launch/pane/agent-launch-tab-publication.test.ts": 1855,
"src/renderer/src/lib/agent-session/launch/pane/agent-launch-through-host.test.ts": 1975,
@@ -6213,7 +6174,6 @@
"src/renderer/src/lib/agent-session/messaging/paste/agent-paste-draft.test.ts": 445,
"src/renderer/src/lib/agent-session/resume/agent-resume-launch-target.test.ts": 3911,
"src/renderer/src/lib/agent-session/launch/structured-agent-session-launch-after-failure.test.ts": 870,
"src/renderer/src/lib/agent-session/launch/structured-agent-session-launch-close-race.test.ts": 983,
"src/renderer/src/lib/agent-session/launch/structured-agent-session-launch-create-message.test.ts": 2521,
"src/renderer/src/lib/agent-session/launch/structured-agent-session-launch-different-request.test.ts": 885,
"src/renderer/src/lib/agent-session/launch/structured-agent-session-launch-exited-owner.test.ts": 1289,
@@ -6224,9 +6184,6 @@
"src/renderer/src/lib/agent-session/launch/structured-agent-session-launch-prompt.test.ts": 710,
"src/renderer/src/lib/agent-session/launch/structured-agent-session-launch-record.test.ts": 151,
"src/renderer/src/lib/agent-session/launch/structured-agent-session-launch-resume-identity.test.ts": 828,
"src/renderer/src/lib/agent-session/launch/structured-agent-session-launch-unconfirmed-or-retried.test.ts": 1085,
"src/renderer/src/lib/agent-session/launch/structured-agent-session-launch.test.ts": 977,
"src/renderer/src/lib/agent-session/launch/structured-agent-session-new-chat-own-launch.test.ts": 2177,
"src/renderer/src/lib/agent-session/structured-agent-session-draft-position-lifetime.test.tsx": 3166,
"src/renderer/src/lib/agent-session/structured-agent-session-ordinary-draft.test.tsx": 9907,
"src/renderer/src/lib/agent-session/structured-agent-session-provisional-tab.test.ts": 3672,
@@ -6250,7 +6207,6 @@
"src/renderer/src/lib/bounded-generation-map.test.ts": 35,
"src/renderer/src/lib/browser/history/browser-history-match.test.ts": 328,
"src/renderer/src/lib/browser/navigation/browser-link-destination.test.ts": 1839,
"src/renderer/src/lib/browser/navigation/browser-link-open-layout-owner.test.ts": 3133,
"src/renderer/src/lib/browser/navigation/browser-link-open.test.ts": 2215,
"src/renderer/src/lib/browser/navigation/browser-link-profile-isolation.test.ts": 2511,
"src/renderer/src/lib/browser/palette/browser-page-palette-activation.test.ts": 1983,
@@ -6261,21 +6217,19 @@
"src/renderer/src/lib/claude-account-switch-sessions.test.ts": 782,
"src/renderer/src/lib/claude-session-account-move.test.ts": 1816,
"src/renderer/src/lib/clipboard/images/clipboard-image-copy.test.ts": 243,
"src/renderer/src/lib/cmd-j-host-qualified-candidate-ownership.test.ts": 526,
"src/renderer/src/lib/cmd-j-linear-issue-intent.test.ts": 42,
"src/renderer/src/lib/workspace/search/palette/cmd-j-host-qualified-candidate-ownership.test.ts": 526,
"src/renderer/src/lib/workspace/search/palette/cmd-j-linear-issue-intent.test.ts": 42,
"src/renderer/src/lib/code-host-error-copy.test.ts": 297,
"src/renderer/src/lib/codex-pane-selection-lane.test.ts": 543,
"src/renderer/src/lib/agent-session/accounts/codex-pane-selection-lane.test.ts": 543,
"src/renderer/src/lib/agent-session/accounts/codex/codex-session-restart-shell-flap.test.ts": 1745,
"src/renderer/src/lib/agent-session/accounts/codex/codex-session-restart.test.ts": 2039,
"src/renderer/src/lib/codex-stale-pane-account-identity.test.ts": 1823,
"src/renderer/src/lib/codex-stale-pane-sweep.test.ts": 1817,
"src/renderer/src/lib/agent-session/accounts/codex/codex-stale-pane-account-identity.test.ts": 1823,
"src/renderer/src/lib/agent-session/accounts/codex/codex-stale-pane-sweep.test.ts": 1817,
"src/renderer/src/lib/source-control/review/comments/comment-body-submit-state.test.ts": 55,
"src/renderer/src/lib/composer-submit-cancellation.test.ts": 41,
"src/renderer/src/lib/workspace/ownership/connection-context.test.ts": 1817,
"src/renderer/src/lib/create-untitled-markdown.test.ts": 566,
"src/renderer/src/lib/desktop-created-server-tabs.test.ts": 1933,
"src/renderer/src/lib/workspace/ownership/direct-ssh-target-scope.test.ts": 48,
"src/renderer/src/lib/workspace/creation/work-item/direct-work-item-setup-callers.test.tsx": 2436,
"src/renderer/src/lib/workspace/creation/work-item/direct-work-item-setup.test.ts": 2072,
"src/renderer/src/lib/browser/documents/doc-preview-grants.test.ts": 2094,
"src/renderer/src/lib/editor/file-operations/editor-file-operation-owner.test.ts": 2848,
@@ -6285,13 +6239,9 @@
"src/renderer/src/runtime/hosts/platform/execution-host-facts.test.ts": 1796,
"src/renderer/src/components/sidebar/sidebar-feedback/feedback-image-attachments.test.ts": 557,
"src/renderer/src/lib/files/search/file-search-selection.test.ts": 51,
"src/renderer/src/lib/finished-agent-resume-resurrection.test.ts": 1872,
"src/renderer/src/lib/agent-session/resume/finished-agent-resume-resurrection.test.ts": 1872,
"src/renderer/src/components/terminal-pane/parking/retention/foreground-terminal-tabs.test.ts": 55,
"src/renderer/src/lib/work-items/github/github-source-runtime-context.test.ts": 62,
"src/renderer/src/lib/host-mirror-handle-gap-drain.test.ts": 1706,
"src/renderer/src/lib/host-mirror-handle-gap-resume.test.ts": 1811,
"src/renderer/src/lib/host-mirrored-pane-resume-replay.test.ts": 1814,
"src/renderer/src/lib/browser/navigation/http-link-completion.test.ts": 1760,
"src/renderer/src/lib/browser/navigation/http-link-routing-store.test.ts": 2211,
"src/renderer/src/lib/text-input/ime/ime-composition-keyboard-event.test.ts": 274,
"src/renderer/src/lib/text-input/ime/ime-text-field.test.tsx": 739,
@@ -6312,7 +6262,6 @@
"src/renderer/src/app-shell/startup/lazy-with-retry.never-landed-reload.test.ts": 194,
"src/renderer/src/lib/work-items/linear/linear-board-drag-payload.test.ts": 58,
"src/renderer/src/lib/work-items/linear/linear-issue-workspace-attachment.test.ts": 99,
"src/renderer/src/lib/link-source-local-open-owner.test.ts": 433,
"src/renderer/src/lib/work-items/linked-work-item-context.test.ts": 64,
"src/renderer/src/lib/editor/monaco/monaco-editor-gutter-disposal.test.ts": 295,
"src/renderer/src/lib/monaco-languages/markdown-heading-outline.test.ts": 70,
@@ -6329,11 +6278,10 @@
"src/renderer/src/lib/monaco-languages/textmate-token-provider.test.ts": 245,
"src/renderer/src/lib/monaco-languages/zig-highlighting.test.ts": 7984,
"src/renderer/src/lib/agent-session/resume/cli-fork/native-chat-cli-fork-preparation.test.ts": 2773,
"src/renderer/src/lib/open-agent-message-sender.test.ts": 1497,
"src/renderer/src/lib/simulator/launch/open-mobile-emulator-tab.test.ts": 545,
"src/renderer/src/lib/order-empty-query-worktrees.test.ts": 62,
"src/renderer/src/lib/workspace/search/palette/order-empty-query-worktrees.test.ts": 62,
"src/renderer/src/lib/files/drop/os-file-drop-cancellation-guard.test.ts": 204,
"src/renderer/src/lib/paired-runtime-closed-tab-resume.test.ts": 2008,
"src/renderer/src/lib/agent-session/resume/paired-runtime-closed-tab-resume.test.ts": 2008,
"src/renderer/src/lib/pane-manager/pane-close-focus-successor.test.ts": 1123,
"src/renderer/src/lib/pane-manager/pane-container-listener-lifecycle.test.ts": 312,
"src/renderer/src/lib/pane-manager/pane-cursor-blink-suspension.test.ts": 429,
@@ -6386,8 +6334,7 @@
"src/renderer/src/lib/text-input/paste/paste-payload-metadata.test.ts": 53,
"src/renderer/src/lib/path-display/path-head-elision.test.ts": 53,
"src/renderer/src/lib/path.test.ts": 55,
"src/renderer/src/lib/plugin-command-keybindings.test.ts": 1909,
"src/renderer/src/lib/plugin-command-replacements.test.ts": 95,
"src/renderer/src/lib/plugins/commands/plugin-command-keybindings.test.ts": 1909,
"src/renderer/src/lib/plugin-icons/plugin-icon-svg.test.ts": 231,
"src/renderer/src/lib/editor/appearance/plugin-monaco-token-rules.test.ts": 51,
"src/renderer/src/lib/source-control/review/pr-bot-author-overrides.test.ts": 349,
@@ -6396,13 +6343,8 @@
"src/renderer/src/lib/workspace/creation/project-host-workspace-target.jira-mapping.test.ts": 76,
"src/renderer/src/lib/workspace/creation/project-host-workspace-target.test.ts": 92,
"src/renderer/src/lib/editor/file-operations/remap-open-editor-tabs-for-path-change.test.ts": 2178,
"src/renderer/src/lib/rename-user-named-tab-access.test.ts": 2804,
"src/renderer/src/lib/renderer-agent-status-observation-ingress.test.ts": 81,
"src/renderer/src/diagnostics/memory/renderer-memory-profile.test.ts": 70,
"src/renderer/src/lib/repo-search.test.ts": 54,
"src/renderer/src/lib/repo-slug-cache.test.ts": 52,
"src/renderer/src/lib/repo-slug-index.test.ts": 2240,
"src/renderer/src/lib/resolved-worktree-execution-host.test.ts": 300,
"src/renderer/src/lib/agent-session/resume/resume-sleeping-agent-session-deferred-pane.test.ts": 1747,
"src/renderer/src/lib/agent-session/resume/resume-sleeping-agent-session-direct-ssh-hydration-gap.test.ts": 1654,
"src/renderer/src/lib/agent-session/resume/resume-sleeping-agent-session-execution-host-scope.test.ts": 1924,
@@ -6414,15 +6356,10 @@
"src/renderer/src/lib/agent-session/resume/resume-sleeping-agent-session-suppress-navigation.test.ts": 1919,
"src/renderer/src/lib/agent-session/resume/resume-sleeping-agent-session.test.ts": 2140,
"src/renderer/src/lib/resume-stale-structured-agent-session.test.ts": 1774,
"src/renderer/src/lib/retracted-host-pane-resume.test.ts": 2009,
"src/renderer/src/lib/agent-session/resume/retracted-host-pane-resume.test.ts": 2009,
"src/renderer/src/lib/review-owner.test.ts": 238,
"src/renderer/src/lib/run-quick-command-in-new-tab.test.ts": 82,
"src/renderer/src/lib/runtime-host-copy.test.ts": 317,
"src/renderer/src/lib/script-textarea-rows.test.ts": 93,
"src/renderer/src/lib/session-write-subscriber-acknowledgment.test.ts": 1823,
"src/renderer/src/lib/session-write-subscriber.test.ts": 1882,
"src/renderer/src/lib/sidebar-ended-creations.test.ts": 1889,
"src/renderer/src/lib/sidebar-pending-layer.test.ts": 338,
"src/renderer/src/components/sidebar/sidebar-feed/sidebar-pending-layer.test.ts": 338,
"src/renderer/src/lib/sidebar-shadow/workspace-activity-shadow.test.ts": 1728,
"src/renderer/src/lib/simulator/launch/simulator-launch-coordination.test.ts": 43,
"src/renderer/src/lib/simulator/search/simulator-palette-search.test.ts": 515,
@@ -6430,32 +6367,25 @@
"src/renderer/src/lib/simulator/tabs/simulator-tab-layout-owner.test.ts": 2398,
"src/renderer/src/lib/simulator/tabs/simulator-tab-palette-activation.test.ts": 1903,
"src/renderer/src/lib/source-control/remote/source-control-remote-error.test.ts": 340,
"src/renderer/src/lib/ssh-config-passive-sync.test.ts": 1513,
"src/renderer/src/runtime/hosts/ssh/ssh-config-passive-sync.test.ts": 1513,
"src/renderer/src/diagnostics/memory/state-collection-byte-estimate.test.ts": 86,
"src/renderer/src/lib/agent-session/launch/structured-agent-session-launch-draft.test.ts": 1042,
"src/renderer/src/lib/agent-session/launch/structured-agent-session-launch-prerequisites.test.ts": 2427,
"src/renderer/src/lib/agent-session/options/structured-agent-session-selection-lifetime.test.tsx": 2947,
"src/renderer/src/lib/structured-chat-tab-index.test.ts": 45,
"src/renderer/src/lib/structured-session-open-consumers.test.tsx": 2643,
"src/renderer/src/lib/syntax-highlighting/incremental-syntax-tokenizer.test.ts": 665,
"src/renderer/src/lib/syntax-highlighting/syntax-highlight-scheduler.test.ts": 149,
"src/renderer/src/lib/syntax-highlighting/syntax-highlighter.test.ts": 539,
"src/renderer/src/lib/syntax-highlighting/textmate-core.test.ts": 60,
"src/renderer/src/lib/tab-agent-status-index.test.ts": 210,
"src/renderer/src/lib/task-provider-error-copy.test.ts": 363,
"src/renderer/src/app-shell/appearance/terminal-app-theme.test.ts": 301,
"src/renderer/src/lib/terminal-input-activity-coalescing.test.ts": 43,
"src/renderer/src/lib/text-input/paste/text-control-paste-ownership.test.ts": 217,
"src/renderer/src/lib/text-input/paste/text-control-paste.test.ts": 222,
"src/renderer/src/lib/text-generation-error-copy.test.ts": 466,
"src/renderer/src/lib/typing-latency/echo-instrumentation.test.ts": 145,
"src/renderer/src/lib/typing-latency/renderer-long-tasks.test.ts": 75,
"src/renderer/src/lib/typing-latency/sample-window.test.ts": 77,
"src/renderer/src/lib/unread-badge-count-selector.test.ts": 1930,
"src/renderer/src/lib/use-tab-agent-observed-signal-dispatch.test.tsx": 1971,
"src/renderer/src/lib/use-tab-agent-opencode-native-title.test.ts": 2093,
"src/renderer/src/lib/use-tab-agent.test.ts": 1961,
"src/renderer/src/lib/wake-sleeping-agents-live-unmounted-pane.test.ts": 2432,
"src/renderer/src/attention/unread/unread-badge-count-selector.test.ts": 1930,
"src/renderer/src/lib/agent-session/tab-identity/use-tab-agent-observed-signal-dispatch.test.tsx": 1971,
"src/renderer/src/lib/agent-session/tab-identity/use-tab-agent.test.ts": 1961,
"src/renderer/src/runtime/hosts/capabilities/windows-terminal-capabilities-race.test.ts": 450,
"src/renderer/src/lib/workspace/activation/workspace-activation-path-gate.test.ts": 2107,
"src/renderer/src/lib/browser/workspace/workspace-browser-tab-open-placement.test.ts": 1996,
@@ -6489,8 +6419,7 @@
"src/renderer/src/lib/workspace/activation/worktree-reactivation-tab-forkbomb.test.ts": 4131,
"src/renderer/src/lib/workspace/ownership/worktree-runtime-owner-index.detected.test.ts": 121,
"src/renderer/src/lib/workspace/ownership/worktree-runtime-owner.test.ts": 380,
"src/renderer/src/lib/worktree-status-spinner-launch-agent.test.ts": 271,
"src/renderer/src/lib/worktree-status.test.ts": 306,
"src/renderer/src/lib/workspace/activity/worktree-status.test.ts": 306,
"src/renderer/src/lib/workspace/persistence/wsl-move-renderer-store-rewrites.test.ts": 1072,
"src/renderer/src/runtime/rpc/calls/abortable-runtime-environment-call.test.ts": 189,
"src/renderer/src/runtime/provider-accounts/observations/claude-agent-view-observations.test.ts": 105,
@@ -6512,7 +6441,6 @@
"src/renderer/src/runtime/web-session-tabs-sync/closing/paired-terminal-tab-close-reload.test.ts": 1943,
"src/renderer/src/runtime/workspace-layout/frames/pane-titles-drawn-from-frames.test.ts": 1988,
"src/renderer/src/runtime/web-session-tabs-sync/agent-status/remote-agent-row-last-assistant-message.test.ts": 1776,
"src/renderer/src/runtime/files/mutations/remote-host-file-delete-repro.test.ts": 1890,
"src/renderer/src/runtime/web-session-tabs-sync/inventory/remote-runtime-session-tabs-inflight.test.ts": 55,
"src/renderer/src/runtime/hosted-terminals/snapshots/remote-runtime-snapshot-outcome.test.ts": 233,
"src/renderer/src/runtime/hosted-terminals/streams/remote-runtime-terminal-frame-drop-resync.test.ts": 266,
@@ -6544,14 +6472,12 @@
"src/renderer/src/runtime/workspace-layout/server/server-layout-apply.test.ts": 2222,
"src/renderer/src/runtime/workspace-layout/server/server-layout-editor-handover.test.ts": 5075,
"src/renderer/src/runtime/workspace-layout/server/server-layout-frames-handover.test.ts": 1991,
"src/renderer/src/runtime/workspace-layout/server/server-layout-frames-held-tabs.test.ts": 2302,
"src/renderer/src/runtime/workspace-layout/server/server-layout-frames.test.ts": 2053,
"src/renderer/src/runtime/native-chat/status/structured-agent-session-status-feed-lifecycle.test.ts": 62,
"src/renderer/src/runtime/native-chat/status/structured-agent-session-status-feed.test.ts": 82,
"src/renderer/src/runtime/native-chat/status/structured-agent-session-turn-completion-feed.test.ts": 118,
"src/renderer/src/runtime/native-chat/host-capabilities/structured-chat-host-permission.test.ts": 523,
"src/renderer/src/runtime/web-session-tabs-sync/placement/structured-conversation-tab-replacement.test.ts": 2029,
"src/renderer/src/runtime/native-chat/tab-retirement/structured-launch-cancel-layout-owner.test.ts": 1985,
"src/renderer/src/runtime/sync-runtime-graph/sync-runtime-graph-chat-tab-order.test.ts": 529,
"src/renderer/src/runtime/sync-runtime-graph/sync-runtime-graph-conversion-publish.test.ts": 1608,
"src/renderer/src/runtime/sync-runtime-graph/sync-runtime-graph-editor-diff-tabs.test.ts": 526,
@@ -6563,7 +6489,6 @@
"src/renderer/src/runtime/sync-runtime-graph/terminal-group-grid-sizes.test.ts": 194,
"src/renderer/src/runtime/browser/creation/web-runtime-browser-creation-placement.test.ts": 1927,
"src/renderer/src/runtime/browser/creation/web-runtime-browser-link-open.test.ts": 2217,
"src/renderer/src/runtime/browser/creation/web-runtime-browser-link-session.test.ts": 1964,
"src/renderer/src/runtime/web-session-tabs-sync/closing/web-session-close-replay.test.ts": 1119,
"src/renderer/src/runtime/web-session-tabs-sync/placement/web-session-open-files-batch-equivalence.test.ts": 1478,
"src/renderer/src/runtime/web-session-tabs-sync/identity/web-session-restored-placeholder-identity.test.ts": 985,
@@ -6581,10 +6506,8 @@
"src/renderer/src/runtime/web-session-tabs-sync/identity/web-session-tabs-sync-mirror-identity.test.ts": 2524,
"src/renderer/src/runtime/web-session-tabs-sync/placement/web-session-tabs-sync-mirrored-draft-close.test.ts": 1833,
"src/renderer/src/runtime/web-session-tabs-sync/agent-status/web-session-tabs-sync-remote-status-title-flap.test.ts": 1715,
"src/renderer/src/runtime/web-session-tabs-sync/agent-status/web-session-tabs-sync-sleep-activity.test.ts": 1010,
"src/renderer/src/runtime/web-session-tabs-sync/agent-status/web-session-tabs-sync-stale-spinner.test.ts": 921,
"src/renderer/src/runtime/web-session-tabs-sync/tracking/web-session-tabs-sync-tracking-teardown.test.ts": 940,
"src/renderer/src/runtime/web-session-tabs-sync/subscriptions/web-session-tabs-sync-unverifiable-host.test.tsx": 2424,
"src/renderer/src/runtime/web-session-tabs-sync/subscriptions/web-session-tabs-sync-visibility-collision.test.tsx": 2699,
"src/renderer/src/runtime/web-session-tabs-sync/subscriptions/web-session-tabs-sync-window-visibility.test.tsx": 2589,
"src/renderer/src/runtime/web-session-tabs-sync/subscriptions/web-session-tabs-sync-worktree-switch.test.tsx": 2625,
@@ -6601,7 +6524,6 @@
"src/renderer/src/runtime/hosted-terminals/recovery/evidence/web-session-terminal-retirement-proof-ledger.test.ts": 685,
"src/renderer/src/runtime/rpc/subscriptions/window-visibility-subscription-parking-stream-end.test.ts": 225,
"src/renderer/src/runtime/workspace-layout/frames/workspace-layout-frame-binding.test.ts": 2155,
"src/renderer/src/runtime/workspace-layout/frames/workspace-layout-frame-editor-views.test.ts": 2098,
"src/renderer/src/runtime/workspace-layout/frames/workspace-layout-frame-held-tabs.test.ts": 2519,
"src/renderer/src/runtime/workspace-layout/frames/workspace-layout-frame-sync.test.ts": 2282,
"src/renderer/src/runtime/workspace-layout/frames/workspace-layout-frame-tab-props.test.ts": 2852,
@@ -6616,7 +6538,6 @@
"src/renderer/src/store/github/requests/provider-request-coalescing.test.ts": 969,
"src/renderer/src/store/slices/hosted-review/refresh/visible-hosted-review-refresh-scheduler.test.ts": 97,
"src/renderer/src/store/github/repositories/wsl-stopped-distro-poll-refusal.test.ts": 696,
"src/renderer/src/store/workspaces/host-isolation/host-twin-isolation.test.ts": 1889,
"src/renderer/src/store/workspaces/host-isolation/host-twin-worktree-purge.test.ts": 1945,
"src/renderer/src/store/plugins/localization/plugin-language-packs-startup.test.ts": 435,
"src/renderer/src/store/plugins/localization/plugin-language-packs.test.ts": 377,
@@ -6653,7 +6574,6 @@
"src/renderer/src/store/slices/agent-status/agent-status-worktree-purge-leak.test.ts": 1744,
"src/renderer/src/store/slices/agent-status/agent-status.test.ts": 2129,
"src/renderer/src/store/repos/all-host-catalog-settlement.test.ts": 1955,
"src/renderer/src/store/slices/worktrees/teardown/ambiguous-owner-warning-worktree-removal-leak.test.ts": 2101,
"src/renderer/src/store/slices/browser/annotations/browser-annotation-retention.test.ts": 8178,
"src/renderer/src/store/slices/browser/cleanup/browser-cleanup-close.test.ts": 1911,
"src/renderer/src/store/slices/browser/cleanup/browser-mount-admission-removal.test.ts": 1982,
@@ -6664,7 +6584,6 @@
"src/renderer/src/store/slices/browser/tabs/browser-tab-creation-placement.test.ts": 1886,
"src/renderer/src/store/slices/browser/pages/browser-workspace-doc-location.test.ts": 2007,
"src/renderer/src/store/slices/browser/browser.test.ts": 2001,
"src/renderer/src/store/slices/worktrees/teardown/bulk-worktree-purge-terminal-maps-leak.test.ts": 1727,
"src/renderer/src/store/terminals/codex-restart-notice-lifecycle.test.ts": 1685,
"src/renderer/src/store/slices/tabs/content-tabs-from-main-frames.test.ts": 2025,
"src/renderer/src/store/slices/tabs/content-tabs-paired-server-workspace.test.ts": 1923,
@@ -6679,7 +6598,6 @@
"src/renderer/src/store/slices/editor/checks/editor-check-details-tabs.test.ts": 1814,
"src/renderer/src/store/slices/editor/closing/editor-close-background-file.test.ts": 893,
"src/renderer/src/store/slices/editor/closing/editor-close-document-siblings.test.ts": 1317,
"src/renderer/src/store/slices/editor/closing/editor-close-file-cleanup.test.ts": 2000,
"src/renderer/src/store/slices/editor/closing/editor-close-file-stale-active.test.ts": 1806,
"src/renderer/src/store/slices/editor/closing/editor-close-pinned-sibling.test.ts": 924,
"src/renderer/src/store/slices/editor/closing/editor-close-workspace-selection.test.ts": 1850,
@@ -6711,7 +6629,6 @@
"src/renderer/src/store/github/pull-requests/github-linked-review-clear-ownership.test.ts": 891,
"src/renderer/src/store/slices/editor/git/github-post-operation-owner.test.ts": 2062,
"src/renderer/src/store/github/pull-requests/github-pr-branch-direct-refresh-scope.test.ts": 667,
"src/renderer/src/store/github/pull-requests/github-pr-branch-fallback-results.test.ts": 658,
"src/renderer/src/store/github/pull-requests/github-pr-branch-linked-pr-divergence.test.ts": 662,
"src/renderer/src/store/github/comments/github-pr-comment-read-order.test.ts": 570,
"src/renderer/src/store/github/comments/github-pr-comments.test.ts": 746,
@@ -6719,7 +6636,6 @@
"src/renderer/src/store/github/refresh/github-pr-manual-refresh-broadcast.test.ts": 693,
"src/renderer/src/store/github/refresh/github-pr-refresh-states-leak.test.ts": 1327,
"src/renderer/src/store/github/pull-requests/github-pr-request-lifetime.test.ts": 1458,
"src/renderer/src/store/github/projects/github-project-view-tables.test.ts": 656,
"src/renderer/src/store/github/repositories/github-repo-lookup-index.test.ts": 51,
"src/renderer/src/store/github/review-threads/github-review-thread-rollback.test.ts": 663,
"src/renderer/src/store/github/task-records/github-task-record-retries.test.ts": 758,
@@ -6781,10 +6697,8 @@
"src/renderer/src/store/slices/worktrees/create/sparse-presets.test.ts": 217,
"src/renderer/src/store/slices/ssh/ssh.test.ts": 1843,
"src/renderer/src/lib/workspace/activation/active-worktree-removal-successor.test.ts": 1867,
"src/renderer/src/store/slices/worktrees/session/store-active-worktree-selection.test.ts": 2039,
"src/renderer/src/store/terminals/store-create-tab-start-in-main.test.ts": 1801,
"src/renderer/src/store/slices/tabs/store-open-to-side-layout-owner.test.ts": 1919,
"src/renderer/src/store/slices/browser/hydration/store-session-browser-hydration.test.ts": 1906,
"src/renderer/src/store/repos/store-session-cascades.test.ts": 1775,
"src/renderer/src/store/slices/editor/hydration/store-session-editor-hydration.test.ts": 1719,
"src/renderer/src/store/terminals/store-session-terminal-reconnect.test.ts": 2279,
@@ -6793,7 +6707,6 @@
"src/renderer/src/store/terminals/store-sleep-exact-runtime-stop.test.ts": 1842,
"src/renderer/src/store/terminals/store-sleep-pane-hibernation.test.ts": 1932,
"src/renderer/src/store/terminals/store-sleep-runtime-convergence.test.ts": 1767,
"src/renderer/src/store/terminals/store-sleep-twin-host-owner.test.ts": 1706,
"src/renderer/src/store/slices/worktrees/teardown/store-worktree-removal-cascade.test.ts": 1786,
"src/renderer/src/store/slices/worktrees/teardown/tab-worktree-orphan-map-purge-leak.test.ts": 1936,
"src/renderer/src/store/slices/tabs/tabs-close-dangling-group.test.ts": 1849,
@@ -6815,7 +6728,6 @@
"src/renderer/src/store/terminals/terminal-tab-owner-index.test.ts": 50,
"src/renderer/src/store/terminals/terminal-tab-recovery-remount.test.ts": 1791,
"src/renderer/src/store/terminals/terminal-tab-retirement-store.test.ts": 1955,
"src/renderer/src/store/terminals/terminal-tab-title-batch.test.ts": 1749,
"src/renderer/src/store/terminals/terminals-hydration-canonical-pty-overlap.test.ts": 1946,
"src/renderer/src/store/terminals/terminals-hydration-canonical-rows.test.ts": 1680,
"src/renderer/src/store/slices/ui/ui-agent-send-target.test.ts": 760,
@@ -6889,7 +6801,6 @@
"src/renderer/src/store/terminals/workspace-terminal-placeholders.test.ts": 302,
"src/renderer/src/store/slices/runtime-status/views/use-runtime-status-view.test.tsx": 1979,
"src/renderer/src/store/workspace-layout/workspace-layout-cache.test.ts": 63,
"src/renderer/src/store/workspace-layout/frames/workspace-layout-frame-store-patch.test.ts": 2284,
"src/renderer/src/store/slices/worktrees/listing/worktree-host-collision-index.test.ts": 1875,
"src/renderer/src/web/preload-api/web-agent-session-attachment-upload.test.ts": 1588,
"src/renderer/src/web/preload-api/web-chat-permission-normalization.test.ts": 293,
@@ -7852,7 +7763,6 @@
"tests/e2e/agent-launch-cli.unit.test.ts": 2379,
"tests/e2e/agent-launch-setup-choice.unit.test.ts": 2657,
"tests/e2e/agent-model-catalog-renderer-cache.unit.test.ts": 2029,
"tests/e2e/ai-vault-account-stream.unit.test.ts": 4506,
"tests/e2e/ai-vault-manual-name-clear.unit.test.ts": 21206,
"tests/e2e/automation-chat-reopen.unit.test.ts": 6262,
@@ -7898,13 +7808,11 @@
"tests/e2e/linear-store.unit.test.ts": 519,
"tests/e2e/linear-write-lifetime.unit.test.ts": 5214,
"tests/e2e/multi-workspace-typing-bench.unit.test.ts": 550,
"tests/e2e/native-chat-image-runtime-context.unit.test.ts": 2124,
"tests/e2e/native-chat-live-history.unit.test.ts": 3258,
"tests/e2e/native-chat-rewind-boundary.unit.test.ts": 2977,
"tests/e2e/native-chat-ssh-transcript.unit.test.ts": 1166,
"tests/e2e/native-chat-startup-option-pickers.unit.test.ts": 9377,
"tests/e2e/native-chat-transcript-reasoning.unit.test.ts": 3341,
"tests/e2e/nested-agent-idle-owner.unit.test.ts": 2469,
"tests/e2e/omp-child-session-recovery.unit.test.ts": 2205,
"tests/e2e/omp-retired-host-renderer.unit.test.ts": 2546,
@@ -7928,7 +7836,6 @@
"tests/e2e/source-control-action-phone-launch.unit.test.ts": 746,
"tests/e2e/ssh-browser-network-execution-route.docker.unit.test.ts": 413,
"tests/e2e/structured-agent-session-launch-admission.unit.test.ts": 4762,
"tests/e2e/structured-agent-session-launch-continuation.unit.test.ts": 23572,
"tests/e2e/structured-agent-session-read-owner.unit.test.ts": 6912,
"tests/e2e/structured-attention-headless-delivery.unit.test.ts": 328,
"tests/e2e/structured-attention-prompt-relay.unit.test.ts": 14045,
@@ -125,7 +125,7 @@ const EFFECT_BOUNDARIES = new Set([
`${WATCHERS}terminal-parked-pty-watcher.ts#startParkedPtyWatcher`,
`${RENDERER}components/terminal-pane/parking/capture/parked-terminal-buffer-capture.ts#captureParkedTerminalBuffers`,
`${RENDERER}lib/agent-session/resume/sleeping-agent-session-launch.ts#launchSleepingAgentSession`,
`${RENDERER}lib/host-mirror-handle-gap-wait.ts#parkUntilHostMirrorHandleLands`,
`${RENDERER}lib/agent-session/resume/host-mirror-handle-gap-wait.ts#parkUntilHostMirrorHandleLands`,
`${RENDERER}runtime/web-session-tabs-sync/hydration/host-session-mirror-hydration.ts#parkUntilHostSessionMirrorHydrates`
])
const ENUMERATORS = new Set(['entries', 'values', 'keys', 'assign'])
+3 -3
View File
@@ -30,14 +30,14 @@
1 src/renderer/src/lib/browser/navigation/http-link-localhost-route.ts # P5b-2 must clear: optional state field defaults to empty; extracted from http-link-routing.ts
1 src/renderer/src/lib/workspace/ownership/connection-owner-resolution.ts # P5b-2 must clear: optional-chain compare of a previous slice
2 src/renderer/src/lib/workspace/ownership/direct-ssh-target-scope.ts # P5b-2 must clear: optional input fields default to empty
3 src/renderer/src/lib/duplicate-paired-servers.ts # P5b-2 must clear: optional state fields default to empty
3 src/renderer/src/lib/workspace/ownership/duplicate-paired-servers.ts # P5b-2 must clear: optional state fields default to empty
1 src/renderer/src/lib/workspace/ownership/folder-workspace-runtime-owner.ts # P5b-2 must clear: loosely typed state param
1 src/renderer/src/runtime/hosts/wsl/local-project-runtime-workspace.ts # P5b-2 must clear: optional state field defaults to empty
1 src/renderer/src/lib/resolved-worktree-execution-host.ts # P5b-2 must clear: loosely typed state param
1 src/renderer/src/lib/workspace/ownership/resolved-worktree-execution-host.ts # P5b-2 must clear: loosely typed state param
2 src/renderer/src/lib/workspace/ownership/runtime-session-mirror-owners.ts # P5b-2 must clear: optional state fields default to empty
2 src/renderer/src/lib/workspace/ownership/terminal-worktree-route.ts # P5b-2 must clear: the unattributed-twin check reads both catalogs directly
3 src/renderer/src/lib/typing-latency/diagnostic-summary.ts # P5b-2 must clear: optional state field
2 src/renderer/src/lib/unread-badge-count.ts # reads a passed-in copy
2 src/renderer/src/attention/unread/unread-badge-count.ts # reads a passed-in copy
1 src/renderer/src/lib/workspace/paths/workspace-directory.ts # P5b-2 must clear: optional state field defaults to empty
2 src/renderer/src/lib/workspace/ownership/workspace-terminal-host-authority.ts # P5b-2 must clear: optional state fields
1 src/renderer/src/lib/workspace/activation/initial-surface/worktree-initial-terminal-seeding.ts # P5b-2 must clear: treats an undefined field as a narrow adapter
+15
View File
@@ -233,6 +233,21 @@ orca chat rename --name "Migrate auth"
Renames a chat tab, the same as renaming it by hand. `--session` takes the `sessionId` that `orca agent launch` prints. Run inside a chat, it defaults to that chat; with `--environment` it is required.
Agents that run as chats are read and messaged with `chat` commands. `--session` takes the session id from `chat list` or the handle `agent launch` returns.
```bash
orca chat list --json
orca chat list --state working --json
orca chat read --session <session> --limit 10 --json
orca chat send --session <session> --text "Run the tests, then summarize failures" --json
orca chat send --session <session> --text "<message>" --wait --timeout-ms 600000 --json
orca chat wait --session <session> --timeout-ms 600000 --json
```
`chat read` returns the newest messages, tool calls, errors, approvals and questions; an approval or question waiting for an answer has `pending: true`. `chat send` sends the text as your message. While the agent is working, hosts with a message queue hold it until the turn ends and report `delivery: "queued"`. A chat that restarted since it was read refuses the send. `--text-file -` reads the message from stdin.
`chat send --wait` and `chat wait` return once the chat's own turn settles, in the words `chat list` uses: `settled: "done"`, or `settled: "blocked"` when an approval or question needs an answer. Background agents the chat started can still show as `working` or `waiting` in `chat list`. They print the entries since the last user message. A wait past `--timeout-ms` returns `settled: "timeout"`, and a message held in a stopped or failed queue returns `settled: "held"`; both exit 1. `chat read --json` returns a `cursor` for the newest row read, and `truncated: true` when older rows it needed were past the 200-row read. `chat list --state` takes `working`, `blocked`, `waiting` or `done`. Paired hosts (`--environment`, `--pairing-code`) can list chats but not read, send or wait yet.
## Files
```bash
@@ -38,7 +38,7 @@ internal enum class MobileWebShellBridgeInstall {
/** The prop is false, so nothing is registered and Phase B behaviour is byte-identical. */
SKIP,
INSTALL,
/** The WebView provider is older than `WEB_MESSAGE_LISTENER` (Chromium 88). Terminal. */
/** The WebView provider is older than `WEB_MESSAGE_LISTENER` (Chromium 83). Terminal. */
UNAVAILABLE
}
@@ -201,7 +201,7 @@ internal class MobileWebShellDocument(private val context: Context) {
view.destroy()
}
// Keep explicit settings for the Chromium 83 floor, even where newer WebViews ignore deprecated options.
// Keep explicit settings even where newer WebViews ignore deprecated options; the floor is Chromium 101.
// B4 requires device proofs: no network, persistent state, file/content access, cleartext or navigation escape.
@Suppress("DEPRECATION")
private fun createWebView(): WebView {
@@ -17,7 +17,7 @@ internal val MOBILE_WEB_SHELL_NETWORK_API_BLOCKER = """
})();
""".trimIndent()
/** Query document-start-script capability (Chromium 83 floor), not version strings. */
/** Query capability, not version strings; stable WebView has it from Chromium 101. */
internal fun installMobileWebShellNetworkApiBlocker(
webView: WebView,
allowedOrigin: String
@@ -8,6 +8,8 @@ import android.content.res.Configuration
import android.net.Uri
import android.os.Handler
import android.os.Looper
import androidx.webkit.WebViewCompat
import androidx.webkit.WebViewFeature
import expo.modules.kotlin.exception.CodedException
import expo.modules.kotlin.exception.Exceptions
import expo.modules.kotlin.functions.Queues
@@ -68,6 +70,17 @@ class OrcaMobileWebShellModule : Module() {
Uri.fromFile(directory).toString()
}
// Lets isolation-unavailable name the WebView to update.
Function("currentWebViewProvider") {
val context = appContext.reactContext ?: return@Function null
val info = WebViewCompat.getCurrentWebViewPackage(context) ?: return@Function null
val version = info.versionName ?: return@Function null
val name = info.applicationInfo?.loadLabel(context.packageManager)?.toString() ?: info.packageName
val hasShellFeatures = WebViewFeature.isFeatureSupported(WebViewFeature.DOCUMENT_START_SCRIPT) &&
WebViewFeature.isFeatureSupported(WebViewFeature.WEB_MESSAGE_LISTENER)
mapOf("name" to name, "version" to version, "hasShellFeatures" to hasShellFeatures)
}
AsyncFunction("prepareSpareDocument") { directory: String, sessionId: String ->
val activity = appContext.currentActivity ?: return@AsyncFunction false
MobileWebShellSparePool.prepare(activity, directory, sessionId)
@@ -18,7 +18,7 @@ export type OrcaMobileWebShellViewProps = ViewProps & {
generationDirectory: string
/** `[A-Za-z0-9_-]{1,128}`. Scopes the private origin, so every mount must mint a fresh one. */
sessionId: string
// Bridge is off by default with nothing registered. Opt-in on Android below WEB_MESSAGE_LISTENER/Chromium 88 fails isolation-unavailable instead of loading unfenced.
// Bridge is off by default with nothing registered. Opt-in on Android below WEB_MESSAGE_LISTENER/Chromium 83 fails isolation-unavailable instead of loading unfenced.
bridgeEnabled?: boolean
onLoadState?: (event: NativeSyntheticEvent<MobileWebShellLoadStatePayload>) => void
// Raw JSON from window.orcaBridge; native silently rejects other origins/frames/WebViews and envelopes above 640 KiB (MobileWebShellBridge.maxMessageByteCount).
@@ -82,6 +82,23 @@ export function warmUpWebShell(): void {
}
}
export type WebViewProvider = { name: string; version: string; hasShellFeatures: boolean }
// Android only: the WebView provider and whether it has the shell's fences. Null when unknown.
export function currentWebViewProvider(): WebViewProvider | null {
if (Platform.OS !== 'android') {
return null
}
const shell = requireOptionalNativeModule<{
currentWebViewProvider?: () => WebViewProvider | null
}>('OrcaMobileWebShell')
try {
return shell?.currentWebViewProvider?.() ?? null
} catch {
return null
}
}
export {
MOBILE_WEB_SHELL_FAILURE_REASONS,
parseMobileWebShellLoadState,
+1 -1
View File
@@ -21045,7 +21045,7 @@
"id": "codex-reset-credit-consumed",
"operation": "accounts.codex-reset-credit",
"family": "components.codex-reset-credit",
"sites": ["mobile/src/components/codex-reset-credit.ts"],
"sites": ["mobile/src/accounts/usage/codex-reset-credit.ts"],
"schedules": [],
"deviceStore": {},
"steps": [
+5 -4
View File
@@ -16,22 +16,23 @@ import { useMobileTranslation } from '../i18n/use-mobile-translation'
import { styles } from './mobile-accounts-screen-styles'
import { useNow } from '../hooks/use-now'
import { ClaudeIcon, OpenAIIcon } from '../components/AgentIcons'
import './usage/UsageBar'
import {
type ProviderKey,
getActiveProviderRateLimits,
getInactiveProviderUsage,
getOtherUsageProviders,
hasActiveProviderUsage
} from '../components/AccountUsage'
} from './usage/usage-selectors'
import { MobileAgentIcon } from '../components/MobileAgentIcon'
import { getProviderDisplayName } from '../../../src/shared/usage-provider-windows'
import { ProviderUsageWindows } from './ProviderUsageWindows'
import {
getActiveCodexAccountIdForRateLimitTarget,
getCodexResetCreditSummary
} from '../components/codex-reset-credit'
import { CodexResetCreditAction } from '../components/CodexResetCreditAction'
import { useCodexResetCreditAction } from '../components/use-codex-reset-credit-action'
} from './usage/codex-reset-credit'
import { CodexResetCreditAction } from './usage/CodexResetCreditAction'
import { useCodexResetCreditAction } from './usage/use-codex-reset-credit-action'
import { ConfirmModal } from '../components/ConfirmModal'
import { NavBar } from '../components/nav-bar/NavBar'
import { NavBarButton } from '../components/nav-bar/NavBarButton'
+3 -6
View File
@@ -4,12 +4,9 @@ import {
getUsageWindowSections,
type UsageWindowSection
} from '../../../src/shared/usage-provider-windows'
import {
getUsageBarState,
getWindowResetLabel,
UsageBar,
type ProviderRateLimits
} from '../components/AccountUsage'
import { UsageBar } from './usage/UsageBar'
import { getUsageBarState, getWindowResetLabel } from './usage/usage-selectors'
import type { ProviderRateLimits } from './accounts-snapshot'
import type { Translate } from '../i18n/mobile-i18n'
import { useMobileTranslation } from '../i18n/use-mobile-translation'
import { spacing } from '../theme/mobile-theme'
@@ -1,6 +1,6 @@
import { queryOptions, skipToken } from '@tanstack/react-query'
import { AccountsSnapshotSchema, decodeAccountsSnapshot } from '../components/accounts-snapshot'
import type { AccountsSnapshot } from '../components/AccountUsage'
import { AccountsSnapshotSchema, decodeAccountsSnapshot } from './accounts-snapshot'
import type { AccountsSnapshot } from './accounts-snapshot'
import { hostQueryKey, type HostQueryKey } from '../query/host-query-key'
import type { PersistedHostFamily } from '../query/host-query-persistence'
import type { RpcClient } from '../transport/rpc/rpc-client-contract'
@@ -1,11 +1,11 @@
import { ActivityIndicator, Pressable, StyleSheet, Text } from 'react-native'
import { RotateCcw } from 'lucide-react-native'
import { useMobileTranslation } from '../i18n/use-mobile-translation'
import { colors, feedback, radii, spacing, typography } from '../theme/mobile-theme'
import { themedStyleSheet } from '../theme/themed-styles'
import { useMobileColorScheme } from '../theme/use-mobile-color-scheme'
import { useMobileTranslation } from '../../i18n/use-mobile-translation'
import { colors, feedback, radii, spacing, typography } from '../../theme/mobile-theme'
import { themedStyleSheet } from '../../theme/themed-styles'
import { useMobileColorScheme } from '../../theme/use-mobile-color-scheme'
import type { CodexResetCreditSummary } from './codex-reset-credit'
import { ListRow } from './list/ListGroup'
import { ListRow } from '../../components/list/ListGroup'
export function CodexResetCreditAction({
summary,
@@ -1,29 +1,9 @@
import { View, Text, ActivityIndicator, type StyleProp, type ViewStyle } from 'react-native'
import { colors, spacing, typography } from '../theme/mobile-theme'
import { themedStyleSheet } from '../theme/themed-styles'
import { useMobileColorScheme } from '../theme/use-mobile-color-scheme'
import { colors, spacing, typography } from '../../theme/mobile-theme'
import { themedStyleSheet } from '../../theme/themed-styles'
import { useMobileColorScheme } from '../../theme/use-mobile-color-scheme'
// Re-export pure account-usage-state selectors/types to keep imports stable and tests free of RN.
export type {
RateLimitWindow,
ProviderRateLimits,
InactiveAccountUsage,
ClaudeAccountSummary,
CodexAccountSummary,
AccountsSnapshot,
ProviderKey,
UsageBarState
} from './account-usage-state'
export {
decodeAccountsSnapshot,
getActiveProviderRateLimits,
getInactiveProviderUsage,
getOtherUsageProviders,
getUsageBarState,
getWindowResetLabel,
hasActiveProviderUsage,
hasRenderableUsage
} from './account-usage-state'
import './usage-selectors'
/** A meter's fill: the rounded, clamped percent and its consumption colour, shared by every usage meter. */
export function usageBarFill(
@@ -1,10 +1,7 @@
import { useEffect, useState } from 'react'
import { CODEX_RESET_CREDIT_RUNTIME_CAPABILITY } from '../../../src/shared/account-runtime-capabilities'
import type { RpcClient } from '../transport/rpc/rpc-client-contract'
import { startRuntimeCapabilityProbe } from '../transport/connection/runtime-capability-probe'
// Use shared capability constant so host/mobile versions cannot silently drift.
export const MOBILE_CODEX_RESET_CREDIT_CAPABILITY = CODEX_RESET_CREDIT_RUNTIME_CAPABILITY
import { CODEX_RESET_CREDIT_RUNTIME_CAPABILITY } from '../../../../src/shared/account-runtime-capabilities'
import type { RpcClient } from '../../transport/rpc/rpc-client-contract'
import { startRuntimeCapabilityProbe } from '../../transport/connection/runtime-capability-probe'
export function useCodexResetCreditCapability(
client: RpcClient | null,
@@ -18,7 +15,7 @@ export function useCodexResetCreditCapability(
return
}
return startRuntimeCapabilityProbe(client, (capabilities) => {
setSupported(capabilities.includes(MOBILE_CODEX_RESET_CREDIT_CAPABILITY))
setSupported(capabilities.includes(CODEX_RESET_CREDIT_RUNTIME_CAPABILITY))
})
}, [client, connected])
@@ -1,5 +1,5 @@
import { bindDeferredRpcOperation, defineRpcOperation } from '../transport/rpc/rpc-operation'
import { rpcResultVariant } from '../transport/rpc/rpc-operation-result-reader'
import { bindDeferredRpcOperation, defineRpcOperation } from '../../transport/rpc/rpc-operation'
import { rpcResultVariant } from '../../transport/rpc/rpc-operation-result-reader'
import { codexResetCreditReplySchema } from './codex-reset-credit-reply-schema'
// Use require-result-or-throw-message so confirm shows host sentence. Keep payload opaque: call-site decodeResetResult alone checks attempt scope/snapshot.
@@ -1,20 +1,20 @@
import {
buildCodexResetCreditExpectedScope,
type CodexResetCreditExpectedScope
} from '../../../src/shared/codex-reset-credit-scope'
} from '../../../../src/shared/codex-reset-credit-scope'
import {
codexResetCreditConsume,
type MobileCodexResetCreditRpcSender,
type MobileCodexResetCreditSendScope
} from './codex-reset-credit-consume-operations'
import { CodexResetCreditExpectedScopeSchema } from './codex-reset-credit-reply-schema'
import { randomV4Uuid } from '../platform/random-v4-uuid'
import { translate } from '../i18n/mobile-i18n'
import { randomV4Uuid } from '../../platform/random-v4-uuid'
import { translate } from '../../i18n/mobile-i18n'
import {
decodeAccountsSnapshot,
type AccountsSnapshot,
type ProviderRateLimits
} from './accounts-snapshot'
} from '../accounts-snapshot'
export type CodexResetCreditOutcome = 'reset' | 'nothingToReset' | 'noCredit' | 'alreadyRedeemed'
@@ -1,29 +1,13 @@
// Keep shapes aligned with shared types/rate-limit-types without pulling Electron-coupled desktop graph into mobile.
// Pure RN-free selectors stay directly testable; AccountUsage re-exports them with UsageBar.
import { formatResetCountdown } from '../../../src/shared/rate-limit-reset-format'
import { hasUsageData } from '../../../src/shared/usage-provider-windows'
import { formatResetCountdown } from '../../../../src/shared/rate-limit-reset-format'
import { hasUsageData } from '../../../../src/shared/usage-provider-windows'
import {
ProviderRateLimitsSchema,
type AccountsSnapshot,
type InactiveAccountUsage,
type ProviderRateLimits,
type RateLimitWindow
} from './accounts-snapshot'
export {
AccountsSnapshotSchema,
decodeAccountsSnapshot,
ProviderRateLimitsSchema,
RateLimitRuntimeTargetSchema,
type AccountProviderRateLimits,
type AccountsSnapshot,
type ClaudeAccountSummary,
type CodexAccountSummary,
type InactiveAccountUsage,
type ProviderRateLimits,
type RateLimitRuntimeTarget,
type RateLimitWindow
} from './accounts-snapshot'
} from '../accounts-snapshot'
export type ProviderKey = 'claude' | 'codex'
@@ -1,10 +1,10 @@
import { useCallback, useMemo, useRef, useState } from 'react'
import type { CodexResetCreditExpectedScope } from '../../../src/shared/codex-reset-credit-scope'
import type { RpcClient } from '../transport/rpc/rpc-client-contract'
import { translate } from '../i18n/mobile-i18n'
import type { Translate } from '../i18n/mobile-i18n'
import { useMobileTranslation } from '../i18n/use-mobile-translation'
import type { AccountsSnapshot } from './account-usage-state'
import type { CodexResetCreditExpectedScope } from '../../../../src/shared/codex-reset-credit-scope'
import type { RpcClient } from '../../transport/rpc/rpc-client-contract'
import { translate } from '../../i18n/mobile-i18n'
import type { Translate } from '../../i18n/mobile-i18n'
import { useMobileTranslation } from '../../i18n/use-mobile-translation'
import type { AccountsSnapshot } from '../accounts-snapshot'
import {
getCodexResetCreditOutcomeCopy,
getCodexResetCreditScope,
@@ -1,7 +1,7 @@
import { useCallback, useEffect, useMemo, useState } from 'react'
import { hashKey, useQuery, useQueryClient } from '@tanstack/react-query'
import { AccountsSnapshotError, decodeAccountsSnapshot } from '../components/accounts-snapshot'
import type { AccountsSnapshot } from '../components/AccountUsage'
import { AccountsSnapshotError, decodeAccountsSnapshot } from './accounts-snapshot'
import type { AccountsSnapshot } from './accounts-snapshot'
import { useMobileTranslation } from '../i18n/use-mobile-translation'
import { holdsRestoredHostQueryData } from '../query/host-query-persistence'
import type { ConnectionState } from '../transport/connection/connection-state'
@@ -1,134 +0,0 @@
import { describe, expect, it } from 'vitest'
import { decodeAccountsSnapshot } from './accounts-snapshot'
function makeSnapshot(): unknown {
return {
extensionField: { retained: true },
claude: {
accounts: [],
activeAccountId: null,
activeAccountIdsByRuntime: { host: null, wsl: {} }
},
codex: {
accounts: [
{
id: 'codex-host',
email: 'host@example.com',
managedHomeRuntime: 'host',
wslDistro: null,
updatedAt: 100,
extensionField: 'account-extra'
}
],
activeAccountId: 'codex-host',
activeAccountIdsByRuntime: {
host: 'codex-host',
wsl: { Ubuntu: 'codex-wsl' }
}
},
rateLimits: {
extensionField: 'limits-extra',
claude: null,
codex: {
provider: 'codex',
session: {
usedPercent: 100,
windowMinutes: 300,
resetsAt: 200,
resetDescription: 'soon'
},
weekly: null,
rateLimitResetCredits: {
availableCount: 1,
totalEarnedCount: 2,
nextExpiresAt: 300,
credits: [{ status: 'available', expiresAt: 300, grantedAt: 50 }]
},
updatedAt: 100,
error: null,
status: 'ok',
extensionField: 'provider-extra'
},
claudeTarget: { runtime: 'host', wslDistro: null },
codexTarget: { runtime: 'host', wslDistro: null },
inactiveClaudeAccounts: [],
inactiveCodexAccounts: [
{
accountId: 'codex-inactive',
rateLimits: null,
updatedAt: 99,
isFetching: false
}
]
}
}
}
function setPath(root: unknown, path: string[], value: unknown): void {
let current: unknown = root
for (const segment of path.slice(0, -1)) {
if (!current || typeof current !== 'object' || Array.isArray(current)) {
throw new Error(`Invalid fixture path: ${path.join('.')}`)
}
current = (current as Record<string, unknown>)[segment]
}
if (!current || typeof current !== 'object' || Array.isArray(current)) {
throw new Error(`Invalid fixture path: ${path.join('.')}`)
}
const record = current as Record<string, unknown>
record[path.at(-1)!] = value
}
describe('decodeAccountsSnapshot', () => {
it('validates nested account/rate-limit state and preserves forward-compatible fields', () => {
const snapshot = decodeAccountsSnapshot(makeSnapshot())
expect(snapshot.extensionField).toEqual({ retained: true })
expect(snapshot.codex.accounts[0]?.extensionField).toBe('account-extra')
expect(snapshot.rateLimits.extensionField).toBe('limits-extra')
expect(snapshot.rateLimits.codex?.extensionField).toBe('provider-extra')
})
it('defaults missing runtime targets for older host-only snapshots', () => {
const raw = makeSnapshot() as {
rateLimits: { claudeTarget?: unknown; codexTarget?: unknown }
}
delete raw.rateLimits.claudeTarget
delete raw.rateLimits.codexTarget
const snapshot = decodeAccountsSnapshot(raw)
expect(snapshot.rateLimits.claudeTarget).toEqual({ runtime: 'host', wslDistro: null })
expect(snapshot.rateLimits.codexTarget).toEqual({ runtime: 'host', wslDistro: null })
})
it.each([
['account arrays', ['codex', 'accounts'], {}],
['active account IDs', ['codex', 'activeAccountId'], 42],
['runtime selections', ['codex', 'activeAccountIdsByRuntime', 'wsl'], []],
['targets', ['rateLimits', 'codexTarget', 'runtime'], 'remote'],
['provider identity', ['rateLimits', 'codex', 'provider'], 'claude'],
['inactive account arrays', ['rateLimits', 'inactiveCodexAccounts'], {}],
['window percentages', ['rateLimits', 'codex', 'session', 'usedPercent'], 101],
['credit counts', ['rateLimits', 'codex', 'rateLimitResetCredits', 'availableCount'], -1],
[
'credit status',
['rateLimits', 'codex', 'rateLimitResetCredits', 'credits'],
[{ status: '', expiresAt: 300, grantedAt: 50 }]
],
['credit expiry', ['rateLimits', 'codex', 'rateLimitResetCredits', 'nextExpiresAt'], 'soon']
] satisfies Array<[string, string[], unknown]>)('rejects malformed %s', (_name, path, value) => {
const snapshot = makeSnapshot()
setPath(snapshot, path, value)
expect(() => decodeAccountsSnapshot(snapshot)).toThrow('Invalid accounts snapshot from host')
})
it('rejects a host target that smuggles a WSL distro', () => {
const snapshot = makeSnapshot()
setPath(snapshot, ['rateLimits', 'codexTarget', 'wslDistro'], 'Ubuntu')
expect(() => decodeAccountsSnapshot(snapshot)).toThrow('Invalid accounts snapshot from host')
})
})
@@ -1,4 +1,4 @@
import type { GenerationFileSystem } from '../mobile-web-shell/generation-store-file-system'
import type { GenerationFileSystem } from '../mobile-web-shell/generations/generation-store-file-system'
import type { DeviceStoreRoots } from './device-store-files'
import type { DeviceStoreKeychain } from './device-store-key'
import type { DeviceStoreTable } from './device-store-seal'
@@ -1,10 +1,10 @@
import { joinUri } from '../mobile-web-shell/generation-cache-uri'
import { joinUri } from '../mobile-web-shell/generations/generation-cache-uri'
import type {
GenerationDirectoryEntry,
GenerationFileListing,
GenerationFileSystem
} from '../mobile-web-shell/generation-store-file-system'
import { deriveHostCacheKey } from '../mobile-web-shell/host-cache-key'
} from '../mobile-web-shell/generations/generation-store-file-system'
import { deriveHostCacheKey } from '../mobile-web-shell/generations/host-cache-key'
import { DEVICE_STORE_BUCKETS, DRAFT_TMP_SUFFIX, promoteLoneDraftTmp } from './device-store-files'
import type { DeviceStoreTable } from './device-store-seal'
@@ -1,9 +1,9 @@
import { sha256 } from '@noble/hashes/sha256'
import { bytesToHex } from '@noble/hashes/utils'
import type { AESEncryptionKey } from 'expo-crypto'
import { joinUri } from '../mobile-web-shell/generation-cache-uri'
import type { GenerationFileSystem } from '../mobile-web-shell/generation-store-file-system'
import { deriveHostCacheKey } from '../mobile-web-shell/host-cache-key'
import { joinUri } from '../mobile-web-shell/generations/generation-cache-uri'
import type { GenerationFileSystem } from '../mobile-web-shell/generations/generation-store-file-system'
import { deriveHostCacheKey } from '../mobile-web-shell/generations/host-cache-key'
import {
openDeviceStoreValue,
type DeviceStoreTable,
+1 -1
View File
@@ -6,7 +6,7 @@ import type {
import type { AESEncryptionKey } from 'expo-crypto'
import { Directory, Paths } from 'expo-file-system'
import { AppState } from 'react-native'
import { createExpoGenerationFileSystem } from '../mobile-web-shell/generation-store-file-system'
import { createExpoGenerationFileSystem } from '../mobile-web-shell/generations/generation-store-file-system'
import { loadStoredHostProfiles } from '../host-catalog/host-metadata-store'
import {
readPairingKeychainItem,
@@ -1,7 +1,7 @@
import { useEffect, useState } from 'react'
import { Text, View } from 'react-native'
import type { MobileWebShellUpdateFailure } from '../mobile-web-shell/mobile-web-shell-update-failure'
import { processGenerationStore } from '../mobile-web-shell/process-generation-store'
import { processGenerationStore } from '../mobile-web-shell/generations/process-generation-store'
import { loadHosts } from '../host-catalog/host-store'
import { formatUpdateFailure } from './mobile-web-shell-update-failure-copy'
import { useMobileColorScheme } from '../theme/use-mobile-color-scheme'
+3 -3
View File
@@ -7,13 +7,13 @@ import Animated, {
useSharedValue,
withTiming
} from 'react-native-reanimated'
import { usageBarFill } from '../../accounts/usage/UsageBar'
import {
getUsageBarState,
getWindowResetLabel,
usageBarFill,
type AccountsSnapshot,
type ProviderKey
} from '../../components/AccountUsage'
} from '../../accounts/usage/usage-selectors'
import type { AccountsSnapshot } from '../../accounts/accounts-snapshot'
import { ClaudeIcon, OpenAIIcon } from '../../components/AgentIcons'
import { useNow } from '../../hooks/use-now'
import { useMobileTranslation } from '../../i18n/use-mobile-translation'
@@ -1,8 +1,5 @@
import { describe, expect, it } from 'vitest'
import type {
AccountProviderRateLimits,
AccountsSnapshot
} from '../../components/account-usage-state'
import type { AccountProviderRateLimits, AccountsSnapshot } from '../../accounts/accounts-snapshot'
import { selectHomeUsageCards } from './home-usage-cards'
function limits(
+4 -5
View File
@@ -3,11 +3,10 @@ import {
getInactiveProviderUsage,
hasActiveProviderUsage,
hasRenderableUsage,
type AccountsSnapshot,
type ProviderKey,
type ProviderRateLimits
} from '../../components/account-usage-state'
import { getActiveCodexAccountIdForRateLimitTarget } from '../../components/codex-reset-credit'
type ProviderKey
} from '../../accounts/usage/usage-selectors'
import type { AccountsSnapshot, ProviderRateLimits } from '../../accounts/accounts-snapshot'
import { getActiveCodexAccountIdForRateLimitTarget } from '../../accounts/usage/codex-reset-credit'
export type HomeUsageCard = {
/** The managed account's id, or null for the agent's own login (System default). */
+1 -1
View File
@@ -8,7 +8,7 @@ import {
leaveHomeSparePage,
prepareHomeSparePage
} from '../mobile-web-shell/home-spare-page'
import { processGenerationStore } from '../mobile-web-shell/process-generation-store'
import { processGenerationStore } from '../mobile-web-shell/generations/process-generation-store'
// Past Home's first paint and its first reads, so the boot never competes with them.
const HOME_SPARE_IDLE_MS = 1000
+1 -1
View File
@@ -16,7 +16,7 @@ import {
} from '../agents/agent-list-rows'
import { useAgentActivityWrites } from '../agents/use-agent-activity-writes'
import { accountsSnapshotOptions } from '../accounts/accounts-snapshot-stream'
import type { AccountsSnapshot } from '../components/AccountUsage'
import type { AccountsSnapshot } from '../accounts/accounts-snapshot'
import {
HOST_LIST_TARGET,
homeWorktreeCountsKey,
@@ -3,7 +3,7 @@ import { wipeHostStore } from '../device-store/device-store'
import {
deleteHostPageCache,
forgetHostUpdateFailures
} from '../mobile-web-shell/removed-host-shell-cache'
} from '../mobile-web-shell/generations/removed-host-shell-cache'
import { unregisterPushForRemovedHost } from '../notifications/push-registration'
import { forgetNativeHostQueries } from '../query/native-query-persistence'
import { forgetHostDescriptor } from '../host-descriptors/host-descriptor-store'
+2
View File
@@ -820,6 +820,8 @@
"webShell": {
"shellStateScreen": {
"isolationUnavailable": "This device's WebView is too old to open the workspace safely.",
"isolationUnavailableAndroid": "Orca needs Android System WebView or Chrome 101 or newer. Update it from the Play Store, or pick a newer one in Developer options > WebView implementation.",
"webViewInUse": "This device has {{name}} {{version}}.",
"downloadFailed": "The latest app could not be downloaded from this host.",
"hostProfileUnreadable": "Could not read this host on your device. Try again.",
"statusUnreadable": "Could not read this host's status. Go back and reopen it.",
@@ -204,15 +204,4 @@ describe('the page language catalog', () => {
expect(i18n.getMobileUiLocale()).toBe('ko')
expect(i18n.translate('greeting', 'Hello')).toBe('안녕하세요')
})
it('imports the chunk an older shell left on disk, with no wait and no request', async () => {
chunksOnDisk.set('es', { greeting: 'Hola' })
const client = fakeClient('reconnecting')
openPage(client, fakeStore({}))
await i18n.activateMobileUiLocale('es')
expect(i18n.translate('greeting', 'Hello')).toBe('Hola')
expect(client.sent).toHaveLength(0)
})
})
@@ -1,5 +1,6 @@
import type { ReactNode } from 'react'
import { Pressable, Text, View } from 'react-native'
import { Platform, Pressable, Text, View } from 'react-native'
import { currentWebViewProvider } from '../../modules/orca-mobile-web-shell/src'
import { ProtocolBlockScreen } from '../components/ProtocolBlockScreen'
import { colors, radii, spacing, typography } from '../theme/mobile-theme'
import { themedStyleSheet } from '../theme/themed-styles'
@@ -65,11 +66,30 @@ function Failed({
useMobileColorScheme()
// Retry cannot change a settled isolation gate or give an unsupported WebView the missing fence.
const retryable = state.reason !== 'isolation-unavailable' && state.reason !== 'status-unreadable'
const provider = state.reason === 'isolation-unavailable' ? currentWebViewProvider() : null
// Unknown provider (older binary): a missing feature is still the likely cause.
const webViewTooOld =
Platform.OS === 'android' &&
state.reason === 'isolation-unavailable' &&
provider?.hasShellFeatures !== true
return (
<Centered>
<Text style={styles.failedMessage} testID="mobile-web-shell-failed">
{failureMessage(state.reason, t)}
{webViewTooOld
? t(
'webShell.shellStateScreen.isolationUnavailableAndroid',
'Orca needs Android System WebView or Chrome 101 or newer. Update it from the Play Store, or pick a newer one in Developer options > WebView implementation.'
)
: failureMessage(state.reason, t)}
</Text>
{webViewTooOld && provider ? (
<Text style={styles.failedDetail}>
{t('webShell.shellStateScreen.webViewInUse', 'This device has {{name}} {{version}}.', {
name: provider.name,
version: provider.version
})}
</Text>
) : null}
{retryable ? (
<Pressable
style={({ pressed }) => [styles.retryButton, pressed && styles.pressed]}
@@ -160,6 +180,12 @@ const styles = themedStyleSheet(() => ({
textAlign: 'center',
marginBottom: spacing.lg
},
failedDetail: {
fontSize: typography.metaSize,
color: colors.textSecondary,
textAlign: 'center',
marginBottom: spacing.lg
},
retryButton: {
backgroundColor: colors.bgRaised,
paddingVertical: spacing.sm + 2,
@@ -1,100 +0,0 @@
import { describe, expect, it } from 'vitest'
import { createGenerationStore } from './generation-store'
import { deriveHostCacheKey } from './host-cache-key'
import type { MobileWebBundleFetchResult } from '../transport/web-bundle/mobile-web-bundle-fetch'
import { computeMobileWebBundleId } from '../../../src/shared/mobile-web-bundle/manifest-contract'
import {
createFakeGenerationFileSystem as createFakeFileSystem,
FAKE_GENERATION_ROOT
} from './generation-file-system-fake'
const ROOT = FAKE_GENERATION_ROOT
const HOST = deriveHostCacheKey('host-a')
function buildResult(options: {
buildId?: string
assets?: readonly { path: string; byteLength: number; kind?: string }[]
bytes?: ReadonlyMap<string, Uint8Array>
}): MobileWebBundleFetchResult {
const listed = options.assets ?? [
{ path: 'index.html', byteLength: 4 },
{ path: 'assets/app.js', byteLength: 2 }
]
const assets = listed.map((asset, index) => ({
path: asset.path,
sha256: String(index).repeat(64).slice(0, 64),
byteLength: asset.byteLength,
contentType: 'text/html; charset=utf-8',
...(asset.kind === undefined ? {} : { kind: asset.kind })
}))
const totalBytes = assets.reduce((sum, asset) => sum + asset.byteLength, 0)
return {
manifest: {
schemaVersion: 1,
buildId: options.buildId ?? computeMobileWebBundleId(assets),
minCompatibleRuntimeProtocolVersion: 2,
runtimeProtocolVersion: 2,
entrypoint: 'index.html',
totalBytes,
assets
},
assets:
options.bytes ??
new Map(assets.map((asset) => [asset.path, new Uint8Array(asset.byteLength).fill(7)])),
reused: [],
totalBytes,
elapsedMs: 1
}
}
// Derive ids from assets so the cached manifest passes its digest check.
const BUILD = buildResult({}).manifest.buildId
const SECOND = { assets: [{ path: 'index.html', byteLength: 8 }] }
const SECOND_BUILD = buildResult(SECOND).manifest.buildId
async function activate(
store: ReturnType<typeof createGenerationStore>,
hostKey: string,
result = buildResult({})
): Promise<void> {
await store.commitGeneration(await store.stageGeneration(hostKey, result))
}
// Commit deletes the old build first, so it must not run under a page still loading that build's chunks.
describe('an update staged behind a live page', () => {
it('stays staged while a page reads the old build, and the next read after it commits', async () => {
const fs = createFakeFileSystem()
const store = createGenerationStore({ fileSystem: fs })
await activate(store, HOST)
const release = store.holdGeneration(HOST)
store.deferCommit(await store.stageGeneration(HOST, buildResult(SECOND)))
expect((await store.readActiveGeneration(HOST))?.buildId).toBe(BUILD)
expect(await fs.fileExists(`${ROOT}/${HOST}/generations/${BUILD}/index.html`)).toBe(true)
release()
expect((await store.readActiveGeneration(HOST))?.buildId).toBe(SECOND_BUILD)
expect(await fs.fileExists(`${ROOT}/${HOST}/generations/${BUILD}/index.html`)).toBe(false)
})
it('stages a build without its language-catalog chunks and still commits it at the next launch', async () => {
const fs = createFakeFileSystem()
const first = createGenerationStore({ fileSystem: fs })
await activate(first, HOST)
first.holdGeneration(HOST)
const withCatalog = buildResult({
assets: [
{ path: 'index.html', byteLength: 8 },
{ path: 'assets/de.js', byteLength: 3, kind: 'catalog' }
],
bytes: new Map([['index.html', new Uint8Array(8)]])
})
first.deferCommit(await first.stageGeneration(HOST, withCatalog))
const relaunched = createGenerationStore({ fileSystem: fs })
const build = withCatalog.manifest.buildId
expect((await relaunched.readActiveGeneration(HOST))?.buildId).toBe(build)
expect(await fs.fileExists(`${ROOT}/${HOST}/generations/${build}/assets/de.js`)).toBe(false)
})
})
@@ -2,7 +2,7 @@ import {
MobileWebBundleManifestReadSchema,
shellDownloadedAssets,
type MobileWebBundleManifestRead
} from '../transport/web-bundle/mobile-web-bundle-reply-schemas'
} from '../../transport/web-bundle/mobile-web-bundle-reply-schemas'
import { MANIFEST_FILE_NAME } from './generation-asset-path'
import { joinUri } from './generation-cache-uri'
import { parseJson } from './generation-host-order'
@@ -1,5 +1,5 @@
import type { MobileWebBundleReusableAssets } from '../transport/web-bundle/mobile-web-bundle-fetch'
import type { MobileWebBundleAssetRead } from '../transport/web-bundle/mobile-web-bundle-reply-schemas'
import type { MobileWebBundleReusableAssets } from '../../transport/web-bundle/mobile-web-bundle-fetch'
import type { MobileWebBundleAssetRead } from '../../transport/web-bundle/mobile-web-bundle-reply-schemas'
import { requireStorablePath } from './generation-asset-path'
import { joinUri } from './generation-cache-uri'
import type { ActiveGeneration } from './generation-store'
@@ -1,5 +1,5 @@
import type { MobileWebBundleFetchResult } from '../transport/web-bundle/mobile-web-bundle-fetch'
import { shellDownloadedAssets } from '../transport/web-bundle/mobile-web-bundle-reply-schemas'
import type { MobileWebBundleFetchResult } from '../../transport/web-bundle/mobile-web-bundle-fetch'
import { shellDownloadedAssets } from '../../transport/web-bundle/mobile-web-bundle-reply-schemas'
import { requireStorablePath } from './generation-asset-path'
import { joinUri } from './generation-cache-uri'
@@ -1,11 +1,12 @@
import { describe, expect, it, vi } from 'vitest'
// Mock the import-time native module to test only the URI converter.
// Mock the import-time native modules to test only the URI converter.
vi.mock('expo-file-system', () => ({
Directory: class {},
File: class {},
Paths: { cache: '' }
}))
vi.mock('react-native', () => ({ Platform: { OS: 'ios' } }))
import { generationDirectoryPath } from './generation-store-file-system'
@@ -1,4 +1,5 @@
import { Directory, File } from 'expo-file-system'
import { Platform } from 'react-native'
export type GenerationDirectoryEntry = {
readonly name: string
@@ -127,7 +128,23 @@ export function createExpoGenerationFileSystem(rootUri: string): GenerationFileS
}
},
async moveDirectory(fromUri, toUri) {
new Directory(fromUri).move(new Directory(toUri))
const from = new Directory(fromUri)
// Below API 26, Expo 55's move copies a directory without its contents; its copy is recursive.
if (Platform.OS === 'android' && Number(Platform.Version) < 26) {
const to = new Directory(toUri)
try {
from.copy(to)
} catch (error) {
// Readers trust a generation by its manifest, so a failed copy must leave no partial tree.
if (to.exists) {
to.delete()
}
throw error
}
from.delete()
return
}
from.move(new Directory(toUri))
},
async moveFile(fromUri, toUri) {
new File(fromUri).move(new File(toUri))
@@ -1,8 +1,8 @@
import type { MobileWebBundleManifestRead } from '../transport/web-bundle/mobile-web-bundle-reply-schemas'
import type { MobileWebBundleManifestRead } from '../../transport/web-bundle/mobile-web-bundle-reply-schemas'
import type {
MobileWebBundleFetchResult,
MobileWebBundleReusableAssets
} from '../transport/web-bundle/mobile-web-bundle-fetch'
} from '../../transport/web-bundle/mobile-web-bundle-fetch'
import { joinUri } from './generation-cache-uri'
import { createGenerationHostOrder, withHostLast } from './generation-host-order'
import { createDeferredCommits } from './generation-deferred-commits'
@@ -18,7 +18,7 @@ import {
listGenerationHostDirectories
} from './generation-host-directories'
import { isHostCacheKey } from './host-cache-key'
import type { MobileWebShellUpdateFailure } from './mobile-web-shell-update-failure'
import type { MobileWebShellUpdateFailure } from '../mobile-web-shell-update-failure'
import {
forgetHostUpdateFailuresIn,
readUpdateFailureLog,
@@ -216,7 +216,7 @@ export function createGenerationStore(options: {
manifest: staged.manifest
}
const entries = await fs.list(generations)
// A build-id directory alone proves nothing: pre-API-26 Android moves can leave it empty. Require its activation manifest before reusing it.
// A build-id directory alone proves nothing; require its activation manifest before reusing it.
const existing = entries.find((entry) => entry.name === staged.buildId)
if (
existing?.isDirectory === true &&
@@ -238,7 +238,7 @@ export function createGenerationStore(options: {
}
await fs.createDirectory(generations)
await fs.moveDirectory(staged.directory, target)
// Below API 26, Expo Android FileSystemPath.kt moves directories via non-recursive copy/delete and can leave an empty target; failed source deletion leaves tmp for sweeping.
// Never activate a target without its manifest; a source left in tmp is swept.
if (!(await fs.fileExists(joinUri(target, MANIFEST_FILE_NAME)))) {
await fs.delete(target)
throw new Error(`generation ${staged.buildId} did not carry its manifest through the rename`)
@@ -1,10 +1,9 @@
import { describe, expect, it } from 'vitest'
import { computeMobileWebBundleId } from '../../../src/shared/mobile-web-bundle/manifest-contract'
import type { MobileWebBundleFetchResult } from '../transport/web-bundle/mobile-web-bundle-fetch'
import { createFakeGenerationFileSystem } from './generation-file-system-fake'
import { createGenerationStore } from './generation-store'
import { deriveHostCacheKey } from './host-cache-key'
import type { MobileWebShellUpdateFailure } from './mobile-web-shell-update-failure'
import type { MobileWebShellUpdateFailure } from '../mobile-web-shell-update-failure'
import { appendUpdateFailure } from './mobile-web-shell-update-failure-log'
const LOG = 'update-failures.json'
@@ -52,43 +51,6 @@ describe('the generation store keeps the log', () => {
expect(fileSystem.text(LOG)).toBeNull()
})
it("outlives the host's own cache, which a recovery deletes", async () => {
const fileSystem = createFakeGenerationFileSystem()
const store = createGenerationStore({ fileSystem })
const host = deriveHostCacheKey('host-1')
const assets = [
{ path: 'index.html', sha256: '1'.repeat(64), byteLength: 1, contentType: 'text/html' }
]
const buildId = computeMobileWebBundleId(assets)
const bundle: MobileWebBundleFetchResult = {
manifest: {
schemaVersion: 1,
buildId,
minCompatibleRuntimeProtocolVersion: 2,
runtimeProtocolVersion: 2,
entrypoint: 'index.html',
totalBytes: 1,
assets
},
assets: new Map([['index.html', new Uint8Array(1)]]),
reused: [],
totalBytes: 1,
elapsedMs: 1
}
await store.commitGeneration(await store.stageGeneration(host, bundle))
expect((await store.readActiveGeneration(host))?.buildId).toBe(buildId)
expect(fileSystem.paths()).toContain(`${host}/generations/${buildId}/manifest.json`)
expect(fileSystem.bytes(`${host}/generations/${buildId}/index.html`)).toEqual(new Uint8Array(1))
const recorded = failure('host-1', 1)
await store.recordUpdateFailure(recorded)
await store.deleteHostCache(host)
expect(fileSystem.paths().some((path) => path === host || path.startsWith(`${host}/`))).toBe(
false
)
expect(await store.readActiveGeneration(host)).toBeNull()
expect(await store.readUpdateFailures()).toEqual([recorded])
})
it('reads a corrupt log as empty and keeps the entries that still parse', async () => {
const fileSystem = createFakeGenerationFileSystem()
const store = createGenerationStore({ fileSystem })
@@ -1,5 +1,5 @@
import { z } from 'zod'
import { MobileWebBundleErrorCodeSchema } from '../../../src/shared/mobile-web-bundle/bundle-rpc-contract'
import { MobileWebBundleErrorCodeSchema } from '../../../../src/shared/mobile-web-bundle/bundle-rpc-contract'
import { joinUri } from './generation-cache-uri'
import type { GenerationFileSystem } from './generation-store-file-system'
import {
@@ -7,7 +7,7 @@ import {
MOBILE_WEB_SHELL_UPDATE_FAILURE_REASONS,
MOBILE_WEB_SHELL_UPDATE_FAILURE_WALLS,
type MobileWebShellUpdateFailure
} from './mobile-web-shell-update-failure'
} from '../mobile-web-shell-update-failure'
// Keep enough history to distinguish one bad download from repeated failures without growing diagnostic storage.
export const MAX_UPDATE_FAILURES_PER_HOST = 5
@@ -1,8 +1,8 @@
import { Directory, Paths } from 'expo-file-system'
import { generationStoreDirectory } from '../../modules/orca-mobile-web-shell/src/generation-store-directory'
import { generationStoreDirectory } from '../../../modules/orca-mobile-web-shell/src/generation-store-directory'
import { createGenerationStore, type GenerationStore } from './generation-store'
import { createExpoGenerationFileSystem } from './generation-store-file-system'
import { dropHomeSparePage } from './home-spare-page'
import { dropHomeSparePage } from '../home-spare-page'
const GENERATION_STORE_DIRECTORY_NAME = 'mobile-web'
@@ -3,9 +3,9 @@ import {
discardSpareDocument,
prepareSpareDocument
} from '../../modules/orca-mobile-web-shell/src/spare-document'
import type { GenerationStore } from './generation-store'
import { generationDirectoryPath } from './generation-store-file-system'
import { deriveHostCacheKey } from './host-cache-key'
import type { GenerationStore } from './generations/generation-store'
import { generationDirectoryPath } from './generations/generation-store-file-system'
import { deriveHostCacheKey } from './generations/host-cache-key'
import { mintShellSessionId } from './shell-session-id'
// A Home entry claims the spare about 0.2 s after the tap on a simulator; a native screen keeps it no longer.
@@ -1,6 +1,6 @@
import { BRIDGE_READY_RETRY_MAX_MS } from './bridge/bridge-client-init-handshake'
import type { GenerationStore } from './generation-store'
import { processGenerationStore } from './process-generation-store'
import type { GenerationStore } from './generations/generation-store'
import { processGenerationStore } from './generations/process-generation-store'
import { setForegroundTimer } from './foreground-timer'
import { claimHomeSparePage } from './home-spare-page'
import { mintShellSessionId } from './shell-session-id'
@@ -7,6 +7,7 @@ const doubles = vi.hoisted(() => ({
}))
vi.mock('expo-file-system', () => ({ Directory: class {}, File: class {}, Paths: { cache: '' } }))
vi.mock('react-native', () => ({ Platform: { OS: 'ios' } }))
// The runner's deadlines live in the runtime module, whose foreground timer reads React Native's AppState.
vi.mock('./foreground-timer', () => ({ setForegroundTimer: () => () => {} }))
vi.mock('../transport/rpc/rpc-operation', () => ({
@@ -20,9 +21,9 @@ vi.mock('../transport/web-bundle/mobile-web-bundle-fetch', () => ({
import type { RpcClient } from '../transport/rpc/rpc-client-contract'
import { computeMobileWebBundleId } from '../../../src/shared/mobile-web-bundle/manifest-contract'
import type { MobileWebBundleFetchResult } from '../transport/web-bundle/mobile-web-bundle-fetch'
import { createGenerationStore, type GenerationStore } from './generation-store'
import { createFakeGenerationFileSystem } from './generation-file-system-fake'
import { deriveHostCacheKey } from './host-cache-key'
import { createGenerationStore, type GenerationStore } from './generations/generation-store'
import { createFakeGenerationFileSystem } from './generations/generation-file-system-fake'
import { deriveHostCacheKey } from './generations/host-cache-key'
import { download } from './mobile-web-shell-session-effects'
const CLIENT: RpcClient = {
@@ -114,64 +115,6 @@ describe('a download that reuses the cached generation', () => {
return done.then(() => events)
}
it('writes no staging bytes when canceled while its staging waits in the store queue', async () => {
const fileSystem = createFakeGenerationFileSystem()
const store = createGenerationStore({ fileSystem })
const NEXT = bundle(16)
const BLOCKER = deriveHostCacheKey('host-b')
let enterBlocker = (): void => {}
const blockerEntered = new Promise<void>((resolve) => {
enterBlocker = resolve
})
let releaseBlocker = (): void => {}
const blockerReleased = new Promise<void>((resolve) => {
releaseBlocker = resolve
})
const list = fileSystem.list.bind(fileSystem)
fileSystem.list = async (uri) => {
if (uri.includes(`/${BLOCKER}/`)) {
enterBlocker()
await blockerReleased
}
return list(uri)
}
const writes: string[] = []
const writeBytes = fileSystem.writeBytes.bind(fileSystem)
fileSystem.writeBytes = async (uri, bytes) => {
writes.push(uri)
await writeBytes(uri, bytes)
}
let blocker: Promise<unknown> = Promise.resolve()
doubles.fetch = async () => {
blocker = store.readActiveGeneration(BLOCKER)
await blockerEntered
return NEXT
}
let markQueued = (): void => {}
const stageQueued = new Promise<void>((resolve) => {
markQueued = resolve
})
const downloads = new Set<AbortController>()
const run = runFor(
{
...store,
stageGeneration: (...args) => {
const staged = store.stageGeneration(...args)
markQueued()
return staged
}
},
downloads
)
await stageQueued
downloads.forEach((controller) => controller.abort())
releaseBlocker()
await Promise.all([run, blocker])
expect(writes.filter((uri) => uri.includes(`/tmp/${NEXT.manifest.buildId}/`))).toEqual([])
})
it('stages from the offered snapshot without reopening its manifest after fetch', async () => {
const { fileSystem, store } = await cachedStore()
doubles.fetch = async () => {
@@ -9,14 +9,14 @@ import {
import type { MobileWebBundleCompatManifest } from '../transport/web-bundle/mobile-web-bundle-compat'
import { runRpcOperation } from '../transport/rpc/rpc-operation'
import type { RpcClient } from '../transport/rpc/rpc-client-contract'
import type { GenerationStore, StagedGeneration } from './generation-store'
import type { GenerationStore, StagedGeneration } from './generations/generation-store'
import type { createShellPageDeadline } from './shell-page-deadline'
import {
DOCUMENT_LOAD_DEADLINE_MS,
PAGE_READY_DEADLINE_MS,
type MobileWebShellRuntime
} from './mobile-web-shell-runtime'
import { generationDirectoryPath } from './generation-store-file-system'
import { generationDirectoryPath } from './generations/generation-store-file-system'
import type {
CachedGeneration,
MobileWebShellSessionEffect,
@@ -7,7 +7,11 @@ import type {
MobileWebBundleFetchResult
} from '../transport/web-bundle/mobile-web-bundle-fetch'
import type { MobileWebBundleManifestRead } from '../transport/web-bundle/mobile-web-bundle-reply-schemas'
import type { ActiveGeneration, GenerationStore, StagedGeneration } from './generation-store'
import type {
ActiveGeneration,
GenerationStore,
StagedGeneration
} from './generations/generation-store'
import type { DownloadProgressFeed } from './download-progress-feed'
import type { MobileWebShellSessionState } from './mobile-web-shell-session-contract'
import '../transport/rpc/rpc-delivery-ambiguity'
@@ -205,7 +209,6 @@ function createFakeStore(): {
}
}
// Use recorded timers so deadline tests assert requested delays without wall-clock waits.
type ArmedTimer = { delayMs: number; run: () => void; cancelled: boolean }
function createTimerSeam() {
@@ -347,7 +350,6 @@ async function flush(): Promise<void> {
await act(async () => undefined)
}
// Entry import failures can finish WebView load without mounting a boundary or sending ready; the deadline must recover that silent blank page.
describe('the wait for the page to speak', () => {
beforeEach(() => {
doubles.manifestReads = 0
@@ -358,24 +360,6 @@ describe('the wait for the page to speak', () => {
doubles.gates.hostCapabilities = [MOBILE_WEB_BUNDLE_CAPABILITY]
})
async function ready(fake = createFakeStore()): Promise<Mounted> {
const mounted = await mount(fake.store)
fake.settleCacheRead(activeGeneration())
await flush()
expect(mounted.states().at(-1)?.kind).toBe('ready')
return mounted
}
// A remount mints the replacement's session before React commits it; reports the retired view already queued must not land on it.
it('does not charge a second fault from the retired view to its replacement', async () => {
const mounted = await ready()
await act(async () => {
mounted.shellFailed('document-load-failed')
mounted.shellFailed('document-load-failed')
})
expect(mounted.states().at(-1)?.kind).toBe('ready')
})
it('opens a page Home booted under its session id, and remounts under a fresh one', async () => {
const fake = createFakeStore()
const mounted = await mount(fake.store, undefined, async () => 'home-spare')
@@ -389,21 +373,6 @@ describe('the wait for the page to speak', () => {
expect(mounted.states().at(-1)).toMatchObject({ kind: 'ready', sessionId: 'session-1' })
})
it('stays ready when the page speaks after document load and the timers fire', async () => {
const mounted = await ready()
await act(async () => {
mounted.documentLoaded()
mounted.pageReady()
})
await act(async () => {
mounted.timers.fire()
})
expect(mounted.states().at(-1)?.kind).toBe('ready')
await act(async () => {
mounted.tree.unmount()
})
})
it('re-arms a session the route rebuilt, with the host and its gates unchanged', async () => {
// A route change rebuilds the session too; re-arm gates even if their verdict did not change.
const fake = createFakeStore()
@@ -454,5 +423,3 @@ describe('the wait for the page to speak', () => {
})
})
})
// RN holds timers while backgrounded and fires overdue ones on resume, before the suspended WebView has loaded anything.
@@ -6,8 +6,8 @@ import {
downloadFraction,
type DownloadProgressFeed
} from './download-progress-feed'
import type { GenerationStore } from './generation-store'
import { deriveHostCacheKey } from './host-cache-key'
import type { GenerationStore } from './generations/generation-store'
import { deriveHostCacheKey } from './generations/host-cache-key'
import { runShellEffect, type FlowManifest } from './mobile-web-shell-session-effects'
import { documentMayTalk } from './mobile-web-shell-gates'
import { readMobileWebShellReachability } from './mobile-web-shell-reachability'
@@ -76,18 +76,6 @@ describe('useMobileNativeChatSendError', () => {
expect(api().message).toBeNull()
})
it('a refusal behind a question goes once it is answered', async () => {
await render()
await showing({ working: false, prompt: true })
await act(async () =>
api().show("Answer the agent's question or approval, then run /clear.", {
refusedWhile: 'prompt'
})
)
await showing({ working: false, prompt: false })
expect(api().message).toBeNull()
})
it('a failure naming nothing the phone shows, or background tasks it cannot see, stays', async () => {
await render()
await act(async () => api().show('Message not sent'))
@@ -115,16 +103,6 @@ describe('useMobileNativeChatSendError', () => {
expect(api().message).toBeNull()
})
it('falls back to the toast when the banner is not mounted', async () => {
await act(async () => {
renderer = create(createElement(Harness, { scopeKey: 'terminal-1', bannerMounted: false }))
})
await act(async () => api().show('Delivery unconfirmed'))
expect(showToast).toHaveBeenCalledWith('Delivery unconfirmed', 1600)
expect(api().message).toBeNull()
})
it('toasts a deferred failure that resolves after the user switched tabs', async () => {
await render('terminal-1')
const showFromTabA = api().show
@@ -342,33 +342,6 @@ it('phone captures accepted echoed inputs, preserves false, and freezes empty vs
await harness.unmount()
})
it('accepts a typed literal at an attached fence while options refresh with no menu', async () => {
const pending = deferred<AgentSessionOptionsResult>()
let reads = 0
const client = optionsClient(() =>
++reads === 1 ? Promise.resolve({ models: [], current: {} }) : pending.promise
)
const { calls, mutate } = recordingMutate(async () =>
accepted({ key: 'model', value: 'literal', options: { model: 'literal' } }, true)
)
const view = await mountOptions({ ...BASE, client: client.client, mutate })
await view.rerender({ fence: 2 })
let result = true
await act(async () => {
result = await view.current().setStructuredOption('model', 'literal')
})
expect(result).toBe(true)
expect(calls).toHaveLength(1)
await act(async () => pending.resolve({ models: [], current: {} }))
await settle()
await act(async () => {
result = await view.current().setStructuredOption('model', 'literal')
})
expect(result).toBe(true)
expect(calls).toHaveLength(2)
await view.unmount()
})
it('refreshes saved planning intent from the same host status stamp without remounting', async () => {
let interactionMode: 'default' | 'plan' = 'default'
const client = optionsClient(async () => ({
@@ -243,15 +243,6 @@ describe('useFolderCreateFlow', () => {
setupDecision: 'skip'
})
})
it("refreshes the folder when a form's create may have landed", async () => {
const refetch = vi.fn()
const { flow } = mountFlow(refetch)
const b = repoIn()
const form = await openComposer(flow, b)
form.folderLaunch?.submit.begin({ ...b.repo, path: '/w/b' })?.settle('uncertain')
expect(refetch).toHaveBeenCalledTimes(1)
})
async function setupRefusedRetry(flow: { current: Flow | null }) {
const a = repoIn()
const lost = new FakeSession('connected')
@@ -1,7 +1,9 @@
import { mountFixture } from '../recorder-fixture-shape'
import type { operationModuleLoader } from '../operation-module-loader'
import type { MountAdapter } from '../recording-scenario'
import type { AccountsSnapshot } from '../../../components/accounts-snapshot'
import type { AccountsSnapshot } from '../../../accounts/accounts-snapshot'
import type * as AccountsSnapshotModule from '../../../accounts/accounts-snapshot'
import type * as CodexResetCreditModule from '../../../accounts/usage/codex-reset-credit'
const ACCOUNT_REVISION = 1_700_000_000_000
@@ -34,13 +36,11 @@ export function codexResetCreditMountAdapters(
): Record<string, MountAdapter> {
return {
'accounts.codex-reset-credit': ({ client }) => {
const credit = modules.load<typeof import('../../../components/codex-reset-credit')>(
'mobile/src/components/codex-reset-credit.ts'
const credit = modules.load<typeof CodexResetCreditModule>(
'mobile/src/accounts/usage/codex-reset-credit.ts'
)
const snapshot = modules
.load<typeof import('../../../components/accounts-snapshot')>(
'mobile/src/components/accounts-snapshot.ts'
)
.load<typeof AccountsSnapshotModule>('mobile/src/accounts/accounts-snapshot.ts')
.decodeAccountsSnapshot(CODEX_ACCOUNTS)
let settled: unknown = null
return {
+28 -2
View File
@@ -28,9 +28,9 @@ Prefer `--json` for agent-driven calls. If the CLI is missing, say so explicitly
A full handoff transfers ownership to another agent or worktree, then the original agent stops. Treat requests phrased as "hand off", "handoff", "handover", "give this to another agent", "give this to another worktree", "another agent", or "another worktree" as full handoffs unless the user expects the result back ("have another agent review this and report") or explicitly asks to supervise, monitor, wait for results, track completion, coordinate a DAG, use decision gates, or manage ask/reply.
A handoff is done when the new worktree id and agent handle have been reported and the prompt was delivered: the launch's `prompt.outcome` is `journaled` or `handed-to-terminal`, or, for an agent that was already running, the send receipt reported `accepted: true`. Do not wait for the receiving agent to finish.
A handoff is done when the new worktree id and agent handle have been reported and the prompt was delivered: the launch's `prompt.outcome` is `journaled` or `handed-to-terminal`, or, for an agent that was already running, the `terminal send` receipt reported `accepted: true` or `chat send` reported `delivery` `submitted` or `queued`. Do not wait for the receiving agent to finish.
Do not use `orca orchestration task-create`, `orca orchestration dispatch --inject`, or `orca orchestration check --wait` for full handoffs. `task-create` is also forbidden because it records coordinator-owned tracking state; if a task row is needed, the user asked for supervised orchestration. Deliver the prompt with the agent launch, or with terminal commands for an agent that is already running.
Do not use `orca orchestration task-create`, `orca orchestration dispatch --inject`, or `orca orchestration check --wait` for full handoffs. `task-create` is also forbidden because it records coordinator-owned tracking state; if a task row is needed, the user asked for supervised orchestration. Deliver the prompt with the agent launch, or with `terminal send` or `chat send` for an agent that is already running.
For local work in the caller’s project, omit `--repo` and `--project`. Pass one to target another project or when Orca asks you to disambiguate; do not pick a repo from a list for unambiguous same-project work. The project comes from the caller’s directory, not the project visible in the app. Paired-server calls require an explicit server-side target.
@@ -62,6 +62,14 @@ Existing-terminal handoff:
ORCA terminal send --terminal <handle> --text "<task brief>" --enter --json
```
Existing-chat handoff, for an agent that runs as a chat (`outcome.kind` `structured`):
```text
ORCA chat send --session <session> --text "<task brief>" --json
ORCA chat send --session <session> --text "<message>" --wait --timeout-ms 600000 --json
ORCA chat wait --session <session> --timeout-ms 600000 --json
```
## Starting agents
`worktree create --agent` (new checkout) and `agent launch` (existing worktree) are how to start an agent. They go through Orca's agent launch, the same one the app's new-agent tab uses: the user's Chat | CLI choice for that agent decides whether it opens as a chat or a terminal, and the result reports which (`outcome.kind`) and why (`receipt.detail`). When a chat is not possible, such as for an agent without chat support, the launch starts a terminal and the receipt says so. `--surface chat|terminal` picks one for that launch instead of the setting; pass it only when the user asked for a chat or a terminal. `--surface chat` is refused when Orca can establish before starting anything that the agent cannot open as a chat. If support cannot be checked, the launch can fall back to a terminal. If chat becomes unavailable only after a new workspace is created, Orca keeps that workspace, its setup and default tabs, then opens a terminal; the receipt explains the fallback. `terminal create` makes a terminal for shells and commands.
@@ -273,6 +281,24 @@ Terminal rules:
- For long output, use cursor reads. After a limited tail preview, page from `oldestCursor`; after a cursor read, continue with `nextCursor` while `limited` is true and `nextCursor !== latestCursor`.
- `--direction vertical` splits left/right. `--direction horizontal` splits top/bottom.
## Chats
Agents launched as chats are read and messaged with `chat`, not `terminal`. `chat list` names each chat's workspace, agent, state and last reply; `--session` takes the `session` it reports or the `handle` a launch returned.
```text
ORCA chat list --json
ORCA chat list --state working --json
ORCA chat read --session <session> --limit 10 --json
ORCA chat send --session <session> --text "<message>" --json
```
- `chat read` returns messages, tool calls, errors, and approvals or questions; `pending: true` marks one waiting for the user.
- `chat send` sends the text as the user's message. While the agent works, a host with a message queue holds it until the turn ends and reports `delivery: "queued"`.
- A refused send was not delivered. Read the chat again before resending.
- `chat send --wait` (or `chat wait`) returns when the chat settles, using `chat list` states: `settled: "done"`, or `"blocked"` on an approval or question, with the entries since the last user message; `settled: "timeout"` or `"held"` (queued message stopped or failed) exits 1. Pass `--timeout-ms`. Long or quoted text goes through `--text-file -` on stdin.
- Paired hosts can `chat list` only; read, send and wait run on the host machine.
- When relaying for a user from outside Orca (for example a voice or messaging assistant on the same machine), report from `chat list` and `chat read`, repeat an instruction back and get the user's confirmation before `chat send`, and send the user's words without adding instructions.
<!-- host-capability: artifact-publishing -->
## Artifacts
@@ -71,6 +71,7 @@ Browser rules:
- Pass `--page <browserPageId>` on every command that acts on one page; `ORCA <command> --help` lists `--page` when it does. `tab list`, `tab current`, `tab create` and `open-url` take no `--page`, and `tab switch`/`tab close` pick a tab by `--index` or `--page`, never both, since `--page` wins. Take the ID from `result.tab.browserPageId` in `ORCA tab current --json` or `result.browserPageId` in `ORCA tab create --json` and keep it for the task; `tab current` shows the routed tab, not the one you pin. When the user means a specific tab, find it by URL or title in `ORCA tab list --json`.
- Without `--page`, a command goes to the worktree's current tab. That stays the agent's tab while it has had a command in the last 20 seconds or so, even after the user picks another (`tab current` reports it too), then moves to the user's pick.
- After `ORCA tab switch`, pass the new page's `browserPageId`.
- When the user says they left notes or comments on a page, read them with `ORCA tab annotations --page <browserPageId>` (the current tab without `--page`). It prints the notes they haven't sent, the same text the tab's Copy button gives, and `--json` returns them in `result.annotations`. Notes the user already sent arrive in your chat instead.
- A popup window a page opens (sign-in, payment) is listed in `ORCA tab list --json` as a `popup-<n>` page with `openerBrowserPageId`. If a click seems to do nothing, check `tab list`, then drive the popup with `--page popup-<n>`. When it closes, continue on the opener page.
- Browser commands default to the current worktree. `--page` reaches the page in any worktree unless you also pass `--worktree <selector>`. Use `--worktree all` only intentionally.
- `tab list` shows every tab in the tab bar. After a restart, tabs the user has not opened report `loaded: false`; `tab switch` or any `--page` command loads one in the background without changing the user's visible tab.
+9
View File
@@ -1,10 +1,12 @@
import { readBrowserActionEffects } from '../../shared/browser-action-effects'
import { writeCliScreenshotTempFile } from '../cli-screenshot-temp-file'
import type { RuntimeRpcSuccess } from '../../shared/runtime-rpc-envelope'
import { formatBrowserAnnotationsAsMarkdown } from '../../shared/browser/annotations/browser-annotation-output'
import type {
BrowserProfileListResult,
BrowserScreenshotResult,
BrowserSnapshotResult,
BrowserTabAnnotationsResult,
BrowserTabCurrentResult,
BrowserTabListResult,
BrowserTabProfileCloneResult,
@@ -132,6 +134,13 @@ export function formatTabShow(result: BrowserTabShowResult | BrowserTabCurrentRe
].join('\n')
}
// The same text the tab's Copy button gives, so an agent reads what the user would send.
export function formatTabAnnotations(result: BrowserTabAnnotationsResult): string {
return result.annotations.length > 0
? formatBrowserAnnotationsAsMarkdown(result.annotations)
: `No unsent notes on tab ${result.tab.browserPageId}`
}
export function formatTabProfileShow(result: BrowserTabProfileShowResult): string {
return [
`page: ${result.browserPageId}`,
+12 -1
View File
@@ -1,11 +1,17 @@
import type {
BrowserTabAnnotationsResult,
BrowserTabCurrentResult,
BrowserTabListResult,
BrowserTabShowResult,
BrowserTabSwitchResult
} from '../../shared/browser/runtime/runtime-browser-contracts'
import type { CommandHandler } from '../dispatch'
import { formatTabList, formatTabListWithProfiles, formatTabShow } from './browser-format'
import {
formatTabAnnotations,
formatTabList,
formatTabListWithProfiles,
formatTabShow
} from './browser-format'
import { printResult } from '../format'
import {
getOptionalNonNegativeIntegerFlag,
@@ -42,6 +48,11 @@ export const BROWSER_TAB_HANDLERS: Record<string, CommandHandler> = {
const result = await client.call<BrowserTabShowResult>('browser.tabShow', target)
printResult(result, json, formatTabShow)
},
'tab annotations': async ({ flags, client, cwd, json }) => {
const target = await getBrowserCommandTarget(flags, cwd, client)
const result = await client.call<BrowserTabAnnotationsResult>('browser.tabAnnotations', target)
printResult(result, json, formatTabAnnotations)
},
'tab current': async ({ flags, client, cwd, json }) => {
const worktree = await getBrowserWorktreeSelector(flags, cwd, client)
const result = await client.call<BrowserTabCurrentResult>('browser.tabCurrent', { worktree })
+29 -2
View File
@@ -256,9 +256,9 @@ const ORCA_CLI_MARKDOWN = [
"",
"A full handoff transfers ownership to another agent or worktree, then the original agent stops. Treat requests phrased as \"hand off\", \"handoff\", \"handover\", \"give this to another agent\", \"give this to another worktree\", \"another agent\", or \"another worktree\" as full handoffs unless the user expects the result back (\"have another agent review this and report\") or explicitly asks to supervise, monitor, wait for results, track completion, coordinate a DAG, use decision gates, or manage ask/reply.",
"",
"A handoff is done when the new worktree id and agent handle have been reported and the prompt was delivered: the launch's `prompt.outcome` is `journaled` or `handed-to-terminal`, or, for an agent that was already running, the send receipt reported `accepted: true`. Do not wait for the receiving agent to finish.",
"A handoff is done when the new worktree id and agent handle have been reported and the prompt was delivered: the launch's `prompt.outcome` is `journaled` or `handed-to-terminal`, or, for an agent that was already running, the `terminal send` receipt reported `accepted: true` or `chat send` reported `delivery` `submitted` or `queued`. Do not wait for the receiving agent to finish.",
"",
"Do not use `orca orchestration task-create`, `orca orchestration dispatch --inject`, or `orca orchestration check --wait` for full handoffs. `task-create` is also forbidden because it records coordinator-owned tracking state; if a task row is needed, the user asked for supervised orchestration. Deliver the prompt with the agent launch, or with terminal commands for an agent that is already running.",
"Do not use `orca orchestration task-create`, `orca orchestration dispatch --inject`, or `orca orchestration check --wait` for full handoffs. `task-create` is also forbidden because it records coordinator-owned tracking state; if a task row is needed, the user asked for supervised orchestration. Deliver the prompt with the agent launch, or with `terminal send` or `chat send` for an agent that is already running.",
"",
"For local work in the caller’s project, omit `--repo` and `--project`. Pass one to target another project or when Orca asks you to disambiguate; do not pick a repo from a list for unambiguous same-project work. The project comes from the caller’s directory, not the project visible in the app. Paired-server calls require an explicit server-side target.",
"",
@@ -290,6 +290,14 @@ const ORCA_CLI_MARKDOWN = [
"ORCA terminal send --terminal <handle> --text \"<task brief>\" --enter --json",
"```",
"",
"Existing-chat handoff, for an agent that runs as a chat (`outcome.kind` `structured`):",
"",
"```text",
"ORCA chat send --session <session> --text \"<task brief>\" --json",
"ORCA chat send --session <session> --text \"<message>\" --wait --timeout-ms 600000 --json",
"ORCA chat wait --session <session> --timeout-ms 600000 --json",
"```",
"",
"## Starting agents",
"",
"`worktree create --agent` (new checkout) and `agent launch` (existing worktree) are how to start an agent. They go through Orca's agent launch, the same one the app's new-agent tab uses: the user's Chat | CLI choice for that agent decides whether it opens as a chat or a terminal, and the result reports which (`outcome.kind`) and why (`receipt.detail`). When a chat is not possible, such as for an agent without chat support, the launch starts a terminal and the receipt says so. `--surface chat|terminal` picks one for that launch instead of the setting; pass it only when the user asked for a chat or a terminal. `--surface chat` is refused when Orca can establish before starting anything that the agent cannot open as a chat. If support cannot be checked, the launch can fall back to a terminal. If chat becomes unavailable only after a new workspace is created, Orca keeps that workspace, its setup and default tabs, then opens a terminal; the receipt explains the fallback. `terminal create` makes a terminal for shells and commands.",
@@ -501,6 +509,24 @@ const ORCA_CLI_MARKDOWN = [
"- For long output, use cursor reads. After a limited tail preview, page from `oldestCursor`; after a cursor read, continue with `nextCursor` while `limited` is true and `nextCursor !== latestCursor`.",
"- `--direction vertical` splits left/right. `--direction horizontal` splits top/bottom.",
"",
"## Chats",
"",
"Agents launched as chats are read and messaged with `chat`, not `terminal`. `chat list` names each chat's workspace, agent, state and last reply; `--session` takes the `session` it reports or the `handle` a launch returned.",
"",
"```text",
"ORCA chat list --json",
"ORCA chat list --state working --json",
"ORCA chat read --session <session> --limit 10 --json",
"ORCA chat send --session <session> --text \"<message>\" --json",
"```",
"",
"- `chat read` returns messages, tool calls, errors, and approvals or questions; `pending: true` marks one waiting for the user.",
"- `chat send` sends the text as the user's message. While the agent works, a host with a message queue holds it until the turn ends and reports `delivery: \"queued\"`.",
"- A refused send was not delivered. Read the chat again before resending.",
"- `chat send --wait` (or `chat wait`) returns when the chat settles, using `chat list` states: `settled: \"done\"`, or `\"blocked\"` on an approval or question, with the entries since the last user message; `settled: \"timeout\"` or `\"held\"` (queued message stopped or failed) exits 1. Pass `--timeout-ms`. Long or quoted text goes through `--text-file -` on stdin.",
"- Paired hosts can `chat list` only; read, send and wait run on the host machine.",
"- When relaying for a user from outside Orca (for example a voice or messaging assistant on the same machine), report from `chat list` and `chat read`, repeat an instruction back and get the user's confirmation before `chat send`, and send the user's words without adding instructions.",
"",
"<!-- host-capability: artifact-publishing -->",
"",
"## Artifacts",
@@ -740,6 +766,7 @@ const ORCA_CLI_BROWSER_REFERENCE_MARKDOWN = [
"- Pass `--page <browserPageId>` on every command that acts on one page; `ORCA <command> --help` lists `--page` when it does. `tab list`, `tab current`, `tab create` and `open-url` take no `--page`, and `tab switch`/`tab close` pick a tab by `--index` or `--page`, never both, since `--page` wins. Take the ID from `result.tab.browserPageId` in `ORCA tab current --json` or `result.browserPageId` in `ORCA tab create --json` and keep it for the task; `tab current` shows the routed tab, not the one you pin. When the user means a specific tab, find it by URL or title in `ORCA tab list --json`.",
"- Without `--page`, a command goes to the worktree's current tab. That stays the agent's tab while it has had a command in the last 20 seconds or so, even after the user picks another (`tab current` reports it too), then moves to the user's pick.",
"- After `ORCA tab switch`, pass the new page's `browserPageId`.",
"- When the user says they left notes or comments on a page, read them with `ORCA tab annotations --page <browserPageId>` (the current tab without `--page`). It prints the notes they haven't sent, the same text the tab's Copy button gives, and `--json` returns them in `result.annotations`. Notes the user already sent arrive in your chat instead.",
"- A popup window a page opens (sign-in, payment) is listed in `ORCA tab list --json` as a `popup-<n>` page with `openerBrowserPageId`. If a click seems to do nothing, check `tab list`, then drive the popup with `--page popup-<n>`. When it closes, continue on the opener page.",
"- Browser commands default to the current worktree. `--page` reaches the page in any worktree unless you also pass `--worktree <selector>`. Use `--worktree all` only intentionally.",
"- `tab list` shows every tab in the tab bar. After a restart, tabs the user has not opened report `loaded: false`; `tab switch` or any `--page` command loads one in the background without changing the user's visible tab.",
+168
View File
@@ -0,0 +1,168 @@
import type {
AgentSessionHistoryPage,
AgentSessionHistoryResult
} from '../shared/agent-session/agent-session-wire'
import { AGENT_SESSION_HISTORY_MAX_LIMIT } from '../shared/agent-session/agent-session-wire'
import {
AGENT_SESSION_UNATTACHED_REFUSAL_CODE,
isUnattachedAgentSessionReadRefusal
} from '../shared/agent-session/failures/structured-agent-session-read-refusal'
import { structuredAgentSessionQueueSendsNext } from '../shared/agent-session/view/structured-agent-session-live-turn'
import { chatTranscript, formatChatRead, type ChatTranscriptEntry } from './chat-sessions'
import type { RuntimeClient, RuntimeRpcSuccess } from './runtime-client'
import { RuntimeClientError } from './runtime-client'
export const DEFAULT_READ_LIMIT = 20
const WAIT_POLL_MS = 1000
export type ChatTranscript = {
session: string
entries: ChatTranscriptEntry[]
/** Newest journal row read, so a later `--since` can continue from it. */
cursor: AgentSessionHistoryPage['window']['newest']
/** Older rows exist that this 200-row read did not reach, and they were needed. */
truncated: boolean
}
/** The chat's own turn in `chat list` words (structuredAgentSessionLeadState), plus two wait-only outcomes. */
export type ChatSettled = 'done' | 'blocked' | 'held' | 'timeout'
export async function readHistory(
client: RuntimeClient,
session: string,
limit: number
): Promise<RuntimeRpcSuccess<AgentSessionHistoryResult>> {
return client
.call<AgentSessionHistoryResult>('agentSession.history', {
sessionId: session,
direction: 'tail',
limit
})
.catch((error: unknown) => {
throw explainChatRefusal(error, session, 'read')
})
}
export async function readTranscript(
client: RuntimeClient,
session: string,
limit?: number
): Promise<RuntimeRpcSuccess<ChatTranscript>> {
// Status frames and turn markers share the journal, so read the most rows a page allows.
const response = await readHistory(client, session, AGENT_SESSION_HISTORY_MAX_LIMIT)
const { page } = response.result
const all = chatTranscript(page.items, page.actionablePromptIds)
const entries = limit === undefined ? all : all.slice(-limit)
const truncated = page.hasOlder && (limit === undefined || all.length < limit)
return { ...response, result: { session, entries, cursor: page.window.newest, truncated } }
}
export function requireWorkingFlag(page: AgentSessionHistoryPage): void {
if (page.working === undefined) {
throw new RuntimeClientError(
'incompatible_runtime',
'This Orca host does not report when a chat is working, so it cannot wait. Update Orca on the host.'
)
}
}
// Settled means no running turn or unanswered send, or a question/approval waiting for the user.
export async function waitForChat(
client: RuntimeClient,
session: string,
timeoutMs: number | undefined,
queuedMessageId?: string
): Promise<ChatSettled> {
const deadline = timeoutMs === undefined ? Infinity : Date.now() + timeoutMs
for (;;) {
const { page } = (await readHistory(client, session, 1)).result
requireWorkingFlag(page)
if ((page.actionablePromptIds?.length ?? 0) > 0) {
return 'blocked'
}
// Between turns the host names its next automatic send while working is briefly false.
const sendsNext = structuredAgentSessionQueueSendsNext(
page.nextQueuedMessageId,
page.working === true
)
if (!page.working && !sendsNext) {
// Still queued with nothing running or about to send: stopped, failed or held across a reopen.
const held = page.queuedMessages?.some((m) => m.messageId === queuedMessageId) === true
return held ? 'held' : 'done'
}
if (Date.now() >= deadline) {
return 'timeout'
}
await new Promise((resolve) => setTimeout(resolve, WAIT_POLL_MS))
}
}
// After a wait, the turn's entries: everything after the last user message.
export async function readSettledTurn(
client: RuntimeClient,
session: string,
settled: ChatSettled
): Promise<RuntimeRpcSuccess<ChatTranscript & { settled: ChatSettled }>> {
if (settled === 'timeout' || settled === 'held') {
// Chained commands such as `send --wait && ...` need a failing exit when the chat did not settle.
process.exitCode = 1
}
const response = await readTranscript(client, session)
const { entries, truncated } = response.result
const lastUser = entries.findLastIndex((e) => e.kind === 'message' && e.role === 'user')
// A held message never ran, so the last turn on the page is not its reply.
const turn = settled === 'held' ? [] : entries.slice(lastUser + 1)
return {
...response,
result: {
...response.result,
entries: turn,
truncated: settled !== 'held' && truncated && lastUser === -1,
settled
}
}
}
export function formatSettled(result: ChatTranscript & { settled: ChatSettled }): string {
const status =
result.settled === 'timeout'
? 'Still working when the wait timed out.'
: result.settled === 'held'
? 'Your message is held in the queue (the chat was stopped or the send failed). Resume it in Orca.'
: result.settled === 'blocked'
? 'Blocked: waiting for you to answer an approval or question.'
: 'Done.'
return result.entries.length === 0 ? status : `${formatChatRead(result)}\n${status}`
}
// The host answers with bare wire codes; say what they mean for this command.
export function explainChatRefusal(
error: unknown,
sessionId: string,
action: 'rename' | 'read' | 'send to'
): unknown {
if (!(error instanceof RuntimeClientError)) {
return error
}
if (error.message === 'agent_session_identity_required') {
return new RuntimeClientError(
'agent_session_identity_required',
`No chat with session id ${sessionId} on this host.`
)
}
if (isUnattachedAgentSessionReadRefusal(error)) {
return new RuntimeClientError(
AGENT_SESSION_UNATTACHED_REFUSAL_CODE,
`No open chat with session id ${sessionId} on this host. Find it with \`orca chat list\`.`
)
}
if (
error.message === 'structured_agent_session_unsupported' ||
error.code === 'method_not_found'
) {
return new RuntimeClientError(
'incompatible_runtime',
`This Orca host cannot ${action} chats from the CLI. Update Orca on that host, or check that it has chats turned on.`
)
}
return error
}
+175
View File
@@ -0,0 +1,175 @@
import { agentSessionPromptQuestions } from '../shared/agent-session/agent-session-question-answer'
import { isActionableStructuredAgentSessionPrompt } from '../shared/agent-session/view/structured-agent-session-live-turn'
import { isRootAgentJournalItem } from '../shared/agent-session/journal/agent-session-journal-producer'
import type { AgentJournalRenderItem } from '../shared/agent-session/journal/agent-session-journal-types'
import type {
RuntimeWorktreeAgentRow,
RuntimeWorktreePsSummary
} from '../shared/runtime-worktree-contracts'
import { structuredAgentSessionTabId } from '../shared/agent-session/view/structured-agent-session-projection'
import { RuntimeClientError } from './runtime-client'
const CHAT_HANDLE_PREFIX = structuredAgentSessionTabId('')
export type ChatSessionEntry = {
session: string
handle: string
worktreeId: string
worktree: string
agentType: string | null
state: RuntimeWorktreeAgentRow['state']
title: string | null
lastAssistantMessage: string | null
updatedAt: number
}
export type ChatTranscriptEntry =
| { kind: 'message'; role: string; text: string }
| { kind: 'tool'; name: string; state: string }
| { kind: 'approval' | 'question'; text: string; pending: boolean }
| { kind: 'error'; text: string }
/** The session id a chat is addressed by, from its id, its handle, or a pane key that names it. */
export function parseChatSessionSelector(value: string): string {
const withoutHandle = value.startsWith(CHAT_HANDLE_PREFIX)
? value.slice(CHAT_HANDLE_PREFIX.length)
: value
// A pane key is the chat's handle and its leaf: "<handle>:<leaf>".
const session = withoutHandle.split(':')[0]?.trim() ?? ''
if (session.length === 0) {
throw new RuntimeClientError(
'invalid_argument',
'--session needs a chat session id or handle; run `orca chat list` to find one.'
)
}
return session
}
/** The top-level chats in a worktree summary. Terminal agents and subagents are left out:
* terminals are read with `orca terminal`, and a subagent is reached through its parent chat. */
export function listChatSessions(
worktrees: readonly RuntimeWorktreePsSummary[]
): ChatSessionEntry[] {
return worktrees.flatMap((worktree) =>
worktree.agents
.filter(
(agent) => agent.parentPaneKey === null && agent.paneKey.startsWith(CHAT_HANDLE_PREFIX)
)
.map((agent) => {
const session = parseChatSessionSelector(agent.paneKey)
return {
session,
handle: structuredAgentSessionTabId(session),
worktreeId: worktree.worktreeId,
worktree: worktree.displayName,
agentType: agent.agentType,
state: agent.state,
title: agent.displayName ?? agent.taskTitle,
lastAssistantMessage: agent.lastAssistantMessage,
updatedAt: agent.updatedAt
}
})
)
}
function messageText(item: AgentJournalRenderItem): string {
if (item.body.kind !== 'message') {
return ''
}
return item.body.blocks
.map((block) =>
block.type === 'text' ? block.text : block.type === 'image-ref' ? '[image]' : ''
)
.filter((text) => text.length > 0)
.join('\n')
.trim()
}
/** The conversation as a reader follows it: messages, the tools the agent ran, and the
* approvals and questions it raised. Provider status frames and turn markers are left out. */
export function chatTranscript(
items: readonly AgentJournalRenderItem[],
actionablePromptIds?: readonly string[]
): ChatTranscriptEntry[] {
// An ended agent's unanswered prompts stay pending in the journal but can no longer be answered.
const waiting = (item: AgentJournalRenderItem, state: string): boolean =>
state === 'pending' &&
isActionableStructuredAgentSessionPrompt(item.itemId, actionablePromptIds)
const entries: ChatTranscriptEntry[] = []
for (const item of items) {
// Subagents share the journal; their rows belong to their own section, not the chat's turn.
if (!isRootAgentJournalItem(item)) {
continue
}
const body = item.body
if (body.kind === 'message') {
const text = messageText(item)
// Reasoning is the model's scratch work, folded away in the app too.
if (text.length > 0 && body.role !== 'reasoning') {
entries.push({ kind: 'message', role: body.role, text })
}
} else if (body.kind === 'status' && body.tone === 'error') {
// Start failures and dead agents land as error status rows; without them a wait reads "Done.".
entries.push({ kind: 'error', text: String(body.text) })
} else if (body.kind === 'tool-call') {
entries.push({ kind: 'tool', name: body.name, state: body.state })
} else if (body.kind === 'approval') {
entries.push({
kind: 'approval',
text: body.title,
pending: waiting(item, body.resolution.state)
})
} else if (body.kind === 'question') {
entries.push({
kind: 'question',
// Grouped prompts keep their real questions in `questions`; `question` is then a heading.
text: agentSessionPromptQuestions(body)
.map((q) => q.question)
.join('\n'),
pending: waiting(item, body.resolution.state)
})
}
}
return entries
}
export function formatChatList(result: { chats: ChatSessionEntry[] }): string {
if (result.chats.length === 0) {
return 'No chats.'
}
return result.chats
.map((chat) =>
[
`${chat.worktree} · ${chat.agentType ?? 'agent'} · ${chat.state}`,
` session: ${chat.session}`,
...(chat.title ? [` title: ${chat.title}`] : []),
...(chat.lastAssistantMessage
? [` last reply: ${chat.lastAssistantMessage.replace(/\s+/g, ' ').slice(0, 200)}`]
: [])
].join('\n')
)
.join('\n\n')
}
export function formatChatRead(result: {
session: string
entries: ChatTranscriptEntry[]
}): string {
if (result.entries.length === 0) {
return `No messages in ${result.session}.`
}
return result.entries
.map((entry) => {
if (entry.kind === 'message') {
return `${entry.role}: ${entry.text}`
}
if (entry.kind === 'error') {
return `[error] ${entry.text}`
}
if (entry.kind === 'tool') {
return `[tool ${entry.name}: ${entry.state}]`
}
return `[${entry.kind}${entry.pending ? ', waiting for you' : ''}] ${entry.text}`
})
.join('\n')
}
+15
View File
@@ -2,7 +2,22 @@
const FILE_OPEN_FOCUS_HELP =
"--focus Bring the user to the file (switches Orca's window to its worktree)"
const CHAT_SESSION_HELP =
'--session <id> Chat session id or handle from chat list or agent launch'
const COMMAND_SCOPED_FLAG_HELP: Record<string, Record<string, string>> = {
'chat rename': {
session: '--session <id> Chat session id from chat list or agent launch'
},
'chat list': {
state: '--state <state> Only chats in this state: working, blocked, waiting or done'
},
'chat read': { session: CHAT_SESSION_HELP },
'chat send': {
session: CHAT_SESSION_HELP,
wait: '--wait Wait until the chat finishes or needs your answer'
},
'chat wait': { session: CHAT_SESSION_HELP },
'extension reload': {
'extension-id':
'--extension-id <id> Installed unpacked extension ID; also accepted positionally',
+1
View File
@@ -36,6 +36,7 @@ export const FLAG_HELP_TEXT: Record<string, string> = {
interrupt: '--interrupt Send as an interrupt-style input when supported',
'keep-open': '--keep-open Keep the worker open after it finishes',
'spec-file': '--spec-file <path|-> Read the spec from a file or stdin',
'text-file': '--text-file <path|-> Read the text from a file or stdin',
id: '--id <id> Identifier for a target item or permission',
issue: '--issue <number|null> Linked GitHub issue number',
'gitlab-issue':
+1 -1
View File
@@ -207,7 +207,7 @@ export const HANDLER_GROUPS: readonly HandlerGroup[] = [
},
{
name: 'chat',
keys: ['chat rename'],
keys: ['chat rename', 'chat list', 'chat read', 'chat send', 'chat wait'],
load: async () => (await import('./handlers/chat.js')).CHAT_HANDLERS
},
{
+176
View File
@@ -1,7 +1,183 @@
import { afterEach, describe, expect, it, vi } from 'vitest'
import { SendParams } from '../../shared/rpc-contract/structured-agent-session-params'
import { AGENT_SESSION_QUEUED_MESSAGES_RUNTIME_CAPABILITY } from '../../shared/agent-session/agent-session-runtime-capabilities'
import { RuntimeClient } from '../runtime-client'
import { CHAT_HANDLERS } from './chat'
const SESSION = 'codex_8eb631ab_59c5_41e4_8672_01cfe0a6fd5f'
function ok(result: unknown) {
return { id: 'req', ok: true, result, _meta: { runtimeId: 'runtime-1' } }
}
function historyPage(
items: unknown[],
fence: number | undefined = 3,
pageOverrides: Record<string, unknown> = {}
) {
return ok({
ok: true,
page: {
sessionId: SESSION,
epoch: 'e',
fence,
direction: 'tail',
items,
removedItemIds: [],
submissions: [],
window: {
oldest: null,
newest: { epoch: 'e', sequence: 9 },
nextCursor: { epoch: 'e', sequence: 9 }
},
...pageOverrides
}
})
}
function item(body: unknown) {
return { itemId: 'i', revision: 1, sequence: 1, observedAt: 1, body }
}
function fakeClient(
responses: unknown[],
capabilities: string[] = [AGENT_SESSION_QUEUED_MESSAGES_RUNTIME_CAPABILITY]
): RuntimeClient & { call: ReturnType<typeof vi.fn> } {
const client = new RuntimeClient('/tmp/orca-chat-test', 60_000, null, null)
const call = vi.fn()
for (const response of responses) {
call.mockResolvedValueOnce(response)
}
vi.spyOn(client, 'call').mockImplementation(call)
vi.spyOn(client, 'getCliStatus').mockResolvedValue({
id: 'status',
ok: true,
result: {
app: { running: true, pid: 123 },
runtime: { state: 'ready', reachable: true, runtimeId: 'runtime-1', capabilities },
graph: { state: 'ready' }
},
_meta: { runtimeId: 'runtime-1' }
})
return Object.assign(client, { call })
}
async function run(
command: string,
flags: Record<string, string | boolean>,
client: RuntimeClient
) {
const logs: string[] = []
const spy = vi.spyOn(console, 'log').mockImplementation((line: string) => logs.push(line))
try {
await CHAT_HANDLERS[command]!({
flags: new Map(Object.entries(flags)),
client,
cwd: '/tmp',
json: true
})
} finally {
spy.mockRestore()
}
return JSON.parse(logs.join('\n')).result
}
afterEach(() => {
vi.useRealTimers()
vi.restoreAllMocks()
})
describe('chat send', () => {
it('sends a host-valid message fenced to the chat it read, queued while the agent works', async () => {
const client = fakeClient([
historyPage([], 7),
ok({
ok: true,
replayed: false,
fence: 7,
cursor: { epoch: 'e', sequence: 2 },
value: {
clientMessageId: 'm-1',
queued: { messageId: 'q-1', position: 1, state: 'waiting' }
}
})
])
const result = await run('chat send', { session: SESSION, text: 'Run the tests' }, client)
const params = client.call.mock.calls[1]![1]
expect(client.call.mock.calls[1]![0]).toBe('agentSession.send')
// The host validates the same schema, so a malformed envelope or body fails here.
expect(SendParams.safeParse(params).success).toBe(true)
expect(params).toMatchObject({
envelope: { sessionId: SESSION, expectedRuntimeFence: 7 },
delivery: 'queue-if-active',
body: { kind: 'message', role: 'user', blocks: [{ type: 'text', text: 'Run the tests' }] }
})
expect(result).toEqual({
session: SESSION,
delivery: 'queued',
clientMessageId: 'm-1',
queuePosition: 1
})
})
it('reports a host refusal as an error instead of a sent message', async () => {
const client = fakeClient([
historyPage([], 2),
ok({
ok: false,
refusal: { code: 'agent_session_fence_mismatch', message: 'The chat restarted.' }
})
])
await expect(run('chat send', { session: SESSION, text: 'hi' }, client)).rejects.toMatchObject({
code: 'agent_session_fence_mismatch'
})
})
it('with --wait, waits for its queued message to run and returns that turn', async () => {
vi.useFakeTimers()
const client = fakeClient([
historyPage([], 7, { working: true }),
ok({
ok: true,
replayed: false,
fence: 7,
cursor: { epoch: 'e', sequence: 2 },
value: {
clientMessageId: 'm-1',
queued: { messageId: 'q-1', position: 1, state: 'waiting' }
}
}),
// The earlier turn ended, but the queued message has not been handed to the agent yet.
historyPage([], 7, {
working: false,
queuedMessages: [{ messageId: 'q-1' }],
nextQueuedMessageId: 'q-1'
}),
historyPage([], 7, { working: true, queuedMessages: [] }),
historyPage([], 7, { working: false, queuedMessages: [], actionablePromptIds: [] }),
historyPage([
item({ kind: 'message', role: 'user', blocks: [{ type: 'text', text: 'Earlier' }] }),
item({ kind: 'message', role: 'assistant', blocks: [{ type: 'text', text: 'Old reply' }] }),
item({ kind: 'message', role: 'user', blocks: [{ type: 'text', text: 'Run the tests' }] }),
item({ kind: 'message', role: 'assistant', blocks: [{ type: 'text', text: 'All pass' }] })
])
])
const pending = run(
'chat send',
{ session: SESSION, text: 'Run the tests', wait: true },
client
)
await vi.advanceTimersByTimeAsync(5_000)
const result = await pending
expect(client.call).toHaveBeenCalledTimes(6)
expect(result).toMatchObject({
delivery: 'queued',
settled: 'done',
entries: [{ kind: 'message', role: 'assistant', text: 'All pass' }]
})
})
})
function chatClient(isRemote: boolean): { client: RuntimeClient; call: ReturnType<typeof vi.fn> } {
const client = new RuntimeClient('/tmp/orca-chat-test', 60_000, null, null)
vi.spyOn(client, 'isRemote', 'get').mockReturnValue(isRemote)
+166 -28
View File
@@ -1,11 +1,64 @@
import type { CommandHandler } from '../dispatch'
import { getPresentStringFlag, getRequiredStringFlag } from '../flags'
import { printResult } from '../format'
import { RuntimeClientError } from '../runtime-client'
import { randomUUID } from 'node:crypto'
import type {
AgentSessionMutationResult,
AgentSessionSendResult
} from '../../shared/agent-session/agent-session-wire'
import { AGENT_SESSION_QUEUED_MESSAGES_RUNTIME_CAPABILITY } from '../../shared/agent-session/agent-session-runtime-capabilities'
import type {
RuntimeWorktreePsResult,
RuntimeWorktreeRecord
} from '../../shared/runtime-worktree-contracts'
import { createStructuredAgentSessionOperationId } from '../../shared/agent-session/lifecycle/structured-agent-session-mutation'
import {
structuredAgentSessionMessageSendMutation,
structuredAgentSessionSendBody
} from '../../shared/agent-session/requests/structured-agent-session-send-mutation'
import { AGENT_STATUS_STATES } from '../../shared/agent-status/contracts/agent-status-types'
import { readInjectedAgentSessionId } from '../../shared/agent-session/lifecycle/agent-session-caller-env'
import {
DEFAULT_READ_LIMIT,
explainChatRefusal,
formatSettled,
readHistory,
readSettledTurn,
readTranscript,
requireWorkingFlag,
waitForChat
} from '../chat-history'
import {
formatChatList,
formatChatRead,
listChatSessions,
parseChatSessionSelector
} from '../chat-sessions'
import { readTextOrFileFlag } from '../command-body-input'
import type { CommandHandler } from '../dispatch'
import {
getOptionalPositiveIntegerFlag,
getOptionalStringFlag,
getPresentStringFlag,
getRequiredStringFlag
} from '../flags'
import { printResult } from '../format'
import { getOptionalWorktreeSelector } from '../selectors'
import type { RuntimeClient } from '../runtime-client'
import { RuntimeClientError } from '../runtime-client'
const MAX_READ_LIMIT = 100
type ChatRenameResult = { name: string | null; applied: boolean }
// Paired CLIs lack the host's chat read/send capability; refuse before the host does with a bare code.
function readSession(flags: Map<string, string | boolean>, client: RuntimeClient): string {
if (client.isRemote) {
throw new RuntimeClientError(
'runtime_unsupported',
'Reading and messaging chats on a paired host is not supported yet. Run this on the host machine.'
)
}
return parseChatSessionSelector(getRequiredStringFlag(flags, 'session'))
}
export const CHAT_HANDLERS: Record<string, CommandHandler> = {
'chat rename': async ({ flags, client, json }) => {
const name = getRequiredStringFlag(flags, 'name')
@@ -24,34 +77,119 @@ export const CHAT_HANDLERS: Record<string, CommandHandler> = {
const result = await client
.call<ChatRenameResult>('agentSession.rename', { sessionId, name })
.catch((error: unknown) => {
throw explainRenameRefusal(error, sessionId)
throw explainChatRefusal(error, sessionId, 'rename')
})
if (!result.result.applied) {
throw new RuntimeClientError('invalid_argument', 'Not renamed: the name has no visible text.')
}
printResult(result, json, (value) => `Renamed chat to "${value.name}".`)
},
'chat list': async ({ flags, client, cwd, json }) => {
const state = getOptionalStringFlag(flags, 'state')
if (state !== undefined && !AGENT_STATUS_STATES.some((known) => known === state)) {
throw new RuntimeClientError(
'invalid_argument',
`--state must be one of: ${AGENT_STATUS_STATES.join(', ')}.`
)
}
const selector = await getOptionalWorktreeSelector(flags, 'worktree', cwd, client)
const shown = selector
? (
await client.call<{ worktree: RuntimeWorktreeRecord }>('worktree.show', {
worktree: selector
})
).result.worktree
: undefined
const result = await client.call<RuntimeWorktreePsResult>('worktree.ps', {})
// A local and an SSH copy can share an id; the host tells them apart when both name one.
const worktrees = result.result.worktrees.filter(
(w) =>
!shown ||
(w.worktreeId === shown.id &&
(w.hostId === undefined || shown.hostId === undefined || w.hostId === shown.hostId))
)
const chats = listChatSessions(worktrees).filter((chat) => !state || chat.state === state)
printResult({ ...result, result: { chats } }, json, formatChatList)
},
'chat read': async ({ flags, client, json }) => {
const session = readSession(flags, client)
const limit = getOptionalPositiveIntegerFlag(flags, 'limit') ?? DEFAULT_READ_LIMIT
if (limit > MAX_READ_LIMIT) {
throw new RuntimeClientError('invalid_argument', `--limit must be at most ${MAX_READ_LIMIT}.`)
}
printResult(await readTranscript(client, session, limit), json, formatChatRead)
},
'chat wait': async ({ flags, client, json }) => {
const session = readSession(flags, client)
const timeoutMs = getOptionalPositiveIntegerFlag(flags, 'timeout-ms')
const settled = await waitForChat(client, session, timeoutMs)
printResult(await readSettledTurn(client, session, settled), json, formatSettled)
},
'chat send': async ({ flags, client, cwd, json }) => {
const session = readSession(flags, client)
const text = (await readTextOrFileFlag(flags, cwd, 'text', true)) ?? ''
if (text.trim().length === 0) {
throw new RuntimeClientError('invalid_argument', 'The message must not be empty.')
}
const wait = flags.has('wait')
const timeoutMs = getOptionalPositiveIntegerFlag(flags, 'timeout-ms')
const status = await client.getCliStatus()
if (!status.result.runtime.reachable) {
throw new RuntimeClientError(
'runtime_unavailable',
'Orca could not reach the execution host, so nothing was sent. Retry once it is reachable.'
)
}
// A working chat holds a queued message until its turn ends; older hosts get an ordinary send.
const queue =
status.result.runtime.capabilities?.includes(
AGENT_SESSION_QUEUED_MESSAGES_RUNTIME_CAPABILITY
) === true
// The send is fenced to the session's current runtime, so a restarted chat refuses it.
const { page } = (await readHistory(client, session, 1)).result
if (wait) {
requireWorkingFlag(page)
}
const { fence } = page
if (fence === undefined) {
throw new RuntimeClientError(
'agent_session_not_running',
`Chat ${session} has no running session on this host, so nothing was sent. Open it in Orca and retry.`
)
}
const mutation = structuredAgentSessionMessageSendMutation({
sessionId: session,
clientOperationId: createStructuredAgentSessionOperationId(randomUUID),
expectedRuntimeFence: fence,
body: structuredAgentSessionSendBody(text, []),
...(queue ? { delivery: 'queue-if-active' as const } : {})
})
const result = await client.call<AgentSessionMutationResult<AgentSessionSendResult>>(
'agentSession.send',
mutation
)
if (!result.result.ok) {
const { code, message } = result.result.refusal
throw explainChatRefusal(new RuntimeClientError(code, message), session, 'send to')
}
const value = result.result.value
const sent = {
session,
delivery: 'queued' in value ? ('queued' as const) : ('submitted' as const),
clientMessageId: value.clientMessageId,
...('queued' in value ? { queuePosition: value.queued.position } : {})
}
if (!wait) {
printResult({ ...result, result: sent }, json, (r) =>
r.delivery === 'queued'
? `Queued for ${r.session}; it is sent when the current turn ends.`
: `Sent to ${r.session}.`
)
return
}
const queuedId = 'queued' in value ? value.queued.messageId : undefined
const settled = await waitForChat(client, session, timeoutMs, queuedId)
const turn = await readSettledTurn(client, session, settled)
printResult({ ...turn, result: { ...sent, ...turn.result } }, json, formatSettled)
}
}
// The host answers with bare wire codes; say what they mean for this command.
function explainRenameRefusal(error: unknown, sessionId: string): unknown {
if (!(error instanceof RuntimeClientError)) {
return error
}
if (error.message === 'agent_session_identity_required') {
return new RuntimeClientError(
'agent_session_identity_required',
`No chat with session id ${sessionId} on this host.`
)
}
if (
error.message === 'structured_agent_session_unsupported' ||
error.code === 'method_not_found'
) {
return new RuntimeClientError(
'incompatible_runtime',
'This Orca host cannot rename chats from the CLI. Update Orca on that host, or check that it has chats turned on.'
)
}
return error
}
@@ -108,6 +108,7 @@ export type WorkerListResult = {
dispatchStatus: string
agentTerminalHandle: string | null
terminalState: string | null
coordinatedFrom?: string | null
resource?: { worktreeId?: string | null; autoReleaseAt?: string | null } | null
projection?: WorkerProjection
}[]
@@ -133,6 +134,7 @@ type WorkerListRow = {
terminalState?: string
workspace?: string
host?: string
coordinatedFrom?: string
attention?: string[]
autoReleaseAt?: string
next?: string
@@ -168,6 +170,7 @@ export const WORKER_LIST_VIEW: OrchestrationAgentView<ScopedWorkerList, WorkerLi
// Older runtimes send no projection; the terminal resource row still names both.
workspace: projection?.workspace?.id ?? worker.resource?.worktreeId ?? undefined,
host: projection?.host.id,
coordinatedFrom: worker.coordinatedFrom ?? undefined,
attention: actionableAttention(projection),
autoReleaseAt: projection?.autoReleaseAt ?? worker.resource?.autoReleaseAt ?? undefined,
next: projection
@@ -173,7 +173,10 @@ export const ORCHESTRATION_WORKER_TERMINAL_HANDLERS: Record<string, CommandHandl
const autoRelease = projection?.autoReleaseAt
? ` auto-release=${projection.autoReleaseAt}`
: ''
return `${worker.dispatchId} task=${worker.taskId} [${worker.workerState}${details} terminal=${worker.terminalState ?? 'none'}${autoRelease}${next}`
const coordinatedFrom = worker.coordinatedFrom
? ` coordinated from ${worker.coordinatedFrom}`
: ''
return `${worker.dispatchId} task=${worker.taskId} [${worker.workerState}${details} terminal=${worker.terminalState ?? 'none'}${autoRelease}${next}${coordinatedFrom}`
})
.join('\n')
const counts = Object.entries(value.counts)
+5
View File
@@ -121,6 +121,10 @@ export const ROOT_HELP_TEXT_PRIMARY = [
' agent launch Start an agent in a worktree, as a chat or terminal per your settings',
'',
'Chats:',
' chat list List agent chats with their workspace, state and last reply',
' chat read Read the latest messages of an agent chat',
' chat send Send a message to an agent chat',
' chat wait Wait until an agent chat finishes or needs your answer',
' chat rename Rename a chat tab',
'',
'Files:',
@@ -207,6 +211,7 @@ export const ROOT_HELP_TEXT_PRIMARY = [
' tab create Create a new browser tab (navigates to --url)',
' tab list List open browser tabs',
' tab show Show one browser tab by page id',
" tab annotations Show a tab's unsent notes from the user",
' tab current Show the current browser tab',
' tab profile list List browser session profiles',
' tab profile create Create a browser session profile',
@@ -15,9 +15,9 @@ export function createOrchestrationCompatibilityEnvelope(
}
}
/** The chat an agent launch came from, so the host can show the launched agent there.
/** The chat a launch or browser command came from, so the host can show its agent or page there.
* Only a same-host session can be named: host-stamped (WSL) environments send nothing. */
export function createAgentLaunchCallerEvidence(
export function createChatCallerEvidence(
env: NodeJS.ProcessEnv
): RuntimeOrchestrationEnvelope['orchestrationCompatibilityEvidence'] {
const agentSessionId = readInjectedAgentSessionId(env)
@@ -29,12 +29,16 @@ export function createAgentLaunchCallerEvidence(
const AGENT_LAUNCH_METHODS: ReadonlySet<string> = new Set(['agent.launch', 'agent.launchReplay'])
function namesChatCaller(method: string): boolean {
return AGENT_LAUNCH_METHODS.has(method) || method.startsWith('browser.')
}
/** The caller evidence one request carries, read from this process's environment once. */
export class OrchestrationRequestEvidence {
private readonly orchestration: RuntimeOrchestrationEnvelope
// A chat's session id means nothing on another server, so reads there go like a shell's.
private readonly remoteRead: RuntimeOrchestrationEnvelope
private readonly agentLaunchCaller: RuntimeOrchestrationEnvelope['orchestrationCompatibilityEvidence']
private readonly chatCaller: RuntimeOrchestrationEnvelope['orchestrationCompatibilityEvidence']
constructor(env: NodeJS.ProcessEnv) {
this.orchestration = createOrchestrationCompatibilityEnvelope(env)
@@ -44,7 +48,7 @@ export class OrchestrationRequestEvidence {
...this.orchestration,
orchestrationCompatibilityEvidence: Object.keys(shell).length > 0 ? shell : undefined
}
this.agentLaunchCaller = createAgentLaunchCallerEvidence(env)
this.chatCaller = createChatCallerEvidence(env)
}
envelopeFor(
@@ -58,8 +62,8 @@ export class OrchestrationRequestEvidence {
compatibilityInvocationId: request.requestId ?? base.compatibilityInvocationId
}
}
return AGENT_LAUNCH_METHODS.has(method) && !request.remote && this.agentLaunchCaller
? { orchestrationCompatibilityEvidence: this.agentLaunchCaller }
return namesChatCaller(method) && !request.remote && this.chatCaller
? { orchestrationCompatibilityEvidence: this.chatCaller }
: {}
}
}
@@ -26,3 +26,18 @@ describe('caller evidence on requests to another server', () => {
).toEqual({ agentSessionId: '11111111-1111-4111-8111-111111111111' })
})
})
describe('caller evidence on browser commands', () => {
it('names the chat on this host, so its run can show the page it drove', () => {
const evidence = new OrchestrationRequestEvidence(CHAT)
const request = { mutation: false, requestId: undefined }
expect(
evidence.envelopeFor('browser.click', { ...request, remote: false })
.orchestrationCompatibilityEvidence
).toEqual({ agentSessionId: '11111111-1111-4111-8111-111111111111' })
expect(
evidence.envelopeFor('browser.click', { ...request, remote: true })
.orchestrationCompatibilityEvidence
).toBeUndefined()
})
})
+6
View File
@@ -206,6 +206,12 @@ export const BROWSER_BASIC_COMMAND_SPECS: CommandSpec[] = withBrowserPageTarget(
usage: 'orca tab show --page <id> [--worktree <selector>] [--json]',
allowedFlags: [...GLOBAL_FLAGS, 'page', 'worktree']
},
{
path: ['tab', 'annotations'],
summary: "Show the notes the user left on a browser tab and hasn't sent yet",
usage: 'orca tab annotations [--page <id>] [--worktree <selector>] [--json]',
allowedFlags: [...GLOBAL_FLAGS, 'page', 'worktree']
},
{
path: ['tab', 'current'],
summary: 'Show the current browser tab',
+52
View File
@@ -15,5 +15,57 @@ export const CHAT_COMMAND_SPECS: CommandSpec[] = [
'orca chat rename --name "Migrate auth to OAuth"',
'orca chat rename --session <sessionId> --name "Release notes" --json'
]
},
{
path: ['chat', 'list'],
summary: 'List agent chats with their workspace, state and last reply',
usage: 'orca chat list [--worktree <selector>] [--state <state>] [--json]',
allowedFlags: [...GLOBAL_FLAGS, 'worktree', 'state'],
notes: [
'Lists the top-level chats Orca shows as agent tabs. Terminal agents are read with `orca terminal`.',
'--state keeps chats in one state: working, blocked, waiting or done.'
],
examples: ['orca chat list --json', 'orca chat list --state working']
},
{
path: ['chat', 'read'],
summary: 'Read the latest messages of an agent chat',
usage: 'orca chat read --session <id-or-handle> [--limit <n>] [--json]',
allowedFlags: [...GLOBAL_FLAGS, 'session', 'limit'],
notes: [
'--session takes the session id or handle from `orca chat list` or `orca agent launch`.',
'--limit is the number of entries shown (messages, tool calls, approvals and questions); the default is 20 and the maximum 100.',
'Approvals and questions waiting for an answer are marked "waiting for you".'
],
examples: ['orca chat read --session codex_1234 --limit 10']
},
{
path: ['chat', 'send'],
summary: 'Send a message to an agent chat',
usage:
'orca chat send --session <id-or-handle> (--text <text> | --text-file <path|->) [--wait] [--timeout-ms <ms>] [--json]',
allowedFlags: [...GLOBAL_FLAGS, 'session', 'text', 'text-file', 'wait', 'timeout-ms'],
notes: [
'Sends the text as your message, as if typed in the chat. --text-file - reads it from stdin.',
'While the agent is working, hosts with a message queue hold the message until the turn ends; the result says "queued".',
'--wait returns once the chat finishes or waits for your answer, with what it did since your message. It exits 1 when the wait times out or the message is held in a stopped queue.',
'A chat that restarted since it was read refuses the send; read it again and resend.'
],
examples: [
'orca chat send --session codex_1234 --text "Run the tests, then summarize failures"',
'orca chat send --session codex_1234 --text "Run the tests" --wait --timeout-ms 600000 --json',
'cat notes.md | orca chat send --session codex_1234 --text-file -'
]
},
{
path: ['chat', 'wait'],
summary: 'Wait until an agent chat finishes or needs your answer',
usage: 'orca chat wait --session <id-or-handle> [--timeout-ms <ms>] [--json]',
allowedFlags: [...GLOBAL_FLAGS, 'session', 'timeout-ms'],
notes: [
'Settles on the chat\'s own turn, in `chat list` words: "done", or "blocked" on an approval or question. Background agents it started can still show as working or waiting in `chat list`. "held" and "timeout" exit 1.',
'Prints what the chat did since the last user message. A wait that times out exits 1.'
],
examples: ['orca chat wait --session codex_1234 --timeout-ms 600000 --json']
}
]
@@ -0,0 +1,89 @@
import { afterEach, describe, expect, it } from 'vitest'
import { acpLaunchSpecFor } from '../launch/acp-launch-registry'
import type { AcpLaunchSpec } from '../launch/acp-launch-contract'
import { createAcpModelCatalogProbe } from './acp-model-catalog-probe'
import { AcpSessionRuntime } from '../protocol/acp-session-runtime'
import { AcpScriptedAgent } from '../process/testing/acp-scripted-agent.test-support'
import { openCodeAcpAccountBinding } from '../../opencode/opencode-structured-account-home'
// Bypass the app's managed-account service for this fixture.
const OPENCODE: AcpLaunchSpec = {
...acpLaunchSpecFor('opencode')!,
account: openCodeAcpAccountBinding(() => ({
list: () => ({ activeAccountId: null, accounts: [] }),
restoreOriginalEnvironment: () => {},
environmentForAccount: () => ({})
}))
}
const agents: AcpScriptedAgent[] = []
afterEach(() => {
for (const agent of agents.splice(0)) {
agent.close()
}
})
describe('ACP model catalog probes', () => {
it('lists the catalog after OpenCode answers session/new with -32603 while starting', async () => {
const agent = new AcpScriptedAgent()
agents.push(agent)
agent.on('initialize', (frame) =>
agent.reply(frame, {
protocolVersion: 1,
agentCapabilities: { sessionCapabilities: { delete: {} } }
})
)
let sessionNews = 0
agent.on('session/new', (frame) => {
sessionNews += 1
if (sessionNews === 1) {
agent.fail(frame, -32603, 'Internal error: Internal service failure', {
errorName: 'InvalidRequestError'
})
return
}
agent.reply(frame, {
sessionId: 'probe-session',
configOptions: [
{
id: 'model',
name: 'Model',
category: 'model',
type: 'select',
currentValue: 'opencode/exo-free',
options: [
{ value: 'opencode/big-pickle', name: 'Big Pickle' },
{ value: 'opencode/exo-free', name: 'Exo Free' }
]
}
]
})
})
agent.on('session/delete', (frame) => agent.reply(frame, {}))
agent.on('session/set_config_option', (frame) => agent.fail(frame, -32602, 'Model unavailable'))
const success = await createAcpModelCatalogProbe(OPENCODE, {
resolveEnvironment: async () => ({ PATH: '/usr/bin', HOME: '/home/user' }),
resolveCommand: () => '/opt/opencode/bin/opencode',
probeVersion: async () => ({ version: '2.0.29' }),
homePath: '/home/user',
dataDirectory: '/orca-data',
connectSession: () => {
const runtime = new AcpSessionRuntime(agent.stdout, agent.stdin)
return {
initialize: () => runtime.initialize(),
start: (options) => runtime.start(options),
setConfigOption: (id, value) => runtime.setConfigOption(id, value),
deleteSession: (sessionId) => runtime.deleteSession(sessionId),
close: async () => runtime.close()
}
}
})({ kind: 'opencode', locator: { kind: 'unmanaged' } }, { workspacePath: '/work/project' })
expect(sessionNews).toBe(2)
expect(success.models.map((model) => model.id)).toEqual([
'opencode/big-pickle',
'opencode/exo-free'
])
})
})
@@ -4,6 +4,7 @@ import {
type StructuredAgentResolutionOperation
} from '../../native-chat/structured-agent-command-resolution'
import { homedir } from 'node:os'
import { setTimeout as delay } from 'node:timers/promises'
import { join } from 'node:path'
import type { AgentCliVersionReader } from '../../agent-launch/preflight/agent-cli-version-probe'
import type { AgentModelCatalogProbe } from '../../native-chat/agent-model-catalog/agent-model-catalog-store'
@@ -190,6 +191,26 @@ export function createAcpModelCatalogProbe(
const folderlessListing = (spec: AcpLaunchSpec) =>
new AgentModelCatalogListingStoppedError(`${spec.agent} lists in a chat's folder`)
// OpenCode can answer -32603 while its providers are still opening; a later attempt lists them.
async function startListingSession(
connection: AcpModelCatalogSessionConnection,
workspace: string,
operation?: StructuredAgentResolutionOperation
): Promise<AcpSessionStarted> {
for (const backoffMs of [250, 500]) {
try {
return await connection.start({ cwd: workspace, mcpServers: [] })
} catch (error) {
if (!(error instanceof AcpAgentError && error.code === -32603)) {
throw error
}
}
await delay(backoffMs, undefined, { signal: operation?.signal })
assertStructuredAgentResolutionCurrent(operation)
}
return connection.start({ cwd: workspace, mcpServers: [] })
}
async function readSessionModels(
spec: AcpLaunchSpec,
listing: AcpSessionModelDiscovery,
@@ -206,7 +227,7 @@ async function readSessionModels(
if (!deletes && !listing.sessionFolderArgs) {
throw new Error(`${spec.agent} cannot delete a session, so it lists its models only in chats`)
}
const started = await connection.start({ cwd: workspace, mcpServers: [] })
const started = await startListingSession(connection, workspace, operation)
let stopped = false
const cleanup = async (): Promise<void> => {
stopped = true
@@ -6,9 +6,7 @@ import {
import type { HookCommandConfig, HookDefinition } from '../configuration/hook-config-schema'
// Match script names so reinstalls sweep entries from old and parallel installations.
export function createManagedCommandMatcher(
scriptFileName: string
): (command: string | undefined) => boolean {
export function createManagedCommandMatcher(scriptFileName: string): (command: unknown) => boolean {
const scriptStem = scriptFileName.replace(/\.(?:cmd|ps1|sh)$/, '')
// Sweep every platform suffix after a platform switch.
const needles = [
@@ -19,8 +17,9 @@ export function createManagedCommandMatcher(
]
// The native executable selects its provider through argv[1].
const nativeHook = `agent-hooks/${WINDOWS_NATIVE_HOOK_EXECUTABLE_NAME} ${getWindowsNativeHookAgent(scriptFileName)} `
// hooks.json is user-editable, so a command may not be a string.
return (command) => {
if (!command) {
if (typeof command !== 'string' || !command) {
return false
}
const decodedCommand = decodePowerShellEncodedCommand(command)

Some files were not shown because too many files have changed in this diff Show More