mirror of
https://github.com/stablyai/orca.git
synced 2026-11-16 02:47:34 +00:00
Merge origin/main before final retention deletion QA
This commit is contained in:
@@ -29,7 +29,6 @@ on:
|
||||
- 'src/main/codex-usage/scanner-incremental-append.test.ts'
|
||||
- 'src/main/usage/jsonl-file-reader.test.ts'
|
||||
- 'src/main/usage/jsonl-file-snapshot.test.ts'
|
||||
- 'src/renderer/src/lib/pane-manager/pane-terminal-output-scheduler-queue-retention.test.ts'
|
||||
- 'src/main/claude-usage/scanner-incremental-append.test.ts'
|
||||
- 'src/main/claude-usage/store-checkpoint-persistence.test.ts'
|
||||
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
id: claude-chat-entrypoint-callers
|
||||
snapshots:
|
||||
"import { withOrcaClaudeChatEntrypoint as stamp } from './claude-chat-entrypoint'":
|
||||
labels:
|
||||
- source: withOrcaClaudeChatEntrypoint
|
||||
style: primary
|
||||
start: 9
|
||||
end: 37
|
||||
'withOrcaClaudeChatEntrypoint(env, platform)':
|
||||
labels:
|
||||
- source: withOrcaClaudeChatEntrypoint
|
||||
style: primary
|
||||
start: 0
|
||||
end: 28
|
||||
@@ -0,0 +1,20 @@
|
||||
id: claude-chat-entrypoint-owner
|
||||
snapshots:
|
||||
"const env = { CLAUDE_CODE_ENTRYPOINT: 'orca' }":
|
||||
labels:
|
||||
- source: CLAUDE_CODE_ENTRYPOINT
|
||||
style: primary
|
||||
start: 14
|
||||
end: 36
|
||||
const identity = 'sdk-cli':
|
||||
labels:
|
||||
- source: sdk-cli
|
||||
style: primary
|
||||
start: 18
|
||||
end: 25
|
||||
"env['claude_code_entrypoint'] = 'other'":
|
||||
labels:
|
||||
- source: claude_code_entrypoint
|
||||
style: primary
|
||||
start: 5
|
||||
end: 27
|
||||
@@ -0,0 +1,14 @@
|
||||
id: claude-entrypoint-key-owner
|
||||
snapshots:
|
||||
"env[CLAUDE_ENTRYPOINT_ENV] = 'orca'":
|
||||
labels:
|
||||
- source: CLAUDE_ENTRYPOINT_ENV
|
||||
style: primary
|
||||
start: 4
|
||||
end: 25
|
||||
"import { CLAUDE_ENTRYPOINT_ENV as key } from './claude-chat-entrypoint'":
|
||||
labels:
|
||||
- source: CLAUDE_ENTRYPOINT_ENV
|
||||
style: primary
|
||||
start: 9
|
||||
end: 30
|
||||
@@ -0,0 +1,6 @@
|
||||
id: claude-chat-entrypoint-callers
|
||||
valid:
|
||||
- 'stripInheritedClaudeSessionEnv(env)'
|
||||
invalid:
|
||||
- 'withOrcaClaudeChatEntrypoint(env, platform)'
|
||||
- "import { withOrcaClaudeChatEntrypoint as stamp } from './claude-chat-entrypoint'"
|
||||
@@ -0,0 +1,8 @@
|
||||
id: claude-chat-entrypoint-owner
|
||||
valid:
|
||||
- 'const env = withOrcaClaudeChatEntrypoint(configured, platform)'
|
||||
- "const binary = 'orca'"
|
||||
invalid:
|
||||
- "const env = { CLAUDE_CODE_ENTRYPOINT: 'orca' }"
|
||||
- "env['claude_code_entrypoint'] = 'other'"
|
||||
- "const identity = 'sdk-cli'"
|
||||
@@ -0,0 +1,6 @@
|
||||
id: claude-entrypoint-key-owner
|
||||
valid:
|
||||
- "const binary = 'orca'"
|
||||
invalid:
|
||||
- "env[CLAUDE_ENTRYPOINT_ENV] = 'orca'"
|
||||
- "import { CLAUDE_ENTRYPOINT_ENV as key } from './claude-chat-entrypoint'"
|
||||
@@ -0,0 +1,117 @@
|
||||
id: claude-chat-entrypoint-owner
|
||||
language: typescript
|
||||
severity: error
|
||||
message: Keep the Claude identity literal in claude-chat-entrypoint.ts.
|
||||
files: ['src/**']
|
||||
ignores:
|
||||
- '**/*.test.*'
|
||||
- '**/*.test-fixtures.*'
|
||||
- '**/__fixtures__/**'
|
||||
- 'src/shared/agent-launch/startup/claude-chat-entrypoint.ts'
|
||||
rule:
|
||||
all:
|
||||
- any:
|
||||
- kind: string_fragment
|
||||
- kind: property_identifier
|
||||
- kind: identifier
|
||||
- regex: '(?i)^(CLAUDE_CODE_ENTRYPOINT|sdk-cli)$'
|
||||
---
|
||||
id: claude-chat-entrypoint-owner-tsx
|
||||
language: tsx
|
||||
severity: error
|
||||
message: Keep the Claude identity literal in claude-chat-entrypoint.ts.
|
||||
files: ['src/**']
|
||||
ignores:
|
||||
- '**/*.test.*'
|
||||
- '**/*.test-fixtures.*'
|
||||
- '**/__fixtures__/**'
|
||||
- 'src/shared/agent-launch/startup/claude-chat-entrypoint.ts'
|
||||
rule:
|
||||
all:
|
||||
- any:
|
||||
- kind: string_fragment
|
||||
- kind: property_identifier
|
||||
- kind: identifier
|
||||
- regex: '(?i)^(CLAUDE_CODE_ENTRYPOINT|sdk-cli)$'
|
||||
---
|
||||
id: claude-chat-entrypoint-callers
|
||||
language: typescript
|
||||
severity: error
|
||||
message: Only structured native chat and its own probes may apply the chat identity.
|
||||
files: ['src/**']
|
||||
ignores:
|
||||
- '**/*.test.*'
|
||||
- '**/*.test-fixtures.*'
|
||||
- '**/__fixtures__/**'
|
||||
- 'src/shared/agent-launch/startup/claude-chat-entrypoint.ts'
|
||||
- 'src/main/claude/claude-stream-json-connection.ts'
|
||||
- 'src/main/claude/claude-agent-sdk-process-spawn.ts'
|
||||
- 'src/main/claude/structured/launch/claude-structured-child-env.ts'
|
||||
- 'src/main/claude/claude-model-catalog-probe.ts'
|
||||
rule:
|
||||
all:
|
||||
- any:
|
||||
- kind: string_fragment
|
||||
- kind: property_identifier
|
||||
- kind: identifier
|
||||
- regex: '^withOrcaClaudeChatEntrypoint$'
|
||||
---
|
||||
id: claude-chat-entrypoint-callers-tsx
|
||||
language: tsx
|
||||
severity: error
|
||||
message: Only structured native chat and its own probes may apply the chat identity.
|
||||
files: ['src/**']
|
||||
ignores:
|
||||
- '**/*.test.*'
|
||||
- '**/*.test-fixtures.*'
|
||||
- '**/__fixtures__/**'
|
||||
- 'src/shared/agent-launch/startup/claude-chat-entrypoint.ts'
|
||||
- 'src/main/claude/claude-stream-json-connection.ts'
|
||||
- 'src/main/claude/claude-agent-sdk-process-spawn.ts'
|
||||
- 'src/main/claude/structured/launch/claude-structured-child-env.ts'
|
||||
- 'src/main/claude/claude-model-catalog-probe.ts'
|
||||
rule:
|
||||
all:
|
||||
- any:
|
||||
- kind: string_fragment
|
||||
- kind: property_identifier
|
||||
- kind: identifier
|
||||
- regex: '^withOrcaClaudeChatEntrypoint$'
|
||||
---
|
||||
id: claude-entrypoint-key-owner
|
||||
language: typescript
|
||||
severity: error
|
||||
message: Only the chat identity owner and inherited-session isolation may access this key directly.
|
||||
files: ['src/**']
|
||||
ignores:
|
||||
- '**/*.test.*'
|
||||
- '**/*.test-fixtures.*'
|
||||
- '**/__fixtures__/**'
|
||||
- 'src/shared/agent-launch/startup/claude-chat-entrypoint.ts'
|
||||
- 'src/shared/agent-launch/startup/claude-parent-session-env.ts'
|
||||
rule:
|
||||
all:
|
||||
- any:
|
||||
- kind: string_fragment
|
||||
- kind: property_identifier
|
||||
- kind: identifier
|
||||
- regex: '^CLAUDE_ENTRYPOINT_ENV$'
|
||||
---
|
||||
id: claude-entrypoint-key-owner-tsx
|
||||
language: tsx
|
||||
severity: error
|
||||
message: Only the chat identity owner and inherited-session isolation may access this key directly.
|
||||
files: ['src/**']
|
||||
ignores:
|
||||
- '**/*.test.*'
|
||||
- '**/*.test-fixtures.*'
|
||||
- '**/__fixtures__/**'
|
||||
- 'src/shared/agent-launch/startup/claude-chat-entrypoint.ts'
|
||||
- 'src/shared/agent-launch/startup/claude-parent-session-env.ts'
|
||||
rule:
|
||||
all:
|
||||
- any:
|
||||
- kind: string_fragment
|
||||
- kind: property_identifier
|
||||
- kind: identifier
|
||||
- regex: '^CLAUDE_ENTRYPOINT_ENV$'
|
||||
@@ -30,7 +30,6 @@
|
||||
3 test-no-in-test-import-actual:src/renderer/src/components/terminal-pane/snapshots/remote-snapshot-alt-screen-host-chain.test.ts
|
||||
1 test-no-in-test-import-actual:src/renderer/src/hooks/useIpcEvents-agent-status-pane-teardown.test.ts
|
||||
1 test-no-in-test-import-actual:src/renderer/src/hooks/useIpcEvents-agent-status-snapshot-hydration.test.ts
|
||||
1 test-no-in-test-import-actual:src/renderer/src/lib/agent-session/launch/new-tab/agent-launch-caller-routing.test.ts
|
||||
1 test-no-polling-loop:src/main/browser/cookies/browser-cookie-import-concurrency.test.ts
|
||||
1 test-no-polling-loop:src/main/claude/claude-stop-ack-race.test.ts
|
||||
1 test-no-polling-loop:src/main/claude/claude-stream-json-connection.test.ts
|
||||
@@ -635,7 +634,7 @@
|
||||
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
|
||||
3 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/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
|
||||
2 test-no-wall-clock:src/renderer/src/components/task-page/jira/task-page-jira-cache-selectors.test.ts
|
||||
2 test-no-wall-clock:src/renderer/src/components/terminal-pane/pty-connection/emulation/fish-color-scheme-child-stdin.node-pty.test.ts
|
||||
@@ -645,7 +644,6 @@
|
||||
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/hooks/useIpcEvents-agent-status-hook-titles.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
|
||||
|
||||
@@ -551,7 +551,6 @@
|
||||
2 src/main/worker-threads/forked-child-entry-path.ts
|
||||
4 src/main/workspace-hooks/hooks.ts
|
||||
10 src/main/workspace-hooks/issue-command-file.ts
|
||||
4 src/main/workspace-hooks/worktree-runner-script.ts
|
||||
1 src/main/workspaces/catalog/folder-repo-git-conversion.ts
|
||||
2 src/main/workspaces/catalog/folder-upgrade-worktree-path.ts
|
||||
3 src/main/workspaces/execution-host/project-runtime-git-router.ts
|
||||
|
||||
@@ -707,7 +707,7 @@
|
||||
6 src/renderer/src/hooks/useVirtualizedScrollAnchor.ts
|
||||
1 src/renderer/src/lib/agent-session/launch/inventory/host-chat-program-acquisition.ts
|
||||
1 src/renderer/src/lib/files/search/quick-open-file-history.ts
|
||||
2 src/renderer/src/lib/worker-auto-close.ts
|
||||
2 src/renderer/src/runtime/agent-orchestration/worker-auto-close.ts
|
||||
1 src/renderer/src/runtime/native-chat/naming/structured-chat-name-observation.ts
|
||||
1 src/renderer/src/store/plugins/appearance/plugin-icon-themes.ts
|
||||
5 src/renderer/src/store/retained-views/app-state-view.ts
|
||||
|
||||
@@ -85,9 +85,9 @@
|
||||
1 src/renderer/src/components/terminal-pane/render-health/terminal-render-desync-sentinel.ts
|
||||
1 src/renderer/src/hooks/use-now.ts
|
||||
1 src/renderer/src/lib/agent-session/hibernation/agent-hibernation-coordinator.ts
|
||||
1 src/renderer/src/lib/crash-diagnostics.ts
|
||||
1 src/renderer/src/lib/window-visibility-interval.ts
|
||||
1 src/renderer/src/lib/worker-auto-close.ts
|
||||
1 src/renderer/src/diagnostics/crash-reporting/crash-diagnostics.ts
|
||||
1 src/renderer/src/lib/window-activity/window-visibility-interval.ts
|
||||
1 src/renderer/src/runtime/agent-orchestration/worker-auto-close.ts
|
||||
1 src/renderer/src/runtime/hosts/wsl/wsl-refused-read-watch.ts
|
||||
1 src/shared/remote-runtime/control/remote-runtime-shared-control-app-heartbeat.ts
|
||||
1 src/shared/remote-runtime/remote-runtime-socket-liveness.ts
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -4622,11 +4622,9 @@
|
||||
"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/shutdown-checkpoint-restart-lifecycle.test.ts": 210,
|
||||
"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,
|
||||
"src/renderer/src/app-shell/use-profile-state-save-delay-notice.test.tsx": 293,
|
||||
"src/renderer/src/app-shell/use-visible-hosted-review-refresh.test.tsx": 572,
|
||||
"src/renderer/src/app-shell/visible-review-reporting.test.ts": 1872,
|
||||
"src/renderer/src/app-shell/workspace-view-cross-client-sync.test.tsx": 1170,
|
||||
"src/renderer/src/app-shell/worktree-creation-chat-handoff.test.tsx": 2824,
|
||||
@@ -4711,7 +4709,6 @@
|
||||
"src/renderer/src/components/automations/runs/use-automation-runs-dashboard.test.tsx": 854,
|
||||
"src/renderer/src/components/automations/use-selected-automation-run-history.test.tsx": 2104,
|
||||
"src/renderer/src/components/browser-favicon.test.tsx": 333,
|
||||
"src/renderer/src/components/browser-pane/ClientHostedBrowserPagePane.dead-guest.test.tsx": 6219,
|
||||
"src/renderer/src/components/browser-pane/ClientHostedBrowserPagePane.drag-focus.test.tsx": 5826,
|
||||
"src/renderer/src/components/browser-pane/ClientHostedBrowserPagePane.failure-remount.test.tsx": 3085,
|
||||
"src/renderer/src/components/browser-pane/ClientHostedBrowserPagePane.markup.test.tsx": 4575,
|
||||
@@ -4808,7 +4805,6 @@
|
||||
"src/renderer/src/components/dashboard-popout/preview-terminal-box-fit-lifecycle.test.ts": 192,
|
||||
"src/renderer/src/components/dashboard-popout/preview-terminal-ime-bridge-kitty-bytes.test.ts": 479,
|
||||
"src/renderer/src/components/dashboard-popout/remote-runtime-terminal-preview-api.test.ts": 81,
|
||||
"src/renderer/src/components/dashboard-popout/use-agent-dashboard-telemetry.test.ts": 2108,
|
||||
"src/renderer/src/components/dashboard-popout/useDashboardSnapshot.test.tsx": 432,
|
||||
"src/renderer/src/components/dashboard/AgentDashboardDrawer.focus.test.tsx": 2567,
|
||||
"src/renderer/src/components/dashboard/AgentDashboardDrawer.test.tsx": 1981,
|
||||
@@ -4830,14 +4826,11 @@
|
||||
"src/renderer/src/components/diff-comments/diff-comment-popover-outside-click.test.tsx": 1889,
|
||||
"src/renderer/src/components/diff-comments/useDiffCommentDecorator.lifecycle.test.tsx": 2669,
|
||||
"src/renderer/src/components/diff-comments/useDiffCommentDecorator.range-selection.test.tsx": 1782,
|
||||
"src/renderer/src/components/editor/check-details/panel/CheckRunDetailsPanel.captured-failure.test.tsx": 2412,
|
||||
"src/renderer/src/components/editor/check-details/panel/CheckRunDetailsPanel.copy.test.tsx": 3108,
|
||||
"src/renderer/src/components/editor/check-details/panel/CheckRunDetailsPanel.log-outcomes.test.tsx": 3230,
|
||||
"src/renderer/src/components/editor/DiagramViewerModal.test.tsx": 2539,
|
||||
"src/renderer/src/components/editor/diff/sections/DiffSectionBody.word-wrap-lifecycle.test.tsx": 3036,
|
||||
"src/renderer/src/components/editor/diff/monaco-view/DiffViewer.word-wrap-lifecycle.test.tsx": 2499,
|
||||
"src/renderer/src/components/editor/EditorConflictReviewSurface.live-record.test.tsx": 1193,
|
||||
"src/renderer/src/components/editor/EditorContent.monaco-lifecycle.test.tsx": 3162,
|
||||
"src/renderer/src/components/editor/EditorEditFileSurface.monaco-containment.test.tsx": 2666,
|
||||
"src/renderer/src/components/editor/EditorFileLoadErrorView.test.tsx": 660,
|
||||
"src/renderer/src/components/editor/EditorFileLocationMenuItems.test.tsx": 846,
|
||||
@@ -4849,17 +4842,13 @@
|
||||
"src/renderer/src/components/editor/notebook/document/IpynbRendering.test.tsx": 2143,
|
||||
"src/renderer/src/components/editor/markdown-preview/surface/MarkdownPreview.link-routing.interaction.test.tsx": 1127,
|
||||
"src/renderer/src/components/editor/MediaViewer.test.tsx": 308,
|
||||
"src/renderer/src/components/editor/MermaidViewer.test.tsx": 3079,
|
||||
"src/renderer/src/components/editor/MonacoEditor.owner-view-state.test.tsx": 7073,
|
||||
"src/renderer/src/components/editor/PdfFind.test.tsx": 581,
|
||||
"src/renderer/src/components/editor/PluginBytesCustomEditorSurface.test.tsx": 641,
|
||||
"src/renderer/src/components/editor/PluginEditorNeedsDesktopNotice.test.tsx": 2107,
|
||||
"src/renderer/src/components/editor/PluginFileTypeSuggestion.test.tsx": 2062,
|
||||
"src/renderer/src/components/editor/rich-markdown/instance/RichMarkdownEditor.focus-leave.test.tsx": 4927,
|
||||
"src/renderer/src/components/editor/rich-markdown/instance/RichMarkdownErrorBoundary.lazy-chunk.test.tsx": 367,
|
||||
"src/renderer/src/components/editor/ai-vault-session-log-content.test.tsx": 1899,
|
||||
"src/renderer/src/components/editor/check-details/actions/check-annotation-path.test.ts": 53,
|
||||
"src/renderer/src/components/editor/check-details/reading/check-details-reading-viewport.test.ts": 259,
|
||||
"src/renderer/src/components/editor/model-lifetime/retention/closed-editor-model-lifetime.test.ts": 7921,
|
||||
"src/renderer/src/components/editor/model-lifetime/retention/closed-editor-model-shell.test.tsx": 4492,
|
||||
"src/renderer/src/components/editor/model-lifetime/retention/closed-editor-tab-disposal.test.ts": 121,
|
||||
@@ -4963,7 +4952,6 @@
|
||||
"src/renderer/src/components/editor/monaco-programmatic-sync.test.ts": 46,
|
||||
"src/renderer/src/components/editor/pdf-orca-media-range-transport.test.ts": 282,
|
||||
"src/renderer/src/components/editor/pdf-view-position.test.ts": 74,
|
||||
"src/renderer/src/components/editor/pdf-viewer-failed-load-recovery.test.tsx": 2363,
|
||||
"src/renderer/src/components/editor/pdf-viewer-zoom-ownership.test.tsx": 789,
|
||||
"src/renderer/src/components/editor/plugin-custom-editor-host.test.ts": 480,
|
||||
"src/renderer/src/components/editor/rich-markdown/raw-source/raw-markdown-html-line-break.test.ts": 2188,
|
||||
@@ -5034,7 +5022,6 @@
|
||||
"src/renderer/src/components/editor/use-monaco-editor-mount.cursor-owner.test.tsx": 1332,
|
||||
"src/renderer/src/components/editor/use-monaco-editor-mount.stale-cache.test.tsx": 877,
|
||||
"src/renderer/src/components/editor/use-monaco-reveal-scheduler.test.tsx": 273,
|
||||
"src/renderer/src/components/editor/use-pdf-viewer-find-shortcut.test.tsx": 907,
|
||||
"src/renderer/src/components/editor/use-preserve-section-during-external-edit.test.tsx": 268,
|
||||
"src/renderer/src/components/editor/rich-markdown/tables/use-rich-markdown-table-context-menu.test.tsx": 2238,
|
||||
"src/renderer/src/components/editor/external-changes/useEditorPanelExternalContentEvents.test.tsx": 2018,
|
||||
@@ -5042,7 +5029,6 @@
|
||||
"src/renderer/src/components/editor/useEditorPanelHostUnresolvedContentState.test.tsx": 1952,
|
||||
"src/renderer/src/components/editor/notebook/kernel/useIpynbCellExecution.test.tsx": 695,
|
||||
"src/renderer/src/components/editor/notebook/document/useIpynbDocumentEditing.test.tsx": 2192,
|
||||
"src/renderer/src/components/editor/notebook/document/useIpynbScrollRestoration.test.tsx": 323,
|
||||
"src/renderer/src/components/editor/rich-markdown/links/useLinkBubble.test.tsx": 493,
|
||||
"src/renderer/src/components/editor/rich-markdown/images/useLocalImagePick.test.tsx": 1319,
|
||||
"src/renderer/src/components/editor/document-images/useLocalImageSrc.test.ts": 736,
|
||||
@@ -5066,11 +5052,7 @@
|
||||
"src/renderer/src/components/emulator-pane/emulator-screen-stream-content.test.tsx": 408,
|
||||
"src/renderer/src/components/emulator-pane/use-emulator-pane-session.test.tsx": 1968,
|
||||
"src/renderer/src/components/emulator-pane/use-mobile-emulator-tab-intro-actions.test.tsx": 1828,
|
||||
"src/renderer/src/components/error-boundaries/RecoverableRenderErrorBoundary.lazy-chunk.test.tsx": 451,
|
||||
"src/renderer/src/components/error-boundaries/RecoverableRenderErrorBoundary.never-landed-reload.test.tsx": 449,
|
||||
"src/renderer/src/components/feature-tips/ChatUiHereCornerCard.test.tsx": 2798,
|
||||
"src/renderer/src/components/feature-tips/ChatUiHereFeatureTipVisual.test.tsx": 1093,
|
||||
"src/renderer/src/components/feature-tips/ChatUiHereTip.test.tsx": 6788,
|
||||
"src/renderer/src/components/feature-tips/feature-tip-modal-state.test.ts": 244,
|
||||
"src/renderer/src/components/feature-wall/FeatureWallSetupWorkflowActions.test.tsx": 2028,
|
||||
"src/renderer/src/components/feature-wall/FullDiskAccessSetupPrompt.test.ts": 466,
|
||||
@@ -5215,7 +5197,6 @@
|
||||
"src/renderer/src/components/native-chat/attachments/intake/native-chat-composer-drop-scope.test.tsx": 1409,
|
||||
"src/renderer/src/components/native-chat/attachments/intake/native-chat-composer-ime-file-drop.test.tsx": 1326,
|
||||
"src/renderer/src/components/native-chat/drafts/native-chat-composer-prompt-recall.test.tsx": 1724,
|
||||
"src/renderer/src/components/native-chat/composer/focus/native-chat-composer-reveal-focus.test.tsx": 526,
|
||||
"src/renderer/src/components/native-chat/attachments/intake/native-chat-composer-workspace-file-drop.test.tsx": 1166,
|
||||
"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,
|
||||
@@ -5279,7 +5260,6 @@
|
||||
"src/renderer/src/components/native-chat/conversation/projection/use-native-chat-context-clear-floor.test.tsx": 271,
|
||||
"src/renderer/src/components/native-chat/pane/actions/use-native-chat-context-menu.targets.test.tsx": 3071,
|
||||
"src/renderer/src/components/native-chat/attachments/intake/use-native-chat-external-attachments.test.tsx": 797,
|
||||
"src/renderer/src/components/native-chat/viewport/find/use-native-chat-find.test.tsx": 1458,
|
||||
"src/renderer/src/components/native-chat/session/status/use-native-chat-hook-status.test.ts": 1927,
|
||||
"src/renderer/src/components/native-chat/host-access/use-native-chat-host-outage.test.tsx": 2131,
|
||||
"src/renderer/src/components/native-chat/drafts/use-native-chat-launch-draft-adoption.test.tsx": 319,
|
||||
@@ -5328,7 +5308,6 @@
|
||||
"src/renderer/src/components/new-workspace/use-recent-project-ids.test.ts": 1730,
|
||||
"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/OnboardingInlineCommandTerminal.command-finished.test.tsx": 681,
|
||||
"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,
|
||||
@@ -5392,7 +5371,6 @@
|
||||
"src/renderer/src/components/right-sidebar/ai-vault/scanning/ai-vault-panel-session-list-request.test.tsx": 3044,
|
||||
"src/renderer/src/components/right-sidebar/ai-vault/search/ai-vault-search-session.test.ts": 201,
|
||||
"src/renderer/src/components/right-sidebar/ai-vault/accounts/ai-vault-session-account-render.test.tsx": 2885,
|
||||
"src/renderer/src/components/right-sidebar/ai-vault/scanning/ai-vault-session-conditional-refresh-hook.test.tsx": 2370,
|
||||
"src/renderer/src/components/right-sidebar/ai-vault/session-list/ai-vault-session-filters.test.ts": 105,
|
||||
"src/renderer/src/components/right-sidebar/ai-vault/scope/ai-vault-session-projects.test.ts": 117,
|
||||
"src/renderer/src/components/right-sidebar/ai-vault/scanning/ai-vault-session-refresh.test.ts": 2034,
|
||||
@@ -5408,7 +5386,6 @@
|
||||
"src/renderer/src/components/right-sidebar/checks-panel/gitlab-review-client.test.ts": 321,
|
||||
"src/renderer/src/components/right-sidebar/checks-panel/comments/review-comment-markdown.test.tsx": 2171,
|
||||
"src/renderer/src/components/right-sidebar/checks-panel/refresh/use-checks-panel-manual-refresh-recovery.test.tsx": 2909,
|
||||
"src/renderer/src/components/right-sidebar/checks-panel/refresh/use-checks-panel-polling.test.tsx": 2189,
|
||||
"src/renderer/src/lib/repository-refresh/coalesced-poll-runner.test.ts": 61,
|
||||
"src/renderer/src/components/right-sidebar/file-explorer/mutations/file-explorer-delete-undo-precondition.test.tsx": 2023,
|
||||
"src/renderer/src/components/right-sidebar/file-explorer/tree/file-explorer-dir-pages.test.ts": 1767,
|
||||
@@ -5430,7 +5407,6 @@
|
||||
"src/renderer/src/components/right-sidebar/plugin-panels/health/plugin-panel-watchdog.test.ts": 116,
|
||||
"src/renderer/src/components/right-sidebar/checks-panel/comments/pr-comments-ai-launch-ack.test.ts": 118,
|
||||
"src/renderer/src/components/right-sidebar/checks-panel/comments/pr-comments-list-selection.test.tsx": 3290,
|
||||
"src/renderer/src/components/right-sidebar/right-sidebar-titlebar-drag-regions.render.test.tsx": 1044,
|
||||
"src/renderer/src/components/right-sidebar/source-control/ai/runSourceControlAgentActionStart.test.ts": 1917,
|
||||
"src/renderer/src/components/right-sidebar/source-control/review/source-control-create-pr-intent-flow.test.ts": 71,
|
||||
"src/renderer/src/components/right-sidebar/source-control/review/source-control-manual-review-url.test.ts": 77,
|
||||
@@ -5475,7 +5451,6 @@
|
||||
"src/renderer/src/components/settings/browser/BrowserSitePermissionsSetting.test.tsx": 739,
|
||||
"src/renderer/src/components/settings/browser/BrowserUserAgentSetting.test.tsx": 2325,
|
||||
"src/renderer/src/components/settings/chat/ChatNamingSetting.test.tsx": 2454,
|
||||
"src/renderer/src/components/settings/chat/ChatPermissionSetting.test.tsx": 834,
|
||||
"src/renderer/src/components/settings/chat/ChatSettingsSection.test.tsx": 2718,
|
||||
"src/renderer/src/lib/skills/runtime/skill-runtime-command.test.ts": 1670,
|
||||
"src/renderer/src/components/settings/virtual-machines/recipes/EphemeralVmsPane.test.tsx": 1025,
|
||||
@@ -5488,7 +5463,6 @@
|
||||
"src/renderer/src/components/settings/advanced/network/NodeDistMirrorDialog.test.tsx": 2412,
|
||||
"src/renderer/src/components/plugins/list/PluginsSettingsSection.lifecycle.test.tsx": 5402,
|
||||
"src/renderer/src/components/settings/runtime-environments/pairing/RuntimePairingGeneratorForm.test.tsx": 461,
|
||||
"src/renderer/src/components/settings/session-history/SessionHistorySettingsPane.test.tsx": 1474,
|
||||
"src/renderer/src/components/settings/appearance/fonts/FontAutocomplete.test.tsx": 1202,
|
||||
"src/renderer/src/components/settings/form-controls/SettingsFormControls.segmented-control.test.tsx": 730,
|
||||
"src/renderer/src/components/settings/shortcuts/ShortcutFilterRail.test.ts": 273,
|
||||
@@ -5503,7 +5477,6 @@
|
||||
"src/renderer/src/components/settings/TerminalAppearanceSection.ghostty.test.ts": 549,
|
||||
"src/renderer/src/components/settings/terminal/appearance/TerminalContrastSetting.test.tsx": 798,
|
||||
"src/renderer/src/components/settings/terminal/session-management/TerminalLimitSetting.test.tsx": 1015,
|
||||
"src/renderer/src/components/settings/terminal/TerminalPane.section-lifetime.test.tsx": 1237,
|
||||
"src/renderer/src/components/settings/developer-permissions/TerminalTccAttributionNotice.test.tsx": 401,
|
||||
"src/renderer/src/components/settings/voice/VoiceMicrophoneSetting.test.tsx": 957,
|
||||
"src/renderer/src/components/settings/voice/VoicePane.test.tsx": 1042,
|
||||
@@ -5538,7 +5511,6 @@
|
||||
"src/renderer/src/components/session-search/use-session-search-status.test.tsx": 477,
|
||||
"src/renderer/src/components/settings/accounts/usage/use-zcode-plan-credentials.test.tsx": 880,
|
||||
"src/renderer/src/components/setup-guide/SetupGuideModal.mount-gating.test.tsx": 2348,
|
||||
"src/renderer/src/components/shared/MacFolderAccessFixDialog.test.tsx": 1356,
|
||||
"src/renderer/src/components/shared/kill-all-terminal-surfaces.test.ts": 1925,
|
||||
"src/renderer/src/components/shared/useDaemonActions.test.tsx": 332,
|
||||
"src/renderer/src/components/sidebar/host-admission/ssh/AddRemoteHostDialog.config-picker.test.tsx": 1178,
|
||||
@@ -5560,7 +5532,6 @@
|
||||
"src/renderer/src/components/sidebar/SeveredTerminalDaemonBanner.test.tsx": 574,
|
||||
"src/renderer/src/components/sidebar/Sidebar.test.tsx": 833,
|
||||
"src/renderer/src/components/sidebar/SidebarAgentsList.test.tsx": 2985,
|
||||
"src/renderer/src/components/sidebar/sidebar-feedback/SidebarFeedbackDialog.test.tsx": 2529,
|
||||
"src/renderer/src/components/sidebar/StalledTerminalDaemonBanner.test.tsx": 320,
|
||||
"src/renderer/src/components/sidebar/workspace-board/viewport/WorkspaceKanbanLaneGrid.test.tsx": 360,
|
||||
"src/renderer/src/components/sidebar/workspace-card/surface/WorktreeCard.single-reference-details.test.tsx": 2032,
|
||||
@@ -5663,7 +5634,6 @@
|
||||
"src/renderer/src/components/stats/usage-daily-chart.test.tsx": 333,
|
||||
"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/PortsStatusSegment.render-stability.test.tsx": 2161,
|
||||
|
||||
"src/renderer/src/components/status-bar/SshStatusSegment.large-host-list.test.tsx": 1838,
|
||||
"src/renderer/src/components/status-bar/StatusBarUsageChangeNotices.test.tsx": 785,
|
||||
@@ -5685,7 +5655,6 @@
|
||||
"src/renderer/src/components/status-bar/use-resource-pty-actions.test.tsx": 879,
|
||||
"src/renderer/src/components/status-bar/use-resource-usage-derived-model.test.tsx": 742,
|
||||
"src/renderer/src/components/tab-bar/CopyTabIdMenuItem.test.tsx": 428,
|
||||
"src/renderer/src/components/tab-bar/NativeChatNamingFailure.test.tsx": 1062,
|
||||
"src/renderer/src/components/tab-bar/TabBarCreateEntry.search.test.tsx": 3224,
|
||||
"src/renderer/src/components/tab-bar/TabBarItemRow.test.tsx": 2116,
|
||||
"src/renderer/src/components/tab-bar/TabBarQuickCommandItem.test.tsx": 384,
|
||||
@@ -5808,7 +5777,6 @@
|
||||
"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,
|
||||
"src/renderer/src/components/terminal-pane/layout/close/pending-split-close.test.ts": 4680,
|
||||
"tests/e2e/terminal-agent-pane-launch.unit.test.ts": 8045,
|
||||
"src/renderer/src/components/terminal-pane/snapshots/pty-buffer-serializer.test.ts": 53,
|
||||
"src/renderer/src/components/terminal-pane/pty-connection/agent-identity/pty-connection-command-finished-late-done.test.ts": 10940,
|
||||
"src/renderer/src/components/terminal-pane/pty-connection/tests/pty-connection-completion-and-notification.test.ts": 18380,
|
||||
@@ -5856,7 +5824,6 @@
|
||||
"src/renderer/src/components/terminal-pane/pty-connection/host-ownership/unserved-ssh-pane-bridge.test.ts": 70,
|
||||
"src/renderer/src/components/terminal-pane/pty-transport/delivery/pty-dispatcher-delivery-resync.test.ts": 85,
|
||||
"src/renderer/src/components/terminal-pane/pty-transport/delivery/pty-dispatcher-pi-routing.test.ts": 1362,
|
||||
"src/renderer/src/components/terminal-pane/pty-transport/delivery/pty-dispatcher-push-reattach.test.ts": 108,
|
||||
"src/renderer/src/components/terminal-pane/pty-transport/input/pty-input-write-queue.test.ts": 787,
|
||||
"src/renderer/src/components/terminal-pane/pty-transport/delivery/pty-model-restore-channel.test.ts": 44,
|
||||
"src/renderer/src/components/terminal-pane/pty-transport/output/pty-output-processor-program-activity.test.ts": 160,
|
||||
@@ -5893,7 +5860,6 @@
|
||||
"src/renderer/src/components/terminal-pane/pty-transport/remote-runtime/remote-runtime-pty-query-reply-immediate.test.ts": 1556,
|
||||
"src/renderer/src/components/terminal-pane/pty-transport/remote-runtime/recovery/remote-runtime-pty-recovery-state.test.ts": 85,
|
||||
"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-attach-subscription.test.ts": 2346,
|
||||
"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,
|
||||
@@ -5994,10 +5960,8 @@
|
||||
"src/renderer/src/components/terminal-pane/layout/reconciliation/terminal-pane-frame-reconciliation.test.ts": 903,
|
||||
"src/renderer/src/components/terminal-pane/host-state/terminal-pane-host-state-memo.test.ts": 4534,
|
||||
"src/renderer/src/components/terminal-pane/mounting/terminal-pane-mount-bootstrap.test.ts": 1723,
|
||||
"src/renderer/src/components/terminal-pane/render-health/recovery/terminal-pane-recovery-unsettled-fallback.test.ts": 831,
|
||||
"src/renderer/src/components/terminal-pane/render-health/recovery/terminal-pane-recovery.test.ts": 949,
|
||||
"src/renderer/src/components/terminal-pane/layout/split/terminal-pane-split-request-routing.test.ts": 2015,
|
||||
"src/renderer/src/components/terminal-pane/pty-transport/recovery/terminal-pane-surface-ownership.test.ts": 426,
|
||||
"src/renderer/src/components/terminal-pane/layout/detach/terminal-pane-tab-detach-main-commit.test.ts": 2090,
|
||||
"src/renderer/src/components/terminal-pane/layout/detach/terminal-pane-tab-detach-main-move.test.ts": 2147,
|
||||
"src/renderer/src/components/terminal-pane/parking/verdict/terminal-park-verdict-flip-telemetry.test.ts": 123,
|
||||
@@ -6187,7 +6151,6 @@
|
||||
"src/renderer/src/hooks/useImmediateMutation.test.ts": 618,
|
||||
"src/renderer/src/hooks/skills/discovery/useInstalledAgentSkills.react.test.tsx": 2093,
|
||||
"src/renderer/src/hooks/useIpcEvents-agent-status-connection-attribution.test.ts": 5510,
|
||||
"src/renderer/src/hooks/useIpcEvents-agent-status-hook-titles.test.ts": 5621,
|
||||
"src/renderer/src/hooks/useIpcEvents-agent-status-pane-teardown.test.ts": 5268,
|
||||
"src/renderer/src/hooks/useIpcEvents-agent-status-queue-ordering.test.ts": 3680,
|
||||
"src/renderer/src/hooks/useIpcEvents-agent-status-snapshot-hydration.test.ts": 7403,
|
||||
@@ -6204,7 +6167,6 @@
|
||||
"src/renderer/src/hooks/useIpcEvents-runtime-environment-selectors.test.ts": 530,
|
||||
"src/renderer/src/hooks/useIpcEvents-session-tab-close-request.test.ts": 2252,
|
||||
"src/renderer/src/hooks/useIssueMetadata.test.tsx": 344,
|
||||
"src/renderer/src/hooks/useMacTccAttributionSeveredNotice.test.tsx": 2358,
|
||||
"src/renderer/src/hooks/useMetadataListRequest.test.tsx": 266,
|
||||
"src/renderer/src/hooks/useModalReturnFocus.test.tsx": 1938,
|
||||
"src/renderer/src/hooks/clipboard/primary-selection/usePrimarySelectionPaste.terminal-native-paste.test.tsx": 388,
|
||||
@@ -6240,8 +6202,6 @@
|
||||
"src/renderer/src/lib/agent-session/hibernation/agent-hibernation-pane-age.test.ts": 41,
|
||||
"src/renderer/src/lib/agent-session/hibernation/agent-hibernation-planner.test.ts": 341,
|
||||
"src/renderer/src/lib/agent-session/hibernation/agent-hibernation-runtime-liveness-race.test.ts": 1914,
|
||||
"src/renderer/src/lib/agent-session/launch/new-tab/agent-launch-caller-prompt-transport.test.ts": 1326,
|
||||
"src/renderer/src/lib/agent-session/launch/new-tab/agent-launch-caller-routing.test.ts": 1266,
|
||||
"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,
|
||||
@@ -6312,7 +6272,6 @@
|
||||
"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/crash-diagnostics.test.ts": 176,
|
||||
"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,
|
||||
@@ -6324,8 +6283,7 @@
|
||||
"src/renderer/src/runtime/repo-hooks/ensure-hooks-confirmed.test.ts": 799,
|
||||
"src/renderer/src/lib/simulator/tabs/ensure-simulator-tab-behavior.test.ts": 3601,
|
||||
"src/renderer/src/runtime/hosts/platform/execution-host-facts.test.ts": 1796,
|
||||
"src/renderer/src/lib/feature-education-telemetry.test.ts": 52,
|
||||
"src/renderer/src/lib/feedback-image-attachments.test.ts": 557,
|
||||
"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/components/terminal-pane/parking/retention/foreground-terminal-tabs.test.ts": 55,
|
||||
@@ -6351,10 +6309,7 @@
|
||||
"src/renderer/src/lib/workspace/creation/work-item/launch-work-item-direct-accepted.test.tsx": 2754,
|
||||
"src/renderer/src/lib/workspace/creation/work-item/launch-work-item-direct-defaults.test.ts": 1594,
|
||||
"src/renderer/src/lib/workspace/creation/work-item/launch-work-item-direct-setup.test.tsx": 3435,
|
||||
"src/renderer/src/lib/lazy-chunk-recovery-reload.test.ts": 246,
|
||||
"src/renderer/src/lib/lazy-with-retry.never-landed-reload.test.ts": 194,
|
||||
"src/renderer/src/lib/lazy-with-retry.preload.test.tsx": 208,
|
||||
"src/renderer/src/lib/lazy-with-retry.test.ts": 282,
|
||||
"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,
|
||||
@@ -6384,7 +6339,6 @@
|
||||
"src/renderer/src/lib/pane-manager/pane-cursor-blink-suspension.test.ts": 429,
|
||||
"src/renderer/src/lib/pane-manager/pane-drag-window-blur.test.ts": 618,
|
||||
"src/renderer/src/lib/pane-manager/pane-fit-resize-observer.test.ts": 94,
|
||||
"src/renderer/src/lib/pane-manager/pane-fit.test.ts": 166,
|
||||
"src/renderer/src/lib/pane-manager/pane-inline-image-recovery.test.ts": 61,
|
||||
"src/renderer/src/lib/pane-manager/pane-inline-images.test.ts": 74,
|
||||
"src/renderer/src/lib/pane-manager/pane-layout-geometry-apply.test.ts": 897,
|
||||
@@ -6394,11 +6348,6 @@
|
||||
"src/renderer/src/lib/pane-manager/pane-terminal-foreground-render-settle.test.ts": 43,
|
||||
"src/renderer/src/lib/pane-manager/pane-terminal-mouse-wheel.test.ts": 88,
|
||||
"src/renderer/src/lib/pane-manager/pane-terminal-output-queue-chunks.test.ts": 44,
|
||||
"src/renderer/src/lib/pane-manager/pane-terminal-output-scheduler-ack-credit.test.ts": 173,
|
||||
"src/renderer/src/lib/pane-manager/pane-terminal-output-scheduler-disposed-writes.test.ts": 121,
|
||||
"src/renderer/src/lib/pane-manager/pane-terminal-output-scheduler-queue-retention.test.ts": 301,
|
||||
"src/renderer/src/lib/pane-manager/pane-terminal-output-scheduler-synchronized-frames.test.ts": 213,
|
||||
"src/renderer/src/lib/pane-manager/pane-terminal-output-scheduler.test.ts": 236,
|
||||
"src/renderer/src/lib/pane-manager/pane-tree-equalization-parity.test.ts": 182,
|
||||
"src/renderer/src/lib/pane-manager/pane-tree-equalization-scaling.test.ts": 239,
|
||||
"src/renderer/src/lib/pane-manager/pane-tree-match-moves.test.ts": 662,
|
||||
@@ -6415,7 +6364,6 @@
|
||||
"src/renderer/src/lib/pane-manager/terminal-indic-cluster-ranges.test.ts": 50,
|
||||
"src/renderer/src/lib/pane-manager/terminal-kitty-file-reader.test.ts": 83,
|
||||
"src/renderer/src/lib/pane-manager/terminal-ligatures-addon.test.ts": 59,
|
||||
"src/renderer/src/lib/pane-manager/terminal-link-provider-guard.test.ts": 48,
|
||||
"src/renderer/src/lib/pane-manager/terminal-linkifier-hover-reset-on-write.test.ts": 59,
|
||||
"src/renderer/src/lib/pane-manager/terminal-mouse-encoding-tracker.test.ts": 95,
|
||||
"src/renderer/src/lib/pane-manager/terminal-mouse-report-finite-coordinates.test.ts": 272,
|
||||
@@ -6433,7 +6381,6 @@
|
||||
"src/renderer/src/lib/pane-manager/xterm-instance-disposed.test.ts": 57,
|
||||
"src/renderer/src/lib/pane-manager/xterm-parse-barrier.test.ts": 154,
|
||||
"src/renderer/src/lib/pane-manager/xterm-user-scrolling-contract.test.ts": 1266,
|
||||
"src/renderer/src/lib/pane-manager/xterm-write-callback-guard.test.ts": 53,
|
||||
"src/renderer/src/components/terminal-pane/session-restore/spawn-deferral/pane-spawn-deferral-drain.test.ts": 61,
|
||||
"src/renderer/src/components/terminal-pane/mounting/parked-terminal-host-hydration.test.ts": 274,
|
||||
"src/renderer/src/lib/text-input/paste/paste-payload-metadata.test.ts": 53,
|
||||
@@ -6448,15 +6395,10 @@
|
||||
"src/renderer/src/lib/workspace/creation/project-clone-url-prefill.test.ts": 61,
|
||||
"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/react-commit-cascade-observer.react185.test.tsx": 285,
|
||||
"src/renderer/src/lib/react-commit-cascade-observer.test.ts": 189,
|
||||
"src/renderer/src/lib/react-commit-cascade-telemetry.test.ts": 159,
|
||||
"src/renderer/src/lib/react-error-boundary-reporting.test.ts": 55,
|
||||
"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/lib/renderer-app-platform.test.ts": 197,
|
||||
"src/renderer/src/lib/renderer-memory-profile.test.ts": 70,
|
||||
"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,
|
||||
@@ -6479,7 +6421,6 @@
|
||||
"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/shutdown-checkpoint-guard.test.ts": 209,
|
||||
"src/renderer/src/lib/sidebar-ended-creations.test.ts": 1889,
|
||||
"src/renderer/src/lib/sidebar-pending-layer.test.ts": 338,
|
||||
"src/renderer/src/lib/sidebar-shadow/workspace-activity-shadow.test.ts": 1728,
|
||||
@@ -6490,7 +6431,7 @@
|
||||
"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/lib/state-collection-byte-estimate.test.ts": 86,
|
||||
"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,
|
||||
@@ -6515,8 +6456,6 @@
|
||||
"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/lib/window-visibility-interval.test.ts": 48,
|
||||
"src/renderer/src/lib/window-visibility-timeout-poller.test.ts": 207,
|
||||
"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,
|
||||
@@ -6625,11 +6564,6 @@
|
||||
"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/browser/creation/web-runtime-session-browser-create-split-placement.test.ts": 949,
|
||||
"src/renderer/src/runtime/web-session-tabs-sync/closing/web-runtime-session-tab-activate-close.test.ts": 1426,
|
||||
"src/renderer/src/runtime/hosted-terminals/actions/web-runtime-session-terminal-pane-delegation.test.ts": 1341,
|
||||
"src/renderer/src/runtime/hosted-terminals/creation/web-runtime-session-terminal-workspace-routing.test.ts": 768,
|
||||
"src/renderer/src/runtime/web-session-tabs-sync/inventory/web-runtime-session.test.ts": 743,
|
||||
"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,
|
||||
@@ -6638,7 +6572,6 @@
|
||||
"src/renderer/src/runtime/web-session-tabs-sync/subscriptions/web-session-tabs-stream-end-resubscribe.test.tsx": 2282,
|
||||
"src/renderer/src/runtime/web-session-tabs-sync/agent-status/web-session-tabs-sync-agent-status.test.ts": 987,
|
||||
"src/renderer/src/runtime/web-session-tabs-sync/placement/web-session-tabs-sync-browser-tabs.test.ts": 925,
|
||||
"src/renderer/src/runtime/web-session-tabs-sync/subscriptions/web-session-tabs-sync-completion-on-reveal.test.tsx": 2249,
|
||||
"src/renderer/src/runtime/web-session-tabs-sync/identity/web-session-tabs-sync-cross-runtime-worktree.test.ts": 964,
|
||||
"src/renderer/src/runtime/web-session-tabs-sync/placement/web-session-tabs-sync-editor-ownership.test.ts": 1902,
|
||||
"src/renderer/src/runtime/web-session-tabs-sync/placement/web-session-tabs-sync-editor-tabs.test.ts": 1073,
|
||||
@@ -6732,7 +6665,6 @@
|
||||
"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/workspaces/creation/active-workspace-create-actions.test.ts": 1879,
|
||||
"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,
|
||||
@@ -8009,7 +7941,6 @@
|
||||
"tests/e2e/terminal-binding-crash-hydration.unit.test.ts": 1769,
|
||||
"tests/e2e/terminal-foreground-confirmation.unit.test.ts": 644,
|
||||
"tests/e2e/terminal-perf-presentation.unit.test.ts": 60,
|
||||
"tests/e2e/web-runtime-session-terminal-host-authority.unit.test.ts": 1061,
|
||||
"tests/e2e/worktree-status-warning.unit.test.ts": 2331,
|
||||
"tests/tools/branch-line-total-renderer.test.mjs": 1222,
|
||||
"tests/tools/omp-close-lifecycle.test.mjs": 403,
|
||||
|
||||
@@ -27,8 +27,6 @@ const NODE_RUNTIME_INCLUDE = [
|
||||
'src/main/browser/extensions/native-messaging/browser-extension-native-host-process-backpressure.test.ts',
|
||||
'src/main/daemon/providers/lifecycle/testing/daemon-init-provider-installation.test.ts',
|
||||
'src/renderer/src/components/terminal-pane/pty-transport/input/pty-input-write-queue.test.ts',
|
||||
'src/renderer/src/lib/react-commit-cascade-observer.test.ts',
|
||||
'src/renderer/src/lib/react-commit-cascade-telemetry.test.ts',
|
||||
// Asserts payloads are collected; Bun's GC scans the stack conservatively and may keep one alive.
|
||||
'src/shared/ws-inbound-message-queue.test.ts',
|
||||
'src/renderer/src/lib/agent-session/history/title-sync/ai-vault-tab-title-sync-inputs.test.ts',
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
"../src/cli/runtime/runtime-pid-liveness.ts",
|
||||
"../src/renderer/src/store/slices/worktrees/create/worktree-create-payload.ts",
|
||||
"../src/renderer/src/runtime/repo-hooks/orca-hook-trust.ts",
|
||||
"../src/renderer/src/lib/sha256.ts",
|
||||
"../src/renderer/src/components/native-chat/native-chat-resolution-receipt.ts",
|
||||
"../src/renderer/src/components/native-chat/structured-agent-question-projection.ts",
|
||||
"../src/renderer/src/components/native-chat/subagents/native-chat-subagent-delegation.ts",
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
"exclude": [
|
||||
"../src/renderer/src/lib/agent-session/launch/new-tab/launch-agent-in-new-tab-main-surface.test.ts",
|
||||
"../src/renderer/src/components/task-page/linear/task-page-linear-detail-query.test.tsx",
|
||||
"../tests/e2e/terminal-agent-pane-launch.unit.test.ts",
|
||||
"../src/renderer/src/runtime/provider-accounts/observations/provider-account-observation.test-fixture.ts",
|
||||
"../src/shared/**/*.test.ts",
|
||||
"../src/shared/**/*.test.tsx",
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
"../src/main/runtime/orchestration/terminal-authority/structured-sessions/structured-chat-coordinator-mail.test.ts",
|
||||
"../src/main/runtime/rpc/methods/orchestration/orchestration-check-ambiguous-caller.test.ts",
|
||||
"../src/renderer/src/components/task-page/linear/task-page-linear-detail-query.test.tsx",
|
||||
"../tests/e2e/terminal-agent-pane-launch.unit.test.ts",
|
||||
"../src/renderer/src/runtime/observed-provider-accounts.test.tsx",
|
||||
"../src/renderer/src/components/status-bar/ClaudeSwitcherMenu.observation.test.tsx",
|
||||
"../src/renderer/src/runtime/provider-accounts/observations/provider-account-observation.test-fixture.ts",
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
"exclude": [
|
||||
"../src/renderer/src/lib/agent-session/launch/new-tab/launch-agent-in-new-tab-main-surface.test.ts",
|
||||
"../src/renderer/src/components/task-page/linear/task-page-linear-detail-query.test.tsx",
|
||||
"../tests/e2e/terminal-agent-pane-launch.unit.test.ts",
|
||||
"../src/renderer/src/runtime/provider-accounts/observations/provider-account-observation.test-fixture.ts"
|
||||
],
|
||||
"compilerOptions": {
|
||||
|
||||
@@ -17,7 +17,6 @@ const contracts = [
|
||||
'src/main/codex-usage/scanner-incremental-append.test.ts',
|
||||
'src/main/usage/jsonl-file-reader.test.ts',
|
||||
'src/main/usage/jsonl-file-snapshot.test.ts',
|
||||
'src/renderer/src/lib/pane-manager/pane-terminal-output-scheduler-queue-retention.test.ts',
|
||||
'config/scripts/static-analysis/oxlint-contracts/app-store-performance-plugin.test.mjs',
|
||||
'config/scripts/static-analysis/oxlint-contracts/quadratic-buffer-concat-plugin.test.mjs',
|
||||
'src/main/claude-usage/scanner-incremental-append.test.ts',
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
4 src/renderer/src/components/dashboard/build-dashboard-bucket-counts.ts # P5b-2 must clear: optional state fields; memo compare goes stale when absent
|
||||
3 src/renderer/src/components/dashboard/dashboard-card-terminal-input.ts # P5b-2 must clear: optional state fields default to empty
|
||||
1 src/renderer/src/components/dashboard/dashboard-snapshot-workspaces.ts # P5b-2 must clear: optional state field defaults to empty
|
||||
1 src/renderer/src/components/dashboard/dashboard-worktree-launch-options.ts # P5b-2 must clear: optional state field defaults to empty
|
||||
4 src/renderer/src/components/dashboard/useDashboardPopoutBridge.ts # P5b-2 must clear: change detection on optional fields never fires when absent
|
||||
1 src/renderer/src/components/editor/markdown/documents/markdown-document-worktree-path-selector.ts # P5b-2 must clear: optional state field
|
||||
2 src/renderer/src/components/right-sidebar/file-explorer/watching/useFileExplorerWatch.ts # P5b-2 must clear: optional state fields default to empty
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="113" height="20" role="img" aria-label="downloads: 164m">
|
||||
<title>downloads: 164m</title>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="113" height="20" role="img" aria-label="downloads: 168m">
|
||||
<title>downloads: 168m</title>
|
||||
<linearGradient id="s" x2="0" y2="100%">
|
||||
<stop offset="0" stop-color="#bbb" stop-opacity=".1"/>
|
||||
<stop offset="1" stop-opacity=".1"/>
|
||||
@@ -15,7 +15,7 @@
|
||||
<g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="11">
|
||||
<text x="37" y="15" fill="#010101" fill-opacity=".3">downloads</text>
|
||||
<text x="37" y="14">downloads</text>
|
||||
<text x="93.5" y="15" fill="#010101" fill-opacity=".3">164m</text>
|
||||
<text x="93.5" y="14">164m</text>
|
||||
<text x="93.5" y="15" fill="#010101" fill-opacity=".3">168m</text>
|
||||
<text x="93.5" y="14">168m</text>
|
||||
</g>
|
||||
</svg>
|
||||
|
||||
|
Before Width: | Height: | Size: 943 B After Width: | Height: | Size: 943 B |
@@ -21,7 +21,14 @@ function oneLine(text: string | null | undefined): string {
|
||||
return text?.replace(/\s+/g, ' ').trim() ?? ''
|
||||
}
|
||||
|
||||
function lastMessage(agent: RuntimeWorktreeAgentRow): string {
|
||||
// A worktree agent row or a session tab's AgentStatusEntry, which leaves these optional.
|
||||
type AgentPreviewSource = Pick<RuntimeWorktreeAgentRow, 'prompt'> & {
|
||||
lastAssistantMessage?: string | null
|
||||
toolName?: string | null
|
||||
toolInput?: string | null
|
||||
}
|
||||
|
||||
function lastMessage(agent: AgentPreviewSource): string {
|
||||
const message = agent.lastAssistantMessage
|
||||
return message ? oneLine(withoutNativeChatVisualDirectiveLines(message)) : ''
|
||||
}
|
||||
@@ -31,7 +38,7 @@ function lastMessage(agent: RuntimeWorktreeAgentRow): string {
|
||||
* (`group` null) shows no tool, since the tool call is long over.
|
||||
*/
|
||||
export function agentListPreview(
|
||||
agent: RuntimeWorktreeAgentRow,
|
||||
agent: AgentPreviewSource,
|
||||
group: AgentStatusGroup | null,
|
||||
title: string
|
||||
): string {
|
||||
|
||||
@@ -84,6 +84,8 @@ export function SwipeRowActions({
|
||||
})
|
||||
// Web has no worklet plugin; mapper hooks need this explicit dependency list.
|
||||
const rowStyle = useAnimatedStyle(() => ({ transform: [{ translateX: offset.value }] }), [offset])
|
||||
// Hidden at rest, so the action can't show through a rounded group's antialiased corners.
|
||||
const actionsStyle = useAnimatedStyle(() => ({ opacity: offset.value === 0 ? 0 : 1 }), [offset])
|
||||
// A tap on an open row closes it rather than pressing the row.
|
||||
const guardPress = (onPress: () => void) => () => {
|
||||
// The click a drag release produces belongs to the drag, not to the row.
|
||||
@@ -124,8 +126,10 @@ export function SwipeRowActions({
|
||||
}
|
||||
return (
|
||||
<View>
|
||||
{leading ? renderAction(leading, 'leading') : null}
|
||||
{trailing ? renderAction(trailing, 'trailing') : null}
|
||||
<Animated.View pointerEvents="box-none" style={[styles.actions, actionsStyle]}>
|
||||
{leading ? renderAction(leading, 'leading') : null}
|
||||
{trailing ? renderAction(trailing, 'trailing') : null}
|
||||
</Animated.View>
|
||||
{/* pan-y keeps the page scrolling vertically over the row on the web. */}
|
||||
<GestureDetector gesture={pan} touchAction="pan-y">
|
||||
<Animated.View style={rowStyle}>{children(guardPress)}</Animated.View>
|
||||
@@ -144,6 +148,7 @@ const styles = themedStyleSheet(() => ({
|
||||
justifyContent: 'center',
|
||||
gap: 2
|
||||
},
|
||||
actions: { position: 'absolute', top: 0, right: 0, bottom: 0, left: 0 },
|
||||
leading: { left: 0 },
|
||||
trailing: { right: 0 },
|
||||
actionPressed: { opacity: feedback.pressedOpacity },
|
||||
|
||||
@@ -2454,8 +2454,7 @@
|
||||
"tabStrip": {
|
||||
"checkingCapabilities": "Desktop-Funktionen werden geprüft – gleich erneut versuchen",
|
||||
"newTab": "Neuen Tab erstellen",
|
||||
"quickCommandsUpdateRequired": "Desktop-Update für Schnellbefehle erforderlich",
|
||||
"tabStatus": "{{title}}, {{status}}"
|
||||
"quickCommandsUpdateRequired": "Desktop-Update für Schnellbefehle erforderlich"
|
||||
},
|
||||
"terminalActionSheetActions": {
|
||||
"clearTerminal": "Terminal leeren",
|
||||
|
||||
@@ -2182,10 +2182,10 @@
|
||||
"renameTerminal": "Rename Terminal",
|
||||
"renameTerminalFailed": "Couldn't rename the terminal. {{reason}}",
|
||||
"terminalName": "Terminal name",
|
||||
"allowAutoClose": "Allow Auto-Close"
|
||||
"allowAutoClose": "Allow Auto-Close",
|
||||
"agents": "Agents"
|
||||
},
|
||||
"tabStrip": {
|
||||
"tabStatus": "{{title}}, {{status}}",
|
||||
"newTab": "New tab",
|
||||
"quickCommandsUpdateRequired": "Desktop update required for quick commands",
|
||||
"checkingCapabilities": "Checking desktop capabilities — try again in a moment"
|
||||
@@ -2887,8 +2887,6 @@
|
||||
},
|
||||
"presentation": {
|
||||
"loadingTabs": "Loading tabs",
|
||||
"oneTab": "1 tab",
|
||||
"tabCount": "{{tabCount}} tabs",
|
||||
"tapToRetry": "{{status}} — tap to retry"
|
||||
},
|
||||
"documentReaders": {
|
||||
@@ -2926,6 +2924,29 @@
|
||||
"skip": "Skip",
|
||||
"stop": "Stop",
|
||||
"yes": "Yes"
|
||||
},
|
||||
"tabsSheet": {
|
||||
"needsYou": "Needs you",
|
||||
"working": "Working",
|
||||
"everythingElse": "Everything else",
|
||||
"open": "Open",
|
||||
"closeTab": "Close {{title}}"
|
||||
},
|
||||
"tabRows": {
|
||||
"browser": "Browser",
|
||||
"markdown": "Markdown note",
|
||||
"file": "File",
|
||||
"chat": "Chat",
|
||||
"terminal": "Terminal"
|
||||
},
|
||||
"tabBar": {
|
||||
"oneTab": "1 tab",
|
||||
"tabCount": "{{count}} tabs",
|
||||
"anotherNeedsYou": "another tab needs you",
|
||||
"actionsHint": "Shows actions for this tab",
|
||||
"next": "Next tab",
|
||||
"previous": "Previous tab",
|
||||
"hint": "Shows all tabs"
|
||||
}
|
||||
},
|
||||
"chat": {
|
||||
@@ -2967,7 +2988,12 @@
|
||||
"skip": "Skip",
|
||||
"step": "Step {{step}}",
|
||||
"other": "Other…",
|
||||
"answerPlaceholder": "Type your answer"
|
||||
"answerPlaceholder": "Type your answer",
|
||||
"optionPreview": "{{option}} preview",
|
||||
"previewPosition": "{{current}} of {{total}}",
|
||||
"chosen": "Chosen",
|
||||
"chooseThis": "Choose this",
|
||||
"viewPreview": "View"
|
||||
},
|
||||
"permission": {
|
||||
"reason": "Reason: ",
|
||||
|
||||
@@ -2524,8 +2524,7 @@
|
||||
"tabStrip": {
|
||||
"checkingCapabilities": "Comprobando las funciones del escritorio. Inténtalo de nuevo en un momento.",
|
||||
"newTab": "Nueva pestaña",
|
||||
"quickCommandsUpdateRequired": "Actualiza el escritorio para usar los comandos rápidos.",
|
||||
"tabStatus": "{{title}}, {{status}}"
|
||||
"quickCommandsUpdateRequired": "Actualiza el escritorio para usar los comandos rápidos."
|
||||
},
|
||||
"terminalActionSheetActions": {
|
||||
"clearTerminal": "Limpiar terminal",
|
||||
|
||||
@@ -2524,8 +2524,7 @@
|
||||
"tabStrip": {
|
||||
"checkingCapabilities": "Vérification des fonctionnalités de l'ordinateur — réessayez dans un instant",
|
||||
"newTab": "Nouvel onglet",
|
||||
"quickCommandsUpdateRequired": "Mettez à jour Orca sur l'ordinateur pour utiliser les commandes rapides",
|
||||
"tabStatus": "{{title}}, {{status}}"
|
||||
"quickCommandsUpdateRequired": "Mettez à jour Orca sur l'ordinateur pour utiliser les commandes rapides"
|
||||
},
|
||||
"terminalActionSheetActions": {
|
||||
"clearTerminal": "Effacer le terminal",
|
||||
|
||||
@@ -2450,8 +2450,7 @@
|
||||
"tabStrip": {
|
||||
"checkingCapabilities": "デスクトップの対応機能を確認中です。少し待ってから再試行してください。",
|
||||
"newTab": "新規タブ",
|
||||
"quickCommandsUpdateRequired": "クイックコマンドの利用にはデスクトップの更新が必要です。",
|
||||
"tabStatus": "{{title}}、{{status}}"
|
||||
"quickCommandsUpdateRequired": "クイックコマンドの利用にはデスクトップの更新が必要です。"
|
||||
},
|
||||
"terminalActionSheetActions": {
|
||||
"clearTerminal": "ターミナルをクリア",
|
||||
|
||||
@@ -2450,8 +2450,7 @@
|
||||
"tabStrip": {
|
||||
"checkingCapabilities": "데스크톱에서 지원하는 기능을 확인 중입니다. 잠시 후 다시 시도하세요.",
|
||||
"newTab": "새 탭",
|
||||
"quickCommandsUpdateRequired": "빠른 명령을 사용하려면 데스크톱 업데이트가 필요합니다.",
|
||||
"tabStatus": "{{title}}, {{status}}"
|
||||
"quickCommandsUpdateRequired": "빠른 명령을 사용하려면 데스크톱 업데이트가 필요합니다."
|
||||
},
|
||||
"terminalActionSheetActions": {
|
||||
"clearTerminal": "터미널 지우기",
|
||||
|
||||
@@ -2524,8 +2524,7 @@
|
||||
"tabStrip": {
|
||||
"checkingCapabilities": "Verificando os recursos do desktop — tente novamente em instantes",
|
||||
"newTab": "Nova aba",
|
||||
"quickCommandsUpdateRequired": "Atualize o desktop para usar comandos rápidos",
|
||||
"tabStatus": "{{title}}, {{status}}"
|
||||
"quickCommandsUpdateRequired": "Atualize o desktop para usar comandos rápidos"
|
||||
},
|
||||
"terminalActionSheetActions": {
|
||||
"clearTerminal": "Limpar Terminal",
|
||||
|
||||
@@ -2594,8 +2594,7 @@
|
||||
"tabStrip": {
|
||||
"checkingCapabilities": "Проверяем возможности Orca на компьютере — повторите попытку чуть позже",
|
||||
"newTab": "Новая вкладка",
|
||||
"quickCommandsUpdateRequired": "Для быстрых команд обновите Orca на компьютере",
|
||||
"tabStatus": "{{title}}, {{status}}"
|
||||
"quickCommandsUpdateRequired": "Для быстрых команд обновите Orca на компьютере"
|
||||
},
|
||||
"terminalActionSheetActions": {
|
||||
"clearTerminal": "Очистить терминал",
|
||||
|
||||
@@ -2454,8 +2454,7 @@
|
||||
"tabStrip": {
|
||||
"checkingCapabilities": "Masaüstü özellikleri kontrol ediliyor — birazdan tekrar deneyin",
|
||||
"newTab": "Yeni sekme",
|
||||
"quickCommandsUpdateRequired": "Hızlı komutlar için masaüstü uygulaması güncellenmeli",
|
||||
"tabStatus": "{{title}}, {{status}}"
|
||||
"quickCommandsUpdateRequired": "Hızlı komutlar için masaüstü uygulaması güncellenmeli"
|
||||
},
|
||||
"terminalActionSheetActions": {
|
||||
"clearTerminal": "Terminali Temizle",
|
||||
|
||||
@@ -2450,8 +2450,7 @@
|
||||
"tabStrip": {
|
||||
"checkingCapabilities": "正在檢查桌面版支援的功能,請稍後再試",
|
||||
"newTab": "新分頁",
|
||||
"quickCommandsUpdateRequired": "需更新桌面版才能使用快速命令",
|
||||
"tabStatus": "{{title}},{{status}}"
|
||||
"quickCommandsUpdateRequired": "需更新桌面版才能使用快速命令"
|
||||
},
|
||||
"terminalActionSheetActions": {
|
||||
"clearTerminal": "清除終端機",
|
||||
|
||||
@@ -2450,8 +2450,7 @@
|
||||
"tabStrip": {
|
||||
"checkingCapabilities": "正在检查桌面支持的功能,请稍后重试",
|
||||
"newTab": "新标签页",
|
||||
"quickCommandsUpdateRequired": "使用快捷命令需更新桌面应用",
|
||||
"tabStatus": "{{title}},{{status}}"
|
||||
"quickCommandsUpdateRequired": "使用快捷命令需更新桌面应用"
|
||||
},
|
||||
"terminalActionSheetActions": {
|
||||
"clearTerminal": "清空终端",
|
||||
|
||||
@@ -6,7 +6,7 @@ import { NavBar, NavBarRefreshLine } from '../components/nav-bar/NavBar'
|
||||
import { useRefreshHint } from '../query/refresh-hint'
|
||||
import { NavBarButton } from '../components/nav-bar/NavBarButton'
|
||||
import { MobileSessionHeaderMoreMenu } from './MobileSessionHeaderMoreMenu'
|
||||
import { MobileSessionTabStrip } from './tabs/MobileSessionTabStrip'
|
||||
import { MobileSessionTabBar } from './tabs/MobileSessionTabBar'
|
||||
import { MobileSessionTitleBlock } from './MobileSessionTitleBlock'
|
||||
import type { SessionTitleCard } from './tabs/use-session-title-card'
|
||||
import { styles } from './mobile-session-styles'
|
||||
@@ -58,11 +58,11 @@ export function MobileSessionHeader({
|
||||
// Why: a sideways phone is ~390pt tall, so the tabs share the top bar instead of taking a second row.
|
||||
const hasTabs = visibleTabs.length > 0
|
||||
const tabsInTopBar = (layout.isLandscapePhone || sideRail) && hasTabs
|
||||
// Bar buttons otherwise leave less than two readable tabs on a narrow header.
|
||||
// Bar buttons otherwise leave the tab bar too narrow to read on a narrow header.
|
||||
const actionsCollapsed = tabsInTopBar && (headerWidth ?? layout.width) < 600
|
||||
const sourceControlInBar = !isFloatingWorkspaceRoute && !actionsCollapsed
|
||||
const tabStrip = hasTabs ? (
|
||||
<MobileSessionTabStrip
|
||||
<MobileSessionTabBar
|
||||
controller={controller}
|
||||
inTopBar={tabsInTopBar}
|
||||
actionsCollapsed={actionsCollapsed}
|
||||
|
||||
@@ -2,7 +2,7 @@ import { Platform } from 'react-native'
|
||||
import { useMobileTranslation } from '../i18n/use-mobile-translation'
|
||||
import { getRepoIdFromWorktreeId } from '../../../src/shared/worktree/id'
|
||||
import { useClipboardWriter } from '../platform/clipboard'
|
||||
import { Copy, FileText, Globe, RefreshCw, SquareTerminal } from 'lucide-react-native'
|
||||
import { Copy, FileText, RefreshCw } from 'lucide-react-native'
|
||||
import { MobileSessionTerminalLayoutSheet } from '../terminal/session/MobileSessionTerminalLayoutSheet'
|
||||
import { QuickCommandsSheet } from '../terminal/quick-commands/QuickCommandsSheet'
|
||||
import { triggerSuccess, triggerError } from '../platform/haptics'
|
||||
@@ -19,6 +19,7 @@ import { isTerminalPhoneDisplayMode } from '../terminal/session/terminal-phone-d
|
||||
import type { MobileSessionController } from './use-mobile-session-controller'
|
||||
import { useMobileAllowAutoCloseActions } from './tabs/mobile-worker-auto-close'
|
||||
import { MobileAgentSessionTabActionSheet } from './tabs/MobileAgentSessionTabActionSheet'
|
||||
import { MobileNewTabSheet } from './tabs/MobileNewTabSheet'
|
||||
|
||||
export function MobileSessionSheets({ controller }: { controller: MobileSessionController }) {
|
||||
const t = useMobileTranslation()
|
||||
@@ -90,7 +91,8 @@ export function MobileSessionSheets({ controller }: { controller: MobileSessionC
|
||||
bulkCloseActions,
|
||||
bulkCloseConfirm,
|
||||
closeWithBulkActions,
|
||||
createTabAgentActions,
|
||||
createTabAgentStatusRow,
|
||||
createTabAgentOptions,
|
||||
sendDiffNotesAgentActions
|
||||
} = controller
|
||||
const clipboard = useClipboardWriter()
|
||||
@@ -115,61 +117,33 @@ export function MobileSessionSheets({ controller }: { controller: MobileSessionC
|
||||
agentPromptMaxLength={controller.quickCommandAgentPromptMaxLength}
|
||||
onLaunch={launchQuickCommand}
|
||||
/>
|
||||
<ActionSheetModal
|
||||
<MobileNewTabSheet
|
||||
visible={showCreateTabDrawer}
|
||||
title={t('session.sheets.newTab', 'New Tab')}
|
||||
actions={[
|
||||
...createTabAgentActions,
|
||||
{
|
||||
id: 'terminal',
|
||||
label: t('session.sheets.terminal', 'Terminal'),
|
||||
icon: SquareTerminal,
|
||||
onPress: () => {
|
||||
setShowCreateTabDrawer(false)
|
||||
void handleCreateTerminal()
|
||||
}
|
||||
},
|
||||
// Why: browser/markdown creation resolve a real worktree on the host
|
||||
// (browser.tabCreate, files.createFile); the floating sentinel is
|
||||
// terminal-only over RPC, so those options hide there.
|
||||
...(isFloatingWorkspaceRoute
|
||||
? []
|
||||
: [
|
||||
{
|
||||
id: 'browser',
|
||||
label: t('session.sheets.browser', 'Browser'),
|
||||
icon: Globe,
|
||||
closeBeforePress: true,
|
||||
onPress: () => {
|
||||
if (browserScreencastSupported !== true) {
|
||||
showToast(
|
||||
t(
|
||||
'session.sheets.browserUpdateRequired',
|
||||
'Desktop update required for mobile browser streaming'
|
||||
),
|
||||
1600
|
||||
)
|
||||
return
|
||||
}
|
||||
setShowCreateBrowserModal(true)
|
||||
}
|
||||
},
|
||||
...(onPairedHost
|
||||
? [
|
||||
{
|
||||
id: 'markdownNote',
|
||||
label: t('session.sheets.markdownNote', 'Markdown Note'),
|
||||
icon: FileText,
|
||||
onPress: () => {
|
||||
setShowCreateTabDrawer(false)
|
||||
void handleCreateMarkdownNote()
|
||||
}
|
||||
}
|
||||
]
|
||||
: [])
|
||||
])
|
||||
]}
|
||||
workspaceName={worktreeName}
|
||||
agentOptions={createTabAgentOptions}
|
||||
agentStatusRow={createTabAgentStatusRow}
|
||||
// Why: browser/markdown creation resolve a real worktree on the host
|
||||
// (browser.tabCreate, files.createFile); the floating sentinel is
|
||||
// terminal-only over RPC, so those options hide there.
|
||||
canCreateBrowser={!isFloatingWorkspaceRoute}
|
||||
canCreateMarkdownNote={!isFloatingWorkspaceRoute && onPairedHost}
|
||||
onClose={() => setShowCreateTabDrawer(false)}
|
||||
onCreateAgent={(agent) => void handleCreateTerminal(agent)}
|
||||
onCreateTerminal={() => void handleCreateTerminal()}
|
||||
onCreateBrowser={() => {
|
||||
if (browserScreencastSupported !== true) {
|
||||
showToast(
|
||||
t(
|
||||
'session.sheets.browserUpdateRequired',
|
||||
'Desktop update required for mobile browser streaming'
|
||||
),
|
||||
1600
|
||||
)
|
||||
return
|
||||
}
|
||||
setShowCreateBrowserModal(true)
|
||||
}}
|
||||
onCreateMarkdownNote={() => void handleCreateMarkdownNote()}
|
||||
/>
|
||||
<ActionSheetModal
|
||||
visible={pendingDiffNotesDelivery !== null}
|
||||
|
||||
@@ -58,108 +58,6 @@ export const mobileSessionFrameStyles = themedStyleSheet(() => ({
|
||||
color: colors.textSecondary,
|
||||
fontSize: typography.metaSize
|
||||
},
|
||||
tabBar: {
|
||||
flexDirection: 'row',
|
||||
alignItems: 'center',
|
||||
borderTopWidth: 1,
|
||||
borderTopColor: colors.borderSubtle
|
||||
},
|
||||
// Cancels the top bar's vertical padding so tab borders run the bar's full height.
|
||||
tabBarInTopBar: {
|
||||
flex: 1,
|
||||
minWidth: 0,
|
||||
flexDirection: 'row',
|
||||
alignItems: 'center',
|
||||
alignSelf: 'stretch',
|
||||
marginVertical: -spacing.xs,
|
||||
marginLeft: spacing.md,
|
||||
borderLeftWidth: 1,
|
||||
borderLeftColor: colors.borderSubtle
|
||||
},
|
||||
tabScrollFrame: {
|
||||
flex: 1,
|
||||
minWidth: 0,
|
||||
flexDirection: 'row',
|
||||
alignItems: 'center',
|
||||
alignSelf: 'stretch'
|
||||
},
|
||||
tabEdgeHint: {
|
||||
position: 'absolute',
|
||||
top: 0,
|
||||
bottom: 0,
|
||||
justifyContent: 'center',
|
||||
paddingHorizontal: spacing.xs,
|
||||
backgroundColor: colors.bgPanel
|
||||
},
|
||||
tabEdgeHintLeft: {
|
||||
left: 0,
|
||||
borderRightWidth: 1,
|
||||
borderRightColor: colors.borderSubtle
|
||||
},
|
||||
tabEdgeHintRight: {
|
||||
right: 0,
|
||||
borderLeftWidth: 1,
|
||||
borderLeftColor: colors.borderSubtle
|
||||
},
|
||||
// Opaque like the chrome behind it: see the chat page scroll (#36553).
|
||||
tabScroll: {
|
||||
flex: 1,
|
||||
maxHeight: 44,
|
||||
backgroundColor: colors.bgPanel
|
||||
},
|
||||
tabScrollInTopBar: {
|
||||
alignSelf: 'stretch',
|
||||
maxHeight: 44
|
||||
},
|
||||
tabContent: {
|
||||
paddingLeft: spacing.md,
|
||||
paddingRight: spacing.sm
|
||||
},
|
||||
tabContentInTopBar: {
|
||||
paddingLeft: 0
|
||||
},
|
||||
tab: {
|
||||
minWidth: 44,
|
||||
maxWidth: 128,
|
||||
minHeight: 44,
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
paddingHorizontal: spacing.sm,
|
||||
paddingVertical: spacing.sm,
|
||||
borderBottomWidth: 2,
|
||||
borderBottomColor: 'transparent',
|
||||
borderRightWidth: 1,
|
||||
borderRightColor: colors.borderSubtle
|
||||
},
|
||||
tabFirst: {
|
||||
borderLeftWidth: 1,
|
||||
borderLeftColor: colors.borderSubtle
|
||||
},
|
||||
tabActive: {
|
||||
borderBottomColor: colors.textSecondary,
|
||||
backgroundColor: colors.bgRaised
|
||||
},
|
||||
tabPressed: {
|
||||
backgroundColor: colors.translucentFill
|
||||
},
|
||||
tabLabelRow: {
|
||||
maxWidth: '100%',
|
||||
flexDirection: 'row',
|
||||
alignItems: 'center',
|
||||
gap: spacing.xs
|
||||
},
|
||||
// Prevent web SVG shrink before the title ellipsizes.
|
||||
tabIcon: {
|
||||
flexShrink: 0
|
||||
},
|
||||
tabText: {
|
||||
flexShrink: 1,
|
||||
color: colors.textSecondary,
|
||||
fontSize: 13
|
||||
},
|
||||
tabTextActive: {
|
||||
color: colors.textPrimary
|
||||
},
|
||||
newTerminalButtonPressed: {
|
||||
backgroundColor: colors.bgRaised
|
||||
},
|
||||
|
||||
@@ -0,0 +1,165 @@
|
||||
import { createElement, type ReactNode } from 'react'
|
||||
import { act, create, type ReactTestInstance, type ReactTestRenderer } from 'react-test-renderer'
|
||||
import { afterEach, expect, it, vi, type Mock } from 'vitest'
|
||||
import type { AskPrompt } from '../../../../../src/shared/native-chat/input/native-chat-ask-types'
|
||||
import { MobileNativeChatAsk } from './MobileNativeChatAsk'
|
||||
|
||||
vi.mock('react-native', () => ({
|
||||
Keyboard: { dismiss: vi.fn() },
|
||||
Platform: { select: (options: { ios: unknown }) => options.ios },
|
||||
Pressable: 'Pressable',
|
||||
ScrollView: 'ScrollView',
|
||||
Text: 'Text',
|
||||
View: 'View',
|
||||
StyleSheet: { create: (styles: unknown) => styles, hairlineWidth: 1 }
|
||||
}))
|
||||
vi.mock('lucide-react-native', () => ({ Check: 'Check' }))
|
||||
vi.mock('../../../components/composer-input/MessageBox', () => ({ MessageBox: 'MessageBox' }))
|
||||
vi.mock('../transcript/MobileNativeChatQuestionText', () => ({
|
||||
MobileNativeChatQuestionText: 'QuestionText'
|
||||
}))
|
||||
vi.mock('./MobileNativeChatCardHeaderAction', () => ({
|
||||
MobileNativeChatCardHeaderAction: () => null
|
||||
}))
|
||||
vi.mock('../../../components/bottom-drawer/keyed-bottom-drawer', () => ({
|
||||
KeyedBottomDrawer: ({
|
||||
sheet,
|
||||
children
|
||||
}: {
|
||||
sheet: number | null
|
||||
children: (index: number) => ReactNode
|
||||
}) => (sheet === null ? null : children(sheet))
|
||||
}))
|
||||
vi.mock('../../../components/nav-bar/SheetHeader', () => ({
|
||||
SheetHeader: ({ onClose }: { onClose: () => void }) =>
|
||||
createElement('button', { accessibilityLabel: 'Close viewer', onPress: onClose })
|
||||
}))
|
||||
|
||||
let renderer: ReactTestRenderer
|
||||
const compactedPreview = `${'| panes |'.repeat(450)}…`
|
||||
function prompt(multiSelect = false): AskPrompt {
|
||||
return {
|
||||
questions: [
|
||||
{
|
||||
question: 'Which layout?',
|
||||
header: 'Layout',
|
||||
multiSelect,
|
||||
options: [
|
||||
{ label: 'First', preview: 'A\t|\n𠀀\t|' },
|
||||
{ label: 'No preview' },
|
||||
{ label: 'Last', preview: compactedPreview }
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
function buttons(): ReactTestInstance[] {
|
||||
return renderer.root.findAll(
|
||||
(node) => String(node.type) === 'Pressable' || String(node.type) === 'button'
|
||||
)
|
||||
}
|
||||
function button(label: string): ReactTestInstance {
|
||||
return buttons().find((node) => node.props.accessibilityLabel === label)!
|
||||
}
|
||||
function row(index: number): ReactTestInstance {
|
||||
return buttons().filter((node) => ['radio', 'checkbox'].includes(node.props.accessibilityRole))[
|
||||
index
|
||||
]!
|
||||
}
|
||||
function textAction(label: string): ReactTestInstance {
|
||||
return buttons().find((node) =>
|
||||
node
|
||||
.findAll((child) => String(child.type) === 'Text')
|
||||
.some((text) => text.children.includes(label))
|
||||
)!
|
||||
}
|
||||
function press(node: ReactTestInstance): void {
|
||||
act(() => node.props.onPress())
|
||||
}
|
||||
type Answer = Parameters<typeof MobileNativeChatAsk>[0]['onAnswer']
|
||||
function mount(value: AskPrompt): Mock<Answer> {
|
||||
const onAnswer = vi.fn<Answer>(async () => true)
|
||||
act(() => {
|
||||
renderer = create(createElement(MobileNativeChatAsk, { prompt: value, onAnswer }))
|
||||
})
|
||||
return onAnswer
|
||||
}
|
||||
|
||||
afterEach(() => {
|
||||
act(() => renderer?.unmount())
|
||||
vi.useRealTimers()
|
||||
})
|
||||
|
||||
it('inspects every preview without choosing, and keeps the original option when choosing and submitting', async () => {
|
||||
vi.useFakeTimers()
|
||||
const onAnswer = mount(prompt())
|
||||
expect(button('First preview')).toBeDefined()
|
||||
expect(button('Last preview')).toBeDefined()
|
||||
expect(row(2).props.accessibilityState.checked).toBe(false)
|
||||
press(button('First preview'))
|
||||
expect(renderer.root.findByProps({ selectable: true }).props.children).toBe('A\t|\n𠀀\t|')
|
||||
// Paging crosses the option with no preview; inspection does not change the answer.
|
||||
press(
|
||||
buttons().find(
|
||||
(node) => node.props.accessibilityLabel === 'Last preview' && node.props.accessibilityState
|
||||
)!
|
||||
)
|
||||
expect(
|
||||
renderer.root
|
||||
.findAll((node) => String(node.type) === 'Text')
|
||||
.some((node) => node.children.includes(compactedPreview))
|
||||
).toBe(true)
|
||||
press(button('Close viewer'))
|
||||
act(() => {
|
||||
vi.runAllTimers()
|
||||
})
|
||||
expect(onAnswer).not.toHaveBeenCalled()
|
||||
expect(row(2).props.accessibilityState.checked).toBe(false)
|
||||
press(button('Last preview'))
|
||||
press(button('Choose this'))
|
||||
act(() => {
|
||||
vi.runAllTimers()
|
||||
})
|
||||
expect(row(2).props.accessibilityState.checked).toBe(true)
|
||||
expect(onAnswer).not.toHaveBeenCalled()
|
||||
press(button('Last preview'))
|
||||
press(button('Chosen'))
|
||||
press(row(2))
|
||||
expect(row(2).props.accessibilityState.checked).toBe(true)
|
||||
await act(async () => textAction('Submit').props.onPress())
|
||||
expect(onAnswer).toHaveBeenCalledWith([{ indices: [2] }], expect.any(Function))
|
||||
})
|
||||
|
||||
it('preserves generic multi choices while inspecting and choosing, with row checkbox removal', async () => {
|
||||
const onAnswer = mount(prompt(true))
|
||||
press(row(0))
|
||||
press(button('Last preview'))
|
||||
press(button('Choose this'))
|
||||
press(button('Last preview'))
|
||||
press(button('Chosen'))
|
||||
expect(row(0).props.accessibilityState.checked).toBe(true)
|
||||
expect(row(2).props.accessibilityState.checked).toBe(true)
|
||||
press(row(0))
|
||||
await act(async () => textAction('Submit').props.onPress())
|
||||
expect(onAnswer).toHaveBeenCalledWith([{ indices: [2] }], expect.any(Function))
|
||||
})
|
||||
|
||||
it('retains automatic answer for an ordinary question and disables the viewer choice while pending', async () => {
|
||||
vi.useFakeTimers()
|
||||
const plain = prompt()
|
||||
plain.questions[0]!.options = [{ label: 'Plain' }]
|
||||
const onAnswer = mount(plain)
|
||||
press(row(0))
|
||||
await act(async () => {
|
||||
vi.runAllTimers()
|
||||
})
|
||||
expect(onAnswer).toHaveBeenCalledWith([{ indices: [0] }], expect.any(Function))
|
||||
act(() => renderer.unmount())
|
||||
act(() => {
|
||||
renderer = create(
|
||||
createElement(MobileNativeChatAsk, { prompt: prompt(), answerPending: true, onAnswer })
|
||||
)
|
||||
})
|
||||
press(button('Last preview'))
|
||||
expect(button('Choose this').props.disabled).toBe(true)
|
||||
})
|
||||
@@ -0,0 +1,95 @@
|
||||
import { StyleSheet } from 'react-native'
|
||||
import { colors, radii, spacing, typography } from '../../../theme/mobile-theme'
|
||||
import { themedStyleSheet } from '../../../theme/themed-styles'
|
||||
|
||||
export const mobileNativeChatAskStyles = themedStyleSheet(() => ({
|
||||
card: {
|
||||
flexShrink: 1,
|
||||
minHeight: 0,
|
||||
backgroundColor: colors.bgPanel,
|
||||
borderTopWidth: StyleSheet.hairlineWidth,
|
||||
borderTopColor: colors.borderSubtle
|
||||
},
|
||||
tabs: {
|
||||
flexGrow: 0,
|
||||
paddingTop: spacing.sm,
|
||||
borderBottomWidth: StyleSheet.hairlineWidth,
|
||||
borderBottomColor: colors.borderSubtle
|
||||
},
|
||||
tabsContent: {
|
||||
paddingHorizontal: spacing.sm,
|
||||
gap: spacing.xs,
|
||||
alignItems: 'center'
|
||||
},
|
||||
tab: {
|
||||
flexDirection: 'row',
|
||||
alignItems: 'center',
|
||||
gap: 4,
|
||||
minHeight: 36,
|
||||
paddingHorizontal: spacing.sm,
|
||||
paddingVertical: spacing.xs,
|
||||
borderBottomWidth: 2,
|
||||
borderBottomColor: 'transparent'
|
||||
},
|
||||
tabActive: {
|
||||
borderBottomColor: colors.statusGreen
|
||||
},
|
||||
tabText: {
|
||||
color: colors.textSecondary,
|
||||
fontSize: typography.metaSize,
|
||||
fontWeight: '600'
|
||||
},
|
||||
tabTextActive: {
|
||||
color: colors.textPrimary
|
||||
},
|
||||
scroll: {
|
||||
paddingHorizontal: spacing.md
|
||||
},
|
||||
questionRow: { flexDirection: 'row', alignItems: 'flex-start', gap: spacing.sm },
|
||||
questionText: {
|
||||
flex: 1,
|
||||
marginVertical: spacing.sm
|
||||
},
|
||||
other: {
|
||||
marginBottom: spacing.xs
|
||||
},
|
||||
footer: {
|
||||
flexDirection: 'row',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'space-between',
|
||||
padding: spacing.md,
|
||||
gap: spacing.sm,
|
||||
borderTopWidth: StyleSheet.hairlineWidth,
|
||||
borderTopColor: colors.borderSubtle
|
||||
},
|
||||
cancel: {
|
||||
paddingVertical: spacing.sm,
|
||||
paddingHorizontal: spacing.sm
|
||||
},
|
||||
cancelText: {
|
||||
color: colors.textSecondary,
|
||||
fontSize: typography.bodySize,
|
||||
fontWeight: '600'
|
||||
},
|
||||
progress: {
|
||||
color: colors.textMuted,
|
||||
fontSize: typography.metaSize
|
||||
},
|
||||
next: {
|
||||
paddingVertical: spacing.sm,
|
||||
paddingHorizontal: spacing.lg,
|
||||
borderRadius: radii.control,
|
||||
backgroundColor: colors.textPrimary
|
||||
},
|
||||
nextSkip: {
|
||||
backgroundColor: colors.bgRaised
|
||||
},
|
||||
nextText: {
|
||||
color: colors.bgBase,
|
||||
fontSize: typography.bodySize,
|
||||
fontWeight: '700'
|
||||
},
|
||||
nextSkipText: {
|
||||
color: colors.textMuted
|
||||
}
|
||||
}))
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useMemo, useRef, useState } from 'react'
|
||||
import { Pressable, ScrollView, StyleSheet, Text, View } from 'react-native'
|
||||
import { Keyboard, Pressable, ScrollView, Text, View } from 'react-native'
|
||||
import { Check } from 'lucide-react-native'
|
||||
import {
|
||||
nativeChatAnswerOperationEvidence,
|
||||
@@ -17,8 +17,7 @@ import {
|
||||
askTypedText,
|
||||
toggleAskOption
|
||||
} from '../../../../../src/shared/native-chat/input/native-chat-ask-card-rules'
|
||||
import { colors, radii, spacing, typography, pressedStyle } from '../../../theme/mobile-theme'
|
||||
import { themedStyleSheet } from '../../../theme/themed-styles'
|
||||
import { colors, pressedStyle } from '../../../theme/mobile-theme'
|
||||
import { useMobileColorScheme } from '../../../theme/use-mobile-color-scheme'
|
||||
import type { Translate } from '../../../i18n/mobile-i18n'
|
||||
import { useMobileTranslation } from '../../../i18n/use-mobile-translation'
|
||||
@@ -27,6 +26,8 @@ import { MobileNativeChatCardHeaderAction } from './MobileNativeChatCardHeaderAc
|
||||
import { MobileNativeChatQuestionText } from '../transcript/MobileNativeChatQuestionText'
|
||||
import { useMobileNativeChatAskAutoAdvance } from './use-mobile-native-chat-ask-auto-advance'
|
||||
import { MobileNativeChatAskOptionRow } from './MobileNativeChatAskOptionRow'
|
||||
import { MobileNativeChatOptionPreviewSheet } from './MobileNativeChatOptionPreviewSheet'
|
||||
import { mobileNativeChatAskStyles as styles } from './MobileNativeChatAsk.styles'
|
||||
import { useMobileNativeChatReplyScroll } from './use-mobile-native-chat-reply-scroll'
|
||||
|
||||
type Props = {
|
||||
@@ -66,9 +67,9 @@ export function MobileNativeChatAsk({
|
||||
}: Props): React.JSX.Element {
|
||||
useMobileColorScheme()
|
||||
const t = useMobileTranslation()
|
||||
const { scrollRef, inputRef, revealReply, scrollViewProps, revealContent } =
|
||||
useMobileNativeChatReplyScroll()
|
||||
const { scrollRef, inputRef, revealReply, onViewportLayout } = useMobileNativeChatReplyScroll()
|
||||
const [index, setIndex] = useState(0)
|
||||
const [viewedOption, setViewedOption] = useState<number | null>(null)
|
||||
const [selections, setSelections] = useState<number[][]>(() => prompt.questions.map(() => []))
|
||||
const [otherText, setOtherText] = useState<string[]>(() =>
|
||||
prompt.questions.map((_, qi) => freeTextInputs?.[qi]?.initialValue ?? '')
|
||||
@@ -93,6 +94,7 @@ export function MobileNativeChatAsk({
|
||||
const autoAdvance = useMobileNativeChatAskAutoAdvance(submitting)
|
||||
// Open each step at its question and end the last step's edit, so no typing lands out of view.
|
||||
const showStep = (next: (current: number) => number): void => {
|
||||
setViewedOption(null)
|
||||
inputRef.current?.blur()
|
||||
scrollRef.current?.scrollTo({ y: 0, animated: false })
|
||||
setIndex(next)
|
||||
@@ -105,17 +107,17 @@ export function MobileNativeChatAsk({
|
||||
askAcceptsEmptyAnswer(prompt.questions[qi], freeTextInputs?.[qi])
|
||||
|
||||
// Delay single-select advance to show the choice; Other still needs text.
|
||||
const toggle = (qi: number, optIndex: number, multi: boolean): void => {
|
||||
const toggle = (qi: number, optIndex: number, multi: boolean, choosing = false): void => {
|
||||
// Block same-frame taps before disabled state renders.
|
||||
if (isLocalPending(operationRef.current) || answerPending) {
|
||||
return
|
||||
}
|
||||
const cur = selections[qi] ?? []
|
||||
// A pick reveals its preview, so a re-tap keeps it and the user confirms.
|
||||
// Preview choices wait for Submit so inspecting alternatives never commits an answer.
|
||||
const keep = optIndex !== OTHER && askQuestionShowsPreviews(prompt.questions[qi])
|
||||
const picked = !cur.includes(optIndex)
|
||||
const next = selections.map((s, i) =>
|
||||
i === qi ? toggleAskOption(cur, optIndex, multi, keep) : s
|
||||
i === qi ? toggleAskOption(cur, optIndex, multi, keep || choosing) : s
|
||||
)
|
||||
setSelections(next)
|
||||
autoAdvance.cancel()
|
||||
@@ -252,7 +254,12 @@ export function MobileNativeChatAsk({
|
||||
</ScrollView>
|
||||
) : null}
|
||||
|
||||
<ScrollView {...scrollViewProps} style={styles.scroll} keyboardShouldPersistTaps="always">
|
||||
<ScrollView
|
||||
ref={scrollRef}
|
||||
onLayout={onViewportLayout}
|
||||
style={styles.scroll}
|
||||
keyboardShouldPersistTaps="always"
|
||||
>
|
||||
<View style={styles.questionRow}>
|
||||
<MobileNativeChatQuestionText title content={q.question} style={styles.questionText} />
|
||||
<MobileNativeChatCardHeaderAction
|
||||
@@ -272,7 +279,12 @@ export function MobileNativeChatAsk({
|
||||
label={opt.label}
|
||||
description={opt.description}
|
||||
preview={opt.preview}
|
||||
onPreviewLayout={revealContent}
|
||||
onPreview={() => {
|
||||
autoAdvance.cancel()
|
||||
inputRef.current?.blur()
|
||||
Keyboard.dismiss()
|
||||
setViewedOption(optIndex)
|
||||
}}
|
||||
selected={(selections[index] ?? []).includes(optIndex)}
|
||||
multi={q.multiSelect}
|
||||
disabled={submitting}
|
||||
@@ -333,98 +345,18 @@ export function MobileNativeChatAsk({
|
||||
</Text>
|
||||
</Pressable>
|
||||
</View>
|
||||
<MobileNativeChatOptionPreviewSheet
|
||||
options={q.options}
|
||||
viewedIndex={viewedOption}
|
||||
selected={selections[index] ?? []}
|
||||
disabled={submitting}
|
||||
onView={setViewedOption}
|
||||
onClose={() => setViewedOption(null)}
|
||||
onChoose={(optionIndex) => {
|
||||
setViewedOption(null)
|
||||
toggle(index, optionIndex, q.multiSelect, true)
|
||||
}}
|
||||
/>
|
||||
</View>
|
||||
)
|
||||
}
|
||||
|
||||
const styles = themedStyleSheet(() => ({
|
||||
card: {
|
||||
flexShrink: 1,
|
||||
minHeight: 0,
|
||||
backgroundColor: colors.bgPanel,
|
||||
borderTopWidth: StyleSheet.hairlineWidth,
|
||||
borderTopColor: colors.borderSubtle
|
||||
},
|
||||
tabs: {
|
||||
flexGrow: 0,
|
||||
paddingTop: spacing.sm,
|
||||
borderBottomWidth: StyleSheet.hairlineWidth,
|
||||
borderBottomColor: colors.borderSubtle
|
||||
},
|
||||
tabsContent: {
|
||||
paddingHorizontal: spacing.sm,
|
||||
gap: spacing.xs,
|
||||
alignItems: 'center'
|
||||
},
|
||||
tab: {
|
||||
flexDirection: 'row',
|
||||
alignItems: 'center',
|
||||
gap: 4,
|
||||
minHeight: 36,
|
||||
paddingHorizontal: spacing.sm,
|
||||
paddingVertical: spacing.xs,
|
||||
borderBottomWidth: 2,
|
||||
borderBottomColor: 'transparent'
|
||||
},
|
||||
tabActive: {
|
||||
borderBottomColor: colors.statusGreen
|
||||
},
|
||||
tabText: {
|
||||
color: colors.textSecondary,
|
||||
fontSize: typography.metaSize,
|
||||
fontWeight: '600'
|
||||
},
|
||||
tabTextActive: {
|
||||
color: colors.textPrimary
|
||||
},
|
||||
scroll: {
|
||||
paddingHorizontal: spacing.md
|
||||
},
|
||||
questionRow: { flexDirection: 'row', alignItems: 'flex-start', gap: spacing.sm },
|
||||
questionText: {
|
||||
flex: 1,
|
||||
marginVertical: spacing.sm
|
||||
},
|
||||
other: {
|
||||
marginBottom: spacing.xs
|
||||
},
|
||||
footer: {
|
||||
flexDirection: 'row',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'space-between',
|
||||
padding: spacing.md,
|
||||
gap: spacing.sm,
|
||||
borderTopWidth: StyleSheet.hairlineWidth,
|
||||
borderTopColor: colors.borderSubtle
|
||||
},
|
||||
cancel: {
|
||||
paddingVertical: spacing.sm,
|
||||
paddingHorizontal: spacing.sm
|
||||
},
|
||||
cancelText: {
|
||||
color: colors.textSecondary,
|
||||
fontSize: typography.bodySize,
|
||||
fontWeight: '600'
|
||||
},
|
||||
progress: {
|
||||
color: colors.textMuted,
|
||||
fontSize: typography.metaSize
|
||||
},
|
||||
next: {
|
||||
paddingVertical: spacing.sm,
|
||||
paddingHorizontal: spacing.lg,
|
||||
borderRadius: radii.control,
|
||||
backgroundColor: colors.textPrimary
|
||||
},
|
||||
nextSkip: {
|
||||
backgroundColor: colors.bgRaised
|
||||
},
|
||||
nextText: {
|
||||
color: colors.bgBase,
|
||||
fontSize: typography.bodySize,
|
||||
fontWeight: '700'
|
||||
},
|
||||
nextSkipText: {
|
||||
color: colors.textMuted
|
||||
}
|
||||
}))
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { Pressable, ScrollView, Text, View, type LayoutChangeEvent } from 'react-native'
|
||||
import { Pressable, Text, View } from 'react-native'
|
||||
import { Check } from 'lucide-react-native'
|
||||
import { MobileNativeChatOptionThumbnail } from './MobileNativeChatOptionThumbnail'
|
||||
import {
|
||||
colors,
|
||||
concentricRadius,
|
||||
@@ -15,7 +16,7 @@ export function MobileNativeChatAskOptionRow({
|
||||
label,
|
||||
description,
|
||||
preview,
|
||||
onPreviewLayout,
|
||||
onPreview,
|
||||
selected,
|
||||
multi,
|
||||
disabled,
|
||||
@@ -23,16 +24,16 @@ export function MobileNativeChatAskOptionRow({
|
||||
}: {
|
||||
label: string
|
||||
description?: string
|
||||
/** Shown under the row while it is selected, as the agent wrote it. */
|
||||
/** Read-only inspection is separate from choosing the option. */
|
||||
preview?: string
|
||||
/** The preview's edges in the card's scroll content; the row renders as its direct children. */
|
||||
onPreviewLayout?: (top: number, bottom: number) => void
|
||||
onPreview?: () => void
|
||||
selected: boolean
|
||||
multi?: boolean
|
||||
disabled: boolean
|
||||
onPress: () => void
|
||||
}): React.JSX.Element {
|
||||
useMobileColorScheme()
|
||||
const hasPreview = Boolean(preview && onPreview)
|
||||
const row = (
|
||||
<Pressable
|
||||
accessibilityRole={multi ? 'checkbox' : 'radio'}
|
||||
@@ -40,6 +41,7 @@ export function MobileNativeChatAskOptionRow({
|
||||
style={({ pressed }) => [
|
||||
styles.option,
|
||||
selected && styles.optionSelected,
|
||||
hasPreview && styles.optionWithPreview,
|
||||
pressed && pressedStyle
|
||||
]}
|
||||
disabled={disabled}
|
||||
@@ -65,29 +67,15 @@ export function MobileNativeChatAskOptionRow({
|
||||
</View>
|
||||
</Pressable>
|
||||
)
|
||||
// One root shape whether or not the preview shows, so selecting never remounts the row.
|
||||
return (
|
||||
<>
|
||||
return hasPreview ? (
|
||||
<View style={[styles.optionCard, selected && styles.optionSelected]}>
|
||||
{row}
|
||||
{preview && selected ? (
|
||||
<View
|
||||
style={styles.preview}
|
||||
onLayout={(event: LayoutChangeEvent) => {
|
||||
const { y, height } = event.nativeEvent.layout
|
||||
onPreviewLayout?.(y, y + height)
|
||||
}}
|
||||
>
|
||||
<ScrollView nestedScrollEnabled showsVerticalScrollIndicator>
|
||||
{/* Mockups are drawn in columns, so they scroll sideways instead of wrapping at phone width. */}
|
||||
<ScrollView horizontal showsHorizontalScrollIndicator={false}>
|
||||
<Text selectable style={styles.previewText}>
|
||||
{preview}
|
||||
</Text>
|
||||
</ScrollView>
|
||||
</ScrollView>
|
||||
</View>
|
||||
) : null}
|
||||
</>
|
||||
<View style={styles.previewInset}>
|
||||
<MobileNativeChatOptionThumbnail label={label} preview={preview!} onPress={onPreview!} />
|
||||
</View>
|
||||
</View>
|
||||
) : (
|
||||
row
|
||||
)
|
||||
}
|
||||
|
||||
@@ -137,18 +125,17 @@ const styles = themedStyleSheet(() => ({
|
||||
color: colors.textSecondary,
|
||||
fontSize: typography.metaSize
|
||||
},
|
||||
preview: {
|
||||
backgroundColor: colors.bgPanel,
|
||||
optionCard: {
|
||||
borderWidth: 1,
|
||||
borderColor: colors.borderSubtle,
|
||||
borderRadius: concentricRadius(radii.surface, spacing.xs),
|
||||
padding: spacing.sm,
|
||||
marginBottom: spacing.xs,
|
||||
maxHeight: 220
|
||||
backgroundColor: colors.bgRaised,
|
||||
marginBottom: spacing.xs
|
||||
},
|
||||
previewText: {
|
||||
color: colors.textPrimary,
|
||||
fontFamily: typography.monoFamily,
|
||||
fontSize: typography.metaSize
|
||||
optionWithPreview: { borderWidth: 0, marginBottom: 0 },
|
||||
previewInset: {
|
||||
marginLeft: 18 + spacing.sm * 2,
|
||||
marginRight: spacing.sm,
|
||||
marginBottom: spacing.sm
|
||||
}
|
||||
}))
|
||||
|
||||
@@ -0,0 +1,129 @@
|
||||
import { useMemo } from 'react'
|
||||
import { Pressable, ScrollView, Text, View } from 'react-native'
|
||||
import type { AskQuestion } from '../../../../../src/shared/native-chat/input/native-chat-ask-types'
|
||||
import { KeyedBottomDrawer } from '../../../components/bottom-drawer/keyed-bottom-drawer'
|
||||
import { SheetHeader } from '../../../components/nav-bar/SheetHeader'
|
||||
import { SheetPrimaryButton } from '../../../components/SheetPrimaryButton'
|
||||
import { useMobileTranslation } from '../../../i18n/use-mobile-translation'
|
||||
import { colors, radii, spacing, typography, pressedStyle } from '../../../theme/mobile-theme'
|
||||
import { themedStyleSheet } from '../../../theme/themed-styles'
|
||||
import { useMobileColorScheme } from '../../../theme/use-mobile-color-scheme'
|
||||
import { optionPreviewFont } from './mobile-native-chat-option-preview'
|
||||
|
||||
const sheetKey = () => 'option-preview'
|
||||
|
||||
export function MobileNativeChatOptionPreviewSheet({
|
||||
options,
|
||||
viewedIndex,
|
||||
selected,
|
||||
disabled,
|
||||
onView,
|
||||
onChoose,
|
||||
onClose
|
||||
}: {
|
||||
options: AskQuestion['options']
|
||||
viewedIndex: number | null
|
||||
selected: readonly number[]
|
||||
disabled: boolean
|
||||
onView: (index: number) => void
|
||||
onChoose: (index: number) => void
|
||||
onClose: () => void
|
||||
}): React.JSX.Element {
|
||||
useMobileColorScheme()
|
||||
const t = useMobileTranslation()
|
||||
const previews = useMemo(
|
||||
() => options.flatMap((option, index) => (option.preview ? [{ option, index }] : [])),
|
||||
[options]
|
||||
)
|
||||
return (
|
||||
<KeyedBottomDrawer
|
||||
sheet={viewedIndex}
|
||||
sheetKey={sheetKey}
|
||||
onClose={onClose}
|
||||
fillAvailable
|
||||
contentScrollable={false}
|
||||
dragContentToDismiss={false}
|
||||
>
|
||||
{(index) => {
|
||||
const option = options[index]!
|
||||
return (
|
||||
<>
|
||||
<SheetHeader
|
||||
title={option.label}
|
||||
subtitle={t('chat.ask.previewPosition', '{{current}} of {{total}}', {
|
||||
current: previews.findIndex((item) => item.index === index) + 1,
|
||||
total: previews.length
|
||||
})}
|
||||
onClose={onClose}
|
||||
/>
|
||||
<ReadablePreview
|
||||
// oxlint-disable-next-line react-doctor/no-array-index-as-key -- Option indices are immutable answer identities; changing pages resets both scroll axes.
|
||||
key={index}
|
||||
preview={option.preview ?? ''}
|
||||
/>
|
||||
{previews.length > 1 ? (
|
||||
<ScrollView
|
||||
horizontal
|
||||
style={styles.pages}
|
||||
contentContainerStyle={styles.pageContent}
|
||||
>
|
||||
{previews.map((item) => (
|
||||
<Pressable
|
||||
key={item.index}
|
||||
accessibilityRole="button"
|
||||
accessibilityLabel={t('chat.ask.optionPreview', '{{option}} preview', {
|
||||
option: item.option.label
|
||||
})}
|
||||
accessibilityState={{ selected: item.index === index }}
|
||||
onPress={() => onView(item.index)}
|
||||
style={({ pressed }) => [styles.page, pressed && pressedStyle]}
|
||||
>
|
||||
<View style={[styles.dot, item.index === index && styles.currentDot]} />
|
||||
</Pressable>
|
||||
))}
|
||||
</ScrollView>
|
||||
) : null}
|
||||
<SheetPrimaryButton
|
||||
label={
|
||||
selected.includes(index)
|
||||
? t('chat.ask.chosen', 'Chosen')
|
||||
: t('chat.ask.chooseThis', 'Choose this')
|
||||
}
|
||||
disabled={disabled}
|
||||
onPress={() => onChoose(index)}
|
||||
/>
|
||||
</>
|
||||
)
|
||||
}}
|
||||
</KeyedBottomDrawer>
|
||||
)
|
||||
}
|
||||
|
||||
function ReadablePreview({ preview }: { preview: string }): React.JSX.Element {
|
||||
useMobileColorScheme()
|
||||
return (
|
||||
<ScrollView style={styles.preview} showsVerticalScrollIndicator nestedScrollEnabled>
|
||||
<ScrollView horizontal showsHorizontalScrollIndicator nestedScrollEnabled>
|
||||
<Text selectable style={styles.text}>
|
||||
{preview}
|
||||
</Text>
|
||||
</ScrollView>
|
||||
</ScrollView>
|
||||
)
|
||||
}
|
||||
|
||||
const styles = themedStyleSheet(() => ({
|
||||
preview: { flex: 1, minHeight: 0, backgroundColor: colors.bgPanel },
|
||||
text: {
|
||||
padding: spacing.md,
|
||||
color: colors.textPrimary,
|
||||
fontFamily: optionPreviewFont,
|
||||
fontSize: typography.bodySize,
|
||||
lineHeight: typography.bodySize * 1.5
|
||||
},
|
||||
pages: { flexGrow: 0, marginVertical: spacing.xs },
|
||||
pageContent: { flexGrow: 1, justifyContent: 'center' },
|
||||
page: { width: 44, height: 44, alignItems: 'center', justifyContent: 'center' },
|
||||
dot: { width: 6, height: 6, borderRadius: radii.pill, backgroundColor: colors.borderSubtle },
|
||||
currentDot: { backgroundColor: colors.textPrimary }
|
||||
}))
|
||||
@@ -0,0 +1,117 @@
|
||||
import { useState } from 'react'
|
||||
import { Platform, Pressable, Text, View, type TextStyle } from 'react-native'
|
||||
import { MobileEdgeFade } from '../../../components/MobileEdgeFade'
|
||||
import { useMobileTranslation } from '../../../i18n/use-mobile-translation'
|
||||
import { colors, radii, spacing, typography, pressedStyle } from '../../../theme/mobile-theme'
|
||||
import { themedStyleSheet } from '../../../theme/themed-styles'
|
||||
import { useMobileColorScheme } from '../../../theme/use-mobile-color-scheme'
|
||||
import { optionPreviewFont } from './mobile-native-chat-option-preview'
|
||||
|
||||
const MAX_HEIGHT = 96 - spacing.sm * 2
|
||||
|
||||
export function MobileNativeChatOptionThumbnail({
|
||||
label,
|
||||
preview,
|
||||
onPress
|
||||
}: {
|
||||
label: string
|
||||
preview: string
|
||||
onPress: () => void
|
||||
}): React.JSX.Element {
|
||||
return (
|
||||
<MeasuredPreviewThumbnail key={preview} label={label} preview={preview} onPress={onPress} />
|
||||
)
|
||||
}
|
||||
|
||||
function MeasuredPreviewThumbnail({
|
||||
label,
|
||||
preview,
|
||||
onPress
|
||||
}: {
|
||||
label: string
|
||||
preview: string
|
||||
onPress: () => void
|
||||
}): React.JSX.Element {
|
||||
useMobileColorScheme()
|
||||
const t = useMobileTranslation()
|
||||
const [width, setWidth] = useState(0)
|
||||
const [bounds, setBounds] = useState<{ width: number; height: number } | null>(null)
|
||||
const scale = bounds && width > 0 ? Math.min(1, width / Math.max(1, bounds.width)) : 0
|
||||
const height = bounds && width > 0 ? Math.min(MAX_HEIGHT, bounds.height * scale) : MAX_HEIGHT
|
||||
|
||||
return (
|
||||
<Pressable
|
||||
accessibilityRole="button"
|
||||
accessibilityLabel={t('chat.ask.optionPreview', '{{option}} preview', { option: label })}
|
||||
onPress={onPress}
|
||||
style={({ pressed }) => [styles.thumbnail, pressed && pressedStyle]}
|
||||
>
|
||||
<View
|
||||
pointerEvents="none"
|
||||
onLayout={(event) => setWidth(event.nativeEvent.layout.width)}
|
||||
style={[styles.image, { height }]}
|
||||
accessibilityElementsHidden
|
||||
importantForAccessibility="no-hide-descendants"
|
||||
>
|
||||
<Text
|
||||
allowFontScaling={false}
|
||||
onLayout={(event) => {
|
||||
const { width, height } = event.nativeEvent.layout
|
||||
setBounds((previous) =>
|
||||
previous?.width === width && previous.height === height ? previous : { width, height }
|
||||
)
|
||||
}}
|
||||
style={[styles.text, { transform: [{ scale }] }]}
|
||||
>
|
||||
{preview}
|
||||
</Text>
|
||||
{height >= MAX_HEIGHT ? <MobileEdgeFade edge="bottom" /> : null}
|
||||
</View>
|
||||
<Text style={styles.view}>{t('chat.ask.viewPreview', 'View')}</Text>
|
||||
</Pressable>
|
||||
)
|
||||
}
|
||||
|
||||
const styles = themedStyleSheet(() => ({
|
||||
thumbnail: {
|
||||
minHeight: 44,
|
||||
padding: spacing.sm,
|
||||
borderWidth: 1,
|
||||
borderColor: colors.borderSubtle,
|
||||
borderRadius: radii.control,
|
||||
backgroundColor: colors.bgPanel,
|
||||
overflow: 'hidden'
|
||||
},
|
||||
// Native rows measure absolute Text intrinsically; the web uses its explicit CSS width below.
|
||||
image: { position: 'relative', flexDirection: 'row', overflow: 'hidden' },
|
||||
text: {
|
||||
position: 'absolute',
|
||||
...(Platform.OS === 'web'
|
||||
? {
|
||||
whiteSpace: 'pre' as const,
|
||||
// oxlint-disable-next-line typescript/consistent-type-assertions -- SAFETY: RN Web accepts intrinsic CSS widths; this branch never reaches native.
|
||||
width: 'max-content' as TextStyle['width']
|
||||
}
|
||||
: {}),
|
||||
top: 0,
|
||||
left: 0,
|
||||
transformOrigin: 'top left',
|
||||
fontFamily: optionPreviewFont,
|
||||
fontSize: typography.metaSize,
|
||||
lineHeight: typography.metaSize * 1.25,
|
||||
color: colors.textPrimary,
|
||||
includeFontPadding: false
|
||||
},
|
||||
view: {
|
||||
alignSelf: 'flex-end',
|
||||
color: colors.textSecondary,
|
||||
fontSize: typography.metaSize,
|
||||
fontWeight: '600',
|
||||
position: 'absolute',
|
||||
right: spacing.xs,
|
||||
bottom: spacing.xs,
|
||||
paddingHorizontal: spacing.sm,
|
||||
borderRadius: radii.pill,
|
||||
backgroundColor: colors.bgRaised
|
||||
}
|
||||
}))
|
||||
@@ -0,0 +1,7 @@
|
||||
import { Platform } from 'react-native'
|
||||
import { typography } from '../../../theme/mobile-theme'
|
||||
|
||||
export const optionPreviewFont = Platform.select({
|
||||
ios: 'Menlo',
|
||||
default: typography.monoFamily
|
||||
})
|
||||
@@ -1,18 +1,11 @@
|
||||
import { useRef } from 'react'
|
||||
import type {
|
||||
LayoutChangeEvent,
|
||||
NativeScrollEvent,
|
||||
NativeSyntheticEvent,
|
||||
ScrollView,
|
||||
TextInput
|
||||
} from 'react-native'
|
||||
import type { LayoutChangeEvent, ScrollView, TextInput } from 'react-native'
|
||||
|
||||
// Keep a focused reply in view when its card shrinks above the keyboard.
|
||||
export function useMobileNativeChatReplyScroll() {
|
||||
const scrollRef = useRef<ScrollView>(null)
|
||||
const inputRef = useRef<TextInput>(null)
|
||||
const viewportHeight = useRef(0)
|
||||
const scrollOffset = useRef(0)
|
||||
const revealReply = (): void => {
|
||||
if (inputRef.current?.isFocused()) {
|
||||
scrollRef.current?.scrollToEnd({ animated: false })
|
||||
@@ -27,31 +20,5 @@ export function useMobileNativeChatReplyScroll() {
|
||||
revealReply()
|
||||
}
|
||||
}
|
||||
const onScroll = (event: NativeSyntheticEvent<NativeScrollEvent>): void => {
|
||||
scrollOffset.current = event.nativeEvent.contentOffset.y
|
||||
}
|
||||
// Scroll just enough to show content that opened below the visible edge, never past its top.
|
||||
const revealContent = (top: number, bottom: number): void => {
|
||||
const hidden = bottom - (scrollOffset.current + viewportHeight.current)
|
||||
if (viewportHeight.current > 0 && hidden > 0) {
|
||||
scrollRef.current?.scrollTo({
|
||||
y: Math.min(scrollOffset.current + hidden, top),
|
||||
animated: true
|
||||
})
|
||||
}
|
||||
}
|
||||
const scrollViewProps = {
|
||||
ref: scrollRef,
|
||||
onLayout: onViewportLayout,
|
||||
onScroll,
|
||||
scrollEventThrottle: 16
|
||||
}
|
||||
return {
|
||||
scrollRef,
|
||||
inputRef,
|
||||
revealReply,
|
||||
onViewportLayout,
|
||||
scrollViewProps,
|
||||
revealContent
|
||||
}
|
||||
return { scrollRef, inputRef, revealReply, onViewportLayout }
|
||||
}
|
||||
|
||||
@@ -0,0 +1,183 @@
|
||||
import { useRef } from 'react'
|
||||
import { Pressable, Text, View } from 'react-native'
|
||||
import { FileText, Globe, SquareTerminal } from 'lucide-react-native'
|
||||
import type { TuiAgent } from '../../../../src/shared/agent-launch/catalog/tui-agent'
|
||||
import { ActionSheetContent, type ActionSheetAction } from '../../components/ActionSheetModal'
|
||||
import { BottomDrawer } from '../../components/bottom-drawer/BottomDrawer'
|
||||
import {
|
||||
LIST_LEADING_INSET,
|
||||
ListGroup,
|
||||
ListRow,
|
||||
SectionHeader
|
||||
} from '../../components/list/ListGroup'
|
||||
import { MobileAgentIcon } from '../../components/MobileAgentIcon'
|
||||
import { SheetHeader } from '../../components/nav-bar/SheetHeader'
|
||||
import { useMobileTranslation } from '../../i18n/use-mobile-translation'
|
||||
import { colors, radii, spacing } from '../../theme/mobile-theme'
|
||||
import { themedStyleSheet } from '../../theme/themed-styles'
|
||||
import { useMobileColorScheme } from '../../theme/use-mobile-color-scheme'
|
||||
import type { MobileNewTabAgentOption } from '../agent-launch/mobile-new-tab-agent-options'
|
||||
|
||||
const AGENT_GRID_COLUMNS = 3
|
||||
|
||||
type Props = {
|
||||
visible: boolean
|
||||
workspaceName: string
|
||||
agentOptions: readonly MobileNewTabAgentOption[]
|
||||
/** Loading, none, other-server or error; shown instead of the agent grid. */
|
||||
agentStatusRow: ActionSheetAction | null
|
||||
canCreateBrowser: boolean
|
||||
canCreateMarkdownNote: boolean
|
||||
onClose: () => void
|
||||
onCreateAgent: (agent: TuiAgent) => void
|
||||
onCreateTerminal: () => void
|
||||
/** Runs after the sheet has gone, so it may open another modal. */
|
||||
onCreateBrowser: () => void
|
||||
onCreateMarkdownNote: () => void
|
||||
}
|
||||
|
||||
export function MobileNewTabSheet({
|
||||
visible,
|
||||
workspaceName,
|
||||
agentOptions,
|
||||
agentStatusRow,
|
||||
canCreateBrowser,
|
||||
canCreateMarkdownNote,
|
||||
onClose,
|
||||
onCreateAgent,
|
||||
onCreateTerminal,
|
||||
onCreateBrowser,
|
||||
onCreateMarkdownNote
|
||||
}: Props) {
|
||||
useMobileColorScheme()
|
||||
const t = useMobileTranslation()
|
||||
// Wait for the iOS sheet window to unmount before presenting another native modal.
|
||||
const afterCloseRef = useRef<(() => void) | null>(null)
|
||||
const closeThen = (action: () => void) => {
|
||||
afterCloseRef.current = action
|
||||
onClose()
|
||||
}
|
||||
const closeAndRun = (action: () => void) => {
|
||||
onClose()
|
||||
action()
|
||||
}
|
||||
const showAgentGrid = agentStatusRow === null && agentOptions.length > 0
|
||||
// Short last rows keep empty slots so every tile stays a third of the row wide.
|
||||
const agentRows: { options: MobileNewTabAgentOption[]; emptySlots: string[] }[] = []
|
||||
for (let start = 0; start < agentOptions.length; start += AGENT_GRID_COLUMNS) {
|
||||
const options = agentOptions.slice(start, start + AGENT_GRID_COLUMNS)
|
||||
const emptySlots: string[] = []
|
||||
for (let column = options.length; column < AGENT_GRID_COLUMNS; column += 1) {
|
||||
emptySlots.push(`empty:${column}`)
|
||||
}
|
||||
agentRows.push({ options, emptySlots })
|
||||
}
|
||||
const iconColor = colors.textSecondary
|
||||
return (
|
||||
<BottomDrawer
|
||||
visible={visible}
|
||||
onClose={onClose}
|
||||
onAfterClose={() => {
|
||||
const run = afterCloseRef.current
|
||||
afterCloseRef.current = null
|
||||
run?.()
|
||||
}}
|
||||
dragContentToDismiss
|
||||
>
|
||||
<SheetHeader
|
||||
title={t('session.sheets.newTab', 'New Tab')}
|
||||
{...(workspaceName ? { subtitle: workspaceName } : {})}
|
||||
onClose={onClose}
|
||||
/>
|
||||
{showAgentGrid || agentStatusRow ? (
|
||||
<SectionHeader title={t('session.sheets.agents', 'Agents')} first />
|
||||
) : null}
|
||||
{agentStatusRow ? <ActionSheetContent actions={[agentStatusRow]} /> : null}
|
||||
{showAgentGrid ? (
|
||||
<View style={styles.grid}>
|
||||
{agentRows.map((row) => (
|
||||
<View key={row.options.map((option) => option.agent).join(':')} style={styles.gridRow}>
|
||||
{row.options.map((option) => (
|
||||
<Pressable
|
||||
key={option.agent}
|
||||
onPress={() => closeAndRun(() => onCreateAgent(option.agent))}
|
||||
accessibilityRole="button"
|
||||
accessibilityLabel={option.label}
|
||||
style={styles.tile}
|
||||
>
|
||||
{({ pressed }) => (
|
||||
<>
|
||||
{pressed ? <View style={styles.tilePressed} /> : null}
|
||||
<MobileAgentIcon agentId={option.agent} size={22} />
|
||||
<Text style={styles.tileLabel} numberOfLines={1}>
|
||||
{option.label}
|
||||
</Text>
|
||||
</>
|
||||
)}
|
||||
</Pressable>
|
||||
))}
|
||||
{row.emptySlots.map((slot) => (
|
||||
<View key={slot} style={styles.tileSpacer} />
|
||||
))}
|
||||
</View>
|
||||
))}
|
||||
</View>
|
||||
) : null}
|
||||
<ListGroup separatorInset={LIST_LEADING_INSET} style={styles.actions}>
|
||||
<ListRow
|
||||
key="terminal"
|
||||
title={t('session.sheets.terminal', 'Terminal')}
|
||||
leading={<SquareTerminal size={16} color={iconColor} />}
|
||||
onPress={() => closeAndRun(onCreateTerminal)}
|
||||
/>
|
||||
{canCreateBrowser ? (
|
||||
<ListRow
|
||||
key="browser"
|
||||
title={t('session.sheets.browser', 'Browser')}
|
||||
leading={<Globe size={16} color={iconColor} />}
|
||||
navigates
|
||||
onPress={() => closeThen(onCreateBrowser)}
|
||||
/>
|
||||
) : null}
|
||||
{canCreateMarkdownNote ? (
|
||||
<ListRow
|
||||
key="markdownNote"
|
||||
title={t('session.sheets.markdownNote', 'Markdown Note')}
|
||||
leading={<FileText size={16} color={iconColor} />}
|
||||
onPress={() => closeAndRun(onCreateMarkdownNote)}
|
||||
/>
|
||||
) : null}
|
||||
</ListGroup>
|
||||
</BottomDrawer>
|
||||
)
|
||||
}
|
||||
|
||||
const styles = themedStyleSheet(() => ({
|
||||
grid: { gap: spacing.sm },
|
||||
gridRow: { flexDirection: 'row', gap: spacing.sm },
|
||||
tile: {
|
||||
flex: 1,
|
||||
minWidth: 0,
|
||||
height: 78,
|
||||
borderRadius: radii.surface,
|
||||
backgroundColor: colors.sheetGroup,
|
||||
overflow: 'hidden',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
gap: spacing.sm,
|
||||
paddingHorizontal: spacing.sm
|
||||
},
|
||||
// Same wash as a pressed ListRow, laid over the tile so its own fill stays underneath.
|
||||
tilePressed: {
|
||||
position: 'absolute',
|
||||
top: 0,
|
||||
right: 0,
|
||||
bottom: 0,
|
||||
left: 0,
|
||||
backgroundColor: colors.translucentFill
|
||||
},
|
||||
tileLabel: { fontSize: 13.5, fontWeight: '600', color: colors.textPrimary, maxWidth: '100%' },
|
||||
// Padded like a tile: flex shares space after padding, so a bare spacer would widen its row's tiles.
|
||||
tileSpacer: { flex: 1, paddingHorizontal: spacing.sm },
|
||||
actions: { marginTop: spacing.lg }
|
||||
}))
|
||||
@@ -0,0 +1,361 @@
|
||||
import { useMemo, useRef, useState } from 'react'
|
||||
import { Pressable, Text, View } from 'react-native'
|
||||
import { Plus } from 'lucide-react-native'
|
||||
import { Gesture, GestureDetector } from 'react-native-gesture-handler'
|
||||
import Animated, {
|
||||
Easing,
|
||||
ReduceMotion,
|
||||
useAnimatedStyle,
|
||||
useSharedValue,
|
||||
withSequence,
|
||||
withTiming
|
||||
} from 'react-native-reanimated'
|
||||
import { triggerMediumImpact, triggerSelection } from '../../platform/haptics'
|
||||
import { useMobileTranslation } from '../../i18n/use-mobile-translation'
|
||||
import { AgentStateDot } from '../../components/AgentStateDot'
|
||||
import { ArrivalFade } from '../../components/ArrivalFade'
|
||||
import { useDrawerReducedMotion } from '../../components/bottom-drawer/bottom-drawer-constants'
|
||||
import { SHEET_CURVE } from '../../components/sheet-motion-values'
|
||||
import { useReducedMotionEnabled } from '../../platform/use-reduced-motion'
|
||||
import { useKeyboardPersistingTaps } from '../../platform/keyboard-persisting-taps'
|
||||
import { useNow } from '../../hooks/use-now'
|
||||
import { agentStateLabel, type AgentDotState } from '../../worktree/agent-row-display'
|
||||
import { colors, feedback, radii, spacing } from '../../theme/mobile-theme'
|
||||
import { themedStyleSheet } from '../../theme/themed-styles'
|
||||
import { useMobileColorScheme } from '../../theme/use-mobile-color-scheme'
|
||||
import { buildMobileSessionTabRow, type MobileSessionTabRow } from './mobile-session-tab-rows'
|
||||
import { MobileSessionTabMark } from './MobileSessionTabMark'
|
||||
import { MobileSessionTabsSheet } from './MobileSessionTabsSheet'
|
||||
import type { MobileSessionController } from '../use-mobile-session-controller'
|
||||
|
||||
const SWIPE_SETTLE_MS = 250
|
||||
// A tab arriving from the side starts this far out, as a share of the tab cell's width.
|
||||
const SWIPE_ENTRY_SHARE = 0.4
|
||||
const FLICK_VELOCITY = 600
|
||||
// With no tab on that side, the tab gives only this share of the drag.
|
||||
const EDGE_RESISTANCE = 0.25
|
||||
const DRAG_CLICK_WINDOW_MS = 400
|
||||
|
||||
// A tab drawn before it had any agent state (from the phone's store) fades its dot in when one lands.
|
||||
function TabBarDot({ tabId, state }: { tabId: string; state: AgentDotState | undefined }) {
|
||||
const [startedEmpty] = useState({ tabId, empty: state === undefined })
|
||||
if (startedEmpty.tabId === tabId && startedEmpty.empty) {
|
||||
return <ArrivingTabBarDot state={state} />
|
||||
}
|
||||
return state && state !== 'idle' ? <AgentStateDot state={state} /> : null
|
||||
}
|
||||
|
||||
// Mounted with the bare tab, so the motion preference is read before the dot arrives.
|
||||
function ArrivingTabBarDot({ state }: { state: AgentDotState | undefined }) {
|
||||
const reducedMotion = useReducedMotionEnabled()
|
||||
if (!state || state === 'idle') {
|
||||
return null
|
||||
}
|
||||
return (
|
||||
<ArrivalFade animate={reducedMotion === false}>
|
||||
<AgentStateDot state={state} />
|
||||
</ArrivalFade>
|
||||
)
|
||||
}
|
||||
|
||||
/** The tab you're in as one cell: tap for its actions, swipe for the next one; the count shows every tab, + adds one. */
|
||||
export function MobileSessionTabBar({
|
||||
controller,
|
||||
inTopBar,
|
||||
actionsCollapsed = false
|
||||
}: {
|
||||
controller: MobileSessionController
|
||||
inTopBar: boolean
|
||||
actionsCollapsed?: boolean
|
||||
}) {
|
||||
useMobileColorScheme()
|
||||
const t = useMobileTranslation()
|
||||
const {
|
||||
activeSessionTabId,
|
||||
connState,
|
||||
createTabBusy,
|
||||
handleOpenNewTab,
|
||||
switchSessionTab,
|
||||
openSessionTabActionSheetAfterKeyboardDismiss,
|
||||
visibleTabs,
|
||||
terminals
|
||||
} = controller
|
||||
// Why: the first tap must reach the bar with the keyboard open instead of only dismissing it (#5106).
|
||||
const keepsKeyboard = useKeyboardPersistingTaps('handled')
|
||||
const now = useNow(60_000)
|
||||
const rows = useMemo(
|
||||
() => visibleTabs.map((tab) => buildMobileSessionTabRow(tab, terminals, now)),
|
||||
[visibleTabs, terminals, now]
|
||||
)
|
||||
const activeIndex = rows.findIndex((row) => row.tab.id === activeSessionTabId)
|
||||
const active: MobileSessionTabRow | undefined = rows[activeIndex]
|
||||
const previous = activeIndex > 0 ? rows[activeIndex - 1] : undefined
|
||||
const next = activeIndex !== -1 ? rows[activeIndex + 1] : undefined
|
||||
const othersNeedYou = rows.some(
|
||||
(row) => row.tab.id !== activeSessionTabId && row.group === 'needs-you'
|
||||
)
|
||||
const [sheetOpen, setSheetOpen] = useState(false)
|
||||
|
||||
const reducedMotion = useDrawerReducedMotion()
|
||||
const offset = useSharedValue(0)
|
||||
const width = useSharedValue(0)
|
||||
// On the web, releasing a mouse drag also clicks the tab.
|
||||
const dragEndedAtRef = useRef(0)
|
||||
const settle = (to: number) =>
|
||||
withTiming(
|
||||
to,
|
||||
reducedMotion
|
||||
? { duration: 0, reduceMotion: ReduceMotion.Never }
|
||||
: { duration: SWIPE_SETTLE_MS, easing: Easing.bezier(...SHEET_CURVE) }
|
||||
)
|
||||
const step = (target: MobileSessionTabRow | undefined, direction: 1 | -1) => {
|
||||
if (!target) {
|
||||
offset.value = settle(0)
|
||||
return
|
||||
}
|
||||
triggerSelection()
|
||||
switchSessionTab(target.tab)
|
||||
offset.value = withSequence(
|
||||
withTiming(-direction * width.value * SWIPE_ENTRY_SHARE, { duration: 0 }),
|
||||
settle(0)
|
||||
)
|
||||
}
|
||||
// Callbacks run on JS: the session page is a web document, and stepping switches React state.
|
||||
const pan = Gesture.Pan()
|
||||
.runOnJS(true)
|
||||
.enabled(rows.length > 1)
|
||||
.activeOffsetX([-12, 12])
|
||||
.failOffsetY([-10, 10])
|
||||
.onUpdate((event) => {
|
||||
const target = event.translationX > 0 ? previous : next
|
||||
offset.value = target ? event.translationX : event.translationX * EDGE_RESISTANCE
|
||||
})
|
||||
.onEnd((event) => {
|
||||
// oxlint-disable-next-line react/purity -- runs when the drag ends, never during render.
|
||||
dragEndedAtRef.current = Date.now()
|
||||
const direction = event.translationX > 0 ? 1 : -1
|
||||
const flicked =
|
||||
Math.abs(event.velocityX) > FLICK_VELOCITY && Math.sign(event.velocityX) === direction
|
||||
if (Math.abs(event.translationX) > width.value / 2 || flicked) {
|
||||
step(direction === 1 ? previous : next, direction)
|
||||
return
|
||||
}
|
||||
offset.value = settle(0)
|
||||
})
|
||||
// Web has no worklet plugin; mapper hooks need this explicit dependency list.
|
||||
const contentStyle = useAnimatedStyle(
|
||||
() => ({
|
||||
transform: [{ translateX: offset.value }],
|
||||
opacity: 1 - Math.min(Math.abs(offset.value) / Math.max(width.value, 1), 1) * 0.6
|
||||
}),
|
||||
[offset, width]
|
||||
)
|
||||
|
||||
const status = active?.dotState && active.dotState !== 'idle' ? active.dotState : undefined
|
||||
const countLabel =
|
||||
rows.length === 1
|
||||
? t('session.tabBar.oneTab', '1 tab')
|
||||
: t('session.tabBar.tabCount', '{{count}} tabs', { count: rows.length })
|
||||
const tabLabel = [active?.title, status ? agentStateLabel(status) : null]
|
||||
.filter(Boolean)
|
||||
.join(', ')
|
||||
const countAccessibilityLabel = [
|
||||
countLabel,
|
||||
othersNeedYou ? t('session.tabBar.anotherNeedsYou', 'another tab needs you') : null
|
||||
]
|
||||
.filter(Boolean)
|
||||
.join(', ')
|
||||
const createDisabled = createTabBusy || connState !== 'connected'
|
||||
const openTabActions = () => {
|
||||
// The click a drag release produces on the web belongs to the drag.
|
||||
if (!active || Date.now() - dragEndedAtRef.current < DRAG_CLICK_WINDOW_MS) {
|
||||
return
|
||||
}
|
||||
openSessionTabActionSheetAfterKeyboardDismiss(active.tab)
|
||||
}
|
||||
|
||||
return (
|
||||
<View ref={keepsKeyboard} style={inTopBar ? styles.barInTopBar : styles.bar}>
|
||||
{/* pan-y keeps vertical touches with the page on the web. */}
|
||||
<GestureDetector gesture={pan} touchAction="pan-y">
|
||||
<View
|
||||
style={styles.tabCell}
|
||||
onLayout={(event) => {
|
||||
width.value = event.nativeEvent.layout.width
|
||||
}}
|
||||
>
|
||||
<Pressable
|
||||
style={({ pressed }) => [styles.tabPress, pressed && styles.cellPressed]}
|
||||
onPress={openTabActions}
|
||||
onLongPress={() => {
|
||||
triggerMediumImpact()
|
||||
openTabActions()
|
||||
}}
|
||||
delayLongPress={400}
|
||||
disabled={!active}
|
||||
accessibilityRole="button"
|
||||
accessibilityLabel={tabLabel || countLabel}
|
||||
accessibilityHint={t('session.tabBar.actionsHint', 'Shows actions for this tab')}
|
||||
accessibilityActions={[
|
||||
...(next ? [{ name: 'nextTab', label: t('session.tabBar.next', 'Next tab') }] : []),
|
||||
...(previous
|
||||
? [{ name: 'previousTab', label: t('session.tabBar.previous', 'Previous tab') }]
|
||||
: [])
|
||||
]}
|
||||
onAccessibilityAction={(event) => {
|
||||
const name = event.nativeEvent.actionName
|
||||
if (name === 'nextTab') {
|
||||
step(next, -1)
|
||||
} else if (name === 'previousTab') {
|
||||
step(previous, 1)
|
||||
}
|
||||
}}
|
||||
>
|
||||
{/* Only the contents slide, so the cell stays flush with the screen edge. */}
|
||||
<Animated.View style={[styles.tabContent, contentStyle]}>
|
||||
{active ? (
|
||||
<>
|
||||
<TabBarDot tabId={active.tab.id} state={active.dotState} />
|
||||
<View style={styles.mark}>
|
||||
<MobileSessionTabMark row={active} size={14} />
|
||||
</View>
|
||||
</>
|
||||
) : null}
|
||||
<Text style={styles.title} numberOfLines={1}>
|
||||
{active?.title ?? countLabel}
|
||||
</Text>
|
||||
</Animated.View>
|
||||
</Pressable>
|
||||
</View>
|
||||
</GestureDetector>
|
||||
<Pressable
|
||||
style={({ pressed }) => [
|
||||
styles.sideCell,
|
||||
actionsCollapsed && !inTopBar && styles.lastCell,
|
||||
pressed && styles.cellPressed
|
||||
]}
|
||||
onPress={() => setSheetOpen(true)}
|
||||
accessibilityRole="button"
|
||||
accessibilityLabel={countAccessibilityLabel}
|
||||
accessibilityHint={t('session.tabBar.hint', 'Shows all tabs')}
|
||||
>
|
||||
<View style={styles.countBox}>
|
||||
<Text style={styles.countText}>{rows.length}</Text>
|
||||
</View>
|
||||
{othersNeedYou ? <View style={styles.alert} /> : null}
|
||||
</Pressable>
|
||||
{/* A collapsed bar's + lives in the header's ⋯ menu. */}
|
||||
{!actionsCollapsed ? (
|
||||
<Pressable
|
||||
style={({ pressed }) => [
|
||||
styles.sideCell,
|
||||
!inTopBar && styles.lastCell,
|
||||
pressed && styles.cellPressed,
|
||||
createDisabled && styles.cellDisabled
|
||||
]}
|
||||
disabled={createDisabled}
|
||||
onPress={handleOpenNewTab}
|
||||
accessibilityRole="button"
|
||||
accessibilityLabel={t('session.tabStrip.newTab', 'New tab')}
|
||||
accessibilityState={{ disabled: createDisabled }}
|
||||
>
|
||||
<Plus size={18} color={colors.textPrimary} strokeWidth={2.2} />
|
||||
</Pressable>
|
||||
) : null}
|
||||
<MobileSessionTabsSheet
|
||||
controller={controller}
|
||||
rows={rows}
|
||||
visible={sheetOpen}
|
||||
onClose={() => setSheetOpen(false)}
|
||||
/>
|
||||
</View>
|
||||
)
|
||||
}
|
||||
|
||||
const styles = themedStyleSheet(() => ({
|
||||
bar: {
|
||||
height: 44,
|
||||
flexDirection: 'row',
|
||||
alignItems: 'stretch',
|
||||
borderTopWidth: 1,
|
||||
borderTopColor: colors.borderSubtle
|
||||
},
|
||||
// Cancels the top bar's vertical padding so the cells run the bar's full height.
|
||||
barInTopBar: {
|
||||
flex: 1,
|
||||
minWidth: 0,
|
||||
flexDirection: 'row',
|
||||
alignItems: 'stretch',
|
||||
alignSelf: 'stretch',
|
||||
marginVertical: -spacing.xs,
|
||||
marginLeft: spacing.md,
|
||||
borderLeftWidth: 1,
|
||||
borderLeftColor: colors.borderSubtle
|
||||
},
|
||||
// The open tab, drawn like the strip's active tab: raised, with a line under it.
|
||||
tabCell: {
|
||||
flex: 1,
|
||||
minWidth: 0,
|
||||
backgroundColor: colors.bgRaised,
|
||||
borderBottomWidth: 2,
|
||||
borderBottomColor: colors.textSecondary,
|
||||
borderRightWidth: 1,
|
||||
borderRightColor: colors.borderSubtle,
|
||||
overflow: 'hidden'
|
||||
},
|
||||
tabPress: {
|
||||
flex: 1,
|
||||
justifyContent: 'center',
|
||||
paddingLeft: spacing.lg,
|
||||
paddingRight: spacing.sm
|
||||
},
|
||||
tabContent: { flexDirection: 'row', alignItems: 'center', gap: 6 },
|
||||
// Keeps web SVGs from shrinking before the title ellipsizes.
|
||||
mark: { flexShrink: 0 },
|
||||
title: {
|
||||
flexShrink: 1,
|
||||
minWidth: 0,
|
||||
fontSize: 14,
|
||||
fontWeight: '600',
|
||||
color: colors.textPrimary
|
||||
},
|
||||
sideCell: {
|
||||
width: 46,
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
borderRightWidth: 1,
|
||||
borderRightColor: colors.borderSubtle
|
||||
},
|
||||
// At the screen edge; in the top bar the hairline stays to part the cells from the round buttons.
|
||||
lastCell: { borderRightWidth: 0 },
|
||||
cellPressed: { backgroundColor: colors.translucentFill },
|
||||
cellDisabled: { opacity: feedback.disabledOpacity },
|
||||
countBox: {
|
||||
minWidth: 19,
|
||||
height: 19,
|
||||
paddingHorizontal: 3,
|
||||
borderRadius: 6,
|
||||
borderWidth: 1.8,
|
||||
borderColor: colors.textPrimary,
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center'
|
||||
},
|
||||
countText: {
|
||||
fontSize: 11,
|
||||
fontWeight: '700',
|
||||
color: colors.textPrimary,
|
||||
fontVariant: ['tabular-nums']
|
||||
},
|
||||
// Another tab needs you: a red dot on the count's corner, ringed in the bar's colour.
|
||||
alert: {
|
||||
position: 'absolute',
|
||||
top: 8,
|
||||
right: 9,
|
||||
width: 9,
|
||||
height: 9,
|
||||
borderRadius: radii.pill,
|
||||
backgroundColor: colors.statusRed,
|
||||
borderWidth: 2,
|
||||
borderColor: colors.bgPanel
|
||||
}
|
||||
}))
|
||||
@@ -0,0 +1,28 @@
|
||||
import { File, FileText, Globe, SquareTerminal } from 'lucide-react-native'
|
||||
import { MobileAgentIcon } from '../../components/MobileAgentIcon'
|
||||
import { colors } from '../../theme/mobile-theme'
|
||||
import { useMobileColorScheme } from '../../theme/use-mobile-color-scheme'
|
||||
import type { MobileSessionTabRow } from './mobile-session-tab-rows'
|
||||
|
||||
/** The tab's agent icon, else an icon for what kind of tab it is. */
|
||||
export function MobileSessionTabMark({
|
||||
row,
|
||||
size
|
||||
}: {
|
||||
row: Pick<MobileSessionTabRow, 'tab' | 'agentId'>
|
||||
size: number
|
||||
}) {
|
||||
useMobileColorScheme()
|
||||
if (row.agentId) {
|
||||
return <MobileAgentIcon agentId={row.agentId} size={size} />
|
||||
}
|
||||
const Icon =
|
||||
row.tab.type === 'browser'
|
||||
? Globe
|
||||
: row.tab.type === 'markdown'
|
||||
? FileText
|
||||
: row.tab.type === 'file'
|
||||
? File
|
||||
: SquareTerminal
|
||||
return <Icon size={size} color={colors.textSecondary} strokeWidth={2.1} />
|
||||
}
|
||||
@@ -1,327 +0,0 @@
|
||||
import { useCallback, useMemo, useRef, useState } from 'react'
|
||||
import { View, Text, ScrollView, Pressable, StyleSheet } from 'react-native'
|
||||
import { File, FileText, Globe, Plus, SquareTerminal } from 'lucide-react-native'
|
||||
import { triggerMediumImpact } from '../../platform/haptics'
|
||||
import { useMobileTranslation } from '../../i18n/use-mobile-translation'
|
||||
import { MobileAgentIcon } from '../../components/MobileAgentIcon'
|
||||
import { AgentStateDot } from '../../components/AgentStateDot'
|
||||
import { ArrivalFade } from '../../components/ArrivalFade'
|
||||
import { useReducedMotionEnabled } from '../../platform/use-reduced-motion'
|
||||
import { useNow } from '../../hooks/use-now'
|
||||
import {
|
||||
agentDotState,
|
||||
agentStateLabel,
|
||||
type AgentDotState
|
||||
} from '../../worktree/agent-row-display'
|
||||
import {
|
||||
getMobileTerminalTabHostAgentIdentity,
|
||||
getMobileSessionTabTitle,
|
||||
resolveMobileTerminalTabAgentId
|
||||
} from '../../terminal/session/mobile-terminal-tab-agent'
|
||||
import { colors, spacing } from '../../theme/mobile-theme'
|
||||
import { useMobileColorScheme } from '../../theme/use-mobile-color-scheme'
|
||||
import { NavBarButton } from '../../components/nav-bar/NavBarButton'
|
||||
import {
|
||||
resolveTabStripEdgeHint,
|
||||
resolveTabStripHiddenTabs,
|
||||
resolveTabStripTapOffset,
|
||||
type TabStripHiddenTabs
|
||||
} from './tab-strip-scroll'
|
||||
import { styles } from '../mobile-session-styles'
|
||||
import { useKeyboardPersistingTaps } from '../../platform/keyboard-persisting-taps'
|
||||
import type { MobileSessionController } from '../use-mobile-session-controller'
|
||||
|
||||
const DOUBLE_TAP_RENAME_MS = 300
|
||||
|
||||
// A tab drawn before it had any agent state (a strip from the phone's store) fades its dot in when one lands.
|
||||
function SessionTabAgentDot({ state }: { state: AgentDotState | undefined }) {
|
||||
const [startedEmpty] = useState(state === undefined)
|
||||
if (startedEmpty) {
|
||||
return <ArrivingSessionTabAgentDot state={state} />
|
||||
}
|
||||
return state && state !== 'idle' ? <AgentStateDot state={state} /> : null
|
||||
}
|
||||
|
||||
// Mounted with the bare tab, so the motion preference is read before the dot arrives.
|
||||
function ArrivingSessionTabAgentDot({ state }: { state: AgentDotState | undefined }) {
|
||||
const reducedMotion = useReducedMotionEnabled()
|
||||
if (!state || state === 'idle') {
|
||||
return null
|
||||
}
|
||||
return (
|
||||
<ArrivalFade animate={reducedMotion === false}>
|
||||
<AgentStateDot state={state} />
|
||||
</ArrivalFade>
|
||||
)
|
||||
}
|
||||
|
||||
export function MobileSessionTabStrip({
|
||||
controller,
|
||||
inTopBar,
|
||||
actionsCollapsed = false
|
||||
}: {
|
||||
controller: MobileSessionController
|
||||
inTopBar: boolean
|
||||
actionsCollapsed?: boolean
|
||||
}) {
|
||||
useMobileColorScheme()
|
||||
const t = useMobileTranslation()
|
||||
const {
|
||||
activeSessionTabId,
|
||||
activeSessionTabIdRef,
|
||||
tabStripRef,
|
||||
tabStripOffsetRef,
|
||||
tabStripViewportWidthRef,
|
||||
tabStripContentWidthRef,
|
||||
tabLayoutsRef,
|
||||
connState,
|
||||
createTabBusy,
|
||||
handleOpenNewTab,
|
||||
scrollActiveTabIntoView,
|
||||
holdTabStripReveal,
|
||||
cancelHeldTabStripReveal,
|
||||
switchSessionTab,
|
||||
openSessionTabActionSheetAfterKeyboardDismiss,
|
||||
setRenameTarget,
|
||||
activeHandleRef,
|
||||
visibleTabs,
|
||||
terminals
|
||||
} = controller
|
||||
const tabBarKeepsKeyboard = useKeyboardPersistingTaps('handled')
|
||||
const lastTabTapRef = useRef<{ id: string; at: number } | null>(null)
|
||||
const now = useNow(60_000)
|
||||
const tabStates = useMemo(() => {
|
||||
const states = new Map<string, AgentDotState>()
|
||||
for (const tab of visibleTabs) {
|
||||
// Why: a status restored across a host restart is unconfirmed, so like desktop it shows no live state.
|
||||
if (tab.type === 'terminal' && tab.agentStatus && !tab.agentStatus.restoredUnconfirmed) {
|
||||
states.set(tab.id, agentDotState(tab.agentStatus, now))
|
||||
} else if (tab.type === 'agent-session' && tab.chatStatus) {
|
||||
states.set(tab.id, agentDotState(tab.chatStatus, now))
|
||||
}
|
||||
}
|
||||
return states
|
||||
}, [visibleTabs, now])
|
||||
const [hiddenTabs, setHiddenTabs] = useState<TabStripHiddenTabs>({ left: [], right: [] })
|
||||
const refreshHiddenTabs = () => {
|
||||
const next = resolveTabStripHiddenTabs({
|
||||
layouts: tabLayoutsRef.current,
|
||||
viewportWidth: tabStripViewportWidthRef.current,
|
||||
currentOffset: tabStripOffsetRef.current
|
||||
})
|
||||
// Why: scroll fires every frame; re-render only when a tab crosses an edge.
|
||||
setHiddenTabs((prev) =>
|
||||
prev.left.join('\n') === next.left.join('\n') &&
|
||||
prev.right.join('\n') === next.right.join('\n')
|
||||
? prev
|
||||
: next
|
||||
)
|
||||
}
|
||||
const leftHint = resolveTabStripEdgeHint(hiddenTabs.left, tabStates)
|
||||
const rightHint = resolveTabStripEdgeHint(hiddenTabs.right, tabStates)
|
||||
const pressTab = useCallback(
|
||||
(t: (typeof visibleTabs)[number]) => {
|
||||
const at = Date.now()
|
||||
const lastTap = lastTabTapRef.current
|
||||
lastTabTapRef.current = { id: t.id, at }
|
||||
if (
|
||||
lastTap?.id === t.id &&
|
||||
at - lastTap.at < DOUBLE_TAP_RENAME_MS &&
|
||||
t.type === 'terminal' &&
|
||||
typeof t.terminal === 'string'
|
||||
) {
|
||||
lastTabTapRef.current = null
|
||||
triggerMediumImpact()
|
||||
setRenameTarget({
|
||||
handle: t.terminal,
|
||||
title: t.title,
|
||||
isActive: t.terminal === activeHandleRef.current
|
||||
})
|
||||
// The first tap's held reveal still runs once the window closes.
|
||||
return
|
||||
}
|
||||
cancelHeldTabStripReveal()
|
||||
const nextOffset = resolveTabStripTapOffset({
|
||||
tabId: t.id,
|
||||
tabs: visibleTabs,
|
||||
layouts: tabLayoutsRef.current,
|
||||
viewportWidth: tabStripViewportWidthRef.current,
|
||||
contentWidth: tabStripContentWidthRef.current,
|
||||
currentOffset: tabStripOffsetRef.current
|
||||
})
|
||||
if (nextOffset !== tabStripOffsetRef.current) {
|
||||
holdTabStripReveal(nextOffset, DOUBLE_TAP_RENAME_MS)
|
||||
}
|
||||
switchSessionTab(t)
|
||||
},
|
||||
[
|
||||
activeHandleRef,
|
||||
cancelHeldTabStripReveal,
|
||||
holdTabStripReveal,
|
||||
setRenameTarget,
|
||||
switchSessionTab,
|
||||
tabLayoutsRef,
|
||||
tabStripContentWidthRef,
|
||||
tabStripOffsetRef,
|
||||
tabStripRef,
|
||||
tabStripViewportWidthRef,
|
||||
visibleTabs
|
||||
]
|
||||
)
|
||||
const attachTabStrip = useCallback(
|
||||
(view: ScrollView | null) => {
|
||||
if (view) {
|
||||
tabStripOffsetRef.current = 0
|
||||
tabStripViewportWidthRef.current = 0
|
||||
tabStripContentWidthRef.current = 0
|
||||
tabLayoutsRef.current.clear()
|
||||
}
|
||||
tabStripRef.current = view
|
||||
},
|
||||
[
|
||||
tabStripRef,
|
||||
tabStripOffsetRef,
|
||||
tabStripViewportWidthRef,
|
||||
tabStripContentWidthRef,
|
||||
tabLayoutsRef
|
||||
]
|
||||
)
|
||||
return (
|
||||
<View ref={tabBarKeepsKeyboard} style={inTopBar ? styles.tabBarInTopBar : styles.tabBar}>
|
||||
{/* Why: tab taps must register on first press with the keyboard open instead of being eaten by dismissal (#5106). */}
|
||||
<View style={styles.tabScrollFrame}>
|
||||
<ScrollView
|
||||
ref={attachTabStrip}
|
||||
horizontal
|
||||
showsHorizontalScrollIndicator={false}
|
||||
style={[styles.tabScroll, inTopBar && styles.tabScrollInTopBar]}
|
||||
contentContainerStyle={[styles.tabContent, inTopBar && styles.tabContentInTopBar]}
|
||||
keyboardShouldPersistTaps="handled"
|
||||
scrollEventThrottle={16}
|
||||
onScrollBeginDrag={cancelHeldTabStripReveal}
|
||||
onScroll={(e) => {
|
||||
tabStripOffsetRef.current = e.nativeEvent.contentOffset.x
|
||||
refreshHiddenTabs()
|
||||
}}
|
||||
onLayout={(e) => {
|
||||
tabStripViewportWidthRef.current = e.nativeEvent.layout.width
|
||||
scrollActiveTabIntoView(activeSessionTabIdRef.current, false)
|
||||
refreshHiddenTabs()
|
||||
}}
|
||||
onContentSizeChange={(width) => {
|
||||
tabStripContentWidthRef.current = width
|
||||
scrollActiveTabIntoView(activeSessionTabIdRef.current, false)
|
||||
refreshHiddenTabs()
|
||||
}}
|
||||
>
|
||||
{visibleTabs.map((tab, index) => {
|
||||
const tabState = tabStates.get(tab.id)
|
||||
const hostAgentIdentity = getMobileTerminalTabHostAgentIdentity(tab, terminals)
|
||||
const title = getMobileSessionTabTitle(tab, hostAgentIdentity)
|
||||
return (
|
||||
<Pressable
|
||||
key={tab.id}
|
||||
style={({ pressed }) => [
|
||||
styles.tab,
|
||||
index === 0 && !inTopBar && styles.tabFirst,
|
||||
tab.id === activeSessionTabId && styles.tabActive,
|
||||
pressed && styles.tabPressed
|
||||
]}
|
||||
onLayout={(e) => {
|
||||
const { x, width } = e.nativeEvent.layout
|
||||
tabLayoutsRef.current.set(tab.id, { x, width })
|
||||
if (tab.id === activeSessionTabIdRef.current) {
|
||||
scrollActiveTabIntoView(tab.id, false)
|
||||
}
|
||||
refreshHiddenTabs()
|
||||
}}
|
||||
onPress={() => pressTab(tab)}
|
||||
accessibilityRole="tab"
|
||||
accessibilityLabel={
|
||||
tabState && tabState !== 'idle'
|
||||
? t('session.tabStrip.tabStatus', '{{title}}, {{status}}', {
|
||||
title,
|
||||
status: agentStateLabel(tabState)
|
||||
})
|
||||
: title
|
||||
}
|
||||
accessibilityState={{ selected: tab.id === activeSessionTabId }}
|
||||
onLongPress={() => {
|
||||
triggerMediumImpact()
|
||||
openSessionTabActionSheetAfterKeyboardDismiss(tab)
|
||||
}}
|
||||
delayLongPress={400}
|
||||
>
|
||||
<View style={styles.tabLabelRow}>
|
||||
<SessionTabAgentDot state={tabState} />
|
||||
<View style={styles.tabIcon}>
|
||||
{tab.type === 'browser' && (
|
||||
<Globe size={13} color={colors.textSecondary} strokeWidth={2.1} />
|
||||
)}
|
||||
{tab.type === 'markdown' && (
|
||||
<FileText size={13} color={colors.textSecondary} strokeWidth={2.1} />
|
||||
)}
|
||||
{tab.type === 'file' && (
|
||||
<File size={13} color={colors.textSecondary} strokeWidth={2.1} />
|
||||
)}
|
||||
{tab.type === 'agent-session' && (
|
||||
<MobileAgentIcon agentId={tab.agent} size={13} />
|
||||
)}
|
||||
{tab.type === 'terminal' &&
|
||||
(() => {
|
||||
const agentId = resolveMobileTerminalTabAgentId(tab, hostAgentIdentity)
|
||||
return agentId ? (
|
||||
<MobileAgentIcon agentId={agentId} size={13} />
|
||||
) : (
|
||||
<SquareTerminal
|
||||
size={13}
|
||||
color={colors.textSecondary}
|
||||
strokeWidth={2.1}
|
||||
/>
|
||||
)
|
||||
})()}
|
||||
</View>
|
||||
<Text
|
||||
style={[styles.tabText, tab.id === activeSessionTabId && styles.tabTextActive]}
|
||||
numberOfLines={1}
|
||||
>
|
||||
{title}
|
||||
</Text>
|
||||
</View>
|
||||
</Pressable>
|
||||
)
|
||||
})}
|
||||
</ScrollView>
|
||||
{leftHint ? (
|
||||
<View pointerEvents="none" style={[styles.tabEdgeHint, styles.tabEdgeHintLeft]}>
|
||||
<AgentStateDot state={leftHint} />
|
||||
</View>
|
||||
) : null}
|
||||
{rightHint ? (
|
||||
<View pointerEvents="none" style={[styles.tabEdgeHint, styles.tabEdgeHintRight]}>
|
||||
<AgentStateDot state={rightHint} />
|
||||
</View>
|
||||
) : null}
|
||||
</View>
|
||||
{/* Terminal layout and Quick commands live in the header's ⋯ menu. */}
|
||||
{!actionsCollapsed ? (
|
||||
<View style={newTabStyles.slot}>
|
||||
<NavBarButton
|
||||
disabled={createTabBusy || connState !== 'connected'}
|
||||
onPress={handleOpenNewTab}
|
||||
accessibilityLabel={t('session.tabStrip.newTab', 'New tab')}
|
||||
icon={Plus}
|
||||
/>
|
||||
</View>
|
||||
) : null}
|
||||
</View>
|
||||
)
|
||||
}
|
||||
|
||||
// The right inset matches the nav bar's, so the + lines up with the ⋯ above it.
|
||||
const newTabStyles = StyleSheet.create({
|
||||
slot: {
|
||||
paddingLeft: spacing.sm,
|
||||
paddingRight: spacing.md
|
||||
}
|
||||
})
|
||||
@@ -0,0 +1,220 @@
|
||||
import { Fragment, useRef, useState } from 'react'
|
||||
import { Pressable, Text, View } from 'react-native'
|
||||
import { Plus, X } from 'lucide-react-native'
|
||||
import { BottomDrawer } from '../../components/bottom-drawer/BottomDrawer'
|
||||
import { ListGroup, SectionHeader } from '../../components/list/ListGroup'
|
||||
import { NavBarButton } from '../../components/nav-bar/NavBarButton'
|
||||
import { SheetHeader } from '../../components/nav-bar/SheetHeader'
|
||||
import { SwipeRowActions } from '../../components/SwipeRowActions'
|
||||
import { AgentStateDot } from '../../components/AgentStateDot'
|
||||
import { useMobileTranslation } from '../../i18n/use-mobile-translation'
|
||||
import { useNow } from '../../hooks/use-now'
|
||||
import { formatTimeAgo } from '../../worktree/agent-row-display'
|
||||
import { colors, radii, spacing } from '../../theme/mobile-theme'
|
||||
import { themedStyleSheet } from '../../theme/themed-styles'
|
||||
import { useMobileColorScheme } from '../../theme/use-mobile-color-scheme'
|
||||
import type { MobileSessionTabGroup, MobileSessionTabRow } from './mobile-session-tab-rows'
|
||||
import { MobileSessionTabMark } from './MobileSessionTabMark'
|
||||
import type { MobileSessionController } from '../use-mobile-session-controller'
|
||||
|
||||
const TILE_SIZE = 34
|
||||
const TILE_DOT_RING = 2
|
||||
const GROUP_ORDER: readonly MobileSessionTabGroup[] = ['needs-you', 'working', 'other']
|
||||
|
||||
/** Every tab in the workspace, what needs you first; tap one to go there, swipe one to close it. */
|
||||
export function MobileSessionTabsSheet({
|
||||
controller,
|
||||
rows,
|
||||
visible,
|
||||
onClose
|
||||
}: {
|
||||
controller: MobileSessionController
|
||||
rows: readonly MobileSessionTabRow[]
|
||||
visible: boolean
|
||||
onClose: () => void
|
||||
}) {
|
||||
useMobileColorScheme()
|
||||
const t = useMobileTranslation()
|
||||
const now = useNow(60_000)
|
||||
const {
|
||||
activeSessionTabId,
|
||||
worktreeName,
|
||||
switchSessionTab,
|
||||
handleCloseSessionTab,
|
||||
handleOpenNewTab,
|
||||
createTabBusy,
|
||||
connState
|
||||
} = controller
|
||||
// Sections hold still while the sheet is open, so a row never moves under a finger.
|
||||
const [frozenGroups, setFrozenGroups] = useState<ReadonlyMap<string, MobileSessionTabGroup>>()
|
||||
if (visible && frozenGroups === undefined) {
|
||||
setFrozenGroups(new Map(rows.map((row) => [row.tab.id, row.group])))
|
||||
}
|
||||
const afterCloseRef = useRef<(() => void) | null>(null)
|
||||
const sections = GROUP_ORDER.map((group) => ({
|
||||
group,
|
||||
rows: rows.filter((row) => (frozenGroups?.get(row.tab.id) ?? row.group) === group)
|
||||
})).filter((section) => section.rows.length > 0)
|
||||
const sectionTitles: Record<MobileSessionTabGroup, string> = {
|
||||
'needs-you': t('session.tabsSheet.needsYou', 'Needs you'),
|
||||
working: t('session.tabsSheet.working', 'Working'),
|
||||
other: t('session.tabsSheet.everythingElse', 'Everything else')
|
||||
}
|
||||
const title =
|
||||
rows.length === 1
|
||||
? t('session.tabBar.oneTab', '1 tab')
|
||||
: t('session.tabBar.tabCount', '{{count}} tabs', { count: rows.length })
|
||||
|
||||
const renderRow = (row: MobileSessionTabRow) => {
|
||||
const current = row.tab.id === activeSessionTabId
|
||||
const badge = row.dotState && row.dotState !== 'idle' ? row.dotState : undefined
|
||||
const time = current
|
||||
? t('session.tabsSheet.open', 'Open')
|
||||
: row.timeAt !== null
|
||||
? formatTimeAgo(row.timeAt, now)
|
||||
: ''
|
||||
return (
|
||||
<SwipeRowActions
|
||||
key={row.tab.id}
|
||||
trailing={{
|
||||
label: t('common.close', 'Close'),
|
||||
accessibilityLabel: t('session.tabsSheet.closeTab', 'Close {{title}}', {
|
||||
title: row.title
|
||||
}),
|
||||
icon: X,
|
||||
background: colors.statusRed,
|
||||
foreground: colors.onStatusRed,
|
||||
onPress: () => void handleCloseSessionTab(row.tab)
|
||||
}}
|
||||
>
|
||||
{(guardPress) => (
|
||||
<Pressable
|
||||
accessibilityRole="button"
|
||||
accessibilityLabel={[row.title, row.detail, time].filter(Boolean).join(', ')}
|
||||
accessibilityState={{ selected: current }}
|
||||
style={styles.row}
|
||||
onPress={guardPress(() => {
|
||||
if (!current) {
|
||||
switchSessionTab(row.tab)
|
||||
}
|
||||
onClose()
|
||||
})}
|
||||
>
|
||||
{({ pressed }) => (
|
||||
<>
|
||||
{current || pressed ? <View pointerEvents="none" style={styles.wash} /> : null}
|
||||
<View style={styles.tile}>
|
||||
<MobileSessionTabMark row={row} size={17} />
|
||||
{badge ? (
|
||||
<View style={styles.tileBadge}>
|
||||
<AgentStateDot state={badge} />
|
||||
</View>
|
||||
) : null}
|
||||
</View>
|
||||
<View style={styles.text}>
|
||||
<Text style={styles.title} numberOfLines={1}>
|
||||
{row.title}
|
||||
</Text>
|
||||
<Text style={styles.detail} numberOfLines={1}>
|
||||
{row.detail}
|
||||
</Text>
|
||||
</View>
|
||||
{time ? (
|
||||
<Text style={[styles.time, current && styles.timeCurrent]}>{time}</Text>
|
||||
) : null}
|
||||
</>
|
||||
)}
|
||||
</Pressable>
|
||||
)}
|
||||
</SwipeRowActions>
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<BottomDrawer
|
||||
visible={visible}
|
||||
onClose={onClose}
|
||||
onAfterClose={() => {
|
||||
setFrozenGroups(undefined)
|
||||
const afterClose = afterCloseRef.current
|
||||
afterCloseRef.current = null
|
||||
afterClose?.()
|
||||
}}
|
||||
>
|
||||
<View>
|
||||
<SheetHeader title={title} subtitle={worktreeName || undefined} />
|
||||
<View style={styles.newTab}>
|
||||
<NavBarButton
|
||||
icon={Plus}
|
||||
disabled={createTabBusy || connState !== 'connected'}
|
||||
accessibilityLabel={t('session.tabStrip.newTab', 'New tab')}
|
||||
onPress={() => {
|
||||
// The new-tab sheet is its own drawer; open it once this one is gone.
|
||||
afterCloseRef.current = handleOpenNewTab
|
||||
onClose()
|
||||
}}
|
||||
/>
|
||||
</View>
|
||||
</View>
|
||||
<View style={styles.body}>
|
||||
{sections.map((section, index) => (
|
||||
<Fragment key={section.group}>
|
||||
{sections.length > 1 ? (
|
||||
<SectionHeader title={sectionTitles[section.group]} first={index === 0} />
|
||||
) : null}
|
||||
<ListGroup separatorInset={spacing.lg + TILE_SIZE + spacing.md}>
|
||||
{section.rows.map(renderRow)}
|
||||
</ListGroup>
|
||||
</Fragment>
|
||||
))}
|
||||
</View>
|
||||
</BottomDrawer>
|
||||
)
|
||||
}
|
||||
|
||||
const styles = themedStyleSheet(() => ({
|
||||
// Over the sheet header's empty trailing side, centred in its 52pt row.
|
||||
newTab: { position: 'absolute', top: 8, right: spacing.xs },
|
||||
body: { paddingBottom: spacing.lg },
|
||||
// Opaque so a swipe's action stays hidden until the row slides off it.
|
||||
row: {
|
||||
minHeight: 60,
|
||||
flexDirection: 'row',
|
||||
alignItems: 'center',
|
||||
gap: spacing.md,
|
||||
paddingHorizontal: spacing.lg,
|
||||
paddingVertical: spacing.sm,
|
||||
backgroundColor: colors.sheetGroup
|
||||
},
|
||||
// The tab you're in, or a pressed row, washed like a picked segment on a sheet group.
|
||||
wash: {
|
||||
position: 'absolute',
|
||||
top: 0,
|
||||
right: 0,
|
||||
bottom: 0,
|
||||
left: 0,
|
||||
backgroundColor: colors.translucentFill
|
||||
},
|
||||
tile: {
|
||||
width: TILE_SIZE,
|
||||
height: TILE_SIZE,
|
||||
borderRadius: radii.tile,
|
||||
backgroundColor: colors.translucentFill,
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center'
|
||||
},
|
||||
// The state dot on the tile's corner, ringed in the group's colour.
|
||||
tileBadge: {
|
||||
position: 'absolute',
|
||||
top: -4,
|
||||
right: -4,
|
||||
padding: TILE_DOT_RING,
|
||||
borderRadius: radii.pill,
|
||||
backgroundColor: colors.sheetGroup
|
||||
},
|
||||
text: { flex: 1, minWidth: 0, gap: 2 },
|
||||
title: { fontSize: 15, fontWeight: '600', color: colors.textPrimary },
|
||||
detail: { fontSize: 13, color: colors.textSecondary },
|
||||
time: { fontSize: 12, color: colors.textMuted, fontVariant: ['tabular-nums'] },
|
||||
timeCurrent: { fontWeight: '600', color: colors.accentBlue }
|
||||
}))
|
||||
@@ -0,0 +1,121 @@
|
||||
import { agentListPreview } from '../../agents/agent-list-row-text'
|
||||
import { agentStatusGroup } from '../../agents/agent-list-rows'
|
||||
import { translate } from '../../i18n/mobile-i18n'
|
||||
import {
|
||||
getMobileSessionTabTitle,
|
||||
getMobileTerminalTabHostAgentIdentity,
|
||||
resolveMobileTerminalTabAgentId
|
||||
} from '../../terminal/session/mobile-terminal-tab-agent'
|
||||
import {
|
||||
agentDotState,
|
||||
agentRowTimeAt,
|
||||
agentStateLabel,
|
||||
type AgentDotState
|
||||
} from '../../worktree/agent-row-display'
|
||||
import type { MobileSessionTab } from './mobile-session-tabs'
|
||||
|
||||
export type MobileSessionTabGroup = 'needs-you' | 'working' | 'other'
|
||||
|
||||
export type MobileSessionTabRow = {
|
||||
tab: MobileSessionTab
|
||||
title: string
|
||||
/** The agent whose icon marks the tab; null draws the tab kind's icon. */
|
||||
agentId: string | null
|
||||
dotState: AgentDotState | undefined
|
||||
group: MobileSessionTabGroup
|
||||
/** The second line: the state, then what the tab is doing or showing. */
|
||||
detail: string
|
||||
timeAt: number | null
|
||||
}
|
||||
|
||||
export function mobileSessionTabDotState(
|
||||
tab: MobileSessionTab,
|
||||
now: number
|
||||
): AgentDotState | undefined {
|
||||
// Why: a status restored across a host restart is unconfirmed, so like desktop it shows no live state.
|
||||
if (tab.type === 'terminal' && tab.agentStatus && !tab.agentStatus.restoredUnconfirmed) {
|
||||
return agentDotState(tab.agentStatus, now)
|
||||
}
|
||||
if (tab.type === 'agent-session' && tab.chatStatus) {
|
||||
return agentDotState(tab.chatStatus, now)
|
||||
}
|
||||
return undefined
|
||||
}
|
||||
|
||||
function tabGroup(state: AgentDotState | undefined): MobileSessionTabGroup {
|
||||
if (!state) {
|
||||
return 'other'
|
||||
}
|
||||
const group = agentStatusGroup(state)
|
||||
return group === 'needs-you' || group === 'working' ? group : 'other'
|
||||
}
|
||||
|
||||
function tabContent(
|
||||
tab: MobileSessionTab,
|
||||
title: string,
|
||||
dotState: AgentDotState | undefined
|
||||
): string {
|
||||
switch (tab.type) {
|
||||
case 'terminal': {
|
||||
const status = tab.agentStatus
|
||||
if (!status || !dotState) {
|
||||
return ''
|
||||
}
|
||||
return agentListPreview(status, agentStatusGroup(dotState), title)
|
||||
}
|
||||
case 'browser':
|
||||
return tab.url === title ? '' : tab.url
|
||||
case 'markdown':
|
||||
case 'file':
|
||||
return tab.relativePath === title ? '' : tab.relativePath
|
||||
case 'agent-session':
|
||||
return ''
|
||||
}
|
||||
}
|
||||
|
||||
function tabKindLabel(tab: MobileSessionTab): string {
|
||||
switch (tab.type) {
|
||||
case 'browser':
|
||||
return translate('session.tabRows.browser', 'Browser')
|
||||
case 'markdown':
|
||||
return translate('session.tabRows.markdown', 'Markdown note')
|
||||
case 'file':
|
||||
return translate('session.tabRows.file', 'File')
|
||||
case 'agent-session':
|
||||
return translate('session.tabRows.chat', 'Chat')
|
||||
case 'terminal':
|
||||
return translate('session.tabRows.terminal', 'Terminal')
|
||||
}
|
||||
}
|
||||
|
||||
export function buildMobileSessionTabRow(
|
||||
tab: MobileSessionTab,
|
||||
terminals: readonly { handle: string; agentIdentity?: string }[],
|
||||
now: number
|
||||
): MobileSessionTabRow {
|
||||
const hostAgentIdentity = getMobileTerminalTabHostAgentIdentity(tab, terminals)
|
||||
const title = getMobileSessionTabTitle(tab, hostAgentIdentity)
|
||||
const dotState = mobileSessionTabDotState(tab, now)
|
||||
const stateWord = dotState && dotState !== 'idle' ? agentStateLabel(dotState) : ''
|
||||
const content = tabContent(tab, title, dotState)
|
||||
const timeAt =
|
||||
tab.type === 'terminal' && tab.agentStatus && !tab.agentStatus.restoredUnconfirmed
|
||||
? agentRowTimeAt(tab.agentStatus)
|
||||
: tab.type === 'agent-session' && tab.chatStatus
|
||||
? tab.chatStatus.updatedAt
|
||||
: null
|
||||
return {
|
||||
tab,
|
||||
title,
|
||||
agentId:
|
||||
tab.type === 'agent-session'
|
||||
? tab.agent
|
||||
: tab.type === 'terminal'
|
||||
? resolveMobileTerminalTabAgentId(tab, hostAgentIdentity)
|
||||
: null,
|
||||
dotState,
|
||||
group: tabGroup(dotState),
|
||||
detail: [stateWord, content].filter(Boolean).join(' · ') || tabKindLabel(tab),
|
||||
timeAt
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,3 @@
|
||||
import type { AgentDotState } from '../../worktree/agent-row-display'
|
||||
|
||||
export type TabStripScrollInput = {
|
||||
tabX: number
|
||||
tabWidth: number
|
||||
@@ -36,98 +34,3 @@ export function resolveTabStripScrollOffset({
|
||||
|
||||
return Math.min(Math.max(0, nextOffset), maxOffset)
|
||||
}
|
||||
|
||||
type TabLayouts = ReadonlyMap<string, { x: number; width: number }>
|
||||
|
||||
export function resolveTabStripTapOffset(args: {
|
||||
tabId: string
|
||||
tabs: readonly { id: string }[]
|
||||
layouts: TabLayouts
|
||||
viewportWidth: number
|
||||
contentWidth: number
|
||||
currentOffset: number
|
||||
}): number {
|
||||
const { tabs, layouts, viewportWidth, contentWidth, currentOffset } = args
|
||||
const index = tabs.findIndex((tab) => tab.id === args.tabId)
|
||||
const selected = layouts.get(args.tabId)
|
||||
if (index === -1 || !selected || viewportWidth <= 0) {
|
||||
return currentOffset
|
||||
}
|
||||
const selectedOnly = resolveTabStripScrollOffset({
|
||||
tabX: selected.x,
|
||||
tabWidth: selected.width,
|
||||
viewportWidth,
|
||||
contentWidth,
|
||||
currentOffset
|
||||
})
|
||||
if (selectedOnly === currentOffset) {
|
||||
return currentOffset
|
||||
}
|
||||
const left = selected.x + selected.width / 2 < currentOffset + viewportWidth / 2
|
||||
const neighbor = tabs[index + (left ? -1 : 1)]
|
||||
const layout = neighbor ? layouts.get(neighbor.id) : undefined
|
||||
let start = selected.x
|
||||
let end = selected.x + selected.width
|
||||
if (layout) {
|
||||
const gap = left ? selected.x - (layout.x + layout.width) : layout.x - end
|
||||
// Keep the tapped tab whole while revealing as much of its neighbor as fits within both margins.
|
||||
const peek = Math.min(layout.width, Math.max(0, viewportWidth - 24 - selected.width - gap))
|
||||
if (left) {
|
||||
start -= gap + peek
|
||||
} else {
|
||||
end += gap + peek
|
||||
}
|
||||
}
|
||||
return resolveTabStripScrollOffset({
|
||||
tabX: start,
|
||||
tabWidth: end - start,
|
||||
viewportWidth,
|
||||
contentWidth,
|
||||
currentOffset
|
||||
})
|
||||
}
|
||||
|
||||
export type TabStripHiddenTabs = { left: readonly string[]; right: readonly string[] }
|
||||
|
||||
export function resolveTabStripHiddenTabs(args: {
|
||||
layouts: TabLayouts
|
||||
viewportWidth: number
|
||||
currentOffset: number
|
||||
}): TabStripHiddenTabs {
|
||||
const left: string[] = []
|
||||
const right: string[] = []
|
||||
if (args.viewportWidth > 0) {
|
||||
for (const [tabId, layout] of args.layouts) {
|
||||
const center = layout.x + layout.width / 2
|
||||
if (center < args.currentOffset) {
|
||||
left.push(tabId)
|
||||
} else if (center > args.currentOffset + args.viewportWidth) {
|
||||
right.push(tabId)
|
||||
}
|
||||
}
|
||||
}
|
||||
return { left, right }
|
||||
}
|
||||
|
||||
// Lower ranks win when several hidden tabs share an edge; other states get no edge hint.
|
||||
const EDGE_HINT_RANK: Partial<Record<AgentDotState, number>> = {
|
||||
blocked: 0,
|
||||
waiting: 0,
|
||||
working: 1,
|
||||
monitoring: 1
|
||||
}
|
||||
|
||||
export function resolveTabStripEdgeHint(
|
||||
tabIds: readonly string[],
|
||||
tabStates: ReadonlyMap<string, AgentDotState>
|
||||
): AgentDotState | null {
|
||||
let hint: AgentDotState | null = null
|
||||
for (const tabId of tabIds) {
|
||||
const state = tabStates.get(tabId)
|
||||
const rank = state ? EDGE_HINT_RANK[state] : undefined
|
||||
if (state && rank !== undefined && (hint === null || rank < (EDGE_HINT_RANK[hint] ?? 0))) {
|
||||
hint = state
|
||||
}
|
||||
}
|
||||
return hint
|
||||
}
|
||||
|
||||
@@ -52,6 +52,7 @@ export function useMobileSessionFoundation() {
|
||||
name: worktreeName,
|
||||
path: worktreePath,
|
||||
hostId: worktreeHostId,
|
||||
branch: worktreeBranch,
|
||||
resolution: worktreeResolution
|
||||
} = useLiveWorktreeName({
|
||||
client,
|
||||
@@ -115,6 +116,7 @@ export function useMobileSessionFoundation() {
|
||||
worktreeName,
|
||||
worktreePath,
|
||||
worktreeHostId,
|
||||
worktreeBranch,
|
||||
worktreeResolution,
|
||||
isWideLayout,
|
||||
activePanel,
|
||||
|
||||
@@ -7,7 +7,7 @@ import {
|
||||
shouldShowSessionHeaderChecksAction,
|
||||
panelRouteDescriptor
|
||||
} from './session-panel-host'
|
||||
import { MobileAgentIcon } from '../components/MobileAgentIcon'
|
||||
import type { ActionSheetAction } from '../components/ActionSheetModal'
|
||||
import { useMobileTranslation } from '../i18n/use-mobile-translation'
|
||||
import {
|
||||
useWorkspaceExecutionHost,
|
||||
@@ -49,127 +49,81 @@ export function useMobileSessionPanelRouteActions(scope: MobileSessionPresentati
|
||||
quickCommandsSupported,
|
||||
showToast
|
||||
} = scope
|
||||
const otherRuntimeAgentRow = {
|
||||
id: 'otherServerAgents',
|
||||
label: t('session.usePanelRouteActions.otherServerAgents', 'Agents on Another Server'),
|
||||
hint: t('session.usePanelRouteActions.pairServerHint', 'Pair that server directly'),
|
||||
icon: Bot,
|
||||
disabled: true,
|
||||
onPress: () => {}
|
||||
}
|
||||
const createTabAgentActions =
|
||||
const agentStatusRow = (errorHint: string): ActionSheetAction | null =>
|
||||
createTabAgentLoadState === 'loading'
|
||||
? [
|
||||
{
|
||||
id: 'detectingAgents',
|
||||
label: t('session.usePanelRouteActions.detectingAgents', 'Detecting Agents'),
|
||||
icon: Bot,
|
||||
disabled: true,
|
||||
loading: true,
|
||||
onPress: () => {}
|
||||
}
|
||||
]
|
||||
? {
|
||||
id: 'detectingAgents',
|
||||
label: t('session.usePanelRouteActions.detectingAgents', 'Detecting Agents'),
|
||||
icon: Bot,
|
||||
disabled: true,
|
||||
loading: true,
|
||||
onPress: () => {}
|
||||
}
|
||||
: createTabAgentOptions.length > 0
|
||||
? createTabAgentOptions.map((option) => ({
|
||||
id: `agent:${option.agent}`,
|
||||
label: option.label,
|
||||
renderIcon: () => <MobileAgentIcon agentId={option.agent} size={16} />,
|
||||
onPress: () => {
|
||||
setShowCreateTabDrawer(false)
|
||||
void handleCreateTerminal(option.agent)
|
||||
}
|
||||
}))
|
||||
? null
|
||||
: createTabAgentLoadState === 'loaded'
|
||||
? [
|
||||
{
|
||||
id: 'noEnabledAgents',
|
||||
label: t('session.usePanelRouteActions.noEnabledAgents', 'No Enabled Agents'),
|
||||
? {
|
||||
id: 'noEnabledAgents',
|
||||
label: t('session.usePanelRouteActions.noEnabledAgents', 'No Enabled Agents'),
|
||||
icon: Bot,
|
||||
disabled: true,
|
||||
onPress: () => {}
|
||||
}
|
||||
: createTabAgentLoadState === 'other-runtime'
|
||||
? {
|
||||
id: 'otherServerAgents',
|
||||
label: t(
|
||||
'session.usePanelRouteActions.otherServerAgents',
|
||||
'Agents on Another Server'
|
||||
),
|
||||
hint: t('session.usePanelRouteActions.pairServerHint', 'Pair that server directly'),
|
||||
icon: Bot,
|
||||
disabled: true,
|
||||
onPress: () => {}
|
||||
}
|
||||
]
|
||||
: createTabAgentLoadState === 'other-runtime'
|
||||
? [otherRuntimeAgentRow]
|
||||
: createTabAgentLoadState === 'error'
|
||||
? [
|
||||
{
|
||||
id: 'presetsUnavailable',
|
||||
label: t(
|
||||
'session.usePanelRouteActions.presetsUnavailable',
|
||||
'Agent Presets Unavailable'
|
||||
),
|
||||
hint: t(
|
||||
'session.usePanelRouteActions.checkHostHint',
|
||||
'Check the host connection'
|
||||
),
|
||||
icon: Bot,
|
||||
disabled: true,
|
||||
onPress: () => {}
|
||||
}
|
||||
]
|
||||
: []
|
||||
const sendDiffNotesAgentActions =
|
||||
pendingDiffNotesDelivery === null
|
||||
? []
|
||||
: createTabAgentLoadState === 'loading'
|
||||
? [
|
||||
{
|
||||
id: 'detectingAgents',
|
||||
label: t('session.usePanelRouteActions.detectingAgents', 'Detecting Agents'),
|
||||
icon: Bot,
|
||||
disabled: true,
|
||||
loading: true,
|
||||
onPress: () => {}
|
||||
}
|
||||
]
|
||||
: createTabAgentOptions.length > 0
|
||||
? createTabAgentOptions.map((option) => ({
|
||||
id: `agent:${option.agent}`,
|
||||
label: option.label,
|
||||
hint: t('session.usePanelRouteActions.newSessionHint', 'New agent session'),
|
||||
icon: Bot,
|
||||
onPress: () => {
|
||||
const delivery = pendingDiffNotesDelivery
|
||||
setPendingDiffNotesDelivery(null)
|
||||
if (!delivery) {
|
||||
return
|
||||
}
|
||||
void sendDiffNotesToNewAgent(delivery, async () => {
|
||||
await handleCreateTerminal(option.agent, {
|
||||
initialPrompt: delivery.prompt,
|
||||
onPromptSent: () => void clearDeliveredDiffComments(delivery.comments)
|
||||
})
|
||||
})
|
||||
}
|
||||
}))
|
||||
: createTabAgentLoadState === 'loaded'
|
||||
? [
|
||||
{
|
||||
id: 'noEnabledAgents',
|
||||
label: t('session.usePanelRouteActions.noEnabledAgents', 'No Enabled Agents'),
|
||||
? {
|
||||
id: 'presetsUnavailable',
|
||||
label: t(
|
||||
'session.usePanelRouteActions.presetsUnavailable',
|
||||
'Agent Presets Unavailable'
|
||||
),
|
||||
hint: errorHint,
|
||||
icon: Bot,
|
||||
disabled: true,
|
||||
onPress: () => {}
|
||||
}
|
||||
]
|
||||
: createTabAgentLoadState === 'other-runtime'
|
||||
? [otherRuntimeAgentRow]
|
||||
: createTabAgentLoadState === 'error'
|
||||
? [
|
||||
{
|
||||
id: 'presetsUnavailable',
|
||||
label: t(
|
||||
'session.usePanelRouteActions.presetsUnavailable',
|
||||
'Agent Presets Unavailable'
|
||||
),
|
||||
hint: t('session.usePanelRouteActions.copyNotesHint', 'Copy notes instead'),
|
||||
icon: Bot,
|
||||
disabled: true,
|
||||
onPress: () => {}
|
||||
}
|
||||
]
|
||||
: []
|
||||
: null
|
||||
const createTabAgentStatusRow = agentStatusRow(
|
||||
t('session.usePanelRouteActions.checkHostHint', 'Check the host connection')
|
||||
)
|
||||
const sendDiffNotesStatusRow = agentStatusRow(
|
||||
t('session.usePanelRouteActions.copyNotesHint', 'Copy notes instead')
|
||||
)
|
||||
const sendDiffNotesAgentActions: ActionSheetAction[] =
|
||||
pendingDiffNotesDelivery === null
|
||||
? []
|
||||
: sendDiffNotesStatusRow
|
||||
? [sendDiffNotesStatusRow]
|
||||
: createTabAgentOptions.map((option) => ({
|
||||
id: `agent:${option.agent}`,
|
||||
label: option.label,
|
||||
hint: t('session.usePanelRouteActions.newSessionHint', 'New agent session'),
|
||||
icon: Bot,
|
||||
onPress: () => {
|
||||
const delivery = pendingDiffNotesDelivery
|
||||
setPendingDiffNotesDelivery(null)
|
||||
if (!delivery) {
|
||||
return
|
||||
}
|
||||
void sendDiffNotesToNewAgent(delivery, async () => {
|
||||
await handleCreateTerminal(option.agent, {
|
||||
initialPrompt: delivery.prompt,
|
||||
onPromptSent: () => void clearDeliveredDiffComments(delivery.comments)
|
||||
})
|
||||
})
|
||||
}
|
||||
}))
|
||||
|
||||
const handleSessionContentRowLayout = useCallback((event: LayoutChangeEvent) => {
|
||||
const width = Math.round(event.nativeEvent.layout.width)
|
||||
@@ -235,7 +189,7 @@ export function useMobileSessionPanelRouteActions(scope: MobileSessionPresentati
|
||||
)
|
||||
}
|
||||
return {
|
||||
createTabAgentActions,
|
||||
createTabAgentStatusRow,
|
||||
sendDiffNotesAgentActions,
|
||||
handleSessionContentRowLayout,
|
||||
handlePanelTap,
|
||||
|
||||
@@ -76,11 +76,8 @@ export function useMobileSessionPresentation(scope: MobileSessionBulkCloseModel)
|
||||
presentedConnState === 'connected'
|
||||
? showLoadingState && visibleTabs.length === 0
|
||||
? t('session.presentation.loadingTabs', 'Loading tabs')
|
||||
: visibleTabs.length === 1
|
||||
? t('session.presentation.oneTab', '1 tab')
|
||||
: t('session.presentation.tabCount', '{{tabCount}} tabs', {
|
||||
tabCount: visibleTabs.length
|
||||
})
|
||||
: // The tab count lives in the tab bar, so the header names the branch instead.
|
||||
(scope.worktreeBranch ?? MOBILE_SESSION_STATUS_LABELS.connected)
|
||||
: showConnectionRetry
|
||||
? t('session.presentation.tapToRetry', '{{status}} — tap to retry', {
|
||||
status: verdictDisplayLabel(connectionVerdict)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { useState, useRef, useMemo } from 'react'
|
||||
import { useTerminalSplitLayout } from '../terminal/session/use-terminal-split-layout'
|
||||
import { createLiveInputCapture } from '../terminal/session/live-input-capture'
|
||||
import { Animated, type ScrollView } from 'react-native'
|
||||
import { Animated } from 'react-native'
|
||||
import type { MobileTerminalLinkOpenMode } from '../storage/preferences'
|
||||
import type { TerminalKeyboardAvoidanceMetrics } from '../terminal/terminal-webview-contract'
|
||||
import {
|
||||
@@ -46,11 +46,6 @@ export function useMobileSessionScreenState(scope: MobileSessionFoundationModel)
|
||||
const activeSessionTabIdRef = useRef<string | null>(null)
|
||||
// Preserve an explicit phone tab pick while a host snapshot is transiently incomplete.
|
||||
const selectedSessionTabIdRef = useRef<string | null>(null)
|
||||
const tabStripRef = useRef<ScrollView>(null)
|
||||
const tabStripOffsetRef = useRef(0)
|
||||
const tabStripViewportWidthRef = useRef(0)
|
||||
const tabStripContentWidthRef = useRef(0)
|
||||
const tabLayoutsRef = useRef<Map<string, { x: number; width: number }>>(new Map())
|
||||
const [markdownDocs, setMarkdownDocs] = useState<Map<string, MarkdownDocState>>(new Map())
|
||||
const markdownDocsRef = useRef<Map<string, MarkdownDocState>>(new Map())
|
||||
const [fileDocs, setFileDocs] = useState<Map<string, FileDocState>>(new Map())
|
||||
@@ -134,11 +129,6 @@ export function useMobileSessionScreenState(scope: MobileSessionFoundationModel)
|
||||
setActiveSessionTabId,
|
||||
activeSessionTabIdRef,
|
||||
selectedSessionTabIdRef,
|
||||
tabStripRef,
|
||||
tabStripOffsetRef,
|
||||
tabStripViewportWidthRef,
|
||||
tabStripContentWidthRef,
|
||||
tabLayoutsRef,
|
||||
markdownDocs,
|
||||
setMarkdownDocs,
|
||||
markdownDocsRef,
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
import { useEffect, useCallback, useRef } from 'react'
|
||||
import { useEffect, useCallback } from 'react'
|
||||
import { currentSoftKeyboardHeight, subscribeSoftKeyboard } from '../../platform/keyboard-occlusion'
|
||||
import { useTerminalViewportRefit } from '../terminal-viewport-refit'
|
||||
import { removeCustomKey, type CustomKey } from '../terminal-custom-keys'
|
||||
import { useWorkspaceExecutionHost } from '../../navigation/workspace-execution-host'
|
||||
import { writeLastVisitedWorktree } from '../../worktree/last-visited-worktree-by-host'
|
||||
import { resolveTabStripScrollOffset } from '../../session/tabs/tab-strip-scroll'
|
||||
import type { MobileSessionLifecycleModel } from '../../session/use-mobile-session-lifecycle'
|
||||
|
||||
export type MobileSessionKeyboardScope = Pick<
|
||||
@@ -12,7 +11,6 @@ export type MobileSessionKeyboardScope = Pick<
|
||||
| 'activeHandleRef'
|
||||
| 'visibleTerminalHandlesRef'
|
||||
| 'terminalPaneViewportsRef'
|
||||
| 'activeSessionTabId'
|
||||
| 'clientRef'
|
||||
| 'connState'
|
||||
| 'deviceTokenRef'
|
||||
@@ -22,11 +20,6 @@ export type MobileSessionKeyboardScope = Pick<
|
||||
| 'setShowCustomKeyModal'
|
||||
| 'showNativeChatRef'
|
||||
| 'subscribeToTerminal'
|
||||
| 'tabLayoutsRef'
|
||||
| 'tabStripContentWidthRef'
|
||||
| 'tabStripOffsetRef'
|
||||
| 'tabStripRef'
|
||||
| 'tabStripViewportWidthRef'
|
||||
| 'terminalFrameRef'
|
||||
| 'terminalRefs'
|
||||
| 'terminals'
|
||||
@@ -45,12 +38,6 @@ export function useMobileSessionKeyboardState(scope: MobileSessionKeyboardScope)
|
||||
connState,
|
||||
terminals,
|
||||
terminalTextScale,
|
||||
activeSessionTabId,
|
||||
tabStripRef,
|
||||
tabStripOffsetRef,
|
||||
tabStripViewportWidthRef,
|
||||
tabStripContentWidthRef,
|
||||
tabLayoutsRef,
|
||||
setCustomKeys,
|
||||
setShowCustomKeyModal,
|
||||
deviceTokenRef,
|
||||
@@ -98,55 +85,6 @@ export function useMobileSessionKeyboardState(scope: MobileSessionKeyboardScope)
|
||||
)
|
||||
}, [notifyKeyboardVisibility])
|
||||
|
||||
const heldTabStripRevealRef = useRef<ReturnType<typeof setTimeout> | null>(null)
|
||||
const cancelHeldTabStripReveal = useCallback(() => {
|
||||
if (heldTabStripRevealRef.current) {
|
||||
clearTimeout(heldTabStripRevealRef.current)
|
||||
heldTabStripRevealRef.current = null
|
||||
}
|
||||
}, [])
|
||||
useEffect(() => cancelHeldTabStripReveal, [cancelHeldTabStripReveal])
|
||||
// Hold strip movement through double-tap detection so its second tap reaches the same tab.
|
||||
const holdTabStripReveal = useCallback(
|
||||
(offset: number, delayMs: number) => {
|
||||
cancelHeldTabStripReveal()
|
||||
heldTabStripRevealRef.current = setTimeout(() => {
|
||||
heldTabStripRevealRef.current = null
|
||||
if (offset !== tabStripOffsetRef.current) {
|
||||
tabStripOffsetRef.current = offset
|
||||
tabStripRef.current?.scrollTo({ x: offset, animated: true })
|
||||
}
|
||||
}, delayMs)
|
||||
},
|
||||
[cancelHeldTabStripReveal]
|
||||
)
|
||||
|
||||
const scrollActiveTabIntoView = useCallback((tabId: string | null, animated: boolean) => {
|
||||
if (!tabId || heldTabStripRevealRef.current) {
|
||||
return
|
||||
}
|
||||
const layout = tabLayoutsRef.current.get(tabId)
|
||||
if (!layout) {
|
||||
return
|
||||
}
|
||||
const nextOffset = resolveTabStripScrollOffset({
|
||||
tabX: layout.x,
|
||||
tabWidth: layout.width,
|
||||
viewportWidth: tabStripViewportWidthRef.current,
|
||||
contentWidth: tabStripContentWidthRef.current,
|
||||
currentOffset: tabStripOffsetRef.current
|
||||
})
|
||||
if (nextOffset !== tabStripOffsetRef.current) {
|
||||
tabStripOffsetRef.current = nextOffset
|
||||
tabStripRef.current?.scrollTo({ x: nextOffset, animated })
|
||||
}
|
||||
}, [])
|
||||
|
||||
useEffect(() => {
|
||||
const id = requestAnimationFrame(() => scrollActiveTabIntoView(activeSessionTabId, true))
|
||||
return () => cancelAnimationFrame(id)
|
||||
}, [activeSessionTabId, scrollActiveTabIntoView])
|
||||
|
||||
const executionHost = useWorkspaceExecutionHost()
|
||||
useEffect(() => {
|
||||
if (hostId && worktreeId) {
|
||||
@@ -171,9 +109,6 @@ export function useMobileSessionKeyboardState(scope: MobileSessionKeyboardScope)
|
||||
notifyTerminalFrameWidth,
|
||||
notifyKeyboardVisibility,
|
||||
notifyTerminalCellBoxChange,
|
||||
scrollActiveTabIntoView,
|
||||
holdTabStripReveal,
|
||||
cancelHeldTabStripReveal,
|
||||
handleDeleteCustomKey,
|
||||
handleManageShortcuts
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ export function agentDisplayLabel(row: RuntimeWorktreeAgentRow, now: number): st
|
||||
|
||||
// Mirror desktop lastEnteredDoneAt: date main-agent failures independently while subagents remain active.
|
||||
export function agentRowTimeAt(
|
||||
row: Pick<RuntimeWorktreeAgentRow, 'state' | 'interrupted' | 'mainAgent' | 'stateStartedAt'>
|
||||
row: AgentRowVerdictSource & Pick<RuntimeWorktreeAgentRow, 'stateStartedAt'>
|
||||
): number {
|
||||
if (row.state !== 'done' && row.mainAgent && agentVerdictDisplayMark(row) === 'failed') {
|
||||
return row.mainAgent.stateStartedAt
|
||||
|
||||
@@ -14,6 +14,7 @@ export const sessionWorktreeRecordSchema = z
|
||||
repo: salvagedOptional('repo', z.string().nullable()),
|
||||
path: salvagedOptional('path', z.string()),
|
||||
hostId: salvagedOptional('hostId', z.string()),
|
||||
branch: salvagedOptional('branch', z.string().nullable()),
|
||||
diffComments: z.unknown().optional()
|
||||
})
|
||||
)
|
||||
@@ -22,6 +23,11 @@ export const sessionWorktreeRecordSchema = z
|
||||
(
|
||||
reply
|
||||
):
|
||||
| (WorktreeDisplayNameSource & { path?: string; hostId?: string; diffComments?: unknown })
|
||||
| (WorktreeDisplayNameSource & {
|
||||
path?: string
|
||||
hostId?: string
|
||||
branch?: string | null
|
||||
diffComments?: unknown
|
||||
})
|
||||
| undefined => reply.worktree
|
||||
)
|
||||
|
||||
@@ -30,6 +30,8 @@ export type LiveWorktreeName = {
|
||||
/** Where the worktree lives on its host; null until the host's record arrives. */
|
||||
path: string | null
|
||||
hostId: string | null
|
||||
/** The checked-out branch without refs/heads/; null for folders, detached heads and until the record arrives. */
|
||||
branch: string | null
|
||||
resolution: WorktreeShowResolution
|
||||
}
|
||||
|
||||
@@ -48,6 +50,7 @@ export function useLiveWorktreeName({
|
||||
name: string
|
||||
path?: string | null
|
||||
hostId?: string | null
|
||||
branch?: string | null
|
||||
}>(() => ({ worktreeId, name: routeNameHint }))
|
||||
// Key verdicts by route so a previous workspace’s deletion cannot escape into the new one.
|
||||
const [resolved, setResolved] = useState<{
|
||||
@@ -125,13 +128,16 @@ export function useLiveWorktreeName({
|
||||
if (liveName) {
|
||||
const path = worktree?.path || null
|
||||
const hostId = worktree?.hostId ?? null
|
||||
// Match desktop formatBranchName by hiding the refs/heads/ prefix.
|
||||
const branch = worktree?.branch?.replace(/^refs\/heads\//, '') || null
|
||||
setWorktreeName((current) =>
|
||||
current.worktreeId === worktreeId &&
|
||||
current.name === liveName &&
|
||||
current.path === path &&
|
||||
current.hostId === hostId
|
||||
current.hostId === hostId &&
|
||||
current.branch === branch
|
||||
? current
|
||||
: { worktreeId, name: liveName, path, hostId }
|
||||
: { worktreeId, name: liveName, path, hostId, branch }
|
||||
)
|
||||
}
|
||||
hasSuccessfulRefresh = true
|
||||
@@ -197,12 +203,19 @@ export function useLiveWorktreeName({
|
||||
)
|
||||
|
||||
if (isFloatingWorkspace) {
|
||||
return { name: getFloatingWorkspaceTitle(), path: null, hostId: 'local', resolution: 'unknown' }
|
||||
return {
|
||||
name: getFloatingWorkspaceTitle(),
|
||||
path: null,
|
||||
hostId: 'local',
|
||||
branch: null,
|
||||
resolution: 'unknown'
|
||||
}
|
||||
}
|
||||
return {
|
||||
name: worktreeName.worktreeId === worktreeId ? worktreeName.name : routeNameHint,
|
||||
path: worktreeName.worktreeId === worktreeId ? (worktreeName.path ?? null) : null,
|
||||
hostId: worktreeName.worktreeId === worktreeId ? (worktreeName.hostId ?? null) : null,
|
||||
branch: worktreeName.worktreeId === worktreeId ? (worktreeName.branch ?? null) : null,
|
||||
resolution: resolved.worktreeId === worktreeId ? resolved.resolution : 'unknown'
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
import type { RuntimeClient } from '../runtime-client'
|
||||
import type { RuntimeStatus } from '../../shared/runtime-types'
|
||||
import { FOLDER_WORKSPACE_INSTANCE_SEPARATOR } from '../../shared/worktree/id'
|
||||
import { WORKTREE_FOLDER_SETUP_RUNTIME_CAPABILITY } from '../../shared/worktree-runtime-capabilities'
|
||||
|
||||
const FOLDER_SETUP_UNSUPPORTED_WARNING =
|
||||
'Setup did not run: this host runs an older Orca without folder workspace setup. Update Orca on that host to run it.'
|
||||
|
||||
/** An older host makes folder workspaces without running setup; say so rather than imply it ran. */
|
||||
export async function folderSetupUnsupportedWarning(
|
||||
client: RuntimeClient,
|
||||
worktreeId: string | undefined,
|
||||
create: { setupDecision?: unknown; runHooks?: unknown }
|
||||
): Promise<string | null> {
|
||||
const setupRequested = create.setupDecision === 'run' || create.runHooks === true
|
||||
if (!setupRequested || !worktreeId?.includes(FOLDER_WORKSPACE_INSTANCE_SEPARATOR)) {
|
||||
return null
|
||||
}
|
||||
const status = await client.call<RuntimeStatus>('status.get').catch(() => null)
|
||||
return status && !status.result.capabilities?.includes(WORKTREE_FOLDER_SETUP_RUNTIME_CAPABILITY)
|
||||
? FOLDER_SETUP_UNSUPPORTED_WARNING
|
||||
: null
|
||||
}
|
||||
|
||||
/** Joins the warning onto a create result, so text output and --json both carry it. */
|
||||
export async function withFolderSetupSupportWarning<
|
||||
T extends { worktree?: { id?: string }; warning?: string }
|
||||
>(
|
||||
client: RuntimeClient,
|
||||
result: T,
|
||||
create: { setupDecision?: unknown; runHooks?: unknown }
|
||||
): Promise<T> {
|
||||
const warning = await folderSetupUnsupportedWarning(client, result.worktree?.id, create)
|
||||
return warning
|
||||
? { ...result, warning: result.warning ? `${result.warning} ${warning}` : warning }
|
||||
: result
|
||||
}
|
||||
@@ -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)
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
// Use agent.launch for surface/model/effort; older hosts fall back to the create startup terminal.
|
||||
|
||||
import {
|
||||
folderSetupUnsupportedWarning,
|
||||
withFolderSetupSupportWarning
|
||||
} from './folder-setup-support-warning'
|
||||
import type { AgentLaunchResult } from '../../shared/agent-launch/contracts/agent-launch-intent'
|
||||
import {
|
||||
AGENT_LAUNCH_LOCAL_PRESENTATION_RUNTIME_CAPABILITY,
|
||||
@@ -65,7 +69,7 @@ export async function createWorktreeWithAgent(args: {
|
||||
startupPrompt: launch.prompt?.text ?? '',
|
||||
launchSource: 'cli'
|
||||
}
|
||||
const created = await withSetupDecisionRecovery(
|
||||
const response = await withSetupDecisionRecovery(
|
||||
withCliAgentLaunchRecovery(
|
||||
client.call<RuntimeWorktreeCreateResult>('worktree.create', params),
|
||||
{
|
||||
@@ -74,6 +78,10 @@ export async function createWorktreeWithAgent(args: {
|
||||
}
|
||||
)
|
||||
)
|
||||
const created = {
|
||||
...response,
|
||||
result: await withFolderSetupSupportWarning(client, response.result, create)
|
||||
}
|
||||
printHookWarning(created.result, json)
|
||||
printLineageSummary(created.result, json)
|
||||
printResult(created, json, formatWorktreeShow)
|
||||
@@ -93,6 +101,15 @@ export async function createWorktreeWithAgent(args: {
|
||||
launch.operationId !== undefined
|
||||
)
|
||||
const worktree = await showLaunchedWorktree(client, launched.result.worktreeId)
|
||||
const setupWarning = await folderSetupUnsupportedWarning(
|
||||
client,
|
||||
launched.result.worktreeId,
|
||||
create
|
||||
)
|
||||
if (setupWarning) {
|
||||
// stderr keeps --json output parseable while still reporting the skipped setup.
|
||||
console.error(`warning: ${setupWarning}`)
|
||||
}
|
||||
const result: WorktreeAgentLaunchResult = {
|
||||
...(worktree
|
||||
? {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { withFolderSetupSupportWarning } from './folder-setup-support-warning'
|
||||
import { withWorktreeSelectorRecovery } from '../worktree-selector-recovery'
|
||||
import type {
|
||||
RuntimeWorktreeListResult,
|
||||
@@ -207,9 +208,13 @@ export const WORKTREE_HANDLERS: Record<string, CommandHandler> = {
|
||||
const result = await withSetupDecisionRecovery(
|
||||
callNamingParentEnvironment<RuntimeWorktreeCreateResult>(client, 'worktree.create', create)
|
||||
)
|
||||
printHookWarning(result.result, json)
|
||||
printLineageSummary(result.result, json)
|
||||
printResult(result, json, formatWorktreeShow)
|
||||
const created = {
|
||||
...result,
|
||||
result: await withFolderSetupSupportWarning(client, result.result, create)
|
||||
}
|
||||
printHookWarning(created.result, json)
|
||||
printLineageSummary(created.result, json)
|
||||
printResult(created, json, formatWorktreeShow)
|
||||
},
|
||||
'worktree set': async ({ flags, client, cwd, json }) => {
|
||||
assertWorktreeParentFlagsCompatible(
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { z } from 'zod'
|
||||
import { legacyAgentSessionQuestionAnswers } from '../../../shared/agent-session/agent-session-question-answer'
|
||||
import { AcpRpcError } from '../transport/acp-errors'
|
||||
import { AcpRpcError, acpErrorDataWords, type AcpAgentError } from '../transport/acp-errors'
|
||||
import { readAcpPermissionRequest } from '../protocol/acp-permission-requests'
|
||||
import { acpPermissionPresentation } from '../requests/acp-timeline-requests'
|
||||
import type { ToolCallUpdate } from '../generated/acp-protocol.generated'
|
||||
@@ -107,9 +107,28 @@ function normalizeToolUpdate(update: ToolCallUpdate): ToolCallUpdate {
|
||||
}
|
||||
}
|
||||
|
||||
const cloudCodeErrorSchema = z.object({
|
||||
error: z.object({ message: z.string().trim().min(1) })
|
||||
})
|
||||
|
||||
function promptErrorDetail(error: AcpAgentError): string | undefined {
|
||||
const text = acpErrorDataWords(error.data) ?? error.message
|
||||
const prefix = /^Cloud Code Assist API error \(\d{3}\):\s*/.exec(text)
|
||||
if (!prefix) {
|
||||
return undefined
|
||||
}
|
||||
try {
|
||||
return cloudCodeErrorSchema.safeParse(JSON.parse(text.slice(prefix[0].length))).data?.error
|
||||
.message
|
||||
} catch {
|
||||
return undefined
|
||||
}
|
||||
}
|
||||
|
||||
export const ANTIGRAVITY_ACP_DIALECT: AcpDialect = {
|
||||
request: (method, params) => questionRequest(method, params) ?? warnedApproval(method, params),
|
||||
normalizeToolUpdate,
|
||||
promptErrorDetail,
|
||||
// Avoid using the full command line as the tool name.
|
||||
toolName: (update) => (update.kind === 'execute' ? 'execute' : undefined),
|
||||
// Logout would clear the account shared by every Antigravity chat on this host.
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
import { afterEach, expect, it } from 'vitest'
|
||||
import { closeProviderTimelineRigs } from '../../native-chat/agent-session-timeline/provider-timeline-assembler-test-support'
|
||||
import { acpLaunchSpecFor } from '../launch/acp-launch-registry'
|
||||
import {
|
||||
openAcpAdapterRig,
|
||||
sendHello,
|
||||
waitFor
|
||||
} from './testing/acp-structured-adapter.test-support'
|
||||
|
||||
afterEach(closeProviderTimelineRigs)
|
||||
|
||||
const quotaError = `Cloud Code Assist API error (429): {
|
||||
"error": {
|
||||
"code": 429,
|
||||
"message": "Individual quota reached. Please upgrade your subscription to increase your limits. Resets in 3h42m11s.",
|
||||
"status": "RESOURCE_EXHAUSTED",
|
||||
"details": [
|
||||
{
|
||||
"@type": "type.googleapis.com/google.rpc.ErrorInfo",
|
||||
"reason": "QUOTA_EXHAUSTED",
|
||||
"domain": "cloudcode-pa.googleapis.com",
|
||||
"metadata": {
|
||||
"quotaResetDelay": "3h42m11.598227131s",
|
||||
"quotaResetTimeStamp": "2026-11-10T15:58:51Z",
|
||||
"uiMessage": "true",
|
||||
"model": "claude-opus-5-5-high"
|
||||
}
|
||||
},
|
||||
{
|
||||
"@type": "type.googleapis.com/google.rpc.RetryInfo",
|
||||
"retryDelay": "13331.598227131s"
|
||||
}
|
||||
]
|
||||
}
|
||||
}`
|
||||
|
||||
it('publishes the Cloud Code Assist message instead of its JSON envelope in chat', async () => {
|
||||
const rig = await openAcpAdapterRig({
|
||||
spec: acpLaunchSpecFor('antigravity')!,
|
||||
script: (agent) =>
|
||||
agent.on('session/prompt', (frame) =>
|
||||
agent.fail(frame, -32603, 'Internal error', { details: quotaError })
|
||||
)
|
||||
})
|
||||
await rig.acquire()
|
||||
await sendHello(rig, 'send-1')
|
||||
await waitFor(async () =>
|
||||
expect((await rig.rig.rows()).filter((row) => row.body.kind === 'status')).toEqual([
|
||||
expect.objectContaining({
|
||||
body: {
|
||||
kind: 'status',
|
||||
tone: 'error',
|
||||
text: 'Individual quota reached. Please upgrade your subscription to increase your limits. Resets in 3h42m11s.'
|
||||
}
|
||||
})
|
||||
])
|
||||
)
|
||||
})
|
||||
@@ -5,6 +5,17 @@ import {
|
||||
withProviderDiagnostic
|
||||
} from '../../../shared/agent-session/failures/agent-session-failure'
|
||||
|
||||
// Structured metadata is not user-facing diagnostic text.
|
||||
export function acpErrorDataWords(data: unknown): string | undefined {
|
||||
const words =
|
||||
typeof data === 'string'
|
||||
? data
|
||||
: typeof data === 'object' && data !== null && 'details' in data
|
||||
? data.details
|
||||
: undefined
|
||||
return typeof words === 'string' && words.trim() ? words : undefined
|
||||
}
|
||||
|
||||
export class AcpRpcError extends Error {
|
||||
constructor(
|
||||
readonly code: number,
|
||||
|
||||
@@ -6,7 +6,12 @@ import {
|
||||
|
||||
import type { AcpDialect, AcpTurnEnding } from '../acp-dialects/acp-dialect'
|
||||
|
||||
import { AcpAgentError, AcpAuthRequiredError, AcpSignInPromptError } from '../transport/acp-errors'
|
||||
import {
|
||||
AcpAgentError,
|
||||
AcpAuthRequiredError,
|
||||
AcpSignInPromptError,
|
||||
acpErrorDataWords
|
||||
} from '../transport/acp-errors'
|
||||
|
||||
/** Prefer provider error details over generic messages such as Internal error. */
|
||||
export function acpPromptErrorDetail(dialect: AcpDialect, error: AcpAgentError): string {
|
||||
@@ -17,17 +22,6 @@ export function acpPromptErrorDetail(dialect: AcpDialect, error: AcpAgentError):
|
||||
return dialect.promptErrorDetail?.(error) ?? acpErrorDataWords(error.data) ?? error.message
|
||||
}
|
||||
|
||||
// Structured metadata is not user-facing diagnostic text.
|
||||
function acpErrorDataWords(data: unknown): string | undefined {
|
||||
const words =
|
||||
typeof data === 'string'
|
||||
? data
|
||||
: typeof data === 'object' && data !== null && 'details' in data
|
||||
? data.details
|
||||
: undefined
|
||||
return typeof words === 'string' && words.trim() ? words : undefined
|
||||
}
|
||||
|
||||
export function acpAuthenticationRequired(dialect: AcpDialect, error: unknown): boolean {
|
||||
return (
|
||||
error instanceof AcpAuthRequiredError ||
|
||||
|
||||
@@ -19,6 +19,8 @@ export function agentHookRuntimeDeps(
|
||||
getAgentStatusSnapshot: () =>
|
||||
server.getStatusSnapshot().filter((entry) => entry.providerSessionOnly !== true),
|
||||
getAgentStatusSnapshotForPane: (paneKey) => server.getStatusSnapshotForPane(paneKey),
|
||||
getPublicAgentStatusSnapshotForPane: (paneKey) =>
|
||||
server.getPublicStatusSnapshotForPane(paneKey),
|
||||
// Include resume identities so mobile can locate provider transcripts, including Pi sessions.
|
||||
getAgentProviderSessionSnapshot: (tabId) =>
|
||||
tabId === undefined
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
import { isTmuxInnerSubject } from '../../../shared/tmux-selected-status'
|
||||
import {
|
||||
getLegacyStatusListingOrder,
|
||||
type HookListenerState
|
||||
} from '../../../shared/agent-hook-listener/listener-state'
|
||||
import {
|
||||
serializeAgentStatusSubject,
|
||||
type AgentStatusSubject
|
||||
} from '../../../shared/agent-status/contracts/agent-status-subject'
|
||||
import type { AgentStatusStore } from '../../../shared/agent-status/store/agent-status-store'
|
||||
import type { EnrichedAgentHookEventPayload } from './server-types'
|
||||
import { structuredStatusLegacyEvent } from './server-structured-status-row'
|
||||
import type { ProgramStatusFacetStore } from './program-status/facet-store'
|
||||
|
||||
const UNORDERED_STATUS_ROW = Number.MAX_SAFE_INTEGER
|
||||
|
||||
export function combinedAgentStatusEntries(
|
||||
source: {
|
||||
state: HookListenerState
|
||||
programStatusFacets: Pick<ProgramStatusFacetStore, 'stitch'>
|
||||
canonicalStatusStore: Pick<AgentStatusStore, 'getParents' | 'getParent'>
|
||||
canonicalSubjectsByPane: ReadonlyMap<string, ReadonlyMap<string, AgentStatusSubject>>
|
||||
canonicalListingOrder: ReadonlyMap<string, number>
|
||||
},
|
||||
paneKey?: string
|
||||
): EnrichedAgentHookEventPayload[] {
|
||||
const rows: { entry: EnrichedAgentHookEventPayload; order: number }[] = []
|
||||
const legacy =
|
||||
paneKey === undefined
|
||||
? source.state.lastStatusByPaneKey
|
||||
: source.state.lastStatusByPaneKey.has(paneKey)
|
||||
? [[paneKey, source.state.lastStatusByPaneKey.get(paneKey)!] as const]
|
||||
: []
|
||||
for (const [paneKey, entry] of legacy) {
|
||||
rows.push({
|
||||
// oxlint-disable-next-line typescript/consistent-type-assertions -- SAFETY: Main admits enriched legacy rows; shared listeners expose only the base event type.
|
||||
entry: source.programStatusFacets.stitch(entry as EnrichedAgentHookEventPayload),
|
||||
order: getLegacyStatusListingOrder(source.state, paneKey) ?? UNORDERED_STATUS_ROW
|
||||
})
|
||||
}
|
||||
const parents =
|
||||
paneKey === undefined
|
||||
? source.canonicalStatusStore.getParents()
|
||||
: [...(source.canonicalSubjectsByPane.get(paneKey)?.values() ?? [])].flatMap(
|
||||
(subject) => source.canonicalStatusStore.getParent(subject) ?? []
|
||||
)
|
||||
for (const parent of parents) {
|
||||
if (!parent.status || isTmuxInnerSubject(parent.subject)) {
|
||||
continue
|
||||
}
|
||||
rows.push({
|
||||
entry: structuredStatusLegacyEvent(parent.status),
|
||||
order:
|
||||
source.canonicalListingOrder.get(serializeAgentStatusSubject(parent.subject)) ??
|
||||
UNORDERED_STATUS_ROW
|
||||
})
|
||||
}
|
||||
return rows.sort((a, b) => a.order - b.order).map(({ entry }) => entry)
|
||||
}
|
||||
@@ -41,11 +41,19 @@ export function programStatusHookYieldEndsAt(
|
||||
) {
|
||||
return Infinity
|
||||
}
|
||||
// Settled turns are naturally silent; a later wait must prove intervening program work.
|
||||
if (previous.payload.state === 'done' && payload.state === 'waiting') {
|
||||
return programWorkingSince !== undefined && programWorkingSince > previous.receivedAt
|
||||
// A settled turn yields only to program work begun after it (a replayed done keeps its own time):
|
||||
// Codex re-reports the settled turn's working while a background terminal it started runs.
|
||||
if (
|
||||
previous.payload.state === 'done' &&
|
||||
(payload.state === 'waiting' || payload.state === 'working')
|
||||
) {
|
||||
const doneAt = previous.evidenceObservedAt ?? previous.receivedAt
|
||||
if (programWorkingSince === undefined || programWorkingSince <= doneAt) {
|
||||
return Infinity
|
||||
}
|
||||
return payload.state === 'waiting'
|
||||
? undefined
|
||||
: Infinity
|
||||
: previous.receivedAt + HOOK_SILENCE_BEFORE_PROGRAM_STATUS_FALLBACK_MS
|
||||
}
|
||||
// A question sends no hooks while open, so a `working` that began before it (e.g. re-sent by the
|
||||
// lease renewal) proves nothing; a working transition after it keeps the silence fallback.
|
||||
|
||||
@@ -180,6 +180,13 @@ export abstract class AgentHookServerIngestTerminal extends AgentHookServerInges
|
||||
const previous = this.state.lastStatusByPaneKey.get(paneKey) as
|
||||
| EnrichedAgentHookEventPayload
|
||||
| undefined
|
||||
// OSC 7501 names OpenCode 2 `opencode`; the row its hook or launch named keeps the generation.
|
||||
const payload: ParsedAgentStatusPayload =
|
||||
event.fromProgramStatus === true &&
|
||||
event.payload.agentType === 'opencode' &&
|
||||
previous?.payload.agentType === 'opencode2'
|
||||
? { ...event.payload, agentType: 'opencode2' }
|
||||
: event.payload
|
||||
// OpenCode 1 run loads hooks in-process; a hook during the command owns its status.
|
||||
const hookOwnsCommand =
|
||||
event.yieldsToHookSince !== undefined &&
|
||||
@@ -189,7 +196,7 @@ export abstract class AgentHookServerIngestTerminal extends AgentHookServerInges
|
||||
// Record ordering before removal, which also marks a program turn boundary.
|
||||
const workingSince =
|
||||
event.fromProgramStatus === true
|
||||
? this.programStatusFacets.noteState(paneKey, event.payload, now)
|
||||
? this.programStatusFacets.noteState(paneKey, payload, now)
|
||||
: undefined
|
||||
if (event.removesProgramStatusRow === true) {
|
||||
this.hookSilenceRechecks.cancel(paneKey)
|
||||
@@ -205,7 +212,7 @@ export abstract class AgentHookServerIngestTerminal extends AgentHookServerInges
|
||||
}
|
||||
const yieldEndsAt =
|
||||
event.fromProgramStatus === true
|
||||
? programStatusHookYieldEndsAt(previous, event.payload, workingSince)
|
||||
? programStatusHookYieldEndsAt(previous, payload, workingSince)
|
||||
: undefined
|
||||
const hookOwnsAgent = yieldEndsAt !== undefined && now < yieldEndsAt
|
||||
if (event.fromProgramStatus === true) {
|
||||
@@ -235,7 +242,7 @@ export abstract class AgentHookServerIngestTerminal extends AgentHookServerInges
|
||||
// OSC 7501 uses the hook precedence above; other terminal reports cannot settle child-held work.
|
||||
(event.fromProgramStatus !== true &&
|
||||
previous?.payload.agentType === 'claude' &&
|
||||
event.payload.agentType === 'claude' &&
|
||||
payload.agentType === 'claude' &&
|
||||
isAgentStatusHeldOpenByChildWork(previous.payload) &&
|
||||
previous.payload.subagents?.some((subagent) => subagent.state === 'working') === true)
|
||||
) {
|
||||
@@ -258,10 +265,10 @@ export abstract class AgentHookServerIngestTerminal extends AgentHookServerInges
|
||||
previous.worktreeId === worktreeId &&
|
||||
// A terminal handle joins row identity; acquiring or replacing it requires publication.
|
||||
previous.terminalHandle === (terminalHandle ?? previous.terminalHandle) &&
|
||||
terminalStatusPayloadMatchesHook(previous.payload, event.payload, preserveActiveTurnStamp) &&
|
||||
terminalStatusPayloadMatchesHook(previous.payload, payload, preserveActiveTurnStamp) &&
|
||||
// OSC 7501 child-only changes still require publication; absent children means none remain.
|
||||
(event.fromProgramStatus !== true ||
|
||||
agentSubagentsEqual(previous.payload.subagents, event.payload.subagents))
|
||||
agentSubagentsEqual(previous.payload.subagents, payload.subagents))
|
||||
) {
|
||||
// An authority transfer must refresh enriched subscribers even for an identical payload.
|
||||
this.refreshTerminalStatusEvidence(
|
||||
@@ -274,24 +281,22 @@ export abstract class AgentHookServerIngestTerminal extends AgentHookServerInges
|
||||
}
|
||||
// Terminal status carries no provider session; retain eligible cached identity without treating unknown as a mismatch (#10630).
|
||||
const claimedAgentType =
|
||||
event.payload.agentType && event.payload.agentType !== 'unknown'
|
||||
? event.payload.agentType
|
||||
: undefined
|
||||
payload.agentType && payload.agentType !== 'unknown' ? payload.agentType : undefined
|
||||
// A live agent's turn after `done` keeps its session (OSC 7501 reports hookless slash commands); a new run or an exited agent's resume-only row does not. Launch seeds are not completed turns.
|
||||
const preservedProviderSession =
|
||||
previous?.providerSession &&
|
||||
(claimedAgentType === undefined || claimedAgentType === previous.payload.agentType) &&
|
||||
(previous.payload.state !== 'done' ||
|
||||
event.payload.state === 'done' ||
|
||||
payload.state === 'done' ||
|
||||
previous.observation?.origin === 'launch' ||
|
||||
(!newRun && previous.providerSessionOnly !== true))
|
||||
? previous.providerSession
|
||||
: undefined
|
||||
// Without a new main-agent fact, preserve it only while the row's state and agent still match.
|
||||
const preservedMainAgent =
|
||||
event.payload.mainAgent ??
|
||||
payload.mainAgent ??
|
||||
(previous?.payload.mainAgent &&
|
||||
previous.payload.state === event.payload.state &&
|
||||
previous.payload.state === payload.state &&
|
||||
(claimedAgentType === undefined || claimedAgentType === previous.payload.agentType)
|
||||
? previous.payload.mainAgent
|
||||
: undefined)
|
||||
@@ -304,9 +309,7 @@ export abstract class AgentHookServerIngestTerminal extends AgentHookServerInges
|
||||
connectionId,
|
||||
...(preservedProviderSession ? { providerSession: preservedProviderSession } : {}),
|
||||
...(terminalHandle ? { terminalHandle } : {}),
|
||||
payload: preservedMainAgent
|
||||
? { ...event.payload, mainAgent: preservedMainAgent }
|
||||
: event.payload
|
||||
payload: preservedMainAgent ? { ...payload, mainAgent: preservedMainAgent } : payload
|
||||
},
|
||||
undefined,
|
||||
event.origin ?? 'osc',
|
||||
|
||||
@@ -1,15 +1,11 @@
|
||||
import { cliWriterExecutionMatcher, type CliWriterExecutionMatches } from './cli-writer-observation'
|
||||
import { isTmuxInnerSubject } from '../../../shared/tmux-selected-status'
|
||||
import type {
|
||||
AgentStatusClearIpcPayload,
|
||||
AgentStatusIpcPayload
|
||||
} from '../../../shared/agent-status/contracts/agent-status-ipc-payload'
|
||||
import type { ClaudeStatusLineRateLimits } from '../../../shared/claude-statusline-rate-limits'
|
||||
import type { HookTransportInterferenceReport } from '../../../shared/agent-hook-listener/transport/agent-hook-transport-interference'
|
||||
import {
|
||||
getLegacyStatusListingOrder,
|
||||
type HookListenerState
|
||||
} from '../../../shared/agent-hook-listener/listener-state'
|
||||
import type { HookListenerState } from '../../../shared/agent-hook-listener/listener-state'
|
||||
import type {
|
||||
AgentHookAuthorityEvidence,
|
||||
AgentHookProviderSessionIdentity,
|
||||
@@ -20,15 +16,11 @@ import type {
|
||||
} from './server-types'
|
||||
import { toAgentStatusIpcPayload } from './server-status-identity'
|
||||
import { AgentHookServerState } from './server-state'
|
||||
import { serializeAgentStatusSubject } from '../../../shared/agent-status/contracts/agent-status-subject'
|
||||
import { structuredStatusLegacyEvent } from './server-structured-status-row'
|
||||
import { combinedAgentStatusEntries } from './combined-agent-status-entries'
|
||||
import { PaneTimers } from './program-status/pane-timers'
|
||||
import { ProgramStatusFacetStore } from './program-status/facet-store'
|
||||
import { parsePaneKey } from '../../../shared/workspace-layout/stable-pane-id'
|
||||
|
||||
// Unassigned rows sort after the listing counter, which starts at 1.
|
||||
const UNORDERED_STATUS_ROW = Number.MAX_SAFE_INTEGER
|
||||
|
||||
export abstract class AgentHookServerListeners extends AgentHookServerState {
|
||||
protected providerRowsByTab: Map<string, AgentStatusIpcPayload[]> | null = null
|
||||
protected statusChangeNotificationVersion = 0
|
||||
@@ -76,27 +68,17 @@ export abstract class AgentHookServerListeners extends AgentHookServerState {
|
||||
this.providerRowsByTab = null
|
||||
}
|
||||
|
||||
private combinedStatusEntries(): EnrichedAgentHookEventPayload[] {
|
||||
const rows: { entry: EnrichedAgentHookEventPayload; order: number }[] = []
|
||||
for (const [paneKey, entry] of this.state.lastStatusByPaneKey) {
|
||||
rows.push({
|
||||
// oxlint-disable-next-line typescript/consistent-type-assertions -- SAFETY: Main admits enriched legacy rows; shared listeners expose only the base event type.
|
||||
entry: this.programStatusFacets.stitch(entry as EnrichedAgentHookEventPayload),
|
||||
order: getLegacyStatusListingOrder(this.state, paneKey) ?? UNORDERED_STATUS_ROW
|
||||
})
|
||||
}
|
||||
for (const parent of this.canonicalStatusStore.getParents()) {
|
||||
if (!parent.status || isTmuxInnerSubject(parent.subject)) {
|
||||
continue
|
||||
}
|
||||
rows.push({
|
||||
entry: structuredStatusLegacyEvent(parent.status),
|
||||
order:
|
||||
this.canonicalListingOrder.get(serializeAgentStatusSubject(parent.subject)) ??
|
||||
UNORDERED_STATUS_ROW
|
||||
})
|
||||
}
|
||||
return rows.sort((a, b) => a.order - b.order).map(({ entry }) => entry)
|
||||
private combinedStatusEntries(paneKey?: string): EnrichedAgentHookEventPayload[] {
|
||||
return combinedAgentStatusEntries(
|
||||
{
|
||||
state: this.state,
|
||||
programStatusFacets: this.programStatusFacets,
|
||||
canonicalStatusStore: this.canonicalStatusStore,
|
||||
canonicalSubjectsByPane: this.canonicalSubjectsByPane,
|
||||
canonicalListingOrder: this.canonicalListingOrder
|
||||
},
|
||||
paneKey
|
||||
)
|
||||
}
|
||||
/** Report repeated hook-body truncation once per process; fail-open handling otherwise hides it (#11217). */
|
||||
setTransportInterferenceListener(
|
||||
@@ -248,6 +230,12 @@ export abstract class AgentHookServerListeners extends AgentHookServerState {
|
||||
return this.buildStatusChangeNotification().providerSessions
|
||||
}
|
||||
|
||||
getPublicStatusSnapshotForPane(paneKey: string): AgentStatusIpcPayload[] {
|
||||
return this.combinedStatusEntries(paneKey)
|
||||
.filter((entry) => entry.providerSessionOnly !== true)
|
||||
.map(toAgentStatusIpcPayload)
|
||||
}
|
||||
|
||||
getStatusSnapshotForPane(paneKey: string): AgentStatusIpcPayload[] {
|
||||
const legacy = this.state.lastStatusByPaneKey.get(paneKey)
|
||||
if (legacy) {
|
||||
|
||||
+2
-9
@@ -4,7 +4,7 @@ import { join } from 'node:path'
|
||||
import { afterEach, beforeEach, expect, it, vi } from 'vitest'
|
||||
import { AgentHookServer } from '../../agent-hook-server'
|
||||
import { HOOK_SILENCE_BEFORE_PROGRAM_STATUS_FALLBACK_MS } from '../../program-status/hook-precedence'
|
||||
import { buildBody, PANE, postHookEvent } from '../server.test-fixtures'
|
||||
import { buildBody, ingestProgramStatusOsc, PANE, postHookEvent } from '../server.test-fixtures'
|
||||
|
||||
const SESSION = '70efcb3f-ae17-4863-9318-649f5469408b'
|
||||
|
||||
@@ -54,14 +54,7 @@ it('keeps the start folder and effort when a terminal status row precedes the ne
|
||||
vi.useFakeTimers({ toFake: ['Date'] })
|
||||
vi.setSystemTime(Date.now() + HOOK_SILENCE_BEFORE_PROGRAM_STATUS_FALLBACK_MS)
|
||||
// Claude reports OSC 7501 `working` just before UserPromptSubmit.
|
||||
server.ingestTerminalStatus({
|
||||
paneKey: PANE,
|
||||
tabId: 'tab-1',
|
||||
worktreeId: 'wt-1',
|
||||
connectionId: null,
|
||||
fromProgramStatus: true,
|
||||
payload: { prompt: '', state: 'working', agentType: 'claude' }
|
||||
})
|
||||
ingestProgramStatusOsc(server, '\x1b]7501;state=working:app=claude-code\x1b\\')
|
||||
await claudeHook({ hook_event_name: 'UserPromptSubmit', prompt: 'next', cwd: '/repo/sub' })
|
||||
|
||||
expect(recordedSession()).toMatchObject({ id: SESSION, cwd: '/repo', effort: 'max' })
|
||||
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
import { afterEach, beforeEach, expect, it, vi } from 'vitest'
|
||||
import { AgentHookServer } from '../../../agent-hook-server'
|
||||
import { HOOK_SILENCE_BEFORE_PROGRAM_STATUS_FALLBACK_MS } from '../../../program-status/hook-precedence'
|
||||
import { buildBody, ingestProgramStatusOsc, postHookEvent } from '../../server.test-fixtures'
|
||||
|
||||
const TURN = { session_id: 'session-1', turn_id: 'turn-1' }
|
||||
|
||||
let server: AgentHookServer
|
||||
|
||||
beforeEach(async () => {
|
||||
server = new AgentHookServer()
|
||||
await server.start({ env: 'production' })
|
||||
})
|
||||
|
||||
afterEach(() => {
|
||||
vi.useRealTimers()
|
||||
server.stop()
|
||||
})
|
||||
|
||||
async function codexHook(hookEventName: string, payload: Record<string, unknown> = {}) {
|
||||
const response = await postHookEvent(
|
||||
server,
|
||||
buildBody({ ...TURN, hook_event_name: hookEventName, ...payload }),
|
||||
'/hook/codex'
|
||||
)
|
||||
expect(response.status).toBe(204)
|
||||
}
|
||||
|
||||
it('keeps a finished Codex turn done while its background terminal keeps OSC 7501 working', async () => {
|
||||
await codexHook('UserPromptSubmit', { prompt: 'start sleep 900 in the background' })
|
||||
// Codex 0.167 sends this at the turn start and nothing after it while `sleep 900` runs.
|
||||
const working = ingestProgramStatusOsc(server, '\x1b]7501;state=working:app=codex\x1b\\')
|
||||
await codexHook('Stop', { last_assistant_message: 'ok' })
|
||||
|
||||
vi.useFakeTimers({ toFake: ['Date', 'setTimeout', 'clearTimeout'] })
|
||||
server.ingestTerminalStatus({ ...working, renewsProgramStatusLease: true })
|
||||
vi.advanceTimersByTime(HOOK_SILENCE_BEFORE_PROGRAM_STATUS_FALLBACK_MS + 1)
|
||||
|
||||
expect(server.getStatusSnapshot()[0]?.state).toBe('done')
|
||||
})
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
import { afterEach, expect, it, vi } from 'vitest'
|
||||
import { AgentHookServer } from '../../../agent-hook-server'
|
||||
import { buildBody, PANE, postHookEvent } from '../../server.test-fixtures'
|
||||
|
||||
vi.mock('../../../../../telemetry/client', () => ({ track: vi.fn() }))
|
||||
vi.mock('../../../../../telemetry/cohort-classifier', () => ({ getCohortAtEmit: () => ({}) }))
|
||||
|
||||
let server: AgentHookServer | undefined
|
||||
afterEach(() => {
|
||||
server?.stop()
|
||||
})
|
||||
|
||||
function oscStatus(state: 'working' | 'done'): void {
|
||||
// OpenCode 2 reports OSC 7501 as `app=opencode`.
|
||||
server!.ingestTerminalStatus({
|
||||
paneKey: PANE,
|
||||
tabId: 'tab-1',
|
||||
worktreeId: 'wt-1',
|
||||
connectionId: null,
|
||||
fromProgramStatus: true,
|
||||
payload: { state, prompt: '', agentType: 'opencode' }
|
||||
})
|
||||
}
|
||||
|
||||
async function hook(hook_event_name: string, prompt = ''): Promise<void> {
|
||||
const body = buildBody({ hook_event_name, sessionID: 'ses_opencode2', prompt })
|
||||
expect((await postHookEvent(server!, body, '/hook/opencode2')).status).toBe(204)
|
||||
}
|
||||
|
||||
it('keeps OpenCode 2 hooks and their session on a pane its OSC 7501 reports as opencode', async () => {
|
||||
server = new AgentHookServer()
|
||||
await server.start({ env: 'production' })
|
||||
oscStatus('working')
|
||||
await hook('SessionBusy', 'rename the branch')
|
||||
expect(server.getStatusSnapshot()[0]).toMatchObject({
|
||||
agentType: 'opencode2',
|
||||
prompt: 'rename the branch'
|
||||
})
|
||||
|
||||
await hook('SessionIdle')
|
||||
oscStatus('done')
|
||||
expect(server.getStatusSnapshot()[0]).toMatchObject({
|
||||
agentType: 'opencode2',
|
||||
state: 'done',
|
||||
providerSession: { id: 'ses_opencode2' }
|
||||
})
|
||||
})
|
||||
@@ -1,4 +1,5 @@
|
||||
import { makePaneKey } from '../../../../shared/workspace-layout/stable-pane-id'
|
||||
import { createProgramStatusProjector } from '../../../../shared/program-status/agent-status-projector'
|
||||
import type { AgentHookServer } from '../agent-hook-server'
|
||||
|
||||
export const LEAF_1 = '11111111-1111-4111-8111-111111111111'
|
||||
@@ -44,6 +45,22 @@ export function buildBody(payload: Record<string, unknown>, overrides: Partial<B
|
||||
}
|
||||
}
|
||||
|
||||
/** Feed one OSC 7501 report to the server as the runtime does: its facet, then its status row. */
|
||||
export function ingestProgramStatusOsc(server: AgentHookServer, osc: string) {
|
||||
const { payloads, facet } = createProgramStatusProjector().process(osc)
|
||||
server.ingestProgramStatusFacet({ paneKey: PANE, facet: facet ?? null })
|
||||
const event = {
|
||||
paneKey: PANE,
|
||||
tabId: 'tab-1',
|
||||
worktreeId: 'wt-1',
|
||||
connectionId: null,
|
||||
fromProgramStatus: true as const,
|
||||
payload: payloads[0]!.payload
|
||||
}
|
||||
server.ingestTerminalStatus(event)
|
||||
return event
|
||||
}
|
||||
|
||||
// Stay within the seven-day hydration limit without racing now.
|
||||
export function recentTs(offsetMs = 0): number {
|
||||
return Date.now() - 60 * 60 * 1000 + offsetMs
|
||||
|
||||
+48
@@ -11,6 +11,7 @@ import {
|
||||
} from '../../../../../shared/agent-session/view/structured-agent-session-projection'
|
||||
import { AgentHookServer } from '../../agent-hook-server'
|
||||
import { PANE } from '../server.test-fixtures'
|
||||
import { agentHookRuntimeDeps } from '../../../runtime/agent-hook-runtime-deps'
|
||||
|
||||
vi.mock('../../../../telemetry/client', () => ({ track: vi.fn() }))
|
||||
vi.mock('../../../../telemetry/cohort-classifier', () => ({ getCohortAtEmit: vi.fn(() => ({})) }))
|
||||
@@ -51,6 +52,53 @@ function terminal(server: AgentHookServer, paneKey: string): void {
|
||||
afterEach(() => vi.restoreAllMocks())
|
||||
|
||||
describe('structured canonical production slice', () => {
|
||||
it('publishes the same public pane evidence while preserving resume-only provider identity', () => {
|
||||
const server = new AgentHookServer()
|
||||
const deps = agentHookRuntimeDeps(server, { read: () => ({ kind: 'unobserved' }) }, () => ({}))
|
||||
server.recordLaunchResumeIdentity({
|
||||
paneKey: PANE,
|
||||
agentType: 'codex',
|
||||
providerSession: { key: 'session_id', id: 'resume-only' },
|
||||
launchedAt: 100
|
||||
})
|
||||
expect(deps.getPublicAgentStatusSnapshotForPane(PANE)).toEqual([])
|
||||
expect(deps.getAgentStatusSnapshotForPane(PANE)).toEqual([
|
||||
expect.objectContaining({
|
||||
providerSessionOnly: true,
|
||||
providerSession: { key: 'session_id', id: 'resume-only' }
|
||||
})
|
||||
])
|
||||
expect(deps.getAgentProviderSessionRowsForPane(PANE)).toEqual([
|
||||
expect.objectContaining({
|
||||
providerSessionOnly: true,
|
||||
providerSession: { key: 'session_id', id: 'resume-only' }
|
||||
})
|
||||
])
|
||||
terminal(server, PANE)
|
||||
server.ingestStructuredStatus(summary(), SUBJECT)
|
||||
const second = makeStructuredAgentStatusSubject(
|
||||
{ ...SCOPE, executionHostId: 'ssh:other' },
|
||||
SESSION
|
||||
)
|
||||
server.ingestStructuredStatus({ ...summary(second), agent: 'claude', status: 'idle' }, second)
|
||||
expect(deps.getAgentStatusSnapshotForPane(PANE).map(({ state }) => state)).toEqual(['working'])
|
||||
expect(
|
||||
deps
|
||||
.getPublicAgentStatusSnapshotForPane(PANE_KEY)
|
||||
.map(({ agentType, state }) => ({ agentType, state }))
|
||||
).toEqual([
|
||||
{ agentType: 'codex', state: 'working' },
|
||||
{ agentType: 'claude', state: 'done' }
|
||||
])
|
||||
expect(deps.getAgentStatusSnapshot().map(({ paneKey, state }) => ({ paneKey, state }))).toEqual(
|
||||
[
|
||||
{ paneKey: PANE, state: 'working' },
|
||||
{ paneKey: PANE_KEY, state: 'working' },
|
||||
{ paneKey: PANE_KEY, state: 'done' }
|
||||
]
|
||||
)
|
||||
})
|
||||
|
||||
it('isolates identical session identifiers across host, WSL and workspace kind scopes', () => {
|
||||
const server = new AgentHookServer()
|
||||
const scopes: AgentStatusExecutionScope[] = [
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
import type { CapturePaintHold } from '../debugger/guest-paint-hold'
|
||||
import {
|
||||
holdPaintUntilCdpCaptureSettles,
|
||||
holdPaintUntilSettled,
|
||||
type CapturePaintHold
|
||||
} from '../debugger/guest-paint-hold'
|
||||
import type { WebContents } from 'electron'
|
||||
import { sendGuestCdpCommand } from '../debugger/guest-cdp-command'
|
||||
import {
|
||||
@@ -137,7 +141,8 @@ export function withTimeout<T>(
|
||||
// Undrawn pages can leave captures pending; cheap probes trigger a frame for the original request.
|
||||
function captureUntilDrawn(
|
||||
webContents: WebContents,
|
||||
params: Record<string, unknown>
|
||||
params: Record<string, unknown>,
|
||||
holdPaint: CapturePaintHold
|
||||
): Promise<{ data: string } | null> {
|
||||
return new Promise((resolve, reject) => {
|
||||
let settled = false
|
||||
@@ -173,12 +178,12 @@ function captureUntilDrawn(
|
||||
} catch {
|
||||
// Guest teardown can reject repaint requests; still try CDP.
|
||||
}
|
||||
return sendGuestCdpCommand(webContents, 'Page.captureScreenshot', requestParams).then(
|
||||
(result) => {
|
||||
const data = isRecord(result) ? result.data : undefined
|
||||
return typeof data === 'string' ? { data } : undefined
|
||||
}
|
||||
)
|
||||
return holdPaintUntilCdpCaptureSettles(webContents, holdPaint, () =>
|
||||
sendGuestCdpCommand(webContents, 'Page.captureScreenshot', requestParams)
|
||||
).then((result) => {
|
||||
const data = isRecord(result) ? result.data : undefined
|
||||
return typeof data === 'string' ? { data } : undefined
|
||||
})
|
||||
}
|
||||
const deadline = setTimeout(() => finish(() => resolve(null)), SCREENSHOT_TIMEOUT_MS)
|
||||
let probes: NodeJS.Timeout[] = []
|
||||
@@ -223,11 +228,15 @@ export async function captureFullPageScreenshot(
|
||||
if (!clip) {
|
||||
throw new Error('Unable to determine full-page screenshot bounds')
|
||||
}
|
||||
const frame = await captureUntilDrawn(webContents, {
|
||||
format,
|
||||
captureBeyondViewport: true,
|
||||
clip
|
||||
})
|
||||
const frame = await captureUntilDrawn(
|
||||
webContents,
|
||||
{
|
||||
format,
|
||||
captureBeyondViewport: true,
|
||||
clip
|
||||
},
|
||||
holdPaint
|
||||
)
|
||||
if (!frame) {
|
||||
throw new Error(SCREENSHOT_TIMEOUT_MESSAGE)
|
||||
}
|
||||
@@ -269,13 +278,13 @@ export async function captureScreenshot(
|
||||
|
||||
const release = holdPaint()
|
||||
try {
|
||||
const frame = await captureUntilDrawn(webContents, screenshotParams)
|
||||
const frame = await captureUntilDrawn(webContents, screenshotParams, holdPaint)
|
||||
if (frame) {
|
||||
return frame
|
||||
}
|
||||
const fallback = await readRemoteCliAdmittedPage(webContents.id, () =>
|
||||
withTimeout(
|
||||
Promise.resolve().then(() => webContents.capturePage()),
|
||||
holdPaintUntilSettled(holdPaint, () => webContents.capturePage()),
|
||||
FALLBACK_CAPTURE_TIMEOUT_MS,
|
||||
SCREENSHOT_TIMEOUT_MESSAGE
|
||||
)
|
||||
|
||||
@@ -1,2 +1,41 @@
|
||||
import type { WebContents } from 'electron'
|
||||
import { acquireElectronDebugger } from './electron-debugger-lease'
|
||||
|
||||
/** Draws a hidden guest while a capture or agent input needs its frames; returns its release. */
|
||||
export type CapturePaintHold = () => () => void
|
||||
|
||||
function retainUntilSettled<T>(acquire: () => () => void, run: () => Promise<T>): Promise<T> {
|
||||
let release: () => void
|
||||
try {
|
||||
release = acquire()
|
||||
} catch (error) {
|
||||
return Promise.reject(error)
|
||||
}
|
||||
const pending = new Promise<T>((resolve) => resolve(run()))
|
||||
void pending.then(release, release)
|
||||
return pending
|
||||
}
|
||||
|
||||
/**
|
||||
* Holds paint until Chromium answers the capture, not just while the caller waits. A capture stays
|
||||
* pending until the guest draws, and while pending it can hold macOS display sleep off ("Capturing");
|
||||
* timeouts do not cancel it (#24946).
|
||||
*/
|
||||
export function holdPaintUntilSettled<T>(
|
||||
holdPaint: CapturePaintHold,
|
||||
capture: () => Promise<T>
|
||||
): Promise<T> {
|
||||
return retainUntilSettled(holdPaint, capture)
|
||||
}
|
||||
|
||||
/** Also keeps the debugger attached: a detach rejects the command while Chromium keeps the capture. */
|
||||
export function holdPaintUntilCdpCaptureSettles<T>(
|
||||
webContents: WebContents,
|
||||
holdPaint: CapturePaintHold,
|
||||
capture: () => Promise<T>
|
||||
): Promise<T> {
|
||||
return retainUntilSettled(
|
||||
() => acquireElectronDebugger(webContents).release,
|
||||
() => retainUntilSettled(holdPaint, capture)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ function startOptions(viewport: boolean) {
|
||||
maxHeight: 1200,
|
||||
everyNthFrame: 2,
|
||||
minFrameIntervalMs: 0,
|
||||
holdPaint: () => () => {},
|
||||
...(viewport ? { viewportWidth: 390, viewportHeight: 844 } : {}),
|
||||
onFrame: vi.fn(() => true),
|
||||
onError: vi.fn()
|
||||
@@ -59,6 +60,49 @@ describe('browser screencast first-frame deadline', () => {
|
||||
await session.done
|
||||
})
|
||||
|
||||
it('keeps the page drawable until Chromium answers the captures the stream gave up on', async () => {
|
||||
let settleCapture!: (image: unknown) => void
|
||||
const webContents = Object.assign(createMockScreencastWebContents(), {
|
||||
capturePage: vi.fn(
|
||||
() =>
|
||||
new Promise((resolve) => {
|
||||
settleCapture = resolve
|
||||
})
|
||||
)
|
||||
})
|
||||
let settleScreenshot!: (result: unknown) => void
|
||||
let rejectScreenshot!: (error: Error) => void
|
||||
webContents.debugger.sendCommand.mockImplementation(async (method: string) =>
|
||||
method === 'Page.captureScreenshot'
|
||||
? new Promise((resolve, reject) => {
|
||||
settleScreenshot = resolve
|
||||
rejectScreenshot = reject
|
||||
})
|
||||
: {}
|
||||
)
|
||||
// Electron rejects pending commands on detach, but Chromium keeps the capture.
|
||||
webContents.debugger.detach.mockImplementation(() =>
|
||||
rejectScreenshot(new Error('target closed while handling command'))
|
||||
)
|
||||
const releasePaint = vi.fn()
|
||||
const options = { ...startOptions(true), holdPaint: vi.fn(() => releasePaint) }
|
||||
const session = await start(webContents, options)
|
||||
|
||||
// capturePage's 10 s bound, then the CDP fallback's 8 s.
|
||||
await vi.advanceTimersByTimeAsync(18_000)
|
||||
session.stop()
|
||||
await session.done
|
||||
expect(options.holdPaint).toHaveBeenCalledTimes(2)
|
||||
expect(webContents.debugger.detach).not.toHaveBeenCalled()
|
||||
expect(releasePaint).not.toHaveBeenCalled()
|
||||
|
||||
settleCapture({ getSize: () => ({ width: 0, height: 0 }) })
|
||||
settleScreenshot({})
|
||||
await vi.advanceTimersByTimeAsync(0)
|
||||
expect(releasePaint).toHaveBeenCalledTimes(2)
|
||||
expect(webContents.debugger.detach).toHaveBeenCalledOnce()
|
||||
})
|
||||
|
||||
it('drops a capture that settles after the limit', async () => {
|
||||
let settleCapture!: (image: unknown) => void
|
||||
const webContents = Object.assign(createMockScreencastWebContents(), {
|
||||
|
||||
@@ -70,6 +70,7 @@ async function startOversizedStream(guest: ReturnType<typeof createGuest>, onFra
|
||||
deviceScaleFactor: 2,
|
||||
everyNthFrame: 1,
|
||||
minFrameIntervalMs: 0,
|
||||
holdPaint: () => () => {},
|
||||
onFrame
|
||||
})
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@ describe('browser screencast lifecycle', () => {
|
||||
maxHeight: 2160,
|
||||
everyNthFrame: 2,
|
||||
minFrameIntervalMs: 0,
|
||||
holdPaint: () => () => {},
|
||||
onFrame
|
||||
})
|
||||
|
||||
@@ -80,6 +81,7 @@ describe('browser screencast lifecycle', () => {
|
||||
maxHeight: 1200,
|
||||
everyNthFrame: 2,
|
||||
minFrameIntervalMs: 0,
|
||||
holdPaint: () => () => {},
|
||||
onFrame: vi.fn()
|
||||
},
|
||||
isClosed: () => false,
|
||||
|
||||
@@ -40,6 +40,7 @@ function createLiveFrameRoute(
|
||||
maxHeight: 1200,
|
||||
everyNthFrame: 2,
|
||||
minFrameIntervalMs: 0,
|
||||
holdPaint: () => () => {},
|
||||
onFrame
|
||||
}
|
||||
const isClosed = () => false
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
import { Buffer } from 'node:buffer'
|
||||
import type { Debugger, WebContents } from 'electron'
|
||||
import { readBrowserScreencastImageSize } from './browser-screencast-image-size'
|
||||
import { sendDebuggerCommand } from './browser-screencast-debugger-command'
|
||||
import { runDebuggerCommandWithTimeout } from './browser-screencast-debugger-command'
|
||||
import {
|
||||
holdPaintUntilCdpCaptureSettles,
|
||||
holdPaintUntilSettled
|
||||
} from '../debugger/guest-paint-hold'
|
||||
import type {
|
||||
BrowserScreencastOptions,
|
||||
PendingScreencastFrame
|
||||
@@ -35,6 +39,7 @@ export function createBrowserScreencastSnapshotCapture(
|
||||
): BrowserScreencastSnapshotCapture {
|
||||
const { webContents, dbg, options, isClosed, isStopping, getSeq, queueFrame } = deps
|
||||
const { applyDeviceMetricsOverride } = deps
|
||||
const { holdPaint } = options
|
||||
|
||||
let snapshotGeneration = 0
|
||||
let navigationCaptureTimer: ReturnType<typeof setTimeout> | null = null
|
||||
@@ -81,7 +86,9 @@ export function createBrowserScreencastSnapshotCapture(
|
||||
try {
|
||||
// Prefer capturePage to avoid CDP tiling; stopped compositing can leave it pending.
|
||||
const nativeImage = await withTimeout(
|
||||
webContents.capturePage({ x: 0, y: 0, width: viewportWidth, height: viewportHeight }),
|
||||
holdPaintUntilSettled(holdPaint, () =>
|
||||
webContents.capturePage({ x: 0, y: 0, width: viewportWidth, height: viewportHeight })
|
||||
),
|
||||
SNAPSHOT_CAPTURE_TIMEOUT_MS,
|
||||
null
|
||||
)
|
||||
@@ -101,7 +108,7 @@ export function createBrowserScreencastSnapshotCapture(
|
||||
}
|
||||
}
|
||||
if (!image) {
|
||||
const result = await sendDebuggerCommand(dbg, 'Page.captureScreenshot', {
|
||||
const screenshotParams = {
|
||||
format: options.format,
|
||||
...(options.format === 'jpeg' ? { quality: options.quality } : {}),
|
||||
...(viewportWidth && viewportHeight
|
||||
@@ -117,7 +124,12 @@ export function createBrowserScreencastSnapshotCapture(
|
||||
}
|
||||
: {}),
|
||||
captureBeyondViewport: false
|
||||
})
|
||||
}
|
||||
const result = await runDebuggerCommandWithTimeout('Page.captureScreenshot', () =>
|
||||
holdPaintUntilCdpCaptureSettles(webContents, holdPaint, () =>
|
||||
dbg.sendCommand('Page.captureScreenshot', screenshotParams)
|
||||
)
|
||||
)
|
||||
if (isSnapshotStale(initialOnly, generation)) {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ import type {
|
||||
BrowserScreencastFormat,
|
||||
BrowserScreencastFrameMetadata
|
||||
} from '../../../../shared/browser/screencast/browser-screencast-protocol'
|
||||
import type { CapturePaintHold } from '../debugger/guest-paint-hold'
|
||||
|
||||
export type BrowserScreencastOptions = {
|
||||
format: BrowserScreencastFormat
|
||||
@@ -17,6 +18,7 @@ export type BrowserScreencastOptions = {
|
||||
onFrame: (bytes: Uint8Array<ArrayBufferLike>) => boolean | void
|
||||
onEvent?: (event: BrowserScreencastEvent) => void
|
||||
onError?: (message: string) => void
|
||||
holdPaint: CapturePaintHold
|
||||
}
|
||||
|
||||
export type BrowserScreencastViewport = Pick<
|
||||
|
||||
@@ -27,6 +27,7 @@ describe('startBrowserScreencast', () => {
|
||||
maxHeight: 1200,
|
||||
everyNthFrame: 1,
|
||||
minFrameIntervalMs: 0,
|
||||
holdPaint: () => () => {},
|
||||
onFrame
|
||||
})
|
||||
|
||||
@@ -84,6 +85,7 @@ describe('startBrowserScreencast', () => {
|
||||
maxHeight: 1200,
|
||||
everyNthFrame: 1,
|
||||
minFrameIntervalMs: 100,
|
||||
holdPaint: () => () => {},
|
||||
onFrame
|
||||
})
|
||||
|
||||
@@ -136,6 +138,7 @@ describe('startBrowserScreencast', () => {
|
||||
maxHeight: 1200,
|
||||
everyNthFrame: 2,
|
||||
minFrameIntervalMs: 0,
|
||||
holdPaint: () => () => {},
|
||||
onFrame: vi.fn(),
|
||||
onEvent
|
||||
})
|
||||
|
||||
@@ -90,6 +90,25 @@ describe('claude agent SDK process spawn', () => {
|
||||
expect(spawn.managed?.stderrTail().length).toBe(8192)
|
||||
})
|
||||
|
||||
it('keeps native chat identity after SDK and configured environment defaults', () => {
|
||||
const process = fakeSpawn()
|
||||
createClaudeCodeProcessSpawn(process.spawnImpl, 'win32').spawn(
|
||||
sdkOptions({
|
||||
env: {
|
||||
CLAUDE_CODE_ENTRYPOINT: 'sdk-ts',
|
||||
claude_code_entrypoint: 'account',
|
||||
PATH: 'C:\\bin'
|
||||
}
|
||||
})
|
||||
)
|
||||
expect(process.specs[0]?.env).toMatchObject({ CLAUDE_CODE_ENTRYPOINT: 'orca', PATH: 'C:\\bin' })
|
||||
expect(
|
||||
Object.keys(process.specs[0]?.env ?? {}).filter(
|
||||
(key) => key.toUpperCase() === 'CLAUDE_CODE_ENTRYPOINT'
|
||||
)
|
||||
).toEqual(['CLAUDE_CODE_ENTRYPOINT'])
|
||||
})
|
||||
|
||||
it('preserves a Windows .cmd shim and its arguments for the host spawner', () => {
|
||||
const process = fakeSpawn()
|
||||
createClaudeCodeProcessSpawn(process.spawnImpl, 'win32').spawn(
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { withOrcaClaudeChatEntrypoint } from '../../shared/agent-launch/startup/claude-chat-entrypoint'
|
||||
import type { ChildProcessWithoutNullStreams } from 'node:child_process'
|
||||
import type { PipedProcessSpawner } from '@orca/process-host/process-spec'
|
||||
import type { SpawnOptions as ClaudeAgentSdkSpawnOptions } from '@anthropic-ai/claude-agent-sdk'
|
||||
@@ -70,7 +71,7 @@ export function createClaudeCodeProcessSpawn(
|
||||
{
|
||||
spawnImpl,
|
||||
platform,
|
||||
inheritedEnv: definedEnv(options.env),
|
||||
inheritedEnv: withOrcaClaudeChatEntrypoint(definedEnv(options.env), platform),
|
||||
site: 'claude-stream-json-teardown',
|
||||
policy: (supervised) => claudeChildClosePolicy(supervised, platform),
|
||||
acceptClose: claudeChildCloseProven
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { withOrcaClaudeChatEntrypoint } from '../../shared/agent-launch/startup/claude-chat-entrypoint'
|
||||
import { waitForPromiseWithSignal } from '../../shared/abort-signal-reason'
|
||||
import {
|
||||
assertStructuredAgentResolutionCurrent,
|
||||
@@ -88,7 +89,11 @@ export async function runClaudeListing(
|
||||
stdin: request.stdin,
|
||||
...(request.cwd ? { cwd: request.cwd } : {})
|
||||
},
|
||||
{ site: request.site, inheritedEnv: env, signal: request.signal }
|
||||
{
|
||||
site: request.site,
|
||||
inheritedEnv: withOrcaClaudeChatEntrypoint(env, process.platform),
|
||||
signal: request.signal
|
||||
}
|
||||
)
|
||||
}
|
||||
const result = await runClaudeBackgroundAttempts({
|
||||
@@ -197,7 +202,10 @@ export function createClaudeModelCatalogProbe(
|
||||
{
|
||||
site: 'claude-model-catalog-probe',
|
||||
// The listing runs from the account folder; relative PATH entries still mean the chat's.
|
||||
inheritedEnv: launchDirectory ? envWithPathRelativeTo(env, launchDirectory) : env,
|
||||
inheritedEnv: withOrcaClaudeChatEntrypoint(
|
||||
launchDirectory ? envWithPathRelativeTo(env, launchDirectory) : env,
|
||||
process.platform
|
||||
),
|
||||
signal,
|
||||
partialOutput: {
|
||||
timeoutMs: 2_000,
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { withOrcaClaudeChatEntrypoint } from '../../shared/agent-launch/startup/claude-chat-entrypoint'
|
||||
import { claudeStartupAnswerObservation } from './claude-startup-answer-observation'
|
||||
import type { PipedProcessSpawner } from '@orca/process-host/process-spec'
|
||||
import type * as ClaudeAgentSdk from '@anthropic-ai/claude-agent-sdk'
|
||||
@@ -123,7 +124,7 @@ export async function openClaudeStreamJsonConnection(
|
||||
options: {
|
||||
...launch.options,
|
||||
cwd: launch.cwd,
|
||||
env,
|
||||
env: withOrcaClaudeChatEntrypoint(env, process.platform),
|
||||
pathToClaudeCodeExecutable: launch.pathToClaudeCodeExecutable,
|
||||
spawnClaudeCodeProcess: spawner.spawn,
|
||||
...(handlers.canUseTool ? { canUseTool: handlers.canUseTool } : {}),
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { withOrcaClaudeChatEntrypoint } from '../../../../shared/agent-launch/startup/claude-chat-entrypoint'
|
||||
import { waitForPromiseWithSignal } from '../../../../shared/abort-signal-reason'
|
||||
import {
|
||||
assertStructuredAgentResolutionCurrent,
|
||||
@@ -91,24 +92,6 @@ async function readClaudeChildEnvSources(deps: ClaudeEnvDeps): Promise<ClaudeChi
|
||||
return { ...invocation, overlay: overlay ? cloneDefinedEnv(overlay) : undefined, inheritedEnv }
|
||||
}
|
||||
|
||||
const CLAUDE_ENTRYPOINT_ENV = 'CLAUDE_CODE_ENTRYPOINT'
|
||||
|
||||
// Name Orca as the client instead of the SDK's sdk-ts default or a launching Claude's value.
|
||||
export function withOrcaClaudeEntrypoint(
|
||||
inheritedEnv: Record<string, string>,
|
||||
overlay: Record<string, string> | undefined,
|
||||
platform: NodeJS.Platform
|
||||
): Record<string, string> {
|
||||
const inherited = { ...inheritedEnv }
|
||||
stripInheritedClaudeSessionEnv(inherited, { platform })
|
||||
// The SDK reads only the exact name and otherwise adds its own default, which Windows would pick.
|
||||
return overlayEnvironmentVariables(
|
||||
{ ...inherited, [CLAUDE_ENTRYPOINT_ENV]: 'orca' },
|
||||
overlay,
|
||||
platform
|
||||
)
|
||||
}
|
||||
|
||||
// Merge onto the shell environment to retain PATH and ambient Anthropic auth.
|
||||
export function claudeChildEnv(
|
||||
sources: ClaudeChildEnvSources,
|
||||
@@ -116,13 +99,9 @@ export function claudeChildEnv(
|
||||
/** False when the session's seal pairs the CLI runtime itself, behind this app's CLI. */
|
||||
{ runtimeOnPath = true }: { runtimeOnPath?: boolean } = {}
|
||||
): Record<string, string> {
|
||||
const env = decorateEnv(
|
||||
withOrcaClaudeEntrypoint(
|
||||
withoutInheritedClaudeConfigDir(sources.inheritedEnv, process.platform),
|
||||
sources.overlay,
|
||||
process.platform
|
||||
)
|
||||
)
|
||||
const inherited = withoutInheritedClaudeConfigDir(sources.inheritedEnv, process.platform)
|
||||
stripInheritedClaudeSessionEnv(inherited)
|
||||
const env = decorateEnv(overlayEnvironmentVariables(inherited, sources.overlay, process.platform))
|
||||
return runtimeOnPath
|
||||
? withCliRuntimeOnPath(sources.command, env, { platform: process.platform })
|
||||
: env
|
||||
@@ -130,12 +109,12 @@ export function claudeChildEnv(
|
||||
|
||||
// Version probes need the launch runtime and PATH, without auth credentials.
|
||||
export function claudeProbeEnv(sources: ClaudeChildEnvSources): Record<string, string> {
|
||||
return applyClaudeEnvPatch(
|
||||
claudeChildEnv(sources),
|
||||
{},
|
||||
{
|
||||
stripAuthEnv: true,
|
||||
platform: process.platform
|
||||
}
|
||||
return withOrcaClaudeChatEntrypoint(
|
||||
applyClaudeEnvPatch(
|
||||
claudeChildEnv(sources),
|
||||
{},
|
||||
{ stripAuthEnv: true, platform: process.platform }
|
||||
),
|
||||
process.platform
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
import { ipcMain } from 'electron'
|
||||
import { getRepoDialableSshTargetId, type ExecutionHostId } from '../../../shared/execution-host'
|
||||
import {
|
||||
getRepoDialableSshTargetId,
|
||||
isRepoOnCatalogHost,
|
||||
type ExecutionHostId
|
||||
} from '../../../shared/execution-host'
|
||||
import { scopeHooksToRepoKind } from '../../../shared/folder-workspace-hooks'
|
||||
import { isFolderRepo } from '../../../shared/repo-kind'
|
||||
import { hasHooksFile, loadHooks, hasUnrecognizedOrcaYamlKeys } from '../../workspace-hooks/hooks'
|
||||
import { resolveRepoForExecutionHost } from '../worktrees/repo-host-ownership'
|
||||
@@ -23,7 +28,8 @@ export function registerWorktreeHookCheckHandler(context: WorktreeIpcContext): v
|
||||
mayNeedUpdate: false
|
||||
}
|
||||
}
|
||||
if (isFolderRepo(repo)) {
|
||||
// A folder owned by another host has no hooks here; its own host reports them.
|
||||
if (isFolderRepo(repo) && !isRepoOnCatalogHost(repo)) {
|
||||
return { status: 'ok', hasHooks: false, hooks: null, mayNeedUpdate: false }
|
||||
}
|
||||
|
||||
@@ -53,7 +59,7 @@ export function registerWorktreeHookCheckHandler(context: WorktreeIpcContext): v
|
||||
}
|
||||
|
||||
const has = hasHooksFile(repo.path)
|
||||
const hooks = has ? loadHooks(repo.path) : null
|
||||
const hooks = scopeHooksToRepoKind(repo, has ? loadHooks(repo.path) : null)
|
||||
// Well-formed unknown keys may come from a newer Orca; suggest updating instead of parse repair.
|
||||
const mayNeedUpdate = has && !hooks && hasUnrecognizedOrcaYamlKeys(repo.path)
|
||||
return {
|
||||
|
||||
@@ -7,12 +7,17 @@ import type { CreateWorktreeArgsWithSystemProvenance } from '../ipc-context-sche
|
||||
import { getFolderWorkspaceInstanceId, mergeFolderWorkspace } from '../folder-workspace-model'
|
||||
import { resolveWorktreeCreateDisplayNameRequest } from '../../worktree-display-name'
|
||||
import { hostWorktreeTargetForRepo } from '../../../persistence/host-qualified-worktree-meta'
|
||||
import {
|
||||
isPreparedFolderSetup,
|
||||
prepareFolderWorktreeSetup
|
||||
} from '../../../runtime/workspaces/creation/runtime-folder-worktree-setup'
|
||||
import { getLocalProjectWorktreeGitOptions } from '../../../workspaces/execution-host/project-runtime-git-options'
|
||||
|
||||
export function createFolderWorkspace(
|
||||
export async function createFolderWorkspace(
|
||||
args: CreateWorktreeArgsWithSystemProvenance,
|
||||
repo: Repo,
|
||||
store: Store
|
||||
): CreateWorktreeResult {
|
||||
): Promise<CreateWorktreeResult> {
|
||||
const now = Date.now()
|
||||
const instanceId = randomUUID()
|
||||
const worktreeId = getFolderWorkspaceInstanceId(repo, instanceId)
|
||||
@@ -64,5 +69,22 @@ export function createFolderWorkspace(
|
||||
? { linkedTaskSourceContext: args.linkedTaskSourceContext }
|
||||
: {})
|
||||
})
|
||||
return { worktree: mergeFolderWorkspace(repo, worktreeId, meta) }
|
||||
const worktree = mergeFolderWorkspace(repo, worktreeId, meta)
|
||||
// The window opens the Setup tab from `setup`, as for a new worktree.
|
||||
const prepared = await prepareFolderWorktreeSetup({
|
||||
// A desktop create is the user's act, as for a new worktree.
|
||||
request: { ...args, wslUserAct: true },
|
||||
repo,
|
||||
worktree,
|
||||
settings: store.getSettings(),
|
||||
runtimeTarget: () => getLocalProjectWorktreeGitOptions(store, repo),
|
||||
shouldUseSetupRunner: true
|
||||
})
|
||||
const setup = isPreparedFolderSetup(prepared) ? prepared : undefined
|
||||
return {
|
||||
worktree,
|
||||
...(setup?.setup ? { setup: setup.setup } : {}),
|
||||
...(setup?.setupTrustMismatch ? { setupTrustMismatch: setup.setupTrustMismatch } : {}),
|
||||
...(prepared?.warning ? { warning: prepared.warning } : {})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,8 +67,8 @@ export function registerWorktreeCreateHandlers(context: WorktreeIpcContext): voi
|
||||
try {
|
||||
// Track operational failures; malformed IPC rejected above is outside the creation funnel.
|
||||
if (isFolderRepo(repo)) {
|
||||
// Folder creation only registers metadata, so it needs no filesystem host route.
|
||||
result = createFolderWorkspace(createArgs, repo, store)
|
||||
// Folder creation registers metadata; its setup prep checks ownership itself.
|
||||
result = await createFolderWorkspace(createArgs, repo, store)
|
||||
} else {
|
||||
// Resolve executionHostId-only SSH ownership before any local Git operation.
|
||||
const createRoute = requireWorktreeCreateRoute(repo)
|
||||
|
||||
@@ -179,7 +179,8 @@ export async function executeWorktreeRemoval(
|
||||
canonicalWorktreePath,
|
||||
repo,
|
||||
undefined,
|
||||
localWorktreeGitOptions
|
||||
localWorktreeGitOptions,
|
||||
{ identity: { worktreeId: args.worktreeId } }
|
||||
)
|
||||
archiveHookOverride = gateWorktreeRemovalOnArchiveHook({
|
||||
worktreePath: canonicalWorktreePath,
|
||||
|
||||
@@ -13,6 +13,12 @@ import { getFolderWorkspaceRootId } from '../folder-workspace-model'
|
||||
import { preservedBranchCleanupByScope } from './preserved-branch-cleanup'
|
||||
import { removeWorktreeMetadataAndTransientState } from './worktree-removal-ownership'
|
||||
import { teardownStops } from '../../../runtime/workspaces/removal/owned-session-teardown-policy'
|
||||
import {
|
||||
gateFolderWorkspaceRemovalOnArchiveHook,
|
||||
removeFolderWorkspaceRunnerFiles
|
||||
} from '../../../workspaces/removal/folder-workspace-archive-hook'
|
||||
import { readWorktreeMetaForRepo } from '../../../persistence/host-qualified-worktree-meta'
|
||||
import { getLocalProjectWorktreeGitOptions } from '../../../workspaces/execution-host/project-runtime-git-options'
|
||||
|
||||
export async function removeFolderWorkspace(
|
||||
context: WorktreeIpcContext,
|
||||
@@ -25,6 +31,19 @@ export async function removeFolderWorkspace(
|
||||
if (args.worktreeId === getFolderWorkspaceRootId(repo)) {
|
||||
throw new Error('Cannot delete the project root workspace. Remove the folder project instead.')
|
||||
}
|
||||
// Archive failure must refuse before watcher, PTY or metadata teardown (#19334).
|
||||
const archiveHookOverride = await gateFolderWorkspaceRemovalOnArchiveHook({
|
||||
repo,
|
||||
worktreeId: args.worktreeId,
|
||||
displayName:
|
||||
(
|
||||
readWorktreeMetaForRepo(store, args.worktreeId, repo) ??
|
||||
store.getWorktreeMeta(args.worktreeId)
|
||||
)?.displayName ?? repo.displayName,
|
||||
runArchive: !args.skipArchive,
|
||||
allowFailure: args.allowFailedArchiveHook === true,
|
||||
runtimeTarget: () => getLocalProjectWorktreeGitOptions(store, repo)
|
||||
})
|
||||
const ownerHost = parseExecutionHostId(removalHostId)
|
||||
const gate = await runtime.acquireFileWatcherRemoval(
|
||||
repo.path,
|
||||
@@ -62,8 +81,9 @@ export async function removeFolderWorkspace(
|
||||
preservedBranchCleanupByScope.delete(
|
||||
preservedBranchCleanupScopeKey({ worktreeId: args.worktreeId, hostId: removalHostId })
|
||||
)
|
||||
removeFolderWorkspaceRunnerFiles(repo, args.worktreeId)
|
||||
notifyWorktreesChanged(mainWindow, repoId)
|
||||
return {}
|
||||
return archiveHookOverride ? { archiveHookOverride } : {}
|
||||
} finally {
|
||||
await gate.finish(false)
|
||||
}
|
||||
|
||||
@@ -57,6 +57,19 @@ function requestWithComments(): LinearIssueRequest {
|
||||
}
|
||||
}
|
||||
|
||||
function requestWithActivity(): LinearIssueRequest {
|
||||
return {
|
||||
include: {
|
||||
comments: false,
|
||||
children: false,
|
||||
attachments: false,
|
||||
relations: false,
|
||||
activity: true
|
||||
},
|
||||
depth: 2
|
||||
}
|
||||
}
|
||||
|
||||
function result(): LinearIssueContextResult {
|
||||
return {
|
||||
issue: resolvedIssue().issue,
|
||||
@@ -127,4 +140,41 @@ describe('Linear issue context includes', () => {
|
||||
}
|
||||
])
|
||||
})
|
||||
|
||||
it('does not treat an activity page without pageInfo as a complete history', async () => {
|
||||
plainRawRequest
|
||||
.mockResolvedValueOnce({
|
||||
data: {
|
||||
issue: {
|
||||
history: {
|
||||
nodes: [{ id: 'life-1' }, { id: 'life-2' }],
|
||||
pageInfo: { hasNextPage: true, endCursor: 'next' }
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
.mockResolvedValueOnce({
|
||||
data: { issue: { history: { nodes: [] } } }
|
||||
})
|
||||
const { readOptionalIncludes } = await import('./includes')
|
||||
const output = result()
|
||||
|
||||
await readOptionalIncludes(
|
||||
resolvedIssue(),
|
||||
requestWithActivity(),
|
||||
output,
|
||||
output.meta.includeErrors,
|
||||
output.meta.sections
|
||||
)
|
||||
|
||||
expect(output.activity).toBeUndefined()
|
||||
expect(output.meta.sections.activity).toBeUndefined()
|
||||
expect(output.meta.includeErrors).toEqual([
|
||||
expect.objectContaining({
|
||||
include: 'activity',
|
||||
code: 'linear_include_failed'
|
||||
})
|
||||
])
|
||||
expect(plainRawRequest).toHaveBeenCalledTimes(2)
|
||||
})
|
||||
})
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user