@openrig/cli 0.7.22 → 0.7.24
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 +7 -7
- package/daemon/assets/claude-hook-bridge.cjs +575 -6
- package/daemon/assets/claude-hook-bridge.d.cts +5 -0
- package/daemon/assets/claude-permission-policies.cjs +4 -3
- package/daemon/assets/guidance/openrig-context-entry.md +1 -0
- package/daemon/assets/onboarding/01-world-and-purpose.md +2 -1
- package/daemon/assets/onboarding/02-self-and-competent-action.md +6 -0
- package/daemon/assets/plugins/openrig/.claude-plugin/plugin.json +4 -3
- package/daemon/assets/plugins/openrig/.codex-plugin/plugin.json +3 -2
- package/daemon/assets/plugins/openrig/.cursor-plugin/plugin.json +1 -1
- package/daemon/assets/plugins/openrig/README.md +64 -9
- package/daemon/assets/plugins/openrig/hooks/claude.json +39 -0
- package/daemon/assets/plugins/openrig/hooks/codex.json +27 -0
- package/daemon/assets/plugins/openrig/hooks/scripts/claude-hook-bridge.cjs +715 -0
- package/daemon/assets/plugins/openrig/plugin.json +1 -1
- package/daemon/assets/plugins/openrig/scripts/run-rig.cjs +30 -0
- package/daemon/assets/plugins/openrig/skills/working-with-an-openrig-team/SKILL.md +71 -9
- package/daemon/assets/plugins/openrig-codex/.agents/plugins/marketplace.json +15 -0
- package/daemon/assets/plugins/openrig-codex/.codex-plugin/plugin.json +42 -0
- package/daemon/assets/plugins/openrig-codex/LICENSE +200 -0
- package/daemon/assets/plugins/openrig-codex/assets/logo.svg +1 -0
- package/daemon/assets/plugins/openrig-codex/hooks/codex.json +27 -0
- package/daemon/assets/plugins/openrig-codex/hooks/scripts/claude-hook-bridge.cjs +715 -0
- package/daemon/assets/plugins/openrig-codex/skills/working-with-an-openrig-team/SKILL.md +175 -0
- 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/README.md +10 -2
- package/daemon/assets/plugins/openrig-core/hooks/claude.json +9 -0
- package/daemon/assets/plugins/openrig-core/hooks/scripts/activity-relay.cjs +50 -0
- package/daemon/assets/plugins/openrig-core/hooks/scripts/compaction-restore-bridge.cjs +3 -1
- package/daemon/assets/plugins/openrig-core/hooks/scripts/permission-answer.cjs +270 -0
- package/daemon/assets/plugins/openrig-core/hooks/scripts/refocus.cjs +24 -6
- package/daemon/assets/plugins/openrig-core/skills/claude-compaction-restore/scripts/precompact-hook.mjs +11 -8
- package/daemon/assets/plugins/openrig-core/skills/claude-compaction-restore/scripts/restore-from-jsonl.mjs +76 -10
- package/daemon/assets/plugins/openrig-core/skills/messaging-the-human/SKILL.md +1 -1
- package/daemon/assets/plugins/openrig-core/skills/openrig-user/SKILL.md +4 -2
- package/daemon/assets/plugins/openrig-core/skills/refocusing/scripts/trace-to-root.py +191 -25
- package/daemon/assets/skills/rigs/SKILL.md +136 -26
- 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 +128 -18
- package/daemon/context-packs/reference/acp-agents.md +11 -3
- package/daemon/context-packs/reference/getting-started.md +144 -13
- package/daemon/context-packs/reference/manifest.yaml +1 -1
- package/daemon/context-packs/reference/rig-spec.md +201 -3
- package/daemon/context-packs/reference/tmux-servers.md +43 -2
- package/daemon/context-packs/reference/whats-new.md +186 -12
- 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/claude-compaction-restore/scripts/precompact-hook.mjs +11 -8
- package/daemon/context-packs/skills/claude-compaction-restore/scripts/restore-from-jsonl.mjs +76 -10
- 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/SKILL.md +1 -1
- package/daemon/context-packs/skills/core/messaging-the-human/manifest.yaml +3 -3
- 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/core/working-with-an-openrig-team/SKILL.md +71 -9
- package/daemon/context-packs/skills/core/working-with-an-openrig-team/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/SKILL.md +4 -2
- 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/manifest.yaml +1 -1
- package/daemon/context-packs/skills/refocusing/manifest.yaml +1 -1
- package/daemon/context-packs/skills/refocusing/scripts/trace-to-root.py +191 -25
- 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 +24 -2
- package/daemon/dist/adapters/claude-code-adapter.d.ts.map +1 -1
- package/daemon/dist/adapters/claude-code-adapter.js +312 -45
- package/daemon/dist/adapters/claude-code-adapter.js.map +1 -1
- package/daemon/dist/adapters/claude-resume-launch.d.ts +3 -0
- package/daemon/dist/adapters/claude-resume-launch.d.ts.map +1 -1
- package/daemon/dist/adapters/claude-resume-launch.js +5 -0
- package/daemon/dist/adapters/claude-resume-launch.js.map +1 -1
- package/daemon/dist/adapters/claude-resume.d.ts.map +1 -1
- package/daemon/dist/adapters/claude-resume.js +66 -24
- package/daemon/dist/adapters/claude-resume.js.map +1 -1
- package/daemon/dist/adapters/community-harness-runtime-adapter.d.ts +22 -0
- package/daemon/dist/adapters/community-harness-runtime-adapter.d.ts.map +1 -1
- package/daemon/dist/adapters/community-harness-runtime-adapter.js +72 -20
- package/daemon/dist/adapters/community-harness-runtime-adapter.js.map +1 -1
- package/daemon/dist/adapters/pi-community-runtime-adapter.d.ts +9 -0
- package/daemon/dist/adapters/pi-community-runtime-adapter.d.ts.map +1 -1
- package/daemon/dist/adapters/pi-community-runtime-adapter.js +6 -0
- package/daemon/dist/adapters/pi-community-runtime-adapter.js.map +1 -1
- package/daemon/dist/adapters/pi-runtime-adapter.d.ts +3 -0
- package/daemon/dist/adapters/pi-runtime-adapter.d.ts.map +1 -1
- package/daemon/dist/adapters/pi-runtime-adapter.js +9 -3
- package/daemon/dist/adapters/pi-runtime-adapter.js.map +1 -1
- package/daemon/dist/adapters/seat-slice.d.ts +19 -0
- package/daemon/dist/adapters/seat-slice.d.ts.map +1 -0
- package/daemon/dist/adapters/seat-slice.js +29 -0
- package/daemon/dist/adapters/seat-slice.js.map +1 -0
- package/daemon/dist/adapters/shell-quote.d.ts +1 -0
- package/daemon/dist/adapters/shell-quote.d.ts.map +1 -1
- package/daemon/dist/adapters/shell-quote.js +6 -0
- package/daemon/dist/adapters/shell-quote.js.map +1 -1
- package/daemon/dist/adapters/tmux.d.ts +84 -17
- package/daemon/dist/adapters/tmux.d.ts.map +1 -1
- package/daemon/dist/adapters/tmux.js +355 -78
- package/daemon/dist/adapters/tmux.js.map +1 -1
- package/daemon/dist/build-info.js +3 -3
- package/daemon/dist/conversation-key-surface.d.ts +2 -0
- package/daemon/dist/conversation-key-surface.d.ts.map +1 -0
- package/daemon/dist/conversation-key-surface.js +5 -0
- package/daemon/dist/conversation-key-surface.js.map +1 -0
- package/daemon/dist/daemon-shutdown.d.ts +8 -0
- package/daemon/dist/daemon-shutdown.d.ts.map +1 -1
- package/daemon/dist/daemon-shutdown.js +15 -2
- package/daemon/dist/daemon-shutdown.js.map +1 -1
- package/daemon/dist/db/all-migrations.d.ts.map +1 -1
- package/daemon/dist/db/all-migrations.js +32 -0
- package/daemon/dist/db/all-migrations.js.map +1 -1
- package/daemon/dist/db/migrate.d.ts +15 -1
- package/daemon/dist/db/migrate.d.ts.map +1 -1
- package/daemon/dist/db/migrate.js +41 -6
- package/daemon/dist/db/migrate.js.map +1 -1
- package/daemon/dist/db/migrations/179_community_harness_runtime_switches.d.ts +14 -0
- package/daemon/dist/db/migrations/179_community_harness_runtime_switches.d.ts.map +1 -0
- package/daemon/dist/db/migrations/179_community_harness_runtime_switches.js +54 -0
- package/daemon/dist/db/migrations/179_community_harness_runtime_switches.js.map +1 -0
- package/daemon/dist/db/migrations/179_remote_control_observations.d.ts +10 -0
- package/daemon/dist/db/migrations/179_remote_control_observations.d.ts.map +1 -0
- package/daemon/dist/db/migrations/179_remote_control_observations.js +20 -0
- package/daemon/dist/db/migrations/179_remote_control_observations.js.map +1 -0
- package/daemon/dist/db/migrations/180_session_stop_attempt.d.ts +5 -0
- package/daemon/dist/db/migrations/180_session_stop_attempt.d.ts.map +1 -0
- package/daemon/dist/db/migrations/180_session_stop_attempt.js +7 -0
- package/daemon/dist/db/migrations/180_session_stop_attempt.js.map +1 -0
- package/daemon/dist/db/migrations/181_node_keep_alive.d.ts +8 -0
- package/daemon/dist/db/migrations/181_node_keep_alive.d.ts.map +1 -0
- package/daemon/dist/db/migrations/181_node_keep_alive.js +26 -0
- package/daemon/dist/db/migrations/181_node_keep_alive.js.map +1 -0
- package/daemon/dist/db/migrations/182_queue_items_blocked_on_index.d.ts +7 -0
- package/daemon/dist/db/migrations/182_queue_items_blocked_on_index.d.ts.map +1 -0
- package/daemon/dist/db/migrations/182_queue_items_blocked_on_index.js +11 -0
- package/daemon/dist/db/migrations/182_queue_items_blocked_on_index.js.map +1 -0
- package/daemon/dist/db/migrations/183_queue_items_scan_indexes.d.ts +8 -0
- package/daemon/dist/db/migrations/183_queue_items_scan_indexes.d.ts.map +1 -0
- package/daemon/dist/db/migrations/183_queue_items_scan_indexes.js +13 -0
- package/daemon/dist/db/migrations/183_queue_items_scan_indexes.js.map +1 -0
- package/daemon/dist/db/migrations/184_network_requests.d.ts +11 -0
- package/daemon/dist/db/migrations/184_network_requests.d.ts.map +1 -0
- package/daemon/dist/db/migrations/184_network_requests.js +32 -0
- package/daemon/dist/db/migrations/184_network_requests.js.map +1 -0
- package/daemon/dist/db/migrations/185_seat_cold_starts.d.ts +9 -0
- package/daemon/dist/db/migrations/185_seat_cold_starts.d.ts.map +1 -0
- package/daemon/dist/db/migrations/185_seat_cold_starts.js +19 -0
- package/daemon/dist/db/migrations/185_seat_cold_starts.js.map +1 -0
- package/daemon/dist/db/migrations/186_queue_relayed_answers.d.ts +3 -0
- package/daemon/dist/db/migrations/186_queue_relayed_answers.d.ts.map +1 -0
- package/daemon/dist/db/migrations/186_queue_relayed_answers.js +5 -0
- package/daemon/dist/db/migrations/186_queue_relayed_answers.js.map +1 -0
- package/daemon/dist/db/migrations/189_rig_seat_slice.d.ts +5 -0
- package/daemon/dist/db/migrations/189_rig_seat_slice.d.ts.map +1 -0
- package/daemon/dist/db/migrations/189_rig_seat_slice.js +7 -0
- package/daemon/dist/db/migrations/189_rig_seat_slice.js.map +1 -0
- package/daemon/dist/db/migrations/190_queue_transfer_staging.d.ts +3 -0
- package/daemon/dist/db/migrations/190_queue_transfer_staging.d.ts.map +1 -0
- package/daemon/dist/db/migrations/190_queue_transfer_staging.js +20 -0
- package/daemon/dist/db/migrations/190_queue_transfer_staging.js.map +1 -0
- package/daemon/dist/db/migrations/191_network_binding_providers.d.ts +3 -0
- package/daemon/dist/db/migrations/191_network_binding_providers.d.ts.map +1 -0
- package/daemon/dist/db/migrations/191_network_binding_providers.js +27 -0
- package/daemon/dist/db/migrations/191_network_binding_providers.js.map +1 -0
- package/daemon/dist/db/migrations/194_workflow_run_title.d.ts +4 -0
- package/daemon/dist/db/migrations/194_workflow_run_title.d.ts.map +1 -0
- package/daemon/dist/db/migrations/194_workflow_run_title.js +6 -0
- package/daemon/dist/db/migrations/194_workflow_run_title.js.map +1 -0
- package/daemon/dist/db/migrations/195_workflow_start_operations.d.ts +4 -0
- package/daemon/dist/db/migrations/195_workflow_start_operations.d.ts.map +1 -0
- package/daemon/dist/db/migrations/195_workflow_start_operations.js +13 -0
- package/daemon/dist/db/migrations/195_workflow_start_operations.js.map +1 -0
- package/daemon/dist/db/migrations/196_queue_item_evidence_ref_roots.d.ts +5 -0
- package/daemon/dist/db/migrations/196_queue_item_evidence_ref_roots.d.ts.map +1 -0
- package/daemon/dist/db/migrations/196_queue_item_evidence_ref_roots.js +7 -0
- package/daemon/dist/db/migrations/196_queue_item_evidence_ref_roots.js.map +1 -0
- package/daemon/dist/db/migrations/199_queue_items_native_permission_index.d.ts +9 -0
- package/daemon/dist/db/migrations/199_queue_items_native_permission_index.d.ts.map +1 -0
- package/daemon/dist/db/migrations/199_queue_items_native_permission_index.js +14 -0
- package/daemon/dist/db/migrations/199_queue_items_native_permission_index.js.map +1 -0
- package/daemon/dist/domain/activity-taxonomy.d.ts +3 -0
- package/daemon/dist/domain/activity-taxonomy.d.ts.map +1 -1
- package/daemon/dist/domain/activity-taxonomy.js.map +1 -1
- package/daemon/dist/domain/agent-activity-store.d.ts +17 -0
- package/daemon/dist/domain/agent-activity-store.d.ts.map +1 -1
- package/daemon/dist/domain/agent-activity-store.js +101 -45
- package/daemon/dist/domain/agent-activity-store.js.map +1 -1
- package/daemon/dist/domain/agent-manifest.d.ts.map +1 -1
- package/daemon/dist/domain/agent-manifest.js +14 -0
- package/daemon/dist/domain/agent-manifest.js.map +1 -1
- package/daemon/dist/domain/background-process-evidence.d.ts +23 -0
- package/daemon/dist/domain/background-process-evidence.d.ts.map +1 -0
- package/daemon/dist/domain/background-process-evidence.js +81 -0
- package/daemon/dist/domain/background-process-evidence.js.map +1 -0
- package/daemon/dist/domain/chat-repository.d.ts +1 -1
- package/daemon/dist/domain/chat-repository.d.ts.map +1 -1
- package/daemon/dist/domain/chat-repository.js +2 -2
- package/daemon/dist/domain/chat-repository.js.map +1 -1
- package/daemon/dist/domain/claude-compaction-enforcer.d.ts +46 -8
- package/daemon/dist/domain/claude-compaction-enforcer.d.ts.map +1 -1
- package/daemon/dist/domain/claude-compaction-enforcer.js +66 -20
- package/daemon/dist/domain/claude-compaction-enforcer.js.map +1 -1
- package/daemon/dist/domain/codex-member-permissions.d.ts +35 -0
- package/daemon/dist/domain/codex-member-permissions.d.ts.map +1 -1
- package/daemon/dist/domain/codex-member-permissions.js +106 -1
- package/daemon/dist/domain/codex-member-permissions.js.map +1 -1
- package/daemon/dist/domain/community-harness-presets.d.ts +9 -0
- package/daemon/dist/domain/community-harness-presets.d.ts.map +1 -1
- package/daemon/dist/domain/community-harness-presets.js +25 -1
- package/daemon/dist/domain/community-harness-presets.js.map +1 -1
- package/daemon/dist/domain/compaction-restore-notice.d.ts +12 -1
- package/daemon/dist/domain/compaction-restore-notice.d.ts.map +1 -1
- package/daemon/dist/domain/compaction-restore-notice.js +130 -2
- package/daemon/dist/domain/compaction-restore-notice.js.map +1 -1
- package/daemon/dist/domain/continuity-policy-materializer.d.ts.map +1 -1
- package/daemon/dist/domain/continuity-policy-materializer.js +11 -3
- package/daemon/dist/domain/continuity-policy-materializer.js.map +1 -1
- package/daemon/dist/domain/core-app-job.d.ts +4 -4
- package/daemon/dist/domain/core-app-job.d.ts.map +1 -1
- package/daemon/dist/domain/core-app-job.js +4 -59
- package/daemon/dist/domain/core-app-job.js.map +1 -1
- package/daemon/dist/domain/current-work.d.ts +43 -4
- package/daemon/dist/domain/current-work.d.ts.map +1 -1
- package/daemon/dist/domain/current-work.js +52 -3
- package/daemon/dist/domain/current-work.js.map +1 -1
- package/daemon/dist/domain/escalation-owner.d.ts +3 -0
- package/daemon/dist/domain/escalation-owner.d.ts.map +1 -1
- package/daemon/dist/domain/escalation-owner.js +9 -3
- package/daemon/dist/domain/escalation-owner.js.map +1 -1
- package/daemon/dist/domain/execution-candidate-reader.d.ts +3 -0
- package/daemon/dist/domain/execution-candidate-reader.d.ts.map +1 -1
- package/daemon/dist/domain/execution-candidate-reader.js +8 -2
- package/daemon/dist/domain/execution-candidate-reader.js.map +1 -1
- package/daemon/dist/domain/existing-rig-restore.d.ts +2 -0
- package/daemon/dist/domain/existing-rig-restore.d.ts.map +1 -1
- package/daemon/dist/domain/existing-rig-restore.js +11 -1
- package/daemon/dist/domain/existing-rig-restore.js.map +1 -1
- package/daemon/dist/domain/feed/attention-aggregator.d.ts +5 -5
- package/daemon/dist/domain/feed/attention-aggregator.d.ts.map +1 -1
- package/daemon/dist/domain/feed/attention-aggregator.js +10 -4
- package/daemon/dist/domain/feed/attention-aggregator.js.map +1 -1
- package/daemon/dist/domain/files/path-safety.d.ts +7 -0
- package/daemon/dist/domain/files/path-safety.d.ts.map +1 -1
- package/daemon/dist/domain/files/path-safety.js +23 -0
- package/daemon/dist/domain/files/path-safety.js.map +1 -1
- package/daemon/dist/domain/frontmatter.d.ts.map +1 -1
- package/daemon/dist/domain/frontmatter.js +4 -2
- package/daemon/dist/domain/frontmatter.js.map +1 -1
- package/daemon/dist/domain/gateway/destination-resolver.d.ts +3 -0
- package/daemon/dist/domain/gateway/destination-resolver.d.ts.map +1 -1
- package/daemon/dist/domain/gateway/destination-resolver.js +9 -0
- package/daemon/dist/domain/gateway/destination-resolver.js.map +1 -1
- package/daemon/dist/domain/gateway/human-quiet-windows.d.ts.map +1 -1
- package/daemon/dist/domain/gateway/human-quiet-windows.js +2 -1
- package/daemon/dist/domain/gateway/human-quiet-windows.js.map +1 -1
- package/daemon/dist/domain/gateway/slack/inbound.d.ts +6 -1
- package/daemon/dist/domain/gateway/slack/inbound.d.ts.map +1 -1
- package/daemon/dist/domain/gateway/slack/inbound.js +53 -9
- package/daemon/dist/domain/gateway/slack/inbound.js.map +1 -1
- package/daemon/dist/domain/gateway/slack/message.d.ts +4 -4
- package/daemon/dist/domain/gateway/slack/message.d.ts.map +1 -1
- package/daemon/dist/domain/gateway/slack/message.js +20 -7
- package/daemon/dist/domain/gateway/slack/message.js.map +1 -1
- package/daemon/dist/domain/gateway/slack/outbound-driver.d.ts +4 -0
- package/daemon/dist/domain/gateway/slack/outbound-driver.d.ts.map +1 -1
- package/daemon/dist/domain/gateway/slack/outbound-driver.js +1 -0
- package/daemon/dist/domain/gateway/slack/outbound-driver.js.map +1 -1
- package/daemon/dist/domain/gateway/slack/queue-access.d.ts +9 -1
- package/daemon/dist/domain/gateway/slack/queue-access.d.ts.map +1 -1
- package/daemon/dist/domain/gateway/slack/queue-access.js +2 -0
- package/daemon/dist/domain/gateway/slack/queue-access.js.map +1 -1
- package/daemon/dist/domain/gateway/slack/settled-asks.d.ts.map +1 -1
- package/daemon/dist/domain/gateway/slack/settled-asks.js +15 -2
- package/daemon/dist/domain/gateway/slack/settled-asks.js.map +1 -1
- package/daemon/dist/domain/gateway/slack/slack-delivery.d.ts +10 -19
- package/daemon/dist/domain/gateway/slack/slack-delivery.d.ts.map +1 -1
- package/daemon/dist/domain/gateway/slack/slack-delivery.js +64 -40
- package/daemon/dist/domain/gateway/slack/slack-delivery.js.map +1 -1
- package/daemon/dist/domain/gateway/slack/slack-subsystem.d.ts +3 -13
- package/daemon/dist/domain/gateway/slack/slack-subsystem.d.ts.map +1 -1
- package/daemon/dist/domain/gateway/slack/slack-subsystem.js +70 -22
- package/daemon/dist/domain/gateway/slack/slack-subsystem.js.map +1 -1
- package/daemon/dist/domain/harness-not-started-notice.d.ts +5 -2
- package/daemon/dist/domain/harness-not-started-notice.d.ts.map +1 -1
- package/daemon/dist/domain/harness-not-started-notice.js +46 -15
- package/daemon/dist/domain/harness-not-started-notice.js.map +1 -1
- package/daemon/dist/domain/health-detectors.d.ts +4 -0
- package/daemon/dist/domain/health-detectors.d.ts.map +1 -1
- package/daemon/dist/domain/health-detectors.js +4 -1
- package/daemon/dist/domain/health-detectors.js.map +1 -1
- package/daemon/dist/domain/health-diagnosis.d.ts.map +1 -1
- package/daemon/dist/domain/health-diagnosis.js +14 -9
- package/daemon/dist/domain/health-diagnosis.js.map +1 -1
- package/daemon/dist/domain/health-passive-ceremony.d.ts +2 -0
- package/daemon/dist/domain/health-passive-ceremony.d.ts.map +1 -1
- package/daemon/dist/domain/health-passive-ceremony.js +71 -13
- package/daemon/dist/domain/health-passive-ceremony.js.map +1 -1
- package/daemon/dist/domain/history-query.d.ts +1 -1
- package/daemon/dist/domain/history-query.d.ts.map +1 -1
- package/daemon/dist/domain/history-query.js +1 -2
- package/daemon/dist/domain/history-query.js.map +1 -1
- package/daemon/dist/domain/hosts/read-through.d.ts +1 -1
- package/daemon/dist/domain/hosts/read-through.d.ts.map +1 -1
- package/daemon/dist/domain/hosts/read-through.js +9 -2
- package/daemon/dist/domain/hosts/read-through.js.map +1 -1
- package/daemon/dist/domain/hot-potato-enforcer.d.ts +3 -3
- package/daemon/dist/domain/hot-potato-enforcer.d.ts.map +1 -1
- package/daemon/dist/domain/hot-potato-enforcer.js +2 -2
- package/daemon/dist/domain/hot-potato-enforcer.js.map +1 -1
- package/daemon/dist/domain/human-questions.d.ts +1 -1
- package/daemon/dist/domain/human-questions.d.ts.map +1 -1
- package/daemon/dist/domain/human-questions.js +2 -0
- package/daemon/dist/domain/human-questions.js.map +1 -1
- package/daemon/dist/domain/input-read-diagnostic.js +1 -1
- package/daemon/dist/domain/input-read-diagnostic.js.map +1 -1
- package/daemon/dist/domain/keep-alive-supervisor.d.ts +178 -0
- package/daemon/dist/domain/keep-alive-supervisor.d.ts.map +1 -0
- package/daemon/dist/domain/keep-alive-supervisor.js +523 -0
- package/daemon/dist/domain/keep-alive-supervisor.js.map +1 -0
- package/daemon/dist/domain/managed-restore-read-access.d.ts +18 -0
- package/daemon/dist/domain/managed-restore-read-access.d.ts.map +1 -1
- package/daemon/dist/domain/managed-restore-read-access.js +41 -1
- package/daemon/dist/domain/managed-restore-read-access.js.map +1 -1
- package/daemon/dist/domain/mission-control/audit-browse.d.ts +1 -1
- package/daemon/dist/domain/mission-control/audit-browse.d.ts.map +1 -1
- package/daemon/dist/domain/mission-control/audit-browse.js +3 -6
- package/daemon/dist/domain/mission-control/audit-browse.js.map +1 -1
- package/daemon/dist/domain/mission-control/mission-control-fleet-cli-capability.d.ts +6 -0
- package/daemon/dist/domain/mission-control/mission-control-fleet-cli-capability.d.ts.map +1 -1
- package/daemon/dist/domain/mission-control/mission-control-fleet-cli-capability.js +38 -9
- package/daemon/dist/domain/mission-control/mission-control-fleet-cli-capability.js.map +1 -1
- package/daemon/dist/domain/mission-control/mission-control-write-contract.d.ts.map +1 -1
- package/daemon/dist/domain/mission-control/mission-control-write-contract.js +50 -5
- package/daemon/dist/domain/mission-control/mission-control-write-contract.js.map +1 -1
- package/daemon/dist/domain/mutation-trace.d.ts +28 -0
- package/daemon/dist/domain/mutation-trace.d.ts.map +1 -0
- package/daemon/dist/domain/mutation-trace.js +38 -0
- package/daemon/dist/domain/mutation-trace.js.map +1 -0
- package/daemon/dist/domain/native-resume-probe.d.ts +35 -3
- package/daemon/dist/domain/native-resume-probe.d.ts.map +1 -1
- package/daemon/dist/domain/native-resume-probe.js +84 -17
- package/daemon/dist/domain/native-resume-probe.js.map +1 -1
- package/daemon/dist/domain/network/hub-client.d.ts +30 -1
- package/daemon/dist/domain/network/hub-client.d.ts.map +1 -1
- package/daemon/dist/domain/network/hub-client.js +62 -9
- package/daemon/dist/domain/network/hub-client.js.map +1 -1
- package/daemon/dist/domain/network/network-bindings.d.ts +52 -2
- package/daemon/dist/domain/network/network-bindings.d.ts.map +1 -1
- package/daemon/dist/domain/network/network-bindings.js +217 -23
- package/daemon/dist/domain/network/network-bindings.js.map +1 -1
- package/daemon/dist/domain/network/network-connector.d.ts +9 -1
- package/daemon/dist/domain/network/network-connector.d.ts.map +1 -1
- package/daemon/dist/domain/network/network-connector.js +95 -7
- package/daemon/dist/domain/network/network-connector.js.map +1 -1
- package/daemon/dist/domain/network/network-installations.d.ts.map +1 -1
- package/daemon/dist/domain/network/network-installations.js +22 -7
- package/daemon/dist/domain/network/network-installations.js.map +1 -1
- package/daemon/dist/domain/network/network-provider-removal.d.ts +9 -0
- package/daemon/dist/domain/network/network-provider-removal.d.ts.map +1 -0
- package/daemon/dist/domain/network/network-provider-removal.js +75 -0
- package/daemon/dist/domain/network/network-provider-removal.js.map +1 -0
- package/daemon/dist/domain/network/network-requests.d.ts +60 -0
- package/daemon/dist/domain/network/network-requests.d.ts.map +1 -0
- package/daemon/dist/domain/network/network-requests.js +502 -0
- package/daemon/dist/domain/network/network-requests.js.map +1 -0
- package/daemon/dist/domain/node-inventory.d.ts +26 -0
- package/daemon/dist/domain/node-inventory.d.ts.map +1 -1
- package/daemon/dist/domain/node-inventory.js +87 -7
- package/daemon/dist/domain/node-inventory.js.map +1 -1
- package/daemon/dist/domain/node-launcher.d.ts +2 -2
- package/daemon/dist/domain/node-launcher.d.ts.map +1 -1
- package/daemon/dist/domain/node-launcher.js +9 -7
- package/daemon/dist/domain/node-launcher.js.map +1 -1
- package/daemon/dist/domain/occupant-invalidator.d.ts +1 -1
- package/daemon/dist/domain/occupant-invalidator.d.ts.map +1 -1
- package/daemon/dist/domain/occupant-invalidator.js +1 -1
- package/daemon/dist/domain/occupant-invalidator.js.map +1 -1
- package/daemon/dist/domain/outbox-handler.d.ts +11 -0
- package/daemon/dist/domain/outbox-handler.d.ts.map +1 -1
- package/daemon/dist/domain/outbox-handler.js +20 -0
- package/daemon/dist/domain/outbox-handler.js.map +1 -1
- package/daemon/dist/domain/pane-cutover.d.ts +36 -9
- package/daemon/dist/domain/pane-cutover.d.ts.map +1 -1
- package/daemon/dist/domain/pane-cutover.js +82 -13
- package/daemon/dist/domain/pane-cutover.js.map +1 -1
- package/daemon/dist/domain/parked-query.d.ts +6 -0
- package/daemon/dist/domain/parked-query.d.ts.map +1 -1
- package/daemon/dist/domain/parked-query.js +14 -4
- package/daemon/dist/domain/parked-query.js.map +1 -1
- package/daemon/dist/domain/policies/seat-pool.d.ts +13 -0
- package/daemon/dist/domain/policies/seat-pool.d.ts.map +1 -1
- package/daemon/dist/domain/policies/seat-pool.js +18 -3
- package/daemon/dist/domain/policies/seat-pool.js.map +1 -1
- package/daemon/dist/domain/profile-resolver.d.ts +7 -1
- package/daemon/dist/domain/profile-resolver.d.ts.map +1 -1
- package/daemon/dist/domain/profile-resolver.js +7 -0
- package/daemon/dist/domain/profile-resolver.js.map +1 -1
- package/daemon/dist/domain/progress/progress-indexer.d.ts.map +1 -1
- package/daemon/dist/domain/progress/progress-indexer.js +11 -0
- package/daemon/dist/domain/progress/progress-indexer.js.map +1 -1
- package/daemon/dist/domain/project-lifecycle-compiler.d.ts.map +1 -1
- package/daemon/dist/domain/project-lifecycle-compiler.js +4 -1
- package/daemon/dist/domain/project-lifecycle-compiler.js.map +1 -1
- package/daemon/dist/domain/projection-planner.d.ts +17 -3
- package/daemon/dist/domain/projection-planner.d.ts.map +1 -1
- package/daemon/dist/domain/projection-planner.js +9 -1
- package/daemon/dist/domain/projection-planner.js.map +1 -1
- package/daemon/dist/domain/proof/judgments.d.ts +3 -0
- package/daemon/dist/domain/proof/judgments.d.ts.map +1 -1
- package/daemon/dist/domain/proof/judgments.js +13 -3
- package/daemon/dist/domain/proof/judgments.js.map +1 -1
- package/daemon/dist/domain/proof/source-watch.js +4 -4
- package/daemon/dist/domain/proof/source-watch.js.map +1 -1
- package/daemon/dist/domain/provider/claude-interruption.d.ts +6 -0
- package/daemon/dist/domain/provider/claude-interruption.d.ts.map +1 -1
- package/daemon/dist/domain/provider/claude-interruption.js +18 -0
- package/daemon/dist/domain/provider/claude-interruption.js.map +1 -1
- package/daemon/dist/domain/ps-projection.d.ts +8 -1
- package/daemon/dist/domain/ps-projection.d.ts.map +1 -1
- package/daemon/dist/domain/ps-projection.js +11 -3
- package/daemon/dist/domain/ps-projection.js.map +1 -1
- package/daemon/dist/domain/queue-destination-check.d.ts +8 -0
- package/daemon/dist/domain/queue-destination-check.d.ts.map +1 -1
- package/daemon/dist/domain/queue-destination-check.js +17 -4
- package/daemon/dist/domain/queue-destination-check.js.map +1 -1
- package/daemon/dist/domain/queue-erasure.d.ts +3 -0
- package/daemon/dist/domain/queue-erasure.d.ts.map +1 -1
- package/daemon/dist/domain/queue-erasure.js +2 -2
- package/daemon/dist/domain/queue-erasure.js.map +1 -1
- package/daemon/dist/domain/queue-owner.d.ts +5 -0
- package/daemon/dist/domain/queue-owner.d.ts.map +1 -1
- package/daemon/dist/domain/queue-owner.js +16 -8
- package/daemon/dist/domain/queue-owner.js.map +1 -1
- package/daemon/dist/domain/queue-recorded-graph.d.ts +32 -0
- package/daemon/dist/domain/queue-recorded-graph.d.ts.map +1 -0
- package/daemon/dist/domain/queue-recorded-graph.js +84 -0
- package/daemon/dist/domain/queue-recorded-graph.js.map +1 -0
- package/daemon/dist/domain/queue-repository.d.ts +94 -5
- package/daemon/dist/domain/queue-repository.d.ts.map +1 -1
- package/daemon/dist/domain/queue-repository.js +491 -39
- package/daemon/dist/domain/queue-repository.js.map +1 -1
- package/daemon/dist/domain/queue-retention.d.ts +1 -1
- package/daemon/dist/domain/queue-retention.d.ts.map +1 -1
- package/daemon/dist/domain/queue-retention.js +4 -0
- package/daemon/dist/domain/queue-retention.js.map +1 -1
- package/daemon/dist/domain/queue-stuck-sweep.d.ts +23 -3
- package/daemon/dist/domain/queue-stuck-sweep.d.ts.map +1 -1
- package/daemon/dist/domain/queue-stuck-sweep.js +661 -22
- package/daemon/dist/domain/queue-stuck-sweep.js.map +1 -1
- package/daemon/dist/domain/queue-transfer-export.d.ts +75 -0
- package/daemon/dist/domain/queue-transfer-export.d.ts.map +1 -0
- package/daemon/dist/domain/queue-transfer-export.js +158 -0
- package/daemon/dist/domain/queue-transfer-export.js.map +1 -0
- package/daemon/dist/domain/queue-transfer-format.d.ts +15 -0
- package/daemon/dist/domain/queue-transfer-format.d.ts.map +1 -0
- package/daemon/dist/domain/queue-transfer-format.js +32 -0
- package/daemon/dist/domain/queue-transfer-format.js.map +1 -0
- package/daemon/dist/domain/queue-transfer-parse.d.ts +40 -0
- package/daemon/dist/domain/queue-transfer-parse.d.ts.map +1 -0
- package/daemon/dist/domain/queue-transfer-parse.js +131 -0
- package/daemon/dist/domain/queue-transfer-parse.js.map +1 -0
- package/daemon/dist/domain/queue-transfer-review.d.ts +22 -0
- package/daemon/dist/domain/queue-transfer-review.d.ts.map +1 -0
- package/daemon/dist/domain/queue-transfer-review.js +81 -0
- package/daemon/dist/domain/queue-transfer-review.js.map +1 -0
- package/daemon/dist/domain/queue-transfer-staging.d.ts +79 -0
- package/daemon/dist/domain/queue-transfer-staging.d.ts.map +1 -0
- package/daemon/dist/domain/queue-transfer-staging.js +67 -0
- package/daemon/dist/domain/queue-transfer-staging.js.map +1 -0
- 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 +1 -1
- package/daemon/dist/domain/queue-transition-log.js.map +1 -1
- package/daemon/dist/domain/queue-waiting.d.ts.map +1 -1
- package/daemon/dist/domain/queue-waiting.js +7 -0
- package/daemon/dist/domain/queue-waiting.js.map +1 -1
- package/daemon/dist/domain/queue-wake-ladder.d.ts +4 -0
- package/daemon/dist/domain/queue-wake-ladder.d.ts.map +1 -1
- package/daemon/dist/domain/queue-wake-ladder.js +181 -24
- package/daemon/dist/domain/queue-wake-ladder.js.map +1 -1
- package/daemon/dist/domain/reconciler.d.ts +27 -2
- package/daemon/dist/domain/reconciler.d.ts.map +1 -1
- package/daemon/dist/domain/reconciler.js +184 -16
- package/daemon/dist/domain/reconciler.js.map +1 -1
- package/daemon/dist/domain/refusal-trace.d.ts +15 -0
- package/daemon/dist/domain/refusal-trace.d.ts.map +1 -0
- package/daemon/dist/domain/refusal-trace.js +23 -0
- package/daemon/dist/domain/refusal-trace.js.map +1 -0
- package/daemon/dist/domain/rehydrate-eligibility.d.ts +8 -0
- package/daemon/dist/domain/rehydrate-eligibility.d.ts.map +1 -1
- package/daemon/dist/domain/rehydrate-eligibility.js +61 -9
- package/daemon/dist/domain/rehydrate-eligibility.js.map +1 -1
- package/daemon/dist/domain/relayed-answers.d.ts +80 -0
- package/daemon/dist/domain/relayed-answers.d.ts.map +1 -0
- package/daemon/dist/domain/relayed-answers.js +8 -0
- package/daemon/dist/domain/relayed-answers.js.map +1 -0
- package/daemon/dist/domain/remote-control-observations.d.ts +50 -0
- package/daemon/dist/domain/remote-control-observations.d.ts.map +1 -0
- package/daemon/dist/domain/remote-control-observations.js +72 -0
- package/daemon/dist/domain/remote-control-observations.js.map +1 -0
- package/daemon/dist/domain/restore-attempt-receipt.d.ts.map +1 -1
- package/daemon/dist/domain/restore-attempt-receipt.js +8 -2
- package/daemon/dist/domain/restore-attempt-receipt.js.map +1 -1
- package/daemon/dist/domain/restore-check-service.d.ts.map +1 -1
- package/daemon/dist/domain/restore-check-service.js +5 -2
- package/daemon/dist/domain/restore-check-service.js.map +1 -1
- package/daemon/dist/domain/restore-orchestrator.d.ts +70 -6
- package/daemon/dist/domain/restore-orchestrator.d.ts.map +1 -1
- package/daemon/dist/domain/restore-orchestrator.js +387 -51
- package/daemon/dist/domain/restore-orchestrator.js.map +1 -1
- package/daemon/dist/domain/return-route.d.ts +13 -2
- package/daemon/dist/domain/return-route.d.ts.map +1 -1
- package/daemon/dist/domain/return-route.js +30 -1
- package/daemon/dist/domain/return-route.js.map +1 -1
- package/daemon/dist/domain/rig-lifecycle-service.d.ts +1 -0
- package/daemon/dist/domain/rig-lifecycle-service.d.ts.map +1 -1
- package/daemon/dist/domain/rig-lifecycle-service.js +27 -3
- package/daemon/dist/domain/rig-lifecycle-service.js.map +1 -1
- package/daemon/dist/domain/rig-mode/operating-posture.d.ts.map +1 -1
- package/daemon/dist/domain/rig-mode/operating-posture.js +23 -4
- package/daemon/dist/domain/rig-mode/operating-posture.js.map +1 -1
- package/daemon/dist/domain/rig-repository.d.ts +21 -3
- package/daemon/dist/domain/rig-repository.d.ts.map +1 -1
- package/daemon/dist/domain/rig-repository.js +67 -2
- package/daemon/dist/domain/rig-repository.js.map +1 -1
- package/daemon/dist/domain/rig-teardown.d.ts +52 -9
- package/daemon/dist/domain/rig-teardown.d.ts.map +1 -1
- package/daemon/dist/domain/rig-teardown.js +184 -32
- package/daemon/dist/domain/rig-teardown.js.map +1 -1
- package/daemon/dist/domain/rigspec-codec.d.ts.map +1 -1
- package/daemon/dist/domain/rigspec-codec.js +12 -0
- package/daemon/dist/domain/rigspec-codec.js.map +1 -1
- package/daemon/dist/domain/rigspec-exporter.d.ts +14 -0
- package/daemon/dist/domain/rigspec-exporter.d.ts.map +1 -1
- package/daemon/dist/domain/rigspec-exporter.js +56 -14
- package/daemon/dist/domain/rigspec-exporter.js.map +1 -1
- package/daemon/dist/domain/rigspec-instantiator.d.ts +34 -3
- package/daemon/dist/domain/rigspec-instantiator.d.ts.map +1 -1
- package/daemon/dist/domain/rigspec-instantiator.js +195 -40
- package/daemon/dist/domain/rigspec-instantiator.js.map +1 -1
- package/daemon/dist/domain/rigspec-preflight.d.ts.map +1 -1
- package/daemon/dist/domain/rigspec-preflight.js +26 -3
- package/daemon/dist/domain/rigspec-preflight.js.map +1 -1
- package/daemon/dist/domain/rigspec-schema.d.ts.map +1 -1
- package/daemon/dist/domain/rigspec-schema.js +30 -4
- package/daemon/dist/domain/rigspec-schema.js.map +1 -1
- package/daemon/dist/domain/roster-ready-notice.d.ts +11 -0
- package/daemon/dist/domain/roster-ready-notice.d.ts.map +1 -0
- package/daemon/dist/domain/roster-ready-notice.js +35 -0
- package/daemon/dist/domain/roster-ready-notice.js.map +1 -0
- package/daemon/dist/domain/rosters.d.ts +1 -0
- package/daemon/dist/domain/rosters.d.ts.map +1 -1
- package/daemon/dist/domain/rosters.js +5 -4
- package/daemon/dist/domain/rosters.js.map +1 -1
- package/daemon/dist/domain/runner-permissions.d.ts +140 -5
- package/daemon/dist/domain/runner-permissions.d.ts.map +1 -1
- package/daemon/dist/domain/runner-permissions.js +593 -16
- package/daemon/dist/domain/runner-permissions.js.map +1 -1
- package/daemon/dist/domain/runtime-adapter.d.ts +3 -1
- package/daemon/dist/domain/runtime-adapter.d.ts.map +1 -1
- package/daemon/dist/domain/runtime-exit.d.ts +79 -0
- package/daemon/dist/domain/runtime-exit.d.ts.map +1 -0
- package/daemon/dist/domain/runtime-exit.js +301 -0
- package/daemon/dist/domain/runtime-exit.js.map +1 -0
- package/daemon/dist/domain/runtime-switch-materials.d.ts +4 -1
- package/daemon/dist/domain/runtime-switch-materials.d.ts.map +1 -1
- package/daemon/dist/domain/runtime-switch-materials.js +66 -13
- package/daemon/dist/domain/runtime-switch-materials.js.map +1 -1
- package/daemon/dist/domain/scope/attestation-lineage.generated.js +2 -2
- package/daemon/dist/domain/scope/attestation-lineage.generated.js.map +1 -1
- package/daemon/dist/domain/scope/logical-checkbox.d.ts.map +1 -1
- package/daemon/dist/domain/scope/logical-checkbox.js +18 -0
- package/daemon/dist/domain/scope/logical-checkbox.js.map +1 -1
- package/daemon/dist/domain/scope/scaffold-placeholder.js +2 -2
- package/daemon/dist/domain/scope/scaffold-placeholder.js.map +1 -1
- package/daemon/dist/domain/seat-activity-service.d.ts +4 -0
- package/daemon/dist/domain/seat-activity-service.d.ts.map +1 -1
- package/daemon/dist/domain/seat-activity-service.js +24 -5
- package/daemon/dist/domain/seat-activity-service.js.map +1 -1
- package/daemon/dist/domain/seat-attention-reconciler.d.ts +7 -0
- package/daemon/dist/domain/seat-attention-reconciler.d.ts.map +1 -1
- package/daemon/dist/domain/seat-attention-reconciler.js +152 -65
- package/daemon/dist/domain/seat-attention-reconciler.js.map +1 -1
- package/daemon/dist/domain/seat-cold-start.d.ts +150 -0
- package/daemon/dist/domain/seat-cold-start.d.ts.map +1 -0
- package/daemon/dist/domain/seat-cold-start.js +371 -0
- package/daemon/dist/domain/seat-cold-start.js.map +1 -0
- package/daemon/dist/domain/seat-delivery-guard.d.ts +11 -2
- package/daemon/dist/domain/seat-delivery-guard.d.ts.map +1 -1
- package/daemon/dist/domain/seat-delivery-guard.js +34 -6
- package/daemon/dist/domain/seat-delivery-guard.js.map +1 -1
- package/daemon/dist/domain/seat-handover-service.d.ts +5 -2
- package/daemon/dist/domain/seat-handover-service.d.ts.map +1 -1
- package/daemon/dist/domain/seat-handover-service.js +30 -6
- package/daemon/dist/domain/seat-handover-service.js.map +1 -1
- package/daemon/dist/domain/seat-identity-reconciler.d.ts +31 -0
- package/daemon/dist/domain/seat-identity-reconciler.d.ts.map +1 -1
- package/daemon/dist/domain/seat-identity-reconciler.js +218 -29
- package/daemon/dist/domain/seat-identity-reconciler.js.map +1 -1
- package/daemon/dist/domain/seat-identity-store.d.ts +5 -3
- package/daemon/dist/domain/seat-identity-store.d.ts.map +1 -1
- package/daemon/dist/domain/seat-identity-store.js +7 -3
- package/daemon/dist/domain/seat-identity-store.js.map +1 -1
- package/daemon/dist/domain/seat-launch-environment.d.ts +8 -0
- package/daemon/dist/domain/seat-launch-environment.d.ts.map +1 -1
- package/daemon/dist/domain/seat-launch-environment.js +37 -5
- package/daemon/dist/domain/seat-launch-environment.js.map +1 -1
- package/daemon/dist/domain/seat-lifecycle-service.d.ts +54 -1
- package/daemon/dist/domain/seat-lifecycle-service.d.ts.map +1 -1
- package/daemon/dist/domain/seat-lifecycle-service.js +220 -30
- package/daemon/dist/domain/seat-lifecycle-service.js.map +1 -1
- package/daemon/dist/domain/seat-pool-executor.d.ts +174 -0
- package/daemon/dist/domain/seat-pool-executor.d.ts.map +1 -0
- package/daemon/dist/domain/seat-pool-executor.js +1241 -0
- package/daemon/dist/domain/seat-pool-executor.js.map +1 -0
- package/daemon/dist/domain/seat-pool-registration.d.ts +93 -0
- package/daemon/dist/domain/seat-pool-registration.d.ts.map +1 -0
- package/daemon/dist/domain/seat-pool-registration.js +149 -0
- package/daemon/dist/domain/seat-pool-registration.js.map +1 -0
- package/daemon/dist/domain/seat-pool-slots.d.ts +66 -0
- package/daemon/dist/domain/seat-pool-slots.d.ts.map +1 -1
- package/daemon/dist/domain/seat-pool-slots.js +101 -0
- package/daemon/dist/domain/seat-pool-slots.js.map +1 -1
- package/daemon/dist/domain/seat-restart-in-place.d.ts +15 -0
- package/daemon/dist/domain/seat-restart-in-place.d.ts.map +1 -1
- package/daemon/dist/domain/seat-restart-in-place.js +54 -2
- package/daemon/dist/domain/seat-restart-in-place.js.map +1 -1
- package/daemon/dist/domain/seat-runtime-home-record.d.ts +8 -0
- package/daemon/dist/domain/seat-runtime-home-record.d.ts.map +1 -1
- package/daemon/dist/domain/seat-runtime-home-record.js +1 -1
- package/daemon/dist/domain/seat-runtime-home-record.js.map +1 -1
- package/daemon/dist/domain/seat-runtime-switch-service.d.ts +2 -1
- package/daemon/dist/domain/seat-runtime-switch-service.d.ts.map +1 -1
- package/daemon/dist/domain/seat-runtime-switch-service.js +68 -20
- package/daemon/dist/domain/seat-runtime-switch-service.js.map +1 -1
- package/daemon/dist/domain/session-registry.d.ts +22 -3
- package/daemon/dist/domain/session-registry.d.ts.map +1 -1
- package/daemon/dist/domain/session-registry.js +38 -6
- package/daemon/dist/domain/session-registry.js.map +1 -1
- package/daemon/dist/domain/session-transport.d.ts +18 -2
- package/daemon/dist/domain/session-transport.d.ts.map +1 -1
- package/daemon/dist/domain/session-transport.js +73 -39
- package/daemon/dist/domain/session-transport.js.map +1 -1
- package/daemon/dist/domain/skill-catalog.d.ts.map +1 -1
- package/daemon/dist/domain/skill-catalog.js +24 -10
- package/daemon/dist/domain/skill-catalog.js.map +1 -1
- package/daemon/dist/domain/slices/slice-indexer.d.ts +55 -0
- package/daemon/dist/domain/slices/slice-indexer.d.ts.map +1 -1
- package/daemon/dist/domain/slices/slice-indexer.js +259 -50
- package/daemon/dist/domain/slices/slice-indexer.js.map +1 -1
- package/daemon/dist/domain/startup-orchestrator.d.ts +6 -2
- package/daemon/dist/domain/startup-orchestrator.d.ts.map +1 -1
- package/daemon/dist/domain/startup-orchestrator.js +118 -30
- package/daemon/dist/domain/startup-orchestrator.js.map +1 -1
- package/daemon/dist/domain/startup-proof.d.ts +6 -0
- package/daemon/dist/domain/startup-proof.d.ts.map +1 -1
- package/daemon/dist/domain/startup-proof.js +11 -0
- package/daemon/dist/domain/startup-proof.js.map +1 -1
- package/daemon/dist/domain/startup-submission-evidence.d.ts +3 -0
- package/daemon/dist/domain/startup-submission-evidence.d.ts.map +1 -1
- package/daemon/dist/domain/startup-submission-evidence.js +36 -3
- package/daemon/dist/domain/startup-submission-evidence.js.map +1 -1
- package/daemon/dist/domain/stream-reader-actions.d.ts +23 -0
- package/daemon/dist/domain/stream-reader-actions.d.ts.map +1 -1
- package/daemon/dist/domain/stream-reader-actions.js +43 -0
- package/daemon/dist/domain/stream-reader-actions.js.map +1 -1
- package/daemon/dist/domain/successor-session-launcher.d.ts +24 -3
- package/daemon/dist/domain/successor-session-launcher.d.ts.map +1 -1
- package/daemon/dist/domain/successor-session-launcher.js +54 -23
- package/daemon/dist/domain/successor-session-launcher.js.map +1 -1
- package/daemon/dist/domain/terminal/earlier-tile-attach-0723.d.ts +2 -0
- package/daemon/dist/domain/terminal/earlier-tile-attach-0723.d.ts.map +1 -0
- package/daemon/dist/domain/terminal/earlier-tile-attach-0723.js +48 -0
- package/daemon/dist/domain/terminal/earlier-tile-attach-0723.js.map +1 -0
- package/daemon/dist/domain/terminal/herdr-adapter.d.ts +2 -0
- package/daemon/dist/domain/terminal/herdr-adapter.d.ts.map +1 -1
- package/daemon/dist/domain/terminal/herdr-adapter.js +2 -0
- package/daemon/dist/domain/terminal/herdr-adapter.js.map +1 -1
- package/daemon/dist/domain/terminal/rex-agent-status.d.ts.map +1 -1
- package/daemon/dist/domain/terminal/rex-agent-status.js +5 -2
- package/daemon/dist/domain/terminal/rex-agent-status.js.map +1 -1
- package/daemon/dist/domain/terminal/scope-task-terminal-view.d.ts +2 -1
- package/daemon/dist/domain/terminal/scope-task-terminal-view.d.ts.map +1 -1
- package/daemon/dist/domain/terminal/scope-task-terminal-view.js +80 -38
- package/daemon/dist/domain/terminal/scope-task-terminal-view.js.map +1 -1
- package/daemon/dist/domain/terminal/terminal-provider.d.ts +2 -0
- package/daemon/dist/domain/terminal/terminal-provider.d.ts.map +1 -1
- package/daemon/dist/domain/terminal/terminal-service.d.ts +3 -0
- package/daemon/dist/domain/terminal/terminal-service.d.ts.map +1 -1
- package/daemon/dist/domain/terminal/terminal-service.js +30 -26
- package/daemon/dist/domain/terminal/terminal-service.js.map +1 -1
- package/daemon/dist/domain/terminal/tile-attach.d.ts +31 -3
- package/daemon/dist/domain/terminal/tile-attach.d.ts.map +1 -1
- package/daemon/dist/domain/terminal/tile-attach.js +95 -4
- package/daemon/dist/domain/terminal/tile-attach.js.map +1 -1
- package/daemon/dist/domain/terminal/view-composer.d.ts +2 -0
- package/daemon/dist/domain/terminal/view-composer.d.ts.map +1 -1
- package/daemon/dist/domain/terminal/view-composer.js +4 -2
- package/daemon/dist/domain/terminal/view-composer.js.map +1 -1
- package/daemon/dist/domain/topology-trace.d.ts +40 -0
- package/daemon/dist/domain/topology-trace.d.ts.map +1 -0
- package/daemon/dist/domain/topology-trace.js +106 -0
- package/daemon/dist/domain/topology-trace.js.map +1 -0
- package/daemon/dist/domain/transcript-redaction.d.ts +10 -8
- package/daemon/dist/domain/transcript-redaction.d.ts.map +1 -1
- package/daemon/dist/domain/transcript-redaction.js +51 -22
- package/daemon/dist/domain/transcript-redaction.js.map +1 -1
- package/daemon/dist/domain/transcript-store.d.ts.map +1 -1
- package/daemon/dist/domain/transcript-store.js +12 -1
- package/daemon/dist/domain/transcript-store.js.map +1 -1
- package/daemon/dist/domain/types.d.ts +111 -9
- package/daemon/dist/domain/types.d.ts.map +1 -1
- package/daemon/dist/domain/types.js +6 -2
- package/daemon/dist/domain/types.js.map +1 -1
- package/daemon/dist/domain/user-settings/settings-browser.d.ts.map +1 -1
- package/daemon/dist/domain/user-settings/settings-browser.js +2 -0
- package/daemon/dist/domain/user-settings/settings-browser.js.map +1 -1
- package/daemon/dist/domain/user-settings/settings-store.d.ts +1 -1
- package/daemon/dist/domain/user-settings/settings-store.d.ts.map +1 -1
- package/daemon/dist/domain/user-settings/settings-store.js +13 -0
- package/daemon/dist/domain/user-settings/settings-store.js.map +1 -1
- package/daemon/dist/domain/watchdog-jobs-repository.d.ts +5 -3
- package/daemon/dist/domain/watchdog-jobs-repository.d.ts.map +1 -1
- package/daemon/dist/domain/watchdog-jobs-repository.js +6 -1
- package/daemon/dist/domain/watchdog-jobs-repository.js.map +1 -1
- package/daemon/dist/domain/watchdog-policy-engine.d.ts +8 -1
- package/daemon/dist/domain/watchdog-policy-engine.d.ts.map +1 -1
- package/daemon/dist/domain/watchdog-policy-engine.js +6 -2
- package/daemon/dist/domain/watchdog-policy-engine.js.map +1 -1
- package/daemon/dist/domain/whoami-service.d.ts +11 -0
- package/daemon/dist/domain/whoami-service.d.ts.map +1 -1
- package/daemon/dist/domain/whoami-service.js +13 -0
- package/daemon/dist/domain/whoami-service.js.map +1 -1
- package/daemon/dist/domain/workflow-instance-store.d.ts +2 -0
- package/daemon/dist/domain/workflow-instance-store.d.ts.map +1 -1
- package/daemon/dist/domain/workflow-instance-store.js +11 -2
- package/daemon/dist/domain/workflow-instance-store.js.map +1 -1
- package/daemon/dist/domain/workflow-projector.d.ts +3 -1
- package/daemon/dist/domain/workflow-projector.d.ts.map +1 -1
- package/daemon/dist/domain/workflow-projector.js +58 -10
- package/daemon/dist/domain/workflow-projector.js.map +1 -1
- package/daemon/dist/domain/workflow-reconciliation.d.ts.map +1 -1
- package/daemon/dist/domain/workflow-reconciliation.js +9 -0
- package/daemon/dist/domain/workflow-reconciliation.js.map +1 -1
- package/daemon/dist/domain/workflow-run-title.d.ts +4 -0
- package/daemon/dist/domain/workflow-run-title.d.ts.map +1 -0
- package/daemon/dist/domain/workflow-run-title.js +5 -0
- package/daemon/dist/domain/workflow-run-title.js.map +1 -0
- package/daemon/dist/domain/workflow-runtime.d.ts +3 -0
- package/daemon/dist/domain/workflow-runtime.d.ts.map +1 -1
- package/daemon/dist/domain/workflow-runtime.js +48 -3
- package/daemon/dist/domain/workflow-runtime.js.map +1 -1
- package/daemon/dist/domain/workflow-spec-cache.d.ts +2 -2
- package/daemon/dist/domain/workflow-spec-cache.d.ts.map +1 -1
- package/daemon/dist/domain/workflow-spec-cache.js +20 -1
- package/daemon/dist/domain/workflow-spec-cache.js.map +1 -1
- package/daemon/dist/domain/workflow-types.d.ts +15 -0
- package/daemon/dist/domain/workflow-types.d.ts.map +1 -1
- package/daemon/dist/domain/workflow-types.js +4 -0
- package/daemon/dist/domain/workflow-types.js.map +1 -1
- package/daemon/dist/domain/workspace/project-read.d.ts +10 -0
- package/daemon/dist/domain/workspace/project-read.d.ts.map +1 -1
- package/daemon/dist/domain/workspace/project-read.js +34 -2
- package/daemon/dist/domain/workspace/project-read.js.map +1 -1
- package/daemon/dist/index.d.ts.map +1 -1
- package/daemon/dist/index.js +7 -1
- package/daemon/dist/index.js.map +1 -1
- package/daemon/dist/queue-transfer-export-surface.d.ts +33 -0
- package/daemon/dist/queue-transfer-export-surface.d.ts.map +1 -0
- package/daemon/dist/queue-transfer-export-surface.js +13 -0
- package/daemon/dist/queue-transfer-export-surface.js.map +1 -0
- package/daemon/dist/queue-transfer-staging-surface.d.ts +86 -0
- package/daemon/dist/queue-transfer-staging-surface.d.ts.map +1 -0
- package/daemon/dist/queue-transfer-staging-surface.js +91 -0
- package/daemon/dist/queue-transfer-staging-surface.js.map +1 -0
- package/daemon/dist/routes/activity.d.ts.map +1 -1
- package/daemon/dist/routes/activity.js +105 -2
- package/daemon/dist/routes/activity.js.map +1 -1
- package/daemon/dist/routes/compaction.d.ts.map +1 -1
- package/daemon/dist/routes/compaction.js +33 -11
- package/daemon/dist/routes/compaction.js.map +1 -1
- package/daemon/dist/routes/context-packs.d.ts.map +1 -1
- package/daemon/dist/routes/context-packs.js +23 -1
- package/daemon/dist/routes/context-packs.js.map +1 -1
- package/daemon/dist/routes/events.js +7 -4
- package/daemon/dist/routes/events.js.map +1 -1
- package/daemon/dist/routes/network.d.ts +2 -0
- package/daemon/dist/routes/network.d.ts.map +1 -1
- package/daemon/dist/routes/network.js +62 -1
- package/daemon/dist/routes/network.js.map +1 -1
- package/daemon/dist/routes/ps.js +12 -1
- package/daemon/dist/routes/ps.js.map +1 -1
- package/daemon/dist/routes/queue.d.ts.map +1 -1
- package/daemon/dist/routes/queue.js +219 -77
- package/daemon/dist/routes/queue.js.map +1 -1
- package/daemon/dist/routes/require-sender-identity.d.ts +15 -0
- package/daemon/dist/routes/require-sender-identity.d.ts.map +1 -1
- package/daemon/dist/routes/require-sender-identity.js +57 -8
- package/daemon/dist/routes/require-sender-identity.js.map +1 -1
- package/daemon/dist/routes/rigs.js +2 -0
- package/daemon/dist/routes/rigs.js.map +1 -1
- package/daemon/dist/routes/seat.d.ts.map +1 -1
- package/daemon/dist/routes/seat.js +18 -5
- package/daemon/dist/routes/seat.js.map +1 -1
- package/daemon/dist/routes/sessions.d.ts.map +1 -1
- package/daemon/dist/routes/sessions.js +14 -0
- package/daemon/dist/routes/sessions.js.map +1 -1
- package/daemon/dist/routes/slices.d.ts.map +1 -1
- package/daemon/dist/routes/slices.js +16 -7
- package/daemon/dist/routes/slices.js.map +1 -1
- package/daemon/dist/routes/startup.d.ts.map +1 -1
- package/daemon/dist/routes/startup.js +49 -4
- package/daemon/dist/routes/startup.js.map +1 -1
- package/daemon/dist/routes/stream.d.ts.map +1 -1
- package/daemon/dist/routes/stream.js +28 -1
- package/daemon/dist/routes/stream.js.map +1 -1
- package/daemon/dist/routes/terminal-ws.js +28 -2
- package/daemon/dist/routes/terminal-ws.js.map +1 -1
- package/daemon/dist/routes/terminal.d.ts.map +1 -1
- package/daemon/dist/routes/terminal.js +3 -2
- package/daemon/dist/routes/terminal.js.map +1 -1
- package/daemon/dist/routes/transport.d.ts.map +1 -1
- package/daemon/dist/routes/transport.js +14 -2
- package/daemon/dist/routes/transport.js.map +1 -1
- package/daemon/dist/routes/up.js +2 -0
- package/daemon/dist/routes/up.js.map +1 -1
- package/daemon/dist/routes/workflow.d.ts.map +1 -1
- package/daemon/dist/routes/workflow.js +57 -44
- package/daemon/dist/routes/workflow.js.map +1 -1
- package/daemon/dist/server.d.ts +7 -0
- package/daemon/dist/server.d.ts.map +1 -1
- package/daemon/dist/server.js +25 -1
- package/daemon/dist/server.js.map +1 -1
- package/daemon/dist/startup.d.ts +3 -0
- package/daemon/dist/startup.d.ts.map +1 -1
- package/daemon/dist/startup.js +166 -12
- package/daemon/dist/startup.js.map +1 -1
- package/daemon/dist/terminal/TerminalSessionBroker.d.ts +10 -0
- package/daemon/dist/terminal/TerminalSessionBroker.d.ts.map +1 -1
- package/daemon/dist/terminal/TerminalSessionBroker.js +63 -4
- package/daemon/dist/terminal/TerminalSessionBroker.js.map +1 -1
- package/daemon/dist/topology-trace-surface.d.ts +2 -0
- package/daemon/dist/topology-trace-surface.d.ts.map +1 -0
- package/daemon/dist/topology-trace-surface.js +2 -0
- package/daemon/dist/topology-trace-surface.js.map +1 -0
- package/daemon/dist/transcript-redaction-surface.d.ts +2 -0
- package/daemon/dist/transcript-redaction-surface.d.ts.map +1 -0
- package/daemon/dist/transcript-redaction-surface.js +2 -0
- package/daemon/dist/transcript-redaction-surface.js.map +1 -0
- package/daemon/docs/reference/acp-agents.md +11 -3
- package/daemon/docs/reference/agent-spec.md +25 -2
- package/daemon/docs/reference/agent-startup-guide.md +13 -1
- package/daemon/docs/reference/agent-state-taxonomy.md +35 -1
- package/daemon/docs/reference/checked-seat-stop.md +11 -1
- package/daemon/docs/reference/claude-status-line.md +7 -0
- package/daemon/docs/reference/community-harness-examples/cursor/cursor.yaml +3 -1
- package/daemon/docs/reference/community-harness-presets.md +27 -2
- package/daemon/docs/reference/daemon-http-clients.md +177 -18
- package/daemon/docs/reference/developing.md +3 -2
- package/daemon/docs/reference/gateway-participants.md +6 -0
- package/daemon/docs/reference/getting-started.md +144 -13
- package/daemon/docs/reference/harness-runner-contract.md +72 -0
- package/daemon/docs/reference/hosted-members.md +133 -0
- package/daemon/docs/reference/inventory-request-diagnostics.md +22 -0
- package/daemon/docs/reference/network-connector.md +141 -4
- package/daemon/docs/reference/project-workspace.md +11 -2
- package/daemon/docs/reference/queue-erasure.md +1 -1
- package/daemon/docs/reference/queue-transfer-export.md +38 -0
- package/daemon/docs/reference/queue-transfer-staging.md +39 -0
- package/daemon/docs/reference/quickstart.md +4 -4
- package/daemon/docs/reference/refocus-channel.md +53 -2
- package/daemon/docs/reference/rig-bundle.md +11 -1
- package/daemon/docs/reference/rig-spec.md +201 -3
- package/daemon/docs/reference/rosters.md +18 -3
- package/daemon/docs/reference/sdlc-conventions.md +1 -1
- package/daemon/docs/reference/seat-delivery.md +21 -4
- package/daemon/docs/reference/seat-node-targeting.md +10 -0
- package/daemon/docs/reference/seat-pools.md +182 -0
- package/daemon/docs/reference/slack-app-setup.md +15 -0
- package/daemon/docs/reference/terminal-sessions.md +127 -13
- package/daemon/docs/reference/tmux-servers.md +43 -2
- package/daemon/docs/reference/whats-new.md +186 -12
- package/daemon/specs/agents/shared/skills/core/messaging-the-human/SKILL.md +1 -1
- package/daemon/specs/agents/shared/skills/core/working-with-an-openrig-team/SKILL.md +71 -9
- package/daemon/specs/rigs/launch/factory/guidance/lead-first-move.md +4 -1
- package/daemon/specs/rigs/launch/kernel/agents/operator/agent/guidance/role.md +2 -1
- package/daemon/specs/rigs/launch/starter/guidance/lead-first-move.md +4 -1
- package/dist/bin-wrapper.d.ts.map +1 -1
- package/dist/bin-wrapper.js +24 -5
- package/dist/bin-wrapper.js.map +1 -1
- package/dist/build-info.js +3 -3
- package/dist/client.d.ts +6 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +7 -1
- package/dist/client.js.map +1 -1
- package/dist/commands/add.js +1 -1
- package/dist/commands/add.js.map +1 -1
- package/dist/commands/agent.js +1 -1
- package/dist/commands/agent.js.map +1 -1
- package/dist/commands/broadcast.d.ts.map +1 -1
- package/dist/commands/broadcast.js +87 -8
- package/dist/commands/broadcast.js.map +1 -1
- package/dist/commands/bundle.d.ts.map +1 -1
- package/dist/commands/bundle.js +18 -4
- package/dist/commands/bundle.js.map +1 -1
- package/dist/commands/chatroom.d.ts +3 -0
- package/dist/commands/chatroom.d.ts.map +1 -1
- package/dist/commands/chatroom.js +7 -1
- package/dist/commands/chatroom.js.map +1 -1
- package/dist/commands/config.d.ts.map +1 -1
- package/dist/commands/config.js +2 -1
- package/dist/commands/config.js.map +1 -1
- package/dist/commands/create.d.ts.map +1 -1
- package/dist/commands/create.js +6 -2
- package/dist/commands/create.js.map +1 -1
- package/dist/commands/daemon.d.ts.map +1 -1
- package/dist/commands/daemon.js +18 -15
- package/dist/commands/daemon.js.map +1 -1
- package/dist/commands/down.d.ts.map +1 -1
- package/dist/commands/down.js +12 -1
- package/dist/commands/down.js.map +1 -1
- package/dist/commands/exec.d.ts.map +1 -1
- package/dist/commands/exec.js +22 -13
- package/dist/commands/exec.js.map +1 -1
- package/dist/commands/expand.js +1 -1
- package/dist/commands/expand.js.map +1 -1
- package/dist/commands/export.d.ts.map +1 -1
- package/dist/commands/export.js +5 -1
- package/dist/commands/export.js.map +1 -1
- package/dist/commands/fork.js +1 -1
- package/dist/commands/fork.js.map +1 -1
- package/dist/commands/gateway.d.ts +4 -0
- package/dist/commands/gateway.d.ts.map +1 -1
- package/dist/commands/gateway.js +37 -0
- package/dist/commands/gateway.js.map +1 -1
- package/dist/commands/grow.d.ts.map +1 -1
- package/dist/commands/grow.js +9 -4
- package/dist/commands/grow.js.map +1 -1
- package/dist/commands/import.js +1 -1
- package/dist/commands/import.js.map +1 -1
- package/dist/commands/mcp.d.ts.map +1 -1
- package/dist/commands/mcp.js +57 -22
- package/dist/commands/mcp.js.map +1 -1
- package/dist/commands/network.d.ts +2 -3
- package/dist/commands/network.d.ts.map +1 -1
- package/dist/commands/network.js +102 -4
- package/dist/commands/network.js.map +1 -1
- package/dist/commands/parked.d.ts.map +1 -1
- package/dist/commands/parked.js +12 -6
- package/dist/commands/parked.js.map +1 -1
- package/dist/commands/provider.d.ts.map +1 -1
- package/dist/commands/provider.js +3 -2
- package/dist/commands/provider.js.map +1 -1
- package/dist/commands/ps.d.ts +13 -1
- package/dist/commands/ps.d.ts.map +1 -1
- package/dist/commands/ps.js +65 -29
- package/dist/commands/ps.js.map +1 -1
- package/dist/commands/queue-export.d.ts +3 -0
- package/dist/commands/queue-export.d.ts.map +1 -0
- package/dist/commands/queue-export.js +67 -0
- package/dist/commands/queue-export.js.map +1 -0
- package/dist/commands/queue-import.d.ts +4 -0
- package/dist/commands/queue-import.d.ts.map +1 -0
- package/dist/commands/queue-import.js +47 -0
- package/dist/commands/queue-import.js.map +1 -0
- package/dist/commands/queue.d.ts +3 -1
- package/dist/commands/queue.d.ts.map +1 -1
- package/dist/commands/queue.js +79 -7
- package/dist/commands/queue.js.map +1 -1
- package/dist/commands/reconcile-session.js +1 -1
- package/dist/commands/reconcile-session.js.map +1 -1
- package/dist/commands/restore.js +1 -1
- package/dist/commands/restore.js.map +1 -1
- package/dist/commands/rig.js +2 -2
- package/dist/commands/rig.js.map +1 -1
- package/dist/commands/roster.js +1 -1
- package/dist/commands/roster.js.map +1 -1
- package/dist/commands/scope.d.ts.map +1 -1
- package/dist/commands/scope.js +30 -18
- package/dist/commands/scope.js.map +1 -1
- package/dist/commands/seat.d.ts.map +1 -1
- package/dist/commands/seat.js +75 -18
- package/dist/commands/seat.js.map +1 -1
- package/dist/commands/send.d.ts.map +1 -1
- package/dist/commands/send.js +15 -3
- package/dist/commands/send.js.map +1 -1
- package/dist/commands/skill.js +1 -1
- package/dist/commands/skill.js.map +1 -1
- package/dist/commands/start.d.ts +14 -0
- package/dist/commands/start.d.ts.map +1 -1
- package/dist/commands/start.js +57 -7
- package/dist/commands/start.js.map +1 -1
- package/dist/commands/terminal.d.ts.map +1 -1
- package/dist/commands/terminal.js +20 -4
- package/dist/commands/terminal.js.map +1 -1
- package/dist/commands/up.d.ts.map +1 -1
- package/dist/commands/up.js +2 -1
- package/dist/commands/up.js.map +1 -1
- package/dist/commands/whoami.d.ts.map +1 -1
- package/dist/commands/whoami.js +6 -0
- package/dist/commands/whoami.js.map +1 -1
- package/dist/commands/workflow-follow.d.ts.map +1 -1
- package/dist/commands/workflow-follow.js +37 -34
- package/dist/commands/workflow-follow.js.map +1 -1
- package/dist/commands/workflow-render.d.ts +1 -1
- package/dist/commands/workflow-render.d.ts.map +1 -1
- package/dist/commands/workflow-render.js +2 -7
- package/dist/commands/workflow-render.js.map +1 -1
- package/dist/commands/workflow.d.ts.map +1 -1
- package/dist/commands/workflow.js +26 -2
- package/dist/commands/workflow.js.map +1 -1
- package/dist/config-store.d.ts +2 -1
- package/dist/config-store.d.ts.map +1 -1
- package/dist/config-store.js +14 -1
- package/dist/config-store.js.map +1 -1
- package/dist/cross-host-executor.d.ts +3 -0
- package/dist/cross-host-executor.d.ts.map +1 -1
- package/dist/cross-host-executor.js +5 -0
- package/dist/cross-host-executor.js.map +1 -1
- package/dist/daemon-auto-start.d.ts.map +1 -1
- package/dist/daemon-auto-start.js +1 -0
- package/dist/daemon-auto-start.js.map +1 -1
- package/dist/daemon-lifecycle.d.ts +30 -1
- package/dist/daemon-lifecycle.d.ts.map +1 -1
- package/dist/daemon-lifecycle.js +135 -38
- package/dist/daemon-lifecycle.js.map +1 -1
- package/dist/daemon-start-lock.d.ts +38 -3
- package/dist/daemon-start-lock.d.ts.map +1 -1
- package/dist/daemon-start-lock.js +201 -48
- package/dist/daemon-start-lock.js.map +1 -1
- package/dist/lib/bundle-source.d.ts +4 -0
- package/dist/lib/bundle-source.d.ts.map +1 -1
- package/dist/lib/bundle-source.js +14 -2
- package/dist/lib/bundle-source.js.map +1 -1
- package/dist/lib/context-git.js +2 -2
- package/dist/lib/context-git.js.map +1 -1
- package/dist/lib/frontmatter.d.ts.map +1 -1
- package/dist/lib/frontmatter.js +4 -2
- package/dist/lib/frontmatter.js.map +1 -1
- package/dist/lib/scope/attestation-lineage.js +2 -2
- package/dist/lib/scope/attestation-lineage.js.map +1 -1
- package/dist/lib/scope/logical-checkbox.d.ts.map +1 -1
- package/dist/lib/scope/logical-checkbox.js +18 -0
- package/dist/lib/scope/logical-checkbox.js.map +1 -1
- package/dist/lib/scope/progress-edit.d.ts.map +1 -1
- package/dist/lib/scope/progress-edit.js +11 -1
- package/dist/lib/scope/progress-edit.js.map +1 -1
- package/dist/lib/scope/scaffold-placeholder.js +2 -2
- package/dist/lib/scope/scaffold-placeholder.js.map +1 -1
- package/dist/lib/terminal-cell.d.ts +5 -0
- package/dist/lib/terminal-cell.d.ts.map +1 -0
- package/dist/lib/terminal-cell.js +22 -0
- package/dist/lib/terminal-cell.js.map +1 -0
- package/dist/lib/topology-trace.d.ts +3 -34
- package/dist/lib/topology-trace.d.ts.map +1 -1
- package/dist/lib/topology-trace.js +3 -97
- package/dist/lib/topology-trace.js.map +1 -1
- package/dist/local-db.d.ts +2 -0
- package/dist/local-db.d.ts.map +1 -1
- package/dist/local-db.js +14 -11
- package/dist/local-db.js.map +1 -1
- package/dist/mcp-caller-resolver.d.ts +36 -0
- package/dist/mcp-caller-resolver.d.ts.map +1 -0
- package/dist/mcp-caller-resolver.js +82 -0
- package/dist/mcp-caller-resolver.js.map +1 -0
- package/dist/mcp-http.d.ts +44 -3
- package/dist/mcp-http.d.ts.map +1 -1
- package/dist/mcp-http.js +228 -48
- package/dist/mcp-http.js.map +1 -1
- package/dist/mcp-server.d.ts +28 -1
- package/dist/mcp-server.d.ts.map +1 -1
- package/dist/mcp-server.js +219 -52
- package/dist/mcp-server.js.map +1 -1
- package/dist/mcp-surface.d.ts +3 -2
- package/dist/mcp-surface.d.ts.map +1 -1
- package/dist/node-support.d.ts.map +1 -1
- package/dist/node-support.js +10 -0
- package/dist/node-support.js.map +1 -1
- package/dist/release-surface/extract-surface.d.ts.map +1 -1
- package/dist/release-surface/extract-surface.js +38 -20
- package/dist/release-surface/extract-surface.js.map +1 -1
- package/dist/release-surface/generate.d.ts.map +1 -1
- package/dist/release-surface/generate.js +3 -0
- package/dist/release-surface/generate.js.map +1 -1
- package/dist/release-surface/surface-diff.d.ts +1 -0
- package/dist/release-surface/surface-diff.d.ts.map +1 -1
- package/dist/release-surface/surface-diff.js +19 -18
- package/dist/release-surface/surface-diff.js.map +1 -1
- package/dist/remote-host-ops.d.ts +3 -0
- package/dist/remote-host-ops.d.ts.map +1 -1
- package/dist/remote-host-ops.js +15 -1
- package/dist/remote-host-ops.js.map +1 -1
- package/dist/restore-packet/redaction.d.ts +4 -26
- package/dist/restore-packet/redaction.d.ts.map +1 -1
- package/dist/restore-packet/redaction.js +19 -63
- package/dist/restore-packet/redaction.js.map +1 -1
- package/dist/terminal-orca.d.ts +7 -0
- package/dist/terminal-orca.d.ts.map +1 -0
- package/dist/terminal-orca.js +239 -0
- package/dist/terminal-orca.js.map +1 -0
- package/package.json +3 -3
- package/scripts/check-abi.mjs +15 -0
- package/tui/dist/attention/attention-model.d.ts.map +1 -1
- package/tui/dist/attention/attention-model.js +8 -4
- package/tui/dist/attention/attention-model.js.map +1 -1
- package/tui/dist/connected-assistants.d.ts +1 -1
- package/tui/dist/connected-assistants.d.ts.map +1 -1
- package/tui/dist/connected-assistants.js +3 -1
- package/tui/dist/connected-assistants.js.map +1 -1
- package/tui/dist/crash-cart/start-daemon.d.ts +20 -0
- package/tui/dist/crash-cart/start-daemon.d.ts.map +1 -1
- package/tui/dist/crash-cart/start-daemon.js +56 -0
- package/tui/dist/crash-cart/start-daemon.js.map +1 -1
- package/tui/dist/daemon-client.d.ts +4 -0
- package/tui/dist/daemon-client.d.ts.map +1 -1
- package/tui/dist/daemon-client.js +12 -8
- package/tui/dist/daemon-client.js.map +1 -1
- package/tui/dist/health/health-model.d.ts.map +1 -1
- package/tui/dist/health/health-model.js +2 -0
- package/tui/dist/health/health-model.js.map +1 -1
- package/tui/dist/hydrate.d.ts +3 -1
- package/tui/dist/hydrate.d.ts.map +1 -1
- package/tui/dist/hydrate.js +44 -27
- package/tui/dist/hydrate.js.map +1 -1
- package/tui/dist/live.d.ts +5 -1
- package/tui/dist/live.d.ts.map +1 -1
- package/tui/dist/live.js +20 -2
- package/tui/dist/live.js.map +1 -1
- package/tui/dist/main.js +29 -10
- package/tui/dist/main.js.map +1 -1
- package/tui/dist/pulse/pulse-model.d.ts.map +1 -1
- package/tui/dist/pulse/pulse-model.js +3 -2
- package/tui/dist/pulse/pulse-model.js.map +1 -1
- package/tui/dist/render.d.ts +2 -0
- package/tui/dist/render.d.ts.map +1 -1
- package/tui/dist/render.js +47 -14
- package/tui/dist/render.js.map +1 -1
- package/tui/dist/types.d.ts +10 -4
- package/tui/dist/types.d.ts.map +1 -1
- package/ui/dist/assets/index-Chh-NS8Z.css +32 -0
- package/ui/dist/assets/index-DG_7XFcL.js +628 -0
- package/ui/dist/index.html +2 -2
- package/ui/dist/assets/index-B-sMy02c.js +0 -623
- package/ui/dist/assets/index-DiN7RwWg.css +0 -32
|
@@ -0,0 +1,1241 @@
|
|
|
1
|
+
import { randomUUID } from "node:crypto";
|
|
2
|
+
import { readClaudeAutoModeForLaunch } from "./claude-auto-mode.js";
|
|
3
|
+
import { reserveOperation } from "./operation-correlation.js";
|
|
4
|
+
import { planSeatPool, seatPoolCanReceive, } from "./policies/seat-pool.js";
|
|
5
|
+
import { DeliveryGuardError } from "./seat-delivery-guard.js";
|
|
6
|
+
import { seatPoolModelOfJob } from "./seat-pool-registration.js";
|
|
7
|
+
import { readAttemptOutcome } from "./seat-pool-slots.js";
|
|
8
|
+
import { parsePoolBlock } from "./seat-pool-spec.js";
|
|
9
|
+
import { deriveCanonicalSessionName } from "./session-name.js";
|
|
10
|
+
import { seatLaunchAdditionPathsForNode } from "./seat-launch-additions.js";
|
|
11
|
+
/** The report of a stop from what the checked stop returned. */
|
|
12
|
+
export function seatPoolStopReport(stop) {
|
|
13
|
+
// A keep_alive seat whose session was already gone is recorded as stopped, but nothing was stopped: an absence.
|
|
14
|
+
if (stop.ok && stop.alreadyDown)
|
|
15
|
+
return { cause: "drain", result: "absent", code: "already_down", ...(stop.message ? { message: stop.message } : {}) };
|
|
16
|
+
if (stop.ok)
|
|
17
|
+
return { cause: "drain", result: "stopped" };
|
|
18
|
+
if (stop.code === "session_not_live")
|
|
19
|
+
return { cause: "drain", result: "absent", code: stop.code, message: stop.message };
|
|
20
|
+
if (stop.code === "selection_changed" && stop.partialEffect !== true) {
|
|
21
|
+
return { cause: "drain", result: "changed_owner", code: stop.code, message: stop.message };
|
|
22
|
+
}
|
|
23
|
+
return { cause: "drain", result: "unconfirmed", code: stop.code, message: stop.message };
|
|
24
|
+
}
|
|
25
|
+
/** The queue's reroute actor and note, as the queue records a reroute (the queue's own rule for "was rerouted"). */
|
|
26
|
+
const QUEUE_FALLBACK_ACTOR = "system:queue-fallback";
|
|
27
|
+
const FALLBACK_NOTE = "fallback-routed: ";
|
|
28
|
+
/** No cut: list() keeps the newest rows first, so any limit would drop the oldest rows, which move first. */
|
|
29
|
+
const ALL_ROWS = Number.MAX_SAFE_INTEGER;
|
|
30
|
+
/** Refusals that mean the row moved on since it was read: skipped, never a failure. */
|
|
31
|
+
const ROW_MOVED_ON = new Set(["fallback_state_mismatch", "fallback_destination_mismatch", "qitem_not_found"]);
|
|
32
|
+
/** A queue-only seat's cold watchdog reminder is about that seat, never its work (the stuck sweep's rule). */
|
|
33
|
+
function isWatchdogReminder(row) {
|
|
34
|
+
return row.sourceSession === "watchdog@system" && !!row.tags?.includes("watchdog") && row.tags.includes("queue-only");
|
|
35
|
+
}
|
|
36
|
+
/** When the row was last rerouted, from its transitions, or null when it never was. */
|
|
37
|
+
function lastReroute(queueRepo, qitemId) {
|
|
38
|
+
const transitions = queueRepo.transitionLog.listForQitem(qitemId);
|
|
39
|
+
for (let i = transitions.length - 1; i >= 0; i--) {
|
|
40
|
+
const t = transitions[i];
|
|
41
|
+
if (t.actorSession === QUEUE_FALLBACK_ACTOR && t.transitionNote?.startsWith(FALLBACK_NOTE) && t.identityProvenance === null)
|
|
42
|
+
return t.ts;
|
|
43
|
+
}
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
/** The queue repository as the pool uses it: two reads and the move. */
|
|
47
|
+
export function seatPoolQueueEffects(queueRepo) {
|
|
48
|
+
return {
|
|
49
|
+
pendingRows: (sessionName) => {
|
|
50
|
+
// The seat's own work, by the same rule as its open obligations: a wake escalation about its own prompt is left out.
|
|
51
|
+
const work = new Set(queueRepo.listOpenObligations(sessionName, ALL_ROWS).map((row) => row.qitemId));
|
|
52
|
+
return queueRepo.list({ destinationSession: sessionName, state: "pending", limit: ALL_ROWS, compact: true })
|
|
53
|
+
.filter((row) => work.has(row.qitemId) && !isWatchdogReminder(row))
|
|
54
|
+
.map((row) => ({
|
|
55
|
+
qitemId: row.qitemId,
|
|
56
|
+
rawDestination: row.destinationSession,
|
|
57
|
+
tags: row.tags ?? [],
|
|
58
|
+
waitingSince: lastReroute(queueRepo, row.qitemId) ?? row.tsCreated,
|
|
59
|
+
}));
|
|
60
|
+
},
|
|
61
|
+
openRows: (sessionName) => queueRepo.listOpenObligations(sessionName, ALL_ROWS).length,
|
|
62
|
+
moveRow: async ({ qitemId, from, to, reason }) => {
|
|
63
|
+
// No await before routeToFallback: the re-check just before this call and the move run with nothing in between.
|
|
64
|
+
try {
|
|
65
|
+
queueRepo.routeToFallback(qitemId, to, reason, { expectState: "pending", expectDestination: from, wake: true });
|
|
66
|
+
return { ok: true };
|
|
67
|
+
}
|
|
68
|
+
catch (error) {
|
|
69
|
+
const code = typeof error.code === "string" ? error.code : "move_failed";
|
|
70
|
+
return { ok: false, code, message: error instanceof Error ? error.message : String(error) };
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
/** An agent's node as recorded, with its canonical session name (null without a pod-aware name), or null when the node
|
|
76
|
+
* is gone. */
|
|
77
|
+
function agentNode(db, nodeId) {
|
|
78
|
+
const row = db.prepare("SELECT n.logical_id AS logical_id, r.name AS rig_name FROM nodes n JOIN rigs r ON r.id = n.rig_id WHERE n.id = ?").get(nodeId);
|
|
79
|
+
if (!row)
|
|
80
|
+
return null;
|
|
81
|
+
const dot = row.logical_id.indexOf(".");
|
|
82
|
+
if (dot <= 0 || dot === row.logical_id.length - 1)
|
|
83
|
+
return { sessionName: null };
|
|
84
|
+
return { sessionName: deriveCanonicalSessionName(row.logical_id.slice(0, dot), row.logical_id.slice(dot + 1), row.rig_name) };
|
|
85
|
+
}
|
|
86
|
+
/** The model's pod namespace: its logical id before the first dot (a resolved model always has one). */
|
|
87
|
+
function modelPod(db, modelNodeId) {
|
|
88
|
+
const row = db.prepare("SELECT logical_id FROM nodes WHERE id = ?").get(modelNodeId);
|
|
89
|
+
const dot = row ? row.logical_id.indexOf(".") : -1;
|
|
90
|
+
return dot > 0 ? row.logical_id.slice(0, dot) : null;
|
|
91
|
+
}
|
|
92
|
+
function validIso(value) {
|
|
93
|
+
return typeof value === "string" && value !== "" && Number.isFinite(Date.parse(value));
|
|
94
|
+
}
|
|
95
|
+
/** The agents only: what the re-check just before a move needs. */
|
|
96
|
+
export function readSeatPoolAgents(deps, slots) {
|
|
97
|
+
const latestStatus = deps.db.prepare("SELECT status FROM sessions WHERE node_id = ? ORDER BY created_at DESC, id DESC LIMIT 1");
|
|
98
|
+
const nowIso = deps.now().toISOString();
|
|
99
|
+
return slots.map((slot) => {
|
|
100
|
+
const node = slot.nodeId === null ? null : agentNode(deps.db, slot.nodeId);
|
|
101
|
+
const nodeId = node === null ? null : slot.nodeId;
|
|
102
|
+
const sessionName = node?.sessionName ?? null;
|
|
103
|
+
const latestSessionStatus = nodeId === null
|
|
104
|
+
? null
|
|
105
|
+
: latestStatus.get(nodeId)?.status ?? null;
|
|
106
|
+
const running = nodeId !== null && (latestSessionStatus === "running" || latestSessionStatus === "idle")
|
|
107
|
+
&& !deps.confirmedStopped(nodeId);
|
|
108
|
+
const state = running ? deps.seatState(nodeId) : null;
|
|
109
|
+
const idleAtPrompt = state?.activity === "idle-at-prompt" && state.needsInput.count === 0 && !state.backgroundWork;
|
|
110
|
+
return {
|
|
111
|
+
slotNumber: slot.slotNumber,
|
|
112
|
+
sessionName,
|
|
113
|
+
phase: slot.phase,
|
|
114
|
+
attemptState: slot.attemptState,
|
|
115
|
+
running,
|
|
116
|
+
idleAtPrompt,
|
|
117
|
+
// Every agent idle at its prompt has a time: an unreadable one starts the grace now rather than never.
|
|
118
|
+
idleSince: idleAtPrompt ? (validIso(state.changedAt) ? state.changedAt : nowIso) : null,
|
|
119
|
+
openRows: sessionName ? deps.queue.openRows(sessionName) : 0,
|
|
120
|
+
heldCount: nodeId ? deps.heldCount(nodeId) : 0,
|
|
121
|
+
nodeId,
|
|
122
|
+
latestSessionStatus,
|
|
123
|
+
};
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
/** The agents and the rows waiting for the model or for a drained agent: the planner's whole input. */
|
|
127
|
+
export function readSeatPoolState(deps, model, slots) {
|
|
128
|
+
const agents = readSeatPoolAgents(deps, slots);
|
|
129
|
+
const pending = [];
|
|
130
|
+
const rawDestination = new Map();
|
|
131
|
+
const add = (destination) => {
|
|
132
|
+
for (const row of deps.queue.pendingRows(destination)) {
|
|
133
|
+
if (rawDestination.has(row.qitemId))
|
|
134
|
+
continue;
|
|
135
|
+
rawDestination.set(row.qitemId, row.rawDestination);
|
|
136
|
+
pending.push({ qitemId: row.qitemId, destination, waitingSince: row.waitingSince, tags: row.tags });
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
add(model.sessionName);
|
|
140
|
+
for (const agent of agents) {
|
|
141
|
+
if (agent.phase === "drained" && agent.sessionName !== null)
|
|
142
|
+
add(agent.sessionName);
|
|
143
|
+
}
|
|
144
|
+
return { modelSession: model.sessionName, agents, pending, lastStepAt: null, rawDestination };
|
|
145
|
+
}
|
|
146
|
+
/** The hold the rig's events give: the latest `rig.stopped` with no `restore.completed` after it. */
|
|
147
|
+
export function readSeatPoolHold(db, rigId) {
|
|
148
|
+
const seqOf = (sql, ...args) => db.prepare(sql).get(...args)?.seq ?? null;
|
|
149
|
+
const stopped = seqOf("SELECT seq FROM events WHERE rig_id = ? AND type = 'rig.stopped' ORDER BY seq DESC LIMIT 1", rigId);
|
|
150
|
+
if (stopped !== null) {
|
|
151
|
+
const released = seqOf("SELECT seq FROM events WHERE rig_id = ? AND type = 'restore.completed' AND seq > ? ORDER BY seq LIMIT 1", rigId, stopped);
|
|
152
|
+
if (released === null) {
|
|
153
|
+
const seatsLaunched = seqOf("SELECT seq FROM events WHERE rig_id = ? AND type = 'restore.subset_completed' AND seq > ? ORDER BY seq DESC LIMIT 1", rigId, stopped);
|
|
154
|
+
return { stoppedSeq: stopped, seatsLaunchedSeq: seatsLaunched, unfinishedRestoreSeq: null };
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
const started = seqOf("SELECT seq FROM events WHERE rig_id = ? AND type = 'restore.started' ORDER BY seq DESC LIMIT 1", rigId);
|
|
158
|
+
const completed = started === null
|
|
159
|
+
? null
|
|
160
|
+
: seqOf("SELECT seq FROM events WHERE rig_id = ? AND type = 'restore.completed' AND seq > ? LIMIT 1", rigId, started);
|
|
161
|
+
return { stoppedSeq: null, seatsLaunchedSeq: null, unfinishedRestoreSeq: started !== null && completed === null ? started : null };
|
|
162
|
+
}
|
|
163
|
+
const JOB_STOPPED = { cause: "job stopped", message: "held: job stopped" };
|
|
164
|
+
const BLOCK_UNREADABLE = { cause: "pool block unreadable", message: "held: pool block unreadable" };
|
|
165
|
+
function blockView(stored) {
|
|
166
|
+
if (stored === undefined)
|
|
167
|
+
return { block: "none" };
|
|
168
|
+
return "spec" in stored ? { block: "stored", spec: stored.spec } : { block: "unusable", error: stored.error };
|
|
169
|
+
}
|
|
170
|
+
/** Whether two stored specs are the same, field by field. */
|
|
171
|
+
function sameSpec(a, b) {
|
|
172
|
+
const keys = new Set([...Object.keys(a), ...Object.keys(b)]);
|
|
173
|
+
for (const key of keys)
|
|
174
|
+
if (a[key] !== b[key])
|
|
175
|
+
return false;
|
|
176
|
+
return true;
|
|
177
|
+
}
|
|
178
|
+
function unreadableAdvisory(error) {
|
|
179
|
+
return `the stored pool block can't be read (${error}); the pool is held until the block is fixed, and nothing is removed`;
|
|
180
|
+
}
|
|
181
|
+
function inFlight(attemptId) {
|
|
182
|
+
return { id: attemptId, status: "in_flight", message: `in flight (attempt ${attemptId})` };
|
|
183
|
+
}
|
|
184
|
+
const CANCELLED_NOT_ISSUED = "cancelled: not issued";
|
|
185
|
+
const INTERRUPTED_BEFORE_CREATE = "not launched (interrupted before create)";
|
|
186
|
+
/** A slot's attempt as its row records it: an issued attempt with an `unknown` outcome is reported so, and a settled one
|
|
187
|
+
* by the status its outcome kept (a settled add with no such status settled running). */
|
|
188
|
+
function attemptView(slot) {
|
|
189
|
+
if (slot.attemptId === null || slot.attemptState === null)
|
|
190
|
+
return undefined;
|
|
191
|
+
const outcome = readAttemptOutcome(slot.attemptOutcome);
|
|
192
|
+
const text = (key) => (typeof outcome[key] === "string" ? { [key]: outcome[key] } : {});
|
|
193
|
+
if (slot.attemptState === "settled") {
|
|
194
|
+
if (outcome["status"] !== "not_running")
|
|
195
|
+
return { id: slot.attemptId, status: "running" };
|
|
196
|
+
return {
|
|
197
|
+
id: slot.attemptId, status: "not_running",
|
|
198
|
+
...(outcome["observed"] === "exited" || outcome["observed"] === "probe_absent" ? { observed: outcome["observed"] } : {}),
|
|
199
|
+
...text("code"), ...text("message"),
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
if (slot.attemptState === "issued" && outcome["status"] === "unknown") {
|
|
203
|
+
return { id: slot.attemptId, status: "unknown", ...text("code"), ...text("message") };
|
|
204
|
+
}
|
|
205
|
+
return inFlight(slot.attemptId);
|
|
206
|
+
}
|
|
207
|
+
function slotsView(slots) {
|
|
208
|
+
return slots.map((slot) => {
|
|
209
|
+
const attempt = attemptView(slot);
|
|
210
|
+
return { slotNumber: slot.slotNumber, nodeId: slot.nodeId, phase: slot.phase, ...(attempt ? { attempt } : {}) };
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
/** The interim rule until drained slots come back: no new number while one is `drained`. Reported for the add only. */
|
|
214
|
+
const DRAINED_SLOT_GUARD = "held: drained slot awaiting comeback";
|
|
215
|
+
/** The model member's keys an agent does not take: it gets its own id and folder, no pool, no conversation of the
|
|
216
|
+
* model's, and its own `keep_alive: false` (below). */
|
|
217
|
+
const NOT_INHERITED = ["pool", "id", "label", "cwd", "session_source", "keep_alive"];
|
|
218
|
+
function addCallOutcome(outcome) {
|
|
219
|
+
if (!outcome.ok)
|
|
220
|
+
return { ok: false, code: outcome.code, message: "message" in outcome ? outcome.message : outcome.errors.join("; ") };
|
|
221
|
+
const node = outcome.result.node;
|
|
222
|
+
return {
|
|
223
|
+
ok: true, status: node.status, nodeId: node.nodeId,
|
|
224
|
+
...(node.error ? { error: node.error } : {}), ...(node.sessionName ? { sessionName: node.sessionName } : {}),
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* The one rule an add with a node settles by, in the cycle that ran it and in a later cycle (or process) that reads it
|
|
229
|
+
* again. Exited, or the node's executor confirmed stopped: not running, never retried. Running or idle with startup
|
|
230
|
+
* `ready`: running, unless the call is known to have returned anything but a launch (a failed launch whose session
|
|
231
|
+
* still runs is not settled here). Anything else (startup not ready, no session, another status): unknown.
|
|
232
|
+
*/
|
|
233
|
+
function classifyAdd(call, latest, confirmedStopped) {
|
|
234
|
+
const failure = call === null ? {}
|
|
235
|
+
: call.ok ? (call.error ? { message: call.error } : {})
|
|
236
|
+
: { code: call.code, message: call.message };
|
|
237
|
+
if (latest?.status === "exited")
|
|
238
|
+
return { status: "not_running", observed: "exited", ...failure };
|
|
239
|
+
if (confirmedStopped)
|
|
240
|
+
return { status: "not_running", observed: "probe_absent", ...failure };
|
|
241
|
+
if (latest === null)
|
|
242
|
+
return { status: "unknown", code: "no_session", message: "unknown: the node has no session yet" };
|
|
243
|
+
const evidence = `latest session ${latest.status}, startup ${latest.startupStatus ?? "unknown"}`;
|
|
244
|
+
if (latest.status === "running" || latest.status === "idle") {
|
|
245
|
+
if (call !== null && !(call.ok && call.status === "launched")) {
|
|
246
|
+
return { status: "unknown", code: call.ok ? `node_${call.status}` : call.code, message: `unknown: the add returned ${call.ok ? call.status : call.code}; ${evidence}` };
|
|
247
|
+
}
|
|
248
|
+
if (latest.startupStatus === "ready")
|
|
249
|
+
return { status: "running", sessionId: latest.id };
|
|
250
|
+
}
|
|
251
|
+
return { status: "unknown", code: "not_settled", message: `unknown: ${evidence}` };
|
|
252
|
+
}
|
|
253
|
+
/** The add call's outcome an `unknown` attempt kept on its row, or null when the call never returned. */
|
|
254
|
+
function keptCall(slot) {
|
|
255
|
+
const call = readAttemptOutcome(slot.attemptOutcome)["call"];
|
|
256
|
+
if (call === null || typeof call !== "object" || Array.isArray(call))
|
|
257
|
+
return null;
|
|
258
|
+
const c = call;
|
|
259
|
+
if (c["ok"] === true && typeof c["status"] === "string" && typeof c["nodeId"] === "string")
|
|
260
|
+
return c;
|
|
261
|
+
if (c["ok"] === false && typeof c["code"] === "string" && typeof c["message"] === "string")
|
|
262
|
+
return c;
|
|
263
|
+
return null;
|
|
264
|
+
}
|
|
265
|
+
/** What an add was issued on (`attempt_basis`), or null when the row's basis can't be read. */
|
|
266
|
+
function issuedBasis(text) {
|
|
267
|
+
if (text === null)
|
|
268
|
+
return null;
|
|
269
|
+
try {
|
|
270
|
+
const parsed = JSON.parse(text);
|
|
271
|
+
return Array.isArray(parsed.targets) && parsed.targets.every((t) => typeof t === "string") && typeof parsed.body === "string"
|
|
272
|
+
? { targets: parsed.targets, body: parsed.body }
|
|
273
|
+
: null;
|
|
274
|
+
}
|
|
275
|
+
catch {
|
|
276
|
+
return null;
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
function errorMessage(error) {
|
|
280
|
+
return error instanceof Error ? error.message : String(error);
|
|
281
|
+
}
|
|
282
|
+
/** A refusal to issue an add, raised inside the issue transaction so it rolls back. */
|
|
283
|
+
class AddNotIssued extends Error {
|
|
284
|
+
code;
|
|
285
|
+
constructor(code) {
|
|
286
|
+
super(code);
|
|
287
|
+
this.code = code;
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
/** A node's latest session, in the order the reader uses. Null: none. */
|
|
291
|
+
function latestSession(db, nodeId) {
|
|
292
|
+
return db.prepare("SELECT id, status FROM sessions WHERE node_id = ? ORDER BY created_at DESC, id DESC LIMIT 1").get(nodeId) ?? null;
|
|
293
|
+
}
|
|
294
|
+
/** The spec the job was last ensured with (`context.pool`); null when it has none that reads. */
|
|
295
|
+
function lastEnsuredSpec(context) {
|
|
296
|
+
const read = parsePoolBlock(context["pool"]);
|
|
297
|
+
return read.ok ? read.spec : null;
|
|
298
|
+
}
|
|
299
|
+
/** The time of the latest drain step on record: the newest phase change of a `draining` or `drained` slot. */
|
|
300
|
+
function lastDrainStep(slots) {
|
|
301
|
+
let latest = null;
|
|
302
|
+
for (const slot of slots) {
|
|
303
|
+
if ((slot.phase !== "draining" && slot.phase !== "drained") || !validIso(slot.phaseChangedAt))
|
|
304
|
+
continue;
|
|
305
|
+
if (latest === null || Date.parse(slot.phaseChangedAt) > Date.parse(latest))
|
|
306
|
+
latest = slot.phaseChangedAt;
|
|
307
|
+
}
|
|
308
|
+
return latest;
|
|
309
|
+
}
|
|
310
|
+
/** Free to drain: its latest session runs, idle at its prompt, with no open row and no held message. */
|
|
311
|
+
function freeToDrain(agent) {
|
|
312
|
+
return agent.running && agent.idleAtPrompt && agent.openRows === 0 && agent.heldCount === 0;
|
|
313
|
+
}
|
|
314
|
+
export function makeSeatPoolExecutor(deps) {
|
|
315
|
+
/** Woken since the plan: the agent's recorded idle time can be read and is not the one the plan read. */
|
|
316
|
+
const woken = (nodeId, idleSince) => {
|
|
317
|
+
const changedAt = deps.seatState(nodeId)?.changedAt;
|
|
318
|
+
return validIso(changedAt) && changedAt !== idleSince;
|
|
319
|
+
};
|
|
320
|
+
const at = () => deps.now().toISOString();
|
|
321
|
+
/** The adds started and not settled yet. */
|
|
322
|
+
const pending = new Set();
|
|
323
|
+
/** The attempt ids this process issued and whose call has not settled yet. An `issued` row that is not here is no
|
|
324
|
+
* process's any more: an add cut off by a daemon restart, or one whose result was unknown when its call returned. */
|
|
325
|
+
const inFlightAttempts = new Set();
|
|
326
|
+
/** model node id → what settled since that model's last report. */
|
|
327
|
+
const settled = new Map();
|
|
328
|
+
const reportSettled = (modelNodeId, entry) => settled.set(modelNodeId, [...(settled.get(modelNodeId) ?? []), entry]);
|
|
329
|
+
/** An add with a node, settled by its latest session (classifyAdd). Running: `live`. Not running: `drained`, with a
|
|
330
|
+
* reuse hold. Unknown: it stays issued, with what was read kept on its row. What settled is returned for the report;
|
|
331
|
+
* nothing while unknown, or when the row no longer holds the attempt. */
|
|
332
|
+
const settleWithNode = (add, call, latest) => {
|
|
333
|
+
const settlement = classifyAdd(call, latest, deps.confirmedStopped(add.nodeId));
|
|
334
|
+
const entry = (attempt) => ({ slotNumber: add.slotNumber, logicalId: add.logicalId, nodeId: add.nodeId, attempt });
|
|
335
|
+
if (settlement.status === "running") {
|
|
336
|
+
return deps.slots.settleAdd(add.slotId, add.attemptId, {
|
|
337
|
+
outcome: JSON.stringify(call ?? { replayed: true }),
|
|
338
|
+
result: JSON.stringify({ nodeId: add.nodeId, sessionId: settlement.sessionId }), at: at(),
|
|
339
|
+
}) ? entry({ id: add.attemptId, status: "running" }) : null;
|
|
340
|
+
}
|
|
341
|
+
if (settlement.status === "not_running") {
|
|
342
|
+
const seen = {
|
|
343
|
+
observed: settlement.observed,
|
|
344
|
+
...(settlement.code !== undefined ? { code: settlement.code } : {}),
|
|
345
|
+
...(settlement.message !== undefined ? { message: settlement.message } : {}),
|
|
346
|
+
};
|
|
347
|
+
// The reuse hold: the launch's status or code (`not_running` when the call never returned), what was observed, and
|
|
348
|
+
// the launch's error when there is one.
|
|
349
|
+
const error = call === null ? undefined : call.ok ? call.error : call.message;
|
|
350
|
+
const hold = {
|
|
351
|
+
code: call === null ? "not_running" : call.ok ? call.status : call.code,
|
|
352
|
+
observed: settlement.observed,
|
|
353
|
+
...(error !== undefined ? { error } : {}),
|
|
354
|
+
};
|
|
355
|
+
return deps.slots.settleAddNotRunning(add.slotId, add.attemptId, {
|
|
356
|
+
outcome: JSON.stringify({ status: "not_running", ...seen, call }), hold: JSON.stringify(hold), at: at(),
|
|
357
|
+
}) ? entry({ id: add.attemptId, status: "not_running", ...seen }) : null;
|
|
358
|
+
}
|
|
359
|
+
deps.slots.recordAttemptOutcome(add.slotId, add.attemptId, JSON.stringify({ status: "unknown", code: settlement.code, message: settlement.message, call }));
|
|
360
|
+
return null;
|
|
361
|
+
};
|
|
362
|
+
/** The model's logical id, for the `<model>-s<n>` of a slot read back from its row. */
|
|
363
|
+
const logicalIdOf = (modelNodeId, slotNumber) => {
|
|
364
|
+
const row = deps.db.prepare("SELECT logical_id FROM nodes WHERE id = ?").get(modelNodeId);
|
|
365
|
+
return `${row?.logical_id ?? modelNodeId}-s${slotNumber}`;
|
|
366
|
+
};
|
|
367
|
+
/**
|
|
368
|
+
* An add attempt no process is running any more, settled from its row, under the custody lease. Reserved: cancelled.
|
|
369
|
+
* Issued: read again by replaying `reserveOperation` with what it was issued on, which never runs the add again; with
|
|
370
|
+
* no node recorded the row goes, otherwise the node settles it by the same rule as the call that ran it. An operation
|
|
371
|
+
* id with no row is not replayed (that would reserve it anew): unknown, as is any replay that is not one.
|
|
372
|
+
*/
|
|
373
|
+
const settleLeftover = (modelNodeId, slot) => {
|
|
374
|
+
const attemptId = slot.attemptId;
|
|
375
|
+
const logicalId = logicalIdOf(modelNodeId, slot.slotNumber);
|
|
376
|
+
if (slot.attemptState === "reserved") {
|
|
377
|
+
return deps.slots.cancelReservedAdd(slot.slotId, attemptId)
|
|
378
|
+
? { slotNumber: slot.slotNumber, logicalId, attempt: { id: attemptId, status: "cancelled", message: CANCELLED_NOT_ISSUED, code: "interrupted_before_issue" } }
|
|
379
|
+
: null;
|
|
380
|
+
}
|
|
381
|
+
const unknown = (code, message) => {
|
|
382
|
+
deps.slots.recordAttemptOutcome(slot.slotId, attemptId, JSON.stringify({ status: "unknown", code, message, call: keptCall(slot) }));
|
|
383
|
+
return null;
|
|
384
|
+
};
|
|
385
|
+
const basis = issuedBasis(slot.attemptBasis);
|
|
386
|
+
if (basis === null)
|
|
387
|
+
return unknown("basis_unreadable", "unknown: what the add was issued on can't be read");
|
|
388
|
+
if (!deps.db.prepare("SELECT 1 FROM operation_correlations WHERE operation_id = ?").get(attemptId)) {
|
|
389
|
+
return unknown("operation_missing", "unknown: the add's operation id has no record");
|
|
390
|
+
}
|
|
391
|
+
const replayed = reserveOperation(deps.db, attemptId, "member.add", basis.targets, basis.body);
|
|
392
|
+
if (replayed.state !== "replay")
|
|
393
|
+
return unknown(`operation_${replayed.state}`, `unknown: replaying the add's operation id gave ${replayed.state}`);
|
|
394
|
+
const operation = replayed.operation;
|
|
395
|
+
if (slot.nodeId === null) {
|
|
396
|
+
if (operation.nodeIds.length > 0)
|
|
397
|
+
return unknown("node_not_recorded", "unknown: the operation recorded a node the slot does not have");
|
|
398
|
+
return deps.slots.removeAddWithoutNode(slot.slotId, attemptId)
|
|
399
|
+
? { slotNumber: slot.slotNumber, logicalId, attempt: { id: attemptId, status: "no_node", code: "interrupted_before_create", message: INTERRUPTED_BEFORE_CREATE } }
|
|
400
|
+
: null;
|
|
401
|
+
}
|
|
402
|
+
const latest = operation.current.nodes.find((node) => node.id === slot.nodeId)?.latestSession ?? null;
|
|
403
|
+
return settleWithNode({ slotId: slot.slotId, slotNumber: slot.slotNumber, logicalId, attemptId, nodeId: slot.nodeId }, keptCall(slot), latest);
|
|
404
|
+
};
|
|
405
|
+
/** Why the model member gives no agent, read from the model node itself (the export leaves these out silently), or null. */
|
|
406
|
+
const addRefusal = (rigId, modelNodeId) => {
|
|
407
|
+
let node;
|
|
408
|
+
try {
|
|
409
|
+
node = deps.rigRepo.getRig(rigId)?.nodes.find((candidate) => candidate.id === modelNodeId);
|
|
410
|
+
}
|
|
411
|
+
catch (error) {
|
|
412
|
+
return `add refused: the model member can't be read (${errorMessage(error)})`;
|
|
413
|
+
}
|
|
414
|
+
if (!node)
|
|
415
|
+
return "add refused: the model member can't be read (no such node)";
|
|
416
|
+
if (node.processLimitsError !== undefined)
|
|
417
|
+
return `add refused: the model's stored process_limits can't be read (${node.processLimitsError})`;
|
|
418
|
+
if (node.runtime === "claude-code") {
|
|
419
|
+
const autoMode = readClaudeAutoModeForLaunch(deps.db, modelNodeId);
|
|
420
|
+
if (autoMode !== undefined && "unreadable" in autoMode)
|
|
421
|
+
return "add refused: the model's stored claude_auto_mode can't be read";
|
|
422
|
+
}
|
|
423
|
+
if (node.accountHome)
|
|
424
|
+
return "add refused: the model has an accountHome, which a pool agent does not carry";
|
|
425
|
+
if (node.claudeTokenRef?.kind === "api-key")
|
|
426
|
+
return "add refused: the model has an api-key token ref, which a pool agent does not carry";
|
|
427
|
+
return null;
|
|
428
|
+
};
|
|
429
|
+
/** The add's call, after the lease, and its settlement on the slot row. Never rejects. */
|
|
430
|
+
const runAdd = async (modelNodeId, add) => {
|
|
431
|
+
const report = (entry) => reportSettled(modelNodeId, entry);
|
|
432
|
+
let outcome;
|
|
433
|
+
try {
|
|
434
|
+
if (add.folder !== null) {
|
|
435
|
+
try {
|
|
436
|
+
deps.add.makeFolder(add.folder);
|
|
437
|
+
}
|
|
438
|
+
catch (error) {
|
|
439
|
+
outcome = { ok: false, code: "cwd_unavailable", message: errorMessage(error) };
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
if (outcome === undefined) {
|
|
443
|
+
// The node id goes to the slot row in the same transaction that creates the node: a rolled-back create leaves both
|
|
444
|
+
// unwritten. The first call names only the rig.
|
|
445
|
+
const recordCreated = (createdRigId, nodeId) => {
|
|
446
|
+
add.operation.recordCreated(createdRigId, nodeId);
|
|
447
|
+
if (nodeId !== undefined)
|
|
448
|
+
deps.slots.recordAttemptNode(add.slotId, add.attemptId, nodeId);
|
|
449
|
+
};
|
|
450
|
+
try {
|
|
451
|
+
const converged = await deps.add.converge(add.rigId, add.op, add.rigRoot, {
|
|
452
|
+
recordCreated, ...(add.launchAdditionsFrom ? { launchAdditionsFrom: add.launchAdditionsFrom } : {}),
|
|
453
|
+
});
|
|
454
|
+
outcome = converged.kind === "add_member" && converged.supported
|
|
455
|
+
? addCallOutcome(converged.outcome)
|
|
456
|
+
: { ok: false, code: "add_unsupported", message: "the converge path did not run the member add" };
|
|
457
|
+
}
|
|
458
|
+
catch (error) {
|
|
459
|
+
const code = error.code;
|
|
460
|
+
outcome = { ok: false, code: typeof code === "string" ? code : "add_failed", message: errorMessage(error) };
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
// The node decides, never the code alone: an add can fail after it created its node.
|
|
464
|
+
const slot = deps.slots.get(add.slotId);
|
|
465
|
+
if (!slot || slot.attemptId !== add.attemptId)
|
|
466
|
+
return; // its row went with a node deleted by hand
|
|
467
|
+
if (slot.nodeId === null) {
|
|
468
|
+
deps.slots.removeAddWithoutNode(add.slotId, add.attemptId);
|
|
469
|
+
const code = outcome.ok ? "node_not_recorded" : outcome.code;
|
|
470
|
+
report({
|
|
471
|
+
slotNumber: add.slotNumber, logicalId: add.logicalId,
|
|
472
|
+
attempt: { id: add.attemptId, status: "no_node", code, ...(outcome.ok ? {} : { message: outcome.message }) },
|
|
473
|
+
});
|
|
474
|
+
return;
|
|
475
|
+
}
|
|
476
|
+
const latest = add.operation.read().current.nodes.find((node) => node.id === slot.nodeId)?.latestSession ?? null;
|
|
477
|
+
// An unknown result stays issued; once this call is over, a later cycle reads it again.
|
|
478
|
+
const entry = settleWithNode({ ...add, nodeId: slot.nodeId }, outcome, latest);
|
|
479
|
+
if (entry)
|
|
480
|
+
report(entry);
|
|
481
|
+
}
|
|
482
|
+
catch (error) {
|
|
483
|
+
// The call's outcome stays on the row, so the cycle that reads this attempt again settles it with the call.
|
|
484
|
+
try {
|
|
485
|
+
deps.slots.recordAttemptOutcome(add.slotId, add.attemptId, JSON.stringify({ status: "unknown", code: "settle_failed", message: errorMessage(error), call: outcome ?? null }));
|
|
486
|
+
}
|
|
487
|
+
catch { /* the settle's own error is the one reported */ }
|
|
488
|
+
report({ slotNumber: add.slotNumber, logicalId: add.logicalId, attempt: { ...inFlight(add.attemptId), code: "settle_failed", message: errorMessage(error) } });
|
|
489
|
+
}
|
|
490
|
+
finally {
|
|
491
|
+
inFlightAttempts.delete(add.attemptId);
|
|
492
|
+
}
|
|
493
|
+
};
|
|
494
|
+
/** One add after another, each after the lease is released; the cycle does not wait for them. */
|
|
495
|
+
const startAdds = (modelNodeId, adds) => {
|
|
496
|
+
if (adds.length === 0)
|
|
497
|
+
return;
|
|
498
|
+
const run = adds.reduce((previous, add) => previous.then(() => runAdd(modelNodeId, add)), Promise.resolve());
|
|
499
|
+
pending.add(run);
|
|
500
|
+
void run.finally(() => pending.delete(run));
|
|
501
|
+
};
|
|
502
|
+
return {
|
|
503
|
+
async idle() {
|
|
504
|
+
while (pending.size > 0)
|
|
505
|
+
await Promise.all([...pending]);
|
|
506
|
+
},
|
|
507
|
+
async cycle(job) {
|
|
508
|
+
const active = () => deps.jobsRepo.getById(job.jobId)?.state === "active";
|
|
509
|
+
const found = seatPoolModelOfJob(deps.db, job);
|
|
510
|
+
if (!found.found && found.cause === "no_model_node_id") {
|
|
511
|
+
return { action: "skip", reason: "seat_pool_model_unknown", notes: { modelNodeId: found.modelNodeId } };
|
|
512
|
+
}
|
|
513
|
+
// What settled since this model's last report goes in this one.
|
|
514
|
+
// Not while the job is no longer active: the engine records no evaluation of a stopped job, so what settled waits
|
|
515
|
+
// for a report it does record.
|
|
516
|
+
const report = (notes) => {
|
|
517
|
+
const id = typeof notes["modelNodeId"] === "string" && active() ? notes["modelNodeId"] : null;
|
|
518
|
+
const done = id === null ? undefined : settled.get(id);
|
|
519
|
+
if (id !== null)
|
|
520
|
+
settled.delete(id);
|
|
521
|
+
return { action: "skip", reason: "seat_pool_report", notes: done?.length ? { ...notes, settled: done } : notes };
|
|
522
|
+
};
|
|
523
|
+
if (!found.found) {
|
|
524
|
+
// No custody: the guard can't resolve a node that is gone.
|
|
525
|
+
const held = found.cause === "node_gone"
|
|
526
|
+
? { cause: "model node gone", message: "held: model node gone" }
|
|
527
|
+
: { cause: "model has no canonical session", message: "held: model has no canonical session" };
|
|
528
|
+
return report({ modelNodeId: found.modelNodeId, slots: slotsView(deps.slots.forModel(found.modelNodeId)), held });
|
|
529
|
+
}
|
|
530
|
+
const { model, modelNodeId, rigId } = found;
|
|
531
|
+
const slots = deps.slots.forModel(modelNodeId);
|
|
532
|
+
let block = blockView(deps.rigRepo.getNodePool(modelNodeId));
|
|
533
|
+
// The report reads the slot rows when it is built, not the snapshot the plan used: an add that settles while the cycle
|
|
534
|
+
// waits for custody is then reported the same way in `slots` and in `settled`.
|
|
535
|
+
const base = () => ({ modelNodeId, ...block, slots: slotsView(deps.slots.forModel(modelNodeId)) });
|
|
536
|
+
if (!active())
|
|
537
|
+
return report({ ...base(), held: JOB_STOPPED });
|
|
538
|
+
if (block.block === "unusable")
|
|
539
|
+
return report({ ...base(), held: BLOCK_UNREADABLE, advisory: unreadableAdvisory(block.error) });
|
|
540
|
+
// After `pool: {}` the model has no block: the job drains with the spec last stored on its row (`drain` set), and
|
|
541
|
+
// ends once every agent is drained. A job with no readable spec of its own does nothing.
|
|
542
|
+
const removed = block.block === "none";
|
|
543
|
+
const lastSpec = removed ? lastEnsuredSpec(job.context) : null;
|
|
544
|
+
if (block.block === "none" && lastSpec === null)
|
|
545
|
+
return report(base());
|
|
546
|
+
const spec = block.block === "stored" ? block.spec : { ...lastSpec, drain: true };
|
|
547
|
+
const removal = removed ? { removal: "the pool block was removed; draining with the spec last stored on the job" } : {};
|
|
548
|
+
// The plan is read outside the lease; the custody is for the hold check, the moves, the drain decisions and the
|
|
549
|
+
// add's reservation and issue. The add's call goes out after it.
|
|
550
|
+
const read = { ...readSeatPoolState(deps, model, slots), lastStepAt: lastDrainStep(slots) };
|
|
551
|
+
const plan = planSeatPool(spec, read, deps.now().getTime());
|
|
552
|
+
const dispatches = plan.intents.filter((i) => i.kind === "dispatch");
|
|
553
|
+
const drainIntents = plan.intents.filter((i) => i.kind === "drain");
|
|
554
|
+
const addIntent = plan.intents.find((i) => i.kind === "add");
|
|
555
|
+
const plannedTo = (slotNumber) => read.agents.find((a) => a.slotNumber === slotNumber)?.sessionName ?? `slot ${slotNumber}`;
|
|
556
|
+
// The session each agent ran when the plan read it: a drain stops only that session.
|
|
557
|
+
const planSession = new Map(read.agents.map((a) => [a.slotNumber, a.nodeId === null ? null : latestSession(deps.db, a.nodeId)?.id ?? null]));
|
|
558
|
+
let held;
|
|
559
|
+
let advisory;
|
|
560
|
+
let hold;
|
|
561
|
+
let custody;
|
|
562
|
+
let blockChanged = false;
|
|
563
|
+
const moved = [];
|
|
564
|
+
const skipped = [];
|
|
565
|
+
const failed = [];
|
|
566
|
+
const drains = [];
|
|
567
|
+
const toDrain = [];
|
|
568
|
+
const restops = [];
|
|
569
|
+
const gone = [];
|
|
570
|
+
/** The block again: a re-apply since the plan (cleared, broken, or with any other value; after `pool: {}`, a block
|
|
571
|
+
* stored again) ends this cycle's effects, since the plan may no longer hold. The next evaluation plans against the
|
|
572
|
+
* block as it is then. */
|
|
573
|
+
const blockChangedNow = () => {
|
|
574
|
+
const storedNow = deps.rigRepo.getNodePool(modelNodeId);
|
|
575
|
+
const same = removed
|
|
576
|
+
? storedNow === undefined
|
|
577
|
+
: storedNow !== undefined && "spec" in storedNow && sameSpec(storedNow.spec, spec);
|
|
578
|
+
if (same)
|
|
579
|
+
return false;
|
|
580
|
+
blockChanged = true;
|
|
581
|
+
block = blockView(storedNow);
|
|
582
|
+
if (block.block === "unusable") {
|
|
583
|
+
held = BLOCK_UNREADABLE;
|
|
584
|
+
advisory = unreadableAdvisory(block.error);
|
|
585
|
+
}
|
|
586
|
+
return true;
|
|
587
|
+
};
|
|
588
|
+
const drainSkipped = (step, code) => {
|
|
589
|
+
drains.push({ ...step, outcome: "skipped", code });
|
|
590
|
+
};
|
|
591
|
+
let addNotes;
|
|
592
|
+
const issued = [];
|
|
593
|
+
let thrown;
|
|
594
|
+
try {
|
|
595
|
+
await deps.custody([modelNodeId], async () => {
|
|
596
|
+
if (!active()) {
|
|
597
|
+
held = JOB_STOPPED;
|
|
598
|
+
return;
|
|
599
|
+
}
|
|
600
|
+
hold = readSeatPoolHold(deps.db, rigId);
|
|
601
|
+
if (hold.stoppedSeq !== null) {
|
|
602
|
+
held = {
|
|
603
|
+
cause: "rig stopped",
|
|
604
|
+
seq: hold.stoppedSeq,
|
|
605
|
+
message: `held: rig stopped (event ${hold.stoppedSeq})`,
|
|
606
|
+
...(hold.seatsLaunchedSeq !== null
|
|
607
|
+
? { exit: `seats launched with \`rig launch --seats\` (event ${hold.seatsLaunchedSeq}) do not end the hold; run \`rig down\`, then \`rig up\`` }
|
|
608
|
+
: {}),
|
|
609
|
+
};
|
|
610
|
+
return;
|
|
611
|
+
}
|
|
612
|
+
// The block again first: one that became unreadable while the cycle waited for custody holds the leftovers too,
|
|
613
|
+
// and they stay as they are. A block stored again with another value, or removed, still lets them settle.
|
|
614
|
+
if (blockView(deps.rigRepo.getNodePool(modelNodeId)).block === "unusable") {
|
|
615
|
+
blockChangedNow();
|
|
616
|
+
return;
|
|
617
|
+
}
|
|
618
|
+
// An add attempt no process runs any more (a reservation never issued, or an issued add not in flight in this
|
|
619
|
+
// process: cut off by a daemon restart, or left unknown), settled from its row. One in flight here is left alone.
|
|
620
|
+
for (const slot of deps.slots.forModel(modelNodeId)) {
|
|
621
|
+
if (slot.phase !== "adding" || slot.attemptKind !== "add" || slot.attemptId === null || inFlightAttempts.has(slot.attemptId))
|
|
622
|
+
continue;
|
|
623
|
+
const entry = settleLeftover(modelNodeId, slot);
|
|
624
|
+
if (entry)
|
|
625
|
+
reportSettled(modelNodeId, entry);
|
|
626
|
+
}
|
|
627
|
+
// A leftover settled `not_running` here drains its slot, which starts the cooldown the plan could not see: under
|
|
628
|
+
// it, this cycle's drains wait (`drain: true` keeps its exemption).
|
|
629
|
+
const stepNow = lastDrainStep(deps.slots.forModel(modelNodeId));
|
|
630
|
+
const coolingNow = !spec.drain && stepNow !== null && stepNow !== read.lastStepAt
|
|
631
|
+
&& deps.now().getTime() - Date.parse(stepNow) < spec.cooldownSeconds * 1000;
|
|
632
|
+
// A drain an earlier cycle left unfinished. One whose unconfirmed stop may have had an effect (a kill was
|
|
633
|
+
// attempted) is stopped again below, never captured again. Any other (its capture failed, it ended before the
|
|
634
|
+
// capture, or its stop is known to have had no effect) goes back to `live`: nothing was stopped, and a later plan
|
|
635
|
+
// decides again, with a new capture.
|
|
636
|
+
for (const slot of slots.filter((s) => s.phase === "draining")) {
|
|
637
|
+
const agent = read.agents.find((a) => a.slotNumber === slot.slotNumber);
|
|
638
|
+
const session = agent?.sessionName ?? null;
|
|
639
|
+
const stop = deps.slots.stopOutcome(slot.slotId);
|
|
640
|
+
if (stop?.result === "unconfirmed" && stop.partialEffect === true && typeof stop.sessionId === "string"
|
|
641
|
+
&& slot.nodeId !== null && agent?.nodeId && session) {
|
|
642
|
+
restops.push({ slot, nodeId: slot.nodeId, session, sessionId: stop.sessionId });
|
|
643
|
+
}
|
|
644
|
+
else if (deps.slots.setPhase({ slotId: slot.slotId, from: "draining", to: "live", at: at() })) {
|
|
645
|
+
drains.push({ slotNumber: slot.slotNumber, session, phase: "live", outcome: "returned", code: "drain_not_finished" });
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
// Under `drain` (after `pool: {}`, or a block with `drain: true`), a `live` agent positively gone (its latest
|
|
649
|
+
// session `exited`, or its node confirmed stopped) with no work: the planner never picks it, since only running
|
|
650
|
+
// agents drain, so it would keep the job from ending. Its slot goes to `draining`, and the checked stop below
|
|
651
|
+
// confirms the session is absent before the slot is `drained`. An unknown or stale status is not gone.
|
|
652
|
+
if (spec.drain && deps.drain && !held && !blockChangedNow()) {
|
|
653
|
+
const current = deps.slots.forModel(modelNodeId);
|
|
654
|
+
const agentsNow = readSeatPoolAgents(deps, current);
|
|
655
|
+
for (const slot of current.filter((s) => s.phase === "live" && s.nodeId !== null)) {
|
|
656
|
+
const agent = agentsNow.find((a) => a.slotNumber === slot.slotNumber);
|
|
657
|
+
if (!agent || agent.nodeId === null || agent.sessionName === null || agent.running)
|
|
658
|
+
continue;
|
|
659
|
+
if (agent.openRows > 0 || agent.heldCount > 0)
|
|
660
|
+
continue;
|
|
661
|
+
if (agent.latestSessionStatus !== "exited" && !deps.confirmedStopped(agent.nodeId))
|
|
662
|
+
continue;
|
|
663
|
+
const sessionId = planSession.get(slot.slotNumber) ?? null;
|
|
664
|
+
if (sessionId === null || latestSession(deps.db, agent.nodeId)?.id !== sessionId)
|
|
665
|
+
continue;
|
|
666
|
+
if (!deps.slots.setPhase({ slotId: slot.slotId, from: "live", to: "draining", at: at(), stop: null }))
|
|
667
|
+
continue;
|
|
668
|
+
gone.push({ slot, nodeId: agent.nodeId, session: agent.sessionName, sessionId });
|
|
669
|
+
}
|
|
670
|
+
}
|
|
671
|
+
for (const [index, d] of dispatches.entries()) {
|
|
672
|
+
// A job stopped while an earlier move awaited: no later effect.
|
|
673
|
+
if (!active()) {
|
|
674
|
+
held = JOB_STOPPED;
|
|
675
|
+
break;
|
|
676
|
+
}
|
|
677
|
+
const from = read.rawDestination.get(d.qitemId);
|
|
678
|
+
if (blockChangedNow()) {
|
|
679
|
+
for (const rest of dispatches.slice(index)) {
|
|
680
|
+
skipped.push({ qitemId: rest.qitemId, from: read.rawDestination.get(rest.qitemId), to: plannedTo(rest.slotNumber), code: "pool_block_changed" });
|
|
681
|
+
}
|
|
682
|
+
break;
|
|
683
|
+
}
|
|
684
|
+
// The agent again, just before the move: still free, no held message, no open row, not above max.
|
|
685
|
+
const agents = readSeatPoolAgents(deps, deps.slots.forModel(modelNodeId));
|
|
686
|
+
const agent = agents.find((a) => a.slotNumber === d.slotNumber);
|
|
687
|
+
if (!agent || agent.sessionName === null || !seatPoolCanReceive(spec, agents, agent)) {
|
|
688
|
+
skipped.push({ qitemId: d.qitemId, from, to: agent?.sessionName ?? plannedTo(d.slotNumber), code: "agent_not_free" });
|
|
689
|
+
continue;
|
|
690
|
+
}
|
|
691
|
+
const to = agent.sessionName;
|
|
692
|
+
const reason = `seat pool ${job.jobId}: ${d.from} had not taken it; ${to} was free`;
|
|
693
|
+
const result = await deps.queue.moveRow({ qitemId: d.qitemId, from, to, reason });
|
|
694
|
+
if (result.ok)
|
|
695
|
+
moved.push({ qitemId: d.qitemId, from, to });
|
|
696
|
+
else if (ROW_MOVED_ON.has(result.code))
|
|
697
|
+
skipped.push({ qitemId: d.qitemId, from, to, code: result.code });
|
|
698
|
+
else
|
|
699
|
+
failed.push({ qitemId: d.qitemId, from, to, code: result.code, message: result.message });
|
|
700
|
+
}
|
|
701
|
+
// The drains: each agent again, just before its slot goes to `draining`. The capture and the stop come after
|
|
702
|
+
// the custody lease, under the agent's own lifecycle lease.
|
|
703
|
+
for (const [index, d] of drainIntents.entries()) {
|
|
704
|
+
if (held || blockChanged)
|
|
705
|
+
break;
|
|
706
|
+
if (!active()) {
|
|
707
|
+
held = JOB_STOPPED;
|
|
708
|
+
break;
|
|
709
|
+
}
|
|
710
|
+
if (coolingNow) {
|
|
711
|
+
for (const rest of drainIntents.slice(index))
|
|
712
|
+
drainSkipped({ slotNumber: rest.slotNumber, session: plannedTo(rest.slotNumber), phase: "live" }, "cooldown");
|
|
713
|
+
break;
|
|
714
|
+
}
|
|
715
|
+
if (blockChangedNow()) {
|
|
716
|
+
for (const rest of drainIntents.slice(index))
|
|
717
|
+
drainSkipped({ slotNumber: rest.slotNumber, session: plannedTo(rest.slotNumber), phase: "live" }, "pool_block_changed");
|
|
718
|
+
break;
|
|
719
|
+
}
|
|
720
|
+
const current = deps.slots.forModel(modelNodeId);
|
|
721
|
+
const slot = current.find((s) => s.slotNumber === d.slotNumber);
|
|
722
|
+
const agent = readSeatPoolAgents(deps, current).find((a) => a.slotNumber === d.slotNumber);
|
|
723
|
+
const step = { slotNumber: d.slotNumber, session: agent?.sessionName ?? plannedTo(d.slotNumber), phase: slot?.phase ?? "live" };
|
|
724
|
+
if (!slot || !agent || slot.nodeId === null || agent.nodeId === null || agent.sessionName === null) {
|
|
725
|
+
drainSkipped(step, "agent_gone");
|
|
726
|
+
continue;
|
|
727
|
+
}
|
|
728
|
+
const sessionId = planSession.get(d.slotNumber) ?? null;
|
|
729
|
+
// An agent relaunched since the plan read it is left alone.
|
|
730
|
+
if (sessionId === null || latestSession(deps.db, slot.nodeId)?.id !== sessionId) {
|
|
731
|
+
drainSkipped(step, "relaunched");
|
|
732
|
+
continue;
|
|
733
|
+
}
|
|
734
|
+
if (slot.phase !== "live" || !freeToDrain(agent) || woken(slot.nodeId, d.idleSince)) {
|
|
735
|
+
drainSkipped(step, "agent_not_free");
|
|
736
|
+
continue;
|
|
737
|
+
}
|
|
738
|
+
if (!deps.drain) {
|
|
739
|
+
drainSkipped(step, "drain_not_composed");
|
|
740
|
+
continue;
|
|
741
|
+
}
|
|
742
|
+
if (!deps.slots.setPhase({ slotId: slot.slotId, from: "live", to: "draining", at: at(), stop: null })) {
|
|
743
|
+
drainSkipped(step, "slot_moved_on");
|
|
744
|
+
continue;
|
|
745
|
+
}
|
|
746
|
+
toDrain.push({ slot, nodeId: slot.nodeId, session: agent.sessionName, sessionId, idleSince: d.idleSince });
|
|
747
|
+
}
|
|
748
|
+
// The add, after the moves of the same cycle, under the same lease. Nothing in it awaits.
|
|
749
|
+
if (!addIntent || !deps.add || held || blockChanged)
|
|
750
|
+
return;
|
|
751
|
+
if (!active()) {
|
|
752
|
+
held = JOB_STOPPED;
|
|
753
|
+
return;
|
|
754
|
+
}
|
|
755
|
+
const storedNow = deps.rigRepo.getNodePool(modelNodeId);
|
|
756
|
+
if (storedNow === undefined || !("spec" in storedNow) || !sameSpec(storedNow.spec, spec)) {
|
|
757
|
+
addNotes = { skipped: "pool_block_changed" };
|
|
758
|
+
return;
|
|
759
|
+
}
|
|
760
|
+
const current = deps.slots.forModel(modelNodeId);
|
|
761
|
+
if (current.some((slot) => slot.phase === "drained")) {
|
|
762
|
+
addNotes = { held: DRAINED_SLOT_GUARD };
|
|
763
|
+
return;
|
|
764
|
+
}
|
|
765
|
+
const refusal = addRefusal(rigId, modelNodeId);
|
|
766
|
+
if (refusal) {
|
|
767
|
+
addNotes = { refused: refusal };
|
|
768
|
+
return;
|
|
769
|
+
}
|
|
770
|
+
let raw;
|
|
771
|
+
try {
|
|
772
|
+
raw = deps.add.exportMember(rigId, modelNodeId);
|
|
773
|
+
}
|
|
774
|
+
catch (error) {
|
|
775
|
+
addNotes = { refused: `add refused: the model member can't be exported (${errorMessage(error)})` };
|
|
776
|
+
return;
|
|
777
|
+
}
|
|
778
|
+
const inherited = Object.fromEntries(Object.entries(raw).filter(([key]) => !NOT_INHERITED.includes(key)));
|
|
779
|
+
const pod = modelPod(deps.db, modelNodeId);
|
|
780
|
+
if (pod === null) {
|
|
781
|
+
addNotes = { refused: "add refused: the model member has no pod" };
|
|
782
|
+
return;
|
|
783
|
+
}
|
|
784
|
+
const rigRoot = deps.rigRepo.getNodeLaunchRecipe(modelNodeId)?.rigRoot ?? ".";
|
|
785
|
+
const launchAdditionsFrom = seatLaunchAdditionPathsForNode(deps.db, modelNodeId);
|
|
786
|
+
const issuedView = [];
|
|
787
|
+
const notIssued = [];
|
|
788
|
+
const cancelled = [];
|
|
789
|
+
for (let unit = 0; unit < addIntent.count; unit++) {
|
|
790
|
+
if (!active()) {
|
|
791
|
+
held = JOB_STOPPED;
|
|
792
|
+
break;
|
|
793
|
+
}
|
|
794
|
+
// The reservation: a new number and its row in one transaction. The operation id is a UUID.
|
|
795
|
+
const attemptId = randomUUID();
|
|
796
|
+
const { slot, logicalId } = deps.slots.reserveAdd({ modelNodeId, attemptId, at: deps.now().toISOString() });
|
|
797
|
+
const memberId = logicalId.slice(pod.length + 1);
|
|
798
|
+
const folder = spec.cwdTemplate === null
|
|
799
|
+
? null
|
|
800
|
+
: spec.cwdTemplate.replace(/\{(rig|slot)\}/g, (_, key) => (key === "rig" ? model.rigName : memberId));
|
|
801
|
+
// A pool agent is never kept alive: a kept-alive agent would be relaunched against the pool's own stops. Leaving
|
|
802
|
+
// the key out is not enough, since the add then resolves it from the agent spec's profile or defaults.
|
|
803
|
+
const member = { id: memberId, ...inherited, cwd: folder ?? raw["cwd"], keep_alive: false };
|
|
804
|
+
// The re-check just before the issue, with nothing awaited since the reservation: the job, the holds and the
|
|
805
|
+
// stored block again, then a new plan with this reservation counted. A lower `max`, `drain: true`, any other
|
|
806
|
+
// change to the block, a hold, or surplus that reaches this reservation cancels it before any operation row
|
|
807
|
+
// or call, and ends this cycle's adds.
|
|
808
|
+
let stopped;
|
|
809
|
+
const recheck = () => {
|
|
810
|
+
if (!active())
|
|
811
|
+
return "job_stopped";
|
|
812
|
+
const holdNow = readSeatPoolHold(deps.db, rigId);
|
|
813
|
+
if (holdNow.stoppedSeq !== null) {
|
|
814
|
+
stopped = holdNow;
|
|
815
|
+
return "rig_stopped";
|
|
816
|
+
}
|
|
817
|
+
const storedSpec = deps.rigRepo.getNodePool(modelNodeId);
|
|
818
|
+
const specNow = storedSpec !== undefined && "spec" in storedSpec ? storedSpec.spec : null;
|
|
819
|
+
if (blockChangedNow()) {
|
|
820
|
+
if (specNow === null)
|
|
821
|
+
return "pool_block_changed";
|
|
822
|
+
return specNow.max < spec.max ? "max_lowered" : specNow.drain ? "drain" : "pool_block_changed";
|
|
823
|
+
}
|
|
824
|
+
const slotsNow = deps.slots.forModel(modelNodeId);
|
|
825
|
+
const replan = planSeatPool(spec, { ...readSeatPoolState(deps, model, slotsNow), lastStepAt: lastDrainStep(slotsNow) }, deps.now().getTime());
|
|
826
|
+
return replan.intents.some((i) => i.kind === "cancel" && i.slotNumber === slot.slotNumber) ? "surplus" : null;
|
|
827
|
+
};
|
|
828
|
+
let cancelCause;
|
|
829
|
+
try {
|
|
830
|
+
cancelCause = recheck();
|
|
831
|
+
}
|
|
832
|
+
catch (error) {
|
|
833
|
+
// A re-check that fails leaves no reservation behind: the reserved row goes before its error is raised.
|
|
834
|
+
try {
|
|
835
|
+
deps.slots.cancelReservedAdd(slot.slotId, attemptId);
|
|
836
|
+
}
|
|
837
|
+
catch { /* the re-check's own error is the one raised */ }
|
|
838
|
+
throw error;
|
|
839
|
+
}
|
|
840
|
+
if (cancelCause !== null) {
|
|
841
|
+
// Reported cancelled only when its reserved row went; a row that no longer holds the reservation is reported
|
|
842
|
+
// as not issued, as the issue reports it.
|
|
843
|
+
if (deps.slots.cancelReservedAdd(slot.slotId, attemptId)) {
|
|
844
|
+
cancelled.push({ slotNumber: slot.slotNumber, logicalId, attempt: { id: attemptId, status: "cancelled", message: CANCELLED_NOT_ISSUED, code: cancelCause } });
|
|
845
|
+
}
|
|
846
|
+
else {
|
|
847
|
+
notIssued.push({ slotNumber: slot.slotNumber, logicalId, code: "slot_changed" });
|
|
848
|
+
}
|
|
849
|
+
if (cancelCause === "job_stopped")
|
|
850
|
+
held = JOB_STOPPED;
|
|
851
|
+
else if (stopped !== undefined) {
|
|
852
|
+
hold = stopped;
|
|
853
|
+
held = { cause: "rig stopped", seq: stopped.stoppedSeq, message: `held: rig stopped (event ${stopped.stoppedSeq})` };
|
|
854
|
+
}
|
|
855
|
+
break;
|
|
856
|
+
}
|
|
857
|
+
// The issue: the issued attempt, what it was issued on and the operation id, in one transaction.
|
|
858
|
+
const targets = [rigId, pod];
|
|
859
|
+
const body = JSON.stringify({ member, rigRoot });
|
|
860
|
+
let operation;
|
|
861
|
+
try {
|
|
862
|
+
const eventSeq = deps.db.prepare("SELECT MAX(seq) AS seq FROM events WHERE rig_id = ?").get(rigId).seq;
|
|
863
|
+
const basis = JSON.stringify({ eventSeq, targets, body });
|
|
864
|
+
operation = deps.db.transaction(() => {
|
|
865
|
+
if (!deps.slots.issueAttempt(slot.slotId, attemptId, basis))
|
|
866
|
+
throw new AddNotIssued("slot_changed");
|
|
867
|
+
const reserved = reserveOperation(deps.db, attemptId, "member.add", targets, body);
|
|
868
|
+
if (reserved.state !== "fresh")
|
|
869
|
+
throw new AddNotIssued(`operation_${reserved.state}`);
|
|
870
|
+
return reserved;
|
|
871
|
+
})();
|
|
872
|
+
}
|
|
873
|
+
catch (error) {
|
|
874
|
+
// Whatever stops the issue after the reservation, the reserved row goes, so its number is free again. A
|
|
875
|
+
// failed removal does not hide the error that stopped the issue.
|
|
876
|
+
try {
|
|
877
|
+
deps.slots.removeAddWithoutNode(slot.slotId, attemptId);
|
|
878
|
+
}
|
|
879
|
+
catch { /* the issue's own error is the one raised */ }
|
|
880
|
+
if (!(error instanceof AddNotIssued))
|
|
881
|
+
throw error;
|
|
882
|
+
notIssued.push({ slotNumber: slot.slotNumber, logicalId, code: error.code });
|
|
883
|
+
continue;
|
|
884
|
+
}
|
|
885
|
+
inFlightAttempts.add(attemptId);
|
|
886
|
+
issued.push({
|
|
887
|
+
slotId: slot.slotId, slotNumber: slot.slotNumber, logicalId, attemptId, rigId, rigRoot, folder, launchAdditionsFrom, operation,
|
|
888
|
+
op: { kind: "add_member", pod, member },
|
|
889
|
+
});
|
|
890
|
+
issuedView.push({ slotNumber: slot.slotNumber, logicalId, attempt: inFlight(attemptId) });
|
|
891
|
+
}
|
|
892
|
+
addNotes = {
|
|
893
|
+
...(issuedView.length ? { issued: issuedView } : {}),
|
|
894
|
+
...(notIssued.length ? { failed: notIssued } : {}),
|
|
895
|
+
...(cancelled.length ? { cancelled } : {}),
|
|
896
|
+
};
|
|
897
|
+
});
|
|
898
|
+
}
|
|
899
|
+
catch (error) {
|
|
900
|
+
thrown = error;
|
|
901
|
+
}
|
|
902
|
+
// The calls go out after the lease is released, whatever happened after their issue.
|
|
903
|
+
startAdds(modelNodeId, issued);
|
|
904
|
+
if (thrown !== undefined) {
|
|
905
|
+
// A refused custody is not a failure: the cycle had no effect.
|
|
906
|
+
if (!(thrown instanceof DeliveryGuardError))
|
|
907
|
+
throw thrown;
|
|
908
|
+
custody = { code: thrown.code, message: thrown.message };
|
|
909
|
+
}
|
|
910
|
+
if (!held && !custody && deps.drain) {
|
|
911
|
+
const effects = deps.drain;
|
|
912
|
+
/** The slot's phase after a write, read back when the write found it moved on. */
|
|
913
|
+
const moveTo = (slot, to, stop) => deps.slots.setPhase({ slotId: slot.slotId, from: "draining", to, at: at(), ...(stop !== undefined ? { stop } : {}) })
|
|
914
|
+
? to
|
|
915
|
+
: deps.slots.forModel(modelNodeId).find((s) => s.slotId === slot.slotId)?.phase ?? "draining";
|
|
916
|
+
/** The slot after the checked stop: `stopped` and `absent` drain it, `changed_owner` leaves it `live`, and
|
|
917
|
+
* `unconfirmed` keeps it `draining`, recorded with the session it stopped so the next cycle stops it again. */
|
|
918
|
+
const settle = (s, stop, snapshotId, attemptedBefore = false) => {
|
|
919
|
+
const reported = seatPoolStopReport(stop);
|
|
920
|
+
const to = reported.result === "stopped" || reported.result === "absent" ? "drained"
|
|
921
|
+
: reported.result === "changed_owner" ? "live" : "draining";
|
|
922
|
+
// A kill attempted by an earlier stop of the same session stays on record until a stop is confirmed.
|
|
923
|
+
const partial = !stop.ok && (stop.partialEffect === true || attemptedBefore) ? { partialEffect: true } : {};
|
|
924
|
+
const phase = moveTo(s.slot, to, { ...reported, ...partial, sessionId: s.sessionId, at: at() });
|
|
925
|
+
return {
|
|
926
|
+
slotNumber: s.slot.slotNumber, session: s.session, phase,
|
|
927
|
+
outcome: to === "drained" ? "drained" : to === "live" ? "left" : "draining",
|
|
928
|
+
...(snapshotId !== undefined ? { snapshotId } : {}),
|
|
929
|
+
stop: reported,
|
|
930
|
+
};
|
|
931
|
+
};
|
|
932
|
+
const stopReason = (what) => `seat pool ${job.jobId}: ${what}`;
|
|
933
|
+
const phaseNow = (slot) => deps.slots.forModel(modelNodeId).find((s) => s.slotId === slot.slotId)?.phase ?? "draining";
|
|
934
|
+
/** What holds the pool now: the job, the model and rig holds, and the current block. Null when none does. */
|
|
935
|
+
const holdsNow = () => {
|
|
936
|
+
if (!active()) {
|
|
937
|
+
held = JOB_STOPPED;
|
|
938
|
+
return "job_stopped";
|
|
939
|
+
}
|
|
940
|
+
const modelNow = seatPoolModelOfJob(deps.db, job);
|
|
941
|
+
if (!modelNow.found) {
|
|
942
|
+
held = modelNow.cause === "node_gone"
|
|
943
|
+
? { cause: "model node gone", message: "held: model node gone" }
|
|
944
|
+
: { cause: "model has no canonical session", message: "held: model has no canonical session" };
|
|
945
|
+
return "model_held";
|
|
946
|
+
}
|
|
947
|
+
const holdNow = readSeatPoolHold(deps.db, rigId);
|
|
948
|
+
if (holdNow.stoppedSeq !== null) {
|
|
949
|
+
held = { cause: "rig stopped", seq: holdNow.stoppedSeq, message: `held: rig stopped (event ${holdNow.stoppedSeq})` };
|
|
950
|
+
return "rig_stopped";
|
|
951
|
+
}
|
|
952
|
+
if (blockChangedNow())
|
|
953
|
+
return "pool_block_changed";
|
|
954
|
+
return null;
|
|
955
|
+
};
|
|
956
|
+
/** What keeps an agent from being stopped now, read again at the checked stop's final step before each effect
|
|
957
|
+
* (after its liveness probe): the job, the rig and model holds, the current block, the agent's work and activity,
|
|
958
|
+
* and, for a retry (`idleSince` null), whether the pool still has surplus. Null when the stop may go on. */
|
|
959
|
+
const keeps = (slotNumber, nodeId, idleSince) => {
|
|
960
|
+
const holding = holdsNow();
|
|
961
|
+
if (holding !== null)
|
|
962
|
+
return holding;
|
|
963
|
+
const now = readSeatPoolState(deps, model, deps.slots.forModel(modelNodeId));
|
|
964
|
+
const agent = now.agents.find((a) => a.slotNumber === slotNumber);
|
|
965
|
+
if (!agent || agent.phase !== "draining")
|
|
966
|
+
return "slot_moved_on";
|
|
967
|
+
// Work first: `running` comes from the recorded status, so false does not prove the process is gone.
|
|
968
|
+
if (agent.openRows > 0 || agent.heldCount > 0)
|
|
969
|
+
return "work_arrived";
|
|
970
|
+
// An agent positively gone keeps nothing: the stop only confirms it. Gone is its latest session `exited`, or the
|
|
971
|
+
// node's executor confirmed stopped (session missing or pane exited); an unknown or stale status keeps it.
|
|
972
|
+
if (!agent.running) {
|
|
973
|
+
return agent.latestSessionStatus === "exited" || deps.confirmedStopped(nodeId) ? null : "not_confirmed_gone";
|
|
974
|
+
}
|
|
975
|
+
if (!agent.idleAtPrompt || (idleSince !== null && woken(nodeId, idleSince)))
|
|
976
|
+
return "woken";
|
|
977
|
+
if (idleSince === null) {
|
|
978
|
+
// A stop already attempted is finished only while the pool still has surplus, the draining agents counted as
|
|
979
|
+
// serving.
|
|
980
|
+
const serving = now.agents.map((a) => (a.phase === "draining" ? { ...a, phase: "live" } : a));
|
|
981
|
+
if (planSeatPool(spec, { ...now, agents: serving }, deps.now().getTime()).surplus === 0)
|
|
982
|
+
return "no_surplus";
|
|
983
|
+
}
|
|
984
|
+
return null;
|
|
985
|
+
};
|
|
986
|
+
/** The recheck the checked stop runs, and the code it refused with (the stop itself reports `selection_changed`). */
|
|
987
|
+
const recheckOf = (slotNumber, nodeId, idleSince) => {
|
|
988
|
+
const refused = { code: null };
|
|
989
|
+
const recheck = () => {
|
|
990
|
+
const code = keeps(slotNumber, nodeId, idleSince);
|
|
991
|
+
if (code === null)
|
|
992
|
+
return null;
|
|
993
|
+
refused.code = code;
|
|
994
|
+
return { ok: false, code: "selection_changed", message: `The seat pool drain stops nothing: ${code} right before the stop.` };
|
|
995
|
+
};
|
|
996
|
+
return { refused, recheck };
|
|
997
|
+
};
|
|
998
|
+
for (const r of restops) {
|
|
999
|
+
if (!active()) {
|
|
1000
|
+
held = JOB_STOPPED;
|
|
1001
|
+
break;
|
|
1002
|
+
}
|
|
1003
|
+
const step = { slotNumber: r.slot.slotNumber, session: r.session };
|
|
1004
|
+
try {
|
|
1005
|
+
drains.push(await effects.lifecycle([r.nodeId], async () => {
|
|
1006
|
+
if (!active()) {
|
|
1007
|
+
held = JOB_STOPPED;
|
|
1008
|
+
return { ...step, phase: "draining", outcome: "draining", code: "job_stopped" };
|
|
1009
|
+
}
|
|
1010
|
+
// The block again, under the lease: one changed or unreadable while the lease was awaited ends this cycle's
|
|
1011
|
+
// effects. A kill was attempted, so the slot stays `draining` and a later cycle stops it again.
|
|
1012
|
+
if (blockChangedNow())
|
|
1013
|
+
return { ...step, phase: "draining", outcome: "draining", code: "pool_block_changed" };
|
|
1014
|
+
// The agent again, under its lifecycle lease: one that still runs and got work or is not idle is never
|
|
1015
|
+
// stopped. A kill was attempted, so it is not given back to `live` either: the slot stays `draining`, and a
|
|
1016
|
+
// later cycle stops it once it is free.
|
|
1017
|
+
const agent = readSeatPoolAgents(deps, deps.slots.forModel(modelNodeId)).find((a) => a.slotNumber === r.slot.slotNumber);
|
|
1018
|
+
if (!agent || agent.phase !== "draining")
|
|
1019
|
+
return { ...step, phase: agent?.phase ?? "draining", outcome: "skipped", code: "slot_moved_on" };
|
|
1020
|
+
if (agent.running && (agent.openRows > 0 || agent.heldCount > 0 || !agent.idleAtPrompt)) {
|
|
1021
|
+
return { ...step, phase: "draining", outcome: "draining", code: agent.openRows > 0 || agent.heldCount > 0 ? "work_arrived" : "woken" };
|
|
1022
|
+
}
|
|
1023
|
+
const { refused, recheck } = recheckOf(r.slot.slotNumber, r.nodeId, null);
|
|
1024
|
+
const stop = await effects.stopSeat({
|
|
1025
|
+
seatRef: r.session, reason: stopReason("the drain's stop was unconfirmed; stopping again"),
|
|
1026
|
+
expected: { nodeId: r.nodeId, sessionId: r.sessionId }, recheck,
|
|
1027
|
+
});
|
|
1028
|
+
// Refused at the stop's final step before any effect: the earlier attempt stays on record, and the slot stays
|
|
1029
|
+
// `draining` until a later cycle finishes it.
|
|
1030
|
+
if (refused.code !== null && !stop.ok && stop.partialEffect !== true) {
|
|
1031
|
+
return { ...step, phase: phaseNow(r.slot), outcome: "draining", code: refused.code };
|
|
1032
|
+
}
|
|
1033
|
+
return settle(r, stop, undefined, true);
|
|
1034
|
+
}));
|
|
1035
|
+
}
|
|
1036
|
+
catch (error) {
|
|
1037
|
+
// The guard refused the lease. A stop was already tried, so the slot stays `draining` until one is confirmed.
|
|
1038
|
+
if (!(error instanceof DeliveryGuardError))
|
|
1039
|
+
throw error;
|
|
1040
|
+
drains.push({ ...step, phase: "draining", outcome: "draining", code: error.code, message: error.message });
|
|
1041
|
+
}
|
|
1042
|
+
}
|
|
1043
|
+
/** What keeps a gone agent's slot from being `drained` now, read under its lifecycle lease and again at the
|
|
1044
|
+
* checked stop's final step: the holds, its work, and whether it is still positively gone. */
|
|
1045
|
+
const keepsGone = (slotNumber, nodeId) => {
|
|
1046
|
+
const holding = holdsNow();
|
|
1047
|
+
if (holding !== null)
|
|
1048
|
+
return holding;
|
|
1049
|
+
const agent = readSeatPoolAgents(deps, deps.slots.forModel(modelNodeId)).find((a) => a.slotNumber === slotNumber);
|
|
1050
|
+
if (!agent || agent.phase !== "draining")
|
|
1051
|
+
return "slot_moved_on";
|
|
1052
|
+
if (agent.openRows > 0 || agent.heldCount > 0)
|
|
1053
|
+
return "work_arrived";
|
|
1054
|
+
if (agent.running)
|
|
1055
|
+
return "running";
|
|
1056
|
+
return agent.latestSessionStatus === "exited" || deps.confirmedStopped(nodeId) ? null : "not_confirmed_gone";
|
|
1057
|
+
};
|
|
1058
|
+
for (const g of gone) {
|
|
1059
|
+
if (held)
|
|
1060
|
+
break;
|
|
1061
|
+
if (!active()) {
|
|
1062
|
+
held = JOB_STOPPED;
|
|
1063
|
+
break;
|
|
1064
|
+
}
|
|
1065
|
+
const step = { slotNumber: g.slot.slotNumber, session: g.session };
|
|
1066
|
+
try {
|
|
1067
|
+
drains.push(await effects.lifecycle([g.nodeId], async () => {
|
|
1068
|
+
// Relaunched since the plan read it: someone's seat now, left alone.
|
|
1069
|
+
if (latestSession(deps.db, g.nodeId)?.id !== g.sessionId)
|
|
1070
|
+
return { ...step, phase: moveTo(g.slot, "live"), outcome: "left", code: "relaunched" };
|
|
1071
|
+
const before = keepsGone(g.slot.slotNumber, g.nodeId);
|
|
1072
|
+
if (before === "slot_moved_on")
|
|
1073
|
+
return { ...step, phase: phaseNow(g.slot), outcome: "skipped", code: before };
|
|
1074
|
+
if (before !== null) {
|
|
1075
|
+
return { ...step, phase: moveTo(g.slot, "live"), outcome: before === "work_arrived" ? "returned" : "left", code: before };
|
|
1076
|
+
}
|
|
1077
|
+
const refused = { code: null };
|
|
1078
|
+
const stop = await effects.stopSeat({
|
|
1079
|
+
seatRef: g.session, reason: stopReason("its session is gone; drained"),
|
|
1080
|
+
expected: { nodeId: g.nodeId, sessionId: g.sessionId },
|
|
1081
|
+
recheck: () => {
|
|
1082
|
+
const code = keepsGone(g.slot.slotNumber, g.nodeId);
|
|
1083
|
+
if (code === null)
|
|
1084
|
+
return null;
|
|
1085
|
+
refused.code = code;
|
|
1086
|
+
return { ok: false, code: "selection_changed", message: `The seat pool drain stops nothing: ${code} right before the stop.` };
|
|
1087
|
+
},
|
|
1088
|
+
});
|
|
1089
|
+
// Refused at the stop's final step before any effect: nothing was stopped, and the slot is `live` again.
|
|
1090
|
+
if (refused.code !== null && !stop.ok && stop.partialEffect !== true) {
|
|
1091
|
+
return { ...step, phase: moveTo(g.slot, "live", null), outcome: refused.code === "work_arrived" ? "returned" : "left", code: refused.code };
|
|
1092
|
+
}
|
|
1093
|
+
// A session found absent returns before the stop's final step, so its recheck never ran: the same reading
|
|
1094
|
+
// again before the slot is `drained`. Nothing was stopped, so a slot that got work meanwhile is `live` again.
|
|
1095
|
+
if (seatPoolStopReport(stop).result === "absent") {
|
|
1096
|
+
const after = keepsGone(g.slot.slotNumber, g.nodeId);
|
|
1097
|
+
if (after === "slot_moved_on")
|
|
1098
|
+
return { ...step, phase: phaseNow(g.slot), outcome: "skipped", code: after };
|
|
1099
|
+
if (after !== null) {
|
|
1100
|
+
return { ...step, phase: moveTo(g.slot, "live", null), outcome: after === "work_arrived" ? "returned" : "left", code: after };
|
|
1101
|
+
}
|
|
1102
|
+
}
|
|
1103
|
+
return settle(g, stop);
|
|
1104
|
+
}));
|
|
1105
|
+
}
|
|
1106
|
+
catch (error) {
|
|
1107
|
+
// The guard refused the lease: nothing was stopped, and the slot is `live` again.
|
|
1108
|
+
if (!(error instanceof DeliveryGuardError))
|
|
1109
|
+
throw error;
|
|
1110
|
+
drains.push({ ...step, phase: moveTo(g.slot, "live"), outcome: "left", code: error.code, message: error.message });
|
|
1111
|
+
}
|
|
1112
|
+
}
|
|
1113
|
+
for (const [index, t] of toDrain.entries()) {
|
|
1114
|
+
// A job stopped, or a block changed, while an earlier drain awaited: no later effect. The slots left
|
|
1115
|
+
// `draining` go back to `live` in the next cycle, with nothing stopped.
|
|
1116
|
+
if (held)
|
|
1117
|
+
break;
|
|
1118
|
+
if (!active()) {
|
|
1119
|
+
held = JOB_STOPPED;
|
|
1120
|
+
break;
|
|
1121
|
+
}
|
|
1122
|
+
if (blockChangedNow()) {
|
|
1123
|
+
for (const rest of toDrain.slice(index))
|
|
1124
|
+
drainSkipped({ slotNumber: rest.slot.slotNumber, session: rest.session, phase: "draining" }, "pool_block_changed");
|
|
1125
|
+
break;
|
|
1126
|
+
}
|
|
1127
|
+
const step = { slotNumber: t.slot.slotNumber, session: t.session };
|
|
1128
|
+
const back = (outcome, code, message) => ({ ...step, phase: moveTo(t.slot, "live"), outcome, code, ...(message !== undefined ? { message } : {}) });
|
|
1129
|
+
try {
|
|
1130
|
+
drains.push(await effects.lifecycle([t.nodeId], async () => {
|
|
1131
|
+
// The agent again, under its lifecycle lease.
|
|
1132
|
+
const agent = readSeatPoolAgents(deps, deps.slots.forModel(modelNodeId)).find((a) => a.slotNumber === t.slot.slotNumber);
|
|
1133
|
+
if (!agent || agent.phase !== "draining")
|
|
1134
|
+
return { ...step, phase: agent?.phase ?? "draining", outcome: "skipped", code: "slot_moved_on" };
|
|
1135
|
+
// Relaunched since the plan read it (or no longer running): someone's seat now, left alone.
|
|
1136
|
+
if (latestSession(deps.db, t.nodeId)?.id !== t.sessionId)
|
|
1137
|
+
return back("left", "relaunched");
|
|
1138
|
+
if (!agent.running)
|
|
1139
|
+
return back("left", "not_running");
|
|
1140
|
+
// A row or a held message reached it, or something woke it: it serves, and nothing is stopped.
|
|
1141
|
+
if (agent.openRows > 0 || agent.heldCount > 0)
|
|
1142
|
+
return back("returned", "work_arrived");
|
|
1143
|
+
if (!agent.idleAtPrompt || woken(t.nodeId, t.idleSince))
|
|
1144
|
+
return back("returned", "woken");
|
|
1145
|
+
if (!active()) {
|
|
1146
|
+
held = JOB_STOPPED;
|
|
1147
|
+
return { ...step, phase: "draining", outcome: "draining", code: "job_stopped" };
|
|
1148
|
+
}
|
|
1149
|
+
// The block again, under the lease: one changed or unreadable while the lease was awaited ends this cycle's
|
|
1150
|
+
// effects before any capture. Nothing was stopped, so the slot goes back to `live` in a later cycle.
|
|
1151
|
+
if (blockChangedNow())
|
|
1152
|
+
return { ...step, phase: "draining", outcome: "draining", code: "pool_block_changed" };
|
|
1153
|
+
// The agent's resume metadata, refreshed as `rig down` does before its snapshot. Best-effort: a refresh that
|
|
1154
|
+
// fails still captures and stops.
|
|
1155
|
+
try {
|
|
1156
|
+
await effects.refresh({ rigId, nodeId: t.nodeId, sessionId: t.sessionId });
|
|
1157
|
+
}
|
|
1158
|
+
catch {
|
|
1159
|
+
// best-effort, as in teardown
|
|
1160
|
+
}
|
|
1161
|
+
// The job, the holds and the block again after the refresh, which can take a while: one that holds the pool
|
|
1162
|
+
// now captures nothing and stops nothing. Nothing was stopped, so the slot goes back to `live` in a later cycle.
|
|
1163
|
+
const heldAfterRefresh = holdsNow();
|
|
1164
|
+
if (heldAfterRefresh !== null)
|
|
1165
|
+
return { ...step, phase: "draining", outcome: "draining", code: heldAfterRefresh };
|
|
1166
|
+
// The capture, while the agent still runs, right before the stop. A capture that fails stops nothing.
|
|
1167
|
+
let snapshotId;
|
|
1168
|
+
try {
|
|
1169
|
+
snapshotId = effects.capture(rigId).snapshotId;
|
|
1170
|
+
}
|
|
1171
|
+
catch (error) {
|
|
1172
|
+
return { ...step, phase: "draining", outcome: "draining", code: "capture_failed", message: errorMessage(error) };
|
|
1173
|
+
}
|
|
1174
|
+
// The attempt goes on record before the stop: a daemon exit after the stop took effect and before its result
|
|
1175
|
+
// is written leaves the slot `draining` with it, and the next cycle stops the recorded session again instead
|
|
1176
|
+
// of giving back to `live` an agent that no longer runs. The result below replaces it.
|
|
1177
|
+
const inFlight = { cause: "drain", result: "unconfirmed", code: "stop_in_flight", partialEffect: true, sessionId: t.sessionId, at: at() };
|
|
1178
|
+
if (!deps.slots.setPhase({ slotId: t.slot.slotId, from: "draining", to: "draining", at: at(), stop: inFlight })) {
|
|
1179
|
+
const phase = deps.slots.forModel(modelNodeId).find((s) => s.slotId === t.slot.slotId)?.phase ?? "draining";
|
|
1180
|
+
return { ...step, phase, outcome: "skipped", code: "slot_moved_on" };
|
|
1181
|
+
}
|
|
1182
|
+
const { refused, recheck } = recheckOf(t.slot.slotNumber, t.nodeId, t.idleSince);
|
|
1183
|
+
const stop = await effects.stopSeat({
|
|
1184
|
+
seatRef: t.session, reason: stopReason(`idle since ${t.idleSince}; drained`),
|
|
1185
|
+
expected: { nodeId: t.nodeId, sessionId: t.sessionId }, recheck,
|
|
1186
|
+
});
|
|
1187
|
+
// Refused at the stop's final step before any effect: nothing was stopped, and the attempt record goes. An
|
|
1188
|
+
// agent that got work or woke serves again; otherwise the slot goes back to `live` in a later cycle.
|
|
1189
|
+
if (refused.code !== null && !stop.ok && stop.partialEffect !== true) {
|
|
1190
|
+
if (refused.code === "work_arrived" || refused.code === "woken") {
|
|
1191
|
+
return { ...step, phase: moveTo(t.slot, "live", null), outcome: "returned", code: refused.code, snapshotId };
|
|
1192
|
+
}
|
|
1193
|
+
return { ...step, phase: moveTo(t.slot, "draining", null), outcome: "draining", code: refused.code, snapshotId };
|
|
1194
|
+
}
|
|
1195
|
+
return settle(t, stop, snapshotId);
|
|
1196
|
+
}));
|
|
1197
|
+
}
|
|
1198
|
+
catch (error) {
|
|
1199
|
+
// The guard refused the lease: nothing was captured or stopped, and the agent serves again.
|
|
1200
|
+
if (!(error instanceof DeliveryGuardError))
|
|
1201
|
+
throw error;
|
|
1202
|
+
drains.push(back("returned", error.code, error.message));
|
|
1203
|
+
}
|
|
1204
|
+
}
|
|
1205
|
+
}
|
|
1206
|
+
// After `pool: {}`, the block again before the job ends: one stored again (or broken) while the cycle waited for
|
|
1207
|
+
// custody, with no effect to read it, keeps the job active. Read before the notes, which report the block it finds.
|
|
1208
|
+
const ends = removed && !held && !custody && !blockChanged && !blockChangedNow()
|
|
1209
|
+
&& deps.slots.forModel(modelNodeId).every((s) => s.phase === "drained");
|
|
1210
|
+
const restore = !held && hold && hold.unfinishedRestoreSeq !== null
|
|
1211
|
+
? {
|
|
1212
|
+
seq: hold.unfinishedRestoreSeq,
|
|
1213
|
+
completed: false,
|
|
1214
|
+
message: `restore at event ${hold.unfinishedRestoreSeq} has no restore.completed; nothing is held without a rig.stopped`,
|
|
1215
|
+
}
|
|
1216
|
+
: undefined;
|
|
1217
|
+
const notes = {
|
|
1218
|
+
...base(),
|
|
1219
|
+
...(blockChanged ? {} : removal),
|
|
1220
|
+
...(held ? { held } : {}),
|
|
1221
|
+
...(advisory ? { advisory } : {}),
|
|
1222
|
+
...(restore ? { restore } : {}),
|
|
1223
|
+
...(moved.length ? { moved } : {}),
|
|
1224
|
+
...(skipped.length ? { skipped } : {}),
|
|
1225
|
+
...(failed.length ? { failed } : {}),
|
|
1226
|
+
...(drains.length ? { drains } : {}),
|
|
1227
|
+
...(addNotes && Object.keys(addNotes).length ? { add: addNotes } : {}),
|
|
1228
|
+
...(custody ? { custody } : {}),
|
|
1229
|
+
};
|
|
1230
|
+
// After `pool: {}`: the job ends once every agent is drained (busy agents stay `live` until they are free).
|
|
1231
|
+
if (ends) {
|
|
1232
|
+
// What this cycle (or an earlier one) settled goes in the last report too.
|
|
1233
|
+
const done = settled.get(modelNodeId);
|
|
1234
|
+
settled.delete(modelNodeId);
|
|
1235
|
+
return { action: "terminal", reason: "seat_pool_removed_drained", notes: done?.length ? { ...notes, settled: done } : notes };
|
|
1236
|
+
}
|
|
1237
|
+
return report(notes);
|
|
1238
|
+
},
|
|
1239
|
+
};
|
|
1240
|
+
}
|
|
1241
|
+
//# sourceMappingURL=seat-pool-executor.js.map
|