Merge main into project grouping

This commit is contained in:
Brennan Benson
2026-10-31 06:36:28 -07:00
1117 changed files with 47325 additions and 37754 deletions
-1
View File
@@ -100,7 +100,6 @@ jobs:
src/main/computer/macos-computer-use-permissions.test.ts
src/main/computer/macos-computer-use-permission-status.test.ts
src/main/providers/windows-shell-preflight-runtime.windows.test.ts
src/main/computer/desktop-script-provider-client.test.ts
src/main/computer/desktop-script-provider-cache.test.ts
src/main/computer/desktop-script-provider-actions.test.ts
src/main/computer/desktop-script-provider-cache-lifecycle.test.ts
-58
View File
@@ -31,10 +31,6 @@ on:
description: Runner override for GitHub-hosted signing provenance.
type: string
default: ubuntu-24.04
secrets:
SLACK_WEBHOOK_URL:
description: Existing orca-releases incoming webhook
required: false
workflow_dispatch:
permissions:
@@ -52,8 +48,6 @@ jobs:
if: github.event_name != 'pull_request' || github.event.pull_request.draft != true
runs-on: ${{ inputs.runner || 'ubuntu-24.04' }}
timeout-minutes: 15
outputs:
audit_result: ${{ steps.audit.outcome }}
steps:
- uses: actions/checkout@v6
with:
@@ -87,8 +81,6 @@ jobs:
if: github.event_name != 'pull_request' || github.event.pull_request.draft != true
runs-on: ${{ inputs.runner || 'ubuntu-24.04' }}
timeout-minutes: 20
outputs:
audit_result: ${{ steps.audit.outcome }}
steps:
- uses: actions/checkout@v6
with:
@@ -126,53 +118,3 @@ jobs:
name: dependency-security-rust
path: tmp/dependency-security/*.log
if-no-files-found: error
notify:
needs: [javascript, rust]
if: >-
!cancelled() && github.repository == 'stablyai/orca' &&
(needs.javascript.outputs.audit_result == 'failure' ||
needs.rust.outputs.audit_result == 'failure' ||
needs.javascript.result == 'failure' || needs.rust.result == 'failure')
runs-on: ${{ inputs.runner || 'ubuntu-24.04' }}
timeout-minutes: 5
steps:
- name: Send dependency review to orca-releases
uses: actions/github-script@v8
continue-on-error: true
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
RELEASE_REF: ${{ inputs.ref }}
AUDIT_RESULTS: ${{ toJSON(needs) }}
with:
script: |
if (!process.env.SLACK_WEBHOOK_URL) {
core.notice('Slack notification unavailable for this run; see the dependency reports in Actions.')
return
}
const results = JSON.parse(process.env.AUDIT_RESULTS)
const checks = [['javascript', 'JavaScript'], ['rust', 'Rust']].map(([job, label]) => {
const result = results[job]
const status = result.result !== 'success' ? 'scan incomplete'
: result.outputs.audit_result === 'success' ? 'passed' : 'review suggested'
return `${label}: ${status}`
})
const target = context.payload.pull_request
? `PR #${context.payload.pull_request.number}`
: process.env.RELEASE_REF || context.ref
const runUrl = `${process.env.GITHUB_SERVER_URL}/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}`
const text = `Orca dependency review for ${target}\n${checks.join(' · ')}\nReports and logs: ${runUrl}`
let response
try {
response = await fetch(process.env.SLACK_WEBHOOK_URL, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ text, mrkdwn: false, unfurl_links: false, unfurl_media: false }),
signal: AbortSignal.timeout(15000)
})
} catch {
throw new Error('Slack dependency review notification could not be sent')
}
if (!response.ok) {
throw new Error(`Slack dependency review notification returned HTTP ${response.status}`)
}
+1
View File
@@ -83,6 +83,7 @@ jobs:
/config/scripts/pr-e2e-source-routing.mjs
/config/scripts/pr-browser-e2e-source-routes.mjs
/config/scripts/pr-editor-preview-e2e-source-routes.mjs
/config/scripts/pr-feature-area-e2e-source-routes.mjs
/config/scripts/pr-plugin-e2e-source-routes.mjs
/config/scripts/pr-wsl-e2e-source-routes.mjs
/config/scripts/ci-e2e-job-selection.mjs
-2
View File
@@ -697,8 +697,6 @@ jobs:
with:
ref: refs/tags/${{ needs.cut.outputs.tag }}
runner: ubuntu-latest
secrets:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
terminal-rendering-golden:
needs: cut
+1 -1
View File
@@ -58,7 +58,7 @@ import {
} from './cell-admission-migration-registration.js'
import {
ASSIGNMENT_CONNECTION_HEADROOM_QUERY
} from './assignment-connection-headroom-query.js'
} from './assignment/assignment-connection-headroom-query.js'
import {
CONNECTION_CAP_COLUMNS_SQL,
EFFECTIVE_HARD_CAP_SQL,
@@ -1,11 +1,11 @@
import pg from 'pg'
import { afterAll, beforeAll, describe, expect, it } from 'vitest'
import { ASSIGNMENT_CONNECTION_HEADROOM_QUERY } from './assignment-connection-headroom-query.js'
import { RelayAssignmentStore } from './assignment-store.js'
import { RelayAssignmentStore } from '../assignment-store.js'
import {
openRelayDatabase,
type RelayDatabase
} from './database.js'
} from '../database.js'
const databaseUrl = process.env.ORCA_RELAY_TEST_POSTGRES_URL
const describePostgres = databaseUrl ? describe : describe.skip
@@ -1,4 +1,4 @@
import { EFFECTIVE_HARD_CAP_SQL } from './cell-connection-cap.js'
import { EFFECTIVE_HARD_CAP_SQL } from '../cell-connection-cap.js'
export const ASSIGNMENT_CONNECTION_HEADROOM_QUERY =
`SELECT limits.cell_id, ${EFFECTIVE_HARD_CAP_SQL} AS effective_hard_cap, limits.unobserved_bound,
@@ -1,11 +1,11 @@
import { ASSIGNMENT_LIMITS } from '@orca-cloud/relay-contract'
import { ASSIGNMENT_LIMITS } from '@orca-cloud/relay-contract/assignment-invariants'
import { afterEach, describe, expect, it } from 'vitest'
import { RelayAssignmentStore } from './assignment-store.js'
import type { RelayCellConfig } from './config.js'
import { RelayAssignmentStore } from '../assignment-store.js'
import type { RelayCellConfig } from '../config.js'
import {
openInMemoryRelayDatabase,
type RelayDatabase
} from './database.js'
} from '../database.js'
const LIMITED_CELL: RelayCellConfig = {
id: 'limited',
@@ -1,6 +1,6 @@
import { afterAll, beforeAll, describe, expect, it } from 'vitest'
import { RelayAssignmentStore } from './assignment-store.js'
import { openRelayDatabase, type RelayDatabase } from './database.js'
import { RelayAssignmentStore } from '../assignment-store.js'
import { openRelayDatabase, type RelayDatabase } from '../database.js'
const databaseUrl = process.env.ORCA_RELAY_TEST_POSTGRES_URL
const describePostgres = databaseUrl ? describe : describe.skip
@@ -1,6 +1,6 @@
import { afterEach, describe, expect, it } from 'vitest'
import { RelayAssignmentStore } from './assignment-store.js'
import { openInMemoryRelayDatabase, type RelayDatabase } from './database.js'
import { RelayAssignmentStore } from '../assignment-store.js'
import { openInMemoryRelayDatabase, type RelayDatabase } from '../database.js'
const NOW = 100_000
const CELL_COUNT = 32
@@ -1,6 +1,6 @@
import { afterAll, beforeAll, describe, expect, it } from 'vitest'
import { RelayAssignmentStore } from './assignment-store.js'
import { openRelayDatabase, type RelayDatabase } from './database.js'
import { RelayAssignmentStore } from '../assignment-store.js'
import { openRelayDatabase, type RelayDatabase } from '../database.js'
const databaseUrl = process.env.ORCA_RELAY_TEST_POSTGRES_URL
const describePostgres = databaseUrl ? describe : describe.skip
@@ -1,7 +1,7 @@
import { describe, expect, it } from 'vitest'
import { RelayAssignmentStore } from './assignment-store.js'
import type { RelayDatabase, RelayLockOptions, SqlRow } from './database.js'
import { openInMemoryRelayDatabase } from './database.js'
import { RelayAssignmentStore } from '../assignment-store.js'
import type { RelayDatabase, RelayLockOptions, SqlRow } from '../database.js'
import { openInMemoryRelayDatabase } from '../database.js'
const identity = { userId: 'user-a', relayHostId: 'host000000000001' }
const activityId = 'splice:connection-1'
@@ -1,5 +1,5 @@
import { afterAll, beforeAll, describe, expect, it } from 'vitest'
import { ASSIGNMENT_CONNECTION_HEADROOM_QUERY } from './assignment-connection-headroom-query.js'
import { ASSIGNMENT_CONNECTION_HEADROOM_QUERY } from './assignment/assignment-connection-headroom-query.js'
import { RelayAssignmentStore } from './assignment-store.js'
import type { RelayCellConfig } from './config.js'
import { openRelayDatabase, type RelayDatabase } from './database.js'
+3 -3
View File
@@ -1,4 +1,4 @@
import { readdirSync, readFileSync } from 'node:fs'
import { globSync, readFileSync } from 'node:fs'
import { join } from 'node:path'
import { fileURLToPath } from 'node:url'
import { defaultExclude, defineConfig } from 'vitest/config'
@@ -6,8 +6,8 @@ import { defaultExclude, defineConfig } from 'vitest/config'
// PostgreSQL files share session locks and a small connection budget.
// The runner overlaps this serialized project with SQLite tests after other packages finish.
const sourceDirectory = fileURLToPath(new URL('src', import.meta.url))
const sharedPostgresTests = readdirSync(sourceDirectory)
.filter((entry) => entry.endsWith('.test.ts'))
const sharedPostgresTests = globSync('**/*.test.ts', { cwd: sourceDirectory })
.map((entry) => entry.replaceAll('\\', '/'))
.filter((entry) =>
readFileSync(join(sourceDirectory, entry), 'utf8').includes('ORCA_RELAY_TEST_POSTGRES_URL')
)
@@ -19,5 +19,16 @@
"@types/node": "^24.19.2",
"typescript": "^7.0.2",
"vitest": "^5.0.5"
},
"exports": {
".": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
},
"./assignment-invariants": {
"types": "./dist/assignment-invariants.d.ts",
"default": "./dist/assignment-invariants.js"
},
"./package.json": "./package.json"
}
}
+6 -19
View File
@@ -12,7 +12,6 @@
1 test-no-in-test-import-actual:src/main/claude/claude-agent-sdk-process-spawn.test.ts
3 test-no-in-test-import-actual:src/main/codex-accounts/runtime-home-read-only-launch-resolution.test.ts
1 test-no-in-test-import-actual:src/main/codex-accounts/runtime-home-wsl-system-default.test.ts
2 test-no-in-test-import-actual:src/main/codex-accounts/service-managed-home-removal-retries.test.ts
1 test-no-in-test-import-actual:src/main/codex-usage/scanner-file-identity.test.ts
1 test-no-in-test-import-actual:src/main/codex/config-toml-hook-trust-scaling.test.ts
8 test-no-in-test-import-actual:src/main/daemon/daemon-endpoint-publish.test.ts
@@ -43,7 +42,7 @@
1 test-no-in-test-import-actual:src/main/runtime/orca-runtime-files-terminal-artifact-swap-detection.test.ts
1 test-no-in-test-import-actual:src/main/runtime/structured-agent-cli-writers.test.ts
1 test-no-in-test-import-actual:src/main/speech/openai-api-key-store.test.ts
6 test-no-in-test-import-actual:src/main/ssh/config/ssh-config-loader-regression.test.ts
5 test-no-in-test-import-actual:src/main/ssh/config/ssh-config-loader-regression.test.ts
2 test-no-in-test-import-actual:src/main/ssh/connection/ssh-connection-auth-fallback.test.ts
1 test-no-in-test-import-actual:src/main/ssh/orcad-snapshot-room.test.ts
2 test-no-in-test-import-actual:src/main/window/dropped-path-preparation.test.ts
@@ -94,7 +93,7 @@
1 test-no-polling-loop:src/main/daemon/daemon-stream-backpressure-socket.test.ts
1 test-no-polling-loop:src/main/daemon/headless-emulator-snapshot-cost.bench.test.ts
1 test-no-polling-loop:src/main/daemon/node-pty-conout-worker-errors.test.ts
2 test-no-polling-loop:src/main/daemon/repro-12101-mouse-tracking-survives-agent-death.test.ts
1 test-no-polling-loop:src/main/daemon/repro-12101-mouse-tracking-survives-agent-death.test.ts
2 test-no-polling-loop:src/main/git/repo-ref-maintenance-real-git.test.ts
1 test-no-polling-loop:src/main/git/worktree-removal-large-tree.bench.test.ts
1 test-no-polling-loop:src/main/ipc/folder-repo-git-upgrade.test.ts
@@ -313,7 +312,7 @@
4 test-no-real-time-wait:src/main/daemon/node-pty-windows-input-error.win32.test.ts
1 test-no-real-time-wait:src/main/daemon/node-pty-windows-output-error.win32.test.ts
11 test-no-real-time-wait:src/main/daemon/reattach-snapshot.test.ts
2 test-no-real-time-wait:src/main/daemon/repro-12101-mouse-tracking-survives-agent-death.test.ts
1 test-no-real-time-wait:src/main/daemon/repro-12101-mouse-tracking-survives-agent-death.test.ts
6 test-no-real-time-wait:src/main/daemon/repro-13767-shell-ready-marker-lost-to-exec.test.ts
4 test-no-real-time-wait:src/main/daemon/session-shell-recovery.test.ts
1 test-no-real-time-wait:src/main/daemon/session.test.ts
@@ -370,7 +369,6 @@
2 test-no-real-time-wait:src/main/native-chat/agent-session-wire/structured-agent-session-claude-subagent-row.test.ts
1 test-no-real-time-wait:src/main/native-chat/agent-session-wire/structured-agent-session-owed-work-release.test.ts
3 test-no-real-time-wait:src/main/native-chat/agent-session-wire/structured-agent-session-queued-command.test.ts
1 test-no-real-time-wait:src/main/native-chat/agent-session-wire/structured-agent-session-queued-legacy-import.test.ts
1 test-no-real-time-wait:src/main/native-chat/agent-session-wire/structured-agent-session-queued-quit.test.ts
1 test-no-real-time-wait:src/main/native-chat/agent-session-wire/structured-agent-session-queued-refused-card.test.ts
1 test-no-real-time-wait:src/main/native-chat/agent-session-wire/structured-agent-session-restart-cap.test.ts
@@ -381,7 +379,7 @@
1 test-no-real-time-wait:src/main/native-chat/agent-session-wire/structured-agent-session-stop-aborts-start.test.ts
1 test-no-real-time-wait:src/main/native-chat/agent-session-wire/structured-agent-session-target-reconcile.test.ts
1 test-no-real-time-wait:src/main/native-chat/transcript-opencode2-sqlite.test.ts
2 test-no-real-time-wait:src/main/native-chat/transcript-watch-error.test.ts
1 test-no-real-time-wait:src/main/native-chat/transcript-watch-error.test.ts
2 test-no-real-time-wait:src/main/native-chat/transcript-watch-liveness.test.ts
11 test-no-real-time-wait:src/main/native-chat/transcript-watch.test.ts
1 test-no-real-time-wait:src/main/node-runtime/managed-runtime-installation.test.ts
@@ -420,7 +418,6 @@
1 test-no-real-time-wait:src/main/runtime/restored-pane-start-cli-handles.test.ts
1 test-no-real-time-wait:src/main/runtime/rpc/methods/agent-launch-instant-tab.test.ts
2 test-no-real-time-wait:src/main/runtime/rpc/methods/agent-launch-restart-replay.test.ts
1 test-no-real-time-wait:src/main/runtime/rpc/methods/structured-agent-session-at-rest.test.ts
1 test-no-real-time-wait:src/main/runtime/rpc/terminal-multiplex-ack-output-budget.test.ts
1 test-no-real-time-wait:src/main/runtime/rpc/terminal-multiplex-input-sequence-replay.test.ts
2 test-no-real-time-wait:src/main/runtime/rpc/terminal-multiplex-source-range-request.test.ts
@@ -458,7 +455,6 @@
2 test-no-real-time-wait:src/main/ssh/sftp-upload.test.ts
1 test-no-real-time-wait:src/main/ssh/ssh-credential-prompt-login-grace-wire.test.ts
2 test-no-real-time-wait:src/main/ssh/ssh-quit-abort-upload.test.ts
1 test-no-real-time-wait:src/main/startup/codex-hook-startup-wiring.test.ts
2 test-no-real-time-wait:src/main/startup/gpu-lifecycle-install-dir-acl-guard.test.ts
1 test-no-real-time-wait:src/main/startup/main-process-ready-duplicate-pty-repair.test.ts
3 test-no-real-time-wait:src/main/startup/run-electron-vite-dev-web.test.ts
@@ -960,7 +956,7 @@
2 test-no-wall-clock:src/main/rate-limits/service-cursor-usage.test.ts
12 test-no-wall-clock:src/main/rate-limits/service-minimax-usage.test.ts
38 test-no-wall-clock:src/main/rate-limits/service-refresh-orchestration.test.ts
6 test-no-wall-clock:src/main/rate-limits/service-zcode-usage.test.ts
4 test-no-wall-clock:src/main/rate-limits/service-zcode-usage.test.ts
1 test-no-wall-clock:src/main/runtime/agent-session/ownership/agent-session-process-identity-probe.test.ts
1 test-no-wall-clock:src/main/runtime/agent-state-rules/agent-state-rules-engine.test.ts
1 test-no-wall-clock:src/main/runtime/antigravity-readiness-transcripts.test.ts
@@ -1106,12 +1102,9 @@
4 test-no-wall-clock:src/renderer/src/components/sidebar/WorktreeCard.compact-hover.test.tsx
13 test-no-wall-clock:src/renderer/src/components/sidebar/WorktreeCard.pr-display.test.tsx
2 test-no-wall-clock:src/renderer/src/components/sidebar/WorktreeCard.single-reference-details.test.tsx
3 test-no-wall-clock:src/renderer/src/components/sidebar/WorktreeCardAgents.send-target.test.tsx
1 test-no-wall-clock:src/renderer/src/components/sidebar/WorktreeList.lineage-agent-expansion-coupling.test.tsx
1 test-no-wall-clock:src/renderer/src/components/sidebar/WorktreeList.lineage-child-real-card.test.tsx
5 test-no-wall-clock:src/renderer/src/components/sidebar/use-workspace-reference-details.test.tsx
3 test-no-wall-clock:src/renderer/src/components/sidebar/worktree-agent-rows-subscriptions.bench.test.tsx
1 test-no-wall-clock:src/renderer/src/components/status-bar/RuntimeHostStatusRow.test.tsx
5 test-no-wall-clock:src/renderer/src/components/status-bar/inline-usage-bars.test.tsx
4 test-no-wall-clock:src/renderer/src/components/status-bar/provider-segment-balance.test.tsx
2 test-no-wall-clock:src/renderer/src/components/status-bar/status-bar-antigravity-segment.test.tsx
@@ -1127,13 +1120,10 @@
2 test-no-wall-clock:src/renderer/src/components/terminal-pane/remote-snapshot-alt-screen-host-chain.test.ts
3 test-no-wall-clock:src/renderer/src/components/terminal-pane/terminal-hidden-view-parking.test.ts
1 test-no-wall-clock:src/renderer/src/components/terminal-pane/terminal-link-worktree-root-activation.test.ts
1 test-no-wall-clock:src/renderer/src/components/terminal-pane/terminal-pane-store-subscription-budget.test.tsx
1 test-no-wall-clock:src/renderer/src/components/terminal-pane/terminal-parked-tab-watchers.test.ts
2 test-no-wall-clock:src/renderer/src/components/terminal-workspace-surface-ids.test.tsx
1 test-no-wall-clock:src/renderer/src/components/terminal/initial-terminal-structured-launch.test.tsx
2 test-no-wall-clock:src/renderer/src/components/workspace-cleanup/use-workspace-cleanup-removal.agent-stop.test.tsx
6 test-no-wall-clock:src/renderer/src/components/workspace-cleanup/workspace-cleanup-confirm-remove.test.tsx
2 test-no-wall-clock:src/renderer/src/components/worktree-creation/WorktreeCreationPanel.test.tsx
2 test-no-wall-clock:src/renderer/src/hooks/ipc-events/agent-status-terminal-title-tab-write.test.ts
3 test-no-wall-clock:src/renderer/src/hooks/useAutomationDispatchEvents.test.ts
1 test-no-wall-clock:src/renderer/src/hooks/useIpcEvents-agent-status-hook-titles.test.ts
@@ -1304,7 +1294,7 @@
4 test-timeout-needs-reason:src/main/managed-server/lifecycle/orcad-managed-tunnel-transport-real-openssh.test.ts
3 test-timeout-needs-reason:src/main/native-chat/agent-model-catalog/agent-model-catalog-probe-runner.test.ts
5 test-timeout-needs-reason:src/main/native-chat/agent-session-wire/structured-agent-session-claude-queued-stop.test.ts
3 test-timeout-needs-reason:src/main/native-chat/agent-session-wire/structured-agent-session-claude-stop-ends-session.test.ts
2 test-timeout-needs-reason:src/main/native-chat/agent-session-wire/structured-agent-session-claude-stop-ends-session.test.ts
1 test-timeout-needs-reason:src/main/native-chat/agent-session-wire/structured-agent-session-claude-stop-turn-end.test.ts
1 test-timeout-needs-reason:src/main/native-chat/agent-session-wire/structured-agent-session-interrupted-continuation.test.ts
1 test-timeout-needs-reason:src/main/native-chat/agent-session-wire/structured-agent-session-status-feed-children.test.ts
@@ -1369,10 +1359,7 @@
4 test-timeout-needs-reason:src/packages/process-host/src/run-process.test.ts
5 test-timeout-needs-reason:src/renderer/src/components/sidebar/WorktreeCard.compact-hover.test.tsx
2 test-timeout-needs-reason:src/renderer/src/components/sidebar/WorktreeCard.host-badge-toggle.test.tsx
2 test-timeout-needs-reason:src/renderer/src/components/sidebar/WorktreeCard.lineage.test.tsx
4 test-timeout-needs-reason:src/renderer/src/components/sidebar/WorktreeCard.pinned-repo-icon.test.tsx
7 test-timeout-needs-reason:src/renderer/src/components/sidebar/WorktreeCard.pr-display.test.tsx
1 test-timeout-needs-reason:src/renderer/src/components/sidebar/WorktreeCardAgents.send-target.test.tsx
1 test-timeout-needs-reason:src/renderer/src/components/sidebar/WorktreeCardAgents.test.tsx
1 test-timeout-needs-reason:src/renderer/src/components/tab-bar/BrowserTab.test.tsx
1 test-timeout-needs-reason:src/renderer/src/components/tab-bar/TabBar.windows-shell-launch.test.ts
+24 -5
View File
@@ -61,33 +61,52 @@
Pop $0
nsExec::Exec 'taskkill /F /IM "orca-terminal-daemon.exe" $2'
Pop $0
; WSL hosts: the detached wsl.exe holders outlive the app and keep their distros running. Orca
; WSL hosts: the detached wsl.exe holders and each host's server keep their distros running. Orca
; ends only the holders its profile recorded, each checked by pid, start time and command line.
; Only a userData that has a holder folder launches it: everyone who never ran a WSL host sees
; nothing here. These are the folders Electron's userData (app.getName()) can be, as the
; The last install for this user also stops each recorded host's server in a running distro: the
; HKCU/HKLM twin shares this userData, its host records and those servers, so it keeps them.
; Only a userData with a holder folder or WSL host records launches it: everyone who never ran a
; WSL host sees nothing here. These are the folders Electron's userData (app.getName()) can be, as the
; deleteAppData step lists them; a custom --user-data-dir can't be known here.
; Sync the flag with WSL_HOLDER_UNINSTALL_FLAG in src/main/startup/wsl-holder-uninstall-preflight.ts.
; Sync the flags with WSL_HOLDER_UNINSTALL_FLAG and WSL_SERVER_UNINSTALL_FLAG in
; src/main/startup/wsl-holder-uninstall-preflight.ts.
${if} $installMode == "all"
SetShellVarContext current
${endIf}
StrCpy $1 ""
StrCpy $2 ""
${if} ${FileExists} "$APPDATA\${APP_FILENAME}\wsl-distro-holders\*.json"
StrCpy $1 "1"
${endIf}
${if} ${FileExists} "$APPDATA\${APP_FILENAME}\orca-wsl-host-deployments.json"
StrCpy $2 "1"
${endIf}
!ifdef APP_PRODUCT_FILENAME
${if} ${FileExists} "$APPDATA\${APP_PRODUCT_FILENAME}\wsl-distro-holders\*.json"
StrCpy $1 "1"
${endIf}
${if} ${FileExists} "$APPDATA\${APP_PRODUCT_FILENAME}\orca-wsl-host-deployments.json"
StrCpy $2 "1"
${endIf}
!endif
!ifdef APP_PACKAGE_NAME
${if} ${FileExists} "$APPDATA\${APP_PACKAGE_NAME}\wsl-distro-holders\*.json"
StrCpy $1 "1"
${endIf}
${if} ${FileExists} "$APPDATA\${APP_PACKAGE_NAME}\orca-wsl-host-deployments.json"
StrCpy $2 "1"
${endIf}
!endif
${if} $installMode == "all"
SetShellVarContext all
${endIf}
${if} $1 == "1"
${if} $2 == "1"
!insertmacro ORCA_OTHER_INSTALL_STATE $2
${endIf}
${if} $2 == "none"
nsExec::Exec '"$INSTDIR\${APP_EXECUTABLE_FILENAME}" --orca-uninstall-release-wsl-holders --orca-uninstall-stop-wsl-servers'
Pop $0
${elseIf} $1 == "1"
nsExec::Exec '"$INSTDIR\${APP_EXECUTABLE_FILENAME}" --orca-uninstall-release-wsl-holders'
Pop $0
${endIf}
+8 -13
View File
@@ -10811,7 +10811,7 @@
"providers": ["local", "remote-runtime", "ssh", "wsl"],
"coveredPlatforms": ["macos"],
"coveredProviders": ["local", "remote-runtime", "ssh", "wsl"],
"coverageNotes": "Platform-neutral deterministic tests separate the durable Active Server preference from per-client connection, selected-workspace, browser-session, Add Project, and execution-host routing. The composed regression models Local desktop -> connect/navigate Windows 2 -> reveal a local terminal -> restart. Multi-client browser host overrides, multi-server profile caches, generic settings IPC rejection, local and remote workspace ownership, Add Project eligibility/owner capture/stale-result fencing, host-qualified group/folder/worktree identity, and restart reset of transient routing are covered. A visible macOS Orca desktop server plus separate paired Electron and web clients prove selected-runtime Add Project operations and disabled creation when the only listed host is blocked or unavailable; headless-server parity also passed. Live Linux, Windows, WSL, and SSH Add Project journeys remain uncollected.",
"coverageNotes": "Platform-neutral deterministic tests separate the durable Active Server preference from per-client connection, selected-workspace, browser-session, Add Project, and execution-host routing. The composed regression models Local desktop -> connect/navigate Windows 2 -> reveal a local terminal -> restart. Multi-client browser host overrides, multi-server profile caches, generic settings IPC rejection, local and remote workspace ownership, Add Project eligibility/owner capture/stale-result fencing, host-qualified group/folder/worktree identity, and restart reset of transient routing are covered. A visible macOS Orca desktop server plus separate paired Electron and web clients prove selected-runtime Add Project operations and disabled creation when the only listed host is blocked or unavailable; headless-server parity also passed. Live Linux, Windows, WSL, and SSH Add Project journeys remain uncollected. The static wrapper-rendering suite was removed during the low-value-test audit; its supplied-prop host-browser and control-visibility output assertions are no longer checked by that suite. This removal supplies no new runtime-routing evidence.",
"motivatingLinks": [
"https://github.com/stablyai/orca/pull/9687",
"https://linear.app/stably/issue/STA-4024/p1-paired-web-add-project-enables-unavailable-host-fallback-after-pr"
@@ -10821,7 +10821,7 @@
"commands": [
"pnpm exec vitest run --config config/vitest.config.ts src/main/ipc/settings.test.ts src/main/ipc/runtime-environments/runtime-environments-pairing.test.ts src/renderer/src/store/slices/settings.test.ts src/renderer/src/store/slices/browser.test.ts src/renderer/src/components/settings/browser-session-host-selection.test.ts src/renderer/src/components/settings/RuntimeEnvironmentsPane.test.ts src/renderer/src/components/sidebar/use-add-repo-host-selection.test.ts src/renderer/src/hooks/useIpcEvents-terminal-create-surfacing.test.ts src/renderer/src/web/web-preload-api-runtime-environment.test.ts --maxWorkers=1",
"pnpm exec vitest run --config config/vitest.config.ts src/renderer/src/components/sidebar/AddProjectFromFolderDialog.test.tsx src/renderer/src/components/sidebar/NonGitFolderDialog.test.tsx src/renderer/src/components/sidebar/AddRepoDialog.default-checkout.test.ts src/renderer/src/components/sidebar/AddRepoSteps.default-checkout.test.ts src/renderer/src/components/sidebar/project-added-default-checkout.test.ts src/renderer/src/components/sidebar/useAddRepoLocalFolderFlow.test.ts src/renderer/src/components/sidebar/useAddRepoNestedImportFlow.test.ts src/renderer/src/components/sidebar/useAddRepoServerPathFlow.test.ts src/renderer/src/components/sidebar/useAddRepoCloneFlow.test.ts src/renderer/src/components/sidebar/useCreateRepo.default-checkout.test.ts src/renderer/src/components/sidebar/worktree-list/listing/host-filtering.test.ts src/renderer/src/lib/resolved-worktree-execution-host.test.ts src/renderer/src/lib/worktree-runtime-owner.test.ts src/renderer/src/store/selectors.test.ts src/renderer/src/store/slices/repos-catalog-reconciliation.test.ts src/renderer/src/store/slices/repos-project-groups.test.ts src/renderer/src/store/slices/repos-selected-owner-routing.test.ts src/renderer/src/store/slices/selected-host-active-workspace-identity.test.ts src/renderer/src/store/slices/worktrees-fetch-owner-routing.test.ts --maxWorkers=1",
"pnpm exec vitest run --config config/vitest.config.ts src/renderer/src/components/sidebar/use-add-repo-host-selection.test.ts src/renderer/src/components/sidebar/add-repo-browse-authority.test.ts src/renderer/src/components/sidebar/AddRepoDialogStepContent.test.tsx src/renderer/src/components/sidebar/AddRepoStartSteps.test.tsx src/renderer/src/components/sidebar/useAddRepoServerPathFlow.test.ts src/renderer/src/store/slices/repos-paired-runtime-add.test.ts --maxWorkers=1",
"pnpm exec vitest run --config config/vitest.config.ts src/renderer/src/components/sidebar/use-add-repo-host-selection.test.ts src/renderer/src/components/sidebar/add-repo-browse-authority.test.ts src/renderer/src/components/sidebar/AddRepoStartSteps.test.tsx src/renderer/src/components/sidebar/useAddRepoServerPathFlow.test.ts src/renderer/src/store/slices/repos-paired-runtime-add.test.ts --maxWorkers=1",
"pnpm exec vitest run --config config/vitest.config.ts src/renderer/src/components/sidebar/AddProjectFromFolderDialog.test.tsx src/renderer/src/components/sidebar/NonGitFolderDialog.test.tsx src/renderer/src/components/sidebar/AddRepoDialog.default-checkout.test.ts src/renderer/src/components/sidebar/AddRepoSteps.default-checkout.test.ts src/renderer/src/components/sidebar/project-added-default-checkout.test.ts src/renderer/src/components/sidebar/useAddRepoLocalFolderFlow.test.ts src/renderer/src/components/sidebar/useAddRepoNestedImportFlow.test.ts src/renderer/src/components/sidebar/useAddRepoServerPathFlow.test.ts src/renderer/src/components/sidebar/useAddRepoCloneFlow.test.ts src/renderer/src/components/sidebar/useCreateRepo.default-checkout.test.ts src/renderer/src/components/sidebar/worktree-list/listing/host-filtering.test.ts src/renderer/src/lib/resolved-worktree-execution-host.test.ts src/renderer/src/lib/worktree-runtime-owner.test.ts src/renderer/src/store/selectors.test.ts src/renderer/src/store/slices/repos-catalog-reconciliation.test.ts src/renderer/src/store/slices/repos-project-groups.test.ts src/renderer/src/store/slices/repos-selected-owner-routing.test.ts src/renderer/src/store/slices/selected-host-active-workspace-identity.test.ts src/renderer/src/store/slices/worktrees-fetch-owner-routing.test.ts src/renderer/src/runtime/web-runtime-session.test.ts --maxWorkers=1",
"pnpm run ensure:electron-runtime && npx playwright test tests/e2e/pr11346-selected-runtime-add.spec.ts --config tests/playwright.config.ts --project electron-headful --workers=1 --reporter=line",
"pnpm run ensure:electron-runtime && npx playwright test tests/e2e/pr11346-selected-runtime-add.spec.ts --config tests/playwright.config.ts --project electron-headless --workers=1 --reporter=line",
@@ -10842,7 +10842,6 @@
"src/renderer/src/components/sidebar/AddProjectFromFolderDialog.test.tsx",
"src/renderer/src/components/sidebar/NonGitFolderDialog.test.tsx",
"src/renderer/src/components/sidebar/AddRepoDialog.default-checkout.test.ts",
"src/renderer/src/components/sidebar/AddRepoDialogStepContent.test.tsx",
"src/renderer/src/components/sidebar/AddRepoStartSteps.test.tsx",
"src/renderer/src/components/sidebar/AddRepoSteps.default-checkout.test.ts",
"src/renderer/src/components/sidebar/project-added-default-checkout.test.ts",
@@ -10879,10 +10878,6 @@
"paired runtime browsing opens the host browser without invoking native pickFolders while desktop local and SSH routes remain intact"
]
},
{
"file": "src/renderer/src/components/sidebar/AddRepoDialogStepContent.test.tsx",
"assertions": ["paired runtime browsing renders the in-app host filesystem browser"]
},
{
"file": "src/renderer/src/components/sidebar/AddRepoStartSteps.test.tsx",
"assertions": [
@@ -20737,20 +20732,20 @@
"invariant": "A single-cell capacity check reads only that cell while retaining snapshot freshness, incarnation, outstanding reservation and missing-limit policy; new placement retains the full fleet inventory.",
"oracle": "With 32 capped cells, an existing active host stays on its pinned cell and reads one headroom row; new placement reads all 32. Missing, expired or prior-incarnation snapshots, capacity exhaustion and outstanding debt still refuse the active pinned host; an uncapped cell remains admissible.",
"commands": [
"ORCA_BACKGROUND_LAUNCH=1 pnpm --dir cloud/apps/relay exec vitest run ../../../cloud/apps/relay/src/assignment-headroom-scope.test.ts ../../../cloud/apps/relay/src/assignment-connection-headroom.test.ts ../../../cloud/apps/relay/src/assignment-store.test.ts ../../../cloud/apps/relay/src/assignment-store-lock-order.test.ts ../../../cloud/apps/relay/src/cell-inventory-lock-contention.test.ts ../../../cloud/apps/relay/src/assignment-isolated-cell-replacement.test.ts ../../../cloud/apps/relay/src/regional-rehome-target-selection.test.ts --silent=false"
"ORCA_BACKGROUND_LAUNCH=1 pnpm --dir cloud/apps/relay exec vitest run ../../../cloud/apps/relay/src/assignment/assignment-headroom-scope.test.ts ../../../cloud/apps/relay/src/assignment/assignment-connection-headroom.test.ts ../../../cloud/apps/relay/src/assignment-store.test.ts ../../../cloud/apps/relay/src/assignment/assignment-store-lock-order.test.ts ../../../cloud/apps/relay/src/cell-inventory-lock-contention.test.ts ../../../cloud/apps/relay/src/assignment-isolated-cell-replacement.test.ts ../../../cloud/apps/relay/src/regional-rehome-target-selection.test.ts --silent=false"
],
"testFiles": [
"cloud/apps/relay/src/assignment-headroom-scope.test.ts",
"cloud/apps/relay/src/assignment-connection-headroom.test.ts",
"cloud/apps/relay/src/assignment/assignment-headroom-scope.test.ts",
"cloud/apps/relay/src/assignment/assignment-connection-headroom.test.ts",
"cloud/apps/relay/src/assignment-store.test.ts",
"cloud/apps/relay/src/assignment-store-lock-order.test.ts",
"cloud/apps/relay/src/assignment/assignment-store-lock-order.test.ts",
"cloud/apps/relay/src/cell-inventory-lock-contention.test.ts",
"cloud/apps/relay/src/assignment-isolated-cell-replacement.test.ts",
"cloud/apps/relay/src/regional-rehome-target-selection.test.ts"
],
"assertionRefs": [
{
"file": "cloud/apps/relay/src/assignment-headroom-scope.test.ts",
"file": "cloud/apps/relay/src/assignment/assignment-headroom-scope.test.ts",
"assertions": [
"reads one cell for a sticky assignment even when the capped fleet grows",
"still considers the full fleet for a new placement",
@@ -20765,7 +20760,7 @@
"date": "2026-09-25",
"runner": "local",
"platform": "macos",
"command": "ORCA_BACKGROUND_LAUNCH=1 pnpm --dir cloud/apps/relay exec vitest run ../../../cloud/apps/relay/src/assignment-headroom-scope.test.ts ../../../cloud/apps/relay/src/assignment-connection-headroom.test.ts ../../../cloud/apps/relay/src/assignment-store.test.ts ../../../cloud/apps/relay/src/assignment-store-lock-order.test.ts ../../../cloud/apps/relay/src/cell-inventory-lock-contention.test.ts ../../../cloud/apps/relay/src/assignment-isolated-cell-replacement.test.ts ../../../cloud/apps/relay/src/regional-rehome-target-selection.test.ts --silent=false",
"command": "ORCA_BACKGROUND_LAUNCH=1 pnpm --dir cloud/apps/relay exec vitest run ../../../cloud/apps/relay/src/assignment/assignment-headroom-scope.test.ts ../../../cloud/apps/relay/src/assignment/assignment-connection-headroom.test.ts ../../../cloud/apps/relay/src/assignment-store.test.ts ../../../cloud/apps/relay/src/assignment/assignment-store-lock-order.test.ts ../../../cloud/apps/relay/src/cell-inventory-lock-contention.test.ts ../../../cloud/apps/relay/src/assignment-isolated-cell-replacement.test.ts ../../../cloud/apps/relay/src/regional-rehome-target-selection.test.ts --silent=false",
"result": "passed",
"durationSeconds": 0.513,
"summary": "189 tests across seven files passed; independent root rerun also passed189 tests. Relay typecheck passed separately."
+6 -1
View File
@@ -186,7 +186,12 @@ function buildTasks(root, plan, { files, mergeBase, maxWorkers, bun }) {
tasks.push({
name: 'oxlint',
steps: [
step(oxlint.command, [...oxlint.prefixArgs, '--quiet', ...(wholeTree ? [] : lintable)]),
step(oxlint.command, [
...oxlint.prefixArgs,
'--quiet',
'--no-error-on-unmatched-pattern',
...(wholeTree ? [] : lintable)
]),
...(antiSlop.length > 0
? [
step(node, ['config/scripts/sync-anti-slop-plugin.mjs']),
+3 -87
View File
@@ -1697,7 +1697,6 @@
"src/main/codex-accounts/service-device-code-login.test.ts": 437,
"src/main/codex-accounts/service-login-process-teardown.test.ts": 452,
"src/main/codex-accounts/service-managed-home-identity.test.ts": 355,
"src/main/codex-accounts/service-managed-home-removal-retries.test.ts": 278,
"src/main/codex-accounts/service-quota-refresh-decoupling.test.ts": 421,
"src/main/codex-accounts/service-reauthenticate-activation.test.ts": 318,
"src/main/codex-accounts/service-reset-credit-durability.test.ts": 767,
@@ -1777,7 +1776,6 @@
"src/main/codex/codex-hook-trust-failure-memo.test.ts": 242,
"src/main/codex/codex-hook-trust-grant.test.ts": 681,
"src/main/codex/codex-hook-trust-memo.test.ts": 165,
"src/main/codex/codex-hooks-read-denial-followup.test.ts": 324,
"src/main/codex/codex-index-heal-binary-contract.test.ts": 121,
"src/main/codex/codex-interrupt-hook-trust.test.ts": 104,
"src/main/codex/codex-legacy-session-resume.test.ts": 188,
@@ -1813,7 +1811,6 @@
"src/main/codex/codex-session-resume-preparation.test.ts": 75,
"src/main/codex/codex-session-resume-windows.test.ts": 57,
"src/main/codex/codex-session-resume-wrong-account.test.ts": 65,
"src/main/codex/codex-session-source-home.test.ts": 37,
"src/main/codex/codex-shared-server-fix.test.ts": 63,
"src/main/codex/codex-shared-server-pane.test.ts": 66,
"src/main/codex/codex-shared-server-probe.test.ts": 120,
@@ -1948,7 +1945,6 @@
"src/main/computer/desktop-script-provider-bridge.test.ts": 59,
"src/main/computer/desktop-script-provider-cache-lifecycle.test.ts": 70,
"src/main/computer/desktop-script-provider-cache.test.ts": 109,
"src/main/computer/desktop-script-provider-client.test.ts": 237,
"src/main/computer/desktop-script-provider-errors.test.ts": 279,
"src/main/computer/desktop-script-provider-paste-validation.test.ts": 93,
"src/main/computer/desktop-script-provider-paths.test.ts": 69,
@@ -2322,7 +2318,6 @@
"src/main/emulator/scrcpy-video-registry.test.ts": 57,
"src/main/emulator/serve-sim-accessibility-tree.test.ts": 62,
"src/main/emulator/serve-sim-ax-normalization.test.ts": 35,
"src/main/emulator/serve-sim-execution.test.ts": 64,
"src/main/emulator/serve-sim-helper-processes.test.ts": 59,
"src/main/emulator/serve-sim-kill-contract.test.ts": 1307,
"src/main/emulator/serve-sim-runtime-materializer.test.ts": 106,
@@ -2562,7 +2557,6 @@
"src/main/git/wsl-windows-checkout-sample-script.test.ts": 107,
"src/main/gitea/client-scan-invalidation.test.ts": 485,
"src/main/gitea/client.test.ts": 385,
"src/main/gitea/pull-request-creation.test.ts": 293,
"src/main/gitea/repository-ref.test.ts": 436,
"src/main/github/account-binding-required-host.test.ts": 220,
"src/main/github/auth-diagnose.test.ts": 58,
@@ -2583,7 +2577,6 @@
"src/main/github/client-pr-local-runtime.test.ts": 432,
"src/main/github/client-pr-lookup-coalescing.test.ts": 627,
"src/main/github/client-pr-push-target.test.ts": 449,
"src/main/github/client-pr-state.test.ts": 533,
"src/main/github/client-rate-limit-block.test.ts": 393,
"src/main/github/client-ssh-provider-execution-boundary.test.ts": 534,
"src/main/github/client-stack-merge-guard.test.ts": 422,
@@ -2624,7 +2617,6 @@
"src/main/github/github-repository-identity.gh-account.test.ts": 623,
"src/main/github/github-repository-identity.signed-cache.test.ts": 526,
"src/main/github/github-repository-identity.ssh-host-alias.test.ts": 490,
"src/main/github/issue-mutation-source.test.ts": 553,
"src/main/github/issues.test.ts": 511,
"src/main/github/pr-head-tracking-ref.test.ts": 59,
"src/main/github/pr-mutation-review-invalidation.test.ts": 2171,
@@ -2658,7 +2650,6 @@
"src/main/github/work-item-details-config-change.test.ts": 563,
"src/main/github/work-item-details-enterprise-host.test.ts": 372,
"src/main/github/work-item-details-file-viewed.test.ts": 487,
"src/main/github/work-item-details-issue-source.test.ts": 76,
"src/main/github/work-item-details-pr-files.test.ts": 535,
"src/main/github/work-item-details.test.ts": 428,
"src/main/github/work-item-search-fallback-environment.test.ts": 463,
@@ -2711,7 +2702,6 @@
"src/main/hook-termination-real-process.test.ts": 3176,
"src/main/hooks-archive-exit-observation.test.ts": 229,
"src/main/hooks-effective-hook-resolution.test.ts": 249,
"src/main/hooks-issue-command.test.ts": 307,
"src/main/hooks-orca-yaml-parsing.test.ts": 366,
"src/main/hooks-orca-yaml-unc-drive.test.ts": 316,
"src/main/hooks-runner.test.ts": 193,
@@ -2862,7 +2852,6 @@
"src/main/ipc/folder-repo-git-upgrade.test.ts": 2155,
"src/main/ipc/freebuff-detection.test.ts": 26,
"src/main/ipc/git-status-upstream-ref-watch-request.test.ts": 759,
"src/main/ipc/github-issue-source-preference.test.ts": 688,
"src/main/ipc/github-pr-refresh-routing.test.ts": 583,
"src/main/ipc/github-repo-access-guards.test.ts": 614,
"src/main/ipc/github-repo-routing-twin-host.test.ts": 91,
@@ -2907,7 +2896,6 @@
"src/main/ipc/notifications-workspace-click-binding.test.ts": 346,
"src/main/ipc/opencode-go-credentials.test.ts": 42,
"src/main/ipc/orca-profile-auth-handlers.test.ts": 492,
"src/main/ipc/orca-profile-org-members-handlers.test.ts": 47,
"src/main/ipc/orca-profiles-switch-persistence.test.ts": 2326,
"src/main/ipc/orca-profiles.test.ts": 691,
"src/main/ipc/parcel-watcher-crash-fuse-recovery.test.ts": 118,
@@ -2955,7 +2943,6 @@
"src/main/ipc/pty/host-env/spawn-cwd-hung-folder.test.ts": 577,
"src/main/ipc/pty/host-env/spawn-cwd-wsl-move.test.ts": 250,
"src/main/ipc/pty/host-env/startup-cwd-directory-exists.test.ts": 74,
"src/main/ipc/pty/ipc/claude-diff-panel-notice.test.ts": 42,
"src/main/ipc/pty/ipc/claude-old-terminal.test.ts": 41,
"src/main/ipc/pty/ipc/closed-pane-spawn-refusal.test.ts": 161,
"src/main/ipc/pty/ipc/codex-shared-server.test.ts": 81,
@@ -3050,7 +3037,6 @@
"src/main/ipc/pty/spawn-options-agent-workspace-trust.test.ts": 642,
"src/main/ipc/qoder-desktop-execution-host.test.ts": 3315,
"src/main/ipc/qoder-independent-renderer-spawn-review.test.ts": 3959,
"src/main/ipc/readdir-error-diagnostics.test.ts": 29,
"src/main/ipc/rebinding-file-watch-noise.test.ts": 1071,
"src/main/ipc/rebinding-file-watch.test.ts": 4132,
"src/main/ipc/register-core-handlers/register-core-handlers.test.ts": 706,
@@ -3069,7 +3055,6 @@
"src/main/ipc/repos-local-clone-lifecycle.test.ts": 1322,
"src/main/ipc/repos-nested-import.test.ts": 1224,
"src/main/ipc/repos-nested-scan.test.ts": 933,
"src/main/ipc/repos-picker.test.ts": 1077,
"src/main/ipc/repos-remote-base-ref-queries.test.ts": 1138,
"src/main/ipc/repos-remote-client-events.test.ts": 1301,
"src/main/ipc/repos-sparse-presets.test.ts": 1238,
@@ -3396,7 +3381,6 @@
"src/main/managed-server/install/orcad-remote-runtime.test.ts": 531,
"src/main/managed-server/install/orcad-remote-shell-commands.integration.test.ts": 9405,
"src/main/managed-server/install/orcad-remote-windows-commands.test.ts": 242,
"src/main/managed-server/install/orcad-remote-windows-decommission.test.ts": 319,
"src/main/managed-server/install/orcad-remote-windows-scripts.test.ts": 3133,
"src/main/managed-server/install/remote-install-gc-claim-termination.test.ts": 156,
"src/main/managed-server/install/remote-install-gc-termination.test.ts": 120,
@@ -3999,7 +3983,6 @@
"src/main/orcad/orcad-managed-stop-identity.test.ts": 156,
"src/main/orcad/orcad-managed-stop.test.ts": 1249,
"src/main/orcad/orcad-migration-wsl-destination.test.ts": 63,
"src/main/orcad/orcad-native-preflight.test.ts": 161,
"src/main/orcad/orcad-node-launcher.integration.test.ts": 90,
"src/main/orcad/orcad-observability.test.ts": 229,
"src/main/orcad/orcad-packaged-node-pty.integration.test.ts": 46,
@@ -4522,7 +4505,6 @@
"src/main/pty/codex-shell-no-daemon.test.ts": 8257,
"src/main/pty/conda-activation-env.test.ts": 44,
"src/main/pty/legacy-terminal-shim-dir.test.ts": 183,
"src/main/pty/legacy-terminal-windows-tombstone.test.ts": 49,
"src/main/pty/managed-ssh-host-login-shell.test.ts": 40,
"src/main/pty/node-pty-master-fd-retirement.test.ts": 2376,
"src/main/pty/overlay-mirror.test.ts": 73,
@@ -4870,7 +4852,6 @@
"src/main/runtime/mobile-pairing-qr.test.ts": 694,
"src/main/runtime/mobile-pairing-userdata-path.test.ts": 1791,
"src/main/runtime/mobile-presence-lock.test.ts": 16606,
"src/main/runtime/mobile-rpc-allowlist.test.ts": 2610,
"src/main/runtime/mobile-session-chat-tab-order.test.ts": 96,
"src/main/runtime/mobile-session-editor-projection.test.ts": 42,
"src/main/runtime/mobile-session-resume-identity.test.ts": 4735,
@@ -5432,7 +5413,6 @@
"src/main/runtime/rpc/methods/workspace-layout-apply.test.ts": 5567,
"src/main/runtime/rpc/methods/workspace-layout-paired-desktop.test.ts": 41277,
"src/main/runtime/rpc/methods/workspace-layout.test.ts": 1673,
"src/main/runtime/rpc/methods/workspace-ports.test.ts": 648,
"src/main/runtime/rpc/methods/worktree-catalog-snapshot-method.test.ts": 1270,
"src/main/runtime/rpc/methods/worktree-create-args.test.ts": 193,
"src/main/runtime/rpc/methods/worktree-create-navigation.test.ts": 1474,
@@ -5488,7 +5468,6 @@
"src/main/runtime/rpc/terminal-agent-prompt-send.test.ts": 1761,
"src/main/runtime/rpc/terminal-agent-send-guard.test.ts": 1295,
"src/main/runtime/rpc/terminal-claude-agent-view.test.ts": 1058,
"src/main/runtime/rpc/terminal-geometry-stale-handle.test.ts": 1168,
"src/main/runtime/rpc/terminal-lease-stale-handle-survival.test.ts": 1201,
"src/main/runtime/rpc/terminal-multiplex-ack-output-budget.test.ts": 1505,
"src/main/runtime/rpc/terminal-multiplex-ack-overflow-recovery-history.test.ts": 1306,
@@ -5564,7 +5543,6 @@
"src/main/runtime/runtime-file-upload-decode.test.ts": 255,
"src/main/runtime/runtime-folder-workspace-delete-lifecycle.test.ts": 3681,
"src/main/runtime/runtime-folder-workspace.test.ts": 71,
"src/main/runtime/runtime-folder-worktree-create.test.ts": 107,
"src/main/runtime/runtime-git-conflict-operation-routing.test.ts": 507,
"src/main/runtime/runtime-git-execution-host-ownership.test.ts": 702,
"src/main/runtime/runtime-git-generation-admission.test.ts": 560,
@@ -6311,7 +6289,6 @@
"src/main/startup/cli-launch-redirect.test.ts": 120,
"src/main/startup/cloud-session-shutdown-flush.test.ts": 77,
"src/main/startup/codex-account-restart-resume.test.ts": 329,
"src/main/startup/codex-hook-startup-wiring.test.ts": 1174,
"src/main/startup/codex-launch-per-agent-hook-opt-out.test.ts": 144,
"src/main/startup/codex-session-resume-daemon-guard.test.ts": 117,
"src/main/startup/configure-process-dev-parent-shutdown.test.ts": 95,
@@ -6319,7 +6296,6 @@
"src/main/startup/configure-process.test.ts": 178,
"src/main/startup/desktop-profile-instance-lock.test.ts": 167,
"src/main/startup/dev-education-suppression.test.ts": 110,
"src/main/startup/dev-instance-identity.test.ts": 73,
"src/main/startup/ensure-virtual-display.test.ts": 70,
"src/main/startup/first-window-startup-services.test.ts": 34,
"src/main/startup/gpu-fallback-marker.test.ts": 48,
@@ -6330,13 +6306,10 @@
"src/main/startup/hydrate-shell-path.test.ts": 471,
"src/main/startup/hydrate-shell-path.windows.test.ts": 434,
"src/main/startup/legacy-worker-renderer-recovery.test.ts": 51,
"src/main/startup/linux-dev-shm-policy.test.ts": 48,
"src/main/startup/linux-keyring-backend-selection.test.ts": 39,
"src/main/startup/linux-secret-service-probe.test.ts": 41,
"src/main/startup/login-shell-environment-cache.test.ts": 111,
"src/main/startup/login-shell-environment.test.ts": 80,
"src/main/startup/main-process-error-guards.test.ts": 73,
"src/main/startup/main-process-observers-hang-breadcrumb.test.ts": 158,
"src/main/startup/main-process-quit-pending-writer.test.ts": 426,
"src/main/startup/main-process-quit-update-veto.test.ts": 486,
"src/main/startup/main-process-ready-activation-failure.test.ts": 117,
@@ -6522,7 +6495,6 @@
"src/main/window/createMainWindow-renderer-crash-recovery.test.ts": 1486,
"src/main/window/createMainWindow-renderer-launch-failure.test.ts": 2008,
"src/main/window/createMainWindow-startup-reveal.test.ts": 1416,
"src/main/window/createMainWindow-system-resume-relay.test.ts": 2222,
"src/main/window/createMainWindow-terminal-focus-shortcuts.test.ts": 1546,
"src/main/window/createMainWindow-tray-minimize-close.test.ts": 1482,
"src/main/window/createMainWindow-user-quit-close.test.ts": 1489,
@@ -6533,7 +6505,6 @@
"src/main/window/dragged-temp-file-copy.test.ts": 137,
"src/main/window/dropped-path-preparation-ipc.test.ts": 106,
"src/main/window/dropped-path-preparation.test.ts": 586,
"src/main/window/editable-context-menu.test.ts": 39,
"src/main/window/focus-existing-window.test.ts": 49,
"src/main/window/foreground-activation-policy.test.ts": 39,
"src/main/window/history-gc-worktree-ids.test.ts": 228,
@@ -6692,7 +6663,6 @@
"src/main/wsl/wsl-runner.wsl.test.ts": 64,
"src/main/wsl/wsl-unc-drive-file-content.test.ts": 33,
"src/main/wsl/wsl-unc-drive-fs-path.test.ts": 40,
"src/main/wsl/wsl-w1-w3-contract.test.ts": 54,
"src/main/zcode/hook-service.test.ts": 107,
"src/main/zcode/interactive-capability.live.test.ts": 55,
"src/main/zcode/zcode-plan-api-key-store-native-windows.test.ts": 32,
@@ -7104,7 +7074,6 @@
"src/renderer/src/components/contextual-tours/contextual-tour-overlay-measurement.test.ts": 258,
"src/renderer/src/components/contextual-tours/contextual-tour-step-actions.test.ts": 55,
"src/renderer/src/components/contextual-tours/request-contextual-tour-when-ready.test.ts": 1380,
"src/renderer/src/components/contextual-tours/use-contextual-tour.test.ts": 1525,
"src/renderer/src/components/contextual-tours/workspace-creation-tour-handoff.test.ts": 1390,
"src/renderer/src/components/crash-report/crash-report-submit-notice.test.ts": 124,
"src/renderer/src/components/crash-report/use-crash-report-copy.test.tsx": 358,
@@ -7556,7 +7525,6 @@
"src/renderer/src/components/feature-tips/feature-tip-startup-gate.test.ts": 105,
"src/renderer/src/components/feature-tips/use-session-search-tip-setup.test.tsx": 520,
"src/renderer/src/components/feature-wall/AgentCapabilitiesSetupAction.test.ts": 1690,
"src/renderer/src/components/feature-wall/ConnectIntegrationsList.test.tsx": 663,
"src/renderer/src/components/feature-wall/FeatureWallSetupWorkflowActions.test.tsx": 1589,
"src/renderer/src/components/feature-wall/FullDiskAccessSetupPrompt.test.ts": 695,
"src/renderer/src/components/feature-wall/browser-animated-visual-sequence.test.ts": 42,
@@ -7929,7 +7897,6 @@
"src/renderer/src/components/native-chat/use-native-chat-draft.test.tsx": 395,
"src/renderer/src/components/native-chat/use-native-chat-external-attachments.test.tsx": 671,
"src/renderer/src/components/native-chat/use-native-chat-file-link-click.test.tsx": 941,
"src/renderer/src/components/native-chat/use-native-chat-file-link-existence.test.tsx": 907,
"src/renderer/src/components/native-chat/use-native-chat-find.test.tsx": 1160,
"src/renderer/src/components/native-chat/use-native-chat-font-size.test.tsx": 680,
"src/renderer/src/components/native-chat/use-native-chat-hook-status.test.ts": 1672,
@@ -7999,7 +7966,6 @@
"src/renderer/src/components/native-chat/use-structured-agent-session-transport-state.working.test.tsx": 395,
"src/renderer/src/components/native-chat/use-structured-agent-session-write-refusal.test.tsx": 2087,
"src/renderer/src/components/native-chat/use-structured-agent-session.clear-send.test.tsx": 2827,
"src/renderer/src/components/native-chat/use-structured-agent-session.cut-turn-notice.test.tsx": 1855,
"src/renderer/src/components/native-chat/use-structured-agent-session.queue-while-stopping.test.tsx": 2337,
"src/renderer/src/components/native-chat/use-structured-agent-session.queued-gating.test.tsx": 2062,
"src/renderer/src/components/native-chat/use-structured-agent-session.rejected-card.test.tsx": 2333,
@@ -8047,7 +8013,6 @@
"src/renderer/src/components/onboarding/windows-terminal-onboarding-telemetry.test.ts": 49,
"src/renderer/src/components/pet/PetOverlay.pointer-interaction.test.tsx": 195,
"src/renderer/src/components/pet/pet-blob-cache.test.ts": 55,
"src/renderer/src/components/pet/pet-overlay-hit-area.test.tsx": 228,
"src/renderer/src/components/pet/pet-overlay-visibility.test.ts": 46,
"src/renderer/src/components/pet/sprite-animation-css.test.ts": 44,
"src/renderer/src/components/pet/usePetPointerInteraction.test.ts": 257,
@@ -8091,7 +8056,6 @@
"src/renderer/src/components/right-sidebar/AiVaultSessionVirtualList.measurement.test.tsx": 2554,
"src/renderer/src/components/right-sidebar/AiVaultVirtualRow.test.tsx": 2253,
"src/renderer/src/components/right-sidebar/ChecksPanel.updated-at-metadata.test.tsx": 243,
"src/renderer/src/components/right-sidebar/CommitArea.chevron-spinner.test.tsx": 1564,
"src/renderer/src/components/right-sidebar/CommitArea.generate.test.tsx": 1781,
"src/renderer/src/components/right-sidebar/CommitArea.test.tsx": 8618,
"src/renderer/src/components/right-sidebar/FileExplorerFilesTreePane.errors.test.tsx": 3001,
@@ -8121,7 +8085,6 @@
"src/renderer/src/components/right-sidebar/SourceControl.resolve-conflicts-prompt.test.ts": 96,
"src/renderer/src/components/right-sidebar/SourceControl.virtual-file-list.test.tsx": 3910,
"src/renderer/src/components/right-sidebar/SourceControlAgentActionDialog.test.tsx": 7135,
"src/renderer/src/components/right-sidebar/SourceControlAgentActionDialogForm.test.tsx": 191,
"src/renderer/src/components/right-sidebar/SourceControlTextGenerationDialog.test.ts": 495,
"src/renderer/src/components/right-sidebar/active-checks-status.test.ts": 1264,
"src/renderer/src/components/right-sidebar/activity-bar-buttons.test.tsx": 190,
@@ -8137,7 +8100,6 @@
"src/renderer/src/components/right-sidebar/ai-vault-scope-paths.test.ts": 65,
"src/renderer/src/components/right-sidebar/ai-vault-scope-state.test.ts": 30,
"src/renderer/src/components/right-sidebar/ai-vault-search-hit-hosts.test.ts": 45,
"src/renderer/src/components/right-sidebar/ai-vault-search-scope-identity.test.tsx": 479,
"src/renderer/src/components/right-sidebar/ai-vault-search-session.test.ts": 88,
"src/renderer/src/components/right-sidebar/ai-vault-session-cli-fork.test.ts": 1630,
"src/renderer/src/components/right-sidebar/ai-vault-session-conditional-refresh-hook.test.tsx": 1736,
@@ -8183,7 +8145,6 @@
"src/renderer/src/components/right-sidebar/checks-panel/use-checks-panel-foreground-effects.test.tsx": 228,
"src/renderer/src/components/right-sidebar/checks-panel/use-checks-panel-generation.test.tsx": 1570,
"src/renderer/src/components/right-sidebar/checks-panel/use-checks-panel-git-status-effects.test.tsx": 160,
"src/renderer/src/components/right-sidebar/checks-panel/use-checks-panel-manual-refresh.test.tsx": 1589,
"src/renderer/src/components/right-sidebar/checks-panel/use-checks-panel-polling-stability.test.tsx": 1574,
"src/renderer/src/components/right-sidebar/checks-panel/use-checks-panel-polling.test.tsx": 1222,
"src/renderer/src/components/right-sidebar/coalesced-poll-runner.test.ts": 38,
@@ -8264,12 +8225,9 @@
"src/renderer/src/components/right-sidebar/source-control-create-review-blocked-action.test.ts": 148,
"src/renderer/src/components/right-sidebar/source-control-created-review-link.test.ts": 57,
"src/renderer/src/components/right-sidebar/source-control-discard-confirmation.test.ts": 118,
"src/renderer/src/components/right-sidebar/source-control-discard-dialog.test.tsx": 196,
"src/renderer/src/components/right-sidebar/source-control-dropdown-items.create-pr-intent.test.ts": 163,
"src/renderer/src/components/right-sidebar/source-control-dropdown-items.test.ts": 256,
"src/renderer/src/components/right-sidebar/source-control-entry-context-menu.test.tsx": 367,
"src/renderer/src/components/right-sidebar/source-control-file-filter.test.ts": 46,
"src/renderer/src/components/right-sidebar/source-control-header-toolbar-identity.test.tsx": 346,
"src/renderer/src/components/right-sidebar/source-control-hosted-review-creation-eligibility-snapshot.test.ts": 87,
"src/renderer/src/components/right-sidebar/source-control-hosted-review-push-target.test.ts": 52,
"src/renderer/src/components/right-sidebar/source-control-huge-repo-warning-dismissals.test.ts": 150,
@@ -8280,7 +8238,6 @@
"src/renderer/src/components/right-sidebar/source-control-push-recovery.test.ts": 35,
"src/renderer/src/components/right-sidebar/source-control-recovery-admission.test.ts": 131,
"src/renderer/src/components/right-sidebar/source-control-section-order.test.ts": 69,
"src/renderer/src/components/right-sidebar/source-control-split-open.test.ts": 52,
"src/renderer/src/components/right-sidebar/source-control-submodule-expansion.test.ts": 46,
"src/renderer/src/components/right-sidebar/source-control-too-many-changes-banner.test.tsx": 632,
"src/shared/source-control-tree.test.ts": 57,
@@ -8289,7 +8246,6 @@
"src/renderer/src/components/right-sidebar/source-control/commit/rename-mutation-paths.test.ts": 70,
"src/renderer/src/components/right-sidebar/source-control/commit/source-control-discard-editor-owner.test.tsx": 527,
"src/renderer/src/components/right-sidebar/source-control/commit/source-control-entry-failure-toast.test.ts": 282,
"src/renderer/src/components/right-sidebar/source-control/commit/source-control-entry-mutation-failures.test.tsx": 514,
"src/renderer/src/components/right-sidebar/source-control/commit/use-bulk-actions-capped-stage.test.tsx": 1547,
"src/renderer/src/components/right-sidebar/source-control/commit/use-commit-message-generation.cancel.test.ts": 1660,
"src/renderer/src/components/right-sidebar/source-control/listing/content-status.test.tsx": 269,
@@ -8390,7 +8346,6 @@
"src/renderer/src/components/settings/CloudVmSetupGuide.test.tsx": 1716,
"src/renderer/src/components/settings/CodexLoginLinkNotice.test.tsx": 541,
"src/renderer/src/components/settings/CommitMessageAiPane.test.tsx": 1913,
"src/renderer/src/components/settings/DefaultWindowsProjectRuntimeSetting.test.tsx": 337,
"src/renderer/src/components/settings/DeveloperPermissionsPane.test.tsx": 1754,
"src/renderer/src/components/settings/EphemeralVmRuntimesSection.test.tsx": 2771,
"src/renderer/src/components/settings/EphemeralVmsPane.test.tsx": 803,
@@ -8403,7 +8358,6 @@
"src/renderer/src/components/settings/HostAccountSignInPrompt.test.tsx": 158,
"src/renderer/src/components/settings/HostAgentLaunchSettings.test.tsx": 4184,
"src/renderer/src/components/settings/KagiSessionLinkForm.test.ts": 193,
"src/renderer/src/components/settings/LinearAgentSkillPane.test.tsx": 675,
"src/renderer/src/components/settings/LocalNetworkConnectionTest.test.tsx": 556,
"src/renderer/src/components/settings/MachineNameField.test.tsx": 481,
"src/renderer/src/components/settings/McpConfigSection.host-owner.test.tsx": 2450,
@@ -8430,7 +8384,6 @@
"src/renderer/src/components/settings/ReleaseChannelSection.test.tsx": 2427,
"src/renderer/src/components/settings/repository/RepositoryGitHubAccountSection.inventory-lifetime.test.tsx": 587,
"src/renderer/src/components/settings/repository/RepositoryGitHubAccountSection.test.tsx": 662,
"src/renderer/src/components/settings/repository/RepositoryPane.test.ts": 2778,
"src/renderer/src/components/settings/repository/source-control/RepositorySourceControlAiSection.test.ts": 365,
"src/renderer/src/components/settings/RuntimeEnvironmentsPane.test.ts": 201,
"src/renderer/src/components/settings/RuntimeHostAccessForm.test.tsx": 307,
@@ -8441,7 +8394,6 @@
"src/renderer/src/components/settings/SettingsConstants.test.ts": 97,
"src/renderer/src/components/settings/SettingsFormControls.font-autocomplete.test.tsx": 789,
"src/renderer/src/components/settings/SettingsFormControls.segmented-control.test.tsx": 548,
"src/renderer/src/components/settings/SettingsSidebar.test.tsx": 2169,
"src/renderer/src/components/settings/ShareSkillsSettingsPane.test.tsx": 601,
"src/renderer/src/components/settings/ShortcutFilterRail.test.ts": 157,
"src/renderer/src/components/settings/SparsePresetSettingsSection.test.tsx": 785,
@@ -8449,12 +8401,10 @@
"src/renderer/src/components/settings/SshHostRecoverServerAction.test.tsx": 343,
"src/renderer/src/components/settings/SshHostRestartServerAction.test.tsx": 385,
"src/renderer/src/components/settings/SshPane.test.tsx": 1821,
"src/renderer/src/components/settings/SshTargetCard.test.tsx": 2061,
"src/renderer/src/components/settings/SshTargetDestructiveActions.test.tsx": 338,
"src/renderer/src/components/settings/SshTargetForm.test.tsx": 690,
"src/renderer/src/components/settings/SshTargetList.large-config.test.tsx": 371,
"src/renderer/src/components/settings/SshTargetList.test.tsx": 2127,
"src/renderer/src/components/settings/TaskSourceLinearSetup.test.tsx": 391,
"src/renderer/src/components/settings/TaskSourceProviderCard.test.tsx": 309,
"src/renderer/src/components/settings/TaskSourceShowInTasksStep.test.tsx": 194,
"src/renderer/src/components/settings/TaskSourceSimpleSetup.test.tsx": 323,
@@ -8539,7 +8489,6 @@
"src/renderer/src/components/settings/use-runtime-environment-catalog.test.tsx": 2203,
"src/renderer/src/components/settings/use-runtime-environment-mutation-actions.test.tsx": 1871,
"src/renderer/src/components/settings/use-session-search-status.test.tsx": 362,
"src/renderer/src/components/settings/use-task-source-provider-readiness.test.tsx": 199,
"src/renderer/src/components/settings/use-zcode-plan-credentials.test.tsx": 1115,
"src/renderer/src/components/settings/useGhosttyImport.test.ts": 83,
"src/renderer/src/components/settings/useWarpThemeImport.test.ts": 153,
@@ -8557,8 +8506,6 @@
"src/renderer/src/components/sidebar/AddRepoCreateStep.test.tsx": 532,
"src/renderer/src/components/sidebar/AddRepoDialog.default-checkout.test.ts": 42,
"src/renderer/src/components/sidebar/AddRepoDialogChrome.test.tsx": 495,
"src/renderer/src/components/sidebar/AddRepoDialogStepContent.test.tsx": 1988,
"src/renderer/src/components/sidebar/AddRepoHostSelector.test.tsx": 390,
"src/renderer/src/components/sidebar/AddRepoNestedImportStep.test.tsx": 817,
"src/renderer/src/components/sidebar/AddRepoStartSteps.test.tsx": 681,
"src/renderer/src/components/sidebar/AddRepoSteps.default-checkout.test.ts": 170,
@@ -8579,8 +8526,6 @@
"src/renderer/src/components/sidebar/DeleteWorktreeDialog.unsaved-edits.test.tsx": 1079,
"src/renderer/src/components/sidebar/DeleteWorktreeDialogFooter.test.tsx": 523,
"src/renderer/src/components/sidebar/DeleteWorktreeTargetPreview.test.tsx": 608,
"src/renderer/src/components/sidebar/ForgetSshWorkspaceDialog.test.tsx": 1539,
"src/renderer/src/components/sidebar/ImportedWorktreesVisibilityLine.test.tsx": 1451,
"src/renderer/src/components/sidebar/LinearAgentSkillSetupPrompt.reminder-toast.test.tsx": 1545,
"src/renderer/src/components/sidebar/LinearAgentSkillSetupPrompt.test.tsx": 2010,
"src/renderer/src/components/sidebar/LocalGitToolchainScanBanner.test.tsx": 1690,
@@ -8593,7 +8538,6 @@
"src/renderer/src/components/sidebar/ProjectGroupDeleteDialog.test.tsx": 2252,
"src/renderer/src/components/sidebar/ProjectHeaderActions.test.tsx": 141,
"src/renderer/src/components/sidebar/RemoteFileBrowser.paste.test.tsx": 640,
"src/renderer/src/components/sidebar/RemoveFolderDialog.test.tsx": 754,
"src/renderer/src/components/sidebar/SetupGuideSidebarEntry.test.tsx": 433,
"src/renderer/src/components/sidebar/SetupScriptPromptCard.test.ts": 73,
"src/renderer/src/components/sidebar/SeveredTerminalDaemonBanner.test.tsx": 393,
@@ -8612,20 +8556,13 @@
"src/renderer/src/components/sidebar/WorkspaceKanbanDrawer.mount-gating.test.tsx": 1554,
"src/renderer/src/components/sidebar/WorkspaceKanbanDrawer.search.test.tsx": 2430,
"src/renderer/src/components/sidebar/WorkspaceKanbanDrawer.task-status-sync.test.tsx": 1766,
"src/renderer/src/components/sidebar/WorkspaceKanbanDrawerHeader.test.tsx": 1722,
"src/renderer/src/components/sidebar/WorkspaceKanbanLaneCardList.test.tsx": 286,
"src/renderer/src/components/sidebar/WorkspaceKanbanLaneGrid.test.tsx": 519,
"src/renderer/src/components/sidebar/WorkspaceKanbanSearchField.test.tsx": 658,
"src/renderer/src/components/sidebar/WorkspaceKanbanStatusLane.test.tsx": 419,
"src/renderer/src/components/sidebar/WorktreeCard.affiliate-list-mode.test.tsx": 1826,
"src/renderer/src/components/sidebar/WorktreeCard.compact-hover.test.tsx": 2372,
"src/renderer/src/components/sidebar/WorktreeCard.compact-ports-hover-independence.test.tsx": 2147,
"src/renderer/src/components/sidebar/WorktreeCard.delete-failed.test.tsx": 2196,
"src/renderer/src/components/sidebar/WorktreeCard.host-badge-toggle.test.tsx": 1253,
"src/renderer/src/components/sidebar/WorktreeCard.hosted-review-refresh.test.tsx": 1647,
"src/renderer/src/components/sidebar/WorktreeCard.lineage.test.tsx": 1737,
"src/renderer/src/components/sidebar/WorktreeCard.merged-pr-display.test.tsx": 1682,
"src/renderer/src/components/sidebar/WorktreeCard.pinned-repo-icon.test.tsx": 1604,
"src/renderer/src/components/sidebar/WorktreeCard.pr-display.test.tsx": 1246,
"src/renderer/src/components/sidebar/WorktreeCard.quick-actions.test.tsx": 1827,
"src/renderer/src/components/sidebar/WorktreeCard.single-reference-details.test.tsx": 1662,
@@ -8633,7 +8570,6 @@
"src/renderer/src/components/sidebar/WorktreeCardAgents.acknowledgement-emphasis.test.tsx": 944,
"src/renderer/src/components/sidebar/WorktreeCardAgents.activation.test.tsx": 766,
"src/renderer/src/components/sidebar/WorktreeCardAgents.expansion-remount.test.tsx": 958,
"src/renderer/src/components/sidebar/WorktreeCardAgents.send-target.test.tsx": 1228,
"src/renderer/src/components/sidebar/WorktreeCardAgents.test.tsx": 846,
"src/renderer/src/components/sidebar/WorktreeCardLinkedItemsSection.test.tsx": 3296,
"src/renderer/src/components/sidebar/WorktreeCardMeta.interaction.test.tsx": 1658,
@@ -8644,11 +8580,8 @@
"src/renderer/src/components/sidebar/WorktreeContextMenu.delete-shortcut.test.tsx": 1570,
"src/renderer/src/components/sidebar/WorktreeContextMenu.react185-bystander.test.tsx": 1475,
"src/renderer/src/components/sidebar/WorktreeContextMenu.test.ts": 164,
"src/renderer/src/components/sidebar/WorktreeDeveloperMenuReveal.test.tsx": 702,
"src/renderer/src/components/sidebar/WorktreeList.card-memo-stability.test.tsx": 819,
"src/renderer/src/components/sidebar/WorktreeList.empty-project-rows.test.ts": 3395,
"src/renderer/src/components/sidebar/WorktreeList.folder-workspace-rows.test.ts": 2943,
"src/renderer/src/components/sidebar/WorktreeList.group-headers.test.ts": 1786,
"src/renderer/src/components/sidebar/WorktreeList.lineage-agent-expansion-coupling.test.tsx": 3116,
"src/renderer/src/components/sidebar/WorktreeList.lineage-child-card.test.ts": 4240,
"src/renderer/src/components/sidebar/WorktreeList.lineage-child-real-card.test.tsx": 3000,
@@ -8803,7 +8736,6 @@
"src/renderer/src/components/sidebar/worktree-agent-orchestration-index.test.ts": 81,
"src/renderer/src/components/sidebar/worktree-agent-remote-attribution.test.ts": 885,
"src/renderer/src/components/sidebar/worktree-agent-row-selectors.test.ts": 43,
"src/renderer/src/components/sidebar/worktree-agent-rows-subscriptions.bench.test.tsx": 1878,
"src/renderer/src/components/sidebar/worktree-card-agent-ack-inputs.test.tsx": 145,
"src/renderer/src/components/sidebar/worktree-card-agent-summary.test.ts": 2036,
"src/renderer/src/components/sidebar/worktree-card-compact-agent-row.stable-message.test.tsx": 2596,
@@ -8900,8 +8832,6 @@
"src/renderer/src/components/sidebar/worktree-title-derived-agent-rows.test.ts": 119,
"src/renderer/src/components/sidebar/worktree-unambiguous-id-index.test.ts": 19,
"src/renderer/src/components/sidebar/worktree-unnest.test.ts": 94,
"src/renderer/src/components/sidebar/worktree-visibility-source-provenance.test.ts": 45,
"src/renderer/src/components/sidebar/wsl-host-removal.test.ts": 129,
"src/renderer/src/components/sidebar/wsl-host-row-status.test.ts": 282,
"src/renderer/src/components/skills/SkillFreshnessNudge.test.tsx": 292,
"src/renderer/src/components/skills/SkillFreshnessStatusPill.test.tsx": 2390,
@@ -8920,7 +8850,6 @@
"src/renderer/src/components/skills/skill-delete-copy.test.ts": 146,
"src/renderer/src/components/skills/skill-description-length.test.ts": 34,
"src/renderer/src/components/skills/skill-install-progress-state.test.tsx": 258,
"src/renderer/src/components/skills/skill-install-provider-groups.test.ts": 32,
"src/renderer/src/components/skills/skill-install-workspace-choices.test.ts": 55,
"src/renderer/src/components/skills/skill-share-link.test.ts": 38,
"src/renderer/src/components/skills/skill-share-package-selection.test.ts": 48,
@@ -8934,14 +8863,12 @@
"src/renderer/src/components/sparse/sparse-directory-entry-input.test.ts": 107,
"src/renderer/src/components/star-nag/StarNagAgentValueMomentObserver.test.tsx": 1534,
"src/renderer/src/components/star-nag/StarNagToastHost.test.tsx": 344,
"src/renderer/src/components/stats/CodexUsagePane.test.tsx": 753,
"src/renderer/src/components/stats/usage-daily-chart.test.tsx": 189,
"src/renderer/src/components/stats/usage-overview-model.test.ts": 422,
"src/renderer/src/components/status-bar/CaffeinateStatusSegment.localization.test.tsx": 482,
"src/renderer/src/components/status-bar/NativeChatResumeStatusSegment.test.tsx": 2041,
"src/renderer/src/components/status-bar/PortsStatusSegment.host-routing.test.tsx": 712,
"src/renderer/src/components/status-bar/PortsStatusSegment.render-stability.test.tsx": 1289,
"src/renderer/src/components/status-bar/ResourceUsageStatusSegment.rows.test.tsx": 1780,
"src/renderer/src/components/status-bar/RuntimeHostStatusRow.test.tsx": 381,
"src/renderer/src/components/status-bar/SkillUpdateStatusSegment.test.tsx": 436,
"src/renderer/src/components/status-bar/SshStatusSegment.large-host-list.test.tsx": 1552,
@@ -8975,8 +8902,6 @@
"src/renderer/src/components/status-bar/resource-session-kill-confirmation.test.ts": 42,
"src/renderer/src/components/status-bar/resource-session-removal-render-budget.test.tsx": 288,
"src/renderer/src/components/status-bar/resource-usage-folder-merge.test.ts": 87,
"src/renderer/src/components/status-bar/resource-usage-open-slices.test.ts": 1804,
"src/renderer/src/components/status-bar/resource-usage-space-scan-ready.test.ts": 38,
"src/renderer/src/components/status-bar/runtime-host-resources.test.ts": 45,
"src/renderer/src/components/status-bar/ssh-status-menu-rows.test.ts": 48,
"src/renderer/src/components/status-bar/status-bar-antigravity-segment.test.tsx": 968,
@@ -9135,14 +9060,13 @@
"src/renderer/src/components/task-page/jira/task-page-jira-saved-filter-application.test.tsx": 1838,
"src/renderer/src/components/task-page-jira-saved-filter-load-failure.test.tsx": 2974,
"src/renderer/src/components/task-page/jira/task-page-jira-search.test.ts": 42,
"src/renderer/src/components/task-page-jira-sorting.test.ts": 107,
"src/renderer/src/components/task-page/jira/task-page-jira-sorting.test.ts": 107,
"src/renderer/src/components/task-page-jira-status-catalog.test.ts": 60,
"src/renderer/src/components/task-page/jira/task-page-jira-status-order-session.test.tsx": 2111,
"src/renderer/src/components/task-page/jira/task-page-jira-text-fallback-notice.test.tsx": 375,
"src/renderer/src/components/task-page/task-page-list-chrome-visibility.test.ts": 33,
"src/renderer/src/components/task-page/task-page-mutation-page-allocation.test.ts": 128,
"src/renderer/src/components/task-page/task-page-new-issue-draft.test.ts": 76,
"src/renderer/src/components/task-page/task-page-task-source-host-availability.test.ts": 401,
"src/renderer/src/components/task-page/task-page-work-item-pagination.test.ts": 56,
"src/renderer/src/components/task-page/github/rows-twin-host-routing.test.tsx": 1521,
"src/renderer/src/components/task-page/github/task-page-github-dialog-state-authority.test.ts": 71,
@@ -9489,7 +9413,6 @@
"src/renderer/src/components/terminal-pane/terminal-cold-park-tab-model-identity.react185.test.tsx": 774,
"src/renderer/src/components/terminal-pane/terminal-cold-park-timer-rearm.test.tsx": 538,
"src/renderer/src/components/terminal-pane/terminal-cold-park-verdict-loop.test.tsx": 694,
"src/renderer/src/components/terminal-pane/terminal-cold-park-withheld-tabs.test.ts": 48,
"src/renderer/src/components/terminal-pane/terminal-command-lifecycle.test.ts": 46,
"src/renderer/src/components/terminal-pane/terminal-copy-shortcut.test.ts": 1636,
"src/renderer/src/components/terminal-pane/terminal-ctrl-enter.test.ts": 115,
@@ -9712,7 +9635,6 @@
"src/renderer/src/components/terminal-pane/use-terminal-pane-global-effects-visibility-resume.test.ts": 1476,
"src/renderer/src/components/terminal-pane/use-terminal-pane-global-effects-window-focus-recovery.test.ts": 1531,
"src/renderer/src/components/terminal-pane/use-terminal-pane-lifecycle.test.ts": 1551,
"src/renderer/src/components/terminal-pane/use-terminal-pane-process-exit-actions.test.ts": 204,
"src/renderer/src/components/terminal-pane/use-terminal-park-mount-intent.react185.test.tsx": 251,
"src/renderer/src/components/terminal-pane/use-terminal-scroll-visibility-memory.test.ts": 56,
"src/renderer/src/components/terminal-pane/use-terminal-tab-cold-parking.test.ts": 461,
@@ -9749,7 +9671,6 @@
"src/renderer/src/components/terminal/split-group-mount.test.ts": 58,
"src/renderer/src/components/terminal/startup-terminal-tab-hold.test.ts": 1872,
"src/renderer/src/components/terminal/tab-type-cycle.test.ts": 39,
"src/renderer/src/components/terminal/terminal-close-confirm-keyboard-vs-mouse.test.ts": 211,
"src/renderer/src/components/terminal/terminal-close-copy-kind.test.ts": 40,
"src/renderer/src/components/terminal/terminal-close-incarnation.test.ts": 28,
"src/renderer/src/components/terminal/terminal-provider-snapshot-bound-pty-ids.test.ts": 1570,
@@ -9804,7 +9725,6 @@
"src/renderer/src/components/workspace-cleanup/workspace-cleanup-background-removal.test.ts": 176,
"src/renderer/src/components/workspace-cleanup/workspace-cleanup-candidate-row-data.test.ts": 279,
"src/renderer/src/components/workspace-cleanup/workspace-cleanup-candidate-row.test.tsx": 2141,
"src/renderer/src/components/workspace-cleanup/workspace-cleanup-confirm-remove.test.tsx": 658,
"src/renderer/src/components/workspace-cleanup/workspace-cleanup-facet-controls.test.tsx": 601,
"src/renderer/src/components/workspace-cleanup/workspace-cleanup-facet-filter.test.ts": 107,
"src/renderer/src/components/workspace-cleanup/workspace-cleanup-facet-sort.test.ts": 127,
@@ -9820,7 +9740,6 @@
"src/renderer/src/components/workspace-space/SpaceWindowStatePublisher.test.tsx": 618,
"src/renderer/src/components/workspace-space/space-window-state.test.ts": 162,
"src/renderer/src/components/workspace-surface-projection.test.ts": 48,
"src/renderer/src/components/worktree-creation/WorktreeCreationPanel.test.tsx": 509,
"src/renderer/src/components/worktree-jump-palette-browser-navigation.test.tsx": 2772,
"src/renderer/src/components/worktree-jump-palette-interleaved-sections.test.tsx": 2023,
"src/renderer/src/components/worktree-jump-palette-primitives.test.tsx": 384,
@@ -9980,7 +9899,6 @@
"src/renderer/src/hooks/useIpcEvents-repos-changed-catalogs.test.ts": 2758,
"src/renderer/src/hooks/useIpcEvents-runtime-environment-selectors.test.ts": 502,
"src/renderer/src/hooks/useIpcEvents-session-tab-close-request.test.ts": 1385,
"src/renderer/src/hooks/useIpcEvents-silent-terminal-adoption.test.ts": 1395,
"src/renderer/src/hooks/useIpcEvents-ssh-disconnect-cleanup.test.ts": 1178,
"src/renderer/src/hooks/useIpcEvents-terminal-create-surfacing.test.ts": 998,
"src/renderer/src/hooks/useIpcEvents-updater-status.test.ts": 1219,
@@ -10200,7 +10118,6 @@
"src/renderer/src/lib/github-work-item-source-lookup.test.ts": 130,
"src/renderer/src/lib/github-work-item-workspace-attachment.test.ts": 87,
"src/renderer/src/lib/gitlab-links.test.ts": 43,
"src/renderer/src/lib/gitlab-work-item-source-lookup.test.ts": 253,
"src/renderer/src/lib/hook-command-delayed-delivery-perf.test.ts": 1086,
"src/renderer/src/lib/hook-command-delayed-delivery.test.ts": 1444,
"src/renderer/src/lib/host-chat-program.test.ts": 1832,
@@ -10662,7 +10579,6 @@
"src/renderer/src/lib/worktree-creation-backend-startup-focus.test.ts": 1775,
"src/renderer/src/lib/worktree-creation-background-mount.test.ts": 2109,
"src/renderer/src/lib/worktree-creation-chat-setup.test.ts": 2040,
"src/renderer/src/lib/worktree-creation-flow-dedupe.test.ts": 1005,
"src/renderer/src/lib/worktree-creation-flow-ready-toast.test.ts": 2003,
"src/renderer/src/lib/worktree-creation-flow-stranded-surface.test.ts": 1041,
"src/renderer/src/lib/worktree-creation-flow.test.ts": 2013,
@@ -11648,8 +11564,8 @@
"src/shared/agent-session-definitive-refusal.test.ts": 119,
"src/shared/agent-session-failure-words.test.ts": 461,
"src/shared/agent-session-failure.test.ts": 97,
"src/shared/agent-session-journal-body-admission.test.ts": 108,
"src/shared/agent-session-journal-producer.test.ts": 42,
"src/shared/agent-session/journal/agent-session-journal-body-admission.test.ts": 108,
"src/shared/agent-session/journal/agent-session-journal-producer.test.ts": 42,
"src/shared/agent-session-journal-schemas.test.ts": 113,
"src/shared/agent-session-lease-adjudication.test.ts": 51,
"src/shared/agent-session-legacy-handoff-lease.test.ts": 124,
@@ -3,7 +3,7 @@ import { tmpdir } from 'node:os'
import { dirname, join } from 'node:path'
import { runProcess } from '@orca/process-host'
import { runInNewContext } from 'node:vm'
import { expect, it, vi } from 'vitest'
import { expect, it } from 'vitest'
import { parse } from 'yaml'
const release = parse(readFileSync('.github/workflows/release-cut.yml', 'utf8'))
@@ -59,97 +59,13 @@ it('scans the release tag with read-only workflow tooling instead of installing
}
})
it('keeps audit outcomes for notifications while allowing findings to pass CI', () => {
expect(audit.secrets.SLACK_WEBHOOK_URL).toBe('${{ secrets.SLACK_WEBHOOK_URL }}')
expect(security.on.workflow_call.secrets.SLACK_WEBHOOK_URL.required).toBe(false)
const notify = security.jobs.notify
expect(notify.needs).toEqual(['javascript', 'rust'])
expect(notify.steps[0]['continue-on-error']).toBe(true)
it('allows audit findings to pass CI', () => {
for (const name of ['javascript', 'rust']) {
const job = security.jobs[name]
expect(job.steps.find((step) => step.id === 'audit')['continue-on-error']).toBe(true)
expect(job.outputs.audit_result).toBe('${{ steps.audit.outcome }}')
for (const status of ['success', 'failure']) {
for (const outcome of ['success', 'failure']) {
for (const cancelled of [false, true]) {
const needs = {
javascript: { result: 'success', outputs: { audit_result: 'success' } },
rust: { result: 'success', outputs: { audit_result: 'success' } }
}
needs[name] = { result: status, outputs: { audit_result: outcome } }
expect(
runInNewContext(notify.if, {
needs,
github: { repository: 'stablyai/orca' },
cancelled: () => cancelled
})
).toBe(!cancelled && (status === 'failure' || outcome === 'failure'))
}
}
}
}
})
async function sendNotification({
webhook = 'https://example.test/slack',
ref = '',
pullRequest,
fetch = vi.fn().mockResolvedValue({ ok: true })
} = {}) {
const notice = vi.fn()
await runInNewContext(`(async () => { ${security.jobs.notify.steps[0].with.script} })()`, {
process: {
env: {
SLACK_WEBHOOK_URL: webhook,
RELEASE_REF: ref,
GITHUB_SERVER_URL: 'https://github.com',
GITHUB_REPOSITORY: 'stablyai/orca',
GITHUB_RUN_ID: '123',
AUDIT_RESULTS: JSON.stringify({
javascript: { result: 'success', outputs: { audit_result: 'failure' } },
rust: { result: 'success', outputs: { audit_result: 'success' } }
})
}
},
context: { payload: { pull_request: pullRequest }, ref: 'refs/heads/main' },
core: { notice },
fetch,
AbortSignal
})
return { fetch, notice }
}
it.each([
{ pullRequest: { number: 1234 }, target: 'PR #1234' },
{ ref: 'refs/tags/v1.5.0', target: 'refs/tags/v1.5.0' }
])('sends a dependency review with the target and report link: $target', async (options) => {
const { fetch } = await sendNotification(options)
const [url, request] = fetch.mock.calls[0]
expect(url).toBe('https://example.test/slack')
expect(request.method).toBe('POST')
const payload = JSON.parse(request.body)
expect(payload.text).toContain(`Orca dependency review for ${options.target}`)
expect(payload.text).toContain('JavaScript: review suggested · Rust: passed')
expect(payload.text).toContain('https://github.com/stablyai/orca/actions/runs/123')
expect(payload.mrkdwn).toBe(false)
})
it('retains fork reports without requiring a Slack secret and redacts delivery errors', async () => {
const { fetch, notice } = await sendNotification({ webhook: '' })
expect(fetch).not.toHaveBeenCalled()
expect(notice).toHaveBeenCalledOnce()
await expect(
sendNotification({
fetch: vi.fn().mockRejectedValue(new Error('fetch failed: https://example.test/slack'))
})
).rejects.toThrow(/^Slack dependency review notification could not be sent$/)
await expect(
sendNotification({
fetch: vi.fn().mockResolvedValue({ ok: false, status: 503 })
})
).rejects.toThrow(/^Slack dependency review notification returned HTTP 503$/)
})
it('extracts release data while excluding executable package and Cargo configuration', async () => {
const root = mkdtempSync(join(tmpdir(), 'release audit data '))
const source = join(root, 'source')
@@ -0,0 +1,21 @@
import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs'
import { tmpdir } from 'node:os'
import { join } from 'node:path'
import { afterEach, expect, it } from 'vitest'
import { collectNodeServerInputs } from './node-server-change-scope.mjs'
let outer
afterEach(() => rmSync(outer, { recursive: true, force: true }))
it('ignores warnings from an enclosing checkout but not from the repo', async () => {
const duplicateKey = '{ "name": "x", "name": "y" }'
outer = mkdtempSync(join(tmpdir(), 'node-server-scope-outer-'))
const root = join(outer, 'repo')
mkdirSync(root)
writeFileSync(join(outer, 'package.json'), duplicateKey)
writeFileSync(join(root, 'entry.ts'), 'export {}')
const collect = () => collectNodeServerInputs({ root, entryPoints: ['entry.ts'] })
expect([...(await collect())]).toEqual(['entry.ts'])
writeFileSync(join(root, 'package.json'), duplicateKey)
await expect(collect()).rejects.toThrow('Duplicate key')
})
+12 -3
View File
@@ -1,5 +1,5 @@
import { appendFileSync, globSync, readFileSync } from 'node:fs'
import { resolve } from 'node:path'
import { isAbsolute, relative, resolve, sep } from 'node:path'
import { pathToFileURL } from 'node:url'
import { nodeServerTestPaths } from './node-server-test-paths.mjs'
import { nodeServerQualification } from './node-server-qualification.mjs'
@@ -134,8 +134,12 @@ export async function collectNodeServerInputs({ root = ROOT, entryPoints } = {})
metafile: true,
logLevel: 'silent'
})
if (result.warnings.length > 0) {
throw new Error(result.warnings.map((warning) => warning.text).join('\n'))
// esbuild parses every ancestor package.json; a checkout nested in another one must not fail on it.
const warnings = result.warnings.filter(
({ location }) => !location || isInsideRoot(root, location.file)
)
if (warnings.length > 0) {
throw new Error(warnings.map((warning) => warning.text).join('\n'))
}
return new Set([
...manifests,
@@ -145,6 +149,11 @@ export async function collectNodeServerInputs({ root = ROOT, entryPoints } = {})
])
}
function isInsideRoot(root, file) {
const path = relative(root, resolve(root, file))
return !isAbsolute(path) && path !== '..' && !path.startsWith(`..${sep}`)
}
function isSourceUnitTest(file) {
return (
/^src\/(?:[^/]+\/)*[^/]+\.test\.(?:ts|tsx)$/.test(file) &&
@@ -38,7 +38,6 @@ const cases = {
windows: {
excluded: [
'src/main/daemon/daemon-server.test.ts',
'src/main/orcad/orcad-native-preflight.test.ts',
'src/main/orcad/nested/orcad-launch.test.ts',
'src/cli/runtime/serve.test.ts',
'src/cli/runtime/nested/serve.test.ts'
@@ -392,6 +392,7 @@ function createMobileCiScopeRepository(
'config/scripts/pr-e2e-source-routing.mjs',
'config/scripts/pr-browser-e2e-source-routes.mjs',
'config/scripts/pr-editor-preview-e2e-source-routes.mjs',
'config/scripts/pr-feature-area-e2e-source-routes.mjs',
'config/scripts/pr-plugin-e2e-source-routes.mjs',
'config/scripts/pr-wsl-e2e-source-routes.mjs',
'config/scripts/ci-e2e-job-selection.mjs'
+2
View File
@@ -9,6 +9,7 @@ import { MANAGED_SSH_E2E_SPEC_PREFIX } from './ci-e2e-job-selection.mjs'
import { LAYOUT_ORACLE_E2E_SPECS } from './pr-layout-oracle-route.mjs'
import { PR_BROWSER_E2E_SOURCE_ROUTES } from './pr-browser-e2e-source-routes.mjs'
import { PR_EDITOR_PREVIEW_E2E_SOURCE_ROUTES } from './pr-editor-preview-e2e-source-routes.mjs'
import { PR_FEATURE_AREA_E2E_SOURCE_ROUTES } from './pr-feature-area-e2e-source-routes.mjs'
import { PR_PLUGIN_E2E_SOURCE_ROUTES } from './pr-plugin-e2e-source-routes.mjs'
import { PR_WSL_E2E_SOURCE_ROUTES } from './pr-wsl-e2e-source-routes.mjs'
@@ -39,6 +40,7 @@ const ENABLED_AUTOMATION_MOVE =
export const PR_E2E_SOURCE_ROUTES = [
...PR_BROWSER_E2E_SOURCE_ROUTES,
...PR_EDITOR_PREVIEW_E2E_SOURCE_ROUTES,
...PR_FEATURE_AREA_E2E_SOURCE_ROUTES,
...PR_PLUGIN_E2E_SOURCE_ROUTES,
...PR_WSL_E2E_SOURCE_ROUTES,
{
@@ -0,0 +1,97 @@
import { describe, expect, it } from 'vitest'
import { existsSync, readdirSync } from 'node:fs'
import { join, resolve } from 'node:path'
import { generalE2eShards } from './ci-e2e-job-selection.mjs'
import { selectPrE2eSpecs } from './pr-e2e-source-routing.mjs'
import { PR_FEATURE_AREA_E2E_SOURCE_ROUTES } from './pr-feature-area-e2e-source-routes.mjs'
const projectDir = resolve(import.meta.dirname, '../..')
function productSources(directory) {
return readdirSync(join(projectDir, directory), { recursive: true, withFileTypes: true })
.filter((entry) => entry.isFile() && /\.tsx?$/.test(entry.name))
.map((entry) => join(entry.parentPath, entry.name).slice(projectDir.length + 1))
.map((file) => file.split('\\').join('/'))
.filter((file) => !/\.test\.tsx?$/.test(file))
}
describe('feature area PR E2E routing', () => {
it.each([
[
'src/renderer/src/components/automations/AutomationDeleteDialogs.tsx',
'automation-runs-dashboard'
],
['src/renderer/src/components/feature-wall/AgentCapabilityStatusBadges.tsx', 'feature-wall'],
['src/renderer/src/components/sparse/SparseCheckoutPresetDraftForm.tsx', 'sparse-preset-proof'],
['src/renderer/src/components/onboarding/AgentStep.tsx', 'onboarding'],
['src/renderer/src/components/diff-comments/DiffCommentCard.tsx', 'diff-note-edit'],
[
'src/renderer/src/components/floating-terminal/FloatingTerminalEmptyState.tsx',
'floating-terminal-switch-reveal'
],
['src/main/speech/model-catalog.ts', 'voice-microphone-selection'],
['src/renderer/src/components/right-sidebar/AiVaultPanel.tsx', 'ai-vault-panel-search'],
['src/main/ai-vault-search/session-search-child-service.ts', 'ai-vault-panel-search'],
['src/main/linear/client.ts', 'linear-private-images'],
['src/renderer/src/components/task-page/jira/Content.tsx', 'jira-panel-layout'],
['src/renderer/src/components/task-page/Content.tsx', 'tasks-page'],
['src/main/project-groups/folder-workspace-path-status.ts', 'project-group-manual-sort'],
['src/renderer/src/components/stats/UsageOverviewPane.tsx', 'usage-overview'],
['src/renderer/src/components/pet/PetOverlay.tsx', 'pet-status-segment-layout'],
['src/renderer/src/components/setup-guide/SetupGuideModal.tsx', 'setup-guide-sidebar'],
[
'src/renderer/src/components/new-workspace/ComposerBaseRefPicker.tsx',
'new-workspace-create-more'
]
])('routes %s to %s', (file, spec) => {
expect(selectPrE2eSpecs([file])).toContain(`tests/e2e/${spec}.spec.ts`)
})
it('routes only to specs that exist', () => {
for (const spec of PR_FEATURE_AREA_E2E_SOURCE_ROUTES.flatMap((route) => route.specs)) {
expect(existsSync(join(projectDir, spec)), spec).toBe(true)
}
})
it('routes every product source in each owned feature directory', () => {
for (const directory of [
'src/renderer/src/components/automations',
'src/renderer/src/components/feature-wall',
'src/renderer/src/components/onboarding',
'src/renderer/src/components/diff-comments',
'src/renderer/src/components/task-page',
'src/main/ai-vault',
'src/main/linear',
'src/main/jira'
]) {
const files = productSources(directory)
expect(files.length, directory).toBeGreaterThan(0)
for (const file of files) {
expect(
PR_FEATURE_AREA_E2E_SOURCE_ROUTES.some((route) => route.matches(file)),
file
).toBe(true)
}
}
})
it('keeps any single feature directory in one changed-spec shard', () => {
for (const route of PR_FEATURE_AREA_E2E_SOURCE_ROUTES) {
expect(generalE2eShards(JSON.stringify(route.specs)), route.id).toEqual(['1/1'])
}
})
it('leaves unit tests and neighbouring sources alone', () => {
for (const file of [
'src/renderer/src/components/automations/AutomationDestinationField.test.tsx',
'src/renderer/src/components/right-sidebar/FileExplorer.tsx',
'src/main/linear-unrelated.ts',
'src/renderer/src/components/settings/GeneralPane.tsx'
]) {
expect(
PR_FEATURE_AREA_E2E_SOURCE_ROUTES.filter((route) => route.matches(file)),
file
).toEqual([])
}
})
})
@@ -0,0 +1,108 @@
import { isUnitTestSupportSource } from './pr-code-change-scope.mjs'
const isProductSource = (file) => !/\.test\.tsx?$/.test(file) && !isUnitTestSupportSource(file)
const COMPONENTS = 'src/renderer/src/components/'
/** A route for product sources under any of `prefixes` to specs that only exercise that feature. */
function featureRoute(id, specs, prefixes) {
return {
id,
specs: specs.map((name) => `tests/e2e/${name}.spec.ts`),
matches: (file) => isProductSource(file) && prefixes.some((prefix) => file.startsWith(prefix))
}
}
// Feature areas whose specs the nightly suite alone used to select (gap audit, Oct 2026).
export const PR_FEATURE_AREA_E2E_SOURCE_ROUTES = [
featureRoute(
'feature.automations-ui',
['automation-prompt-disclosure', 'automation-runs-dashboard'],
[`${COMPONENTS}automations/`]
),
featureRoute('feature.feature-wall', ['feature-wall'], [`${COMPONENTS}feature-wall/`]),
featureRoute(
'feature.sparse-checkout',
['sparse-explorer-proof', 'sparse-preset-proof'],
[`${COMPONENTS}sparse/`]
),
featureRoute(
'feature.onboarding',
['onboarding', 'onboarding-language-catalog-retry'],
[`${COMPONENTS}onboarding/`]
),
featureRoute(
'feature.diff-notes',
[
'diff-note-delete',
'diff-note-draft',
'diff-note-edit',
'diff-note-layout',
'diff-note-line-range'
],
[`${COMPONENTS}diff-comments/`]
),
featureRoute(
'feature.floating-terminal',
[
'floating-terminal-switch-reveal',
'floating-terminal-tab-rename-focus',
'floating-workspace-pane-height'
],
[`${COMPONENTS}floating-terminal/`]
),
featureRoute(
'feature.dictation',
['dictation-indicator', 'voice-microphone-selection'],
[`${COMPONENTS}dictation/`, 'src/main/speech/']
),
featureRoute(
'feature.ai-vault',
['ai-vault-panel-search', 'ai-vault-session-delete'],
[
'src/main/ai-vault/',
'src/main/ai-vault-search/',
`${COMPONENTS}right-sidebar/ai-vault-`,
`${COMPONENTS}right-sidebar/AiVault`
]
),
featureRoute(
'feature.linear',
[
'linear-filter-chip-labels',
'linear-issue-view-persistence',
'linear-private-images',
'linear-url-workspace-entry'
],
[
`${COMPONENTS}task-page/linear/`,
'src/renderer/src/store/slices/linear/',
'src/main/linear/',
'src/main/ipc/linear/',
'src/shared/linear/'
]
),
featureRoute(
'feature.jira',
['jira-panel-layout'],
[`${COMPONENTS}task-page/jira/`, 'src/main/jira/', 'src/main/ipc/jira/', 'src/shared/jira/']
),
featureRoute('feature.tasks-page', ['tasks-page'], [`${COMPONENTS}task-page/`]),
featureRoute(
'feature.project-groups',
['project-group-creation-visibility', 'project-group-manual-sort'],
['src/main/project-groups/', 'src/renderer/src/store/project-groups/']
),
featureRoute('feature.usage-overview', ['usage-overview'], [`${COMPONENTS}stats/`]),
featureRoute('feature.pet', ['pet-status-segment-layout'], [`${COMPONENTS}pet/`]),
featureRoute('feature.setup-guide', ['setup-guide-sidebar'], [`${COMPONENTS}setup-guide/`]),
featureRoute(
'feature.new-workspace',
[
'new-workspace-create-more',
'new-workspace-cross-project-dialog',
'new-workspace-linked-item-project-switch'
],
[`${COMPONENTS}new-workspace/`]
)
]
-1
View File
@@ -88,7 +88,6 @@ export const WINDOWS_BOUNDARY_TESTS = [
'src/main/wsl/wsl-guest-environment.test.ts',
'src/main/wsl/wsl-executable-path.win32.test.ts',
'src/main/claude-accounts/claude-profile-history-windows.test.ts',
'src/main/wsl/wsl-w1-w3-contract.test.ts',
'src/shared/source-scan/source-tree-scan.test.ts',
'src/main/cli/wsl-cli-powershell-boundary.test.ts',
'src/main/computer/desktop-script-runtime-host.win32.test.ts',
@@ -57,9 +57,6 @@ const EXPECTED_MATRIX = {
[`${RELEASE_WORKFLOW}#dependency-security -> .github/workflows/dependency-security.yml#rust`]: {
contents: 'read'
},
[`${RELEASE_WORKFLOW}#dependency-security -> .github/workflows/dependency-security.yml#notify`]: {
contents: 'read'
},
[`${RELEASE_WORKFLOW}#docs-production-dispatch`]: { actions: 'write' },
[`${RELEASE_WORKFLOW}#homebrew-bump`]: { contents: 'read' },
[`${RELEASE_WORKFLOW}#homebrew-bump -> .github/workflows/homebrew-bump.yml#bump-cask`]: {
@@ -0,0 +1,22 @@
import { globSync, readFileSync } from 'node:fs'
import { dirname, posix, resolve } from 'node:path'
import { expect, it } from 'vitest'
const root = resolve(import.meta.dirname, '../..')
const references = (file) =>
JSON.parse(readFileSync(resolve(root, file), 'utf8')).references.map(({ path }) =>
posix.join(posix.dirname(file), path)
)
// Unit tests transform with this pinned solution, so a project missing from it loses its compiler options.
it('lists every project tsconfig auto-discovery would find for unit-test sources', () => {
const nested = globSync('**/tsconfig.json', {
cwd: root,
exclude: ['**/node_modules/**', 'mobile/**', 'docs/**']
})
.map((file) => file.replaceAll('\\', '/'))
.filter((file) => dirname(file) !== '.')
expect(references('config/tsconfig.vitest-transform.json').sort()).toEqual(
[...nested, ...references('tsconfig.json')].sort()
)
})
+11
View File
@@ -29,6 +29,14 @@
"../mobile/src/worktree/worktree-agent-child-rows.ts",
"../src/packages/process-host/src/__fixtures__/**/*",
"../src/main/gitlab/mappers.ts",
"../src/main/source-control/hosted-review-branch-cache.ts",
"../src/main/source-control/hosted-review-active-branch-claims.ts",
"../src/main/source-control/hosted-review-unsettled-lookups.ts",
"../src/main/source-control/hosted-review-inflight-lookups.ts",
"../src/main/source-control/hosted-review-scope-generations.ts",
"../src/main/source-control/hosted-review-lookup-backoff.ts",
"../src/main/source-control/hosted-review-refresh-pacing.ts",
"../src/main/source-control/hosted-review-provider-read.ts",
"../src/main/persistence/profile-state-cutover-fixture.ts",
"../src/main/runtime/sidebar-inputs/sidebar-clock.ts",
"../src/main/runtime/sidebar-inputs/sidebar-retention-owner.ts",
@@ -60,6 +68,9 @@
"../src/main/wsl.ts",
"../src/main/wsl-interop-spawn-directory.ts",
"../src/main/wsl-exe-process.ts",
"../src/main/wsl-console-running-distros.ts",
"../src/main/wsl-registered-distro-fallback.ts",
"../src/main/wsl/wsl-distro-registry-id.ts",
"../src/main/persistence/applying-settings/ui-state-read.ts",
"../src/main/persistence/tracking-repos/worktree-identity-migration.ts",
"../src/main/persistence/tracking-repos/worktree-identity-row-repoint.ts",
+19
View File
@@ -0,0 +1,19 @@
{
"files": [],
"include": [],
"compilerOptions": { "useDefineForClassFields": true },
"references": [
{ "path": "../src/packages/process-host/tsconfig.json" },
{ "path": "../cloud/apps/connector/tsconfig.json" },
{ "path": "../cloud/apps/push/tsconfig.json" },
{ "path": "../cloud/apps/relay-fence-broker/tsconfig.json" },
{ "path": "../cloud/apps/relay/tsconfig.json" },
{ "path": "../cloud/packages/cloud-database/tsconfig.json" },
{ "path": "../cloud/packages/connector-contract/tsconfig.json" },
{ "path": "../cloud/packages/postgres-schema/tsconfig.json" },
{ "path": "../cloud/packages/push-contract/tsconfig.json" },
{ "path": "../cloud/packages/relay-contract/tsconfig.json" },
{ "path": "./tsconfig.node.json" },
{ "path": "./tsconfig.web.json" }
]
}
+2
View File
@@ -23,6 +23,8 @@ const paletteMeasurementFile =
const measurementFiles = [measurementFile, paletteMeasurementFile]
const phoneContractPattern = /\/mobile\/src\/.*\.(?:ts|tsx)(?:\?.*)?$/
const transforms = {
// Auto-discovery climbs past the repo for files no in-repo tsconfig owns, into an enclosing checkout.
tsconfig: resolve(import.meta.dirname, 'tsconfig.vitest-transform.json'),
oxc: { exclude: [/\.js$/, phoneContractPattern] },
plugins: [
{
+2 -1
View File
@@ -55,7 +55,8 @@ The exact release the catalog vouches for. Orca refuses bytes that differ.
| `types` | (`"interface-language"` \| `"app-theme"` \| `"terminal-theme"` \| `"icon-theme"` \| `"syntax"` \| `"instructions"` \| `"panel"` \| `"editor"` \| `"worker"`)[] | no | 1.4.245 | Optional; Orca derives it from `contributes` and `execution`. When present, every kind of contribution the release carries, matching its manifest exactly. `instructions` needs the `declarative` profile or higher, `panel` and `editor` need `sandboxed-ui`, and `worker` needs `trusted-worker`. Example: `["syntax"]` |
| `name` | string | no | 1.4.245 | The manifest's `name`, so Orca can suggest the plugin before downloading it. Example: `"Gleam"` |
| `license` | string | no | 1.4.245 | SPDX license expression. Example: `"MIT"` |
| `repository` | string | no | 1.4.245 | Source repository page, https only. Example: `"https://github.com/acme/orca-gleam-syntax"` |
| `repository` | string | no | 1.4.245 | Source repository page, https only. Orca links it when it is a github.com or gitlab.com repository of the plugin's publisher. Example: `"https://github.com/acme/orca-gleam-syntax"` |
| `sourceUnavailable` | `true` | no | 1.4.246 | Set when the release's `repository` is gone and `source` serves an archived copy, so Orca links `source` instead. Example: `true` |
| `homepage` | string | no | 1.4.245 | Project homepage, https only. Example: `"https://example.com/gleam"` |
| `updatedAt` | string | no | 1.4.245 | When this release was published, as an ISO 8601 date or date-time. Example: `"2026-10-20"` |
| `changelog` | string | no | 1.4.245 | What changed in this release, as plain text. At most 2000 characters. Example: `"Adds highlighting for use expressions."` |
+49
View File
@@ -82,3 +82,52 @@ later) in the same shape as a VS Code theme's, so most VS Code theme lists paste
Colors are hex. A palette needs `background`, `foreground` and at least one ANSI color. When a
user selects it, Orca saves a copy of the palette in settings so hosts, headless servers and
relays answer terminal color queries without the plugin loaded.
## Icon themes
`contributes.iconThemes` points at a JSON file that maps files and folders to SVG icons. Paths
are relative to the plugin root. The map names match the common JSON file icon theme format.
To port such a theme, keep the keys you want and replace each value: those themes map a key
to an icon definition ID, while Orca needs the SVG file's path, which is that definition's
`iconPath`. Large themes have far more entries than the 512-mapping limit, so pick the most
common names.
```json
{
"schemaVersion": 1,
"icons": {
"file": "icons/file.svg",
"folder": "icons/folder.svg",
"folder-open": "icons/folder-open.svg"
},
"fileNames": { "readme.md": "icons/readme.svg" },
"fileExtensions": { "ts": "icons/typescript.svg", "d.ts": "icons/typescript-def.svg" },
"folderNames": { "src": "icons/folder-src.svg", "docs": "icons/folder-docs.svg" },
"folderNamesExpanded": {
"src": "icons/folder-src-open.svg",
"docs": "icons/folder-docs-open.svg"
}
}
```
- `icons` holds the generic `file`, `folder` and `folder-open` icons.
- For a file, Orca checks `fileNames`, then the longest matching `fileExtensions` key (so
`d.ts` beats `ts`), then `icons.file`.
- For a folder, Orca matches the folder's own name, not its path. A closed folder checks
`folderNames`, then `icons.folder`. An open folder checks `folderNamesExpanded`, then
`icons["folder-open"]`, then falls back like a closed folder. If you set `folder-open`, give
each named folder an expanded icon too, or it shows the generic open folder when expanded.
Orca releases up to 1.4.245 ignore `folderNames` and `folderNamesExpanded`. They show only
the generic icons, and an open folder without `folder-open` gets Orca's built-in icon.
- Keys are case-insensitive. Two keys that differ only in case are refused. Name keys can't
contain `/` or `\`, so keys qualified by a parent folder (`src/components`) are not
supported.
- These icons appear in the file explorer, Source Control, diff and conflict file trees, tabs,
Quick Open, search results and the remote folder browser.
- The theme file can be at most 64 KiB. A theme can have at most 512 mappings across all maps
and 512 distinct SVGs. Each SVG can be at most 64 KiB, and all of a theme's SVGs together at
most 4 MiB. An SVG painted only with `currentColor` takes the row's text color. Any other SVG
keeps its own colors.
- `rootFolder`, `rootFolderNames`, `languageIds` and font icons aren't supported.
Orca's explorer has no workspace-root row for a root icon. `pnpm validate:plugin` flags these
keys, and Orca skips them at runtime.
@@ -261,7 +261,7 @@
"pattern": "^\\(?[A-Za-z0-9][A-Za-z0-9.+-]*(?: (?:AND|OR|WITH) \\(?[A-Za-z0-9][A-Za-z0-9.+-]*\\)?)*\\)?$"
},
"repository": {
"description": "Source repository page, https only.",
"description": "Source repository page, https only. Orca links it when it is a github.com or gitlab.com repository of the plugin's publisher.",
"x-orca-since": "1.4.245",
"examples": [
"https://github.com/acme/orca-gleam-syntax"
@@ -270,6 +270,15 @@
"maxLength": 2048,
"pattern": "^https:\\/\\/\\S+$"
},
"sourceUnavailable": {
"description": "Set when the release's `repository` is gone and `source` serves an archived copy, so Orca links `source` instead.",
"x-orca-since": "1.4.246",
"examples": [
true
],
"type": "boolean",
"const": true
},
"homepage": {
"description": "Project homepage, https only.",
"x-orca-since": "1.4.245",
+5 -5
View File
@@ -22,7 +22,7 @@ Use it when you need ownership, completion tracking, or a DAG. For one-off promp
## Output
Every orchestration command prints a short view by default: the IDs and state the next command needs, with the next step last. `--json` prints the same fields as one line of JSON (`{"ok":true,"result":{...}}`). `--full` prints the complete record Orca returned, as text or with `--json` as pretty JSON. A failed or unconfirmed outcome exits non-zero and writes `error: <code>: <message>` to stderr.
Every orchestration command prints a short view by default: the IDs and state the next command needs, with the next step last. `--json` prints the same fields as one line of JSON (`{"ok":true,"result":{...}}`). `--full --json` prints the complete record Orca returned as pretty JSON; `--full` alone prints the longer text receipt. A failed or unconfirmed outcome exits non-zero and writes `error: <code>: <message>` to stderr.
## Core model
@@ -48,7 +48,7 @@ orca orchestration worker-start --task <taskId> --worktree new-child --name bill
orca orchestration worker-start --task <taskId> --worktree current --agent claude --model <opaque-model-id> --effort high
```
`--agent` takes any Orca agent ID enabled on the worker server, for example `claude`, `codex`, `cursor`, `antigravity`, `muse`, `opencode`, or `opencode2`. `--model` accepts opaque provider model IDs for Claude, Codex, Cursor, Antigravity, Grok, and Muse (for example `--agent muse --model muse-spark-1.3`); OpenCode accepts a per-launch model only in an existing worktree, when the execution host verifies its CLI version and model availability; OpenCode effort remains unsupported. Other agents run the model from their own config. `--effort` requires `--model` and only applies when that agent/model supports the level. Neither flag can combine with `--terminal` (reuse an existing pane). Overrides apply to that launch only and show as `model` / `effort` in the start receipt (`--full` shows `launch.requested` / `launch.effective`). Federated starts need a worker host that advertises launch-preference support.
`--agent` takes any Orca agent ID enabled on the worker server, for example `claude`, `codex`, `cursor`, `antigravity`, `muse`, `opencode`, or `opencode2`. `--model` accepts opaque provider model IDs for Claude, Codex, Cursor, Antigravity, Grok, and Muse (for example `--agent muse --model muse-spark-1.3`); OpenCode accepts a per-launch model only in an existing worktree, when the execution host verifies its CLI version and model availability; OpenCode effort remains unsupported. Other agents run the model from their own config. `--effort` requires `--model` and only applies when that agent/model supports the level. Neither flag can combine with `--terminal` (reuse an existing pane). Overrides apply to that launch only and show as `model` / `effort` in the start receipt (`--full --json` shows `launch.requested` / `launch.effective`). Federated starts need a worker host that advertises launch-preference support.
After starting workers, end your turn. Orca wakes the coordinator when a worker reports, asks, or stops; run the `check` command the wake gives you and handle every message it prints:
@@ -80,8 +80,8 @@ orca orchestration worker-stop --dispatch <dispatchId>
# After an accepted worker_done: reuse the same terminal for a follow-up Dispatch, or release it
# (archives inspectable output, then closes only that coordinator-owned agent terminal):
orca orchestration worker-release --dispatch <dispatchId>
# Keep a settled worker live for debugging when the user asked to retain it:
orca orchestration worker-retain --dispatch <dispatchId>
# Keep a worker open after it finishes (or start it with worker-start --keep-open):
orca orchestration worker-keep-open --dispatch <dispatchId>
# retry placement is explicit — --retry-of does not inherit --on/worktree:
orca orchestration worker-start --task <taskId> --retry-of <dispatchId> --worktree current --agent codex
```
@@ -115,7 +115,7 @@ orca orchestration dispatch --task <taskId> --to <workerHandle> --inject
## Messaging notes
- Default `check` returns the bound Run's oldest unread mail as one Delivery (FIFO) and marks it handled. `--ack <deliveryId>` acknowledges a Delivery from an older Orca that does not mark it; alone it reads no new mail, and with `--wait` it then waits for and takes the next Delivery.
- `--peek` / `--all` do not consume mail and return no `deliveryId`, so they do not drain a mailbox on their own. `--all` and a Run `--peek` show at most 100 rows. To drain, repeat plain `check` until it prints `No messages.` (with `--json`, until `messages` is empty).
- `--peek` / `--all` do not consume mail and return no `deliveryId`, so they do not drain a mailbox on their own. `--all` and a Run `--peek` show at most 100 rows. To drain, repeat plain `check` until it prints `No messages.` (with `--json`, until `messages` is empty); on an older Orca that asks for `--ack <deliveryId>`, ack each Delivery first or `check` returns it again.
- Group addresses: `@all`, `@idle`, `@claude`, `@codex`, `@opencode`, `@gemini`, `@droid`, `@grok`, `@cursor`, `@worktree:<id>` — never for `worker_done`.
- Every group except `@worktree:<id>` means the live Dispatches of the sender's own Run, delivered to their Dispatch mailboxes (or child Run mailboxes for nested coordinators). A sender in no Run is refused; `--run` must match the audience and never grants membership.
- Run groups exclude their owning coordinator. A worker raising a blocker sends to `run:<id>`. `@worktree:<id>` includes coordinators in that workspace.
+6 -1
View File
@@ -1,6 +1,6 @@
import { useRef, type ReactNode } from 'react'
import { ActivityIndicator, View, Text, Pressable, StyleSheet } from 'react-native'
import { Edit3, Trash2, type LucideIcon } from 'lucide-react-native'
import { Check, Edit3, Trash2, type LucideIcon } from 'lucide-react-native'
import { colors, radii, spacing, typography } from '../theme/mobile-theme'
import { themedStyleSheet } from '../theme/themed-styles'
import { useMobileColorScheme } from '../theme/use-mobile-color-scheme'
@@ -14,6 +14,8 @@ export type ActionSheetAction = {
destructive?: boolean
disabled?: boolean
hint?: string
/** Marks the choice that is current, as a trailing check. */
checked?: boolean
loading?: boolean
skipAutoClose?: boolean
closeBeforePress?: boolean
@@ -78,6 +80,7 @@ export function ActionSheetContent({ title, message, children, actions, onClose
pressed && !action.disabled && !action.loading && styles.actionPressed
]}
disabled={action.disabled || action.loading}
accessibilityState={action.checked ? { checked: true } : undefined}
onPress={() => {
action.onPress()
if (!action.skipAutoClose && onClose) {
@@ -105,6 +108,8 @@ export function ActionSheetContent({ title, message, children, actions, onClose
</View>
{action.loading ? (
<ActivityIndicator size="small" color={colors.textSecondary} />
) : action.checked ? (
<Check size={18} color={colors.textPrimary} />
) : null}
</Pressable>
</View>
@@ -1,19 +1,25 @@
import { ActivityIndicator, Pressable } from 'react-native'
import { ArrowUp } from 'lucide-react-native'
import { ArrowUp, type LucideIcon } from 'lucide-react-native'
import { colors } from '../../theme/mobile-theme'
import { useMobileColorScheme } from '../../theme/use-mobile-color-scheme'
import { composerInputStyles as styles } from './composer-input-styles'
export function ComposerSendButton({
onPress,
onLongPress,
canSend,
sending = false,
label = 'Send'
label = 'Send',
icon: Icon = ArrowUp
}: {
onPress: () => void
/** A hold offers more ways to send; absent, a hold is a plain press. */
onLongPress?: () => void
canSend: boolean
sending?: boolean
label?: string
/** What a tap does when it isn't a plain send. */
icon?: LucideIcon
}): React.JSX.Element {
useMobileColorScheme()
const enabled = canSend && !sending
@@ -30,12 +36,13 @@ export function ComposerSendButton({
pressed && enabled && styles.pressed
]}
onPress={onPress}
onLongPress={onLongPress}
disabled={!enabled}
>
{sending ? (
<ActivityIndicator size="small" color={colors.bgBase} />
) : (
<ArrowUp size={19} color={canSend ? colors.bgBase : colors.textMuted} strokeWidth={2.4} />
<Icon size={19} color={canSend ? colors.bgBase : colors.textMuted} strokeWidth={2.4} />
)}
</Pressable>
)
+5 -1
View File
@@ -186,7 +186,11 @@
"cancelEditing": "Bearbeitung abbrechen",
"placeholder": "Frage stellen, @ für Dateiverweise, / für Befehle",
"saveEditedMessage": "Bearbeitete Nachricht speichern",
"sendMessage": "Nachricht senden"
"sendMessage": "Nachricht senden",
"sendQueue": "Einreihen",
"sendSteer": "Steuern",
"sendQueueHint": "Läuft nach dem aktuellen Durchgang",
"sendSteerHint": "Fließt in das ein, was der Agent gerade tut"
},
"composerAttachments": {
"attachedImage": "Angehängtes Bild",
+5 -1
View File
@@ -2550,7 +2550,11 @@
"placeholder": "Ask anything, @ to mention files, / for commands",
"cancelEditing": "Cancel editing",
"saveEditedMessage": "Save edited message",
"sendMessage": "Send message"
"sendMessage": "Send message",
"sendQueue": "Queue",
"sendSteer": "Steer",
"sendQueueHint": "Runs after the current turn",
"sendSteerHint": "Goes into what the agent is doing now"
},
"composerAttachments": {
"file": "File",
+5 -1
View File
@@ -190,7 +190,11 @@
"cancelEditing": "Cancelar edición",
"placeholder": "Pregunta lo que quieras, @ para referenciar archivos, / para comandos",
"saveEditedMessage": "Guardar mensaje editado",
"sendMessage": "Enviar mensaje"
"sendMessage": "Enviar mensaje",
"sendQueue": "Poner en cola",
"sendSteer": "Enviar ahora",
"sendQueueHint": "Se ejecuta después del turno actual",
"sendSteerHint": "Entra en lo que el agente está haciendo ahora"
},
"composerAttachments": {
"attachedImage": "Imagen adjunta",
+5 -1
View File
@@ -190,7 +190,11 @@
"cancelEditing": "Annuler la modification",
"placeholder": "Posez votre question, @ pour référencer des fichiers, / pour les commandes",
"saveEditedMessage": "Enregistrer le message modifié",
"sendMessage": "Envoyer le message"
"sendMessage": "Envoyer le message",
"sendQueue": "Mettre en file d’attente",
"sendSteer": "Envoyer maintenant",
"sendQueueHint": "S’exécute après le tour en cours",
"sendSteerHint": "S’ajoute à ce que l’agent fait en ce moment"
},
"composerAttachments": {
"attachedImage": "Image jointe",
+5 -1
View File
@@ -186,7 +186,11 @@
"cancelEditing": "編集をキャンセル",
"placeholder": "何でも聞いてください。@ でファイルを参照、/ でコマンドを実行",
"saveEditedMessage": "編集したメッセージを保存",
"sendMessage": "メッセージを送信"
"sendMessage": "メッセージを送信",
"sendQueue": "キューに入れる",
"sendSteer": "今すぐ送信",
"sendQueueHint": "現在のターンの後に実行します",
"sendSteerHint": "Agent が今行っている作業に加えます"
},
"composerAttachments": {
"attachedImage": "添付画像",
+5 -1
View File
@@ -186,7 +186,11 @@
"cancelEditing": "편집 취소",
"placeholder": "무엇이든 물어보세요. @로 파일 참조, /로 명령어 실행",
"saveEditedMessage": "수정한 메시지 저장",
"sendMessage": "메시지 보내기"
"sendMessage": "메시지 보내기",
"sendQueue": "대기열에 추가",
"sendSteer": "지금 보내기",
"sendQueueHint": "현재 턴이 끝난 뒤 실행됩니다",
"sendSteerHint": "Agent가 지금 하고 있는 작업에 들어갑니다"
},
"composerAttachments": {
"attachedImage": "첨부된 이미지",
+5 -1
View File
@@ -190,7 +190,11 @@
"cancelEditing": "Cancelar edição",
"placeholder": "Pergunte o que quiser, @ para mencionar arquivos, / para comandos",
"saveEditedMessage": "Salvar mensagem editada",
"sendMessage": "Enviar mensagem"
"sendMessage": "Enviar mensagem",
"sendQueue": "Colocar na fila",
"sendSteer": "Orientar",
"sendQueueHint": "Executa depois do turno atual",
"sendSteerHint": "Entra no que o agente está fazendo agora"
},
"composerAttachments": {
"attachedImage": "Imagem anexada",
+5 -1
View File
@@ -194,7 +194,11 @@
"cancelEditing": "Отменить редактирование",
"placeholder": "Задайте вопрос; @ — файлы, / — команды",
"saveEditedMessage": "Сохранить изменённое сообщение",
"sendMessage": "Отправить сообщение"
"sendMessage": "Отправить сообщение",
"sendQueue": "В очередь",
"sendSteer": "Направить",
"sendQueueHint": "Выполнится после текущего хода",
"sendSteerHint": "Попадёт в то, что агент делает сейчас"
},
"composerAttachments": {
"attachedImage": "Прикреплённое изображение",
+5 -1
View File
@@ -186,7 +186,11 @@
"cancelEditing": "Düzenlemeyi iptal et",
"placeholder": "Bir şey sorun; dosyalara başvurmak için @, komutlar için / kullanın",
"saveEditedMessage": "Düzenlenen mesajı kaydet",
"sendMessage": "Mesaj gönder"
"sendMessage": "Mesaj gönder",
"sendQueue": "Sıraya al",
"sendSteer": "Yönlendir",
"sendQueueHint": "Geçerli tur bittikten sonra çalışır",
"sendSteerHint": "Ajanın şu anda yaptığı işe katılır"
},
"composerAttachments": {
"attachedImage": "Ekli görsel",
+5 -1
View File
@@ -186,7 +186,11 @@
"cancelEditing": "取消編輯",
"placeholder": "隨心輸入,@ 引用檔案,/ 使用命令",
"saveEditedMessage": "儲存編輯後的訊息",
"sendMessage": "傳送訊息"
"sendMessage": "傳送訊息",
"sendQueue": "加入佇列",
"sendSteer": "引導",
"sendQueueHint": "在目前回合結束後執行",
"sendSteerHint": "加入代理程式目前正在進行的工作"
},
"composerAttachments": {
"attachedImage": "已附加的圖片",
+5 -1
View File
@@ -186,7 +186,11 @@
"cancelEditing": "取消编辑",
"placeholder": "随心输入,@ 引用文件,/ 使用命令",
"saveEditedMessage": "保存编辑后的消息",
"sendMessage": "发送消息"
"sendMessage": "发送消息",
"sendQueue": "加入队列",
"sendSteer": "立即发送",
"sendQueueHint": "在当前回合结束后运行",
"sendSteerHint": "加入智能体当前正在进行的工作"
},
"composerAttachments": {
"attachedImage": "已添加的图片",
@@ -96,7 +96,8 @@ export function MobileNativeChatOverlay({
onResume: queued.resume,
sessionKey: queued.sessionKey,
// Hold steering while Stop ends the turn; use the session’s single display-status decision.
steerHeld: controller.nativeChatTurnIndicator?.stopping === true
steerHeld: controller.nativeChatTurnIndicator?.stopping === true,
agentWorking: controller.nativeChatTurnActive
},
backgroundTasks: controller.nativeChatBackgroundTasks
})
@@ -192,6 +193,7 @@ export function MobileNativeChatOverlay({
agentWorking={controller.nativeChatTurnActive}
awaitingInput={controller.nativeChatAwaitingInput}
canStop={controller.nativeChatCanStop}
sendFollowUp={controller.nativeChatSendFollowUp}
structuredActivityUi={controller.nativeChatStructured}
turnIndicator={controller.nativeChatTurnIndicator}
workingStartedAt={controller.nativeChatWorkingStartedAt}
@@ -48,6 +48,8 @@ vi.mock('lucide-react-native', () =>
[
'ArrowDown',
'ArrowUp',
'ListEnd',
'CornerDownRight',
'ChevronDown',
'ChevronUp',
'ChevronsDownUp',
+6 -5
View File
@@ -49,6 +49,7 @@ import { MobileNativeChatFloatingControls } from './MobileNativeChatFloatingCont
import type { PendingNativeChatImage } from './native-chat/composer/mobile-native-chat-image-attachment'
import {
MobileNativeChatDraftComposer,
type MobileNativeChatSendProps,
type MobileNativeChatStructuredComposer
} from './native-chat/composer/MobileNativeChatComposer'
import { MobileNativeChatPromptCard } from './native-chat/input/MobileNativeChatPromptCard'
@@ -71,7 +72,7 @@ export type MobileNativeChatInputLockReason = 'disconnected' | 'waiting'
type Props = ComposerTrayProps & MobileNativeChatMicProps & ChatViewProps
type ChatViewProps = {
type ChatViewProps = MobileNativeChatSendProps & {
// Keep raw messages to distinguish loading from a loaded transcript filtered to empty.
messages: NativeChatMessage[]
folded: NativeChatMessage[]
@@ -98,7 +99,6 @@ type ChatViewProps = {
hasMore?: boolean
olderPages?: OlderPagePhase
onLoadEarlier?: () => void
onSend: (text: string) => Promise<boolean>
// Fence send completion by route identity after tab/view switches.
sendSurfaceId: string
getSendCompletionGeneration: () => number
@@ -154,6 +154,7 @@ export function MobileNativeChatView({
sessionLive,
agentWorking,
canStop = agentWorking,
sendFollowUp,
awaitingInput = null,
structuredActivityUi = false,
turnIndicator = null,
@@ -236,8 +237,8 @@ export function MobileNativeChatView({
const { jumpToTail, recordScrollMetrics, scrollMayLoadEarlier } = tail
const handleSend = useCallback(
async (text: string): Promise<boolean> => {
const accepted = await onSend(text)
async (...send: Parameters<typeof onSend>): Promise<boolean> => {
const accepted = await onSend(...send)
if (!accepted) {
return false
}
@@ -400,7 +401,7 @@ export function MobileNativeChatView({
onChangeText={onComposerTextChange}
onSend={handleSend}
sendSurfaceId={sendSurfaceId}
{...{ getSendCompletionGeneration, getComposerEditGeneration, inputRef }}
{...{ getSendCompletionGeneration, getComposerEditGeneration, inputRef, sendFollowUp }}
agent={agent}
sessionOptions={sessionOptions}
onAttachImage={onAttachImage}
@@ -27,6 +27,8 @@ type QueuedMessageCardRowProps = {
busy: boolean
editBlocked: boolean
steerHeld: boolean
/** Steer only into a running turn; an idle agent's card reads Send. */
agentWorking: boolean
onSend: () => void
onDelete: () => void
onMore: () => void
@@ -59,6 +61,7 @@ function QueuedMessageCardContents({
busy,
editBlocked,
steerHeld,
agentWorking,
onSend,
onDelete,
onMore,
@@ -68,7 +71,7 @@ function QueuedMessageCardContents({
const t = useMobileTranslation()
const [expanded, setExpanded] = useState(false)
const returned = card.state === 'returned'
const steers = queuedMessageCardSteers(card)
const steers = agentWorking && queuedMessageCardSteers(card)
const count = card.images?.length ?? 0
return (
<View testID="queued-card-row" style={[styles.card, styles.divided]}>
@@ -156,7 +156,7 @@ function Harness(props: HarnessProps) {
controller: current,
onOpenFile: vi.fn(),
images: {
sendNativeChat: controller.handleNativeChatSend,
sendNativeChat: (text: string) => controller.handleNativeChatSend(text),
attachments: [],
isAttaching: false,
attachImage: async () => {},
@@ -40,6 +40,8 @@ vi.mock('lucide-react-native', () =>
[
'ArrowDown',
'ArrowUp',
'ListEnd',
'CornerDownRight',
'ChevronDown',
'ChevronUp',
'ChevronsDownUp',
@@ -31,6 +31,8 @@ vi.mock('react-native', async () => {
})
vi.mock('lucide-react-native', () => ({
ArrowUp: 'ArrowUp',
ListEnd: 'ListEnd',
CornerDownRight: 'CornerDownRight',
Check: 'Check',
ChevronDown: 'ChevronDown',
ChevronLeft: 'ChevronLeft',
@@ -24,6 +24,8 @@ vi.mock('react-native', async () => {
})
vi.mock('lucide-react-native', () => ({
ArrowUp: 'ArrowUp',
ListEnd: 'ListEnd',
CornerDownRight: 'CornerDownRight',
Check: 'Check',
ChevronDown: 'ChevronDown',
ChevronLeft: 'ChevronLeft',
@@ -0,0 +1,295 @@
import { act, create, type ReactTestRenderer } from 'react-test-renderer'
import { afterEach, expect, it, vi } from 'vitest'
import { mobileNativeChatFollowUpPreference } from './mobile-native-chat-follow-up-preference'
import { useMobileNativeChatQueueFollowUps } from './use-mobile-native-chat-queue-follow-ups'
import { createStableLogicalRpcClient } from '../transport/stable-logical-rpc-client'
import { scopeRpcClientToExecutionHost } from '../transport/execution-host-scoped-rpc-client'
import type { RpcClient } from '../transport/rpc-client'
import type { ConnectionState, RpcResponse } from '../transport/types'
function connection() {
let state: ConnectionState = 'connected'
let generation = 0
const callbacks: ((event: unknown) => void)[] = []
const states = new Set<(state: ConnectionState) => void>()
const stops = vi.fn()
const replies: ((reply: RpcResponse) => void)[] = []
const failures: ((reason: Error) => void)[] = []
const sendRequest = vi.fn<RpcClient['sendRequest']>(
() =>
new Promise((resolve, reject) => {
replies.push(resolve)
failures.push(reject)
})
)
const client: RpcClient = {
sendRequest,
subscribe: vi.fn((_method, _params, callback) => {
callbacks.push(callback)
return stops
}),
onStateChange: (callback) => {
states.add(callback)
return () => {
states.delete(callback)
}
},
getState: () => state,
getGeneration: () => generation,
getReconnectAttempt: () => 0,
getLastConnectedAt: () => null,
notifyForeground: () => {},
close: () => {},
updateTerminalSubscriptionViewport: () => {}
}
return {
client,
stops,
replies,
failures,
callbacks,
states,
emit: (event: unknown) => callbacks.at(-1)?.(event),
change: (next: ConnectionState, migrate = false) => {
state = next
if (migrate) {
generation++
}
for (const callback of states) {
callback(state)
}
}
}
}
const reply = (queueFollowUps: boolean): RpcResponse => ({
id: 'r',
ok: true,
result: { settings: { nativeChatQueueFollowUps: queueFollowUps } },
_meta: { runtimeId: 'r' }
})
const renderers = new Set<ReactTestRenderer>()
afterEach(() => {
act(() => {
for (const renderer of renderers) {
renderer.unmount()
}
})
renderers.clear()
})
it('shares one live scalar per connection, fences late reads/events, and isolates real hook renders', async () => {
const a = connection(),
b = connection()
const renders = new Map<string, number>()
const values = new Map<string, boolean>()
function Chat({ id, client }: { id: string; client: RpcClient }) {
values.set(id, useMobileNativeChatQueueFollowUps(client, true, id))
renders.set(id, (renders.get(id) ?? 0) + 1)
return null
}
let mounted: ReactTestRenderer | undefined
await act(async () => {
mounted = create(
<>
<Chat id="a1" client={a.client} />
<Chat id="a2" client={a.client} />
<Chat id="b" client={b.client} />
</>
)
renderers.add(mounted)
})
await act(async () => {})
expect(a.client.subscribe).toHaveBeenCalledTimes(1)
expect(b.client.subscribe).toHaveBeenCalledTimes(1)
const before = new Map(renders)
for (const count of [10, 100]) {
for (let index = 0; index < count; index++) {
await act(async () => a.emit({ type: 'workspaceViewChanged' }))
}
expect(renders).toEqual(before)
expect(a.client.sendRequest).toHaveBeenCalledTimes(1)
expect(a.client.subscribe).toHaveBeenCalledTimes(1)
}
await act(async () =>
a.emit({
type: 'ready',
subscriptionId: 'a',
snapshot: { nativeChatQueueFollowUps: true }
})
)
expect(values.get('a1')).toBe(true)
expect(values.get('a2')).toBe(true)
expect(values.get('b')).toBe(true)
expect(renders.get('b')).toBe(before.get('b'))
const after = new Map(renders)
await act(async () => a.emit({ type: 'ready', subscriptionId: 'old-no-projection' }))
await act(async () => a.emit({ type: 'nativeChatQueueFollowUpsChanged', queueFollowUps: true }))
expect(renders).toEqual(after)
await act(async () => a.replies[1]!(reply(false)))
expect(values.get('a1')).toBe(true)
await act(async () => a.replies[0]!(reply(false)))
expect(values.get('a1')).toBe(true)
const beforeOff = new Map(renders)
await act(async () => a.emit({ type: 'nativeChatQueueFollowUpsChanged', queueFollowUps: false }))
expect(values.get('a1')).toBe(false)
expect(values.get('a2')).toBe(false)
expect(renders.get('a1')).toBe(beforeOff.get('a1')! + 1)
expect(renders.get('a2')).toBe(beforeOff.get('a2')! + 1)
expect(renders.get('b')).toBe(before.get('b'))
const oldEvent = a.callbacks[0]!
await act(async () => a.change('disconnected'))
await act(async () => a.change('connected'))
const beforeOn = new Map(renders)
await act(async () =>
a.emit({
type: 'ready',
subscriptionId: 'a2',
snapshot: { nativeChatQueueFollowUps: true }
})
)
expect(values.get('a1')).toBe(true)
expect(values.get('a2')).toBe(true)
expect(renders.get('a1')).toBe(beforeOn.get('a1')! + 1)
expect(renders.get('a2')).toBe(beforeOn.get('a2')! + 1)
expect(renders.get('b')).toBe(beforeOn.get('b'))
await act(async () =>
oldEvent({ type: 'nativeChatQueueFollowUpsChanged', queueFollowUps: false })
)
expect(values.get('a1')).toBe(true)
const previousTransportEvent = a.callbacks.at(-1)!
await act(async () => a.change('connected', true))
expect(values.get('a1')).toBe(true)
await act(async () =>
previousTransportEvent({ type: 'nativeChatQueueFollowUpsChanged', queueFollowUps: false })
)
expect(values.get('a1')).toBe(true)
// Old host ready uses the existing read fallback; latest read wins.
await act(async () => a.emit({ type: 'ready', subscriptionId: 'old' }))
await act(async () => a.replies.at(-1)!(reply(true)))
expect(values.get('a1')).toBe(true)
await act(async () => a.replies[2]!(reply(false)))
expect(values.get('a1')).toBe(true)
await act(async () => mounted?.unmount())
expect(a.states.size).toBe(0)
expect(b.states.size).toBe(0)
expect(a.stops).toHaveBeenCalledTimes(3)
expect(b.stops).toHaveBeenCalledTimes(1)
})
it('existing phone workspace event reader ignores additive preference snapshot and events', async () => {
const { startHostWorktreeRefresh } = await import('../worktree/host-worktree-refresh')
const host = connection()
const fetchWorktrees = vi.fn(async () => {}),
fetchRepoMetadata = vi.fn(async () => {}),
syncViewSettings = vi.fn(async () => {})
const stop = startHostWorktreeRefresh({
client: host.client,
fetchWorktrees,
fetchRepoMetadata,
syncViewSettings,
appState: { currentState: 'active', addEventListener: () => ({ remove: () => {} }) }
})
const counts = [
fetchWorktrees.mock.calls.length,
fetchRepoMetadata.mock.calls.length,
syncViewSettings.mock.calls.length
]
host.emit({
type: 'ready',
subscriptionId: 'old',
snapshot: { nativeChatQueueFollowUps: true }
})
host.emit({ type: 'nativeChatQueueFollowUpsChanged', queueFollowUps: false })
expect([
fetchWorktrees.mock.calls.length,
fetchRepoMetadata.mock.calls.length,
syncViewSettings.mock.calls.length
]).toEqual(counts)
stop()
})
it('keeps known OFF across real direct/relay migrations and failed reads, while scoped hosts start Queue', async () => {
const direct = connection(),
relay = connection(),
directAgain = connection()
const logical = createStableLogicalRpcClient(direct.client, 'lan')
const values = new Map<string, boolean>()
function Chat({ id, client }: { id: string; client: RpcClient | null }) {
values.set(id, useMobileNativeChatQueueFollowUps(client, true, id))
return null
}
let mounted!: ReactTestRenderer
await act(async () => {
mounted = create(
<>
<Chat id="same" client={logical} />
<Chat id="unknown" client={null} />
</>
)
renderers.add(mounted)
})
expect(values.get('same')).toBe(true)
expect(values.get('unknown')).toBe(true)
await act(async () =>
direct.emit({
type: 'ready',
subscriptionId: 'd',
snapshot: { nativeChatQueueFollowUps: false }
})
)
await act(async () => direct.replies[0]!(reply(true)))
expect(values.get('same')).toBe(false)
await act(async () => logical.migrateTo(relay.client, 'relay'))
expect(values.get('same')).toBe(false)
await act(async () => relay.failures[0]!(new Error('read failed')))
expect(values.get('same')).toBe(false)
await act(async () =>
direct.emit({ type: 'nativeChatQueueFollowUpsChanged', queueFollowUps: true })
)
expect(values.get('same')).toBe(false)
// Ready ON also fences an older OFF read.
await act(async () => relay.emit({ type: 'ready', subscriptionId: 'legacy' }))
await act(async () =>
relay.emit({ type: 'ready', subscriptionId: 'r', snapshot: { nativeChatQueueFollowUps: true } })
)
await act(async () => relay.replies.at(-1)!(reply(false)))
expect(values.get('same')).toBe(true)
await act(async () =>
relay.emit({ type: 'nativeChatQueueFollowUpsChanged', queueFollowUps: false })
)
await act(async () => logical.migrateTo(directAgain.client, 'lan'))
expect(values.get('same')).toBe(false)
await act(async () => directAgain.failures[0]!(new Error('read failed')))
expect(values.get('same')).toBe(false)
const sameHostEvent = directAgain.callbacks.at(-1)!
const other = scopeRpcClientToExecutionHost(logical, 'runtime:other')
await act(async () =>
mounted.update(
<>
<Chat id="same" client={logical} />
<Chat id="other" client={other} />
</>
)
)
expect(values.get('other')).toBe(true)
expect(values.get('same')).toBe(false)
await act(async () =>
directAgain.emit({ type: 'nativeChatQueueFollowUpsChanged', queueFollowUps: false })
)
await act(async () =>
sameHostEvent({ type: 'nativeChatQueueFollowUpsChanged', queueFollowUps: true })
)
expect(values.get('same')).toBe(true)
expect(values.get('other')).toBe(false)
await act(async () =>
sameHostEvent({ type: 'nativeChatQueueFollowUpsChanged', queueFollowUps: false })
)
await act(async () => mounted.unmount())
// Late callbacks after last unsubscribe cannot replace the retained same-host value.
directAgain.emit({ type: 'nativeChatQueueFollowUpsChanged', queueFollowUps: true })
expect(mobileNativeChatFollowUpPreference(logical).getSnapshot()).toBe(false)
expect(directAgain.states.size).toBe(1) // Only the logical transport's own state listener remains.
logical.close()
expect(directAgain.states.size).toBe(0)
})
@@ -1,4 +1,5 @@
import type { NativeChatSkillDiscoverySnapshot } from '../../../src/shared/native-chat/input/native-chat-picker-items'
import type { NativeChatSendFollowUp } from '../../../src/shared/native-chat-follow-up-behavior'
import type { StructuredMobileSendAttachment } from './use-mobile-structured-send-with-outcome'
import type { MobileSessionView } from '../storage/session-view-preferences'
import type { Dispatch, MutableRefObject, SetStateAction } from 'react'
@@ -13,7 +14,10 @@ import type {
import type { NativeChatTurnJournal } from '../../../src/shared/native-chat-turn-membership'
import type { NativeChatAwaitingInput } from '../../../src/shared/native-chat/native-chat-terminal-turn'
import type { NativeChatResolvedPrompt } from '../../../src/shared/native-chat-resolution-receipt'
import type { MobileNativeChatSendOutcome } from './native-chat/mobile-native-chat-send'
import type {
MobileNativeChatSendIntent,
MobileNativeChatSendOutcome
} from './native-chat/mobile-native-chat-send'
import type { MobileNativeChatCommandRefusalCauses } from './native-chat/use-mobile-native-chat-send-error'
import type { MobileStructuredQueuedMessageControls } from './use-mobile-structured-queued-message-controls'
import type { MobileStructuredBackgroundTasks } from './use-mobile-structured-background-tasks'
@@ -54,6 +58,8 @@ export type MobileNativeChatController = {
nativeChatActionablePromptIds: readonly string[] | undefined
nativeChatCommandRefusalCauses: MobileNativeChatCommandRefusalCauses
nativeChatCanStop: boolean
/** While the agent works on a host that queues: what a tap on Send does and whether holding it offers the other way; null otherwise. */
nativeChatSendFollowUp: NativeChatSendFollowUp | null
nativeChatStreamingText?: string
nativeChatPermission: MobileChatPermission | null
// A new prompt occurrence resets local card submission state only.
@@ -97,7 +103,8 @@ export type MobileNativeChatController = {
images?: string[],
deadline?: number,
attachments?: readonly StructuredMobileSendAttachment[],
sentAt?: number
sentAt?: number,
intent?: MobileNativeChatSendIntent
) => Promise<MobileNativeChatSendOutcome>
// Read parked TUI launch text to clear one line per Ctrl+U before pasting images.
readSeededLaunchDraft: () => string | null
@@ -0,0 +1,111 @@
import { nativeChatQueueFollowUpsRead } from '../transport/settings-read-operations'
import type { RpcClient } from '../transport/rpc-client'
import { nativeChatQueueFollowUps } from '../../../src/shared/native-chat-follow-up-behavior'
const projections = new WeakMap<RpcClient, MobileNativeChatFollowUpPreference>()
/** The connection owns one live host preference shared by every mounted chat. */
export function mobileNativeChatFollowUpPreference(
client: RpcClient
): MobileNativeChatFollowUpPreference {
let projection = projections.get(client)
if (!projection) {
projection = new MobileNativeChatFollowUpPreference(client)
projections.set(client, projection)
}
return projection
}
class MobileNativeChatFollowUpPreference {
private value = nativeChatQueueFollowUps(null)
private readonly listeners = new Set<() => void>()
private stopState?: () => void
private stopStream?: () => void
private readVersion = 0
private connectionVersion = 0
constructor(private readonly client: RpcClient) {}
getSnapshot = (): boolean => this.value
subscribe = (listener: () => void): (() => void) => {
this.listeners.add(listener)
if (this.listeners.size === 1) {
this.stopState = this.client.onStateChange(() => this.connect())
this.connect()
}
return () => {
this.listeners.delete(listener)
if (this.listeners.size === 0) {
this.connectionVersion += 1
this.readVersion += 1
this.stopStream?.()
this.stopStream = undefined
this.stopState?.()
this.stopState = undefined
}
}
}
private publish(value: boolean): void {
if (value !== this.value) {
this.value = value
for (const listener of this.listeners) {
listener()
}
}
}
private connect(): void {
const connectionVersion = ++this.connectionVersion
this.readVersion += 1
this.stopStream?.()
this.stopStream = undefined
const generation = this.client.getGeneration?.() ?? 0
if (this.client.getState() !== 'connected') {
return
}
const current = (): boolean =>
connectionVersion === this.connectionVersion &&
generation === (this.client.getGeneration?.() ?? 0)
const read = (): void => {
const version = ++this.readVersion
void nativeChatQueueFollowUpsRead
.request(this.client)
.then((response) => {
const preference = nativeChatQueueFollowUpsRead.interpret(response)
if (current() && version === this.readVersion && preference.accepted) {
this.publish(preference.value)
}
})
.catch(() => {
// Keep this host's last answer until a ready snapshot repairs the gap.
})
}
read()
this.stopStream = this.client.subscribe('runtime.clientEvents.subscribe', null, (payload) => {
if (!current() || !payload || typeof payload !== 'object') {
return
}
const event: { type?: unknown; queueFollowUps?: unknown; snapshot?: unknown } = payload
let queueFollowUps: unknown
if (event.type === 'nativeChatQueueFollowUpsChanged') {
queueFollowUps = event.queueFollowUps
} else if (event.type === 'ready') {
const snapshot = event.snapshot
if (snapshot && typeof snapshot === 'object' && 'nativeChatQueueFollowUps' in snapshot) {
queueFollowUps = snapshot.nativeChatQueueFollowUps
} else {
read()
return
}
} else {
return
}
if (typeof queueFollowUps === 'boolean') {
this.readVersion += 1
this.publish(queueFollowUps)
}
})
}
}
@@ -110,7 +110,9 @@ export function mobileQueuedEditHarness() {
const client: RpcClient = {
sendRequest,
subscribe: (_method, _params, onData) => {
state.listener = onData
if (_method === 'agentSession.subscribe') {
state.listener = onData
}
return () => {}
},
updateTerminalSubscriptionViewport: () => {},
@@ -1,7 +1,11 @@
import type { AgentSessionSlashCommand } from '../../../src/shared/agent-session-wire'
import type { NativeChatSendFollowUp } from '../../../src/shared/native-chat-follow-up-behavior'
import type { RpcClient } from '../transport/rpc-client'
import type { StructuredAgentSessionHostSupport } from './mobile-structured-agent-session-host-support'
import type { MobileNativeChatSendOutcome } from './native-chat/mobile-native-chat-send'
import type {
MobileNativeChatSendIntent,
MobileNativeChatSendOutcome
} from './native-chat/mobile-native-chat-send'
import type { MobileNativeChatVisualSource } from './native-chat/visual/mobile-native-chat-visual-read'
import type { MobileChatPermission } from './native-chat/input/mobile-native-chat-permission'
import type { MobileChatQuestion } from './native-chat/input/mobile-native-chat-question'
@@ -26,6 +30,8 @@ export type StructuredMobileSession = ReturnType<typeof useMobileStructuredAgent
isWorking: boolean
/** Desktop's Stop rule: a running turn, or conversation Stop while working or sending. */
canStop: boolean
/** While the agent works on a host that queues: what a tap on Send does and whether holding it offers the other way; null otherwise. */
sendFollowUp: NativeChatSendFollowUp | null
turnId: string | null
turnIndicator: NativeChatLiveTurnIndicator
sendWithOutcome: (
@@ -33,7 +39,8 @@ export type StructuredMobileSession = ReturnType<typeof useMobileStructuredAgent
images?: string[],
deadline?: number,
attachments?: readonly StructuredMobileSendAttachment[],
skills?: readonly AgentJournalSkillRef[]
skills?: readonly AgentJournalSkillRef[],
intent?: MobileNativeChatSendIntent
) => Promise<MobileNativeChatSendOutcome>
cancel: () => void
receipts: ReadonlyMap<string, NativeChatResolvedPrompt>
@@ -27,7 +27,7 @@ export async function sendMobileStructuredAgentSessionMessage(input: {
attachments: readonly StructuredAgentSessionAttachment[]
/** Sent only when the host advertises `agent-session.send-skills.v1`. */
skills?: readonly AgentJournalSkillRef[]
/** Sent only when the host advertises `agent-session.queued-messages.v1`. */
/** Sent only when the host advertises `agent-session.queued-messages.v2`. */
delivery?: 'queue-if-active'
/** Sent only when the host advertises `agent-session.send-selection.v1`. */
selection?: Readonly<Record<string, string>>
@@ -0,0 +1,16 @@
import type { StructuredAgentSessionState } from '../../../src/shared/structured-agent-session-reducer'
import {
runningStructuredAgentSessionTurnId,
structuredAgentSessionHostSaysWorking
} from '../../../src/shared/structured-agent-session-live-turn'
import { isStructuredAgentSessionMainAgentWorking } from '../../../src/shared/structured-agent-session-main-agent-working'
export function mobileStructuredAgentSessionWorking(state: StructuredAgentSessionState): boolean {
return structuredAgentSessionHostSaysWorking(state.working, () =>
isStructuredAgentSessionMainAgentWorking(
runningStructuredAgentSessionTurnId(state),
state.submissions,
state.fence
)
)
}
@@ -0,0 +1,180 @@
import { createElement, useState, type ReactNode } from 'react'
import { act, create, type ReactTestRenderer } from 'react-test-renderer'
import { expect, it, vi } from 'vitest'
import type { RpcClient } from '../transport/rpc-client'
import type { AgentSessionOptionsResult } from '../../../src/shared/agent-session-wire'
import { EMPTY_STRUCTURED_AGENT_SESSION } from '../../../src/shared/structured-agent-session-reducer'
import { useMobileStructuredAgentMutate } from './use-mobile-structured-agent-mutation'
import { fieldsOf } from './use-mobile-structured-agent-session-queued.test-fixture'
import { useMobileStructuredAgentOptions } from './use-mobile-structured-agent-options'
import {
MobileNativeChatSessionOptionPickers,
type MobileNativeChatPickerPresentation
} from './native-chat/input/MobileNativeChatSessionOptionPickers'
import { findAllByHostType } from '../test-support/react-test-renderer-host-nodes'
vi.mock('react-native', () => ({
AccessibilityInfo: { announceForAccessibilityWithOptions: vi.fn() },
ActivityIndicator: 'ActivityIndicator',
Keyboard: { dismiss: vi.fn() },
Platform: { OS: 'ios' },
Pressable: 'Pressable',
Switch: 'Switch',
StyleSheet: { create: (styles: unknown) => styles, hairlineWidth: 1 },
Text: 'Text',
View: 'View'
}))
vi.mock('../components/MobileSwitch', () => ({ MobileSwitch: 'Switch' }))
vi.mock('lucide-react-native', () => ({
Check: 'Check',
ChevronDown: 'ChevronDown',
ChevronLeft: 'ChevronLeft',
ChevronRight: 'ChevronRight',
FilePenLine: 'FilePenLine',
Hand: 'Hand',
LockKeyhole: 'LockKeyhole',
ShieldAlert: 'ShieldAlert',
ShieldCheck: 'ShieldCheck',
X: 'X'
}))
vi.mock('../components/BottomDrawer', () => ({
BottomDrawer: ({ visible, children }: { visible: boolean; children?: ReactNode }) =>
visible ? createElement('BottomDrawer', null, children) : null
}))
it('shows an unknown model without sending or remembering a guess, then applies a real row pick', async () => {
let answer: AgentSessionOptionsResult = {
models: [{ id: 'sonnet', label: 'Sonnet', isDefault: false, efforts: [] }],
current: {},
conversationCommands: ['clear']
}
const writes: unknown[] = []
const sendRequest = vi.fn<RpcClient['sendRequest']>(async (method, params) => {
if (method === 'agentSession.setOption') {
expect(fieldsOf(params)).toMatchObject({ key: 'model', value: 'sonnet' })
answer = { ...answer, current: { model: 'sonnet', confirmed: ['model'] } }
return {
id: 'rpc',
ok: true,
result: {
ok: true,
replayed: false,
value: { key: 'model', value: 'sonnet', options: { model: 'sonnet' } }
},
_meta: { runtimeId: 'host-b' }
}
}
if (method === 'settings.mutateNativeChatSessionOptions') {
writes.push(params)
}
return {
id: 'rpc',
ok: true,
result:
method === 'agentSession.options'
? answer
: method === 'agentSession.modelCatalog'
? { origin: 'unknown' }
: {},
_meta: { runtimeId: 'host-b' }
}
})
const client: RpcClient = {
sendRequest,
subscribe: () => () => {},
updateTerminalSubscriptionViewport: () => {},
getState: () => 'connected',
getReconnectAttempt: () => 0,
getLastConnectedAt: () => null,
onStateChange: () => () => {},
notifyForeground: () => {},
close: () => {}
}
const stateRef = { current: { ...EMPTY_STRUCTURED_AGENT_SESSION, fence: 1 } }
let options!: ReturnType<typeof useMobileStructuredAgentOptions>
function Chat() {
const mutate = useMobileStructuredAgentMutate({
client,
sessionId: 'unknown-mobile',
enabled: true,
stateRef,
onSendError: (message) => {
throw new Error(message)
}
})
options = useMobileStructuredAgentOptions({
agent: 'claude',
client,
sessionId: 'unknown-mobile',
enabled: true,
fence: 1,
turnId: null,
mutate,
hostSupport: {
permissionModes: false,
coherentModelCatalog: true,
statusFeed: false,
sendOptions: true
}
})
const [presentation, setPresentation] = useState<MobileNativeChatPickerPresentation | null>(
null
)
return createElement(MobileNativeChatSessionOptionPickers, {
controller: {
snapshot: options.optionSnapshot,
pendingId: options.pendingOptionId,
setOption: options.setStructuredOption,
invokeAction: options.invokeStructuredOption,
recordCommand: () => {}
},
isWorking: false,
presentation,
onDrawerOpen: (page) => setPresentation({ page, refocus: false }),
onNavigate: (page) => setPresentation((previous) => previous && { ...previous, page })
})
}
let renderer!: ReactTestRenderer
await act(async () => {
renderer = create(createElement(Chat))
})
try {
await vi.waitFor(() =>
expect(options.conversationCommands).toEqual(answer.conversationCommands)
)
const pill = () =>
renderer.root.find(
(node) =>
String(node.type) === 'Pressable' &&
String(node.props.accessibilityLabel).startsWith('Model,')
)
expect(pill().props.accessibilityLabel).toBe('Model, Model')
expect(options.sendSelection()).toEqual({ options: undefined })
expect(writes).toEqual([])
expect(
sendRequest.mock.calls.filter(([method]) => method === 'agentSession.setOption')
).toHaveLength(0)
await act(async () => pill().props.onPress())
const row = renderer.root.find(
(node) =>
String(node.type) === 'Pressable' &&
node.props.accessibilityRole === 'radio' &&
findAllByHostType(node, 'Text').some((text) => text.props.children === 'Sonnet')
)
expect(row.props.accessibilityState.checked).toBe(false)
await act(async () => row.props.onPress())
expect(options.sendSelection()).toEqual({ options: { model: 'sonnet' } })
expect(pill().props.accessibilityLabel).toBe('Model, Sonnet')
await vi.waitFor(() =>
expect(writes).toEqual([
{
type: 'apply-picks',
agent: 'claude',
picks: [{ modelId: 'sonnet', optionId: 'model', value: 'sonnet' }]
}
])
)
} finally {
await act(async () => renderer.unmount())
}
})
@@ -1,3 +1,4 @@
import { activateMobileUiLocale } from '../../../i18n/mobile-i18n'
import { useMobileNativeChatImageAttachments } from './use-mobile-native-chat-image-attachments'
import {
setMobileNativeChatDraftText,
@@ -15,6 +16,8 @@ import { useMobileStructuredAgentSession } from '../../use-mobile-structured-age
import {
CAPABLE,
SESSION_ID,
batchEvent,
queuedDraft,
snapshotEvent,
mutationOk,
ok
@@ -22,6 +25,8 @@ import {
import { structuredSendResultFixture } from '../../structured-agent-send-result.test-fixture'
import { findByHostType } from '../../../test-support/react-test-renderer-host-nodes'
import type { RpcClient } from '../../../transport/rpc-client'
import { structuredAgentSessionHostSupport } from '../../mobile-structured-agent-session-host-support'
import { AGENT_SESSION_RUNTIME_CAPABILITIES } from '../../../../../src/shared/agent-session-runtime-capabilities'
vi.mock('../../../components/MobileSwitch', () => ({ MobileSwitch: 'Switch' }))
vi.mock('../../../platform/media-picker', () => ({
useMediaPicker: () => ({ pickImages: async () => [] })
@@ -30,7 +35,7 @@ vi.mock('@react-native-async-storage/async-storage', () => ({
default: { getItem: async () => null, setItem: async () => {}, removeItem: async () => {} }
}))
import { createElement, type ComponentProps } from 'react'
import { act, create, type ReactTestRenderer } from 'react-test-renderer'
import { act, create, type ReactTestInstance, type ReactTestRenderer } from 'react-test-renderer'
import { afterEach, describe, expect, it, vi } from 'vitest'
import {
MobileNativeChatComposer as NativeChatComposer,
@@ -76,7 +81,9 @@ vi.mock('lucide-react-native', () => ({
ChevronDown: 'ChevronDown',
ChevronLeft: 'ChevronLeft',
ChevronRight: 'ChevronRight',
CornerDownRight: 'CornerDownRight',
FileText: 'FileText',
ListEnd: 'ListEnd',
Mic: 'Mic',
Package: 'Package',
Plus: 'Plus',
@@ -111,9 +118,10 @@ const structured = (
describe('MobileNativeChatComposer on a structured chat', () => {
let renderer: ReactTestRenderer | null = null
afterEach(() => {
afterEach(async () => {
act(() => renderer?.unmount())
renderer = null
await activateMobileUiLocale('en')
})
const draw = (props: Partial<ComponentProps<typeof MobileNativeChatComposer>>) =>
@@ -292,7 +300,7 @@ describe('MobileNativeChatComposer on a structured chat', () => {
agent,
draftScopeKey: scope,
onChangeText: drafts.setComposerText,
onSend: bridge.send,
onSend: (text: string) => bridge.send(text),
sendSurfaceId: scope,
getSendCompletionGeneration: () => 0,
getComposerEditGeneration: () => readMobileNativeChatDraftEditGeneration(scope),
@@ -388,6 +396,194 @@ describe('MobileNativeChatComposer on a structured chat', () => {
expect(onAttachImage).toHaveBeenCalledTimes(1)
})
it.each([
{
locale: 'en',
send: 'Send message',
queue: 'Queue',
steer: 'Steer',
queueHint: 'Runs after the current turn',
steerHint: 'Goes into what the agent is doing now'
},
{
locale: 'de',
send: 'Nachricht senden',
queue: 'Einreihen',
steer: 'Steuern',
queueHint: 'Läuft nach dem aktuellen Durchgang',
steerHint: 'Fließt in das ein, was der Agent gerade tut'
}
] as const)(
'mid-turn Send shows what a tap does, and holding it offers the other way first-marked in $locale',
async (labels) => {
await activateMobileUiLocale(labels.locale)
const onSend = vi.fn().mockResolvedValue(true)
const choices = () =>
drawers()[0]!.findAll(
(node) => String(node.type) === 'Pressable' && node.props.onPress !== undefined
)
const text = (node: ReactTestInstance) =>
node
.findAll((child) => typeof child.props.children === 'string')
.map((child) => child.props.children)
await act(async () => {
renderer = create(
draw({ value: 'hi', onSend, sendFollowUp: { action: 'steer', offersChoice: true } })
)
})
const send = () => labelled(labels.steer)[0]!
expect(send().findAll((node) => String(node.type) === 'CornerDownRight')).toHaveLength(1)
await act(async () => send().props.onLongPress())
await act(async () => drawers()[0]!.props.onClose())
expect(onSend).not.toHaveBeenCalled()
await act(async () => send().props.onLongPress())
expect(choices().map(text)).toEqual([
[labels.steer, labels.steerHint],
[labels.queue, labels.queueHint]
])
expect(choices().map((choice) => choice.props.accessibilityState?.checked)).toEqual([
true,
undefined
])
await act(async () => choices()[1]!.props.onPress())
expect(onSend).toHaveBeenCalledExactlyOnceWith('hi', { alternate: true })
await act(async () => send().props.onLongPress())
await act(async () => choices()[0]!.props.onPress())
expect(onSend).toHaveBeenCalledTimes(2)
expect(onSend).toHaveBeenLastCalledWith('hi')
// A waiting command queues either way: the button says so, and a hold is a tap.
await act(async () =>
renderer!.update(
draw({ value: 'hi', onSend, sendFollowUp: { action: 'queue', offersChoice: false } })
)
)
expect(labelled(labels.queue)[0]!.props.onLongPress).toBeUndefined()
await act(async () => renderer!.update(draw({ value: 'hi', onSend, sendFollowUp: null })))
expect(labelled(labels.send)[0]!.props.onLongPress).toBeUndefined()
}
)
it('the hold choice and a tap reach the outgoing request through the real send path', async () => {
const scope = mobileNativeChatScopeKey('host', 'worktree', 'hold-choice')!
resetMobileNativeChatDraftInputsForTests()
setMobileNativeChatDraftText(scope, 'hi')
// The phone's own mapping of what this build's host advertises.
const advertised = structuredAgentSessionHostSupport(AGENT_SESSION_RUNTIME_CAPABILITIES)
expect(advertised.queuedMessages).toBe(true)
let publish: ((data: unknown) => void) | undefined
const sendRequest = vi.fn<RpcClient['sendRequest']>(async (method) =>
method === 'agentSession.send'
? mutationOk(structuredSendResultFixture('accepted'))
: method === 'settings.get'
? ok({ settings: {} })
: ok({ models: [], current: {} })
)
const client: RpcClient = {
sendRequest,
subscribe: (method, _p, listener) => {
if (method === 'agentSession.subscribe') {
publish = listener
}
return () => {}
},
updateTerminalSubscriptionViewport: () => {},
getState: () => 'connected',
getReconnectAttempt: () => 0,
getLastConnectedAt: () => null,
onStateChange: () => () => {},
notifyForeground: () => {},
close: () => {}
}
function Conversation() {
const session = useMobileStructuredAgentSession({
client,
sessionId: SESSION_ID,
sourceIdentity: 'host',
enabled: true,
connected: true,
agent: 'claude',
hostSupport: { ...CAPABLE, queuedMessages: advertised.queuedMessages },
composerScopeKey: scope,
onSendError: vi.fn()
})
const drafts = useMobileNativeChatDrafts({
hostId: 'host',
worktreeId: 'worktree',
tabId: 'hold-choice',
sessionId: SESSION_ID,
messages: [],
transcriptSettled: true
})
const bridge = useMobileStructuredNativeChatSendBridge({
...drafts,
agent: 'claude',
sendStructured: session.sendWithOutcome,
onSendError: vi.fn()
})
const image = useMobileNativeChatImageAttachments({
client,
agent: 'claude',
activeHandleRef: { current: null },
deviceTokenRef: { current: null },
getActiveWorktreeConnectionId: async () => null,
connState: 'connected',
scopeKey: scope,
enabled: true,
structuredNativeChat: true,
showToast: vi.fn(),
onSendError: vi.fn(),
baseSend: bridge.sendWithOutcome,
readSeededLaunchDraft: () => null
})
return draw({
value: 'hi',
onSend: image.sendNativeChat,
sendFollowUp: session.sendFollowUp,
structured: structured()
})
}
await act(async () => {
renderer = create(createElement(Conversation))
})
await act(async () =>
publish?.({
...snapshotEvent(),
page: {
...snapshotEvent().page,
working: true,
latestTurn: null,
nextQueuedMessageId: null
}
})
)
const sends = () =>
sendRequest.mock.calls.filter(([method]) => method === 'agentSession.send').map(([, p]) => p)
const send = () => labelled('Queue')[0]!
await act(async () => send().props.onLongPress())
const steer = drawers()[0]!.findAll(
(node) =>
String(node.type) === 'Pressable' &&
node.findAll((child) => child.props.children === 'Steer').length > 0
)[0]!
await act(async () => steer.props.onPress())
expect(sends()).toHaveLength(1)
expect(sends()[0]).not.toHaveProperty('delivery')
await act(async () => send().props.onPress())
expect(sends()).toHaveLength(2)
expect(sends()[1]).toHaveProperty('delivery', 'queue-if-active')
// A waiting command queues either way, so a hold is a tap.
const compact = queuedDraft({
messageId: 'compact',
body: { kind: 'message', role: 'user', blocks: [], command: { name: 'compact' } }
})
await act(async () => publish?.(batchEvent([compact])))
expect(send().props.onLongPress).toBeUndefined()
})
it('holds Send while a file is still uploading, and sends a stored file alone', async () => {
const onSend = vi.fn().mockResolvedValue(true)
const file = { id: 'f1', name: 'spec.pdf', mime: 'application/pdf', byteLength: 10 }
@@ -47,6 +47,8 @@ vi.mock('react-native', async () => {
vi.mock('lucide-react-native', () => ({
ArrowUp: 'ArrowUp',
ListEnd: 'ListEnd',
CornerDownRight: 'CornerDownRight',
Check: 'Check',
ChevronDown: 'ChevronDown',
ChevronLeft: 'ChevronLeft',
@@ -293,17 +295,6 @@ describe('MobileNativeChatComposer', () => {
expect(onSend).not.toHaveBeenCalled()
})
it('keeps the draft when the send is rejected', async () => {
const onChangeText = vi.fn()
const onSend = vi.fn().mockResolvedValue(false)
await render(onSend, onChangeText)
await act(async () => sendButton().props.onPress())
expect(onSend).toHaveBeenCalledWith(' hello ')
expect(onChangeText).not.toHaveBeenCalled()
})
it('disables send while an attachment path is still being injected', async () => {
const onSend = vi.fn().mockResolvedValue(true)
await render(onSend, vi.fn(), true)
@@ -682,14 +673,18 @@ describe('MobileNativeChatComposer', () => {
expect(Keyboard.dismiss).toHaveBeenCalledTimes(1)
})
it('keeps the keyboard up when the send is rejected', async () => {
it('keeps the draft and keyboard when the send is rejected', async () => {
// Keep the keyboard after rejection so the draft can be corrected and retried.
vi.mocked(Keyboard.dismiss).mockClear()
await render(vi.fn().mockResolvedValue(false), vi.fn())
const onSend = vi.fn().mockResolvedValue(false)
const onChangeText = vi.fn()
await render(onSend, onChangeText)
await act(async () => sendButton().props.onPress())
expect(Keyboard.dismiss).not.toHaveBeenCalled()
expect(onSend).toHaveBeenCalledWith(' hello ')
expect(onChangeText).not.toHaveBeenCalled()
})
it('does not dismiss a newly focused composer when an old accepted send settles', async () => {
@@ -1,4 +1,5 @@
import { getNativeChatAgentProfile } from '../../../../../src/shared/native-chat-agent-profiles'
import type { NativeChatSendFollowUp } from '../../../../../src/shared/native-chat-follow-up-behavior'
import {
recordMobileNativeChatSkillPick,
useMobileNativeChatDraft
@@ -33,7 +34,8 @@ import { mobileNativeChatComposerShowsStop } from './mobile-native-chat-composer
import { MobileNativeChatStopButton } from '../input/MobileNativeChatStopButton'
import { mobileNativeChatComposerStyles as styles } from './mobile-native-chat-composer-styles'
import { composerInputStyles as inputStyles } from '../../../components/composer-input/composer-input-styles'
import { ComposerSendButton } from '../../../components/composer-input/ComposerSendButton'
import { MobileNativeChatSendButton } from './MobileNativeChatSendButton'
import type { MobileNativeChatSendIntent } from '../mobile-native-chat-send'
import {
MobileNativeChatComposerMic,
type MobileNativeChatMicProps
@@ -64,7 +66,9 @@ type Props = MobileNativeChatMicProps & {
structured?: MobileNativeChatStructuredComposer | null
value: string
onChangeText: (text: string) => void
onSend: (text: string) => Promise<boolean>
onSend: (text: string, intent?: MobileNativeChatSendIntent) => Promise<boolean>
/** While the agent works on a host that queues: what a tap on Send does and whether holding it offers the other way; null otherwise. */
sendFollowUp?: NativeChatSendFollowUp | null
/** Changes whenever the route focuses a different chat composer surface. */
sendSurfaceId: string
/** Reads the retained route's focus generation without forcing a screen render. */
@@ -89,6 +93,9 @@ type Props = MobileNativeChatMicProps & {
stop?: { onStop?: () => void; held: boolean } | null
}
/** What a chat's composer sends through, which the chat view hands down from its route. */
export type MobileNativeChatSendProps = Pick<Props, 'onSend' | 'sendFollowUp'>
export function MobileNativeChatComposer({
inputRef,
draftScopeKey,
@@ -122,7 +129,8 @@ export function MobileNativeChatComposer({
onNeedFiles,
skillDiscovery,
onNeedSkills,
stop = null
stop = null,
sendFollowUp = null
}: Props): React.JSX.Element {
useMobileColorScheme()
const t = useMobileTranslation()
@@ -216,7 +224,7 @@ export function MobileNativeChatComposer({
}
}, [])
const handleSend = async (): Promise<void> => {
const handleSend = async (intent?: MobileNativeChatSendIntent): Promise<void> => {
if (!canSend || sendingRef.current) {
return
}
@@ -228,7 +236,7 @@ export function MobileNativeChatComposer({
try {
// Raw, not trimmed: the send seam owns the wire trim, and a rejection has
// to hand the user back exactly what they typed (#14819).
const accepted = await onSend(value)
const accepted = await (intent ? onSend(value, intent) : onSend(value))
if (
accepted &&
mountedRef.current &&
@@ -368,7 +376,7 @@ export function MobileNativeChatComposer({
!canSend && inputStyles.sendButtonDisabled,
pressed && canSend && inputStyles.pressed
]}
onPress={handleSend}
onPress={() => void handleSend()}
disabled={!canSend}
>
<Text style={{ color: canSend ? colors.bgBase : colors.textMuted }}>
@@ -376,10 +384,10 @@ export function MobileNativeChatComposer({
</Text>
</Pressable>
) : (
<ComposerSendButton
onPress={handleSend}
<MobileNativeChatSendButton
canSend={canSend}
label={t('chat.composer.sendMessage', 'Send message')}
sendFollowUp={sendFollowUp}
onSend={(intent) => void handleSend(intent)}
/>
)}
</View>
@@ -0,0 +1,61 @@
import { useState } from 'react'
import { CornerDownRight, ListEnd } from 'lucide-react-native'
import type {
NativeChatFollowUpBehavior,
NativeChatSendFollowUp
} from '../../../../../src/shared/native-chat-follow-up-behavior'
import { ActionSheetModal } from '../../../components/ActionSheetModal'
import { ComposerSendButton } from '../../../components/composer-input/ComposerSendButton'
import { useMobileTranslation } from '../../../i18n/use-mobile-translation'
import type { MobileNativeChatSendIntent } from '../mobile-native-chat-send'
const FOLLOW_UP_ICON = { queue: ListEnd, steer: CornerDownRight } as const
/** Send; while the agent works on a host that queues, it shows what a tap does, and holding it offers the other way when that would differ. */
export function MobileNativeChatSendButton({
canSend,
sendFollowUp,
onSend
}: {
canSend: boolean
sendFollowUp: NativeChatSendFollowUp | null
onSend: (intent?: MobileNativeChatSendIntent) => void
}): React.JSX.Element {
const t = useMobileTranslation()
const [open, setOpen] = useState(false)
const label = {
queue: t('chat.composer.sendQueue', 'Queue'),
steer: t('chat.composer.sendSteer', 'Steer')
}
const hint = {
queue: t('chat.composer.sendQueueHint', 'Runs after the current turn'),
steer: t('chat.composer.sendSteerHint', 'Goes into what the agent is doing now')
}
const action = sendFollowUp?.action
const choices: NativeChatFollowUpBehavior[] =
action === 'queue' ? ['queue', 'steer'] : ['steer', 'queue']
return (
<>
<ComposerSendButton
onPress={() => onSend()}
onLongPress={sendFollowUp?.offersChoice && canSend ? () => setOpen(true) : undefined}
canSend={canSend}
label={action ? label[action] : t('chat.composer.sendMessage', 'Send message')}
icon={action ? FOLLOW_UP_ICON[action] : undefined}
/>
<ActionSheetModal
visible={open}
onClose={() => setOpen(false)}
actions={choices.map((choice) => ({
id: choice,
label: label[choice],
hint: hint[choice],
icon: FOLLOW_UP_ICON[choice],
checked: choice === action,
// Only the choice other than a tap's is the alternate; the send resolves it against the state then.
onPress: () => (choice === action ? onSend() : onSend({ alternate: true }))
}))}
/>
</>
)
}
@@ -1,4 +1,5 @@
import { useCallback, useSyncExternalStore } from 'react'
import { createUuidV4 } from '../../../../../src/shared/uuid-v4'
import { pickedSkillsInText } from '../../../../../src/shared/structured-agent-session-send-mutation'
import type { AgentJournalSkillRef } from '../../../../../src/shared/agent-session-journal-types'
import type { PendingNativeChatImage } from './mobile-native-chat-image-attachment'
@@ -63,6 +64,19 @@ export function updateMobileNativeChatDraftInputs(
drafts.set(destination.scope, update(readMobileNativeChatDraftInputs(destination.scope)))
listeners.get(destination.scope)?.forEach((listener) => listener())
}
/** Adds uploaded images to the draft they were picked for, each under a fresh chip id. */
export function addMobileNativeChatDraftImages(
scope: MobileNativeChatDraftDestination,
uploadedImages: Omit<PendingNativeChatImage, 'id'>[]
): void {
updateMobileNativeChatDraftInputs(scope, (current) => ({
...current,
images: [
...current.images,
...uploadedImages.map((image) => ({ ...image, id: createUuidV4() }))
]
}))
}
export function subscribeMobileNativeChatDraftInputs(
scope: string | null,
listener: () => void
@@ -41,7 +41,8 @@ export function useMobileNativeChatComposerTray({
pause,
onResume,
sessionKey,
steerHeld
steerHeld,
agentWorking
} = queued
return useMemo(
() => ({
@@ -66,7 +67,8 @@ export function useMobileNativeChatComposerTray({
onMove,
pause,
onResume,
steerHeld
steerHeld,
agentWorking
})
),
composerInputRef
@@ -84,7 +86,8 @@ export function useMobileNativeChatComposerTray({
onSend,
pause,
sessionKey,
steerHeld
steerHeld,
agentWorking
]
)
}
@@ -1,5 +1,5 @@
import { createUuidV4 } from '../../../../../src/shared/uuid-v4'
import {
addMobileNativeChatDraftImages,
readMobileNativeChatDraftInputs,
useMobileNativeChatDraftInputs,
updateMobileNativeChatDraftInputs,
@@ -18,6 +18,7 @@ import {
} from './mobile-native-chat-image-send'
import {
openMobileNativeChatSendBudget,
type MobileNativeChatSendIntent,
type MobileNativeChatSendOutcome
} from '../mobile-native-chat-send'
import {
@@ -65,7 +66,8 @@ type Args = {
imagePreviewUris?: string[],
deadline?: number,
attachments?: readonly StructuredMobileSendAttachment[],
sentAt?: number
sentAt?: number,
intent?: MobileNativeChatSendIntent
) => Promise<MobileNativeChatSendOutcome>
/** Structured sessions send attachments without the terminal paste path. */
readonly structuredNativeChat: boolean
@@ -91,7 +93,7 @@ export type MobileNativeChatImageAttachments = {
readonly removeAttachment: (id: string) => void
/** Ride any pending images along with `text`, then submit; clears the sent
* chips (and only those) once the send is accepted. */
readonly sendNativeChat: (text: string) => Promise<boolean>
readonly sendNativeChat: (text: string, intent?: MobileNativeChatSendIntent) => Promise<boolean>
}
const NO_FILES: readonly PendingNativeChatFile[] = []
@@ -123,22 +125,6 @@ export function useMobileNativeChatImageAttachments({
const images = inputs.images
const attachments = useMemo(() => [...images], [images])
const addUploadedImages = useCallback(
(
scope: MobileNativeChatDraftDestination,
uploadedImages: Omit<PendingNativeChatImage, 'id'>[]
) => {
updateMobileNativeChatDraftInputs(scope, (current) => ({
...current,
images: [
...current.images,
...uploadedImages.map((image) => ({ ...image, id: createUuidV4() }))
]
}))
},
[]
)
const { attachImage, isAttaching } = useMobileNativeChatImageUpload({
client,
activeHandleRef,
@@ -147,7 +133,7 @@ export function useMobileNativeChatImageAttachments({
scopeKey,
structuredNativeChat,
showToast,
onImagesUploaded: addUploadedImages,
onImagesUploaded: addMobileNativeChatDraftImages,
onAttachSuccess,
onError
})
@@ -167,7 +153,7 @@ export function useMobileNativeChatImageAttachments({
)
const sendNativeChat = useCallback(
async (text: string): Promise<boolean> => {
async (text: string, intent?: MobileNativeChatSendIntent): Promise<boolean> => {
// Serialize clear/paste/submit ownership per terminal while allowing other
// tabs to send. Shared with the prompt-card writes (answer/permission), so
// a card tap can't interleave into a mid-flight paste sequence either.
@@ -202,12 +188,11 @@ export function useMobileNativeChatImageAttachments({
onSendError('Message not sent (disconnected)')
return false
}
const outcome = await baseSend(
text,
pendingImages.map((attachment) => attachment.previewUri),
deadline,
[...pendingImages, ...storedFiles]
)
const previews = pendingImages.map((attachment) => attachment.previewUri)
const sendAttachments = [...pendingImages, ...storedFiles]
const outcome = await (intent
? baseSend(text, previews, deadline, sendAttachments, undefined, intent)
: baseSend(text, previews, deadline, sendAttachments))
if (outcome !== 'rejected' && destination.active) {
const sentIds = new Set(pendingImages.map((attachment) => attachment.id))
updateMobileNativeChatDraftInputs(destination, (current) => ({
@@ -244,7 +229,10 @@ export function useMobileNativeChatImageAttachments({
return false
}
}
return (await baseSend(text, undefined, deadline, undefined, sentAt)) !== 'rejected'
const outcome = await (intent
? baseSend(text, undefined, deadline, undefined, sentAt, intent)
: baseSend(text, undefined, deadline, undefined, sentAt))
return outcome !== 'rejected'
}
const handle = activeHandleRef.current
if (!client || !handle || !enabled || connState !== 'connected') {
@@ -1,3 +1,4 @@
import { activateMobileUiLocale } from '../../../i18n/mobile-i18n'
import {
mobileQueuedMessageCards,
type MobileQueuedMessageCard
@@ -104,10 +105,11 @@ function card(
describe('MobileNativeChatQueuedMessages', () => {
let renderer: ReactTestRenderer | null = null
afterEach(() => {
afterEach(async () => {
vi.restoreAllMocks()
act(() => renderer?.unmount())
renderer = null
await activateMobileUiLocale('en')
})
async function mount(
@@ -183,19 +185,13 @@ describe('MobileNativeChatQueuedMessages', () => {
expect(texts(mounted)).toContain('See this')
})
it('draws a plain waiting card as one compact row with no caption', async () => {
it('draws a translated idle card as one compact row with Send and no caption', async () => {
await activateMobileUiLocale('de')
const mounted = await mount({ cards: [card({ messageId: 'w', text: 'next' })] })
const rows = mounted.root.findAllByProps({ testID: 'queued-card-row' })
expect(rows).toHaveLength(1)
expect(texts(mounted)).toEqual(['Queued', 1, 'next', 'Steer'])
expect(
mounted.root.find(
(node) =>
String(node.type) === 'Text' &&
node.props.children === 'next' &&
!node.props.accessibilityElementsHidden
).props.numberOfLines
).toBe(2)
expect(texts(mounted)).toEqual(['In der Warteschlange', 1, 'next', 'Senden'])
expect(mounted.root.findByProps({ children: 'next', numberOfLines: 2 })).toBeTruthy()
expect(nodeTypes(rows[0]!)).toContain('ListEnd')
expect(nodeTypes(rows[0]!)).not.toContain('AlertCircle')
})
@@ -318,7 +314,7 @@ describe('MobileNativeChatQueuedMessages', () => {
expect(texts(mounted).filter((text) => text === reason)).toHaveLength(1)
})
it('reads Steer on a waiting card and plain Send on a returned one or one whose own send failed', async () => {
it('reads Steer during work and plain Send on a returned one or one whose own send failed', async () => {
const mounted = await mount({
cards: [
card({
@@ -330,6 +326,7 @@ describe('MobileNativeChatQueuedMessages', () => {
card({ messageId: 'waiting' }),
card({ messageId: 'returned', state: 'returned', needsAttention: true })
],
agentWorking: true,
onSend: vi.fn(async () => true)
})
expect(control(mounted, 'Send this message')).toBeTruthy()
@@ -392,7 +389,8 @@ describe('MobileNativeChatQueuedMessages', () => {
cards: [card({ messageId: 'w' })],
onSend,
onDelete,
steerHeld: true
steerHeld: true,
agentWorking: true
})
const steer = control(mounted, 'Submit without interrupting the model')
expect(steer.props.disabled).toBe(true)
@@ -478,15 +476,15 @@ describe('MobileNativeChatQueuedMessages', () => {
const mounted = await mount({ cards: [card({ messageId: 'w' })], onSend, onDelete })
// Tap all actions before disabled state renders to expose same-frame duplication.
await act(async () => {
control(mounted, 'Submit without interrupting the model').props.onPress()
control(mounted, 'Submit without interrupting the model').props.onPress()
control(mounted, 'Send this message').props.onPress()
control(mounted, 'Send this message').props.onPress()
control(mounted, 'Delete this queued message').props.onPress()
})
expect(onSend).toHaveBeenCalledTimes(1)
expect(onDelete).not.toHaveBeenCalled()
expect(control(mounted, 'More actions').props.disabled).toBe(true)
await act(async () => answer(true))
expect(control(mounted, 'Submit without interrupting the model').props.disabled).toBe(false)
expect(control(mounted, 'Send this message').props.disabled).toBe(false)
})
describe('a paused queue', () => {
@@ -557,7 +555,7 @@ describe('MobileNativeChatQueuedMessages', () => {
onSend
})
const labels = ['Delete every queued message', 'Resume sending the queued messages']
const steer = 'Submit without interrupting the model'
const steer = 'Send this message'
const trigger = async (action: () => void) => {
counting = true
await act(async () => action())
@@ -665,7 +663,11 @@ describe('MobileNativeChatQueuedMessages', () => {
it('keeps Steer on its cards: one card can still go beside the paused rest', async () => {
const onSend = vi.fn(async () => true)
const mounted = await mountPaused({ pause: { reason: 'stopped' }, onSend })
const mounted = await mountPaused({
pause: { reason: 'stopped' },
onSend,
agentWorking: true
})
const steer = control(mounted, 'Submit without interrupting the model')
expect(texts(mounted)).toContain('Steer')
expect(texts(mounted)).not.toContain('Send')
@@ -695,7 +697,7 @@ describe('MobileNativeChatQueuedMessages', () => {
'Queued messages',
'Delete every queued message',
'Resume sending the queued messages',
'Submit without interrupting the model',
'Send this message',
'Delete this queued message',
'More actions'
])
@@ -33,6 +33,8 @@ export type MobileNativeChatQueuedMessagesProps = {
pause?: AgentSessionQueuePause | null
onResume?: () => Promise<boolean>
steerHeld?: boolean
/** The agent is working: a steerable card's action reads Steer, otherwise Send. */
agentWorking?: boolean
}
export function MobileNativeChatQueuedMessages({
@@ -45,7 +47,8 @@ export function MobileNativeChatQueuedMessages({
onMove,
pause,
onResume,
steerHeld = false
steerHeld = false,
agentWorking = false
}: MobileNativeChatQueuedMessagesProps): React.JSX.Element | null {
useMobileColorScheme()
const t = useMobileTranslation()
@@ -199,6 +202,7 @@ export function MobileNativeChatQueuedMessages({
busy={busyIds.has(card.messageId)}
editBlocked={busyIds.has(card.messageId) || editor !== undefined || !onEdit}
steerHeld={steerHeld}
agentWorking={agentWorking}
onSend={() => void run(card.messageId, onSend)}
onDelete={() => void run(card.messageId, onDelete)}
onMore={() => setMenuFor(card.messageId)}
@@ -27,6 +27,9 @@ type MobileNativeChatSendArgs = {
// Unknown delivery must not be called definite failure; structured queued drafts render as cards, not transcript echoes.
export type MobileNativeChatSendOutcome = 'accepted' | 'rejected' | 'unknown' | 'queued'
/** How one send goes: `alternate` does the other thing than the host's follow-up setting. */
export type MobileNativeChatSendIntent = { alternate?: true }
export type MobileNativeChatWriteOutcome = Exclude<MobileNativeChatSendOutcome, 'queued'>
// Bound reconnect wait so an interactive send cannot keep the composer locked indefinitely.
@@ -261,6 +261,7 @@ export function useMobileNativeChatController(args: {
nativeChatActionablePromptIds: structuredNativeChat.actionablePromptIds,
nativeChatCommandRefusalCauses: structuredNativeChat.commandRefusalCauses,
nativeChatCanStop: activeChatStructured ? structuredNativeChat.canStop : nativeChatAgentWorking,
nativeChatSendFollowUp: activeChatStructured ? structuredNativeChat.sendFollowUp : null,
nativeChatStreamingText: terminalTurn.streamingText,
...prompts,
handleNativeChatStop: activeChatStructured ? structuredNativeChat.cancel : terminalTurn.stop,
@@ -1,33 +1,24 @@
import { useEffect, useState } from 'react'
import { nativeChatQueueFollowUpsRead } from '../transport/settings-read-operations'
import { useCallback, useSyncExternalStore } from 'react'
import { nativeChatQueueFollowUps } from '../../../src/shared/native-chat-follow-up-behavior'
import type { RpcClient } from '../transport/rpc-client'
import { mobileNativeChatFollowUpPreference } from './mobile-native-chat-follow-up-preference'
const defaultSnapshot = (): boolean => nativeChatQueueFollowUps(null)
// Read per connection and chat: the phone has no settings stream, and on is today's default.
export function useMobileNativeChatQueueFollowUps(
client: RpcClient | null,
connected: boolean,
sessionId: string | null
): boolean {
const [queueFollowUps, setQueueFollowUps] = useState(true)
useEffect(() => {
if (!client || !connected || !sessionId) {
return
}
let stale = false
void nativeChatQueueFollowUpsRead
.request(client)
.then((response) => {
const preference = nativeChatQueueFollowUpsRead.interpret(response)
if (!stale && preference.accepted) {
setQueueFollowUps(preference.value)
}
})
.catch(() => {
// Keep the last answer when the host is unreachable.
})
return () => {
stale = true
}
}, [client, connected, sessionId])
return queueFollowUps
const preference = client ? mobileNativeChatFollowUpPreference(client) : null
const subscribe = useCallback(
(listener: () => void) =>
preference && connected && sessionId ? preference.subscribe(listener) : () => {},
[preference, connected, sessionId]
)
return useSyncExternalStore(
subscribe,
preference?.getSnapshot ?? defaultSnapshot,
defaultSnapshot
)
}
@@ -1,7 +1,10 @@
import type { RpcClient } from '../transport/rpc-client'
import type { ConnectionState } from '../transport/types'
import type { MobileImageSource } from './mobile-image-source-picker'
import type { MobileNativeChatSendOutcome } from './native-chat/mobile-native-chat-send'
import type {
MobileNativeChatSendIntent,
MobileNativeChatSendOutcome
} from './native-chat/mobile-native-chat-send'
import type { StructuredMobileSendAttachment } from './use-mobile-structured-send-with-outcome'
import { useMobileImageAttachment } from './use-mobile-image-attachment'
import {
@@ -35,7 +38,8 @@ type Args = {
images?: string[],
deadline?: number,
attachments?: readonly StructuredMobileSendAttachment[],
sentAt?: number
sentAt?: number,
intent?: MobileNativeChatSendIntent
) => Promise<MobileNativeChatSendOutcome>
readonly structuredNativeChat: boolean
readonly nativeChatSessionId: string | null
@@ -15,8 +15,9 @@ it('renders trustworthy context through the phone consumer while capturing only
for (const input of ['low', 'max', 'opencode', 'absent'] as const) {
const { agent, model, display, live, resting, catalog } = await recordedEffortCase(input)
for (const answer of [live, resting]) {
let response = Promise.resolve(answer)
const { client } = optionsClient(
async () => answer,
() => response,
async () => catalog
)
const harness = await mountOptions({
@@ -35,6 +36,12 @@ it('renders trustworthy context through the phone consumer while capturing only
}
expect(effort?.kind.currentValue).toBe(display ?? undefined)
expect(harness.current().sendSelection()).toEqual({ selection: { model } })
response = new Promise(() => {})
await harness.rerender({ fence: 2 })
expect(descriptorFor(harness.current().optionSnapshot, 'effort')?.kind.currentValue).toBe(
display ?? undefined
)
expect(harness.current().sendSelection()).toEqual({ selection: { model } })
await harness.unmount()
}
}
@@ -35,7 +35,7 @@ it('keeps actual phone operations and correlated acceptance through a stable-cli
const stale = deferred<AgentSessionOptionsResult>()
let oldReads = 0
const physical = optionsClient(() =>
++oldReads === 1 ? Promise.resolve(OPTIONS) : stale.promise
++oldReads === 1 ? Promise.resolve({ ...OPTIONS, acceptsImages: true }) : stale.promise
)
const currentReads: ReturnType<typeof deferred<AgentSessionOptionsResult>>[] = []
const next = optionsClient(() => {
@@ -77,8 +77,11 @@ it('keeps actual phone operations and correlated acceptance through a stable-cli
await client.migrateTo(next.client, 'relay')
})
await settle()
await act(async () => stale.resolve({ ...OPTIONS, conversationCommands: ['compact'] }))
await act(async () =>
stale.resolve({ ...OPTIONS, acceptsImages: false, conversationCommands: ['compact'] })
)
expect(view.current().conversationCommands).toEqual([])
expect(view.current().acceptsImages).toBe(true)
expect(currentValueOf(view.current().optionSnapshot, 'model')).toBe('gpt-fast')
expect(view.current().sendSelection()).toMatchObject({ selection: { model: 'gpt-fast' } })
await act(async () =>
@@ -217,6 +220,33 @@ it('reads the new physical path after an idle connected-to-connected migration w
client.close()
})
it('coalesces a burst of turns into one running and one trailing options read', async () => {
const reads: ReturnType<typeof deferred<AgentSessionOptionsResult>>[] = []
const rpc = optionsClient(() => {
const read = deferred<AgentSessionOptionsResult>()
reads.push(read)
return read.promise
})
const { mutate } = recordingMutate(async () => ({ status: 'unknown' }))
const view = await mountOptions({ ...BASE, client: rpc.client, mutate })
expect(reads).toHaveLength(1)
await act(async () => reads[0].resolve(OPTIONS))
await settle()
for (let turn = 1; turn <= 10; turn++) {
await view.rerender({ turnId: `turn-${turn}` })
}
expect(reads).toHaveLength(2)
await act(async () => reads[1].resolve({ ...OPTIONS, conversationCommands: ['clear'] }))
await settle()
expect(view.current().conversationCommands).toEqual([])
expect(reads).toHaveLength(3)
await act(async () => reads[2].resolve({ ...OPTIONS, conversationCommands: ['compact'] }))
await settle()
expect(reads).toHaveLength(3)
expect(view.current().conversationCommands).toEqual(['compact'])
await view.unmount()
})
it.each(['current', 'failed-then-wake', 'true-end'] as const)(
'settles a late refusal after a physical reset without losing progress (%s)',
async (schedule) => {
@@ -1,3 +1,8 @@
import * as selectionOperations from '../../../src/shared/structured-agent-session-selection-operations'
import {
rememberMobileCreatedStructuredSession,
mobileCreatedStructuredSession
} from './mobile-created-structured-sessions'
import { createElement } from 'react'
import { act, create, type ReactTestRenderer } from 'react-test-renderer'
import { describe, expect, it, vi } from 'vitest'
@@ -97,6 +102,7 @@ async function mountOptions(props: ProbeProps) {
await settle()
return {
pending: () => rendered.current?.pendingOptionId,
images: () => rendered.current?.acceptsImages,
offered: () => {
const entry = rendered.current?.optionSnapshot.find(
(descriptor) => descriptor.id === 'permissionMode'
@@ -131,19 +137,52 @@ async function mountOptions(props: ProbeProps) {
// STA-10671: a 1.4.224 host ignores per-chat modes and runs its own Agent Permissions.
describe('the permission pill against a host predating per-chat modes', () => {
it("says the chat runs the host's Agent Permissions, and offers nothing to pick", async () => {
it('publishes legacyHostPermissions only after a current options answer', async () => {
const factory = vi.spyOn(selectionOperations, 'createStructuredSessionSelectionController')
const old = Promise.withResolvers<AgentSessionOptionsResult>()
const current = Promise.withResolvers<AgentSessionOptionsResult>()
const rpc = optionsClient(undefined)
const send = rpc.client.sendRequest
let reads = 0
rpc.client.sendRequest = async (method, params, config) =>
method === 'agentSession.options'
? {
id: 'held',
ok: true,
result: await (++reads === 1 ? old.promise : current.promise),
_meta: { runtimeId: 'runtime-1' }
}
: send(method, params, config)
rememberMobileCreatedStructuredSession('session-1', '/workspace')
const options = await mountOptions({
client: optionsClient(undefined).client,
client: rpc.client,
fence: 1,
optionStamp: 'gpt-live|',
optionStamp: '',
hostAdvertisesPermissionModes: false
})
const constructed = factory.mock.results.at(-1)
if (constructed?.type !== 'return') {
throw new Error('Phone selection owner was not created')
}
const controller = constructed.value
await act(async () => {
const pick = controller.issue('model', 'gpt-live', null)
controller.settle(pick, { kind: 'unknown' })
})
await act(async () => old.resolve({ ...optionsFor(), acceptsImages: false }))
expect(options.permission()).toBeNull()
expect(options.images()).toBe(true)
expect(mobileCreatedStructuredSession('session-1')).toEqual({ worktree: '/workspace' })
await act(async () => current.resolve({ ...optionsFor(), acceptsImages: false }))
expect(options.permission()).toBe('host')
expect(options.offered()).toEqual(['host'])
expect(options.images()).toBe(false)
expect(mobileCreatedStructuredSession('session-1')).toBeUndefined()
vi.mocked(mutate).mockClear()
expect(await options.pick('own', true)).toBe(false)
expect(mutate).not.toHaveBeenCalled()
await options.unmount()
factory.mockRestore()
})
// 1.4.225–1.4.226 apply modes without advertising the capability: their stated mode wins.
@@ -34,6 +34,35 @@ beforeAll(async () => {
})
describe('useMobileStructuredAgentOptions fast mode', () => {
it('unlocks after the latest key settles and never restores an earlier pending key', async () => {
const client = optionsClient(queuedReads(FAST_OPTIONS))
const earlier = deferred<StructuredAgentSessionMutationResult<AgentSessionOptionResult>>()
const latest = deferred<StructuredAgentSessionMutationResult<AgentSessionOptionResult>>()
const { mutate } = recordingMutate(async (index) =>
index === 0 ? earlier.promise : latest.promise
)
const harness = await mountOptions({ ...BASE, client: client.client, mutate })
let first!: Promise<boolean>
let second!: Promise<boolean>
await act(async () => {
first = harness.current().setStructuredOption('effort', 'high')
second = harness.current().setStructuredOption('fastMode', true)
})
expect(harness.current().pendingOptionId).toBe('fastMode')
await act(async () => {
latest.resolve(accepted({ key: 'fastMode', value: 'true' }, true))
await second
})
expect(harness.current().pendingOptionId).toBeNull()
await act(async () => {
expect(await harness.current().setStructuredOption('effort', 'medium')).toBe(false)
earlier.resolve(accepted({ key: 'effort', value: 'high' }, true))
await first
})
expect(harness.current().pendingOptionId).toBeNull()
await harness.unmount()
})
it('round-trips a boolean fastMode pick as the wire string and remembers the decoded pick', async () => {
const client = optionsClient(queuedReads(FAST_OPTIONS, FAST_OPTIONS_ON))
const { calls, mutate } = recordingMutate(async () =>
@@ -4,29 +4,24 @@ import { useCallback, useLayoutEffect, useMemo, useRef } from 'react'
import { isAgentSessionHandleProvider } from '../../../src/shared/agent-session-provider-handle'
import { structuredAgentSessionSeedCatalog } from '../../../src/shared/structured-agent-session-seed-catalog'
import type { AgentSessionOptionResult } from '../../../src/shared/agent-session-wire'
import type { SessionOptionValue } from '../../../src/shared/native-chat/input/native-chat-session-options'
import {
canSetStructuredAgentSessionOption,
lockedStructuredAgentSessionOptionSnapshot,
structuredAgentSessionOptionPicks
} from '../../../src/shared/structured-agent-session-options'
import { lockedStructuredAgentSessionOptionSnapshot } from '../../../src/shared/structured-agent-session-options'
import {
structuredAgentSessionOptionView,
structuredAgentSessionSendSelection,
structuredAgentSessionMessageSelection,
structuredAgentSessionShownSnapshot
} from '../../../src/shared/structured-agent-session-option-view'
import {
AGENT_CHAT_PERMISSION_MODE_OPTION_ID,
agentChatPermissionModes
} from '../../../src/shared/agent-chat-permission-mode'
import { agentChatPermissionModes } from '../../../src/shared/agent-chat-permission-mode'
import { legacyHostPermissionDescriptor } from '../../../src/shared/structured-agent-session-permission-option'
import type { RpcClient } from '../transport/rpc-client'
import type { StructuredAgentSessionHostSupport } from './mobile-structured-agent-session-host-support'
import type { StructuredAgentSessionMutate } from './mobile-structured-agent-session-rpc'
import { useMobileHostModelCatalogUpgrade } from './use-mobile-host-model-catalog-upgrade'
import { mobileCreatedStructuredSession } from './mobile-created-structured-sessions'
import { encodeStructuredAgentSessionOptionValue } from '../../../src/shared/structured-agent-session-option-codec'
import {
acceptedStructuredSessionSelectionOutcome,
createStructuredAgentSessionOptionsWriteOwner
} from '../../../src/shared/structured-agent-session-options-write-owner'
import { useMobileStructuredOptionSurface } from './use-mobile-structured-option-surface'
const NO_COMMANDS: readonly AgentSessionConversationCommand[] = []
@@ -139,103 +134,52 @@ export function useMobileStructuredAgentOptions(args: {
? [...shown, legacyHostPermissionDescriptor()]
: shown
const setStructuredOption = useCallback(
async (id: string, value: SessionOptionValue): Promise<boolean> => {
const currentState = projectPermission({
...optionStateRef.current,
permissionOwnSupported: hostSupport ? hostSupport.permissionOwn === true : null
})
const view = structuredAgentSessionOptionView(currentState, undefined, controller.overlay())
const pickState = {
...view,
pendingId:
providerStarting ||
id === AGENT_CHAT_PERMISSION_MODE_OPTION_ID ||
!controller.isPending(id)
? null
: id
}
const encoded = encodeStructuredAgentSessionOptionValue(id, value)
if (
(id === AGENT_CHAT_PERMISSION_MODE_OPTION_ID &&
value === 'own' &&
!hostSupport?.permissionOwn) ||
!isCurrentContext() ||
awaitingOptions ||
!client ||
!sessionId ||
!optionCatalog ||
encoded === null ||
!canSetStructuredAgentSessionOption(
pickState,
id,
value,
lockSnapshotRef.current(
structuredAgentSessionShownSnapshot(
structuredAgentSessionOptionView(currentState, undefined, controller.overlay())
)
),
interactionReadyRef.current
)
) {
return false
}
const targetRecord = currentState.record
const model = structuredAgentSessionOptionPicks(view, { [id]: encoded })[0]?.modelId ?? null
const operation = controller.issue(id, encoded, model)
updateOptionState((current) => ({
...current,
pendingId: providerStarting || id === AGENT_CHAT_PERMISSION_MODE_OPTION_ID ? null : id
}))
void controller.flush(async (pick) => {
// A queued pick never retargets a replacement runtime.
if (activeOptionRecordRef.current !== targetRecord) {
return { kind: 'superseded' }
}
const result = await mutate<AgentSessionOptionResult>(
'agentSession.setOption',
'agentSession.setOption',
{
key: pick.key,
value: pick.value
}
)
return result.status === 'accepted'
? { kind: 'accepted', options: result.value.options ?? { [pick.key]: pick.value } }
: result.status === 'unknown'
? { kind: 'unknown' }
: { kind: 'refused' }
})
const outcome = await operation.result
if (activeOptionRecordRef.current === targetRecord) {
updateOptionState((current) => ({
...current,
pendingId:
current.pendingId !== null && controller.isPending(current.pendingId)
? current.pendingId
: null
}))
if (outcome.kind === 'refused') {
reread()
}
}
return outcome.kind !== 'refused'
},
[
hostSupport?.permissionOwn,
projectPermission,
providerStarting,
client,
awaitingOptions,
const readWriteContext = () => {
const currentState = projectPermission({
...optionStateRef.current,
permissionOwnSupported: hostSupport ? hostSupport.permissionOwn === true : null
})
const view = structuredAgentSessionOptionView(currentState, undefined, controller.overlay())
return {
controller,
mutate,
optionCatalog,
reread,
sessionId,
updateOptionState,
isCurrentContext
]
record: optionStateRef.current.record,
view,
snapshot: lockSnapshotRef.current(structuredAgentSessionShownSnapshot(view)),
ready: !awaitingOptions && !!client && !!sessionId && interactionReadyRef.current,
providerStarting,
isCurrentContext,
flush: (isCurrent: () => boolean) => {
controller.flush(async (pick) => {
// A queued pick never retargets a replacement runtime.
if (!isCurrent()) {
return { kind: 'superseded' }
}
const result = await mutate<AgentSessionOptionResult>(
'agentSession.setOption',
'agentSession.setOption',
{ key: pick.key, value: pick.value }
)
return result.status === 'accepted'
? acceptedStructuredSessionSelectionOutcome(pick, result.value.options)
: result.status === 'unknown'
? { kind: 'unknown' }
: { kind: 'refused' }
})
},
revalidate: reread,
revalidateOn: 'refused-current' as const
}
}
const writeContextRef = useRef(readWriteContext)
useLayoutEffect(() => {
writeContextRef.current = readWriteContext
})
const writer = useMemo(
() => createStructuredAgentSessionOptionsWriteOwner(() => writeContextRef.current()),
[]
)
useLayoutEffect(() => () => writer.detach(), [writer])
const setStructuredOption = writer.setOption
// Controls and capture derive from the same queried base and transient operations.
const sendSelection = useCallback(() => {
@@ -269,7 +213,7 @@ export function useMobileStructuredAgentOptions(args: {
(agent !== null && isAgentSessionHandleProvider(agent)),
optionSnapshot,
optionSurface,
pendingOptionId: optionState.pendingId,
pendingOptionId: writer.pendingOptionId(controller, optionState.record),
setStructuredOption,
invokeStructuredOption,
sendSelection
@@ -61,7 +61,9 @@ describe('mobile structured session background tasks', () => {
const client: RpcClient = {
sendRequest,
subscribe: (_method, _params, onData) => {
listener = onData
if (_method === 'agentSession.subscribe') {
listener = onData
}
return vi.fn()
},
updateTerminalSubscriptionViewport: () => {},
@@ -30,7 +30,9 @@ const sendRequest = vi.fn<RpcClient['sendRequest']>()
const client: RpcClient = {
sendRequest,
subscribe: vi.fn<RpcClient['subscribe']>((_method, _params, onData) => {
listener = onData
if (_method === 'agentSession.subscribe') {
listener = onData
}
return vi.fn()
}),
updateTerminalSubscriptionViewport: () => {},
@@ -82,7 +84,7 @@ async function sentDelivery(items: AgentJournalRenderItem[]): Promise<unknown> {
})
await vi.waitFor(() => expect(listener).toEqual(expect.any(Function)))
const event = snapshotEvent({ items })
act(() => listener?.(event))
await act(async () => listener?.(event))
await act(async () => {
await hook!.sendWithOutcome('carry on')
})
@@ -98,7 +100,9 @@ beforeEach(() => {
? mutationOk({ clientMessageId: 'client-1' })
: method === 'agentSession.options'
? ok({ models: [], current: {} })
: ok({})
: method === 'settings.get'
? ok({ settings: { nativeChatQueueFollowUps: true } })
: ok({})
)
})
@@ -136,14 +140,16 @@ async function afterStop(items: AgentJournalRenderItem[]): Promise<unknown> {
? new Promise(() => undefined)
: method === 'agentSession.options'
? ok({ models: [], current: {} })
: ok({})
: method === 'settings.get'
? ok({ settings: { nativeChatQueueFollowUps: true } })
: ok({})
)
act(() => {
renderer = create(createElement(Harness))
})
await vi.waitFor(() => expect(listener).toEqual(expect.any(Function)))
const event = snapshotEvent({ items: [...items, RUNNING_TURN] })
act(() => listener?.(event))
await act(async () => listener?.(event))
act(() => hook?.cancel())
expect(hook?.turnIndicator.stopping).toBe(true)
return hook?.turnIndicator.afterStop
@@ -43,6 +43,10 @@ const asyncStorage = vi.hoisted(() => ({
vi.mock('@react-native-async-storage/async-storage', () => ({ default: asyncStorage }))
function normalReply(method: string): RpcResponse {
// Queue is the default; explicit OFF is covered below.
if (method === 'settings.get') {
return ok({ settings: { nativeChatQueueFollowUps: true } })
}
if (method === 'agentSession.options') {
return ok({ models: [], current: {} })
}
@@ -61,12 +65,18 @@ describe('mobile structured queued messages', () => {
let renderer: ReactTestRenderer | null = null
let hook: ReturnType<typeof useMobileStructuredAgentSession> | null = null
let listener: ((value: unknown) => void) | null = null
let preferenceListener: ((value: unknown) => void) | null = null
let stored: Map<string, string>
const onSendError = vi.fn()
const appendText = vi.fn((_text: string) => true)
const sendRequest = vi.fn<RpcClient['sendRequest']>()
const subscribe = vi.fn<RpcClient['subscribe']>((_method, _params, onData) => {
listener = onData
if (_method === 'agentSession.subscribe') {
listener = onData
}
if (_method === 'runtime.clientEvents.subscribe') {
preferenceListener = onData
}
return vi.fn()
})
const client: RpcClient = {
@@ -121,6 +131,7 @@ describe('mobile structured queued messages', () => {
renderer = null
hook = null
listener = null
preferenceListener = null
}
function calls(method: string) {
@@ -249,7 +260,7 @@ describe('mobile structured queued messages', () => {
expect(asyncStorage.setItem).not.toHaveBeenCalled()
})
it("sends straight into the turn when the host's Queue follow-ups is off, as the desktop does", async () => {
it("sends straight into the turn when the host's setting is Steer, as the desktop does", async () => {
sendRequest.mockImplementation(async (method) => {
if (method === 'settings.get') {
return ok({ settings: { nativeChatQueueFollowUps: false } })
@@ -273,6 +284,105 @@ describe('mobile structured queued messages', () => {
expect('delivery' in requestOf('agentSession.send').params).toBe(false)
})
it.each(['steer', 'queue'] as const)(
'pre-turn host Working honors default and explicit choice (%s)',
async (behavior) => {
sendRequest.mockImplementation(async (method) => {
if (method === 'settings.get') {
return ok({ settings: { nativeChatQueueFollowUps: behavior === 'queue' } })
}
if (method === 'agentSession.send') {
return mutationOk({
clientMessageId: 'client-1',
submission: acceptedSubmission('client-1')
})
}
return normalReply(method)
})
await mountSession(CAPABLE, {
...snapshotEvent(),
page: {
...snapshotEvent().page,
working: true,
latestTurn: null,
nextQueuedMessageId: null
}
})
await act(async () => {})
expect(hook!.isWorking).toBe(true)
expect(hook!.sendFollowUp).toEqual({ action: behavior, offersChoice: true })
for (const alternate of [false, true]) {
await act(async () => {
await hook!.sendWithOutcome(
'pre-turn',
undefined,
undefined,
undefined,
[],
alternate ? { alternate: true } : undefined
)
})
expect(requestOf('agentSession.send', alternate ? 1 : 0).params.delivery).toBe(
(behavior === 'queue') !== alternate ? 'queue-if-active' : undefined
)
}
// A sheet opened during work sends against the current idle state.
await act(async () =>
listener?.({
...snapshotEvent(),
page: {
...snapshotEvent().page,
working: false,
latestTurn: null,
nextQueuedMessageId: null
}
})
)
await act(async () => {
await hook!.sendWithOutcome('now idle', undefined, undefined, undefined, [], {
alternate: true
})
})
expect(requestOf('agentSession.send', 2).params.delivery).toBe(
behavior === 'queue' ? 'queue-if-active' : undefined
)
}
)
it('sends using a changed host preference in the same connected chat', async () => {
sendRequest.mockImplementation(async (method) =>
method === 'agentSession.send'
? mutationOk({ clientMessageId: 'client-1', submission: acceptedSubmission('client-1') })
: normalReply(method)
)
await mountSession(CAPABLE, {
...snapshotEvent(),
page: {
...snapshotEvent().page,
working: true,
latestTurn: null,
nextQueuedMessageId: null
}
})
expect(hook!.sendFollowUp).toEqual({ action: 'queue', offersChoice: true })
await act(async () => {
await hook!.sendWithOutcome('queue by default')
})
expect(requestOf('agentSession.send').params.delivery).toBe('queue-if-active')
await act(async () =>
preferenceListener?.({ type: 'nativeChatQueueFollowUpsChanged', queueFollowUps: false })
)
expect(hook!.sendFollowUp).toEqual({ action: 'steer', offersChoice: true })
await act(async () => {
await hook!.sendWithOutcome('now steer')
})
expect(requestOf('agentSession.send', 1).params.delivery).toBeUndefined()
expect(
subscribe.mock.calls.filter(([method]) => method === 'agentSession.subscribe')
).toHaveLength(1)
expect(calls('settings.get')).toHaveLength(1)
})
it('keeps today’s request exactly against an incapable host', async () => {
sendRequest.mockImplementation(async (method) => {
if (method === 'agentSession.send') {
@@ -22,7 +22,9 @@ const sendRequest = vi.fn<RpcClient['sendRequest']>()
const client: RpcClient = {
sendRequest,
subscribe: vi.fn<RpcClient['subscribe']>((_method, _params, onData) => {
listener = onData
if (_method === 'agentSession.subscribe') {
listener = onData
}
return vi.fn()
}),
updateTerminalSubscriptionViewport: () => {},
@@ -57,7 +57,9 @@ it('draws one row for a run of provider retries, with what failed on its second
_meta: { runtimeId: 'runtime-1' }
}),
subscribe: (_method, _params, onData) => {
listener = onData
if (_method === 'agentSession.subscribe') {
listener = onData
}
return () => {}
},
updateTerminalSubscriptionViewport: () => {},
@@ -74,7 +74,9 @@ describe('mobile structured send actions', () => {
const onSendError = vi.fn()
const sendRequest = vi.fn<RpcClient['sendRequest']>()
const subscribe = vi.fn<RpcClient['subscribe']>((_method, _params, onData) => {
listener = onData
if (_method === 'agentSession.subscribe') {
listener = onData
}
return vi.fn()
})
const client: RpcClient = {
@@ -71,7 +71,9 @@ describe('useMobileStructuredAgentSession transcript', () => {
_meta: { runtimeId: 'runtime-1' }
})),
subscribe: vi.fn((_method: string, _params: unknown, onData: (value: unknown) => void) => {
listener = onData
if (_method === 'agentSession.subscribe') {
listener = onData
}
return () => {}
})
}
@@ -195,10 +195,14 @@ describe('useMobileStructuredAgentSession', () => {
let listener: ((value: unknown) => void) | null = null
const onSendError = vi.fn()
const unsubscribe = vi.fn()
const unsubscribePreference = vi.fn()
const sendRequest = vi.fn(defaultSendRequest)
const subscribe = vi.fn((_method: string, _params: unknown, onData: (value: unknown) => void) => {
listener = onData
return unsubscribe
if (_method === 'agentSession.subscribe') {
listener = onData
return unsubscribe
}
return unsubscribePreference
})
const client: RpcClient = {
sendRequest,
@@ -337,13 +341,17 @@ describe('useMobileStructuredAgentSession', () => {
sendRequest.mock.calls.filter(([method]) => method === 'agentSession.hold')
).toHaveLength(1)
)
await vi.waitFor(() => expect(subscribe).toHaveBeenCalledTimes(1))
await vi.waitFor(() =>
expect(
subscribe.mock.calls.filter(([method]) => method === 'agentSession.subscribe')
).toHaveLength(1)
)
// Reconnect must acquire the connection-scoped hold before replaying the stream.
await act(async () => {
renderer?.update(createElement(Harness, { connected: false }))
})
expect(unsubscribe).toHaveBeenCalledTimes(1)
expect([unsubscribe.mock.calls.length, unsubscribePreference.mock.calls.length]).toEqual([1, 1])
await act(async () => {
renderer?.update(createElement(Harness, { connected: true }))
})
@@ -353,19 +361,28 @@ describe('useMobileStructuredAgentSession', () => {
sendRequest.mock.calls.filter(([method]) => method === 'agentSession.hold')
).toHaveLength(2)
)
await vi.waitFor(() => expect(subscribe).toHaveBeenCalledTimes(2))
await vi.waitFor(() =>
expect(
subscribe.mock.calls.filter(([method]) => method === 'agentSession.subscribe')
).toHaveLength(2)
)
const holdOrders = sendRequest.mock.calls
.map((call, index) =>
call[0] === 'agentSession.hold' ? sendRequest.mock.invocationCallOrder[index] : null
)
.filter((order): order is number => order !== null)
const subscribeOrders = subscribe.mock.invocationCallOrder
const subscribeOrders = subscribe.mock.calls.flatMap(([method], index) =>
method === 'agentSession.subscribe' ? [subscribe.mock.invocationCallOrder[index]] : []
)
const secondHoldOrder = holdOrders[1]
const secondSubscribeOrder = subscribeOrders[1]
if (secondHoldOrder === undefined || secondSubscribeOrder === undefined) {
throw new Error('reconnect calls were not recorded')
}
expect(secondHoldOrder).toBeLessThan(secondSubscribeOrder)
await act(async () => renderer?.unmount())
renderer = null
expect([unsubscribe.mock.calls.length, unsubscribePreference.mock.calls.length]).toEqual([2, 2])
})
it('sends with the shared structured mutation envelope after the stream fence lands', async () => {
@@ -9,11 +9,10 @@ import {
import { withNativeChatCutTurnNotices } from '../../../src/shared/native-chat/transcript/native-chat-cut-turn-notice'
import { agentSessionTranscriptRows } from '../../../src/shared/agent-session-context-clear'
import { tuiAgentDisplayName } from '../../../src/shared/tui-agent-display-names'
import { isStructuredAgentSessionMainAgentWorking } from '../../../src/shared/structured-agent-session-main-agent-working'
import { mobileStructuredAgentSessionWorking } from './mobile-structured-agent-session-working'
import { isFinalAgentSessionReadRefusal } from '../../../src/shared/structured-agent-session-read-refusal'
import {
runningStructuredAgentSessionTurnId,
structuredAgentSessionHostSaysWorking,
structuredAgentSessionQueueSendsNext
} from '../../../src/shared/structured-agent-session-live-turn'
import {
@@ -152,9 +151,7 @@ export function useMobileStructuredAgentSession(
{ ...state, items: transcriptItems },
turnId
)
const isWorking = structuredAgentSessionHostSaysWorking(state.working, () =>
isStructuredAgentSessionMainAgentWorking(turnId, state.submissions, state.fence)
)
const isWorking = mobileStructuredAgentSessionWorking(state)
const queueSendsNext = structuredAgentSessionQueueSendsNext(state.nextQueuedMessageId, isWorking)
const backgroundTasks = useMobileStructuredBackgroundTasks({
sessionKey,
@@ -183,7 +180,8 @@ export function useMobileStructuredAgentSession(
hostStopping,
stopPressed: stopPress.pressed,
queueCapable,
queueFollowUps
queueFollowUps,
queueSendsNext
})
const { stopping } = turnIndicator
const sendWithOutcome = useMobileStructuredSendWithOutcome({
@@ -289,6 +287,7 @@ export function useMobileStructuredAgentSession(
},
isWorking: isWorking || queueSendsNext,
canStop,
sendFollowUp: turnIndicator.sendFollowUp ?? null,
turnId,
turnIndicator,
...turnTiming,
@@ -2,7 +2,10 @@ import { useCallback } from 'react'
import type { StructuredAgentId } from '../../../src/shared/agent-session-provider-handle'
import type { AgentSessionSlashCommand } from '../../../src/shared/agent-session-wire'
import { isStructuredAgentSessionComposerCommand } from '../../../src/shared/structured-agent-session-composer'
import type { MobileNativeChatSendOutcome } from './native-chat/mobile-native-chat-send'
import type {
MobileNativeChatSendIntent,
MobileNativeChatSendOutcome
} from './native-chat/mobile-native-chat-send'
import type { MobileNativeChatSendOrigin } from './native-chat/mobile-native-chat-pending-echo'
import type { StructuredMobileSendAttachment } from './use-mobile-structured-send-with-outcome'
import type { AgentJournalSkillRef } from '../../../src/shared/agent-session-journal-types'
@@ -19,7 +22,8 @@ export function useMobileStructuredNativeChatSendBridge(args: {
images?: string[],
deadline?: number,
attachments?: readonly StructuredMobileSendAttachment[],
skills?: readonly AgentJournalSkillRef[]
skills?: readonly AgentJournalSkillRef[],
intent?: MobileNativeChatSendIntent
) => Promise<MobileNativeChatSendOutcome>
captureSendOrigin: (text: string) => MobileNativeChatSendOrigin | null
clearDraftForSend: (origin: MobileNativeChatSendOrigin, text: string) => void
@@ -31,7 +35,9 @@ export function useMobileStructuredNativeChatSendBridge(args: {
text: string,
images?: string[],
deadline?: number,
attachments?: readonly StructuredMobileSendAttachment[]
attachments?: readonly StructuredMobileSendAttachment[],
sentAt?: number,
intent?: MobileNativeChatSendIntent
) => Promise<MobileNativeChatSendOutcome>
} {
const {
@@ -48,7 +54,9 @@ export function useMobileStructuredNativeChatSendBridge(args: {
text: string,
images?: string[],
deadline?: number,
attachments?: readonly StructuredMobileSendAttachment[]
attachments?: readonly StructuredMobileSendAttachment[],
_sentAt?: number,
intent?: MobileNativeChatSendIntent
): Promise<MobileNativeChatSendOutcome> => {
const origin = captureSendOrigin(text.trimEnd())
if (!origin) {
@@ -58,7 +66,9 @@ export function useMobileStructuredNativeChatSendBridge(args: {
const isHostCommand = isStructuredAgentSessionComposerCommand(text, agent, sessionCommands)
const skills = readMobileNativeChatPickedSkills(origin.draftKey)
clearDraftForSend(origin, text)
const outcome = await sendStructured(text, images, deadline, attachments, skills)
const outcome = await (intent
? sendStructured(text, images, deadline, attachments, skills, intent)
: sendStructured(text, images, deadline, attachments, skills))
// Accepted messages remain host-owned; restore commands whose reply was lost.
if (outcome === 'rejected' || (outcome === 'unknown' && isHostCommand)) {
restoreRejectedDraft(origin, text)
@@ -1,26 +1,15 @@
import { useCallback, useEffect, useRef, useState, useSyncExternalStore } from 'react'
import { useCallback, useEffect, useMemo, useRef, useState, useSyncExternalStore } from 'react'
import { mobileStructuredSessionStatusFeed } from './mobile-structured-session-status-feed'
import { projectRuntimePermission } from '../../../src/shared/structured-agent-session-permission-option'
import type { AgentSessionConversationCommand } from '../../../src/shared/agent-session/agent-session-conversation-command'
import { useMobileStructuredSelectionController } from './use-mobile-structured-selection-controller'
import type {
AgentSessionOptionsResult,
AgentSessionModelCatalogResult
} from '../../../src/shared/agent-session-wire'
import type { AgentSessionOptionsResult } from '../../../src/shared/agent-session-wire'
import { callAgentSession } from './mobile-structured-agent-session-rpc'
import { forgetMobileCreatedStructuredSession } from './mobile-created-structured-sessions'
import { createCoalescingKeyedRunner } from '../../../src/shared/coalescing-keyed-runner'
import { createStructuredAgentSessionOptionsReadOwner } from '../../../src/shared/structured-agent-session-options-read-owner'
import type { RpcClient } from '../transport/rpc-client'
import type { AgentSessionOptionCatalog } from '../../../src/shared/agent-session-option-catalog'
import { usesInstalledAgentModelCatalog } from '../../../src/shared/agent-model-catalog-ownership'
import { cloneStructuredAgentSessionOptionRecord } from '../../../src/shared/structured-agent-session-option-state'
import {
createStructuredAgentSessionOptionState,
applyStructuredAgentSessionOptions,
applyStructuredAgentSessionModelCatalog,
settleStructuredAgentSessionBuiltinCatalog,
type StructuredAgentSessionOptionState
} from '../../../src/shared/structured-agent-session-options'
import { createStructuredAgentSessionOptionState } from '../../../src/shared/structured-agent-session-options'
export function useMobileStructuredOptionState(args: {
client: RpcClient | null
@@ -67,31 +56,25 @@ export function useMobileStructuredOptionState(args: {
const projectPermission = <T extends { reportedPermissionMode?: string | null }>(state: T): T =>
projectRuntimePermission(state, summary, fence)
const coherentCatalog = usesInstalledAgentModelCatalog(agent ?? '', hostCoherentCatalog)
const [optionState, setOptionState] = useState(() =>
createStructuredAgentSessionOptionState(agent ?? 'codex', optionCatalog)
const [reader] = useState(() =>
createStructuredAgentSessionOptionsReadOwner(
createStructuredAgentSessionOptionState(agent ?? 'codex', optionCatalog)
)
)
const optionStateRef = useRef(optionState)
const activeOptionRecordRef = useRef(optionState.record)
const readEpoch = useRef(0)
const readRef = useRef<(() => void) | null>(null)
const reread = useCallback(() => {
readEpoch.current += 1
readRef.current?.()
}, [])
const { optionState, support } = useSyncExternalStore(reader.subscribe, reader.getSnapshot)
const {
optionStateRef,
activeOptionRecordRef,
updateOptionState,
receiveCatalog,
invalidate: reread
} = reader
const { controller, clientGeneration } = useMobileStructuredSelectionController({
agent,
client,
sessionId,
onRevalidate: reread
})
const updateOptionState = useCallback(
(update: (current: StructuredAgentSessionOptionState) => StructuredAgentSessionOptionState) => {
const next = update(optionStateRef.current)
optionStateRef.current = next
setOptionState(next)
},
[]
)
const contextKey = JSON.stringify([agent, sessionId, newLaunch, worktree, fence, connected])
const contextRef = useRef({ key: contextKey, client })
useEffect(() => {
@@ -101,151 +84,88 @@ export function useMobileStructuredOptionState(args: {
() => contextRef.current.key === contextKey && contextRef.current.client === client,
[contextKey, client]
)
const optionIdentityRef = useRef({ agent, sessionId, client, controller })
useEffect(() => {
const previousIdentity = optionIdentityRef.current
const sameSession =
previousIdentity.agent === agent &&
previousIdentity.sessionId === sessionId &&
previousIdentity.client === client &&
previousIdentity.controller === controller
optionIdentityRef.current = { agent, sessionId, client, controller }
const previous = optionStateRef.current
const seeded = createStructuredAgentSessionOptionState(agent ?? 'codex', optionCatalog)
// Retain account answers across fence changes instead of reviving placeholders.
const kept =
sameSession &&
(previous.optionsAnswerPresent ||
(previous.catalogSource !== 'seed' && previous.catalogSource !== null))
// Projected once per accepted answer so consumers keep stable references between answers.
const { conversationSupport, imageSupport } = useMemo(
() =>
support && support.sessionId !== null
? {
...previous,
record: cloneStructuredAgentSessionOptionRecord(previous.record),
pendingId: null,
reportedPermissionMode: undefined,
reportedEffort: undefined
conversationSupport: {
sessionId: support.sessionId,
fence: support.fence,
commands: support.result.conversationCommands ?? []
},
imageSupport: {
sessionId: support.sessionId,
acceptsImages: support.result.acceptsImages,
statesPermissionMode: support.result.current?.permissionMode !== undefined
}
}
: seeded
// Keep the chat’s mode visible through provider restarts.
const next = sameSession ? { ...kept, permissionMode: previous.permissionMode } : kept
readEpoch.current += 1
optionStateRef.current = next
activeOptionRecordRef.current = next.record
setOptionState(next)
}, [
agent,
enabled,
fence,
optionCatalog,
sessionId,
contextKey,
client,
clientGeneration,
controller
])
const [conversationSupport, setConversationSupport] = useState<{
sessionId: string
commands: readonly AgentSessionConversationCommand[]
fence: number | null
} | null>(null)
const [imageSupport, setImageSupport] = useState<{
sessionId: string
acceptsImages: boolean | undefined
statesPermissionMode: boolean
} | null>(null)
: { conversationSupport: null, imageSupport: null },
[support]
)
const awaitingOptions =
conversationSupport?.sessionId === sessionId && conversationSupport.fence !== fence
const receiveCatalog = (
catalog: AgentSessionModelCatalogResult | null,
_event: 'demand' | 'progress' | 'settled'
) => {
updateOptionState((current) =>
catalog && optionCatalog
? applyStructuredAgentSessionModelCatalog(current, optionCatalog, catalog, {
newLaunch,
coherentCatalog
useEffect(
() =>
reader.attach({
owner: [agent, sessionId, client, controller],
reset: [contextKey, clientGeneration, enabled, optionCatalog],
sessionId,
fence,
seed: () => createStructuredAgentSessionOptionState(agent ?? 'codex', optionCatalog),
controller,
eligible:
!!client &&
!!sessionId &&
enabled &&
!!optionCatalog &&
(!providerStarting || !newLaunch || !!sendSelection),
optionCatalog,
newLaunch,
coherentCatalog,
authority: () => client?.getGeneration?.(),
isCurrent: isCurrentContext,
request: () => {
if (!client || !sessionId) {
throw new Error('Options reader is not attached')
}
return callAgentSession<AgentSessionOptionsResult>(client, 'agentSession.options', {
sessionId
})
: settleStructuredAgentSessionBuiltinCatalog(current, false)
)
if (!coherentCatalog && catalog && catalog.origin !== 'unknown' && !catalog.listingInProgress) {
readRef.current?.()
}
}
},
accepted: () => {
if (sessionId) {
forgetMobileCreatedStructuredSession(sessionId)
}
}
}),
[
reader,
agent,
sessionId,
client,
controller,
contextKey,
clientGeneration,
enabled,
optionCatalog,
fence,
newLaunch,
coherentCatalog,
providerStarting,
sendSelection,
isCurrentContext
]
)
// A turn or host status change rereads within the same lease, as on desktop; it is not a new context.
const readStamp = JSON.stringify([optionStamp, turnId])
const seenReadStamp = useRef(readStamp)
useEffect(() => {
// Read each turn and after provider start; before start only a resumed chat has model evidence.
if (
!client ||
!sessionId ||
!enabled ||
!optionCatalog ||
(providerStarting && newLaunch && !sendSelection)
) {
return
if (seenReadStamp.current !== readStamp) {
seenReadStamp.current = readStamp
reread()
}
let stale = false
const run = createCoalescingKeyedRunner<void>()
const request = () => {
void run('options', 'latest', async () => {
if (stale || !isCurrentContext()) {
return
}
const record = activeOptionRecordRef.current
const epoch = readEpoch.current
const generation = client.getGeneration?.()
const completed = controller.captureRead()
const result = await callAgentSession<AgentSessionOptionsResult>(
client,
'agentSession.options',
{ sessionId }
)
if (stale || !isCurrentContext() || activeOptionRecordRef.current !== record) {
return
}
// Latch for this view; a later view may run the model selected here.
forgetMobileCreatedStructuredSession(sessionId)
setImageSupport({
sessionId,
acceptsImages: result.acceptsImages,
statesPermissionMode: result.current?.permissionMode !== undefined
})
if (readEpoch.current !== epoch || client.getGeneration?.() !== generation) {
return
}
setConversationSupport({ sessionId, fence, commands: result.conversationCommands ?? [] })
updateOptionState((current) =>
applyStructuredAgentSessionOptions(current, optionCatalog, result, {
newLaunch,
coherentCatalog
})
)
controller.retire(completed)
}).catch(() => undefined)
}
readRef.current = request
request()
return () => {
stale = true
readRef.current = null
}
}, [
client,
clientGeneration,
newLaunch,
enabled,
optionCatalog,
optionStamp,
sendSelection,
controller,
isCurrentContext,
coherentCatalog,
providerStarting,
sessionId,
fence,
turnId,
updateOptionState
])
}, [readStamp, reread])
return {
projectPermission,
@@ -2,6 +2,7 @@ import { selectAgentSessionCurrentRequests } from '../../../src/shared/agent-ses
import { useCallback } from 'react'
import { runningStructuredAgentSessionTurnId } from '../../../src/shared/structured-agent-session-live-turn'
import { mobileStructuredAgentSessionWorking } from './mobile-structured-agent-session-working'
import { structuredSessionBackgroundTasksView } from '../../../src/shared/structured-session-background-tasks-view'
import { agentSessionVisibleFailureFacts } from '../../../src/shared/agent-session-visible-failures'
import { tuiAgentDisplayName } from '../../../src/shared/tui-agent-display-names'
@@ -17,9 +18,15 @@ import { MAX_SKILL_REFS } from '../../../src/shared/rpc-contract/structured-agen
import type { StructuredAgentSessionComposerOptions } from '../../../src/shared/structured-agent-session-composer'
import type { AgentSessionSlashCommand } from '../../../src/shared/agent-session-wire'
import type { StructuredAgentSessionState } from '../../../src/shared/structured-agent-session-reducer'
import { structuredAgentSessionQueueEnabled } from '../../../src/shared/structured-agent-session-queued-cards'
import {
structuredAgentSessionFollowUpsQueue,
structuredAgentSessionQueueEnabled
} from '../../../src/shared/structured-agent-session-queued-cards'
import type { RpcClient } from '../transport/rpc-client'
import type { MobileNativeChatSendOutcome } from './native-chat/mobile-native-chat-send'
import type {
MobileNativeChatSendIntent,
MobileNativeChatSendOutcome
} from './native-chat/mobile-native-chat-send'
import { dispatchMobileStructuredCommand } from './mobile-structured-composer-command'
import type { MobileNativeChatSendErrorReporter } from './native-chat/use-mobile-native-chat-send-error'
import { sendMobileStructuredAgentSessionMessage } from './mobile-structured-agent-session-send'
@@ -33,15 +40,20 @@ import {
actionableStructuredQuestion
} from './mobile-structured-actionable-prompt'
/** The desktop's rule: the alternate flips the setting first, then the queue's own rules decide. */
export function mobileStructuredSendQueues(
queueCapable: boolean,
queueFollowUps: boolean,
state: Pick<StructuredAgentSessionState, 'items' | 'currentRequests' | 'queuedMessages'>
state: Pick<StructuredAgentSessionState, 'items' | 'currentRequests' | 'queuedMessages'>,
send: { alternate?: boolean; isWorking: boolean; stopping: boolean } = {
isWorking: false,
stopping: false
}
): boolean {
return (
queueCapable &&
structuredAgentSessionQueueEnabled(
queueFollowUps,
structuredAgentSessionFollowUpsQueue(queueFollowUps, send),
state,
selectAgentSessionCurrentRequests(state)
)
@@ -86,7 +98,8 @@ export function useMobileStructuredSendWithOutcome(args: {
images?: string[],
deadline?: number,
attachments?: readonly StructuredMobileSendAttachment[],
skills?: readonly AgentJournalSkillRef[]
skills?: readonly AgentJournalSkillRef[],
intent?: MobileNativeChatSendIntent
) => Promise<MobileNativeChatSendOutcome> {
const {
accept,
@@ -116,7 +129,8 @@ export function useMobileStructuredSendWithOutcome(args: {
images?: string[],
deadline?: number,
attachments?: readonly StructuredMobileSendAttachment[],
pickedSkills?: readonly AgentJournalSkillRef[]
pickedSkills?: readonly AgentJournalSkillRef[],
intent?: MobileNativeChatSendIntent
): Promise<MobileNativeChatSendOutcome> => {
const currentFence = stateRef.current.fence
if (!client || !sessionId || !enabled || currentFence === null) {
@@ -148,7 +162,7 @@ export function useMobileStructuredSendWithOutcome(args: {
const turnId = runningStructuredAgentSessionTurnId(state)
const tasks = structuredSessionBackgroundTasksView(state.backgroundTasks, turnId)
return {
working: turnId !== null || queueSendsNext,
working: mobileStructuredAgentSessionWorking(state) || queueSendsNext,
prompt: Boolean(
actionableStructuredApproval(state) || actionableStructuredQuestion(state)
),
@@ -207,7 +221,12 @@ export function useMobileStructuredSendWithOutcome(args: {
text: wireText,
attachments: imageAttachments,
skills,
...(mobileStructuredSendQueues(queueCapable, queueFollowUps, stateRef.current)
// Resolved from the chat as it is now: a hold-menu choice made mid-turn may land after it.
...(mobileStructuredSendQueues(queueCapable, queueFollowUps, stateRef.current, {
alternate: intent?.alternate,
isWorking: mobileStructuredAgentSessionWorking(stateRef.current) || queueSendsNext,
stopping
})
? { delivery: 'queue-if-active' as const }
: {}),
...captured,
@@ -64,7 +64,9 @@ describe('a structured send in the open chat', () => {
const client: RpcClient = {
sendRequest,
subscribe: vi.fn<RpcClient['subscribe']>((_method, _params, onData) => {
listener = onData
if (_method === 'agentSession.subscribe') {
listener = onData
}
return vi.fn()
}),
updateTerminalSubscriptionViewport: () => {},
@@ -44,7 +44,9 @@ describe('useMobileStructuredAgentSession turn indicator', () => {
_meta: { runtimeId: 'r1' }
}))
const subscribe = vi.fn((_method: string, _params: unknown, onData: (value: unknown) => void) => {
listener = onData
if (_method === 'agentSession.subscribe') {
listener = onData
}
return vi.fn()
})
const client: RpcClient = {
@@ -5,6 +5,10 @@ import { isStructuredAgentSessionThinking } from '../../../src/shared/structured
import { selectStructuredAgentTurnActivity } from '../../../src/shared/native-chat/transcript/native-chat-turn-activity'
import { agentStopDisplayStatus } from '../../../src/shared/agent-stop-display-status'
import { mobileStructuredSendQueues } from './use-mobile-structured-send-with-outcome'
import {
nativeChatSendFollowUp,
type NativeChatSendFollowUp
} from '../../../src/shared/native-chat-follow-up-behavior'
export function useMobileStructuredTurnIndicator(input: {
state: StructuredAgentSessionState
@@ -16,7 +20,12 @@ export function useMobileStructuredTurnIndicator(input: {
stopPressed: boolean
queueCapable: boolean
queueFollowUps: boolean
}): NativeChatLiveTurnIndicator & { stopping: boolean } {
/** The send's own working test counts a queued card about to send. */
queueSendsNext: boolean
}): NativeChatLiveTurnIndicator & {
stopping: boolean
sendFollowUp?: NativeChatSendFollowUp
} {
const { state, turnId, hostStopping, stopPressed, queueCapable, queueFollowUps } = input
const activityText = useMemo(
() => selectStructuredAgentTurnActivity(state.items, turnId, state.activity)?.text ?? null,
@@ -31,14 +40,38 @@ export function useMobileStructuredTurnIndicator(input: {
? ('queue' as const)
: ('send' as const)
: undefined
const isWorking = input.isWorking || input.queueSendsNext
const sendFollowUp =
queueCapable && working && !stopping
? nativeChatSendFollowUp((alternate) =>
mobileStructuredSendQueues(queueCapable, queueFollowUps, state, {
alternate,
isWorking,
stopping
})
)
: null
const followUpAction = sendFollowUp?.action
const followUpOffersChoice = sendFollowUp?.offersChoice === true
return useMemo(
() => ({
thinking,
activityText,
stopping,
stopRequestInFlight,
...(followUpAction
? { sendFollowUp: { action: followUpAction, offersChoice: followUpOffersChoice } }
: {}),
...(afterStop ? { afterStop } : {})
}),
[thinking, activityText, stopping, stopRequestInFlight, afterStop]
[
thinking,
activityText,
stopping,
stopRequestInFlight,
followUpAction,
followUpOffersChoice,
afterStop
]
)
}

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