Merge remote-tracking branch 'origin/main' into brennanb2025/session-search-worker

# Conflicts:
#	src/renderer/src/components/right-sidebar/ai-vault/search/use-ai-vault-search.test.tsx
This commit is contained in:
Brennan Benson
2026-11-08 14:07:49 -08:00
706 changed files with 6034 additions and 5300 deletions
+12 -5
View File
@@ -12,22 +12,29 @@ on:
- 'config/oxlint-performance-audit.json'
- 'config/oxlint-plugins/*performance.mjs'
- 'config/oxlint-plugins/quadratic-buffer-concat.mjs'
- 'config/scripts/*-plugin.test.mjs'
- '!config/scripts/static-analysis/oxlint-contracts/renderer-scrollbar-style-plugin.test.mjs'
# Keep in sync with the contract list in config/vitest.performance.config.ts;
- 'config/scripts/static-analysis/oxlint-contracts/app-store-performance-plugin.test.mjs'
- 'config/scripts/static-analysis/oxlint-contracts/quadratic-buffer-concat-plugin.test.mjs'
- '**/*.performance.test.ts'
- '**/*.performance.test.tsx'
# Contracts without the .performance suffix. Keep in sync with config/vitest.performance.config.ts;
# without these a rename lands green and only breaks the next nightly.
- 'src/main/native-chat/agent-session-wire/host/testing/structured-agent-session-terminal-writer-acquire.test.ts'
- 'src/main/runtime/session-tabs/session-tabs-phone-layout-moves.test.ts'
- 'src/renderer/src/components/terminal-pane/pty-connection/startup/saved-resume-cancellation.test.ts'
- 'src/main/native-chat/agent-session-wire/host/testing/structured-agent-session-terminal-writer-acquire.test.ts'
- 'src/shared/agent-launch/permissions/tui-agent-permission-choice.test.ts'
- 'src/main/runtime/rpc/methods/projects/repo.test.ts'
- 'src/renderer/src/components/tab-bar/use-new-tab-agent-menu-host-preferences.test.tsx'
- 'src/main/sqlite/sync-database.test.ts'
- 'src/main/runtime/orchestration/db/row-column-lists.test.ts'
- 'src/shared/native-chat/tools/native-chat-tool-pairing.performance.test.ts'
- 'src/main/codex-usage/codex-rollout-file-lifetime.test.ts'
- 'src/main/codex-usage/scanner-incremental-append.test.ts'
- 'src/main/usage/jsonl-file-reader.test.ts'
- 'src/main/usage/jsonl-file-snapshot.test.ts'
- 'src/renderer/src/lib/pane-manager/pane-terminal-output-scheduler-queue-retention.test.ts'
- 'src/renderer/src/store/diagnostics/store-identity-churn-probe.test.ts'
- 'src/main/claude-usage/scanner-incremental-append.test.ts'
- 'src/main/claude-usage/store-checkpoint-persistence.test.ts'
- 'src/renderer/src/components/native-chat/surfaces/integration/NativeChatResolvedView.streaming-input.test.tsx'
permissions:
contents: read
+1 -1
View File
@@ -1,6 +1,6 @@
// The CLI loads these paths after electron-vite replaces out/main.
export const CLI_MAIN_ENTRY_NAMES = [
'agent-hooks/managed-agent-hook-controls',
'agent-hooks/installation/managed-agent-hook-controls',
'gitlab/project-ref-parser',
'orca-profiles/profile-index-store',
'claude-accounts/keychain',
+19 -23
View File
@@ -2,7 +2,7 @@
# This is a RATCHET: counts may only go DOWN. Run `pnpm lint:ast-grep:flaky-tests` to list them.
# Prune after a fix: pnpm check:flaky-test-pattern-ratchet --prune
1 test-no-in-test-import-actual:src/cli/runtime/launch-serve-replaced-app-restart.test.ts
1 test-no-in-test-import-actual:src/main/agent-hooks/server-status-persist-nonblocking.test.ts
1 test-no-in-test-import-actual:src/main/agent-hooks/server/testing/persistence/server-status-persist-nonblocking.test.ts
1 test-no-in-test-import-actual:src/main/bitbucket/credential-connection.test.ts
4 test-no-in-test-import-actual:src/main/bitbucket/credential-store.test.ts
1 test-no-in-test-import-actual:src/main/bitbucket/status-no-decrypt.test.ts
@@ -148,12 +148,12 @@
1 test-no-polling-loop:tests/e2e/workspace-sleep-in-main.spec.ts
2 test-no-polling-loop:tests/e2e/worktree-card-downward-drag.spec.ts
1 test-no-real-time-wait:mobile/src/terminal/terminal-webview-tap-routing.test.ts
1 test-no-real-time-wait:src/main/agent-hooks/posix-hook-json-stdin-reader.test.ts
3 test-no-real-time-wait:src/main/agent-hooks/server-copilot-normalization.test.ts
2 test-no-real-time-wait:src/main/agent-hooks/server-transport-interference.test.ts
1 test-no-real-time-wait:src/main/agent-hooks/server-turn-ended-at.test.ts
1 test-no-real-time-wait:src/main/agent-hooks/server-turn-started-at.test.ts
5 test-no-real-time-wait:src/main/agent-hooks/wsl-hook-relay-manager.test.ts
1 test-no-real-time-wait:src/main/agent-hooks/installation/scripts/posix-hook-json-stdin-reader.test.ts
3 test-no-real-time-wait:src/main/agent-hooks/server/testing/transcripts/server-transcript-result-retry.test.ts
2 test-no-real-time-wait:src/main/agent-hooks/server/testing/http/server-transport-interference.test.ts
1 test-no-real-time-wait:src/main/agent-hooks/server/testing/main-agent/server-turn-ended-at.test.ts
1 test-no-real-time-wait:src/main/agent-hooks/server/testing/main-agent/server-turn-started-at.test.ts
5 test-no-real-time-wait:src/main/agent-hooks/wsl-relay/wsl-hook-relay-manager.test.ts
1 test-no-real-time-wait:src/main/ai-vault/scanners/opencode/reader-transport/session-scanner-opencode-sqlite-process.test.ts
2 test-no-real-time-wait:src/main/ai-vault/scanners/opencode/sqlite/session-scanner-opencode-sqlite-scan-scope.test.ts
1 test-no-real-time-wait:src/main/antigravity/windows-hook-json-post.test.ts
@@ -224,7 +224,6 @@
1 test-no-real-time-wait:src/main/managed-server/lifecycle/orcad-managed-tunnel-local-port.test.ts
1 test-no-real-time-wait:src/main/native-chat/agent-session-wire/host/testing/structured-agent-session-claude-echo-working.test.ts
1 test-no-real-time-wait:src/main/native-chat/agent-session-wire/host/testing/structured-agent-session-queued-quit.test.ts
1 test-no-real-time-wait:src/main/native-chat/agent-session-wire/recovery/testing/structured-agent-session-restart-cap.test.ts
1 test-no-real-time-wait:src/main/native-chat/agent-session-wire/recovery/testing/structured-agent-session-target-reconcile.test.ts
1 test-no-real-time-wait:src/main/provider-process/provider-group-orphan-guard.integration.test.ts
2 test-no-real-time-wait:src/main/provider-process/provider-process-supervisor.integration.test.ts
@@ -464,20 +463,18 @@
1 test-no-wall-clock:config/scripts/worktree-storage/reclaim-release-test-caches.test.ts
1 test-no-wall-clock:mobile/scripts/native-build-cache.test.ts
1 test-no-wall-clock:mobile/src/pairing/mobile-relay-invite-director.test.ts
1 test-no-wall-clock:mobile/src/transport/relay/mobile-relay-resume-director.test.ts
1 test-no-wall-clock:src/cli/format.test.ts
2 test-no-wall-clock:src/cli/runtime/serve-appimage-update.test.ts
4 test-no-wall-clock:src/cli/runtime/serve-bundle-park.test.ts
5 test-no-wall-clock:src/cli/runtime/serve-pid1-init-reaper.test.ts
1 test-no-wall-clock:src/cli/runtime/status-caller.test.ts
2 test-no-wall-clock:src/main/agent-hooks/managed-hook-timeout.test.ts
2 test-no-wall-clock:src/main/agent-hooks/posix-hook-json-stdin-reader.test.ts
1 test-no-wall-clock:src/main/agent-hooks/server-codex-capacity.test.ts
1 test-no-wall-clock:src/main/agent-hooks/server-endpoint-file-lifecycle.test.ts
3 test-no-wall-clock:src/main/agent-hooks/server-ingest-structured-status.test.ts
4 test-no-wall-clock:src/main/agent-hooks/server-launch-resume-identity.test.ts
5 test-no-wall-clock:src/main/agent-hooks/spool.test.ts
2 test-no-wall-clock:src/main/agent-hooks/windows-native-hook-exe-hosts.test.ts
2 test-no-wall-clock:src/main/agent-hooks/installation/scripts/managed-hook-timeout.test.ts
2 test-no-wall-clock:src/main/agent-hooks/installation/scripts/posix-hook-json-stdin-reader.test.ts
1 test-no-wall-clock:src/main/agent-hooks/server/testing/providers/codex/server-codex-capacity.test.ts
1 test-no-wall-clock:src/main/agent-hooks/server/testing/http/server-endpoint-file-lifecycle.test.ts
3 test-no-wall-clock:src/main/agent-hooks/server/testing/structured-ingress/server-ingest-structured-status.test.ts
4 test-no-wall-clock:src/main/agent-hooks/server/testing/identity/server-launch-resume-identity.test.ts
5 test-no-wall-clock:src/main/agent-hooks/server/testing/replay/spool.test.ts
2 test-no-wall-clock:src/main/agent-hooks/installation/commands/windows-native-hook-exe-hosts.test.ts
2 test-no-wall-clock:src/main/ai-vault-search/session-search-indexer.test.ts
1 test-no-wall-clock:src/main/ai-vault/parse-cache/session-parse-cache-preview-upgrade.test.ts
1 test-no-wall-clock:src/main/ai-vault/scanners/copilot/session-scanner-copilot-cache-upgrade.test.ts
@@ -623,7 +620,7 @@
4 test-no-wall-clock:src/main/skills/runtime-upload/skill-upload-process-restart.integration.test.ts
4 test-no-wall-clock:src/main/sqlite/sync-database.test.ts
4 test-no-wall-clock:src/main/managed-server/activation/orcad-exited-own-fence-mutation-race.test.ts
8 test-no-wall-clock:src/main/managed-server/activation/orcad-exited-own-fence.test.ts
6 test-no-wall-clock:src/main/managed-server/activation/orcad-exited-own-fence.test.ts
4 test-no-wall-clock:src/main/managed-server/activation/orcad-exited-own-install-lock.test.ts
2 test-no-wall-clock:src/main/managed-server/activation/orcad-exited-own-lock-windows.test.ts
4 test-no-wall-clock:src/main/ssh/remote-exec/ssh-remote-commands.test.ts
@@ -706,9 +703,9 @@
1 test-timeout-needs-reason:src/cli/runtime/serve-pid1-init-reaper.test.ts
1 test-timeout-needs-reason:src/cli/skills-install.test.ts
2 test-timeout-needs-reason:src/main/acp/journal/acp-structured-broken-stream.test.ts
4 test-timeout-needs-reason:src/main/agent-hooks/server-transport-interference.test.ts
1 test-timeout-needs-reason:src/main/agent-hooks/wsl-hook-relay-live.integration.test.ts
1 test-timeout-needs-reason:src/main/agent-hooks/wsl-hook-relay-manager.test.ts
4 test-timeout-needs-reason:src/main/agent-hooks/server/testing/http/server-transport-interference.test.ts
1 test-timeout-needs-reason:src/main/agent-hooks/wsl-relay/testing/wsl-hook-relay-live.integration.test.ts
1 test-timeout-needs-reason:src/main/agent-hooks/wsl-relay/wsl-hook-relay-manager.test.ts
1 test-timeout-needs-reason:src/main/ai-vault/parse-cache/session-parse-cache-large-scan.test.ts
1 test-timeout-needs-reason:src/main/antigravity/native-macos-credentials.real.test.ts
1 test-timeout-needs-reason:src/main/antigravity/posix-hook-invocation.test.ts
@@ -786,7 +783,6 @@
1 test-timeout-needs-reason:src/main/skills/install/skill-bundle-process-termination.integration.test.ts
1 test-timeout-needs-reason:src/main/sqlite/sync-database-concurrent-backup.test.ts
2 test-timeout-needs-reason:src/main/ssh/connection/ssh-connection-sftp-wire.test.ts
1 test-timeout-needs-reason:src/main/managed-server/activation/orcad-exited-own-fence.test.ts
1 test-timeout-needs-reason:src/main/ssh/file-transfer/ssh-exec-stdin-file-transfer.test.ts
2 test-timeout-needs-reason:src/main/ssh/system-transport/forwarding/system-ssh-forward-process-real-openssh.test.ts
2 test-timeout-needs-reason:src/main/startup/single-instance-lock-exit.electron.test.ts
+1 -1
View File
@@ -15,7 +15,7 @@
"src/main/worker-thread-child-process/worker-thread-child-process-entry.ts",
"src/main/ipc/filesystem/watcher-process/parcel-watcher-process-entry.ts",
"src/main/hang-watchdog/main-thread-hang-watchdog-entry.ts",
"src/main/agent-hooks/managed-agent-hook-controls.ts",
"src/main/agent-hooks/installation/managed-agent-hook-controls.ts",
"src/main/claude-accounts/keychain.ts",
"src/renderer/src/main.tsx",
"src/renderer/src/popout.tsx",
+617
View File
@@ -0,0 +1,617 @@
# Synchronous node:fs calls (every *Sync export) in production src/main and src/shared, per file.
# Startup-only or one-shot uses are fine to keep; per-RPC, per-spawn, per-focus or per-poll uses are the target.
# This is a RATCHET: counts may only go DOWN.
# Prune after removing calls: pnpm check:main-sync-fs-ratchet --prune
1 src/main/agent-hooks/first-work/first-work-rename-runtime.ts
2 src/main/agent-hooks/installation/configuration/hook-config-write-path.ts
1 src/main/agent-hooks/installation/configuration/hooks-json-read.ts
11 src/main/agent-hooks/installation/configuration/hooks-json-write.ts
6 src/main/agent-hooks/installation/scripts/locked-executable-rename.ts
9 src/main/agent-hooks/installation/scripts/managed-hook-script-write.ts
1 src/main/agent-hooks/server/server-hydration.ts
1 src/main/agent-hooks/wsl-relay/wsl-hook-relay-deps.ts
3 src/main/agent-hooks/wsl-relay/wsl-hook-relay-launch.ts
1 src/main/agent-launch/trust/agent-trust-ownership-ledger.ts
14 src/main/agent-launch/trust/agent-trust-presets.ts
2 src/main/agent-launch/trust/antigravity-workspace-trust-ownership.ts
1 src/main/agent-launch/trust/execution-host-workspace-trust.ts
4 src/main/ai-vault/parse-cache/session-parse-cache-legacy-json.ts
2 src/main/ai-vault/scan-service/session-scanner-service-entry-path.ts
1 src/main/ai-vault/scan-service/session-scanner-service-spawn.ts
1 src/main/ai-vault/scanners/omp/omp-session-root.ts
1 src/main/ai-vault/scanners/opencode/reader-transport/opencode-wsl-runtime-preparation.ts
2 src/main/ai-vault/scanners/opencode/reader-transport/session-scanner-opencode-sqlite-worker-spawn.ts
8 src/main/amp/hook-service.ts
2 src/main/amp/managed-plugin-install-status.ts
1 src/main/antigravity/antigravity-host-acp.ts
1 src/main/antigravity/native-account-launch.ts
5 src/main/antigravity/native-account-store.ts
2 src/main/antigravity/native-credential-backend.ts
7 src/main/antigravity/native-file-credentials.ts
12 src/main/artifacts/artifact-create-intent-store.ts
2 src/main/artifacts/artifact-share-record-store.ts
1 src/main/automations/external-manager-discovery.ts
7 src/main/bitbucket/credential-store.ts
1 src/main/browser-passwords/browser-password-chromium-import.ts
2 src/main/browser-passwords/browser-password-vault-file.ts
2 src/main/browser/agent-browser/agent-browser-bridge-process.ts
2 src/main/browser/agent-browser/agent-browser-dependency-binary.ts
2 src/main/browser/agent-browser/agent-browser-process-environment.ts
1 src/main/browser/agent-browser/agent-browser-session-reset.ts
2 src/main/browser/client-hosts/file-transfers/browser-client-download-relay.ts
1 src/main/browser/client-hosts/file-transfers/browser-client-upload-staging.ts
2 src/main/browser/client-hosts/leases/browser-host-client-identity.ts
1 src/main/browser/cookies/browser-cookie-import-diagnostics.ts
2 src/main/browser/cookies/chromium/chromium-cookie-path.ts
4 src/main/browser/cookies/chromium/chromium-cookie-snapshot.ts
1 src/main/browser/cookies/chromium/import-cookies.ts
3 src/main/browser/cookies/client-route/client-route-cookie-import-source-store.ts
2 src/main/browser/cookies/sources/browser-cookie-detection.ts
8 src/main/browser/cookies/sources/browser-cookie-firefox-import.ts
2 src/main/browser/cookies/sources/browser-cookie-key.ts
1 src/main/browser/cookies/sources/browser-cookie-safari-import.ts
5 src/main/browser/cookies/sources/browser-cookie-source-profiles.ts
11 src/main/browser/cookies/staging/browser-session-cookie-staging.ts
1 src/main/browser/downloads/browser-download-destination.ts
2 src/main/browser/extensions/api-runtime/browser-extension-worker-shim-source.ts
8 src/main/browser/extensions/installation/browser-extension-install-store.ts
1 src/main/browser/extensions/installation/browser-extension-load-directory.ts
1 src/main/browser/extensions/profile-sessions/browser-extension-session-loader.ts
2 src/main/browser/extensions/profile-storage/browser-extension-data-removal.ts
8 src/main/browser/extensions/profile-storage/browser-extension-profile-document-store.ts
4 src/main/browser/extensions/profile-storage/browser-extension-profile-state-store.ts
3 src/main/browser/extensions/profile-storage/browser-extension-retired-profile-storage.ts
1 src/main/browser/guest-lifecycle/popups/browser-popup-background-cdp-probe.ts
2 src/main/browser/guest-lifecycle/popups/popup-identity-electron-probe.ts
1 src/main/browser/identity/browser-identity-mode-record.ts
2 src/main/browser/identity/browser-identity-mode-store.ts
2 src/main/browser/network/egress/browser-route-egress-electron-launch.ts
4 src/main/browser/network/execution-routes/wsl-browser-network-relay-launch.ts
5 src/main/browser/routing/partitions/browser-route-partition-binding-file.ts
3 src/main/browser/routing/partitions/browser-route-partition-binding-store.ts
4 src/main/browser/routing/partitions/browser-route-partition-pending-deletes.ts
4 src/main/browser/sessions/browser-session-meta-store.ts
2 src/main/browser/site-settings/browser-profile-site-store.ts
7 src/main/claude-accounts/claude-account-folder.ts
1 src/main/claude-accounts/claude-observed-config-dirs.ts
14 src/main/claude-accounts/claude-profile-history.ts
2 src/main/claude-accounts/claude-profile-homes.ts
1 src/main/claude-accounts/claude-profile-launch-preparation.ts
7 src/main/claude-accounts/claude-profile-paths.ts
26 src/main/claude-accounts/claude-profile-prompt-history.ts
5 src/main/claude-accounts/claude-profile-provisioning.ts
5 src/main/claude-accounts/claude-profile-router.ts
1 src/main/claude-accounts/claude-profile-settings.ts
1 src/main/claude-accounts/claude-profile-setup-worker.ts
1 src/main/claude-accounts/claude-profile-setup.ts
12 src/main/claude-accounts/claude-profile-sharing.ts
1 src/main/claude-accounts/claude-profile-wsl-router.ts
2 src/main/claude-accounts/keychain.ts
1 src/main/claude-accounts/runtime-paths.ts
3 src/main/claude/agent-view/agent-view-install.ts
1 src/main/claude/claude-diff-panel-auto-open.ts
14 src/main/claude/claude-folder-trust-file.ts
2 src/main/claude/claude-profile-hook-target.ts
1 src/main/claude/claude-rejected-api-key.ts
1 src/main/claude/claude-rewind-transcript.ts
1 src/main/claude/hook-service.ts
3 src/main/claude/statusline-install.ts
6 src/main/claude/windows-hook-files.ts
1 src/main/cli/appimage-copy-pre-extraction.ts
3 src/main/cli/appimage-extracted-root.ts
1 src/main/cli/appimage-extraction-pruning.ts
2 src/main/cli/appimage-generation-lease.ts
4 src/main/cli/appimage-generation-residency.ts
16 src/main/cli/appimage-stable-launcher.ts
1 src/main/cli/cli-command-inspection.ts
1 src/main/cli/cli-dev-launcher.ts
3 src/main/cli/cli-install-location.ts
2 src/main/cli/linux-bare-orca-dispatcher.ts
7 src/main/cli/linux-terminal-orca-cli-shim.ts
2 src/main/cli/wsl-managed-cli.ts
2 src/main/codex-accounts/codex-account-identity.ts
3 src/main/codex-accounts/codex-account-registration.ts
4 src/main/codex-accounts/codex-config-mirror.ts
1 src/main/codex-accounts/codex-credential-absence-grace.ts
1 src/main/codex-accounts/codex-login-auth-snapshot.ts
5 src/main/codex-accounts/codex-managed-home-lifecycle.ts
6 src/main/codex-accounts/codex-managed-home-path.ts
17 src/main/codex-accounts/fs-utils.ts
1 src/main/codex-accounts/guest-codex-account-homes.ts
6 src/main/codex-accounts/host-codex-managed-home-ownership.ts
2 src/main/codex-accounts/legacy-shared-auth-migration.ts
21 src/main/codex-accounts/legacy-wsl-runtime-auth-drain-recovery-script-harness.ts
36 src/main/codex-accounts/legacy-wsl-runtime-auth-drain-script-harness.ts
6 src/main/codex-accounts/legacy-wsl-runtime-auth-drain-script-interference-shims.ts
1 src/main/codex-accounts/managed-codex-auth-readiness.ts
7 src/main/codex-accounts/runtime-home-service-auth-core.ts
5 src/main/codex-accounts/runtime-home-service-auth-provenance.ts
23 src/main/codex-accounts/runtime-home-service-auth-sync.ts
19 src/main/codex-accounts/runtime-home-service-legacy-migration.ts
1 src/main/codex-accounts/runtime-home-service-managed-home.ts
14 src/main/codex-accounts/runtime-home-service-paths.ts
1 src/main/codex-accounts/runtime-home-service-sync.ts
2 src/main/codex-accounts/runtime-home-service-wsl-core.ts
1 src/main/codex-usage/codex-session-file-discovery.ts
1 src/main/codex/configuration/codex-path-observation.ts
21 src/main/codex/configuration/homes/codex-home-paths.ts
6 src/main/codex/configuration/homes/codex-managed-home-resource-copy-marker.ts
8 src/main/codex/configuration/homes/codex-managed-home-rules.ts
5 src/main/codex/configuration/homes/codex-pane-account-registry.ts
5 src/main/codex/configuration/homes/codex-windows-sandbox-read-grant.ts
1 src/main/codex/configuration/settings/codex-config-path-reference-rewrite.ts
1 src/main/codex/configuration/settings/config-settings-baseline.ts
5 src/main/codex/configuration/settings/config-settings-promotion-write-target.ts
3 src/main/codex/configuration/settings/config-settings-promotion.ts
1 src/main/codex/configuration/shared-server/codex-daemon-socket-path-guard.ts
8 src/main/codex/configuration/toml/config-toml-atomic-write.ts
4 src/main/codex/history/backfill/codex-session-backfill-marker.ts
17 src/main/codex/history/bridges/codex-session-bridge.ts
5 src/main/codex/history/index/codex-session-index-heal-state.ts
2 src/main/codex/history/index/codex-state-db.ts
2 src/main/codex/history/resume/codex-session-resume-home.ts
2 src/main/codex/history/rollouts/codex-account-home-discovery.ts
1 src/main/codex/history/rollouts/codex-session-file-listing.ts
2 src/main/codex/history/rollouts/codex-session-link.ts
1 src/main/codex/hooks/installation/codex-hook-local-install.ts
2 src/main/codex/hooks/installation/codex-hook-local-maintenance.ts
4 src/main/codex/hooks/reconciliation/codex-hook-legacy-cleanup.ts
2 src/main/codex/hooks/reconciliation/codex-hook-status.ts
4 src/main/codex/hooks/reconciliation/codex-real-home-hooks-json.ts
3 src/main/codex/trust/grants/codex-trust-grant-ledger.ts
2 src/main/codex/trust/hooks/codex-hook-trust-derivation.ts
1 src/main/codex/trust/hooks/codex-hook-trust-memo.ts
2 src/main/codex/trust/hooks/codex-hook-user-mirroring.ts
4 src/main/codex/trust/hooks/hook-trust-promotion.ts
1 src/main/codex/trust/identity/codex-trust-identity.ts
1 src/main/codex/trust/toml/config-toml-project-trust.ts
7 src/main/codex/trust/toml/config-toml-trust.ts
2 src/main/computer/desktop-script-provider-paths.ts
1 src/main/computer/macos-native-provider-client.ts
3 src/main/computer/macos-native-provider-paths.ts
5 src/main/computer/macos-native-provider-transport.ts
1 src/main/computer/sidecar-client.ts
3 src/main/connector-cloud/connector-turn-events.ts
1 src/main/copilot/hook-service.ts
4 src/main/crash-reporting/appimage-crashpad-handler-exit.ts
2 src/main/credentials/credential-file-protection.ts
6 src/main/credentials/encrypted-api-key-file-store.ts
10 src/main/credentials/integration-credential-file.ts
1 src/main/credentials/integration-state-file-cache.ts
1 src/main/credentials/integration-token-file-cache.ts
2 src/main/credentials/saved-credential-readability.ts
2 src/main/daemon/admission/automatic-work-run-marker-store.ts
5 src/main/daemon/admission/host-terminal-ledger.ts
1 src/main/daemon/admission/legacy-restore-records.ts
1 src/main/daemon/daemon-entry.ts
1 src/main/daemon/endpoint/identity/daemon-endpoint-incarnation.ts
3 src/main/daemon/endpoint/identity/daemon-pid-identity.ts
2 src/main/daemon/endpoint/identity/daemon-pid-record-quarantine.ts
2 src/main/daemon/endpoint/identity/daemon-process-start-time.ts
2 src/main/daemon/endpoint/identity/daemon-ready-identity.ts
3 src/main/daemon/endpoint/publication/daemon-endpoint-lifecycle.ts
7 src/main/daemon/endpoint/publication/daemon-endpoint-ownership.ts
1 src/main/daemon/endpoint/publication/daemon-endpoint-probe.ts
3 src/main/daemon/endpoint/publication/daemon-private-file-modes.ts
2 src/main/daemon/endpoint/publication/daemon-socket-endpoint-path.ts
3 src/main/daemon/executable-host/linux/daemon-appimage-generation-launch.ts
1 src/main/daemon/executable-host/linux/daemon-appimage-launch.ts
3 src/main/daemon/executable-host/linux/daemon-host-image.ts
2 src/main/daemon/executable-host/macos/macos-daemon-bundle.ts
9 src/main/daemon/executable-host/windows/daemon-host-build-inventory.ts
2 src/main/daemon/executable-host/windows/daemon-host-file-hash-cache.ts
3 src/main/daemon/executable-host/windows/daemon-host-manifest.ts
2 src/main/daemon/executable-host/windows/daemon-host-reclaim.ts
12 src/main/daemon/executable-host/windows/daemon-host-relocation.ts
4 src/main/daemon/health/daemon-health.ts
4 src/main/daemon/history/restoration/history-reader.ts
1 src/main/daemon/history/restoration/terminal-history-checkpoint-reader.ts
1 src/main/daemon/history/restoration/terminal-history-legacy-scrollback-restore.ts
1 src/main/daemon/history/storage/history-manager.ts
3 src/main/daemon/history/storage/terminal-history-metadata.ts
2 src/main/daemon/history/storage/terminal-history-permission-repair.ts
8 src/main/daemon/history/storage/terminal-history-recovery-quarantine.ts
1 src/main/daemon/history/storage/terminal-history-session-files.ts
3 src/main/daemon/history/storage/terminal-history-session-tombstone.ts
6 src/main/daemon/history/storage/terminal-history-session-writer.ts
1 src/main/daemon/launch/daemon-bundle-staleness.ts
1 src/main/daemon/launch/daemon-endpoint-adoption.ts
3 src/main/daemon/launch/daemon-generation-liveness.ts
2 src/main/daemon/launch/daemon-launch-paths.ts
1 src/main/daemon/launch/daemon-legacy-process-liveness.ts
2 src/main/daemon/launch/daemon-protocol-cleanup.ts
11 src/main/daemon/launch/daemon-spawner.ts
1 src/main/daemon/launch/daemon-stale-kill.ts
1 src/main/daemon/observability/daemon-adoption-telemetry-event.ts
1 src/main/daemon/observability/daemon-file-log.ts
3 src/main/daemon/permissions/daemon-tcc-attribution.ts
5 src/main/daemon/process-scopes/daemon-cgroup-scope.ts
1 src/main/daemon/process-scopes/daemon-user-manager-lifetime.ts
1 src/main/daemon/process-scopes/terminal-scopes-runtime.ts
2 src/main/daemon/process-scopes/terminal-scopes.ts
1 src/main/daemon/providers/adapter/daemon-pty-daemon-recovery.ts
1 src/main/daemon/providers/adapter/daemon-pty-session-inventory.ts
1 src/main/daemon/providers/routing/daemon-legacy-adapters.ts
2 src/main/daemon/pty-subprocess/spawn-preflight.ts
1 src/main/daemon/shell-readiness/shell-ready.ts
1 src/main/daemon/transport/client/daemon-client-token.ts
2 src/main/daemon/transport/stream/daemon-stream-backlog-probe.ts
4 src/main/devin/hook-config-json.ts
3 src/main/dsh/dsh-hook-packages.ts
3 src/main/dsh/hook-service.ts
1 src/main/emulator/android/android-sdk-host-discovery.ts
7 src/main/emulator/android/scrcpy-server-download.ts
1 src/main/emulator/emulator-probe.ts
2 src/main/emulator/serve-sim-detached-session.ts
7 src/main/emulator/serve-sim-execution.ts
17 src/main/emulator/serve-sim-runtime-materializer.ts
12 src/main/external-editors/external-editor-launch.ts
9 src/main/filesystem/durable-file-write.ts
2 src/main/filesystem/rolling-file-backup.ts
2 src/main/foreign-sqlite-readers/foreign-sqlite-reader-entry-path.ts
1 src/main/foreign-sqlite-readers/foreign-sqlite-reader-spawn.ts
1 src/main/foreign-sqlite-readers/readers/cursor-profile.ts
1 src/main/foreign-sqlite-readers/readers/opencode-binder-sessions.ts
1 src/main/git/huge-folder-ignore.ts
5 src/main/git/repo-detection.ts
13 src/main/git/repo-git-marker-scan.ts
3 src/main/git/worktrees/catalog/worktree-git-path.ts
1 src/main/github/client/check/check-job-log-cache-retention-child.mjs
3 src/main/grok/grok-hook-backup-cleanup.ts
3 src/main/grok/grok-hook-owners.ts
4 src/main/grok/grok-hook-symlink-cleanup-marker.ts
4 src/main/grok/hook-service.ts
4 src/main/hang-watchdog/hang-detection-marker.ts
1 src/main/hang-watchdog/hang-watchdog-worker-path.ts
1 src/main/hang-watchdog/previous-hang-detection.ts
1 src/main/hermes/hermes-default-home.ts
10 src/main/hermes/hermes-home-filesystem.ts
2 src/main/hermes/hook-service.ts
2 src/main/host/secret-protection-report.ts
1 src/main/ipc/app.ts
1 src/main/ipc/command-path/command-path-directory-worker-client.ts
1 src/main/ipc/command-path/command-path-resolver.ts
4 src/main/ipc/diagnostics.ts
2 src/main/ipc/filesystem/access/filesystem-path-containment.ts
2 src/main/ipc/filesystem/watcher-process/parcel-watcher-canary-directory.ts
1 src/main/ipc/filesystem/watcher-process/parcel-watcher-child-launch.ts
4 src/main/ipc/filesystem/watcher-process/parcel-watcher-delivery-canary.ts
3 src/main/ipc/filesystem/watcher-process/parcel-watcher-entry-path.ts
1 src/main/ipc/filesystem/watcher-process/parcel-watcher-shallow-file-subscription.ts
1 src/main/ipc/filesystem/watcher-process/parcel-watcher-shallow-subscription.ts
1 src/main/ipc/filesystem/watcher-process/parcel-watcher-supervisor-subscribe.ts
1 src/main/ipc/filesystem/watcher-process/rebinding-file-watch.ts
1 src/main/ipc/filesystem/watcher-process/watcher-event-root-path-rewrite.ts
1 src/main/ipc/macos-keyboard-layout-snapshot.ts
1 src/main/ipc/notification-authorization-status.ts
1 src/main/ipc/pty/spawn-pane-env.ts
1 src/main/ipc/ssh/ssh-connect-flow.ts
2 src/main/ipc/worktree-remote.ts
2 src/main/ipc/wsl-guest-windows-drive-path.ts
7 src/main/jcode/hook-service.ts
8 src/main/jira/site-credential-store.ts
7 src/main/keybindings/keybinding-file-parser.ts
1 src/main/keybindings/keybinding-file.ts
13 src/main/kimi/hook-service.ts
3 src/main/kiro/hook-service.ts
1 src/main/kiro/standalone-hooks.ts
4 src/main/linear/linear-credential-paths.ts
3 src/main/linear/linear-legacy-viewer-store.ts
1 src/main/linear/linear-token-store.ts
3 src/main/linear/linear-workspace-registry.ts
1 src/main/macos-permissions/macos-tcc-prompt-notice.ts
3 src/main/managed-data-accounts/credential-capture.ts
18 src/main/managed-data-accounts/profile-removal.ts
10 src/main/managed-data-accounts/service.ts
1 src/main/managed-server/activation/orcad-held-fence-tokens.ts
1 src/main/managed-server/install/orcad-deployment-target.ts
2 src/main/managed-server/install/remote-versioned-install.ts
1 src/main/memory/darwin-process-footprint.ts
13 src/main/mimo/hook-service.ts
6 src/main/minimax/minimax-cookie-store.ts
1 src/main/muse/hook-config-json.ts
4 src/main/muse/hook-service.ts
2 src/main/native-chat/agent-session-attachments/agent-session-attachment-claims.ts
1 src/main/native-chat/agent-session-journal/database/journal-host-database.ts
1 src/main/native-chat/host-readable-transcript-path.ts
2 src/main/native-chat/wsl-transcript-fs-process-spawn.ts
1 src/main/node-runtime/appimage-bundled-node-runtime.ts
2 src/main/node-runtime/managed-runtime-release-install.ts
7 src/main/node-runtime/managed-runtime-release.ts
11 src/main/notebook/python-environments.ts
1 src/main/observability/bounded-log-file-writer.ts
2 src/main/observability/bundle.ts
6 src/main/observability/local-file-sink.ts
14 src/main/opencode/hook-service.ts
1 src/main/opencode/legacy-plugin-acl-retry.ts
2 src/main/opencode/opencode-overlay-manifest.ts
1 src/main/opencode/opencode-plugin-config-writer.ts
1 src/main/opencode/opencode-private-server.ts
1 src/main/opencode/opencode-wsl-text-task.ts
2 src/main/orca-profiles/new-profile-state.ts
3 src/main/orca-profiles/other-profile-workspace-catalog.ts
3 src/main/orca-profiles/profile-artifact-cloud-cleanup.ts
1 src/main/orca-profiles/profile-cloud-index.ts
4 src/main/orca-profiles/profile-cloud-session-store.ts
12 src/main/orca-profiles/profile-index-store.ts
5 src/main/orca-profiles/profile-legacy-state-import.ts
4 src/main/orca-profiles/profile-project-move-intent.ts
3 src/main/orca-profiles/profile-project-move-record.ts
4 src/main/orca-profiles/profile-project-state-file.ts
2 src/main/orcad/launcher.ts
7 src/main/orcad/node-pty-prebuilt-slot.ts
2 src/main/orcad/node-pty-precondition.ts
2 src/main/orcad/orcad-agent-browser-binary.ts
1 src/main/orcad/orcad-app-paths.ts
1 src/main/orcad/orcad-artifact-identity.ts
2 src/main/orcad/orcad-artifact-materializer.ts
12 src/main/orcad/orcad-bundled-runtime.ts
2 src/main/orcad/orcad-cli-launcher.ts
1 src/main/orcad/orcad-command-arguments.ts
1 src/main/orcad/orcad-completed-stop-receipt.ts
2 src/main/orcad/orcad-daemon-slot-pins.ts
2 src/main/orcad/orcad-data-root-locality.ts
3 src/main/orcad/orcad-data-root-privacy.ts
4 src/main/orcad/orcad-host-account-launch-env-store.ts
1 src/main/orcad/orcad-host-adapters.ts
2 src/main/orcad/orcad-idle-stop-record.ts
3 src/main/orcad/orcad-instance-lock-hold.ts
16 src/main/orcad/orcad-instance-lock-reclaim.ts
4 src/main/orcad/orcad-instance-lock.ts
7 src/main/orcad/orcad-local-serve-selection.ts
1 src/main/orcad/orcad-lock-clone-machine.ts
1 src/main/orcad/orcad-managed-stop-cancellation.ts
3 src/main/orcad/orcad-managed-stop-decision.ts
2 src/main/orcad/orcad-managed-stop-request.ts
4 src/main/orcad/orcad-plaintext-credential-migration.ts
5 src/main/orcad/orcad-process-start-time.ts
11 src/main/orcad/orcad-secret-key-record.ts
3 src/main/orcad/orcad-stale-lock-reclaim.ts
1 src/main/orcad/orcad-stop-request-listener.ts
1 src/main/orcad/orcad-wsl-holder-release.ts
2 src/main/orcad/orcad-wsl-host-claude-profile-refresh.ts
1 src/main/orcad/serve-profile-ssh-targets.ts
6 src/main/persistence/atomic-snapshot-writer.ts
6 src/main/persistence/loading-store/user-data-path.ts
3 src/main/persistence/loading-store/write-flush-barriers.ts
9 src/main/persistence/migrating-orcad-catalog/migration-journal-directory.ts
4 src/main/persistence/migrating-orcad-catalog/orcad-migration-blob-installers.ts
3 src/main/persistence/migrating-orcad-catalog/orcad-migration-blob-staging.ts
17 src/main/persistence/migrating-orcad-catalog/orcad-migration-staged-file.ts
1 src/main/persistence/migrating-orcad-catalog/orcad-scrollback-snapshot-transfer.ts
11 src/main/persistence/migrating-orcad-catalog/orcad-shell-history-installer.ts
7 src/main/persistence/migrating-orcad-catalog/orcad-terminal-history-installer.ts
1 src/main/persistence/migrating-orcad-catalog/orcad-terminal-restore-hint-store.ts
1 src/main/persistence/moving-wsl-projects/wsl-move-orchestration-history-rewrite.ts
1 src/main/persistence/moving-wsl-projects/wsl-move-orchestrator-store.ts
6 src/main/persistence/moving-wsl-projects/wsl-move-slept-scrollback.ts
2 src/main/persistence/moving-wsl-projects/wsl-move-slept-spool-sweep.ts
5 src/main/persistence/preferences/active-view-preference.ts
4 src/main/persistence/profile-state/legacy-json/profile-state-authority-exports.ts
2 src/main/persistence/profile-state/legacy-json/profile-state-export-path.ts
1 src/main/persistence/profile-state/legacy-json/profile-state-legacy-backup-path.ts
2 src/main/persistence/profile-state/legacy-json/profile-state-legacy-import.ts
8 src/main/persistence/profile-state/legacy-json/profile-state-recovery.ts
6 src/main/persistence/profile-state/legacy-json/profile-state-versioned-export.ts
5 src/main/persistence/profile-state/profile-state-access-identity.ts
12 src/main/persistence/profile-state/profile-state-access-owner.ts
3 src/main/persistence/profile-state/profile-state-access.ts
2 src/main/persistence/profile-state/profile-state-active-location.ts
5 src/main/persistence/profile-state/profile-state-authority-bootstrap.ts
1 src/main/persistence/profile-state/profile-state-authority-marker.ts
2 src/main/persistence/profile-state/profile-state-backup-path.ts
2 src/main/persistence/profile-state/profile-state-backup-worker.ts
5 src/main/persistence/profile-state/profile-state-database-quarantine.ts
9 src/main/persistence/profile-state/profile-state-database-recovery.ts
2 src/main/persistence/profile-state/profile-state-database.ts
4 src/main/persistence/profile-state/profile-state-migration.ts
6 src/main/persistence/profile-state/profile-state-offline-settings.ts
6 src/main/persistence/profile-state/profile-state-recovery-command.ts
8 src/main/persistence/profile-state/profile-state-recovery-copy.ts
2 src/main/persistence/profile-state/profile-state-recovery-crash-process.ts
1 src/main/persistence/profile-state/profile-state-recovery-required.ts
2 src/main/persistence/profile-state/profile-state-section-repair.ts
2 src/main/persistence/profile-state/profile-state-sqlite-authority.ts
1 src/main/persistence/profile-state/profile-state-startup-recovery-dialog.ts
2 src/main/persistence/profile-state/profile-state-storage-classification.ts
1 src/main/persistence/profile-state/profile-state-writer-worker-path.ts
2 src/main/persistence/restoring-sessions/floating-workspace-normalization.ts
1 src/main/persistence/tracking-repos/worktree-metadata-normalization.ts
1 src/main/persistence/window-save-divergence.ts
8 src/main/pi/legacy-omp-overlay-migration.ts
5 src/main/pi/titlebar-extension-service.ts
3 src/main/plugins/appearance/plugin-appearance-service.ts
2 src/main/plugins/installation/plugin-install-staging.ts
1 src/main/plugins/installation/plugin-install.ts
1 src/main/plugins/panels/plugin-frame-guest-sessions.ts
1 src/main/plugins/panels/plugin-source-transpile-client.ts
2 src/main/plugins/plugin-dev-watcher.ts
3 src/main/plugins/plugin-secrets-store.ts
3 src/main/plugins/plugin-storage-store.ts
1 src/main/plugins/testing/plugin-editor-static-check.ts
1 src/main/plugins/workers/plugin-host-process.ts
3 src/main/plugins/workers/plugin-worker-source-hooks.ts
8 src/main/ports/darwin-port-scan-lock.ts
1 src/main/ports/port-scan-command-client.ts
1 src/main/ports/port-scan-command-execution.ts
2 src/main/provider-process/provider-executable-missing.ts
5 src/main/providers/local-pty/local-pty-executable-spawn.ts
1 src/main/providers/local-pty/local-pty-session-operations.ts
1 src/main/providers/local-pty/local-pty-shell-ready-wrapper-root.ts
1 src/main/providers/macos-login-session-pty-probe.ts
3 src/main/providers/macos-tcc-login-shell.ts
3 src/main/providers/windows-powershell-executable.ts
2 src/main/providers/working-directory-validation.ts
4 src/main/pty/history/fish-history-session.ts
4 src/main/pty/history/terminal-history-deletion.ts
2 src/main/pty/history/terminal-history-paths.ts
5 src/main/pty/history/terminal-history.ts
1 src/main/pty/process-retirement/posix-pty-process-table.ts
12 src/main/pty/scrollback/overlay-mirror.ts
1 src/main/pty/scrollback/terminal-scrollback-snapshot-nonblocking-reads.ts
11 src/main/pty/scrollback/terminal-scrollback-snapshots.ts
2 src/main/pty/shell-startup/codex-shell-launch-preflight.ts
7 src/main/pty/shell-startup/git-bash.ts
3 src/main/pty/shell-startup/legacy-terminal-posix-tombstone.ts
9 src/main/pty/shell-startup/legacy-terminal-shim-dir.ts
1 src/main/pty/shell-startup/managed-ssh-host-login-shell.ts
1 src/main/pty/shell-startup/powershell-profile-env.ts
3 src/main/pty/shell-startup/shell-startup-env.ts
5 src/main/pty/shell-startup/shell-wrapper-file-writer.ts
6 src/main/pty/shell-startup/zsh-startup-hook-pty-harness.ts
2 src/main/pty/shell-startup/zsh-wrapper-dir-ownership.ts
1 src/main/qoder/workspace-trust.ts
4 src/main/rate-limits/cursor-auth.ts
2 src/main/rate-limits/grok-auth.ts
3 src/main/rate-limits/hidden-probe-cwd.ts
2 src/main/rate-limits/opencode-go-api-key-source.ts
1 src/main/rate-limits/zcode-usage-credentials.ts
3 src/main/ripgrep/bundled-ripgrep-path.ts
8 src/main/runtime/agent-session/ownership/agent-session-claim-identity.ts
1 src/main/runtime/agent-session/records/agent-session-record-store-slot.ts
7 src/main/runtime/agent-session/records/agent-session-runtime-end-record.ts
1 src/main/runtime/agent-session/structured-agent-session-attachment-wiring.ts
1 src/main/runtime/client/navigation/desktop-chat-creation-history.ts
4 src/main/runtime/hosts/platform-probe/host-descriptor.ts
5 src/main/runtime/mobile-cloud-relay/relay-region-preference.ts
2 src/main/runtime/mobile-cloud-relay/relay-revoke-outbox.ts
1 src/main/runtime/orchestration/db/runtime-orchestration-database-access.ts
1 src/main/runtime/push/notifications/mobile-notification-dismissal-store.ts
2 src/main/runtime/push/push-unregister-outbox.ts
2 src/main/runtime/rpc/methods/mobile-delivery/bundled-mobile-web-bundle.ts
1 src/main/runtime/rpc/server/network-source-policy-store.ts
2 src/main/runtime/rpc/server/pairing/device-registry-corruption.ts
2 src/main/runtime/rpc/server/pairing/device-registry-disk-merge.ts
1 src/main/runtime/rpc/server/pairing/device-registry-file-read.ts
3 src/main/runtime/rpc/server/pairing/e2ee-keypair.ts
3 src/main/runtime/rpc/server/runtime-metadata.ts
2 src/main/runtime/rpc/server/runtime-rpc-socket-metadata.ts
5 src/main/runtime/rpc/unix-socket-transport.ts
3 src/main/runtime/rpc/ws-fallback-port-store.ts
2 src/main/runtime/terminal/launch/claude-agent-teams-shim-env.ts
1 src/main/runtime/workspaces/persisted-surfaces/crew-operations.ts
1 src/main/server/serve-pairing-output.ts
2 src/main/speech/model-cache-path.ts
9 src/main/speech/model-manager.ts
10 src/main/speech/openai-api-key-store.ts
2 src/main/speech/speech-model-download-cleanup.ts
1 src/main/speech/speech-model-download-transport.ts
2 src/main/speech/speech-model-http-download.ts
1 src/main/speech/stt-worker-model-config.ts
2 src/main/speech/stt-worker-paths.ts
2 src/main/sqlite/harden-database-files.ts
1 src/main/sqlite/sync-database.ts
1 src/main/sqlite/versioned-cache-database.ts
1 src/main/ssh/authentication/ssh-auth-resolution.ts
2 src/main/ssh/config/ssh-config-alias-claim.ts
5 src/main/ssh/config/ssh-config-include-expander.ts
1 src/main/ssh/config/ssh-config-parser.ts
1 src/main/ssh/config/ssh-g-config-resolution.ts
3 src/main/ssh/system-transport/file-transfer/system-ssh-sftp-transfer.ts
3 src/main/ssh/system-transport/ssh-control-socket.ts
3 src/main/ssh/system-transport/system-ssh-binary.ts
3 src/main/startup/cli-launch-redirect.ts
2 src/main/startup/configure-process.ts
4 src/main/startup/gpu-fallback-marker.ts
2 src/main/startup/http1-compatibility-marker.ts
5 src/main/startup/http1-compatibility-profile-state.ts
1 src/main/startup/linux-dev-shm-policy.ts
4 src/main/startup/linux-realtime-scheduling-guard.ts
1 src/main/startup/linux-rttime-limit.ts
2 src/main/startup/profile-state-recovery-preflight.ts
1 src/main/startup/startup-diagnostics.ts
1 src/main/startup/windows-app-data-path.ts
5 src/main/startup/windows-install-dir-acl-poison-marker.ts
1 src/main/startup/windows-install-dir-acl-probe.ts
1 src/main/startup/windows-install-dir-package-acl-grant.ts
4 src/main/startup/windows-install-dir-package-acl-repair.ts
3 src/main/startup/windows-renderer-runtime-files.ts
3 src/main/startup/windows-user-data-acl.ts
6 src/main/startup/x-display-artifacts.ts
2 src/main/stats/stats-file-loader.ts
2 src/main/text-generation/source-control-prompt-files.ts
1 src/main/updater/lifecycle/windows-update-install-directory.ts
9 src/main/updater/linux-package/appimage-runtime-identity.ts
1 src/main/updater/linux-package/linux-package-install-command.ts
1 src/main/updater/linux-package/linux-update-package-type.ts
6 src/main/updater/serve-update-handoff.ts
2 src/main/usage/usage-provider-store-lifecycle.ts
1 src/main/usage/usage-scan-worker-spawn.ts
1 src/main/warp-themes/discovery.ts
1 src/main/window/desktop-integration/custom-app-icon.ts
3 src/main/window/desktop-integration/macos-press-and-hold-default.ts
1 src/main/windows/windows-administrator-restart.ts
1 src/main/windows/windows-command-paths.ts
1 src/main/windows/windows-process-table.ts
1 src/main/worker-thread-child-process/worker-thread-child-process.ts
2 src/main/worker-threads/forked-child-entry-path.ts
4 src/main/workspace-hooks/hooks.ts
10 src/main/workspace-hooks/issue-command-file.ts
4 src/main/workspace-hooks/worktree-runner-script.ts
1 src/main/workspaces/catalog/folder-repo-git-conversion.ts
2 src/main/workspaces/catalog/folder-upgrade-worktree-path.ts
3 src/main/workspaces/execution-host/project-runtime-git-router.ts
1 src/main/workspaces/space-analysis/workspace-space-scan-worker-client.ts
1 src/main/wsl/execution/wsl-executable-path.ts
1 src/main/wsl/execution/wsl-interop-spawn-directory.ts
1 src/main/wsl/execution/wsl-node-runtime-prefetch.ts
3 src/main/wsl/filesystem/wsl-drive-project-new-default.ts
10 src/main/wsl/filesystem/wsl-drive-unc-conversion-stores.ts
2 src/main/wsl/host-lifecycle/wsl-host-automation-wake-store.ts
4 src/main/wsl/host-lifecycle/wsl-host-e2e-fake-connector.ts
1 src/main/wsl/host-lifecycle/wsl-host-early-wake.ts
1 src/main/wsl/host-lifecycle/wsl-orphan-holder-release.ts
1 src/main/zcode/hook-config-json.ts
12 src/main/zcode/zcode-plan-api-key-store.ts
6 src/shared/agent-hook-listener/claude-session-continuation.ts
4 src/shared/agent-hook-listener/reverse-file-region-scan.ts
3 src/shared/agent-hook-listener/transcript-reader.ts
3 src/shared/agent-hook-listener/transport/agent-hook-endpoint-temp-cleanup.ts
13 src/shared/agent-hook-listener/transport/agent-hook-spool.ts
5 src/shared/agent-hook-listener/transport/endpoint-publication.ts
4 src/shared/agent-launch/startup/omp-fresh-config.ts
2 src/shared/appimage-cache-identity.ts
2 src/shared/bundled-web-client-manifest.ts
3 src/shared/bundled-web-client-root.ts
5 src/shared/cli-fs-reads.ts
3 src/shared/cli-runtime-pairing-inputs.ts
9 src/shared/codex-rollout-jsonl-cursor.ts
1 src/shared/codex-subagent-roster.ts
4 src/shared/ephemeral-vm-recipe-doctor.ts
1 src/shared/ephemeral-vm-recipe-runner.ts
1 src/shared/ephemeral-vm-runtime-feature-store.ts
1 src/shared/ephemeral-vm-runtime-store.ts
6 src/shared/file-content/node-bounded-file-reader.ts
5 src/shared/file-content/node-file-content-equality.ts
6 src/shared/file-content/node-source-copy-content-equality.ts
3 src/shared/grok-session-paths.ts
2 src/shared/jcode-session-files.ts
1 src/shared/muse-session-log.ts
1 src/shared/opencode-installed-plugin.ts
10 src/shared/opencode-plugin-atomic-write.ts
5 src/shared/opencode-tui-config-registration.ts
1 src/shared/opencode-tui-plugin-install.ts
2 src/shared/orcad-build-identity.ts
1 src/shared/plugins/declarative/testing/orca-testing.ts
2 src/shared/real-path-sync.ts
1 src/shared/remote-runtime/e2ee/node/remote-runtime-e2ee-v2-host-latch.ts
1 src/shared/remote-runtime/host-store/runtime-e2ee-keypair-file.ts
1 src/shared/remote-runtime/host-store/runtime-environment-sidecar.ts
2 src/shared/remote-runtime/host-store/runtime-environment-store-read-cache.ts
2 src/shared/remote-runtime/host-store/runtime-environment-store-records.ts
1 src/shared/remote-runtime/host-store/wsl-host-deployment-store.ts
13 src/shared/secure-storage/secure-file.ts
1 src/shared/secure-storage/secure-path-metadata-snapshot.ts
1 src/shared/secure-storage/secure-path-windows-acl.ts
3 src/shared/serve-abort-park.ts
7 src/shared/serve-bundle-park.ts
1 src/shared/serve-user-data-path.ts
3 src/shared/source-scan/source-tree-scan.ts
5 src/shared/startup-command-staging.ts
1 src/shared/terminal/pty/native-process/pty-process-ceiling-state.ts
8 src/shared/windows-breakaway-launcher.ts
3 src/shared/windows-console-input.ts
2 src/shared/windows-interactive-login-spawn.ts
2 src/shared/windows-retry-file-operations.ts
2 src/shared/windows-security-addon.ts
1 src/shared/windows-transient-lock-removal.ts
+1 -1
View File
@@ -5,7 +5,7 @@
# Some entries run in the daemon or orcad process, or are test harnesses outside the test-path
# conventions. This is a RATCHET: counts may only go DOWN.
# Prune after removing launches: pnpm check:main-sync-spawn-ratchet --prune
1 src/main/agent-hooks/installer-utils.ts
1 src/main/agent-hooks/installation/scripts/managed-hook-script-write.ts
1 src/main/browser/network/egress/browser-route-egress-electron-launch.ts
1 src/main/browser/routing/partitions/browser-route-partition-binding-store.ts
1 src/main/claude-accounts/runtime-auth-service.ts
+1 -1
View File
@@ -76,7 +76,7 @@ const ELECTRON_ARCHITECTURE_BY_ENUM = {
const PACKAGED_NATIVE_ARCHITECTURES = new Set(['ia32', 'x64', 'arm', 'arm64'])
const PACKAGED_MAIN_REQUIRED_FILES = [
'out/main/index.js',
'out/main/agent-hooks/managed-agent-hook-controls.js'
'out/main/agent-hooks/installation/managed-agent-hook-controls.js'
]
const PACKAGED_MAIN_SOURCE_RE = /^out\/main\/.+\.js$/
const TYPE_DECLARATION_ARTIFACT_RE = /\.d\.(?:c|m)?ts(?:\.map)?$/
+8
View File
@@ -54,3 +54,11 @@ identity, queue-admission or retained-memory oracle. Confirm it fails with the
old behavior. Use controlled, counterbalanced benchmark samples for timings;
avoid new machine-dependent millisecond gates in the normal unit suite. A green
source scan and these contracts cannot establish that the whole app is fast.
Two count ratchets (counts per file may only fall) cover classes the audit only warns about:
`pnpm check:main-sync-fs-ratchet` counts synchronous `node:fs` calls (every `*Sync` export) in production `src/main` and `src/shared`
(`config/main-sync-fs-baseline.txt`), and `pnpm check:recurring-timer-ratchet` counts `setInterval`
calls in production `src/main`, `src/renderer`, `src/shared` and `src/cli`
(`config/recurring-timer-baseline.txt`). Both run in `check:ratchets` on every non-draft PR that runs static analysis. A new use either
moves off the hot path (async fs or a stat-fingerprint cache; a push signal, a visibility-gated or
backing-off timer) or raises its file's count with reviewer sign-off.
@@ -4,10 +4,10 @@
src/cli/handlers/core.ts
src/cli/handlers/interactive-login-interruption.ts
src/cli/runtime/launch.ts
src/main/agent-hooks/managed-hook-owner-identity.ts
src/main/agent-hooks/wsl-hook-relay-link.ts
src/main/agent-hooks/wsl-hook-relay-manager.ts
src/main/agent-hooks/wsl-hook-relay-sentinel.ts
src/main/agent-hooks/installation/locking/managed-hook-owner-identity.ts
src/main/agent-hooks/wsl-relay/wsl-hook-relay-link.ts
src/main/agent-hooks/wsl-relay/wsl-hook-relay-manager.ts
src/main/agent-hooks/wsl-relay/wsl-hook-relay-sentinel.ts
src/main/ai-vault/scan-service/session-scanner-service-client-state.ts
src/main/ai-vault/scan-service/session-scanner-service-client.ts
src/main/ai-vault/scan-service/session-scanner-service-spawn.ts
+92
View File
@@ -0,0 +1,92 @@
# setInterval calls (global, or imported from node:timers / node:timers/promises) in production src/main,
# src/renderer, src/shared and src/cli, per file. Bare calls are resolved per scope; imported bindings follow the shared
# collector (file-wide). Not counted: destructuring off a global object, a self-rescheduling setTimeout (it must back off or pause while hidden).
# This is a RATCHET: counts may only go DOWN.
# Prune after removing intervals: pnpm check:recurring-timer-ratchet --prune
1 src/cli/handlers/orchestration/check-keepalive.ts
1 src/cli/runtime/mac-app-update-bundle.ts
1 src/cli/runtime/serve-supervised-service.ts
1 src/main/agent-hooks/server/server-opencode-binder.ts
1 src/main/automations/retained-run-reconciliation.ts
1 src/main/automations/service.ts
1 src/main/browser/extensions/native-messaging/browser-extension-native-ports.ts
1 src/main/browser/extensions/web-store/browser-extension-webstore-updater.ts
1 src/main/claude/agent-view/agent-view-bridge.ts
1 src/main/cli/appimage-serve-preparation.ts
1 src/main/codex-accounts/codex-login-session.ts
1 src/main/codex/configuration/homes/codex-windows-sandbox-read-grant.ts
1 src/main/crash-reporting/pre-gone-host-memory.ts
1 src/main/crash-reporting/process-gone-diagnostics.ts
1 src/main/crash-reporting/renderer-heap-allocation-profile.ts
1 src/main/daemon/admission/host-terminal-ledger.ts
1 src/main/daemon/admission/host-terminal-policy.ts
1 src/main/daemon/endpoint/publication/daemon-endpoint-lifecycle.ts
1 src/main/daemon/transport/stream/daemon-stream-backlog-probe.ts
1 src/main/diagnostics/event-loop-delay-probe.ts
1 src/main/diagnostics/main-thread-churn-probe.ts
1 src/main/git/refs/maintenance/pack-refs-lock-ownership.ts
1 src/main/hang-watchdog/main-thread-hang-watchdog-entry.ts
1 src/main/hang-watchdog/main-thread-hang-watchdog.ts
2 src/main/ipc/filesystem/watcher-process/parcel-watcher-shallow-file-subscription.ts
1 src/main/ipc/filesystem/watcher-process/parcel-watcher-shallow-subscription.ts
1 src/main/ipc/runtime-environments/runtime-environment-preference.ts
1 src/main/ipc/worktrees/git/worktree-git-common-narrow-watch.ts
1 src/main/ipc/worktrees/git/worktree-git-common-native-upgrade-poll.ts
1 src/main/ipc/wsl/wsl-host-automation-wake-wiring.ts
1 src/main/native-chat/agent-session-attachments/agent-session-attachment-sweep.ts
1 src/main/native-chat/agent-session-wire/host/structured-agent-session-lease-renewer.ts
1 src/main/native-chat/agent-session-wire/recovery/structured-agent-session-usage-limit-continue.ts
1 src/main/native-chat/agent-session-wire/termination/structured-agent-session-idle-sweep.ts
1 src/main/notifications/desktop-presence-reporter.ts
1 src/main/orcad/orcad-browser-install-park.ts
1 src/main/orcad/orcad-lock-clone-machine.ts
1 src/main/orcad/orcad-stop-request-listener.ts
1 src/main/plugins/catalog/plugin-auto-updater.ts
1 src/main/plugins/catalog/plugin-kill-list-service.ts
1 src/main/plugins/installation/plugin-git-repository.ts
1 src/main/plugins/plugin-service-housekeeping.ts
1 src/main/rate-limits/service/service-polling.ts
1 src/main/runtime/agent-state-rules/agent-state-rules-live-update.ts
1 src/main/runtime/mobile-cloud-relay/desktop-relay-service.ts
2 src/main/runtime/mobile-cloud-relay/relay-control-liveness.ts
1 src/main/runtime/rpc/methods/orchestration/messaging/check-run.ts
1 src/main/runtime/rpc/mobile-socket-wiring.ts
1 src/main/runtime/rpc/remote-runtime-server-heartbeat.ts
1 src/main/runtime/rpc/server/runtime-metadata-ownership-watch.ts
1 src/main/runtime/rpc/unix-socket-transport.ts
1 src/main/runtime/sidebar-inputs/paired-server-rows-producer.ts
1 src/main/runtime/terminal/input/agent-prompt-permission-hold.ts
1 src/main/runtime/terminal/output/terminal-derived-agent-facts.ts
1 src/main/runtime/terminal/wait/terminal-idle-polls.ts
1 src/main/ssh/legacy-relay/bridge/legacy-relay-daily-activity.ts
1 src/main/ssh/legacy-relay/cli/legacy-relay-cli-call-limits.ts
1 src/main/ssh/port-forwarding/ssh-tcp-forwarding-probe.ts
1 src/main/ssh/protocol/ssh-channel-multiplexer.ts
1 src/main/startup/configure-process.ts
1 src/main/startup/event-loop-stall-probe.ts
1 src/main/startup/synthetic-title-runtime.ts
1 src/main/telemetry/wsl-usage-reporter.ts
1 src/main/wsl/host-lifecycle/wsl-hosts-policy-live-update.ts
1 src/main/wsl/orcad/wsl-orcad-connect-stop-fence.ts
1 src/renderer/src/app-shell/use-app-session-persistence.ts
1 src/renderer/src/components/browser-pane/browser-client-page-position-driver.ts
1 src/renderer/src/components/contextual-tours/use-contextual-tour.ts
1 src/renderer/src/components/editor/setup-contextual-copy.ts
1 src/renderer/src/components/right-sidebar/plugin-panels/health/plugin-panel-watchdog.ts
1 src/renderer/src/components/sidebar/SeveredTerminalDaemonBanner.tsx
1 src/renderer/src/components/sidebar/StalledTerminalDaemonBanner.tsx
1 src/renderer/src/components/sidebar/workspace-card/activity/prompt-cache-countdown-clock.ts
1 src/renderer/src/components/status-bar/use-resource-memory-snapshot.ts
1 src/renderer/src/components/status-bar/use-runtime-host-resources.ts
1 src/renderer/src/components/tab-bar/tab-strip-drag-scroll.ts
1 src/renderer/src/components/terminal-pane/pty-transport/delivery/terminal-delivery-watchdog.ts
1 src/renderer/src/components/terminal-pane/pty-transport/remote-runtime/recovery/RemoteRuntimeRecoveryCard.tsx
1 src/renderer/src/components/terminal-pane/render-health/terminal-render-desync-sentinel.ts
1 src/renderer/src/hooks/use-now.ts
1 src/renderer/src/lib/agent-session/hibernation/agent-hibernation-coordinator.ts
1 src/renderer/src/lib/crash-diagnostics.ts
1 src/renderer/src/lib/window-visibility-interval.ts
1 src/renderer/src/lib/worker-auto-close.ts
1 src/renderer/src/runtime/hosts/wsl/wsl-refused-read-watch.ts
1 src/shared/remote-runtime/remote-runtime-socket-liveness.ts
1 src/shared/tmux-agent-hook-owner.ts
+5 -5
View File
@@ -6389,7 +6389,7 @@
"commands": [
"pnpm exec vitest run --config config/vitest.config.ts src/main/runtime/terminal/surface/orca-runtime-terminal-close-continuity.test.ts",
"pnpm exec vitest run --config config/vitest.config.ts src/main/runtime/construction/orca-runtime.test.ts",
"pnpm dlx node@24 ./node_modules/vitest/vitest.mjs run --config config/vitest.config.ts src/main/agent-hooks/server-pane-authority.test.ts src/main/ipc/agent-hooks.test.ts src/main/ipc/agent-pane-authority-ownership.test.ts src/main/persistence/terminal-topology/persistence-pane-identity-migration.test.ts src/main/persistence/terminal-topology/persistence-pty-binding-reconciliation.test.ts src/renderer/src/store/slices/agent-status/agent-pane-authority.test.ts src/renderer/src/store/terminals/terminal-pane-detach-agent-identity.test.ts src/renderer/src/store/terminals/terminal-tab-retirement-store.test.ts tests/e2e/completed-worker-retirement-resume.unit.test.ts src/renderer/src/components/shared/kill-all-terminal-surfaces.test.ts",
"pnpm dlx node@24 ./node_modules/vitest/vitest.mjs run --config config/vitest.config.ts src/main/agent-hooks/server/testing/authority/server-pane-authority.test.ts src/main/ipc/agent-hooks.test.ts src/main/ipc/agent-pane-authority-ownership.test.ts src/main/persistence/terminal-topology/persistence-pane-identity-migration.test.ts src/main/persistence/terminal-topology/persistence-pty-binding-reconciliation.test.ts src/renderer/src/store/slices/agent-status/agent-pane-authority.test.ts src/renderer/src/store/terminals/terminal-pane-detach-agent-identity.test.ts src/renderer/src/store/terminals/terminal-tab-retirement-store.test.ts tests/e2e/completed-worker-retirement-resume.unit.test.ts src/renderer/src/components/shared/kill-all-terminal-surfaces.test.ts",
"pnpm exec vitest run --config config/vitest.config.ts src/main/pty/process-retirement/pty-descendant-termination.test.ts src/main/daemon/sessions/testing/session.test.ts src/main/daemon/terminal-host/testing/terminal-host.test.ts src/main/providers/local-pty/local-pty-provider-shutdown.test.ts src/main/runtime/workspaces/removal/worktree-teardown.test.ts",
"pnpm run test:e2e -- tests/e2e/terminal-tab-close-restart-persistence.spec.ts --workers=1",
"pnpm run test:e2e -- tests/e2e/terminal-parked-close-retirement.spec.ts --workers=1",
@@ -6400,7 +6400,7 @@
"testFiles": [
"src/main/runtime/terminal/surface/orca-runtime-terminal-close-continuity.test.ts",
"src/main/runtime/construction/orca-runtime.test.ts",
"src/main/agent-hooks/server-pane-authority.test.ts",
"src/main/agent-hooks/server/testing/authority/server-pane-authority.test.ts",
"src/main/ipc/agent-hooks.test.ts",
"src/main/ipc/agent-pane-authority-ownership.test.ts",
"src/main/persistence/terminal-topology/persistence-pane-identity-migration.test.ts",
@@ -9253,7 +9253,7 @@
"pnpm exec vitest run --config config/vitest.config.ts src/main/ssh/protocol/ssh-multiplexer-transport-writer.test.ts src/main/ssh/protocol/ssh-channel-multiplexer.test.ts src/wsl-guest/dispatcher-client-writer.test.ts --reporter=dot",
"pnpm exec vitest run --config config/vitest.config.ts src/main/ssh/protocol/ssh-multiplexer-transport-writer.test.ts src/main/ssh/protocol/ssh-channel-multiplexer.test.ts src/main/ssh/protocol/ssh-channel-multiplexer-backpressure.test.ts src/wsl-guest/dispatcher-client-writer.test.ts --reporter=dot",
"pnpm exec vitest run --config config/vitest.config.ts src/main/ssh/protocol/ssh-multiplexer-transport-writer.test.ts src/main/ssh/protocol/ssh-channel-multiplexer-backpressure.test.ts --reporter=dot",
"pnpm exec vitest run --config config/vitest.config.ts src/main/agent-hooks/wsl-hook-relay-sentinel.test.ts --reporter=dot"
"pnpm exec vitest run --config config/vitest.config.ts src/main/agent-hooks/wsl-relay/wsl-hook-relay-sentinel.test.ts --reporter=dot"
],
"testFiles": [
"src/main/runtime/construction/orca-runtime.test.ts",
@@ -9263,7 +9263,7 @@
"src/main/ssh/protocol/ssh-channel-multiplexer.test.ts",
"src/main/ssh/protocol/ssh-channel-multiplexer-backpressure.test.ts",
"src/wsl-guest/dispatcher-client-writer.test.ts",
"src/main/agent-hooks/wsl-hook-relay-sentinel.test.ts"
"src/main/agent-hooks/wsl-relay/wsl-hook-relay-sentinel.test.ts"
],
"assertionRefs": [
{
@@ -9304,7 +9304,7 @@
]
},
{
"file": "src/main/agent-hooks/wsl-hook-relay-sentinel.test.ts",
"file": "src/main/agent-hooks/wsl-relay/wsl-hook-relay-sentinel.test.ts",
"assertions": [
"WSL stdin forwards write(false), callback settlement, and drain without claiming a live WSL topology"
]
+127 -127
View File
@@ -529,131 +529,131 @@
"src/main/persistence/preferences/active-view-preference.test.ts": 61,
"src/main/providers/accounts/agent-auth-restart-preservation.test.ts": 55,
"src/main/agent-launch/preflight/agent-cli-version-probe.test.ts": 72,
"src/main/agent-hooks/agent-tool-plugin-hooks.test.ts": 202,
"src/main/agent-hooks/agent-transition-detector.test.ts": 666,
"src/main/agent-hooks/cursor-replay-guard.test.ts": 403,
"src/main/agent-hooks/ended-process-reconciliation.test.ts": 775,
"src/main/agent-hooks/first-work-branch-rename-wsl-move.test.ts": 831,
"src/main/agent-hooks/first-work-branch-rename.test.ts": 857,
"src/main/agent-hooks/grok-replay-guard.test.ts": 533,
"src/main/agent-hooks/hook-process-capture.test.ts": 118,
"src/main/agent-hooks/hook-script-outside-orca.test.ts": 171,
"src/main/agent-hooks/installer-utils.test.ts": 264,
"src/main/agent-hooks/local-agent-cli-presence.test.ts": 153,
"src/main/agent-hooks/local-tmux-managed-pty.test.ts": 50,
"src/main/agent-hooks/locked-executable-rename.test.ts": 69,
"src/main/agent-hooks/managed-agent-hook-controls.test.ts": 250,
"src/main/agent-hooks/managed-hook-install-lock.test.ts": 226,
"src/main/agent-hooks/managed-hook-script-refresh-main-thread.test.ts": 567,
"src/main/agent-hooks/managed-hook-script-refresh.test.ts": 1637,
"src/main/agent-hooks/managed-hook-stdin-lifecycle.test.ts": 1989,
"src/main/agent-hooks/managed-hook-timeout.test.ts": 2987,
"src/main/agent-hooks/managed-toml-ownership.test.ts": 52,
"src/main/agent-hooks/posix-hook-json-stdin-reader.test.ts": 3479,
"src/main/agent-hooks/server-agent-presence.test.ts": 1257,
"src/main/agent-hooks/server-agent-tool-plugin-hooks.test.ts": 717,
"src/main/agent-hooks/server-ai-vault-liveness.test.ts": 643,
"src/main/agent-hooks/server-amp-normalization.test.ts": 607,
"src/main/agent-hooks/server-antigravity-resume-identity.test.ts": 820,
"src/main/agent-hooks/server-claude-blocked-prompt.test.ts": 681,
"src/main/agent-hooks/server-claude-child-permission-lifecycle.test.ts": 681,
"src/main/agent-hooks/server-claude-config-dir-observation.test.ts": 696,
"src/main/agent-hooks/server-claude-helper-kill.test.ts": 10279,
"src/main/agent-hooks/server-claude-helper-recovery.test.ts": 34523,
"src/main/agent-hooks/server-claude-normalization.test.ts": 683,
"src/main/agent-hooks/server-claude-owed-notification-expiry.test.ts": 877,
"src/main/agent-hooks/server-claude-permission-tool-failure.test.ts": 674,
"src/main/agent-hooks/server-claude-permission-visibility.test.ts": 765,
"src/main/agent-hooks/server-claude-session-continuation.test.ts": 675,
"src/main/agent-hooks/server-claude-statusline.test.ts": 679,
"src/main/agent-hooks/server-claude-task-wakeup-lifecycle.test.ts": 5451,
"src/main/agent-hooks/server-claude-terminal-interrupt.test.ts": 802,
"src/main/agent-hooks/server-closed-tab-suppression.test.ts": 895,
"src/main/agent-hooks/server-codex-capacity.test.ts": 671,
"src/main/agent-hooks/server-codex-interrupt-hook.test.ts": 679,
"src/main/agent-hooks/server-codex-normalization.test.ts": 741,
"src/main/agent-hooks/server-codex-review-turn-end.test.ts": 860,
"src/main/agent-hooks/server-codex-side-thread.test.ts": 847,
"src/main/agent-hooks/server-codex-subagent-transcript.test.ts": 706,
"src/main/agent-hooks/server-codex-turn-interruption.test.ts": 716,
"src/main/agent-hooks/server-copilot-normalization.test.ts": 1125,
"src/main/agent-hooks/server-copilot-resume-identity.test.ts": 729,
"src/main/agent-hooks/server-cursor-normalization.test.ts": 645,
"src/main/agent-hooks/server-endpoint-file-lifecycle.test.ts": 801,
"src/main/agent-hooks/server-grok-background-status.test.ts": 723,
"src/main/agent-hooks/server-grok-cancel.test.ts": 692,
"src/main/agent-hooks/server-grok-discovery.test.ts": 723,
"src/main/agent-hooks/server-hermes-resume-identity.test.ts": 941,
"src/main/agent-hooks/server-hook-http-ingest.test.ts": 719,
"src/main/agent-hooks/server-hook-session-binding.test.ts": 2674,
"src/main/agent-hooks/server-http-owner-probe-lifecycle.test.ts": 1088,
"src/main/agent-hooks/server-idle-process-owner.test.ts": 1014,
"src/main/agent-hooks/server-ingest-remote-codex-question.test.ts": 656,
"src/main/agent-hooks/server-ingest-remote-codex-transcript.test.ts": 647,
"src/main/agent-hooks/server-ingest-remote.test.ts": 653,
"src/main/agent-hooks/server-ingest-structured-state-clock.test.ts": 723,
"src/main/agent-hooks/server-ingest-structured-status.test.ts": 697,
"src/main/agent-hooks/server-ingest-terminal-status.test.ts": 673,
"src/main/agent-hooks/server-interrupt-inference-guards.test.ts": 685,
"src/main/agent-hooks/server-interrupt-inference-resurrection.test.ts": 759,
"src/main/agent-hooks/server-last-status-child-held-main-agent.test.ts": 937,
"src/main/agent-hooks/server-last-status-hydrate-confirmation.test.ts": 713,
"src/main/agent-hooks/server-last-status-hydrate-validation.test.ts": 737,
"src/main/agent-hooks/server-last-status-lead-boundary.test.ts": 768,
"src/main/agent-hooks/server-last-status-main-agent-fact.test.ts": 813,
"src/main/agent-hooks/server-last-status-restored-children.test.ts": 818,
"src/main/agent-hooks/server-last-status-write.test.ts": 745,
"src/main/agent-hooks/server-launch-resume-identity.test.ts": 735,
"src/main/agent-hooks/server-main-agent-turn-verdicts.test.ts": 1716,
"src/main/agent-hooks/server-muse-session-log-poll.test.ts": 2772,
"src/main/agent-hooks/server-nested-agent-boundaries.test.ts": 657,
"src/main/agent-hooks/server-nested-agent-consumers.test.ts": 660,
"src/main/agent-hooks/server-nested-agent-model.test.ts": 665,
"src/main/agent-hooks/server-nested-same-provider-owner.test.ts": 708,
"src/main/agent-hooks/server-observation-provenance.test.ts": 672,
"src/main/agent-hooks/server-omp-retired-ingress.test.ts": 641,
"src/main/agent-hooks/server-omp-retirement-ack.test.ts": 676,
"src/main/agent-hooks/server-opencode-tui-identity.test.ts": 843,
"src/main/agent-hooks/server-opencode-writer-observation.test.ts": 681,
"src/main/agent-hooks/server-pane-authority.test.ts": 762,
"src/main/agent-hooks/server-process-lifetime-status.test.ts": 852,
"src/main/agent-hooks/server-prompt-sent-telemetry.test.ts": 701,
"src/main/agent-hooks/server-relayed-claude-cancel.test.ts": 901,
"src/main/agent-hooks/server-relayed-claude-permission-replay.test.ts": 758,
"src/main/agent-hooks/server-reminted-pane-key.test.ts": 688,
"src/main/agent-hooks/server-removed-worktree-foreign-authority.test.ts": 764,
"src/main/agent-hooks/server-removed-worktree-status.test.ts": 687,
"src/main/agent-hooks/server-replay-evidence-clock.test.ts": 643,
"src/main/agent-hooks/server-restored-agent-status.test.ts": 694,
"src/main/agent-hooks/server-retired-pane-new-turn.test.ts": 666,
"src/main/agent-hooks/server-startup-lifecycle.test.ts": 718,
"src/main/agent-hooks/server-startup-prompt-control.test.ts": 697,
"src/main/agent-hooks/server-status-listener-fanout.test.ts": 783,
"src/main/agent-hooks/server-status-persist-nonblocking.test.ts": 697,
"src/main/agent-hooks/server-status-persist-throttle.test.ts": 860,
"src/main/agent-hooks/server-structured-canonical-status.test.ts": 765,
"src/main/agent-hooks/server-tmux-canonical.test.ts": 739,
"src/main/agent-hooks/server-tmux-wire.test.ts": 564,
"src/main/agent-hooks/server-transport-interference.test.ts": 1814,
"src/main/agent-hooks/server-turn-ended-at.test.ts": 990,
"src/main/agent-hooks/server-turn-started-at.test.ts": 898,
"src/main/agent-hooks/tool-events/agent-tool-plugin-hooks.test.ts": 202,
"src/main/agent-hooks/observations/agent-transition-detector.test.ts": 666,
"src/main/agent-hooks/installation/scripts/cursor-replay-guard.test.ts": 403,
"src/main/agent-hooks/server/testing/reconciliation/ended-process-reconciliation.test.ts": 775,
"src/main/agent-hooks/first-work/first-work-branch-rename-wsl-move.test.ts": 831,
"src/main/agent-hooks/first-work/first-work-branch-rename.test.ts": 857,
"src/main/agent-hooks/installation/scripts/grok-replay-guard.test.ts": 533,
"src/main/agent-hooks/installation/scripts/hook-process-capture.test.ts": 118,
"src/main/agent-hooks/installation/scripts/hook-script-outside-orca.test.ts": 171,
"src/main/agent-hooks/installation/testing/installer-contract.test.ts": 264,
"src/main/agent-hooks/installation/local-agent-cli-presence.test.ts": 153,
"src/main/agent-hooks/observations/local-tmux-managed-pty.test.ts": 50,
"src/main/agent-hooks/installation/scripts/locked-executable-rename.test.ts": 69,
"src/main/agent-hooks/installation/managed-agent-hook-controls.test.ts": 250,
"src/main/agent-hooks/installation/locking/managed-hook-install-lock.test.ts": 226,
"src/main/agent-hooks/installation/scripts/managed-hook-script-refresh-main-thread.test.ts": 567,
"src/main/agent-hooks/installation/scripts/managed-hook-script-refresh.test.ts": 1637,
"src/main/agent-hooks/installation/scripts/managed-hook-stdin-lifecycle.test.ts": 1989,
"src/main/agent-hooks/installation/scripts/managed-hook-timeout.test.ts": 2987,
"src/main/agent-hooks/installation/configuration/managed-toml-ownership.test.ts": 52,
"src/main/agent-hooks/installation/scripts/posix-hook-json-stdin-reader.test.ts": 3479,
"src/main/agent-hooks/server/testing/presence/server-agent-presence.test.ts": 1257,
"src/main/agent-hooks/server/testing/tool-events/server-agent-tool-plugin-hooks.test.ts": 717,
"src/main/agent-hooks/server/testing/identity/server-ai-vault-liveness.test.ts": 643,
"src/main/agent-hooks/server/testing/providers/amp/server-amp-normalization.test.ts": 607,
"src/main/agent-hooks/server/testing/providers/antigravity/server-antigravity-resume-identity.test.ts": 820,
"src/main/agent-hooks/server/testing/providers/claude/server-claude-blocked-prompt.test.ts": 681,
"src/main/agent-hooks/server/testing/permissions/server-claude-child-permission-lifecycle.test.ts": 681,
"src/main/agent-hooks/server/testing/providers/claude/server-claude-config-dir-observation.test.ts": 696,
"src/main/agent-hooks/server/testing/interruptions/server-claude-helper-kill.test.ts": 10279,
"src/main/agent-hooks/server/testing/interruptions/server-claude-helper-recovery.test.ts": 34523,
"src/main/agent-hooks/server/testing/providers/claude/server-claude-normalization.test.ts": 683,
"src/main/agent-hooks/server/testing/task-wakeup/server-claude-owed-notification-expiry.test.ts": 877,
"src/main/agent-hooks/server/testing/permissions/server-claude-permission-tool-failure.test.ts": 674,
"src/main/agent-hooks/server/testing/permissions/server-claude-permission-visibility.test.ts": 765,
"src/main/agent-hooks/server/testing/identity/server-claude-session-continuation.test.ts": 675,
"src/main/agent-hooks/server/testing/http/server-claude-statusline.test.ts": 679,
"src/main/agent-hooks/server/testing/task-wakeup/server-claude-task-wakeup-lifecycle.test.ts": 5451,
"src/main/agent-hooks/server/testing/interruptions/server-claude-terminal-interrupt.test.ts": 802,
"src/main/agent-hooks/server/testing/authority/server-closed-tab-suppression.test.ts": 895,
"src/main/agent-hooks/server/testing/providers/codex/server-codex-capacity.test.ts": 671,
"src/main/agent-hooks/server/testing/providers/codex/server-codex-interrupt-hook.test.ts": 679,
"src/main/agent-hooks/server/testing/normalization/server-provider-normalization.test.ts": 741,
"src/main/agent-hooks/server/testing/providers/codex/server-codex-review-turn-end.test.ts": 860,
"src/main/agent-hooks/server/testing/providers/codex/server-codex-side-thread.test.ts": 847,
"src/main/agent-hooks/server/testing/providers/codex/server-codex-subagent-transcript.test.ts": 706,
"src/main/agent-hooks/server/testing/providers/codex/server-codex-turn-interruption.test.ts": 716,
"src/main/agent-hooks/server/testing/transcripts/server-transcript-result-retry.test.ts": 1125,
"src/main/agent-hooks/server/testing/identity/server-copilot-resume-identity.test.ts": 729,
"src/main/agent-hooks/server/testing/providers/cursor/server-cursor-normalization.test.ts": 645,
"src/main/agent-hooks/server/testing/http/server-endpoint-file-lifecycle.test.ts": 801,
"src/main/agent-hooks/server/testing/providers/grok/server-grok-background-status.test.ts": 723,
"src/main/agent-hooks/server/testing/providers/grok/server-grok-cancel.test.ts": 692,
"src/main/agent-hooks/server/testing/providers/grok/server-grok-discovery.test.ts": 723,
"src/main/agent-hooks/server/testing/identity/server-hermes-resume-identity.test.ts": 941,
"src/main/agent-hooks/server/testing/http/server-hook-http-ingest.test.ts": 719,
"src/main/agent-hooks/server/testing/identity/server-hook-session-binding.test.ts": 2674,
"src/main/agent-hooks/server/testing/presence/server-http-owner-probe-lifecycle.test.ts": 1088,
"src/main/agent-hooks/server/testing/presence/server-idle-process-owner.test.ts": 1014,
"src/main/agent-hooks/server/testing/remote-ingress/server-ingest-remote-codex-question.test.ts": 656,
"src/main/agent-hooks/server/testing/remote-ingress/server-ingest-remote-codex-transcript.test.ts": 647,
"src/main/agent-hooks/server/testing/remote-ingress/server-ingest-remote.test.ts": 653,
"src/main/agent-hooks/server/testing/structured-ingress/server-ingest-structured-state-clock.test.ts": 723,
"src/main/agent-hooks/server/testing/structured-ingress/server-ingest-structured-status.test.ts": 697,
"src/main/agent-hooks/server/testing/terminal-ingress/server-ingest-terminal-status.test.ts": 673,
"src/main/agent-hooks/server/testing/interruptions/server-interrupt-inference-guards.test.ts": 685,
"src/main/agent-hooks/server/testing/interruptions/server-interrupt-inference-resurrection.test.ts": 759,
"src/main/agent-hooks/server/testing/persistence/server-last-status-child-held-main-agent.test.ts": 937,
"src/main/agent-hooks/server/testing/persistence/server-last-status-hydrate-confirmation.test.ts": 713,
"src/main/agent-hooks/server/testing/persistence/server-last-status-hydrate-validation.test.ts": 737,
"src/main/agent-hooks/server/testing/persistence/server-last-status-lead-boundary.test.ts": 768,
"src/main/agent-hooks/server/testing/persistence/server-last-status-main-agent-fact.test.ts": 813,
"src/main/agent-hooks/server/testing/persistence/server-last-status-restored-children.test.ts": 818,
"src/main/agent-hooks/server/testing/persistence/server-last-status-write.test.ts": 745,
"src/main/agent-hooks/server/testing/identity/server-launch-resume-identity.test.ts": 735,
"src/main/agent-hooks/server/testing/main-agent/server-main-agent-turn-verdicts.test.ts": 1716,
"src/main/agent-hooks/server/testing/providers/muse/server-muse-session-log-poll.test.ts": 2772,
"src/main/agent-hooks/server/testing/identity/server-nested-agent-boundaries.test.ts": 657,
"src/main/agent-hooks/server/testing/identity/server-nested-agent-consumers.test.ts": 660,
"src/main/agent-hooks/server/testing/identity/server-nested-agent-model.test.ts": 665,
"src/main/agent-hooks/server/testing/identity/server-nested-same-provider-owner.test.ts": 708,
"src/main/agent-hooks/server/testing/persistence/server-observation-provenance.test.ts": 672,
"src/main/agent-hooks/server/testing/authority/server-omp-retired-ingress.test.ts": 641,
"src/main/agent-hooks/server/testing/authority/server-omp-retirement-ack.test.ts": 676,
"src/main/agent-hooks/server/testing/providers/opencode/server-opencode-tui-identity.test.ts": 843,
"src/main/agent-hooks/server/testing/identity/server-opencode-writer-observation.test.ts": 681,
"src/main/agent-hooks/server/testing/authority/server-pane-authority.test.ts": 762,
"src/main/agent-hooks/server/testing/terminal-ingress/server-process-lifetime-status.test.ts": 852,
"src/main/agent-hooks/server/testing/telemetry/server-prompt-sent-telemetry.test.ts": 701,
"src/main/agent-hooks/server/testing/interruptions/server-relayed-claude-cancel.test.ts": 901,
"src/main/agent-hooks/server/testing/replay/server-relayed-claude-permission-replay.test.ts": 758,
"src/main/agent-hooks/server/testing/authority/server-reminted-pane-key.test.ts": 688,
"src/main/agent-hooks/server/testing/authority/server-removed-worktree-foreign-authority.test.ts": 764,
"src/main/agent-hooks/server/testing/authority/server-removed-worktree-status.test.ts": 687,
"src/main/agent-hooks/server/testing/replay/server-replay-evidence-clock.test.ts": 643,
"src/main/agent-hooks/server/testing/persistence/server-restored-agent-status.test.ts": 694,
"src/main/agent-hooks/server/testing/authority/server-retired-pane-new-turn.test.ts": 666,
"src/main/agent-hooks/server/testing/http/server-startup-lifecycle.test.ts": 718,
"src/main/agent-hooks/server/testing/http/server-startup-prompt-control.test.ts": 697,
"src/main/agent-hooks/server/testing/publication/server-status-listener-fanout.test.ts": 783,
"src/main/agent-hooks/server/testing/persistence/server-status-persist-nonblocking.test.ts": 697,
"src/main/agent-hooks/server/testing/persistence/server-status-persist-throttle.test.ts": 860,
"src/main/agent-hooks/server/testing/structured-ingress/server-structured-canonical-status.test.ts": 765,
"src/main/agent-hooks/server/testing/tmux/server-tmux-canonical.test.ts": 739,
"src/main/agent-hooks/server/testing/tmux/server-tmux-wire.test.ts": 564,
"src/main/agent-hooks/server/testing/http/server-transport-interference.test.ts": 1814,
"src/main/agent-hooks/server/testing/main-agent/server-turn-ended-at.test.ts": 990,
"src/main/agent-hooks/server/testing/main-agent/server-turn-started-at.test.ts": 898,
"src/main/agent-hooks/server/program-status/hook-precedence.test.ts": 45,
"src/main/agent-hooks/spool.test.ts": 999,
"src/main/agent-hooks/terminal-handle-row-identity.test.ts": 669,
"src/main/agent-hooks/windows-batch-hook-launcher.test.ts": 108,
"src/main/agent-hooks/windows-cmd-hook-command-unicode.test.ts": 141,
"src/main/agent-hooks/windows-hook-payload-delivery.test.ts": 345,
"src/main/agent-hooks/windows-native-hook-exe-hosts.test.ts": 262,
"src/main/agent-hooks/windows-powershell-hook-launcher.test.ts": 44,
"src/main/agent-hooks/wsl-guest-plugin-install.test.ts": 64,
"src/main/agent-hooks/wsl-hook-relay-idle-stop.test.ts": 1235,
"src/main/agent-hooks/wsl-hook-relay-live.integration.test.ts": 2231,
"src/main/agent-hooks/wsl-hook-relay-manager.test.ts": 3176,
"src/main/agent-hooks/wsl-hook-relay-reattach.test.ts": 1280,
"src/main/agent-hooks/wsl-hook-relay-recovery.test.ts": 1529,
"src/main/agent-hooks/wsl-hook-relay-sentinel.test.ts": 62,
"src/main/agent-hooks/wsl-opencode-settings-lifetime.test.ts": 1951,
"src/main/agent-hooks/wsl-opencode-settings.test.ts": 1364,
"src/main/agent-hooks/server/testing/replay/spool.test.ts": 999,
"src/main/agent-hooks/server/testing/identity/terminal-handle-row-identity.test.ts": 669,
"src/main/agent-hooks/installation/commands/windows-batch-hook-launcher.test.ts": 108,
"src/main/agent-hooks/installation/commands/windows-cmd-hook-command-unicode.test.ts": 141,
"src/main/agent-hooks/installation/commands/windows-hook-payload-delivery.test.ts": 345,
"src/main/agent-hooks/installation/commands/windows-native-hook-exe-hosts.test.ts": 262,
"src/main/agent-hooks/installation/commands/windows-powershell-hook-launcher.test.ts": 44,
"src/main/agent-hooks/wsl-relay/wsl-guest-plugin-install.test.ts": 64,
"src/main/agent-hooks/wsl-relay/wsl-hook-relay-idle-stop.test.ts": 1235,
"src/main/agent-hooks/wsl-relay/testing/wsl-hook-relay-live.integration.test.ts": 2231,
"src/main/agent-hooks/wsl-relay/wsl-hook-relay-manager.test.ts": 3176,
"src/main/agent-hooks/wsl-relay/wsl-hook-relay-reattach.test.ts": 1280,
"src/main/agent-hooks/wsl-relay/wsl-hook-relay-recovery.test.ts": 1529,
"src/main/agent-hooks/wsl-relay/wsl-hook-relay-sentinel.test.ts": 62,
"src/main/agent-hooks/wsl-relay/wsl-opencode-settings-lifetime.test.ts": 1951,
"src/main/agent-hooks/wsl-relay/wsl-opencode-settings.test.ts": 1364,
"src/main/agent-launch/agent-launch-account-env.test.ts": 958,
"src/main/agent-launch/agent-launch-executor-cancel.test.ts": 1455,
"src/main/agent-launch/agent-launch-mode-settings.test.ts": 4041,
@@ -1115,9 +1115,9 @@
"src/main/browser/extensions/api-runtime/browser-extension-worker-api-host.test.ts": 237,
"src/main/browser/extensions/declarative-net-request/engine-stages.test.ts": 112,
"src/main/browser/extensions/declarative-net-request/engine.test.ts": 145,
"src/main/browser/extensions/declarative-net-request/redirect-url.test.ts": 66,
"src/main/browser/extensions/declarative-net-request/regex-filter.test.ts": 116,
"src/main/browser/extensions/declarative-net-request/url-pattern.test.ts": 84,
"src/main/browser/extensions/declarative-net-request/redirect-actions/redirect-url.test.ts": 66,
"src/main/browser/extensions/declarative-net-request/regex/regex-filter.test.ts": 116,
"src/main/browser/extensions/declarative-net-request/matching/url-pattern.test.ts": 84,
"src/main/browser/element-grab/grab-guest-overlay-follow.test.ts": 332,
"src/main/browser/element-grab/grab-guest-script.test.ts": 107,
"src/main/browser/cdp/debugger/guest-cdp-command.test.ts": 105,
@@ -23,7 +23,10 @@ describe('packaged runtime resources', () => {
const sources = new Map([
['out\\main\\index.js', 'const z = require("zod")'],
['out\\main\\agent-hooks\\managed-agent-hook-controls.js', 'const YAML = require("yaml")']
[
'out\\main\\agent-hooks\\installation\\managed-agent-hook-controls.js',
'const YAML = require("yaml")'
]
])
const asar = {
listPackage: () => [...sources.keys()].map((entry) => `\\${entry}`),
@@ -48,7 +51,7 @@ describe('packaged runtime resources', () => {
'let p=null;function q(){return p??=import(`@anthropic-ai/claude-agent-sdk`),p}'
],
[
'out/main/agent-hooks/managed-agent-hook-controls.js',
'out/main/agent-hooks/installation/managed-agent-hook-controls.js',
'import (`@anthropic-ai/claude-agent-sdk`)'
]
])
@@ -96,7 +99,7 @@ describe('packaged runtime resources', () => {
// The entry points themselves carry no specifier; only the shared chunk does.
const sources = new Map([
['out/main/index.js', ''],
['out/main/agent-hooks/managed-agent-hook-controls.js', ''],
['out/main/agent-hooks/installation/managed-agent-hook-controls.js', ''],
['out/main/chunks/managed-agent-hook-controls-CWf8D-KR.js', 'require(`jsonc-parser`)']
])
// listPackage includes directories that extractFile rejects; mock them to enforce the .js anchor.
@@ -128,7 +131,7 @@ describe('packaged runtime resources', () => {
const sources = new Map([
['out/main/index.js', 'const all=[...require("jsonc-parser")]'],
['out/main/agent-hooks/managed-agent-hook-controls.js', '']
['out/main/agent-hooks/installation/managed-agent-hook-controls.js', '']
])
const asar = {
listPackage: () => [...sources.keys()].map((entry) => `/${entry}`),
@@ -149,7 +152,10 @@ describe('packaged runtime resources', () => {
// Registry require(key) members are not packaged bare-module imports, even with literal keys.
const sources = new Map([
['out/main/index.js', 'registry.require("public-a");grants.require(`host-key`)'],
['out/main/agent-hooks/managed-agent-hook-controls.js', 'state.import("android-sdk")']
[
'out/main/agent-hooks/installation/managed-agent-hook-controls.js',
'state.import("android-sdk")'
]
])
const asar = {
listPackage: () => [...sources.keys()].map((entry) => `/${entry}`),
@@ -9,23 +9,17 @@ import type { AppState } from '@/store/types'
import type { AgentStatusBatchUpdate } from '@/store/slices/agent-status/agent-status-contract'
import '@/store/slices/agent-status/agent-status'
import { MAX_LIVE_AGENT_STATUSES } from '@/store/slices/agent-status/agent-status-capacity-eviction'
import { createTestStore } from '@/store/testing/app-store-test-fixture'
import { makeTab } from '@/store/terminals/terminal-tab.test-fixture'
import { makeUnifiedTab } from '@/store/slices/tabs/tab-group.test-fixture'
import { makeWorktree } from '@/store/slices/worktrees/worktree.test-fixture'
import { TEST_REPO } from '@/store/repos/repo.test-fixture'
import { makePaneKey } from '../../../../src/shared/workspace-layout/stable-pane-id'
import { getDefaultSettings } from '../../../../src/shared/constants'
import type { createTestStore } from '@/store/testing/app-store-test-fixture'
import {
createAgentStatusPaneRoutingIndex,
resolvePaneKeyFromRoutingIndex
} from '@/hooks/ipc-events/agent-status-pane-routing-index'
import { buildAgentStatusScaleFixture } from '@/store/slices/agent-status/agent-status-scale.test-fixture'
import { resolvePaneKey } from '@/hooks/ipc-events/agent-status-routing'
const WORKTREES = 423
const EVENTS = 1_000
const BATCH_SIZE = 8
const LEAF_ID = '11111111-1111-4111-8111-111111111111'
const BASE_TIME = 2_000_000_000
const counters = { maps: 0, sets: 0, tabComparisons: 0 }
@@ -58,62 +52,16 @@ function withAllocationCounting<T>(run: () => T): T {
}
}
/** Tab list whose iteration is observable, so the nested-loop resolver's comparisons are countable. */
class CountingTabList<T> extends Array<T> {
[Symbol.iterator](): ArrayIterator<T> {
const iterator = super[Symbol.iterator]()
const next = iterator.next.bind(iterator)
iterator.next = (...args) => {
const result = next(...args)
if (!result.done) {
counters.tabComparisons += 1
}
return result
}
return iterator
}
}
function buildFixture(countTabIteration: boolean) {
const store = createTestStore()
const settings = store.getState().settings ?? getDefaultSettings(tmpdir())
const tabsByWorktree: AppState['tabsByWorktree'] = {}
const unifiedTabsByWorktree: AppState['unifiedTabsByWorktree'] = {}
const worktrees: ReturnType<typeof makeWorktree>[] = []
const paneKeys: string[] = []
const owners: { tabId: string; worktreeId: string }[] = []
for (let index = 0; index < WORKTREES; index += 1) {
const worktreeId = `wt-${index}`
worktrees.push(makeWorktree({ id: worktreeId, repoId: TEST_REPO.id }))
const tabs: ReturnType<typeof makeTab>[] = []
const unified: ReturnType<typeof makeUnifiedTab>[] = []
for (let tab = 0; tab < (index % 2 === 0 ? 1 : 2); tab += 1) {
const tabId = `tab-${index}-${tab}`
tabs.push(makeTab({ id: tabId, worktreeId, title: `Terminal ${index}-${tab}` }))
unified.push(
makeUnifiedTab({
id: tabId,
worktreeId,
groupId: `group-${index}`,
label: `Label ${index}`
})
)
paneKeys.push(makePaneKey(tabId, LEAF_ID))
owners.push({ tabId, worktreeId })
}
tabsByWorktree[worktreeId] = countTabIteration ? CountingTabList.from(tabs) : tabs
unifiedTabsByWorktree[worktreeId] = unified
}
store.setState({
repos: [TEST_REPO],
worktreesByRepo: { [TEST_REPO.id]: worktrees },
tabsByWorktree,
unifiedTabsByWorktree,
terminalLayoutsByTabId: {},
setGeneratedTabTitlesFromAgentPrompts: () => {},
settings: { ...settings, tabAutoGenerateTitle: false }
})
return { store, paneKeys, owners }
const fixture = buildAgentStatusScaleFixture(
countTabIteration
? () => {
counters.tabComparisons += 1
}
: undefined
)
fixture.store.setState({ setGeneratedTabTitlesFromAgentPrompts: () => {} })
return fixture
}
function measure(run: () => void): number {
@@ -310,10 +310,10 @@ async function main() {
))
;({ killAllPty } = await jiti.import('../../../../src/main/ipc/pty/kill-all.ts'))
const { WslHookRelayManager, wslHookRelayManager } = await jiti.import(
'../../../../src/main/agent-hooks/wsl-hook-relay-manager.ts'
'../../../../src/main/agent-hooks/wsl-relay/wsl-hook-relay-manager.ts'
)
const { ensureWslHookRelayForReattach } = await jiti.import(
'../../../../src/main/agent-hooks/wsl-hook-relay-reattach.ts'
'../../../../src/main/agent-hooks/wsl-relay/wsl-hook-relay-reattach.ts'
)
const { codexHookService } = await jiti.import(
'../../../../src/main/codex/hooks/installation/hook-service.ts'
@@ -35,8 +35,15 @@ const RATCHET_INPUTS = {
'check-host-list-render-ratchet.mjs': ['src/renderer/src/'],
'check-id-only-store-write-ratchet.mjs': ['src/main/persistence/'],
'check-layout-writer-ratchets.mjs': ['src/main/', 'src/renderer/src/'],
'check-main-sync-fs-ratchet.mjs': ['src/main/', 'src/shared/'],
'check-main-sync-spawn-ratchet.mjs': ['src/main/'],
'check-react-compiler-compat-ratchet.mjs': ['src/renderer/src/'],
'check-recurring-timer-ratchet.mjs': [
'src/main/',
'src/renderer/src/',
'src/shared/',
'src/cli/'
],
'check-render-path-translate-ratchet.mjs': ['src/renderer/src/'],
'check-repo-host-read-ratchet.mjs': ['src/cli/', 'src/main/', 'src/shared/'],
'check-runtime-electron-ratchet.mjs': ['src/main/', 'src/cli/', 'src/shared/'],
@@ -258,7 +265,9 @@ export function selectTypecheckProjects(files) {
const RATCHET_SHARED_MODULES = {
'config/scripts/static-analysis/process-boundaries/gated-call-use-collector.mjs': [
'check-daemon-blocking-call-ratchet.mjs',
'check-main-sync-spawn-ratchet.mjs'
'check-main-sync-fs-ratchet.mjs',
'check-main-sync-spawn-ratchet.mjs',
'check-recurring-timer-ratchet.mjs'
],
'config/scripts/static-analysis/ratchets/react-compiler/react-compiler-hazards.mjs': [
'check-react-compiler-compat-ratchet.mjs'
@@ -41,6 +41,8 @@ export const LINT_STEPS = [
'check:workspace-record-read-ratchet',
'check:unproven-pty-retirement-ratchet',
'check:daemon-blocking-call-ratchet',
'check:main-sync-fs-ratchet',
'check:recurring-timer-ratchet',
'check:node-runtime-pin',
'check:path-literal-ratchet',
'check:host-list-render-ratchet',
@@ -77,12 +77,12 @@ describe('main sync-spawn ratchet', () => {
],
[
"const { execSync } = require('child_process')\nconst run = execSync\nrun('a')",
2,
1,
['execSync']
],
[
"function f() { const run = cp.execSync; run('a') }\nconst cp = require('child_process')",
2,
1,
['execSync']
],
[
@@ -91,10 +91,18 @@ describe('main sync-spawn ratchet', () => {
['execFileSync']
],
[
"import { runProcessSync } from '@orca/process-host'\nconst run = runProcessSync<string>",
"import { runProcessSync } from '@orca/process-host'\nconst run = runProcessSync<string>\nrun(a)",
1,
['runProcessSync']
]
],
// Binding an alias is setup; each call through it is a use, so an alias refactor keeps the count.
[
"import { execSync } from 'child_process'\nconst run = execSync\nrun('a')\nrun('b')",
2,
['execSync']
],
["import { execSync } from 'child_process'\nexport const run = execSync", 1, ['execSync']],
["import { execSync } from 'child_process'\nconst out = execSync('a')", 1, ['execSync']]
])('counts %s', (source, count, symbols) => {
expect(uses(source)).toEqual({ count, symbols })
})
@@ -38,6 +38,15 @@ function isValueReference(node) {
)
}
function isExportedDeclaration(declaration) {
const statement = declaration.parent?.parent
return (
!!statement &&
ts.isVariableStatement(statement) &&
!!statement.modifiers?.some((modifier) => modifier.kind === ts.SyntaxKind.ExportKeyword)
)
}
/**
* Each family lists module specifiers (packages, or repo paths without extension) and the gated
* exports to count, each with advice for the failure message.
@@ -72,7 +81,7 @@ export function createGatedCallCollector(families, ratchetName) {
)
}
// Count each gated value reference, alias use and re-export; imports alone do not count.
// Count each gated value reference, alias use and re-export; imports and plain alias bindings alone do not count.
// File-wide, not scope-aware: computed specifiers/members and non-const holder flows are unresolved; local wrappers are not traced.
function collectUses(file, contents) {
// Escaped spellings and relative imports inside gated modules still need the full analysis.
@@ -197,7 +206,7 @@ export function createGatedCallCollector(families, ratchetName) {
identifiers.push(node)
} else if (ts.isVariableDeclaration(node) && node.initializer) {
if (ts.isIdentifier(node.name)) {
aliases.push({ name: node.name.text, initializer: node.initializer })
aliases.push({ name: node.name.text, initializer: node.initializer, declaration: node })
} else if (ts.isObjectBindingPattern(node.name)) {
destructures.push(node)
}
@@ -236,14 +245,30 @@ export function createGatedCallCollector(families, ratchetName) {
}
}
}
// Binding a tracked alias is setup, not a use: its calls are charged instead, so an alias refactor
// keeps the count. Conditional/fallback aliases and exported bindings stay charged (conservative).
const aliasSetup = new Set()
for (const { name, initializer, declaration } of aliases) {
const target = unwrap(initializer)
if (
functions.has(name) &&
(ts.isIdentifier(target) ||
ts.isPropertyAccessExpression(target) ||
ts.isElementAccessExpression(target)) &&
gatedFunction(target) &&
!isExportedDeclaration(declaration)
) {
aliasSetup.add(target)
}
}
for (const node of members) {
const name = propertyName(node)
if (moduleSymbols(node.expression)?.has(name)) {
if (!aliasSetup.has(node) && moduleSymbols(node.expression)?.has(name)) {
recordUse(name)
}
}
for (const node of identifiers) {
const name = functions.get(node.text)
const name = aliasSetup.has(node) ? null : functions.get(node.text)
if (name) {
recordUse(name)
}
@@ -0,0 +1,115 @@
import process from 'node:process'
import { pathToFileURL } from 'node:url'
import { createGatedCallCollector } from '../../process-boundaries/gated-call-use-collector.mjs'
import { readTrackedSources, runCountRatchet } from '../../ratchet-baseline/ratchet-baseline.mjs'
import { isTestOnlySourcePath } from '../../process-boundaries/test-only-source-path.mjs'
// Sync fs on Electron main stalls every window (and in the daemon/orcad, every terminal); per-spawn/RPC/focus stat and read sweeps were a recurring lag source (#39805, #35967, #38481).
const BASELINE_PATH = 'config/main-sync-fs-baseline.txt'
// src/shared runs on main too; leaving it out would let a helper move bypass the gate.
const SCAN_ROOTS = ['src/main', 'src/shared']
const ADVICE =
'use node:fs/promises, or cache the result on a stat fingerprint outside the hot path'
// Every *Sync export of node:fs (descriptor and copy APIs included), listed so the baseline doesn't depend on the runtime.
const SYNC_FS = [
'accessSync',
'appendFileSync',
'chmodSync',
'chownSync',
'closeSync',
'copyFileSync',
'cpSync',
'existsSync',
'fchmodSync',
'fchownSync',
'fdatasyncSync',
'fstatSync',
'fsyncSync',
'ftruncateSync',
'futimesSync',
'globSync',
'lchmodSync',
'lchownSync',
'linkSync',
'lstatSync',
'lutimesSync',
'mkdirSync',
'mkdtempDisposableSync',
'mkdtempSync',
'openSync',
'opendirSync',
'readFileSync',
'readSync',
'readdirSync',
'readlinkSync',
'readvSync',
'realpathSync',
'renameSync',
'rmSync',
'rmdirSync',
'statSync',
'statfsSync',
'symlinkSync',
'truncateSync',
'unlinkSync',
'utimesSync',
'writeFileSync',
'writeSync',
'writevSync'
]
const collector = createGatedCallCollector(
[
{
modules: ['fs', 'node:fs', 'original-fs', 'graceful-fs'],
advice: Object.fromEntries(SYNC_FS.map((name) => [name, ADVICE]))
}
],
'main sync-fs'
)
function isScannedPath(rel) {
return /\.[cm]?[jt]sx?$/.test(rel) && !rel.endsWith('.d.ts') && !isTestOnlySourcePath(rel)
}
export function countSyncFsCalls(rel, source) {
return collector.collectUses(rel, source).count
}
export function collectMainSyncFsCounts(root = process.cwd()) {
const counts = new Map()
for (const [rel, source] of readTrackedSources(root, SCAN_ROOTS, isScannedPath)) {
const count = countSyncFsCalls(rel, source)
if (count > 0) {
counts.set(rel, count)
}
}
return counts
}
export function main(root = process.cwd(), arg = undefined) {
return runCountRatchet(
{
name: 'main-sync-fs',
baselinePath: BASELINE_PATH,
header: [
'# Synchronous node:fs calls (every *Sync export) in production src/main and src/shared, per file.',
'# Startup-only or one-shot uses are fine to keep; per-RPC, per-spawn, per-focus or per-poll uses are the target.',
'# This is a RATCHET: counts may only go DOWN.',
'# Prune after removing calls: pnpm check:main-sync-fs-ratchet --prune'
],
collect: collectMainSyncFsCounts,
unit: 'sync fs call(s)',
fix: [
`Sync fs blocks the thread it runs on: Electron main (every window) or the daemon/orcad loop (every terminal). ${ADVICE}.`,
`A one-shot startup or shutdown use may raise the file's count in ${BASELINE_PATH} with reviewer sign-off.`
]
},
root,
arg
)
}
if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) {
process.exit(main(process.cwd(), process.argv[2]))
}
@@ -0,0 +1,168 @@
import process from 'node:process'
import { pathToFileURL } from 'node:url'
import ts from 'typescript-api'
import { createGatedCallCollector } from '../../process-boundaries/gated-call-use-collector.mjs'
import { readTrackedSources, runCountRatchet } from '../../ratchet-baseline/ratchet-baseline.mjs'
import { isTestOnlySourcePath } from '../../process-boundaries/test-only-source-path.mjs'
// Fixed-cadence polls that never back off, settle or pause while hidden were the most common perf fix class (#39734, #38902, #33829, #39650).
const BASELINE_PATH = 'config/recurring-timer-baseline.txt'
const SCAN_ROOTS = ['src/main', 'src/renderer/src', 'src/shared', 'src/cli']
const TIMER_HOSTS = new Set(['window', 'globalThis', 'self', 'global'])
const TIMER_MODULES = ['timers', 'node:timers', 'timers/promises', 'node:timers/promises']
const timerImports = createGatedCallCollector(
[
{
modules: TIMER_MODULES,
advice: { setInterval: 'prefer a push signal or a backing-off timer' }
}
],
'recurring-timer'
)
function isScannedPath(rel) {
return /\.[cm]?[jt]sx?$/.test(rel) && !rel.endsWith('.d.ts') && !isTestOnlySourcePath(rel)
}
function isHostInterval(node) {
if (!ts.isIdentifier(node.expression) || !TIMER_HOSTS.has(node.expression.text)) {
return false
}
if (ts.isPropertyAccessExpression(node)) {
return node.name.text === 'setInterval'
}
return (
ts.isElementAccessExpression(node) &&
ts.isStringLiteralLike(node.argumentExpression) &&
node.argumentExpression.text === 'setInterval'
)
}
// Skips transparent wrappers so `typeof (setInterval)` and `(setInterval) = x` read like the bare forms.
function outerExpression(node) {
let current = node
while (ts.isParenthesizedExpression(current.parent)) {
current = current.parent
}
return current
}
// Reads the timer value: not a plain `=` target (compound assignments read it), a `typeof` probe or a JSX tag name.
function isRuntimeRead(node) {
const outer = outerExpression(node)
const parent = outer.parent
return !(
ts.isTypeOfExpression(parent) ||
(ts.isBinaryExpression(parent) &&
parent.left === outer &&
parent.operatorToken.kind === ts.SyntaxKind.EqualsToken) ||
((ts.isJsxOpeningElement(parent) ||
ts.isJsxSelfClosingElement(parent) ||
ts.isJsxClosingElement(parent)) &&
parent.tagName === node)
)
}
// A value reference to the identifier, not a declaration, member name or key.
function isBareValueReference(node) {
const parent = node.parent
return (
isRuntimeRead(node) &&
!(
(ts.isPropertyAccessExpression(parent) && parent.name === node) ||
(ts.isPropertyAssignment(parent) && parent.name === node) ||
ts.isImportSpecifier(parent) ||
ts.isExportSpecifier(parent) ||
(ts.isBindingElement(parent) && (parent.name === node || parent.propertyName === node)) ||
(ts.isVariableDeclaration(parent) && parent.name === node) ||
(ts.isParameter(parent) && parent.name === node) ||
((ts.isFunctionDeclaration(parent) || ts.isMethodDeclaration(parent)) && parent.name === node)
)
)
}
const SCOPE_OPTIONS = { noLib: true, noResolve: true, allowJs: true, types: [] }
// Counts references, not calls, to the global timer, so `const every = setInterval; every(f)` and
// `window['setInterval']` are charged once. A bare name is the global when it binds to nothing
// declared in this file (resolved per scope); module bindings and their aliases are the collector's.
function countGlobalTimerReferences(source) {
const host = ts.createCompilerHost(SCOPE_OPTIONS)
host.getSourceFile = (name) => (name === source.fileName ? source : undefined)
const checker = ts.createProgram([source.fileName], SCOPE_OPTIONS, host).getTypeChecker()
let count = 0
const visit = (node) => {
if (ts.isTypeNode(node) && !ts.isExpressionWithTypeArguments(node)) {
return
}
if (
(ts.isPropertyAccessExpression(node) || ts.isElementAccessExpression(node)) &&
isHostInterval(node) &&
isRuntimeRead(node)
) {
count += 1
} else if (ts.isIdentifier(node) && node.text === 'setInterval' && isBareValueReference(node)) {
// A shorthand `{ setInterval }` names the property; its value is the binding being read.
const symbol = ts.isShorthandPropertyAssignment(node.parent)
? checker.getShorthandAssignmentValueSymbol(node.parent)
: checker.getSymbolAtLocation(node)
const declarations = symbol?.declarations ?? []
if (!declarations.some((declaration) => declaration.getSourceFile() === source)) {
count += 1
}
}
ts.forEachChild(node, visit)
}
visit(source)
return count
}
export function countRecurringTimers(rel, source) {
if (!source.includes('setInterval')) {
return 0
}
const file = ts.createSourceFile(rel, source, ts.ScriptTarget.Latest, true)
return countGlobalTimerReferences(file) + timerImports.collectUses(rel, source).count
}
export function collectRecurringTimerCounts(root = process.cwd()) {
const counts = new Map()
for (const [rel, source] of readTrackedSources(root, SCAN_ROOTS, isScannedPath)) {
const count = countRecurringTimers(rel, source)
if (count > 0) {
counts.set(rel, count)
}
}
return counts
}
export function main(root = process.cwd(), arg = undefined) {
return runCountRatchet(
{
name: 'recurring-timer',
baselinePath: BASELINE_PATH,
header: [
'# setInterval calls (global, or imported from node:timers / node:timers/promises) in production src/main,',
'# src/renderer, src/shared and src/cli, per file. Bare calls are resolved per scope; imported bindings follow the shared',
'# collector (file-wide). Not counted: destructuring off a global object, a self-rescheduling setTimeout (it must back off or pause while hidden).',
'# This is a RATCHET: counts may only go DOWN.',
'# Prune after removing intervals: pnpm check:recurring-timer-ratchet --prune'
],
collect: collectRecurringTimerCounts,
unit: 'setInterval call(s)',
fix: [
'A fixed-cadence interval keeps working when nothing changes, the window is hidden or its dependency keeps failing.',
'Prefer a push signal; otherwise use installWindowVisibilityInterval (renderer) or a timer that backs off and stops when idle.',
'Rewriting it as a self-rescheduling setTimeout at the same fixed cadence is the same bug; review will treat it so.',
`An interval whose cadence is the feature (a clock, a heartbeat with a stop) may raise the file's count in ${BASELINE_PATH} with reviewer sign-off.`
]
},
root,
arg
)
}
if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) {
process.exit(main(process.cwd(), process.argv[2]))
}
@@ -0,0 +1,40 @@
import { describe, expect, it } from 'vitest'
import { countRecurringTimers } from './check-recurring-timer-ratchet.mjs'
describe('recurring-timer ratchet', () => {
it.each([
['setInterval(poll, 1000)', 1],
['window.setInterval(poll, 1)\nglobalThis.setInterval(poll, 1)\nobj.setInterval(1)', 2],
[
"import { setInterval } from 'node:timers'\nsetInterval(poll, 1)\nwindow.setInterval(poll, 1)",
2
],
["const { setInterval } = require('node:timers')\nsetInterval(poll, 1)", 1],
["import { setInterval as every } from 'node:timers/promises'\nevery(5000)", 1],
// Alias and destructure forms of an imported timer count once, like the direct call.
[
"import * as timers from 'node:timers'\nconst setInterval = timers.setInterval\nsetInterval(poll, 1)",
1
],
[
"const timers = require('node:timers')\nconst { setInterval } = timers\nsetInterval(poll, 1)",
1
],
["const { setInterval } = await import('node:timers')\nsetInterval(poll, 1)", 1],
// An unrelated local binding must not hide a global poll elsewhere in the file.
['function configure(setInterval) {\n return setInterval\n}\nsetInterval(poll, 1000)', 1],
['type Configure = (setInterval: number) => void\nsetInterval(poll, 1000)', 1],
['function a(setInterval) { setInterval(f) }\nfunction b() { setInterval(g, 1) }', 1],
['function setInterval(f) {}\nsetInterval(poll)', 0],
// Aliases and bracket access of the global timer are charged at the reference.
['const schedule = setInterval\nschedule(poll, 1000)', 1],
["window['setInterval'](poll, 1000)", 1],
['const every = window.setInterval\nevery(poll, 1)', 1],
["if (typeof setInterval === 'function') {}\ntype T = typeof setInterval", 0],
['const deps = { setInterval, clearInterval }\ndeps.setInterval(poll, 1)', 1],
["setInterval = replacement\nwindow['setInterval'] = replacement\ntypeof (setInterval)", 0],
['(window.setInterval ||= fallback)(poll, 1000)', 1]
])('counts %s', (source, count) => {
expect(countRecurringTimers('src/main/example.ts', source)).toBe(count)
})
})
@@ -92,7 +92,7 @@ const NODE_RUNTIME_INCLUDE = [
'src/**/*allocation*.test.ts',
'src/**/*expiry*.test.ts',
'src/shared/own-retained-string.test.ts',
'src/main/agent-hooks/server-transport-interference.test.ts',
'src/main/agent-hooks/server/testing/http/server-transport-interference.test.ts',
'src/main/plugins/workers/plugin-worker-supervision.integration.test.ts',
'src/main/plugins/workers/plugin-worker-dev-restart-storage.integration.test.ts',
// Worker TypeScript loads through node:module registerHooks, which Bun lacks.
@@ -102,8 +102,8 @@ const CODEX_INDEX_HEAL_CONTRACT_PREFIXES = [
'src/main/codex/trust/identity/codex-trust-identity',
'src/main/codex/trust/toml/config-toml-hook-trust-',
'src/main/codex/configuration/toml/config-toml-key-path',
'src/main/agent-hooks/posix-hook-command',
'src/main/agent-hooks/hook-post-command',
'src/main/agent-hooks/installation/commands/posix-hook-command',
'src/main/agent-hooks/installation/scripts/hook-post-command',
'src/main/codex-cli/codex-read-only-app-server-args',
'src/main/agent-launch/trust/agent-trust-presets',
'src/main/codex/trust/toml/config-toml-trust',
@@ -173,14 +173,14 @@ export const WINDOWS_BOUNDARY_TESTS = [
'src/shared/__tests__/process-host/windows-tree-kill-late-taskkill.win32.test.ts',
'src/shared/agent-launch/startup/omp-fresh-launch-cmd.win32.test.ts',
'src/shared/windows-batch-spawn.win32.test.ts',
'src/main/agent-hooks/windows-hook-payload-delivery.test.ts',
'src/main/agent-hooks/managed-hook-stdin-lifecycle.test.ts',
'src/main/agent-hooks/installation/commands/windows-hook-payload-delivery.test.ts',
'src/main/agent-hooks/installation/scripts/managed-hook-stdin-lifecycle.test.ts',
'src/main/jcode/hook-gate-script.test.ts',
'src/main/agent-hooks/windows-native-hook-exe-hosts.test.ts',
'src/main/agent-hooks/installation/commands/windows-native-hook-exe-hosts.test.ts',
'src/main/claude/windows-native-hook-registration.test.ts',
'src/main/agent-hooks/windows-cmd-hook-command-unicode.test.ts',
'src/main/agent-hooks/windows-batch-hook-launcher.test.ts',
'src/main/agent-hooks/windows-powershell-hook-launcher.test.ts',
'src/main/agent-hooks/installation/commands/windows-cmd-hook-command-unicode.test.ts',
'src/main/agent-hooks/installation/commands/windows-batch-hook-launcher.test.ts',
'src/main/agent-hooks/installation/commands/windows-powershell-hook-launcher.test.ts',
'src/main/claude/claude-status-line-windows.test.ts',
'src/main/codex/hooks/installation/windows-hook-command.test.ts',
'src/main/codex/hooks/installation/hook-service-managed-install.test.ts',
+14 -1
View File
@@ -23,7 +23,20 @@ const contracts = [
'config/scripts/static-analysis/oxlint-contracts/app-store-performance-plugin.test.mjs',
'config/scripts/static-analysis/oxlint-contracts/quadratic-buffer-concat-plugin.test.mjs',
'src/main/claude-usage/scanner-incremental-append.test.ts',
'src/main/claude-usage/store-checkpoint-persistence.test.ts'
'src/main/claude-usage/store-checkpoint-persistence.test.ts',
// Renderer hot paths: render, identity and publication counts at N and 10N (agent status, sidebar, tab strip, chat).
'src/renderer/src/store/slices/agent-status/agent-status-batch.performance.test.ts',
'src/renderer/src/components/sidebar/workspace-card/activity/use-worktree-agent-rows.performance.test.tsx',
'src/renderer/src/components/sidebar/workspace-card/activity/use-worktree-activity-status.performance.test.tsx',
'src/renderer/src/components/sidebar/worktree-list/listing/use-visible-worktrees.performance.test.tsx',
'src/renderer/src/components/tab-bar/use-terminal-tab-activity.performance.test.tsx',
'src/renderer/src/components/tab-bar/tab-agent-types-by-tab-id.performance.test.ts',
'src/renderer/src/app-shell/use-runtime-graph-sync.performance.test.tsx',
'src/renderer/src/components/native-chat/markdown/NativeChatMarkdown.streaming.performance.test.tsx',
'src/renderer/src/components/native-chat/surfaces/integration/NativeChatStructuredSession.composer-typing.performance.test.tsx',
'src/renderer/src/components/native-chat/surfaces/integration/NativeChatResolvedView.streaming-input.test.tsx',
'src/renderer/src/components/native-chat/viewport/virtualization/NativeChatMessageList.windowing.performance.test.tsx',
'src/renderer/src/components/activity/use-agent-pane-threads.performance.test.tsx'
]
for (const contract of contracts) {
if (!existsSync(resolve(contract))) {
@@ -227,48 +227,6 @@ describe('useHostClient', () => {
harness.unmount()
})
it('reports disconnected instead of hanging when the host id is unknown', async () => {
loadHostsMock.mockResolvedValue([])
const harness = await renderHarness('missing-host')
expect(connectMock).not.toHaveBeenCalled()
expect(harness.hook.client).toBeNull()
expect(harness.hook.state).toBe('disconnected')
harness.unmount()
})
it('seeds connecting during the async open instead of flashing disconnected', async () => {
let resolveHosts: ((hosts: (typeof HOST)[]) => void) | null = null
const hostLookup = new Promise<(typeof HOST)[]>((resolve) => {
resolveHosts = resolve
})
connectMock.mockReturnValue(makeFakeClient('connecting'))
loadHostsMock.mockReturnValue(hostLookup)
const states: ConnectionState[] = []
let renderer: ReactTestRenderer | null = null
function Probe(): null {
states.push(useHostClient(HOST.id).state)
return null
}
try {
act(() => {
renderer = create(createElement(RpcClientProvider, null, createElement(Probe)))
})
expect(states.at(-1)).toBe('connecting')
await act(async () => {
resolveHosts?.([HOST])
await hostLookup
})
expect(states.at(-1)).toBe('connecting')
expect(states).not.toContain('disconnected')
} finally {
act(() => renderer?.unmount())
}
})
it('keeps Retry amber through forceReconnect instead of grey-then-amber', async () => {
const first = makeFakeClient('connected')
const second = makeFakeClient('connecting')
@@ -1,20 +0,0 @@
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
import { HostOpenRetryScheduler } from './host-open-retry-scheduler'
describe('HostOpenRetryScheduler', () => {
beforeEach(() => vi.useFakeTimers())
afterEach(() => {
vi.useRealTimers()
})
it('cancels retry delivery', async () => {
const open = vi.fn()
const scheduler = new HostOpenRetryScheduler({ canRetry: () => true, open })
scheduler.recordFailure('host-1', 1)
scheduler.cancel('host-1')
await vi.advanceTimersByTimeAsync(60_000)
expect(open).not.toHaveBeenCalled()
})
})
@@ -1,16 +0,0 @@
import { describe, expect, it } from 'vitest'
import { encodeBase64Bytes } from './base64-byte-codec'
describe('base64 byte codec', () => {
it('keeps the fallback when the native property is not callable', () => {
const bytes = new Uint8Array([255, 254])
Object.defineProperty(bytes, 'toBase64', { value: undefined })
expect(encodeBase64Bytes(bytes)).toBe('//4=')
})
it('preserves empty encoding for a detached byte view', () => {
const bytes = new Uint8Array([1, 2, 3])
structuredClone(bytes.buffer, { transfer: [bytes.buffer] })
expect(encodeBase64Bytes(bytes)).toBe('')
})
})
@@ -5,34 +5,18 @@ vi.mock('@react-native-async-storage/async-storage', () => ({
default: { getItem: vi.fn(), setItem: vi.fn() }
}))
const channelArgs: { onAuthenticated: () => void }[] = []
const stored = new Map<string, string>()
vi.mock('./mobile-e2ee-v2-client-session', () => ({
MobileE2EEV2ClientSession: { create: () => ({}) }
}))
vi.mock('./mobile-e2ee-v2-physical-channel', () => ({
MobileE2EEV2PhysicalChannel: class {
constructor(args: { onAuthenticated: () => void }) {
channelArgs.push(args)
}
start = vi.fn()
handleMessage = vi.fn(async () => {})
dispose = vi.fn()
}
}))
import { createDirectE2EEFramingPolicy } from './direct-e2ee-framing-policy'
import {
hydrateE2EEV2HostLatch,
isHostLatchedToE2EEV2,
latchHostToE2EEV2,
resetE2EEV2HostLatchForTests
} from './e2ee-v2-host-latch'
describe('E2EE v2 host latch', () => {
beforeEach(() => {
resetE2EEV2HostLatchForTests()
channelArgs.length = 0
stored.clear()
vi.mocked(AsyncStorage.getItem)
.mockReset()
@@ -73,16 +57,4 @@ describe('E2EE v2 host latch', () => {
expect(policy.framingForNextDial()).toBe('v2')
expect(policy.helloRefusalIsAuthFailure()).toBe(true)
})
it('ignores malformed persisted entries', async () => {
vi.mocked(AsyncStorage.getItem).mockResolvedValueOnce(JSON.stringify(['a', 7, '', null]))
await hydrateE2EEV2HostLatch()
expect(isHostLatchedToE2EEV2('a')).toBe(true)
expect(isHostLatchedToE2EEV2('')).toBe(false)
expect(isHostLatchedToE2EEV2('7')).toBe(false)
expect(isHostLatchedToE2EEV2('null')).toBe(false)
latchHostToE2EEV2('b')
await Promise.resolve()
expect(stored.get('orca:e2ee-v2-hosts')).toBe('["a","b"]')
})
})
@@ -1,20 +0,0 @@
import { describe, expect, it, vi } from 'vitest'
import { removeHostAndCloseClient } from './host-removal-lifecycle.web'
import { isPageHostRemovalUnavailable } from './page-host-removal-refusal'
describe('removing a host from the page', () => {
it('refuses with a code the screen can branch on', async () => {
const error = await removeHostAndCloseClient('host-1', vi.fn()).catch(
(reason: unknown) => reason
)
expect(isPageHostRemovalUnavailable(error)).toBe(true)
expect({
name: error instanceof Error ? error.name : null,
code: isPageHostRemovalUnavailable(error) ? error.code : null
}).toEqual({
name: 'PageHostRemovalUnavailableError',
code: 'page_host_removal_unavailable'
})
})
})
@@ -1,13 +1,7 @@
import AsyncStorage from '@react-native-async-storage/async-storage'
import * as SecureStore from 'expo-secure-store'
import { beforeEach, describe, expect, it, vi } from 'vitest'
import {
loadHosts,
RelayRoutingHostRemovedError,
resetHostStoreForTests,
setRelayRouting,
updateHostNameAndEndpoint
} from './host-store'
import { loadHosts, resetHostStoreForTests, updateHostNameAndEndpoint } from './host-store'
import { resetMobileRelayHostOverlayStoreForTests } from './mobile-relay-host-overlay-store'
vi.mock('@react-native-async-storage/async-storage', () => ({
@@ -44,10 +38,6 @@ describe('relay routing after a host edit', () => {
const storage = new Map<string, string>()
function writesTo(key: string): unknown[] {
return vi.mocked(AsyncStorage.setItem).mock.calls.filter(([written]) => written === key)
}
beforeEach(() => {
resetHostStoreForTests()
resetMobileRelayHostOverlayStoreForTests()
@@ -99,17 +89,4 @@ describe('relay routing after a host edit', () => {
relay
})
})
it('refuses to write routing for a removed host and leaves no overlay behind', async () => {
storage.set('orca:hosts', '[]')
storage.set(OVERLAY_KEY, '[]')
await expect(setRelayRouting('host-1', relay)).rejects.toBeInstanceOf(
RelayRoutingHostRemovedError
)
expect(writesTo(OVERLAY_KEY)).toEqual([])
expect(writesTo('orca:hosts')).toEqual([])
await expect(loadHosts()).resolves.toEqual([])
})
})
+1 -72
View File
@@ -48,8 +48,7 @@ import {
resetHostStoreForTests,
savePairedHost,
setRelayRouting,
updateHostNameAndEndpoint,
updateLastConnected
updateHostNameAndEndpoint
} from './host-store'
import { resetMobileRelayHostOverlayStoreForTests } from './mobile-relay-host-overlay-store'
@@ -136,36 +135,6 @@ describe('host-store list mutations', () => {
expect(profiles.map(({ id }) => id)).toEqual([HOST_TWO.id])
})
it('keeps orphaned metadata visible when its credential is missing', async () => {
secureStoreMock.getItemAsync.mockImplementation(async (key: string) =>
key.endsWith(HOST_TWO.id) ? 'token-2' : null
)
const catalog = await loadHostCatalog()
expect(catalog.find(({ id }) => id === HOST_ONE.id)).toMatchObject({
credentialStatus: 'missing',
profile: null
})
})
it('keeps existing metadata when pairing a distinct host', async () => {
await savePairedHost({
id: 'host-new',
name: 'Host 3',
endpoint: 'ws://127.0.0.1:3',
publicKeyB64: 'key-new',
deviceToken: 'token-new',
lastConnected: 0
})
expect(JSON.parse(storedHostsRaw).map(({ id }: { id: string }) => id)).toEqual([
HOST_ONE.id,
HOST_TWO.id,
'host-new'
])
})
it('fails closed when durable host identity storage is unreadable', async () => {
asyncStorageMock.getItem.mockRejectedValueOnce(new Error('storage unavailable'))
@@ -361,14 +330,6 @@ describe('host-store list mutations', () => {
const hosts = await loadHosts()
expect(hosts.find((host) => host.id === newHost.id)?.deviceToken).toBe(newHost.deviceToken)
})
it('resolves instead of rejecting when updateLastConnected hits unreadable storage', async () => {
// Void callers cannot catch rejection; unreadable storage must leave this bookkeeping best-effort.
storedHostsRaw = '{'
await expect(updateLastConnected(HOST_ONE.id)).resolves.toBeUndefined()
expect(asyncStorageMock.setItem).not.toHaveBeenCalled()
expect(storedHostsRaw).toBe('{')
})
})
describe('host-store pairing save after an Android encryption rejection', () => {
@@ -419,38 +380,6 @@ describe('host-store pairing save after an Android encryption rejection', () =>
secureStoreMock.getItemAsync.mockResolvedValue(null)
})
it('saves the host when the reported Android failure is alias-local (#6600)', async () => {
const written = new Map<string | undefined, string>()
// Model the alias-local hypothesis; no affected physical device was available.
secureStoreMock.setItemAsync.mockImplementation(
async (_key: string, value: string, options?: { keychainService?: string }) => {
if (options?.keychainService === undefined) {
throw ENCRYPT_REJECTION
}
written.set(options.keychainService, value)
}
)
await expect(savePairedHost(NEW_HOST)).resolves.toBeUndefined()
expect(written.get('orca.pairing.v1')).toBe('device-token')
expect(JSON.parse(storedHostsRaw)).toEqual([
{
id: NEW_HOST.id,
name: NEW_HOST.name,
endpoint: NEW_HOST.endpoint,
publicKeyB64: NEW_HOST.publicKeyB64,
lastConnected: NEW_HOST.lastConnected
}
])
})
it('still surfaces the failure when no keystore alias can accept the token', async () => {
secureStoreMock.setItemAsync.mockRejectedValue(ENCRYPT_REJECTION)
await expect(savePairedHost(NEW_HOST)).rejects.toBe(ENCRYPT_REJECTION)
})
it('serves the rotated token to loadHosts so the saved host survives a relaunch', async () => {
const written = new Map<string | undefined, string>()
secureStoreMock.setItemAsync.mockImplementation(
@@ -69,16 +69,4 @@ describe('pairing keychain', () => {
expect(asyncStorageMock.setItem).not.toHaveBeenCalled()
expect(secureStoreMock.setItemAsync).not.toHaveBeenCalled()
})
it.each(['not-a-number', '', ' ', '0:pending'])(
'refuses to write from malformed generation record %j',
async (raw) => {
generationRecord = raw
await expect(writePairingKeychainItem(TOKEN_KEY, 'token')).rejects.toThrow(
/generation record is invalid/
)
expect(secureStoreMock.setItemAsync).not.toHaveBeenCalled()
}
)
})
@@ -1,17 +0,0 @@
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
import { directPathForEndpoint } from './mobile-direct-endpoint-probe'
describe('mobile direct endpoint probe', () => {
beforeEach(() => vi.useFakeTimers())
afterEach(() => vi.useRealTimers())
it('classifies a tailnet endpoint apart from a LAN one', () => {
expect(directPathForEndpoint('ws://100.64.0.2:6768')).toBe('tailscale')
expect(directPathForEndpoint('wss://desk.tail1234.ts.net:6768')).toBe('tailscale')
expect(directPathForEndpoint('ws://[fd7a:115c:a1e0::1]:6768')).toBe('tailscale')
// 100.0.0.0/10 is not the tailnet's 100.64.0.0/10.
expect(directPathForEndpoint('ws://100.12.0.2:6768')).toBe('lan')
expect(directPathForEndpoint('ws://192.168.1.10:6768')).toBe('lan')
})
})
@@ -11,34 +11,6 @@ const relay = {
}
describe('mobile relay resume director', () => {
it('uses a bounded POST body and never puts the bearer in the URL', async () => {
const fetchImpl = vi.fn(
async (_url: string, _init: RequestInit) =>
new Response(
JSON.stringify({
v: 1,
cellUrl: 'https://relay-c2.onorca.dev',
assignmentEpoch: 8,
leaseExpiresAt: Date.now() + 60_000
}),
{ status: 200, headers: { 'content-type': 'application/json' } }
)
)
await expect(
resolveMobileRelayEndpoint({ relay, resumeToken: 'A'.repeat(43), fetchImpl })
).resolves.toMatchObject({ cellUrl: 'https://relay-c2.onorca.dev', assignmentEpoch: 8 })
const [url, init] = fetchImpl.mock.calls[0]!
expect(url).toBe('https://relay.onorca.dev/v1/resolve')
expect(url).not.toContain('A'.repeat(43))
expect(init).toMatchObject({ method: 'POST' })
expect(JSON.parse(String(init.body))).toEqual({
v: 1,
relayHostId: relay.relayHostId,
resumeToken: 'A'.repeat(43)
})
})
it('rejects non-canonical targets and oversized bodies', async () => {
const badTarget = vi.fn(
async () =>
@@ -44,24 +44,6 @@ describe('the post-barrier combinator', () => {
await expect(barrier).rejects.toThrow('method_not_found: no such method')
})
it('keeps the middle operation error when a later one also fails', async () => {
const barrier = interpretAtRpcBarrier([
startRpcOperation(replying(rpcSuccess(rows)), workspaceListAtBarrier, {}),
startRpcOperation(
replying(rpcRefusal('conflict', 'middle refused')),
workspaceListAtBarrier,
{}
),
startRpcOperation(
replying(rpcRefusal('runtime_error', 'later refused')),
workspaceListAtBarrier,
{}
)
])
await expect(barrier).rejects.toThrow('conflict: middle refused')
})
it('rethrows a captured transport rejection as the original error object', async () => {
const error = markRpcDeliveryUnknown(new Error('socket closed before response'))
const dropped = new FakeSession('connected')
@@ -1,57 +0,0 @@
import { describe, expect, it } from 'vitest'
import { FakeSession } from '../connection/mobile-endpoint-supervisor-test-fakes'
import { isLogicalClientCutoverError } from '../connection/logical-client-cutover-error'
import { isRpcDeliveryUnknown, markRpcDeliveryUnknown } from './rpc-delivery-ambiguity'
import { captureRpcOperationSettlement, runRpcOperation } from './rpc-operation'
import { workspaceListOrThrow } from './rpc-operation-test-families'
describe('transport rejection stays on the promise channel', () => {
it('rejects with the original error object', async () => {
const error = new Error('socket closed')
const session = new FakeSession('connected')
session.sendRequest.mockRejectedValue(error)
await expect(runRpcOperation(session, workspaceListOrThrow, {})).rejects.toBe(error)
})
it('keeps a delivery-unknown mark readable through the descriptor', async () => {
const error = markRpcDeliveryUnknown(new Error('socket closed before response'))
const session = new FakeSession('connected')
session.sendRequest.mockRejectedValue(error)
const caught = await runRpcOperation(session, workspaceListOrThrow, {}).catch(
(thrown: unknown) => thrown
)
expect(caught).toBe(error)
expect(isRpcDeliveryUnknown(caught)).toBe(true)
})
// instanceof misses foreign bundle copies; cutover detection must also accept the exact message.
it('keeps a cutover error from another bundle copy recognisable', async () => {
class ForeignBundleCutoverError extends Error {}
const error = new ForeignBundleCutoverError('RPC interrupted by connection migration')
const session = new FakeSession('connected')
session.sendRequest.mockRejectedValue(error)
const caught = await runRpcOperation(session, workspaceListOrThrow, {}).catch(
(thrown: unknown) => thrown
)
expect(caught).toBe(error)
expect(isLogicalClientCutoverError(caught)).toBe(true)
})
it('only captures a rejection when a caller names the all-settled helper', async () => {
const error = new Error('socket closed')
const session = new FakeSession('connected')
session.sendRequest.mockRejectedValue(error)
await expect(captureRpcOperationSettlement(session, workspaceListOrThrow, {})).resolves.toEqual(
{ status: 'rejected', error }
)
})
})
@@ -69,16 +69,6 @@ function mountNames() {
}
describe('useRetiredWorktreeNames', () => {
it('holds the watermark too when a refresh fails', async () => {
const probe = mountNames()
await probe.settle(0, { 'repo-1': [] }, { 'repo-1': 3 })
probe.rerender({ repoId: 'repo-1', refreshKey: 'b' })
await probe.fail(1)
expect(probe.registry.exhaustedTiers).toBe(3)
})
// Match desktop: refresh failure must not un-retire every name for the rest of the sheet session.
it('keeps previously loaded names when a refresh fails', async () => {
const probe = mountNames()
@@ -1,37 +0,0 @@
import { describe, expect, it } from 'vitest'
import { getLiveWorktreeDisplayName } from './worktree-display-name'
describe('getLiveWorktreeDisplayName', () => {
it('uses the host-list display name for the current worktree', () => {
expect(
getLiveWorktreeDisplayName(
[
{ worktreeId: 'wt-1', displayName: 'Old' },
{ worktreeId: 'wt-2', displayName: 'Auto Generated Name' }
],
'wt-2'
)
).toBe('Auto Generated Name')
})
it('matches worktree.show payloads keyed by id', () => {
expect(getLiveWorktreeDisplayName([{ id: 'wt-1', displayName: 'Settled Name' }], 'wt-1')).toBe(
'Settled Name'
)
})
it('falls back to repo only when the display name is blank', () => {
expect(
getLiveWorktreeDisplayName(
[{ worktreeId: 'wt-1', displayName: ' ', repo: ' orca ' }],
'wt-1'
)
).toBe('orca')
})
it('ignores snapshots that do not contain the current worktree', () => {
expect(getLiveWorktreeDisplayName([{ worktreeId: 'wt-1', displayName: 'Other' }], 'wt-2')).toBe(
null
)
})
})
+2
View File
@@ -226,6 +226,8 @@
"build:packages": "node config/scripts/workspace-package-build/build-workspace-packages.mjs",
"check:process-host-imports": "node config/scripts/static-analysis/process-boundaries/check-process-host-imports.mjs",
"check:main-sync-spawn-ratchet": "node config/scripts/static-analysis/process-boundaries/check-main-sync-spawn-ratchet.mjs",
"check:main-sync-fs-ratchet": "node config/scripts/static-analysis/ratchets/runtime-lifecycle/check-main-sync-fs-ratchet.mjs",
"check:recurring-timer-ratchet": "node config/scripts/static-analysis/ratchets/runtime-lifecycle/check-recurring-timer-ratchet.mjs",
"check:compat-boundary-imports": "node config/scripts/static-analysis/process-boundaries/check-compat-boundary-imports.mjs",
"check:import-boundaries": "bun config/scripts/static-analysis/process-boundaries/check-import-boundaries.mjs"
},
@@ -1,23 +0,0 @@
import { afterEach, describe, expect, it, vi } from 'vitest'
import { formatCliError } from './format'
import { RuntimeRpcFailureError } from './runtime-client'
function conflict(code: string, message: string): RuntimeRpcFailureError {
return new RuntimeRpcFailureError({
id: 'request-1',
ok: false,
error: { code, message: `${message}: ${code}` },
_meta: { runtimeId: 'runtime-1' }
})
}
afterEach(() => vi.restoreAllMocks())
describe('automation owner conflicts read as CLI outcomes', () => {
it('leaves unrelated failures untouched', () => {
const output = formatCliError(conflict('runtime_error', 'Something else'))
expect(output).toBe('Something else: runtime_error')
})
})
+2 -373
View File
@@ -1,17 +1,9 @@
import { existsSync, mkdtempSync, readFileSync, rmSync, utimesSync, writeFileSync } from 'node:fs'
import { rmSync, writeFileSync } from 'node:fs'
import { tmpdir } from 'node:os'
import { join } from 'node:path'
import { afterEach, describe, expect, it, vi } from 'vitest'
import {
formatAutomationShow,
formatComputerAction,
formatTerminalList,
formatWorktreeList,
printResult
} from './format'
import type { ComputerActionResult, RuntimeWorktreeRecord } from '../shared/runtime-types'
import type { Automation } from '../shared/automations/automation-definition'
import { printResult } from './format'
let testScreenshotDir: string | null = null
@@ -24,370 +16,7 @@ afterEach(() => {
}
})
function worktree(overrides: Partial<RuntimeWorktreeRecord> = {}): RuntimeWorktreeRecord {
const base: RuntimeWorktreeRecord = {
id: 'repo::/tmp/repo/child',
repoId: 'repo',
path: '/tmp/repo/child',
head: 'abc123',
branch: 'feature/child',
isBare: false,
isMainWorktree: false,
parentWorktreeId: null,
childWorktreeIds: [],
lineage: null,
linkedIssue: null,
linkedPR: null,
linkedLinearIssue: null,
isArchived: false,
isUnread: false,
isPinned: false,
sortOrder: 0,
lastActivityAt: 0,
git: {
path: '/tmp/repo/child',
head: 'abc123',
branch: 'feature/child',
isBare: false,
isMainWorktree: false
},
displayName: '',
comment: ''
}
return { ...base, ...overrides }
}
describe('formatWorktreeList', () => {
it('includes parent and child workspace relationships in text output', () => {
const output = formatWorktreeList({
worktrees: [
worktree({
id: 'repo::/tmp/repo/parent',
path: '/tmp/repo/parent',
branch: 'feature/parent',
childWorktreeIds: ['repo::/tmp/repo/child']
}),
worktree({
parentWorktreeId: 'repo::/tmp/repo/parent'
})
],
totalCount: 2,
truncated: false
})
const [parent, child] = output.split('\n\n')
expect(parent).toContain('repo::/tmp/repo/parent feature/parent')
expect(parent).toContain('parentWorktreeId: null')
expect(parent).toContain('childWorktreeIds: repo::/tmp/repo/child')
expect(child).toContain('repo::/tmp/repo/child feature/child')
expect(child).toContain('parentWorktreeId: repo::/tmp/repo/parent')
expect(child).toContain('childWorktreeIds: []')
})
})
describe('formatAutomationShow', () => {
function automation(overrides: Partial<Automation> = {}): Automation {
return {
id: 'auto-1',
name: 'Nightly',
prompt: 'Run checks',
precheck: null,
agentId: 'codex',
projectId: 'repo-legacy',
executionTargetType: 'local',
executionTargetId: 'local',
schedulerOwner: 'local_host_service',
workspaceMode: 'new_per_run',
workspaceId: null,
baseBranch: null,
reuseSession: false,
timezone: 'UTC',
rrule: 'FREQ=DAILY;BYHOUR=9;BYMINUTE=0',
dtstart: 0,
enabled: true,
nextRunAt: 0,
missedRunPolicy: 'run_once_within_grace',
missedRunGraceMinutes: 720,
createdAt: 0,
updatedAt: 0,
...overrides
}
}
it('shows explicit run context before the legacy repo id', () => {
const output = formatAutomationShow({
automation: automation({
runContext: {
kind: 'workspace-run',
projectId: 'github:stablyai/orca',
hostId: 'runtime:gpu',
projectHostSetupId: 'setup-gpu',
repoId: 'repo-gpu',
path: '/srv/orca'
}
})
})
expect(output).toContain('runProjectId: github:stablyai/orca')
expect(output).toContain('runHostId: runtime:gpu')
expect(output).toContain('projectHostSetupId: setup-gpu')
expect(output).toContain('runRepoId: repo-gpu')
expect(output).toContain('runPath: /srv/orca')
expect(output).toContain('legacyRepoId: repo-legacy')
expect(output).not.toContain('projectId: repo-legacy')
})
})
describe('formatTerminalList', () => {
it('prints visual split groups and nested terminal panes', () => {
const output = formatTerminalList({
terminals: [
{
handle: 'term_left',
ptyId: 'pty-left',
worktreeId: 'wt-1',
worktreePath: '/repo',
branch: 'main',
tabId: 'tab-left',
leafId: 'leaf-left',
title: 'Left',
connected: true,
writable: true,
lastOutputAt: null,
preview: ''
},
{
handle: 'term_top',
ptyId: 'pty-top',
worktreeId: 'wt-1',
worktreePath: '/repo',
branch: 'main',
tabId: 'tab-right',
leafId: 'leaf-top',
title: 'Right top',
connected: true,
writable: true,
lastOutputAt: null,
preview: ''
},
{
handle: 'term_bottom',
ptyId: 'pty-bottom',
worktreeId: 'wt-1',
worktreePath: '/repo',
branch: 'main',
tabId: 'tab-right',
leafId: 'leaf-bottom',
title: 'Right bottom',
connected: true,
writable: true,
lastOutputAt: null,
preview: ''
}
],
totalCount: 3,
truncated: false,
visualLayouts: [
{
worktreeId: 'wt-1',
worktreePath: '/repo',
root: {
type: 'split',
direction: 'horizontal',
first: {
type: 'group',
groupId: 'group-left',
activeTabId: 'tab-left',
tabs: [
{
tabId: 'tab-left',
title: 'Left',
activeLeafId: 'leaf-left',
panes: {
type: 'terminal',
handle: 'term_left',
tabId: 'tab-left',
leafId: 'leaf-left',
title: 'Left',
connected: true,
active: true
}
}
]
},
second: {
type: 'group',
groupId: 'group-right',
activeTabId: 'tab-right',
tabs: [
{
tabId: 'tab-right',
title: 'Right',
activeLeafId: 'leaf-bottom',
panes: {
type: 'pane-split',
direction: 'vertical',
first: {
type: 'terminal',
handle: 'term_top',
tabId: 'tab-right',
leafId: 'leaf-top',
title: 'Right top',
connected: true,
active: false
},
second: {
type: 'terminal',
handle: 'term_bottom',
tabId: 'tab-right',
leafId: 'leaf-bottom',
title: 'Right bottom',
connected: true,
active: true
}
}
}
]
}
}
}
]
} as never)
expect(output).toContain('visual layout:')
expect(output).toContain('/repo')
expect(output).toContain('split horizontal')
expect(output).toContain('group group-left')
expect(output).toContain('tab tab-left Left')
expect(output).toContain('* term_left Left tab=tab-left leaf=leaf-left')
expect(output).toContain('group group-right')
expect(output).toContain('pane split vertical')
expect(output).toContain(' term_top Right top tab=tab-right leaf=leaf-top')
expect(output).toContain('* term_bottom Right bottom tab=tab-right leaf=leaf-bottom')
})
})
describe('formatComputerAction', () => {
it('preserves explicit window-index targeting in the suggested follow-up command', () => {
const result: ComputerActionResult = {
snapshot: {
id: 'snap-1',
app: { name: 'Finder', bundleId: 'com.apple.finder', pid: 100 },
window: { title: 'Document', id: 42, width: 800, height: 600 },
coordinateSpace: 'window',
treeText: 'tree',
elementCount: 5,
focusedElementId: null
},
screenshot: null,
screenshotStatus: { state: 'skipped', reason: 'no_screenshot_flag' }
}
const output = formatComputerAction('click', result, {
session: 'manual',
windowIndex: 1
})
expect(output).toContain(
'Use `orca computer get-app-state --app com.apple.finder --session manual --window-index 1`'
)
})
it('uses snapshot window index for follow-up commands when the provider has no stable window id', () => {
const result: ComputerActionResult = {
snapshot: {
id: 'snap-1',
app: { name: 'Linux Browser', bundleId: null, pid: 100 },
window: { title: 'Inbox', id: null, index: 2, width: 800, height: 600 },
coordinateSpace: 'window',
treeText: 'tree',
elementCount: 5,
focusedElementId: null
},
screenshot: null,
screenshotStatus: { state: 'skipped', reason: 'no_screenshot_flag' },
action: {
path: 'synthetic',
targetWindowId: null
}
}
const output = formatComputerAction('click', result)
const app = process.platform === 'win32' ? '"Linux Browser"' : "'Linux Browser'"
expect(output).toContain(`Use \`orca computer get-app-state --app ${app} --window-index 2\``)
expect(output).not.toContain('--window-id')
})
it('uses action target window index before snapshot fallback for ID-less providers', () => {
const result: ComputerActionResult = {
snapshot: {
id: 'snap-1',
app: { name: 'Linux Browser', bundleId: null, pid: 100 },
window: { title: 'Inbox', id: null, index: 4, width: 800, height: 600 },
coordinateSpace: 'window',
treeText: 'tree',
elementCount: 5,
focusedElementId: null
},
screenshot: null,
screenshotStatus: { state: 'skipped', reason: 'no_screenshot_flag' },
action: {
path: 'synthetic',
targetWindowId: null,
targetWindowIndex: 2
}
}
const output = formatComputerAction('click', result)
const app = process.platform === 'win32' ? '"Linux Browser"' : "'Linux Browser'"
expect(output).toContain(`Use \`orca computer get-app-state --app ${app} --window-index 2\``)
expect(output).not.toContain('--window-index 4')
expect(output).not.toContain('--window-id')
})
})
describe('printResult computer screenshots', () => {
it('skips screenshot temp cleanup when the cleanup marker is fresh', () => {
testScreenshotDir = mkdtempSync(join(tmpdir(), 'orca-format-test-'))
const expiredPath = join(testScreenshotDir, 'old-screenshot.png')
writeFileSync(expiredPath, 'old')
const expired = new Date(Date.now() - 48 * 60 * 60 * 1000)
utimesSync(expiredPath, expired, expired)
writeFileSync(join(testScreenshotDir, '.last-cleanup'), 'recent\n')
process.env.ORCA_COMPUTER_SCREENSHOT_TMPDIR = testScreenshotDir
const logSpy = vi.spyOn(console, 'log').mockImplementation(() => undefined)
printResult(
{
id: 'req/1',
ok: true,
result: {
screenshot: {
data: Buffer.from('png-data').toString('base64'),
format: 'png',
width: 1,
height: 1,
scale: 1
},
screenshotStatus: { state: 'captured' }
},
_meta: { runtimeId: 'runtime-1' }
},
true,
() => 'unused'
)
expect(existsSync(expiredPath)).toBe(true)
const output: {
result: { screenshot: { dataOmitted: boolean; path: string } }
} = JSON.parse(logSpy.mock.calls[0][0])
expect(output.result.screenshot.dataOmitted).toBe(true)
expect(output.result.screenshot.path).toContain('req_1-screenshot.png')
expect(readFileSync(output.result.screenshot.path, 'utf8')).toBe('png-data')
})
it('keeps inline screenshot data when temp export fails', () => {
testScreenshotDir = join(tmpdir(), `orca-format-blocked-${Date.now()}`)
writeFileSync(testScreenshotDir, 'not-a-directory')
+1 -1
View File
@@ -83,7 +83,7 @@ vi.mock('../runtime-client', () => {
}
})
vi.mock('../../main/agent-hooks/managed-agent-hook-controls', () => ({
vi.mock('../../main/agent-hooks/installation/managed-agent-hook-controls', () => ({
applyAgentStatusHooksEnabled: applyAgentStatusHooksEnabledMock,
getManagedAgentHookStatuses: getManagedAgentHookStatusesMock
}))
+2 -2
View File
@@ -163,7 +163,7 @@ async function setAgentHooksEnabled(
enabled: boolean
): Promise<AgentHookCommandResult> {
const { applyAgentStatusHooksEnabled, getManagedAgentHookStatuses } =
await import('../../main/agent-hooks/managed-agent-hook-controls.js')
await import('../../main/agent-hooks/installation/managed-agent-hook-controls.js')
const updatedRuntime = await updateRunningRuntime(client, enabled)
const offlineUpdate = updatedRuntime ? null : await updateEnabledOnDisk(enabled)
const settingsPath = offlineUpdate?.settingsPath ?? (await getDataPath())
@@ -202,7 +202,7 @@ export const AGENT_HOOK_HANDLERS: Record<string, CommandHandler> = {
'agent hooks status': async ({ json, flags }) => {
rejectRemoteHookSelection(flags)
const { getManagedAgentHookStatuses } =
await import('../../main/agent-hooks/managed-agent-hook-controls.js')
await import('../../main/agent-hooks/installation/managed-agent-hook-controls.js')
const result: AgentHookCommandResult = {
enabled: (await readHookSettingsFromDisk()).agentStatusHooksEnabled,
settingsPath: await getDataPath(),
@@ -1,31 +0,0 @@
import { afterEach, expect, it, vi } from 'vitest'
import { formatCliError, reportCliError } from './format'
import { RuntimeRpcFailureError, type RuntimeRpcFailure } from './runtime/types'
afterEach(() => {
vi.restoreAllMocks()
})
// Runtime envelopes may contain codes introduced after this client; formatting must preserve them.
it('prints an unknown code with its message and nextSteps unchanged', () => {
const failure: RuntimeRpcFailure = {
id: 'rpc_1',
ok: false,
error: {
code: 'code_from_a_newer_host',
message: 'Refused for a reason this CLI has never heard of.',
data: { nextSteps: ['Do the thing the newer host suggested.'] }
},
_meta: { runtimeId: 'runtime_1' }
}
const error = new RuntimeRpcFailureError(failure)
expect(formatCliError(error, { commandPath: ['orchestration', 'dispatch'] })).toBe(
'Refused for a reason this CLI has never heard of.\nNext step: Do the thing the newer host suggested.'
)
const log = vi.spyOn(console, 'log').mockImplementation(() => {})
reportCliError(error, true, { commandPath: ['orchestration', 'dispatch'] })
expect(JSON.parse(log.mock.calls[0]?.[0] as string)).toEqual(failure)
})
+1 -1
View File
@@ -37,7 +37,7 @@ vi.mock(
)
// Stub hook writes: this suite runs real handlers that would otherwise edit the developer's agent configs.
vi.mock('../main/agent-hooks/managed-agent-hook-controls', () => ({
vi.mock('../main/agent-hooks/installation/managed-agent-hook-controls', () => ({
applyAgentStatusHooksEnabled: applyAgentStatusHooksEnabledMock,
getManagedAgentHookStatuses: vi.fn(() => [])
}))
@@ -26,7 +26,7 @@ vi.mock('@orca/process-host', async (original) => ({
}))
// Exercise the existing hook installer on one isolated target; do not discover installed agents.
vi.mock('../../main/agent-hooks/managed-agent-hook-controls', async () => {
vi.mock('../../main/agent-hooks/installation/managed-agent-hook-controls', async () => {
const { claudeHookService } = await import('../../main/claude/hook-service.js')
return {
applyAgentStatusHooksEnabled: vi.fn(async (enabled: boolean) => [
@@ -1,5 +1,5 @@
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
import { _internals } from '../../../agent-hooks/server'
import { _internals } from '../../../agent-hooks/server/agent-hook-server'
import {
closeProviderTimelineRigs,
SESSION as ADAPTER_SESSION
@@ -1,5 +1,5 @@
import { afterEach, beforeEach, describe, expect, it } from 'vitest'
import { _internals } from '../../../agent-hooks/server'
import { _internals } from '../../../agent-hooks/server/agent-hook-server'
import { closeProviderTimelineRigs } from '../../../native-chat/agent-session-timeline/provider-timeline-assembler-test-support'
import { CALLER } from '../../../native-chat/agent-session-wire/host/testing/structured-agent-session-host-test-harness'
import { HOST_TEST_SESSION as SESSION } from '../../../native-chat/agent-session-wire/host/testing/structured-agent-session-host-test-data'
@@ -1,4 +1,4 @@
import { AgentHookServer } from '../../../agent-hooks/server'
import { AgentHookServer } from '../../../agent-hooks/server/agent-hook-server'
import type { AgentChildWorkEvidence } from '../../../../shared/agent-status/child-work/agent-status-child-work-evidence'
import {
makeStructuredAgentStatusSubject,
+5 -5
View File
@@ -3,10 +3,10 @@
Orca learns what each agent is doing through two channels. Both write into the hook server's
status store.
| Channel | How | What it carries |
| ---------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- |
| **Managed integrations** (this folder) | Per-agent hooks, plugins and extensions that POST to the loopback hook server. Installers are listed in `managed-agent-hook-registry.ts`; each agent's code lives in `src/main/<agent>/`. | State, prompt, tool name and input, assistant reply, provider session id (resume and native chat), model, subagents |
| **OSC 7501** (Program Status Protocol, [spec](https://www.superlogical.com/rex/docs/build/program-status)) | The agent writes its own status into the terminal stream. Orca reads it from PTY output and answers the protocol's `?` probe. | State, blocked `kind`, one free-text line (`msg`), child records |
| Channel | How | What it carries |
| ---------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------- |
| **Managed integrations** (this folder) | Per-agent hooks, plugins and extensions that POST to the loopback hook server. Installers are listed in `installation/managed-agent-hook-registry.ts`; each agent's code lives in `src/main/<agent>/`. | State, prompt, tool name and input, assistant reply, provider session id (resume and native chat), model, subagents |
| **OSC 7501** (Program Status Protocol, [spec](https://www.superlogical.com/rex/docs/build/program-status)) | The agent writes its own status into the terminal stream. Orca reads it from PTY output and answers the protocol's `?` probe. | State, blocked `kind`, one free-text line (`msg`), child records |
**Precedence:** hooks win, and OSC 7501 fills in wherever they don't speak. That covers:
@@ -90,7 +90,7 @@ When an agent ships OSC 7501 support, or changes what it reports:
## Plugin tool hooks (`agent.tool.before` / `.after`)
The hook server runs plugins' `agent.tool.before` and `.after` on each tool event it receives, after
it records status (`agent-tool-plugin-hooks.ts`). Only Claude Code's POSIX script waits for the
it records status (`tool-events/agent-tool-plugin-hooks.ts`). Only Claude Code's POSIX script waits for the
answer: it sends `X-Orca-Hook-Decision: claude-pre-tool-use-v1` on PreToolUse, waits at most 8 s
(Orca answers within 6 s), and prints Orca's `hookSpecificOutput` (a `deny`, or `updatedInput`
without an approval) or `{}`. A timeout, an error or Orca being down prints `{}`, so the call
@@ -1,7 +1,7 @@
import {
formatAgentGenerationFailureOutputForDisplay,
type AgentGenerationFailureOutput
} from '../text-generation/agent-failure-output'
} from '../../text-generation/agent-failure-output'
// Keep full CLI diagnostics local and ephemeral; persist only the sanitized failure badge.
const MAX_ENTRIES = 32
@@ -2,13 +2,13 @@ import { mkdtempSync, rmSync } from 'node:fs'
import { tmpdir } from 'node:os'
import { join } from 'node:path'
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
import type { Repo } from '../../shared/repo-types'
import { wslMoveCutoverFixture as cutover } from '../persistence/__fixtures__/wsl-mover/wsl-move-cutover-fixture'
import { seedWslMoveCutover } from '../persistence/__fixtures__/wsl-mover/wsl-move-journal-seeding'
import type { Repo } from '../../../shared/repo-types'
import { wslMoveCutoverFixture as cutover } from '../../persistence/__fixtures__/wsl-mover/wsl-move-cutover-fixture'
import { seedWslMoveCutover } from '../../persistence/__fixtures__/wsl-mover/wsl-move-journal-seeding'
import {
loadWslMoveFence,
resetWslMoveFenceForTests
} from '../persistence/moving-wsl-projects/wsl-move-scope-guard'
} from '../../persistence/moving-wsl-projects/wsl-move-scope-guard'
const { gitExecFileAsyncMock, generateBranchNameMock, resolveTextGenerationParamsMock } =
vi.hoisted(() => ({
@@ -17,19 +17,19 @@ const { gitExecFileAsyncMock, generateBranchNameMock, resolveTextGenerationParam
resolveTextGenerationParamsMock: vi.fn()
}))
vi.mock('../git/command-runner/git-exec-file', async (importOriginal) => ({
vi.mock('../../git/command-runner/git-exec-file', async (importOriginal) => ({
...(await importOriginal<Record<string, unknown>>()),
gitExecFileAsync: gitExecFileAsyncMock
}))
vi.mock('../git/git-username', () => ({ resolveLocalGitUsername: vi.fn(async () => 'you') }))
vi.mock('../text-generation/commit-message-text-generation', () => ({
vi.mock('../../git/git-username', () => ({ resolveLocalGitUsername: vi.fn(async () => 'you') }))
vi.mock('../../text-generation/commit-message-text-generation', () => ({
generateBranchNameFromContext: generateBranchNameMock,
resolveTextGenerationParams: resolveTextGenerationParamsMock
}))
vi.mock('../text-generation/commit-message-agent-environment', () => ({
vi.mock('../../text-generation/commit-message-agent-environment', () => ({
prepareLocalCommitMessageAgentEnv: vi.fn(async () => ({ ok: true }))
}))
vi.mock('../ipc/worktree-branch-name', () => ({
vi.mock('../../ipc/worktree-branch-name', () => ({
computeBranchName: vi.fn((leaf: string) => `you/${leaf}`),
getConfiguredBranchPrefix: vi.fn(() => 'you')
}))
@@ -45,7 +45,7 @@ import {
gitResponder,
makeBranchRenameDeps,
workingEvent
} from './first-work-branch-rename-test-harness'
} from './testing/first-work-branch-rename-test-harness'
const LOCAL_REPO: Repo = {
id: REPO_ID,
@@ -1,11 +1,11 @@
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
import type { Repo } from '../../shared/repo-types'
import type * as CommitMessageTextGenerationModule from '../text-generation/commit-message-text-generation'
import type { AgentJournalRenderItem } from '../../shared/agent-session/journal/agent-session-journal-types'
import type { AgentSessionJournal } from '../native-chat/agent-session-journal/journal-store'
import { StructuredAgentSessionStatusFeed } from '../native-chat/agent-session-wire/observations/structured-agent-session-status-feed'
import type { Repo } from '../../../shared/repo-types'
import type * as CommitMessageTextGenerationModule from '../../text-generation/commit-message-text-generation'
import type { AgentJournalRenderItem } from '../../../shared/agent-session/journal/agent-session-journal-types'
import type { AgentSessionJournal } from '../../native-chat/agent-session-journal/journal-store'
import { StructuredAgentSessionStatusFeed } from '../../native-chat/agent-session-wire/observations/structured-agent-session-status-feed'
import { maybeAutoRenameWorkspaceOnFirstStructuredTurn } from './first-work-structured-session-rename'
import '../../shared/worktree/id'
import '../../../shared/worktree/id'
const {
gitExecFileAsyncMock,
@@ -25,22 +25,22 @@ const {
getConfiguredBranchPrefixMock: vi.fn((_settings: unknown, username: string | null) => username)
}))
vi.mock('../git/command-runner/git-exec-file', async (importOriginal) => ({
vi.mock('../../git/command-runner/git-exec-file', async (importOriginal) => ({
...(await importOriginal<Record<string, unknown>>()),
gitExecFileAsync: gitExecFileAsyncMock
}))
vi.mock('../git/git-username', () => ({ resolveLocalGitUsername: resolveLocalGitUsernameMock }))
vi.mock('../text-generation/commit-message-text-generation', () => ({
vi.mock('../../git/git-username', () => ({ resolveLocalGitUsername: resolveLocalGitUsernameMock }))
vi.mock('../../text-generation/commit-message-text-generation', () => ({
generateBranchNameFromContext: generateBranchNameMock,
resolveTextGenerationParams: resolveTextGenerationParamsMock
}))
await vi.importActual<typeof CommitMessageTextGenerationModule>(
'../text-generation/commit-message-text-generation'
'../../text-generation/commit-message-text-generation'
)
vi.mock('../text-generation/commit-message-agent-environment', () => ({
vi.mock('../../text-generation/commit-message-agent-environment', () => ({
prepareLocalCommitMessageAgentEnv: prepareLocalEnvMock
}))
vi.mock('../ipc/worktree-branch-name', () => ({
vi.mock('../../ipc/worktree-branch-name', () => ({
computeBranchName: computeBranchNameMock,
getConfiguredBranchPrefix: getConfiguredBranchPrefixMock
}))
@@ -57,9 +57,9 @@ import {
makeBranchRenameDeps,
noUpstreamError,
workingEvent
} from './first-work-branch-rename-test-harness'
} from './testing/first-work-branch-rename-test-harness'
import { FIRST_WORK_GENERATION_RETRY_DELAYS_MS } from './first-work-generation-backoff'
import { createStructuredAgentSessionLogger } from '../native-chat/agent-session-wire/host/structured-agent-session-logger'
import { createStructuredAgentSessionLogger } from '../../native-chat/agent-session-wire/host/structured-agent-session-logger'
const REMOTE_REPO_BASE: Repo = {
id: REPO_ID,
@@ -1,36 +1,36 @@
import type { GlobalSettings } from '../../shared/global-settings-types'
import type { Repo } from '../../shared/repo-types'
import { isFolderRepo } from '../../shared/repo-kind'
import { getRepoIdFromWorktreeId, splitWorktreeIdForFilesystem } from '../../shared/worktree/id'
import { parseWorkspaceKey } from '../../shared/workspace-scope'
import { parsePaneKey } from '../../shared/workspace-layout/stable-pane-id'
import type { GlobalSettings } from '../../../shared/global-settings-types'
import type { Repo } from '../../../shared/repo-types'
import { isFolderRepo } from '../../../shared/repo-kind'
import { getRepoIdFromWorktreeId, splitWorktreeIdForFilesystem } from '../../../shared/worktree/id'
import { parseWorkspaceKey } from '../../../shared/workspace-scope'
import { parsePaneKey } from '../../../shared/workspace-layout/stable-pane-id'
import {
humanizeBranchSlug,
isAutoGeneratedCreatureBranchName,
stripConfiguredBranchPrefix
} from '../../shared/source-control/ai/naming/branch-name-from-work'
import { getCommitMessageModelDiscoveryHostKey } from '../../shared/source-control/ai/generation/commit-message-host-key'
import { computeBranchName, getConfiguredBranchPrefix } from '../ipc/worktree-branch-name'
import { gitExecFileAsync } from '../git/runner'
import { resolveLocalGitUsername } from '../git/git-username'
import { resolveGitRouteForHost } from '../providers/execution-host-provider-dispatch'
import { getRepoExecutionHostId } from '../../shared/execution-host'
import { withCheckoutLock } from '../git/branch-switch'
} from '../../../shared/source-control/ai/naming/branch-name-from-work'
import { getCommitMessageModelDiscoveryHostKey } from '../../../shared/source-control/ai/generation/commit-message-host-key'
import { computeBranchName, getConfiguredBranchPrefix } from '../../ipc/worktree-branch-name'
import { gitExecFileAsync } from '../../git/command-runner/git-exec-file'
import { resolveLocalGitUsername } from '../../git/git-username'
import { resolveGitRouteForHost } from '../../providers/execution-host-provider-dispatch'
import { getRepoExecutionHostId } from '../../../shared/execution-host'
import { withCheckoutLock } from '../../git/branch-switch'
import {
probeBranchUpstream,
renameCurrentBranch,
resolveUniqueBranchName,
type GitExec
} from '../git/branch-rename'
} from '../../git/branch-rename'
import {
generateBranchNameFromContext,
resolveTextGenerationParams
} from '../text-generation/commit-message-text-generation'
import type { CommitMessageAgentEnvironmentResolvers } from '../text-generation/commit-message-agent-environment'
import type { AgentGenerationFailureOutput } from '../text-generation/agent-failure-output'
} from '../../text-generation/commit-message-text-generation'
import type { CommitMessageAgentEnvironmentResolvers } from '../../text-generation/commit-message-agent-environment'
import type { AgentGenerationFailureOutput } from '../../text-generation/agent-failure-output'
import { resolveGenerationTarget } from './first-work-generation-target'
import { runFolderWorkspaceTitleAutoRename } from './first-work-workspace-title-rename'
import { isWslMoveRepoBlocked } from '../persistence/moving-wsl-projects/wsl-move-background-backoff'
import { isWslMoveRepoBlocked } from '../../persistence/moving-wsl-projects/wsl-move-background-backoff'
import {
clearFirstWorkGenerationFailures,
isFirstWorkGenerationBackingOff,
@@ -1,13 +1,13 @@
import type { Repo } from '../../shared/repo-types'
import type { Repo } from '../../../shared/repo-types'
import {
FOLDER_WORKSPACE_INSTANCE_SEPARATOR,
getRepoIdFromWorktreeId,
splitWorktreeIdForFilesystem
} from '../../shared/worktree/id'
import { getRepoExecutionHostId, LOCAL_EXECUTION_HOST_ID } from '../../shared/execution-host'
import { planWorktreeFolderRename } from '../ipc/worktree-folder-rename-target'
import { hostWorktreeTargetForRepo } from '../persistence/host-qualified-worktree-meta'
import type { HostWorktreeTarget } from '../../shared/worktree/host-qualified-identity'
} from '../../../shared/worktree/id'
import { getRepoExecutionHostId, LOCAL_EXECUTION_HOST_ID } from '../../../shared/execution-host'
import { planWorktreeFolderRename } from '../../ipc/worktree-folder-rename-target'
import { hostWorktreeTargetForRepo } from '../../persistence/host-qualified-worktree-meta'
import type { HostWorktreeTarget } from '../../../shared/worktree/host-qualified-identity'
export type FirstWorkFolderRenameDeps = {
getRepo: (repoId: string) => Repo | undefined
@@ -1,4 +1,4 @@
import type { AgentGenerationFailureOutput } from '../text-generation/agent-failure-output'
import type { AgentGenerationFailureOutput } from '../../text-generation/agent-failure-output'
// Usage-limit failures spawned hundreds of sessions on repeated working events (#9705); back off until recovery.
export const FIRST_WORK_GENERATION_RETRY_DELAYS_MS: readonly number[] = [30_000, 120_000, 1_800_000]
@@ -1,8 +1,8 @@
import type { CommitMessageGenerationTarget } from '../text-generation/commit-message-text-generation'
import type { CommitMessageGenerationTarget } from '../../text-generation/commit-message-text-generation'
import {
prepareLocalCommitMessageAgentEnv,
type CommitMessageAgentEnvironmentResolvers
} from '../text-generation/commit-message-agent-environment'
} from '../../text-generation/commit-message-agent-environment'
export async function resolveGenerationTarget(
worktreePath: string,
@@ -1,16 +1,16 @@
import { existsSync } from 'node:fs'
import { parseWorkspaceKey } from '../../shared/workspace-scope'
import { LOCAL_EXECUTION_HOST_ID } from '../../shared/execution-host'
import { getRepoIdFromWorktreeId } from '../../shared/worktree/id'
import { parseWorkspaceKey } from '../../../shared/workspace-scope'
import { LOCAL_EXECUTION_HOST_ID } from '../../../shared/execution-host'
import { getRepoIdFromWorktreeId } from '../../../shared/worktree/id'
import type { FirstWorkBranchRenameDeps } from './first-work-branch-rename'
import { rememberBranchRenameFailureOutput } from './branch-rename-failure-output'
import { renameWorktreeFolderOnFirstWork } from './first-work-folder-rename'
import { moveWorktree } from '../git/worktrees/movement/worktree-move'
import { isWslMoveFolderWorkspaceBlocked } from '../persistence/moving-wsl-projects/wsl-move-background-backoff'
import type { Store } from '../persistence/loading-store/store'
import type { RuntimeStore } from '../runtime/construction/runtime-store-contract'
import type { OrcaRuntimeService } from '../runtime/orca-runtime'
import { resolveWorktreeMetaOwner } from '../persistence/host-qualified-worktree-meta'
import { moveWorktree } from '../../git/worktrees/movement/worktree-move'
import { isWslMoveFolderWorkspaceBlocked } from '../../persistence/moving-wsl-projects/wsl-move-background-backoff'
import type { Store } from '../../persistence/loading-store/store'
import type { RuntimeStore } from '../../runtime/construction/runtime-store-contract'
import type { OrcaRuntimeService } from '../../runtime/orca-runtime'
import { resolveWorktreeMetaOwner } from '../../persistence/host-qualified-worktree-meta'
const ENABLE_FIRST_WORK_FOLDER_RENAME = false
@@ -1,4 +1,4 @@
import type { AgentSessionStatusSummary } from '../../shared/agent-session/agent-session-wire'
import type { AgentSessionStatusSummary } from '../../../shared/agent-session/agent-session-wire'
import {
maybeAutoRenameBranchOnFirstWork,
type FirstWorkBranchRenameDeps
@@ -1,8 +1,8 @@
import { humanizeBranchSlug } from '../../shared/source-control/ai/naming/branch-name-from-work'
import { humanizeBranchSlug } from '../../../shared/source-control/ai/naming/branch-name-from-work'
import {
generateBranchNameFromContext,
resolveTextGenerationParams
} from '../text-generation/commit-message-text-generation'
} from '../../text-generation/commit-message-text-generation'
import { resolveGenerationTarget } from './first-work-generation-target'
import type { FirstWorkBranchRenameDeps } from './first-work-branch-rename'
import { retryFailedGeneration } from './first-work-generation-backoff'
@@ -1,12 +1,12 @@
import type { vi } from 'vitest'
import type { GlobalSettings } from '../../shared/global-settings-types'
import type { Repo } from '../../shared/repo-types'
import '../../shared/worktree/id'
import { WORKTREE_ID_SEPARATOR } from '../../shared/terminal/pty/lifecycle/pty-session-id-format'
import type { GlobalSettings } from '../../../../shared/global-settings-types'
import type { Repo } from '../../../../shared/repo-types'
import '../../../../shared/worktree/id'
import { WORKTREE_ID_SEPARATOR } from '../../../../shared/terminal/pty/lifecycle/pty-session-id-format'
import type {
FirstWorkBranchRenameDeps,
FirstWorkBranchRenameEvent
} from './first-work-branch-rename'
} from '../first-work-branch-rename'
export const REPO_ID = 'repo1'
export const WORKTREE_ID = `${REPO_ID}${WORKTREE_ID_SEPARATOR}/repo/wt`
@@ -0,0 +1,119 @@
import {
getWindowsNativeHookAgent,
WINDOWS_NATIVE_HOOK_EXECUTABLE_NAME
} from './windows-native-hook-executable'
import type { HookCommandConfig, HookDefinition } from '../configuration/hook-config-schema'
// Match script names so reinstalls sweep entries from old and parallel installations.
export function createManagedCommandMatcher(
scriptFileName: string
): (command: string | undefined) => boolean {
const scriptStem = scriptFileName.replace(/\.(?:cmd|ps1|sh)$/, '')
// Sweep every platform suffix after a platform switch.
const needles = [
`agent-hooks/${scriptFileName}`,
`agent-hooks/${scriptStem}.cmd`,
`agent-hooks/${scriptStem}.ps1`,
`agent-hooks/${scriptStem}.sh`
]
// The native executable selects its provider through argv[1].
const nativeHook = `agent-hooks/${WINDOWS_NATIVE_HOOK_EXECUTABLE_NAME} ${getWindowsNativeHookAgent(scriptFileName)} `
return (command) => {
if (!command) {
return false
}
const decodedCommand = decodePowerShellEncodedCommand(command)
const searchText = decodedCommand ? `${command}\n${decodedCommand}` : command
const normalizedCommand = searchText.replaceAll('\\', '/')
return (
needles.some((needle) => normalizedCommand.includes(needle)) ||
normalizedCommand.split('\n').some((line) => `${line} `.includes(nativeHook))
)
}
}
function decodePowerShellEncodedCommand(command: string): string | null {
const match = command.match(/\s-EncodedCommand\s+(\S+)/i)
if (!match) {
return null
}
try {
return Buffer.from(match[1], 'base64').toString('utf16le')
} catch {
return null
}
}
export function removeManagedCommands(
definitions: HookDefinition[],
isManagedCommand: (command: string | undefined) => boolean
): HookDefinition[] {
return definitions.flatMap((definition) => {
const directCommandKeys = ['command', 'bash', 'powershell'] as const
const directManagedKeys = directCommandKeys.filter((key) => isManagedCommand(definition[key]))
const hasNestedHooks = Array.isArray(definition.hooks)
const hasManagedNestedHook =
hasNestedHooks &&
definition.hooks!.some((hook) => hookHasManagedCommand(hook, isManagedCommand))
if (directManagedKeys.length === 0 && !hasManagedNestedHook) {
return [definition]
}
const nextDefinition: HookDefinition = { ...definition }
for (const key of directManagedKeys) {
delete nextDefinition[key]
}
if (hasManagedNestedHook) {
const filteredHooks = definition.hooks!.filter(
(hook) => !hookHasManagedCommand(hook, isManagedCommand)
)
if (filteredHooks.length > 0) {
nextDefinition.hooks = filteredHooks
} else {
delete nextDefinition.hooks
}
}
const hasCommandAfterCleanup =
directCommandKeys.some((key) => typeof nextDefinition[key] === 'string') ||
(Array.isArray(nextDefinition.hooks) && nextDefinition.hooks.length > 0)
if (!hasCommandAfterCleanup) {
return []
}
return [nextDefinition]
})
}
function hookHasManagedCommand(hook: HookCommandConfig, matches: (value?: string) => boolean) {
const args = Array.isArray(hook.args) ? hook.args : []
return matches(hook.command) || args.some((arg) => typeof arg === 'string' && matches(arg))
}
// Users may opt a managed hook into async; keep that choice when the hook is rewritten.
export function withPreviousManagedAsync(
hook: HookCommandConfig,
definitions: HookDefinition[],
matches: (command: string | undefined) => boolean
): HookCommandConfig {
const async = definitions
.flatMap((definition) => (Array.isArray(definition.hooks) ? definition.hooks : []))
.find((prev) => typeof prev.async === 'boolean' && hookHasManagedCommand(prev, matches))?.async
return async === undefined ? hook : { ...hook, async }
}
export function hookDefinitionHasManagedCommand(
definition: HookDefinition,
isManagedCommand: (command: string | undefined) => boolean
): boolean {
return (
isManagedCommand(definition.command) ||
isManagedCommand(definition.bash) ||
isManagedCommand(definition.powershell) ||
(Array.isArray(definition.hooks) &&
definition.hooks.some((hook) => hookHasManagedCommand(hook, isManagedCommand)))
)
}
@@ -1,5 +1,5 @@
import { quotePosixShell } from '../../shared/shell/launch/shell-argument-quoting'
import { POSIX_HOOK_STDIN_DRAIN_COMMAND } from './hook-stdin-contract'
import { quotePosixShell } from '../../../../shared/shell/launch/shell-argument-quoting'
import { POSIX_HOOK_STDIN_DRAIN_COMMAND } from '../scripts/hook-stdin-contract'
// Missing scripts must become silent no-ops rather than fail every tool call.
export function wrapPosixHookCommand(
@@ -1,9 +1,9 @@
import { HOOK_PARENT_CAPTURE } from './hook-process-capture'
import { HOOK_PARENT_CAPTURE } from '../scripts/hook-process-capture'
import {
POSIX_HOOK_STDIN_DRAIN_COMMAND,
WINDOWS_GIT_BASH_HOOK_ENVIRONMENT_GUARD,
WINDOWS_POWERSHELL_HOOK_ENVIRONMENT_GUARD
} from './hook-stdin-contract'
} from '../scripts/hook-stdin-contract'
import {
encodeWindowsPowerShellHookCommand,
WINDOWS_POWERSHELL_HOOK_SWITCHES
@@ -1,7 +1,7 @@
import { runProcessSync } from '@orca/process-host'
import { join, resolve } from 'node:path'
const REPO_ROOT = resolve(import.meta.dirname, '../../..')
const REPO_ROOT = resolve(import.meta.dirname, '../../../../../..')
const BUILD_OUTPUT = join(
REPO_ROOT,
'native',
@@ -1,6 +1,6 @@
import { runProcess } from '@orca/process-host'
import { expect } from 'vitest'
import { wrapWindowsHookCommand } from './installer-utils'
import { wrapWindowsHookCommand } from '../windows-hook-command'
// A fresh runner's first encoded-PowerShell launch took 5-40s; per-hook bounds detect stdin hangs, not cold start.
export const WINDOWS_POWERSHELL_WARM_UP_TIMEOUT_MS = 90_000
@@ -0,0 +1,42 @@
import type { AgentHookSource } from '../../../../shared/agent-hook-listener/transport/agent-hook-relay'
/** Extra form lines precede payload@- and must end with ` ^`. */
export function buildWindowsAgentHookPostCommand(
source: AgentHookSource,
extraFormLines: readonly string[] = []
): string {
// Avoid PowerShell startup; qualify curl to prevent repo-local payload interception.
return [
`"%SystemRoot%\\System32\\curl.exe" -sS -X POST "http://127.0.0.1:%ORCA_AGENT_HOOK_PORT%/hook/${source}" ^`,
' --connect-timeout 0.5 --max-time 1.5 ^',
' -H "Content-Type: application/x-www-form-urlencoded" ^',
' -H "X-Orca-Agent-Hook-Token: %ORCA_AGENT_HOOK_TOKEN%" ^',
' --data-urlencode "paneKey=%ORCA_PANE_KEY%" ^',
' --data-urlencode "tabId=%ORCA_TAB_ID%" ^',
' --data-urlencode "launchToken=%ORCA_AGENT_LAUNCH_TOKEN%" ^',
' --data-urlencode "worktreeId=%ORCA_WORKTREE_ID%" ^',
' --data-urlencode "env=%ORCA_AGENT_HOOK_ENV%" ^',
' --data-urlencode "version=%ORCA_AGENT_HOOK_VERSION%" ^',
...extraFormLines,
' --data-urlencode "payload@-" >nul 2>nul'
].join('\r\n')
}
// curl.exe avoids PowerShell startup and code-page corruption of UTF-8 payloads.
export function buildWindowsAgentHookCurlPostCommand(source: AgentHookSource): string {
return [
'"%SystemRoot%\\System32\\curl.exe" -sS -X POST',
`"http://127.0.0.1:%ORCA_AGENT_HOOK_PORT%/hook/${source}"`,
'--connect-timeout 0.5 --max-time 1.5',
'-H "Content-Type: application/x-www-form-urlencoded"',
'-H "X-Orca-Agent-Hook-Token: %ORCA_AGENT_HOOK_TOKEN%"',
'--data-urlencode "paneKey=%ORCA_PANE_KEY%"',
'--data-urlencode "tabId=%ORCA_TAB_ID%"',
'--data-urlencode "launchToken=%ORCA_AGENT_LAUNCH_TOKEN%"',
'--data-urlencode "worktreeId=%ORCA_WORKTREE_ID%"',
'--data-urlencode "env=%ORCA_AGENT_HOOK_ENV%"',
'--data-urlencode "version=%ORCA_AGENT_HOOK_VERSION%"',
'--data-urlencode "payload@-"',
'>nul 2>&1'
].join(' ')
}
@@ -3,10 +3,10 @@ import { mkdtempSync, writeFileSync } from 'node:fs'
import { tmpdir } from 'node:os'
import { join } from 'node:path'
import { runProcess } from '@orca/process-host'
import { removeTree } from '../../shared/windows-transient-lock-removal'
import '../claude/hook-settings'
import { removeTree } from '../../../../shared/windows-transient-lock-removal'
import '../../../claude/hook-settings'
import { wrapWindowsBatchHookCommand } from './windows-direct-cmd-hook-command'
import './windows-git-bash-path.test-fixture'
import './testing/windows-git-bash-path.test-fixture'
import { getWindowsPowerShellExecutablePath } from './windows-powershell-hook-launcher'
describe.skipIf(process.platform !== 'win32')('guarded Windows batch hook commands', () => {
@@ -5,22 +5,18 @@ import { tmpdir } from 'node:os'
import { join } from 'node:path'
import type * as osModule from 'node:os'
import { runProcess } from '@orca/process-host'
import { removeTree } from '../../shared/windows-transient-lock-removal'
import {
isPlainObject,
readHooksJson,
WINDOWS_CMD_SAFE_PATH,
wrapWindowsHookCommand,
writeHooksJson
} from './installer-utils'
import { removeTree } from '../../../../shared/windows-transient-lock-removal'
import { isPlainObject, readHooksJson } from '../configuration/hooks-json-read'
import { WINDOWS_CMD_SAFE_PATH, wrapWindowsHookCommand } from './windows-hook-command'
import { writeHooksJson } from '../configuration/hooks-json-write'
import {
wrapWindowsBatchHookCommand,
wrapWindowsDirectCmdHookCommand
} from './windows-direct-cmd-hook-command'
import { AntigravityHookService } from '../antigravity/hook-service'
import { ANTIGRAVITY_EVENTS } from '../antigravity/hook-events'
import { AntigravityHookService } from '../../../antigravity/hook-service'
import { ANTIGRAVITY_EVENTS } from '../../../antigravity/hook-events'
import { getWindowsPowerShellExecutablePath } from './windows-powershell-hook-launcher'
import { findGitBash } from './windows-git-bash-path.test-fixture'
import { findGitBash } from './testing/windows-git-bash-path.test-fixture'
const { homedirMock } = vi.hoisted(() => ({ homedirMock: vi.fn<() => string>() }))
vi.mock('electron', () => ({ app: { getPath: () => process.cwd() } }))
@@ -1,5 +1,5 @@
import { quotePowerShellLiteral } from '../../shared/powershell-native-argument'
import { WINDOWS_POWERSHELL_HOOK_ENVIRONMENT_GUARD } from './hook-stdin-contract'
import { quotePowerShellLiteral } from '../../../../shared/powershell-native-argument'
import { WINDOWS_POWERSHELL_HOOK_ENVIRONMENT_GUARD } from '../scripts/hook-stdin-contract'
import {
wrapWindowsPowerShellEncodedCommand,
type WindowsPowerShellHookOptions
@@ -3,7 +3,7 @@ import { afterEach, beforeAll, describe, expect, it, vi } from 'vitest'
import { runProcess } from '@orca/process-host'
import { createServer, type Server } from 'node:http'
import { lstatSync, mkdirSync, mkdtempSync, readFileSync, writeFileSync } from 'node:fs'
import { removeTreeSync } from '../../shared/windows-transient-lock-removal'
import { removeTreeSync } from '../../../../shared/windows-transient-lock-removal'
import { tmpdir } from 'node:os'
import { basename, dirname, join } from 'node:path'
import type * as osModule from 'node:os'
@@ -34,30 +34,31 @@ vi.mock('os', async (importOriginal) => {
}
})
import { ClaudeHookService } from '../claude/hook-service'
import { CommandCodeHookService } from '../command-code/hook-service'
import { CopilotHookService } from '../copilot/hook-service'
import { DroidHookService } from '../droid/hook-service'
import { DevinHookService } from '../devin/hook-service'
import { DshHookService } from '../dsh/hook-service'
import { GeminiHookService } from '../gemini/hook-service'
import { GrokHookService } from '../grok/hook-service'
import { KimiHookService } from '../kimi/hook-service'
import { KiroHookService } from '../kiro/hook-service'
import { MuseHookService } from '../muse/hook-service'
import { getMuseManagedHooksPath } from '../muse/hook-settings'
import { zcodeHookService } from '../zcode/hook-service'
import { readHooksJson, WINDOWS_CMD_SAFE_PATH, wrapWindowsHookCommand } from './installer-utils'
import { getConfigPath } from '../claude/hook-settings'
import { findGitBash } from './windows-git-bash-path.test-fixture'
import { ClaudeHookService } from '../../../claude/hook-service'
import { CommandCodeHookService } from '../../../command-code/hook-service'
import { CopilotHookService } from '../../../copilot/hook-service'
import { DroidHookService } from '../../../droid/hook-service'
import { DevinHookService } from '../../../devin/hook-service'
import { DshHookService } from '../../../dsh/hook-service'
import { GeminiHookService } from '../../../gemini/hook-service'
import { GrokHookService } from '../../../grok/hook-service'
import { KimiHookService } from '../../../kimi/hook-service'
import { KiroHookService } from '../../../kiro/hook-service'
import { MuseHookService } from '../../../muse/hook-service'
import { getMuseManagedHooksPath } from '../../../muse/hook-settings'
import { zcodeHookService } from '../../../zcode/hook-service'
import { readHooksJson } from '../configuration/hooks-json-read'
import { WINDOWS_CMD_SAFE_PATH, wrapWindowsHookCommand } from './windows-hook-command'
import { getConfigPath } from '../../../claude/hook-settings'
import { findGitBash } from './testing/windows-git-bash-path.test-fixture'
import {
buildWindowsNativeHookExecutable,
WINDOWS_NATIVE_HOOK_BUILD_TIMEOUT_MS
} from './windows-native-hook-exe.test-fixture'
} from './testing/windows-native-hook-exe.test-fixture'
import {
WINDOWS_POWERSHELL_WARM_UP_TIMEOUT_MS,
warmWindowsEncodedPowerShell
} from './windows-powershell-warm-up.test-fixture'
} from './testing/windows-powershell-warm-up.test-fixture'
const PANE_KEY = 'tab-1:leaf-1'
const HOOK_TOKEN = 'payload-delivery-token'
@@ -4,16 +4,16 @@ import { createServer, type IncomingMessage, type Server } from 'node:http'
import { copyFileSync, mkdtempSync, writeFileSync } from 'node:fs'
import { tmpdir } from 'node:os'
import { join } from 'node:path'
import { removeTreeSync } from '../../shared/windows-transient-lock-removal'
import { getManagedScript } from '../claude/hook-script'
import { CLAUDE_HOOK_SETTINGS, getManagedLifecycleHook } from '../claude/hook-settings'
import { getWindowsClaudeHookEntry } from '../claude/windows-hook-files'
import { WINDOWS_CMD_SAFE_PATH } from './installer-utils'
import { removeTreeSync } from '../../../../shared/windows-transient-lock-removal'
import { getManagedScript } from '../../../claude/hook-script'
import { CLAUDE_HOOK_SETTINGS, getManagedLifecycleHook } from '../../../claude/hook-settings'
import { getWindowsClaudeHookEntry } from '../../../claude/windows-hook-files'
import { WINDOWS_CMD_SAFE_PATH } from './windows-hook-command'
import {
buildWindowsNativeHookExecutable,
WINDOWS_NATIVE_HOOK_BUILD_TIMEOUT_MS
} from './windows-native-hook-exe.test-fixture'
import { findGitBash } from './windows-git-bash-path.test-fixture'
} from './testing/windows-native-hook-exe.test-fixture'
import { findGitBash } from './testing/windows-git-bash-path.test-fixture'
import { getWindowsPowerShellExecutablePath } from './windows-powershell-hook-launcher'
const PAYLOAD = JSON.stringify({
@@ -0,0 +1,40 @@
export type HookCommandConfig = {
type: 'command'
command: string
args?: string[]
timeout?: number
async?: boolean
statusMessage?: string
[key: string]: unknown
}
export type HookDefinition = {
matcher?: string
command?: string
bash?: string
powershell?: string
hooks?: HookCommandConfig[]
[key: string]: unknown
}
export type HooksConfig = {
hooks?: Record<string, HookDefinition[]>
[key: string]: unknown
}
// Host-level backstop independent of curl and provider-specific timeouts.
export const MANAGED_HOOK_TIMEOUT_SECONDS = 10
export const MANAGED_HOOK_TIMEOUT_MILLISECONDS = MANAGED_HOOK_TIMEOUT_SECONDS * 1000
// Claude-shaped schemas nest command hooks; Cursor puts command on the definition itself.
export function buildManagedCommandHook(
command: string,
timeout = MANAGED_HOOK_TIMEOUT_SECONDS
): HookCommandConfig {
return { type: 'command', command, timeout }
}
export function buildManagedCommandDefinition(command: string): HookDefinition {
return { command, timeout: MANAGED_HOOK_TIMEOUT_SECONDS }
}
@@ -1,6 +1,6 @@
import { readFileSync } from 'node:fs'
import { isDefinitiveAbsence } from '../../shared/definitive-filesystem-absence'
import type { HooksConfig } from './installer-utils'
import { isDefinitiveAbsence } from '../../../../shared/definitive-filesystem-absence'
import type { HooksConfig } from './hook-config-schema'
export function isPlainObject(value: unknown): value is Record<string, unknown> {
return typeof value === 'object' && value !== null && !Array.isArray(value)
@@ -0,0 +1,69 @@
import { randomUUID } from 'node:crypto'
import type { SFTPWrapper } from 'ssh2'
import type { HooksConfig } from './hook-config-schema'
import { parseHooksJsonText } from './hooks-json-read'
import {
DEFAULT_REMOTE_CONFIG_MODE,
readFile,
writeFile,
getRemoteFileModeOrDefault,
rename,
unlink,
chmod,
mkdirpRemote,
dirnamePosix,
isNoEntryError
} from '../remote/hook-sftp-operations'
/** Null means invalid JSON, {} means missing; propagate other I/O failures. */
export async function readHooksJsonRemote(
sftp: SFTPWrapper,
remotePath: string
): Promise<HooksConfig | null> {
let body: string
try {
body = await readFile(sftp, remotePath)
} catch (err) {
if (isNoEntryError(err)) {
return {}
}
throw err
}
return parseHooksJsonText(body)
}
/** Atomically replace the remote config without rotating local-style backups. */
export async function writeHooksJsonRemote(
sftp: SFTPWrapper,
remotePath: string,
config: Record<string, unknown>,
// JSONC callers can supply text edited in place.
options?: { serialized?: string }
): Promise<void> {
const dir = dirnamePosix(remotePath)
await mkdirpRemote(sftp, dir)
const serialized = options?.serialized ?? `${JSON.stringify(config, null, 2)}\n`
// Preserve mtime and inode on repeated installs.
try {
const existing = await readFile(sftp, remotePath)
if (existing === serialized) {
return
}
} catch {
// Retry through the write path after a failed read.
}
// Atomic replacement prevents interrupted writes from truncating live settings.
const tmp = `${dir}/.${Date.now()}-${randomUUID()}.tmp`
try {
const mode = await getRemoteFileModeOrDefault(sftp, remotePath, DEFAULT_REMOTE_CONFIG_MODE)
await writeFile(sftp, tmp, serialized, mode)
await chmod(sftp, tmp, mode)
await rename(sftp, tmp, remotePath)
} finally {
try {
await unlink(sftp, tmp)
} catch {
// Cleanup is best effort.
}
}
}
@@ -0,0 +1,71 @@
import {
existsSync,
mkdirSync,
readFileSync,
statSync,
writeFileSync,
chmodSync,
renameSync,
unlinkSync
} from 'node:fs'
import { dirname, join } from 'node:path'
import { randomUUID } from 'node:crypto'
import { resolveHooksJsonWritePath } from './hook-config-write-path'
import { writeRollingFileBackup } from '../../../filesystem/rolling-file-backup'
export function writeHooksJson(
configPath: string,
// Fallback serialization accepts provider-specific JSON shapes, including nested hooks.events.
config: Record<string, unknown>,
// JSONC callers supply edited text while retaining atomic writes and backups.
options?: { preserveMode?: boolean; defaultMode?: number; serialized?: string }
): void {
const writePath = resolveHooksJsonWritePath(configPath)
const dir = dirname(writePath)
mkdirSync(dir, { recursive: true })
// Unique temp paths isolate concurrent writers and preserve the original on write failure.
const tmpPath = join(dir, `.${Date.now()}-${randomUUID()}.tmp`)
const serialized = options?.serialized ?? `${JSON.stringify(config, null, 2)}\n`
// Preserve owner-only permissions: agent configs can contain API keys.
const existingMode =
options?.preserveMode !== false && existsSync(writePath)
? statSync(writePath).mode & 0o777
: options?.defaultMode
// Identical reinstalls must not rotate away the last recoverable backup.
if (existsSync(writePath)) {
try {
if (readFileSync(writePath, 'utf-8') === serialized) {
return
}
} catch {
// Retry through the write path after a failed read.
}
}
try {
// Windows read-only mode could prevent deleting a failed temporary write.
const tmpMode = process.platform === 'win32' ? undefined : existingMode
writeFileSync(tmpPath, serialized, { encoding: 'utf-8', mode: tmpMode, flag: 'wx' })
if (existingMode !== undefined && process.platform !== 'win32') {
// Preserve requested permissions even with a stricter process umask.
chmodSync(tmpPath, existingMode)
}
// Keep one prior version for recovery from a bad merge.
if (existsSync(writePath)) {
writeRollingFileBackup(writePath, `${writePath}.bak`)
}
renameSync(tmpPath, writePath)
} finally {
if (existsSync(tmpPath)) {
try {
unlinkSync(tmpPath)
} catch {
// best effort
}
}
}
}
@@ -1,4 +1,4 @@
import { isPlainObject } from './installer-utils'
import { isPlainObject } from './hooks-json-read'
/** Treat malformed user-edited nodes as absent events when reporting installation status. */
export function readManagedHookEventsFromJson(
@@ -1,6 +1,6 @@
import { errnoCodeOrUnknown } from '../../shared/errno-code'
import type { HookInstallAgent } from '../../shared/telemetry-events'
import { track } from '../telemetry/client'
import { errnoCodeOrUnknown } from '../../../shared/errno-code'
import type { HookInstallAgent } from '../../../shared/telemetry-daemon-event-schemas'
import { track } from '../../telemetry/client'
export function recordManagedHookInstallFailure(agent: HookInstallAgent, error: unknown): void {
try {
@@ -2,13 +2,13 @@ import { chmodSync, mkdirSync, mkdtempSync, rmSync, symlinkSync, writeFileSync }
import { tmpdir } from 'node:os'
import { join } from 'node:path'
import { afterEach, describe, expect, it, vi } from 'vitest'
import type { ManagedAgentHookTarget } from '../../shared/managed-agent-hook-targets'
import type { ManagedAgentHookTarget } from '../../../shared/managed-agent-hook-targets'
import { detectLocalManagedAgentCliPresence } from './local-agent-cli-presence'
const { mergePersistedWindowsPathAsyncMock } = vi.hoisted(() => ({
mergePersistedWindowsPathAsyncMock: vi.fn(async (_env: NodeJS.ProcessEnv) => undefined)
}))
vi.mock('../pty/environment/windows-environment-path', () => ({
vi.mock('../../pty/environment/windows-environment-path', () => ({
mergePersistedWindowsPathAsync: mergePersistedWindowsPathAsyncMock
}))
@@ -2,22 +2,22 @@ import { constants } from 'node:fs'
import { access, stat } from 'node:fs/promises'
import { homedir } from 'node:os'
import path from 'node:path'
import type { AgentHookTarget } from '../../shared/agent-hook-listener/configuration/agent-hook-types'
import type { AgentHookTarget } from '../../../shared/agent-hook-listener/configuration/agent-hook-types'
import {
extractExecutableToken,
hasPathSeparatorToken,
isSafeExecutableBasename
} from '../../shared/managed-agent-command-token'
import type { ManagedAgentHookTarget } from '../../shared/managed-agent-hook-targets'
import type { GlobalSettings } from '../../shared/global-settings-types'
import { mapWithConcurrency } from '../../shared/map-with-concurrency'
import { hydrateShellPath, mergePathSegments } from '../startup/hydrate-shell-path'
import { mergePersistedWindowsPathAsync } from '../pty/environment/windows-environment-path'
import { resolvePathEnvKey } from '../pty/environment/windows-path-segment-merge'
} from '../../../shared/managed-agent-command-token'
import type { ManagedAgentHookTarget } from '../../../shared/managed-agent-hook-targets'
import type { GlobalSettings } from '../../../shared/global-settings-types'
import { mapWithConcurrency } from '../../../shared/map-with-concurrency'
import { hydrateShellPath, mergePathSegments } from '../../startup/hydrate-shell-path'
import { mergePersistedWindowsPathAsync } from '../../pty/environment/windows-environment-path'
import { resolvePathEnvKey } from '../../pty/environment/windows-path-segment-merge'
import {
isUnderWindowsDriveMount,
readGuestWindowsDriveMounts
} from '../ipc/wsl-guest-windows-drive-path'
} from '../../ipc/wsl-guest-windows-drive-path'
export type LocalCliPresenceState = 'found' | 'missing' | 'unknown'
export type LocalCliPresenceByAgent = Partial<
@@ -19,7 +19,7 @@ vi.mock('./local-agent-cli-presence', () => ({
detectLocalManagedAgentCliPresence: mocks.detect
}))
vi.mock('../claude/claude-hook-event-versions', () => ({
vi.mock('../../claude/claude-hook-event-versions', () => ({
probeClaudeCliVersion: mocks.probeClaudeVersion
}))
@@ -1,18 +1,18 @@
import type {
AgentHookInstallStatus,
AgentHookTarget
} from '../../shared/agent-hook-listener/configuration/agent-hook-types'
} from '../../../shared/agent-hook-listener/configuration/agent-hook-types'
import {
getManagedAgentHookTarget,
isManagedAgentHookTarget
} from '../../shared/managed-agent-hook-targets'
import { normalizeDisabledTuiAgents } from '../../shared/agent-launch/catalog/tui-agent-selection'
import type { GlobalSettings } from '../../shared/global-settings-types'
} from '../../../shared/managed-agent-hook-targets'
import { normalizeDisabledTuiAgents } from '../../../shared/agent-launch/catalog/tui-agent-selection'
import type { GlobalSettings } from '../../../shared/global-settings-types'
import {
isAgentStatusHooksEnabled,
isAgentStatusHooksEnabledForAgent
} from '../../shared/agent-hook-listener/configuration/agent-status-hooks-setting'
import { probeClaudeCliVersion } from '../claude/claude-hook-event-versions'
} from '../../../shared/agent-hook-listener/configuration/agent-status-hooks-setting'
import { probeClaudeCliVersion } from '../../claude/claude-hook-event-versions'
import { detectLocalManagedAgentCliPresence } from './local-agent-cli-presence'
import {
MANAGED_AGENT_HOOK_ASYNC_REMOVERS,

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