@openrig/cli 0.7.24 → 0.7.26
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 +151 -37
- package/daemon/assets/claude-hook-bridge.d.cts +9 -2
- package/daemon/assets/claude-permission-policies.cjs +22 -1
- package/daemon/assets/claude-permission-policies.d.cts +2 -0
- package/daemon/assets/claude-statusline-context.cjs +14 -0
- package/daemon/assets/claude-team-permissions.cjs +54 -6
- package/daemon/assets/guidance/openrig-context-entry.md +4 -5
- package/daemon/assets/guidance/openrig-start.md +3 -0
- package/daemon/assets/plugins/openrig/.claude-plugin/plugin.json +2 -2
- package/daemon/assets/plugins/openrig/.codex-plugin/plugin.json +1 -1
- package/daemon/assets/plugins/openrig/.cursor-plugin/plugin.json +1 -1
- package/daemon/assets/plugins/openrig/README.md +33 -18
- package/daemon/assets/plugins/openrig/hooks/scripts/claude-hook-bridge.cjs +151 -37
- package/daemon/assets/plugins/openrig/plugin.json +1 -1
- package/daemon/assets/plugins/openrig/scripts/run-rig.cjs +16 -13
- package/daemon/assets/plugins/openrig/skills/working-with-an-openrig-team/SKILL.md +32 -19
- package/daemon/assets/plugins/openrig-codex/.codex-plugin/plugin.json +1 -1
- package/daemon/assets/plugins/openrig-codex/hooks/scripts/claude-hook-bridge.cjs +151 -37
- package/daemon/assets/plugins/openrig-codex/skills/working-with-an-openrig-team/SKILL.md +32 -19
- package/daemon/assets/plugins/openrig-core/.claude-plugin/plugin.json +1 -1
- package/daemon/assets/plugins/openrig-core/.codex-plugin/plugin.json +1 -1
- package/daemon/assets/plugins/openrig-core/hooks/scripts/permission-answer.cjs +3 -2
- package/daemon/assets/plugins/openrig-core/skills/openrig-user/SKILL.md +47 -14
- package/daemon/assets/plugins/openrig-core/skills/session-compaction-and-restore/SKILL.md +5 -2
- package/daemon/assets/skills/rigs/SKILL.md +99 -34
- package/daemon/assets/skills/rigs/references/installing-for-someone.md +1 -1
- package/daemon/context-packs/help/help.md +9 -0
- 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 +179 -25
- package/daemon/context-packs/reference/getting-started.md +73 -11
- package/daemon/context-packs/reference/manifest.yaml +1 -1
- package/daemon/context-packs/reference/rig-spec.md +218 -23
- package/daemon/context-packs/reference/whats-new.md +190 -14
- package/daemon/context-packs/skills/agent-operated-software/manifest.yaml +1 -1
- package/daemon/context-packs/skills/agent-operated-workflows/manifest.yaml +1 -1
- package/daemon/context-packs/skills/applying-a-permission-policy/manifest.yaml +1 -1
- package/daemon/context-packs/skills/claude-compaction-restore/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/agent-starters/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/agent-startup-and-context-ingestion/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/cross-host-rig-commands/SKILL.md +9 -1
- package/daemon/context-packs/skills/core/cross-host-rig-commands/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/human-in-the-loop/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/messaging-the-human/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/openrig-architect/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/openrig-cmux/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/openrig-herdr/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/openrig-skills/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/openrig-software-factory/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/openrig-upgrade/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/rig-bundles-and-shareable-artifacts/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/rig-lifecycle/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/session-source-fork/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/specification-system/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/topology-mutation-and-seat-management/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/watchdog/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/working-with-an-openrig-team/SKILL.md +32 -19
- 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 +47 -14
- 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/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/SKILL.md +5 -2
- 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.map +1 -1
- package/daemon/dist/adapters/claude-code-adapter.js +25 -8
- package/daemon/dist/adapters/claude-code-adapter.js.map +1 -1
- package/daemon/dist/adapters/claude-resume.d.ts +2 -0
- package/daemon/dist/adapters/claude-resume.d.ts.map +1 -1
- package/daemon/dist/adapters/claude-resume.js +44 -8
- package/daemon/dist/adapters/claude-resume.js.map +1 -1
- package/daemon/dist/adapters/codex-resume.d.ts +3 -0
- package/daemon/dist/adapters/codex-resume.d.ts.map +1 -1
- package/daemon/dist/adapters/codex-resume.js +7 -3
- package/daemon/dist/adapters/codex-resume.js.map +1 -1
- package/daemon/dist/adapters/codex-runtime-adapter.d.ts +49 -4
- package/daemon/dist/adapters/codex-runtime-adapter.d.ts.map +1 -1
- package/daemon/dist/adapters/codex-runtime-adapter.js +238 -25
- package/daemon/dist/adapters/codex-runtime-adapter.js.map +1 -1
- package/daemon/dist/adapters/community-harness-runtime-adapter.d.ts +12 -5
- package/daemon/dist/adapters/community-harness-runtime-adapter.d.ts.map +1 -1
- package/daemon/dist/adapters/community-harness-runtime-adapter.js +15 -5
- package/daemon/dist/adapters/community-harness-runtime-adapter.js.map +1 -1
- package/daemon/dist/adapters/kernel-authority.d.ts +2 -2
- package/daemon/dist/adapters/kernel-authority.d.ts.map +1 -1
- package/daemon/dist/adapters/kernel-authority.js +5 -3
- package/daemon/dist/adapters/kernel-authority.js.map +1 -1
- package/daemon/dist/adapters/pi-runner.d.ts.map +1 -1
- package/daemon/dist/adapters/pi-runner.js +9 -0
- package/daemon/dist/adapters/pi-runner.js.map +1 -1
- package/daemon/dist/adapters/pi-session-cwd.d.ts +26 -0
- package/daemon/dist/adapters/pi-session-cwd.d.ts.map +1 -0
- package/daemon/dist/adapters/pi-session-cwd.js +89 -0
- package/daemon/dist/adapters/pi-session-cwd.js.map +1 -0
- package/daemon/dist/adapters/shell-quote.d.ts +2 -0
- package/daemon/dist/adapters/shell-quote.d.ts.map +1 -1
- package/daemon/dist/adapters/shell-quote.js +43 -0
- package/daemon/dist/adapters/shell-quote.js.map +1 -1
- package/daemon/dist/adapters/tmux-credential-env.d.ts +15 -2
- package/daemon/dist/adapters/tmux-credential-env.d.ts.map +1 -1
- package/daemon/dist/adapters/tmux-credential-env.js +82 -2
- package/daemon/dist/adapters/tmux-credential-env.js.map +1 -1
- package/daemon/dist/adapters/tmux-exec.d.ts.map +1 -1
- package/daemon/dist/adapters/tmux-exec.js +2 -6
- package/daemon/dist/adapters/tmux-exec.js.map +1 -1
- package/daemon/dist/adapters/tmux.d.ts +31 -1
- package/daemon/dist/adapters/tmux.d.ts.map +1 -1
- package/daemon/dist/adapters/tmux.js +104 -8
- package/daemon/dist/adapters/tmux.js.map +1 -1
- package/daemon/dist/attention-surface.d.ts +5 -0
- package/daemon/dist/attention-surface.d.ts.map +1 -1
- package/daemon/dist/attention-surface.js.map +1 -1
- package/daemon/dist/bind-plan-surface.d.ts +3 -0
- package/daemon/dist/bind-plan-surface.d.ts.map +1 -0
- package/daemon/dist/bind-plan-surface.js +5 -0
- package/daemon/dist/bind-plan-surface.js.map +1 -0
- package/daemon/dist/build-info.js +3 -3
- package/daemon/dist/db/all-migrations.d.ts +4 -1
- package/daemon/dist/db/all-migrations.d.ts.map +1 -1
- package/daemon/dist/db/all-migrations.js +30 -393
- package/daemon/dist/db/all-migrations.js.map +1 -1
- package/daemon/dist/db/migrations/187_provider_account_refs.d.ts +8 -0
- package/daemon/dist/db/migrations/187_provider_account_refs.d.ts.map +1 -0
- package/daemon/dist/db/migrations/187_provider_account_refs.js +25 -0
- package/daemon/dist/db/migrations/187_provider_account_refs.js.map +1 -0
- package/daemon/dist/db/migrations/188_provider_account_assignments.d.ts +14 -0
- package/daemon/dist/db/migrations/188_provider_account_assignments.d.ts.map +1 -0
- package/daemon/dist/db/migrations/188_provider_account_assignments.js +45 -0
- package/daemon/dist/db/migrations/188_provider_account_assignments.js.map +1 -0
- package/daemon/dist/db/migrations/191_queue_transfer_activation.d.ts +3 -0
- package/daemon/dist/db/migrations/191_queue_transfer_activation.d.ts.map +1 -0
- package/daemon/dist/db/migrations/191_queue_transfer_activation.js +49 -0
- package/daemon/dist/db/migrations/191_queue_transfer_activation.js.map +1 -0
- package/daemon/dist/db/migrations/191_seat_reap_state.d.ts +3 -0
- package/daemon/dist/db/migrations/191_seat_reap_state.d.ts.map +1 -0
- package/daemon/dist/db/migrations/191_seat_reap_state.js +19 -0
- package/daemon/dist/db/migrations/191_seat_reap_state.js.map +1 -0
- package/daemon/dist/db/migrations/197_session_agent_activity_hooks.d.ts +3 -0
- package/daemon/dist/db/migrations/197_session_agent_activity_hooks.d.ts.map +1 -0
- package/daemon/dist/db/migrations/197_session_agent_activity_hooks.js +9 -0
- package/daemon/dist/db/migrations/197_session_agent_activity_hooks.js.map +1 -0
- package/daemon/dist/db/migrations/200_context_configured_budget.d.ts +3 -0
- package/daemon/dist/db/migrations/200_context_configured_budget.d.ts.map +1 -0
- package/daemon/dist/db/migrations/200_context_configured_budget.js +5 -0
- package/daemon/dist/db/migrations/200_context_configured_budget.js.map +1 -0
- package/daemon/dist/db/migrations/200_seat_cold_start_standby_stop.d.ts +3 -0
- package/daemon/dist/db/migrations/200_seat_cold_start_standby_stop.d.ts.map +1 -0
- package/daemon/dist/db/migrations/200_seat_cold_start_standby_stop.js +5 -0
- package/daemon/dist/db/migrations/200_seat_cold_start_standby_stop.js.map +1 -0
- package/daemon/dist/db/migrations/200_sessions_earlier_handover_origin.d.ts +11 -0
- package/daemon/dist/db/migrations/200_sessions_earlier_handover_origin.d.ts.map +1 -0
- package/daemon/dist/db/migrations/200_sessions_earlier_handover_origin.js +34 -0
- package/daemon/dist/db/migrations/200_sessions_earlier_handover_origin.js.map +1 -0
- package/daemon/dist/db/migrations/201_queue_transitions_archive_actor_index.d.ts +7 -0
- package/daemon/dist/db/migrations/201_queue_transitions_archive_actor_index.d.ts.map +1 -0
- package/daemon/dist/db/migrations/201_queue_transitions_archive_actor_index.js +12 -0
- package/daemon/dist/db/migrations/201_queue_transitions_archive_actor_index.js.map +1 -0
- package/daemon/dist/db/migrations/201_roster_event_index.d.ts +4 -0
- package/daemon/dist/db/migrations/201_roster_event_index.d.ts.map +1 -0
- package/daemon/dist/db/migrations/201_roster_event_index.js +9 -0
- package/daemon/dist/db/migrations/201_roster_event_index.js.map +1 -0
- package/daemon/dist/db/migrations/202_network_requester_questions.d.ts +4 -0
- package/daemon/dist/db/migrations/202_network_requester_questions.d.ts.map +1 -0
- package/daemon/dist/db/migrations/202_network_requester_questions.js +10 -0
- package/daemon/dist/db/migrations/202_network_requester_questions.js.map +1 -0
- package/daemon/dist/db/migrations/203_outbox_runner_receipts_index.d.ts +3 -0
- package/daemon/dist/db/migrations/203_outbox_runner_receipts_index.d.ts.map +1 -0
- package/daemon/dist/db/migrations/203_outbox_runner_receipts_index.js +22 -0
- package/daemon/dist/db/migrations/203_outbox_runner_receipts_index.js.map +1 -0
- package/daemon/dist/domain/activity-taxonomy.d.ts +16 -5
- package/daemon/dist/domain/activity-taxonomy.d.ts.map +1 -1
- package/daemon/dist/domain/activity-taxonomy.js +30 -5
- package/daemon/dist/domain/activity-taxonomy.js.map +1 -1
- package/daemon/dist/domain/agent-activity-store.d.ts +4 -0
- package/daemon/dist/domain/agent-activity-store.d.ts.map +1 -1
- package/daemon/dist/domain/agent-activity-store.js +21 -0
- package/daemon/dist/domain/agent-activity-store.js.map +1 -1
- package/daemon/dist/domain/agent-images/agent-image-destination.d.ts +15 -0
- package/daemon/dist/domain/agent-images/agent-image-destination.d.ts.map +1 -0
- package/daemon/dist/domain/agent-images/agent-image-destination.js +79 -0
- package/daemon/dist/domain/agent-images/agent-image-destination.js.map +1 -0
- package/daemon/dist/domain/agent-images/agent-image-library-service.d.ts.map +1 -1
- package/daemon/dist/domain/agent-images/agent-image-library-service.js +9 -1
- package/daemon/dist/domain/agent-images/agent-image-library-service.js.map +1 -1
- package/daemon/dist/domain/bootstrap-orchestrator.d.ts +4 -3
- package/daemon/dist/domain/bootstrap-orchestrator.d.ts.map +1 -1
- package/daemon/dist/domain/bootstrap-orchestrator.js +55 -11
- package/daemon/dist/domain/bootstrap-orchestrator.js.map +1 -1
- package/daemon/dist/domain/bundle-content-routing.d.ts +7 -0
- package/daemon/dist/domain/bundle-content-routing.d.ts.map +1 -1
- package/daemon/dist/domain/bundle-content-routing.js +20 -15
- package/daemon/dist/domain/bundle-content-routing.js.map +1 -1
- package/daemon/dist/domain/claude-compaction-enforcer.d.ts +40 -1
- package/daemon/dist/domain/claude-compaction-enforcer.d.ts.map +1 -1
- package/daemon/dist/domain/claude-compaction-enforcer.js +101 -11
- package/daemon/dist/domain/claude-compaction-enforcer.js.map +1 -1
- package/daemon/dist/domain/claude-continuation-launch.d.ts +19 -2
- package/daemon/dist/domain/claude-continuation-launch.d.ts.map +1 -1
- package/daemon/dist/domain/claude-continuation-launch.js +143 -3
- package/daemon/dist/domain/claude-continuation-launch.js.map +1 -1
- package/daemon/dist/domain/claude-managed-launch.d.ts +22 -5
- package/daemon/dist/domain/claude-managed-launch.d.ts.map +1 -1
- package/daemon/dist/domain/claude-managed-launch.js +41 -5
- package/daemon/dist/domain/claude-managed-launch.js.map +1 -1
- package/daemon/dist/domain/claude-permission-rules.d.ts +3 -1
- package/daemon/dist/domain/claude-permission-rules.d.ts.map +1 -1
- package/daemon/dist/domain/claude-permission-rules.js +8 -7
- package/daemon/dist/domain/claude-permission-rules.js.map +1 -1
- package/daemon/dist/domain/claude-seat-token.d.ts +25 -1
- package/daemon/dist/domain/claude-seat-token.d.ts.map +1 -1
- package/daemon/dist/domain/claude-seat-token.js +56 -9
- package/daemon/dist/domain/claude-seat-token.js.map +1 -1
- package/daemon/dist/domain/codex-auth.d.ts +34 -0
- package/daemon/dist/domain/codex-auth.d.ts.map +1 -1
- package/daemon/dist/domain/codex-auth.js +212 -0
- package/daemon/dist/domain/codex-auth.js.map +1 -1
- package/daemon/dist/domain/codex-member-permissions.d.ts +17 -0
- package/daemon/dist/domain/codex-member-permissions.d.ts.map +1 -1
- package/daemon/dist/domain/codex-member-permissions.js +80 -0
- package/daemon/dist/domain/codex-member-permissions.js.map +1 -1
- package/daemon/dist/domain/community-harness-launch-result.d.ts +9 -0
- package/daemon/dist/domain/community-harness-launch-result.d.ts.map +1 -1
- package/daemon/dist/domain/community-harness-launch-result.js +14 -2
- package/daemon/dist/domain/community-harness-launch-result.js.map +1 -1
- package/daemon/dist/domain/community-harness-presets.d.ts +15 -0
- package/daemon/dist/domain/community-harness-presets.d.ts.map +1 -1
- package/daemon/dist/domain/community-harness-presets.js +82 -48
- package/daemon/dist/domain/community-harness-presets.js.map +1 -1
- package/daemon/dist/domain/compaction-restore-notice.d.ts +33 -5
- package/daemon/dist/domain/compaction-restore-notice.d.ts.map +1 -1
- package/daemon/dist/domain/compaction-restore-notice.js +221 -48
- package/daemon/dist/domain/compaction-restore-notice.js.map +1 -1
- package/daemon/dist/domain/context-usage-store.d.ts +1 -0
- package/daemon/dist/domain/context-usage-store.d.ts.map +1 -1
- package/daemon/dist/domain/context-usage-store.js +34 -3
- package/daemon/dist/domain/context-usage-store.js.map +1 -1
- package/daemon/dist/domain/crash-cart-detect.d.ts +7 -0
- package/daemon/dist/domain/crash-cart-detect.d.ts.map +1 -1
- package/daemon/dist/domain/crash-cart-detect.js +10 -5
- package/daemon/dist/domain/crash-cart-detect.js.map +1 -1
- package/daemon/dist/domain/crash-cart-discovery.d.ts +9 -16
- package/daemon/dist/domain/crash-cart-discovery.d.ts.map +1 -1
- package/daemon/dist/domain/crash-cart-discovery.js +22 -40
- package/daemon/dist/domain/crash-cart-discovery.js.map +1 -1
- package/daemon/dist/domain/crash-cart-emit.d.ts +1 -1
- package/daemon/dist/domain/crash-cart-emit.d.ts.map +1 -1
- package/daemon/dist/domain/crash-cart-emit.js +4 -0
- package/daemon/dist/domain/crash-cart-emit.js.map +1 -1
- package/daemon/dist/domain/current-park-arm.d.ts +2 -0
- package/daemon/dist/domain/current-park-arm.d.ts.map +1 -1
- package/daemon/dist/domain/current-park-arm.js +5 -0
- package/daemon/dist/domain/current-park-arm.js.map +1 -1
- package/daemon/dist/domain/current-work.d.ts +16 -4
- package/daemon/dist/domain/current-work.d.ts.map +1 -1
- package/daemon/dist/domain/current-work.js +3 -6
- package/daemon/dist/domain/current-work.js.map +1 -1
- package/daemon/dist/domain/cwd-resolution.d.ts +12 -1
- package/daemon/dist/domain/cwd-resolution.d.ts.map +1 -1
- package/daemon/dist/domain/cwd-resolution.js +39 -2
- package/daemon/dist/domain/cwd-resolution.js.map +1 -1
- package/daemon/dist/domain/draft-aware-delivery.d.ts +17 -2
- package/daemon/dist/domain/draft-aware-delivery.d.ts.map +1 -1
- package/daemon/dist/domain/draft-aware-delivery.js +98 -9
- package/daemon/dist/domain/draft-aware-delivery.js.map +1 -1
- package/daemon/dist/domain/draft-held-reoffer.d.ts +61 -0
- package/daemon/dist/domain/draft-held-reoffer.d.ts.map +1 -0
- package/daemon/dist/domain/draft-held-reoffer.js +143 -0
- package/daemon/dist/domain/draft-held-reoffer.js.map +1 -0
- package/daemon/dist/domain/execution-view.d.ts +20 -0
- package/daemon/dist/domain/execution-view.d.ts.map +1 -1
- package/daemon/dist/domain/execution-view.js +50 -16
- package/daemon/dist/domain/execution-view.js.map +1 -1
- package/daemon/dist/domain/gateway/destination-resolver.d.ts +10 -2
- package/daemon/dist/domain/gateway/destination-resolver.d.ts.map +1 -1
- package/daemon/dist/domain/gateway/destination-resolver.js +26 -3
- package/daemon/dist/domain/gateway/destination-resolver.js.map +1 -1
- package/daemon/dist/domain/gateway/slack/inbound.d.ts.map +1 -1
- package/daemon/dist/domain/gateway/slack/inbound.js +5 -4
- package/daemon/dist/domain/gateway/slack/inbound.js.map +1 -1
- package/daemon/dist/domain/gateway/slack/queue-access.js +1 -1
- package/daemon/dist/domain/gateway/slack/queue-access.js.map +1 -1
- package/daemon/dist/domain/generated-file-hygiene.d.ts.map +1 -1
- package/daemon/dist/domain/generated-file-hygiene.js +35 -2
- package/daemon/dist/domain/generated-file-hygiene.js.map +1 -1
- package/daemon/dist/domain/graph-projection.d.ts +7 -1
- package/daemon/dist/domain/graph-projection.d.ts.map +1 -1
- package/daemon/dist/domain/graph-projection.js +2 -0
- package/daemon/dist/domain/graph-projection.js.map +1 -1
- package/daemon/dist/domain/health-context-samples.d.ts +23 -0
- package/daemon/dist/domain/health-context-samples.d.ts.map +1 -0
- package/daemon/dist/domain/health-context-samples.js +113 -0
- package/daemon/dist/domain/health-context-samples.js.map +1 -0
- package/daemon/dist/domain/health-detectors.d.ts +3 -0
- package/daemon/dist/domain/health-detectors.d.ts.map +1 -1
- package/daemon/dist/domain/health-detectors.js +8 -7
- package/daemon/dist/domain/health-detectors.js.map +1 -1
- package/daemon/dist/domain/home-isolation.d.ts.map +1 -1
- package/daemon/dist/domain/home-isolation.js +21 -8
- package/daemon/dist/domain/home-isolation.js.map +1 -1
- package/daemon/dist/domain/hook-bridge.d.ts +7 -5
- package/daemon/dist/domain/hook-bridge.d.ts.map +1 -1
- package/daemon/dist/domain/hook-bridge.js +12 -11
- package/daemon/dist/domain/hook-bridge.js.map +1 -1
- package/daemon/dist/domain/kernel-boot-tracker.d.ts +7 -5
- package/daemon/dist/domain/kernel-boot-tracker.d.ts.map +1 -1
- package/daemon/dist/domain/kernel-boot-tracker.js +11 -6
- package/daemon/dist/domain/kernel-boot-tracker.js.map +1 -1
- package/daemon/dist/domain/kernel-boot.d.ts.map +1 -1
- package/daemon/dist/domain/kernel-boot.js +6 -2
- package/daemon/dist/domain/kernel-boot.js.map +1 -1
- package/daemon/dist/domain/kernel-hook-review.d.ts +10 -2
- package/daemon/dist/domain/kernel-hook-review.d.ts.map +1 -1
- package/daemon/dist/domain/kernel-hook-review.js +18 -4
- package/daemon/dist/domain/kernel-hook-review.js.map +1 -1
- package/daemon/dist/domain/managed-restore-read-access.d.ts +6 -2
- package/daemon/dist/domain/managed-restore-read-access.d.ts.map +1 -1
- package/daemon/dist/domain/managed-restore-read-access.js +35 -4
- package/daemon/dist/domain/managed-restore-read-access.js.map +1 -1
- package/daemon/dist/domain/mission-control/audit-browse.d.ts.map +1 -1
- package/daemon/dist/domain/mission-control/audit-browse.js +1 -0
- package/daemon/dist/domain/mission-control/audit-browse.js.map +1 -1
- package/daemon/dist/domain/mission-control/mission-control-action-log.d.ts +3 -1
- package/daemon/dist/domain/mission-control/mission-control-action-log.d.ts.map +1 -1
- package/daemon/dist/domain/mission-control/mission-control-action-log.js +7 -0
- package/daemon/dist/domain/mission-control/mission-control-action-log.js.map +1 -1
- package/daemon/dist/domain/mission-control/mission-control-write-contract.d.ts +3 -0
- 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 +56 -13
- package/daemon/dist/domain/mission-control/mission-control-write-contract.js.map +1 -1
- package/daemon/dist/domain/mission-control/notification-adapter-from-env.d.ts +8 -0
- package/daemon/dist/domain/mission-control/notification-adapter-from-env.d.ts.map +1 -0
- package/daemon/dist/domain/mission-control/notification-adapter-from-env.js +17 -0
- package/daemon/dist/domain/mission-control/notification-adapter-from-env.js.map +1 -0
- package/daemon/dist/domain/model-divergence/codex-thread-homes.d.ts +12 -0
- package/daemon/dist/domain/model-divergence/codex-thread-homes.d.ts.map +1 -0
- package/daemon/dist/domain/model-divergence/codex-thread-homes.js +19 -0
- package/daemon/dist/domain/model-divergence/codex-thread-homes.js.map +1 -0
- package/daemon/dist/domain/native-process-arguments.d.ts +6 -3
- package/daemon/dist/domain/native-process-arguments.d.ts.map +1 -1
- package/daemon/dist/domain/native-process-arguments.js +56 -23
- package/daemon/dist/domain/native-process-arguments.js.map +1 -1
- package/daemon/dist/domain/native-resume-probe.d.ts +9 -0
- package/daemon/dist/domain/native-resume-probe.d.ts.map +1 -1
- package/daemon/dist/domain/native-resume-probe.js +15 -1
- package/daemon/dist/domain/native-resume-probe.js.map +1 -1
- package/daemon/dist/domain/network/hub-client.d.ts +14 -4
- package/daemon/dist/domain/network/hub-client.d.ts.map +1 -1
- package/daemon/dist/domain/network/hub-client.js +26 -9
- package/daemon/dist/domain/network/hub-client.js.map +1 -1
- package/daemon/dist/domain/network/network-connector.d.ts +2 -0
- package/daemon/dist/domain/network/network-connector.d.ts.map +1 -1
- package/daemon/dist/domain/network/network-connector.js +162 -16
- package/daemon/dist/domain/network/network-connector.js.map +1 -1
- package/daemon/dist/domain/network/network-requests.d.ts +4 -1
- package/daemon/dist/domain/network/network-requests.d.ts.map +1 -1
- package/daemon/dist/domain/network/network-requests.js +141 -14
- package/daemon/dist/domain/network/network-requests.js.map +1 -1
- package/daemon/dist/domain/node-inventory.d.ts +47 -0
- package/daemon/dist/domain/node-inventory.d.ts.map +1 -1
- package/daemon/dist/domain/node-inventory.js +270 -158
- package/daemon/dist/domain/node-inventory.js.map +1 -1
- package/daemon/dist/domain/node-launcher.d.ts +1 -0
- package/daemon/dist/domain/node-launcher.d.ts.map +1 -1
- package/daemon/dist/domain/node-launcher.js +13 -5
- package/daemon/dist/domain/node-launcher.js.map +1 -1
- package/daemon/dist/domain/outbox-handler.d.ts +66 -0
- package/daemon/dist/domain/outbox-handler.d.ts.map +1 -1
- package/daemon/dist/domain/outbox-handler.js +117 -8
- package/daemon/dist/domain/outbox-handler.js.map +1 -1
- package/daemon/dist/domain/pane-cutover.d.ts +6 -2
- package/daemon/dist/domain/pane-cutover.d.ts.map +1 -1
- package/daemon/dist/domain/pane-cutover.js +14 -4
- package/daemon/dist/domain/pane-cutover.js.map +1 -1
- package/daemon/dist/domain/parked-owner-escalation.d.ts +1 -0
- package/daemon/dist/domain/parked-owner-escalation.d.ts.map +1 -1
- package/daemon/dist/domain/parked-owner-escalation.js +3 -1
- package/daemon/dist/domain/parked-owner-escalation.js.map +1 -1
- package/daemon/dist/domain/parked-query.js +1 -1
- package/daemon/dist/domain/parked-query.js.map +1 -1
- package/daemon/dist/domain/permission-account.d.ts.map +1 -1
- package/daemon/dist/domain/permission-account.js +20 -1
- package/daemon/dist/domain/permission-account.js.map +1 -1
- package/daemon/dist/domain/policies/idle-gate-qitem.d.ts +1 -0
- package/daemon/dist/domain/policies/idle-gate-qitem.d.ts.map +1 -1
- package/daemon/dist/domain/policies/idle-gate-qitem.js +1 -0
- package/daemon/dist/domain/policies/idle-gate-qitem.js.map +1 -1
- package/daemon/dist/domain/policies/parked-owner-consumer.d.ts +21 -0
- package/daemon/dist/domain/policies/parked-owner-consumer.d.ts.map +1 -1
- package/daemon/dist/domain/policies/parked-owner-consumer.js +185 -26
- package/daemon/dist/domain/policies/parked-owner-consumer.js.map +1 -1
- package/daemon/dist/domain/policies/seat-pool.d.ts +2 -1
- package/daemon/dist/domain/policies/seat-pool.d.ts.map +1 -1
- package/daemon/dist/domain/policies/seat-pool.js.map +1 -1
- package/daemon/dist/domain/policies/workflow-keepalive.d.ts +1 -0
- package/daemon/dist/domain/policies/workflow-keepalive.d.ts.map +1 -1
- package/daemon/dist/domain/policies/workflow-keepalive.js +4 -1
- package/daemon/dist/domain/policies/workflow-keepalive.js.map +1 -1
- package/daemon/dist/domain/profile-resolver.d.ts +2 -0
- package/daemon/dist/domain/profile-resolver.d.ts.map +1 -1
- package/daemon/dist/domain/profile-resolver.js +10 -4
- package/daemon/dist/domain/profile-resolver.js.map +1 -1
- package/daemon/dist/domain/project-lifecycle-compiler.d.ts.map +1 -1
- package/daemon/dist/domain/project-lifecycle-compiler.js +35 -1
- package/daemon/dist/domain/project-lifecycle-compiler.js.map +1 -1
- package/daemon/dist/domain/proof/judgments.d.ts +7 -0
- package/daemon/dist/domain/proof/judgments.d.ts.map +1 -1
- package/daemon/dist/domain/proof/judgments.js +18 -10
- package/daemon/dist/domain/proof/judgments.js.map +1 -1
- package/daemon/dist/domain/provider/assignment-apply.d.ts +85 -0
- package/daemon/dist/domain/provider/assignment-apply.d.ts.map +1 -0
- package/daemon/dist/domain/provider/assignment-apply.js +270 -0
- package/daemon/dist/domain/provider/assignment-apply.js.map +1 -0
- package/daemon/dist/domain/provider/assignment-plan.d.ts +150 -0
- package/daemon/dist/domain/provider/assignment-plan.d.ts.map +1 -0
- package/daemon/dist/domain/provider/assignment-plan.js +218 -0
- package/daemon/dist/domain/provider/assignment-plan.js.map +1 -0
- package/daemon/dist/domain/provider/claude-seat-switch.d.ts +1 -1
- package/daemon/dist/domain/provider/claude-seat-switch.d.ts.map +1 -1
- package/daemon/dist/domain/provider/claude-seat-switch.js +37 -6
- package/daemon/dist/domain/provider/claude-seat-switch.js.map +1 -1
- package/daemon/dist/domain/provider/provider-account-assignments.d.ts +64 -0
- package/daemon/dist/domain/provider/provider-account-assignments.d.ts.map +1 -0
- package/daemon/dist/domain/provider/provider-account-assignments.js +75 -0
- package/daemon/dist/domain/provider/provider-account-assignments.js.map +1 -0
- package/daemon/dist/domain/provider/provider-account-refs.d.ts +91 -0
- package/daemon/dist/domain/provider/provider-account-refs.d.ts.map +1 -0
- package/daemon/dist/domain/provider/provider-account-refs.js +164 -0
- package/daemon/dist/domain/provider/provider-account-refs.js.map +1 -0
- package/daemon/dist/domain/provider/provider-collect.d.ts +3 -1
- package/daemon/dist/domain/provider/provider-collect.d.ts.map +1 -1
- package/daemon/dist/domain/provider/provider-collect.js +2 -0
- package/daemon/dist/domain/provider/provider-collect.js.map +1 -1
- package/daemon/dist/domain/provider/provider-service-impl.d.ts +43 -1
- package/daemon/dist/domain/provider/provider-service-impl.d.ts.map +1 -1
- package/daemon/dist/domain/provider/provider-service-impl.js +376 -20
- package/daemon/dist/domain/provider/provider-service-impl.js.map +1 -1
- package/daemon/dist/domain/provider/provider-service.d.ts +82 -6
- package/daemon/dist/domain/provider/provider-service.d.ts.map +1 -1
- package/daemon/dist/domain/provider/provider-types.d.ts +40 -1
- package/daemon/dist/domain/provider/provider-types.d.ts.map +1 -1
- package/daemon/dist/domain/provider/usage-across-hosts.d.ts.map +1 -1
- package/daemon/dist/domain/provider/usage-across-hosts.js +13 -1
- package/daemon/dist/domain/provider/usage-across-hosts.js.map +1 -1
- package/daemon/dist/domain/ps-projection.d.ts +5 -3
- package/daemon/dist/domain/ps-projection.d.ts.map +1 -1
- package/daemon/dist/domain/ps-projection.js +10 -3
- package/daemon/dist/domain/ps-projection.js.map +1 -1
- package/daemon/dist/domain/queue-display.d.ts +7 -0
- package/daemon/dist/domain/queue-display.d.ts.map +1 -0
- package/daemon/dist/domain/queue-display.js +20 -0
- package/daemon/dist/domain/queue-display.js.map +1 -0
- package/daemon/dist/domain/queue-owner.d.ts +4 -2
- package/daemon/dist/domain/queue-owner.d.ts.map +1 -1
- package/daemon/dist/domain/queue-owner.js +7 -5
- package/daemon/dist/domain/queue-owner.js.map +1 -1
- package/daemon/dist/domain/queue-repository.d.ts +104 -24
- package/daemon/dist/domain/queue-repository.d.ts.map +1 -1
- package/daemon/dist/domain/queue-repository.js +600 -89
- package/daemon/dist/domain/queue-repository.js.map +1 -1
- package/daemon/dist/domain/queue-stuck-sweep.d.ts +4 -0
- package/daemon/dist/domain/queue-stuck-sweep.d.ts.map +1 -1
- package/daemon/dist/domain/queue-stuck-sweep.js +1890 -1817
- package/daemon/dist/domain/queue-stuck-sweep.js.map +1 -1
- package/daemon/dist/domain/queue-transfer-activation.d.ts +28 -0
- package/daemon/dist/domain/queue-transfer-activation.d.ts.map +1 -0
- package/daemon/dist/domain/queue-transfer-activation.js +187 -0
- package/daemon/dist/domain/queue-transfer-activation.js.map +1 -0
- package/daemon/dist/domain/queue-transfer-mapping.d.ts +31 -0
- package/daemon/dist/domain/queue-transfer-mapping.d.ts.map +1 -0
- package/daemon/dist/domain/queue-transfer-mapping.js +33 -0
- package/daemon/dist/domain/queue-transfer-mapping.js.map +1 -0
- package/daemon/dist/domain/queue-transfer-operation.d.ts +24 -0
- package/daemon/dist/domain/queue-transfer-operation.d.ts.map +1 -0
- package/daemon/dist/domain/queue-transfer-operation.js +41 -0
- package/daemon/dist/domain/queue-transfer-operation.js.map +1 -0
- package/daemon/dist/domain/queue-transfer-parse.d.ts +8 -0
- package/daemon/dist/domain/queue-transfer-parse.d.ts.map +1 -1
- package/daemon/dist/domain/queue-transfer-parse.js +16 -6
- package/daemon/dist/domain/queue-transfer-parse.js.map +1 -1
- package/daemon/dist/domain/queue-transfer-records.d.ts +160 -0
- package/daemon/dist/domain/queue-transfer-records.d.ts.map +1 -0
- package/daemon/dist/domain/queue-transfer-records.js +94 -0
- package/daemon/dist/domain/queue-transfer-records.js.map +1 -0
- package/daemon/dist/domain/queue-transfer-recovery.d.ts +40 -0
- package/daemon/dist/domain/queue-transfer-recovery.d.ts.map +1 -0
- package/daemon/dist/domain/queue-transfer-recovery.js +136 -0
- package/daemon/dist/domain/queue-transfer-recovery.js.map +1 -0
- package/daemon/dist/domain/queue-transfer-relinquish.d.ts +70 -0
- package/daemon/dist/domain/queue-transfer-relinquish.d.ts.map +1 -0
- package/daemon/dist/domain/queue-transfer-relinquish.js +204 -0
- package/daemon/dist/domain/queue-transfer-relinquish.js.map +1 -0
- package/daemon/dist/domain/queue-transfer-review.d.ts +1 -0
- package/daemon/dist/domain/queue-transfer-review.d.ts.map +1 -1
- package/daemon/dist/domain/queue-transfer-review.js +15 -13
- package/daemon/dist/domain/queue-transfer-review.js.map +1 -1
- package/daemon/dist/domain/queue-transfer-staging.d.ts +14 -0
- package/daemon/dist/domain/queue-transfer-staging.d.ts.map +1 -1
- package/daemon/dist/domain/queue-transfer-staging.js +9 -1
- package/daemon/dist/domain/queue-transfer-staging.js.map +1 -1
- package/daemon/dist/domain/queue-transfer-write.d.ts +14 -0
- package/daemon/dist/domain/queue-transfer-write.d.ts.map +1 -0
- package/daemon/dist/domain/queue-transfer-write.js +42 -0
- package/daemon/dist/domain/queue-transfer-write.js.map +1 -0
- package/daemon/dist/domain/queue-transition-log.d.ts +8 -0
- package/daemon/dist/domain/queue-transition-log.d.ts.map +1 -1
- package/daemon/dist/domain/queue-transition-log.js +27 -14
- package/daemon/dist/domain/queue-transition-log.js.map +1 -1
- package/daemon/dist/domain/queue-waiting.d.ts +10 -1
- package/daemon/dist/domain/queue-waiting.d.ts.map +1 -1
- package/daemon/dist/domain/queue-waiting.js +20 -14
- package/daemon/dist/domain/queue-waiting.js.map +1 -1
- package/daemon/dist/domain/queue-wake-ladder.d.ts +10 -3
- package/daemon/dist/domain/queue-wake-ladder.d.ts.map +1 -1
- package/daemon/dist/domain/queue-wake-ladder.js +60 -23
- package/daemon/dist/domain/queue-wake-ladder.js.map +1 -1
- package/daemon/dist/domain/queue-wake-repository.d.ts +1 -0
- package/daemon/dist/domain/queue-wake-repository.d.ts.map +1 -1
- package/daemon/dist/domain/queue-wake-repository.js +21 -19
- package/daemon/dist/domain/queue-wake-repository.js.map +1 -1
- package/daemon/dist/domain/receiver-context.d.ts +3 -2
- package/daemon/dist/domain/receiver-context.d.ts.map +1 -1
- package/daemon/dist/domain/receiver-context.js +5 -4
- package/daemon/dist/domain/receiver-context.js.map +1 -1
- package/daemon/dist/domain/reconciler.d.ts +2 -0
- package/daemon/dist/domain/reconciler.d.ts.map +1 -1
- package/daemon/dist/domain/reconciler.js +17 -1
- package/daemon/dist/domain/reconciler.js.map +1 -1
- package/daemon/dist/domain/relayed-answers.d.ts +1 -0
- package/daemon/dist/domain/relayed-answers.d.ts.map +1 -1
- package/daemon/dist/domain/relayed-answers.js.map +1 -1
- package/daemon/dist/domain/restore-check-service.d.ts.map +1 -1
- package/daemon/dist/domain/restore-check-service.js +9 -3
- package/daemon/dist/domain/restore-check-service.js.map +1 -1
- package/daemon/dist/domain/restore-orchestrator.d.ts +7 -0
- package/daemon/dist/domain/restore-orchestrator.d.ts.map +1 -1
- package/daemon/dist/domain/restore-orchestrator.js +54 -14
- package/daemon/dist/domain/restore-orchestrator.js.map +1 -1
- package/daemon/dist/domain/return-route.d.ts +4 -0
- package/daemon/dist/domain/return-route.d.ts.map +1 -1
- package/daemon/dist/domain/return-route.js +13 -0
- package/daemon/dist/domain/return-route.js.map +1 -1
- package/daemon/dist/domain/rig-mode/operating-posture.d.ts +3 -0
- package/daemon/dist/domain/rig-mode/operating-posture.d.ts.map +1 -1
- package/daemon/dist/domain/rig-mode/operating-posture.js +27 -8
- package/daemon/dist/domain/rig-mode/operating-posture.js.map +1 -1
- package/daemon/dist/domain/rig-status-compose.d.ts +3 -0
- package/daemon/dist/domain/rig-status-compose.d.ts.map +1 -1
- package/daemon/dist/domain/rig-status-compose.js +4 -1
- package/daemon/dist/domain/rig-status-compose.js.map +1 -1
- package/daemon/dist/domain/rig-teardown.d.ts.map +1 -1
- package/daemon/dist/domain/rig-teardown.js +3 -2
- package/daemon/dist/domain/rig-teardown.js.map +1 -1
- package/daemon/dist/domain/rigspec-exporter.d.ts +2 -0
- package/daemon/dist/domain/rigspec-exporter.d.ts.map +1 -1
- package/daemon/dist/domain/rigspec-exporter.js +38 -2
- package/daemon/dist/domain/rigspec-exporter.js.map +1 -1
- package/daemon/dist/domain/rigspec-instantiator.d.ts +4 -1
- package/daemon/dist/domain/rigspec-instantiator.d.ts.map +1 -1
- package/daemon/dist/domain/rigspec-instantiator.js +32 -13
- package/daemon/dist/domain/rigspec-instantiator.js.map +1 -1
- package/daemon/dist/domain/rigspec-preflight.d.ts +3 -0
- package/daemon/dist/domain/rigspec-preflight.d.ts.map +1 -1
- package/daemon/dist/domain/rigspec-preflight.js +25 -7
- package/daemon/dist/domain/rigspec-preflight.js.map +1 -1
- package/daemon/dist/domain/roster-ready-notice.d.ts +1 -1
- package/daemon/dist/domain/roster-ready-notice.d.ts.map +1 -1
- package/daemon/dist/domain/roster-ready-notice.js +2 -1
- package/daemon/dist/domain/roster-ready-notice.js.map +1 -1
- package/daemon/dist/domain/runner-permissions.d.ts +3 -2
- package/daemon/dist/domain/runner-permissions.d.ts.map +1 -1
- package/daemon/dist/domain/runner-permissions.js +30 -19
- package/daemon/dist/domain/runner-permissions.js.map +1 -1
- package/daemon/dist/domain/runtime-adapter.d.ts +2 -0
- package/daemon/dist/domain/runtime-adapter.d.ts.map +1 -1
- package/daemon/dist/domain/runtime-adapter.js.map +1 -1
- package/daemon/dist/domain/scope/manifest-editor.d.ts +35 -0
- package/daemon/dist/domain/scope/manifest-editor.d.ts.map +1 -0
- package/daemon/dist/domain/scope/manifest-editor.js +197 -0
- package/daemon/dist/domain/scope/manifest-editor.js.map +1 -0
- package/daemon/dist/domain/scope/mission-frontmatter.d.ts +9 -0
- package/daemon/dist/domain/scope/mission-frontmatter.d.ts.map +1 -0
- package/daemon/dist/domain/scope/mission-frontmatter.js +36 -0
- package/daemon/dist/domain/scope/mission-frontmatter.js.map +1 -0
- package/daemon/dist/domain/seat-activity-service.d.ts.map +1 -1
- package/daemon/dist/domain/seat-activity-service.js +53 -20
- package/daemon/dist/domain/seat-activity-service.js.map +1 -1
- package/daemon/dist/domain/seat-cold-start.d.ts +8 -2
- package/daemon/dist/domain/seat-cold-start.d.ts.map +1 -1
- package/daemon/dist/domain/seat-cold-start.js +75 -19
- package/daemon/dist/domain/seat-cold-start.js.map +1 -1
- package/daemon/dist/domain/seat-delivery-guard.d.ts +6 -1
- package/daemon/dist/domain/seat-delivery-guard.d.ts.map +1 -1
- package/daemon/dist/domain/seat-delivery-guard.js +23 -2
- package/daemon/dist/domain/seat-delivery-guard.js.map +1 -1
- package/daemon/dist/domain/seat-evidence.d.ts +13 -0
- package/daemon/dist/domain/seat-evidence.d.ts.map +1 -0
- package/daemon/dist/domain/seat-evidence.js +29 -0
- package/daemon/dist/domain/seat-evidence.js.map +1 -0
- package/daemon/dist/domain/seat-handover-service.d.ts +5 -1
- package/daemon/dist/domain/seat-handover-service.d.ts.map +1 -1
- package/daemon/dist/domain/seat-handover-service.js +49 -35
- package/daemon/dist/domain/seat-handover-service.js.map +1 -1
- package/daemon/dist/domain/seat-lifecycle-service.d.ts +26 -6
- package/daemon/dist/domain/seat-lifecycle-service.d.ts.map +1 -1
- package/daemon/dist/domain/seat-lifecycle-service.js +108 -17
- package/daemon/dist/domain/seat-lifecycle-service.js.map +1 -1
- package/daemon/dist/domain/seat-pool-dispatch-guard.d.ts +28 -0
- package/daemon/dist/domain/seat-pool-dispatch-guard.d.ts.map +1 -0
- package/daemon/dist/domain/seat-pool-dispatch-guard.js +123 -0
- package/daemon/dist/domain/seat-pool-dispatch-guard.js.map +1 -0
- package/daemon/dist/domain/seat-pool-executor.d.ts +64 -3
- package/daemon/dist/domain/seat-pool-executor.d.ts.map +1 -1
- package/daemon/dist/domain/seat-pool-executor.js +993 -102
- package/daemon/dist/domain/seat-pool-executor.js.map +1 -1
- package/daemon/dist/domain/seat-pool-slots.d.ts +90 -2
- package/daemon/dist/domain/seat-pool-slots.d.ts.map +1 -1
- package/daemon/dist/domain/seat-pool-slots.js +88 -3
- package/daemon/dist/domain/seat-pool-slots.js.map +1 -1
- package/daemon/dist/domain/seat-pool-spec.d.ts +4 -1
- package/daemon/dist/domain/seat-pool-spec.d.ts.map +1 -1
- package/daemon/dist/domain/seat-pool-spec.js +14 -2
- package/daemon/dist/domain/seat-pool-spec.js.map +1 -1
- package/daemon/dist/domain/seat-reaper-eligibility.d.ts +34 -0
- package/daemon/dist/domain/seat-reaper-eligibility.d.ts.map +1 -0
- package/daemon/dist/domain/seat-reaper-eligibility.js +30 -0
- package/daemon/dist/domain/seat-reaper-eligibility.js.map +1 -0
- package/daemon/dist/domain/seat-reaper-events.d.ts +31 -0
- package/daemon/dist/domain/seat-reaper-events.d.ts.map +1 -0
- package/daemon/dist/domain/seat-reaper-events.js +2 -0
- package/daemon/dist/domain/seat-reaper-events.js.map +1 -0
- package/daemon/dist/domain/seat-reaper-service.d.ts +59 -0
- package/daemon/dist/domain/seat-reaper-service.d.ts.map +1 -0
- package/daemon/dist/domain/seat-reaper-service.js +311 -0
- package/daemon/dist/domain/seat-reaper-service.js.map +1 -0
- package/daemon/dist/domain/seat-reaper-settings.d.ts +14 -0
- package/daemon/dist/domain/seat-reaper-settings.d.ts.map +1 -0
- package/daemon/dist/domain/seat-reaper-settings.js +32 -0
- package/daemon/dist/domain/seat-reaper-settings.js.map +1 -0
- package/daemon/dist/domain/seat-reaper-store.d.ts +19 -0
- package/daemon/dist/domain/seat-reaper-store.d.ts.map +1 -0
- package/daemon/dist/domain/seat-reaper-store.js +45 -0
- package/daemon/dist/domain/seat-reaper-store.js.map +1 -0
- package/daemon/dist/domain/seat-reaper-workspace.d.ts +4 -0
- package/daemon/dist/domain/seat-reaper-workspace.d.ts.map +1 -0
- package/daemon/dist/domain/seat-reaper-workspace.js +43 -0
- package/daemon/dist/domain/seat-reaper-workspace.js.map +1 -0
- package/daemon/dist/domain/seat-restart-in-place.d.ts +11 -3
- package/daemon/dist/domain/seat-restart-in-place.d.ts.map +1 -1
- package/daemon/dist/domain/seat-restart-in-place.js +39 -48
- package/daemon/dist/domain/seat-restart-in-place.js.map +1 -1
- package/daemon/dist/domain/seat-runtime-switch-service.d.ts.map +1 -1
- package/daemon/dist/domain/seat-runtime-switch-service.js +5 -7
- package/daemon/dist/domain/seat-runtime-switch-service.js.map +1 -1
- package/daemon/dist/domain/seat-skill-storage.d.ts.map +1 -1
- package/daemon/dist/domain/seat-skill-storage.js +27 -5
- package/daemon/dist/domain/seat-skill-storage.js.map +1 -1
- package/daemon/dist/domain/seat-standby.d.ts +13 -0
- package/daemon/dist/domain/seat-standby.d.ts.map +1 -0
- package/daemon/dist/domain/seat-standby.js +21 -0
- package/daemon/dist/domain/seat-standby.js.map +1 -0
- package/daemon/dist/domain/seat-startup-text.d.ts +159 -0
- package/daemon/dist/domain/seat-startup-text.d.ts.map +1 -0
- package/daemon/dist/domain/seat-startup-text.js +200 -0
- package/daemon/dist/domain/seat-startup-text.js.map +1 -0
- package/daemon/dist/domain/seat-status-service.d.ts +18 -0
- package/daemon/dist/domain/seat-status-service.d.ts.map +1 -1
- package/daemon/dist/domain/seat-status-service.js +25 -5
- package/daemon/dist/domain/seat-status-service.js.map +1 -1
- package/daemon/dist/domain/seat-structural-activity-service.d.ts +7 -0
- package/daemon/dist/domain/seat-structural-activity-service.d.ts.map +1 -1
- package/daemon/dist/domain/seat-structural-activity-service.js +16 -1
- package/daemon/dist/domain/seat-structural-activity-service.js.map +1 -1
- package/daemon/dist/domain/session-registry.d.ts +15 -3
- package/daemon/dist/domain/session-registry.d.ts.map +1 -1
- package/daemon/dist/domain/session-registry.js +52 -5
- package/daemon/dist/domain/session-registry.js.map +1 -1
- package/daemon/dist/domain/session-transport.d.ts +12 -5
- package/daemon/dist/domain/session-transport.d.ts.map +1 -1
- package/daemon/dist/domain/session-transport.js +129 -18
- package/daemon/dist/domain/session-transport.js.map +1 -1
- package/daemon/dist/domain/shared-conversation.d.ts.map +1 -1
- package/daemon/dist/domain/shared-conversation.js +3 -1
- package/daemon/dist/domain/shared-conversation.js.map +1 -1
- package/daemon/dist/domain/slices/slice-indexer.d.ts +2 -2
- package/daemon/dist/domain/slices/slice-indexer.d.ts.map +1 -1
- package/daemon/dist/domain/slices/slice-indexer.js +4 -15
- package/daemon/dist/domain/slices/slice-indexer.js.map +1 -1
- package/daemon/dist/domain/snapshot-capture.d.ts +4 -1
- package/daemon/dist/domain/snapshot-capture.d.ts.map +1 -1
- package/daemon/dist/domain/snapshot-capture.js +14 -18
- package/daemon/dist/domain/snapshot-capture.js.map +1 -1
- package/daemon/dist/domain/snapshot-repository.d.ts +37 -0
- package/daemon/dist/domain/snapshot-repository.d.ts.map +1 -1
- package/daemon/dist/domain/snapshot-repository.js +68 -0
- package/daemon/dist/domain/snapshot-repository.js.map +1 -1
- package/daemon/dist/domain/startup-orchestrator.d.ts +8 -20
- package/daemon/dist/domain/startup-orchestrator.d.ts.map +1 -1
- package/daemon/dist/domain/startup-orchestrator.js +94 -27
- package/daemon/dist/domain/startup-orchestrator.js.map +1 -1
- package/daemon/dist/domain/startup-submission-evidence.d.ts +4 -1
- package/daemon/dist/domain/startup-submission-evidence.d.ts.map +1 -1
- package/daemon/dist/domain/startup-submission-evidence.js +12 -1
- package/daemon/dist/domain/startup-submission-evidence.js.map +1 -1
- package/daemon/dist/domain/successor-session-launcher.d.ts +9 -5
- package/daemon/dist/domain/successor-session-launcher.d.ts.map +1 -1
- package/daemon/dist/domain/successor-session-launcher.js +17 -6
- package/daemon/dist/domain/successor-session-launcher.js.map +1 -1
- package/daemon/dist/domain/terminal/earlier-tile-attach-0724.d.ts +2 -0
- package/daemon/dist/domain/terminal/earlier-tile-attach-0724.d.ts.map +1 -0
- package/daemon/dist/domain/terminal/earlier-tile-attach-0724.js +54 -0
- package/daemon/dist/domain/terminal/earlier-tile-attach-0724.js.map +1 -0
- package/daemon/dist/domain/terminal/herdr-app-provider.d.ts +28 -3
- package/daemon/dist/domain/terminal/herdr-app-provider.d.ts.map +1 -1
- package/daemon/dist/domain/terminal/herdr-app-provider.js +216 -52
- package/daemon/dist/domain/terminal/herdr-app-provider.js.map +1 -1
- package/daemon/dist/domain/terminal/herdr-app-state.d.ts +7 -2
- package/daemon/dist/domain/terminal/herdr-app-state.d.ts.map +1 -1
- package/daemon/dist/domain/terminal/herdr-app-state.js.map +1 -1
- package/daemon/dist/domain/terminal/terminal-provider.d.ts +17 -0
- package/daemon/dist/domain/terminal/terminal-provider.d.ts.map +1 -1
- package/daemon/dist/domain/terminal/tile-attach.d.ts +4 -4
- package/daemon/dist/domain/terminal/tile-attach.d.ts.map +1 -1
- package/daemon/dist/domain/terminal/tile-attach.js +14 -8
- package/daemon/dist/domain/terminal/tile-attach.js.map +1 -1
- package/daemon/dist/domain/types.d.ts +71 -4
- package/daemon/dist/domain/types.d.ts.map +1 -1
- package/daemon/dist/domain/types.js.map +1 -1
- package/daemon/dist/domain/usage-samples-store.d.ts.map +1 -1
- package/daemon/dist/domain/usage-samples-store.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 +45 -2
- package/daemon/dist/domain/user-settings/settings-store.js.map +1 -1
- package/daemon/dist/domain/view-projector.d.ts.map +1 -1
- package/daemon/dist/domain/view-projector.js +5 -2
- package/daemon/dist/domain/view-projector.js.map +1 -1
- package/daemon/dist/domain/watchdog-delivery.d.ts +3 -0
- package/daemon/dist/domain/watchdog-delivery.d.ts.map +1 -1
- package/daemon/dist/domain/watchdog-delivery.js +26 -4
- package/daemon/dist/domain/watchdog-delivery.js.map +1 -1
- package/daemon/dist/domain/watchdog-history-log.d.ts +10 -0
- package/daemon/dist/domain/watchdog-history-log.d.ts.map +1 -1
- package/daemon/dist/domain/watchdog-history-log.js +35 -1
- package/daemon/dist/domain/watchdog-history-log.js.map +1 -1
- package/daemon/dist/domain/watchdog-job-update.d.ts.map +1 -1
- package/daemon/dist/domain/watchdog-job-update.js +29 -4
- package/daemon/dist/domain/watchdog-job-update.js.map +1 -1
- package/daemon/dist/domain/watchdog-policy-engine.d.ts.map +1 -1
- package/daemon/dist/domain/watchdog-policy-engine.js +4 -1
- package/daemon/dist/domain/watchdog-policy-engine.js.map +1 -1
- package/daemon/dist/domain/watchdog-scheduler.d.ts +4 -0
- package/daemon/dist/domain/watchdog-scheduler.d.ts.map +1 -1
- package/daemon/dist/domain/watchdog-scheduler.js +14 -0
- package/daemon/dist/domain/watchdog-scheduler.js.map +1 -1
- package/daemon/dist/domain/workflow-role-context.d.ts.map +1 -1
- package/daemon/dist/domain/workflow-role-context.js +1 -0
- package/daemon/dist/domain/workflow-role-context.js.map +1 -1
- package/daemon/dist/domain/workflow-role-resolver.d.ts +3 -0
- package/daemon/dist/domain/workflow-role-resolver.d.ts.map +1 -1
- package/daemon/dist/domain/workflow-role-resolver.js +12 -6
- package/daemon/dist/domain/workflow-role-resolver.js.map +1 -1
- package/daemon/dist/domain/workspace/project-catalog.d.ts +7 -0
- package/daemon/dist/domain/workspace/project-catalog.d.ts.map +1 -1
- package/daemon/dist/domain/workspace/project-catalog.js +16 -9
- package/daemon/dist/domain/workspace/project-catalog.js.map +1 -1
- package/daemon/dist/domain/workspace/project-registration.d.ts +5 -1
- package/daemon/dist/domain/workspace/project-registration.d.ts.map +1 -1
- package/daemon/dist/domain/workspace/project-registration.js +11 -7
- package/daemon/dist/domain/workspace/project-registration.js.map +1 -1
- package/daemon/dist/index.d.ts +3 -0
- package/daemon/dist/index.d.ts.map +1 -1
- package/daemon/dist/index.js +14 -4
- package/daemon/dist/index.js.map +1 -1
- package/daemon/dist/middleware/auth-bearer-token.d.ts +8 -12
- package/daemon/dist/middleware/auth-bearer-token.d.ts.map +1 -1
- package/daemon/dist/middleware/auth-bearer-token.js +18 -36
- package/daemon/dist/middleware/auth-bearer-token.js.map +1 -1
- package/daemon/dist/queue-transfer-records-surface.d.ts +6 -0
- package/daemon/dist/queue-transfer-records-surface.d.ts.map +1 -0
- package/daemon/dist/queue-transfer-records-surface.js +6 -0
- package/daemon/dist/queue-transfer-records-surface.js.map +1 -0
- package/daemon/dist/rig-lookup-surface.d.ts +2 -0
- package/daemon/dist/rig-lookup-surface.d.ts.map +1 -0
- package/daemon/dist/rig-lookup-surface.js +5 -0
- package/daemon/dist/rig-lookup-surface.js.map +1 -0
- package/daemon/dist/routes/activity.d.ts.map +1 -1
- package/daemon/dist/routes/activity.js +4 -3
- package/daemon/dist/routes/activity.js.map +1 -1
- package/daemon/dist/routes/attention.d.ts.map +1 -1
- package/daemon/dist/routes/attention.js +3 -1
- package/daemon/dist/routes/attention.js.map +1 -1
- package/daemon/dist/routes/compaction.d.ts.map +1 -1
- package/daemon/dist/routes/compaction.js +2 -0
- package/daemon/dist/routes/compaction.js.map +1 -1
- package/daemon/dist/routes/mission-control.d.ts.map +1 -1
- package/daemon/dist/routes/mission-control.js +2 -1
- package/daemon/dist/routes/mission-control.js.map +1 -1
- package/daemon/dist/routes/missions.d.ts +3 -6
- package/daemon/dist/routes/missions.d.ts.map +1 -1
- package/daemon/dist/routes/missions.js +42 -76
- package/daemon/dist/routes/missions.js.map +1 -1
- package/daemon/dist/routes/network.d.ts.map +1 -1
- package/daemon/dist/routes/network.js +19 -1
- package/daemon/dist/routes/network.js.map +1 -1
- package/daemon/dist/routes/provider.d.ts.map +1 -1
- package/daemon/dist/routes/provider.js +156 -5
- package/daemon/dist/routes/provider.js.map +1 -1
- package/daemon/dist/routes/queue-transfer.d.ts +9 -0
- package/daemon/dist/routes/queue-transfer.d.ts.map +1 -0
- package/daemon/dist/routes/queue-transfer.js +109 -0
- package/daemon/dist/routes/queue-transfer.js.map +1 -0
- package/daemon/dist/routes/queue.d.ts.map +1 -1
- package/daemon/dist/routes/queue.js +80 -51
- package/daemon/dist/routes/queue.js.map +1 -1
- package/daemon/dist/routes/rigs.js +3 -0
- package/daemon/dist/routes/rigs.js.map +1 -1
- package/daemon/dist/routes/rigspec.d.ts.map +1 -1
- package/daemon/dist/routes/rigspec.js +4 -0
- package/daemon/dist/routes/rigspec.js.map +1 -1
- package/daemon/dist/routes/seat.d.ts.map +1 -1
- package/daemon/dist/routes/seat.js +19 -3
- package/daemon/dist/routes/seat.js.map +1 -1
- package/daemon/dist/routes/terminal-ws.d.ts +0 -5
- package/daemon/dist/routes/terminal-ws.d.ts.map +1 -1
- package/daemon/dist/routes/terminal-ws.js +0 -6
- package/daemon/dist/routes/terminal-ws.js.map +1 -1
- package/daemon/dist/routes/transport.js +1 -1
- package/daemon/dist/routes/transport.js.map +1 -1
- package/daemon/dist/scope-manifest-surface.d.ts +4 -0
- package/daemon/dist/scope-manifest-surface.d.ts.map +1 -0
- package/daemon/dist/scope-manifest-surface.js +4 -0
- package/daemon/dist/scope-manifest-surface.js.map +1 -0
- package/daemon/dist/server.d.ts +2 -1
- package/daemon/dist/server.d.ts.map +1 -1
- package/daemon/dist/server.js +6 -6
- package/daemon/dist/server.js.map +1 -1
- package/daemon/dist/startup.d.ts.map +1 -1
- package/daemon/dist/startup.js +126 -61
- package/daemon/dist/startup.js.map +1 -1
- package/daemon/docs/reference/agent-startup-guide.md +26 -4
- package/daemon/docs/reference/agent-state-taxonomy.md +22 -1
- package/daemon/docs/reference/claude-status-line.md +28 -0
- package/daemon/docs/reference/community-harness-examples/hermes/hermes.yaml +3 -0
- package/daemon/docs/reference/community-harness-examples/hermes/openrig-hermes-launch +10 -0
- package/daemon/docs/reference/community-harness-presets.md +79 -8
- package/daemon/docs/reference/daemon-http-clients.md +49 -2
- package/daemon/docs/reference/getting-started.md +73 -11
- package/daemon/docs/reference/harness-runner-contract.md +12 -4
- package/daemon/docs/reference/help.md +9 -0
- package/daemon/docs/reference/herdr-app.md +45 -4
- package/daemon/docs/reference/hosted-members.md +1 -1
- package/daemon/docs/reference/network-connector.md +66 -1
- package/daemon/docs/reference/pi-tool-selection-recovery.md +13 -29
- package/daemon/docs/reference/queue-transfer-activation.md +89 -0
- package/daemon/docs/reference/queue-transfer-staging.md +1 -1
- package/daemon/docs/reference/quickstart.md +4 -4
- package/daemon/docs/reference/refocus-channel.md +21 -0
- package/daemon/docs/reference/rig-bundle.md +25 -0
- package/daemon/docs/reference/rig-spec.md +218 -23
- package/daemon/docs/reference/scoped-operating-posture.md +6 -1
- package/daemon/docs/reference/sdlc-conventions.md +10 -4
- package/daemon/docs/reference/seat-delivery.md +108 -12
- package/daemon/docs/reference/seat-node-targeting.md +2 -2
- package/daemon/docs/reference/seat-pools.md +181 -18
- package/daemon/docs/reference/seat-scaling.md +137 -0
- package/daemon/docs/reference/whats-new.md +190 -14
- package/daemon/specs/agents/development/implementer/guidance/role.md +11 -0
- package/daemon/specs/agents/development/qa/guidance/role.md +5 -0
- package/daemon/specs/agents/shared/skills/core/cross-host-rig-commands/SKILL.md +9 -1
- package/daemon/specs/agents/shared/skills/core/working-with-an-openrig-team/SKILL.md +32 -19
- package/daemon/specs/rigs/launch/kernel/agents/operator/agent/guidance/role.md +8 -3
- package/dist/build-info.js +3 -3
- package/dist/cli-error.d.ts +2 -0
- package/dist/cli-error.d.ts.map +1 -1
- package/dist/cli-error.js +25 -8
- package/dist/cli-error.js.map +1 -1
- package/dist/client.d.ts +1 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +13 -0
- package/dist/client.js.map +1 -1
- package/dist/commands/auth.d.ts.map +1 -1
- package/dist/commands/auth.js +52 -1
- package/dist/commands/auth.js.map +1 -1
- package/dist/commands/config.d.ts.map +1 -1
- package/dist/commands/config.js +3 -0
- package/dist/commands/config.js.map +1 -1
- package/dist/commands/crash-cart.d.ts.map +1 -1
- package/dist/commands/crash-cart.js +65 -17
- package/dist/commands/crash-cart.js.map +1 -1
- package/dist/commands/daemon.d.ts +7 -20
- package/dist/commands/daemon.d.ts.map +1 -1
- package/dist/commands/daemon.js +117 -46
- package/dist/commands/daemon.js.map +1 -1
- package/dist/commands/doctor.d.ts +26 -0
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +148 -2
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/import.d.ts +5 -0
- package/dist/commands/import.d.ts.map +1 -1
- package/dist/commands/import.js +24 -4
- package/dist/commands/import.js.map +1 -1
- package/dist/commands/mcp.d.ts.map +1 -1
- package/dist/commands/mcp.js +4 -2
- package/dist/commands/mcp.js.map +1 -1
- package/dist/commands/network.d.ts +4 -0
- package/dist/commands/network.d.ts.map +1 -1
- package/dist/commands/network.js +78 -10
- package/dist/commands/network.js.map +1 -1
- package/dist/commands/provider.d.ts +5 -1
- package/dist/commands/provider.d.ts.map +1 -1
- package/dist/commands/provider.js +427 -17
- package/dist/commands/provider.js.map +1 -1
- package/dist/commands/ps.d.ts +16 -1
- package/dist/commands/ps.d.ts.map +1 -1
- package/dist/commands/ps.js +35 -4
- package/dist/commands/ps.js.map +1 -1
- package/dist/commands/queue-transfer.d.ts +10 -0
- package/dist/commands/queue-transfer.d.ts.map +1 -0
- package/dist/commands/queue-transfer.js +140 -0
- package/dist/commands/queue-transfer.js.map +1 -0
- package/dist/commands/queue.d.ts.map +1 -1
- package/dist/commands/queue.js +20 -6
- package/dist/commands/queue.js.map +1 -1
- package/dist/commands/scope.d.ts.map +1 -1
- package/dist/commands/scope.js +258 -17
- package/dist/commands/scope.js.map +1 -1
- package/dist/commands/seat.d.ts.map +1 -1
- package/dist/commands/seat.js +132 -23
- package/dist/commands/seat.js.map +1 -1
- package/dist/commands/setup.d.ts +34 -0
- package/dist/commands/setup.d.ts.map +1 -1
- package/dist/commands/setup.js +111 -18
- package/dist/commands/setup.js.map +1 -1
- package/dist/commands/terminal.d.ts +11 -0
- package/dist/commands/terminal.d.ts.map +1 -1
- package/dist/commands/terminal.js +10 -7
- package/dist/commands/terminal.js.map +1 -1
- package/dist/config-store.d.ts +9 -1
- package/dist/config-store.d.ts.map +1 -1
- package/dist/config-store.js +46 -0
- package/dist/config-store.js.map +1 -1
- package/dist/daemon-lifecycle.d.ts +53 -2
- package/dist/daemon-lifecycle.d.ts.map +1 -1
- package/dist/daemon-lifecycle.js +500 -192
- package/dist/daemon-lifecycle.js.map +1 -1
- package/dist/daemon-reachability.js +2 -2
- package/dist/daemon-reachability.js.map +1 -1
- package/dist/daemon-start-lock.d.ts +28 -0
- package/dist/daemon-start-lock.d.ts.map +1 -1
- package/dist/daemon-start-lock.js +107 -13
- package/dist/daemon-start-lock.js.map +1 -1
- package/dist/lib/seat-activity.d.ts +4 -1
- package/dist/lib/seat-activity.d.ts.map +1 -1
- package/dist/lib/seat-activity.js +4 -3
- package/dist/lib/seat-activity.js.map +1 -1
- package/dist/mcp-server.d.ts +2 -2
- package/dist/mcp-server.d.ts.map +1 -1
- package/dist/mcp-server.js +126 -27
- package/dist/mcp-server.js.map +1 -1
- package/dist/process-liveness.d.ts +21 -0
- package/dist/process-liveness.d.ts.map +1 -0
- package/dist/process-liveness.js +43 -0
- package/dist/process-liveness.js.map +1 -0
- package/dist/remote-host-ops.d.ts +1 -1
- package/dist/remote-host-ops.d.ts.map +1 -1
- package/dist/remote-host-ops.js +3 -14
- package/dist/remote-host-ops.js.map +1 -1
- package/dist/system-preflight.d.ts +9 -0
- package/dist/system-preflight.d.ts.map +1 -1
- package/dist/system-preflight.js +27 -8
- package/dist/system-preflight.js.map +1 -1
- package/dist/tmux-health.d.ts +10 -1
- package/dist/tmux-health.d.ts.map +1 -1
- package/dist/tmux-health.js +31 -2
- package/dist/tmux-health.js.map +1 -1
- package/package.json +4 -2
- package/scripts/check-abi.mjs +18 -2
- package/tui/dist/attention/attention-model.d.ts +1 -1
- package/tui/dist/attention/attention-model.d.ts.map +1 -1
- package/tui/dist/attention/attention-model.js +6 -0
- package/tui/dist/attention/attention-model.js.map +1 -1
- package/tui/dist/daemon-client.d.ts +21 -2
- package/tui/dist/daemon-client.d.ts.map +1 -1
- package/tui/dist/daemon-client.js +36 -5
- package/tui/dist/daemon-client.js.map +1 -1
- package/tui/dist/hydrate.d.ts.map +1 -1
- package/tui/dist/hydrate.js +6 -2
- package/tui/dist/hydrate.js.map +1 -1
- package/tui/dist/main.js +11 -8
- package/tui/dist/main.js.map +1 -1
- package/tui/dist/terminals/open-window.d.ts +9 -3
- package/tui/dist/terminals/open-window.d.ts.map +1 -1
- package/tui/dist/terminals/open-window.js +22 -4
- package/tui/dist/terminals/open-window.js.map +1 -1
- package/tui/dist/terminals/terminal-model.d.ts +3 -0
- package/tui/dist/terminals/terminal-model.d.ts.map +1 -1
- package/tui/dist/terminals/terminal-model.js +6 -1
- package/tui/dist/terminals/terminal-model.js.map +1 -1
- package/tui/dist/topology/glyphs.d.ts.map +1 -1
- package/tui/dist/topology/glyphs.js +11 -1
- package/tui/dist/topology/glyphs.js.map +1 -1
- package/tui/dist/topology/graph-types.d.ts +8 -0
- package/tui/dist/topology/graph-types.d.ts.map +1 -1
- package/tui/dist/types.d.ts +3 -2
- package/tui/dist/types.d.ts.map +1 -1
- package/ui/dist/assets/{index-DG_7XFcL.js → index-D7OUklzs.js} +148 -148
- package/ui/dist/index.html +1 -1
|
@@ -8,6 +8,7 @@ import { readAttemptOutcome } from "./seat-pool-slots.js";
|
|
|
8
8
|
import { parsePoolBlock } from "./seat-pool-spec.js";
|
|
9
9
|
import { deriveCanonicalSessionName } from "./session-name.js";
|
|
10
10
|
import { seatLaunchAdditionPathsForNode } from "./seat-launch-additions.js";
|
|
11
|
+
import { launchStatusIsRunning } from "./restore-orchestrator.js";
|
|
11
12
|
/** The report of a stop from what the checked stop returned. */
|
|
12
13
|
export function seatPoolStopReport(stop) {
|
|
13
14
|
// A keep_alive seat whose session was already gone is recorded as stopped, but nothing was stopped: an absence.
|
|
@@ -25,20 +26,41 @@ export function seatPoolStopReport(stop) {
|
|
|
25
26
|
/** The queue's reroute actor and note, as the queue records a reroute (the queue's own rule for "was rerouted"). */
|
|
26
27
|
const QUEUE_FALLBACK_ACTOR = "system:queue-fallback";
|
|
27
28
|
const FALLBACK_NOTE = "fallback-routed: ";
|
|
29
|
+
/** The actor and note the queue records when a handover or a fresh launch releases the retiring occupant's claims back
|
|
30
|
+
* to pending (`releaseClaimsByGeneration`). */
|
|
31
|
+
const HANDOVER_RELEASE_ACTOR = "system";
|
|
32
|
+
const HANDOVER_RELEASE_NOTE = "released: claimant generation retired (seat handover)";
|
|
28
33
|
/** No cut: list() keeps the newest rows first, so any limit would drop the oldest rows, which move first. */
|
|
29
34
|
const ALL_ROWS = Number.MAX_SAFE_INTEGER;
|
|
30
35
|
/** Refusals that mean the row moved on since it was read: skipped, never a failure. */
|
|
31
36
|
const ROW_MOVED_ON = new Set(["fallback_state_mismatch", "fallback_destination_mismatch", "qitem_not_found"]);
|
|
37
|
+
/** Asks the guard about one move. A missing runner, or one that throws, is a guard error: the move goes ahead. */
|
|
38
|
+
async function askGuard(run, input) {
|
|
39
|
+
if (run === undefined)
|
|
40
|
+
return { verdict: "error", message: "no guard runner composed" };
|
|
41
|
+
try {
|
|
42
|
+
return await run(input);
|
|
43
|
+
}
|
|
44
|
+
catch (error) {
|
|
45
|
+
return { verdict: "error", message: error instanceof Error ? error.message : String(error) };
|
|
46
|
+
}
|
|
47
|
+
}
|
|
32
48
|
/** A queue-only seat's cold watchdog reminder is about that seat, never its work (the stuck sweep's rule). */
|
|
33
49
|
function isWatchdogReminder(row) {
|
|
34
50
|
return row.sourceSession === "watchdog@system" && !!row.tags?.includes("watchdog") && row.tags.includes("queue-only");
|
|
35
51
|
}
|
|
36
|
-
/** When the row
|
|
37
|
-
|
|
52
|
+
/** When the row's waiting clock last restarted, from its transitions: its latest reroute or its latest release back to
|
|
53
|
+
* pending by a handover or a fresh launch, or null when neither happened. Only the queue's own records count (no
|
|
54
|
+
* identity provenance). */
|
|
55
|
+
function waitingRestartedAt(queueRepo, qitemId) {
|
|
38
56
|
const transitions = queueRepo.transitionLog.listForQitem(qitemId);
|
|
39
57
|
for (let i = transitions.length - 1; i >= 0; i--) {
|
|
40
58
|
const t = transitions[i];
|
|
41
|
-
if (t.
|
|
59
|
+
if (t.identityProvenance !== null)
|
|
60
|
+
continue;
|
|
61
|
+
if (t.actorSession === QUEUE_FALLBACK_ACTOR && t.transitionNote?.startsWith(FALLBACK_NOTE))
|
|
62
|
+
return t.ts;
|
|
63
|
+
if (t.state === "pending" && t.actorSession === HANDOVER_RELEASE_ACTOR && t.transitionNote === HANDOVER_RELEASE_NOTE)
|
|
42
64
|
return t.ts;
|
|
43
65
|
}
|
|
44
66
|
return null;
|
|
@@ -55,7 +77,7 @@ export function seatPoolQueueEffects(queueRepo) {
|
|
|
55
77
|
qitemId: row.qitemId,
|
|
56
78
|
rawDestination: row.destinationSession,
|
|
57
79
|
tags: row.tags ?? [],
|
|
58
|
-
waitingSince:
|
|
80
|
+
waitingSince: waitingRestartedAt(queueRepo, row.qitemId) ?? row.tsCreated,
|
|
59
81
|
}));
|
|
60
82
|
},
|
|
61
83
|
openRows: (sessionName) => queueRepo.listOpenObligations(sessionName, ALL_ROWS).length,
|
|
@@ -103,7 +125,9 @@ export function readSeatPoolAgents(deps, slots) {
|
|
|
103
125
|
const latestSessionStatus = nodeId === null
|
|
104
126
|
? null
|
|
105
127
|
: latestStatus.get(nodeId)?.status ?? null;
|
|
106
|
-
|
|
128
|
+
// A `live` slot with a reuse hold is not proven to run: it takes room, but it is not free and receives no row.
|
|
129
|
+
const heldLive = slot.phase === "live" && slot.reuseHold !== null;
|
|
130
|
+
const running = nodeId !== null && !heldLive && (latestSessionStatus === "running" || latestSessionStatus === "idle")
|
|
107
131
|
&& !deps.confirmedStopped(nodeId);
|
|
108
132
|
const state = running ? deps.seatState(nodeId) : null;
|
|
109
133
|
const idleAtPrompt = state?.activity === "idle-at-prompt" && state.needsInput.count === 0 && !state.backgroundWork;
|
|
@@ -167,12 +191,19 @@ function blockView(stored) {
|
|
|
167
191
|
return { block: "none" };
|
|
168
192
|
return "spec" in stored ? { block: "stored", spec: stored.spec } : { block: "unusable", error: stored.error };
|
|
169
193
|
}
|
|
170
|
-
/** Whether two stored specs are the same, field by field. */
|
|
194
|
+
/** Whether two stored specs are the same, field by field (the guard's argv item by item). */
|
|
171
195
|
function sameSpec(a, b) {
|
|
172
196
|
const keys = new Set([...Object.keys(a), ...Object.keys(b)]);
|
|
173
|
-
for (const key of keys)
|
|
174
|
-
|
|
197
|
+
for (const key of keys) {
|
|
198
|
+
const x = a[key];
|
|
199
|
+
const y = b[key];
|
|
200
|
+
if (Array.isArray(x) && Array.isArray(y)) {
|
|
201
|
+
if (x.length !== y.length || x.some((item, i) => item !== y[i]))
|
|
202
|
+
return false;
|
|
203
|
+
}
|
|
204
|
+
else if (x !== y)
|
|
175
205
|
return false;
|
|
206
|
+
}
|
|
176
207
|
return true;
|
|
177
208
|
}
|
|
178
209
|
function unreadableAdvisory(error) {
|
|
@@ -183,14 +214,95 @@ function inFlight(attemptId) {
|
|
|
183
214
|
}
|
|
184
215
|
const CANCELLED_NOT_ISSUED = "cancelled: not issued";
|
|
185
216
|
const INTERRUPTED_BEFORE_CREATE = "not launched (interrupted before create)";
|
|
186
|
-
/** A
|
|
187
|
-
|
|
188
|
-
|
|
217
|
+
/** A JSON object kept on a slot row; null when there is none or it isn't one. */
|
|
218
|
+
function slotRecord(text) {
|
|
219
|
+
if (text === null)
|
|
220
|
+
return null;
|
|
221
|
+
try {
|
|
222
|
+
const parsed = JSON.parse(text);
|
|
223
|
+
return parsed !== null && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : null;
|
|
224
|
+
}
|
|
225
|
+
catch {
|
|
226
|
+
return null;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
/** How a held `live` slot is reported, from its hold: `left_attached`, or `attention_required` (with the launch's status in
|
|
230
|
+
* `code` when it is another one, as a failure whose session still runs), with the hold's error. */
|
|
231
|
+
function heldLiveView(attemptId, hold) {
|
|
232
|
+
const code = typeof hold["code"] === "string" ? hold["code"] : "attention_required";
|
|
233
|
+
const status = code === "left_attached" ? "left_attached" : "attention_required";
|
|
234
|
+
return {
|
|
235
|
+
id: attemptId, status,
|
|
236
|
+
...(code !== status ? { code } : {}),
|
|
237
|
+
...(typeof hold["error"] === "string" ? { message: hold["error"] } : {}),
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
/** A slot's attempt as its row records it. A `live` slot that is held is reported from its hold. A comeback: in flight
|
|
241
|
+
* while its call runs in this process (`inFlightIds`; without it, every issued one), `unknown` once no call runs it,
|
|
242
|
+
* then by how it settled. An add: an issued one with an `unknown` outcome is reported so, and a settled one by the
|
|
243
|
+
* status its outcome kept (a settled add with no such status settled running). */
|
|
244
|
+
function attemptView(slot, inFlightIds) {
|
|
189
245
|
if (slot.attemptId === null || slot.attemptState === null)
|
|
190
246
|
return undefined;
|
|
191
247
|
const outcome = readAttemptOutcome(slot.attemptOutcome);
|
|
192
248
|
const text = (key) => (typeof outcome[key] === "string" ? { [key]: outcome[key] } : {});
|
|
249
|
+
if (slot.attemptState === "settled" && slot.phase === "live" && slot.reuseHold !== null) {
|
|
250
|
+
return heldLiveView(slot.attemptId, slotRecord(slot.reuseHold) ?? {});
|
|
251
|
+
}
|
|
252
|
+
// Put back in `adding` by a later session that has not settled: unknown, read again every cycle.
|
|
253
|
+
if (slot.attemptState === "issued" && outcome["reread"] === "session") {
|
|
254
|
+
const pending = slotRecord(JSON.stringify(outcome["pending"] ?? null)) ?? {};
|
|
255
|
+
return { id: slot.attemptId, status: "unknown", code: typeof pending["code"] === "string" ? pending["code"] : "later_session_not_settled",
|
|
256
|
+
...(typeof pending["message"] === "string" ? { message: pending["message"] } : {}) };
|
|
257
|
+
}
|
|
258
|
+
if (slot.attemptState === "settled") {
|
|
259
|
+
const hold = slotRecord(slot.reuseHold);
|
|
260
|
+
// Held `drained` for a decision or a failure the launch (or a later restore) returned: not running, with that status.
|
|
261
|
+
if (slot.phase === "drained" && hold !== null && !("observed" in hold) && (hold["code"] === "awaiting-decision" || hold["code"] === "failed")) {
|
|
262
|
+
return { id: slot.attemptId, status: "not_running", code: hold["code"], ...(typeof hold["error"] === "string" ? { message: hold["error"] } : {}) };
|
|
263
|
+
}
|
|
264
|
+
// Settled by a later session on its node rather than by its call.
|
|
265
|
+
// Reported by what that session read when it settled the attempt, not by the slot's phase now (a normal drain later
|
|
266
|
+
// does not change how the attempt settled).
|
|
267
|
+
if (outcome["settledBy"] === "later_session") {
|
|
268
|
+
const later = slotRecord(JSON.stringify(outcome["later"] ?? null));
|
|
269
|
+
const ran = later !== null && typeof later["read"] === "string" ? later["read"] === "ready" : slot.phase === "live" && slot.reuseHold === null;
|
|
270
|
+
return ran
|
|
271
|
+
? { id: slot.attemptId, status: "running", code: "later_session" }
|
|
272
|
+
: { id: slot.attemptId, status: "not_running", code: "later_session_absent" };
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
if (slot.attemptKind === "comeback") {
|
|
276
|
+
if (slot.attemptState !== "settled") {
|
|
277
|
+
if (inFlightIds === undefined || inFlightIds.has(slot.attemptId))
|
|
278
|
+
return inFlight(slot.attemptId);
|
|
279
|
+
return { id: slot.attemptId, status: "unknown", code: typeof outcome["code"] === "string" ? outcome["code"] : "no_outcome",
|
|
280
|
+
message: typeof outcome["message"] === "string" ? outcome["message"]
|
|
281
|
+
: "unknown: the comeback's launch is not running in this process and its result is not recorded" };
|
|
282
|
+
}
|
|
283
|
+
if (outcome["cancelled"] === true) {
|
|
284
|
+
return { id: slot.attemptId, status: "cancelled", message: CANCELLED_NOT_ISSUED, ...text("code") };
|
|
285
|
+
}
|
|
286
|
+
if (outcome["settledAs"] === "already_running")
|
|
287
|
+
return { id: slot.attemptId, status: "already_running" };
|
|
288
|
+
if (outcome["settledAs"] === "attention_required" || outcome["settledAs"] === "left_attached") {
|
|
289
|
+
return heldLiveView(slot.attemptId, { code: typeof outcome["status"] === "string" ? outcome["status"] : outcome["settledAs"],
|
|
290
|
+
...(typeof outcome["error"] === "string" ? { error: outcome["error"] } : {}) });
|
|
291
|
+
}
|
|
292
|
+
if (outcome["settledAs"] === "not_running") {
|
|
293
|
+
return { id: slot.attemptId, status: "not_running", ...(typeof outcome["status"] === "string" ? { code: outcome["status"] } : {}),
|
|
294
|
+
...(typeof outcome["error"] === "string" ? { message: outcome["error"] } : {}) };
|
|
295
|
+
}
|
|
296
|
+
if (outcome["ok"] === false) {
|
|
297
|
+
return { id: slot.attemptId, status: "refused", ...(typeof outcome["code"] === "string" ? { code: outcome["code"] } : {}) };
|
|
298
|
+
}
|
|
299
|
+
const selection = outcome["snapshotSelection"];
|
|
300
|
+
return { id: slot.attemptId, status: "running", ...(selection ? { snapshotSelection: selection } : {}) };
|
|
301
|
+
}
|
|
193
302
|
if (slot.attemptState === "settled") {
|
|
303
|
+
if (outcome["status"] === "attention_required" || outcome["status"] === "left_attached") {
|
|
304
|
+
return heldLiveView(slot.attemptId, { code: typeof outcome["code"] === "string" ? outcome["code"] : outcome["status"], ...(typeof outcome["message"] === "string" ? { error: outcome["message"] } : {}) });
|
|
305
|
+
}
|
|
194
306
|
if (outcome["status"] !== "not_running")
|
|
195
307
|
return { id: slot.attemptId, status: "running" };
|
|
196
308
|
return {
|
|
@@ -204,17 +316,50 @@ function attemptView(slot) {
|
|
|
204
316
|
}
|
|
205
317
|
return inFlight(slot.attemptId);
|
|
206
318
|
}
|
|
207
|
-
|
|
319
|
+
/** The slots as reported: each one's attempt and, on a slot the pool does not bring back, its reuse hold, every cycle. */
|
|
320
|
+
function slotsView(slots, inFlightIds) {
|
|
208
321
|
return slots.map((slot) => {
|
|
209
|
-
const attempt = attemptView(slot);
|
|
210
|
-
return {
|
|
322
|
+
const attempt = attemptView(slot, inFlightIds);
|
|
323
|
+
return {
|
|
324
|
+
slotNumber: slot.slotNumber,
|
|
325
|
+
nodeId: slot.nodeId,
|
|
326
|
+
phase: slot.phase,
|
|
327
|
+
...(attempt ? { attempt } : {}),
|
|
328
|
+
...(slot.reuseHold !== null ? { reuseHold: slotRecord(slot.reuseHold) ?? { unreadable: slot.reuseHold } } : {}),
|
|
329
|
+
};
|
|
211
330
|
});
|
|
212
331
|
}
|
|
213
|
-
/**
|
|
214
|
-
|
|
332
|
+
/** An add that settled `not_running` (its latest session exited, or its executor confirmed stopped) and keeps its slot
|
|
333
|
+
* `drained` with its reuse hold. While one is on record, no new number is taken: persistent demand and a launch that
|
|
334
|
+
* keeps failing would otherwise take another number after each cooldown. Not an ordinary drained slot, a comeback's
|
|
335
|
+
* reuse hold (a refusal is a `comeback` attempt; `holdComeback` keeps the slot's add attempt, which settled running) or
|
|
336
|
+
* an `unknown` add (still `adding`). */
|
|
337
|
+
function confirmedFailedAdd(slot) {
|
|
338
|
+
const outcome = readAttemptOutcome(slot.attemptOutcome);
|
|
339
|
+
return slot.phase === "drained" && slot.attemptKind === "add" && slot.attemptState === "settled" && slot.attemptId !== null
|
|
340
|
+
&& slot.reuseHold !== null && outcome["status"] === "not_running" && outcome["later"] === undefined;
|
|
341
|
+
}
|
|
342
|
+
/** The add's notes while a confirmed failed add holds the new number: that attempt, its slot and its evidence. */
|
|
343
|
+
function failedAddHeld(slot) {
|
|
344
|
+
const attempt = attemptView(slot);
|
|
345
|
+
return {
|
|
346
|
+
held: `held: failed add ${slot.attemptId} (slot ${slot.slotNumber}) settled not_running${attempt.observed ? ` (${attempt.observed})` : ""}`,
|
|
347
|
+
failedAdd: {
|
|
348
|
+
slotNumber: slot.slotNumber, nodeId: slot.nodeId, attempt,
|
|
349
|
+
reuseHold: slotRecord(slot.reuseHold) ?? { unreadable: slot.reuseHold },
|
|
350
|
+
},
|
|
351
|
+
};
|
|
352
|
+
}
|
|
353
|
+
/** The refusals a comeback's launch returns before any launch: the slot goes back to `drained` with the code as its
|
|
354
|
+
* reuse hold, and the same snapshot is never sent again. */
|
|
355
|
+
const COMEBACK_REFUSALS = new Set([
|
|
356
|
+
"snapshot_not_found", "snapshot_wrong_rig", "snapshot_unusable", "no_matching_nodes", "selection_changed",
|
|
357
|
+
]);
|
|
215
358
|
/** 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
|
-
|
|
359
|
+
* model's, and its own `keep_alive: false` (below). Nor does it take the model's continuity strategy, mechanic or
|
|
360
|
+
* cold-start opt-in: its continuity comes from its own agent spec, and it isn't opted into cold start. */
|
|
361
|
+
const NOT_INHERITED = ["pool", "id", "label", "cwd", "session_source", "keep_alive", "compaction_strategy", "mechanic",
|
|
362
|
+
"cold_start"];
|
|
218
363
|
function addCallOutcome(outcome) {
|
|
219
364
|
if (!outcome.ok)
|
|
220
365
|
return { ok: false, code: outcome.code, message: "message" in outcome ? outcome.message : outcome.errors.join("; ") };
|
|
@@ -226,9 +371,10 @@ function addCallOutcome(outcome) {
|
|
|
226
371
|
}
|
|
227
372
|
/**
|
|
228
373
|
* 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
|
|
230
|
-
*
|
|
231
|
-
*
|
|
374
|
+
* again. Exited, or the node's executor confirmed stopped: not running, never retried. Running or idle while the call is
|
|
375
|
+
* known to have returned anything but a launch (`attention_required`, `left_attached`, a failure): held `live`, reported
|
|
376
|
+
* by the launch's status (`left_attached`, else `attention_required`, with the status or code in `code`). Running or idle
|
|
377
|
+
* with startup `ready` after a launch: running. Anything else (startup not ready, no session, another status): unknown.
|
|
232
378
|
*/
|
|
233
379
|
function classifyAdd(call, latest, confirmedStopped) {
|
|
234
380
|
const failure = call === null ? {}
|
|
@@ -238,15 +384,25 @@ function classifyAdd(call, latest, confirmedStopped) {
|
|
|
238
384
|
return { status: "not_running", observed: "exited", ...failure };
|
|
239
385
|
if (confirmedStopped)
|
|
240
386
|
return { status: "not_running", observed: "probe_absent", ...failure };
|
|
387
|
+
// The add said it needs attention or was left attached: held `live` whatever its session reads, since a pane may run.
|
|
388
|
+
if (call !== null && call.ok && (call.status === "attention_required" || call.status === "left_attached")) {
|
|
389
|
+
return { status: call.status, code: call.status, ...(call.error !== undefined ? { message: call.error } : {}) };
|
|
390
|
+
}
|
|
241
391
|
if (latest === null)
|
|
242
392
|
return { status: "unknown", code: "no_session", message: "unknown: the node has no session yet" };
|
|
243
393
|
const evidence = `latest session ${latest.status}, startup ${latest.startupStatus ?? "unknown"}`;
|
|
244
394
|
if (latest.status === "running" || latest.status === "idle") {
|
|
245
395
|
if (call !== null && !(call.ok && call.status === "launched")) {
|
|
246
|
-
|
|
396
|
+
const code = call.ok ? call.status : call.code;
|
|
397
|
+
const message = call.ok ? call.error : call.message;
|
|
398
|
+
return { status: code === "left_attached" ? "left_attached" : "attention_required", code, ...(message !== undefined ? { message } : {}) };
|
|
247
399
|
}
|
|
248
400
|
if (latest.startupStatus === "ready")
|
|
249
401
|
return { status: "running", sessionId: latest.id };
|
|
402
|
+
// A startup that needs attention or failed while the session runs (the add's call not known, as after a restart).
|
|
403
|
+
if (latest.startupStatus === "attention_required" || latest.startupStatus === "failed") {
|
|
404
|
+
return { status: "attention_required", code: latest.startupStatus, message: `startup ${latest.startupStatus}; ${evidence}` };
|
|
405
|
+
}
|
|
250
406
|
}
|
|
251
407
|
return { status: "unknown", code: "not_settled", message: `unknown: ${evidence}` };
|
|
252
408
|
}
|
|
@@ -287,10 +443,115 @@ class AddNotIssued extends Error {
|
|
|
287
443
|
this.code = code;
|
|
288
444
|
}
|
|
289
445
|
}
|
|
446
|
+
/** A node's logical id; null when the node is gone. */
|
|
447
|
+
function nodeLogicalId(db, nodeId) {
|
|
448
|
+
return db.prepare("SELECT logical_id FROM nodes WHERE id = ?").get(nodeId)?.logical_id ?? null;
|
|
449
|
+
}
|
|
450
|
+
/** A value as canonical JSON (object keys sorted), so two settings compare by content. */
|
|
451
|
+
function canonical(value) {
|
|
452
|
+
if (Array.isArray(value))
|
|
453
|
+
return `[${value.map(canonical).join(",")}]`;
|
|
454
|
+
if (value !== null && typeof value === "object") {
|
|
455
|
+
return `{${Object.keys(value).sort().map((key) => `${JSON.stringify(key)}:${canonical(value[key])}`).join(",")}}`;
|
|
456
|
+
}
|
|
457
|
+
return JSON.stringify(value) ?? "undefined";
|
|
458
|
+
}
|
|
290
459
|
/** A node's latest session, in the order the reader uses. Null: none. */
|
|
291
460
|
function latestSession(db, nodeId) {
|
|
292
461
|
return db.prepare("SELECT id, status FROM sessions WHERE node_id = ? ORDER BY created_at DESC, id DESC LIMIT 1").get(nodeId) ?? null;
|
|
293
462
|
}
|
|
463
|
+
/** A node's latest session with its startup status, in the order the reader uses, leaving out a session a launch rolled
|
|
464
|
+
* back (`superseded`): that one was never the node's occupant. Null: none. */
|
|
465
|
+
function latestSessionView(db, nodeId) {
|
|
466
|
+
return db.prepare(`SELECT id, status, startup_status AS startupStatus FROM sessions WHERE node_id = ? AND status != 'superseded'
|
|
467
|
+
ORDER BY created_at DESC, id DESC LIMIT 1`).get(nodeId) ?? null;
|
|
468
|
+
}
|
|
469
|
+
/** A session by id as a later change reads it; null for null or an unknown id. */
|
|
470
|
+
function sessionViewOf(db, sessionId) {
|
|
471
|
+
if (sessionId === null)
|
|
472
|
+
return null;
|
|
473
|
+
return db.prepare("SELECT id, status, startup_status AS startupStatus FROM sessions WHERE id = ?").get(sessionId) ?? null;
|
|
474
|
+
}
|
|
475
|
+
/** The highest event seq of the node's rig; 0 when none. */
|
|
476
|
+
function rigEventSeq(db, nodeId) {
|
|
477
|
+
return db.prepare("SELECT MAX(seq) AS seq FROM events WHERE rig_id = (SELECT rig_id FROM nodes WHERE id = ?)").get(nodeId).seq ?? 0;
|
|
478
|
+
}
|
|
479
|
+
/** What a hold is measured from, kept on the slot row (`attempt_result`, marked `held`): the node's latest session as read
|
|
480
|
+
* when the hold was set, with its status and startup status (`sessionId: null` when the node has none), and the rig's
|
|
481
|
+
* event seq then. A later change is measured against it. */
|
|
482
|
+
function heldSession(nodeId, latest, eventSeq) {
|
|
483
|
+
return JSON.stringify({
|
|
484
|
+
held: true, nodeId, sessionId: latest?.id ?? null,
|
|
485
|
+
...(latest !== null ? { status: latest.status, startupStatus: latest.startupStatus } : {}),
|
|
486
|
+
eventSeq,
|
|
487
|
+
});
|
|
488
|
+
}
|
|
489
|
+
/** What a hold is measured from, read back from the slot row; null when the row keeps none (an attempt's own result, or
|
|
490
|
+
* anything that does not read as one). */
|
|
491
|
+
function readHeldSession(text) {
|
|
492
|
+
const record = slotRecord(text);
|
|
493
|
+
if (record === null || record["held"] !== true)
|
|
494
|
+
return null;
|
|
495
|
+
const sessionId = record["sessionId"];
|
|
496
|
+
if (sessionId !== null && (typeof sessionId !== "string" || sessionId === ""))
|
|
497
|
+
return null;
|
|
498
|
+
return {
|
|
499
|
+
sessionId,
|
|
500
|
+
...(typeof record["status"] === "string" ? { status: record["status"] } : {}),
|
|
501
|
+
startupStatus: typeof record["startupStatus"] === "string" ? record["startupStatus"] : null,
|
|
502
|
+
eventSeq: typeof record["eventSeq"] === "number" ? record["eventSeq"] : 0,
|
|
503
|
+
};
|
|
504
|
+
}
|
|
505
|
+
/** The status a held comeback settles with, from its launch's status for the node: a decision awaited, or a failure with
|
|
506
|
+
* no session running, holds it `drained` (`not_running`); attention, left attached, or a failure whose session still
|
|
507
|
+
* runs holds it `live`. Null for a status that runs, or one this does not settle. */
|
|
508
|
+
function heldComeback(nodeStatus, sessionRuns) {
|
|
509
|
+
if (nodeStatus === "awaiting-decision")
|
|
510
|
+
return { as: "not_running" };
|
|
511
|
+
if (nodeStatus === "attention_required")
|
|
512
|
+
return { as: "attention_required" };
|
|
513
|
+
if (nodeStatus === "left_attached")
|
|
514
|
+
return { as: "left_attached" };
|
|
515
|
+
if (nodeStatus === "failed")
|
|
516
|
+
return sessionRuns ? { as: "attention_required" } : { as: "not_running" };
|
|
517
|
+
return null;
|
|
518
|
+
}
|
|
519
|
+
/** A slot whose hold a later change on its node can end: a reuse hold on a `drained` or `live` slot with a node, and no
|
|
520
|
+
* attempt running. */
|
|
521
|
+
function isWatchedHold(slot) {
|
|
522
|
+
return slot.reuseHold !== null && slot.nodeId !== null && (slot.phase === "drained" || slot.phase === "live")
|
|
523
|
+
&& (slot.attemptState === null || slot.attemptState === "settled");
|
|
524
|
+
}
|
|
525
|
+
/** The newest restore since `sinceSeq` (a whole-rig `restore.completed` or a `restore.subset_completed`) that names the
|
|
526
|
+
* node, with its status and error for it; null when none does. A payload that can't be read names no node. */
|
|
527
|
+
function restoreOf(db, nodeId, sinceSeq, snapshotId) {
|
|
528
|
+
// A comeback's own launch records only a `restore.subset_completed`; a later change also reads a whole-rig restore.
|
|
529
|
+
const events = db.prepare(`SELECT seq, type, payload FROM events WHERE rig_id = (SELECT rig_id FROM nodes WHERE id = ?)
|
|
530
|
+
AND type IN ('restore.subset_completed'${snapshotId === undefined ? ", 'restore.completed'" : ""}) AND seq > ? ORDER BY seq DESC`).all(nodeId, sinceSeq);
|
|
531
|
+
for (const event of events) {
|
|
532
|
+
let payload;
|
|
533
|
+
try {
|
|
534
|
+
payload = JSON.parse(event.payload);
|
|
535
|
+
}
|
|
536
|
+
catch {
|
|
537
|
+
continue;
|
|
538
|
+
}
|
|
539
|
+
if (snapshotId !== undefined && payload.snapshotId !== snapshotId)
|
|
540
|
+
continue;
|
|
541
|
+
const nodes = Array.isArray(payload.result?.nodes) ? payload.result.nodes : [];
|
|
542
|
+
const node = nodes.find((n) => n !== null && typeof n === "object" && n["nodeId"] === nodeId);
|
|
543
|
+
if (!node || typeof node["status"] !== "string")
|
|
544
|
+
continue;
|
|
545
|
+
const selection = payload.result?.snapshotSelection;
|
|
546
|
+
return {
|
|
547
|
+
seq: event.seq, status: node["status"],
|
|
548
|
+
...(typeof node["error"] === "string" ? { error: node["error"] } : {}),
|
|
549
|
+
...(selection && typeof selection.snapshotId === "string" && typeof selection.mode === "string"
|
|
550
|
+
? { snapshotSelection: { snapshotId: selection.snapshotId, mode: selection.mode } } : {}),
|
|
551
|
+
};
|
|
552
|
+
}
|
|
553
|
+
return null;
|
|
554
|
+
}
|
|
294
555
|
/** The spec the job was last ensured with (`context.pool`); null when it has none that reads. */
|
|
295
556
|
function lastEnsuredSpec(context) {
|
|
296
557
|
const read = parsePoolBlock(context["pool"]);
|
|
@@ -318,7 +579,7 @@ export function makeSeatPoolExecutor(deps) {
|
|
|
318
579
|
return validIso(changedAt) && changedAt !== idleSince;
|
|
319
580
|
};
|
|
320
581
|
const at = () => deps.now().toISOString();
|
|
321
|
-
/** The adds started and not settled yet. */
|
|
582
|
+
/** The adds and comebacks started and not settled yet. */
|
|
322
583
|
const pending = new Set();
|
|
323
584
|
/** The attempt ids this process issued and whose call has not settled yet. An `issued` row that is not here is no
|
|
324
585
|
* process's any more: an add cut off by a daemon restart, or one whose result was unknown when its call returned. */
|
|
@@ -354,8 +615,17 @@ export function makeSeatPoolExecutor(deps) {
|
|
|
354
615
|
};
|
|
355
616
|
return deps.slots.settleAddNotRunning(add.slotId, add.attemptId, {
|
|
356
617
|
outcome: JSON.stringify({ status: "not_running", ...seen, call }), hold: JSON.stringify(hold), at: at(),
|
|
618
|
+
result: heldSession(add.nodeId, latest, rigEventSeq(deps.db, add.nodeId)),
|
|
357
619
|
}) ? entry({ id: add.attemptId, status: "not_running", ...seen }) : null;
|
|
358
620
|
}
|
|
621
|
+
if (settlement.status === "attention_required" || settlement.status === "left_attached") {
|
|
622
|
+
// Held `live`: a session may run, so the slot takes room, but it is not free, receives no row and is never drained.
|
|
623
|
+
const hold = { code: settlement.code, ...(settlement.message !== undefined ? { error: settlement.message } : {}) };
|
|
624
|
+
return deps.slots.settleAddHeldLive(add.slotId, add.attemptId, {
|
|
625
|
+
outcome: JSON.stringify({ status: settlement.status, code: settlement.code, ...(settlement.message !== undefined ? { message: settlement.message } : {}), call }),
|
|
626
|
+
hold: JSON.stringify(hold), result: heldSession(add.nodeId, latest, rigEventSeq(deps.db, add.nodeId)), at: at(),
|
|
627
|
+
}) ? entry(heldLiveView(add.attemptId, hold)) : null;
|
|
628
|
+
}
|
|
359
629
|
deps.slots.recordAttemptOutcome(add.slotId, add.attemptId, JSON.stringify({ status: "unknown", code: settlement.code, message: settlement.message, call }));
|
|
360
630
|
return null;
|
|
361
631
|
};
|
|
@@ -400,7 +670,10 @@ export function makeSeatPoolExecutor(deps) {
|
|
|
400
670
|
: null;
|
|
401
671
|
}
|
|
402
672
|
const latest = operation.current.nodes.find((node) => node.id === slot.nodeId)?.latestSession ?? null;
|
|
403
|
-
|
|
673
|
+
// An add read with no session yet made none of its own: a session found now is someone else's, so the call that
|
|
674
|
+
// returned without one does not hold it. With still no session, the call is kept with its failure.
|
|
675
|
+
const call = latest !== null && readAttemptOutcome(slot.attemptOutcome)["code"] === "no_session" ? null : keptCall(slot);
|
|
676
|
+
return settleWithNode({ slotId: slot.slotId, slotNumber: slot.slotNumber, logicalId, attemptId, nodeId: slot.nodeId }, call, latest);
|
|
404
677
|
};
|
|
405
678
|
/** Why the model member gives no agent, read from the model node itself (the export leaves these out silently), or null. */
|
|
406
679
|
const addRefusal = (rigId, modelNodeId) => {
|
|
@@ -491,21 +764,455 @@ export function makeSeatPoolExecutor(deps) {
|
|
|
491
764
|
inFlightAttempts.delete(add.attemptId);
|
|
492
765
|
}
|
|
493
766
|
};
|
|
494
|
-
/**
|
|
495
|
-
|
|
496
|
-
|
|
767
|
+
/** The fields of the slot's stored settings that differ from the model's, both read as the export writes them, apart
|
|
768
|
+
* from the keys an agent never takes from the model. `cwd` is one of those keys only when a `cwd_template` gives the
|
|
769
|
+
* slot its own folder; without one the slot took the model's folder, so it is compared. Null when they can't both be
|
|
770
|
+
* read (no warning then). */
|
|
771
|
+
const settingsDiffer = (rigId, modelNodeId, nodeId, cwdFromModel) => {
|
|
772
|
+
if (!deps.add)
|
|
773
|
+
return null;
|
|
774
|
+
let modelMember;
|
|
775
|
+
let own;
|
|
776
|
+
try {
|
|
777
|
+
modelMember = deps.add.exportMember(rigId, modelNodeId);
|
|
778
|
+
own = deps.add.exportMember(rigId, nodeId);
|
|
779
|
+
}
|
|
780
|
+
catch {
|
|
781
|
+
return null;
|
|
782
|
+
}
|
|
783
|
+
return [...new Set([...Object.keys(modelMember), ...Object.keys(own)])]
|
|
784
|
+
.filter((key) => (!NOT_INHERITED.includes(key) || (cwdFromModel && key === "cwd"))
|
|
785
|
+
&& canonical(modelMember[key]) !== canonical(own[key]))
|
|
786
|
+
.sort();
|
|
787
|
+
};
|
|
788
|
+
/** A comeback's call, after the lease, and its settlement on the slot row. Never rejects. */
|
|
789
|
+
const comeback = async (request) => {
|
|
790
|
+
const report = (entry) => settled.set(request.modelNodeId, [...(settled.get(request.modelNodeId) ?? []), entry]);
|
|
791
|
+
const base = { slotNumber: request.slotNumber, logicalId: request.logicalId, nodeId: request.nodeId };
|
|
792
|
+
// Running in this process until it settles, whoever calls it: a cycle does not read it as left over meanwhile.
|
|
793
|
+
inFlightAttempts.add(request.attemptId);
|
|
794
|
+
try {
|
|
795
|
+
if (!deps.comeback) {
|
|
796
|
+
report({ ...base, attempt: { ...inFlight(request.attemptId), code: "comeback_not_composed" } });
|
|
797
|
+
return;
|
|
798
|
+
}
|
|
799
|
+
const slot = deps.slots.get(request.slotId);
|
|
800
|
+
if (!slot || slot.attemptId !== request.attemptId || slot.attemptKind !== "comeback" || slot.attemptState !== "issued")
|
|
801
|
+
return;
|
|
802
|
+
// The job and the rig again, right before the launch: an earlier call of the same cycle may have run while the job
|
|
803
|
+
// was stopped or the rig went down. Held, the comeback is never launched and the slot is `drained` again.
|
|
804
|
+
const rigHold = readSeatPoolHold(deps.db, request.rigId);
|
|
805
|
+
const heldBy = deps.jobsRepo.getById(request.jobId)?.state !== "active" ? JOB_STOPPED.message
|
|
806
|
+
: rigHold.stoppedSeq !== null ? `held: rig stopped (event ${rigHold.stoppedSeq})` : null;
|
|
807
|
+
if (heldBy !== null) {
|
|
808
|
+
const outcome = JSON.stringify({ ok: false, code: "held", message: heldBy, launched: false });
|
|
809
|
+
if (deps.slots.returnComebackToDrained(request.slotId, request.attemptId, outcome)) {
|
|
810
|
+
report({ ...base, attempt: { id: request.attemptId, status: "refused", code: "held", message: heldBy } });
|
|
811
|
+
}
|
|
812
|
+
return;
|
|
813
|
+
}
|
|
814
|
+
// The slot comes back with its own stored settings, never the model's: a difference is only named.
|
|
815
|
+
const differ = settingsDiffer(request.rigId, request.modelNodeId, request.nodeId, request.cwdFromModel);
|
|
816
|
+
const warning = differ && differ.length > 0
|
|
817
|
+
? { warning: `the slot's stored settings differ from the model's (${differ.join(", ")}); it comes back with its own` }
|
|
818
|
+
: {};
|
|
819
|
+
let launch;
|
|
820
|
+
let threw = false;
|
|
821
|
+
try {
|
|
822
|
+
launch = await deps.comeback.launch(request.rigId, request.logicalId, { snapshotId: request.snapshotId });
|
|
823
|
+
}
|
|
824
|
+
catch (error) {
|
|
825
|
+
threw = true;
|
|
826
|
+
const code = error?.code;
|
|
827
|
+
launch = { ok: false, code: typeof code === "string" ? code : "launch_failed", message: errorMessage(error) };
|
|
828
|
+
}
|
|
829
|
+
const node = launch.launched?.find((n) => n.nodeId === request.nodeId) ?? launch.launched?.[0];
|
|
830
|
+
const selection = launch.snapshotSelection
|
|
831
|
+
? { snapshotId: launch.snapshotSelection.snapshotId, mode: launch.snapshotSelection.mode }
|
|
832
|
+
: undefined;
|
|
833
|
+
const storedOutcome = {
|
|
834
|
+
ok: launch.ok && !threw,
|
|
835
|
+
...(launch.code !== undefined ? { code: launch.code } : {}),
|
|
836
|
+
...(launch.message !== undefined ? { message: launch.message } : {}),
|
|
837
|
+
...(threw ? { threw: true } : {}),
|
|
838
|
+
...(node ? { nodeId: node.nodeId, status: node.status, ...(node.error ? { error: node.error } : {}) } : {}),
|
|
839
|
+
...(launch.alreadyRunning?.length ? { alreadyRunning: launch.alreadyRunning.map((n) => n.nodeId) } : {}),
|
|
840
|
+
...(selection ? { snapshotSelection: selection } : {}),
|
|
841
|
+
};
|
|
842
|
+
const stored = JSON.stringify(storedOutcome);
|
|
843
|
+
// Running, on the same node: settled, and the slot `live`.
|
|
844
|
+
if (!threw && launch.ok && node && node.nodeId === request.nodeId && launchStatusIsRunning(node.status)) {
|
|
845
|
+
const sessionId = latestSession(deps.db, request.nodeId)?.id ?? null;
|
|
846
|
+
if (deps.slots.settleAdd(request.slotId, request.attemptId, {
|
|
847
|
+
outcome: stored, result: JSON.stringify({ nodeId: request.nodeId, sessionId }), at: at(),
|
|
848
|
+
})) {
|
|
849
|
+
report({ ...base, attempt: { id: request.attemptId, status: "running", ...(selection ? { snapshotSelection: selection } : {}) }, ...warning });
|
|
850
|
+
return;
|
|
851
|
+
}
|
|
852
|
+
}
|
|
853
|
+
// Launched on the same node and not running: held, and never launched again (a decision awaited, a failure with
|
|
854
|
+
// nothing running: `drained`; attention, left attached, a failure whose session still runs: `live`).
|
|
855
|
+
if (!threw && launch.ok && node && node.nodeId === request.nodeId) {
|
|
856
|
+
// The node's current state first, as for a leftover: a session that reads ready now (an agent someone recovered by
|
|
857
|
+
// hand while the launch ran) is not held from the launch's status.
|
|
858
|
+
const now = latestSessionView(deps.db, request.nodeId);
|
|
859
|
+
if (now !== null && readSession(request.nodeId, now) === "ready") {
|
|
860
|
+
if (deps.slots.settleIssuedByLater({
|
|
861
|
+
slotId: request.slotId, attemptId: request.attemptId, phase: "live", hold: null, result: null, at: at(),
|
|
862
|
+
outcome: JSON.stringify({ ...storedOutcome, settledBy: "later_session", later: { sessionId: now.id, read: "ready", at: at() } }),
|
|
863
|
+
}))
|
|
864
|
+
report({ ...base, attempt: { id: request.attemptId, status: "running", code: "later_session" }, ...warning });
|
|
865
|
+
return;
|
|
866
|
+
}
|
|
867
|
+
const held = settleHeldComeback(request, node.status, node.error, storedOutcome);
|
|
868
|
+
if (held === "moved_on")
|
|
869
|
+
return;
|
|
870
|
+
if (held !== "not_held") {
|
|
871
|
+
report({ ...base, attempt: held, ...warning });
|
|
872
|
+
return;
|
|
873
|
+
}
|
|
874
|
+
}
|
|
875
|
+
// No launch, and the node in `alreadyRunning`: a live session the pool did not start. `live`, with no hold and no
|
|
876
|
+
// session of the attempt's own; free only once idle at its prompt.
|
|
877
|
+
if (!threw && launch.ok && !launch.launched?.length && launch.alreadyRunning?.some((n) => n.nodeId === request.nodeId)) {
|
|
878
|
+
if (deps.slots.settleAdd(request.slotId, request.attemptId, {
|
|
879
|
+
outcome: JSON.stringify({ ...storedOutcome, settledAs: "already_running" }), result: null, at: at(),
|
|
880
|
+
})) {
|
|
881
|
+
report({ ...base, attempt: { id: request.attemptId, status: "already_running" }, ...warning });
|
|
882
|
+
}
|
|
883
|
+
return;
|
|
884
|
+
}
|
|
885
|
+
// Refused before any launch: settled, `drained` again with the code as the reuse hold.
|
|
886
|
+
if (!threw && !launch.ok && launch.code !== undefined && COMEBACK_REFUSALS.has(launch.code)) {
|
|
887
|
+
const hold = JSON.stringify({ code: launch.code, snapshotId: request.snapshotId });
|
|
888
|
+
if (deps.slots.settleComebackRefused(request.slotId, request.attemptId, {
|
|
889
|
+
outcome: stored, hold, result: heldSession(request.nodeId, latestSessionView(deps.db, request.nodeId), rigEventSeq(deps.db, request.nodeId)),
|
|
890
|
+
})) {
|
|
891
|
+
report({
|
|
892
|
+
...base,
|
|
893
|
+
attempt: { id: request.attemptId, status: "refused", code: launch.code, ...(launch.message ? { message: launch.message } : {}) },
|
|
894
|
+
...warning,
|
|
895
|
+
});
|
|
896
|
+
return;
|
|
897
|
+
}
|
|
898
|
+
}
|
|
899
|
+
// Anything else (another refusal, a launch on another node, a call that threw) is not settled here: the attempt
|
|
900
|
+
// stays issued, with its outcome kept, and later cycles report it `unknown` and read it again. Nothing is reported
|
|
901
|
+
// when its row went with a node deleted by hand, or the attempt moved on.
|
|
902
|
+
if (!deps.slots.recordAttemptOutcome(request.slotId, request.attemptId, stored))
|
|
903
|
+
return;
|
|
904
|
+
const code = launch.code ?? (launch.alreadyRunning?.length ? "already_running" : node?.status ?? "no_launch_result");
|
|
905
|
+
report({
|
|
906
|
+
...base,
|
|
907
|
+
attempt: { ...inFlight(request.attemptId), code, ...(launch.message ? { message: launch.message } : node?.error ? { message: node.error } : {}) },
|
|
908
|
+
...warning,
|
|
909
|
+
});
|
|
910
|
+
}
|
|
911
|
+
catch (error) {
|
|
912
|
+
report({ ...base, attempt: { ...inFlight(request.attemptId), code: "settle_failed", message: errorMessage(error) } });
|
|
913
|
+
}
|
|
914
|
+
finally {
|
|
915
|
+
inFlightAttempts.delete(request.attemptId);
|
|
916
|
+
}
|
|
917
|
+
};
|
|
918
|
+
/**
|
|
919
|
+
* An issued comeback whose launch on its node did not run, settled held from the launch's status for the node (from the
|
|
920
|
+
* call, or from the restore event a later cycle reads): `drained` (`not_running`) or `live` (`attention_required`,
|
|
921
|
+
* `left_attached`), with the status as the reuse hold's code, the launch's error and the snapshot. The hold is measured
|
|
922
|
+
* from the node's latest session now (or, with `measuredFrom`, from that session: null when there was none) and the
|
|
923
|
+
* rig's event seq. `not_held` for a status this does not settle; `moved_on` when the row no longer holds the issued
|
|
924
|
+
* attempt.
|
|
925
|
+
*/
|
|
926
|
+
const settleHeldComeback = (attempt, nodeStatus, error, outcome, measuredFrom) => {
|
|
927
|
+
const latest = latestSessionView(deps.db, attempt.nodeId);
|
|
928
|
+
const from = measuredFrom === undefined ? latest : sessionViewOf(deps.db, measuredFrom.sessionId);
|
|
929
|
+
const held = heldComeback(nodeStatus, sessionRuns(attempt.nodeId, latest));
|
|
930
|
+
if (held === null)
|
|
931
|
+
return "not_held";
|
|
932
|
+
const hold = { code: nodeStatus, snapshotId: attempt.snapshotId, ...(error !== undefined ? { error } : {}) };
|
|
933
|
+
if (!deps.slots.settleComebackHeld(attempt.slotId, attempt.attemptId, {
|
|
934
|
+
phase: held.as === "not_running" ? "drained" : "live",
|
|
935
|
+
outcome: JSON.stringify({ ...outcome, settledAs: held.as }), hold: JSON.stringify(hold),
|
|
936
|
+
result: heldSession(attempt.nodeId, from, rigEventSeq(deps.db, attempt.nodeId)), at: at(),
|
|
937
|
+
}))
|
|
938
|
+
return "moved_on";
|
|
939
|
+
return held.as === "not_running"
|
|
940
|
+
? { id: attempt.attemptId, status: "not_running", code: nodeStatus, ...(error !== undefined ? { message: error } : {}) }
|
|
941
|
+
: heldLiveView(attempt.attemptId, hold);
|
|
942
|
+
};
|
|
943
|
+
/** Whether the session runs: running or idle, and its node's executor not confirmed stopped. */
|
|
944
|
+
const sessionRuns = (nodeId, latest) => latest !== null && (latest.status === "running" || latest.status === "idle") && !deps.confirmedStopped(nodeId);
|
|
945
|
+
/** How a node's latest session reads for a later change: confirmed absent (exited, or its executor confirmed stopped),
|
|
946
|
+
* ready (running or idle with startup `ready`), needing attention (running with a startup that needs attention or
|
|
947
|
+
* failed), or anything else. */
|
|
948
|
+
const readSession = (nodeId, latest) => {
|
|
949
|
+
if (latest.status === "exited" || deps.confirmedStopped(nodeId))
|
|
950
|
+
return "absent";
|
|
951
|
+
const runs = latest.status === "running" || latest.status === "idle";
|
|
952
|
+
if (runs && latest.startupStatus === "ready")
|
|
953
|
+
return "ready";
|
|
954
|
+
if (runs && (latest.startupStatus === "attention_required" || latest.startupStatus === "failed"))
|
|
955
|
+
return "attention";
|
|
956
|
+
return "unknown";
|
|
957
|
+
};
|
|
958
|
+
/** Whether a session of the node reached startup `ready` after `sinceSessionId` (any, when null or unknown), in the
|
|
959
|
+
* order `latestSessionView` reads sessions (`created_at`, then `id`), so "later" means one thing. */
|
|
960
|
+
const laterReady = (nodeId, sinceSessionId) => deps.db.prepare(`SELECT 1 FROM sessions s WHERE s.node_id = ? AND s.startup_status = 'ready'
|
|
961
|
+
AND (NOT EXISTS (SELECT 1 FROM sessions WHERE id = ?)
|
|
962
|
+
OR (s.created_at, s.id) > (SELECT created_at, id FROM sessions WHERE id = ?)) LIMIT 1`).get(nodeId, sinceSessionId, sinceSessionId) !== undefined;
|
|
963
|
+
/** The hold a later attention reading gives: its startup status as the code, and the session. */
|
|
964
|
+
const attentionHold = (latest) => ({ code: latest.startupStatus === "failed" ? "failed" : "attention_required", sessionId: latest.id });
|
|
965
|
+
/**
|
|
966
|
+
* An issued attempt no call runs any more, settled by its node's latest session (a comeback cut off before its launch
|
|
967
|
+
* recorded anything, or a slot a later change left `unknown`): ready, the slot is `live` with no hold and no session of
|
|
968
|
+
* the attempt's own; confirmed absent, `drained` and eligible, unless the hold it had awaits a decision and no session
|
|
969
|
+
* reached `ready` since `since` (it is held again); needing attention, `live` and held; anything else is not settled.
|
|
970
|
+
* With `newerThan`, only a session other than that one counts. Returns what changed, or null.
|
|
971
|
+
*/
|
|
972
|
+
const settleIssuedBySession = (modelNodeId, slot, opts) => {
|
|
973
|
+
const nodeId = slot.nodeId;
|
|
974
|
+
const latest = latestSessionView(deps.db, nodeId);
|
|
975
|
+
const logicalId = logicalIdOf(modelNodeId, slot.slotNumber);
|
|
976
|
+
const settledBy = (read) => JSON.stringify({
|
|
977
|
+
...readAttemptOutcome(slot.attemptOutcome), settledBy: "later_session", later: { sessionId: latest?.id ?? null, read, at: at() },
|
|
978
|
+
});
|
|
979
|
+
// A held `live` slot put back in `adding` that settles `drained` is drained from now (the cooldown counts from it); a
|
|
980
|
+
// `drained` one keeps its drain's time.
|
|
981
|
+
const fromLive = readAttemptOutcome(slot.attemptOutcome)["reopenedFrom"] === "live";
|
|
982
|
+
// A restore since the slot was put back in `adding` that launched the node and did not run gives it that outcome,
|
|
983
|
+
// unless a session reads ready now.
|
|
984
|
+
const restore = opts.sinceSeq === undefined ? null : restoreOf(deps.db, nodeId, opts.sinceSeq);
|
|
985
|
+
if (restore !== null && !launchStatusIsRunning(restore.status) && (latest === null || readSession(nodeId, latest) !== "ready")) {
|
|
986
|
+
const held = heldComeback(restore.status, sessionRuns(nodeId, latest));
|
|
987
|
+
if (held !== null) {
|
|
988
|
+
const hold = { code: restore.status, ...(restore.error !== undefined ? { error: restore.error } : {}), restoreSeq: restore.seq };
|
|
989
|
+
const phase = held.as === "not_running" ? "drained" : "live";
|
|
990
|
+
return deps.slots.settleIssuedByLater({
|
|
991
|
+
slotId: slot.slotId, attemptId: slot.attemptId, phase, hold: JSON.stringify(hold), outcome: settledBy("restore"),
|
|
992
|
+
result: heldSession(nodeId, latest, restore.seq), at: at(), drainedNow: fromLive,
|
|
993
|
+
}) ? { slotNumber: slot.slotNumber, logicalId, nodeId, session: latest, read: "restore", restore: { seq: restore.seq, status: restore.status }, phase, reuseHold: hold } : null;
|
|
994
|
+
}
|
|
995
|
+
}
|
|
996
|
+
if (latest === null)
|
|
997
|
+
return null;
|
|
998
|
+
if (opts.newerThan !== undefined && latest.id === opts.newerThan)
|
|
999
|
+
return null;
|
|
1000
|
+
const read = readSession(nodeId, latest);
|
|
1001
|
+
if (read === "unknown")
|
|
1002
|
+
return null;
|
|
1003
|
+
const note = { slotNumber: slot.slotNumber, logicalId, nodeId, session: latest, read };
|
|
1004
|
+
const outcome = settledBy(read);
|
|
1005
|
+
const settle = (phase, hold, result) => deps.slots.settleIssuedByLater({ slotId: slot.slotId, attemptId: slot.attemptId, phase, hold: hold === null ? null : JSON.stringify(hold), outcome, result, at: at(), drainedNow: fromLive });
|
|
1006
|
+
if (read === "ready")
|
|
1007
|
+
return settle("live", null, null) ? { ...note, phase: "live" } : null;
|
|
1008
|
+
if (read === "attention") {
|
|
1009
|
+
const hold = attentionHold(latest);
|
|
1010
|
+
return settle("live", hold, heldSession(nodeId, latest, rigEventSeq(deps.db, nodeId))) ? { ...note, phase: "live", reuseHold: hold } : null;
|
|
1011
|
+
}
|
|
1012
|
+
const prior = slotRecord(slot.reuseHold);
|
|
1013
|
+
if (prior?.["code"] === "awaiting-decision" && !laterReady(nodeId, opts.since)) {
|
|
1014
|
+
return settle("drained", prior, heldSession(nodeId, latest, rigEventSeq(deps.db, nodeId))) ? { ...note, phase: "drained", reuseHold: prior } : null;
|
|
1015
|
+
}
|
|
1016
|
+
return settle("drained", null, null) ? { ...note, phase: "drained" } : null;
|
|
1017
|
+
};
|
|
1018
|
+
/**
|
|
1019
|
+
* An issued comeback no process runs any more (its launch was cut off by a daemon restart, or returned what it does not
|
|
1020
|
+
* settle), read again under the custody lease. The launch records a `restore.subset_completed` naming the node, for the
|
|
1021
|
+
* comeback's snapshot, before it returns, so the newest one after what the comeback was issued on settles it by the same
|
|
1022
|
+
* rule as the call: running (`live`, while its session runs), held, or not settled; the hold is measured from the
|
|
1023
|
+
* session the comeback was issued on, so a session someone started since is a later change. The node's current state
|
|
1024
|
+
* comes first: when its latest session reads ready, the slot is `live` with no hold, whatever the event recorded
|
|
1025
|
+
* (someone recovered the agent by hand before this read), with or without an event (a launch that found the agent
|
|
1026
|
+
* already running records none). Otherwise, with no such event, a session newer than that one settles it by the
|
|
1027
|
+
* later-change rule (`changes`). With neither, it stays issued and
|
|
1028
|
+
* `unknown`: it takes room and is never launched again. Nothing is written then.
|
|
1029
|
+
*/
|
|
1030
|
+
const settleComebackLeftover = (modelNodeId, slot, changes) => {
|
|
1031
|
+
const attemptId = slot.attemptId;
|
|
1032
|
+
const nodeId = slot.nodeId;
|
|
1033
|
+
const logicalId = logicalIdOf(modelNodeId, slot.slotNumber);
|
|
1034
|
+
const entry = (attempt) => ({ slotNumber: slot.slotNumber, logicalId, nodeId, attempt });
|
|
1035
|
+
if (slot.attemptState === "reserved") {
|
|
1036
|
+
// A reservation is issued in the transaction that made it, so none is left behind; one that is goes back.
|
|
1037
|
+
const outcome = JSON.stringify({ ok: false, code: "interrupted_before_issue", launched: false, cancelled: true });
|
|
1038
|
+
return deps.slots.returnComebackToDrained(slot.slotId, attemptId, outcome)
|
|
1039
|
+
? entry({ id: attemptId, status: "cancelled", message: CANCELLED_NOT_ISSUED, code: "interrupted_before_issue" })
|
|
1040
|
+
: null;
|
|
1041
|
+
}
|
|
1042
|
+
const basis = slotRecord(slot.attemptBasis);
|
|
1043
|
+
const snapshotId = typeof basis?.["snapshotId"] === "string" ? basis["snapshotId"] : null;
|
|
1044
|
+
const basisSession = typeof basis?.["sessionId"] === "string" ? basis["sessionId"] : null;
|
|
1045
|
+
const eventSeq = typeof basis?.["eventSeq"] === "number" ? basis["eventSeq"] : 0;
|
|
1046
|
+
if (snapshotId === null)
|
|
1047
|
+
return null;
|
|
1048
|
+
const event = restoreOf(deps.db, nodeId, eventSeq, snapshotId);
|
|
1049
|
+
const latest = latestSessionView(deps.db, nodeId);
|
|
1050
|
+
const readyNow = latest !== null && readSession(nodeId, latest) === "ready";
|
|
1051
|
+
if (event !== null) {
|
|
1052
|
+
const outcome = {
|
|
1053
|
+
ok: true, nodeId, status: event.status, ...(event.error !== undefined ? { error: event.error } : {}), fromEvent: event.seq,
|
|
1054
|
+
...(event.snapshotSelection ? { snapshotSelection: event.snapshotSelection } : {}),
|
|
1055
|
+
};
|
|
1056
|
+
if (launchStatusIsRunning(event.status) && readyNow) {
|
|
1057
|
+
return deps.slots.settleAdd(slot.slotId, attemptId, { outcome: JSON.stringify(outcome), result: JSON.stringify({ nodeId, sessionId: latest.id }), at: at() })
|
|
1058
|
+
? entry({ id: attemptId, status: "running", ...(event.snapshotSelection ? { snapshotSelection: event.snapshotSelection } : {}) })
|
|
1059
|
+
: null;
|
|
1060
|
+
}
|
|
1061
|
+
// The node's current state first: a session that reads ready now (an agent recovered by hand since the event) is
|
|
1062
|
+
// not held from the event's outcome; the later-change rule below settles it `live` with no hold.
|
|
1063
|
+
if (!launchStatusIsRunning(event.status) && !readyNow) {
|
|
1064
|
+
// An `awaiting-decision` launch was rolled back, so the node's latest session is someone else's: that hold is
|
|
1065
|
+
// measured from the session the comeback was issued on, and a session started since (not ready yet) is a later
|
|
1066
|
+
// change the next read takes. Any other status keeps the launch's own session as what the hold is measured from.
|
|
1067
|
+
const held = settleHeldComeback({ slotId: slot.slotId, attemptId, nodeId, snapshotId }, event.status, event.error, outcome, event.status === "awaiting-decision" ? { sessionId: basisSession } : undefined);
|
|
1068
|
+
if (typeof held !== "string")
|
|
1069
|
+
return entry(held);
|
|
1070
|
+
if (held === "moved_on")
|
|
1071
|
+
return null;
|
|
1072
|
+
}
|
|
1073
|
+
}
|
|
1074
|
+
if (readyNow) {
|
|
1075
|
+
// With or without an event, no `newerThan`: the session the comeback was issued on counts too, when it reads ready
|
|
1076
|
+
// now (a launch that found it already running records no event, and settles it `live` the same way).
|
|
1077
|
+
const change = settleIssuedBySession(modelNodeId, slot, { since: basisSession });
|
|
1078
|
+
if (change)
|
|
1079
|
+
changes.push(change);
|
|
1080
|
+
return null;
|
|
1081
|
+
}
|
|
1082
|
+
const change = settleIssuedBySession(modelNodeId, slot, { newerThan: basisSession, since: basisSession });
|
|
1083
|
+
if (change)
|
|
1084
|
+
changes.push(change);
|
|
1085
|
+
return null;
|
|
1086
|
+
};
|
|
1087
|
+
/**
|
|
1088
|
+
* The held slots of a model, read again under the custody lease. A hold ends only through a later change on the slot's
|
|
1089
|
+
* node, measured from what the hold kept: a restore since then that launched the node (a whole-rig `rig up`, or a
|
|
1090
|
+
* `rig launch --seats`) and did not run gives the slot that outcome (`drained` and held for a decision or a failure
|
|
1091
|
+
* with nothing running, `live` and held otherwise); otherwise a session newer than the kept one (which the pool did not
|
|
1092
|
+
* start: it never relaunches a held slot), or a new status or startup status on the kept session of a `live` slot
|
|
1093
|
+
* (`rig seat continue` reruns startup on the same session), is read: ready, the slot is `live` with no hold; confirmed
|
|
1094
|
+
* absent, `drained` and eligible, unless its hold awaits a decision and no session reached `ready` since the kept one,
|
|
1095
|
+
* when it stays held; needing attention, `live` and held; anything else puts the slot back in `adding` with its attempt
|
|
1096
|
+
* issued and `unknown`, read again every cycle. A `drained` slot's kept session ending again is no change: nothing ran
|
|
1097
|
+
* on it when the hold was set. A hold kept before what it is measured from was kept gets it now. No event is written.
|
|
1098
|
+
*/
|
|
1099
|
+
const laterChanges = (modelNodeId) => {
|
|
1100
|
+
const out = [];
|
|
1101
|
+
for (const slot of deps.slots.forModel(modelNodeId)) {
|
|
1102
|
+
if (!isWatchedHold(slot))
|
|
1103
|
+
continue;
|
|
1104
|
+
const nodeId = slot.nodeId;
|
|
1105
|
+
const from = slot.phase;
|
|
1106
|
+
const latest = latestSessionView(deps.db, nodeId);
|
|
1107
|
+
const seen = readHeldSession(slot.attemptResult);
|
|
1108
|
+
if (seen === null) {
|
|
1109
|
+
deps.slots.recordHeldSession(slot.slotId, slot.attemptId, slot.attemptResult, heldSession(nodeId, latest, rigEventSeq(deps.db, nodeId)));
|
|
1110
|
+
continue;
|
|
1111
|
+
}
|
|
1112
|
+
const hold = slotRecord(slot.reuseHold) ?? { unreadable: slot.reuseHold };
|
|
1113
|
+
const logicalId = logicalIdOf(modelNodeId, slot.slotNumber);
|
|
1114
|
+
const later = (read, sessionId) => JSON.stringify({ ...readAttemptOutcome(slot.attemptOutcome), later: { sessionId, read, at: at() } });
|
|
1115
|
+
const change = (to, newHold, result, outcome) => deps.slots.changeHeld({
|
|
1116
|
+
slotId: slot.slotId, attemptId: slot.attemptId, from, to, hold: newHold === null ? null : JSON.stringify(newHold), outcome, result, at: at(),
|
|
1117
|
+
});
|
|
1118
|
+
const restore = restoreOf(deps.db, nodeId, seen.eventSeq);
|
|
1119
|
+
// A session that reads ready now wins over a restore outcome recorded before it.
|
|
1120
|
+
if (restore !== null && !launchStatusIsRunning(restore.status) && (latest === null || readSession(nodeId, latest) !== "ready")) {
|
|
1121
|
+
// The restore's own outcome for the node, as for a comeback's launch.
|
|
1122
|
+
const held = heldComeback(restore.status, sessionRuns(nodeId, latest));
|
|
1123
|
+
if (held !== null) {
|
|
1124
|
+
const newHold = { code: restore.status, ...(restore.error !== undefined ? { error: restore.error } : {}), restoreSeq: restore.seq };
|
|
1125
|
+
const to = held.as === "not_running" ? "drained" : "live";
|
|
1126
|
+
if (change(to, newHold, heldSession(nodeId, latest, restore.seq), later("restore", latest?.id ?? null))) {
|
|
1127
|
+
out.push({ slotNumber: slot.slotNumber, logicalId, nodeId, session: latest, read: "restore", restore: { seq: restore.seq, status: restore.status }, phase: to, reuseHold: newHold });
|
|
1128
|
+
}
|
|
1129
|
+
continue;
|
|
1130
|
+
}
|
|
1131
|
+
}
|
|
1132
|
+
const eventSeq = restore?.seq ?? seen.eventSeq;
|
|
1133
|
+
/** Nothing to end the hold: measured from now on from what was read. */
|
|
1134
|
+
const rebase = () => { if (eventSeq !== seen.eventSeq || latest?.id !== seen.sessionId)
|
|
1135
|
+
change(from, hold, heldSession(nodeId, latest, eventSeq), slot.attemptOutcome); };
|
|
1136
|
+
if (latest === null) {
|
|
1137
|
+
// A held `live` slot with no session row whose executor is now confirmed stopped: nothing runs, `drained` and eligible.
|
|
1138
|
+
if (from === "live" && deps.confirmedStopped(nodeId)) {
|
|
1139
|
+
if (change("drained", null, null, later("absent", null)))
|
|
1140
|
+
out.push({ slotNumber: slot.slotNumber, logicalId, nodeId, session: null, read: "absent", phase: "drained" });
|
|
1141
|
+
continue;
|
|
1142
|
+
}
|
|
1143
|
+
rebase();
|
|
1144
|
+
continue;
|
|
1145
|
+
}
|
|
1146
|
+
const newer = latest.id !== seen.sessionId;
|
|
1147
|
+
const statusChanged = !newer && seen.status !== undefined && (latest.status !== seen.status || latest.startupStatus !== seen.startupStatus);
|
|
1148
|
+
// A held `live` slot whose session's executor is now confirmed stopped: its session ended, even with a stale status.
|
|
1149
|
+
const probeAbsent = !newer && from === "live" && deps.confirmedStopped(nodeId);
|
|
1150
|
+
if (!newer && !statusChanged && !probeAbsent) {
|
|
1151
|
+
rebase();
|
|
1152
|
+
continue;
|
|
1153
|
+
}
|
|
1154
|
+
const read = readSession(nodeId, latest);
|
|
1155
|
+
// A held `drained` slot's own session: nothing ran on it when the hold was set, so only a resume of it (ready, or
|
|
1156
|
+
// needing attention) is a change; marked down, detached or stale, it is not.
|
|
1157
|
+
if (!newer && from === "drained" && read !== "ready" && read !== "attention") {
|
|
1158
|
+
rebase();
|
|
1159
|
+
continue;
|
|
1160
|
+
}
|
|
1161
|
+
const note = { slotNumber: slot.slotNumber, logicalId, nodeId, session: latest, read };
|
|
1162
|
+
if (read === "ready") {
|
|
1163
|
+
if (change("live", null, null, later(read, latest.id)))
|
|
1164
|
+
out.push({ ...note, phase: "live" });
|
|
1165
|
+
}
|
|
1166
|
+
else if (read === "absent") {
|
|
1167
|
+
if (hold["code"] === "awaiting-decision" && !laterReady(nodeId, seen.sessionId)) {
|
|
1168
|
+
// The decision is still awaited: the hold stays, measured from this session now.
|
|
1169
|
+
if (change(from, hold, heldSession(nodeId, latest, eventSeq), slot.attemptOutcome))
|
|
1170
|
+
out.push({ ...note, phase: from, reuseHold: hold });
|
|
1171
|
+
}
|
|
1172
|
+
else if (change("drained", null, null, later(read, latest.id))) {
|
|
1173
|
+
out.push({ ...note, phase: "drained" });
|
|
1174
|
+
}
|
|
1175
|
+
}
|
|
1176
|
+
else if (read === "attention") {
|
|
1177
|
+
const attention = attentionHold(latest);
|
|
1178
|
+
if (change("live", attention, heldSession(nodeId, latest, eventSeq), later(read, latest.id)))
|
|
1179
|
+
out.push({ ...note, phase: "live", reuseHold: attention });
|
|
1180
|
+
}
|
|
1181
|
+
else if (slot.attemptId !== null) {
|
|
1182
|
+
// Not settled yet (a startup still pending): counted as an unknown result, `adding` with its attempt issued, the
|
|
1183
|
+
// hold it had kept, and read again every cycle by its session.
|
|
1184
|
+
const outcome = JSON.stringify({
|
|
1185
|
+
...readAttemptOutcome(slot.attemptOutcome), reread: "session", reopenedFrom: from, since: seen.sessionId, sinceSeq: eventSeq,
|
|
1186
|
+
pending: { code: "later_session_not_settled", message: `unknown: a later session on the node, ${latest.status}, startup ${latest.startupStatus ?? "unknown"}` },
|
|
1187
|
+
later: { sessionId: latest.id, read, at: at() },
|
|
1188
|
+
});
|
|
1189
|
+
if (deps.slots.reopenHeld({ slotId: slot.slotId, attemptId: slot.attemptId, from, outcome, at: at() }))
|
|
1190
|
+
out.push({ ...note, phase: "adding", reuseHold: hold });
|
|
1191
|
+
}
|
|
1192
|
+
else {
|
|
1193
|
+
out.push({ ...note, phase: from, reuseHold: hold });
|
|
1194
|
+
}
|
|
1195
|
+
}
|
|
1196
|
+
return out;
|
|
1197
|
+
};
|
|
1198
|
+
/** One call after another, each after the lease is released; the cycle does not wait for them. */
|
|
1199
|
+
const startCalls = (calls) => {
|
|
1200
|
+
if (calls.length === 0)
|
|
497
1201
|
return;
|
|
498
|
-
const run =
|
|
1202
|
+
const run = calls.reduce((previous, call) => previous.then(call), Promise.resolve());
|
|
499
1203
|
pending.add(run);
|
|
500
1204
|
void run.finally(() => pending.delete(run));
|
|
501
1205
|
};
|
|
502
|
-
|
|
1206
|
+
const executor = {
|
|
1207
|
+
comeback,
|
|
503
1208
|
async idle() {
|
|
504
1209
|
while (pending.size > 0)
|
|
505
1210
|
await Promise.all([...pending]);
|
|
506
1211
|
},
|
|
507
1212
|
async cycle(job) {
|
|
508
1213
|
const active = () => deps.jobsRepo.getById(job.jobId)?.state === "active";
|
|
1214
|
+
// The comeback goes only through the executor's own `comeback`, read once: what is issued is what is called.
|
|
1215
|
+
const comebackCall = deps.comeback !== undefined && typeof executor.comeback === "function" ? executor.comeback : undefined;
|
|
509
1216
|
const found = seatPoolModelOfJob(deps.db, job);
|
|
510
1217
|
if (!found.found && found.cause === "no_model_node_id") {
|
|
511
1218
|
return { action: "skip", reason: "seat_pool_model_unknown", notes: { modelNodeId: found.modelNodeId } };
|
|
@@ -525,14 +1232,13 @@ export function makeSeatPoolExecutor(deps) {
|
|
|
525
1232
|
const held = found.cause === "node_gone"
|
|
526
1233
|
? { cause: "model node gone", message: "held: model node gone" }
|
|
527
1234
|
: { 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 });
|
|
1235
|
+
return report({ modelNodeId: found.modelNodeId, slots: slotsView(deps.slots.forModel(found.modelNodeId), inFlightAttempts), held });
|
|
529
1236
|
}
|
|
530
1237
|
const { model, modelNodeId, rigId } = found;
|
|
531
|
-
const slots = deps.slots.forModel(modelNodeId);
|
|
532
1238
|
let block = blockView(deps.rigRepo.getNodePool(modelNodeId));
|
|
533
1239
|
// The report reads the slot rows when it is built, not the snapshot the plan used: an add that settles while the cycle
|
|
534
1240
|
// 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)) });
|
|
1241
|
+
const base = () => ({ modelNodeId, ...block, slots: slotsView(deps.slots.forModel(modelNodeId), inFlightAttempts) });
|
|
536
1242
|
if (!active())
|
|
537
1243
|
return report({ ...base(), held: JOB_STOPPED });
|
|
538
1244
|
if (block.block === "unusable")
|
|
@@ -545,6 +1251,26 @@ export function makeSeatPoolExecutor(deps) {
|
|
|
545
1251
|
return report(base());
|
|
546
1252
|
const spec = block.block === "stored" ? block.spec : { ...lastSpec, drain: true };
|
|
547
1253
|
const removal = removed ? { removal: "the pool block was removed; draining with the spec last stored on the job" } : {};
|
|
1254
|
+
// A held slot, read again before the plan, under the custody lease, so the plan sees what a later change on its
|
|
1255
|
+
// node made of it. Only while a slot is held, and never while the pool is: a held pool changes nothing.
|
|
1256
|
+
let changes = [];
|
|
1257
|
+
if (deps.slots.forModel(modelNodeId).some(isWatchedHold)) {
|
|
1258
|
+
try {
|
|
1259
|
+
await deps.custody([modelNodeId], async () => {
|
|
1260
|
+
if (!active() || readSeatPoolHold(deps.db, rigId).stoppedSeq !== null)
|
|
1261
|
+
return;
|
|
1262
|
+
if (blockView(deps.rigRepo.getNodePool(modelNodeId)).block === "unusable")
|
|
1263
|
+
return;
|
|
1264
|
+
changes = laterChanges(modelNodeId);
|
|
1265
|
+
});
|
|
1266
|
+
}
|
|
1267
|
+
catch (error) {
|
|
1268
|
+
// A refused custody changes nothing here; the cycle's own lease below reports it.
|
|
1269
|
+
if (!(error instanceof DeliveryGuardError))
|
|
1270
|
+
throw error;
|
|
1271
|
+
}
|
|
1272
|
+
}
|
|
1273
|
+
const slots = deps.slots.forModel(modelNodeId);
|
|
548
1274
|
// The plan is read outside the lease; the custody is for the hold check, the moves, the drain decisions and the
|
|
549
1275
|
// add's reservation and issue. The add's call goes out after it.
|
|
550
1276
|
const read = { ...readSeatPoolState(deps, model, slots), lastStepAt: lastDrainStep(slots) };
|
|
@@ -563,6 +1289,7 @@ export function makeSeatPoolExecutor(deps) {
|
|
|
563
1289
|
const moved = [];
|
|
564
1290
|
const skipped = [];
|
|
565
1291
|
const failed = [];
|
|
1292
|
+
const guardErrors = [];
|
|
566
1293
|
const drains = [];
|
|
567
1294
|
const toDrain = [];
|
|
568
1295
|
const restops = [];
|
|
@@ -590,6 +1317,7 @@ export function makeSeatPoolExecutor(deps) {
|
|
|
590
1317
|
};
|
|
591
1318
|
let addNotes;
|
|
592
1319
|
const issued = [];
|
|
1320
|
+
const comebacks = [];
|
|
593
1321
|
let thrown;
|
|
594
1322
|
try {
|
|
595
1323
|
await deps.custody([modelNodeId], async () => {
|
|
@@ -617,18 +1345,36 @@ export function makeSeatPoolExecutor(deps) {
|
|
|
617
1345
|
}
|
|
618
1346
|
// An add attempt no process runs any more (a reservation never issued, or an issued add not in flight in this
|
|
619
1347
|
// process: cut off by a daemon restart, or left unknown), settled from its row. One in flight here is left alone.
|
|
1348
|
+
// A comeback no process runs any more is read again the same way, from the event its launch records, or by a
|
|
1349
|
+
// later session on its node; a slot a later change left `unknown` is read again by its node's latest session.
|
|
620
1350
|
for (const slot of deps.slots.forModel(modelNodeId)) {
|
|
621
|
-
if (slot.phase !== "adding" || slot.
|
|
1351
|
+
if (slot.phase !== "adding" || slot.attemptId === null || inFlightAttempts.has(slot.attemptId))
|
|
1352
|
+
continue;
|
|
1353
|
+
const outcome = readAttemptOutcome(slot.attemptOutcome);
|
|
1354
|
+
if (outcome["reread"] === "session" && slot.nodeId !== null && slot.attemptState === "issued") {
|
|
1355
|
+
const change = settleIssuedBySession(modelNodeId, slot, {
|
|
1356
|
+
since: typeof outcome["since"] === "string" ? outcome["since"] : null,
|
|
1357
|
+
sinceSeq: typeof outcome["sinceSeq"] === "number" ? outcome["sinceSeq"] : undefined,
|
|
1358
|
+
});
|
|
1359
|
+
if (change)
|
|
1360
|
+
changes.push(change);
|
|
622
1361
|
continue;
|
|
623
|
-
|
|
1362
|
+
}
|
|
1363
|
+
const entry = slot.attemptKind === "add" ? settleLeftover(modelNodeId, slot)
|
|
1364
|
+
: slot.attemptKind === "comeback" && slot.nodeId !== null ? settleComebackLeftover(modelNodeId, slot, changes)
|
|
1365
|
+
: null;
|
|
624
1366
|
if (entry)
|
|
625
1367
|
reportSettled(modelNodeId, entry);
|
|
626
1368
|
}
|
|
627
1369
|
// 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
|
-
|
|
630
|
-
const
|
|
631
|
-
|
|
1370
|
+
// it, this cycle's drains wait (`drain: true` keeps its exemption), and so does its add, comebacks included.
|
|
1371
|
+
// Read again right before the add too: an add that settles `not_running` while the moves await is one more.
|
|
1372
|
+
const coolingSince = () => {
|
|
1373
|
+
const step = lastDrainStep(deps.slots.forModel(modelNodeId));
|
|
1374
|
+
return !spec.drain && step !== null && step !== read.lastStepAt
|
|
1375
|
+
&& deps.now().getTime() - Date.parse(step) < spec.cooldownSeconds * 1000;
|
|
1376
|
+
};
|
|
1377
|
+
const coolingNow = coolingSince();
|
|
632
1378
|
// A drain an earlier cycle left unfinished. One whose unconfirmed stop may have had an effect (a kill was
|
|
633
1379
|
// attempted) is stopped again below, never captured again. Any other (its capture failed, it ended before the
|
|
634
1380
|
// capture, or its stop is known to have had no effect) goes back to `live`: nothing was stopped, and a later plan
|
|
@@ -652,7 +1398,8 @@ export function makeSeatPoolExecutor(deps) {
|
|
|
652
1398
|
if (spec.drain && deps.drain && !held && !blockChangedNow()) {
|
|
653
1399
|
const current = deps.slots.forModel(modelNodeId);
|
|
654
1400
|
const agentsNow = readSeatPoolAgents(deps, current);
|
|
655
|
-
|
|
1401
|
+
// A held `live` slot is never drained by the pool: only a later change on its node ends its hold.
|
|
1402
|
+
for (const slot of current.filter((s) => s.phase === "live" && s.nodeId !== null && s.reuseHold === null)) {
|
|
656
1403
|
const agent = agentsNow.find((a) => a.slotNumber === slot.slotNumber);
|
|
657
1404
|
if (!agent || agent.nodeId === null || agent.sessionName === null || agent.running)
|
|
658
1405
|
continue;
|
|
@@ -668,6 +1415,12 @@ export function makeSeatPoolExecutor(deps) {
|
|
|
668
1415
|
gone.push({ slot, nodeId: agent.nodeId, session: agent.sessionName, sessionId });
|
|
669
1416
|
}
|
|
670
1417
|
}
|
|
1418
|
+
/** The block changed since the plan: this move and the rest are skipped. */
|
|
1419
|
+
const skipRest = (index) => {
|
|
1420
|
+
for (const rest of dispatches.slice(index)) {
|
|
1421
|
+
skipped.push({ qitemId: rest.qitemId, from: read.rawDestination.get(rest.qitemId), to: plannedTo(rest.slotNumber), code: "pool_block_changed" });
|
|
1422
|
+
}
|
|
1423
|
+
};
|
|
671
1424
|
for (const [index, d] of dispatches.entries()) {
|
|
672
1425
|
// A job stopped while an earlier move awaited: no later effect.
|
|
673
1426
|
if (!active()) {
|
|
@@ -676,11 +1429,31 @@ export function makeSeatPoolExecutor(deps) {
|
|
|
676
1429
|
}
|
|
677
1430
|
const from = read.rawDestination.get(d.qitemId);
|
|
678
1431
|
if (blockChangedNow()) {
|
|
679
|
-
|
|
680
|
-
skipped.push({ qitemId: rest.qitemId, from: read.rawDestination.get(rest.qitemId), to: plannedTo(rest.slotNumber), code: "pool_block_changed" });
|
|
681
|
-
}
|
|
1432
|
+
skipRest(index);
|
|
682
1433
|
break;
|
|
683
1434
|
}
|
|
1435
|
+
// The guard, under the block as planned. After its await, the job and the block are read again, and the checks
|
|
1436
|
+
// below run as they would without a guard.
|
|
1437
|
+
const guard = spec.dispatchGuard;
|
|
1438
|
+
if (guard !== undefined) {
|
|
1439
|
+
const to = plannedTo(d.slotNumber);
|
|
1440
|
+
const verdict = await askGuard(deps.dispatchGuard, { argv: guard, qitemId: d.qitemId, from, to });
|
|
1441
|
+
// A job stopped or a block changed while the guard ran ends the moves, whatever the old guard said.
|
|
1442
|
+
if (!active()) {
|
|
1443
|
+
held = JOB_STOPPED;
|
|
1444
|
+
break;
|
|
1445
|
+
}
|
|
1446
|
+
if (blockChangedNow()) {
|
|
1447
|
+
skipRest(index);
|
|
1448
|
+
break;
|
|
1449
|
+
}
|
|
1450
|
+
if (verdict.verdict === "veto") {
|
|
1451
|
+
skipped.push({ qitemId: d.qitemId, from, to, code: "guard_refused", ...(verdict.message ? { message: verdict.message } : {}) });
|
|
1452
|
+
continue;
|
|
1453
|
+
}
|
|
1454
|
+
if (verdict.verdict === "error")
|
|
1455
|
+
guardErrors.push({ qitemId: d.qitemId, from, to, code: "guard_error", message: verdict.message });
|
|
1456
|
+
}
|
|
684
1457
|
// The agent again, just before the move: still free, no held message, no open row, not above max.
|
|
685
1458
|
const agents = readSeatPoolAgents(deps, deps.slots.forModel(modelNodeId));
|
|
686
1459
|
const agent = agents.find((a) => a.slotNumber === d.slotNumber);
|
|
@@ -745,8 +1518,10 @@ export function makeSeatPoolExecutor(deps) {
|
|
|
745
1518
|
}
|
|
746
1519
|
toDrain.push({ slot, nodeId: slot.nodeId, session: agent.sessionName, sessionId, idleSince: d.idleSince });
|
|
747
1520
|
}
|
|
748
|
-
// The add, after the moves of the same cycle, under the same lease. Nothing in it awaits.
|
|
749
|
-
|
|
1521
|
+
// The add, after the moves of the same cycle, under the same lease. Nothing in it awaits. Each unit first brings
|
|
1522
|
+
// back the lowest eligible `drained` slot (no reuse hold) a snapshot qualifies for, and takes a new number only
|
|
1523
|
+
// when no eligible slot is left.
|
|
1524
|
+
if (!addIntent || (!deps.add && !deps.comeback) || held || blockChanged)
|
|
750
1525
|
return;
|
|
751
1526
|
if (!active()) {
|
|
752
1527
|
held = JOB_STOPPED;
|
|
@@ -757,40 +1532,174 @@ export function makeSeatPoolExecutor(deps) {
|
|
|
757
1532
|
addNotes = { skipped: "pool_block_changed" };
|
|
758
1533
|
return;
|
|
759
1534
|
}
|
|
760
|
-
|
|
761
|
-
|
|
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" };
|
|
1535
|
+
if (coolingSince()) {
|
|
1536
|
+
addNotes = { skipped: "cooldown" };
|
|
782
1537
|
return;
|
|
783
1538
|
}
|
|
784
|
-
const
|
|
785
|
-
const
|
|
1539
|
+
const comebackReady = comebackCall !== undefined;
|
|
1540
|
+
const comebackNotes = [];
|
|
1541
|
+
/** The drained slots this cycle already looked at. */
|
|
1542
|
+
const looked = new Set();
|
|
1543
|
+
/** Read once, when a unit first needs a new number; a string: why the model gives no new agent. */
|
|
1544
|
+
let inputs;
|
|
1545
|
+
const newNumberInputs = () => {
|
|
1546
|
+
const refusal = addRefusal(rigId, modelNodeId);
|
|
1547
|
+
if (refusal)
|
|
1548
|
+
return refusal;
|
|
1549
|
+
let raw;
|
|
1550
|
+
try {
|
|
1551
|
+
raw = deps.add.exportMember(rigId, modelNodeId);
|
|
1552
|
+
}
|
|
1553
|
+
catch (error) {
|
|
1554
|
+
return `add refused: the model member can't be exported (${errorMessage(error)})`;
|
|
1555
|
+
}
|
|
1556
|
+
const inherited = Object.fromEntries(Object.entries(raw).filter(([key]) => !NOT_INHERITED.includes(key)));
|
|
1557
|
+
const pod = modelPod(deps.db, modelNodeId);
|
|
1558
|
+
if (pod === null)
|
|
1559
|
+
return "add refused: the model member has no pod";
|
|
1560
|
+
return {
|
|
1561
|
+
raw, inherited, pod,
|
|
1562
|
+
rigRoot: deps.rigRepo.getNodeLaunchRecipe(modelNodeId)?.rigRoot ?? ".",
|
|
1563
|
+
launchAdditionsFrom: seatLaunchAdditionPathsForNode(deps.db, modelNodeId),
|
|
1564
|
+
};
|
|
1565
|
+
};
|
|
1566
|
+
let refused;
|
|
786
1567
|
const issuedView = [];
|
|
787
1568
|
const notIssued = [];
|
|
788
1569
|
const cancelled = [];
|
|
789
|
-
|
|
1570
|
+
/** A confirmed failed add met where a unit would take a new number: the add's notes name it. */
|
|
1571
|
+
let failedAddNote;
|
|
1572
|
+
/**
|
|
1573
|
+
* The re-check of a reservation just before its issue, add or comeback, with nothing awaited since it was made:
|
|
1574
|
+
* the job, the holds and the stored block again, then a new plan with the reservation counted. The cause that
|
|
1575
|
+
* cancels it (a stopped job, a `rig.stopped`, a lower `max`, `drain: true`, any other change to the block, or
|
|
1576
|
+
* surplus that reaches it), or null when it may be issued. A cause that holds the pool also sets the hold.
|
|
1577
|
+
*/
|
|
1578
|
+
const recheckReservation = (slotNumber, comebackSession) => {
|
|
1579
|
+
if (!active()) {
|
|
1580
|
+
held = JOB_STOPPED;
|
|
1581
|
+
return "job_stopped";
|
|
1582
|
+
}
|
|
1583
|
+
const holdNow = readSeatPoolHold(deps.db, rigId);
|
|
1584
|
+
if (holdNow.stoppedSeq !== null) {
|
|
1585
|
+
hold = holdNow;
|
|
1586
|
+
held = {
|
|
1587
|
+
cause: "rig stopped", seq: holdNow.stoppedSeq, message: `held: rig stopped (event ${holdNow.stoppedSeq})`,
|
|
1588
|
+
...(holdNow.seatsLaunchedSeq !== null
|
|
1589
|
+
? { exit: `seats launched with \`rig launch --seats\` (event ${holdNow.seatsLaunchedSeq}) do not end the hold; run \`rig down\`, then \`rig up\`` }
|
|
1590
|
+
: {}),
|
|
1591
|
+
};
|
|
1592
|
+
return "rig_stopped";
|
|
1593
|
+
}
|
|
1594
|
+
const storedSpec = deps.rigRepo.getNodePool(modelNodeId);
|
|
1595
|
+
const specNow = storedSpec !== undefined && "spec" in storedSpec ? storedSpec.spec : null;
|
|
1596
|
+
if (blockChangedNow()) {
|
|
1597
|
+
if (specNow === null)
|
|
1598
|
+
return "pool_block_changed";
|
|
1599
|
+
return specNow.max < spec.max ? "max_lowered" : specNow.drain ? "drain" : "pool_block_changed";
|
|
1600
|
+
}
|
|
1601
|
+
const slotsNow = deps.slots.forModel(modelNodeId);
|
|
1602
|
+
const stateNow = readSeatPoolState(deps, model, slotsNow);
|
|
1603
|
+
// A comeback's reservation took its slot out of `drained`: the rows left with that agent still wait for it, and
|
|
1604
|
+
// count as work waiting, as they did in the plan.
|
|
1605
|
+
const pending = [...stateNow.pending];
|
|
1606
|
+
if (comebackSession) {
|
|
1607
|
+
for (const row of deps.queue.pendingRows(comebackSession)) {
|
|
1608
|
+
if (stateNow.rawDestination.has(row.qitemId))
|
|
1609
|
+
continue;
|
|
1610
|
+
pending.push({ qitemId: row.qitemId, destination: model.sessionName, waitingSince: row.waitingSince, tags: spec.dispatchTag ? [spec.dispatchTag] : row.tags });
|
|
1611
|
+
}
|
|
1612
|
+
}
|
|
1613
|
+
const replan = planSeatPool(spec, { ...stateNow, pending, lastStepAt: lastDrainStep(slotsNow) }, deps.now().getTime());
|
|
1614
|
+
return replan.intents.some((i) => i.kind === "cancel" && i.slotNumber === slotNumber) ? "surplus" : null;
|
|
1615
|
+
};
|
|
1616
|
+
units: for (let unit = 0; unit < addIntent.count; unit++) {
|
|
790
1617
|
if (!active()) {
|
|
791
1618
|
held = JOB_STOPPED;
|
|
792
1619
|
break;
|
|
793
1620
|
}
|
|
1621
|
+
// The comeback first: the lowest eligible `drained` slot, then the next one when no snapshot qualifies.
|
|
1622
|
+
for (;;) {
|
|
1623
|
+
const slot = deps.slots.forModel(modelNodeId)
|
|
1624
|
+
.find((s) => s.phase === "drained" && s.reuseHold === null && s.nodeId !== null && !looked.has(s.slotId));
|
|
1625
|
+
if (!slot)
|
|
1626
|
+
break;
|
|
1627
|
+
looked.add(slot.slotId);
|
|
1628
|
+
const nodeId = slot.nodeId;
|
|
1629
|
+
// The slot's node exists: its row goes with the node (ON DELETE CASCADE), and nothing awaits since the read.
|
|
1630
|
+
const logicalId = nodeLogicalId(deps.db, nodeId);
|
|
1631
|
+
const note = { slotNumber: slot.slotNumber, logicalId, nodeId };
|
|
1632
|
+
// Without the comeback, an eligible slot is not brought back, and no new number takes its place.
|
|
1633
|
+
if (!comebackReady) {
|
|
1634
|
+
comebackNotes.push({ ...note, code: "comeback_not_composed" });
|
|
1635
|
+
break units;
|
|
1636
|
+
}
|
|
1637
|
+
const selection = deps.comeback.select(rigId, nodeId, logicalId);
|
|
1638
|
+
if (selection.chosen === null) {
|
|
1639
|
+
// No snapshot qualifies, or the newest usable one recorded conflicting occupants: no call, and the slot
|
|
1640
|
+
// keeps `drained` with the pool's own hold.
|
|
1641
|
+
const hold = selection.conflict !== undefined
|
|
1642
|
+
? { code: "conflicting_occupants", nodeId, snapshotId: selection.conflict.snapshotId, candidateIds: selection.conflict.candidateIds, read: selection.read, failed: selection.failed }
|
|
1643
|
+
: { code: "no_qualifying_snapshot", nodeId, read: selection.read, failed: selection.failed };
|
|
1644
|
+
const measured = heldSession(nodeId, latestSessionView(deps.db, nodeId), rigEventSeq(deps.db, nodeId));
|
|
1645
|
+
comebackNotes.push(deps.slots.holdComeback(slot.slotId, JSON.stringify(hold), measured) ? { ...note, hold } : { ...note, code: "slot_moved_on" });
|
|
1646
|
+
continue;
|
|
1647
|
+
}
|
|
1648
|
+
const snapshotId = selection.chosen.id;
|
|
1649
|
+
const unknowns = selection.failed.flatMap((f) => (f.unknown ? [{ snapshotId: f.snapshotId, ...f.unknown }] : []));
|
|
1650
|
+
// The reservation, on the slot's own row, with the chosen snapshot, and the issue: the re-check of the
|
|
1651
|
+
// reservation (as an add's), then the issued attempt and what it was issued on (the snapshot, the node's
|
|
1652
|
+
// latest session and the rig's latest event), in one transaction. A comeback the re-check cancels, or not
|
|
1653
|
+
// issued, is `drained` again in the same transaction, eligible, its row never removed, and never launched;
|
|
1654
|
+
// an unexpected error rolls it all back, so the slot stays `drained` with the attempt it had.
|
|
1655
|
+
const attemptId = randomUUID();
|
|
1656
|
+
const issueComeback = deps.db.transaction(() => {
|
|
1657
|
+
if (!deps.slots.reserveComeback({ slotId: slot.slotId, attemptId, snapshotId }))
|
|
1658
|
+
return { code: "slot_moved_on" };
|
|
1659
|
+
const cause = recheckReservation(slot.slotNumber, agentNode(deps.db, nodeId)?.sessionName ?? null);
|
|
1660
|
+
if (cause !== null) {
|
|
1661
|
+
deps.slots.returnComebackToDrained(slot.slotId, attemptId, JSON.stringify({ ok: false, code: cause, launched: false, cancelled: true }));
|
|
1662
|
+
return { code: cause, cancelled: true };
|
|
1663
|
+
}
|
|
1664
|
+
const eventSeq = deps.db.prepare("SELECT MAX(seq) AS seq FROM events WHERE rig_id = ?").get(rigId).seq;
|
|
1665
|
+
const basis = JSON.stringify({ snapshotId, sessionId: latestSessionView(deps.db, nodeId)?.id ?? null, eventSeq });
|
|
1666
|
+
if (!deps.slots.issueAttempt(slot.slotId, attemptId, basis)) {
|
|
1667
|
+
deps.slots.returnComebackToDrained(slot.slotId, attemptId, JSON.stringify({ ok: false, code: "slot_changed", launched: false }));
|
|
1668
|
+
return { code: "slot_changed" };
|
|
1669
|
+
}
|
|
1670
|
+
return null;
|
|
1671
|
+
});
|
|
1672
|
+
const unissued = issueComeback();
|
|
1673
|
+
if (unissued !== null) {
|
|
1674
|
+
if (unissued.cancelled) {
|
|
1675
|
+
// Cancelled before its issue (`cancelled: not issued`): never launched, and this cycle's adds end.
|
|
1676
|
+
cancelled.push({ slotNumber: slot.slotNumber, logicalId, attempt: { id: attemptId, status: "cancelled", message: CANCELLED_NOT_ISSUED, code: unissued.code } });
|
|
1677
|
+
break units;
|
|
1678
|
+
}
|
|
1679
|
+
comebackNotes.push({ ...note, snapshotId, code: unissued.code });
|
|
1680
|
+
continue;
|
|
1681
|
+
}
|
|
1682
|
+
// The request goes out only once its issue committed; its call runs in this process until it settles.
|
|
1683
|
+
inFlightAttempts.add(attemptId);
|
|
1684
|
+
comebacks.push({ jobId: job.jobId, modelNodeId, rigId, slotId: slot.slotId, slotNumber: slot.slotNumber, nodeId, logicalId, attemptId, snapshotId, cwdFromModel: spec.cwdTemplate === null });
|
|
1685
|
+
comebackNotes.push({ ...note, snapshotId, attempt: inFlight(attemptId), ...(unknowns.length ? { unknownOccupants: unknowns } : {}) });
|
|
1686
|
+
continue units;
|
|
1687
|
+
}
|
|
1688
|
+
// No drained slot to bring back: a new number.
|
|
1689
|
+
if (!deps.add)
|
|
1690
|
+
break;
|
|
1691
|
+
// An add that settled `not_running` holds every new number while its slot stays; the comebacks above still ran.
|
|
1692
|
+
const failedAdd = deps.slots.forModel(modelNodeId).find(confirmedFailedAdd);
|
|
1693
|
+
if (failedAdd) {
|
|
1694
|
+
failedAddNote = failedAddHeld(failedAdd);
|
|
1695
|
+
break;
|
|
1696
|
+
}
|
|
1697
|
+
inputs ??= newNumberInputs();
|
|
1698
|
+
if (typeof inputs === "string") {
|
|
1699
|
+
refused = inputs;
|
|
1700
|
+
break;
|
|
1701
|
+
}
|
|
1702
|
+
const { raw, inherited, pod, rigRoot, launchAdditionsFrom } = inputs;
|
|
794
1703
|
// The reservation: a new number and its row in one transaction. The operation id is a UUID.
|
|
795
1704
|
const attemptId = randomUUID();
|
|
796
1705
|
const { slot, logicalId } = deps.slots.reserveAdd({ modelNodeId, attemptId, at: deps.now().toISOString() });
|
|
@@ -801,33 +1710,11 @@ export function makeSeatPoolExecutor(deps) {
|
|
|
801
1710
|
// A pool agent is never kept alive: a kept-alive agent would be relaunched against the pool's own stops. Leaving
|
|
802
1711
|
// the key out is not enough, since the add then resolves it from the agent spec's profile or defaults.
|
|
803
1712
|
const member = { id: memberId, ...inherited, cwd: folder ?? raw["cwd"], keep_alive: false };
|
|
804
|
-
// The re-check just before the issue
|
|
805
|
-
//
|
|
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
|
-
};
|
|
1713
|
+
// The re-check just before the issue (recheckReservation): what cancels the reservation cancels it before any
|
|
1714
|
+
// operation row or call, and ends this cycle's adds.
|
|
828
1715
|
let cancelCause;
|
|
829
1716
|
try {
|
|
830
|
-
cancelCause =
|
|
1717
|
+
cancelCause = recheckReservation(slot.slotNumber);
|
|
831
1718
|
}
|
|
832
1719
|
catch (error) {
|
|
833
1720
|
// A re-check that fails leaves no reservation behind: the reserved row goes before its error is raised.
|
|
@@ -846,12 +1733,6 @@ export function makeSeatPoolExecutor(deps) {
|
|
|
846
1733
|
else {
|
|
847
1734
|
notIssued.push({ slotNumber: slot.slotNumber, logicalId, code: "slot_changed" });
|
|
848
1735
|
}
|
|
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
1736
|
break;
|
|
856
1737
|
}
|
|
857
1738
|
// The issue: the issued attempt, what it was issued on and the operation id, in one transaction.
|
|
@@ -890,6 +1771,9 @@ export function makeSeatPoolExecutor(deps) {
|
|
|
890
1771
|
issuedView.push({ slotNumber: slot.slotNumber, logicalId, attempt: inFlight(attemptId) });
|
|
891
1772
|
}
|
|
892
1773
|
addNotes = {
|
|
1774
|
+
...(refused !== undefined ? { refused } : {}),
|
|
1775
|
+
...(comebackNotes.length ? { comebacks: comebackNotes } : {}),
|
|
1776
|
+
...(failedAddNote ?? {}),
|
|
893
1777
|
...(issuedView.length ? { issued: issuedView } : {}),
|
|
894
1778
|
...(notIssued.length ? { failed: notIssued } : {}),
|
|
895
1779
|
...(cancelled.length ? { cancelled } : {}),
|
|
@@ -899,8 +1783,12 @@ export function makeSeatPoolExecutor(deps) {
|
|
|
899
1783
|
catch (error) {
|
|
900
1784
|
thrown = error;
|
|
901
1785
|
}
|
|
902
|
-
// The calls go out after the lease is released, whatever happened after their issue
|
|
903
|
-
|
|
1786
|
+
// The calls go out after the lease is released, whatever happened after their issue: the comebacks through the
|
|
1787
|
+
// executor's own `comeback`, then the new numbers.
|
|
1788
|
+
startCalls([
|
|
1789
|
+
...(comebackCall ? comebacks.map((request) => () => comebackCall(request)) : []),
|
|
1790
|
+
...issued.map((add) => () => runAdd(modelNodeId, add)),
|
|
1791
|
+
]);
|
|
904
1792
|
if (thrown !== undefined) {
|
|
905
1793
|
// A refused custody is not a failure: the cycle had no effect.
|
|
906
1794
|
if (!(thrown instanceof DeliveryGuardError))
|
|
@@ -1220,9 +2108,11 @@ export function makeSeatPoolExecutor(deps) {
|
|
|
1220
2108
|
...(held ? { held } : {}),
|
|
1221
2109
|
...(advisory ? { advisory } : {}),
|
|
1222
2110
|
...(restore ? { restore } : {}),
|
|
2111
|
+
...(changes.length ? { laterChanges: changes } : {}),
|
|
1223
2112
|
...(moved.length ? { moved } : {}),
|
|
1224
2113
|
...(skipped.length ? { skipped } : {}),
|
|
1225
2114
|
...(failed.length ? { failed } : {}),
|
|
2115
|
+
...(guardErrors.length ? { guardErrors } : {}),
|
|
1226
2116
|
...(drains.length ? { drains } : {}),
|
|
1227
2117
|
...(addNotes && Object.keys(addNotes).length ? { add: addNotes } : {}),
|
|
1228
2118
|
...(custody ? { custody } : {}),
|
|
@@ -1237,5 +2127,6 @@ export function makeSeatPoolExecutor(deps) {
|
|
|
1237
2127
|
return report(notes);
|
|
1238
2128
|
},
|
|
1239
2129
|
};
|
|
2130
|
+
return executor;
|
|
1240
2131
|
}
|
|
1241
2132
|
//# sourceMappingURL=seat-pool-executor.js.map
|