From 4843f85f2a2edef2f2452a8c805436d327ebf38c Mon Sep 17 00:00:00 2001 From: Neil <4138956+nwparker@users.noreply.github.com> Date: Sun, 25 Oct 2026 22:20:14 -0700 Subject: [PATCH] refactor(renderer): group agent-status records and reducers (#33665) * refactor(renderer): group agent-status records and reducers * refactor(renderer): consolidate concrete type owner imports --- config/reliability-gates.jsonc | 24 ++++---- .../agent-status-hot-path-benchmark.ts | 5 +- config/scripts/ci-shard-timings.json | 2 +- .../ActivityPrototypePage-test-fixtures.ts | 2 +- .../activity-clear-completed-hmr.test.ts | 2 +- .../activity/activity-clear-completed.test.ts | 2 +- .../activity/activity-clear-completed.ts | 2 +- ...ivity-event-builder.identity-reuse.test.ts | 2 +- .../activity/activity-event-builder.ts | 2 +- ...automation-run-completion-evidence.test.ts | 2 +- .../automation-run-completion-evidence.ts | 2 +- ...uild-dashboard-snapshot.rows-cache.test.ts | 2 +- .../components/dashboard/useRetainedAgents.ts | 2 +- .../dashboard/worktree-agent-rows-cache.ts | 2 +- ...uctured-agent-session-status-projection.ts | 2 +- .../sidebar/useWorktreeAgentRows.test.ts | 2 +- ...worktree-agent-orchestration-batch.test.ts | 2 +- ...worktree-agent-orchestration-index.test.ts | 2 +- .../worktree-agent-row-selectors.test.ts | 2 +- .../sidebar/worktree-agent-row-selectors.ts | 2 +- .../components/sidebar/worktree-agent-rows.ts | 2 +- ...ty-connection-agent-session-resume.spec.ts | 2 +- .../saved-resume-cancellation.test.ts | 2 +- ...mote-runtime-saved-result-consumer.test.ts | 2 +- ...events-agent-status-store-test-fixtures.ts | 2 +- .../ipc-events/agent-status-bridge-types.ts | 2 +- .../agent-status-event-applicator.ts | 2 +- .../agent-status-partial-updates.ts | 2 +- .../agent-status-pending-retry-gate.test.ts | 2 +- .../normalize-agent-status-event.ts | 2 +- ...ents-agent-status-batch-projection.test.ts | 5 +- ...Events-agent-status-queue-ordering.test.ts | 2 +- .../hooks/useReadOnScreenAttention.test.ts | 2 +- .../src/lib/automation-terminal-ownership.ts | 3 +- .../src/lib/open-tab-occupant-agent.test.ts | 2 +- .../src/lib/open-tab-occupant-agent.ts | 2 +- .../src/lib/tab-agent-status-index.test.ts | 2 +- .../src/lib/tab-agent-status-index.ts | 2 +- src/renderer/src/lib/tab-agent.test.ts | 2 +- src/renderer/src/lib/tab-agent.ts | 2 +- .../use-tab-agent-retained-identity.test.ts | 2 +- .../src/lib/workspace-tab-agent-metadata.ts | 2 +- .../lib/workspace-tab-palette-search.test.ts | 2 +- .../store/slices/activity-cleared-at.test.ts | 2 +- .../slices/agent-status-authority-actions.ts | 4 +- .../store/slices/agent-status-batch.test.ts | 11 ++-- .../slices/agent-status-cleanup-actions.ts | 9 ++- .../store/slices/agent-status-drop-actions.ts | 8 +-- .../slices/agent-status-drop-ipc.test.ts | 5 +- .../agent-status-entry-contracts.test.ts | 8 --- .../slices/agent-status-launch-actions.ts | 6 +- .../slices/agent-status-launch-config.ts | 2 +- .../store/slices/agent-status-live-actions.ts | 8 +-- ...gent-status-live-freshness-request.test.ts | 2 +- .../slices/agent-status-live-map-leak.test.ts | 3 +- .../slices/agent-status-nested-resume.spec.ts | 2 +- .../agent-status-orchestration-actions.ts | 2 +- .../agent-status-pane-key-tab-binding.ts | 7 ++- .../agent-status-program-status-actions.ts | 2 +- .../agent-status-provider-session-actions.ts | 6 +- .../slices/agent-status-quit-capture.test.ts | 3 +- .../slices/agent-status-recovery-actions.ts | 6 +- .../slices/agent-status-retention-actions.ts | 6 +- ...gent-status-retention-prefix-sweep.test.ts | 2 +- ...agent-status-runtime-orchestration.test.ts | 2 +- .../src/store/slices/agent-status-runtime.ts | 7 ++- .../agent-status-verdict-copies.test.ts | 4 +- .../agent-status-worktree-drop-actions.ts | 11 ++-- .../src/store/slices/agent-status.test.ts | 4 +- src/renderer/src/store/slices/agent-status.ts | 55 +++---------------- .../agent-status-capacity-eviction.ts | 11 ++-- .../agent-status-contract.ts | 30 +++------- .../agent-status-drop-reducer.ts | 4 +- .../agent-status-entry-contracts.test.ts | 8 +++ .../agent-status-live-entry-builder.ts | 28 +++++----- .../agent-status-live-entry-children.ts | 7 ++- .../agent-status-live-entry-main-agent.ts | 9 +-- .../agent-status-live-facts.ts | 14 ++--- .../agent-status-live-reducer.ts | 8 +-- ...nt-status-migration-unsupported-entries.ts | 2 +- .../agent-status-pane-keyed-records.test.ts | 0 .../agent-status-pane-keyed-records.ts | 0 .../agent-status-recovery-collection.ts | 17 +++--- .../agent-status-sleeping-records.ts | 14 ++--- .../agent-status-slice-contract.ts | 12 ++-- .../retired-terminal-tab-state-sweep.ts | 5 +- .../subject-attention-transitions.ts | 5 +- .../src/store/terminals/terminal-actions.ts | 2 +- .../terminals/terminal-pane-hibernation.ts | 3 +- .../terminals/terminal-shutdown-state.ts | 11 ++-- .../src/store/terminals/terminal-shutdown.ts | 7 ++- .../src/store/terminals/terminal-tab-close.ts | 2 +- src/renderer/src/store/types.ts | 2 +- .../e2e/nested-agent-idle-owner.unit.test.ts | 2 +- 94 files changed, 238 insertions(+), 267 deletions(-) delete mode 100644 src/renderer/src/store/slices/agent-status-entry-contracts.test.ts rename src/renderer/src/store/slices/{ => agent-status}/agent-status-capacity-eviction.ts (89%) rename src/renderer/src/store/slices/{ => agent-status}/agent-status-contract.ts (86%) rename src/renderer/src/store/slices/{ => agent-status}/agent-status-drop-reducer.ts (98%) create mode 100644 src/renderer/src/store/slices/agent-status/agent-status-entry-contracts.test.ts rename src/renderer/src/store/slices/{ => agent-status}/agent-status-live-entry-builder.ts (91%) rename src/renderer/src/store/slices/{ => agent-status}/agent-status-live-entry-children.ts (68%) rename src/renderer/src/store/slices/{ => agent-status}/agent-status-live-entry-main-agent.ts (78%) rename src/renderer/src/store/slices/{ => agent-status}/agent-status-live-facts.ts (89%) rename src/renderer/src/store/slices/{ => agent-status}/agent-status-live-reducer.ts (93%) rename src/renderer/src/store/slices/{ => agent-status}/agent-status-migration-unsupported-entries.ts (84%) rename src/renderer/src/store/slices/{ => agent-status}/agent-status-pane-keyed-records.test.ts (100%) rename src/renderer/src/store/slices/{ => agent-status}/agent-status-pane-keyed-records.ts (100%) rename src/renderer/src/store/slices/{ => agent-status}/agent-status-recovery-collection.ts (91%) rename src/renderer/src/store/slices/{ => agent-status}/agent-status-sleeping-records.ts (86%) rename src/renderer/src/store/slices/{ => agent-status}/agent-status-slice-contract.ts (95%) diff --git a/config/reliability-gates.jsonc b/config/reliability-gates.jsonc index 71634d46aa7..74fdd7338b0 100644 --- a/config/reliability-gates.jsonc +++ b/config/reliability-gates.jsonc @@ -21509,15 +21509,15 @@ "oracle": "Send a full Claude child roster, interleave Codex review lifecycle/tool/approval/completion hooks, and require identical snapshots plus zero publications. A later Claude child event must retain the original prompt and roster, and a real child completion must shrink it. After Claude Stop, keep its mobile transcript and saved resume identity while its identified process remains live or unverifiable; accept the first provider replacement after confirmed exit or suspension. Replay must admit records in order, retain the file on failed admission, and concurrent starts, stop during replay, or a second stop during a queued restart must not leave a listener. Pending owner probes cannot publish or accept an old request after stop, restart, or status disable/re-enable; interrupted replay stays durable.", "commands": [ "SKIP_BUILD=1 ORCA_BACKGROUND_LAUNCH=1 xvfb-run -a pnpm exec playwright test --config tests/playwright.config.ts tests/e2e/nested-agent-idle-session-owner.spec.ts --project=electron-headless --workers=1 --repeat-each=3", - "ORCA_BACKGROUND_LAUNCH=1 pnpm exec vitest run --config config/vitest.config.ts src/main/agent-hooks/server-idle-process-owner.test.ts src/wsl-guest/relay-idle-process-owner.test.ts tests/e2e/nested-agent-idle-owner.unit.test.ts src/shared/agent-process-presence-probe.test.ts src/shared/agent-hook-spool-drain.test.ts src/main/agent-hooks/server-agent-presence.test.ts src/wsl-guest/relay-agent-presence.test.ts src/main/agent-hooks/server-nested-agent-roster.test.ts src/main/agent-hooks/server-nested-agent-boundaries.test.ts src/main/agent-hooks/server-nested-agent-consumers.test.ts src/main/agent-hooks/server-nested-agent-model.test.ts src/main/agent-hooks/server-ingest-remote.test.ts src/main/agent-hooks/server-hook-http-ingest.test.ts src/main/agent-hooks/server-status-listener-fanout.test.ts src/main/agent-hooks/terminal-handle-row-identity.test.ts src/renderer/src/store/slices/agent-status-entry-contracts.test.ts src/wsl-guest/agent-hook-provider-normalization.test.ts src/main/agent-hooks/server-start-failure-lifecycle.test.ts src/main/agent-hooks/server-startup-lifecycle.test.ts src/main/agent-hooks/spool.test.ts src/shared/agent-hook-spool-read.test.ts src/wsl-guest/agent-hook-server.test.ts src/main/agent-hooks/server-http-owner-probe-lifecycle.test.ts src/wsl-guest/relay-http-owner-probe-lifecycle.test.ts --maxWorkers=2", - "ORCA_BACKGROUND_LAUNCH=1 pnpm exec vitest run --config config/vitest.config.ts src/main/agent-hooks/server-idle-process-owner.test.ts src/wsl-guest/relay-idle-process-owner.test.ts tests/e2e/nested-agent-idle-owner.unit.test.ts src/shared/agent-process-presence-probe.test.ts src/shared/agent-hook-spool-drain.test.ts src/main/agent-hooks/server-agent-presence.test.ts src/wsl-guest/relay-agent-presence.test.ts src/main/agent-hooks/server-nested-agent-roster.test.ts src/main/agent-hooks/server-nested-agent-boundaries.test.ts src/main/agent-hooks/server-nested-agent-consumers.test.ts src/main/agent-hooks/server-nested-agent-model.test.ts src/main/agent-hooks/server-ingest-remote.test.ts src/main/agent-hooks/server-hook-http-ingest.test.ts src/main/agent-hooks/server-status-listener-fanout.test.ts src/main/agent-hooks/terminal-handle-row-identity.test.ts src/renderer/src/store/slices/agent-status-entry-contracts.test.ts src/wsl-guest/agent-hook-provider-normalization.test.ts src/main/agent-hooks/server-start-failure-lifecycle.test.ts src/main/agent-hooks/server-startup-lifecycle.test.ts src/main/agent-hooks/spool.test.ts src/shared/agent-hook-spool-read.test.ts src/wsl-guest/agent-hook-server.test.ts --maxWorkers=2", + "ORCA_BACKGROUND_LAUNCH=1 pnpm exec vitest run --config config/vitest.config.ts src/main/agent-hooks/server-idle-process-owner.test.ts src/wsl-guest/relay-idle-process-owner.test.ts tests/e2e/nested-agent-idle-owner.unit.test.ts src/shared/agent-process-presence-probe.test.ts src/shared/agent-hook-spool-drain.test.ts src/main/agent-hooks/server-agent-presence.test.ts src/wsl-guest/relay-agent-presence.test.ts src/main/agent-hooks/server-nested-agent-roster.test.ts src/main/agent-hooks/server-nested-agent-boundaries.test.ts src/main/agent-hooks/server-nested-agent-consumers.test.ts src/main/agent-hooks/server-nested-agent-model.test.ts src/main/agent-hooks/server-ingest-remote.test.ts src/main/agent-hooks/server-hook-http-ingest.test.ts src/main/agent-hooks/server-status-listener-fanout.test.ts src/main/agent-hooks/terminal-handle-row-identity.test.ts src/renderer/src/store/slices/agent-status/agent-status-entry-contracts.test.ts src/wsl-guest/agent-hook-provider-normalization.test.ts src/main/agent-hooks/server-start-failure-lifecycle.test.ts src/main/agent-hooks/server-startup-lifecycle.test.ts src/main/agent-hooks/spool.test.ts src/shared/agent-hook-spool-read.test.ts src/wsl-guest/agent-hook-server.test.ts src/main/agent-hooks/server-http-owner-probe-lifecycle.test.ts src/wsl-guest/relay-http-owner-probe-lifecycle.test.ts --maxWorkers=2", + "ORCA_BACKGROUND_LAUNCH=1 pnpm exec vitest run --config config/vitest.config.ts src/main/agent-hooks/server-idle-process-owner.test.ts src/wsl-guest/relay-idle-process-owner.test.ts tests/e2e/nested-agent-idle-owner.unit.test.ts src/shared/agent-process-presence-probe.test.ts src/shared/agent-hook-spool-drain.test.ts src/main/agent-hooks/server-agent-presence.test.ts src/wsl-guest/relay-agent-presence.test.ts src/main/agent-hooks/server-nested-agent-roster.test.ts src/main/agent-hooks/server-nested-agent-boundaries.test.ts src/main/agent-hooks/server-nested-agent-consumers.test.ts src/main/agent-hooks/server-nested-agent-model.test.ts src/main/agent-hooks/server-ingest-remote.test.ts src/main/agent-hooks/server-hook-http-ingest.test.ts src/main/agent-hooks/server-status-listener-fanout.test.ts src/main/agent-hooks/terminal-handle-row-identity.test.ts src/renderer/src/store/slices/agent-status/agent-status-entry-contracts.test.ts src/wsl-guest/agent-hook-provider-normalization.test.ts src/main/agent-hooks/server-start-failure-lifecycle.test.ts src/main/agent-hooks/server-startup-lifecycle.test.ts src/main/agent-hooks/spool.test.ts src/shared/agent-hook-spool-read.test.ts src/wsl-guest/agent-hook-server.test.ts --maxWorkers=2", "ORCA_BACKGROUND_LAUNCH=1 ORCA_E2E_RECORD_VIDEO=1 pnpm exec playwright test --config tests/playwright.config.ts tests/e2e/nested-agent-idle-session-owner.spec.ts --project=electron-headless --workers=1 --repeat-each=3", "ORCA_BACKGROUND_LAUNCH=1 pnpm exec vitest run --config config/vitest.config.ts src/main/agent-hooks/server-idle-process-owner.test.ts src/wsl-guest/relay-idle-process-owner.test.ts tests/e2e/nested-agent-idle-owner.unit.test.ts src/shared/agent-process-presence-probe.test.ts src/shared/agent-hook-spool-drain.test.ts src/main/agent-hooks/server-startup-lifecycle.test.ts src/main/agent-hooks/server-start-failure-lifecycle.test.ts --maxWorkers=2", "ORCA_BACKGROUND_LAUNCH=1 pnpm exec playwright test --config tests/playwright.config.ts tests/e2e/nested-agent-idle-session-owner.spec.ts --project=electron-headless --workers=1", - "ORCA_BACKGROUND_LAUNCH=1 pnpm exec vitest run --config config/vitest.config.ts src/main/agent-hooks/server-nested-agent-roster.test.ts src/main/agent-hooks/server-nested-agent-boundaries.test.ts src/main/agent-hooks/server-nested-agent-consumers.test.ts src/main/agent-hooks/server-nested-agent-model.test.ts src/main/agent-hooks/server-ingest-remote.test.ts src/main/agent-hooks/server-hook-http-ingest.test.ts src/main/agent-hooks/server-turn-started-at.test.ts src/main/agent-hooks/server-status-listener-fanout.test.ts src/main/agent-hooks/terminal-handle-row-identity.test.ts src/renderer/src/store/slices/agent-status-entry-contracts.test.ts src/renderer/src/store/slices/agent-status-provider-session.test.ts src/wsl-guest/agent-hook-provider-normalization.test.ts --maxWorkers=2", - "ORCA_BACKGROUND_LAUNCH=1 pnpm exec vitest run --config config/vitest.config.ts src/main/agent-hooks/server-nested-agent-roster.test.ts src/main/agent-hooks/server-nested-agent-model.test.ts src/main/agent-hooks/server-ingest-remote.test.ts src/renderer/src/store/slices/agent-status-entry-contracts.test.ts --maxWorkers=2", - "ORCA_BACKGROUND_LAUNCH=1 pnpm exec vitest run --config config/vitest.config.ts src/main/agent-hooks/server-nested-agent-roster.test.ts src/main/agent-hooks/server-nested-agent-model.test.ts src/main/agent-hooks/server-ingest-remote.test.ts src/main/agent-hooks/server-agent-presence.test.ts src/renderer/src/store/slices/agent-status-entry-contracts.test.ts src/main/agent-hooks/server-hook-http-ingest.test.ts src/wsl-guest/agent-hook-server.test.ts --maxWorkers=2", - "ORCA_BACKGROUND_LAUNCH=1 pnpm exec vitest run --config config/vitest.config.ts src/main/agent-hooks/server-nested-agent-roster.test.ts src/main/agent-hooks/server-ingest-remote.test.ts src/main/agent-hooks/server-nested-agent-model.test.ts src/main/agent-hooks/server-hook-http-ingest.test.ts src/main/agent-hooks/server-turn-started-at.test.ts src/main/agent-hooks/server-status-listener-fanout.test.ts src/main/agent-hooks/terminal-handle-row-identity.test.ts src/renderer/src/store/slices/agent-status-entry-contracts.test.ts --maxWorkers=2" + "ORCA_BACKGROUND_LAUNCH=1 pnpm exec vitest run --config config/vitest.config.ts src/main/agent-hooks/server-nested-agent-roster.test.ts src/main/agent-hooks/server-nested-agent-boundaries.test.ts src/main/agent-hooks/server-nested-agent-consumers.test.ts src/main/agent-hooks/server-nested-agent-model.test.ts src/main/agent-hooks/server-ingest-remote.test.ts src/main/agent-hooks/server-hook-http-ingest.test.ts src/main/agent-hooks/server-turn-started-at.test.ts src/main/agent-hooks/server-status-listener-fanout.test.ts src/main/agent-hooks/terminal-handle-row-identity.test.ts src/renderer/src/store/slices/agent-status/agent-status-entry-contracts.test.ts src/renderer/src/store/slices/agent-status-provider-session.test.ts src/wsl-guest/agent-hook-provider-normalization.test.ts --maxWorkers=2", + "ORCA_BACKGROUND_LAUNCH=1 pnpm exec vitest run --config config/vitest.config.ts src/main/agent-hooks/server-nested-agent-roster.test.ts src/main/agent-hooks/server-nested-agent-model.test.ts src/main/agent-hooks/server-ingest-remote.test.ts src/renderer/src/store/slices/agent-status/agent-status-entry-contracts.test.ts --maxWorkers=2", + "ORCA_BACKGROUND_LAUNCH=1 pnpm exec vitest run --config config/vitest.config.ts src/main/agent-hooks/server-nested-agent-roster.test.ts src/main/agent-hooks/server-nested-agent-model.test.ts src/main/agent-hooks/server-ingest-remote.test.ts src/main/agent-hooks/server-agent-presence.test.ts src/renderer/src/store/slices/agent-status/agent-status-entry-contracts.test.ts src/main/agent-hooks/server-hook-http-ingest.test.ts src/wsl-guest/agent-hook-server.test.ts --maxWorkers=2", + "ORCA_BACKGROUND_LAUNCH=1 pnpm exec vitest run --config config/vitest.config.ts src/main/agent-hooks/server-nested-agent-roster.test.ts src/main/agent-hooks/server-ingest-remote.test.ts src/main/agent-hooks/server-nested-agent-model.test.ts src/main/agent-hooks/server-hook-http-ingest.test.ts src/main/agent-hooks/server-turn-started-at.test.ts src/main/agent-hooks/server-status-listener-fanout.test.ts src/main/agent-hooks/terminal-handle-row-identity.test.ts src/renderer/src/store/slices/agent-status/agent-status-entry-contracts.test.ts --maxWorkers=2" ], "testFiles": [ "src/main/agent-hooks/server-http-owner-probe-lifecycle.test.ts", @@ -21534,7 +21534,7 @@ "src/wsl-guest/agent-hook-provider-normalization.test.ts", "src/main/agent-hooks/server-nested-agent-boundaries.test.ts", "src/main/agent-hooks/server-nested-agent-consumers.test.ts", - "src/renderer/src/store/slices/agent-status-entry-contracts.test.ts", + "src/renderer/src/store/slices/agent-status/agent-status-entry-contracts.test.ts", "src/main/agent-hooks/server-nested-agent-roster.test.ts", "src/main/agent-hooks/server-nested-agent-model.test.ts", "src/main/agent-hooks/server-ingest-remote.test.ts" @@ -21563,7 +21563,7 @@ "runner": "local", "platform": "macos", "command": "ORCA_BACKGROUND_LAUNCH=1 pnpm exec vitest run --config config/vitest.config.ts src/main/agent-hooks/server-idle-process-owner.test.ts src/wsl-guest/relay-idle-process-owner.test.ts tests/e2e/nested-agent-idle-owner.unit.test.ts src/shared/agent-process-presence-probe.test.ts src/shared/agent-hook-spool-drain.test.ts src/main/agent-hooks/server-agent-presence.test.ts src/wsl-guest/relay-agent-presence.test.ts src/main/agent-hooks/server-nested-agent-roster.test.ts src/main/agent-hooks/server-nested-agent-boundaries.test.ts src/main/agent-hooks/server-nested-agent-consumers.test.ts src/main/agent-hooks/server-nested-agent-model.test.ts src/main/agent-hooks/server-ingest-remote.test.ts src/main/agent-hooks/server-hook-http-ingest.test.ts src/main/agent-hooks/server-status-listener-fanout.test.ts src/main/agent-hooks/terminal-handle-row-identity.test.ts src/renderer/src/store/slices/agent-status-nested-resume.test.ts src/wsl-guest/agent-hook-provider-normalization.test.ts src/main/agent-hooks/server-start-failure-lifecycle.test.ts src/main/agent-hooks/server-startup-lifecycle.test.ts src/main/agent-hooks/spool.test.ts src/shared/agent-hook-spool-read.test.ts src/wsl-guest/agent-hook-server.test.ts src/main/agent-hooks/server-http-owner-probe-lifecycle.test.ts src/wsl-guest/relay-http-owner-probe-lifecycle.test.ts --maxWorkers=2", - "currentCommand": "ORCA_BACKGROUND_LAUNCH=1 pnpm exec vitest run --config config/vitest.config.ts src/main/agent-hooks/server-idle-process-owner.test.ts src/wsl-guest/relay-idle-process-owner.test.ts tests/e2e/nested-agent-idle-owner.unit.test.ts src/shared/agent-process-presence-probe.test.ts src/shared/agent-hook-spool-drain.test.ts src/main/agent-hooks/server-agent-presence.test.ts src/wsl-guest/relay-agent-presence.test.ts src/main/agent-hooks/server-nested-agent-roster.test.ts src/main/agent-hooks/server-nested-agent-boundaries.test.ts src/main/agent-hooks/server-nested-agent-consumers.test.ts src/main/agent-hooks/server-nested-agent-model.test.ts src/main/agent-hooks/server-ingest-remote.test.ts src/main/agent-hooks/server-hook-http-ingest.test.ts src/main/agent-hooks/server-status-listener-fanout.test.ts src/main/agent-hooks/terminal-handle-row-identity.test.ts src/renderer/src/store/slices/agent-status-entry-contracts.test.ts src/wsl-guest/agent-hook-provider-normalization.test.ts src/main/agent-hooks/server-start-failure-lifecycle.test.ts src/main/agent-hooks/server-startup-lifecycle.test.ts src/main/agent-hooks/spool.test.ts src/shared/agent-hook-spool-read.test.ts src/wsl-guest/agent-hook-server.test.ts src/main/agent-hooks/server-http-owner-probe-lifecycle.test.ts src/wsl-guest/relay-http-owner-probe-lifecycle.test.ts --maxWorkers=2", + "currentCommand": "ORCA_BACKGROUND_LAUNCH=1 pnpm exec vitest run --config config/vitest.config.ts src/main/agent-hooks/server-idle-process-owner.test.ts src/wsl-guest/relay-idle-process-owner.test.ts tests/e2e/nested-agent-idle-owner.unit.test.ts src/shared/agent-process-presence-probe.test.ts src/shared/agent-hook-spool-drain.test.ts src/main/agent-hooks/server-agent-presence.test.ts src/wsl-guest/relay-agent-presence.test.ts src/main/agent-hooks/server-nested-agent-roster.test.ts src/main/agent-hooks/server-nested-agent-boundaries.test.ts src/main/agent-hooks/server-nested-agent-consumers.test.ts src/main/agent-hooks/server-nested-agent-model.test.ts src/main/agent-hooks/server-ingest-remote.test.ts src/main/agent-hooks/server-hook-http-ingest.test.ts src/main/agent-hooks/server-status-listener-fanout.test.ts src/main/agent-hooks/terminal-handle-row-identity.test.ts src/renderer/src/store/slices/agent-status/agent-status-entry-contracts.test.ts src/wsl-guest/agent-hook-provider-normalization.test.ts src/main/agent-hooks/server-start-failure-lifecycle.test.ts src/main/agent-hooks/server-startup-lifecycle.test.ts src/main/agent-hooks/spool.test.ts src/shared/agent-hook-spool-read.test.ts src/wsl-guest/agent-hook-server.test.ts src/main/agent-hooks/server-http-owner-probe-lifecycle.test.ts src/wsl-guest/relay-http-owner-probe-lifecycle.test.ts --maxWorkers=2", "result": "passed", "durationSeconds": 75.69, "summary": "197 tests across 24 files pass after adversarial review. New regressions cover pending HTTP and process-probe publication after stop/restart/status disable/re-enable, fixed-token relay restarts, interrupted spool durability, and a second stop while a restart is queued." @@ -21582,7 +21582,7 @@ "runner": "local", "platform": "macos", "command": "ORCA_BACKGROUND_LAUNCH=1 pnpm exec vitest run --config config/vitest.config.ts src/main/agent-hooks/server-idle-process-owner.test.ts src/wsl-guest/relay-idle-process-owner.test.ts tests/e2e/nested-agent-idle-owner.unit.test.ts src/shared/agent-process-presence-probe.test.ts src/shared/agent-hook-spool-drain.test.ts src/main/agent-hooks/server-agent-presence.test.ts src/wsl-guest/relay-agent-presence.test.ts src/main/agent-hooks/server-nested-agent-roster.test.ts src/main/agent-hooks/server-nested-agent-boundaries.test.ts src/main/agent-hooks/server-nested-agent-consumers.test.ts src/main/agent-hooks/server-nested-agent-model.test.ts src/main/agent-hooks/server-ingest-remote.test.ts src/main/agent-hooks/server-hook-http-ingest.test.ts src/main/agent-hooks/server-status-listener-fanout.test.ts src/main/agent-hooks/terminal-handle-row-identity.test.ts src/renderer/src/store/slices/agent-status-nested-resume.test.ts src/wsl-guest/agent-hook-provider-normalization.test.ts src/main/agent-hooks/server-start-failure-lifecycle.test.ts src/main/agent-hooks/server-startup-lifecycle.test.ts src/main/agent-hooks/spool.test.ts src/shared/agent-hook-spool-read.test.ts src/wsl-guest/agent-hook-server.test.ts --maxWorkers=2", - "currentCommand": "ORCA_BACKGROUND_LAUNCH=1 pnpm exec vitest run --config config/vitest.config.ts src/main/agent-hooks/server-idle-process-owner.test.ts src/wsl-guest/relay-idle-process-owner.test.ts tests/e2e/nested-agent-idle-owner.unit.test.ts src/shared/agent-process-presence-probe.test.ts src/shared/agent-hook-spool-drain.test.ts src/main/agent-hooks/server-agent-presence.test.ts src/wsl-guest/relay-agent-presence.test.ts src/main/agent-hooks/server-nested-agent-roster.test.ts src/main/agent-hooks/server-nested-agent-boundaries.test.ts src/main/agent-hooks/server-nested-agent-consumers.test.ts src/main/agent-hooks/server-nested-agent-model.test.ts src/main/agent-hooks/server-ingest-remote.test.ts src/main/agent-hooks/server-hook-http-ingest.test.ts src/main/agent-hooks/server-status-listener-fanout.test.ts src/main/agent-hooks/terminal-handle-row-identity.test.ts src/renderer/src/store/slices/agent-status-entry-contracts.test.ts src/wsl-guest/agent-hook-provider-normalization.test.ts src/main/agent-hooks/server-start-failure-lifecycle.test.ts src/main/agent-hooks/server-startup-lifecycle.test.ts src/main/agent-hooks/spool.test.ts src/shared/agent-hook-spool-read.test.ts src/wsl-guest/agent-hook-server.test.ts --maxWorkers=2", + "currentCommand": "ORCA_BACKGROUND_LAUNCH=1 pnpm exec vitest run --config config/vitest.config.ts src/main/agent-hooks/server-idle-process-owner.test.ts src/wsl-guest/relay-idle-process-owner.test.ts tests/e2e/nested-agent-idle-owner.unit.test.ts src/shared/agent-process-presence-probe.test.ts src/shared/agent-hook-spool-drain.test.ts src/main/agent-hooks/server-agent-presence.test.ts src/wsl-guest/relay-agent-presence.test.ts src/main/agent-hooks/server-nested-agent-roster.test.ts src/main/agent-hooks/server-nested-agent-boundaries.test.ts src/main/agent-hooks/server-nested-agent-consumers.test.ts src/main/agent-hooks/server-nested-agent-model.test.ts src/main/agent-hooks/server-ingest-remote.test.ts src/main/agent-hooks/server-hook-http-ingest.test.ts src/main/agent-hooks/server-status-listener-fanout.test.ts src/main/agent-hooks/terminal-handle-row-identity.test.ts src/renderer/src/store/slices/agent-status/agent-status-entry-contracts.test.ts src/wsl-guest/agent-hook-provider-normalization.test.ts src/main/agent-hooks/server-start-failure-lifecycle.test.ts src/main/agent-hooks/server-startup-lifecycle.test.ts src/main/agent-hooks/spool.test.ts src/shared/agent-hook-spool-read.test.ts src/wsl-guest/agent-hook-server.test.ts --maxWorkers=2", "result": "passed", "durationSeconds": 8.34, "summary": "187 tests across 22 files pass on the final follow-up, covering idle process ownership, stale suspension/resume/unavailable/exit, legacy hosts, relay cache isolation, saved resume records, concurrent startup and durable ordered spool replay." @@ -21601,7 +21601,7 @@ "runner": "local", "platform": "macos", "command": "ORCA_BACKGROUND_LAUNCH=1 pnpm exec vitest run --config config/vitest.config.ts src/main/agent-hooks/server-nested-agent-roster.test.ts src/main/agent-hooks/server-nested-agent-boundaries.test.ts src/main/agent-hooks/server-nested-agent-consumers.test.ts src/main/agent-hooks/server-nested-agent-model.test.ts src/main/agent-hooks/server-ingest-remote.test.ts src/main/agent-hooks/server-hook-http-ingest.test.ts src/main/agent-hooks/server-turn-started-at.test.ts src/main/agent-hooks/server-status-listener-fanout.test.ts src/main/agent-hooks/terminal-handle-row-identity.test.ts src/renderer/src/store/slices/agent-status-tool-assistant-fields.test.ts src/renderer/src/store/slices/agent-status-provider-session.test.ts src/renderer/src/store/slices/agent-status-nested-resume.test.ts src/wsl-guest/agent-hook-provider-normalization.test.ts --maxWorkers=2", - "currentCommand": "ORCA_BACKGROUND_LAUNCH=1 pnpm exec vitest run --config config/vitest.config.ts src/main/agent-hooks/server-nested-agent-roster.test.ts src/main/agent-hooks/server-nested-agent-boundaries.test.ts src/main/agent-hooks/server-nested-agent-consumers.test.ts src/main/agent-hooks/server-nested-agent-model.test.ts src/main/agent-hooks/server-ingest-remote.test.ts src/main/agent-hooks/server-hook-http-ingest.test.ts src/main/agent-hooks/server-turn-started-at.test.ts src/main/agent-hooks/server-status-listener-fanout.test.ts src/main/agent-hooks/terminal-handle-row-identity.test.ts src/renderer/src/store/slices/agent-status-entry-contracts.test.ts src/renderer/src/store/slices/agent-status-provider-session.test.ts src/wsl-guest/agent-hook-provider-normalization.test.ts --maxWorkers=2", + "currentCommand": "ORCA_BACKGROUND_LAUNCH=1 pnpm exec vitest run --config config/vitest.config.ts src/main/agent-hooks/server-nested-agent-roster.test.ts src/main/agent-hooks/server-nested-agent-boundaries.test.ts src/main/agent-hooks/server-nested-agent-consumers.test.ts src/main/agent-hooks/server-nested-agent-model.test.ts src/main/agent-hooks/server-ingest-remote.test.ts src/main/agent-hooks/server-hook-http-ingest.test.ts src/main/agent-hooks/server-turn-started-at.test.ts src/main/agent-hooks/server-status-listener-fanout.test.ts src/main/agent-hooks/terminal-handle-row-identity.test.ts src/renderer/src/store/slices/agent-status/agent-status-entry-contracts.test.ts src/renderer/src/store/slices/agent-status-provider-session.test.ts src/wsl-guest/agent-hook-provider-normalization.test.ts --maxWorkers=2", "result": "passed", "durationSeconds": 8.75, "summary": "132 tests across 13 files passed after review and CI boundary fixes, including actual mobile transcript selection, renderer Claude resume argv, host/workspace collision replacement, WSL transport equivalence, legacy unstamped local renderer entries, Pi identity-only boundaries, clock rollback and provider-isolated relay HTTP/spool/reconnect/teardown." @@ -21611,7 +21611,7 @@ "runner": "local", "platform": "macos", "command": "ORCA_BACKGROUND_LAUNCH=1 pnpm exec vitest run --config config/vitest.config.ts src/main/agent-hooks/server-nested-agent-roster.test.ts src/main/agent-hooks/server-nested-agent-model.test.ts src/main/agent-hooks/server-ingest-remote.test.ts src/main/agent-hooks/server-agent-presence.test.ts src/renderer/src/store/slices/agent-status-tool-assistant-fields.test.ts src/main/agent-hooks/server-hook-http-ingest.test.ts src/wsl-guest/agent-hook-server.test.ts --maxWorkers=2", - "currentCommand": "ORCA_BACKGROUND_LAUNCH=1 pnpm exec vitest run --config config/vitest.config.ts src/main/agent-hooks/server-nested-agent-roster.test.ts src/main/agent-hooks/server-nested-agent-model.test.ts src/main/agent-hooks/server-ingest-remote.test.ts src/main/agent-hooks/server-agent-presence.test.ts src/renderer/src/store/slices/agent-status-entry-contracts.test.ts src/main/agent-hooks/server-hook-http-ingest.test.ts src/wsl-guest/agent-hook-server.test.ts --maxWorkers=2", + "currentCommand": "ORCA_BACKGROUND_LAUNCH=1 pnpm exec vitest run --config config/vitest.config.ts src/main/agent-hooks/server-nested-agent-roster.test.ts src/main/agent-hooks/server-nested-agent-model.test.ts src/main/agent-hooks/server-ingest-remote.test.ts src/main/agent-hooks/server-agent-presence.test.ts src/renderer/src/store/slices/agent-status/agent-status-entry-contracts.test.ts src/main/agent-hooks/server-hook-http-ingest.test.ts src/wsl-guest/agent-hook-server.test.ts --maxWorkers=2", "result": "passed", "durationSeconds": 91.45, "summary": "97 tests across seven files passed, including full 32-child local and relay HTTP flows, legacy remote snapshots, model isolation, owner process contracts and renderer ownership. Finished/stale replacement controls added afterward are validated separately." @@ -21621,7 +21621,7 @@ "runner": "local", "platform": "macos", "command": "ORCA_BACKGROUND_LAUNCH=1 pnpm exec vitest run --config config/vitest.config.ts src/main/agent-hooks/server-nested-agent-roster.test.ts src/main/agent-hooks/server-ingest-remote.test.ts src/main/agent-hooks/server-nested-agent-model.test.ts src/main/agent-hooks/server-hook-http-ingest.test.ts src/main/agent-hooks/server-turn-started-at.test.ts src/main/agent-hooks/server-status-listener-fanout.test.ts src/main/agent-hooks/terminal-handle-row-identity.test.ts src/renderer/src/store/slices/agent-status-tool-assistant-fields.test.ts --maxWorkers=2", - "currentCommand": "ORCA_BACKGROUND_LAUNCH=1 pnpm exec vitest run --config config/vitest.config.ts src/main/agent-hooks/server-nested-agent-roster.test.ts src/main/agent-hooks/server-ingest-remote.test.ts src/main/agent-hooks/server-nested-agent-model.test.ts src/main/agent-hooks/server-hook-http-ingest.test.ts src/main/agent-hooks/server-turn-started-at.test.ts src/main/agent-hooks/server-status-listener-fanout.test.ts src/main/agent-hooks/terminal-handle-row-identity.test.ts src/renderer/src/store/slices/agent-status-entry-contracts.test.ts --maxWorkers=2", + "currentCommand": "ORCA_BACKGROUND_LAUNCH=1 pnpm exec vitest run --config config/vitest.config.ts src/main/agent-hooks/server-nested-agent-roster.test.ts src/main/agent-hooks/server-ingest-remote.test.ts src/main/agent-hooks/server-nested-agent-model.test.ts src/main/agent-hooks/server-hook-http-ingest.test.ts src/main/agent-hooks/server-turn-started-at.test.ts src/main/agent-hooks/server-status-listener-fanout.test.ts src/main/agent-hooks/terminal-handle-row-identity.test.ts src/renderer/src/store/slices/agent-status/agent-status-entry-contracts.test.ts --maxWorkers=2", "result": "passed", "durationSeconds": 180.43, "summary": "Final implementation passes 64 tests in six files, including local/relay finished-provider replacement, stale-provider replacement, 32-child ownership, legacy remote snapshots, turn clocks and renderer identity." diff --git a/config/scripts/agent-status-hot-path-benchmark.ts b/config/scripts/agent-status-hot-path-benchmark.ts index 2fbb8e3e4e4..e2604ce3853 100644 --- a/config/scripts/agent-status-hot-path-benchmark.ts +++ b/config/scripts/agent-status-hot-path-benchmark.ts @@ -6,8 +6,9 @@ import { tmpdir } from 'node:os' import { join } from 'node:path' import { describe, expect, it } from 'vitest' import type { AppState } from '@/store/types' -import type { AgentStatusBatchUpdate } from '@/store/slices/agent-status' -import { MAX_LIVE_AGENT_STATUSES } from '@/store/slices/agent-status' +import type { AgentStatusBatchUpdate } from '@/store/slices/agent-status/agent-status-contract' +import '@/store/slices/agent-status' +import { MAX_LIVE_AGENT_STATUSES } from '@/store/slices/agent-status/agent-status-capacity-eviction' import { createTestStore, makeTab, diff --git a/config/scripts/ci-shard-timings.json b/config/scripts/ci-shard-timings.json index 9230ecedfba..77ae203c219 100644 --- a/config/scripts/ci-shard-timings.json +++ b/config/scripts/ci-shard-timings.json @@ -10618,7 +10618,7 @@ "src/renderer/src/store/slices/agent-status-live-map-leak.test.ts": 2819, "src/renderer/src/store/slices/agent-status-main-agent-fact.test.ts": 1531, "src/renderer/src/store/slices/agent-status-manual-sleep-capture.test.ts": 1409, - "src/renderer/src/store/slices/agent-status-pane-keyed-records.test.ts": 56, + "src/renderer/src/store/slices/agent-status/agent-status-pane-keyed-records.test.ts": 56, "src/renderer/src/store/slices/agent-status-pr-refresh-handoff.test.ts": 1240, "src/renderer/src/store/slices/agent-status-provider-session.test.ts": 1400, "src/renderer/src/store/slices/agent-status-quit-capture-resumable-agents.test.ts": 1480, diff --git a/src/renderer/src/components/activity/ActivityPrototypePage-test-fixtures.ts b/src/renderer/src/components/activity/ActivityPrototypePage-test-fixtures.ts index 8656da9aff3..ab243d82797 100644 --- a/src/renderer/src/components/activity/ActivityPrototypePage-test-fixtures.ts +++ b/src/renderer/src/components/activity/ActivityPrototypePage-test-fixtures.ts @@ -3,7 +3,7 @@ import type { Repo } from '../../../../shared/repo-types' import { makePaneKey } from '../../../../shared/stable-pane-id' import type { TerminalTab } from '../../../../shared/terminal-tab-types' import type { Worktree } from '../../../../shared/worktree/types' -import type { RetainedAgentEntry } from '@/store/slices/agent-status' +import type { RetainedAgentEntry } from '@/store/slices/agent-status/agent-status-contract' import { buildActivityEvents } from './activity-event-builder' import { buildAgentPaneThreads } from './activity-thread-builder' diff --git a/src/renderer/src/components/activity/activity-clear-completed-hmr.test.ts b/src/renderer/src/components/activity/activity-clear-completed-hmr.test.ts index 1ea5d3b2c94..9e6cdda5533 100644 --- a/src/renderer/src/components/activity/activity-clear-completed-hmr.test.ts +++ b/src/renderer/src/components/activity/activity-clear-completed-hmr.test.ts @@ -1,6 +1,6 @@ // @vitest-environment happy-dom import { afterEach, beforeEach, expect, it, vi } from 'vitest' -import type { RetainedAgentEntry } from '@/store/slices/agent-status' +import type { RetainedAgentEntry } from '@/store/slices/agent-status/agent-status-contract' import type { ActivityEvent, AgentPaneThread } from './activity-thread-types' import { makeTab, makeWorktree } from './ActivityPrototypePage-test-fixtures' diff --git a/src/renderer/src/components/activity/activity-clear-completed.test.ts b/src/renderer/src/components/activity/activity-clear-completed.test.ts index e5aa4771a86..ada3b60b1e2 100644 --- a/src/renderer/src/components/activity/activity-clear-completed.test.ts +++ b/src/renderer/src/components/activity/activity-clear-completed.test.ts @@ -1,5 +1,5 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' -import type { RetainedAgentEntry } from '@/store/slices/agent-status' +import type { RetainedAgentEntry } from '@/store/slices/agent-status/agent-status-contract' import type { ActivityEvent, AgentPaneThread } from './activity-thread-types' import { makeTab, makeWorktree } from './ActivityPrototypePage-test-fixtures' diff --git a/src/renderer/src/components/activity/activity-clear-completed.ts b/src/renderer/src/components/activity/activity-clear-completed.ts index 4d0b2e94786..3fc48fc9eb7 100644 --- a/src/renderer/src/components/activity/activity-clear-completed.ts +++ b/src/renderer/src/components/activity/activity-clear-completed.ts @@ -1,7 +1,7 @@ import { toast } from 'sonner' import { useAppStore } from '@/store' import { translate } from '@/i18n/i18n' -import type { RetainedAgentEntry } from '@/store/slices/agent-status' +import type { RetainedAgentEntry } from '@/store/slices/agent-status/agent-status-contract' import type { AgentStatusCacheIdentity } from '../../../../shared/agent-status-types' import { activityThreadStatusId } from './activity-thread-presentation' import type { AgentPaneThread } from './activity-thread-types' diff --git a/src/renderer/src/components/activity/activity-event-builder.identity-reuse.test.ts b/src/renderer/src/components/activity/activity-event-builder.identity-reuse.test.ts index d8a87ab9bed..dcd131dae32 100644 --- a/src/renderer/src/components/activity/activity-event-builder.identity-reuse.test.ts +++ b/src/renderer/src/components/activity/activity-event-builder.identity-reuse.test.ts @@ -3,7 +3,7 @@ import type { AgentStatusEntry, AgentStateHistoryEntry } from '../../../../shared/agent-status-types' -import type { RetainedAgentEntry } from '@/store/slices/agent-status' +import type { RetainedAgentEntry } from '@/store/slices/agent-status/agent-status-contract' import { makePaneKey } from '../../../../shared/stable-pane-id' import { buildActivityEvents, diff --git a/src/renderer/src/components/activity/activity-event-builder.ts b/src/renderer/src/components/activity/activity-event-builder.ts index 66bfbe28b79..fb1b5e649fb 100644 --- a/src/renderer/src/components/activity/activity-event-builder.ts +++ b/src/renderer/src/components/activity/activity-event-builder.ts @@ -1,5 +1,5 @@ import { freshActivityLiveAgentState } from './activity-event-state' -import type { RetainedAgentEntry } from '@/store/slices/agent-status' +import type { RetainedAgentEntry } from '@/store/slices/agent-status/agent-status-contract' import type { AgentStatusEntry, AgentStatusOrchestrationContext, diff --git a/src/renderer/src/components/automations/automation-run-completion-evidence.test.ts b/src/renderer/src/components/automations/automation-run-completion-evidence.test.ts index f46426337a8..c30c4e42d71 100644 --- a/src/renderer/src/components/automations/automation-run-completion-evidence.test.ts +++ b/src/renderer/src/components/automations/automation-run-completion-evidence.test.ts @@ -1,7 +1,7 @@ import { describe, expect, it } from 'vitest' import type { AutomationRun } from '../../../../shared/automations-types' import type { AgentStatusEntry } from '../../../../shared/agent-status-types' -import type { RetainedAgentEntry } from '@/store/slices/agent-status' +import type { RetainedAgentEntry } from '@/store/slices/agent-status/agent-status-contract' import { hasAutomationRunCompletionEvidence } from './automation-run-completion-evidence' const PANE = 'tab-1:11111111-1111-4111-8111-111111111111' diff --git a/src/renderer/src/components/automations/automation-run-completion-evidence.ts b/src/renderer/src/components/automations/automation-run-completion-evidence.ts index 26c0b0ffc93..7a39628174b 100644 --- a/src/renderer/src/components/automations/automation-run-completion-evidence.ts +++ b/src/renderer/src/components/automations/automation-run-completion-evidence.ts @@ -1,6 +1,6 @@ import type { AutomationRun } from '../../../../shared/automations-types' import type { AgentStatusEntry } from '../../../../shared/agent-status-types' -import type { RetainedAgentEntry } from '@/store/slices/agent-status' +import type { RetainedAgentEntry } from '@/store/slices/agent-status/agent-status-contract' import { automationRunMatchesPaneKey } from './automation-run-open-target' function isCompletionAfterDispatch(entry: AgentStatusEntry, dispatchedAt: number): boolean { diff --git a/src/renderer/src/components/dashboard/build-dashboard-snapshot.rows-cache.test.ts b/src/renderer/src/components/dashboard/build-dashboard-snapshot.rows-cache.test.ts index 2b29e47720d..fb73aa9bd22 100644 --- a/src/renderer/src/components/dashboard/build-dashboard-snapshot.rows-cache.test.ts +++ b/src/renderer/src/components/dashboard/build-dashboard-snapshot.rows-cache.test.ts @@ -3,7 +3,7 @@ import type { AgentStatusEntry } from '../../../../shared/agent-status-types' import { makePaneKey } from '../../../../shared/stable-pane-id' import type { TerminalTab } from '../../../../shared/terminal-tab-types' import type { Worktree } from '../../../../shared/worktree/types' -import type { RetainedAgentEntry } from '@/store/slices/agent-status' +import type { RetainedAgentEntry } from '@/store/slices/agent-status/agent-status-contract' import { buildDashboardSnapshot, type DashboardSnapshotInput as DashboardSnapshotState diff --git a/src/renderer/src/components/dashboard/useRetainedAgents.ts b/src/renderer/src/components/dashboard/useRetainedAgents.ts index ea0106d5274..412ba7cabfe 100644 --- a/src/renderer/src/components/dashboard/useRetainedAgents.ts +++ b/src/renderer/src/components/dashboard/useRetainedAgents.ts @@ -3,7 +3,7 @@ import { useShallow } from 'zustand/react/shallow' import { useAppStore } from '@/store' import { isExplicitAgentStatusFresh } from '@/lib/agent-status' import type { DashboardAgentRow } from './useDashboardData' -import type { RetainedAgentEntry } from '@/store/slices/agent-status' +import type { RetainedAgentEntry } from '@/store/slices/agent-status/agent-status-contract' import type { FolderWorkspace } from '../../../../shared/folder-workspace-types' import type { Repo } from '../../../../shared/repo-types' import type { TerminalTab } from '../../../../shared/terminal-tab-types' diff --git a/src/renderer/src/components/dashboard/worktree-agent-rows-cache.ts b/src/renderer/src/components/dashboard/worktree-agent-rows-cache.ts index 94e62fe8fd5..00e07d8e728 100644 --- a/src/renderer/src/components/dashboard/worktree-agent-rows-cache.ts +++ b/src/renderer/src/components/dashboard/worktree-agent-rows-cache.ts @@ -5,7 +5,7 @@ import type { } from '../../../../shared/agent-status-types' import type { TerminalLayoutSnapshot, TerminalTab } from '../../../../shared/terminal-tab-types' import { migrationUnsupportedToAgentStatusEntry } from '../../../../shared/migration-unsupported-agent-entry' -import type { RetainedAgentEntry } from '@/store/slices/agent-status' +import type { RetainedAgentEntry } from '@/store/slices/agent-status/agent-status-contract' import type { AppState } from '@/store/types' import { applyAgentRowLineage, type DashboardAgentRowWithLineage } from './agent-row-lineage' import { buildWorktreeAgentRows } from '../sidebar/worktree-agent-rows' diff --git a/src/renderer/src/components/native-chat/structured-agent-session-status-projection.ts b/src/renderer/src/components/native-chat/structured-agent-session-status-projection.ts index e68a47a439d..dfa601f6e77 100644 --- a/src/renderer/src/components/native-chat/structured-agent-session-status-projection.ts +++ b/src/renderer/src/components/native-chat/structured-agent-session-status-projection.ts @@ -27,7 +27,7 @@ import { structuredAgentSessionRowStateStartedAt } from '../../../../shared/structured-agent-session-status-started-at' import { agentMainAgentVerdict } from '../../../../shared/agent-main-agent-verdict' -import type { AgentStatusBatchTransaction } from '@/store/slices/agent-status-contract' +import type { AgentStatusBatchTransaction } from '@/store/slices/agent-status/agent-status-contract' import type { StructuredTab } from './structured-agent-session-tabs' /** Copy modern child views verbatim; convert legacy host task lists and retain the legacy live-agent roster. */ diff --git a/src/renderer/src/components/sidebar/useWorktreeAgentRows.test.ts b/src/renderer/src/components/sidebar/useWorktreeAgentRows.test.ts index 37a685ce0ff..fb0d330d2da 100644 --- a/src/renderer/src/components/sidebar/useWorktreeAgentRows.test.ts +++ b/src/renderer/src/components/sidebar/useWorktreeAgentRows.test.ts @@ -4,7 +4,7 @@ import { type AgentStatusEntry } from '../../../../shared/agent-status-types' import type { TerminalLayoutSnapshot, TerminalTab } from '../../../../shared/terminal-tab-types' -import type { RetainedAgentEntry } from '@/store/slices/agent-status' +import type { RetainedAgentEntry } from '@/store/slices/agent-status/agent-status-contract' import { applyAgentRowLineage } from '@/components/dashboard/agent-row-lineage' import { makePaneKey } from '../../../../shared/stable-pane-id' import { comparePaneKeysOrdinal } from './worktree-agent-row-order' diff --git a/src/renderer/src/components/sidebar/worktree-agent-orchestration-batch.test.ts b/src/renderer/src/components/sidebar/worktree-agent-orchestration-batch.test.ts index 39e8cac67f4..7000ae8ac9f 100644 --- a/src/renderer/src/components/sidebar/worktree-agent-orchestration-batch.test.ts +++ b/src/renderer/src/components/sidebar/worktree-agent-orchestration-batch.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from 'vitest' -import type { RetainedAgentEntry } from '@/store/slices/agent-status' +import type { RetainedAgentEntry } from '@/store/slices/agent-status/agent-status-contract' import type { AgentStatusEntry, AgentStatusOrchestrationContext diff --git a/src/renderer/src/components/sidebar/worktree-agent-orchestration-index.test.ts b/src/renderer/src/components/sidebar/worktree-agent-orchestration-index.test.ts index f86bc34c850..e967f382b3e 100644 --- a/src/renderer/src/components/sidebar/worktree-agent-orchestration-index.test.ts +++ b/src/renderer/src/components/sidebar/worktree-agent-orchestration-index.test.ts @@ -3,7 +3,7 @@ import type { AgentStatusEntry, AgentStatusOrchestrationContext } from '../../../../shared/agent-status-types' -import type { RetainedAgentEntry } from '@/store/slices/agent-status' +import type { RetainedAgentEntry } from '@/store/slices/agent-status/agent-status-contract' import type { TerminalTab } from '../../../../shared/terminal-tab-types' import { makePaneKey, parsePaneKey } from '../../../../shared/stable-pane-id' import { diff --git a/src/renderer/src/components/sidebar/worktree-agent-row-selectors.test.ts b/src/renderer/src/components/sidebar/worktree-agent-row-selectors.test.ts index c29aa9e71b4..d5a116bc035 100644 --- a/src/renderer/src/components/sidebar/worktree-agent-row-selectors.test.ts +++ b/src/renderer/src/components/sidebar/worktree-agent-row-selectors.test.ts @@ -5,7 +5,7 @@ import type { } from '../../../../shared/agent-status-types' import type { Tab } from '../../../../shared/tab-types' import type { TerminalTab } from '../../../../shared/terminal-tab-types' -import type { RetainedAgentEntry } from '@/store/slices/agent-status' +import type { RetainedAgentEntry } from '@/store/slices/agent-status/agent-status-contract' import { makePaneKey } from '../../../../shared/stable-pane-id' import { getLiveEntriesFullRebuildCountForTests } from './worktree-agent-live-index-patch' import { diff --git a/src/renderer/src/components/sidebar/worktree-agent-row-selectors.ts b/src/renderer/src/components/sidebar/worktree-agent-row-selectors.ts index 288ba27502e..7828bc62464 100644 --- a/src/renderer/src/components/sidebar/worktree-agent-row-selectors.ts +++ b/src/renderer/src/components/sidebar/worktree-agent-row-selectors.ts @@ -1,4 +1,4 @@ -import type { RetainedAgentEntry } from '@/store/slices/agent-status' +import type { RetainedAgentEntry } from '@/store/slices/agent-status/agent-status-contract' import type { AppState } from '@/store/types' import type { AgentStatusEntry, diff --git a/src/renderer/src/components/sidebar/worktree-agent-rows.ts b/src/renderer/src/components/sidebar/worktree-agent-rows.ts index 8bd14979986..6f46eb6e06f 100644 --- a/src/renderer/src/components/sidebar/worktree-agent-rows.ts +++ b/src/renderer/src/components/sidebar/worktree-agent-rows.ts @@ -1,6 +1,6 @@ import type { DashboardAgentRow } from '@/components/dashboard/useDashboardData' import { isExplicitAgentStatusFresh } from '@/lib/agent-status' -import type { RetainedAgentEntry } from '@/store/slices/agent-status' +import type { RetainedAgentEntry } from '@/store/slices/agent-status/agent-status-contract' import { AGENT_STATUS_STALE_AFTER_MS, type AgentStatusEntry, diff --git a/src/renderer/src/components/terminal-pane/pty-connection-agent-session-resume.spec.ts b/src/renderer/src/components/terminal-pane/pty-connection-agent-session-resume.spec.ts index 927dbc21746..6f24a789a3d 100644 --- a/src/renderer/src/components/terminal-pane/pty-connection-agent-session-resume.spec.ts +++ b/src/renderer/src/components/terminal-pane/pty-connection-agent-session-resume.spec.ts @@ -21,7 +21,7 @@ import { import { buildPaneConnectionDeps } from './pty-connection-test-deps' import { createInitialStoreState } from './pty-connection-test-store-fixtures' import type { StoreState } from './pty-connection-test-store-state' -import type { AgentStatusSlice } from '@/store/slices/agent-status-slice-contract' +import type { AgentStatusSlice } from '@/store/slices/agent-status/agent-status-slice-contract' import { normalizeLaunchConfigRegistrationMetadata } from '@/store/slices/agent-status-launch-config' import type { MockTransport } from './pty-connection-test-pane-fixtures' import { diff --git a/src/renderer/src/components/terminal-pane/pty-connection/saved-resume-cancellation.test.ts b/src/renderer/src/components/terminal-pane/pty-connection/saved-resume-cancellation.test.ts index 6291ea78499..c79e2c342d9 100644 --- a/src/renderer/src/components/terminal-pane/pty-connection/saved-resume-cancellation.test.ts +++ b/src/renderer/src/components/terminal-pane/pty-connection/saved-resume-cancellation.test.ts @@ -3,7 +3,7 @@ import type { AgentStatusEntry } from '../../../../../shared/agent-status-types' import type { AgentLaunchConfigRegistryEntry, AgentLaunchConfigRegistrationMetadata -} from '@/store/slices/agent-status-contract' +} from '@/store/slices/agent-status/agent-status-contract' import type { ColdRestoreAgentResumeStartup } from './fresh-spawn-types' import type { ConnectPanePtySession } from './connect-pane-pty-session' import { bindSettlePaneSerializer } from './pane-serializer-settle' diff --git a/src/renderer/src/components/terminal-pane/remote-runtime-saved-result-consumer.test.ts b/src/renderer/src/components/terminal-pane/remote-runtime-saved-result-consumer.test.ts index 1418390a598..399fbd6858b 100644 --- a/src/renderer/src/components/terminal-pane/remote-runtime-saved-result-consumer.test.ts +++ b/src/renderer/src/components/terminal-pane/remote-runtime-saved-result-consumer.test.ts @@ -1,7 +1,7 @@ import { afterEach, beforeEach, expect, it, vi } from 'vitest' import type { TerminalAttachmentLaunchResult } from '../../../../shared/terminal-attachment-launch-result' import type { ConnectPanePtySession } from './pty-connection/connect-pane-pty-session' -import type { AgentLaunchConfigRegistryEntry } from '@/store/slices/agent-status-contract' +import type { AgentLaunchConfigRegistryEntry } from '@/store/slices/agent-status/agent-status-contract' import { bindCaptureTransportOutputCallbacks } from './pty-connection/transport-output-callbacks' import { bindSettlePaneSerializer } from './pty-connection/pane-serializer-settle' import { applyTerminalLaunchResult } from './pty-connection/terminal-launch-result-policy' diff --git a/src/renderer/src/hooks/ipc-events-agent-status-store-test-fixtures.ts b/src/renderer/src/hooks/ipc-events-agent-status-store-test-fixtures.ts index ac581720b2a..a037ef471cc 100644 --- a/src/renderer/src/hooks/ipc-events-agent-status-store-test-fixtures.ts +++ b/src/renderer/src/hooks/ipc-events-agent-status-store-test-fixtures.ts @@ -2,7 +2,7 @@ import { expect, vi } from 'vitest' import type { AgentStatusBatchTransaction, AgentStatusBatchUpdate -} from '../store/slices/agent-status' +} from '../store/slices/agent-status/agent-status-contract' import type { AppState } from '../store/types' import { makePaneKey } from '../../../shared/stable-pane-id' diff --git a/src/renderer/src/hooks/ipc-events/agent-status-bridge-types.ts b/src/renderer/src/hooks/ipc-events/agent-status-bridge-types.ts index c5d827eea73..1a5cddde50c 100644 --- a/src/renderer/src/hooks/ipc-events/agent-status-bridge-types.ts +++ b/src/renderer/src/hooks/ipc-events/agent-status-bridge-types.ts @@ -1,5 +1,5 @@ import type { AgentStatusIpcPayload } from '../../../../shared/agent-status-types' -import type { AgentStatusBatchTransaction } from '@/store/slices/agent-status' +import type { AgentStatusBatchTransaction } from '@/store/slices/agent-status/agent-status-contract' import type { AgentStatusPaneRoutingIndex } from './agent-status-pane-routing-index' export type PendingAgentStatusEvent = { diff --git a/src/renderer/src/hooks/ipc-events/agent-status-event-applicator.ts b/src/renderer/src/hooks/ipc-events/agent-status-event-applicator.ts index 17c7d65fe85..496ad1fb2e9 100644 --- a/src/renderer/src/hooks/ipc-events/agent-status-event-applicator.ts +++ b/src/renderer/src/hooks/ipc-events/agent-status-event-applicator.ts @@ -6,7 +6,7 @@ import { normalizeProgramStatusFacet } from '../../../../shared/program-status/f import { resolveAgentStatusTerminalTitle } from '@/lib/agent-status-terminal-title' import { track } from '@/lib/telemetry' import { resolveAgentPaneAuthorityKey } from '@/store/slices/agent-pane-authority' -import type { AgentStatusUpdate } from '@/store/slices/agent-status' +import type { AgentStatusUpdate } from '@/store/slices/agent-status/agent-status-contract' import { observeAgentHookCompletionForNotification } from '../agent-hook-completion-notifications' import { useAppStore } from '../../store' import { diff --git a/src/renderer/src/hooks/ipc-events/agent-status-partial-updates.ts b/src/renderer/src/hooks/ipc-events/agent-status-partial-updates.ts index f8dc3bd7815..7c265e49db2 100644 --- a/src/renderer/src/hooks/ipc-events/agent-status-partial-updates.ts +++ b/src/renderer/src/hooks/ipc-events/agent-status-partial-updates.ts @@ -4,7 +4,7 @@ import type { AppState } from '@/store/types' import type { AgentProgramStatusUpdate, AgentProviderSessionUpdate -} from '@/store/slices/agent-status' +} from '@/store/slices/agent-status/agent-status-contract' import type { AgentStatusApplyResult, AgentStatusBatchContext, diff --git a/src/renderer/src/hooks/ipc-events/agent-status-pending-retry-gate.test.ts b/src/renderer/src/hooks/ipc-events/agent-status-pending-retry-gate.test.ts index 51e8161a8fc..4d9aa567bcf 100644 --- a/src/renderer/src/hooks/ipc-events/agent-status-pending-retry-gate.test.ts +++ b/src/renderer/src/hooks/ipc-events/agent-status-pending-retry-gate.test.ts @@ -1,5 +1,5 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' -import type { AgentStatusBatchUpdate } from '../../store/slices/agent-status' +import type { AgentStatusBatchUpdate } from '../../store/slices/agent-status/agent-status-contract' import { buildStoreState, FUTURE_LEAF_ID, diff --git a/src/renderer/src/hooks/ipc-events/normalize-agent-status-event.ts b/src/renderer/src/hooks/ipc-events/normalize-agent-status-event.ts index db629b9467c..36020d44fc0 100644 --- a/src/renderer/src/hooks/ipc-events/normalize-agent-status-event.ts +++ b/src/renderer/src/hooks/ipc-events/normalize-agent-status-event.ts @@ -1,4 +1,4 @@ -import type { AgentStatusMetadata } from '../../store/slices/agent-status-contract' +import type { AgentStatusMetadata } from '../../store/slices/agent-status/agent-status-contract' import { normalizeAgentStatusPayload, type AgentStatusIpcPayload, diff --git a/src/renderer/src/hooks/useIpcEvents-agent-status-batch-projection.test.ts b/src/renderer/src/hooks/useIpcEvents-agent-status-batch-projection.test.ts index 66b86eacf55..198d4e8ad07 100644 --- a/src/renderer/src/hooks/useIpcEvents-agent-status-batch-projection.test.ts +++ b/src/renderer/src/hooks/useIpcEvents-agent-status-batch-projection.test.ts @@ -5,7 +5,10 @@ import { makeWorktree, TEST_REPO } from '../store/slices/store-test-helpers' -import type { AgentStatusBatchUpdate, AgentStatusUpdate } from '../store/slices/agent-status' +import type { + AgentStatusBatchUpdate, + AgentStatusUpdate +} from '../store/slices/agent-status/agent-status-contract' import type { AppState } from '../store/types' import { makePaneKey } from '../../../shared/stable-pane-id' import { folderWorkspaceKey } from '../../../shared/workspace-scope' diff --git a/src/renderer/src/hooks/useIpcEvents-agent-status-queue-ordering.test.ts b/src/renderer/src/hooks/useIpcEvents-agent-status-queue-ordering.test.ts index d5890c3739b..3dab8474f99 100644 --- a/src/renderer/src/hooks/useIpcEvents-agent-status-queue-ordering.test.ts +++ b/src/renderer/src/hooks/useIpcEvents-agent-status-queue-ordering.test.ts @@ -1,5 +1,5 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' -import type { AgentStatusUpdate } from '../store/slices/agent-status' +import type { AgentStatusUpdate } from '../store/slices/agent-status/agent-status-contract' import { buildStoreState, expectWorktreeRouting, diff --git a/src/renderer/src/hooks/useReadOnScreenAttention.test.ts b/src/renderer/src/hooks/useReadOnScreenAttention.test.ts index bf766b3898a..2e04b03ba7d 100644 --- a/src/renderer/src/hooks/useReadOnScreenAttention.test.ts +++ b/src/renderer/src/hooks/useReadOnScreenAttention.test.ts @@ -6,7 +6,7 @@ import { resolveViewedUnreadSubjectKey } from '@/attention/agent-attention-acknowledgement' import { createTestStore, makeTab, makeUnifiedTab } from '../store/slices/store-test-helpers' -import type { RetainedAgentEntry } from '../store/slices/agent-status' +import type { RetainedAgentEntry } from '../store/slices/agent-status/agent-status-contract' import { FLOATING_TERMINAL_WORKTREE_ID, getDefaultSettings } from '../../../shared/constants' import { makePaneKey } from '../../../shared/stable-pane-id' diff --git a/src/renderer/src/lib/automation-terminal-ownership.ts b/src/renderer/src/lib/automation-terminal-ownership.ts index f081f5e7d09..18aa49b430a 100644 --- a/src/renderer/src/lib/automation-terminal-ownership.ts +++ b/src/renderer/src/lib/automation-terminal-ownership.ts @@ -3,7 +3,8 @@ import { useAppStore } from '@/store' import type { AppState } from '@/store/types' import type { TerminalTab } from '../../../shared/terminal-tab-types' import { parsePaneKey } from '../../../shared/stable-pane-id' -import { collectSleepingAgentSessionRecordsForWorktree } from '@/store/slices/agent-status' +import '@/store/slices/agent-status' +import { collectSleepingAgentSessionRecordsForWorktree } from '@/store/slices/agent-status/agent-status-recovery-collection' import { singlePaneLayoutSnapshot } from '@/store/slices/terminal-helpers' import { readLastTerminalInputAt } from './terminal-input-activity-coalescing' diff --git a/src/renderer/src/lib/open-tab-occupant-agent.test.ts b/src/renderer/src/lib/open-tab-occupant-agent.test.ts index 73d5bab63a8..63c85163d21 100644 --- a/src/renderer/src/lib/open-tab-occupant-agent.test.ts +++ b/src/renderer/src/lib/open-tab-occupant-agent.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from 'vitest' -import type { RetainedAgentEntry } from '@/store/slices/agent-status' +import type { RetainedAgentEntry } from '@/store/slices/agent-status/agent-status-contract' import type { SleepingAgentSessionRecord } from '../../../shared/agent-session-resume' import type { AgentStatusEntry } from '../../../shared/agent-status-types' import { makePaneKey } from '../../../shared/stable-pane-id' diff --git a/src/renderer/src/lib/open-tab-occupant-agent.ts b/src/renderer/src/lib/open-tab-occupant-agent.ts index dc001fd68f0..6a43c220df8 100644 --- a/src/renderer/src/lib/open-tab-occupant-agent.ts +++ b/src/renderer/src/lib/open-tab-occupant-agent.ts @@ -1,4 +1,4 @@ -import type { RetainedAgentEntry } from '@/store/slices/agent-status' +import type { RetainedAgentEntry } from '@/store/slices/agent-status/agent-status-contract' import type { PaneForegroundAgentEntry } from '@/store/slices/pane-foreground-agent' import type { SleepingAgentSessionRecord } from '../../../shared/agent-session-resume' import type { AgentStatusEntry } from '../../../shared/agent-status-types' diff --git a/src/renderer/src/lib/tab-agent-status-index.test.ts b/src/renderer/src/lib/tab-agent-status-index.test.ts index de684a9d784..f42844145b2 100644 --- a/src/renderer/src/lib/tab-agent-status-index.test.ts +++ b/src/renderer/src/lib/tab-agent-status-index.test.ts @@ -16,7 +16,7 @@ import type { } from '../../../shared/agent-status-types' import type { TerminalLayoutSnapshot, TerminalTab } from '../../../shared/terminal-tab-types' import type { TerminalAgent } from '../../../shared/terminal-agent' -import type { RetainedAgentEntry } from '@/store/slices/agent-status' +import type { RetainedAgentEntry } from '@/store/slices/agent-status/agent-status-contract' // Keep pre-index scans as the randomized differential oracle for exact resolver behavior. diff --git a/src/renderer/src/lib/tab-agent-status-index.ts b/src/renderer/src/lib/tab-agent-status-index.ts index 2e5980ed9e2..5aa0e40ed0a 100644 --- a/src/renderer/src/lib/tab-agent-status-index.ts +++ b/src/renderer/src/lib/tab-agent-status-index.ts @@ -1,7 +1,7 @@ import type { AgentStatusEntry } from '../../../shared/agent-status-types' import type { TerminalAgent } from '../../../shared/terminal-agent' import { parsePaneKey } from '../../../shared/stable-pane-id' -import type { RetainedAgentEntry } from '@/store/slices/agent-status' +import type { RetainedAgentEntry } from '@/store/slices/agent-status/agent-status-contract' import { agentTypeToIconAgent } from './agent-status' /** Index iconable panes once per status-map identity instead of scanning globally per mounted tab. Preserve insertion order: first-match resolution decides split-tab icons. */ diff --git a/src/renderer/src/lib/tab-agent.test.ts b/src/renderer/src/lib/tab-agent.test.ts index 29a88501145..7b4747cc02a 100644 --- a/src/renderer/src/lib/tab-agent.test.ts +++ b/src/renderer/src/lib/tab-agent.test.ts @@ -10,7 +10,7 @@ import { import type { AgentStatusEntry, AgentType } from '../../../shared/agent-status-types' import type { TerminalLayoutSnapshot, TerminalTab } from '../../../shared/terminal-tab-types' import type { TerminalAgent } from '../../../shared/terminal-agent' -import type { RetainedAgentEntry } from '@/store/slices/agent-status' +import type { RetainedAgentEntry } from '@/store/slices/agent-status/agent-status-contract' // Compose focused then sibling resolution exactly as useTabAgent does. function resolveTabAgent( diff --git a/src/renderer/src/lib/tab-agent.ts b/src/renderer/src/lib/tab-agent.ts index 85228e9633b..bf70acca8a5 100644 --- a/src/renderer/src/lib/tab-agent.ts +++ b/src/renderer/src/lib/tab-agent.ts @@ -2,7 +2,7 @@ import type { AgentStatusEntry } from '../../../shared/agent-status-types' import type { TerminalLayoutSnapshot } from '../../../shared/terminal-tab-types' import type { TerminalAgent } from '../../../shared/terminal-agent' import { isTerminalLeafId, makePaneKey } from '../../../shared/stable-pane-id' -import type { RetainedAgentEntry } from '@/store/slices/agent-status' +import type { RetainedAgentEntry } from '@/store/slices/agent-status/agent-status-contract' import { agentTypeToIconAgent } from './agent-status' import { firstTabAgentExcludingLeaf, diff --git a/src/renderer/src/lib/use-tab-agent-retained-identity.test.ts b/src/renderer/src/lib/use-tab-agent-retained-identity.test.ts index 2fa9cfec7b7..3a24c207453 100644 --- a/src/renderer/src/lib/use-tab-agent-retained-identity.test.ts +++ b/src/renderer/src/lib/use-tab-agent-retained-identity.test.ts @@ -4,7 +4,7 @@ import { act, createElement } from 'react' import { createRoot, type Root } from 'react-dom/client' import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' import { useAppStore } from '@/store' -import type { RetainedAgentEntry } from '@/store/slices/agent-status' +import type { RetainedAgentEntry } from '@/store/slices/agent-status/agent-status-contract' import type { AgentStatusEntry, AgentType } from '../../../shared/agent-status-types' import { makePaneKey } from '../../../shared/stable-pane-id' import type { TerminalLayoutSnapshot, TerminalTab } from '../../../shared/terminal-tab-types' diff --git a/src/renderer/src/lib/workspace-tab-agent-metadata.ts b/src/renderer/src/lib/workspace-tab-agent-metadata.ts index 2583d76a312..9d0aa9ae4d9 100644 --- a/src/renderer/src/lib/workspace-tab-agent-metadata.ts +++ b/src/renderer/src/lib/workspace-tab-agent-metadata.ts @@ -1,4 +1,4 @@ -import type { RetainedAgentEntry } from '@/store/slices/agent-status' +import type { RetainedAgentEntry } from '@/store/slices/agent-status/agent-status-contract' import type { AgentStatusEntry } from '../../../shared/agent-status-types' import type { SleepingAgentSessionRecord } from '../../../shared/agent-session-resume' import { agentStatusEvidenceObservedAt } from '../../../shared/agent-status-freshness' diff --git a/src/renderer/src/lib/workspace-tab-palette-search.test.ts b/src/renderer/src/lib/workspace-tab-palette-search.test.ts index 819d7a8e3ed..11054ad0746 100644 --- a/src/renderer/src/lib/workspace-tab-palette-search.test.ts +++ b/src/renderer/src/lib/workspace-tab-palette-search.test.ts @@ -1,6 +1,6 @@ import path from 'node:path' import { describe, expect, it } from 'vitest' -import type { RetainedAgentEntry } from '@/store/slices/agent-status' +import type { RetainedAgentEntry } from '@/store/slices/agent-status/agent-status-contract' import type { OpenFile } from '@/store/slices/editor' import type { AgentStatusEntry } from '../../../shared/agent-status-types' import type { SleepingAgentSessionRecord } from '../../../shared/agent-session-resume' diff --git a/src/renderer/src/store/slices/activity-cleared-at.test.ts b/src/renderer/src/store/slices/activity-cleared-at.test.ts index 65bad6ce90f..917d174f03c 100644 --- a/src/renderer/src/store/slices/activity-cleared-at.test.ts +++ b/src/renderer/src/store/slices/activity-cleared-at.test.ts @@ -2,7 +2,7 @@ import { afterEach, describe, expect, it, vi } from 'vitest' import type { AgentStatusEntry } from '../../../../shared/agent-status-types' import { AGENT_STATUS_HYDRATE_MAX_AGE_MS } from '../../../../shared/agent-status-freshness' import type { TerminalTab } from '../../../../shared/terminal-tab-types' -import type { RetainedAgentEntry } from './agent-status' +import type { RetainedAgentEntry } from './agent-status/agent-status-contract' import { createTestStore } from './store-test-helpers' import { sanitizeAcknowledgedAgentsByPaneKey, diff --git a/src/renderer/src/store/slices/agent-status-authority-actions.ts b/src/renderer/src/store/slices/agent-status-authority-actions.ts index 53593369704..0e5e99dcc5c 100644 --- a/src/renderer/src/store/slices/agent-status-authority-actions.ts +++ b/src/renderer/src/store/slices/agent-status-authority-actions.ts @@ -1,4 +1,4 @@ -import type { AgentStatusSlice } from './agent-status-slice-contract' +import type { AgentStatusSlice } from './agent-status/agent-status-slice-contract' import type { AgentStatusRuntime } from './agent-status-runtime' import { rendererAgentStatusObservations } from '../../lib/renderer-agent-status-observations' import { @@ -10,7 +10,7 @@ import { boundRecentlyRetiredAgentStatusPaneKeys, movePaneKeyedRecord, removePaneKeys -} from './agent-status-pane-keyed-records' +} from './agent-status/agent-status-pane-keyed-records' import { getLeafIdFromPaneKey, getTabIdFromPaneKey, diff --git a/src/renderer/src/store/slices/agent-status-batch.test.ts b/src/renderer/src/store/slices/agent-status-batch.test.ts index f767e4b70ae..1fe24a20841 100644 --- a/src/renderer/src/store/slices/agent-status-batch.test.ts +++ b/src/renderer/src/store/slices/agent-status-batch.test.ts @@ -4,11 +4,12 @@ import { type AgentStatusEntry } from '../../../../shared/agent-status-types' import type { AppState } from '../types' -import { - MAX_LIVE_AGENT_STATUSES, - type AgentStatusBatchUpdate, - type RetainedAgentEntry -} from './agent-status' +import './agent-status' +import { MAX_LIVE_AGENT_STATUSES } from './agent-status/agent-status-capacity-eviction' +import type { + AgentStatusBatchUpdate, + RetainedAgentEntry +} from './agent-status/agent-status-contract' import type { GeneratedTabTitleUpdate } from './terminal-tab-title-batch' import { createTestStore, makeTab, makeUnifiedTab } from './store-test-helpers' import { ORCA_LAYOUT_OWNER_IS_MAIN } from '../../../../shared/layout-owner-switch' diff --git a/src/renderer/src/store/slices/agent-status-cleanup-actions.ts b/src/renderer/src/store/slices/agent-status-cleanup-actions.ts index dc52484c0ce..e1ad676b434 100644 --- a/src/renderer/src/store/slices/agent-status-cleanup-actions.ts +++ b/src/renderer/src/store/slices/agent-status-cleanup-actions.ts @@ -1,8 +1,11 @@ -import type { AgentStatusSlice } from './agent-status-slice-contract' +import type { AgentStatusSlice } from './agent-status/agent-status-slice-contract' import type { AgentStatusRuntime } from './agent-status-runtime' import { collectWorktreeIdsForConnection } from './agent-status-connection-worktree-scope' -import { pruneMigrationUnsupportedEntries } from './agent-status-migration-unsupported-entries' -import { removePaneKeys, removePaneKeysByTabPrefix } from './agent-status-pane-keyed-records' +import { pruneMigrationUnsupportedEntries } from './agent-status/agent-status-migration-unsupported-entries' +import { + removePaneKeys, + removePaneKeysByTabPrefix +} from './agent-status/agent-status-pane-keyed-records' /** Actions for removing transient rows and migration-era cache entries. */ export function createAgentStatusCleanupActions( diff --git a/src/renderer/src/store/slices/agent-status-drop-actions.ts b/src/renderer/src/store/slices/agent-status-drop-actions.ts index ff35069756d..4f4313c4da3 100644 --- a/src/renderer/src/store/slices/agent-status-drop-actions.ts +++ b/src/renderer/src/store/slices/agent-status-drop-actions.ts @@ -3,11 +3,11 @@ import type { DropAgentStatusByTabPrefixOptions, DropAgentStatusOptions, DropHibernatedAgentPaneOptions -} from './agent-status-contract' -import type { AgentStatusSlice } from './agent-status-slice-contract' +} from './agent-status/agent-status-contract' +import type { AgentStatusSlice } from './agent-status/agent-status-slice-contract' import type { AgentStatusRuntime } from './agent-status-runtime' -import { buildAgentStatusTabPrefixDropPatch } from './agent-status-drop-reducer' -import { pruneMigrationUnsupportedEntries } from './agent-status-migration-unsupported-entries' +import { buildAgentStatusTabPrefixDropPatch } from './agent-status/agent-status-drop-reducer' +import { pruneMigrationUnsupportedEntries } from './agent-status/agent-status-migration-unsupported-entries' import { retainedAgentEntryFromLive, shouldReplaceRetainedWithLive diff --git a/src/renderer/src/store/slices/agent-status-drop-ipc.test.ts b/src/renderer/src/store/slices/agent-status-drop-ipc.test.ts index 4f57c5be136..1664052b772 100644 --- a/src/renderer/src/store/slices/agent-status-drop-ipc.test.ts +++ b/src/renderer/src/store/slices/agent-status-drop-ipc.test.ts @@ -1,8 +1,9 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' import type { AgentStatusEntry } from '../../../../shared/agent-status-types' import type { TerminalTab } from '../../../../shared/terminal-tab-types' -import type { RetainedAgentEntry } from './agent-status' -import { RECENTLY_CLOSED_AGENT_STATUS_TAB_IDS_MAX } from './agent-status' +import type { RetainedAgentEntry } from './agent-status/agent-status-contract' +import './agent-status' +import { RECENTLY_CLOSED_AGENT_STATUS_TAB_IDS_MAX } from './agent-status/agent-status-pane-keyed-records' import { createTestStore } from './store-test-helpers' // Propagate renderer dismissal to main’s persisted hook cache or restart resurrects dismissed paneKeys. diff --git a/src/renderer/src/store/slices/agent-status-entry-contracts.test.ts b/src/renderer/src/store/slices/agent-status-entry-contracts.test.ts deleted file mode 100644 index e802930bb6b..00000000000 --- a/src/renderer/src/store/slices/agent-status-entry-contracts.test.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { describe } from 'vitest' -import { registerAgentStatusNestedResumeTests } from './agent-status-nested-resume.spec' -import { registerAgentStatusToolAssistantFieldsTests } from './agent-status-tool-assistant-fields.spec' -import { registerAgentStatusPrRefreshHandoffTests } from './agent-status-pr-refresh-handoff.spec' - -describe('agent-status-nested-resume', registerAgentStatusNestedResumeTests) -describe('agent-status-tool-assistant-fields', registerAgentStatusToolAssistantFieldsTests) -describe('agent-status-pr-refresh-handoff', registerAgentStatusPrRefreshHandoffTests) diff --git a/src/renderer/src/store/slices/agent-status-launch-actions.ts b/src/renderer/src/store/slices/agent-status-launch-actions.ts index fab9a12a3a6..ca1f695403b 100644 --- a/src/renderer/src/store/slices/agent-status-launch-actions.ts +++ b/src/renderer/src/store/slices/agent-status-launch-actions.ts @@ -1,8 +1,8 @@ -import type { AgentStatusSlice } from './agent-status-slice-contract' +import type { AgentStatusSlice } from './agent-status/agent-status-slice-contract' import type { AgentStatusRuntime } from './agent-status-runtime' -import type { AgentLaunchConfigRegistryEntry } from './agent-status-contract' +import type { AgentLaunchConfigRegistryEntry } from './agent-status/agent-status-contract' import { copyLaunchConfig } from '../../../../shared/agent-resume-record-from-status' -import { sleepingRecordFromEntry } from './agent-status-sleeping-records' +import { sleepingRecordFromEntry } from './agent-status/agent-status-sleeping-records' import { getLaunchConfigForEntry, launchConfigRegistryEntriesEqual, diff --git a/src/renderer/src/store/slices/agent-status-launch-config.ts b/src/renderer/src/store/slices/agent-status-launch-config.ts index 8a52e244bc2..b84480fbd08 100644 --- a/src/renderer/src/store/slices/agent-status-launch-config.ts +++ b/src/renderer/src/store/slices/agent-status-launch-config.ts @@ -8,7 +8,7 @@ import { import type { AgentLaunchConfigRegistryEntry, AgentLaunchConfigRegistrationMetadata -} from './agent-status-contract' +} from './agent-status/agent-status-contract' import { getLeafIdFromPaneKey, getTabIdFromPaneKey } from './agent-status-pane-key-tab-binding' import { launchConfigsEqual } from '../../../../shared/agent-resume-record-equivalence' diff --git a/src/renderer/src/store/slices/agent-status-live-actions.ts b/src/renderer/src/store/slices/agent-status-live-actions.ts index a929a255715..a4a1d4a4686 100644 --- a/src/renderer/src/store/slices/agent-status-live-actions.ts +++ b/src/renderer/src/store/slices/agent-status-live-actions.ts @@ -1,12 +1,12 @@ import { resolvePaneKey } from '../../lib/agent-status-pane-ownership' -import type { AgentStatusSlice } from './agent-status-slice-contract' +import type { AgentStatusSlice } from './agent-status/agent-status-slice-contract' import type { AgentStatusRuntime } from './agent-status-runtime' import type { AgentStatusMetadata, AgentStatusPayload, AgentStatusRouting, AgentStatusTiming -} from './agent-status-contract' +} from './agent-status/agent-status-contract' import { resolveAgentPaneAuthorityKey, transferAgentPaneAuthorityAlias @@ -15,8 +15,8 @@ import { buildAgentStatusLiveEntry, type AgentStatusLiveEntryBuild, type AgentStatusLiveEntryRejection -} from './agent-status-live-entry-builder' -import { reduceAgentStatusLiveUpdate } from './agent-status-live-reducer' +} from './agent-status/agent-status-live-entry-builder' +import { reduceAgentStatusLiveUpdate } from './agent-status/agent-status-live-reducer' import type { FreshnessLiveEntryDelta } from './agent-status-freshness-scheduler' import { agentStatusTabAlreadyHasProtectedOrGeneratedTitle, diff --git a/src/renderer/src/store/slices/agent-status-live-freshness-request.test.ts b/src/renderer/src/store/slices/agent-status-live-freshness-request.test.ts index 233a7c0121b..d78ed89062c 100644 --- a/src/renderer/src/store/slices/agent-status-live-freshness-request.test.ts +++ b/src/renderer/src/store/slices/agent-status-live-freshness-request.test.ts @@ -1,7 +1,7 @@ import { describe, expect, it, vi } from 'vitest' import type { AppState } from '../types' import type { AgentStatusEntry } from '../../../../shared/agent-status-types' -import type { AgentStatusPayload } from './agent-status-contract' +import type { AgentStatusPayload } from './agent-status/agent-status-contract' import type { AgentStatusRuntime } from './agent-status-runtime' import { createAgentStatusLiveActions } from './agent-status-live-actions' diff --git a/src/renderer/src/store/slices/agent-status-live-map-leak.test.ts b/src/renderer/src/store/slices/agent-status-live-map-leak.test.ts index 5074b51a681..d482aa7ead0 100644 --- a/src/renderer/src/store/slices/agent-status-live-map-leak.test.ts +++ b/src/renderer/src/store/slices/agent-status-live-map-leak.test.ts @@ -5,7 +5,8 @@ import { type ParsedAgentStatusPayload } from '../../../../shared/agent-status-types' import type { SleepingAgentSessionRecord } from '../../../../shared/agent-session-resume' -import { MAX_LIVE_AGENT_STATUSES } from './agent-status' +import './agent-status' +import { MAX_LIVE_AGENT_STATUSES } from './agent-status/agent-status-capacity-eviction' import { createTestStore, makeTab, makeWorktree } from './store-test-helpers' import type { AppState } from '../types' diff --git a/src/renderer/src/store/slices/agent-status-nested-resume.spec.ts b/src/renderer/src/store/slices/agent-status-nested-resume.spec.ts index 205bb4f7569..68fc777cdb3 100644 --- a/src/renderer/src/store/slices/agent-status-nested-resume.spec.ts +++ b/src/renderer/src/store/slices/agent-status-nested-resume.spec.ts @@ -1,6 +1,6 @@ import { afterEach, describe, expect, it, vi } from 'vitest' import { createTestStore } from './store-test-helpers' -import { sleepingRecordFromEntry } from './agent-status-sleeping-records' +import { sleepingRecordFromEntry } from './agent-status/agent-status-sleeping-records' import { getAgentResumeArgv } from '../../../../shared/agent-session-resume' export function registerAgentStatusNestedResumeTests(): void { diff --git a/src/renderer/src/store/slices/agent-status-orchestration-actions.ts b/src/renderer/src/store/slices/agent-status-orchestration-actions.ts index 869c1d05b24..9df6d0bb6a1 100644 --- a/src/renderer/src/store/slices/agent-status-orchestration-actions.ts +++ b/src/renderer/src/store/slices/agent-status-orchestration-actions.ts @@ -2,7 +2,7 @@ import type { AgentStatusEntry, AgentStatusOrchestrationContext } from '../../../../shared/agent-status-types' -import type { AgentStatusSlice } from './agent-status-slice-contract' +import type { AgentStatusSlice } from './agent-status/agent-status-slice-contract' import type { AgentStatusRuntime } from './agent-status-runtime' import { getAgentRowGeneratedTitleText, diff --git a/src/renderer/src/store/slices/agent-status-pane-key-tab-binding.ts b/src/renderer/src/store/slices/agent-status-pane-key-tab-binding.ts index 2e133ff490e..dd70f6d9575 100644 --- a/src/renderer/src/store/slices/agent-status-pane-key-tab-binding.ts +++ b/src/renderer/src/store/slices/agent-status-pane-key-tab-binding.ts @@ -6,8 +6,11 @@ import type { } from '../../../../shared/agent-status-types' import type { TerminalTab } from '../../../../shared/terminal-tab-types' import { tabHasProtectedTitle } from '../../../../shared/agent-generated-tab-title-rules' -import type { DropAgentStatusByWorktreeOptions, RetainedAgentEntry } from './agent-status-contract' -import type { AgentStatusTabPrefixDropState } from './agent-status-drop-reducer' +import type { + DropAgentStatusByWorktreeOptions, + RetainedAgentEntry +} from './agent-status/agent-status-contract' +import type { AgentStatusTabPrefixDropState } from './agent-status/agent-status-drop-reducer' export function paneKeyMatchesAnyTabPrefix(paneKey: string, tabPrefixes: string[]): boolean { for (const prefix of tabPrefixes) { diff --git a/src/renderer/src/store/slices/agent-status-program-status-actions.ts b/src/renderer/src/store/slices/agent-status-program-status-actions.ts index 64624c38db0..9bc4ec66848 100644 --- a/src/renderer/src/store/slices/agent-status-program-status-actions.ts +++ b/src/renderer/src/store/slices/agent-status-program-status-actions.ts @@ -1,4 +1,4 @@ -import type { AgentStatusSlice } from './agent-status-slice-contract' +import type { AgentStatusSlice } from './agent-status/agent-status-slice-contract' import type { AgentStatusRuntime } from './agent-status-runtime' import { programStatusFacetsEqual, diff --git a/src/renderer/src/store/slices/agent-status-provider-session-actions.ts b/src/renderer/src/store/slices/agent-status-provider-session-actions.ts index 907141762d5..7b5d336e65e 100644 --- a/src/renderer/src/store/slices/agent-status-provider-session-actions.ts +++ b/src/renderer/src/store/slices/agent-status-provider-session-actions.ts @@ -1,10 +1,10 @@ -import type { AgentStatusSlice } from './agent-status-slice-contract' +import type { AgentStatusSlice } from './agent-status/agent-status-slice-contract' import type { AgentStatusRuntime } from './agent-status-runtime' import type { AgentProviderSessionRecordMetadata, AgentProviderSessionRouting, AgentProviderSessionTiming -} from './agent-status-contract' +} from './agent-status/agent-status-contract' import { agentProviderSessionsEqual, getAgentResumeArgv, @@ -18,7 +18,7 @@ import { getTabIdFromPaneKey, isRecentlyClosedAgentStatusTab } from './agent-status-pane-key-tab-binding' -import { removePaneKeys } from './agent-status-pane-keyed-records' +import { removePaneKeys } from './agent-status/agent-status-pane-keyed-records' import { registryEntryMatchesStatus } from './agent-status-launch-config' import { copyLaunchConfig } from '../../../../shared/agent-resume-record-from-status' import { agentVerdictFields } from '../../../../shared/agent-main-agent-verdict' diff --git a/src/renderer/src/store/slices/agent-status-quit-capture.test.ts b/src/renderer/src/store/slices/agent-status-quit-capture.test.ts index 68219077539..89310b12043 100644 --- a/src/renderer/src/store/slices/agent-status-quit-capture.test.ts +++ b/src/renderer/src/store/slices/agent-status-quit-capture.test.ts @@ -1,7 +1,8 @@ import { describe, expect, it } from 'vitest' import type { AgentStatusEntry } from '../../../../shared/agent-status-types' import type { AppState } from '../types' -import { collectSleepingAgentSessionRecordsForWorktree } from './agent-status' +import './agent-status' +import { collectSleepingAgentSessionRecordsForWorktree } from './agent-status/agent-status-recovery-collection' import { createTestStore, makeTab } from './store-test-helpers' function makeAgentEntry(overrides: { diff --git a/src/renderer/src/store/slices/agent-status-recovery-actions.ts b/src/renderer/src/store/slices/agent-status-recovery-actions.ts index 98dfe0e8ae0..ad8c48184c3 100644 --- a/src/renderer/src/store/slices/agent-status-recovery-actions.ts +++ b/src/renderer/src/store/slices/agent-status-recovery-actions.ts @@ -1,8 +1,8 @@ import type { SleepingAgentSessionRecord } from '../../../../shared/agent-session-resume' -import type { AgentStatusSlice } from './agent-status-slice-contract' +import type { AgentStatusSlice } from './agent-status/agent-status-slice-contract' import type { AgentStatusRuntime } from './agent-status-runtime' -import { collectSleepingAgentSessionRecordsForWorktree } from './agent-status-recovery-collection' -import { removeSleepingRecordsReplacedByManualWorktreeSleep } from './agent-status-sleeping-records' +import { collectSleepingAgentSessionRecordsForWorktree } from './agent-status/agent-status-recovery-collection' +import { removeSleepingRecordsReplacedByManualWorktreeSleep } from './agent-status/agent-status-sleeping-records' import { capturedResumeRecord } from '../../../../shared/agent-resume-record-from-status' import { getLaunchConfigForEntry } from './agent-status-launch-config' import { findAgentPaneWorktreeId, findTabForAgentEntry } from './agent-status-pane-key-tab-binding' diff --git a/src/renderer/src/store/slices/agent-status-retention-actions.ts b/src/renderer/src/store/slices/agent-status-retention-actions.ts index 737a7231551..76ecb8c0190 100644 --- a/src/renderer/src/store/slices/agent-status-retention-actions.ts +++ b/src/renderer/src/store/slices/agent-status-retention-actions.ts @@ -1,8 +1,8 @@ -import type { RetainedAgentEntry } from './agent-status-contract' -import type { AgentStatusSlice } from './agent-status-slice-contract' +import type { RetainedAgentEntry } from './agent-status/agent-status-contract' +import type { AgentStatusSlice } from './agent-status/agent-status-slice-contract' import type { AgentStatusRuntime } from './agent-status-runtime' import { mergeCurrentOrchestrationContext } from './agent-status-orchestration-context' -import { capRetainedAgents } from './agent-status-capacity-eviction' +import { capRetainedAgents } from './agent-status/agent-status-capacity-eviction' export function createAgentStatusRetentionActions( runtime: AgentStatusRuntime diff --git a/src/renderer/src/store/slices/agent-status-retention-prefix-sweep.test.ts b/src/renderer/src/store/slices/agent-status-retention-prefix-sweep.test.ts index 9d734815a59..d95d5907d37 100644 --- a/src/renderer/src/store/slices/agent-status-retention-prefix-sweep.test.ts +++ b/src/renderer/src/store/slices/agent-status-retention-prefix-sweep.test.ts @@ -1,7 +1,7 @@ import { afterEach, describe, expect, it, vi } from 'vitest' import type { AgentStatusEntry } from '../../../../shared/agent-status-types' import type { AppState } from '../types' -import type { RetainedAgentEntry } from './agent-status' +import type { RetainedAgentEntry } from './agent-status/agent-status-contract' import { createTestStore, makeTab } from './store-test-helpers' describe('agent status retention + prefix sweep', () => { diff --git a/src/renderer/src/store/slices/agent-status-runtime-orchestration.test.ts b/src/renderer/src/store/slices/agent-status-runtime-orchestration.test.ts index 5aa53d78951..f9d31a33914 100644 --- a/src/renderer/src/store/slices/agent-status-runtime-orchestration.test.ts +++ b/src/renderer/src/store/slices/agent-status-runtime-orchestration.test.ts @@ -4,7 +4,7 @@ import { type AgentStatusState, AGENT_STATUS_STALE_AFTER_MS } from '../../../../shared/agent-status-types' -import type { RetainedAgentEntry } from './agent-status' +import type { RetainedAgentEntry } from './agent-status/agent-status-contract' import { createTestStore, makeTab } from './store-test-helpers' import type { AgentStatusObservation } from '../../../../shared/agent-status-observation' import { isExplicitAgentStatusFresh } from '@/lib/pane-agent-evidence' diff --git a/src/renderer/src/store/slices/agent-status-runtime.ts b/src/renderer/src/store/slices/agent-status-runtime.ts index 6bdefa63d92..a1bc6927c36 100644 --- a/src/renderer/src/store/slices/agent-status-runtime.ts +++ b/src/renderer/src/store/slices/agent-status-runtime.ts @@ -1,7 +1,10 @@ import type { StateCreator } from 'zustand' import type { AppState } from '../types' -import type { AgentStatusBatchTransaction, AgentStatusBatchUpdate } from './agent-status-contract' -import type { AgentStatusSlice } from './agent-status-slice-contract' +import type { + AgentStatusBatchTransaction, + AgentStatusBatchUpdate +} from './agent-status/agent-status-contract' +import type { AgentStatusSlice } from './agent-status/agent-status-slice-contract' import type { GeneratedTabTitleUpdate } from './terminal-tab-title-batch' import { createFreshnessScheduler } from './agent-status-freshness-scheduler' diff --git a/src/renderer/src/store/slices/agent-status-verdict-copies.test.ts b/src/renderer/src/store/slices/agent-status-verdict-copies.test.ts index 29d155614cb..20fd07fe85c 100644 --- a/src/renderer/src/store/slices/agent-status-verdict-copies.test.ts +++ b/src/renderer/src/store/slices/agent-status-verdict-copies.test.ts @@ -8,7 +8,7 @@ import type { AppState } from '../types' import { agentMeta, agentTitle } from '@/components/activity/activity-thread-presentation' import { activationTreatsNoteAsFinished } from '@/lib/sleeping-agent-pane-ownership' import { resolveAgentStatusLiveEntryStateHistory } from '../../../../shared/agent-status-live-entry-state-history' -import { deriveAgentStatusLiveFacts } from './agent-status-live-facts' +import { deriveAgentStatusLiveFacts } from './agent-status/agent-status-live-facts' import { recoveryRecordMatches, sleepingRecordsEquivalentIgnoringCaptureTime @@ -17,7 +17,7 @@ import { isValidCompletedAgentHibernationEntry, manualSleepCaptureEntry, sleepingRecordFromEntry -} from './agent-status-sleeping-records' +} from './agent-status/agent-status-sleeping-records' // Every copy of a row's verdict carries it: history, sleep records and their equality checks. // A copy that kept only `interrupted` would read a failure as a clean finish. diff --git a/src/renderer/src/store/slices/agent-status-worktree-drop-actions.ts b/src/renderer/src/store/slices/agent-status-worktree-drop-actions.ts index e7aa681a767..458af5b9b44 100644 --- a/src/renderer/src/store/slices/agent-status-worktree-drop-actions.ts +++ b/src/renderer/src/store/slices/agent-status-worktree-drop-actions.ts @@ -1,7 +1,10 @@ -import type { DropAgentStatusByWorktreeOptions, RetainedAgentEntry } from './agent-status-contract' -import type { AgentStatusSlice } from './agent-status-slice-contract' +import type { + DropAgentStatusByWorktreeOptions, + RetainedAgentEntry +} from './agent-status/agent-status-contract' +import type { AgentStatusSlice } from './agent-status/agent-status-slice-contract' import type { AgentStatusRuntime } from './agent-status-runtime' -import { pruneMigrationUnsupportedEntries } from './agent-status-migration-unsupported-entries' +import { pruneMigrationUnsupportedEntries } from './agent-status/agent-status-migration-unsupported-entries' import { getTabIdFromPaneKey, normalizePaneKeySet, @@ -10,7 +13,7 @@ import { retainedAgentEntryFromLive, shouldReplaceRetainedWithLive } from './agent-status-pane-key-tab-binding' -import { removePaneKeys } from './agent-status-pane-keyed-records' +import { removePaneKeys } from './agent-status/agent-status-pane-keyed-records' import { agentTurnEndedOnPurpose } from '../../../../shared/agent-main-agent-verdict' export function createAgentStatusWorktreeDropActions( diff --git a/src/renderer/src/store/slices/agent-status.test.ts b/src/renderer/src/store/slices/agent-status.test.ts index 757911d487f..f5161be9e26 100644 --- a/src/renderer/src/store/slices/agent-status.test.ts +++ b/src/renderer/src/store/slices/agent-status.test.ts @@ -6,12 +6,12 @@ import { import { flushMicrotasks } from './agent-status-test-harness' import { createTestStore, makeTab, makeTabGroup, makeUnifiedTab } from './store-test-helpers' import type { TerminalTab } from '../../../../shared/terminal-tab-types' -import type { RetainedAgentEntry } from './agent-status' +import type { RetainedAgentEntry } from './agent-status/agent-status-contract' import { structuredAgentSessionPaneKey, structuredAgentSessionTabId } from '../../../../shared/structured-agent-session-projection' -import { buildAgentStatusTabPrefixDropPatch } from './agent-status-drop-reducer' +import { buildAgentStatusTabPrefixDropPatch } from './agent-status/agent-status-drop-reducer' import { createStoreSessionMockApi } from './store-session-test-harness' import { drawTabsFromMain } from './tabs-drawn-from-main.test-fixture' diff --git a/src/renderer/src/store/slices/agent-status.ts b/src/renderer/src/store/slices/agent-status.ts index 7720a4643b9..dfaa57654bb 100644 --- a/src/renderer/src/store/slices/agent-status.ts +++ b/src/renderer/src/store/slices/agent-status.ts @@ -1,6 +1,6 @@ import type { StateCreator } from 'zustand' import type { AppState } from '../types' -import type { AgentStatusSlice } from './agent-status-slice-contract' +import type { AgentStatusSlice } from './agent-status/agent-status-slice-contract' import { createAgentStatusRuntime } from './agent-status-runtime' import { createAgentStatusAuthorityActions } from './agent-status-authority-actions' import { createAgentStatusCleanupActions } from './agent-status-cleanup-actions' @@ -15,53 +15,12 @@ import { createAgentStatusRecoveryActions } from './agent-status-recovery-action import { createAgentStatusRetentionActions } from './agent-status-retention-actions' // Keep this path as the public contract for callers while implementation details live beside it. -export type { - AgentLaunchConfigRegistryEntry, - AgentLaunchConfigRegistrationMetadata, - AgentProviderSessionRecordMetadata, - AgentProviderSessionRouting, - AgentProviderSessionTiming, - AgentStatusBatchTransaction, - AgentStatusBatchUpdate, - AgentStatusMetadata, - AgentStatusPayload, - AgentStatusRouting, - AgentStatusTiming, - AgentStatusUpdate, - AgentProviderSessionUpdate, - AgentProgramStatusUpdate, - AgentStatusWorktreeShutdownReason, - AllAgentSessionCaptureMode, - DropAgentStatusByTabPrefixOptions, - DropAgentStatusByWorktreeOptions, - DropHibernatedAgentPaneOptions, - RetainedAgentEntry, - AgentStateHistoryEntry, - AgentStatusEntry, - AgentStatusOrchestrationContext, - AgentType, - MigrationUnsupportedPtyEntry, - ParsedAgentStatusPayload, - AgentProviderSessionMetadata, - ResumableTuiAgent, - SleepingAgentLaunchConfig, - SleepingAgentSessionRecord -} from './agent-status-contract' -export type { AgentStatusSlice } from './agent-status-slice-contract' -export { - collectSleepingAgentSessionRecordsForWorktree, - collectHibernatedCompletionEvidenceForWorktree -} from './agent-status-recovery-collection' -export { removeSleepingRecordsReplacedByManualWorktreeSleep } from './agent-status-sleeping-records' -export { - buildAgentStatusTabPrefixDropPatch, - type AgentStatusTabPrefixDropState -} from './agent-status-drop-reducer' -export { MAX_LIVE_AGENT_STATUSES } from './agent-status-capacity-eviction' -export { - RECENTLY_CLOSED_AGENT_STATUS_TAB_IDS_MAX, - RECENTLY_RETIRED_AGENT_STATUS_PANE_KEYS_MAX -} from './agent-status-pane-keyed-records' + +import './agent-status/agent-status-recovery-collection' +import './agent-status/agent-status-sleeping-records' +import './agent-status/agent-status-drop-reducer' +import './agent-status/agent-status-capacity-eviction' +import './agent-status/agent-status-pane-keyed-records' export const createAgentStatusSlice: StateCreator = ( storeSet, diff --git a/src/renderer/src/store/slices/agent-status-capacity-eviction.ts b/src/renderer/src/store/slices/agent-status/agent-status-capacity-eviction.ts similarity index 89% rename from src/renderer/src/store/slices/agent-status-capacity-eviction.ts rename to src/renderer/src/store/slices/agent-status/agent-status-capacity-eviction.ts index bc912a995f5..494dce8218d 100644 --- a/src/renderer/src/store/slices/agent-status-capacity-eviction.ts +++ b/src/renderer/src/store/slices/agent-status/agent-status-capacity-eviction.ts @@ -1,9 +1,10 @@ -import type { AppState } from '../types' -import type { AgentStatusEntry } from '../../../../shared/agent-status-types' -import type { TerminalPaneLayoutNode } from '../../../../shared/terminal-tab-types' +import type { AppState } from '../../types' +import type { AgentStatusEntry } from '../../../../../shared/agent-status-types' +import type { TerminalPaneLayoutNode } from '../../../../../shared/terminal-tab-types' import type { RetainedAgentEntry } from './agent-status-contract' -import { AGENT_STATUS_STALE_AFTER_MS } from '../../../../shared/agent-status-types' -import { getTabIdFromPaneKey } from './agent-status-pane-key-tab-binding' +import '../../../../../shared/agent-status-types' +import { AGENT_STATUS_STALE_AFTER_MS } from '../../../../../shared/agent-status-freshness' +import { getTabIdFromPaneKey } from '../agent-status-pane-key-tab-binding' const MAX_RETAINED_AGENTS = 500 diff --git a/src/renderer/src/store/slices/agent-status-contract.ts b/src/renderer/src/store/slices/agent-status/agent-status-contract.ts similarity index 86% rename from src/renderer/src/store/slices/agent-status-contract.ts rename to src/renderer/src/store/slices/agent-status/agent-status-contract.ts index e9f0d892131..b43fbd7c241 100644 --- a/src/renderer/src/store/slices/agent-status-contract.ts +++ b/src/renderer/src/store/slices/agent-status/agent-status-contract.ts @@ -1,22 +1,19 @@ -import type { AppState } from '../types' +import type { AppState } from '../../types' import type { - AgentStateHistoryEntry, AgentStatusEntry, AgentStatusOrchestrationContext, AgentType, - MigrationUnsupportedPtyEntry, ParsedAgentStatusPayload, TurnEndDisposition -} from '../../../../shared/agent-status-types' -import type { AgentStatusObservation } from '../../../../shared/agent-status-observation' -import type { ProgramStatusFacet } from '../../../../shared/program-status/facet' +} from '../../../../../shared/agent-status-types' +import type { AgentStatusObservation } from '../../../../../shared/agent-status-observation' +import type { ProgramStatusFacet } from '../../../../../shared/program-status/facet' import type { AgentProviderSessionMetadata, ResumableTuiAgent, - SleepingAgentLaunchConfig, - SleepingAgentSessionRecord -} from '../../../../shared/agent-session-resume' -import type { TerminalTab } from '../../../../shared/terminal-tab-types' + SleepingAgentLaunchConfig +} from '../../../../../shared/agent-session-resume' +import type { TerminalTab } from '../../../../../shared/terminal-tab-types' export type RetainedAgentEntry = { entry: AgentStatusEntry @@ -163,16 +160,3 @@ export type AgentStatusBatchTransaction = { apply: (update: AgentStatusBatchUpdate) => boolean afterCommit: (effect: () => void) => void } - -export type { - AgentStateHistoryEntry, - AgentStatusEntry, - AgentStatusOrchestrationContext, - AgentType, - MigrationUnsupportedPtyEntry, - ParsedAgentStatusPayload, - AgentProviderSessionMetadata, - ResumableTuiAgent, - SleepingAgentLaunchConfig, - SleepingAgentSessionRecord -} diff --git a/src/renderer/src/store/slices/agent-status-drop-reducer.ts b/src/renderer/src/store/slices/agent-status/agent-status-drop-reducer.ts similarity index 98% rename from src/renderer/src/store/slices/agent-status-drop-reducer.ts rename to src/renderer/src/store/slices/agent-status/agent-status-drop-reducer.ts index 2a7b6cc82e6..63f79169145 100644 --- a/src/renderer/src/store/slices/agent-status-drop-reducer.ts +++ b/src/renderer/src/store/slices/agent-status/agent-status-drop-reducer.ts @@ -1,4 +1,4 @@ -import type { AppState } from '../types' +import type { AppState } from '../../types' import type { DropAgentStatusByTabPrefixOptions } from './agent-status-contract' import { pruneMigrationUnsupportedEntries } from './agent-status-migration-unsupported-entries' import { @@ -8,7 +8,7 @@ import { closedAgentStatusRetirementKeys, removePaneKeysByTabPrefix } from './agent-status-pane-keyed-records' -import { findCompletedOrphanPaneKeysForTabClose } from './agent-status-pane-key-tab-binding' +import { findCompletedOrphanPaneKeysForTabClose } from '../agent-status-pane-key-tab-binding' /** The slice of app state the tab-prefix drop reduces over — narrow so callers * outside the store (the paired snapshot apply) can build the same patch. */ diff --git a/src/renderer/src/store/slices/agent-status/agent-status-entry-contracts.test.ts b/src/renderer/src/store/slices/agent-status/agent-status-entry-contracts.test.ts new file mode 100644 index 00000000000..c17f38d45be --- /dev/null +++ b/src/renderer/src/store/slices/agent-status/agent-status-entry-contracts.test.ts @@ -0,0 +1,8 @@ +import { describe } from 'vitest' +import { registerAgentStatusNestedResumeTests } from '../agent-status-nested-resume.spec' +import { registerAgentStatusToolAssistantFieldsTests } from '../agent-status-tool-assistant-fields.spec' +import { registerAgentStatusPrRefreshHandoffTests } from '../agent-status-pr-refresh-handoff.spec' + +describe('agent-status-nested-resume', registerAgentStatusNestedResumeTests) +describe('agent-status-tool-assistant-fields', registerAgentStatusToolAssistantFieldsTests) +describe('agent-status-pr-refresh-handoff', registerAgentStatusPrRefreshHandoffTests) diff --git a/src/renderer/src/store/slices/agent-status-live-entry-builder.ts b/src/renderer/src/store/slices/agent-status/agent-status-live-entry-builder.ts similarity index 91% rename from src/renderer/src/store/slices/agent-status-live-entry-builder.ts rename to src/renderer/src/store/slices/agent-status/agent-status-live-entry-builder.ts index 383e3045a46..5db27b61ad2 100644 --- a/src/renderer/src/store/slices/agent-status-live-entry-builder.ts +++ b/src/renderer/src/store/slices/agent-status/agent-status-live-entry-builder.ts @@ -1,39 +1,37 @@ -import { sameAgentStatusTerminalOwner } from '../../../../shared/agent-status-terminal-owner' -import type { AppState } from '../types' +import { sameAgentStatusTerminalOwner } from '../../../../../shared/agent-status-terminal-owner' +import type { AppState } from '../../types' import { resolveAgentStatusLiveEntryMainAgent } from './agent-status-live-entry-main-agent' -import { resolveAgentStatusLiveEntryStateHistory } from '../../../../shared/agent-status-live-entry-state-history' -import { - pickHostTurnEnd, - type MigrationUnsupportedPtyEntry, - type AgentStatusEntry -} from '../../../../shared/agent-status-types' +import { resolveAgentStatusLiveEntryStateHistory } from '../../../../../shared/agent-status-live-entry-state-history' +import { pickHostTurnEnd } from '../../../../../shared/agent-status-types' +import type { MigrationUnsupportedPtyEntry } from '../../../../../shared/agent-status-ipc-payload' +import type { AgentStatusEntry } from '../../../../../shared/agent-status-types' import { agentProviderSessionsEqual, type AgentProviderSessionMetadata, type SleepingAgentLaunchConfig, type SleepingAgentSessionRecord -} from '../../../../shared/agent-session-resume' +} from '../../../../../shared/agent-session-resume' import { resolveAgentStatusIdentity, shouldSuppressInheritedTerminalStatus -} from '../../../../shared/agent-status-identity' -import { isCommandCodeNewTurnWhileWorking } from '../../../../shared/command-code-turn-boundary' +} from '../../../../../shared/agent-status-identity' +import { isCommandCodeNewTurnWhileWorking } from '../../../../../shared/command-code-turn-boundary' import type { AgentStatusMetadata, AgentStatusPayload, AgentStatusRouting, AgentStatusTiming } from './agent-status-contract' -import { registryEntryMatchesStatus } from './agent-status-launch-config' -import { findAgentPaneWorktreeId, getTabIdFromPaneKey } from './agent-status-pane-key-tab-binding' -import { mergeCurrentOrchestrationContext } from './agent-status-orchestration-context' +import { registryEntryMatchesStatus } from '../agent-status-launch-config' +import { findAgentPaneWorktreeId, getTabIdFromPaneKey } from '../agent-status-pane-key-tab-binding' +import { mergeCurrentOrchestrationContext } from '../agent-status-orchestration-context' import { deriveAgentStatusLiveFacts } from './agent-status-live-facts' import { liveEntryChildFields } from './agent-status-live-entry-children' import { canReuseStatusProviderSession, recordLaunchConfigForStatus, statusRetainsResumableIdentity -} from '../../../../shared/agent-resume-record-from-status' +} from '../../../../../shared/agent-resume-record-from-status' export type AgentStatusLiveEntryBuild = { entry: AgentStatusEntry diff --git a/src/renderer/src/store/slices/agent-status-live-entry-children.ts b/src/renderer/src/store/slices/agent-status/agent-status-live-entry-children.ts similarity index 68% rename from src/renderer/src/store/slices/agent-status-live-entry-children.ts rename to src/renderer/src/store/slices/agent-status/agent-status-live-entry-children.ts index fa622b8f7dc..0b71306a718 100644 --- a/src/renderer/src/store/slices/agent-status-live-entry-children.ts +++ b/src/renderer/src/store/slices/agent-status/agent-status-live-entry-children.ts @@ -1,6 +1,7 @@ -import type { AgentStatusEntry } from '../../../../shared/agent-status-types' -import { agentSubagentsEqual } from '../../../../shared/agent-status-types' -import { agentChildWorkViewsEqual } from '../../../../shared/agent-status-child-work-view-wire' +import type { AgentStatusEntry } from '../../../../../shared/agent-status-types' +import '../../../../../shared/agent-status-types' +import { agentSubagentsEqual } from '../../../../../shared/agent-status-subagent-snapshot' +import { agentChildWorkViewsEqual } from '../../../../../shared/agent-status-child-work-view-wire' import type { AgentStatusPayload } from './agent-status-contract' /** Reuse equal child arrays for derived-row identity; children are host views, subagents the legacy roster. */ diff --git a/src/renderer/src/store/slices/agent-status-live-entry-main-agent.ts b/src/renderer/src/store/slices/agent-status/agent-status-live-entry-main-agent.ts similarity index 78% rename from src/renderer/src/store/slices/agent-status-live-entry-main-agent.ts rename to src/renderer/src/store/slices/agent-status/agent-status-live-entry-main-agent.ts index 06b8973fb71..06333adfeef 100644 --- a/src/renderer/src/store/slices/agent-status-live-entry-main-agent.ts +++ b/src/renderer/src/store/slices/agent-status/agent-status-live-entry-main-agent.ts @@ -1,9 +1,10 @@ +import '../../../../../shared/agent-status-types' import { mainAgentStatusEqual, - type AgentMainAgentStatus, - type AgentStatusEntry -} from '../../../../shared/agent-status-types' -import type { AgentStatusObservationOrigin } from '../../../../shared/agent-status-observation' + type AgentMainAgentStatus +} from '../../../../../shared/main-agent-status' +import type { AgentStatusEntry } from '../../../../../shared/agent-status-types' +import type { AgentStatusObservationOrigin } from '../../../../../shared/agent-status-observation' import type { AgentStatusPayload } from './agent-status-contract' /** Byte/launch writers omit mainAgent; hook omission authoritatively clears it for mobile/CLI parity. */ diff --git a/src/renderer/src/store/slices/agent-status-live-facts.ts b/src/renderer/src/store/slices/agent-status/agent-status-live-facts.ts similarity index 89% rename from src/renderer/src/store/slices/agent-status-live-facts.ts rename to src/renderer/src/store/slices/agent-status/agent-status-live-facts.ts index ff1b4ed94cd..998731343ed 100644 --- a/src/renderer/src/store/slices/agent-status-live-facts.ts +++ b/src/renderer/src/store/slices/agent-status/agent-status-live-facts.ts @@ -1,19 +1,19 @@ -import type { AppState } from '../types' -import type { AgentStatusEntry } from '../../../../shared/agent-status-types' +import type { AppState } from '../../types' +import type { AgentStatusEntry } from '../../../../../shared/agent-status-types' import type { SleepingAgentLaunchConfig, SleepingAgentSessionRecord -} from '../../../../shared/agent-session-resume' -import { isSmartSortRelevantAgentChange } from '../../../../shared/sidebar-list/smart-sort-agent-change' +} from '../../../../../shared/agent-session-resume' +import { isSmartSortRelevantAgentChange } from '../../../../../shared/sidebar-list/smart-sort-agent-change' import { recordHibernationBoundaryResolved } from '@/lib/agent-hibernation-pane-age' import { findAgentPaneWorktreeId, findTabForAgentEntry, isAgentCompletionState -} from './agent-status-pane-key-tab-binding' +} from '../agent-status-pane-key-tab-binding' import { pruneMigrationUnsupportedEntries } from './agent-status-migration-unsupported-entries' -import { liveResumeRecord } from '../../../../shared/agent-resume-record-from-status' -import { agentMainAgentVerdict } from '../../../../shared/agent-main-agent-verdict' +import { liveResumeRecord } from '../../../../../shared/agent-resume-record-from-status' +import { agentMainAgentVerdict } from '../../../../../shared/agent-main-agent-verdict' export type AgentStatusLiveFacts = { existingSleepingRecord: SleepingAgentSessionRecord | undefined diff --git a/src/renderer/src/store/slices/agent-status-live-reducer.ts b/src/renderer/src/store/slices/agent-status/agent-status-live-reducer.ts similarity index 93% rename from src/renderer/src/store/slices/agent-status-live-reducer.ts rename to src/renderer/src/store/slices/agent-status/agent-status-live-reducer.ts index bf130161400..d7f7a26c5b8 100644 --- a/src/renderer/src/store/slices/agent-status-live-reducer.ts +++ b/src/renderer/src/store/slices/agent-status/agent-status-live-reducer.ts @@ -1,5 +1,5 @@ -import type { AppState } from '../types' -import type { AgentStatusEntry } from '../../../../shared/agent-status-types' +import type { AppState } from '../../types' +import type { AgentStatusEntry } from '../../../../../shared/agent-status-types' import { capLiveAgentStatusesInPlace, classifyPaneKeyLiveness, @@ -8,8 +8,8 @@ import { } from './agent-status-capacity-eviction' import { removePaneKeys } from './agent-status-pane-keyed-records' import type { AgentStatusLiveEntryBuild } from './agent-status-live-entry-builder' -import { agentProviderSessionsEqual } from '../../../../shared/agent-session-resume' -import { liveResumeRecordChange } from '../../../../shared/agent-resume-record-from-status' +import { agentProviderSessionsEqual } from '../../../../../shared/agent-session-resume' +import { liveResumeRecordChange } from '../../../../../shared/agent-resume-record-from-status' export type AgentStatusLiveUpdateReduction = { patch: Partial diff --git a/src/renderer/src/store/slices/agent-status-migration-unsupported-entries.ts b/src/renderer/src/store/slices/agent-status/agent-status-migration-unsupported-entries.ts similarity index 84% rename from src/renderer/src/store/slices/agent-status-migration-unsupported-entries.ts rename to src/renderer/src/store/slices/agent-status/agent-status-migration-unsupported-entries.ts index 13f1b1375ad..c735246c332 100644 --- a/src/renderer/src/store/slices/agent-status-migration-unsupported-entries.ts +++ b/src/renderer/src/store/slices/agent-status/agent-status-migration-unsupported-entries.ts @@ -1,4 +1,4 @@ -import type { MigrationUnsupportedPtyEntry } from '../../../../shared/agent-status-types' +import type { MigrationUnsupportedPtyEntry } from '../../../../../shared/agent-status-ipc-payload' export function pruneMigrationUnsupportedEntries( entries: Record, diff --git a/src/renderer/src/store/slices/agent-status-pane-keyed-records.test.ts b/src/renderer/src/store/slices/agent-status/agent-status-pane-keyed-records.test.ts similarity index 100% rename from src/renderer/src/store/slices/agent-status-pane-keyed-records.test.ts rename to src/renderer/src/store/slices/agent-status/agent-status-pane-keyed-records.test.ts diff --git a/src/renderer/src/store/slices/agent-status-pane-keyed-records.ts b/src/renderer/src/store/slices/agent-status/agent-status-pane-keyed-records.ts similarity index 100% rename from src/renderer/src/store/slices/agent-status-pane-keyed-records.ts rename to src/renderer/src/store/slices/agent-status/agent-status-pane-keyed-records.ts diff --git a/src/renderer/src/store/slices/agent-status-recovery-collection.ts b/src/renderer/src/store/slices/agent-status/agent-status-recovery-collection.ts similarity index 91% rename from src/renderer/src/store/slices/agent-status-recovery-collection.ts rename to src/renderer/src/store/slices/agent-status/agent-status-recovery-collection.ts index 3dde5726654..76e5d951bf5 100644 --- a/src/renderer/src/store/slices/agent-status-recovery-collection.ts +++ b/src/renderer/src/store/slices/agent-status/agent-status-recovery-collection.ts @@ -1,14 +1,13 @@ -import type { AppState } from '../types' -import { - getAgentResumeArgv, - type SleepingAgentSessionRecord -} from '../../../../shared/agent-session-resume' +import type { AppState } from '../../types' +import '../../../../../shared/agent-session-resume' +import { getAgentResumeArgv } from '../../../../../shared/agent-resume-argv' +import type { SleepingAgentSessionRecord } from '../../../../../shared/agent-session-resume' import type { RetainedAgentEntry } from './agent-status-contract' import { normalizePaneKeySet, paneKeyMatchesAnyTabPrefix, retainedAgentEntryFromLive -} from './agent-status-pane-key-tab-binding' +} from '../agent-status-pane-key-tab-binding' import { isValidCompletedAgentHibernationEntry, manualSleepCaptureEntry, @@ -17,9 +16,9 @@ import { sleepingRecordFromEntry, type CollectSleepingAgentSessionRecordsOptions } from './agent-status-sleeping-records' -import { getLaunchConfigForEntry } from './agent-status-launch-config' -import { agentTurnEndedOnPurpose } from '../../../../shared/agent-main-agent-verdict' -import { isCompletedPiCompatibleAgentWithLiveRecoveryRecord } from '../../../../shared/live-resume-anchor-record' +import { getLaunchConfigForEntry } from '../agent-status-launch-config' +import { agentTurnEndedOnPurpose } from '../../../../../shared/agent-main-agent-verdict' +import { isCompletedPiCompatibleAgentWithLiveRecoveryRecord } from '../../../../../shared/live-resume-anchor-record' export function collectSleepingAgentSessionRecordsForWorktree( state: AppState, diff --git a/src/renderer/src/store/slices/agent-status-sleeping-records.ts b/src/renderer/src/store/slices/agent-status/agent-status-sleeping-records.ts similarity index 86% rename from src/renderer/src/store/slices/agent-status-sleeping-records.ts rename to src/renderer/src/store/slices/agent-status/agent-status-sleeping-records.ts index 31a6151292c..7785036f379 100644 --- a/src/renderer/src/store/slices/agent-status-sleeping-records.ts +++ b/src/renderer/src/store/slices/agent-status/agent-status-sleeping-records.ts @@ -1,13 +1,13 @@ -import type { AppState } from '../types' -import type { AgentStatusEntry } from '../../../../shared/agent-status-types' -import { agentTurnEndedUncleanly } from '../../../../shared/agent-main-agent-verdict' +import type { AppState } from '../../types' +import type { AgentStatusEntry } from '../../../../../shared/agent-status-types' +import { agentTurnEndedUncleanly } from '../../../../../shared/agent-main-agent-verdict' import type { SleepingAgentLaunchConfig, SleepingAgentSessionRecord -} from '../../../../shared/agent-session-resume' -import { resumeRecordFromStatus } from '../../../../shared/agent-resume-record-from-status' -import type { TerminalTab } from '../../../../shared/terminal-tab-types' -import { findTabForAgentEntry } from './agent-status-pane-key-tab-binding' +} from '../../../../../shared/agent-session-resume' +import { resumeRecordFromStatus } from '../../../../../shared/agent-resume-record-from-status' +import type { TerminalTab } from '../../../../../shared/terminal-tab-types' +import { findTabForAgentEntry } from '../agent-status-pane-key-tab-binding' export function sleepingRecordFromEntry(args: { state: AppState diff --git a/src/renderer/src/store/slices/agent-status-slice-contract.ts b/src/renderer/src/store/slices/agent-status/agent-status-slice-contract.ts similarity index 95% rename from src/renderer/src/store/slices/agent-status-slice-contract.ts rename to src/renderer/src/store/slices/agent-status/agent-status-slice-contract.ts index ec1ec38e22a..c1d9503a08d 100644 --- a/src/renderer/src/store/slices/agent-status-slice-contract.ts +++ b/src/renderer/src/store/slices/agent-status/agent-status-slice-contract.ts @@ -10,7 +10,6 @@ import type { AgentStatusPayload, AgentStatusRouting, AgentStatusTiming, - AgentProviderSessionMetadata, DropAgentStatusByTabPrefixOptions, DropAgentStatusByWorktreeOptions, DropAgentStatusOptions, @@ -20,15 +19,16 @@ import type { } from './agent-status-contract' import type { AgentStatusEntry, - AgentStatusOrchestrationContext, - MigrationUnsupportedPtyEntry -} from '../../../../shared/agent-status-types' + AgentStatusOrchestrationContext +} from '../../../../../shared/agent-status-types' +import type { MigrationUnsupportedPtyEntry } from '../../../../../shared/agent-status-ipc-payload' import type { + AgentProviderSessionMetadata, ResumableTuiAgent, SleepingAgentLaunchConfig, SleepingAgentSessionRecord -} from '../../../../shared/agent-session-resume' -import type { ProgramStatusFacet } from '../../../../shared/program-status/facet' +} from '../../../../../shared/agent-session-resume' +import type { ProgramStatusFacet } from '../../../../../shared/program-status/facet' export type AgentStatusSlice = { /** Explicit agent status entries keyed by `${tabId}:${leafId}`; real-time only, not persisted. */ diff --git a/src/renderer/src/store/slices/retired-terminal-tab-state-sweep.ts b/src/renderer/src/store/slices/retired-terminal-tab-state-sweep.ts index 247b6fc2bc7..a937d45de74 100644 --- a/src/renderer/src/store/slices/retired-terminal-tab-state-sweep.ts +++ b/src/renderer/src/store/slices/retired-terminal-tab-state-sweep.ts @@ -1,4 +1,4 @@ -import { removePaneKeys } from './agent-status-pane-keyed-records' +import { removePaneKeys } from './agent-status/agent-status-pane-keyed-records' import type { AppState } from '../types' import { forgetAgentHibernationTabOutput } from '@/lib/agent-hibernation-output-activity' import { forgetForegroundTerminalTabs } from '@/lib/foreground-terminal-tabs' @@ -7,10 +7,11 @@ import { forgetAgentStartupDeliveriesForTabs } from '@/lib/agent-startup-deliver import { retireParkedTerminalTab } from '@/components/terminal-pane/terminal-parked-watcher-registry' import { forgetNativeChatPromptDismissalsForTab } from '@/components/native-chat/native-chat-prompt-dismissals' import { retireAgentPaneAuthorityAliasesByOwnerTab } from './agent-pane-authority' +import './agent-status' import { buildAgentStatusTabPrefixDropPatch, type AgentStatusTabPrefixDropState -} from './agent-status' +} from './agent-status/agent-status-drop-reducer' import { buildPaneForegroundAgentTabPrefixClearPatch } from './pane-foreground-agent' export type RetiredTerminalTabSweepActions = Pick< diff --git a/src/renderer/src/store/slices/workspace-attention/subject-attention-transitions.ts b/src/renderer/src/store/slices/workspace-attention/subject-attention-transitions.ts index dd19e75accc..f166d8e19de 100644 --- a/src/renderer/src/store/slices/workspace-attention/subject-attention-transitions.ts +++ b/src/renderer/src/store/slices/workspace-attention/subject-attention-transitions.ts @@ -1,6 +1,9 @@ import type { StoredAgentAttentionUnread } from '@/attention/agent-attention-contract' import type { AppState } from '../../types' -import { movePaneKeyedRecord, removePaneKeys } from '../agent-status-pane-keyed-records' +import { + movePaneKeyedRecord, + removePaneKeys +} from '../agent-status/agent-status-pane-keyed-records' import { omitRecordKeys } from '../worktrees/teardown/record-key-omission' import { paneKeyTabId } from './workspace-live-markers' diff --git a/src/renderer/src/store/terminals/terminal-actions.ts b/src/renderer/src/store/terminals/terminal-actions.ts index 5717d1e9b55..0a407e57adc 100644 --- a/src/renderer/src/store/terminals/terminal-actions.ts +++ b/src/renderer/src/store/terminals/terminal-actions.ts @@ -18,7 +18,7 @@ import type { TerminalTabTitleUpdate } from '../slices/terminal-tab-title-batch' import type { NativeChatLaunchDraft, NativeChatLaunchPrompt } from '@/lib/native-chat-launch-prompt' -import type { AgentStatusWorktreeShutdownReason } from '../slices/agent-status' +import type { AgentStatusWorktreeShutdownReason } from '../slices/agent-status/agent-status-contract' import type { TerminalTabCloseReason, TerminalTabRetirementPlan diff --git a/src/renderer/src/store/terminals/terminal-pane-hibernation.ts b/src/renderer/src/store/terminals/terminal-pane-hibernation.ts index 146ac032694..01ff6ae3c57 100644 --- a/src/renderer/src/store/terminals/terminal-pane-hibernation.ts +++ b/src/renderer/src/store/terminals/terminal-pane-hibernation.ts @@ -7,10 +7,11 @@ import { import { shutdownBufferCaptures } from '@/components/terminal-pane/shutdown-buffer-captures' import { callRuntimeRpc } from '@/runtime/runtime-rpc-client' import { toRuntimeWorktreeSelector } from '@/runtime/runtime-worktree-selector' +import '../slices/agent-status' import { collectHibernatedCompletionEvidenceForWorktree, collectSleepingAgentSessionRecordsForWorktree -} from '../slices/agent-status' +} from '../slices/agent-status/agent-status-recovery-collection' import type { TerminalSlice, TerminalStoreGet, TerminalStoreSet } from './terminal-state' import { equalStringSets, sortedUniquePtyIds } from './terminal-pty-identities' import { resolveTerminalPtyOwner } from '@/lib/terminal-worktree-route' diff --git a/src/renderer/src/store/terminals/terminal-shutdown-state.ts b/src/renderer/src/store/terminals/terminal-shutdown-state.ts index c315ff33a65..222d3c1cd2a 100644 --- a/src/renderer/src/store/terminals/terminal-shutdown-state.ts +++ b/src/renderer/src/store/terminals/terminal-shutdown-state.ts @@ -6,11 +6,12 @@ import { markCommittedPtyShutdowns, settleDeferredPtyShutdownExits } from '@/components/terminal-pane/pty-shutdown-exit-deferral' -import { - removeSleepingRecordsReplacedByManualWorktreeSleep, - type AgentStatusWorktreeShutdownReason, - type RetainedAgentEntry -} from '../slices/agent-status' +import '../slices/agent-status' +import { removeSleepingRecordsReplacedByManualWorktreeSleep } from '../slices/agent-status/agent-status-sleeping-records' +import type { + AgentStatusWorktreeShutdownReason, + RetainedAgentEntry +} from '../slices/agent-status/agent-status-contract' import type { TerminalStoreGet, TerminalStoreSet } from './terminal-state' import { copyOnWriteRecord } from '../copy-on-write-record' import { removeTabsAttention } from '../slices/workspace-attention/subject-attention-transitions' diff --git a/src/renderer/src/store/terminals/terminal-shutdown.ts b/src/renderer/src/store/terminals/terminal-shutdown.ts index f48582800cb..e38bbabb972 100644 --- a/src/renderer/src/store/terminals/terminal-shutdown.ts +++ b/src/renderer/src/store/terminals/terminal-shutdown.ts @@ -2,11 +2,12 @@ import type { SleepingAgentSessionRecord } from '../../../../shared/agent-sessio import { shutdownBufferCaptures } from '@/components/terminal-pane/shutdown-buffer-captures' import { callRuntimeRpc } from '@/runtime/runtime-rpc-client' import { toRuntimeWorktreeSelector } from '@/runtime/runtime-worktree-selector' +import '../slices/agent-status' import { collectHibernatedCompletionEvidenceForWorktree, - collectSleepingAgentSessionRecordsForWorktree, - type AgentStatusWorktreeShutdownReason -} from '../slices/agent-status' + collectSleepingAgentSessionRecordsForWorktree +} from '../slices/agent-status/agent-status-recovery-collection' +import type { AgentStatusWorktreeShutdownReason } from '../slices/agent-status/agent-status-contract' import type { TerminalSlice, TerminalStoreGet, TerminalStoreSet } from './terminal-state' import { equalStringSets, sortedUniquePtyIds } from './terminal-pty-identities' import { resolveTerminalPtyOwner } from '@/lib/terminal-worktree-route' diff --git a/src/renderer/src/store/terminals/terminal-tab-close.ts b/src/renderer/src/store/terminals/terminal-tab-close.ts index 72798ba4639..6fd6977f8a6 100644 --- a/src/renderer/src/store/terminals/terminal-tab-close.ts +++ b/src/renderer/src/store/terminals/terminal-tab-close.ts @@ -18,7 +18,7 @@ import { commitTerminalSurfaceClose } from './terminal-surface-close-intent' import { recordTerminalTabCloseThroughLayoutOwner } from './terminal-tab-close-layout-owner' import { ORCA_LAYOUT_OWNER_IS_MAIN } from '../../../../shared/layout-owner-switch' import { omitUnverifiedPtyLossTabIds } from './terminal-unverified-pty-loss' -import { removePaneKeysByTabPrefix } from '../slices/agent-status-pane-keyed-records' +import { removePaneKeysByTabPrefix } from '../slices/agent-status/agent-status-pane-keyed-records' import { removeTabsAttention } from '../slices/workspace-attention/subject-attention-transitions' import { omitRecordKeys } from '../slices/worktrees/teardown/record-key-omission' import { deleteNativeChatComposerDraftsForTab } from '@/components/native-chat/native-chat-composer-draft-store' diff --git a/src/renderer/src/store/types.ts b/src/renderer/src/store/types.ts index 3fb33c3e496..a6df58db413 100644 --- a/src/renderer/src/store/types.ts +++ b/src/renderer/src/store/types.ts @@ -26,7 +26,7 @@ import type { RateLimitSlice } from './slices/rate-limits' import type { SshSlice } from './slices/ssh' import type { RuntimeEnvironmentSshSlice } from './slices/runtime-environment-ssh' import type { WslHostsSlice } from './slices/wsl-hosts' -import type { AgentStatusSlice } from './slices/agent-status' +import type { AgentStatusSlice } from './slices/agent-status/agent-status-slice-contract' import type { PaneForegroundAgentSlice } from './slices/pane-foreground-agent' import type { DiffCommentsSlice } from './slices/diffComments' import type { DetectedAgentsSlice } from './slices/detected-agents' diff --git a/tests/e2e/nested-agent-idle-owner.unit.test.ts b/tests/e2e/nested-agent-idle-owner.unit.test.ts index 6d4d26382f4..41fdf2f1df9 100644 --- a/tests/e2e/nested-agent-idle-owner.unit.test.ts +++ b/tests/e2e/nested-agent-idle-owner.unit.test.ts @@ -1,6 +1,6 @@ import { afterEach, expect, it, vi } from 'vitest' import { createTestStore } from '../../src/renderer/src/store/slices/store-test-helpers' -import { sleepingRecordFromEntry } from '../../src/renderer/src/store/slices/agent-status-sleeping-records' +import { sleepingRecordFromEntry } from '../../src/renderer/src/store/slices/agent-status/agent-status-sleeping-records' import { getAgentResumeArgv } from '../../src/shared/agent-session-resume' import { readAgentProcess } from '../../src/shared/agent-process-presence-probe' import { AgentHookServer } from '../../src/main/agent-hooks/server'