@openrig/cli 0.7.3 → 0.7.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -5
- package/daemon/assets/plugins/openrig-core/.claude-plugin/plugin.json +1 -1
- package/daemon/assets/plugins/openrig-core/.codex-plugin/plugin.json +1 -1
- package/daemon/assets/plugins/openrig-core/hooks/claude.json +11 -0
- package/daemon/assets/plugins/openrig-core/hooks/scripts/activity-relay.cjs +13 -9
- package/daemon/assets/plugins/openrig-core/skills/queue-handoff/SKILL.md +4 -0
- package/daemon/context-packs/help/help.md +6 -3
- package/daemon/context-packs/help/manifest.yaml +1 -1
- package/daemon/context-packs/onboarding-width/manifest.yaml +1 -1
- package/daemon/context-packs/onboarding-width/public-what-you-can-do.md +37 -5
- package/daemon/context-packs/reference/getting-started.md +7 -5
- package/daemon/context-packs/reference/manifest.yaml +1 -1
- package/daemon/context-packs/reference/rig-spec.md +5 -2
- package/daemon/context-packs/reference/whats-new.md +109 -148
- package/daemon/context-packs/skills/agent-operated-software/manifest.yaml +1 -1
- package/daemon/context-packs/skills/agent-operated-workflows/manifest.yaml +1 -1
- package/daemon/context-packs/skills/applying-a-permission-policy/manifest.yaml +1 -1
- package/daemon/context-packs/skills/claude-compaction-restore/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/agent-starters/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/agent-startup-and-context-ingestion/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/cross-host-rig-commands/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/human-in-the-loop/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/messaging-the-human/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/openrig-architect/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/openrig-cmux/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/openrig-herdr/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/openrig-skills/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/openrig-software-factory/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/openrig-upgrade/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/rig-bundles-and-shareable-artifacts/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/rig-lifecycle/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/session-source-fork/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/specification-system/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/topology-mutation-and-seat-management/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/watchdog/manifest.yaml +1 -1
- package/daemon/context-packs/skills/delegating-work/manifest.yaml +1 -1
- package/daemon/context-packs/skills/forming-an-openrig-mental-model/manifest.yaml +1 -1
- package/daemon/context-packs/skills/loading-addressable-markdown/manifest.yaml +1 -1
- package/daemon/context-packs/skills/mission-slice-sop/manifest.yaml +1 -1
- package/daemon/context-packs/skills/openrig-operating-model/manifest.yaml +1 -1
- package/daemon/context-packs/skills/openrig-user/manifest.yaml +1 -1
- package/daemon/context-packs/skills/orienting-to-an-inherited-seat/manifest.yaml +1 -1
- package/daemon/context-packs/skills/pm/backlog-capture/manifest.yaml +1 -1
- package/daemon/context-packs/skills/pm/context-builder/manifest.yaml +1 -1
- package/daemon/context-packs/skills/pm/exec-summary/manifest.yaml +1 -1
- package/daemon/context-packs/skills/pm/office-hours/manifest.yaml +1 -1
- package/daemon/context-packs/skills/pm/plan-review/manifest.yaml +1 -1
- package/daemon/context-packs/skills/pm/requirements-writer/manifest.yaml +1 -1
- package/daemon/context-packs/skills/pm/ui-mockup/manifest.yaml +1 -1
- package/daemon/context-packs/skills/pods/development-team/manifest.yaml +1 -1
- package/daemon/context-packs/skills/pods/orchestration-team/manifest.yaml +1 -1
- package/daemon/context-packs/skills/pods/oversight-team/manifest.yaml +1 -1
- package/daemon/context-packs/skills/pods/review-team/manifest.yaml +1 -1
- package/daemon/context-packs/skills/process/agent-browser/manifest.yaml +1 -1
- package/daemon/context-packs/skills/process/context-engineering/manifest.yaml +1 -1
- package/daemon/context-packs/skills/process/dogfood/manifest.yaml +1 -1
- package/daemon/context-packs/skills/process/frontend-design/manifest.yaml +1 -1
- package/daemon/context-packs/skills/process/systematic-debugging/manifest.yaml +1 -1
- package/daemon/context-packs/skills/process/test-driven-development/manifest.yaml +1 -1
- package/daemon/context-packs/skills/process/verification-before-completion/manifest.yaml +1 -1
- package/daemon/context-packs/skills/queue-handoff/SKILL.md +4 -0
- package/daemon/context-packs/skills/queue-handoff/manifest.yaml +1 -1
- package/daemon/context-packs/skills/refocusing/manifest.yaml +1 -1
- package/daemon/context-packs/skills/retiring-and-inheriting-a-seat/manifest.yaml +1 -1
- package/daemon/context-packs/skills/seat-continuity-and-handover/manifest.yaml +1 -1
- package/daemon/context-packs/skills/session-compaction-and-restore/manifest.yaml +1 -1
- package/daemon/context-packs/skills/software-for-agents/manifest.yaml +1 -1
- package/daemon/context-packs/world-example/manifest.yaml +1 -1
- package/daemon/context-packs/world-public/manifest.yaml +1 -1
- package/daemon/dist/adapters/claude-code-adapter.d.ts +1 -0
- package/daemon/dist/adapters/claude-code-adapter.d.ts.map +1 -1
- package/daemon/dist/adapters/claude-code-adapter.js +17 -4
- package/daemon/dist/adapters/claude-code-adapter.js.map +1 -1
- package/daemon/dist/adapters/claude-resume.d.ts +1 -1
- package/daemon/dist/adapters/claude-resume.d.ts.map +1 -1
- package/daemon/dist/adapters/claude-resume.js +18 -6
- package/daemon/dist/adapters/claude-resume.js.map +1 -1
- package/daemon/dist/adapters/codex-resume.d.ts +1 -1
- package/daemon/dist/adapters/codex-resume.d.ts.map +1 -1
- package/daemon/dist/adapters/codex-resume.js +9 -3
- package/daemon/dist/adapters/codex-resume.js.map +1 -1
- package/daemon/dist/adapters/codex-runtime-adapter.d.ts +1 -0
- package/daemon/dist/adapters/codex-runtime-adapter.d.ts.map +1 -1
- package/daemon/dist/adapters/codex-runtime-adapter.js +7 -1
- package/daemon/dist/adapters/codex-runtime-adapter.js.map +1 -1
- package/daemon/dist/adapters/pi-openrouter-charge.d.ts.map +1 -1
- package/daemon/dist/adapters/pi-openrouter-charge.js +3 -0
- package/daemon/dist/adapters/pi-openrouter-charge.js.map +1 -1
- package/daemon/dist/adapters/pi-runner.d.ts.map +1 -1
- package/daemon/dist/adapters/pi-runner.js +11 -2
- package/daemon/dist/adapters/pi-runner.js.map +1 -1
- package/daemon/dist/adapters/tmux.d.ts.map +1 -1
- package/daemon/dist/adapters/tmux.js +9 -1
- package/daemon/dist/adapters/tmux.js.map +1 -1
- package/daemon/dist/build-info.js +3 -3
- package/daemon/dist/db/all-migrations.d.ts.map +1 -1
- package/daemon/dist/db/all-migrations.js +2 -0
- package/daemon/dist/db/all-migrations.js.map +1 -1
- package/daemon/dist/db/migrations/140_identity_principal.d.ts +12 -0
- package/daemon/dist/db/migrations/140_identity_principal.d.ts.map +1 -0
- package/daemon/dist/db/migrations/140_identity_principal.js +20 -0
- package/daemon/dist/db/migrations/140_identity_principal.js.map +1 -0
- package/daemon/dist/domain/agent-activity-store.d.ts.map +1 -1
- package/daemon/dist/domain/agent-activity-store.js +3 -1
- package/daemon/dist/domain/agent-activity-store.js.map +1 -1
- package/daemon/dist/domain/current-restore-snapshot.d.ts +8 -0
- package/daemon/dist/domain/current-restore-snapshot.d.ts.map +1 -0
- package/daemon/dist/domain/current-restore-snapshot.js +26 -0
- package/daemon/dist/domain/current-restore-snapshot.js.map +1 -0
- package/daemon/dist/domain/draft-aware-delivery.js +1 -1
- package/daemon/dist/domain/draft-aware-delivery.js.map +1 -1
- package/daemon/dist/domain/gateway/destination-resolver.d.ts +6 -0
- package/daemon/dist/domain/gateway/destination-resolver.d.ts.map +1 -1
- package/daemon/dist/domain/gateway/destination-resolver.js +8 -1
- package/daemon/dist/domain/gateway/destination-resolver.js.map +1 -1
- package/daemon/dist/domain/gateway/slack/slack-subsystem.d.ts.map +1 -1
- package/daemon/dist/domain/gateway/slack/slack-subsystem.js +3 -2
- package/daemon/dist/domain/gateway/slack/slack-subsystem.js.map +1 -1
- package/daemon/dist/domain/hosted-wake.d.ts +19 -0
- package/daemon/dist/domain/hosted-wake.d.ts.map +1 -0
- package/daemon/dist/domain/hosted-wake.js +56 -0
- package/daemon/dist/domain/hosted-wake.js.map +1 -0
- package/daemon/dist/domain/kernel-boot.d.ts +10 -4
- package/daemon/dist/domain/kernel-boot.d.ts.map +1 -1
- package/daemon/dist/domain/kernel-boot.js +14 -7
- package/daemon/dist/domain/kernel-boot.js.map +1 -1
- package/daemon/dist/domain/node-inventory.d.ts +1 -1
- package/daemon/dist/domain/node-inventory.d.ts.map +1 -1
- package/daemon/dist/domain/node-inventory.js +10 -5
- package/daemon/dist/domain/node-inventory.js.map +1 -1
- package/daemon/dist/domain/node-launcher.d.ts +5 -0
- package/daemon/dist/domain/node-launcher.d.ts.map +1 -1
- package/daemon/dist/domain/node-launcher.js +35 -1
- package/daemon/dist/domain/node-launcher.js.map +1 -1
- package/daemon/dist/domain/outbox-handler.d.ts +3 -0
- package/daemon/dist/domain/outbox-handler.d.ts.map +1 -1
- package/daemon/dist/domain/outbox-handler.js +10 -4
- package/daemon/dist/domain/outbox-handler.js.map +1 -1
- package/daemon/dist/domain/policies/artifact-pool-helpers.d.ts +3 -1
- package/daemon/dist/domain/policies/artifact-pool-helpers.d.ts.map +1 -1
- package/daemon/dist/domain/policies/artifact-pool-helpers.js +1 -1
- package/daemon/dist/domain/policies/artifact-pool-helpers.js.map +1 -1
- package/daemon/dist/domain/policies/edge-artifact-required.d.ts.map +1 -1
- package/daemon/dist/domain/policies/edge-artifact-required.js +3 -0
- package/daemon/dist/domain/policies/edge-artifact-required.js.map +1 -1
- package/daemon/dist/domain/provider/claude-interruption.d.ts +3 -0
- package/daemon/dist/domain/provider/claude-interruption.d.ts.map +1 -0
- package/daemon/dist/domain/provider/claude-interruption.js +5 -0
- package/daemon/dist/domain/provider/claude-interruption.js.map +1 -0
- package/daemon/dist/domain/provider/host-usage-rollup.js +18 -8
- package/daemon/dist/domain/provider/host-usage-rollup.js.map +1 -1
- package/daemon/dist/domain/provider/provider-signals.d.ts +12 -5
- package/daemon/dist/domain/provider/provider-signals.d.ts.map +1 -1
- package/daemon/dist/domain/provider/provider-signals.js +31 -8
- package/daemon/dist/domain/provider/provider-signals.js.map +1 -1
- package/daemon/dist/domain/provider/reactive-tap.d.ts +4 -4
- package/daemon/dist/domain/provider/reactive-tap.d.ts.map +1 -1
- package/daemon/dist/domain/provider/reactive-tap.js +20 -4
- package/daemon/dist/domain/provider/reactive-tap.js.map +1 -1
- package/daemon/dist/domain/ps-projection.d.ts.map +1 -1
- package/daemon/dist/domain/ps-projection.js +3 -2
- package/daemon/dist/domain/ps-projection.js.map +1 -1
- package/daemon/dist/domain/queue-repository.d.ts +15 -1
- package/daemon/dist/domain/queue-repository.d.ts.map +1 -1
- package/daemon/dist/domain/queue-repository.js +66 -10
- package/daemon/dist/domain/queue-repository.js.map +1 -1
- package/daemon/dist/domain/queue-retention.d.ts.map +1 -1
- package/daemon/dist/domain/queue-retention.js +4 -2
- package/daemon/dist/domain/queue-retention.js.map +1 -1
- package/daemon/dist/domain/queue-stuck-sweep.d.ts.map +1 -1
- package/daemon/dist/domain/queue-stuck-sweep.js +35 -0
- package/daemon/dist/domain/queue-stuck-sweep.js.map +1 -1
- package/daemon/dist/domain/queue-transition-log.d.ts +6 -0
- package/daemon/dist/domain/queue-transition-log.d.ts.map +1 -1
- package/daemon/dist/domain/queue-transition-log.js +11 -2
- package/daemon/dist/domain/queue-transition-log.js.map +1 -1
- package/daemon/dist/domain/queue-wake-ladder.d.ts +1 -1
- package/daemon/dist/domain/queue-wake-ladder.d.ts.map +1 -1
- package/daemon/dist/domain/queue-wake-ladder.js +2 -1
- package/daemon/dist/domain/queue-wake-ladder.js.map +1 -1
- package/daemon/dist/domain/reconciler.d.ts +2 -0
- package/daemon/dist/domain/reconciler.d.ts.map +1 -1
- package/daemon/dist/domain/reconciler.js +5 -2
- package/daemon/dist/domain/reconciler.js.map +1 -1
- package/daemon/dist/domain/restore-orchestrator.d.ts +17 -2
- package/daemon/dist/domain/restore-orchestrator.d.ts.map +1 -1
- package/daemon/dist/domain/restore-orchestrator.js +169 -42
- package/daemon/dist/domain/restore-orchestrator.js.map +1 -1
- package/daemon/dist/domain/restore-plan-preview.d.ts +27 -1
- package/daemon/dist/domain/restore-plan-preview.d.ts.map +1 -1
- package/daemon/dist/domain/restore-plan-preview.js +51 -29
- package/daemon/dist/domain/restore-plan-preview.js.map +1 -1
- package/daemon/dist/domain/review/gather.d.ts +11 -0
- package/daemon/dist/domain/review/gather.d.ts.map +1 -1
- package/daemon/dist/domain/review/gather.js +64 -26
- package/daemon/dist/domain/review/gather.js.map +1 -1
- package/daemon/dist/domain/rosters.d.ts +46 -0
- package/daemon/dist/domain/rosters.d.ts.map +1 -0
- package/daemon/dist/domain/rosters.js +80 -0
- package/daemon/dist/domain/rosters.js.map +1 -0
- package/daemon/dist/domain/runtime-adapter.d.ts +2 -0
- package/daemon/dist/domain/runtime-adapter.d.ts.map +1 -1
- package/daemon/dist/domain/seat-attention-reconciler.d.ts +2 -0
- package/daemon/dist/domain/seat-attention-reconciler.d.ts.map +1 -1
- package/daemon/dist/domain/seat-attention-reconciler.js +10 -1
- package/daemon/dist/domain/seat-attention-reconciler.js.map +1 -1
- package/daemon/dist/domain/seat-handover-service.d.ts +6 -0
- package/daemon/dist/domain/seat-handover-service.d.ts.map +1 -1
- package/daemon/dist/domain/seat-handover-service.js +83 -2
- package/daemon/dist/domain/seat-handover-service.js.map +1 -1
- package/daemon/dist/domain/seat-lifecycle-service.d.ts.map +1 -1
- package/daemon/dist/domain/session-transport.d.ts +2 -0
- package/daemon/dist/domain/session-transport.d.ts.map +1 -1
- package/daemon/dist/domain/session-transport.js +11 -5
- package/daemon/dist/domain/session-transport.js.map +1 -1
- package/daemon/dist/domain/shared-history-selection.d.ts +34 -0
- package/daemon/dist/domain/shared-history-selection.d.ts.map +1 -0
- package/daemon/dist/domain/shared-history-selection.js +74 -0
- package/daemon/dist/domain/shared-history-selection.js.map +1 -0
- package/daemon/dist/domain/snapshot-capture.d.ts +1 -0
- package/daemon/dist/domain/snapshot-capture.d.ts.map +1 -1
- package/daemon/dist/domain/snapshot-capture.js +43 -1
- package/daemon/dist/domain/snapshot-capture.js.map +1 -1
- package/daemon/dist/domain/startup-orchestrator.d.ts +2 -0
- package/daemon/dist/domain/startup-orchestrator.d.ts.map +1 -1
- package/daemon/dist/domain/startup-orchestrator.js +9 -5
- package/daemon/dist/domain/startup-orchestrator.js.map +1 -1
- package/daemon/dist/domain/startup-submission-evidence.d.ts +6 -0
- package/daemon/dist/domain/startup-submission-evidence.d.ts.map +1 -1
- package/daemon/dist/domain/startup-submission-evidence.js +6 -0
- package/daemon/dist/domain/startup-submission-evidence.js.map +1 -1
- package/daemon/dist/domain/terminal/task-terminal-view.d.ts +50 -0
- package/daemon/dist/domain/terminal/task-terminal-view.d.ts.map +1 -0
- package/daemon/dist/domain/terminal/task-terminal-view.js +227 -0
- package/daemon/dist/domain/terminal/task-terminal-view.js.map +1 -0
- package/daemon/dist/domain/terminal/terminal-provider.d.ts +9 -0
- package/daemon/dist/domain/terminal/terminal-provider.d.ts.map +1 -1
- package/daemon/dist/domain/terminal/terminal-provider.js +0 -15
- package/daemon/dist/domain/terminal/terminal-provider.js.map +1 -1
- package/daemon/dist/domain/terminal/terminal-service.d.ts +7 -2
- package/daemon/dist/domain/terminal/terminal-service.d.ts.map +1 -1
- package/daemon/dist/domain/terminal/terminal-service.js +25 -3
- package/daemon/dist/domain/terminal/terminal-service.js.map +1 -1
- package/daemon/dist/domain/types.d.ts +7 -0
- package/daemon/dist/domain/types.d.ts.map +1 -1
- package/daemon/dist/domain/types.js.map +1 -1
- package/daemon/dist/domain/usage-series.d.ts.map +1 -1
- package/daemon/dist/domain/usage-series.js +17 -3
- package/daemon/dist/domain/usage-series.js.map +1 -1
- package/daemon/dist/index.d.ts.map +1 -1
- package/daemon/dist/index.js +4 -1
- package/daemon/dist/index.js.map +1 -1
- package/daemon/dist/rosters-surface.d.ts +2 -0
- package/daemon/dist/rosters-surface.d.ts.map +1 -0
- package/daemon/dist/rosters-surface.js +4 -0
- package/daemon/dist/rosters-surface.js.map +1 -0
- package/daemon/dist/routes/queue.d.ts.map +1 -1
- package/daemon/dist/routes/queue.js +7 -6
- package/daemon/dist/routes/queue.js.map +1 -1
- package/daemon/dist/routes/require-sender-identity.d.ts +26 -0
- package/daemon/dist/routes/require-sender-identity.d.ts.map +1 -1
- package/daemon/dist/routes/require-sender-identity.js +54 -0
- package/daemon/dist/routes/require-sender-identity.js.map +1 -1
- package/daemon/dist/routes/startup.d.ts.map +1 -1
- package/daemon/dist/routes/startup.js +269 -3
- package/daemon/dist/routes/startup.js.map +1 -1
- package/daemon/dist/routes/transport.d.ts.map +1 -1
- package/daemon/dist/routes/transport.js +9 -3
- package/daemon/dist/routes/transport.js.map +1 -1
- package/daemon/dist/startup.d.ts.map +1 -1
- package/daemon/dist/startup.js +16 -1
- package/daemon/dist/startup.js.map +1 -1
- package/daemon/docs/reference/agent-state-taxonomy.md +7 -0
- package/daemon/docs/reference/claude-status-line.md +42 -0
- package/daemon/docs/reference/community-harness-examples/hermes/hermes.yaml +1 -1
- package/daemon/docs/reference/community-harness-presets.md +13 -3
- package/daemon/docs/reference/getting-started.md +7 -5
- package/daemon/docs/reference/help.md +6 -3
- package/daemon/docs/reference/hosted-members.md +110 -0
- package/daemon/docs/reference/quickstart.md +3 -3
- package/daemon/docs/reference/rig-spec.md +5 -2
- package/daemon/docs/reference/rosters.md +6 -0
- package/daemon/docs/reference/terminal-sessions.md +45 -0
- package/daemon/docs/reference/whats-new.md +109 -148
- package/dist/build-info.js +3 -3
- package/dist/client.d.ts +16 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +53 -25
- package/dist/client.js.map +1 -1
- package/dist/commands/daemon.d.ts.map +1 -1
- package/dist/commands/daemon.js +6 -1
- package/dist/commands/daemon.js.map +1 -1
- package/dist/commands/mcp.d.ts.map +1 -1
- package/dist/commands/mcp.js +58 -14
- package/dist/commands/mcp.js.map +1 -1
- package/dist/commands/queue.d.ts.map +1 -1
- package/dist/commands/queue.js +4 -2
- package/dist/commands/queue.js.map +1 -1
- package/dist/commands/roster.d.ts +7 -27
- package/dist/commands/roster.d.ts.map +1 -1
- package/dist/commands/roster.js +17 -52
- package/dist/commands/roster.js.map +1 -1
- package/dist/commands/seat.d.ts.map +1 -1
- package/dist/commands/seat.js +41 -0
- package/dist/commands/seat.js.map +1 -1
- package/dist/commands/start.d.ts.map +1 -1
- package/dist/commands/start.js +3 -6
- package/dist/commands/start.js.map +1 -1
- package/dist/commands/terminal.js +1 -1
- package/dist/commands/terminal.js.map +1 -1
- package/dist/commands/whoami.d.ts.map +1 -1
- package/dist/commands/whoami.js +2 -1
- package/dist/commands/whoami.js.map +1 -1
- package/dist/daemon-lifecycle.d.ts +4 -0
- package/dist/daemon-lifecycle.d.ts.map +1 -1
- package/dist/daemon-lifecycle.js +11 -0
- package/dist/daemon-lifecycle.js.map +1 -1
- package/dist/mcp-http.d.ts +38 -2
- package/dist/mcp-http.d.ts.map +1 -1
- package/dist/mcp-http.js +303 -36
- package/dist/mcp-http.js.map +1 -1
- package/dist/mcp-presence.d.ts +14 -0
- package/dist/mcp-presence.d.ts.map +1 -0
- package/dist/mcp-presence.js +50 -0
- package/dist/mcp-presence.js.map +1 -0
- package/dist/mcp-server.d.ts +12 -2
- package/dist/mcp-server.d.ts.map +1 -1
- package/dist/mcp-server.js +620 -204
- package/dist/mcp-server.js.map +1 -1
- package/dist/rig-handle.d.ts +1 -0
- package/dist/rig-handle.d.ts.map +1 -1
- package/dist/rig-handle.js +9 -0
- package/dist/rig-handle.js.map +1 -1
- package/package.json +5 -2
- package/tui/dist/daemon-client.d.ts +2 -1
- package/tui/dist/daemon-client.d.ts.map +1 -1
- package/tui/dist/daemon-client.js +3 -2
- package/tui/dist/daemon-client.js.map +1 -1
- package/tui/dist/hydrate.d.ts.map +1 -1
- package/tui/dist/hydrate.js +7 -2
- package/tui/dist/hydrate.js.map +1 -1
- package/tui/dist/main.js +7 -3
- package/tui/dist/main.js.map +1 -1
- package/tui/dist/render.d.ts +6 -0
- package/tui/dist/render.d.ts.map +1 -1
- package/tui/dist/render.js +6 -0
- package/tui/dist/render.js.map +1 -1
|
@@ -13,6 +13,7 @@ import { NativePermissionStore } from "./native-permission-store.js";
|
|
|
13
13
|
import { resolvePermissionPolicyAttachment } from "./permission-policy/policy-ref.js";
|
|
14
14
|
import { claudeResumeRotation } from "./session-registry.js";
|
|
15
15
|
import { seatRuntimeHome } from "./seat-runtime-home.js";
|
|
16
|
+
import { readFreshOccupantRelations } from "./fresh-occupant-relation.js";
|
|
16
17
|
import { assessNativeResumeProbe } from "./native-resume-probe.js";
|
|
17
18
|
import { resumeProbeEvidence } from "./native-resume-probe-evidence.js";
|
|
18
19
|
import { observeClaudeDelivery, observeClaudeResumeLaunch, verifyClaudePaneProcess, verifyPaneIdleShell } from "./native-process-lineage.js";
|
|
@@ -84,17 +85,20 @@ function seatFacts(data, nodeId, savedRuntime, currentRuntime) {
|
|
|
84
85
|
/** What `rig launch` does for this node from this snapshot without --fresh, read as the restore path reads it: the
|
|
85
86
|
* occupant, then the pre-launch stop-and-ask check, then the resume decision (restoreNodeWithCompensation and the
|
|
86
87
|
* resume step after it). An exited agent's message offers stop-then-launch as a resume only when this says so. */
|
|
87
|
-
export function snapshotLaunchOutcome(data, nodeId, runtime, savedRuntime) {
|
|
88
|
+
export function snapshotLaunchOutcome(data, nodeId, runtime, savedRuntime, resumePeriodicCarry = false) {
|
|
88
89
|
const occupant = resolveActiveSnapshotSession(data, nodeId);
|
|
89
90
|
if (occupant.kind === "ambiguous")
|
|
90
91
|
return { kind: "unrecoverable", why: "can't tell which saved session is this seat's" };
|
|
91
|
-
const session = occupant.kind === "resolved" ? occupant.session
|
|
92
|
+
const session = occupant.kind === "resolved" ? occupant.session
|
|
93
|
+
: occupant.kind === "none" && resumePeriodicCarry ? data.periodicResumeSourcesByNode?.[nodeId] ?? null : null;
|
|
94
|
+
if (session && session.nodeId !== nodeId)
|
|
95
|
+
return { kind: "decision", why: "the periodic resume source belongs to another agent" };
|
|
92
96
|
const runtimeError = restoreRuntimeCompatibilityError(runtime, data.nodeStartupContext?.[nodeId]?.runtime);
|
|
93
97
|
if (runtimeError)
|
|
94
98
|
return { kind: "decision", why: runtimeError };
|
|
95
99
|
if (!session) {
|
|
96
100
|
// The restore's own rule for a seat stopped at capture whose earlier occupant left a token.
|
|
97
|
-
const prior = occupant.kind === "none" ? absentSeatResumeHistory(data.sessions, nodeId) : null;
|
|
101
|
+
const prior = occupant.kind === "none" ? data.periodicResumeSourcesByNode?.[nodeId] ?? absentSeatResumeHistory(data.sessions, nodeId) : null;
|
|
98
102
|
return prior
|
|
99
103
|
? { kind: "decision", why: `had no running occupant for this seat when it was taken, but an earlier occupant left a '${prior.resumeType}' resume token` }
|
|
100
104
|
: { kind: "fresh", why: "saves no session for this seat" };
|
|
@@ -174,6 +178,17 @@ export class RestoreOrchestrator {
|
|
|
174
178
|
this.routerLineSettings = deps.routerLineSettings;
|
|
175
179
|
this.appliedLaunchStore = new AppliedLaunchObservationStore(deps.db);
|
|
176
180
|
}
|
|
181
|
+
/** Read-only structural adapter check for a recorded native resume identity.
|
|
182
|
+
* Launch preparation and native existence checks remain on the execution path. */
|
|
183
|
+
canAttemptRecordedResume(runtime, resumeType, resumeToken) {
|
|
184
|
+
if (typeof resumeToken !== "string" || !resumeToken.trim())
|
|
185
|
+
return false;
|
|
186
|
+
if (runtime === "codex")
|
|
187
|
+
return resumeType === "codex_id" && this.codexResume.canResume(resumeType, resumeToken);
|
|
188
|
+
if (runtime === "claude-code")
|
|
189
|
+
return this.claudeResume.canResume(resumeType, resumeToken);
|
|
190
|
+
return false;
|
|
191
|
+
}
|
|
177
192
|
async restore(snapshotId, opts) {
|
|
178
193
|
// 1. Load snapshot
|
|
179
194
|
const snapshot = this.snapshotRepo.getSnapshot(snapshotId);
|
|
@@ -413,7 +428,7 @@ export class RestoreOrchestrator {
|
|
|
413
428
|
/** `keepPane`: the seat is running and is relaunched in its own pane (its process ended in place, the pane and scrollback
|
|
414
429
|
* kept) instead of a new session; nothing checks whether it is live first, since that is the point. */
|
|
415
430
|
async launchSingleNode(rigId, logicalId, opts) {
|
|
416
|
-
return this.launchNodeTargets(rigId, [logicalId], { ...opts, nonTargetMode: "unchanged" });
|
|
431
|
+
return this.launchNodeTargets(rigId, [logicalId], { ...opts, namedAgent: true, nonTargetMode: "unchanged" });
|
|
417
432
|
}
|
|
418
433
|
async launchNodeTargets(rigId, logicalIds, opts) {
|
|
419
434
|
const rig = this.rigRepo.getRig(rigId);
|
|
@@ -423,6 +438,11 @@ export class RestoreOrchestrator {
|
|
|
423
438
|
if (!selected.ok)
|
|
424
439
|
return selected;
|
|
425
440
|
const { snapshot, selection: snapshotSelection } = selected;
|
|
441
|
+
const resumePeriodicCarry = opts.namedAgent === true && snapshot.kind === "auto-periodic"
|
|
442
|
+
&& snapshotSelection.mode === "automatic";
|
|
443
|
+
if (opts.selectedHistory && (opts.snapshotId !== snapshot.id || !opts.selectedHistory.beforeEffect())) {
|
|
444
|
+
return { ok: false, code: "selection_changed", message: "The selected history or seat changed. Refresh the review." };
|
|
445
|
+
}
|
|
426
446
|
const allNodes = rig.nodes;
|
|
427
447
|
const targetNodes = resolveSnapshotRestoreTopology(snapshot.data).intendedNodes
|
|
428
448
|
.filter((node) => logicalIds.includes(node.logicalId));
|
|
@@ -430,6 +450,10 @@ export class RestoreOrchestrator {
|
|
|
430
450
|
const unmatchedIds = logicalIds.filter((id) => !matchedIds.has(id));
|
|
431
451
|
if (targetNodes.length === 0)
|
|
432
452
|
return { ok: false, code: "no_matching_nodes", message: `No nodes match logical ids: ${logicalIds.join(", ")}` };
|
|
453
|
+
if (opts.selectedHistory && (targetNodes.length !== 1 || targetNodes[0].id !== opts.selectedHistory.nodeId
|
|
454
|
+
|| !allNodes.some(node => node.id === opts.selectedHistory.nodeId && node.logicalId === logicalIds[0]))) {
|
|
455
|
+
return { ok: false, code: "selection_changed", message: "The selected node is no longer this seat." };
|
|
456
|
+
}
|
|
433
457
|
const nonTargetNodes = opts.nonTargetMode === "detach_and_hold"
|
|
434
458
|
? allNodes.filter((node) => !targetNodes.some((target) => target.id === node.id))
|
|
435
459
|
: [];
|
|
@@ -447,8 +471,11 @@ export class RestoreOrchestrator {
|
|
|
447
471
|
// discarded, so restore.subset_completed carried warnings: [].
|
|
448
472
|
const subsetWarnings = [];
|
|
449
473
|
for (const node of targetNodes) {
|
|
474
|
+
if (opts.selectedHistory && !opts.selectedHistory.beforeEffect()) {
|
|
475
|
+
return { ok: false, code: "selection_changed", message: "The selected history or seat changed. Refresh the review." };
|
|
476
|
+
}
|
|
450
477
|
if (opts.keepPane) {
|
|
451
|
-
launched.push(await this.restoreNodeWithCompensation({ node }, rigId, snapshot.id, snapshot.data, { adapters: opts.adapters, fsOps: opts.fsOps, keepPane: true }, subsetWarnings));
|
|
478
|
+
launched.push(await this.restoreNodeWithCompensation({ node }, rigId, snapshot.id, snapshot.data, { adapters: opts.adapters, fsOps: opts.fsOps, keepPane: true, resumePeriodicCarry }, subsetWarnings));
|
|
452
479
|
continue;
|
|
453
480
|
}
|
|
454
481
|
// An external CLI's claim has no tmux session to probe; restoreNodeWithCompensation leaves it attached.
|
|
@@ -487,19 +514,29 @@ export class RestoreOrchestrator {
|
|
|
487
514
|
}
|
|
488
515
|
}
|
|
489
516
|
if (isLive) {
|
|
517
|
+
if (opts.selectedHistory)
|
|
518
|
+
return { ok: false, code: "seat_running", message: "The selected seat is already running; no resume was started." };
|
|
490
519
|
alreadyRunning.push({ nodeId: node.id, logicalId: node.logicalId });
|
|
491
520
|
continue;
|
|
492
521
|
}
|
|
493
522
|
if (idleSession) {
|
|
523
|
+
if (opts.selectedHistory)
|
|
524
|
+
return { ok: false, code: "seat_occupied", message: "The selected seat has a live pane; no resume was started." };
|
|
494
525
|
// Keep the pane/history and the existing per-target failure contract.
|
|
495
526
|
// Choosing a fresh versus resumed conversation belongs to the person. Stopping closes the pane, so
|
|
496
527
|
// stop-then-launch is offered as a resume only when this snapshot can resume the seat; otherwise the
|
|
497
|
-
// message says what that launch would do instead.
|
|
528
|
+
// message says what that launch would do instead. Only resolved occupants
|
|
529
|
+
// can pin this snapshot; an automatic carry must be selected automatically again.
|
|
498
530
|
const liveNode = allNodes.find(current => current.logicalId === node.logicalId);
|
|
499
|
-
const outcome = snapshotLaunchOutcome(snapshot.data, node.id, liveNode ? liveNode.runtime : node.runtime, node.runtime);
|
|
500
|
-
const
|
|
531
|
+
const outcome = snapshotLaunchOutcome(snapshot.data, node.id, liveNode ? liveNode.runtime : node.runtime, node.runtime, resumePeriodicCarry && liveNode?.id === node.id);
|
|
532
|
+
const automaticCarry = resumePeriodicCarry
|
|
533
|
+
&& resolveActiveSnapshotSession(snapshot.data, node.id).kind === "none"
|
|
534
|
+
&& !!snapshot.data.periodicResumeSourcesByNode?.[node.id];
|
|
535
|
+
const launchCommand = `rig launch ${rigId} ${node.logicalId}${automaticCarry ? "" : ` --snapshot-id ${snapshot.id}`}`;
|
|
501
536
|
const relaunch = outcome.kind === "resume"
|
|
502
|
-
?
|
|
537
|
+
? automaticCarry
|
|
538
|
+
? `To retry automatic resume: rig seat stop ${idleSession} --reason "<why>", then ${launchCommand} (this closes the pane; launch reselects the latest usable snapshot rather than pinning this one, so the result depends on that new selection). `
|
|
539
|
+
: `To resume its conversation: rig seat stop ${idleSession} --reason "<why>", then ${launchCommand} (this closes the pane, and launch resumes from that snapshot's resume token). `
|
|
503
540
|
: `Stopping it and launching from snapshot ${snapshot.id} won't resume this conversation: that snapshot ${outcome.why}, so launch would `
|
|
504
541
|
+ `${outcome.kind === "fresh" ? "start a fresh conversation" : outcome.kind === "decision" ? "start nothing and ask for a decision" : "fail"}. `;
|
|
505
542
|
launched.push({
|
|
@@ -512,6 +549,8 @@ export class RestoreOrchestrator {
|
|
|
512
549
|
continue;
|
|
513
550
|
}
|
|
514
551
|
if (isUnknown) {
|
|
552
|
+
if (opts.selectedHistory)
|
|
553
|
+
return { ok: false, code: "seat_unverified", message: "The selected seat's terminal could not be verified; no resume was started." };
|
|
515
554
|
// OPR.0.4.3.28 correction — INVERT the fail-closed-on-unknown launch default. A failed tmux
|
|
516
555
|
// liveness probe is NOT positive evidence of a live seat (only isLive, above, is). Deny-by-
|
|
517
556
|
// default here hard-503'd all restore/launch on a transient tmux blip. Instead PROCEED to
|
|
@@ -524,8 +563,11 @@ export class RestoreOrchestrator {
|
|
|
524
563
|
// node's warnings into
|
|
525
564
|
// the subset-level array so they survive to restore.subset_completed + the
|
|
526
565
|
// API result (FR-5 fallback observability must not be discarded here).
|
|
566
|
+
if (opts.selectedHistory && !opts.selectedHistory.beforeEffect()) {
|
|
567
|
+
return { ok: false, code: "selection_changed", message: "The selected history or seat changed during terminal verification. No resume was started." };
|
|
568
|
+
}
|
|
527
569
|
const planEntry = { node };
|
|
528
|
-
const result = await this.restoreNodeWithCompensation(planEntry, rigId, snapshot.id, snapshot.data, { adapters: opts?.adapters, fsOps: opts?.fsOps }, subsetWarnings);
|
|
570
|
+
const result = await this.restoreNodeWithCompensation(planEntry, rigId, snapshot.id, snapshot.data, { adapters: opts?.adapters, fsOps: opts?.fsOps, selectedHistory: opts.selectedHistory, resumePeriodicCarry }, subsetWarnings);
|
|
529
571
|
launched.push(result);
|
|
530
572
|
}
|
|
531
573
|
// Emit restore.subset_completed for launched targets only
|
|
@@ -802,8 +844,13 @@ export class RestoreOrchestrator {
|
|
|
802
844
|
async restoreNodeWithCompensation(entry, rigId, snapshotId, data, opts, warnings, preserveStoppedCurrent = false) {
|
|
803
845
|
// Compare against the live logical target without changing saved post-launch inputs.
|
|
804
846
|
const node = entry.node;
|
|
805
|
-
const liveNode = this.rigRepo.getRig(rigId)?.nodes.find(current => current.logicalId === node.logicalId
|
|
847
|
+
const liveNode = this.rigRepo.getRig(rigId)?.nodes.find(current => current.logicalId === node.logicalId
|
|
848
|
+
&& (!opts?.selectedHistory || current.id === node.id));
|
|
806
849
|
const nodeId = node.id;
|
|
850
|
+
const selectedHistory = opts?.selectedHistory;
|
|
851
|
+
if (selectedHistory && (!liveNode || selectedHistory.nodeId !== nodeId || !selectedHistory.beforeEffect())) {
|
|
852
|
+
return { nodeId, logicalId: node.logicalId, status: "failed", error: "The selected seat or history changed before launch." };
|
|
853
|
+
}
|
|
807
854
|
// A seat joined with `rig attach` as an external CLI keeps its attachment: launching here would replace it.
|
|
808
855
|
const external = this.sessionRegistry.getBindingForNode(nodeId);
|
|
809
856
|
if (external?.attachmentType === "external_cli") {
|
|
@@ -815,7 +862,13 @@ export class RestoreOrchestrator {
|
|
|
815
862
|
// (classified running downstream) while the occupant truth is ambiguous,
|
|
816
863
|
// bypassing A1's loud-failure semantics. Resolved/none/legacy states
|
|
817
864
|
// fall through to absent-history classification and the continuity check.
|
|
818
|
-
const
|
|
865
|
+
const selectedRows = selectedHistory ? data.sessions.filter(row => row.nodeId === nodeId && row.id === selectedHistory.historySessionId) : [];
|
|
866
|
+
if (selectedHistory && selectedRows.length !== 1) {
|
|
867
|
+
return { nodeId, logicalId: node.logicalId, status: "failed", error: "The selected history is no longer in this snapshot." };
|
|
868
|
+
}
|
|
869
|
+
const occupantResolution = selectedHistory
|
|
870
|
+
? { kind: "resolved", session: selectedRows[0] }
|
|
871
|
+
: resolveActiveSnapshotSession(data, nodeId);
|
|
819
872
|
if (occupantResolution.kind === "ambiguous") {
|
|
820
873
|
return {
|
|
821
874
|
nodeId,
|
|
@@ -825,7 +878,30 @@ export class RestoreOrchestrator {
|
|
|
825
878
|
};
|
|
826
879
|
}
|
|
827
880
|
const freshRequested = opts?.freshLogicalIds?.includes(node.logicalId) ?? false;
|
|
828
|
-
|
|
881
|
+
const carried = opts?.resumePeriodicCarry && !selectedHistory && !freshRequested
|
|
882
|
+
&& occupantResolution.kind === "none" && liveNode?.id === nodeId
|
|
883
|
+
? data.periodicResumeSourcesByNode?.[nodeId] : undefined;
|
|
884
|
+
if (carried && carried.nodeId !== nodeId) {
|
|
885
|
+
return { nodeId, logicalId: node.logicalId, status: "awaiting-decision", error: "The periodic resume source belongs to another agent. No session was started." };
|
|
886
|
+
}
|
|
887
|
+
if (carried) {
|
|
888
|
+
// The launch lifecycle lease is held here, before any stale-state cleanup
|
|
889
|
+
// or destination registration. Capture-time eligibility can have expired
|
|
890
|
+
// without another tick; never resume a conversation a fresh launch retired.
|
|
891
|
+
const newest = this.sessionRegistry.getSessionsForRig(rigId).filter(row => row.nodeId === nodeId)
|
|
892
|
+
.reduce((latest, row) => !latest || row.id > latest.id ? row : latest, null);
|
|
893
|
+
const fresh = readFreshOccupantRelations(this.db, rigId);
|
|
894
|
+
if (!absentSeatResumeHistory([carried], nodeId) || !newest || newest.id !== carried.id
|
|
895
|
+
|| newest.restorePolicy !== "resume_if_possible" || newest.status === "superseded"
|
|
896
|
+
|| liveNode?.runtime !== node.runtime
|
|
897
|
+
|| (!!newest.resumeToken?.trim() && (newest.resumeToken !== carried.resumeToken || newest.resumeType !== carried.resumeType))
|
|
898
|
+
|| (Object.hasOwn(fresh, nodeId) && fresh[nodeId] !== carried.id)) {
|
|
899
|
+
return { nodeId, logicalId: node.logicalId, status: "awaiting-decision",
|
|
900
|
+
error: "The periodic resume source is no longer this seat's current resumable session. No session was started. Review its history or deliberately start this seat fresh." };
|
|
901
|
+
}
|
|
902
|
+
}
|
|
903
|
+
const resumeSession = occupantResolution.kind === "resolved" ? occupantResolution.session : carried ?? null;
|
|
904
|
+
if (occupantResolution.kind === "none" && preserveStoppedCurrent && !freshRequested && !carried) {
|
|
829
905
|
return { nodeId, logicalId: node.logicalId, status: "awaiting-decision", error: stoppedSnapshotReason(node.logicalId, data.rig.name) };
|
|
830
906
|
}
|
|
831
907
|
const runtimeError = restoreRuntimeCompatibilityError(liveNode ? liveNode.runtime : node.runtime, data.nodeStartupContext?.[nodeId]?.runtime);
|
|
@@ -834,8 +910,8 @@ export class RestoreOrchestrator {
|
|
|
834
910
|
}
|
|
835
911
|
// Classify absent-seat history before the continuity short-circuit: a
|
|
836
912
|
// restoring seat must not report fresh while its forecast awaits a decision.
|
|
837
|
-
const priorWithToken = occupantResolution.kind === "none" && !freshRequested
|
|
838
|
-
? absentSeatResumeHistory(data.sessions, nodeId)
|
|
913
|
+
const priorWithToken = occupantResolution.kind === "none" && !freshRequested && !carried
|
|
914
|
+
? data.periodicResumeSourcesByNode?.[nodeId] ?? absentSeatResumeHistory(data.sessions, nodeId)
|
|
839
915
|
: null;
|
|
840
916
|
if (priorWithToken) {
|
|
841
917
|
return { nodeId, logicalId: node.logicalId, status: "awaiting-decision", error: absentSeatResumeHistoryError(node.logicalId, priorWithToken.resumeType, this.rigRepo.getRig(rigId)?.rig.name ?? data.rig.name) };
|
|
@@ -845,6 +921,8 @@ export class RestoreOrchestrator {
|
|
|
845
921
|
const continuityRow = this.db.prepare("SELECT status FROM continuity_state WHERE pod_id = ? AND node_id = ?").get(node.podId, nodeId);
|
|
846
922
|
if (continuityRow) {
|
|
847
923
|
if (continuityRow.status === "restoring") {
|
|
924
|
+
if (selectedHistory)
|
|
925
|
+
return { nodeId, logicalId: node.logicalId, status: "failed", error: "Continuity recovery already owns this seat." };
|
|
848
926
|
if (opts?.automaticReplacements?.some(target => target.nodeId === nodeId)) {
|
|
849
927
|
return { nodeId, logicalId: node.logicalId, status: "awaiting-decision", error: "Continuity recovery owns this seat; its startup occupant was left unchanged." };
|
|
850
928
|
}
|
|
@@ -872,7 +950,7 @@ export class RestoreOrchestrator {
|
|
|
872
950
|
// OPR.0.5.7.1 D1 — the active occupant was RESOLVED once at the top of
|
|
873
951
|
// this function (before the continuity consult); ambiguity already
|
|
874
952
|
// returned there, so only resolved/none reach here.
|
|
875
|
-
const snapSession =
|
|
953
|
+
const snapSession = resumeSession;
|
|
876
954
|
const policy = effectiveRestorePolicy(seatFacts(data, nodeId, node.runtime, liveNode ? liveNode.runtime : node.runtime), snapSession?.restorePolicy);
|
|
877
955
|
const resumeSourceRecorded = !!snapSession?.resumeType && snapSession.resumeType !== "none";
|
|
878
956
|
// A community harness that can't resume this seat's token (launch-only, or a former runtime's id) stops here; a seat
|
|
@@ -913,6 +991,9 @@ export class RestoreOrchestrator {
|
|
|
913
991
|
}
|
|
914
992
|
// Clear stale state so NodeLauncher doesn't see already_bound. A kept pane keeps its binding through the takeover: the
|
|
915
993
|
// delivery guard resolves the pane through it.
|
|
994
|
+
if (selectedHistory && !selectedHistory.beforeEffect()) {
|
|
995
|
+
return { nodeId, logicalId: node.logicalId, status: "failed", error: "The selected seat or history changed before launch." };
|
|
996
|
+
}
|
|
916
997
|
this.clearStaleState(nodeId, rigId, { keepBinding: keptPane !== null });
|
|
917
998
|
this.tmuxAdapter.deliveryGuard?.rebindLifecycle(nodeId);
|
|
918
999
|
// Derive canonical session name for pod-aware nodes
|
|
@@ -1031,16 +1112,19 @@ export class RestoreOrchestrator {
|
|
|
1031
1112
|
const onSessionLaunched = opts?.onSessionLaunched;
|
|
1032
1113
|
const launchResult = await this.nodeLauncher.launchNode(rigId, node.logicalId, {
|
|
1033
1114
|
...launchOpts,
|
|
1115
|
+
...(selectedHistory ? { expectedNodeId: nodeId, beforeEffect: selectedHistory.beforeNative,
|
|
1116
|
+
beforeRegistration: selectedHistory.beforeRegistration } : {}),
|
|
1034
1117
|
...(savedStartup ? { pluginPaths: pluginPathsOf(savedStartup.projectionEntries) } : {}),
|
|
1035
1118
|
...(onSessionLaunched ? { onSessionRegistered: (sessionId) => onSessionLaunched(nodeId, sessionId) } : {}),
|
|
1036
1119
|
});
|
|
1037
1120
|
if (!launchResult.ok) {
|
|
1038
1121
|
// Launch failed — restore prior state (compensating action)
|
|
1039
|
-
|
|
1122
|
+
if (!selectedHistory || (launchResult.code !== "selection_changed_after_creation" && selectedHistory.beforeRegistration()))
|
|
1123
|
+
this.restoreNodeState(nodeId, priorState);
|
|
1040
1124
|
return {
|
|
1041
1125
|
nodeId,
|
|
1042
1126
|
logicalId: node.logicalId,
|
|
1043
|
-
status: "failed",
|
|
1127
|
+
status: selectedHistory && launchResult.code === "selection_changed_after_creation" ? "attention_required" : "failed",
|
|
1044
1128
|
error: launchResult.message,
|
|
1045
1129
|
};
|
|
1046
1130
|
}
|
|
@@ -1050,8 +1134,9 @@ export class RestoreOrchestrator {
|
|
|
1050
1134
|
if (launchResult.warnings?.length) {
|
|
1051
1135
|
warnings?.push(...launchResult.warnings);
|
|
1052
1136
|
}
|
|
1053
|
-
const restored = await this.postLaunchRestore(entry, rigId, data, launchResult.sessionName, launchResult, opts, warnings, priorState, seatRehydration);
|
|
1054
|
-
|
|
1137
|
+
const restored = await this.postLaunchRestore(entry, rigId, data, launchResult.sessionName, launchResult, opts, warnings, priorState, seatRehydration, resumeSession);
|
|
1138
|
+
const checked = this.checkRestoredGuidance(restored, entry.node, rigId, data, warnings);
|
|
1139
|
+
return selectedHistory ? { ...checked, sourceSessionId: selectedHistory.historySessionId, resultSessionId: launchResult.session.id } : checked;
|
|
1055
1140
|
}
|
|
1056
1141
|
/** A seat that came back running should also have its role, culture and SOP guidance. If its
|
|
1057
1142
|
* guidance file still lacks a managed block it should hold, the seat keeps its true status (a
|
|
@@ -1101,11 +1186,15 @@ export class RestoreOrchestrator {
|
|
|
1101
1186
|
* launch-failure compensating action). The caller fires this ONLY on a
|
|
1102
1187
|
* POSITIVE determination the session is fresh/blank — never for
|
|
1103
1188
|
* unknown-but-possibly-valid continuity. */
|
|
1104
|
-
async rollbackToZeroSession(nodeId, sessionName, launchedSessionId, priorState) {
|
|
1189
|
+
async rollbackToZeroSession(nodeId, sessionName, launchedSessionId, priorState, assertCurrent) {
|
|
1190
|
+
if (assertCurrent && !assertCurrent())
|
|
1191
|
+
return false;
|
|
1105
1192
|
try {
|
|
1106
1193
|
await this.tmuxAdapter.killSession(sessionName);
|
|
1107
1194
|
}
|
|
1108
1195
|
catch { /* best-effort — the row + projection rollback below is the source of truth */ }
|
|
1196
|
+
if (assertCurrent && !assertCurrent())
|
|
1197
|
+
return false;
|
|
1109
1198
|
if (launchedSessionId) {
|
|
1110
1199
|
try {
|
|
1111
1200
|
this.sessionRegistry.updateStatus(launchedSessionId, "superseded");
|
|
@@ -1115,6 +1204,7 @@ export class RestoreOrchestrator {
|
|
|
1115
1204
|
if (priorState) {
|
|
1116
1205
|
this.restoreNodeState(nodeId, priorState);
|
|
1117
1206
|
}
|
|
1207
|
+
return true;
|
|
1118
1208
|
}
|
|
1119
1209
|
/** Retire only the provisional session created by this restore attempt. The prior
|
|
1120
1210
|
* binding must stay cleared while a replacement launch is handed off. */
|
|
@@ -1141,7 +1231,8 @@ export class RestoreOrchestrator {
|
|
|
1141
1231
|
freshSeatCommand(rigId, data, logicalId) {
|
|
1142
1232
|
return freshSeatLaunchCommand(logicalId, this.rigRepo.getRig(rigId)?.rig.name ?? data.rig.name);
|
|
1143
1233
|
}
|
|
1144
|
-
|
|
1234
|
+
/** Replay the preflight-selected source after launch, keeping native identity and startup checks. */
|
|
1235
|
+
async postLaunchRestore(entry, rigId, data, sessionName, launchResult, opts, warnings, priorState, seatRehydration, resumeSource) {
|
|
1145
1236
|
const node = entry.node;
|
|
1146
1237
|
// OPR.0.7.0.7: what this restore launches with when the seat has a saved effort choice is decided by the one
|
|
1147
1238
|
// precedence seam (latest wins), which also says so when the snapshot held another value.
|
|
@@ -1150,7 +1241,9 @@ export class RestoreOrchestrator {
|
|
|
1150
1241
|
if (!restoreEffort) {
|
|
1151
1242
|
// The live seat is found by its logical id in this rig: a seat removed and grown back has a new node id,
|
|
1152
1243
|
// and its latest saved choice still wins over the older snapshot.
|
|
1153
|
-
const liveRow = this.db.prepare(
|
|
1244
|
+
const liveRow = this.db.prepare(selected
|
|
1245
|
+
? "SELECT id FROM nodes WHERE id = ? AND rig_id = ? AND logical_id = ?"
|
|
1246
|
+
: "SELECT id FROM nodes WHERE rig_id = ? AND logical_id = ?").get(...(selected ? [node.id, rigId, node.logicalId] : [rigId, node.logicalId]));
|
|
1154
1247
|
const decided = effortPrecedence.restoreLaunchEffort({ snapshot: node, live: readSeatEffort(this.db, liveRow?.id ?? node.id) });
|
|
1155
1248
|
if (decided.warning)
|
|
1156
1249
|
warnings?.push(`Restore: ${node.logicalId}: ${decided.warning}`);
|
|
@@ -1161,7 +1254,14 @@ export class RestoreOrchestrator {
|
|
|
1161
1254
|
// OPR.0.5.7.1 D1 — the active occupant is RESOLVED, never inferred from
|
|
1162
1255
|
// row ordering (cite site 2 of 2; "latest = max id" was the incident's
|
|
1163
1256
|
// defect: a superseded row with a newer ULID defeated the real occupant).
|
|
1164
|
-
const
|
|
1257
|
+
const selected = opts?.selectedHistory;
|
|
1258
|
+
const rollbackOwnBlank = async () => this.rollbackToZeroSession(node.id, sessionName, launchResult?.session.id, priorState, selected ? () => selected.beforeNative(launchResult?.session.id, launchResult?.binding.id) : undefined);
|
|
1259
|
+
const changedDuringRollback = () => ({ nodeId: node.id, logicalId: node.logicalId,
|
|
1260
|
+
status: "attention_required", error: "The selected terminal or source changed during cleanup. Its current owner was preserved; inspect the partial launch before retrying." });
|
|
1261
|
+
const selectedRows = selected ? data.sessions.filter(row => row.nodeId === node.id && row.id === selected.historySessionId) : [];
|
|
1262
|
+
const sessionResolution = selected
|
|
1263
|
+
? selectedRows.length === 1 ? { kind: "resolved", session: selectedRows[0] } : { kind: "none" }
|
|
1264
|
+
: resolveActiveSnapshotSession(data, node.id);
|
|
1165
1265
|
if (sessionResolution.kind === "ambiguous") {
|
|
1166
1266
|
return {
|
|
1167
1267
|
nodeId: node.id,
|
|
@@ -1170,7 +1270,7 @@ export class RestoreOrchestrator {
|
|
|
1170
1270
|
error: activeOccupantAmbiguityError(sessionResolution.candidateIds, sessionResolution.detail),
|
|
1171
1271
|
};
|
|
1172
1272
|
}
|
|
1173
|
-
const session = sessionResolution.kind === "resolved" ? sessionResolution.session : null;
|
|
1273
|
+
const session = resumeSource ?? (sessionResolution.kind === "resolved" ? sessionResolution.session : null);
|
|
1174
1274
|
const checkpoint = data.checkpoints[node.id] ?? null;
|
|
1175
1275
|
// Relaunching a seat that was launched for a community harness keeps that selection on the session registered
|
|
1176
1276
|
// for it, whether or not the app can start now: never a fallback to a built-in reading.
|
|
@@ -1179,7 +1279,8 @@ export class RestoreOrchestrator {
|
|
|
1179
1279
|
this.sessionRegistry.recordCommunityHarnessSelection(launchResult.session.id, carriedCommunityHarness);
|
|
1180
1280
|
// Check restore policy. OPR.0.3.4.2: a --fresh-listed seat (operation B)
|
|
1181
1281
|
// deliberately skips the resume attempt; its launch reports `fresh-primed`.
|
|
1182
|
-
const liveRuntime = this.rigRepo.getRig(rigId)?.nodes.find(current => current.logicalId === node.logicalId
|
|
1282
|
+
const liveRuntime = this.rigRepo.getRig(rigId)?.nodes.find(current => current.logicalId === node.logicalId
|
|
1283
|
+
&& (!selected || current.id === node.id))?.runtime ?? node.runtime;
|
|
1183
1284
|
const restorePolicy = effectiveRestorePolicy(seatFacts(data, node.id, node.runtime, liveRuntime), session?.restorePolicy);
|
|
1184
1285
|
const noConversation = isOrdinaryTerminalSeat(seatFacts(data, node.id, node.runtime, liveRuntime));
|
|
1185
1286
|
// A terminal's restore is its shell and its saved startup: one whose startup failed wasn't restored whole.
|
|
@@ -1263,7 +1364,8 @@ export class RestoreOrchestrator {
|
|
|
1263
1364
|
// before any session exists. If it is somehow reached post-launch, the
|
|
1264
1365
|
// just-created session is a confirmed blank (no resume was possible) —
|
|
1265
1366
|
// roll back to zero sessions and present the decision honestly.
|
|
1266
|
-
await
|
|
1367
|
+
if (!await rollbackOwnBlank())
|
|
1368
|
+
return changedDuringRollback();
|
|
1267
1369
|
return { nodeId: node.id, logicalId: node.logicalId, status: "awaiting-decision", error: `Original session unresumable: resume requested but no token available. No session is running. Restore the original session manually, or deliberately start only this seat fresh: ${this.freshSeatCommand(rigId, data, node.logicalId)}.` };
|
|
1268
1370
|
}
|
|
1269
1371
|
else {
|
|
@@ -1275,7 +1377,9 @@ export class RestoreOrchestrator {
|
|
|
1275
1377
|
}
|
|
1276
1378
|
catch { /* best-effort: without it a rotation stays unproved, as before */ }
|
|
1277
1379
|
}
|
|
1278
|
-
|
|
1380
|
+
if (selected && !selected.beforeNative(launchedSessionId, launchResult?.binding.id))
|
|
1381
|
+
return { nodeId: node.id, logicalId: node.logicalId, status: "attention_required", error: "The selected seat, settings or history changed after shell creation; native resume was not dispatched." };
|
|
1382
|
+
const resumeOutcome = await this.attemptResume(node.id, sessionName, resumeType, resumeToken, node.cwd ?? "/", this.liveCodexProfile(rigId, node, selected?.nodeId), node.model, this.resolveRestorePosture(node.id, rigId), effortForRestore(), warnings, node.advisor, selected ? () => selected.beforeNative(launchedSessionId, launchResult?.binding.id) : undefined);
|
|
1279
1383
|
if (resumeOutcome.kind === "resumed") {
|
|
1280
1384
|
baseStatus = "resumed";
|
|
1281
1385
|
if (launchedSessionId && this.claudeResume.canResume(resumeType, resumeToken)) {
|
|
@@ -1307,7 +1411,8 @@ export class RestoreOrchestrator {
|
|
|
1307
1411
|
// OPR.0.3.4.2 (B): resume CONCLUDED failed — the launched session is
|
|
1308
1412
|
// a confirmed blank agent (precision guard trigger (i)). Roll back to
|
|
1309
1413
|
// zero sessions; the stop-and-ask is realized as awaiting-decision.
|
|
1310
|
-
await
|
|
1414
|
+
if (!await rollbackOwnBlank())
|
|
1415
|
+
return changedDuringRollback();
|
|
1311
1416
|
return { nodeId: node.id, logicalId: node.logicalId, status: "awaiting-decision", error: `Original session unresumable: resume attempted but failed. The blank session was rolled back; no session is running. Check the harness state manually, or deliberately start only this seat fresh: ${this.freshSeatCommand(rigId, data, node.logicalId)}.` };
|
|
1312
1417
|
}
|
|
1313
1418
|
}
|
|
@@ -1318,7 +1423,8 @@ export class RestoreOrchestrator {
|
|
|
1318
1423
|
// instead of silently downgrading to a fresh launch with amnesia.
|
|
1319
1424
|
if (!resumeToken) {
|
|
1320
1425
|
// Defense in depth (pre-launch classification catches this first).
|
|
1321
|
-
await
|
|
1426
|
+
if (!await rollbackOwnBlank())
|
|
1427
|
+
return changedDuringRollback();
|
|
1322
1428
|
return {
|
|
1323
1429
|
nodeId: node.id,
|
|
1324
1430
|
logicalId: node.logicalId,
|
|
@@ -1334,7 +1440,8 @@ export class RestoreOrchestrator {
|
|
|
1334
1440
|
// Explicit --fresh and non-resume policies stay the only fresh-prime paths.
|
|
1335
1441
|
const resumeAdapter = seatAdapter(opts?.adapters, node.runtime, session?.communityHarness);
|
|
1336
1442
|
if (!resumeAdapter) {
|
|
1337
|
-
await
|
|
1443
|
+
if (!await rollbackOwnBlank())
|
|
1444
|
+
return changedDuringRollback();
|
|
1338
1445
|
return {
|
|
1339
1446
|
nodeId: node.id,
|
|
1340
1447
|
logicalId: node.logicalId,
|
|
@@ -1497,7 +1604,7 @@ export class RestoreOrchestrator {
|
|
|
1497
1604
|
const binding = {
|
|
1498
1605
|
...launchResult.binding,
|
|
1499
1606
|
cwd: node.cwd ?? ".",
|
|
1500
|
-
codexConfigProfile: this.liveCodexProfile(rigId, node) ?? undefined,
|
|
1607
|
+
codexConfigProfile: this.liveCodexProfile(rigId, node, selected?.nodeId) ?? undefined,
|
|
1501
1608
|
// OPR.0.4.8.3 Seam B: the pod-aware restore path binds the restored posture too
|
|
1502
1609
|
// (both restore paths consume persisted provenance — preflight surface 3).
|
|
1503
1610
|
launchPosture: this.resolveRestorePosture(node.id, rigId),
|
|
@@ -1534,6 +1641,7 @@ export class RestoreOrchestrator {
|
|
|
1534
1641
|
resumeType: (isPodAware && resumeRequested) ? resumeType ?? undefined : undefined,
|
|
1535
1642
|
sessionName: sessionName,
|
|
1536
1643
|
allowFreshFallback: !(isPodAware && resumeRequested),
|
|
1644
|
+
...(selected ? { beforeNativeLaunch: () => selected.beforeNative(launchResult.session.id, launchResult.binding.id) } : {}),
|
|
1537
1645
|
});
|
|
1538
1646
|
warnings?.push(...(startupResult.warnings ?? []));
|
|
1539
1647
|
if (startupResult.ok) {
|
|
@@ -1548,7 +1656,8 @@ export class RestoreOrchestrator {
|
|
|
1548
1656
|
// ONLY on the concluded-fresh determination; a genuinely
|
|
1549
1657
|
// unknown-but-possibly-valid continuity never reaches here
|
|
1550
1658
|
// (continuityOutcome would not be "fresh").
|
|
1551
|
-
await
|
|
1659
|
+
if (!await rollbackOwnBlank())
|
|
1660
|
+
return changedDuringRollback();
|
|
1552
1661
|
return {
|
|
1553
1662
|
nodeId: node.id,
|
|
1554
1663
|
logicalId: node.logicalId,
|
|
@@ -1560,7 +1669,7 @@ export class RestoreOrchestrator {
|
|
|
1560
1669
|
? ((startupResult.continuityOutcome === "resumed" || nativeContinuityProved) ? "resumed" : baseStatus)
|
|
1561
1670
|
: baseStatus;
|
|
1562
1671
|
if (finalStatus === "resumed") {
|
|
1563
|
-
return this.finishJoinedResume(node, sessionName, resumeToken, launchResult?.session.id, isPodAware && node.runtime === "claude-code", startupResult.resumedProcess);
|
|
1672
|
+
return this.finishJoinedResume(node, sessionName, resumeToken, launchResult?.session.id, isPodAware && node.runtime === "claude-code", startupResult.resumedProcess, selected ? () => selected.beforeNative(launchResult?.session.id, launchResult?.binding.id) : undefined);
|
|
1564
1673
|
}
|
|
1565
1674
|
return { nodeId: node.id, logicalId: node.logicalId, status: finalStatus, ...(noConversation && finalStatus === "fresh-primed" ? { noConversation: true } : {}) };
|
|
1566
1675
|
}
|
|
@@ -1587,7 +1696,8 @@ export class RestoreOrchestrator {
|
|
|
1587
1696
|
// as unresumable. A pane that went back to its shell for another reason stays failed,
|
|
1588
1697
|
// with its pane and binding kept, so its output can still be read.
|
|
1589
1698
|
if (startupResult.missingConversation) {
|
|
1590
|
-
await
|
|
1699
|
+
if (!await rollbackOwnBlank())
|
|
1700
|
+
return changedDuringRollback();
|
|
1591
1701
|
return {
|
|
1592
1702
|
nodeId: node.id,
|
|
1593
1703
|
logicalId: node.logicalId,
|
|
@@ -1640,7 +1750,7 @@ export class RestoreOrchestrator {
|
|
|
1640
1750
|
}
|
|
1641
1751
|
}
|
|
1642
1752
|
if (baseStatus === "resumed") {
|
|
1643
|
-
return this.finishJoinedResume(node, sessionName, resumeToken, launchResult?.session.id);
|
|
1753
|
+
return this.finishJoinedResume(node, sessionName, resumeToken, launchResult?.session.id, false, undefined, selected ? () => selected.beforeNative(launchResult?.session.id, launchResult?.binding.id) : undefined);
|
|
1644
1754
|
}
|
|
1645
1755
|
return { nodeId: node.id, logicalId: node.logicalId, status: baseStatus, ...(noConversation && !startupFailed && baseStatus === "fresh-primed" ? { noConversation: true } : {}) };
|
|
1646
1756
|
}
|
|
@@ -1648,7 +1758,9 @@ export class RestoreOrchestrator {
|
|
|
1648
1758
|
* rebound and its process identity agrees with the declared seat runtime. */
|
|
1649
1759
|
async finishJoinedResume(node, sessionName, resumeToken, sessionId, managedClaudeResume = false,
|
|
1650
1760
|
/** Codex (#1524): the process the adapter proved the resume on. The join must verify that same process. */
|
|
1651
|
-
provenCodexProcess) {
|
|
1761
|
+
provenCodexProcess, assertCurrent) {
|
|
1762
|
+
if (assertCurrent && !assertCurrent())
|
|
1763
|
+
return { nodeId: node.id, logicalId: node.logicalId, status: "attention_required", error: "Selected seat changed before joined native proof; outcome needs inspection." };
|
|
1652
1764
|
const identity = await rebindAndVerifyPaneIdentity({
|
|
1653
1765
|
db: this.db,
|
|
1654
1766
|
sessionRegistry: this.sessionRegistry,
|
|
@@ -1658,9 +1770,12 @@ export class RestoreOrchestrator {
|
|
|
1658
1770
|
runtime: node.runtime ?? null,
|
|
1659
1771
|
expectedResumeToken: resumeToken,
|
|
1660
1772
|
requireExactResumeLineage: true,
|
|
1773
|
+
...(assertCurrent ? { assertCurrent } : {}),
|
|
1661
1774
|
...(this.listProcesses ? { listProcesses: this.listProcesses } : {}),
|
|
1662
1775
|
});
|
|
1663
1776
|
const markManagedResumeAttention = () => {
|
|
1777
|
+
if (assertCurrent && !assertCurrent())
|
|
1778
|
+
return;
|
|
1664
1779
|
if (!managedClaudeResume || !sessionId)
|
|
1665
1780
|
return;
|
|
1666
1781
|
// The join awaits native observations. Only the exact launched row, still
|
|
@@ -1679,6 +1794,8 @@ export class RestoreOrchestrator {
|
|
|
1679
1794
|
error: `Exact native session resumed, but joined restore proof is incomplete: ${identity.detail}. The resumed session was preserved; no replacement was started.`,
|
|
1680
1795
|
};
|
|
1681
1796
|
}
|
|
1797
|
+
if (assertCurrent && !assertCurrent())
|
|
1798
|
+
return { nodeId: node.id, logicalId: node.logicalId, status: "attention_required", error: "Selected seat changed during joined native proof; outcome needs inspection." };
|
|
1682
1799
|
// #1524 (b): the adapter proved the resume on one Codex process. The join observed later, after startup's awaits;
|
|
1683
1800
|
// a different process (or none matched) there is not certified by that proof. No new read, wait or relaunch.
|
|
1684
1801
|
if (node.runtime === "codex" && provenCodexProcess) {
|
|
@@ -1742,6 +1859,7 @@ export class RestoreOrchestrator {
|
|
|
1742
1859
|
* 3. Nothing attached (or a resolution error) → EXPLICIT "floor" — the locked
|
|
1743
1860
|
* minimum-floor absence contract; never undefined/env-delegation for managed seats.
|
|
1744
1861
|
*/
|
|
1862
|
+
/** Pure, read-only policy resolution shared with selected startup review. */
|
|
1745
1863
|
resolveRestorePosture(nodeId, rigId) {
|
|
1746
1864
|
try {
|
|
1747
1865
|
const prov = this.rigRepo.getNodePolicyProvenance(nodeId);
|
|
@@ -1809,14 +1927,17 @@ export class RestoreOrchestrator {
|
|
|
1809
1927
|
/** The live seat's current Codex profile: a setter change made after the snapshot is the newer choice, so an older
|
|
1810
1928
|
* snapshot can't bring back the profile it replaced. The seat is found by logical id, as effort's restore does; a
|
|
1811
1929
|
* seat with no live row keeps the snapshot's value. */
|
|
1812
|
-
liveCodexProfile(rigId, node) {
|
|
1813
|
-
const row = this.db.prepare(
|
|
1930
|
+
liveCodexProfile(rigId, node, selectedNodeId) {
|
|
1931
|
+
const row = this.db.prepare(selectedNodeId
|
|
1932
|
+
? "SELECT codex_config_profile FROM nodes WHERE id = ? AND rig_id = ? AND logical_id = ?"
|
|
1933
|
+
: "SELECT codex_config_profile FROM nodes WHERE rig_id = ? AND logical_id = ?")
|
|
1934
|
+
.get(...(selectedNodeId ? [selectedNodeId, rigId, node.logicalId] : [rigId, node.logicalId]));
|
|
1814
1935
|
return row ? row.codex_config_profile : node.codexConfigProfile ?? null;
|
|
1815
1936
|
}
|
|
1816
1937
|
async attemptResume(nodeId, sessionName, resumeType, resumeToken, cwd, codexConfigProfile, model,
|
|
1817
1938
|
// OPR.0.4.8.3 Seam B: the seat's restored launch posture (persisted provenance,
|
|
1818
1939
|
// custom policies re-validated when readable). Absent = env decision.
|
|
1819
|
-
resolvedPosture, effort, warnings, advisor) {
|
|
1940
|
+
resolvedPosture, effort, warnings, advisor, beforeNative) {
|
|
1820
1941
|
const launchGeneration = this.sessionRegistry.currentOccupantTenure(nodeId)?.generationUuid;
|
|
1821
1942
|
const node = this.db.prepare("SELECT rig_id FROM nodes WHERE id = ?").get(nodeId);
|
|
1822
1943
|
const nonInterruptive = node ? this.rigRepo.getRigNonInterruptive(node.rig_id) : false;
|
|
@@ -1855,7 +1976,10 @@ export class RestoreOrchestrator {
|
|
|
1855
1976
|
const tail = claudePermissions !== undefined
|
|
1856
1977
|
? [...claudeTail, ...Array(5 - claudeTail.length).fill(undefined), launch.additions, claudePermissions]
|
|
1857
1978
|
: launch.additions ? [...claudeTail, ...Array(5 - claudeTail.length).fill(undefined), launch.additions] : claudeTail;
|
|
1858
|
-
const
|
|
1979
|
+
const guardedTail = beforeNative ? [...tail, ...Array(Math.max(0, 7 - tail.length)).fill(undefined), beforeNative] : tail;
|
|
1980
|
+
if (beforeNative && !beforeNative())
|
|
1981
|
+
return { kind: "attention_required", message: "The selected seat, settings or history changed during native preparation; resume was not dispatched." };
|
|
1982
|
+
const result = await this.claudeResume.resume(sessionName, resumeType, resumeToken, cwd, resolvedPosture, model, permissionMode, nodeId, ...guardedTail);
|
|
1859
1983
|
if (result.ok) {
|
|
1860
1984
|
// OPR.0.7.0.9: the resumed conversation's own start, as on the pod-aware path.
|
|
1861
1985
|
const promptNote = launch.additions?.appendSystemPromptFile && nodeId && resumeToken ? systemPromptPendingNoteForNode(this.db, nodeId, resumeToken) : undefined;
|
|
@@ -1892,7 +2016,10 @@ export class RestoreOrchestrator {
|
|
|
1892
2016
|
const codexTail = seatHome || codexPermissions !== undefined
|
|
1893
2017
|
? [...launchTail, ...Array(4 - launchTail.length).fill(undefined), seatHome, ...(codexPermissions !== undefined ? [codexPermissions] : [])]
|
|
1894
2018
|
: launchTail;
|
|
1895
|
-
const
|
|
2019
|
+
const guardedCodexTail = beforeNative ? [...codexTail, ...Array(Math.max(0, 6 - codexTail.length)).fill(undefined), beforeNative] : codexTail;
|
|
2020
|
+
if (beforeNative && !beforeNative())
|
|
2021
|
+
return { kind: "attention_required", message: "The selected seat, settings or history changed during native preparation; resume was not dispatched." };
|
|
2022
|
+
const result = await this.codexResume.resume(sessionName, resumeType, resumeToken, cwd, codexConfigProfile, resolvedPosture, model, ...guardedCodexTail);
|
|
1896
2023
|
if (result.ok) {
|
|
1897
2024
|
const notice = nonInterruptiveNotice("codex", { nonInterruptive, launchPosture: codexPermissions ? undefined : resolvedPosture, permissionMode });
|
|
1898
2025
|
if (notice)
|