@openrig/cli 0.7.21 → 0.7.23
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/onboarding/01-world-and-purpose.md +2 -1
- package/daemon/assets/onboarding/02-self-and-competent-action.md +6 -0
- package/daemon/assets/plugins/openrig/.claude-plugin/plugin.json +1 -1
- 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/plugin.json +1 -1
- package/daemon/assets/plugins/openrig-core/.claude-plugin/plugin.json +1 -1
- package/daemon/assets/plugins/openrig-core/.codex-plugin/plugin.json +1 -1
- package/daemon/assets/plugins/openrig-core/hooks/claude.json +22 -0
- package/daemon/assets/plugins/openrig-core/hooks/scripts/activity-relay.cjs +23 -0
- package/daemon/assets/plugins/openrig-core/hooks/scripts/compaction-restore-bridge.cjs +82 -9
- package/daemon/assets/plugins/openrig-core/skills/claude-compaction-restore/scripts/precompact-hook.mjs +138 -20
- package/daemon/assets/plugins/openrig-core/skills/claude-compaction-restore/scripts/restore-from-jsonl.mjs +110 -35
- package/daemon/assets/plugins/openrig-core/skills/messaging-the-human/SKILL.md +1 -1
- package/daemon/assets/plugins/openrig-core/skills/openrig-user/SKILL.md +7 -5
- package/daemon/assets/plugins/openrig-core/skills/refocusing/scripts/trace-to-root.py +32 -6
- package/daemon/assets/skills/rigs/SKILL.md +27 -6
- package/daemon/context-packs/help/help.md +12 -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 +27 -7
- package/daemon/context-packs/reference/acp-agents.md +2 -1
- package/daemon/context-packs/reference/getting-started.md +129 -13
- package/daemon/context-packs/reference/manifest.yaml +1 -1
- package/daemon/context-packs/reference/rig-spec.md +210 -7
- package/daemon/context-packs/reference/tmux-servers.md +46 -2
- package/daemon/context-packs/reference/whats-new.md +167 -5
- package/daemon/context-packs/skills/agent-operated-software/manifest.yaml +1 -1
- package/daemon/context-packs/skills/agent-operated-workflows/manifest.yaml +1 -1
- package/daemon/context-packs/skills/applying-a-permission-policy/manifest.yaml +1 -1
- package/daemon/context-packs/skills/claude-compaction-restore/manifest.yaml +1 -1
- package/daemon/context-packs/skills/claude-compaction-restore/scripts/precompact-hook.mjs +138 -20
- package/daemon/context-packs/skills/claude-compaction-restore/scripts/restore-from-jsonl.mjs +110 -35
- package/daemon/context-packs/skills/core/agent-starters/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/agent-startup-and-context-ingestion/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/cross-host-rig-commands/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/human-in-the-loop/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/messaging-the-human/SKILL.md +1 -1
- package/daemon/context-packs/skills/core/messaging-the-human/manifest.yaml +3 -3
- package/daemon/context-packs/skills/core/openrig-architect/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/openrig-cmux/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/openrig-herdr/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/openrig-skills/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/openrig-software-factory/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/openrig-upgrade/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/rig-bundles-and-shareable-artifacts/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/rig-lifecycle/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/session-source-fork/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/specification-system/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/topology-mutation-and-seat-management/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/watchdog/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/working-with-an-openrig-team/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 +7 -5
- package/daemon/context-packs/skills/openrig-user/manifest.yaml +1 -1
- package/daemon/context-packs/skills/orienting-to-an-inherited-seat/manifest.yaml +1 -1
- package/daemon/context-packs/skills/pm/backlog-capture/manifest.yaml +1 -1
- package/daemon/context-packs/skills/pm/context-builder/manifest.yaml +1 -1
- package/daemon/context-packs/skills/pm/exec-summary/manifest.yaml +1 -1
- package/daemon/context-packs/skills/pm/office-hours/manifest.yaml +1 -1
- package/daemon/context-packs/skills/pm/plan-review/manifest.yaml +1 -1
- package/daemon/context-packs/skills/pm/requirements-writer/manifest.yaml +1 -1
- package/daemon/context-packs/skills/pm/ui-mockup/manifest.yaml +1 -1
- package/daemon/context-packs/skills/pods/development-team/manifest.yaml +1 -1
- package/daemon/context-packs/skills/pods/orchestration-team/manifest.yaml +1 -1
- package/daemon/context-packs/skills/pods/oversight-team/manifest.yaml +1 -1
- package/daemon/context-packs/skills/pods/review-team/manifest.yaml +1 -1
- package/daemon/context-packs/skills/process/agent-browser/manifest.yaml +1 -1
- package/daemon/context-packs/skills/process/context-engineering/manifest.yaml +1 -1
- package/daemon/context-packs/skills/process/dogfood/manifest.yaml +1 -1
- package/daemon/context-packs/skills/process/frontend-design/manifest.yaml +1 -1
- package/daemon/context-packs/skills/process/systematic-debugging/manifest.yaml +1 -1
- package/daemon/context-packs/skills/process/test-driven-development/manifest.yaml +1 -1
- package/daemon/context-packs/skills/process/verification-before-completion/manifest.yaml +1 -1
- package/daemon/context-packs/skills/queue-handoff/manifest.yaml +1 -1
- package/daemon/context-packs/skills/refocusing/manifest.yaml +1 -1
- package/daemon/context-packs/skills/refocusing/scripts/trace-to-root.py +32 -6
- package/daemon/context-packs/skills/retiring-and-inheriting-a-seat/manifest.yaml +1 -1
- package/daemon/context-packs/skills/seat-continuity-and-handover/manifest.yaml +1 -1
- package/daemon/context-packs/skills/session-compaction-and-restore/manifest.yaml +1 -1
- package/daemon/context-packs/skills/software-for-agents/manifest.yaml +1 -1
- package/daemon/context-packs/world-example/manifest.yaml +1 -1
- package/daemon/context-packs/world-public/manifest.yaml +1 -1
- package/daemon/dist/adapters/claude-code-adapter.d.ts +14 -1
- package/daemon/dist/adapters/claude-code-adapter.d.ts.map +1 -1
- package/daemon/dist/adapters/claude-code-adapter.js +98 -23
- package/daemon/dist/adapters/claude-code-adapter.js.map +1 -1
- package/daemon/dist/adapters/claude-resume.d.ts +3 -1
- package/daemon/dist/adapters/claude-resume.d.ts.map +1 -1
- package/daemon/dist/adapters/claude-resume.js +35 -11
- package/daemon/dist/adapters/claude-resume.js.map +1 -1
- package/daemon/dist/adapters/claude-settings-transport.d.ts +10 -0
- package/daemon/dist/adapters/claude-settings-transport.d.ts.map +1 -0
- package/daemon/dist/adapters/claude-settings-transport.js +95 -0
- package/daemon/dist/adapters/claude-settings-transport.js.map +1 -0
- package/daemon/dist/adapters/codex-activity-relay.d.ts +6 -0
- package/daemon/dist/adapters/codex-activity-relay.d.ts.map +1 -0
- package/daemon/dist/adapters/codex-activity-relay.js +29 -0
- package/daemon/dist/adapters/codex-activity-relay.js.map +1 -0
- package/daemon/dist/adapters/codex-runtime-adapter.d.ts +2 -1
- package/daemon/dist/adapters/codex-runtime-adapter.d.ts.map +1 -1
- package/daemon/dist/adapters/codex-runtime-adapter.js +30 -17
- package/daemon/dist/adapters/codex-runtime-adapter.js.map +1 -1
- package/daemon/dist/adapters/community-harness-runtime-adapter.d.ts.map +1 -1
- package/daemon/dist/adapters/community-harness-runtime-adapter.js +19 -4
- package/daemon/dist/adapters/community-harness-runtime-adapter.js.map +1 -1
- package/daemon/dist/adapters/pi-recovery-rpc.d.ts +17 -0
- package/daemon/dist/adapters/pi-recovery-rpc.d.ts.map +1 -0
- package/daemon/dist/adapters/pi-recovery-rpc.js +94 -0
- package/daemon/dist/adapters/pi-recovery-rpc.js.map +1 -0
- package/daemon/dist/adapters/pi-runner-protocol.d.ts +6 -0
- package/daemon/dist/adapters/pi-runner-protocol.d.ts.map +1 -1
- package/daemon/dist/adapters/pi-runner-protocol.js.map +1 -1
- package/daemon/dist/adapters/pi-runner.d.ts +77 -0
- package/daemon/dist/adapters/pi-runner.d.ts.map +1 -1
- package/daemon/dist/adapters/pi-runner.js +644 -43
- package/daemon/dist/adapters/pi-runner.js.map +1 -1
- package/daemon/dist/adapters/pi-runtime-adapter.d.ts +6 -0
- package/daemon/dist/adapters/pi-runtime-adapter.d.ts.map +1 -1
- package/daemon/dist/adapters/pi-runtime-adapter.js +11 -0
- package/daemon/dist/adapters/pi-runtime-adapter.js.map +1 -1
- package/daemon/dist/adapters/pi-runtime-recovery.d.ts +10 -0
- package/daemon/dist/adapters/pi-runtime-recovery.d.ts.map +1 -0
- package/daemon/dist/adapters/pi-runtime-recovery.js +82 -0
- package/daemon/dist/adapters/pi-runtime-recovery.js.map +1 -0
- package/daemon/dist/adapters/replace-file.d.ts +5 -2
- package/daemon/dist/adapters/replace-file.d.ts.map +1 -1
- package/daemon/dist/adapters/replace-file.js +6 -3
- package/daemon/dist/adapters/replace-file.js.map +1 -1
- package/daemon/dist/adapters/seat-slice.d.ts +19 -0
- package/daemon/dist/adapters/seat-slice.d.ts.map +1 -0
- package/daemon/dist/adapters/seat-slice.js +29 -0
- package/daemon/dist/adapters/seat-slice.js.map +1 -0
- package/daemon/dist/adapters/shell-quote.d.ts +1 -0
- package/daemon/dist/adapters/shell-quote.d.ts.map +1 -1
- package/daemon/dist/adapters/shell-quote.js +6 -0
- package/daemon/dist/adapters/shell-quote.js.map +1 -1
- package/daemon/dist/adapters/tmux-exec.d.ts.map +1 -1
- package/daemon/dist/adapters/tmux-exec.js +4 -2
- package/daemon/dist/adapters/tmux-exec.js.map +1 -1
- package/daemon/dist/adapters/tmux.d.ts +78 -13
- package/daemon/dist/adapters/tmux.d.ts.map +1 -1
- package/daemon/dist/adapters/tmux.js +361 -82
- package/daemon/dist/adapters/tmux.js.map +1 -1
- package/daemon/dist/build-info.js +3 -3
- package/daemon/dist/daemon-shutdown.d.ts +8 -0
- package/daemon/dist/daemon-shutdown.d.ts.map +1 -1
- package/daemon/dist/daemon-shutdown.js +18 -2
- package/daemon/dist/daemon-shutdown.js.map +1 -1
- package/daemon/dist/db/all-migrations.d.ts.map +1 -1
- package/daemon/dist/db/all-migrations.js +24 -0
- package/daemon/dist/db/all-migrations.js.map +1 -1
- package/daemon/dist/db/migrate.d.ts +15 -1
- package/daemon/dist/db/migrate.d.ts.map +1 -1
- package/daemon/dist/db/migrate.js +41 -6
- package/daemon/dist/db/migrate.js.map +1 -1
- package/daemon/dist/db/migrations/179_remote_control_observations.d.ts +10 -0
- package/daemon/dist/db/migrations/179_remote_control_observations.d.ts.map +1 -0
- package/daemon/dist/db/migrations/179_remote_control_observations.js +20 -0
- package/daemon/dist/db/migrations/179_remote_control_observations.js.map +1 -0
- package/daemon/dist/db/migrations/180_session_stop_attempt.d.ts +5 -0
- package/daemon/dist/db/migrations/180_session_stop_attempt.d.ts.map +1 -0
- package/daemon/dist/db/migrations/180_session_stop_attempt.js +7 -0
- package/daemon/dist/db/migrations/180_session_stop_attempt.js.map +1 -0
- package/daemon/dist/db/migrations/181_node_keep_alive.d.ts +8 -0
- package/daemon/dist/db/migrations/181_node_keep_alive.d.ts.map +1 -0
- package/daemon/dist/db/migrations/181_node_keep_alive.js +26 -0
- package/daemon/dist/db/migrations/181_node_keep_alive.js.map +1 -0
- package/daemon/dist/db/migrations/182_queue_items_blocked_on_index.d.ts +7 -0
- package/daemon/dist/db/migrations/182_queue_items_blocked_on_index.d.ts.map +1 -0
- package/daemon/dist/db/migrations/182_queue_items_blocked_on_index.js +11 -0
- package/daemon/dist/db/migrations/182_queue_items_blocked_on_index.js.map +1 -0
- package/daemon/dist/db/migrations/183_queue_items_scan_indexes.d.ts +8 -0
- package/daemon/dist/db/migrations/183_queue_items_scan_indexes.d.ts.map +1 -0
- package/daemon/dist/db/migrations/183_queue_items_scan_indexes.js +13 -0
- package/daemon/dist/db/migrations/183_queue_items_scan_indexes.js.map +1 -0
- package/daemon/dist/db/migrations/184_network_requests.d.ts +11 -0
- package/daemon/dist/db/migrations/184_network_requests.d.ts.map +1 -0
- package/daemon/dist/db/migrations/184_network_requests.js +32 -0
- package/daemon/dist/db/migrations/184_network_requests.js.map +1 -0
- package/daemon/dist/db/migrations/185_seat_cold_starts.d.ts +9 -0
- package/daemon/dist/db/migrations/185_seat_cold_starts.d.ts.map +1 -0
- package/daemon/dist/db/migrations/185_seat_cold_starts.js +19 -0
- package/daemon/dist/db/migrations/185_seat_cold_starts.js.map +1 -0
- package/daemon/dist/db/migrations/186_queue_relayed_answers.d.ts +3 -0
- package/daemon/dist/db/migrations/186_queue_relayed_answers.d.ts.map +1 -0
- package/daemon/dist/db/migrations/186_queue_relayed_answers.js +5 -0
- package/daemon/dist/db/migrations/186_queue_relayed_answers.js.map +1 -0
- package/daemon/dist/db/migrations/189_rig_seat_slice.d.ts +5 -0
- package/daemon/dist/db/migrations/189_rig_seat_slice.d.ts.map +1 -0
- package/daemon/dist/db/migrations/189_rig_seat_slice.js +7 -0
- package/daemon/dist/db/migrations/189_rig_seat_slice.js.map +1 -0
- package/daemon/dist/db/migrations/190_queue_transfer_staging.d.ts +3 -0
- package/daemon/dist/db/migrations/190_queue_transfer_staging.d.ts.map +1 -0
- package/daemon/dist/db/migrations/190_queue_transfer_staging.js +20 -0
- package/daemon/dist/db/migrations/190_queue_transfer_staging.js.map +1 -0
- package/daemon/dist/db/migrations/191_network_binding_providers.d.ts +3 -0
- package/daemon/dist/db/migrations/191_network_binding_providers.d.ts.map +1 -0
- package/daemon/dist/db/migrations/191_network_binding_providers.js +27 -0
- package/daemon/dist/db/migrations/191_network_binding_providers.js.map +1 -0
- package/daemon/dist/db/migrations/194_workflow_run_title.d.ts +4 -0
- package/daemon/dist/db/migrations/194_workflow_run_title.d.ts.map +1 -0
- package/daemon/dist/db/migrations/194_workflow_run_title.js +6 -0
- package/daemon/dist/db/migrations/194_workflow_run_title.js.map +1 -0
- package/daemon/dist/domain/activity-taxonomy.d.ts +14 -0
- package/daemon/dist/domain/activity-taxonomy.d.ts.map +1 -1
- package/daemon/dist/domain/activity-taxonomy.js.map +1 -1
- package/daemon/dist/domain/agent-activity-store.d.ts +61 -0
- package/daemon/dist/domain/agent-activity-store.d.ts.map +1 -1
- package/daemon/dist/domain/agent-activity-store.js +261 -48
- package/daemon/dist/domain/agent-activity-store.js.map +1 -1
- package/daemon/dist/domain/agent-manifest.d.ts.map +1 -1
- package/daemon/dist/domain/agent-manifest.js +6 -0
- package/daemon/dist/domain/agent-manifest.js.map +1 -1
- package/daemon/dist/domain/bootstrap-orchestrator.d.ts.map +1 -1
- package/daemon/dist/domain/bootstrap-orchestrator.js +14 -3
- package/daemon/dist/domain/bootstrap-orchestrator.js.map +1 -1
- package/daemon/dist/domain/claude-compaction-enforcer.d.ts +58 -2
- package/daemon/dist/domain/claude-compaction-enforcer.d.ts.map +1 -1
- package/daemon/dist/domain/claude-compaction-enforcer.js +142 -9
- package/daemon/dist/domain/claude-compaction-enforcer.js.map +1 -1
- package/daemon/dist/domain/claude-continuation-launch.d.ts +3 -2
- package/daemon/dist/domain/claude-continuation-launch.d.ts.map +1 -1
- package/daemon/dist/domain/claude-continuation-launch.js +12 -11
- package/daemon/dist/domain/claude-continuation-launch.js.map +1 -1
- package/daemon/dist/domain/codex-thread-id.d.ts +20 -2
- package/daemon/dist/domain/codex-thread-id.d.ts.map +1 -1
- package/daemon/dist/domain/codex-thread-id.js +69 -4
- package/daemon/dist/domain/codex-thread-id.js.map +1 -1
- package/daemon/dist/domain/compaction-restore-notice.d.ts +14 -1
- package/daemon/dist/domain/compaction-restore-notice.d.ts.map +1 -1
- package/daemon/dist/domain/compaction-restore-notice.js +174 -19
- package/daemon/dist/domain/compaction-restore-notice.js.map +1 -1
- package/daemon/dist/domain/context-packs/seat-recap-store.d.ts.map +1 -1
- package/daemon/dist/domain/context-packs/seat-recap-store.js +20 -3
- package/daemon/dist/domain/context-packs/seat-recap-store.js.map +1 -1
- package/daemon/dist/domain/continuity-policy-materializer.d.ts.map +1 -1
- package/daemon/dist/domain/continuity-policy-materializer.js +11 -3
- package/daemon/dist/domain/continuity-policy-materializer.js.map +1 -1
- package/daemon/dist/domain/core-app-job.d.ts +4 -4
- package/daemon/dist/domain/core-app-job.d.ts.map +1 -1
- package/daemon/dist/domain/core-app-job.js +4 -59
- package/daemon/dist/domain/core-app-job.js.map +1 -1
- package/daemon/dist/domain/current-work.d.ts +12 -0
- package/daemon/dist/domain/current-work.d.ts.map +1 -1
- package/daemon/dist/domain/current-work.js +4 -0
- package/daemon/dist/domain/current-work.js.map +1 -1
- package/daemon/dist/domain/escalation-owner.d.ts +3 -0
- package/daemon/dist/domain/escalation-owner.d.ts.map +1 -1
- package/daemon/dist/domain/escalation-owner.js +9 -3
- package/daemon/dist/domain/escalation-owner.js.map +1 -1
- package/daemon/dist/domain/execution-candidate-reader.d.ts +3 -0
- package/daemon/dist/domain/execution-candidate-reader.d.ts.map +1 -1
- package/daemon/dist/domain/execution-candidate-reader.js +8 -2
- package/daemon/dist/domain/execution-candidate-reader.js.map +1 -1
- package/daemon/dist/domain/existing-rig-restore.d.ts +2 -0
- package/daemon/dist/domain/existing-rig-restore.d.ts.map +1 -1
- package/daemon/dist/domain/existing-rig-restore.js +11 -1
- package/daemon/dist/domain/existing-rig-restore.js.map +1 -1
- package/daemon/dist/domain/expected-conversation.js +2 -2
- package/daemon/dist/domain/expected-conversation.js.map +1 -1
- package/daemon/dist/domain/gateway/slack/inbound.d.ts +3 -1
- package/daemon/dist/domain/gateway/slack/inbound.d.ts.map +1 -1
- package/daemon/dist/domain/gateway/slack/inbound.js +56 -11
- package/daemon/dist/domain/gateway/slack/inbound.js.map +1 -1
- package/daemon/dist/domain/gateway/slack/message.d.ts +1 -4
- package/daemon/dist/domain/gateway/slack/message.d.ts.map +1 -1
- package/daemon/dist/domain/gateway/slack/message.js +17 -5
- package/daemon/dist/domain/gateway/slack/message.js.map +1 -1
- package/daemon/dist/domain/gateway/slack/notice-content-dedup.d.ts +23 -0
- package/daemon/dist/domain/gateway/slack/notice-content-dedup.d.ts.map +1 -0
- package/daemon/dist/domain/gateway/slack/notice-content-dedup.js +87 -0
- package/daemon/dist/domain/gateway/slack/notice-content-dedup.js.map +1 -0
- package/daemon/dist/domain/gateway/slack/queue-access.d.ts +7 -1
- package/daemon/dist/domain/gateway/slack/queue-access.d.ts.map +1 -1
- package/daemon/dist/domain/gateway/slack/queue-access.js +1 -0
- package/daemon/dist/domain/gateway/slack/queue-access.js.map +1 -1
- package/daemon/dist/domain/gateway/slack/settled-asks.d.ts.map +1 -1
- package/daemon/dist/domain/gateway/slack/settled-asks.js +17 -3
- package/daemon/dist/domain/gateway/slack/settled-asks.js.map +1 -1
- package/daemon/dist/domain/gateway/slack/slack-delivery.d.ts +0 -17
- package/daemon/dist/domain/gateway/slack/slack-delivery.d.ts.map +1 -1
- package/daemon/dist/domain/gateway/slack/slack-delivery.js +10 -40
- package/daemon/dist/domain/gateway/slack/slack-delivery.js.map +1 -1
- package/daemon/dist/domain/gateway/slack/slack-subsystem.d.ts +3 -1
- package/daemon/dist/domain/gateway/slack/slack-subsystem.d.ts.map +1 -1
- package/daemon/dist/domain/gateway/slack/slack-subsystem.js +21 -7
- package/daemon/dist/domain/gateway/slack/slack-subsystem.js.map +1 -1
- package/daemon/dist/domain/harness-not-started-notice.d.ts +5 -2
- package/daemon/dist/domain/harness-not-started-notice.d.ts.map +1 -1
- package/daemon/dist/domain/harness-not-started-notice.js +46 -15
- package/daemon/dist/domain/harness-not-started-notice.js.map +1 -1
- package/daemon/dist/domain/health-passive-ceremony.d.ts.map +1 -1
- package/daemon/dist/domain/health-passive-ceremony.js +3 -2
- package/daemon/dist/domain/health-passive-ceremony.js.map +1 -1
- package/daemon/dist/domain/hosts/read-through.d.ts +1 -1
- package/daemon/dist/domain/hosts/read-through.d.ts.map +1 -1
- package/daemon/dist/domain/hosts/read-through.js +3 -2
- package/daemon/dist/domain/hosts/read-through.js.map +1 -1
- package/daemon/dist/domain/hosts/remote-daemon-http.d.ts +2 -0
- package/daemon/dist/domain/hosts/remote-daemon-http.d.ts.map +1 -1
- package/daemon/dist/domain/hosts/remote-daemon-http.js +1 -1
- package/daemon/dist/domain/hosts/remote-daemon-http.js.map +1 -1
- package/daemon/dist/domain/hot-potato-enforcer.d.ts +3 -3
- package/daemon/dist/domain/hot-potato-enforcer.d.ts.map +1 -1
- package/daemon/dist/domain/hot-potato-enforcer.js +2 -2
- package/daemon/dist/domain/hot-potato-enforcer.js.map +1 -1
- package/daemon/dist/domain/human-questions.d.ts +1 -1
- package/daemon/dist/domain/human-questions.d.ts.map +1 -1
- package/daemon/dist/domain/human-questions.js +2 -0
- package/daemon/dist/domain/human-questions.js.map +1 -1
- package/daemon/dist/domain/input-read-diagnostic.js +1 -1
- package/daemon/dist/domain/input-read-diagnostic.js.map +1 -1
- package/daemon/dist/domain/install-planner.d.ts +8 -0
- package/daemon/dist/domain/install-planner.d.ts.map +1 -1
- package/daemon/dist/domain/install-planner.js +26 -6
- package/daemon/dist/domain/install-planner.js.map +1 -1
- package/daemon/dist/domain/keep-alive-supervisor.d.ts +178 -0
- package/daemon/dist/domain/keep-alive-supervisor.d.ts.map +1 -0
- package/daemon/dist/domain/keep-alive-supervisor.js +523 -0
- package/daemon/dist/domain/keep-alive-supervisor.js.map +1 -0
- package/daemon/dist/domain/mission-control/mission-control-fleet-cli-capability.d.ts +6 -0
- package/daemon/dist/domain/mission-control/mission-control-fleet-cli-capability.d.ts.map +1 -1
- package/daemon/dist/domain/mission-control/mission-control-fleet-cli-capability.js +39 -9
- package/daemon/dist/domain/mission-control/mission-control-fleet-cli-capability.js.map +1 -1
- package/daemon/dist/domain/mission-control/mission-control-write-contract.d.ts.map +1 -1
- package/daemon/dist/domain/mission-control/mission-control-write-contract.js +29 -1
- package/daemon/dist/domain/mission-control/mission-control-write-contract.js.map +1 -1
- package/daemon/dist/domain/model-divergence/current-generation-record.d.ts +4 -1
- package/daemon/dist/domain/model-divergence/current-generation-record.d.ts.map +1 -1
- package/daemon/dist/domain/model-divergence/current-generation-record.js +18 -2
- package/daemon/dist/domain/model-divergence/current-generation-record.js.map +1 -1
- package/daemon/dist/domain/mutation-trace.d.ts +28 -0
- package/daemon/dist/domain/mutation-trace.d.ts.map +1 -0
- package/daemon/dist/domain/mutation-trace.js +38 -0
- package/daemon/dist/domain/mutation-trace.js.map +1 -0
- package/daemon/dist/domain/native-resume-probe.d.ts +13 -3
- package/daemon/dist/domain/native-resume-probe.d.ts.map +1 -1
- package/daemon/dist/domain/native-resume-probe.js +54 -17
- package/daemon/dist/domain/native-resume-probe.js.map +1 -1
- package/daemon/dist/domain/network/hub-client.d.ts +30 -1
- package/daemon/dist/domain/network/hub-client.d.ts.map +1 -1
- package/daemon/dist/domain/network/hub-client.js +62 -9
- package/daemon/dist/domain/network/hub-client.js.map +1 -1
- package/daemon/dist/domain/network/network-bindings.d.ts +52 -2
- package/daemon/dist/domain/network/network-bindings.d.ts.map +1 -1
- package/daemon/dist/domain/network/network-bindings.js +217 -23
- package/daemon/dist/domain/network/network-bindings.js.map +1 -1
- package/daemon/dist/domain/network/network-connector.d.ts +9 -1
- package/daemon/dist/domain/network/network-connector.d.ts.map +1 -1
- package/daemon/dist/domain/network/network-connector.js +95 -7
- package/daemon/dist/domain/network/network-connector.js.map +1 -1
- package/daemon/dist/domain/network/network-installations.d.ts.map +1 -1
- package/daemon/dist/domain/network/network-installations.js +22 -7
- package/daemon/dist/domain/network/network-installations.js.map +1 -1
- package/daemon/dist/domain/network/network-provider-removal.d.ts +9 -0
- package/daemon/dist/domain/network/network-provider-removal.d.ts.map +1 -0
- package/daemon/dist/domain/network/network-provider-removal.js +75 -0
- package/daemon/dist/domain/network/network-provider-removal.js.map +1 -0
- package/daemon/dist/domain/network/network-requests.d.ts +59 -0
- package/daemon/dist/domain/network/network-requests.d.ts.map +1 -0
- package/daemon/dist/domain/network/network-requests.js +476 -0
- package/daemon/dist/domain/network/network-requests.js.map +1 -0
- package/daemon/dist/domain/node-inventory.d.ts +26 -0
- package/daemon/dist/domain/node-inventory.d.ts.map +1 -1
- package/daemon/dist/domain/node-inventory.js +93 -9
- package/daemon/dist/domain/node-inventory.js.map +1 -1
- package/daemon/dist/domain/occupant-invalidator.d.ts +1 -1
- package/daemon/dist/domain/occupant-invalidator.d.ts.map +1 -1
- package/daemon/dist/domain/occupant-invalidator.js +1 -1
- package/daemon/dist/domain/occupant-invalidator.js.map +1 -1
- package/daemon/dist/domain/outbox-handler.d.ts +11 -0
- package/daemon/dist/domain/outbox-handler.d.ts.map +1 -1
- package/daemon/dist/domain/outbox-handler.js +20 -0
- package/daemon/dist/domain/outbox-handler.js.map +1 -1
- package/daemon/dist/domain/package-install-service.d.ts +1 -0
- package/daemon/dist/domain/package-install-service.d.ts.map +1 -1
- package/daemon/dist/domain/package-install-service.js +1 -0
- package/daemon/dist/domain/package-install-service.js.map +1 -1
- package/daemon/dist/domain/parked-owner-escalation.d.ts +16 -0
- package/daemon/dist/domain/parked-owner-escalation.d.ts.map +1 -0
- package/daemon/dist/domain/parked-owner-escalation.js +53 -0
- package/daemon/dist/domain/parked-owner-escalation.js.map +1 -0
- package/daemon/dist/domain/parked-query.d.ts +6 -0
- package/daemon/dist/domain/parked-query.d.ts.map +1 -1
- package/daemon/dist/domain/parked-query.js +20 -7
- package/daemon/dist/domain/parked-query.js.map +1 -1
- package/daemon/dist/domain/permission-stop-observation.d.ts +8 -1
- package/daemon/dist/domain/permission-stop-observation.d.ts.map +1 -1
- package/daemon/dist/domain/permission-stop-observation.js +19 -2
- package/daemon/dist/domain/permission-stop-observation.js.map +1 -1
- package/daemon/dist/domain/policies/parked-owner-consumer.d.ts +13 -0
- package/daemon/dist/domain/policies/parked-owner-consumer.d.ts.map +1 -1
- package/daemon/dist/domain/policies/parked-owner-consumer.js +24 -1
- package/daemon/dist/domain/policies/parked-owner-consumer.js.map +1 -1
- package/daemon/dist/domain/policies/seat-pool.d.ts +15 -1
- package/daemon/dist/domain/policies/seat-pool.d.ts.map +1 -1
- package/daemon/dist/domain/policies/seat-pool.js +31 -8
- package/daemon/dist/domain/policies/seat-pool.js.map +1 -1
- package/daemon/dist/domain/process-census.d.ts +5 -1
- package/daemon/dist/domain/process-census.d.ts.map +1 -1
- package/daemon/dist/domain/process-census.js +20 -11
- package/daemon/dist/domain/process-census.js.map +1 -1
- package/daemon/dist/domain/profile-resolver.d.ts +7 -1
- package/daemon/dist/domain/profile-resolver.d.ts.map +1 -1
- package/daemon/dist/domain/profile-resolver.js +7 -0
- package/daemon/dist/domain/profile-resolver.js.map +1 -1
- package/daemon/dist/domain/progress/progress-indexer.d.ts.map +1 -1
- package/daemon/dist/domain/progress/progress-indexer.js +11 -0
- package/daemon/dist/domain/progress/progress-indexer.js.map +1 -1
- package/daemon/dist/domain/project-lifecycle-compiler.d.ts.map +1 -1
- package/daemon/dist/domain/project-lifecycle-compiler.js +4 -1
- package/daemon/dist/domain/project-lifecycle-compiler.js.map +1 -1
- package/daemon/dist/domain/proof/judgments.d.ts +10 -0
- package/daemon/dist/domain/proof/judgments.d.ts.map +1 -1
- package/daemon/dist/domain/proof/judgments.js +31 -11
- package/daemon/dist/domain/proof/judgments.js.map +1 -1
- package/daemon/dist/domain/proof/source-watch.js +4 -4
- package/daemon/dist/domain/proof/source-watch.js.map +1 -1
- package/daemon/dist/domain/provider/claude-interruption.d.ts +6 -0
- package/daemon/dist/domain/provider/claude-interruption.d.ts.map +1 -1
- package/daemon/dist/domain/provider/claude-interruption.js +18 -0
- package/daemon/dist/domain/provider/claude-interruption.js.map +1 -1
- package/daemon/dist/domain/provider/codex-limit-banner.d.ts +17 -1
- package/daemon/dist/domain/provider/codex-limit-banner.d.ts.map +1 -1
- package/daemon/dist/domain/provider/codex-limit-banner.js +38 -5
- package/daemon/dist/domain/provider/codex-limit-banner.js.map +1 -1
- package/daemon/dist/domain/ps-projection.d.ts +17 -1
- package/daemon/dist/domain/ps-projection.d.ts.map +1 -1
- package/daemon/dist/domain/ps-projection.js +41 -6
- package/daemon/dist/domain/ps-projection.js.map +1 -1
- package/daemon/dist/domain/queue-erasure.d.ts +3 -0
- package/daemon/dist/domain/queue-erasure.d.ts.map +1 -1
- package/daemon/dist/domain/queue-erasure.js +2 -2
- package/daemon/dist/domain/queue-erasure.js.map +1 -1
- package/daemon/dist/domain/queue-owner.d.ts +5 -0
- package/daemon/dist/domain/queue-owner.d.ts.map +1 -1
- package/daemon/dist/domain/queue-owner.js +16 -8
- package/daemon/dist/domain/queue-owner.js.map +1 -1
- package/daemon/dist/domain/queue-read-wait.d.ts +12 -0
- package/daemon/dist/domain/queue-read-wait.d.ts.map +1 -0
- package/daemon/dist/domain/queue-read-wait.js +43 -0
- package/daemon/dist/domain/queue-read-wait.js.map +1 -0
- package/daemon/dist/domain/queue-recorded-graph.d.ts +32 -0
- package/daemon/dist/domain/queue-recorded-graph.d.ts.map +1 -0
- package/daemon/dist/domain/queue-recorded-graph.js +84 -0
- package/daemon/dist/domain/queue-recorded-graph.js.map +1 -0
- package/daemon/dist/domain/queue-repository.d.ts +143 -8
- package/daemon/dist/domain/queue-repository.d.ts.map +1 -1
- package/daemon/dist/domain/queue-repository.js +689 -59
- package/daemon/dist/domain/queue-repository.js.map +1 -1
- package/daemon/dist/domain/queue-retention.d.ts +1 -1
- package/daemon/dist/domain/queue-retention.d.ts.map +1 -1
- package/daemon/dist/domain/queue-retention.js +4 -0
- package/daemon/dist/domain/queue-retention.js.map +1 -1
- package/daemon/dist/domain/queue-stuck-sweep.d.ts +10 -4
- package/daemon/dist/domain/queue-stuck-sweep.d.ts.map +1 -1
- package/daemon/dist/domain/queue-stuck-sweep.js +169 -21
- package/daemon/dist/domain/queue-stuck-sweep.js.map +1 -1
- package/daemon/dist/domain/queue-transfer-export.d.ts +75 -0
- package/daemon/dist/domain/queue-transfer-export.d.ts.map +1 -0
- package/daemon/dist/domain/queue-transfer-export.js +156 -0
- package/daemon/dist/domain/queue-transfer-export.js.map +1 -0
- package/daemon/dist/domain/queue-transfer-format.d.ts +15 -0
- package/daemon/dist/domain/queue-transfer-format.d.ts.map +1 -0
- package/daemon/dist/domain/queue-transfer-format.js +32 -0
- package/daemon/dist/domain/queue-transfer-format.js.map +1 -0
- package/daemon/dist/domain/queue-transfer-parse.d.ts +40 -0
- package/daemon/dist/domain/queue-transfer-parse.d.ts.map +1 -0
- package/daemon/dist/domain/queue-transfer-parse.js +131 -0
- package/daemon/dist/domain/queue-transfer-parse.js.map +1 -0
- package/daemon/dist/domain/queue-transfer-review.d.ts +22 -0
- package/daemon/dist/domain/queue-transfer-review.d.ts.map +1 -0
- package/daemon/dist/domain/queue-transfer-review.js +81 -0
- package/daemon/dist/domain/queue-transfer-review.js.map +1 -0
- package/daemon/dist/domain/queue-transfer-staging.d.ts +79 -0
- package/daemon/dist/domain/queue-transfer-staging.d.ts.map +1 -0
- package/daemon/dist/domain/queue-transfer-staging.js +67 -0
- package/daemon/dist/domain/queue-transfer-staging.js.map +1 -0
- package/daemon/dist/domain/queue-transition-log.js +3 -3
- package/daemon/dist/domain/queue-wake-ladder.d.ts +20 -3
- package/daemon/dist/domain/queue-wake-ladder.d.ts.map +1 -1
- package/daemon/dist/domain/queue-wake-ladder.js +299 -41
- package/daemon/dist/domain/queue-wake-ladder.js.map +1 -1
- package/daemon/dist/domain/reconciler.d.ts +27 -2
- package/daemon/dist/domain/reconciler.d.ts.map +1 -1
- package/daemon/dist/domain/reconciler.js +184 -16
- package/daemon/dist/domain/reconciler.js.map +1 -1
- package/daemon/dist/domain/refusal-trace.d.ts +15 -0
- package/daemon/dist/domain/refusal-trace.d.ts.map +1 -0
- package/daemon/dist/domain/refusal-trace.js +23 -0
- package/daemon/dist/domain/refusal-trace.js.map +1 -0
- package/daemon/dist/domain/relayed-answers.d.ts +80 -0
- package/daemon/dist/domain/relayed-answers.d.ts.map +1 -0
- package/daemon/dist/domain/relayed-answers.js +8 -0
- package/daemon/dist/domain/relayed-answers.js.map +1 -0
- package/daemon/dist/domain/remote-control-observations.d.ts +50 -0
- package/daemon/dist/domain/remote-control-observations.d.ts.map +1 -0
- package/daemon/dist/domain/remote-control-observations.js +72 -0
- package/daemon/dist/domain/remote-control-observations.js.map +1 -0
- package/daemon/dist/domain/restore-attempt-receipt.d.ts.map +1 -1
- package/daemon/dist/domain/restore-attempt-receipt.js +8 -2
- package/daemon/dist/domain/restore-attempt-receipt.js.map +1 -1
- package/daemon/dist/domain/restore-check-service.d.ts.map +1 -1
- package/daemon/dist/domain/restore-check-service.js +3 -2
- package/daemon/dist/domain/restore-check-service.js.map +1 -1
- package/daemon/dist/domain/restore-orchestrator.d.ts +70 -14
- package/daemon/dist/domain/restore-orchestrator.d.ts.map +1 -1
- package/daemon/dist/domain/restore-orchestrator.js +429 -107
- package/daemon/dist/domain/restore-orchestrator.js.map +1 -1
- package/daemon/dist/domain/return-route.d.ts +9 -2
- package/daemon/dist/domain/return-route.d.ts.map +1 -1
- package/daemon/dist/domain/return-route.js +22 -1
- package/daemon/dist/domain/return-route.js.map +1 -1
- package/daemon/dist/domain/rig-lifecycle-service.d.ts.map +1 -1
- package/daemon/dist/domain/rig-lifecycle-service.js +4 -1
- package/daemon/dist/domain/rig-lifecycle-service.js.map +1 -1
- package/daemon/dist/domain/rig-repository.d.ts +38 -3
- package/daemon/dist/domain/rig-repository.d.ts.map +1 -1
- package/daemon/dist/domain/rig-repository.js +95 -3
- package/daemon/dist/domain/rig-repository.js.map +1 -1
- package/daemon/dist/domain/rig-teardown.d.ts +22 -7
- package/daemon/dist/domain/rig-teardown.d.ts.map +1 -1
- package/daemon/dist/domain/rig-teardown.js +108 -24
- package/daemon/dist/domain/rig-teardown.js.map +1 -1
- package/daemon/dist/domain/rigspec-codec.d.ts.map +1 -1
- package/daemon/dist/domain/rigspec-codec.js +12 -0
- package/daemon/dist/domain/rigspec-codec.js.map +1 -1
- package/daemon/dist/domain/rigspec-exporter.d.ts +14 -0
- package/daemon/dist/domain/rigspec-exporter.d.ts.map +1 -1
- package/daemon/dist/domain/rigspec-exporter.js +56 -14
- package/daemon/dist/domain/rigspec-exporter.js.map +1 -1
- package/daemon/dist/domain/rigspec-instantiator.d.ts +32 -3
- package/daemon/dist/domain/rigspec-instantiator.d.ts.map +1 -1
- package/daemon/dist/domain/rigspec-instantiator.js +135 -29
- package/daemon/dist/domain/rigspec-instantiator.js.map +1 -1
- package/daemon/dist/domain/rigspec-preflight.d.ts +4 -1
- package/daemon/dist/domain/rigspec-preflight.d.ts.map +1 -1
- package/daemon/dist/domain/rigspec-preflight.js +9 -1
- package/daemon/dist/domain/rigspec-preflight.js.map +1 -1
- package/daemon/dist/domain/rigspec-schema.d.ts.map +1 -1
- package/daemon/dist/domain/rigspec-schema.js +30 -4
- package/daemon/dist/domain/rigspec-schema.js.map +1 -1
- package/daemon/dist/domain/rosters.d.ts +1 -0
- package/daemon/dist/domain/rosters.d.ts.map +1 -1
- package/daemon/dist/domain/rosters.js +5 -4
- package/daemon/dist/domain/rosters.js.map +1 -1
- package/daemon/dist/domain/runtime-adapter.d.ts +2 -0
- package/daemon/dist/domain/runtime-adapter.d.ts.map +1 -1
- package/daemon/dist/domain/runtime-recovery.d.ts +41 -0
- package/daemon/dist/domain/runtime-recovery.d.ts.map +1 -0
- package/daemon/dist/domain/runtime-recovery.js +2 -0
- package/daemon/dist/domain/runtime-recovery.js.map +1 -0
- package/daemon/dist/domain/seat-activity-service.d.ts +37 -1
- package/daemon/dist/domain/seat-activity-service.d.ts.map +1 -1
- package/daemon/dist/domain/seat-activity-service.js +160 -7
- package/daemon/dist/domain/seat-activity-service.js.map +1 -1
- package/daemon/dist/domain/seat-attention-reconciler.d.ts +7 -0
- package/daemon/dist/domain/seat-attention-reconciler.d.ts.map +1 -1
- package/daemon/dist/domain/seat-attention-reconciler.js +149 -65
- package/daemon/dist/domain/seat-attention-reconciler.js.map +1 -1
- package/daemon/dist/domain/seat-cold-start.d.ts +150 -0
- package/daemon/dist/domain/seat-cold-start.d.ts.map +1 -0
- package/daemon/dist/domain/seat-cold-start.js +371 -0
- package/daemon/dist/domain/seat-cold-start.js.map +1 -0
- package/daemon/dist/domain/seat-delivery-guard.d.ts +11 -2
- package/daemon/dist/domain/seat-delivery-guard.d.ts.map +1 -1
- package/daemon/dist/domain/seat-delivery-guard.js +34 -6
- package/daemon/dist/domain/seat-delivery-guard.js.map +1 -1
- package/daemon/dist/domain/seat-identity-reconciler.d.ts +43 -0
- package/daemon/dist/domain/seat-identity-reconciler.d.ts.map +1 -1
- package/daemon/dist/domain/seat-identity-reconciler.js +109 -23
- package/daemon/dist/domain/seat-identity-reconciler.js.map +1 -1
- package/daemon/dist/domain/seat-identity-store.d.ts +5 -3
- package/daemon/dist/domain/seat-identity-store.d.ts.map +1 -1
- package/daemon/dist/domain/seat-identity-store.js +7 -3
- package/daemon/dist/domain/seat-identity-store.js.map +1 -1
- package/daemon/dist/domain/seat-launch-environment.d.ts +2 -0
- package/daemon/dist/domain/seat-launch-environment.d.ts.map +1 -1
- package/daemon/dist/domain/seat-launch-environment.js +9 -1
- package/daemon/dist/domain/seat-launch-environment.js.map +1 -1
- package/daemon/dist/domain/seat-lifecycle-service.d.ts +17 -0
- package/daemon/dist/domain/seat-lifecycle-service.d.ts.map +1 -1
- package/daemon/dist/domain/seat-lifecycle-service.js +180 -23
- package/daemon/dist/domain/seat-lifecycle-service.js.map +1 -1
- package/daemon/dist/domain/seat-pool-executor.d.ts +116 -0
- package/daemon/dist/domain/seat-pool-executor.d.ts.map +1 -0
- package/daemon/dist/domain/seat-pool-executor.js +565 -0
- package/daemon/dist/domain/seat-pool-executor.js.map +1 -0
- package/daemon/dist/domain/seat-pool-registration.d.ts +93 -0
- package/daemon/dist/domain/seat-pool-registration.d.ts.map +1 -0
- package/daemon/dist/domain/seat-pool-registration.js +149 -0
- package/daemon/dist/domain/seat-pool-registration.js.map +1 -0
- package/daemon/dist/domain/seat-pool-slots.d.ts +42 -0
- package/daemon/dist/domain/seat-pool-slots.d.ts.map +1 -1
- package/daemon/dist/domain/seat-pool-slots.js +51 -0
- package/daemon/dist/domain/seat-pool-slots.js.map +1 -1
- package/daemon/dist/domain/seat-pool-spec.d.ts +10 -0
- package/daemon/dist/domain/seat-pool-spec.d.ts.map +1 -1
- package/daemon/dist/domain/seat-pool-spec.js +22 -2
- package/daemon/dist/domain/seat-pool-spec.js.map +1 -1
- package/daemon/dist/domain/seat-restart-in-place.d.ts +17 -0
- package/daemon/dist/domain/seat-restart-in-place.d.ts.map +1 -1
- package/daemon/dist/domain/seat-restart-in-place.js +57 -4
- package/daemon/dist/domain/seat-restart-in-place.js.map +1 -1
- package/daemon/dist/domain/seat-runtime-home-record.d.ts +8 -0
- package/daemon/dist/domain/seat-runtime-home-record.d.ts.map +1 -1
- package/daemon/dist/domain/seat-runtime-home-record.js +1 -1
- package/daemon/dist/domain/seat-runtime-home-record.js.map +1 -1
- package/daemon/dist/domain/session-registry.d.ts +25 -3
- package/daemon/dist/domain/session-registry.d.ts.map +1 -1
- package/daemon/dist/domain/session-registry.js +47 -6
- package/daemon/dist/domain/session-registry.js.map +1 -1
- package/daemon/dist/domain/session-transport.d.ts +28 -1
- package/daemon/dist/domain/session-transport.d.ts.map +1 -1
- package/daemon/dist/domain/session-transport.js +80 -33
- package/daemon/dist/domain/session-transport.js.map +1 -1
- package/daemon/dist/domain/slices/slice-indexer.d.ts +59 -0
- package/daemon/dist/domain/slices/slice-indexer.d.ts.map +1 -1
- package/daemon/dist/domain/slices/slice-indexer.js +288 -63
- package/daemon/dist/domain/slices/slice-indexer.js.map +1 -1
- package/daemon/dist/domain/slow-op-recorder.d.ts +3 -1
- package/daemon/dist/domain/slow-op-recorder.d.ts.map +1 -1
- package/daemon/dist/domain/slow-op-recorder.js +7 -1
- package/daemon/dist/domain/slow-op-recorder.js.map +1 -1
- package/daemon/dist/domain/startup-orchestrator.d.ts +1 -1
- package/daemon/dist/domain/startup-orchestrator.d.ts.map +1 -1
- package/daemon/dist/domain/startup-orchestrator.js +75 -23
- package/daemon/dist/domain/startup-orchestrator.js.map +1 -1
- package/daemon/dist/domain/startup-proof.d.ts +6 -0
- package/daemon/dist/domain/startup-proof.d.ts.map +1 -1
- package/daemon/dist/domain/startup-proof.js +11 -0
- package/daemon/dist/domain/startup-proof.js.map +1 -1
- package/daemon/dist/domain/startup-submission-evidence.d.ts +2 -0
- package/daemon/dist/domain/startup-submission-evidence.d.ts.map +1 -1
- package/daemon/dist/domain/startup-submission-evidence.js +31 -3
- package/daemon/dist/domain/startup-submission-evidence.js.map +1 -1
- package/daemon/dist/domain/stream-intake.d.ts +10 -1
- package/daemon/dist/domain/stream-intake.d.ts.map +1 -1
- package/daemon/dist/domain/stream-intake.js +27 -0
- package/daemon/dist/domain/stream-intake.js.map +1 -1
- package/daemon/dist/domain/terminal/herdr-adapter.d.ts +7 -0
- package/daemon/dist/domain/terminal/herdr-adapter.d.ts.map +1 -1
- package/daemon/dist/domain/terminal/herdr-adapter.js +5 -3
- package/daemon/dist/domain/terminal/herdr-adapter.js.map +1 -1
- package/daemon/dist/domain/terminal/herdr-follow-view.d.ts +13 -0
- package/daemon/dist/domain/terminal/herdr-follow-view.d.ts.map +1 -1
- package/daemon/dist/domain/terminal/herdr-follow-view.js +126 -3
- package/daemon/dist/domain/terminal/herdr-follow-view.js.map +1 -1
- package/daemon/dist/domain/terminal/herdr-viewer.d.ts +10 -0
- package/daemon/dist/domain/terminal/herdr-viewer.d.ts.map +1 -1
- package/daemon/dist/domain/terminal/herdr-viewer.js +38 -12
- package/daemon/dist/domain/terminal/herdr-viewer.js.map +1 -1
- package/daemon/dist/domain/terminal/scope-task-terminal-view.d.ts +2 -1
- package/daemon/dist/domain/terminal/scope-task-terminal-view.d.ts.map +1 -1
- package/daemon/dist/domain/terminal/scope-task-terminal-view.js +80 -38
- package/daemon/dist/domain/terminal/scope-task-terminal-view.js.map +1 -1
- package/daemon/dist/domain/terminal/terminal-provider.d.ts +2 -0
- package/daemon/dist/domain/terminal/terminal-provider.d.ts.map +1 -1
- package/daemon/dist/domain/terminal/terminal-service.d.ts +3 -0
- package/daemon/dist/domain/terminal/terminal-service.d.ts.map +1 -1
- package/daemon/dist/domain/terminal/terminal-service.js +30 -26
- package/daemon/dist/domain/terminal/terminal-service.js.map +1 -1
- package/daemon/dist/domain/terminal/tile-attach.d.ts +22 -0
- package/daemon/dist/domain/terminal/tile-attach.d.ts.map +1 -1
- package/daemon/dist/domain/terminal/tile-attach.js +71 -0
- package/daemon/dist/domain/terminal/tile-attach.js.map +1 -1
- package/daemon/dist/domain/terminal/view-composer.d.ts +2 -0
- package/daemon/dist/domain/terminal/view-composer.d.ts.map +1 -1
- package/daemon/dist/domain/terminal/view-composer.js +4 -2
- package/daemon/dist/domain/terminal/view-composer.js.map +1 -1
- package/daemon/dist/domain/terminal-server-reachability.d.ts +14 -7
- package/daemon/dist/domain/terminal-server-reachability.d.ts.map +1 -1
- package/daemon/dist/domain/terminal-server-reachability.js +29 -11
- package/daemon/dist/domain/terminal-server-reachability.js.map +1 -1
- package/daemon/dist/domain/terminal-server-seats.d.ts +1 -1
- package/daemon/dist/domain/terminal-server-seats.d.ts.map +1 -1
- package/daemon/dist/domain/terminal-server-seats.js +4 -1
- package/daemon/dist/domain/terminal-server-seats.js.map +1 -1
- package/daemon/dist/domain/topology/remote-up-leaf.d.ts.map +1 -1
- package/daemon/dist/domain/topology/remote-up-leaf.js +41 -2
- package/daemon/dist/domain/topology/remote-up-leaf.js.map +1 -1
- package/daemon/dist/domain/topology-trace.d.ts +40 -0
- package/daemon/dist/domain/topology-trace.d.ts.map +1 -0
- package/daemon/dist/domain/topology-trace.js +106 -0
- package/daemon/dist/domain/topology-trace.js.map +1 -0
- package/daemon/dist/domain/transcript-store.d.ts.map +1 -1
- package/daemon/dist/domain/transcript-store.js +12 -1
- package/daemon/dist/domain/transcript-store.js.map +1 -1
- package/daemon/dist/domain/types.d.ts +111 -14
- package/daemon/dist/domain/types.d.ts.map +1 -1
- package/daemon/dist/domain/types.js +3 -2
- package/daemon/dist/domain/types.js.map +1 -1
- package/daemon/dist/domain/user-settings/settings-browser.d.ts.map +1 -1
- package/daemon/dist/domain/user-settings/settings-browser.js +6 -2
- package/daemon/dist/domain/user-settings/settings-browser.js.map +1 -1
- package/daemon/dist/domain/user-settings/settings-store.d.ts +1 -1
- package/daemon/dist/domain/user-settings/settings-store.d.ts.map +1 -1
- package/daemon/dist/domain/user-settings/settings-store.js +26 -0
- package/daemon/dist/domain/user-settings/settings-store.js.map +1 -1
- package/daemon/dist/domain/watchdog-jobs-repository.d.ts +11 -3
- package/daemon/dist/domain/watchdog-jobs-repository.d.ts.map +1 -1
- package/daemon/dist/domain/watchdog-jobs-repository.js +23 -1
- package/daemon/dist/domain/watchdog-jobs-repository.js.map +1 -1
- package/daemon/dist/domain/watchdog-policy-engine.d.ts +35 -1
- package/daemon/dist/domain/watchdog-policy-engine.d.ts.map +1 -1
- package/daemon/dist/domain/watchdog-policy-engine.js +99 -23
- package/daemon/dist/domain/watchdog-policy-engine.js.map +1 -1
- package/daemon/dist/domain/workflow-instance-store.d.ts +2 -0
- package/daemon/dist/domain/workflow-instance-store.d.ts.map +1 -1
- package/daemon/dist/domain/workflow-instance-store.js +11 -2
- package/daemon/dist/domain/workflow-instance-store.js.map +1 -1
- package/daemon/dist/domain/workflow-projector.d.ts +3 -1
- package/daemon/dist/domain/workflow-projector.d.ts.map +1 -1
- package/daemon/dist/domain/workflow-projector.js +58 -10
- package/daemon/dist/domain/workflow-projector.js.map +1 -1
- package/daemon/dist/domain/workflow-run-title.d.ts +4 -0
- package/daemon/dist/domain/workflow-run-title.d.ts.map +1 -0
- package/daemon/dist/domain/workflow-run-title.js +5 -0
- package/daemon/dist/domain/workflow-run-title.js.map +1 -0
- package/daemon/dist/domain/workflow-runtime.d.ts +4 -0
- package/daemon/dist/domain/workflow-runtime.d.ts.map +1 -1
- package/daemon/dist/domain/workflow-runtime.js +45 -14
- package/daemon/dist/domain/workflow-runtime.js.map +1 -1
- package/daemon/dist/domain/workflow-spec-cache.d.ts +2 -2
- package/daemon/dist/domain/workflow-spec-cache.d.ts.map +1 -1
- package/daemon/dist/domain/workflow-spec-cache.js +20 -1
- package/daemon/dist/domain/workflow-spec-cache.js.map +1 -1
- package/daemon/dist/domain/workflow-types.d.ts +15 -0
- package/daemon/dist/domain/workflow-types.d.ts.map +1 -1
- package/daemon/dist/domain/workflow-types.js +4 -0
- package/daemon/dist/domain/workflow-types.js.map +1 -1
- package/daemon/dist/domain/workspace/project-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 +20 -3
- package/daemon/dist/domain/workspace/project-catalog.js.map +1 -1
- package/daemon/dist/domain/workspace/project-read.d.ts +12 -0
- package/daemon/dist/domain/workspace/project-read.d.ts.map +1 -1
- package/daemon/dist/domain/workspace/project-read.js +37 -5
- package/daemon/dist/domain/workspace/project-read.js.map +1 -1
- package/daemon/dist/index.d.ts +2 -2
- package/daemon/dist/index.d.ts.map +1 -1
- package/daemon/dist/index.js +40 -4
- package/daemon/dist/index.js.map +1 -1
- package/daemon/dist/queue-transfer-export-surface.d.ts +33 -0
- package/daemon/dist/queue-transfer-export-surface.d.ts.map +1 -0
- package/daemon/dist/queue-transfer-export-surface.js +13 -0
- package/daemon/dist/queue-transfer-export-surface.js.map +1 -0
- package/daemon/dist/queue-transfer-staging-surface.d.ts +86 -0
- package/daemon/dist/queue-transfer-staging-surface.d.ts.map +1 -0
- package/daemon/dist/queue-transfer-staging-surface.js +91 -0
- package/daemon/dist/queue-transfer-staging-surface.js.map +1 -0
- package/daemon/dist/routes/activity.d.ts +9 -1
- package/daemon/dist/routes/activity.d.ts.map +1 -1
- package/daemon/dist/routes/activity.js +79 -3
- package/daemon/dist/routes/activity.js.map +1 -1
- package/daemon/dist/routes/compaction.d.ts.map +1 -1
- package/daemon/dist/routes/compaction.js +7 -2
- package/daemon/dist/routes/compaction.js.map +1 -1
- package/daemon/dist/routes/context-packs.d.ts.map +1 -1
- package/daemon/dist/routes/context-packs.js +23 -1
- package/daemon/dist/routes/context-packs.js.map +1 -1
- package/daemon/dist/routes/events.js +7 -4
- package/daemon/dist/routes/events.js.map +1 -1
- package/daemon/dist/routes/missions.js +4 -4
- package/daemon/dist/routes/missions.js.map +1 -1
- package/daemon/dist/routes/network.d.ts +2 -0
- package/daemon/dist/routes/network.d.ts.map +1 -1
- package/daemon/dist/routes/network.js +62 -1
- package/daemon/dist/routes/network.js.map +1 -1
- package/daemon/dist/routes/packages.js +2 -0
- package/daemon/dist/routes/packages.js.map +1 -1
- package/daemon/dist/routes/ps.js +13 -2
- package/daemon/dist/routes/ps.js.map +1 -1
- package/daemon/dist/routes/queue.d.ts +22 -1
- package/daemon/dist/routes/queue.d.ts.map +1 -1
- package/daemon/dist/routes/queue.js +250 -69
- package/daemon/dist/routes/queue.js.map +1 -1
- package/daemon/dist/routes/require-sender-identity.d.ts.map +1 -1
- package/daemon/dist/routes/require-sender-identity.js +6 -3
- package/daemon/dist/routes/require-sender-identity.js.map +1 -1
- package/daemon/dist/routes/rigs.js +2 -0
- package/daemon/dist/routes/rigs.js.map +1 -1
- package/daemon/dist/routes/seat.d.ts.map +1 -1
- package/daemon/dist/routes/seat.js +12 -5
- package/daemon/dist/routes/seat.js.map +1 -1
- package/daemon/dist/routes/sessions.d.ts.map +1 -1
- package/daemon/dist/routes/sessions.js +16 -2
- package/daemon/dist/routes/sessions.js.map +1 -1
- package/daemon/dist/routes/slices.d.ts.map +1 -1
- package/daemon/dist/routes/slices.js +16 -7
- package/daemon/dist/routes/slices.js.map +1 -1
- package/daemon/dist/routes/startup.d.ts.map +1 -1
- package/daemon/dist/routes/startup.js +49 -4
- package/daemon/dist/routes/startup.js.map +1 -1
- package/daemon/dist/routes/stream.d.ts.map +1 -1
- package/daemon/dist/routes/stream.js +9 -0
- package/daemon/dist/routes/stream.js.map +1 -1
- package/daemon/dist/routes/terminal-ws.js +28 -2
- package/daemon/dist/routes/terminal-ws.js.map +1 -1
- package/daemon/dist/routes/terminal.d.ts.map +1 -1
- package/daemon/dist/routes/terminal.js +3 -2
- package/daemon/dist/routes/terminal.js.map +1 -1
- package/daemon/dist/routes/transport.d.ts.map +1 -1
- package/daemon/dist/routes/transport.js +14 -2
- package/daemon/dist/routes/transport.js.map +1 -1
- package/daemon/dist/routes/up.js +2 -0
- package/daemon/dist/routes/up.js.map +1 -1
- package/daemon/dist/routes/watchdog.d.ts +1 -1
- package/daemon/dist/routes/watchdog.d.ts.map +1 -1
- package/daemon/dist/routes/watchdog.js +7 -2
- package/daemon/dist/routes/watchdog.js.map +1 -1
- package/daemon/dist/routes/workflow.d.ts.map +1 -1
- package/daemon/dist/routes/workflow.js +9 -3
- package/daemon/dist/routes/workflow.js.map +1 -1
- package/daemon/dist/server.d.ts +7 -0
- package/daemon/dist/server.d.ts.map +1 -1
- package/daemon/dist/server.js +8 -0
- package/daemon/dist/server.js.map +1 -1
- package/daemon/dist/startup.d.ts +3 -0
- package/daemon/dist/startup.d.ts.map +1 -1
- package/daemon/dist/startup.js +226 -17
- package/daemon/dist/startup.js.map +1 -1
- package/daemon/dist/terminal/TerminalSessionBroker.d.ts +10 -0
- package/daemon/dist/terminal/TerminalSessionBroker.d.ts.map +1 -1
- package/daemon/dist/terminal/TerminalSessionBroker.js +63 -4
- package/daemon/dist/terminal/TerminalSessionBroker.js.map +1 -1
- package/daemon/dist/tmux-server-start.d.ts +18 -0
- package/daemon/dist/tmux-server-start.d.ts.map +1 -1
- package/daemon/dist/tmux-server-start.js +29 -0
- package/daemon/dist/tmux-server-start.js.map +1 -1
- package/daemon/dist/topology-trace-surface.d.ts +2 -0
- package/daemon/dist/topology-trace-surface.d.ts.map +1 -0
- package/daemon/dist/topology-trace-surface.js +2 -0
- package/daemon/dist/topology-trace-surface.js.map +1 -0
- package/daemon/docs/reference/acp-agents.md +2 -1
- package/daemon/docs/reference/agent-spec.md +3 -1
- package/daemon/docs/reference/agent-startup-guide.md +3 -1
- package/daemon/docs/reference/agent-state-taxonomy.md +39 -1
- package/daemon/docs/reference/author-contracts.md +4 -0
- package/daemon/docs/reference/checked-seat-stop.md +11 -1
- package/daemon/docs/reference/claude-status-line.md +7 -0
- package/daemon/docs/reference/community-harness-examples/agy/agy-plain.yaml +28 -0
- package/daemon/docs/reference/community-harness-examples/agy/agy.yaml +27 -0
- package/daemon/docs/reference/community-harness-examples/agy/openrig-agy-launch +81 -0
- package/daemon/docs/reference/community-harness-examples/agy/openrig-agy-runner.mjs +667 -0
- package/daemon/docs/reference/community-harness-presets.md +78 -0
- package/daemon/docs/reference/daemon-http-clients.md +133 -20
- package/daemon/docs/reference/gateway-participants.md +6 -0
- package/daemon/docs/reference/getting-started.md +129 -13
- package/daemon/docs/reference/harness-runner-contract.md +7 -5
- package/daemon/docs/reference/help.md +12 -0
- package/daemon/docs/reference/hosted-members.md +163 -2
- package/daemon/docs/reference/inventory-request-diagnostics.md +22 -0
- package/daemon/docs/reference/network-connector.md +112 -4
- package/daemon/docs/reference/project-workspace.md +19 -2
- package/daemon/docs/reference/queue-erasure.md +1 -1
- package/daemon/docs/reference/queue-transfer-export.md +38 -0
- package/daemon/docs/reference/queue-transfer-staging.md +39 -0
- package/daemon/docs/reference/quickstart.md +4 -4
- package/daemon/docs/reference/refocus-channel.md +5 -2
- package/daemon/docs/reference/rig-bundle.md +1 -1
- package/daemon/docs/reference/rig-spec.md +210 -7
- package/daemon/docs/reference/rosters.md +18 -3
- package/daemon/docs/reference/sdlc-conventions.md +6 -2
- package/daemon/docs/reference/seat-delivery.md +41 -7
- package/daemon/docs/reference/seat-pools.md +116 -0
- package/daemon/docs/reference/terminal-sessions.md +57 -11
- package/daemon/docs/reference/tmux-servers.md +46 -2
- package/daemon/docs/reference/whats-new.md +167 -5
- package/daemon/specs/agents/shared/skills/core/messaging-the-human/SKILL.md +1 -1
- package/dist/build-info.js +3 -3
- package/dist/bundle-behaviour.d.ts +1 -1
- package/dist/client.d.ts +2 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +3 -2
- package/dist/client.js.map +1 -1
- package/dist/commands/broadcast.d.ts.map +1 -1
- package/dist/commands/broadcast.js +89 -8
- package/dist/commands/broadcast.js.map +1 -1
- package/dist/commands/bundle.js +1 -1
- package/dist/commands/bundle.js.map +1 -1
- package/dist/commands/chatroom.d.ts +3 -0
- package/dist/commands/chatroom.d.ts.map +1 -1
- package/dist/commands/chatroom.js +9 -2
- package/dist/commands/chatroom.js.map +1 -1
- package/dist/commands/config-init-workspace.d.ts +1 -1
- package/dist/commands/config.d.ts.map +1 -1
- package/dist/commands/config.js +4 -2
- package/dist/commands/config.js.map +1 -1
- package/dist/commands/daemon.d.ts.map +1 -1
- package/dist/commands/daemon.js +24 -19
- package/dist/commands/daemon.js.map +1 -1
- package/dist/commands/exec.d.ts.map +1 -1
- package/dist/commands/exec.js +22 -13
- package/dist/commands/exec.js.map +1 -1
- package/dist/commands/export.d.ts.map +1 -1
- package/dist/commands/export.js +5 -1
- package/dist/commands/export.js.map +1 -1
- package/dist/commands/gateway.d.ts +4 -0
- package/dist/commands/gateway.d.ts.map +1 -1
- package/dist/commands/gateway.js +37 -0
- package/dist/commands/gateway.js.map +1 -1
- package/dist/commands/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.map +1 -1
- package/dist/commands/network.js +54 -1
- package/dist/commands/network.js.map +1 -1
- package/dist/commands/package.d.ts.map +1 -1
- package/dist/commands/package.js +10 -0
- package/dist/commands/package.js.map +1 -1
- package/dist/commands/parked.d.ts.map +1 -1
- package/dist/commands/parked.js +12 -6
- package/dist/commands/parked.js.map +1 -1
- package/dist/commands/project-jev.d.ts +1 -1
- package/dist/commands/project-worker.d.ts +3 -3
- package/dist/commands/provider.d.ts.map +1 -1
- package/dist/commands/provider.js +3 -2
- package/dist/commands/provider.js.map +1 -1
- package/dist/commands/ps.d.ts +12 -1
- package/dist/commands/ps.d.ts.map +1 -1
- package/dist/commands/ps.js +43 -10
- package/dist/commands/ps.js.map +1 -1
- package/dist/commands/queue-export.d.ts +3 -0
- package/dist/commands/queue-export.d.ts.map +1 -0
- package/dist/commands/queue-export.js +67 -0
- package/dist/commands/queue-export.js.map +1 -0
- package/dist/commands/queue-import.d.ts +4 -0
- package/dist/commands/queue-import.d.ts.map +1 -0
- package/dist/commands/queue-import.js +47 -0
- package/dist/commands/queue-import.js.map +1 -0
- package/dist/commands/queue.d.ts +1 -1
- package/dist/commands/queue.d.ts.map +1 -1
- package/dist/commands/queue.js +56 -1
- package/dist/commands/queue.js.map +1 -1
- package/dist/commands/restore.d.ts.map +1 -1
- package/dist/commands/restore.js +51 -8
- package/dist/commands/restore.js.map +1 -1
- package/dist/commands/roster.d.ts +1 -1
- package/dist/commands/roster.js +1 -1
- package/dist/commands/roster.js.map +1 -1
- package/dist/commands/scope.d.ts.map +1 -1
- package/dist/commands/scope.js +30 -18
- package/dist/commands/scope.js.map +1 -1
- package/dist/commands/seat.d.ts.map +1 -1
- package/dist/commands/seat.js +26 -2
- package/dist/commands/seat.js.map +1 -1
- package/dist/commands/send.d.ts.map +1 -1
- package/dist/commands/send.js +24 -8
- package/dist/commands/send.js.map +1 -1
- package/dist/commands/slack.d.ts +1 -1
- package/dist/commands/snapshot.d.ts.map +1 -1
- package/dist/commands/snapshot.js +29 -10
- package/dist/commands/snapshot.js.map +1 -1
- package/dist/commands/start.d.ts +14 -0
- package/dist/commands/start.d.ts.map +1 -1
- package/dist/commands/start.js +203 -110
- package/dist/commands/start.js.map +1 -1
- package/dist/commands/stream-outcome.d.ts +96 -32
- package/dist/commands/stream-outcome.d.ts.map +1 -1
- package/dist/commands/stream-outcome.js +25 -2
- package/dist/commands/stream-outcome.js.map +1 -1
- package/dist/commands/up.d.ts +2 -4
- package/dist/commands/up.d.ts.map +1 -1
- package/dist/commands/up.js +35 -3
- package/dist/commands/up.js.map +1 -1
- package/dist/commands/watchdog.js +2 -2
- package/dist/commands/watchdog.js.map +1 -1
- package/dist/commands/workflow.d.ts.map +1 -1
- package/dist/commands/workflow.js +8 -1
- package/dist/commands/workflow.js.map +1 -1
- package/dist/config-store.d.ts +3 -1
- package/dist/config-store.d.ts.map +1 -1
- package/dist/config-store.js +27 -1
- package/dist/config-store.js.map +1 -1
- package/dist/cross-host-executor.d.ts +3 -0
- package/dist/cross-host-executor.d.ts.map +1 -1
- package/dist/cross-host-executor.js +5 -0
- package/dist/cross-host-executor.js.map +1 -1
- package/dist/daemon-auto-start.d.ts.map +1 -1
- package/dist/daemon-auto-start.js +1 -0
- package/dist/daemon-auto-start.js.map +1 -1
- package/dist/daemon-lifecycle.d.ts +9 -3
- package/dist/daemon-lifecycle.d.ts.map +1 -1
- package/dist/daemon-lifecycle.js +109 -37
- package/dist/daemon-lifecycle.js.map +1 -1
- package/dist/daemon-start-lock.d.ts +38 -3
- package/dist/daemon-start-lock.d.ts.map +1 -1
- package/dist/daemon-start-lock.js +201 -48
- package/dist/daemon-start-lock.js.map +1 -1
- package/dist/daemon-transport.d.ts +10 -0
- package/dist/daemon-transport.d.ts.map +1 -0
- package/dist/daemon-transport.js +89 -0
- package/dist/daemon-transport.js.map +1 -0
- package/dist/decisions/stream-consumer.d.ts +2 -2
- package/dist/lib/bundle-source.d.ts.map +1 -1
- package/dist/lib/bundle-source.js +2 -1
- package/dist/lib/bundle-source.js.map +1 -1
- package/dist/lib/codex-auth.d.ts +1 -1
- package/dist/lib/context-git.d.ts.map +1 -1
- package/dist/lib/context-git.js +8 -3
- package/dist/lib/context-git.js.map +1 -1
- package/dist/lib/scope/progress-edit.d.ts.map +1 -1
- package/dist/lib/scope/progress-edit.js +10 -0
- package/dist/lib/scope/progress-edit.js.map +1 -1
- package/dist/lib/scope/scope-fs.d.ts.map +1 -1
- package/dist/lib/scope/scope-fs.js +13 -10
- package/dist/lib/scope/scope-fs.js.map +1 -1
- package/dist/lib/topology-trace.d.ts +3 -34
- package/dist/lib/topology-trace.d.ts.map +1 -1
- package/dist/lib/topology-trace.js +3 -97
- package/dist/lib/topology-trace.js.map +1 -1
- package/dist/lib/work-install.d.ts +1 -1
- package/dist/local-db.d.ts +2 -0
- package/dist/local-db.d.ts.map +1 -1
- package/dist/local-db.js +14 -11
- package/dist/local-db.js.map +1 -1
- package/dist/long-request-fetch.d.ts +2 -1
- package/dist/long-request-fetch.d.ts.map +1 -1
- package/dist/long-request-fetch.js +39 -35
- package/dist/long-request-fetch.js.map +1 -1
- package/dist/mcp-caller-resolver.d.ts +36 -0
- package/dist/mcp-caller-resolver.d.ts.map +1 -0
- package/dist/mcp-caller-resolver.js +82 -0
- package/dist/mcp-caller-resolver.js.map +1 -0
- package/dist/mcp-http.d.ts +48 -5
- package/dist/mcp-http.d.ts.map +1 -1
- package/dist/mcp-http.js +303 -61
- package/dist/mcp-http.js.map +1 -1
- package/dist/mcp-server.d.ts +31 -3
- package/dist/mcp-server.d.ts.map +1 -1
- package/dist/mcp-server.js +191 -58
- package/dist/mcp-server.js.map +1 -1
- package/dist/mcp-surface.d.ts +8 -0
- package/dist/mcp-surface.d.ts.map +1 -0
- package/dist/mcp-surface.js +5 -0
- package/dist/mcp-surface.js.map +1 -0
- package/dist/node-support.d.ts.map +1 -1
- package/dist/node-support.js +10 -0
- package/dist/node-support.js.map +1 -1
- package/dist/release-surface/extract-surface.d.ts.map +1 -1
- package/dist/release-surface/extract-surface.js +14 -2
- package/dist/release-surface/extract-surface.js.map +1 -1
- package/dist/remote-host-ops.d.ts +3 -0
- package/dist/remote-host-ops.d.ts.map +1 -1
- package/dist/remote-host-ops.js +15 -1
- package/dist/remote-host-ops.js.map +1 -1
- package/dist/snapshot-rig-handle.d.ts +12 -0
- package/dist/snapshot-rig-handle.d.ts.map +1 -0
- package/dist/snapshot-rig-handle.js +39 -0
- package/dist/snapshot-rig-handle.js.map +1 -0
- package/mcp.d.ts +1 -0
- package/mcp.js +1 -0
- package/package.json +8 -5
- package/scripts/check-abi.mjs +15 -0
- 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 +8 -4
- package/tui/dist/attention/attention-model.js.map +1 -1
- package/tui/dist/attention/source-continuity.d.ts +1 -1
- package/tui/dist/crash-cart/start-daemon.d.ts +20 -0
- package/tui/dist/crash-cart/start-daemon.d.ts.map +1 -1
- package/tui/dist/crash-cart/start-daemon.js +56 -0
- package/tui/dist/crash-cart/start-daemon.js.map +1 -1
- package/tui/dist/execution/execution-model.d.ts +2 -0
- package/tui/dist/execution/execution-model.d.ts.map +1 -1
- package/tui/dist/execution/execution-model.js +27 -5
- package/tui/dist/execution/execution-model.js.map +1 -1
- package/tui/dist/execution/workflow-model.d.ts.map +1 -1
- package/tui/dist/execution/workflow-model.js +2 -1
- package/tui/dist/execution/workflow-model.js.map +1 -1
- package/tui/dist/hydrate.d.ts.map +1 -1
- package/tui/dist/hydrate.js +4 -2
- package/tui/dist/hydrate.js.map +1 -1
- package/tui/dist/main.js +26 -9
- package/tui/dist/main.js.map +1 -1
- package/tui/dist/print-for-copy.d.ts +7 -1
- package/tui/dist/print-for-copy.d.ts.map +1 -1
- package/tui/dist/print-for-copy.js +10 -3
- package/tui/dist/print-for-copy.js.map +1 -1
- package/tui/dist/render.d.ts +2 -0
- package/tui/dist/render.d.ts.map +1 -1
- package/tui/dist/render.js +75 -19
- package/tui/dist/render.js.map +1 -1
- package/tui/dist/socket-copy.d.ts +6 -0
- package/tui/dist/socket-copy.d.ts.map +1 -0
- package/tui/dist/socket-copy.js +13 -0
- package/tui/dist/socket-copy.js.map +1 -0
- package/tui/dist/terminal-safe-text.d.ts +39 -0
- package/tui/dist/terminal-safe-text.d.ts.map +1 -0
- package/tui/dist/terminal-safe-text.js +44 -0
- package/tui/dist/terminal-safe-text.js.map +1 -0
- package/tui/dist/topology/host-label.js +5 -5
- package/tui/dist/topology/host-label.js.map +1 -1
- package/tui/dist/types.d.ts +3 -3
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { RigDeliveryDrainStore } from "./rig-delivery-drain.js";
|
|
2
|
-
import { PROMPT_ALERT_TAG, WAKE_ESCALATION_TAG, readWakeLadderBackstop } from "./queue-wake-ladder.js";
|
|
2
|
+
import { PROMPT_ALERT_TAG, WAKE_ESCALATION_TAG, readWakeLadderBackstop, resolveWakeRetryCap } from "./queue-wake-ladder.js";
|
|
3
|
+
import { LADDER_ATTEMPT_PREFIX } from "./queue-stuck-sweep.js";
|
|
3
4
|
import { withUrgentLine } from "./urgent-line.js";
|
|
4
5
|
import { quietCustodyBackstop, quietHoldCustody } from "./quiet-hold-custody.js";
|
|
5
6
|
import { cooperativeReadFile, readRowsCooperatively } from "./execution-candidate-reader.js";
|
|
@@ -18,11 +19,11 @@ export const MC_OPERATION_TAG_PREFIX = "mc-operation:";
|
|
|
18
19
|
export function mcOperationTag(operation) {
|
|
19
20
|
return `${MC_OPERATION_TAG_PREFIX}${operation}`;
|
|
20
21
|
}
|
|
21
|
-
import { WAKE_INTENT_PREFIX } from "./outbox-handler.js";
|
|
22
|
+
import { HELD_SENDER_NOTICE_PREFIX, WAKE_INTENT_PREFIX } from "./outbox-handler.js";
|
|
22
23
|
import { physicalSessionName, SessionRegistry } from "./session-registry.js";
|
|
23
24
|
import { derivePickup } from "./queue-pickup.js";
|
|
24
25
|
import { withRecoveryIndex } from "./queue-recovery.js";
|
|
25
|
-
import { lastMeaningfulTransitionMany, meaningfulFor, readWaitingView, WaitingStatements } from "./queue-waiting.js";
|
|
26
|
+
import { lastMeaningfulTransition, lastMeaningfulTransitionMany, meaningfulFor, readWaitingView, WaitingStatements } from "./queue-waiting.js";
|
|
26
27
|
import { isTypedGateBlocker, typedGateBlockerPrefix } from "./queue-blocker.js";
|
|
27
28
|
export { TYPED_GATE_BLOCKER_PREFIXES, isTypedGateBlocker, typedGateBlockerPrefix } from "./queue-blocker.js";
|
|
28
29
|
import { isOpenRigSender, OPENRIG_SENDER, wrapPaneEnvelope } from "../lib/pane-envelope.js";
|
|
@@ -33,6 +34,7 @@ import { parseSessionName, isHumanSeatSessionRef } from "./session-name.js";
|
|
|
33
34
|
import { isEpisodeRelay, RELAY_CLAIMED_PREFIX, RELAY_FOR_PREFIX, RELAY_KEY_PREFIX, RELAY_TAG } from "./return-route.js";
|
|
34
35
|
import { runnerPermissionOrigin } from "./runner-permissions.js";
|
|
35
36
|
import { isHostPairingAsk } from "./hosts/pairing-ask.js";
|
|
37
|
+
import { renderRelayedAnswers } from "./relayed-answers.js";
|
|
36
38
|
import { parseReplyToChoice, parseArrivalThread, parseReplyToThreadMissing, formatReplyToChoice, describeReplyToFallback, REPLY_TO_CHOICE_ACTOR } from "./reply-to-choice.js";
|
|
37
39
|
import { classifyDestination, recordsNoWakeRoute } from "./gateway/destination-resolver.js";
|
|
38
40
|
import { join } from "node:path";
|
|
@@ -109,6 +111,17 @@ const WAKE_TRIGGER_OPENRIG_TAG = "queue:wake-trigger:openrig";
|
|
|
109
111
|
const CLAIM_OVERRIDDEN_WAKE_PREFIX = `${WAKE_INTENT_PREFIX}claim-overridden-`;
|
|
110
112
|
/** The first id after every such wake's, so a range on the outbox's primary key finds them all and nothing else. */
|
|
111
113
|
const CLAIM_OVERRIDDEN_WAKE_END = `${WAKE_INTENT_PREFIX}claim-overridden.`;
|
|
114
|
+
/** A reroute's wake: `wake-intent-fallback-<transitionId>`, keyed on the reroute's transition (routeToFallback). When
|
|
115
|
+
* another entry already holds that id (a row created with the id `fallback-<transitionId>` has it as its create wake),
|
|
116
|
+
* the wake is `wake-intent-fallback-<transitionId>:<k>`, the first such id the outbox doesn't hold. */
|
|
117
|
+
const FALLBACK_WAKE_PREFIX = `${WAKE_INTENT_PREFIX}fallback-`;
|
|
118
|
+
/** The transition a reroute's wake is keyed on, from its id (either form above); NaN for any other id. */
|
|
119
|
+
function fallbackWakeTransition(outboxId) {
|
|
120
|
+
const key = /^(\d+)(?::\d+)?$/.exec(outboxId.slice(FALLBACK_WAKE_PREFIX.length));
|
|
121
|
+
return outboxId.startsWith(FALLBACK_WAKE_PREFIX) && key ? Number(key[1]) : Number.NaN;
|
|
122
|
+
}
|
|
123
|
+
/** An unpark's wake: `wake-intent-blocker-<transitionId>`, keyed on the transition that made the row pending again. */
|
|
124
|
+
const BLOCKER_WAKE_PREFIX = `${WAKE_INTENT_PREFIX}blocker-`;
|
|
112
125
|
/** On a wake intent whose ring a hosted member's trigger accepted: recovery doesn't ring that intent again. */
|
|
113
126
|
const HOSTED_WAKE_ACCEPTED_TAG = "queue:hosted-wake-accepted";
|
|
114
127
|
/** A first failed intent with typed no-input proof permits one return retry; a claim consumes it. */
|
|
@@ -343,6 +356,12 @@ function queryLinkedSuccessor(db, sourceQitemId, target) {
|
|
|
343
356
|
}
|
|
344
357
|
/** The linked-successor index lent to hasLinkedSuccessor by createLinkedSuccessorLookup's run(), for one synchronous call. */
|
|
345
358
|
let successorScope = null;
|
|
359
|
+
/** How far before its oldest seat-naming source createLinkedSuccessorLookup still reads a seat's chained rows: a clock step. */
|
|
360
|
+
const SUCCESSOR_CLOCK_SLACK_MS = 24 * 3_600_000;
|
|
361
|
+
/** How old a source may be for its seat targets to be read in the batch; an older one's take the per-row query. */
|
|
362
|
+
const SUCCESSOR_RECENT_BOUND_MS = 7 * 24 * 3_600_000;
|
|
363
|
+
/** A target that can only be a row's id: a session name always carries `@` or the legacy `r<nn>-` form. */
|
|
364
|
+
const BARE_QITEM_ID = /^qitem-[^@]*$/;
|
|
346
365
|
/** hasLinkedSuccessor for a whole set of sources in one read, for a pass that asks it once per row (the stuck sweep's
|
|
347
366
|
* custody loop, and the handoff advisory of each row it reads). The read keeps the per-row query's own predicates: a
|
|
348
367
|
* successor is a row whose handed_off_from is the source, or whose chain_of_record is valid JSON with the source among
|
|
@@ -351,8 +370,14 @@ let successorScope = null;
|
|
|
351
370
|
* not the source itself. The index covers the targets each source's own row names (its closure_target, each
|
|
352
371
|
* comma-separated part of it, and its handed_off_to), the ones the sweep and the row's handoff advisory ask about, so the
|
|
353
372
|
* chain_of_record arm reads only successors whose id or destination is one of them, through the primary key and the
|
|
354
|
-
* destination index, instead of every row's chain.
|
|
355
|
-
*
|
|
373
|
+
* destination index, instead of every row's chain. A seat target's chained rows are read through the creation index,
|
|
374
|
+
* only from a day before the oldest source that names a seat: no writer chains a row that didn't exist yet, though a
|
|
375
|
+
* caller's own chainOfRecord on create can name an id before it exists. So for a covered seat target, a "yes" is the
|
|
376
|
+
* per-row query's and a "no" is a candidate the caller confirms live before acting on it (the stuck sweep does, before
|
|
377
|
+
* it creates or keeps a custody finding). A source more than a week old (or undated) leaves its seat targets
|
|
378
|
+
* uncovered, so one old source can't widen that read for the rest. Any other source or target keeps the per-row query.
|
|
379
|
+
* For a covered source and
|
|
380
|
+
* target, a snapshot from its first has() until invalidate(): the caller
|
|
356
381
|
* invalidates it whenever other code could have run. Any other target is read as it is now. run(fn) lends it, for the synchronous fn only, to the hasLinkedSuccessor calls made inside fn for a
|
|
357
382
|
* covered source and target. builtMs() is how long the build of the index as it is now took (0 while it is not built),
|
|
358
383
|
* so a caller can tell when rebuilding after each invalidate() costs more than it saves. */
|
|
@@ -366,23 +391,50 @@ export function createLinkedSuccessorLookup(db, sourceQitemIds) {
|
|
|
366
391
|
const targetsOf = new Map();
|
|
367
392
|
const ids = JSON.stringify([...sources]);
|
|
368
393
|
runSyncSite("queue.linked_successors.build", () => {
|
|
369
|
-
const named = db.prepare(`SELECT qitem_id, closure_target, handed_off_to FROM queue_items WHERE qitem_id IN (SELECT value FROM json_each(?))`)
|
|
394
|
+
const named = db.prepare(`SELECT qitem_id, closure_target, handed_off_to, ts_created FROM queue_items WHERE qitem_id IN (SELECT value FROM json_each(?))`)
|
|
370
395
|
.all(ids);
|
|
396
|
+
// A seat target's chained rows are read only from the oldest seat-naming source's creation, less a clock step:
|
|
397
|
+
// every writer stamps ts_created at insert and chains rows that already exist. A source whose targets are all row
|
|
398
|
+
// ids doesn't set that bound (the id arm reads them unbounded), and an old or undated source's seat targets are
|
|
399
|
+
// left to the per-row query, so the range read through idx_queue_items_created stays recent.
|
|
400
|
+
const recentFrom = Date.now() - SUCCESSOR_RECENT_BOUND_MS;
|
|
401
|
+
const seatTargets = new Set();
|
|
402
|
+
let oldest = Infinity;
|
|
371
403
|
for (const r of named) {
|
|
372
404
|
const own = new Set();
|
|
373
405
|
for (const target of [r.closure_target, ...(r.closure_target ?? "").split(",").map((part) => part.trim()), r.handed_off_to])
|
|
374
406
|
if (target)
|
|
375
407
|
own.add(target);
|
|
408
|
+
const created = Date.parse(r.ts_created);
|
|
409
|
+
for (const target of [...own]) {
|
|
410
|
+
if (BARE_QITEM_ID.test(target))
|
|
411
|
+
continue;
|
|
412
|
+
if (created >= recentFrom) {
|
|
413
|
+
seatTargets.add(target);
|
|
414
|
+
oldest = Math.min(oldest, created);
|
|
415
|
+
}
|
|
416
|
+
else
|
|
417
|
+
own.delete(target);
|
|
418
|
+
}
|
|
376
419
|
targetsOf.set(r.qitem_id, own);
|
|
377
420
|
}
|
|
378
421
|
const targets = JSON.stringify([...new Set([...targetsOf.values()].flatMap((own) => [...own]))]);
|
|
422
|
+
// INDEXED BY holds the seat arm to the creation-time range. Left to choose, the daemon's SQLite walked the whole
|
|
423
|
+
// table in primary-key order to feed the UNION's merge, and the destination index holds each seat's whole
|
|
424
|
+
// history; with the index named, a plan that can't use it fails to prepare instead of scanning.
|
|
425
|
+
const seatArm = seatTargets.size === 0 ? "" : `
|
|
426
|
+
UNION
|
|
427
|
+
SELECT s.qitem_id, s.destination_session, j.value AS source FROM queue_items s INDEXED BY idx_queue_items_created, json_each(s.chain_of_record) j
|
|
428
|
+
WHERE s.destination_session IN (SELECT value FROM json_each(?)) AND s.ts_created >= ?
|
|
429
|
+
AND s.chain_of_record IS NOT NULL AND json_valid(s.chain_of_record)
|
|
430
|
+
AND j.value IN (SELECT value FROM json_each(?))`;
|
|
379
431
|
const rows = db.prepare(`SELECT s.qitem_id, s.destination_session, s.handed_off_from AS source FROM queue_items s
|
|
380
432
|
WHERE s.handed_off_from IN (SELECT value FROM json_each(?))
|
|
381
433
|
UNION
|
|
382
434
|
SELECT s.qitem_id, s.destination_session, j.value AS source FROM queue_items s, json_each(s.chain_of_record) j
|
|
383
|
-
WHERE
|
|
435
|
+
WHERE s.qitem_id IN (SELECT value FROM json_each(?))
|
|
384
436
|
AND s.chain_of_record IS NOT NULL AND json_valid(s.chain_of_record)
|
|
385
|
-
AND j.value IN (SELECT value FROM json_each(?))`).all(ids, targets,
|
|
437
|
+
AND j.value IN (SELECT value FROM json_each(?))${seatArm}`).all(ids, targets, ids, ...(seatArm ? [JSON.stringify([...seatTargets]), new Date(oldest - SUCCESSOR_CLOCK_SLACK_MS).toISOString(), ids] : []));
|
|
386
438
|
for (const r of rows) {
|
|
387
439
|
const list = bySource.get(r.source);
|
|
388
440
|
const entry = { qitemId: r.qitem_id, destination: r.destination_session };
|
|
@@ -429,7 +481,7 @@ function detectQueueColumn(db, columnName) {
|
|
|
429
481
|
return false;
|
|
430
482
|
}
|
|
431
483
|
}
|
|
432
|
-
function detectTable(db, tableName) {
|
|
484
|
+
export function detectTable(db, tableName) {
|
|
433
485
|
try {
|
|
434
486
|
return !!db.prepare("SELECT 1 FROM sqlite_master WHERE type = 'table' AND name = ?").get(tableName);
|
|
435
487
|
}
|
|
@@ -573,6 +625,7 @@ function destinationValidationError(field, session, loadRegistry) {
|
|
|
573
625
|
function isWakeTimeoutSignal(s) {
|
|
574
626
|
return !!s && /timeout|timed\s*out|etimedout/i.test(s);
|
|
575
627
|
}
|
|
628
|
+
export { buildQueueTransfer } from "./queue-transfer-export.js";
|
|
576
629
|
export class QueueRepository {
|
|
577
630
|
db;
|
|
578
631
|
deliveryDrains;
|
|
@@ -598,6 +651,8 @@ export class QueueRepository {
|
|
|
598
651
|
* best-effort {@link maybeNudge} when no store is attached (P34 made that
|
|
599
652
|
* fallback real code rather than a promise in a comment). */
|
|
600
653
|
outbox;
|
|
654
|
+
/** #2829 slice 1 — cold-start notifier, late-wired by startup after the restore orchestrator exists. */
|
|
655
|
+
wakeWithoutReceiverNotifier;
|
|
601
656
|
// A first clear may recover durable refusals observed before startup. Later clears need
|
|
602
657
|
// a new positive refusal/attention episode, so a returning prompt cannot spin retries.
|
|
603
658
|
promptRecoveryState = new Map();
|
|
@@ -762,6 +817,11 @@ export class QueueRepository {
|
|
|
762
817
|
}
|
|
763
818
|
if (row?.state !== "pending" || row.destination_session !== entry.destinationSession)
|
|
764
819
|
return false;
|
|
820
|
+
// A reroute that stages a wake replaces the row's earlier wakes for that seat: its create wake, an earlier reroute's
|
|
821
|
+
// wake and an earlier unpark's wake. Without this, a row that comes back to a seat it was rerouted away from would
|
|
822
|
+
// get the old wake again beside the new one.
|
|
823
|
+
if (this.wakeReplacedByReroute(entry))
|
|
824
|
+
return false;
|
|
765
825
|
const prefix = `${WAKE_INTENT_PREFIX}blocker-`;
|
|
766
826
|
if (!entry.outboxId.startsWith(prefix))
|
|
767
827
|
return true;
|
|
@@ -773,6 +833,67 @@ export class QueueRepository {
|
|
|
773
833
|
.get(entry.auditPointer);
|
|
774
834
|
return expected === latest?.transition_id;
|
|
775
835
|
}
|
|
836
|
+
/** Whether a wake's outcome no longer belongs on its row, so the row's last wake result is left as it is (the wake's
|
|
837
|
+
* own outbox entry is still settled). Only once the row has been rerouted: the row now waits on another seat, or a
|
|
838
|
+
* later reroute's wake has replaced this one. Any reroute counts for the first, one that staged no wake included, so
|
|
839
|
+
* a send for the seat the row left does not overwrite what the move recorded (a wake that was not retained, for one).
|
|
840
|
+
* A row that was never rerouted keeps today's bookkeeping. */
|
|
841
|
+
wakeOutcomeStale(entry) {
|
|
842
|
+
if (!entry.auditPointer || !this.wasRerouted(entry.auditPointer))
|
|
843
|
+
return false;
|
|
844
|
+
const row = this.db.prepare("SELECT destination_session FROM queue_items WHERE qitem_id = ?")
|
|
845
|
+
.get(entry.auditPointer);
|
|
846
|
+
if (!row || row.destination_session !== entry.destinationSession)
|
|
847
|
+
return true;
|
|
848
|
+
return this.wakeReplacedByReroute(entry);
|
|
849
|
+
}
|
|
850
|
+
/** Whether a reroute has replaced this wake: a reroute staged a wake for the same seat after this wake was staged.
|
|
851
|
+
* Only the create's wake and the wakes keyed on a transition (a reroute's, an unpark's) are ordered this way. Once
|
|
852
|
+
* replaced, a wake stays replaced, whatever moves follow. A move that staged no wake (no `wake` option, or a full
|
|
853
|
+
* held-message quota) replaces nothing, so a row it brings back to a seat finds that seat's wakes as they were. */
|
|
854
|
+
wakeReplacedByReroute(entry) {
|
|
855
|
+
const qitemId = entry.auditPointer;
|
|
856
|
+
if (!qitemId)
|
|
857
|
+
return false;
|
|
858
|
+
// The create's wake comes before any transition of its row; the others carry the transition they are keyed on.
|
|
859
|
+
const createWake = `${WAKE_INTENT_PREFIX}${qitemId}`;
|
|
860
|
+
let staged;
|
|
861
|
+
if (entry.outboxId === createWake)
|
|
862
|
+
staged = 0;
|
|
863
|
+
else if (entry.outboxId.startsWith(FALLBACK_WAKE_PREFIX))
|
|
864
|
+
staged = fallbackWakeTransition(entry.outboxId);
|
|
865
|
+
else if (entry.outboxId.startsWith(BLOCKER_WAKE_PREFIX))
|
|
866
|
+
staged = Number(entry.outboxId.slice(BLOCKER_WAKE_PREFIX.length));
|
|
867
|
+
else
|
|
868
|
+
return false;
|
|
869
|
+
if (!Number.isInteger(staged))
|
|
870
|
+
return false;
|
|
871
|
+
const reroutes = this.db.prepare("SELECT outbox_id FROM outbox_entries WHERE audit_pointer = ? AND destination_session = ? AND substr(outbox_id, 1, ?) = ?").all(qitemId, entry.destinationSession, FALLBACK_WAKE_PREFIX.length, FALLBACK_WAKE_PREFIX);
|
|
872
|
+
return reroutes.some(({ outbox_id }) => {
|
|
873
|
+
if (outbox_id === createWake)
|
|
874
|
+
return false; // the row's own create wake, whatever its id
|
|
875
|
+
const transition = fallbackWakeTransition(outbox_id);
|
|
876
|
+
return Number.isInteger(transition) && transition > staged;
|
|
877
|
+
});
|
|
878
|
+
}
|
|
879
|
+
/** Whether the row has been rerouted, from its transitions: every routeToFallback move writes one, with a wake or
|
|
880
|
+
* not. A reroute's transition is written in-process, so it has no identity provenance; a transition the update route
|
|
881
|
+
* wrote with the same actor and note is not a reroute. The live log is read, then the archive the retention sweep
|
|
882
|
+
* moves an aged closed row's transitions to, so a reopened archived row reads as rerouted too (the tables and the
|
|
883
|
+
* rule fallbackLineStart uses). */
|
|
884
|
+
wasRerouted(qitemId) {
|
|
885
|
+
if (!this.hasQueueTransitionsTable)
|
|
886
|
+
return false;
|
|
887
|
+
for (const table of ["queue_transitions", ...(detectTable(this.db, "queue_transitions_archive") ? ["queue_transitions_archive"] : [])]) {
|
|
888
|
+
const stamped = table === "queue_transitions"
|
|
889
|
+
? this.hasTransitionProvenanceColumn
|
|
890
|
+
: this.db.prepare(`PRAGMA table_info(${table})`).all().some((c) => c.name === "identity_provenance");
|
|
891
|
+
if (this.db.prepare(`SELECT 1 FROM ${table} WHERE qitem_id = ? AND actor_session = ? AND substr(transition_note, 1, ?) = ?
|
|
892
|
+
${stamped ? "AND identity_provenance IS NULL" : ""} LIMIT 1`).get(qitemId, FALLBACK_ACTOR, "fallback-routed: ".length, "fallback-routed: ") !== undefined)
|
|
893
|
+
return true;
|
|
894
|
+
}
|
|
895
|
+
return false;
|
|
896
|
+
}
|
|
776
897
|
/** A wake's source and urgency at the seat's level: the trigger decides the source; the row's priority (urgent or
|
|
777
898
|
* critical) makes it urgent, marked by whoever created the row. */
|
|
778
899
|
wakeAdmission(qitemId, trigger) {
|
|
@@ -781,7 +902,7 @@ export class QueueRepository {
|
|
|
781
902
|
// OpenRig's own row is marked urgent by OpenRig, not by the person whose obligation it's about.
|
|
782
903
|
return { source: trigger, urgent, ...(urgent && row ? { urgentBy: trigger === "openrig" ? "OpenRig" : row.sourceSession } : {}) };
|
|
783
904
|
}
|
|
784
|
-
classifyWakeResult(res) {
|
|
905
|
+
classifyWakeResult(res, destinationSession) {
|
|
785
906
|
// Held by the seat's hold or interruption level (on purpose; a retry is held again) is the typing guard's; any other
|
|
786
907
|
// retention is the draft-aware delivery's (a draft, an unreadable input, a native prompt), which can clear.
|
|
787
908
|
if (res.outcome === "retained")
|
|
@@ -791,16 +912,29 @@ export class QueueRepository {
|
|
|
791
912
|
// The bridge owns the row now (handed to the hook, typed by its fallback, or named uncertain), so it isn't finalized.
|
|
792
913
|
if (res.outcome === "bridged")
|
|
793
914
|
return { classified: "bridged", nudgeResult: "bridged:queued" };
|
|
915
|
+
// The nudge result keeps its words; a wake that reached a seat at its usage limit, or may have, also gets a note on the row.
|
|
916
|
+
const usageLimit = res.usageLimit ? { usageLimit: { asOf: res.usageLimit.asOf, resetsAt: res.usageLimit.resetsAt,
|
|
917
|
+
...(res.sessionName ? { sessionName: res.sessionName } : {}) } } : {};
|
|
794
918
|
if (res.ok)
|
|
795
|
-
return res.verified ? { classified: "verified", nudgeResult: "verified" } : { classified: "indeterminate", nudgeResult: "delivered-ack-pending" };
|
|
919
|
+
return res.verified ? { classified: "verified", nudgeResult: "verified", ...usageLimit } : { classified: "indeterminate", nudgeResult: "delivered-ack-pending", ...usageLimit };
|
|
796
920
|
const detail = res.error ?? res.reason ?? "unknown";
|
|
797
921
|
// Input evidence survives receipt removal: an issued paste or uncertain Enter is never an unsent failure.
|
|
798
922
|
const inputUncertain = res.sent === true || res.inputPhase === "attempted" || res.inputPhase === "written"
|
|
799
923
|
|| (res.sent !== false && res.inputPhase !== "not_reached" && (res.reason === "delivery_indeterminate" || res.reason === "submit_failed"));
|
|
800
924
|
if (inputUncertain || isWakeTimeoutSignal(res.reason) || isWakeTimeoutSignal(res.error)) {
|
|
801
|
-
return { classified: "indeterminate", nudgeResult: `indeterminate:${detail}
|
|
925
|
+
return { classified: "indeterminate", nudgeResult: `indeterminate:${detail}`, ...usageLimit };
|
|
802
926
|
}
|
|
803
|
-
|
|
927
|
+
const outcome = { classified: "failed", nudgeResult: `failed:${detail}`, preInputFailure: res.inputPhase === "not_reached" && res.sent !== true };
|
|
928
|
+
// #2829 slice 1 — positive no-receiver evidence rides the shared send path: a send
|
|
929
|
+
// that never reached the input phase means the seat was gone before the wake could be
|
|
930
|
+
// typed. Best-effort; it can never change this classification.
|
|
931
|
+
if (outcome.preInputFailure === true && destinationSession !== undefined) {
|
|
932
|
+
try {
|
|
933
|
+
this.wakeHasNoReceiver(destinationSession);
|
|
934
|
+
}
|
|
935
|
+
catch { /* never changes the outcome */ }
|
|
936
|
+
}
|
|
937
|
+
return outcome;
|
|
804
938
|
}
|
|
805
939
|
/**
|
|
806
940
|
* W1 (transactional closure): attach the durable wake-intent store AFTER
|
|
@@ -818,6 +952,12 @@ export class QueueRepository {
|
|
|
818
952
|
}
|
|
819
953
|
this.outbox = outbox;
|
|
820
954
|
}
|
|
955
|
+
/** #2829 slice 1 — late-wired cold-start notifier. Fired (fire-and-forget, never
|
|
956
|
+
* awaited, never throwing) whenever a wake's destination provably has no receiver:
|
|
957
|
+
* the drain's skip branch and the unroutable send classification both land here. */
|
|
958
|
+
attachWakeWithoutReceiverNotifier(notifier) {
|
|
959
|
+
this.wakeWithoutReceiverNotifier = notifier;
|
|
960
|
+
}
|
|
821
961
|
/** The one transition-write classifier. It consumes structured state/action facts only. */
|
|
822
962
|
classifyOwnerNotification(input) {
|
|
823
963
|
if (input.explicitKind === "human-decision-resolved") {
|
|
@@ -1072,7 +1212,7 @@ export class QueueRepository {
|
|
|
1072
1212
|
if (alreadyHeld?.deliveryState === "retained" || alreadyHeld?.deliveryState === "retired") {
|
|
1073
1213
|
if (this.deliveryDrains.holds(alreadyHeld.destinationSession))
|
|
1074
1214
|
return "retained";
|
|
1075
|
-
if (alreadyHeld.auditPointer)
|
|
1215
|
+
if (alreadyHeld.auditPointer && !this.wakeOutcomeStale(alreadyHeld))
|
|
1076
1216
|
this.recordNudgeAttempt(alreadyHeld.auditPointer, "retained:typing_guard");
|
|
1077
1217
|
return "retained";
|
|
1078
1218
|
}
|
|
@@ -1237,7 +1377,8 @@ export class QueueRepository {
|
|
|
1237
1377
|
?.slice(AUTO_UNPARK_BLOCKER_TAG_PREFIX.length)
|
|
1238
1378
|
: undefined;
|
|
1239
1379
|
const wakeEvent = this.db.transaction(() => {
|
|
1240
|
-
this.
|
|
1380
|
+
if (!this.wakeOutcomeStale(intent))
|
|
1381
|
+
this.recordNudgeAttempt(qitemId, nudgeResult, outcome.usageLimit);
|
|
1241
1382
|
if (finalState)
|
|
1242
1383
|
this.outbox.finalizeDelivery(intent.outboxId, finalState);
|
|
1243
1384
|
// Only a first attempt creates proof: an actual retry consumes it even if it again fails before input.
|
|
@@ -1324,6 +1465,7 @@ export class QueueRepository {
|
|
|
1324
1465
|
if (!this.outbox || !this.transport)
|
|
1325
1466
|
return tally;
|
|
1326
1467
|
const attempted = new Set();
|
|
1468
|
+
const coldStartPass = {};
|
|
1327
1469
|
// Notifications left alone for want of a receiver; one a later claim in this pass attempted isn't waiting.
|
|
1328
1470
|
const skipped = new Map();
|
|
1329
1471
|
const result = () => {
|
|
@@ -1352,7 +1494,7 @@ export class QueueRepository {
|
|
|
1352
1494
|
const eligible = (entry) => {
|
|
1353
1495
|
if (opts?.stopRequested?.() || opts?.eligible && !opts.eligible(entry))
|
|
1354
1496
|
return false;
|
|
1355
|
-
if (entry.deliveryState === "pending" || !this.wakeHasNoReceiver(entry.destinationSession))
|
|
1497
|
+
if (entry.deliveryState === "pending" || !this.wakeHasNoReceiver(entry.destinationSession, coldStartPass))
|
|
1356
1498
|
return true;
|
|
1357
1499
|
skipped.set(entry.outboxId, entry.destinationSession);
|
|
1358
1500
|
return false;
|
|
@@ -1386,11 +1528,11 @@ export class QueueRepository {
|
|
|
1386
1528
|
* move the row's last nudge time, which the stuck sweep reads as new evidence; #2939), or the newest session under
|
|
1387
1529
|
* the name the transport sends to has stopped (exited, or detached because its tmux session is gone). A canonical
|
|
1388
1530
|
* address resolves to its current physical session first. Anything unknown may have a receiver. */
|
|
1389
|
-
wakeHasNoReceiver(destinationSession) {
|
|
1531
|
+
wakeHasNoReceiver(destinationSession, drainPass) {
|
|
1390
1532
|
try {
|
|
1391
1533
|
const destClass = this.classifyDestinationOf(destinationSession).class;
|
|
1392
1534
|
if (destClass === "unroutable")
|
|
1393
|
-
return
|
|
1535
|
+
return this.noteWakeWithoutReceiver(destinationSession, drainPass);
|
|
1394
1536
|
if (destClass !== "pane-bound")
|
|
1395
1537
|
return false;
|
|
1396
1538
|
const physical = physicalSessionName(this.db, destinationSession);
|
|
@@ -1398,12 +1540,23 @@ export class QueueRepository {
|
|
|
1398
1540
|
return true;
|
|
1399
1541
|
const newest = this.db.prepare("SELECT status FROM sessions WHERE session_name = ? ORDER BY id DESC LIMIT 1")
|
|
1400
1542
|
.get(physical);
|
|
1401
|
-
return newest?.status === "exited" || newest?.status === "detached";
|
|
1543
|
+
return (newest?.status === "exited" || newest?.status === "detached") && this.noteWakeWithoutReceiver(destinationSession, drainPass);
|
|
1402
1544
|
}
|
|
1403
1545
|
catch {
|
|
1404
1546
|
return false;
|
|
1405
1547
|
}
|
|
1406
1548
|
}
|
|
1549
|
+
/** #2829 slice 1 — positive no-receiver evidence is the cold-start trigger. The notifier is
|
|
1550
|
+
* fire-and-forget and can never change the predicate's value or throw into its caller. */
|
|
1551
|
+
noteWakeWithoutReceiver(destinationSession, drainPass) {
|
|
1552
|
+
try {
|
|
1553
|
+
this.wakeWithoutReceiverNotifier?.(destinationSession, drainPass);
|
|
1554
|
+
}
|
|
1555
|
+
catch {
|
|
1556
|
+
/* a notifier failure must never change delivery semantics */
|
|
1557
|
+
}
|
|
1558
|
+
return true;
|
|
1559
|
+
}
|
|
1407
1560
|
/**
|
|
1408
1561
|
* Issue a default nudge to the destination after a create / handoff /
|
|
1409
1562
|
* handoff-and-complete commit. Records the result via recordNudgeAttempt.
|
|
@@ -1434,7 +1587,11 @@ export class QueueRepository {
|
|
|
1434
1587
|
if (!this.transport)
|
|
1435
1588
|
return;
|
|
1436
1589
|
const outcome = await this.performWakeSend(qitemId, destinationSession, sourceSession, bodyOverride, undefined, undefined, trigger, undefined, opts?.explicit === true);
|
|
1437
|
-
|
|
1590
|
+
// #2829 slice 1 — `preInputFailure` is the honest no-receiver shape: the input phase
|
|
1591
|
+
// was never reached and nothing was sent, meaning the seat was gone before the wake
|
|
1592
|
+
// could be typed. The positive-evidence check itself rides the shared send path
|
|
1593
|
+
// (performWakeSend / classifyWakeResult) and covers this caller.
|
|
1594
|
+
this.recordNudgeAttempt(qitemId, outcome.nudgeResult, outcome.usageLimit);
|
|
1438
1595
|
}
|
|
1439
1596
|
/** The following startup intent drain owns durable pending wakes. Legacy packets
|
|
1440
1597
|
* and overdue claimed work (not eligible for that drain) still use the nudge path. */
|
|
@@ -1597,6 +1754,107 @@ export class QueueRepository {
|
|
|
1597
1754
|
await this.maybeNudge(qitem_id, row.destinationSession, undefined, row.sourceSession);
|
|
1598
1755
|
}
|
|
1599
1756
|
}
|
|
1757
|
+
/** #48: a queue wake the draft-aware guard held is tried again when its seat reports idle, through the same guarded
|
|
1758
|
+
* delivery, which re-checks the input and holds it again if it still can't go. Only while the seat is still in
|
|
1759
|
+
* draft-aware mode: switching modes alone replays nothing, and a retry already admitted goes once. Only rows created
|
|
1760
|
+
* straight to the seat: a handed-off row's retries are the wake ladder's. A hold-mode wake is never retried. Each try
|
|
1761
|
+
* is one of the ladder's attempts, so the existing wake retry cap bounds them; the ladder's one held notice comes past
|
|
1762
|
+
* that cap or the unconfirmed window. */
|
|
1763
|
+
async retryDraftHeldWakesOnIdle(sessionName, state) {
|
|
1764
|
+
if (state !== "idle" || !this.outbox || !this.transport?.draftAwareTarget?.(sessionName))
|
|
1765
|
+
return;
|
|
1766
|
+
const addresses = this.resolveSessionAddresses(sessionName);
|
|
1767
|
+
if (!addresses.length || addresses.some(address => this.deliveryDrains.holds(address)))
|
|
1768
|
+
return;
|
|
1769
|
+
// As for a prompt clear (#2575): while a compaction's restore is owed, the wake would reach the agent before it.
|
|
1770
|
+
if ([sessionName, ...addresses].some(address => this.hasPendingPostCompactStage?.(address)))
|
|
1771
|
+
return;
|
|
1772
|
+
const rows = this.db.prepare(`SELECT qitem_id FROM queue_items WHERE state = 'pending' AND claimed_at IS NULL
|
|
1773
|
+
AND handed_off_from IS NULL AND destination_session IN (${addresses.map(() => "?").join(",")})
|
|
1774
|
+
AND last_nudge_result = 'retained:draft_aware' ORDER BY ts_created, qitem_id`).all(...addresses);
|
|
1775
|
+
const cap = resolveWakeRetryCap();
|
|
1776
|
+
for (const { qitem_id } of rows) {
|
|
1777
|
+
const intent = `${WAKE_INTENT_PREFIX}${qitem_id}`;
|
|
1778
|
+
const after = lastMeaningfulTransition(this.db, qitem_id)?.id ?? 0;
|
|
1779
|
+
const tries = this.db.prepare(`SELECT COUNT(*) AS n FROM queue_transitions WHERE qitem_id = ? AND transition_id > ?
|
|
1780
|
+
AND transition_note LIKE '${LADDER_ATTEMPT_PREFIX}%'`).get(qitem_id, after).n;
|
|
1781
|
+
if (tries >= cap || !this.outbox.reopenHeld(intent))
|
|
1782
|
+
continue;
|
|
1783
|
+
const outcome = await this.deliverWakeIntent(intent);
|
|
1784
|
+
const row = this.getById(qitem_id);
|
|
1785
|
+
if (row)
|
|
1786
|
+
this.transitionLog.append({ qitemId: qitem_id, state: row.state, actorSession: "wake-ladder@system",
|
|
1787
|
+
transitionNote: `${LADDER_ATTEMPT_PREFIX} ${tries + 1}/${cap} outcome=${row.lastNudgeResult ?? outcome} trigger=seat-idle` });
|
|
1788
|
+
}
|
|
1789
|
+
}
|
|
1790
|
+
/** #48: the wake ladder's one notice to a held row's sender in one held episode, recorded in the outbox before the ladder
|
|
1791
|
+
* marks the owner's rung, so a restart before it's sent, or a send that definitely wrote nothing, leaves it owed rather
|
|
1792
|
+
* than lost. Recording it again in the same episode returns the same entry. Null with no outbox: the ladder then sends
|
|
1793
|
+
* it at once with noticeHeldSender, as before, with no custody. */
|
|
1794
|
+
stageHeldSenderNotice(qitemId, episode, sender, body) {
|
|
1795
|
+
if (!this.outbox)
|
|
1796
|
+
return null;
|
|
1797
|
+
const outboxId = `${HELD_SENDER_NOTICE_PREFIX}${qitemId}-${episode}`;
|
|
1798
|
+
this.outbox.record({ outboxId, senderSession: OPENRIG_SENDER, destinationSession: sender, body, auditPointer: qitemId });
|
|
1799
|
+
return outboxId;
|
|
1800
|
+
}
|
|
1801
|
+
/** #48: send a recorded sender notice, as noticeHeldSender does. Only one never tried, or one whose last try definitely
|
|
1802
|
+
* wrote nothing, is sent; delivered, uncertain, held or in-flight ones aren't sent again. The entry keeps the actual
|
|
1803
|
+
* outcome (delivered, failed, indeterminate or retained), and the returned string is the ladder's record. */
|
|
1804
|
+
async deliverHeldSenderNotice(outboxId) {
|
|
1805
|
+
if (!this.outbox || !this.transport)
|
|
1806
|
+
return "skipped:no transport";
|
|
1807
|
+
const entry = this.outbox.getById(outboxId);
|
|
1808
|
+
if (!entry)
|
|
1809
|
+
return "skipped:no notice";
|
|
1810
|
+
if (!this.outbox.claimUnsent(outboxId))
|
|
1811
|
+
return `skipped:${entry.deliveryState}`;
|
|
1812
|
+
let outcome;
|
|
1813
|
+
try {
|
|
1814
|
+
outcome = this.classifyWakeResult(await this.transport.send(entry.destinationSession, wrapPaneEnvelope(OPENRIG_SENDER, entry.destinationSession, entry.body), { verify: true, actorSession: OPENRIG_SENDER, openrigNotice: true }));
|
|
1815
|
+
}
|
|
1816
|
+
catch (error) {
|
|
1817
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
1818
|
+
outcome = isWakeTimeoutSignal(message) ? { classified: "indeterminate", nudgeResult: `indeterminate:${message}` }
|
|
1819
|
+
: { classified: "failed", nudgeResult: `failed:${message}` };
|
|
1820
|
+
}
|
|
1821
|
+
// Only a definite no-write stays retryable; anything that may have reached the sender is never sent again.
|
|
1822
|
+
this.outbox.finalizeDelivery(outboxId, outcome.classified === "verified" ? "delivered" : outcome.classified === "failed" ? "failed"
|
|
1823
|
+
: outcome.classified === "retained" ? "retained" : "indeterminate");
|
|
1824
|
+
return outcome.nudgeResult;
|
|
1825
|
+
}
|
|
1826
|
+
/** #48: recorded sender notices still owed (never tried, or definitely not written), oldest first. */
|
|
1827
|
+
listOwedHeldSenderNotices(limit = 50, after) {
|
|
1828
|
+
if (!this.outbox)
|
|
1829
|
+
return [];
|
|
1830
|
+
// A page starts after `after` in the same order, so a caller can go past entries it can't act on yet.
|
|
1831
|
+
const ts = after?.ts ?? null;
|
|
1832
|
+
return this.db.prepare(`SELECT rowid, outbox_id, destination_session, audit_pointer, delivery_state, ts_dispatched FROM outbox_entries
|
|
1833
|
+
WHERE substr(outbox_id, 1, ?) = ? AND delivery_state IN ('pending','failed')
|
|
1834
|
+
AND (? IS NULL OR ts_dispatched > ? OR (ts_dispatched = ? AND rowid > ?))
|
|
1835
|
+
ORDER BY ts_dispatched, rowid LIMIT ?`)
|
|
1836
|
+
.all(HELD_SENDER_NOTICE_PREFIX.length, HELD_SENDER_NOTICE_PREFIX, ts, ts, ts, after?.rowid ?? 0, limit)
|
|
1837
|
+
.map((row) => ({ outboxId: row.outbox_id, sender: row.destination_session, qitemId: row.audit_pointer, state: row.delivery_state,
|
|
1838
|
+
cursor: { ts: row.ts_dispatched, rowid: row.rowid } }));
|
|
1839
|
+
}
|
|
1840
|
+
/** #48: a recorded sender notice whose row is no longer held in that episode isn't sent; it's retired with the reason. */
|
|
1841
|
+
retireHeldSenderNotice(outboxId, actor, reason) {
|
|
1842
|
+
return this.outbox?.retireUnsent(outboxId, actor, reason) ?? false;
|
|
1843
|
+
}
|
|
1844
|
+
/** #48: the wake ladder's one notice to a held row's sender, sent as OpenRig through the same guarded transport (the
|
|
1845
|
+
* sender's own guard applies), with no custody: the path for a repository with no outbox. Returns the outcome for the
|
|
1846
|
+
* ladder's record. */
|
|
1847
|
+
async noticeHeldSender(sender, body) {
|
|
1848
|
+
if (!this.transport)
|
|
1849
|
+
return "skipped:no transport";
|
|
1850
|
+
try {
|
|
1851
|
+
const res = await this.transport.send(sender, wrapPaneEnvelope(OPENRIG_SENDER, sender, body), { verify: true, actorSession: OPENRIG_SENDER, openrigNotice: true });
|
|
1852
|
+
return res.verified ? "verified" : !res.ok ? `failed:${res.reason ?? res.error ?? "unknown"}` : res.outcome ?? "sent-unverified";
|
|
1853
|
+
}
|
|
1854
|
+
catch (error) {
|
|
1855
|
+
return `failed:${error instanceof Error ? error.message : String(error)}`;
|
|
1856
|
+
}
|
|
1857
|
+
}
|
|
1600
1858
|
/**
|
|
1601
1859
|
* W1 (transactional closure): the shared wake-send CORE. Builds the pane
|
|
1602
1860
|
* envelope, sends with verify, and CLASSIFIES the transport result into the W1
|
|
@@ -1640,6 +1898,9 @@ export class QueueRepository {
|
|
|
1640
1898
|
};
|
|
1641
1899
|
}
|
|
1642
1900
|
if (destClass.class === "unroutable") {
|
|
1901
|
+
// #2829 slice 1 — positive no-receiver evidence: the queue's cold-start
|
|
1902
|
+
// trigger. Fire-and-forget; it can never change this classification.
|
|
1903
|
+
this.noteWakeWithoutReceiver(destinationSession);
|
|
1643
1904
|
return { classified: "failed", nudgeResult: destClass.teaching };
|
|
1644
1905
|
}
|
|
1645
1906
|
// A hosted member with a trigger: ring it. Accepted is indeterminate, never verified: pickup is its claim.
|
|
@@ -1702,7 +1963,7 @@ export class QueueRepository {
|
|
|
1702
1963
|
// expired — so it records `indeterminate` (never silently delivered, never a
|
|
1703
1964
|
// hard `failed`). A definite non-timeout failure (unreachable, unknown
|
|
1704
1965
|
// session) stays `failed`.
|
|
1705
|
-
return this.classifyWakeResult(res);
|
|
1966
|
+
return this.classifyWakeResult(res, destinationSession);
|
|
1706
1967
|
}
|
|
1707
1968
|
catch (err) {
|
|
1708
1969
|
const msg = err instanceof Error ? err.message : String(err);
|
|
@@ -1710,6 +1971,12 @@ export class QueueRepository {
|
|
|
1710
1971
|
if (isWakeTimeoutSignal(msg)) {
|
|
1711
1972
|
return { classified: "indeterminate", nudgeResult: `indeterminate:${msg}` };
|
|
1712
1973
|
}
|
|
1974
|
+
// #2829 slice 1 — a thrown send is still an attempted send: the same positive
|
|
1975
|
+
// no-receiver evidence check rides here (best-effort, never changes the outcome).
|
|
1976
|
+
try {
|
|
1977
|
+
this.wakeHasNoReceiver(destinationSession);
|
|
1978
|
+
}
|
|
1979
|
+
catch { /* never changes the outcome */ }
|
|
1713
1980
|
return { classified: "failed", nudgeResult: `failed:${msg}` };
|
|
1714
1981
|
}
|
|
1715
1982
|
}
|
|
@@ -1773,12 +2040,16 @@ export class QueueRepository {
|
|
|
1773
2040
|
const ask = this.getById(askId);
|
|
1774
2041
|
if (!this.hasReplyToColumn || !ask || ask.humanIntent === "update" || !this.isPersonAddress(ask.destinationSession))
|
|
1775
2042
|
return [];
|
|
2043
|
+
if (ask.relayedAnswers) {
|
|
2044
|
+
const { relays, corrections, directAnswers = [], unplacedReplies = [], returnId } = ask.relayedAnswers;
|
|
2045
|
+
return [...[...directAnswers, ...relays].map(answer => ({ ...answer, qitemId: returnId })), ...corrections, ...unplacedReplies].sort((a, b) => a.at.localeCompare(b.at));
|
|
2046
|
+
}
|
|
1776
2047
|
const candidates = this.db.prepare(`SELECT qitem_id, source_session, ts_created,
|
|
1777
2048
|
EXISTS (SELECT 1 FROM json_each(queue_items.tags) WHERE value = 'human-answer') AS tagged
|
|
1778
2049
|
FROM queue_items
|
|
1779
2050
|
WHERE reply_to = ? AND destination_session = ?
|
|
1780
2051
|
AND (EXISTS (SELECT 1 FROM json_each(queue_items.tags) WHERE value = 'human-answer')
|
|
1781
|
-
OR (qitem_id LIKE 'qitem-slack-inbound-%' AND COALESCE(summary, '') NOT LIKE '[Recovered after gap] %'))
|
|
2052
|
+
${this.hasSummaryColumn ? "OR (qitem_id LIKE 'qitem-slack-inbound-%' AND COALESCE(summary, '') NOT LIKE '[Recovered after gap] %')" : ""})
|
|
1782
2053
|
ORDER BY ts_created, rowid`).all(askId, ask.sourceSession)
|
|
1783
2054
|
.filter((row) => !this.isSharedChannel(row.source_session)
|
|
1784
2055
|
&& (this.answersAsk(ask, row.source_session) || (row.tagged === 1 && row.source_session === UNATTRIBUTED_ACTOR)));
|
|
@@ -1812,6 +2083,195 @@ export class QueueRepository {
|
|
|
1812
2083
|
const row = episode ? this.getById(humanAnswerId(qitemId, episode.key)) : null;
|
|
1813
2084
|
return row?.sourceSession === actorSession ? row : null;
|
|
1814
2085
|
}
|
|
2086
|
+
/** The history, linked return, close and wake intent commit together. */
|
|
2087
|
+
writeRelayedAnswer(input, envelope) {
|
|
2088
|
+
const events = [];
|
|
2089
|
+
const wakes = [];
|
|
2090
|
+
const result = this.db.transaction(() => {
|
|
2091
|
+
const ask = this.getByIdOrThrow(input.qitemId);
|
|
2092
|
+
const refuse = (message) => { throw new QueueRepositoryError("relayed_answer_refused", message); };
|
|
2093
|
+
if (!this.isPersonAddress(ask.destinationSession) || this.isPersonAddress(ask.sourceSession)
|
|
2094
|
+
|| ask.humanIntent === "update" || ask.delegatedDecision || runnerPermissionOrigin(ask)
|
|
2095
|
+
|| isHostPairingAsk(ask) || ask.tags?.includes("runner-permission") || ask.tags?.includes(PROMPT_ALERT_TAG)) {
|
|
2096
|
+
refuse("Only ordinary asks to a person take relayed answers, not permission requests or host pairing.");
|
|
2097
|
+
}
|
|
2098
|
+
const questions = ask.humanQuestions ?? [];
|
|
2099
|
+
const submission = "relay" in input ? input.relay : input.direct;
|
|
2100
|
+
const named = questions.find(q => q.id === submission.questionId);
|
|
2101
|
+
const option = named?.options.find(option => option.id === submission.optionId);
|
|
2102
|
+
if (("relay" in input && (questions.length ? !named : submission.questionId !== undefined))
|
|
2103
|
+
|| (submission.optionId !== undefined && !option)) {
|
|
2104
|
+
refuse("Name the exact question and, for a choice, a valid option on that question.");
|
|
2105
|
+
}
|
|
2106
|
+
let journal = ask.relayedAnswers ?? { relays: [], corrections: [], returnId: null };
|
|
2107
|
+
const directAnswersAtEntry = journal.directAnswers?.length ?? 0;
|
|
2108
|
+
let direct = ask.humanAnswers ?? {};
|
|
2109
|
+
const relayedQuestions = () => questions.filter(q => journal.relays.some(answer => answer.questionId === q.id));
|
|
2110
|
+
const openQuestions = () => unansweredQuestions(questions.filter(q => !journal.relays.some(r => r.questionId === q.id)), direct);
|
|
2111
|
+
const unanswered = () => ask.state === "pending" ? openQuestions().map(q => q.id) : [];
|
|
2112
|
+
const receipt = (replyQitemId = journal.returnId, disposition) => ({
|
|
2113
|
+
item: this.getByIdOrThrow(input.qitemId), replyQitemId, unanswered: unanswered(), ...(disposition ? { [disposition]: true } : {}),
|
|
2114
|
+
});
|
|
2115
|
+
const at = new Date().toISOString();
|
|
2116
|
+
const identity = { identityProvenance: input.identityProvenance, identityPrincipal: input.identityPrincipal };
|
|
2117
|
+
const deliver = (qitemId, summary, body, tag) => {
|
|
2118
|
+
const create = { qitemId, sourceSession: input.actorSession, destinationSession: ask.sourceSession, summary, body,
|
|
2119
|
+
tags: [tag, ...(ask.tags ?? []).filter(t => /^(project|mission|slice):/.test(t))], inboundReplyTo: ask.qitemId,
|
|
2120
|
+
nudge: input.nudge, ...identity };
|
|
2121
|
+
events.push(this.createWithinTransaction(create).persistedEvent);
|
|
2122
|
+
if (this.outbox)
|
|
2123
|
+
this.stageHandoffWake(qitemId, create.sourceSession, create.destinationSession, sideEffectProvenance(input.identityProvenance), input.nudge);
|
|
2124
|
+
wakes.push(create);
|
|
2125
|
+
};
|
|
2126
|
+
let correctionId;
|
|
2127
|
+
let unplacedId;
|
|
2128
|
+
if ("relay" in input) {
|
|
2129
|
+
const relay = input.relay;
|
|
2130
|
+
const questionId = named?.id ?? null;
|
|
2131
|
+
const prior = journal.relays.find(answer => answer.questionId === questionId);
|
|
2132
|
+
if (parseSessionName(input.actorSession).kind !== "canonical" || !this.answersAsk(ask, relay.attributedTo)
|
|
2133
|
+
|| !this.isPersonAddress(relay.attributedTo) || this.isSharedChannel(relay.attributedTo)) {
|
|
2134
|
+
refuse("Record as an agent seat and attribute the answer to a person's address (a human seat or @external person), never a shared channel.");
|
|
2135
|
+
}
|
|
2136
|
+
if (prior) {
|
|
2137
|
+
if (prior.recordedBy === input.actorSession && prior.by === relay.attributedTo && prior.text === relay.text
|
|
2138
|
+
&& prior.channel === relay.channel && prior.optionId === relay.optionId && prior.answeredAt === relay.answeredAt)
|
|
2139
|
+
return receipt();
|
|
2140
|
+
refuse("This question already has a relay; a direct answer can correct it.");
|
|
2141
|
+
}
|
|
2142
|
+
if (ask.state !== "pending" || ask.blockedOn || (named && Object.hasOwn(direct, named.id))
|
|
2143
|
+
|| this.getById(humanAnswerId(ask.qitemId)) || (!ask.relayedAnswers && this.answersForAsk(ask.qitemId).length > 0)) {
|
|
2144
|
+
refuse("This question is not waiting for a relayed answer.");
|
|
2145
|
+
}
|
|
2146
|
+
if (!ask.relayedAnswers && Object.keys(direct).length) {
|
|
2147
|
+
// Partial clicks predate the journal. Recover their real actor and time from the click transitions.
|
|
2148
|
+
const choices = new Map(questions.flatMap(q => q.options.map(o => [
|
|
2149
|
+
`human-answer-recorded: ${JSON.stringify({ questionId: q.id, optionId: o.id })}`,
|
|
2150
|
+
{ kind: "direct-answer", questionId: q.id, optionId: o.id, text: o.label },
|
|
2151
|
+
])));
|
|
2152
|
+
journal = { ...journal, directAnswers: this.transitionLog.listForQitem(ask.qitemId).flatMap(transition => {
|
|
2153
|
+
const choice = choices.get(transition.transitionNote ?? "");
|
|
2154
|
+
return choice ? [{ ...choice, by: transition.actorSession, at: transition.ts }] : [];
|
|
2155
|
+
}) };
|
|
2156
|
+
}
|
|
2157
|
+
journal = { ...journal, relays: [...journal.relays, { kind: "relayed-answer", by: relay.attributedTo, at,
|
|
2158
|
+
recordedBy: input.actorSession, questionId, channel: relay.channel, text: relay.text,
|
|
2159
|
+
...(relay.optionId !== undefined ? { optionId: relay.optionId } : {}), ...(relay.answeredAt ? { answeredAt: relay.answeredAt } : {}) }] };
|
|
2160
|
+
}
|
|
2161
|
+
else {
|
|
2162
|
+
if (!ask.relayedAnswers || this.isSharedChannel(input.actorSession)
|
|
2163
|
+
|| (!input.direct.primaryUser && !this.answersAsk(ask, input.actorSession)))
|
|
2164
|
+
refuse("Only a direct human answer can correct a relay.");
|
|
2165
|
+
const text = input.direct.text ?? option?.label ?? "";
|
|
2166
|
+
if (!text.trim())
|
|
2167
|
+
refuse("Supply the direct answer's words or option.");
|
|
2168
|
+
const { eventId, optionId, attachments, recovering } = input.direct;
|
|
2169
|
+
const history = [...journal.corrections, ...(journal.directAnswers ?? []), ...(journal.unplacedReplies ?? [])];
|
|
2170
|
+
const replay = eventId ? history.find(answer => answer.eventId === eventId)
|
|
2171
|
+
: history.filter(answer => named ? answer.questionId === named.id
|
|
2172
|
+
: answer.questionId === null || (submission.questionId === undefined && "placement" in answer && answer.placement === "first-unanswered"))
|
|
2173
|
+
.sort((a, b) => a.at.localeCompare(b.at)).at(-1);
|
|
2174
|
+
if (replay && (!named || replay.questionId === named.id || (eventId && replay.kind === "unplaced-reply"))
|
|
2175
|
+
&& replay.by === input.actorSession && replay.text === text && replay.optionId === optionId) {
|
|
2176
|
+
if (replay.kind === "direct-correction")
|
|
2177
|
+
return receipt(replay.qitemId, "corrected");
|
|
2178
|
+
if (replay.kind === "unplaced-reply")
|
|
2179
|
+
return receipt(replay.qitemId, "unplaced");
|
|
2180
|
+
return receipt();
|
|
2181
|
+
}
|
|
2182
|
+
if (eventId && replay)
|
|
2183
|
+
refuse("This event was already recorded with a different answer.");
|
|
2184
|
+
const waiting = ask.state === "pending" && !ask.blockedOn;
|
|
2185
|
+
const closedByRelay = ask.state === "done" && ask.closureReason === "relayed-answer";
|
|
2186
|
+
const candidates = waiting ? openQuestions() : closedByRelay ? unansweredQuestions(relayedQuestions(), direct) : [];
|
|
2187
|
+
const question = named ?? (!recovering && submission.questionId === undefined && candidates.length === 1 ? candidates[0] : undefined);
|
|
2188
|
+
const questionId = question?.id ?? null;
|
|
2189
|
+
const prior = journal.relays.find(answer => answer.questionId === questionId);
|
|
2190
|
+
const canPlace = (waiting || (closedByRelay && prior !== undefined))
|
|
2191
|
+
&& (question !== undefined || (questions.length === 0 && submission.questionId === undefined));
|
|
2192
|
+
if (!canPlace && optionId !== undefined && !recovering) {
|
|
2193
|
+
refuse("This ask is not waiting for an answer or a correction to that question.");
|
|
2194
|
+
}
|
|
2195
|
+
const typedReply = { kind: "typed-reply", text, placement: named ? "explicit" : "first-unanswered",
|
|
2196
|
+
unansweredCount: Math.max(0, openQuestions().length - (prior ? 0 : 1)) };
|
|
2197
|
+
const answer = { by: input.actorSession, at, text, questionId,
|
|
2198
|
+
...(optionId === undefined ? {} : { optionId }), ...(eventId ? { eventId } : {}) };
|
|
2199
|
+
const placedAnswer = { ...answer, ...(question && optionId === undefined ? { placement: typedReply.placement } : {}) };
|
|
2200
|
+
if (!canPlace || recovering) {
|
|
2201
|
+
unplacedId = humanAnswerId(ask.qitemId, `relay-unplaced:${journal.unplacedReplies?.length ?? 0}`);
|
|
2202
|
+
journal = { ...journal, unplacedReplies: [...(journal.unplacedReplies ?? []),
|
|
2203
|
+
{ kind: "unplaced-reply", qitemId: unplacedId, ...answer, questionId: null }] };
|
|
2204
|
+
const describe = (items) => items.map(q => `${q.id}: ${q.question}`).join("; ") || "none";
|
|
2205
|
+
deliver(unplacedId, `Direct reply (not placed): ${ask.summary ?? ask.qitemId}`, `Direct reply from ${input.actorSession} on ${ask.qitemId}; no answer was changed.${named ? ` Selected question: ${named.id}.` : ""}\nOpen questions: ${describe(waiting ? openQuestions() : [])}\nQuestions with a relay: ${describe(relayedQuestions())}\n\n${text}`, "human-reply-unplaced");
|
|
2206
|
+
}
|
|
2207
|
+
else if (question) {
|
|
2208
|
+
direct = { ...direct, [question.id]: optionId ?? typedReply };
|
|
2209
|
+
}
|
|
2210
|
+
if (!unplacedId && prior) {
|
|
2211
|
+
correctionId = humanAnswerId(ask.qitemId, `relay-correction:${journal.corrections.length}`);
|
|
2212
|
+
journal = { ...journal, corrections: [...journal.corrections, { kind: "direct-correction", qitemId: correctionId, ...placedAnswer }] };
|
|
2213
|
+
deliver(correctionId, `Direct correction to a RELAYED answer: ${ask.summary ?? ask.qitemId}`, `Direct correction from ${input.actorSession} to the RELAYED answer on ${ask.qitemId}${question ? `, question ${question.id}${optionId ? `, option ${optionId}` : ""}` : ""}. The relay stays in history. Do not repeat work already performed.\n\n${question && !named ? `${describeTypedReplyPlacement(question, typedReply)}:\n` : ""}${text}`, "human-answer-correction");
|
|
2214
|
+
}
|
|
2215
|
+
else if (!unplacedId) {
|
|
2216
|
+
journal = { ...journal, directAnswers: [...(journal.directAnswers ?? []), { kind: "direct-answer", ...placedAnswer }] };
|
|
2217
|
+
}
|
|
2218
|
+
if (eventId && attachments) {
|
|
2219
|
+
deliver(humanAnswerId(ask.qitemId, `relay-attachments:${eventId}`), `Attachments to a direct answer on ${ask.qitemId}`, attachments.body, attachments.tag);
|
|
2220
|
+
}
|
|
2221
|
+
}
|
|
2222
|
+
const completed = !unplacedId && ask.state === "pending" && unanswered().length === 0;
|
|
2223
|
+
if (completed) {
|
|
2224
|
+
if (!journal.returnId) {
|
|
2225
|
+
// First completion only. After a deliberate reopen, the journal still names the
|
|
2226
|
+
// original return row; re-inserting the same deterministic id would roll back the
|
|
2227
|
+
// correction and its linked reply on a duplicate primary key, so reuse that row.
|
|
2228
|
+
const returnId = humanAnswerId(ask.qitemId, "relayed-answer");
|
|
2229
|
+
deliver(returnId, `Answers recorded with a RELAY: ${ask.summary ?? ask.qitemId}`, `${renderRelayedAnswers(journal, questions, direct)}\n\nIn reply to: ${ask.qitemId} (see its answer history).`, "relayed-answer");
|
|
2230
|
+
journal = { ...journal, returnId };
|
|
2231
|
+
}
|
|
2232
|
+
else if ((journal.directAnswers?.length ?? 0) > directAnswersAtEntry) {
|
|
2233
|
+
// A reopened ask whose direct answer changed: the stored return keeps its first
|
|
2234
|
+
// words, so the changed answer must still reach the asker as a linked correction.
|
|
2235
|
+
// An exact retry returns at the replay check above and never reaches this branch.
|
|
2236
|
+
// The id derives from the cumulative direct-answer count: it only grows across
|
|
2237
|
+
// reopens, so B and C never collide on the deterministic id (a corrections+added
|
|
2238
|
+
// sum would repeat for a direct-only second question).
|
|
2239
|
+
const added = (journal.directAnswers ?? []).slice(directAnswersAtEntry);
|
|
2240
|
+
const updateId = humanAnswerId(ask.qitemId, `relay-return-update:${(journal.directAnswers ?? []).length}`);
|
|
2241
|
+
deliver(updateId, `Direct answer changed on a reopened ask: ${ask.summary ?? ask.qitemId}`, `Direct answer from ${input.actorSession} on ${ask.qitemId} changed after reopen. The stored return keeps its id and history; the words now stand as:\n\n${added.map(a => `${a.questionId ?? "general"}: ${a.text}`).join("\n")}\n\nIn reply to: ${ask.qitemId}.`, "human-answer-correction");
|
|
2242
|
+
}
|
|
2243
|
+
}
|
|
2244
|
+
this.db.prepare("UPDATE queue_items SET relayed_answers = ?, human_answers = ?, ts_updated = ? WHERE qitem_id = ?")
|
|
2245
|
+
.run(JSON.stringify(journal), Object.keys(direct).length ? JSON.stringify(direct) : null, at, ask.qitemId);
|
|
2246
|
+
events.push(...this.updateInTransactionalContext({ qitemId: ask.qitemId, actorSession: input.actorSession, ...identity,
|
|
2247
|
+
transitionNote: completed ? "RELAYED answer set returned to the asking seat" : correctionId ? "Direct correction to a RELAYED answer" : unplacedId ? "Direct reply returned without placing it" : "relay" in input ? "RELAYED answer recorded" : "Direct answer recorded",
|
|
2248
|
+
...(completed ? { state: "done", closureReason: "relayed-answer", resolution: renderRelayedAnswers(journal, questions, direct) } : {}),
|
|
2249
|
+
}, completed).persistedEvents);
|
|
2250
|
+
return unplacedId ? receipt(unplacedId, "unplaced") : correctionId ? receipt(correctionId, "corrected") : receipt();
|
|
2251
|
+
})();
|
|
2252
|
+
const deliverWakes = () => {
|
|
2253
|
+
for (const wake of wakes) {
|
|
2254
|
+
if (wake.nudge === false || !wake.qitemId)
|
|
2255
|
+
continue;
|
|
2256
|
+
if (this.outbox)
|
|
2257
|
+
this.deliverWakeIntentAfterCommit(`${WAKE_INTENT_PREFIX}${wake.qitemId}`);
|
|
2258
|
+
else
|
|
2259
|
+
void this.maybeNudge(wake.qitemId, wake.destinationSession, wake.nudge, wake.sourceSession)
|
|
2260
|
+
.catch(error => console.warn(`[queue] answer ${wake.qitemId} retained; wake failed`, error));
|
|
2261
|
+
}
|
|
2262
|
+
};
|
|
2263
|
+
if (envelope) {
|
|
2264
|
+
for (const event of events)
|
|
2265
|
+
envelope.register(event);
|
|
2266
|
+
envelope.afterCommit(deliverWakes);
|
|
2267
|
+
}
|
|
2268
|
+
else {
|
|
2269
|
+
for (const event of events)
|
|
2270
|
+
this.eventBus.notifySubscribers(event);
|
|
2271
|
+
deliverWakes();
|
|
2272
|
+
}
|
|
2273
|
+
return result;
|
|
2274
|
+
}
|
|
1815
2275
|
async create(input, verifyBeforeCreate) {
|
|
1816
2276
|
// FOUNDER ROOT INVARIANT (2026-08-27, supersedes 51-09 incr 4 / ruling cb19867f Q2):
|
|
1817
2277
|
// a LOCAL write stores the bare transport identity — no self-host suffix inside one
|
|
@@ -2881,11 +3341,24 @@ export class QueueRepository {
|
|
|
2881
3341
|
* (the public update() wraps; the public updateWithinTransaction()
|
|
2882
3342
|
* composes inside the caller's outer transaction).
|
|
2883
3343
|
*/
|
|
2884
|
-
updateInTransactionalContext(input) {
|
|
3344
|
+
updateInTransactionalContext(input, completingRelay = false) {
|
|
3345
|
+
if (input.closureReason === "relayed-answer" && !completingRelay) {
|
|
3346
|
+
throw new QueueRepositoryError("invalid_closure_reason", "Use the relay-answer operation to record a relayed answer.");
|
|
3347
|
+
}
|
|
2885
3348
|
const qitem = this.getById(input.qitemId);
|
|
2886
3349
|
if (!qitem) {
|
|
2887
3350
|
throw new QueueRepositoryError("qitem_not_found", `qitem ${input.qitemId} not found`);
|
|
2888
3351
|
}
|
|
3352
|
+
if (input.expectState != null) {
|
|
3353
|
+
if (!isQueueState(input.expectState)) {
|
|
3354
|
+
throw new QueueRepositoryError("invalid_state", `expectState=${String(input.expectState)} not valid; valid: ${QUEUE_STATES.join(", ")}; nothing was written`);
|
|
3355
|
+
}
|
|
3356
|
+
// The condition is read in the same transaction as the write below, so no other write
|
|
3357
|
+
// (a claim, a close) can land between this check and this update's own write.
|
|
3358
|
+
if (qitem.state !== input.expectState) {
|
|
3359
|
+
throw new QueueRepositoryError("qitem_state_changed", `qitem ${input.qitemId} is ${qitem.state}, not the expected ${input.expectState}; nothing was written`, { expectedState: input.expectState, currentState: qitem.state });
|
|
3360
|
+
}
|
|
3361
|
+
}
|
|
2889
3362
|
const hasReestimate = input.closureRequiredAt !== undefined;
|
|
2890
3363
|
let closureRequiredAt;
|
|
2891
3364
|
if (hasReestimate) {
|
|
@@ -3011,7 +3484,7 @@ export class QueueRepository {
|
|
|
3011
3484
|
state: input.state,
|
|
3012
3485
|
closureReason: input.closureReason ?? null,
|
|
3013
3486
|
closureTarget: input.closureTarget ?? null,
|
|
3014
|
-
});
|
|
3487
|
+
}, completingRelay);
|
|
3015
3488
|
if (!validation.ok) {
|
|
3016
3489
|
throw new QueueRepositoryError(validation.code, validation.message, {
|
|
3017
3490
|
validReasons: "validReasons" in validation ? validation.validReasons : undefined,
|
|
@@ -3225,6 +3698,15 @@ export class QueueRepository {
|
|
|
3225
3698
|
resolution = ?
|
|
3226
3699
|
WHERE qitem_id = ?`)
|
|
3227
3700
|
.run(input.state, ts, validation.closureReason, validation.closureTarget, input.handedOffTo ?? null, nextBlockedOn, nextResolution, input.qitemId);
|
|
3701
|
+
// A row that enters in-progress here (resolve, or an update to in-progress from blocked, pending or a reopened
|
|
3702
|
+
// terminal state) carries the claimant generation the way claim() stamps it: the destination's current occupant,
|
|
3703
|
+
// not the actor's, since another seat or a person can resolve it. A seat swap releases or transfers in-progress
|
|
3704
|
+
// rows by this stamp (migration 063).
|
|
3705
|
+
if (this.hasClaimedGenColumn && input.state === "in-progress" && fromState !== "in-progress") {
|
|
3706
|
+
this.db
|
|
3707
|
+
.prepare("UPDATE queue_items SET claimed_by_generation_uuid = ? WHERE qitem_id = ?")
|
|
3708
|
+
.run(this.resolveOccupantGeneration?.(qitem.destinationSession) ?? null, input.qitemId);
|
|
3709
|
+
}
|
|
3228
3710
|
// FR-6: summary/evidence_ref are PERSISTED onto the existing item (not
|
|
3229
3711
|
// merely validated-then-dropped) — visible to the attention query, to
|
|
3230
3712
|
// Packet 2 and to every reader of the row. Only non-blank values are
|
|
@@ -3450,6 +3932,18 @@ export class QueueRepository {
|
|
|
3450
3932
|
return null;
|
|
3451
3933
|
return "park_timer_target_terminal";
|
|
3452
3934
|
}
|
|
3935
|
+
/** A usage-limit blocker's timer is a time event with no recipient: the blocker is addressed to `wake-ladder@<rig>`,
|
|
3936
|
+
* which no seat carries, so an input delivery can never succeed (#3704). When every row this job currently wakes is
|
|
3937
|
+
* such a blocker, its due fire is recorded here, before transport: the blocker resolves once and its dependents are
|
|
3938
|
+
* released. Returns the job's terminal reason, or null to keep the send path. */
|
|
3939
|
+
fireUsageLimitTimerWithoutDelivery(jobId) {
|
|
3940
|
+
const targets = this.wakeRepo.findBlockedQitemsByWatchdog(jobId, true);
|
|
3941
|
+
if (targets.length === 0
|
|
3942
|
+
|| !targets.every(({ qitemId }) => this.getById(qitemId)?.tags?.includes(USAGE_LIMIT_BLOCKER_TAG)))
|
|
3943
|
+
return null;
|
|
3944
|
+
this.recordWatchdogWakeAttempt(jobId, "no-recipient");
|
|
3945
|
+
return "usage_limit_expiry_fired";
|
|
3946
|
+
}
|
|
3453
3947
|
/** OPR.0.7.0.12 — the current park's recorded continuation, bounded (see the transition log). */
|
|
3454
3948
|
currentParkContinuation(qitemId) {
|
|
3455
3949
|
return this.transitionLog.currentParkContinuation(qitemId);
|
|
@@ -3661,7 +4155,7 @@ export class QueueRepository {
|
|
|
3661
4155
|
let mine = true;
|
|
3662
4156
|
const result = this.db.transaction(() => {
|
|
3663
4157
|
const item = this.getById(input.qitemId);
|
|
3664
|
-
if (item?.state !== "pending" || item.humanIntent === "update"
|
|
4158
|
+
if (item?.state !== "pending" || item.humanIntent === "update" || item.relayedAnswers
|
|
3665
4159
|
|| (!this.answersAsk(item, input.actorSession) && !input.primaryUser)
|
|
3666
4160
|
|| !this.isPersonAddress(item.destinationSession))
|
|
3667
4161
|
return null;
|
|
@@ -3673,9 +4167,12 @@ export class QueueRepository {
|
|
|
3673
4167
|
const questions = item.humanQuestions ?? [];
|
|
3674
4168
|
const decision = questions.length && unansweredQuestions(questions, item.humanAnswers ?? {}).length === 0
|
|
3675
4169
|
? formatHumanAnswers(questions, item.humanAnswers ?? {}).join("; ") : humanAnswerText(winner.body);
|
|
3676
|
-
return this.closeDirectAsk(item, winner.sourceSession, decision, !this.answersAsk(item, winner.sourceSession));
|
|
4170
|
+
return this.closeDirectAsk(item, winner.sourceSession, decision, !this.answersAsk(item, winner.sourceSession), this.answerIdentity(winner.qitemId));
|
|
3677
4171
|
}
|
|
3678
|
-
|
|
4172
|
+
// A close that consumes this caller's own committed answer carries that answer's identity too, so attribution doesn't
|
|
4173
|
+
// depend on who completes it. Only a close with no committed answer takes the caller's.
|
|
4174
|
+
const own = this.getHumanAnswer(item.qitemId, input.actorSession, { primaryUser: input.primaryUser === true });
|
|
4175
|
+
return this.closeDirectAsk(item, input.actorSession, input.decision, input.primaryUser === true, own ? this.answerIdentity(own.qitemId) : { provenance: input.identityProvenance ?? null, principal: input.identityPrincipal ?? null });
|
|
3679
4176
|
})();
|
|
3680
4177
|
if (!result)
|
|
3681
4178
|
return false;
|
|
@@ -3829,8 +4326,14 @@ export class QueueRepository {
|
|
|
3829
4326
|
const row = this.getById(humanAnswerId(qitemId, episodeKey));
|
|
3830
4327
|
return row && row.replyTo === qitemId && row.sourceSession !== actorSession ? row : null;
|
|
3831
4328
|
}
|
|
3832
|
-
/**
|
|
3833
|
-
|
|
4329
|
+
/** The identity an answer row was created with: none for an older row. */
|
|
4330
|
+
answerIdentity(answerId) {
|
|
4331
|
+
const created = this.transitionLog.listForQitem(answerId)[0];
|
|
4332
|
+
return { provenance: created?.identityProvenance ?? null, principal: created?.identityPrincipal ?? null };
|
|
4333
|
+
}
|
|
4334
|
+
/** Close a pending direct ask as `actor`, with that answer's recorded identity, its typed words under the first
|
|
4335
|
+
* unanswered question. Inside a transaction. */
|
|
4336
|
+
closeDirectAsk(item, actor, decision, primaryUser, identity) {
|
|
3834
4337
|
const asked = item.destinationSession;
|
|
3835
4338
|
let transitionNote = asked === actor ? "direct human reply received"
|
|
3836
4339
|
: primaryUser && actor === UNATTRIBUTED_ACTOR
|
|
@@ -3848,6 +4351,8 @@ export class QueueRepository {
|
|
|
3848
4351
|
closureReason: "no-follow-on",
|
|
3849
4352
|
transitionNote,
|
|
3850
4353
|
ownerNotificationKind: "human-decision-resolved",
|
|
4354
|
+
identityProvenance: identity.provenance,
|
|
4355
|
+
identityPrincipal: identity.principal,
|
|
3851
4356
|
});
|
|
3852
4357
|
}
|
|
3853
4358
|
/** Store a typed reply under the first unanswered question, keeping earlier clicks; the placement note, or null. */
|
|
@@ -3974,9 +4479,9 @@ export class QueueRepository {
|
|
|
3974
4479
|
/** A park's current question: its latest human-required transition, and that notification's final post receipt, if any. */
|
|
3975
4480
|
/** Bounded recorded relations for an opened request/result. No inference from seats, summaries or timestamps. */
|
|
3976
4481
|
relatedTo(qitemId, limit = 101) {
|
|
3977
|
-
const rows = this.db.prepare(`SELECT qitem_id, reply_to, handed_off_from, blocked_on FROM queue_items
|
|
4482
|
+
const rows = runSyncSite("queue.related_to", () => this.db.prepare(`SELECT qitem_id, reply_to, handed_off_from, blocked_on FROM queue_items
|
|
3978
4483
|
WHERE reply_to = ? OR handed_off_from = ? OR blocked_on = ? ORDER BY rowid LIMIT ?`)
|
|
3979
|
-
.all(qitemId, qitemId, qitemId, Math.min(101, Math.max(1, limit)));
|
|
4484
|
+
.all(qitemId, qitemId, qitemId, Math.min(101, Math.max(1, limit))));
|
|
3980
4485
|
return rows.flatMap(row => {
|
|
3981
4486
|
const item = this.getById(row.qitem_id);
|
|
3982
4487
|
if (!item)
|
|
@@ -4020,6 +4525,7 @@ export class QueueRepository {
|
|
|
4020
4525
|
}
|
|
4021
4526
|
const decision = [item.body, item.humanIntent ?? null, item.humanQuestions ?? null, phase, item.destinationSession, item.blockedOn,
|
|
4022
4527
|
item.humanAnswers ?? null, item.delegatedDecision ?? null, this.currentHumanRequiredEpisode(item.qitemId)?.key ?? null, parkEntry, replies,
|
|
4528
|
+
...(item.relayedAnswers ? [item.relayedAnswers] : []),
|
|
4023
4529
|
...(item.evidenceRef ? [item.evidenceRef] : [])];
|
|
4024
4530
|
return `dr1-${createHash("sha256").update(JSON.stringify(decision)).digest("hex").slice(0, 24)}`;
|
|
4025
4531
|
}
|
|
@@ -4131,7 +4637,7 @@ export class QueueRepository {
|
|
|
4131
4637
|
return refuse("permission-prompt", "a permission prompt or approval gate is never decided on the person's behalf");
|
|
4132
4638
|
}
|
|
4133
4639
|
// A click keeps a multi-question ask pending until every question is answered: once the person has started, it's theirs.
|
|
4134
|
-
if (item.humanAnswers && Object.keys(item.humanAnswers).length > 0) {
|
|
4640
|
+
if (item.relayedAnswers || (item.humanAnswers && Object.keys(item.humanAnswers).length > 0)) {
|
|
4135
4641
|
return refuse("person-answering", "they've started answering; their answer stands");
|
|
4136
4642
|
}
|
|
4137
4643
|
if (item.sourceSession !== input.actorSession) {
|
|
@@ -4196,11 +4702,41 @@ export class QueueRepository {
|
|
|
4196
4702
|
delegatedDecisionsFor(applicationId) {
|
|
4197
4703
|
if (!this.hasDelegatedDecisionColumn)
|
|
4198
4704
|
return [];
|
|
4199
|
-
const rows = this.db.prepare(`SELECT * FROM queue_items WHERE delegated_decision IS NOT NULL
|
|
4705
|
+
const rows = runSyncSite("queue.delegated_decisions", () => this.db.prepare(`SELECT * FROM queue_items WHERE delegated_decision IS NOT NULL
|
|
4200
4706
|
AND json_extract(delegated_decision, '$.applicationId') = ?
|
|
4201
|
-
ORDER BY json_extract(delegated_decision, '$.decidedAt'), qitem_id`).all(applicationId);
|
|
4707
|
+
ORDER BY json_extract(delegated_decision, '$.decidedAt'), qitem_id`).all(applicationId));
|
|
4202
4708
|
return rows.map((row) => this.rowToItem(row));
|
|
4203
4709
|
}
|
|
4710
|
+
/** #3645: the reads that name handoff successors (routes/queue.ts handoffSuccessors) for a whole page of rows in two
|
|
4711
|
+
* statements, batched as createLinkedSuccessorLookup reads (`IN (SELECT value FROM json_each(?))`): for each source,
|
|
4712
|
+
* the rows whose handed_off_from is that source, newest first by ts_created, at most `perSource` (what
|
|
4713
|
+
* `list({ handedOffFrom, limit: perSource })` picks for that source); and the rows with the given ids, as getById
|
|
4714
|
+
* finds them. Only the fields a successor shows, from the stored row, with no listing projection per row. */
|
|
4715
|
+
handoffSuccessorReads(sourceQitemIds, targetQitemIds, perSource) {
|
|
4716
|
+
const bySource = new Map();
|
|
4717
|
+
const byId = new Map();
|
|
4718
|
+
const shown = (r) => ({ qitemId: r.qitem_id, destinationSession: r.destination_session, state: r.state, tsCreated: r.ts_created });
|
|
4719
|
+
if (sourceQitemIds.length > 0) {
|
|
4720
|
+
const rows = this.db.prepare(`SELECT qitem_id, destination_session, state, ts_created, source FROM (
|
|
4721
|
+
SELECT qitem_id, destination_session, state, ts_created, handed_off_from AS source,
|
|
4722
|
+
ROW_NUMBER() OVER (PARTITION BY handed_off_from ORDER BY ts_created DESC) AS n
|
|
4723
|
+
FROM queue_items WHERE handed_off_from IN (SELECT value FROM json_each(?)))
|
|
4724
|
+
WHERE n <= ? ORDER BY source, n`).all(JSON.stringify([...new Set(sourceQitemIds)]), perSource);
|
|
4725
|
+
for (const r of rows) {
|
|
4726
|
+
const list = bySource.get(r.source);
|
|
4727
|
+
if (list)
|
|
4728
|
+
list.push(shown(r));
|
|
4729
|
+
else
|
|
4730
|
+
bySource.set(r.source, [shown(r)]);
|
|
4731
|
+
}
|
|
4732
|
+
}
|
|
4733
|
+
if (targetQitemIds.length > 0) {
|
|
4734
|
+
const rows = this.db.prepare("SELECT qitem_id, destination_session, state, ts_created FROM queue_items WHERE qitem_id IN (SELECT value FROM json_each(?))").all(JSON.stringify([...new Set(targetQitemIds)]));
|
|
4735
|
+
for (const r of rows)
|
|
4736
|
+
byId.set(r.qitem_id, shown(r));
|
|
4737
|
+
}
|
|
4738
|
+
return { bySource, byId };
|
|
4739
|
+
}
|
|
4204
4740
|
/** opts.waiting: false skips the row's waiting view (the stuck sweep's own reads); the default builds it. Per call:
|
|
4205
4741
|
* it never changes what another read returns. */
|
|
4206
4742
|
getById(qitemId, opts) {
|
|
@@ -4293,19 +4829,19 @@ export class QueueRepository {
|
|
|
4293
4829
|
* about this seat's own prompt that nobody holds is left out: with no operator seat to carry it, the alert falls back
|
|
4294
4830
|
* to the seat itself, and the escalation is the wake, not the content, so it is never that seat's work. One its owner
|
|
4295
4831
|
* explicitly holds (blocked) stays, so that hold and its wake are diagnosed as before; so does a row whose tags aren't
|
|
4296
|
-
* a JSON array. */
|
|
4832
|
+
* a JSON array. Each row carries its blocker and last update, so a hold is shown with what it waits on and its age. */
|
|
4297
4833
|
listOpenObligations(destinationSession, limit) {
|
|
4298
4834
|
const addresses = this.resolveSessionAddresses(destinationSession);
|
|
4299
4835
|
const slots = addresses.map(() => "?").join(",");
|
|
4300
4836
|
const ownPrompt = addresses.flatMap((address) => [`prompt-destination:${address}`, `consumed-prompt-destination:${address}`]);
|
|
4301
|
-
const rows = this.db.prepare(`SELECT qitem_id, state${this.hasSummaryColumn ? ", summary" : ""} FROM queue_items
|
|
4837
|
+
const rows = this.db.prepare(`SELECT qitem_id, state, blocked_on, ts_updated${this.hasSummaryColumn ? ", summary" : ""} FROM queue_items
|
|
4302
4838
|
WHERE destination_session IN (${slots}) AND state IN ('pending', 'in-progress', 'blocked')
|
|
4303
4839
|
AND NOT CASE WHEN state != 'blocked' AND json_valid(tags) THEN CASE WHEN json_type(tags) = 'array' THEN
|
|
4304
4840
|
EXISTS (SELECT 1 FROM json_each(queue_items.tags) WHERE value = ?)
|
|
4305
4841
|
AND EXISTS (SELECT 1 FROM json_each(queue_items.tags) WHERE value IN (${ownPrompt.map(() => "?").join(",")}))
|
|
4306
4842
|
ELSE 0 END ELSE 0 END
|
|
4307
4843
|
ORDER BY ts_created DESC LIMIT ?`).all(...addresses, WAKE_ESCALATION_TAG, ...ownPrompt, limit);
|
|
4308
|
-
return rows.map((r) => ({ qitemId: r.qitem_id, state: r.state, summary: r.summary ?? null }));
|
|
4844
|
+
return rows.map((r) => ({ qitemId: r.qitem_id, state: r.state, summary: r.summary ?? null, blockedOn: r.blocked_on, updatedAt: r.ts_updated }));
|
|
4309
4845
|
}
|
|
4310
4846
|
list(opts) {
|
|
4311
4847
|
// one recovery index for the whole listing (built on first use) instead of one json_each scan per row
|
|
@@ -4418,13 +4954,13 @@ export class QueueRepository {
|
|
|
4418
4954
|
const limit = Number.isFinite(opts.limit) ? Math.max(1, Math.min(101, Math.floor(opts.limit))) : 20;
|
|
4419
4955
|
const receipts = `SELECT qitem_id, ts, transition_note FROM queue_transitions` +
|
|
4420
4956
|
(detectTable(this.db, "queue_transitions_archive") ? ` UNION ALL SELECT qitem_id, ts, transition_note FROM queue_transitions_archive` : "");
|
|
4421
|
-
const rows = this.db.prepare(`
|
|
4957
|
+
const rows = runSyncSite("queue.delivered_human_updates", () => this.db.prepare(`
|
|
4422
4958
|
SELECT q.*, r.ts AS delivered_at, r.transition_note AS delivery_receipt
|
|
4423
4959
|
FROM queue_items q JOIN (${receipts}) r ON r.qitem_id = q.qitem_id
|
|
4424
4960
|
WHERE q.human_intent = 'update' AND is_human_seat_session(q.destination_session) = 1
|
|
4425
4961
|
AND (r.transition_note LIKE 'slack-owner-notification-posted %' OR r.transition_note LIKE 'relay-owner-notification-accepted %')
|
|
4426
4962
|
ORDER BY r.ts DESC, q.qitem_id DESC LIMIT ?
|
|
4427
|
-
`).all(limit);
|
|
4963
|
+
`).all(limit));
|
|
4428
4964
|
return rows.map((row) => {
|
|
4429
4965
|
const deliveryOutcome = row.delivery_receipt.startsWith(`${RELAY_OWNER_NOTIFICATION_ACCEPTED_PREFIX} `)
|
|
4430
4966
|
? "accepted"
|
|
@@ -5095,19 +5631,35 @@ export class QueueRepository {
|
|
|
5095
5631
|
* as prompt-clear recovery of a refused wake) read the real end and not `bridged:queued` (#3270). A typed fallback's
|
|
5096
5632
|
* result is recorded as a typed wake's is. */
|
|
5097
5633
|
recordBridgedWakeEnd(qitemId, end) {
|
|
5098
|
-
const
|
|
5634
|
+
const typed = end.kind === "typed" && end.result ? this.classifyWakeResult(end.result) : null;
|
|
5635
|
+
const result = typed ? typed.nudgeResult
|
|
5099
5636
|
: end.kind === "handed-to-hook" ? "bridged:handed-to-hook"
|
|
5100
5637
|
: end.kind === "not-delivered" ? "failed:hook_bridge_not_delivered"
|
|
5101
5638
|
: "indeterminate:hook_bridge_claimed_unacked";
|
|
5102
|
-
this.
|
|
5639
|
+
const intent = this.outbox?.getById(end.outboxId);
|
|
5640
|
+
if (intent && this.wakeOutcomeStale(intent))
|
|
5641
|
+
return;
|
|
5642
|
+
this.recordNudgeAttempt(qitemId, result, typed?.usageLimit);
|
|
5103
5643
|
}
|
|
5104
|
-
recordNudgeAttempt(qitemId, result) {
|
|
5644
|
+
recordNudgeAttempt(qitemId, result, usageLimit) {
|
|
5105
5645
|
const ts = new Date().toISOString();
|
|
5106
5646
|
this.db
|
|
5107
5647
|
.prepare(`UPDATE queue_items
|
|
5108
5648
|
SET last_nudge_attempt = ?, last_nudge_result = ?
|
|
5109
5649
|
WHERE qitem_id = ?`)
|
|
5110
5650
|
.run(ts, result, qitemId);
|
|
5651
|
+
if (usageLimit) {
|
|
5652
|
+
// The receipt's words stay as every reader knows them; the row says what they can't. Delivery bookkeeping, so a
|
|
5653
|
+
// reserved daemon actor: it isn't a change to the row for the wake ladder, the stuck sweep or recovery
|
|
5654
|
+
// (lastMeaningfulTransition), as closure-overdue's note isn't.
|
|
5655
|
+
const row = this.getById(qitemId);
|
|
5656
|
+
// It names the session the wake was sent to, which a reroute during the send can't change, and an in-progress row
|
|
5657
|
+
// keeps its retained claim blocker, as every other non-state receipt does.
|
|
5658
|
+
if (row)
|
|
5659
|
+
this.transitionLog.append({ qitemId, state: row.state, actorSession: "daemon@system",
|
|
5660
|
+
transitionNote: `wake reached ${usageLimit.sessionName ?? row.destinationSession}, or may have, at its usage limit (recorded ${usageLimit.asOf}; resets ${usageLimit.resetsAt}); delivery=${result}. Its agent isn't expected to read it before the reset.`,
|
|
5661
|
+
closureTarget: row.state === "in-progress" ? this.retainedClaimBlocker(qitemId) : undefined });
|
|
5662
|
+
}
|
|
5111
5663
|
// The transport's definite no-write refusal establishes the episode even when a
|
|
5112
5664
|
// fresh hook hid needs_input. Uncertain delivery never arms clear-triggered replay.
|
|
5113
5665
|
if (!this.promptClearRetries.has(qitemId) && isPromptOwnedWakeRefusal(result)) {
|
|
@@ -5169,26 +5721,51 @@ export class QueueRepository {
|
|
|
5169
5721
|
/**
|
|
5170
5722
|
* Pod-fallback: redirect qitem to a fallback destination (e.g., when a seat
|
|
5171
5723
|
* is unreachable). Emits qitem.fallback_routed; preserves chain_of_record.
|
|
5724
|
+
*
|
|
5725
|
+
* `opts` is for a caller that moves a row on an earlier read. `expectState` and `expectDestination` are checked
|
|
5726
|
+
* against the row read inside the transaction that moves it, so a row claimed or rerouted since that read is
|
|
5727
|
+
* refused (`fallback_state_mismatch`, `fallback_destination_mismatch`) and left unchanged. The expected destination
|
|
5728
|
+
* matches any of the row's session addresses, as a claim does. `wake` stages a durable wake for the new destination
|
|
5729
|
+
* in the same transaction, keyed on this reroute's transition; it is refused for a row that is not pending
|
|
5730
|
+
* (`wake_not_admitted`), since delivery only wakes a pending row. A caller that passes no `opts` gets the move it
|
|
5731
|
+
* always got.
|
|
5172
5732
|
*/
|
|
5173
|
-
routeToFallback(qitemId, fallbackDestination, reason) {
|
|
5174
|
-
|
|
5175
|
-
|
|
5176
|
-
|
|
5733
|
+
routeToFallback(qitemId, fallbackDestination, reason, opts = {}) {
|
|
5734
|
+
if (opts.expectState !== undefined && !isQueueState(opts.expectState)) {
|
|
5735
|
+
throw new QueueRepositoryError("invalid_state", `expectState=${opts.expectState} not valid; valid: ${QUEUE_STATES.join(", ")}`);
|
|
5736
|
+
}
|
|
5737
|
+
if (opts.wake && !this.outbox) {
|
|
5738
|
+
throw new QueueRepositoryError("wake_intent_store_unavailable", "a fallback with a wake requires an attached wake-intent store to make its wake durable — none attached");
|
|
5177
5739
|
}
|
|
5178
5740
|
const ts = new Date().toISOString();
|
|
5179
|
-
|
|
5180
|
-
const newChain = JSON.stringify([...(qitem.chainOfRecord ?? []), `fallback-from:${originalDestination}`]);
|
|
5181
|
-
// The field held only a fallback line before a close could store an outcome. The line this method last
|
|
5182
|
-
// wrote is replaced, as it always was; anything else in the field is an outcome (possibly after an
|
|
5183
|
-
// earlier fallback line) and stays, with the new line after it. "The line it last wrote" comes from the
|
|
5184
|
-
// row's own transitions, so no marker is stored in the text. When the row has closed since, the field may
|
|
5185
|
-
// end with an outcome that reads like that line, so then only a field that is exactly the line (an
|
|
5186
|
-
// appended outcome would make it longer) is replaced; with no such reroute transition the field is left whole.
|
|
5187
|
-
const fallbackLine = `fallback: ${reason}`;
|
|
5188
|
-
const start = qitem.resolution ? this.fallbackLineStart(qitemId, qitem.resolution) : null;
|
|
5189
|
-
const kept = qitem.resolution && start !== null ? qitem.resolution.slice(0, Math.max(0, start - 1)) : qitem.resolution;
|
|
5190
|
-
const nextResolution = kept ? `${kept}\n${fallbackLine}` : fallbackLine;
|
|
5741
|
+
let wakeId = null;
|
|
5191
5742
|
const txn = this.db.transaction(() => {
|
|
5743
|
+
const qitem = this.getById(qitemId);
|
|
5744
|
+
if (!qitem) {
|
|
5745
|
+
throw new QueueRepositoryError("qitem_not_found", `qitem ${qitemId} not found`);
|
|
5746
|
+
}
|
|
5747
|
+
if (opts.expectState !== undefined && qitem.state !== opts.expectState) {
|
|
5748
|
+
throw new QueueRepositoryError("fallback_state_mismatch", `qitem ${qitemId} is ${qitem.state}, not ${opts.expectState}; it was not rerouted`, { state: qitem.state, destinationSession: qitem.destinationSession });
|
|
5749
|
+
}
|
|
5750
|
+
if (opts.expectDestination !== undefined
|
|
5751
|
+
&& !this.resolveSessionAddresses(opts.expectDestination).includes(qitem.destinationSession)) {
|
|
5752
|
+
throw new QueueRepositoryError("fallback_destination_mismatch", `qitem ${qitemId} is addressed to ${qitem.destinationSession}, not ${opts.expectDestination}; it was not rerouted`, { state: qitem.state, destinationSession: qitem.destinationSession });
|
|
5753
|
+
}
|
|
5754
|
+
if (opts.wake && qitem.state !== "pending") {
|
|
5755
|
+
throw new QueueRepositoryError("wake_not_admitted", `qitem ${qitemId} is ${qitem.state}; a fallback wakes its new destination only for a pending row (omit the wake, or unclaim the row first)`);
|
|
5756
|
+
}
|
|
5757
|
+
const originalDestination = qitem.destinationSession;
|
|
5758
|
+
const newChain = JSON.stringify([...(qitem.chainOfRecord ?? []), `fallback-from:${originalDestination}`]);
|
|
5759
|
+
// The field held only a fallback line before a close could store an outcome. The line this method last
|
|
5760
|
+
// wrote is replaced, as it always was; anything else in the field is an outcome (possibly after an
|
|
5761
|
+
// earlier fallback line) and stays, with the new line after it. "The line it last wrote" comes from the
|
|
5762
|
+
// row's own transitions, so no marker is stored in the text. When the row has closed since, the field may
|
|
5763
|
+
// end with an outcome that reads like that line, so then only a field that is exactly the line (an
|
|
5764
|
+
// appended outcome would make it longer) is replaced; with no such reroute transition the field is left whole.
|
|
5765
|
+
const fallbackLine = `fallback: ${reason}`;
|
|
5766
|
+
const start = qitem.resolution ? this.fallbackLineStart(qitemId, qitem.resolution) : null;
|
|
5767
|
+
const kept = qitem.resolution && start !== null ? qitem.resolution.slice(0, Math.max(0, start - 1)) : qitem.resolution;
|
|
5768
|
+
const nextResolution = kept ? `${kept}\n${fallbackLine}` : fallbackLine;
|
|
5192
5769
|
this.db
|
|
5193
5770
|
.prepare(`UPDATE queue_items
|
|
5194
5771
|
SET destination_session = ?,
|
|
@@ -5204,13 +5781,63 @@ export class QueueRepository {
|
|
|
5204
5781
|
const armedJob = armed?.kind === "timer" ? (this.watchdogJobsRepo ?? new WatchdogJobsRepository(this.db)).getById(armed.ref) : null;
|
|
5205
5782
|
if (!armedJob || !isQueueWait(armedJob.specYaml))
|
|
5206
5783
|
this.retireParkGeneratedTimer(qitemId, "park_rerouted");
|
|
5207
|
-
this.transitionLog.append({
|
|
5784
|
+
const transition = this.transitionLog.append({
|
|
5208
5785
|
qitemId,
|
|
5209
5786
|
state: qitem.state,
|
|
5210
5787
|
actorSession: FALLBACK_ACTOR,
|
|
5211
5788
|
transitionNote: `fallback-routed: ${originalDestination} → ${fallbackDestination} (${reason})`,
|
|
5212
5789
|
closureTarget: qitem.state === "in-progress" ? this.retainedClaimBlocker(qitemId) : undefined,
|
|
5213
5790
|
});
|
|
5791
|
+
// The row keeps its id, so the wake is keyed on this reroute's transition rather than on the row. The wake its
|
|
5792
|
+
// create staged for the old destination stays where it is and is not delivered, since the row no longer waits
|
|
5793
|
+
// on that seat (currentWakeIntent). OpenRig moved the row, so the wake comes from OpenRig. A wake that cannot be
|
|
5794
|
+
// staged undoes the move; a full held-message quota at the new destination does not: as with a handoff's wake,
|
|
5795
|
+
// the wake is recorded as not retained and the reroute stands.
|
|
5796
|
+
if (opts.wake) {
|
|
5797
|
+
// The transition is new, so an entry the outbox already holds under its wake id is not this reroute's wake: a
|
|
5798
|
+
// row created with the id `fallback-<N>` holds it as its create wake. The outbox would hand that entry back,
|
|
5799
|
+
// and the move would deliver that row's wake while the new seat is never woken. The wake is staged under the
|
|
5800
|
+
// first `:<k>` id the outbox doesn't hold, and the row records the collision. The row's own create wake id is
|
|
5801
|
+
// never a candidate, held or not: a row created with the id `fallback-<N>` or `fallback-<N>:<k>` and no nudge
|
|
5802
|
+
// leaves it free, and wakeReplacedByReroute would read this wake as the row's create wake, which any earlier
|
|
5803
|
+
// reroute to the same seat replaces.
|
|
5804
|
+
const keyed = `${FALLBACK_WAKE_PREFIX}${transition.transitionId}`;
|
|
5805
|
+
const ownCreateWake = `${WAKE_INTENT_PREFIX}${qitemId}`;
|
|
5806
|
+
const holderOf = (id) => this.db.prepare("SELECT audit_pointer, destination_session FROM outbox_entries WHERE outbox_id = ?")
|
|
5807
|
+
.get(id);
|
|
5808
|
+
const holder = holderOf(keyed);
|
|
5809
|
+
let outboxId = keyed;
|
|
5810
|
+
for (let k = 1; outboxId === ownCreateWake || holderOf(outboxId); k++)
|
|
5811
|
+
outboxId = `${keyed}:${k}`;
|
|
5812
|
+
if (outboxId !== keyed) {
|
|
5813
|
+
this.transitionLog.append({
|
|
5814
|
+
qitemId,
|
|
5815
|
+
state: qitem.state,
|
|
5816
|
+
actorSession: FALLBACK_ACTOR,
|
|
5817
|
+
transitionNote: `fallback-wake-id-taken: ${keyed} already names `
|
|
5818
|
+
+ (holder ? `a wake for ${holder.audit_pointer ?? "no row"} to ${holder.destination_session}` : "this row's create wake")
|
|
5819
|
+
+ `; this reroute's wake to ${fallbackDestination} is ${outboxId}`,
|
|
5820
|
+
});
|
|
5821
|
+
}
|
|
5822
|
+
try {
|
|
5823
|
+
this.db.transaction(() => this.recordWakeIntent({
|
|
5824
|
+
outboxId,
|
|
5825
|
+
auditPointer: qitemId,
|
|
5826
|
+
qitemId,
|
|
5827
|
+
fromSession: OPENRIG_SENDER,
|
|
5828
|
+
toSession: fallbackDestination,
|
|
5829
|
+
identityProvenance: null,
|
|
5830
|
+
bareBody: renderQueueHandoffNudge(qitemId, qitem.summary),
|
|
5831
|
+
tags: [WAKE_TRIGGER_OPENRIG_TAG],
|
|
5832
|
+
}))();
|
|
5833
|
+
wakeId = outboxId;
|
|
5834
|
+
}
|
|
5835
|
+
catch (err) {
|
|
5836
|
+
if (err.code !== "retained_quota_full")
|
|
5837
|
+
throw err;
|
|
5838
|
+
this.recordNudgeAttempt(qitemId, `${WAKE_NOT_RETAINED}${err.message}`);
|
|
5839
|
+
}
|
|
5840
|
+
}
|
|
5214
5841
|
return this.eventBus.persistWithinTransaction({
|
|
5215
5842
|
type: "qitem.fallback_routed",
|
|
5216
5843
|
qitemId,
|
|
@@ -5221,6 +5848,8 @@ export class QueueRepository {
|
|
|
5221
5848
|
});
|
|
5222
5849
|
const persistedEvent = txn();
|
|
5223
5850
|
this.eventBus.notifySubscribers(persistedEvent);
|
|
5851
|
+
if (wakeId)
|
|
5852
|
+
this.deliverWakeIntentAfterCommit(wakeId);
|
|
5224
5853
|
return this.getByIdOrThrow(qitemId);
|
|
5225
5854
|
}
|
|
5226
5855
|
getByIdOrThrow(qitemId) {
|
|
@@ -5574,6 +6203,7 @@ export class QueueRepository {
|
|
|
5574
6203
|
humanQuestions: row.human_questions ? JSON.parse(row.human_questions) : null,
|
|
5575
6204
|
humanAnswers: row.human_answers ? JSON.parse(row.human_answers) : null,
|
|
5576
6205
|
delegatedDecision: row.delegated_decision ? JSON.parse(row.delegated_decision) : null,
|
|
6206
|
+
...(row.relayed_answers ? { relayedAnswers: JSON.parse(row.relayed_answers) } : {}),
|
|
5577
6207
|
closureReason: row.closure_reason,
|
|
5578
6208
|
closureTarget: row.closure_target,
|
|
5579
6209
|
closureRequiredAt: row.closure_required_at,
|