@openrig/cli 0.7.10 → 0.7.12
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 +9 -6
- package/daemon/assets/claude-permission-policies.cjs +41 -0
- package/daemon/assets/claude-permission-policies.d.cts +3 -0
- package/daemon/assets/claude-team-permissions.cjs +13 -3
- package/daemon/assets/guidance/openrig-context-entry.md +8 -0
- package/daemon/assets/herdr-app/mods/rig-cell-header/main.js +15 -0
- package/daemon/assets/herdr-app/mods/rig-cell-header/mod.json +1 -0
- package/daemon/assets/herdr-app/mods/rig-ended/main.js +14 -0
- package/daemon/assets/herdr-app/mods/rig-ended/mod.json +1 -0
- package/daemon/assets/herdr-app/mods/rig-pad/main.js +10 -0
- package/daemon/assets/herdr-app/mods/rig-pad/mod.json +1 -0
- package/daemon/assets/herdr-app/mods/rig-strip/main.js +153 -0
- package/daemon/assets/herdr-app/mods/rig-strip/mod.json +1 -0
- package/daemon/assets/openshell/README.md +1 -1
- package/daemon/assets/pi-account-lock.cjs +39 -0
- package/daemon/assets/plugins/openrig/.claude-plugin/marketplace.json +15 -0
- package/daemon/assets/plugins/openrig/.claude-plugin/plugin.json +32 -0
- package/daemon/assets/plugins/openrig/.codex-plugin/plugin.json +39 -0
- package/daemon/assets/plugins/openrig/.cursor-plugin/plugin.json +6 -0
- package/daemon/assets/plugins/openrig/LICENSE +200 -0
- package/daemon/assets/plugins/openrig/README.md +106 -0
- package/daemon/assets/plugins/openrig/assets/logo.svg +1 -0
- package/daemon/assets/plugins/openrig/mcp.json +10 -0
- package/daemon/assets/plugins/openrig/plugin.json +14 -0
- package/daemon/assets/plugins/openrig/skills/working-with-an-openrig-team/SKILL.md +90 -0
- package/daemon/assets/plugins/openrig-core/.claude-plugin/plugin.json +1 -1
- package/daemon/assets/plugins/openrig-core/.codex-plugin/plugin.json +1 -1
- package/daemon/assets/plugins/openrig-core/hooks/scripts/activity-relay.cjs +35 -0
- package/daemon/assets/plugins/openrig-core/hooks/scripts/refocus-state.cjs +103 -0
- package/daemon/assets/plugins/openrig-core/hooks/scripts/refocus.cjs +177 -86
- package/daemon/assets/plugins/openrig-core/skills/agent-operated-software/SKILL.md +5 -1
- package/daemon/assets/plugins/openrig-core/skills/claude-compaction-restore/SKILL.md +3 -2
- package/daemon/assets/plugins/openrig-core/skills/openrig-skills/SKILL.md +1 -0
- package/daemon/assets/plugins/openrig-core/skills/openrig-user/SKILL.md +25 -9
- package/daemon/assets/plugins/openrig-core/skills/refocusing/SKILL.md +5 -0
- package/daemon/assets/plugins/openrig-core/skills/refocusing/scripts/trace-to-root.py +26 -4
- package/daemon/assets/plugins/openrig-core/skills/retiring-and-inheriting-a-seat/SKILL.md +1 -1
- package/daemon/assets/plugins/openrig-core/skills/seat-continuity-and-handover/SKILL.md +10 -6
- package/daemon/assets/plugins/openrig-core/skills/session-compaction-and-restore/SKILL.md +1 -1
- package/daemon/assets/skills/rigs/SKILL.md +37 -2
- package/daemon/context-packs/help/help.md +18 -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 +104 -14
- package/daemon/context-packs/reference/acp-agents.md +68 -0
- package/daemon/context-packs/reference/getting-started.md +19 -3
- package/daemon/context-packs/reference/manifest.yaml +4 -1
- package/daemon/context-packs/reference/rig-spec.md +71 -8
- package/daemon/context-packs/reference/tmux-servers.md +214 -0
- package/daemon/context-packs/reference/whats-new.md +402 -132
- package/daemon/context-packs/skills/agent-operated-software/SKILL.md +5 -1
- 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/SKILL.md +3 -2
- package/daemon/context-packs/skills/claude-compaction-restore/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/agent-starters/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/agent-startup-and-context-ingestion/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/cross-host-rig-commands/SKILL.md +7 -0
- package/daemon/context-packs/skills/core/cross-host-rig-commands/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/human-in-the-loop/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/messaging-the-human/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/openrig-architect/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/openrig-cmux/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/openrig-herdr/SKILL.md +1 -0
- package/daemon/context-packs/skills/core/openrig-herdr/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/openrig-skills/SKILL.md +1 -0
- package/daemon/context-packs/skills/core/openrig-skills/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/openrig-software-factory/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/openrig-upgrade/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/rig-bundles-and-shareable-artifacts/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/rig-lifecycle/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/session-source-fork/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/specification-system/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/topology-mutation-and-seat-management/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/watchdog/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/working-with-an-openrig-team/SKILL.md +90 -0
- package/daemon/context-packs/skills/core/working-with-an-openrig-team/manifest.yaml +10 -0
- 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 +25 -9
- 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/SKILL.md +2 -0
- 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/SKILL.md +5 -0
- package/daemon/context-packs/skills/refocusing/manifest.yaml +1 -1
- package/daemon/context-packs/skills/refocusing/scripts/trace-to-root.py +26 -4
- package/daemon/context-packs/skills/retiring-and-inheriting-a-seat/SKILL.md +1 -1
- package/daemon/context-packs/skills/retiring-and-inheriting-a-seat/manifest.yaml +1 -1
- package/daemon/context-packs/skills/seat-continuity-and-handover/SKILL.md +10 -6
- package/daemon/context-packs/skills/seat-continuity-and-handover/manifest.yaml +1 -1
- package/daemon/context-packs/skills/session-compaction-and-restore/SKILL.md +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 +3 -1
- package/daemon/dist/adapters/claude-code-adapter.d.ts.map +1 -1
- package/daemon/dist/adapters/claude-code-adapter.js +59 -15
- package/daemon/dist/adapters/claude-code-adapter.js.map +1 -1
- package/daemon/dist/adapters/claude-resume.d.ts +2 -1
- package/daemon/dist/adapters/claude-resume.d.ts.map +1 -1
- package/daemon/dist/adapters/claude-resume.js +28 -6
- package/daemon/dist/adapters/claude-resume.js.map +1 -1
- package/daemon/dist/adapters/codex-resume.d.ts +1 -1
- package/daemon/dist/adapters/codex-resume.d.ts.map +1 -1
- package/daemon/dist/adapters/codex-resume.js +6 -2
- package/daemon/dist/adapters/codex-resume.js.map +1 -1
- package/daemon/dist/adapters/codex-runtime-adapter.d.ts +2 -0
- package/daemon/dist/adapters/codex-runtime-adapter.d.ts.map +1 -1
- package/daemon/dist/adapters/codex-runtime-adapter.js +54 -13
- package/daemon/dist/adapters/codex-runtime-adapter.js.map +1 -1
- package/daemon/dist/adapters/community-harness-runtime-adapter.d.ts +10 -6
- package/daemon/dist/adapters/community-harness-runtime-adapter.d.ts.map +1 -1
- package/daemon/dist/adapters/community-harness-runtime-adapter.js +78 -24
- package/daemon/dist/adapters/community-harness-runtime-adapter.js.map +1 -1
- package/daemon/dist/adapters/kernel-authority.d.ts +2 -4
- package/daemon/dist/adapters/kernel-authority.d.ts.map +1 -1
- package/daemon/dist/adapters/kernel-authority.js +10 -41
- package/daemon/dist/adapters/kernel-authority.js.map +1 -1
- package/daemon/dist/adapters/openshell-podman-observer.d.ts.map +1 -1
- package/daemon/dist/adapters/openshell-podman-observer.js +5 -3
- package/daemon/dist/adapters/openshell-podman-observer.js.map +1 -1
- package/daemon/dist/adapters/pi-community-runtime-adapter.d.ts +27 -0
- package/daemon/dist/adapters/pi-community-runtime-adapter.d.ts.map +1 -0
- package/daemon/dist/adapters/pi-community-runtime-adapter.js +38 -0
- package/daemon/dist/adapters/pi-community-runtime-adapter.js.map +1 -0
- package/daemon/dist/adapters/pi-resume.d.ts +4 -1
- package/daemon/dist/adapters/pi-resume.d.ts.map +1 -1
- package/daemon/dist/adapters/pi-resume.js +38 -9
- package/daemon/dist/adapters/pi-resume.js.map +1 -1
- package/daemon/dist/adapters/pi-runner-protocol.d.ts +9 -3
- package/daemon/dist/adapters/pi-runner-protocol.d.ts.map +1 -1
- package/daemon/dist/adapters/pi-runner-protocol.js +13 -1
- package/daemon/dist/adapters/pi-runner-protocol.js.map +1 -1
- package/daemon/dist/adapters/pi-runner.d.ts +14 -4
- package/daemon/dist/adapters/pi-runner.d.ts.map +1 -1
- package/daemon/dist/adapters/pi-runner.js +174 -29
- package/daemon/dist/adapters/pi-runner.js.map +1 -1
- package/daemon/dist/adapters/pi-runtime-adapter.d.ts +37 -14
- package/daemon/dist/adapters/pi-runtime-adapter.d.ts.map +1 -1
- package/daemon/dist/adapters/pi-runtime-adapter.js +97 -31
- package/daemon/dist/adapters/pi-runtime-adapter.js.map +1 -1
- package/daemon/dist/adapters/tmux-control.d.ts +32 -1
- package/daemon/dist/adapters/tmux-control.d.ts.map +1 -1
- package/daemon/dist/adapters/tmux-control.js +149 -9
- package/daemon/dist/adapters/tmux-control.js.map +1 -1
- package/daemon/dist/adapters/tmux-exec.d.ts.map +1 -1
- package/daemon/dist/adapters/tmux-exec.js +13 -4
- package/daemon/dist/adapters/tmux-exec.js.map +1 -1
- package/daemon/dist/adapters/tmux-server.d.ts +11 -0
- package/daemon/dist/adapters/tmux-server.d.ts.map +1 -1
- package/daemon/dist/adapters/tmux-server.js +13 -1
- package/daemon/dist/adapters/tmux-server.js.map +1 -1
- package/daemon/dist/adapters/tmux.d.ts +32 -1
- package/daemon/dist/adapters/tmux.d.ts.map +1 -1
- package/daemon/dist/adapters/tmux.js +241 -27
- package/daemon/dist/adapters/tmux.js.map +1 -1
- package/daemon/dist/attention-surface.d.ts +7 -0
- package/daemon/dist/attention-surface.d.ts.map +1 -1
- package/daemon/dist/attention-surface.js.map +1 -1
- package/daemon/dist/build-info.js +3 -3
- package/daemon/dist/db/all-migrations.d.ts.map +1 -1
- package/daemon/dist/db/all-migrations.js +20 -0
- package/daemon/dist/db/all-migrations.js.map +1 -1
- package/daemon/dist/db/migrations/150_node_launch_wrapper.d.ts +3 -0
- package/daemon/dist/db/migrations/150_node_launch_wrapper.d.ts.map +1 -0
- package/daemon/dist/db/migrations/150_node_launch_wrapper.js +5 -0
- package/daemon/dist/db/migrations/150_node_launch_wrapper.js.map +1 -0
- package/daemon/dist/db/migrations/151_pi_account_switches.d.ts +4 -0
- package/daemon/dist/db/migrations/151_pi_account_switches.d.ts.map +1 -0
- package/daemon/dist/db/migrations/151_pi_account_switches.js +44 -0
- package/daemon/dist/db/migrations/151_pi_account_switches.js.map +1 -0
- package/daemon/dist/db/migrations/152_workflow_instance_spec.d.ts +8 -0
- package/daemon/dist/db/migrations/152_workflow_instance_spec.d.ts.map +1 -0
- package/daemon/dist/db/migrations/152_workflow_instance_spec.js +13 -0
- package/daemon/dist/db/migrations/152_workflow_instance_spec.js.map +1 -0
- package/daemon/dist/db/migrations/153_events_retention_marks.d.ts +7 -0
- package/daemon/dist/db/migrations/153_events_retention_marks.d.ts.map +1 -0
- package/daemon/dist/db/migrations/153_events_retention_marks.js +17 -0
- package/daemon/dist/db/migrations/153_events_retention_marks.js.map +1 -0
- package/daemon/dist/db/migrations/154_workflow_instance_root_objective.d.ts +7 -0
- package/daemon/dist/db/migrations/154_workflow_instance_root_objective.d.ts.map +1 -0
- package/daemon/dist/db/migrations/154_workflow_instance_root_objective.js +11 -0
- package/daemon/dist/db/migrations/154_workflow_instance_root_objective.js.map +1 -0
- package/daemon/dist/db/migrations/155_queue_erasure.d.ts +12 -0
- package/daemon/dist/db/migrations/155_queue_erasure.d.ts.map +1 -0
- package/daemon/dist/db/migrations/155_queue_erasure.js +28 -0
- package/daemon/dist/db/migrations/155_queue_erasure.js.map +1 -0
- package/daemon/dist/db/migrations/156_queue_erasure_link_indexes.d.ts +4 -0
- package/daemon/dist/db/migrations/156_queue_erasure_link_indexes.d.ts.map +1 -0
- package/daemon/dist/db/migrations/156_queue_erasure_link_indexes.js +14 -0
- package/daemon/dist/db/migrations/156_queue_erasure_link_indexes.js.map +1 -0
- package/daemon/dist/db/migrations/157_queue_erasure_batches.d.ts +9 -0
- package/daemon/dist/db/migrations/157_queue_erasure_batches.d.ts.map +1 -0
- package/daemon/dist/db/migrations/157_queue_erasure_batches.js +18 -0
- package/daemon/dist/db/migrations/157_queue_erasure_batches.js.map +1 -0
- package/daemon/dist/db/migrations/158_queue_inbox_checkins.d.ts +8 -0
- package/daemon/dist/db/migrations/158_queue_inbox_checkins.d.ts.map +1 -0
- package/daemon/dist/db/migrations/158_queue_inbox_checkins.js +15 -0
- package/daemon/dist/db/migrations/158_queue_inbox_checkins.js.map +1 -0
- package/daemon/dist/db/migrations/159_queue_items_handed_off_from_index.d.ts +5 -0
- package/daemon/dist/db/migrations/159_queue_items_handed_off_from_index.d.ts.map +1 -0
- package/daemon/dist/db/migrations/159_queue_items_handed_off_from_index.js +9 -0
- package/daemon/dist/db/migrations/159_queue_items_handed_off_from_index.js.map +1 -0
- package/daemon/dist/domain/activity-taxonomy.d.ts +9 -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 +4 -2
- package/daemon/dist/domain/agent-activity-store.d.ts.map +1 -1
- package/daemon/dist/domain/agent-activity-store.js +11 -7
- 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 +11 -1
- package/daemon/dist/domain/agent-manifest.js.map +1 -1
- package/daemon/dist/domain/builtin-startup-files.d.ts +8 -0
- package/daemon/dist/domain/builtin-startup-files.d.ts.map +1 -1
- package/daemon/dist/domain/builtin-startup-files.js +37 -11
- package/daemon/dist/domain/builtin-startup-files.js.map +1 -1
- package/daemon/dist/domain/claude-compaction-enforcer.d.ts +73 -20
- package/daemon/dist/domain/claude-compaction-enforcer.d.ts.map +1 -1
- package/daemon/dist/domain/claude-compaction-enforcer.js +442 -84
- package/daemon/dist/domain/claude-compaction-enforcer.js.map +1 -1
- package/daemon/dist/domain/claude-continuation-launch.d.ts +16 -0
- package/daemon/dist/domain/claude-continuation-launch.d.ts.map +1 -0
- package/daemon/dist/domain/claude-continuation-launch.js +110 -0
- package/daemon/dist/domain/claude-continuation-launch.js.map +1 -0
- package/daemon/dist/domain/claude-git-trust-root.d.ts +11 -0
- package/daemon/dist/domain/claude-git-trust-root.d.ts.map +1 -0
- package/daemon/dist/domain/claude-git-trust-root.js +72 -0
- package/daemon/dist/domain/claude-git-trust-root.js.map +1 -0
- package/daemon/dist/domain/claude-managed-launch.d.ts +3 -0
- package/daemon/dist/domain/claude-managed-launch.d.ts.map +1 -1
- package/daemon/dist/domain/claude-managed-launch.js +17 -7
- package/daemon/dist/domain/claude-managed-launch.js.map +1 -1
- package/daemon/dist/domain/community-harness-presets.d.ts +5 -0
- package/daemon/dist/domain/community-harness-presets.d.ts.map +1 -1
- package/daemon/dist/domain/community-harness-presets.js +33 -6
- package/daemon/dist/domain/community-harness-presets.js.map +1 -1
- package/daemon/dist/domain/compaction-restore-notice.d.ts +3 -1
- package/daemon/dist/domain/compaction-restore-notice.d.ts.map +1 -1
- package/daemon/dist/domain/compaction-restore-notice.js +37 -6
- package/daemon/dist/domain/compaction-restore-notice.js.map +1 -1
- package/daemon/dist/domain/context-monitor.d.ts.map +1 -1
- package/daemon/dist/domain/context-monitor.js +3 -0
- package/daemon/dist/domain/context-monitor.js.map +1 -1
- package/daemon/dist/domain/context-usage-store.d.ts.map +1 -1
- package/daemon/dist/domain/context-usage-store.js +10 -1
- package/daemon/dist/domain/context-usage-store.js.map +1 -1
- package/daemon/dist/domain/current-work.d.ts +52 -0
- package/daemon/dist/domain/current-work.d.ts.map +1 -1
- package/daemon/dist/domain/current-work.js +215 -0
- package/daemon/dist/domain/current-work.js.map +1 -1
- package/daemon/dist/domain/default-receiver.d.ts +40 -0
- package/daemon/dist/domain/default-receiver.d.ts.map +1 -0
- package/daemon/dist/domain/default-receiver.js +70 -0
- package/daemon/dist/domain/default-receiver.js.map +1 -0
- package/daemon/dist/domain/desired-claude-activity-hooks.d.ts +4 -3
- package/daemon/dist/domain/desired-claude-activity-hooks.d.ts.map +1 -1
- package/daemon/dist/domain/desired-claude-activity-hooks.js +49 -15
- package/daemon/dist/domain/desired-claude-activity-hooks.js.map +1 -1
- package/daemon/dist/domain/draft-aware-delivery.d.ts.map +1 -1
- package/daemon/dist/domain/draft-aware-delivery.js +6 -2
- package/daemon/dist/domain/draft-aware-delivery.js.map +1 -1
- package/daemon/dist/domain/escalation-owner.d.ts.map +1 -1
- package/daemon/dist/domain/escalation-owner.js +8 -3
- package/daemon/dist/domain/escalation-owner.js.map +1 -1
- package/daemon/dist/domain/event-bus.d.ts +47 -8
- package/daemon/dist/domain/event-bus.d.ts.map +1 -1
- package/daemon/dist/domain/event-bus.js +137 -17
- package/daemon/dist/domain/event-bus.js.map +1 -1
- package/daemon/dist/domain/execution-view.d.ts +9 -0
- package/daemon/dist/domain/execution-view.d.ts.map +1 -1
- package/daemon/dist/domain/execution-view.js +41 -3
- package/daemon/dist/domain/execution-view.js.map +1 -1
- package/daemon/dist/domain/gateway/connections-projection.d.ts +13 -1
- package/daemon/dist/domain/gateway/connections-projection.d.ts.map +1 -1
- package/daemon/dist/domain/gateway/connections-projection.js +38 -10
- package/daemon/dist/domain/gateway/connections-projection.js.map +1 -1
- package/daemon/dist/domain/gateway/dispatcher.d.ts +2 -0
- package/daemon/dist/domain/gateway/dispatcher.d.ts.map +1 -1
- package/daemon/dist/domain/gateway/dispatcher.js +14 -1
- package/daemon/dist/domain/gateway/dispatcher.js.map +1 -1
- package/daemon/dist/domain/gateway/gateway-subsystem.d.ts +5 -0
- package/daemon/dist/domain/gateway/gateway-subsystem.d.ts.map +1 -1
- package/daemon/dist/domain/gateway/gateway-subsystem.js +10 -0
- package/daemon/dist/domain/gateway/gateway-subsystem.js.map +1 -1
- package/daemon/dist/domain/gateway/human-quiet-windows.d.ts +2 -1
- package/daemon/dist/domain/gateway/human-quiet-windows.d.ts.map +1 -1
- package/daemon/dist/domain/gateway/human-quiet-windows.js +2 -1
- package/daemon/dist/domain/gateway/human-quiet-windows.js.map +1 -1
- package/daemon/dist/domain/gateway/human-readiness.d.ts +7 -0
- package/daemon/dist/domain/gateway/human-readiness.d.ts.map +1 -1
- package/daemon/dist/domain/gateway/human-readiness.js +45 -0
- package/daemon/dist/domain/gateway/human-readiness.js.map +1 -1
- package/daemon/dist/domain/gateway/human-registry.d.ts +35 -4
- package/daemon/dist/domain/gateway/human-registry.d.ts.map +1 -1
- package/daemon/dist/domain/gateway/human-registry.js +130 -42
- package/daemon/dist/domain/gateway/human-registry.js.map +1 -1
- package/daemon/dist/domain/gateway/operator-delivery-engine.d.ts.map +1 -1
- package/daemon/dist/domain/gateway/operator-delivery-engine.js +8 -2
- package/daemon/dist/domain/gateway/operator-delivery-engine.js.map +1 -1
- package/daemon/dist/domain/gateway/relay-config.d.ts +83 -0
- package/daemon/dist/domain/gateway/relay-config.d.ts.map +1 -0
- package/daemon/dist/domain/gateway/relay-config.js +321 -0
- package/daemon/dist/domain/gateway/relay-config.js.map +1 -0
- package/daemon/dist/domain/gateway/relay-inbound.d.ts +85 -0
- package/daemon/dist/domain/gateway/relay-inbound.d.ts.map +1 -0
- package/daemon/dist/domain/gateway/relay-inbound.js +981 -0
- package/daemon/dist/domain/gateway/relay-inbound.js.map +1 -0
- package/daemon/dist/domain/gateway/relay-outbound.d.ts +218 -0
- package/daemon/dist/domain/gateway/relay-outbound.d.ts.map +1 -0
- package/daemon/dist/domain/gateway/relay-outbound.js +801 -0
- package/daemon/dist/domain/gateway/relay-outbound.js.map +1 -0
- package/daemon/dist/domain/gateway/slack/config.d.ts +21 -0
- package/daemon/dist/domain/gateway/slack/config.d.ts.map +1 -1
- package/daemon/dist/domain/gateway/slack/config.js +30 -3
- package/daemon/dist/domain/gateway/slack/config.js.map +1 -1
- package/daemon/dist/domain/gateway/slack/message.d.ts +4 -0
- package/daemon/dist/domain/gateway/slack/message.d.ts.map +1 -1
- package/daemon/dist/domain/gateway/slack/message.js +7 -2
- package/daemon/dist/domain/gateway/slack/message.js.map +1 -1
- package/daemon/dist/domain/gateway/slack/open-asks.d.ts +13 -1
- package/daemon/dist/domain/gateway/slack/open-asks.d.ts.map +1 -1
- package/daemon/dist/domain/gateway/slack/open-asks.js +72 -8
- package/daemon/dist/domain/gateway/slack/open-asks.js.map +1 -1
- package/daemon/dist/domain/gateway/slack/outbound-driver.d.ts +9 -0
- package/daemon/dist/domain/gateway/slack/outbound-driver.d.ts.map +1 -1
- package/daemon/dist/domain/gateway/slack/outbound-driver.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 +19 -1
- package/daemon/dist/domain/gateway/slack/settled-asks.js.map +1 -1
- package/daemon/dist/domain/gateway/slack/slack-api.d.ts +3 -0
- package/daemon/dist/domain/gateway/slack/slack-api.d.ts.map +1 -1
- package/daemon/dist/domain/gateway/slack/slack-api.js +12 -4
- package/daemon/dist/domain/gateway/slack/slack-api.js.map +1 -1
- package/daemon/dist/domain/gateway/slack/slack-delivery.d.ts +2 -0
- package/daemon/dist/domain/gateway/slack/slack-delivery.d.ts.map +1 -1
- package/daemon/dist/domain/gateway/slack/slack-delivery.js +38 -12
- package/daemon/dist/domain/gateway/slack/slack-delivery.js.map +1 -1
- package/daemon/dist/domain/gateway/slack/slack-recovery.d.ts +12 -1
- package/daemon/dist/domain/gateway/slack/slack-recovery.d.ts.map +1 -1
- package/daemon/dist/domain/gateway/slack/slack-recovery.js +68 -10
- package/daemon/dist/domain/gateway/slack/slack-recovery.js.map +1 -1
- package/daemon/dist/domain/gateway/slack/slack-subsystem.d.ts.map +1 -1
- package/daemon/dist/domain/gateway/slack/slack-subsystem.js +363 -67
- package/daemon/dist/domain/gateway/slack/slack-subsystem.js.map +1 -1
- package/daemon/dist/domain/gateway/slack/socket-inbound.d.ts +1 -0
- package/daemon/dist/domain/gateway/slack/socket-inbound.d.ts.map +1 -1
- package/daemon/dist/domain/gateway/slack/socket-inbound.js +5 -0
- package/daemon/dist/domain/gateway/slack/socket-inbound.js.map +1 -1
- package/daemon/dist/domain/gateway/slack/state-store.d.ts +4 -0
- package/daemon/dist/domain/gateway/slack/state-store.d.ts.map +1 -1
- package/daemon/dist/domain/gateway/slack/state-store.js +4 -1
- package/daemon/dist/domain/gateway/slack/state-store.js.map +1 -1
- package/daemon/dist/domain/gateway/slack/thread-recovery.d.ts +23 -3
- package/daemon/dist/domain/gateway/slack/thread-recovery.d.ts.map +1 -1
- package/daemon/dist/domain/gateway/slack/thread-recovery.js +52 -10
- package/daemon/dist/domain/gateway/slack/thread-recovery.js.map +1 -1
- package/daemon/dist/domain/gateway/slack/thread-seat-map.d.ts +4 -1
- package/daemon/dist/domain/gateway/slack/thread-seat-map.d.ts.map +1 -1
- package/daemon/dist/domain/gateway/slack/thread-seat-map.js +7 -4
- package/daemon/dist/domain/gateway/slack/thread-seat-map.js.map +1 -1
- package/daemon/dist/domain/guidance-projection.d.ts +39 -0
- package/daemon/dist/domain/guidance-projection.d.ts.map +1 -0
- package/daemon/dist/domain/guidance-projection.js +91 -0
- package/daemon/dist/domain/guidance-projection.js.map +1 -0
- package/daemon/dist/domain/health-passive-ceremony.d.ts.map +1 -1
- package/daemon/dist/domain/health-passive-ceremony.js +31 -12
- package/daemon/dist/domain/health-passive-ceremony.js.map +1 -1
- package/daemon/dist/domain/hosted-wake.d.ts +5 -1
- package/daemon/dist/domain/hosted-wake.d.ts.map +1 -1
- package/daemon/dist/domain/hosted-wake.js +13 -3
- package/daemon/dist/domain/hosted-wake.js.map +1 -1
- package/daemon/dist/domain/hosts/pairing-ask.d.ts +10 -0
- package/daemon/dist/domain/hosts/pairing-ask.d.ts.map +1 -0
- package/daemon/dist/domain/hosts/pairing-ask.js +9 -0
- package/daemon/dist/domain/hosts/pairing-ask.js.map +1 -0
- package/daemon/dist/domain/launch-wrapper.d.ts +29 -0
- package/daemon/dist/domain/launch-wrapper.d.ts.map +1 -0
- package/daemon/dist/domain/launch-wrapper.js +97 -0
- package/daemon/dist/domain/launch-wrapper.js.map +1 -0
- package/daemon/dist/domain/managed-blocks.d.ts +3 -0
- package/daemon/dist/domain/managed-blocks.d.ts.map +1 -1
- package/daemon/dist/domain/managed-blocks.js +5 -0
- package/daemon/dist/domain/managed-blocks.js.map +1 -1
- package/daemon/dist/domain/markdown-address.d.ts.map +1 -1
- package/daemon/dist/domain/markdown-address.js +12 -1
- package/daemon/dist/domain/markdown-address.js.map +1 -1
- package/daemon/dist/domain/mission-control/mission-control-write-contract.d.ts +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 +116 -28
- package/daemon/dist/domain/mission-control/mission-control-write-contract.js.map +1 -1
- package/daemon/dist/domain/model-divergence/current-model-reader.d.ts.map +1 -1
- package/daemon/dist/domain/model-divergence/current-model-reader.js +14 -3
- package/daemon/dist/domain/model-divergence/current-model-reader.js.map +1 -1
- package/daemon/dist/domain/native-process-arguments.d.ts +5 -0
- package/daemon/dist/domain/native-process-arguments.d.ts.map +1 -1
- package/daemon/dist/domain/native-process-arguments.js +60 -5
- package/daemon/dist/domain/native-process-arguments.js.map +1 -1
- package/daemon/dist/domain/native-process-lineage.d.ts.map +1 -1
- package/daemon/dist/domain/native-process-lineage.js +32 -9
- package/daemon/dist/domain/native-process-lineage.js.map +1 -1
- package/daemon/dist/domain/node-inventory.d.ts.map +1 -1
- package/daemon/dist/domain/node-inventory.js +9 -2
- package/daemon/dist/domain/node-inventory.js.map +1 -1
- package/daemon/dist/domain/node-launcher.d.ts.map +1 -1
- package/daemon/dist/domain/node-launcher.js +9 -2
- package/daemon/dist/domain/node-launcher.js.map +1 -1
- package/daemon/dist/domain/outbox-handler.d.ts +53 -3
- package/daemon/dist/domain/outbox-handler.d.ts.map +1 -1
- package/daemon/dist/domain/outbox-handler.js +101 -6
- package/daemon/dist/domain/outbox-handler.js.map +1 -1
- package/daemon/dist/domain/package-manifest.d.ts.map +1 -1
- package/daemon/dist/domain/package-manifest.js +10 -5
- package/daemon/dist/domain/package-manifest.js.map +1 -1
- package/daemon/dist/domain/parent-session-env.d.ts +2 -1
- package/daemon/dist/domain/parent-session-env.d.ts.map +1 -1
- package/daemon/dist/domain/parent-session-env.js +9 -1
- package/daemon/dist/domain/parent-session-env.js.map +1 -1
- package/daemon/dist/domain/parked-query.d.ts +6 -0
- package/daemon/dist/domain/parked-query.d.ts.map +1 -1
- package/daemon/dist/domain/parked-query.js +1 -0
- package/daemon/dist/domain/parked-query.js.map +1 -1
- package/daemon/dist/domain/pi-account-state.d.ts +6 -0
- package/daemon/dist/domain/pi-account-state.d.ts.map +1 -0
- package/daemon/dist/domain/pi-account-state.js +14 -0
- package/daemon/dist/domain/pi-account-state.js.map +1 -0
- package/daemon/dist/domain/policies/delivery-digest-flush.d.ts.map +1 -1
- package/daemon/dist/domain/policies/delivery-digest-flush.js +9 -1
- package/daemon/dist/domain/policies/delivery-digest-flush.js.map +1 -1
- package/daemon/dist/domain/policies/mode-scheduled-end.d.ts +4 -1
- package/daemon/dist/domain/policies/mode-scheduled-end.d.ts.map +1 -1
- package/daemon/dist/domain/policies/mode-scheduled-end.js +19 -10
- package/daemon/dist/domain/policies/mode-scheduled-end.js.map +1 -1
- package/daemon/dist/domain/policies/parked-owner-consumer.d.ts +6 -0
- package/daemon/dist/domain/policies/parked-owner-consumer.d.ts.map +1 -1
- package/daemon/dist/domain/policies/parked-owner-consumer.js +13 -3
- package/daemon/dist/domain/policies/parked-owner-consumer.js.map +1 -1
- package/daemon/dist/domain/policies/quiet-release.d.ts +19 -6
- package/daemon/dist/domain/policies/quiet-release.d.ts.map +1 -1
- package/daemon/dist/domain/policies/quiet-release.js +50 -10
- package/daemon/dist/domain/policies/quiet-release.js.map +1 -1
- package/daemon/dist/domain/projection-planner.d.ts +4 -1
- package/daemon/dist/domain/projection-planner.d.ts.map +1 -1
- package/daemon/dist/domain/projection-planner.js +3 -0
- package/daemon/dist/domain/projection-planner.js.map +1 -1
- package/daemon/dist/domain/proof/judgments.d.ts +11 -0
- package/daemon/dist/domain/proof/judgments.d.ts.map +1 -1
- package/daemon/dist/domain/proof/judgments.js +61 -38
- package/daemon/dist/domain/proof/judgments.js.map +1 -1
- package/daemon/dist/domain/queue-blocker.d.ts +5 -0
- package/daemon/dist/domain/queue-blocker.d.ts.map +1 -0
- package/daemon/dist/domain/queue-blocker.js +12 -0
- package/daemon/dist/domain/queue-blocker.js.map +1 -0
- package/daemon/dist/domain/queue-erasure.d.ts +173 -0
- package/daemon/dist/domain/queue-erasure.d.ts.map +1 -0
- package/daemon/dist/domain/queue-erasure.js +885 -0
- package/daemon/dist/domain/queue-erasure.js.map +1 -0
- package/daemon/dist/domain/queue-owner.d.ts +6 -0
- package/daemon/dist/domain/queue-owner.d.ts.map +1 -1
- package/daemon/dist/domain/queue-owner.js +13 -4
- package/daemon/dist/domain/queue-owner.js.map +1 -1
- package/daemon/dist/domain/queue-pickup.d.ts +20 -1
- package/daemon/dist/domain/queue-pickup.d.ts.map +1 -1
- package/daemon/dist/domain/queue-pickup.js +38 -6
- package/daemon/dist/domain/queue-pickup.js.map +1 -1
- package/daemon/dist/domain/queue-recovery.d.ts +14 -0
- package/daemon/dist/domain/queue-recovery.d.ts.map +1 -1
- package/daemon/dist/domain/queue-recovery.js +33 -1
- package/daemon/dist/domain/queue-recovery.js.map +1 -1
- package/daemon/dist/domain/queue-repository.d.ts +226 -20
- package/daemon/dist/domain/queue-repository.d.ts.map +1 -1
- package/daemon/dist/domain/queue-repository.js +786 -91
- package/daemon/dist/domain/queue-repository.js.map +1 -1
- package/daemon/dist/domain/queue-retention.d.ts +82 -0
- package/daemon/dist/domain/queue-retention.d.ts.map +1 -1
- package/daemon/dist/domain/queue-retention.js +168 -0
- package/daemon/dist/domain/queue-retention.js.map +1 -1
- package/daemon/dist/domain/queue-stuck-sweep.d.ts +38 -4
- package/daemon/dist/domain/queue-stuck-sweep.d.ts.map +1 -1
- package/daemon/dist/domain/queue-stuck-sweep.js +763 -190
- package/daemon/dist/domain/queue-stuck-sweep.js.map +1 -1
- package/daemon/dist/domain/queue-transition-log.d.ts +52 -1
- package/daemon/dist/domain/queue-transition-log.d.ts.map +1 -1
- package/daemon/dist/domain/queue-transition-log.js +241 -3
- package/daemon/dist/domain/queue-transition-log.js.map +1 -1
- package/daemon/dist/domain/queue-waiting.d.ts +49 -3
- package/daemon/dist/domain/queue-waiting.d.ts.map +1 -1
- package/daemon/dist/domain/queue-waiting.js +73 -13
- package/daemon/dist/domain/queue-waiting.js.map +1 -1
- package/daemon/dist/domain/queue-wake-ladder.d.ts.map +1 -1
- package/daemon/dist/domain/queue-wake-ladder.js +86 -30
- package/daemon/dist/domain/queue-wake-ladder.js.map +1 -1
- package/daemon/dist/domain/quiet-hold-custody.d.ts.map +1 -1
- package/daemon/dist/domain/quiet-hold-custody.js +7 -3
- package/daemon/dist/domain/quiet-hold-custody.js.map +1 -1
- package/daemon/dist/domain/rebuild-priming-chain.d.ts +3 -1
- package/daemon/dist/domain/rebuild-priming-chain.d.ts.map +1 -1
- package/daemon/dist/domain/rebuild-priming-chain.js +3 -1
- package/daemon/dist/domain/rebuild-priming-chain.js.map +1 -1
- package/daemon/dist/domain/refocus-record.d.ts +17 -0
- package/daemon/dist/domain/refocus-record.d.ts.map +1 -0
- package/daemon/dist/domain/refocus-record.js +94 -0
- package/daemon/dist/domain/refocus-record.js.map +1 -0
- package/daemon/dist/domain/restore-check-service.js +1 -1
- package/daemon/dist/domain/restore-check-service.js.map +1 -1
- package/daemon/dist/domain/restore-guidance.d.ts.map +1 -1
- package/daemon/dist/domain/restore-guidance.js +5 -6
- package/daemon/dist/domain/restore-guidance.js.map +1 -1
- package/daemon/dist/domain/restore-orchestrator.d.ts +15 -2
- package/daemon/dist/domain/restore-orchestrator.d.ts.map +1 -1
- package/daemon/dist/domain/restore-orchestrator.js +100 -42
- package/daemon/dist/domain/restore-orchestrator.js.map +1 -1
- package/daemon/dist/domain/restore-plan-preview.d.ts.map +1 -1
- package/daemon/dist/domain/restore-plan-preview.js +2 -1
- package/daemon/dist/domain/restore-plan-preview.js.map +1 -1
- package/daemon/dist/domain/resume-token-validation.d.ts +7 -0
- package/daemon/dist/domain/resume-token-validation.d.ts.map +1 -1
- package/daemon/dist/domain/resume-token-validation.js +13 -3
- package/daemon/dist/domain/resume-token-validation.js.map +1 -1
- package/daemon/dist/domain/rig-repository.d.ts +3 -0
- package/daemon/dist/domain/rig-repository.d.ts.map +1 -1
- package/daemon/dist/domain/rig-repository.js +46 -1
- package/daemon/dist/domain/rig-repository.js.map +1 -1
- package/daemon/dist/domain/rig-teardown.d.ts.map +1 -1
- package/daemon/dist/domain/rig-teardown.js +2 -1
- package/daemon/dist/domain/rig-teardown.js.map +1 -1
- package/daemon/dist/domain/rigs-being-built.d.ts +5 -0
- package/daemon/dist/domain/rigs-being-built.d.ts.map +1 -0
- package/daemon/dist/domain/rigs-being-built.js +18 -0
- package/daemon/dist/domain/rigs-being-built.js.map +1 -0
- package/daemon/dist/domain/rigspec-codec.d.ts.map +1 -1
- package/daemon/dist/domain/rigspec-codec.js +4 -0
- package/daemon/dist/domain/rigspec-codec.js.map +1 -1
- package/daemon/dist/domain/rigspec-exporter.d.ts.map +1 -1
- package/daemon/dist/domain/rigspec-exporter.js +5 -0
- package/daemon/dist/domain/rigspec-exporter.js.map +1 -1
- package/daemon/dist/domain/rigspec-instantiator.d.ts +20 -1
- package/daemon/dist/domain/rigspec-instantiator.d.ts.map +1 -1
- package/daemon/dist/domain/rigspec-instantiator.js +100 -22
- package/daemon/dist/domain/rigspec-instantiator.js.map +1 -1
- package/daemon/dist/domain/rigspec-preflight.d.ts.map +1 -1
- package/daemon/dist/domain/rigspec-preflight.js +13 -0
- 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 +26 -1
- package/daemon/dist/domain/rigspec-schema.js.map +1 -1
- package/daemon/dist/domain/runner-permissions.d.ts +16 -0
- package/daemon/dist/domain/runner-permissions.d.ts.map +1 -1
- package/daemon/dist/domain/runner-permissions.js +95 -14
- package/daemon/dist/domain/runner-permissions.js.map +1 -1
- package/daemon/dist/domain/runtime-adapter.d.ts +2 -0
- package/daemon/dist/domain/runtime-adapter.d.ts.map +1 -1
- package/daemon/dist/domain/runtime-adapter.js.map +1 -1
- package/daemon/dist/domain/runtime-switch-materials.d.ts +1 -1
- package/daemon/dist/domain/runtime-switch-materials.d.ts.map +1 -1
- package/daemon/dist/domain/runtime-switch-materials.js +2 -2
- package/daemon/dist/domain/runtime-switch-materials.js.map +1 -1
- package/daemon/dist/domain/scope/logical-checkbox.d.ts.map +1 -1
- package/daemon/dist/domain/scope/logical-checkbox.js +14 -0
- package/daemon/dist/domain/scope/logical-checkbox.js.map +1 -1
- package/daemon/dist/domain/seat-activity-service.d.ts +50 -1
- package/daemon/dist/domain/seat-activity-service.d.ts.map +1 -1
- package/daemon/dist/domain/seat-activity-service.js +144 -5
- package/daemon/dist/domain/seat-activity-service.js.map +1 -1
- package/daemon/dist/domain/seat-attention-reconciler.d.ts +13 -0
- package/daemon/dist/domain/seat-attention-reconciler.d.ts.map +1 -1
- package/daemon/dist/domain/seat-attention-reconciler.js +45 -1
- package/daemon/dist/domain/seat-attention-reconciler.js.map +1 -1
- package/daemon/dist/domain/seat-handover-service.d.ts +8 -0
- package/daemon/dist/domain/seat-handover-service.d.ts.map +1 -1
- package/daemon/dist/domain/seat-handover-service.js +61 -19
- package/daemon/dist/domain/seat-handover-service.js.map +1 -1
- package/daemon/dist/domain/seat-kinds.d.ts +21 -0
- package/daemon/dist/domain/seat-kinds.d.ts.map +1 -0
- package/daemon/dist/domain/seat-kinds.js +27 -0
- package/daemon/dist/domain/seat-kinds.js.map +1 -0
- package/daemon/dist/domain/seat-launch-environment.d.ts +14 -0
- package/daemon/dist/domain/seat-launch-environment.d.ts.map +1 -1
- package/daemon/dist/domain/seat-launch-environment.js +64 -16
- package/daemon/dist/domain/seat-launch-environment.js.map +1 -1
- package/daemon/dist/domain/seat-lifecycle-service.d.ts +12 -0
- package/daemon/dist/domain/seat-lifecycle-service.d.ts.map +1 -1
- package/daemon/dist/domain/seat-lifecycle-service.js +59 -14
- package/daemon/dist/domain/seat-lifecycle-service.js.map +1 -1
- package/daemon/dist/domain/seat-restart-in-place.d.ts +2 -1
- package/daemon/dist/domain/seat-restart-in-place.d.ts.map +1 -1
- package/daemon/dist/domain/seat-restart-in-place.js +19 -1
- package/daemon/dist/domain/seat-restart-in-place.js.map +1 -1
- package/daemon/dist/domain/seat-runtime-home.d.ts +4 -1
- package/daemon/dist/domain/seat-runtime-home.d.ts.map +1 -1
- package/daemon/dist/domain/seat-runtime-home.js +6 -4
- package/daemon/dist/domain/seat-runtime-home.js.map +1 -1
- package/daemon/dist/domain/seat-runtime-switch-service.d.ts.map +1 -1
- package/daemon/dist/domain/seat-runtime-switch-service.js +87 -13
- package/daemon/dist/domain/seat-runtime-switch-service.js.map +1 -1
- package/daemon/dist/domain/seat-skill-apply.d.ts +2 -0
- package/daemon/dist/domain/seat-skill-apply.d.ts.map +1 -1
- package/daemon/dist/domain/seat-skill-apply.js +5 -2
- package/daemon/dist/domain/seat-skill-apply.js.map +1 -1
- package/daemon/dist/domain/seat-skill-storage.d.ts +57 -4
- package/daemon/dist/domain/seat-skill-storage.d.ts.map +1 -1
- package/daemon/dist/domain/seat-skill-storage.js +339 -9
- package/daemon/dist/domain/seat-skill-storage.js.map +1 -1
- package/daemon/dist/domain/seat-status-service.d.ts +12 -2
- package/daemon/dist/domain/seat-status-service.d.ts.map +1 -1
- package/daemon/dist/domain/seat-status-service.js +39 -4
- package/daemon/dist/domain/seat-status-service.js.map +1 -1
- package/daemon/dist/domain/seat-structural-activity-service.d.ts +8 -0
- package/daemon/dist/domain/seat-structural-activity-service.d.ts.map +1 -1
- package/daemon/dist/domain/seat-structural-activity-service.js +8 -2
- package/daemon/dist/domain/seat-structural-activity-service.js.map +1 -1
- package/daemon/dist/domain/self-attach-service.d.ts.map +1 -1
- package/daemon/dist/domain/self-attach-service.js +11 -4
- package/daemon/dist/domain/self-attach-service.js.map +1 -1
- package/daemon/dist/domain/session-jsonl.d.ts +4 -2
- package/daemon/dist/domain/session-jsonl.d.ts.map +1 -1
- package/daemon/dist/domain/session-jsonl.js +56 -22
- package/daemon/dist/domain/session-jsonl.js.map +1 -1
- package/daemon/dist/domain/session-registry.d.ts +20 -3
- package/daemon/dist/domain/session-registry.d.ts.map +1 -1
- package/daemon/dist/domain/session-registry.js +39 -3
- package/daemon/dist/domain/session-registry.js.map +1 -1
- package/daemon/dist/domain/session-transport.d.ts +52 -5
- package/daemon/dist/domain/session-transport.d.ts.map +1 -1
- package/daemon/dist/domain/session-transport.js +434 -85
- package/daemon/dist/domain/session-transport.js.map +1 -1
- package/daemon/dist/domain/skill-catalog.d.ts +37 -0
- package/daemon/dist/domain/skill-catalog.d.ts.map +1 -1
- package/daemon/dist/domain/skill-catalog.js +152 -3
- package/daemon/dist/domain/skill-catalog.js.map +1 -1
- package/daemon/dist/domain/slices/slice-detail-projector.d.ts +1 -1
- package/daemon/dist/domain/slices/slice-detail-projector.d.ts.map +1 -1
- package/daemon/dist/domain/slices/slice-detail-projector.js +11 -13
- package/daemon/dist/domain/slices/slice-detail-projector.js.map +1 -1
- package/daemon/dist/domain/slices/slice-indexer.d.ts +41 -0
- package/daemon/dist/domain/slices/slice-indexer.d.ts.map +1 -1
- package/daemon/dist/domain/slices/slice-indexer.js +463 -22
- package/daemon/dist/domain/slices/slice-indexer.js.map +1 -1
- package/daemon/dist/domain/startup-orchestrator.d.ts.map +1 -1
- package/daemon/dist/domain/startup-orchestrator.js +12 -3
- package/daemon/dist/domain/startup-orchestrator.js.map +1 -1
- package/daemon/dist/domain/startup-submission-evidence.d.ts +1 -0
- package/daemon/dist/domain/startup-submission-evidence.d.ts.map +1 -1
- package/daemon/dist/domain/startup-submission-evidence.js +18 -4
- package/daemon/dist/domain/startup-submission-evidence.js.map +1 -1
- package/daemon/dist/domain/successor-session-launcher.d.ts +1 -0
- package/daemon/dist/domain/successor-session-launcher.d.ts.map +1 -1
- package/daemon/dist/domain/successor-session-launcher.js +1 -0
- package/daemon/dist/domain/successor-session-launcher.js.map +1 -1
- package/daemon/dist/domain/terminal/earlier-tile-attach-0711.d.ts +2 -0
- package/daemon/dist/domain/terminal/earlier-tile-attach-0711.d.ts.map +1 -0
- package/daemon/dist/domain/terminal/earlier-tile-attach-0711.js +146 -0
- package/daemon/dist/domain/terminal/earlier-tile-attach-0711.js.map +1 -0
- package/daemon/dist/domain/terminal/earlier-tile-attach.d.ts +1 -0
- package/daemon/dist/domain/terminal/earlier-tile-attach.d.ts.map +1 -1
- package/daemon/dist/domain/terminal/earlier-tile-attach.js +42 -1
- package/daemon/dist/domain/terminal/earlier-tile-attach.js.map +1 -1
- package/daemon/dist/domain/terminal/herdr-adapter.d.ts.map +1 -1
- package/daemon/dist/domain/terminal/herdr-adapter.js +3 -2
- package/daemon/dist/domain/terminal/herdr-adapter.js.map +1 -1
- package/daemon/dist/domain/terminal/herdr-app-install.d.ts +28 -0
- package/daemon/dist/domain/terminal/herdr-app-install.d.ts.map +1 -0
- package/daemon/dist/domain/terminal/herdr-app-install.js +170 -0
- package/daemon/dist/domain/terminal/herdr-app-install.js.map +1 -0
- package/daemon/dist/domain/terminal/herdr-app-layout.d.ts +79 -0
- package/daemon/dist/domain/terminal/herdr-app-layout.d.ts.map +1 -0
- package/daemon/dist/domain/terminal/herdr-app-layout.js +134 -0
- package/daemon/dist/domain/terminal/herdr-app-layout.js.map +1 -0
- package/daemon/dist/domain/terminal/herdr-app-provider.d.ts +123 -0
- package/daemon/dist/domain/terminal/herdr-app-provider.d.ts.map +1 -0
- package/daemon/dist/domain/terminal/herdr-app-provider.js +681 -0
- package/daemon/dist/domain/terminal/herdr-app-provider.js.map +1 -0
- package/daemon/dist/domain/terminal/herdr-app-state.d.ts +91 -0
- package/daemon/dist/domain/terminal/herdr-app-state.d.ts.map +1 -0
- package/daemon/dist/domain/terminal/herdr-app-state.js +140 -0
- package/daemon/dist/domain/terminal/herdr-app-state.js.map +1 -0
- package/daemon/dist/domain/terminal/herdr-app-transport.d.ts +68 -0
- package/daemon/dist/domain/terminal/herdr-app-transport.d.ts.map +1 -0
- package/daemon/dist/domain/terminal/herdr-app-transport.js +133 -0
- package/daemon/dist/domain/terminal/herdr-app-transport.js.map +1 -0
- package/daemon/dist/domain/terminal/herdr-follow-view.d.ts.map +1 -1
- package/daemon/dist/domain/terminal/herdr-follow-view.js +43 -19
- package/daemon/dist/domain/terminal/herdr-follow-view.js.map +1 -1
- package/daemon/dist/domain/terminal/herdr-viewer.d.ts +7 -4
- package/daemon/dist/domain/terminal/herdr-viewer.d.ts.map +1 -1
- package/daemon/dist/domain/terminal/herdr-viewer.js +101 -47
- package/daemon/dist/domain/terminal/herdr-viewer.js.map +1 -1
- package/daemon/dist/domain/terminal/terminal-following.js +3 -3
- package/daemon/dist/domain/terminal/terminal-following.js.map +1 -1
- package/daemon/dist/domain/terminal/terminal-provider.d.ts +18 -0
- package/daemon/dist/domain/terminal/terminal-provider.d.ts.map +1 -1
- package/daemon/dist/domain/terminal/terminal-service.d.ts +28 -3
- package/daemon/dist/domain/terminal/terminal-service.d.ts.map +1 -1
- package/daemon/dist/domain/terminal/terminal-service.js +56 -8
- package/daemon/dist/domain/terminal/terminal-service.js.map +1 -1
- package/daemon/dist/domain/terminal/tile-attach.d.ts +6 -3
- package/daemon/dist/domain/terminal/tile-attach.d.ts.map +1 -1
- package/daemon/dist/domain/terminal/tile-attach.js +11 -46
- package/daemon/dist/domain/terminal/tile-attach.js.map +1 -1
- package/daemon/dist/domain/terminal/view-composer.d.ts.map +1 -1
- package/daemon/dist/domain/terminal/view-composer.js +1 -0
- package/daemon/dist/domain/terminal/view-composer.js.map +1 -1
- package/daemon/dist/domain/time-bound-advisory.js +3 -3
- package/daemon/dist/domain/time-bound-advisory.js.map +1 -1
- package/daemon/dist/domain/tmux-server-selection.d.ts.map +1 -1
- package/daemon/dist/domain/tmux-server-selection.js +8 -2
- package/daemon/dist/domain/tmux-server-selection.js.map +1 -1
- package/daemon/dist/domain/types.d.ts +69 -1
- package/daemon/dist/domain/types.d.ts.map +1 -1
- package/daemon/dist/domain/types.js.map +1 -1
- package/daemon/dist/domain/user-settings/settings-browser.d.ts +2 -1
- package/daemon/dist/domain/user-settings/settings-browser.d.ts.map +1 -1
- package/daemon/dist/domain/user-settings/settings-browser.js +22 -3
- 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 +83 -0
- package/daemon/dist/domain/user-settings/settings-store.js.map +1 -1
- package/daemon/dist/domain/view-event-bridge.js +1 -1
- package/daemon/dist/domain/view-event-bridge.js.map +1 -1
- package/daemon/dist/domain/view-projector.d.ts +4 -1
- package/daemon/dist/domain/view-projector.d.ts.map +1 -1
- package/daemon/dist/domain/view-projector.js +9 -4
- package/daemon/dist/domain/view-projector.js.map +1 -1
- package/daemon/dist/domain/wake-recovery.d.ts.map +1 -1
- package/daemon/dist/domain/wake-recovery.js +10 -2
- package/daemon/dist/domain/wake-recovery.js.map +1 -1
- package/daemon/dist/domain/whoami-service.d.ts +6 -0
- package/daemon/dist/domain/whoami-service.d.ts.map +1 -1
- package/daemon/dist/domain/whoami-service.js +9 -1
- package/daemon/dist/domain/whoami-service.js.map +1 -1
- package/daemon/dist/domain/workflow-exception-escalation.d.ts +3 -2
- package/daemon/dist/domain/workflow-exception-escalation.d.ts.map +1 -1
- package/daemon/dist/domain/workflow-exception-escalation.js +1 -1
- package/daemon/dist/domain/workflow-exception-escalation.js.map +1 -1
- package/daemon/dist/domain/workflow-instance-store.d.ts +8 -1
- package/daemon/dist/domain/workflow-instance-store.d.ts.map +1 -1
- package/daemon/dist/domain/workflow-instance-store.js +21 -3
- package/daemon/dist/domain/workflow-instance-store.js.map +1 -1
- package/daemon/dist/domain/workflow-projector.js +1 -1
- package/daemon/dist/domain/workflow-projector.js.map +1 -1
- package/daemon/dist/domain/workflow-reconciliation.d.ts.map +1 -1
- package/daemon/dist/domain/workflow-reconciliation.js +2 -1
- package/daemon/dist/domain/workflow-reconciliation.js.map +1 -1
- package/daemon/dist/domain/workflow-runtime.d.ts +4 -1
- package/daemon/dist/domain/workflow-runtime.d.ts.map +1 -1
- package/daemon/dist/domain/workflow-runtime.js +24 -11
- package/daemon/dist/domain/workflow-runtime.js.map +1 -1
- package/daemon/dist/domain/workflow-spec-cache.d.ts +38 -4
- package/daemon/dist/domain/workflow-spec-cache.d.ts.map +1 -1
- package/daemon/dist/domain/workflow-spec-cache.js +115 -14
- package/daemon/dist/domain/workflow-spec-cache.js.map +1 -1
- package/daemon/dist/domain/workflow-spec-unregister.d.ts +36 -0
- package/daemon/dist/domain/workflow-spec-unregister.d.ts.map +1 -0
- package/daemon/dist/domain/workflow-spec-unregister.js +105 -0
- package/daemon/dist/domain/workflow-spec-unregister.js.map +1 -0
- package/daemon/dist/domain/workflow-types.d.ts +14 -0
- package/daemon/dist/domain/workflow-types.d.ts.map +1 -1
- package/daemon/dist/index.d.ts +3 -1
- package/daemon/dist/index.d.ts.map +1 -1
- package/daemon/dist/index.js +31 -5
- package/daemon/dist/index.js.map +1 -1
- package/daemon/dist/learned-host-bindings-surface.d.ts +2 -0
- package/daemon/dist/learned-host-bindings-surface.d.ts.map +1 -0
- package/daemon/dist/learned-host-bindings-surface.js +4 -0
- package/daemon/dist/learned-host-bindings-surface.js.map +1 -0
- package/daemon/dist/lib/pane-envelope.d.ts +3 -0
- package/daemon/dist/lib/pane-envelope.d.ts.map +1 -1
- package/daemon/dist/lib/pane-envelope.js +3 -1
- package/daemon/dist/lib/pane-envelope.js.map +1 -1
- package/daemon/dist/routes/activity.d.ts.map +1 -1
- package/daemon/dist/routes/activity.js +147 -25
- package/daemon/dist/routes/activity.js.map +1 -1
- package/daemon/dist/routes/adapters.d.ts.map +1 -1
- package/daemon/dist/routes/adapters.js +4 -0
- package/daemon/dist/routes/adapters.js.map +1 -1
- package/daemon/dist/routes/attention.d.ts.map +1 -1
- package/daemon/dist/routes/attention.js +2 -0
- package/daemon/dist/routes/attention.js.map +1 -1
- package/daemon/dist/routes/compaction.js +2 -0
- package/daemon/dist/routes/compaction.js.map +1 -1
- package/daemon/dist/routes/config.d.ts.map +1 -1
- package/daemon/dist/routes/config.js +9 -1
- package/daemon/dist/routes/config.js.map +1 -1
- package/daemon/dist/routes/events.js +11 -2
- package/daemon/dist/routes/events.js.map +1 -1
- package/daemon/dist/routes/gateway.d.ts +3 -0
- package/daemon/dist/routes/gateway.d.ts.map +1 -1
- package/daemon/dist/routes/gateway.js +87 -8
- package/daemon/dist/routes/gateway.js.map +1 -1
- package/daemon/dist/routes/hosts.d.ts.map +1 -1
- package/daemon/dist/routes/hosts.js +400 -37
- package/daemon/dist/routes/hosts.js.map +1 -1
- package/daemon/dist/routes/provider.js +1 -1
- package/daemon/dist/routes/provider.js.map +1 -1
- package/daemon/dist/routes/queue.d.ts +19 -0
- package/daemon/dist/routes/queue.d.ts.map +1 -1
- package/daemon/dist/routes/queue.js +242 -46
- package/daemon/dist/routes/queue.js.map +1 -1
- package/daemon/dist/routes/seat.d.ts.map +1 -1
- package/daemon/dist/routes/seat.js +4 -3
- package/daemon/dist/routes/seat.js.map +1 -1
- package/daemon/dist/routes/skills.d.ts.map +1 -1
- package/daemon/dist/routes/skills.js +8 -2
- package/daemon/dist/routes/skills.js.map +1 -1
- package/daemon/dist/routes/slices.d.ts.map +1 -1
- package/daemon/dist/routes/slices.js +156 -28
- package/daemon/dist/routes/slices.js.map +1 -1
- package/daemon/dist/routes/terminal-ws.d.ts +1 -0
- package/daemon/dist/routes/terminal-ws.d.ts.map +1 -1
- package/daemon/dist/routes/terminal-ws.js +1 -1
- 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 +40 -3
- 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 +0 -1
- package/daemon/dist/routes/transport.js.map +1 -1
- package/daemon/dist/routes/workflow.d.ts.map +1 -1
- package/daemon/dist/routes/workflow.js +24 -0
- package/daemon/dist/routes/workflow.js.map +1 -1
- package/daemon/dist/server.d.ts +2 -0
- package/daemon/dist/server.d.ts.map +1 -1
- package/daemon/dist/server.js +7 -2
- package/daemon/dist/server.js.map +1 -1
- package/daemon/dist/startup.d.ts +34 -0
- package/daemon/dist/startup.d.ts.map +1 -1
- package/daemon/dist/startup.js +255 -25
- package/daemon/dist/startup.js.map +1 -1
- package/daemon/dist/terminal/TerminalSessionBroker.d.ts +18 -13
- package/daemon/dist/terminal/TerminalSessionBroker.d.ts.map +1 -1
- package/daemon/dist/terminal/TerminalSessionBroker.js +113 -76
- package/daemon/dist/terminal/TerminalSessionBroker.js.map +1 -1
- package/daemon/dist/terminal/window-pin.d.ts +3 -3
- package/daemon/dist/terminal/window-pin.d.ts.map +1 -1
- package/daemon/dist/terminal/window-pin.js +2 -2
- package/daemon/dist/terminal/window-pin.js.map +1 -1
- package/daemon/docs/reference/acp-agents.md +68 -0
- package/daemon/docs/reference/agent-spec.md +51 -1
- package/daemon/docs/reference/agent-startup-guide.md +52 -2
- package/daemon/docs/reference/agent-state-taxonomy.md +7 -0
- package/daemon/docs/reference/community-harness-examples/omo/omo.yaml +14 -0
- package/daemon/docs/reference/community-harness-presets.md +56 -2
- package/daemon/docs/reference/daemon-http-clients.md +31 -8
- package/daemon/docs/reference/edge-types.md +6 -4
- package/daemon/docs/reference/gateway-participants.md +23 -1
- package/daemon/docs/reference/gateway-relay.md +268 -0
- package/daemon/docs/reference/getting-started.md +19 -3
- package/daemon/docs/reference/harness-runner-contract.md +61 -12
- package/daemon/docs/reference/health-diagnosis.md +5 -1
- package/daemon/docs/reference/help.md +18 -0
- package/daemon/docs/reference/herdr-app.md +148 -0
- package/daemon/docs/reference/hosted-members.md +56 -7
- package/daemon/docs/reference/keeping-a-watch.md +3 -1
- package/daemon/docs/reference/project-workspace.md +4 -0
- package/daemon/docs/reference/queue-erasure.md +161 -0
- package/daemon/docs/reference/quickstart.md +1 -1
- package/daemon/docs/reference/reconstructions.md +90 -0
- package/daemon/docs/reference/rig-spec.md +71 -8
- package/daemon/docs/reference/runner-conformance/README.md +3 -0
- package/daemon/docs/reference/runner-conformance/check-runner.mjs +27 -6
- package/daemon/docs/reference/runner-conformance/fake-acp-agent.mjs +1 -1
- package/daemon/docs/reference/sdlc-conventions.md +16 -1
- package/daemon/docs/reference/seat-delivery.md +30 -3
- package/daemon/docs/reference/slack-app-setup.md +37 -12
- package/daemon/docs/reference/terminal-sessions.md +101 -26
- package/daemon/docs/reference/tmux-servers.md +50 -2
- package/daemon/docs/reference/whats-new.md +402 -132
- package/daemon/specs/agents/shared/skills/core/cross-host-rig-commands/SKILL.md +7 -0
- package/daemon/specs/agents/shared/skills/core/openrig-herdr/SKILL.md +1 -0
- package/daemon/specs/agents/shared/skills/core/openrig-skills/SKILL.md +1 -0
- package/daemon/specs/agents/shared/skills/core/working-with-an-openrig-team/SKILL.md +90 -0
- package/daemon/specs/agents/shared/skills/pods/review-team/SKILL.md +2 -0
- package/daemon/specs/rigs/launch/kernel/agents/operator/agent/guidance/role.md +24 -0
- package/daemon/specs/rigs/launch/kernel/culture/CULTURE.md +7 -4
- package/daemon/specs/rigs/launch/kernel/rig.yaml +6 -3
- package/daemon/specs/rigs/launch/starter/guidance/lead-first-move.md +3 -1
- package/dist/acp/agent-server.d.ts +126 -0
- package/dist/acp/agent-server.d.ts.map +1 -0
- package/dist/acp/agent-server.js +449 -0
- package/dist/acp/agent-server.js.map +1 -0
- package/dist/acp/json-rpc-stdio.d.ts +24 -10
- package/dist/acp/json-rpc-stdio.d.ts.map +1 -1
- package/dist/acp/json-rpc-stdio.js +58 -36
- package/dist/acp/json-rpc-stdio.js.map +1 -1
- package/dist/bin-wrapper.d.ts.map +1 -1
- package/dist/bin-wrapper.js +3 -1
- package/dist/bin-wrapper.js.map +1 -1
- package/dist/build-info.js +3 -3
- package/dist/client.d.ts +4 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +9 -2
- package/dist/client.js.map +1 -1
- package/dist/commands/acp.d.ts +14 -0
- package/dist/commands/acp.d.ts.map +1 -1
- package/dist/commands/acp.js +189 -2
- package/dist/commands/acp.js.map +1 -1
- package/dist/commands/attach.js +1 -1
- package/dist/commands/attach.js.map +1 -1
- package/dist/commands/capture.js +6 -6
- package/dist/commands/capture.js.map +1 -1
- package/dist/commands/compact.d.ts.map +1 -1
- package/dist/commands/compact.js +14 -2
- package/dist/commands/compact.js.map +1 -1
- package/dist/commands/config.d.ts.map +1 -1
- package/dist/commands/config.js +46 -7
- package/dist/commands/config.js.map +1 -1
- package/dist/commands/context-reconstruction.d.ts +5 -0
- package/dist/commands/context-reconstruction.d.ts.map +1 -0
- package/dist/commands/context-reconstruction.js +69 -0
- package/dist/commands/context-reconstruction.js.map +1 -0
- package/dist/commands/context.d.ts.map +1 -1
- package/dist/commands/context.js +46 -4
- package/dist/commands/context.js.map +1 -1
- package/dist/commands/daemon.d.ts.map +1 -1
- package/dist/commands/daemon.js +22 -5
- package/dist/commands/daemon.js.map +1 -1
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +61 -0
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/gateway.d.ts.map +1 -1
- package/dist/commands/gateway.js +36 -11
- package/dist/commands/gateway.js.map +1 -1
- package/dist/commands/host.d.ts.map +1 -1
- package/dist/commands/host.js +68 -12
- package/dist/commands/host.js.map +1 -1
- package/dist/commands/launch.d.ts +1 -0
- package/dist/commands/launch.d.ts.map +1 -1
- package/dist/commands/launch.js +1 -1
- package/dist/commands/launch.js.map +1 -1
- package/dist/commands/mcp.d.ts.map +1 -1
- package/dist/commands/mcp.js +29 -5
- package/dist/commands/mcp.js.map +1 -1
- package/dist/commands/proof.d.ts.map +1 -1
- package/dist/commands/proof.js +18 -6
- package/dist/commands/proof.js.map +1 -1
- package/dist/commands/provider.d.ts.map +1 -1
- package/dist/commands/provider.js +4 -1
- package/dist/commands/provider.js.map +1 -1
- package/dist/commands/ps.d.ts +11 -1
- package/dist/commands/ps.d.ts.map +1 -1
- package/dist/commands/ps.js +26 -3
- package/dist/commands/ps.js.map +1 -1
- package/dist/commands/queue.d.ts +3 -0
- package/dist/commands/queue.d.ts.map +1 -1
- package/dist/commands/queue.js +429 -75
- package/dist/commands/queue.js.map +1 -1
- package/dist/commands/scope.d.ts +2 -0
- package/dist/commands/scope.d.ts.map +1 -1
- package/dist/commands/scope.js +15 -0
- package/dist/commands/scope.js.map +1 -1
- package/dist/commands/seat.d.ts.map +1 -1
- package/dist/commands/seat.js +79 -13
- package/dist/commands/seat.js.map +1 -1
- package/dist/commands/send.d.ts +2 -0
- package/dist/commands/send.d.ts.map +1 -1
- package/dist/commands/send.js +16 -6
- package/dist/commands/send.js.map +1 -1
- package/dist/commands/setup.js +1 -1
- package/dist/commands/setup.js.map +1 -1
- package/dist/commands/skill.d.ts.map +1 -1
- package/dist/commands/skill.js +5 -0
- package/dist/commands/skill.js.map +1 -1
- package/dist/commands/slack.d.ts +1 -1
- package/dist/commands/slack.d.ts.map +1 -1
- package/dist/commands/slack.js +5 -1
- package/dist/commands/slack.js.map +1 -1
- package/dist/commands/status.d.ts.map +1 -1
- package/dist/commands/status.js +11 -1
- package/dist/commands/status.js.map +1 -1
- package/dist/commands/stream.d.ts.map +1 -1
- package/dist/commands/stream.js +24 -1
- package/dist/commands/stream.js.map +1 -1
- package/dist/commands/terminal.d.ts +22 -0
- package/dist/commands/terminal.d.ts.map +1 -1
- package/dist/commands/terminal.js +117 -8
- package/dist/commands/terminal.js.map +1 -1
- package/dist/commands/up.d.ts.map +1 -1
- package/dist/commands/up.js +22 -0
- package/dist/commands/up.js.map +1 -1
- package/dist/commands/whoami.d.ts.map +1 -1
- package/dist/commands/whoami.js +13 -2
- package/dist/commands/whoami.js.map +1 -1
- package/dist/commands/workflow-errors.js +1 -1
- package/dist/commands/workflow-errors.js.map +1 -1
- package/dist/commands/workflow-render.d.ts +4 -0
- package/dist/commands/workflow-render.d.ts.map +1 -1
- package/dist/commands/workflow-render.js +7 -0
- package/dist/commands/workflow-render.js.map +1 -1
- package/dist/commands/workflow.d.ts.map +1 -1
- package/dist/commands/workflow.js +70 -2
- package/dist/commands/workflow.js.map +1 -1
- package/dist/config-store.d.ts +15 -1
- package/dist/config-store.d.ts.map +1 -1
- package/dist/config-store.js +112 -1
- package/dist/config-store.js.map +1 -1
- package/dist/daemon-lifecycle.d.ts +2 -0
- package/dist/daemon-lifecycle.d.ts.map +1 -1
- package/dist/daemon-lifecycle.js +38 -5
- package/dist/daemon-lifecycle.js.map +1 -1
- package/dist/daemon-reachability.d.ts +1 -1
- package/dist/daemon-reachability.d.ts.map +1 -1
- package/dist/daemon-reachability.js +4 -2
- package/dist/daemon-reachability.js.map +1 -1
- package/dist/daemon-start-lock.d.ts +24 -2
- package/dist/daemon-start-lock.d.ts.map +1 -1
- package/dist/daemon-start-lock.js +125 -4
- package/dist/daemon-start-lock.js.map +1 -1
- package/dist/lib/reconstruction-reader.d.ts +122 -0
- package/dist/lib/reconstruction-reader.d.ts.map +1 -0
- package/dist/lib/reconstruction-reader.js +481 -0
- package/dist/lib/reconstruction-reader.js.map +1 -0
- package/dist/lib/scope/logical-checkbox.d.ts.map +1 -1
- package/dist/lib/scope/logical-checkbox.js +14 -0
- package/dist/lib/scope/logical-checkbox.js.map +1 -1
- package/dist/lib/scope/scope-fs.d.ts.map +1 -1
- package/dist/lib/scope/scope-fs.js +36 -2
- package/dist/lib/scope/scope-fs.js.map +1 -1
- package/dist/lib/work-install.d.ts +28 -0
- package/dist/lib/work-install.d.ts.map +1 -1
- package/dist/lib/work-install.js +80 -20
- package/dist/lib/work-install.js.map +1 -1
- package/dist/mcp-http.d.ts +7 -0
- package/dist/mcp-http.d.ts.map +1 -1
- package/dist/mcp-http.js +30 -6
- package/dist/mcp-http.js.map +1 -1
- package/dist/mcp-server.d.ts +33 -3
- package/dist/mcp-server.d.ts.map +1 -1
- package/dist/mcp-server.js +489 -57
- package/dist/mcp-server.js.map +1 -1
- package/dist/queue-artifact.d.ts +57 -0
- package/dist/queue-artifact.d.ts.map +1 -0
- package/dist/queue-artifact.js +70 -0
- package/dist/queue-artifact.js.map +1 -0
- package/dist/queue-receipt.d.ts.map +1 -1
- package/dist/queue-receipt.js +4 -3
- package/dist/queue-receipt.js.map +1 -1
- package/dist/recap-seat.d.ts +28 -0
- package/dist/recap-seat.d.ts.map +1 -0
- package/dist/recap-seat.js +41 -0
- package/dist/recap-seat.js.map +1 -0
- package/dist/seat-attention.d.ts +24 -0
- package/dist/seat-attention.d.ts.map +1 -0
- package/dist/seat-attention.js +119 -0
- package/dist/seat-attention.js.map +1 -0
- package/dist/system-preflight.d.ts.map +1 -1
- package/dist/system-preflight.js +15 -7
- package/dist/system-preflight.js.map +1 -1
- package/dist/terminal-window.d.ts.map +1 -1
- package/dist/terminal-window.js +16 -13
- package/dist/terminal-window.js.map +1 -1
- package/package.json +1 -1
- package/tui/dist/attention/attention-model.d.ts +2 -1
- package/tui/dist/attention/attention-model.d.ts.map +1 -1
- package/tui/dist/attention/attention-model.js +21 -4
- package/tui/dist/attention/attention-model.js.map +1 -1
- package/tui/dist/config/config-model.d.ts.map +1 -1
- package/tui/dist/config/config-model.js +7 -1
- package/tui/dist/config/config-model.js.map +1 -1
- package/tui/dist/config/pairing.d.ts +49 -0
- package/tui/dist/config/pairing.d.ts.map +1 -0
- package/tui/dist/config/pairing.js +98 -0
- package/tui/dist/config/pairing.js.map +1 -0
- package/tui/dist/daemon-client.d.ts +18 -1
- package/tui/dist/daemon-client.d.ts.map +1 -1
- package/tui/dist/daemon-client.js +33 -9
- package/tui/dist/daemon-client.js.map +1 -1
- package/tui/dist/demo-data.js +2 -2
- package/tui/dist/demo-data.js.map +1 -1
- package/tui/dist/detail.d.ts +3 -0
- package/tui/dist/detail.d.ts.map +1 -1
- package/tui/dist/detail.js +6 -1
- package/tui/dist/detail.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 +10 -3
- package/tui/dist/execution/execution-model.js.map +1 -1
- package/tui/dist/health/health-model.d.ts.map +1 -1
- package/tui/dist/health/health-model.js +27 -11
- package/tui/dist/health/health-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 +11 -2
- package/tui/dist/main.js.map +1 -1
- package/tui/dist/scopes/scopes-model.d.ts +9 -0
- package/tui/dist/scopes/scopes-model.d.ts.map +1 -1
- package/tui/dist/scopes/scopes-model.js +27 -1
- package/tui/dist/scopes/scopes-model.js.map +1 -1
- package/tui/dist/state.d.ts.map +1 -1
- package/tui/dist/state.js +4 -3
- package/tui/dist/state.js.map +1 -1
- package/tui/dist/terminals/open-window.d.ts +21 -1
- package/tui/dist/terminals/open-window.d.ts.map +1 -1
- package/tui/dist/terminals/open-window.js +46 -9
- package/tui/dist/terminals/open-window.js.map +1 -1
- package/tui/dist/terminals/terminal-model.d.ts +8 -1
- package/tui/dist/terminals/terminal-model.d.ts.map +1 -1
- package/tui/dist/terminals/terminal-model.js +25 -8
- package/tui/dist/terminals/terminal-model.js.map +1 -1
- package/tui/dist/types.d.ts +18 -2
- package/tui/dist/types.d.ts.map +1 -1
- package/ui/dist/assets/index-BOYrLyfQ.js +623 -0
- package/ui/dist/assets/index-DqSRu4OY.css +32 -0
- package/ui/dist/index.html +2 -2
- package/ui/dist/assets/index-BFOs3ejL.css +0 -32
- package/ui/dist/assets/index-CdkFwtld.js +0 -623
|
@@ -3,25 +3,39 @@ import { withUrgentLine } from "./urgent-line.js";
|
|
|
3
3
|
import { quietCustodyBackstop, quietHoldCustody } from "./quiet-hold-custody.js";
|
|
4
4
|
import { createHash } from "node:crypto";
|
|
5
5
|
import { loadHumanRegistry, registeredPeople, resolveRegisteredHumanAddress, slackSubscriptionFor, withHumanAlertTag } from "./gateway/human-registry.js";
|
|
6
|
+
import { DispatchBuffer } from "./gateway/dispatch-buffer.js";
|
|
7
|
+
import { loadRelayProfiles } from "./gateway/relay-config.js";
|
|
8
|
+
import { relayStatePaths, validateRelayOutboundEnvelope } from "./gateway/relay-outbound.js";
|
|
9
|
+
import { SeenStore } from "./gateway/slack/state-store.js";
|
|
10
|
+
import { getOpenRigHome } from "../openrig-compat.js";
|
|
6
11
|
import { sharedChannelAddresses } from "./gateway/participants.js";
|
|
7
12
|
import { resolveExternal } from "./gateway/external-admission.js";
|
|
8
|
-
import { QueueTransitionLog } from "./queue-transition-log.js";
|
|
13
|
+
import { QueueTransitionLog, RELAY_OWNER_NOTIFICATION_ACCEPTED_PREFIX, RELAY_OWNER_NOTIFICATION_TRANSPORT_FAILED_PREFIX, formatRelayOwnerNotificationAccepted, formatRelayOwnerNotificationTransportFailed, parseRelayOwnerNotificationAccepted, parseRelayOwnerNotificationTransportFailed, } from "./queue-transition-log.js";
|
|
14
|
+
export { RELAY_OWNER_NOTIFICATION_ACCEPTED_PREFIX, RELAY_OWNER_NOTIFICATION_TRANSPORT_FAILED_PREFIX, formatRelayOwnerNotificationAccepted, formatRelayOwnerNotificationTransportFailed, parseRelayOwnerNotificationAccepted, parseRelayOwnerNotificationTransportFailed, };
|
|
15
|
+
export const MC_OPERATION_TAG_PREFIX = "mc-operation:";
|
|
16
|
+
export function mcOperationTag(operation) {
|
|
17
|
+
return `${MC_OPERATION_TAG_PREFIX}${operation}`;
|
|
18
|
+
}
|
|
9
19
|
import { WAKE_INTENT_PREFIX } from "./outbox-handler.js";
|
|
20
|
+
import { physicalSessionName } from "./session-registry.js";
|
|
10
21
|
import { derivePickup } from "./queue-pickup.js";
|
|
11
22
|
import { withRecoveryIndex } from "./queue-recovery.js";
|
|
12
|
-
import {
|
|
23
|
+
import { lastMeaningfulTransitionMany, meaningfulFor, readWaitingView, WaitingStatements } from "./queue-waiting.js";
|
|
24
|
+
import { isTypedGateBlocker, typedGateBlockerPrefix } from "./queue-blocker.js";
|
|
25
|
+
export { TYPED_GATE_BLOCKER_PREFIXES, isTypedGateBlocker, typedGateBlockerPrefix } from "./queue-blocker.js";
|
|
13
26
|
import { isOpenRigSender, OPENRIG_SENDER, wrapPaneEnvelope } from "../lib/pane-envelope.js";
|
|
14
27
|
import { isBoundTerminalSeat } from "./terminal-seat.js";
|
|
15
28
|
import { renderQueueHandoffNudge } from "./queue-nudge-text.js";
|
|
16
29
|
import { getSelfHostId } from "./hosts/fanout-contract.js";
|
|
17
30
|
import { parseSessionName, isHumanSeatSessionRef } from "./session-name.js";
|
|
18
31
|
import { runnerPermissionOrigin } from "./runner-permissions.js";
|
|
32
|
+
import { isHostPairingAsk } from "./hosts/pairing-ask.js";
|
|
19
33
|
import { parseReplyToChoice, parseReplyToThreadMissing, formatReplyToChoice, describeReplyToFallback, REPLY_TO_CHOICE_ACTOR } from "./reply-to-choice.js";
|
|
20
34
|
import { classifyDestination } from "./gateway/destination-resolver.js";
|
|
21
35
|
import { join } from "node:path";
|
|
22
36
|
import { SettingsStore } from "./user-settings/settings-store.js";
|
|
23
37
|
import { hostedWakeFor, isHostedMemberAt } from "./rosters.js";
|
|
24
|
-
import { ringHostedWake } from "./hosted-wake.js";
|
|
38
|
+
import { hostedRingMayHaveArrived, ringHostedWake } from "./hosted-wake.js";
|
|
25
39
|
import { effectiveGateRoles } from "./gate-predicate.js";
|
|
26
40
|
import { computeClosureRequiredAt, validateClosure, } from "./hot-potato-enforcer.js";
|
|
27
41
|
import { validateHumanPark, validateHumanRoute } from "./human-route-enforcer.js";
|
|
@@ -83,27 +97,17 @@ const AUTO_UNPARK_WAKE_TAG = "queue:auto-unpark:blocker";
|
|
|
83
97
|
* handoff: it keeps that source when it's replayed later. Send, broadcast, queue create and the cross-host forward never
|
|
84
98
|
* set it from a request; the trusted local outbox recorder (/api/queue/outbox/record) accepts caller tags by design. */
|
|
85
99
|
const WAKE_TRIGGER_OPENRIG_TAG = "queue:wake-trigger:openrig";
|
|
100
|
+
/** The wake telling a claimer that a cross-host handoff overrode its claim (#2631): it's about a row closed by design. */
|
|
101
|
+
const CLAIM_OVERRIDDEN_WAKE_PREFIX = `${WAKE_INTENT_PREFIX}claim-overridden-`;
|
|
102
|
+
/** The first id after every such wake's, so a range on the outbox's primary key finds them all and nothing else. */
|
|
103
|
+
const CLAIM_OVERRIDDEN_WAKE_END = `${WAKE_INTENT_PREFIX}claim-overridden.`;
|
|
86
104
|
/** On a wake intent whose ring a hosted member's trigger accepted: recovery doesn't ring that intent again. */
|
|
87
105
|
const HOSTED_WAKE_ACCEPTED_TAG = "queue:hosted-wake-accepted";
|
|
88
106
|
const AUTO_UNPARK_BLOCKER_TAG_PREFIX = "queue:auto-unpark:blocker-ref:";
|
|
89
107
|
/** The actor on the transition routeToFallback writes; the row's own history is how a later reroute finds the line it wrote. */
|
|
90
108
|
const FALLBACK_ACTOR = "system:queue-fallback";
|
|
91
|
-
/** 0.5.1-53 Atom 1a — typed non-qitem gate blocker prefixes. A park may be gated on a fold / auth /
|
|
92
|
-
* external condition that is NOT a qitem and NOT a human seat; these prefixes make such a gate a
|
|
93
|
-
* first-class, compact-visible, downstream-classifiable blocker (the ruling detail rides a transition). */
|
|
94
|
-
export const TYPED_GATE_BLOCKER_PREFIXES = ["fold:", "auth:", "external:"];
|
|
95
109
|
/** The actor a terminal act is recorded as when it names no responder: explicitly unattributed, never a person. */
|
|
96
110
|
export const UNATTRIBUTED_ACTOR = "human@host";
|
|
97
|
-
export function typedGateBlockerPrefix(value) {
|
|
98
|
-
return TYPED_GATE_BLOCKER_PREFIXES.find((p) => value.startsWith(p)) ?? null;
|
|
99
|
-
}
|
|
100
|
-
/** A well-formed typed gate blocker: a recognized prefix AND a non-empty gate body. */
|
|
101
|
-
export function isTypedGateBlocker(value) {
|
|
102
|
-
if (typeof value !== "string")
|
|
103
|
-
return false;
|
|
104
|
-
const p = typedGateBlockerPrefix(value);
|
|
105
|
-
return p != null && value.slice(p.length).trim().length > 0;
|
|
106
|
-
}
|
|
107
111
|
/**
|
|
108
112
|
* #165: a claim is the destination acting on the row, which is stronger evidence than
|
|
109
113
|
* the wake send could get. While the row is claimed, an unconfirmed wire result
|
|
@@ -191,6 +195,8 @@ function defaultIsHostedMember(destination) {
|
|
|
191
195
|
return false;
|
|
192
196
|
}
|
|
193
197
|
}
|
|
198
|
+
/** A session's check-in is written at most this often; the stuck sweep reads it in units of its unclaimed age. */
|
|
199
|
+
const INBOX_CHECKIN_WRITE_INTERVAL_MS = 60_000;
|
|
194
200
|
export class QueueRepositoryError extends Error {
|
|
195
201
|
code;
|
|
196
202
|
meta;
|
|
@@ -277,6 +283,8 @@ export function matchesRecordedHandoffTarget(qitemId, handedOffTo, closureTarget
|
|
|
277
283
|
* Throws on database/query errors so callers can handle lookup failures with their own policies.
|
|
278
284
|
*/
|
|
279
285
|
export function hasLinkedSuccessor(db, sourceQitemId, target) {
|
|
286
|
+
if (successorScope?.db === db && successorScope.covers(sourceQitemId))
|
|
287
|
+
return successorScope.has(sourceQitemId, target);
|
|
280
288
|
const successor = db
|
|
281
289
|
.prepare(`SELECT 1 FROM queue_items s
|
|
282
290
|
WHERE (s.qitem_id = ? OR s.destination_session = ?) AND s.qitem_id != ?
|
|
@@ -290,6 +298,63 @@ export function hasLinkedSuccessor(db, sourceQitemId, target) {
|
|
|
290
298
|
.get(target, target, sourceQitemId, sourceQitemId, sourceQitemId);
|
|
291
299
|
return Boolean(successor);
|
|
292
300
|
}
|
|
301
|
+
/** The linked-successor index lent to hasLinkedSuccessor by createLinkedSuccessorLookup's run(), for one synchronous call. */
|
|
302
|
+
let successorScope = null;
|
|
303
|
+
/** hasLinkedSuccessor for a whole set of sources in one read, for a pass that asks it once per row (the stuck sweep's
|
|
304
|
+
* custody loop, and the handoff advisory of each row it reads). The read keeps the per-row query's own predicates: a
|
|
305
|
+
* successor is a row whose handed_off_from is the source, or whose chain_of_record is valid JSON with the source among
|
|
306
|
+
* its json_each values (compared as `value IN (...)` compares, like `value = ?`: a number or a nested value never
|
|
307
|
+
* equals a text id); has() then checks qitem_id or destination_session against the target and that the successor is
|
|
308
|
+
* not the source itself. A snapshot from its first has() until invalidate(): the caller invalidates it whenever other
|
|
309
|
+
* code could have run. run(fn) lends it, for the synchronous fn only, to the hasLinkedSuccessor calls made inside fn
|
|
310
|
+
* for a covered source; any other source keeps the per-row query. builtMs() is how long the build of the index as it
|
|
311
|
+
* is now took (0 while it is not built), so a caller can tell when rebuilding after each invalidate() costs more than
|
|
312
|
+
* it saves. */
|
|
313
|
+
export function createLinkedSuccessorLookup(db, sourceQitemIds) {
|
|
314
|
+
const sources = new Set(sourceQitemIds);
|
|
315
|
+
let bySource = null;
|
|
316
|
+
let buildMs = 0;
|
|
317
|
+
const build = () => {
|
|
318
|
+
const startedAt = performance.now();
|
|
319
|
+
const map = new Map();
|
|
320
|
+
const ids = JSON.stringify([...sources]);
|
|
321
|
+
const rows = db.prepare(`SELECT s.qitem_id, s.destination_session, s.handed_off_from AS source FROM queue_items s
|
|
322
|
+
WHERE s.handed_off_from IN (SELECT value FROM json_each(?))
|
|
323
|
+
UNION
|
|
324
|
+
SELECT s.qitem_id, s.destination_session, j.value AS source FROM queue_items s, json_each(s.chain_of_record) j
|
|
325
|
+
WHERE s.chain_of_record IS NOT NULL AND json_valid(s.chain_of_record)
|
|
326
|
+
AND j.value IN (SELECT value FROM json_each(?))`).all(ids, ids);
|
|
327
|
+
for (const r of rows) {
|
|
328
|
+
const list = map.get(r.source);
|
|
329
|
+
const entry = { qitemId: r.qitem_id, destination: r.destination_session };
|
|
330
|
+
if (list)
|
|
331
|
+
list.push(entry);
|
|
332
|
+
else
|
|
333
|
+
map.set(r.source, [entry]);
|
|
334
|
+
}
|
|
335
|
+
buildMs = performance.now() - startedAt;
|
|
336
|
+
return map;
|
|
337
|
+
};
|
|
338
|
+
const has = (sourceQitemId, target) => (bySource ??= build()).get(sourceQitemId)?.some((s) => s.qitemId !== sourceQitemId && (s.qitemId === target || s.destination === target)) ?? false;
|
|
339
|
+
const own = { db, covers: (source) => sources.has(source), has };
|
|
340
|
+
return {
|
|
341
|
+
has,
|
|
342
|
+
run: (fn) => {
|
|
343
|
+
if (successorScope?.db === db)
|
|
344
|
+
return fn();
|
|
345
|
+
const previous = successorScope;
|
|
346
|
+
successorScope = own;
|
|
347
|
+
try {
|
|
348
|
+
return fn();
|
|
349
|
+
}
|
|
350
|
+
finally {
|
|
351
|
+
successorScope = previous;
|
|
352
|
+
}
|
|
353
|
+
},
|
|
354
|
+
invalidate: () => { bySource = null; buildMs = 0; },
|
|
355
|
+
builtMs: () => buildMs,
|
|
356
|
+
};
|
|
357
|
+
}
|
|
293
358
|
/** PL-007 — defensive column probe. Older test fixtures bypass the
|
|
294
359
|
* canonical migration list, so target_repo may be absent. Mirrors
|
|
295
360
|
* the `hasNodeColumn` pattern in rig-repository.ts. */
|
|
@@ -474,7 +539,9 @@ export class QueueRepository {
|
|
|
474
539
|
promptRecoveryState = new Map();
|
|
475
540
|
promptClearRetries = new Map();
|
|
476
541
|
resolveOccupantGeneration;
|
|
542
|
+
isSenderSendable;
|
|
477
543
|
resolveSessionAddresses;
|
|
544
|
+
hasPendingPostCompactStage;
|
|
478
545
|
wakeRepo;
|
|
479
546
|
watchdogJobsRepo;
|
|
480
547
|
/** PL-007 Workspace Primitive — true when migration 038 has applied the
|
|
@@ -492,6 +559,7 @@ export class QueueRepository {
|
|
|
492
559
|
hasMintingGenColumn;
|
|
493
560
|
hasClaimedGenColumn;
|
|
494
561
|
hasQueueTransitionsTable;
|
|
562
|
+
hasErasedIdsTable;
|
|
495
563
|
hasTransitionProvenanceColumn;
|
|
496
564
|
hasOwnerNotificationColumns;
|
|
497
565
|
loadHumanRegistryFn;
|
|
@@ -501,7 +569,11 @@ export class QueueRepository {
|
|
|
501
569
|
hostedWakeFn;
|
|
502
570
|
/** Whether the rosters list an address as a hosted member, trigger or not. */
|
|
503
571
|
hostedMemberFn;
|
|
572
|
+
permissionDecider;
|
|
504
573
|
hostedWakeFetch;
|
|
574
|
+
/** When this process last wrote each session's inbox check-in, so a seat that polls often writes at most once a minute. */
|
|
575
|
+
inboxCheckInWrittenAt = new Map();
|
|
576
|
+
inboxCheckInWriteFailed = false;
|
|
505
577
|
/** OPR.0.4.6.WF3 FR-6 — injected by startup (never imported): the
|
|
506
578
|
* workflow domain's is-live-frontier-packet predicate. */
|
|
507
579
|
workflowFrontierPredicate;
|
|
@@ -516,11 +588,14 @@ export class QueueRepository {
|
|
|
516
588
|
this.attachTransport(opts.transport);
|
|
517
589
|
this.workflowFrontierPredicate = opts?.workflowFrontierPredicate;
|
|
518
590
|
this.resolveOccupantGeneration = opts?.resolveOccupantGeneration;
|
|
591
|
+
this.isSenderSendable = opts?.isSenderSendable;
|
|
519
592
|
this.resolveSessionAddresses = opts?.resolveSessionAddresses ?? ((name) => [name]);
|
|
593
|
+
this.hasPendingPostCompactStage = opts?.hasPendingPostCompactStage;
|
|
520
594
|
this.loadHumanRegistryFn = opts?.loadHumanRegistry ?? (() => loadHumanRegistry());
|
|
521
595
|
this.sharedChannelsFn = opts?.sharedChannels ?? (() => sharedChannelAddresses());
|
|
522
596
|
this.hostedWakeFn = opts?.hostedWake ?? defaultHostedWake;
|
|
523
597
|
this.hostedMemberFn = opts?.isHostedMember ?? defaultIsHostedMember;
|
|
598
|
+
this.permissionDecider = opts?.permissionDecider;
|
|
524
599
|
this.hostedWakeFetch = opts?.hostedWakeFetch;
|
|
525
600
|
this.hasTargetRepoColumn = detectQueueColumn(db, "target_repo");
|
|
526
601
|
this.hasSummaryColumn = detectQueueColumn(db, "summary");
|
|
@@ -530,6 +605,7 @@ export class QueueRepository {
|
|
|
530
605
|
this.hasDelegatedDecisionColumn = detectQueueColumn(db, "delegated_decision");
|
|
531
606
|
this.hasEvidenceRefColumn = detectQueueColumn(db, "evidence_ref");
|
|
532
607
|
this.hasQueueTransitionsTable = detectTable(db, "queue_transitions");
|
|
608
|
+
this.hasErasedIdsTable = detectTable(db, "queue_erased_ids");
|
|
533
609
|
const transitionColumns = this.hasQueueTransitionsTable
|
|
534
610
|
? new Set(db.prepare("PRAGMA table_info(queue_transitions)").all().map((column) => column.name))
|
|
535
611
|
: new Set();
|
|
@@ -599,6 +675,19 @@ export class QueueRepository {
|
|
|
599
675
|
}
|
|
600
676
|
currentWakeIntent(entry) {
|
|
601
677
|
const row = entry.auditPointer ? this.db.prepare("SELECT state, destination_session FROM queue_items WHERE qitem_id=?").get(entry.auditPointer) : undefined;
|
|
678
|
+
// That notice stays current while the row stays closed by the close that made it; every other wake, while its row
|
|
679
|
+
// waits on its destination. A reopen and another close end it: its text names the earlier successor.
|
|
680
|
+
if (entry.outboxId.startsWith(CLAIM_OVERRIDDEN_WAKE_PREFIX)) {
|
|
681
|
+
if (row === undefined || !isTerminalState(row.state) || row.destination_session !== entry.destinationSession)
|
|
682
|
+
return false;
|
|
683
|
+
const closed = TERMINAL_QUEUE_STATES.map(() => "?").join(",");
|
|
684
|
+
const close = this.db.prepare(`SELECT transition_id FROM (
|
|
685
|
+
SELECT transition_id, state, LAG(state) OVER (ORDER BY transition_id) AS previous_state
|
|
686
|
+
FROM queue_transitions WHERE qitem_id=?)
|
|
687
|
+
WHERE state IN (${closed}) AND (previous_state IS NULL OR previous_state NOT IN (${closed})) ORDER BY transition_id DESC LIMIT 1`)
|
|
688
|
+
.get(entry.auditPointer, ...TERMINAL_QUEUE_STATES, ...TERMINAL_QUEUE_STATES);
|
|
689
|
+
return Number(entry.outboxId.slice(CLAIM_OVERRIDDEN_WAKE_PREFIX.length)) === close?.transition_id;
|
|
690
|
+
}
|
|
602
691
|
if (row?.state !== "pending" || row.destination_session !== entry.destinationSession)
|
|
603
692
|
return false;
|
|
604
693
|
const prefix = `${WAKE_INTENT_PREFIX}blocker-`;
|
|
@@ -674,10 +763,15 @@ export class QueueRepository {
|
|
|
674
763
|
// isn't echoed back. A later park of it on a person is a new ask, classified (and posted) on that update.
|
|
675
764
|
if (input.gatewayInbound)
|
|
676
765
|
return { kind: "human-required", level: "RECORD" };
|
|
677
|
-
//
|
|
678
|
-
//
|
|
766
|
+
// Slack subscription filters only apply when Slack is the primary connector. When a person's primary connector
|
|
767
|
+
// is relay (or by default when no Slack subscription restricts it), plain asks post by default (`every-ask`),
|
|
768
|
+
// so ordinary relay asks post (ALERT) independently of any retained Slack-specific subscription.
|
|
679
769
|
const person = people.find((entity) => entity.address === destinationHuman);
|
|
680
|
-
const
|
|
770
|
+
const primaryBinding = person?.connectorBindings.find((b) => b.role === "primary");
|
|
771
|
+
const posts = input.humanAlert === true
|
|
772
|
+
|| (primaryBinding?.kind === "relay"
|
|
773
|
+
? true
|
|
774
|
+
: slackSubscriptionFor(person).preset === "every-ask");
|
|
681
775
|
return input.humanIntent === "update"
|
|
682
776
|
? { kind: "human-update", level: "NOTICE" }
|
|
683
777
|
: { kind: "human-required", level: posts ? "ALERT" : "RECORD" };
|
|
@@ -743,6 +837,10 @@ export class QueueRepository {
|
|
|
743
837
|
this.recordNudgeAttempt(successorQitemId, `${WAKE_NOT_RETAINED}${err.message}`);
|
|
744
838
|
}
|
|
745
839
|
}
|
|
840
|
+
/** #2895 (a): the envelope meta for a sender `rig send` can't reach; empty (today's bytes) otherwise or when unwired. */
|
|
841
|
+
senderReach(sender) {
|
|
842
|
+
return sender && this.isSenderSendable && !this.isSenderSendable(sender) ? { senderReachable: false } : {};
|
|
843
|
+
}
|
|
746
844
|
recordWakeIntent(input) {
|
|
747
845
|
if (!this.outbox)
|
|
748
846
|
return null;
|
|
@@ -750,7 +848,7 @@ export class QueueRepository {
|
|
|
750
848
|
// recovery replay these exact bytes without re-resolving the occupant.
|
|
751
849
|
const stampISO = new Date().toISOString();
|
|
752
850
|
const genUuid = this.resolveOccupantGeneration?.(input.fromSession) ?? undefined;
|
|
753
|
-
const frozenEnvelope = wrapPaneEnvelope(input.fromSession, input.toSession, input.bareBody, { stampISO, genUuid, ...(input.qitemId ? { replyToQitem: input.qitemId } : {}) });
|
|
851
|
+
const frozenEnvelope = wrapPaneEnvelope(input.fromSession, input.toSession, input.bareBody, { stampISO, genUuid, ...(input.qitemId ? { replyToQitem: input.qitemId } : {}), ...this.senderReach(input.fromSession) });
|
|
754
852
|
const admission = this.wakeAdmission(input.auditPointer, input.tags?.includes(WAKE_TRIGGER_OPENRIG_TAG) ? "openrig" : "agent");
|
|
755
853
|
// An urgent wake's frozen body carries the line naming who marked it, so a person reading it held sees it too; the
|
|
756
854
|
// transport won't add it a second time when it's delivered.
|
|
@@ -766,8 +864,10 @@ export class QueueRepository {
|
|
|
766
864
|
// Draft-aware wakes remain pending until the transport owns their bounded
|
|
767
865
|
// retry. Manual retention is deliberately never drained.
|
|
768
866
|
const draftTarget = this.transport?.draftAwareTarget?.(input.toSession);
|
|
867
|
+
// The same rule as a held message (#2430): the sender's own held messages there count as room, since this wake
|
|
868
|
+
// coalesces them if it settles as held.
|
|
769
869
|
if (draftTarget)
|
|
770
|
-
this.outbox.assertRetentionCapacity(draftTarget.nodeId, frozenEnvelope);
|
|
870
|
+
this.outbox.assertRetentionCapacity(draftTarget.nodeId, frozenEnvelope, input.fromSession, [input.outboxId]);
|
|
771
871
|
this.outbox.record(record);
|
|
772
872
|
const binding = this.transport?.deliveryTarget?.(input.toSession);
|
|
773
873
|
if (binding)
|
|
@@ -833,6 +933,23 @@ export class QueueRepository {
|
|
|
833
933
|
* hold is left alone; failed/uncertain history permits another attempt. A recovery
|
|
834
934
|
* pass tracks its coalesced members only in memory so each is attempted once per pass.
|
|
835
935
|
*/
|
|
936
|
+
/** #2789: a wake committed while its seat had no pane froze a binding that can never match once the seat is bound, so
|
|
937
|
+
* the delivery guard refused it on every retry. Such an intent takes its first live binding, on the same node and
|
|
938
|
+
* canonical session, only when it is known to have written no input (pending, or failed, which a send records only
|
|
939
|
+
* without a write) and carries no expected identity of its own. A binding that ever named a pane is never replaced,
|
|
940
|
+
* so a wake can't move to another occupant; the guard's write-time check against this binding still holds.
|
|
941
|
+
* `entry` is the intent as read before its claim. Called inside the claim's transaction. */
|
|
942
|
+
bindFirstTarget(entry) {
|
|
943
|
+
const frozen = entry.guardBinding;
|
|
944
|
+
if (!frozen || frozen.pane !== null || (entry.deliveryState !== "pending" && entry.deliveryState !== "failed"))
|
|
945
|
+
return;
|
|
946
|
+
if (this.outbox.expectedIdentity(entry.outboxId))
|
|
947
|
+
return;
|
|
948
|
+
const live = this.transport?.deliveryTarget?.(entry.destinationSession);
|
|
949
|
+
if (!live?.pane || live.nodeId !== frozen.nodeId || live.session !== frozen.session)
|
|
950
|
+
return;
|
|
951
|
+
this.db.prepare("UPDATE outbox_entries SET guard_binding = ? WHERE outbox_id = ?").run(JSON.stringify(live), entry.outboxId);
|
|
952
|
+
}
|
|
836
953
|
async deliverWakeIntent(outboxId, attempted = new Set(), // this pass's attempt history, inherited by any release it delivers
|
|
837
954
|
eligible = () => true) {
|
|
838
955
|
if (!this.outbox)
|
|
@@ -851,6 +968,7 @@ export class QueueRepository {
|
|
|
851
968
|
const claim = (entry) => {
|
|
852
969
|
if (!eligible(entry) || attempted.has(entry.outboxId) || !this.outbox.claimForDelivery(entry.outboxId))
|
|
853
970
|
return false;
|
|
971
|
+
this.bindFirstTarget(entry);
|
|
854
972
|
attempted.add(entry.outboxId);
|
|
855
973
|
recovering ||= entry.deliveryState !== "pending";
|
|
856
974
|
return true;
|
|
@@ -922,8 +1040,8 @@ export class QueueRepository {
|
|
|
922
1040
|
// The level can change while this send waits for the seat's lease. Under the lease, each member is admitted again with
|
|
923
1041
|
// its own source and urgency; only those with the first member's outcome go with this send, and the others go back
|
|
924
1042
|
// to their state before this claim (never marked delivered, held or failed) for their own delivery.
|
|
925
|
-
// A hosted member's trigger already accepted the ring for exactly these intents
|
|
926
|
-
// it again, since each ring can start a run. Any other wake rings: a new intent, or one claimed but never sent.
|
|
1043
|
+
// A hosted member's trigger already accepted the ring for exactly these intents, or may have before it stopped
|
|
1044
|
+
// answering (tagged below): recovery doesn't ring it again, since each ring can start a run. Any other wake rings: a new intent, or one claimed but never sent.
|
|
927
1045
|
if (group.every((entry) => entry.tags?.includes(HOSTED_WAKE_ACCEPTED_TAG))) {
|
|
928
1046
|
for (const entry of group)
|
|
929
1047
|
this.outbox.finalizeDelivery(entry.outboxId, "indeterminate");
|
|
@@ -966,8 +1084,8 @@ export class QueueRepository {
|
|
|
966
1084
|
const wakeEvent = this.db.transaction(() => {
|
|
967
1085
|
this.recordNudgeAttempt(qitemId, nudgeResult);
|
|
968
1086
|
this.outbox.finalizeDelivery(intent.outboxId, finalState);
|
|
969
|
-
// The acceptance belongs to this intent, so recovery can tell this wake already rang.
|
|
970
|
-
if (outcome.nudgeResult
|
|
1087
|
+
// The acceptance (or a ring that may have arrived) belongs to this intent, so recovery can tell this wake already rang.
|
|
1088
|
+
if (hostedRingMayHaveArrived(outcome.nudgeResult)) {
|
|
971
1089
|
this.db.prepare(`UPDATE outbox_entries SET tags = json_insert(COALESCE(tags, '[]'), '$[#]', ?)
|
|
972
1090
|
WHERE outbox_id = ? AND NOT EXISTS (SELECT 1 FROM json_each(COALESCE(outbox_entries.tags, '[]')) WHERE value = ?)`)
|
|
973
1091
|
.run(HOSTED_WAKE_ACCEPTED_TAG, intent.outboxId, HOSTED_WAKE_ACCEPTED_TAG);
|
|
@@ -1036,36 +1154,61 @@ export class QueueRepository {
|
|
|
1036
1154
|
}
|
|
1037
1155
|
/** Recover current notifications once per pass. A snapshot horizon and seek cursor
|
|
1038
1156
|
* prevent new arrivals or persistent failures from making this pass unbounded. `stopRequested` is checked before
|
|
1039
|
-
* each delivery: a stopped pass leaves the notifications it has not attempted as they are, for the next start.
|
|
1157
|
+
* each delivery: a stopped pass leaves the notifications it has not attempted as they are, for the next start.
|
|
1158
|
+
* A notification already tried for a seat that still has no session or transport, or that is a bound terminal seat,
|
|
1159
|
+
* would only fail again, so it isn't claimed, alone or in a group: it stays as it is, its row stays owed, and the
|
|
1160
|
+
* pass reports it as waiting. The receiver is read at each claim, so a seat that starts during the pass gets its
|
|
1161
|
+
* later notifications. */
|
|
1040
1162
|
async drainPendingWakeIntents(opts) {
|
|
1041
1163
|
const tally = { delivered: 0, indeterminate: 0, failed: 0, retained: 0 };
|
|
1042
1164
|
if (!this.outbox || !this.transport)
|
|
1043
1165
|
return tally;
|
|
1166
|
+
const attempted = new Set();
|
|
1167
|
+
// Notifications left alone for want of a receiver; one a later claim in this pass attempted isn't waiting.
|
|
1168
|
+
const skipped = new Map();
|
|
1169
|
+
const result = () => {
|
|
1170
|
+
const waitingBySeat = new Map();
|
|
1171
|
+
for (const [outboxId, seat] of skipped)
|
|
1172
|
+
if (!attempted.has(outboxId))
|
|
1173
|
+
waitingBySeat.set(seat, (waitingBySeat.get(seat) ?? 0) + 1);
|
|
1174
|
+
if (waitingBySeat.size)
|
|
1175
|
+
tally.waiting = { notifications: [...waitingBySeat.values()].reduce((a, b) => a + b, 0), seats: [...waitingBySeat.keys()] };
|
|
1176
|
+
return tally;
|
|
1177
|
+
};
|
|
1044
1178
|
const BATCH = 200;
|
|
1045
1179
|
const horizon = this.db.prepare("SELECT COALESCE(MAX(rowid),0) AS id FROM outbox_entries").get().id;
|
|
1046
1180
|
// Retire never-attempted obsolete notifications without materializing historical intents.
|
|
1047
1181
|
tally.failed += this.db.prepare(`UPDATE outbox_entries AS o SET delivery_state = 'failed',
|
|
1048
1182
|
tags = json_insert(COALESCE(tags, '[]'), '$[#]', 'queue:wake-superseded')
|
|
1049
1183
|
WHERE delivery_state = 'pending' AND rowid <= ? AND substr(outbox_id, 1, ?) = ?
|
|
1184
|
+
AND substr(outbox_id, 1, ?) != ?
|
|
1050
1185
|
AND NOT EXISTS (SELECT 1 FROM queue_items q WHERE q.qitem_id = o.audit_pointer
|
|
1051
1186
|
AND q.state = 'pending' AND q.destination_session = o.destination_session)`)
|
|
1052
|
-
.run(horizon, WAKE_INTENT_PREFIX.length, WAKE_INTENT_PREFIX).changes;
|
|
1053
|
-
const attempted = new Set();
|
|
1187
|
+
.run(horizon, WAKE_INTENT_PREFIX.length, WAKE_INTENT_PREFIX, CLAIM_OVERRIDDEN_WAKE_PREFIX.length, CLAIM_OVERRIDDEN_WAKE_PREFIX).changes;
|
|
1054
1188
|
// A stop also refuses every later claim inside a delivery: coalesced peers and members it releases for their own send.
|
|
1055
|
-
|
|
1189
|
+
// So does a missing receiver, for a notification already tried. One never tried still gets its attempt, so its row
|
|
1190
|
+
// records why it didn't land.
|
|
1191
|
+
const eligible = (entry) => {
|
|
1192
|
+
if (opts?.stopRequested?.())
|
|
1193
|
+
return false;
|
|
1194
|
+
if (entry.deliveryState === "pending" || !this.wakeHasNoReceiver(entry.destinationSession))
|
|
1195
|
+
return true;
|
|
1196
|
+
skipped.set(entry.outboxId, entry.destinationSession);
|
|
1197
|
+
return false;
|
|
1198
|
+
};
|
|
1056
1199
|
let cursor = 0;
|
|
1057
1200
|
for (;;) {
|
|
1058
1201
|
const pending = this.db.prepare(`SELECT o.rowid AS id, o.outbox_id FROM outbox_entries o
|
|
1059
|
-
JOIN queue_items q ON q.qitem_id = o.audit_pointer AND q.state = 'pending'
|
|
1202
|
+
JOIN queue_items q ON q.qitem_id = o.audit_pointer AND (q.state = 'pending' OR substr(o.outbox_id, 1, ?) = ?)
|
|
1060
1203
|
AND q.destination_session = o.destination_session
|
|
1061
1204
|
WHERE o.rowid > ? AND o.rowid <= ? AND substr(o.outbox_id, 1, ?) = ?
|
|
1062
1205
|
AND o.delivery_state IN ('pending','failed','indeterminate') ORDER BY o.rowid LIMIT ?`)
|
|
1063
|
-
.all(cursor, horizon, WAKE_INTENT_PREFIX.length, WAKE_INTENT_PREFIX, BATCH);
|
|
1206
|
+
.all(CLAIM_OVERRIDDEN_WAKE_PREFIX.length, CLAIM_OVERRIDDEN_WAKE_PREFIX, cursor, horizon, WAKE_INTENT_PREFIX.length, WAKE_INTENT_PREFIX, BATCH);
|
|
1064
1207
|
if (pending.length === 0)
|
|
1065
1208
|
break;
|
|
1066
1209
|
for (const intent of pending) {
|
|
1067
1210
|
if (opts?.stopRequested?.())
|
|
1068
|
-
return
|
|
1211
|
+
return result();
|
|
1069
1212
|
cursor = intent.id;
|
|
1070
1213
|
const outcome = await this.deliverWakeIntent(intent.outbox_id, attempted, eligible);
|
|
1071
1214
|
if (outcome !== "skipped")
|
|
@@ -1074,7 +1217,30 @@ export class QueueRepository {
|
|
|
1074
1217
|
if (pending.length < BATCH)
|
|
1075
1218
|
break; // served short batch ⇒ drained
|
|
1076
1219
|
}
|
|
1077
|
-
return
|
|
1220
|
+
return result();
|
|
1221
|
+
}
|
|
1222
|
+
/** Positive evidence only that a wake can't land now: no transport can hold the address, the address is a bound
|
|
1223
|
+
* terminal seat (a shell or a TUI: performWakeSend types nothing there, so a retry can only fail the same way and
|
|
1224
|
+
* move the row's last nudge time, which the stuck sweep reads as new evidence; #2939), or the newest session under
|
|
1225
|
+
* the name the transport sends to has stopped (exited, or detached because its tmux session is gone). A canonical
|
|
1226
|
+
* address resolves to its current physical session first. Anything unknown may have a receiver. */
|
|
1227
|
+
wakeHasNoReceiver(destinationSession) {
|
|
1228
|
+
try {
|
|
1229
|
+
const destClass = this.classifyDestinationOf(destinationSession).class;
|
|
1230
|
+
if (destClass === "unroutable")
|
|
1231
|
+
return true;
|
|
1232
|
+
if (destClass !== "pane-bound")
|
|
1233
|
+
return false;
|
|
1234
|
+
const physical = physicalSessionName(this.db, destinationSession);
|
|
1235
|
+
if (isBoundTerminalSeat(this.db, destinationSession) || isBoundTerminalSeat(this.db, physical))
|
|
1236
|
+
return true;
|
|
1237
|
+
const newest = this.db.prepare("SELECT status FROM sessions WHERE session_name = ? ORDER BY id DESC LIMIT 1")
|
|
1238
|
+
.get(physical);
|
|
1239
|
+
return newest?.status === "exited" || newest?.status === "detached";
|
|
1240
|
+
}
|
|
1241
|
+
catch {
|
|
1242
|
+
return false;
|
|
1243
|
+
}
|
|
1078
1244
|
}
|
|
1079
1245
|
/**
|
|
1080
1246
|
* Issue a default nudge to the destination after a create / handoff /
|
|
@@ -1131,6 +1297,10 @@ export class QueueRepository {
|
|
|
1131
1297
|
return;
|
|
1132
1298
|
if (addresses.every(address => this.promptRecoveryState.get(address) === false))
|
|
1133
1299
|
return;
|
|
1300
|
+
// A compaction's "Compacted" is also a clear. While its turn boundary, restore or audit is still owed, a retried wake
|
|
1301
|
+
// would reach the agent before its restore (#2575): stay armed, and the next clear after those steps retries it.
|
|
1302
|
+
if ([sessionName, ...addresses].some(address => this.hasPendingPostCompactStage?.(address)))
|
|
1303
|
+
return;
|
|
1134
1304
|
for (const address of addresses)
|
|
1135
1305
|
this.promptRecoveryState.set(address, false);
|
|
1136
1306
|
// Correlation may expand the group or release members for separate sends. Each claim must
|
|
@@ -1139,13 +1309,22 @@ export class QueueRepository {
|
|
|
1139
1309
|
if (entry.deliveryState !== "failed" || !entry.auditPointer)
|
|
1140
1310
|
return false;
|
|
1141
1311
|
const current = this.getById(entry.auditPointer), refusal = current?.lastNudgeWireResult;
|
|
1142
|
-
|
|
1312
|
+
const notice = entry.outboxId.startsWith(CLAIM_OVERRIDDEN_WAKE_PREFIX);
|
|
1313
|
+
return (current?.state === "pending" || notice) && addresses.includes(current?.destinationSession ?? "")
|
|
1143
1314
|
&& (refusal === "failed:target_needs_input" || (refusal?.startsWith("failed:Refused:") === true && refusal.includes("interactive prompt")));
|
|
1144
1315
|
};
|
|
1316
|
+
const seats = addresses.map(() => "?").join(",");
|
|
1317
|
+
const refused = (q) => `(${q}last_nudge_result LIKE 'failed:Refused:%interactive prompt%' OR ${q}last_nudge_result = 'failed:target_needs_input')`;
|
|
1318
|
+
// A closed row is here only for a failed override notice, found from the notice by its id range, so this never
|
|
1319
|
+
// reads the host's other failed history.
|
|
1145
1320
|
const rows = this.db.prepare(`SELECT qitem_id, destination_session, source_session, last_nudge_result
|
|
1146
|
-
FROM queue_items WHERE state = 'pending' AND destination_session IN (${
|
|
1147
|
-
|
|
1148
|
-
|
|
1321
|
+
FROM queue_items WHERE state = 'pending' AND destination_session IN (${seats}) AND ${refused("")}
|
|
1322
|
+
UNION
|
|
1323
|
+
SELECT q.qitem_id, q.destination_session, q.source_session, q.last_nudge_result
|
|
1324
|
+
FROM outbox_entries o JOIN queue_items q ON q.qitem_id = o.audit_pointer AND q.destination_session = o.destination_session
|
|
1325
|
+
WHERE o.outbox_id >= ? AND o.outbox_id < ? AND +o.delivery_state = 'failed' AND +o.destination_session IN (${seats})
|
|
1326
|
+
AND ${refused("q.")}`)
|
|
1327
|
+
.all(...addresses, CLAIM_OVERRIDDEN_WAKE_PREFIX, CLAIM_OVERRIDDEN_WAKE_END, ...addresses);
|
|
1149
1328
|
const attempted = new Set();
|
|
1150
1329
|
// Reserve the whole selection before awaiting: a correlated send can include several rows.
|
|
1151
1330
|
// Its refusal stays durable, but must not re-arm this same clear-triggered pass.
|
|
@@ -1177,6 +1356,66 @@ export class QueueRepository {
|
|
|
1177
1356
|
}
|
|
1178
1357
|
}
|
|
1179
1358
|
}
|
|
1359
|
+
/** The rule for re-sending a wake recorded unroutable once its seat may be back, shared by the stuck sweep and
|
|
1360
|
+
* {@link retryUnroutableWakesOnReachable}: unclaimed, not a person's notice, not a local human decision with no
|
|
1361
|
+
* gateway, not held or released for quiet hours, and its seat now pane-bound. A handoff's retry ladder is the
|
|
1362
|
+
* caller's to check: the sweep defers to a live ladder, the reachable-seat retry leaves every handed-off row to it. */
|
|
1363
|
+
unroutableWakeRetryable(row, now = new Date()) {
|
|
1364
|
+
return row.lastNudgeResult?.startsWith("unroutable:") === true
|
|
1365
|
+
&& !row.claimedAt
|
|
1366
|
+
&& row.deliveryOutcome !== "never-posted" && row.deliveryOutcome !== "transport-failed"
|
|
1367
|
+
&& !this.isLocalHumanDecisionWithoutGateway(row)
|
|
1368
|
+
&& !["held", "released"].includes(quietHoldCustody(this.db, row.qitemId, now)?.state ?? "")
|
|
1369
|
+
&& this.classifyDestinationOf(row.destinationSession).class === "pane-bound";
|
|
1370
|
+
}
|
|
1371
|
+
/** A wake recorded unroutable because its seat wasn't bound yet, as just after a restart (#2789), is re-sent as soon
|
|
1372
|
+
* as the seat is seen running or idle, rather than at the stuck sweep's next tick; the sweep remains the backstop.
|
|
1373
|
+
* Only this seat's own pending rows, oldest first, that {@link unroutableWakeRetryable} admits. */
|
|
1374
|
+
async retryUnroutableWakesOnReachable(sessionName, state) {
|
|
1375
|
+
if (state !== "running" && state !== "idle")
|
|
1376
|
+
return;
|
|
1377
|
+
const addresses = this.resolveSessionAddresses(sessionName);
|
|
1378
|
+
if (!addresses.length)
|
|
1379
|
+
return;
|
|
1380
|
+
// As for a prompt clear (#2575): while a compaction's restore is owed, the wake would reach the agent before it.
|
|
1381
|
+
if ([sessionName, ...addresses].some(address => this.hasPendingPostCompactStage?.(address)))
|
|
1382
|
+
return;
|
|
1383
|
+
const rows = this.db.prepare(`SELECT qitem_id FROM queue_items
|
|
1384
|
+
WHERE destination_session IN (${addresses.map(() => "?").join(",")}) AND state = 'pending'
|
|
1385
|
+
AND handed_off_from IS NULL AND last_nudge_result LIKE 'unroutable:%' ORDER BY ts_created, qitem_id`)
|
|
1386
|
+
.all(...addresses);
|
|
1387
|
+
const now = new Date();
|
|
1388
|
+
// One attempt per intent for the pass: a returned result and its resume go as one send, so the second row's turn
|
|
1389
|
+
// mustn't send them again after a refusal.
|
|
1390
|
+
const attempted = new Set();
|
|
1391
|
+
// Correlation can add peers to a send. Each claim must qualify for this retry on its own: a failed wake of this
|
|
1392
|
+
// seat's pending row that the shared rule admits. A peer that may already have been written (indeterminate), or
|
|
1393
|
+
// failed for another reason, isn't claimed here.
|
|
1394
|
+
const eligible = (entry) => {
|
|
1395
|
+
if (entry.deliveryState !== "failed" || !entry.auditPointer)
|
|
1396
|
+
return false;
|
|
1397
|
+
const current = this.getById(entry.auditPointer);
|
|
1398
|
+
return current?.state === "pending" && addresses.includes(current.destinationSession) && !current.handedOffFrom
|
|
1399
|
+
&& this.unroutableWakeRetryable(current, now);
|
|
1400
|
+
};
|
|
1401
|
+
for (const { qitem_id } of rows) {
|
|
1402
|
+
const row = this.getById(qitem_id);
|
|
1403
|
+
if (!row || row.state !== "pending" || !this.unroutableWakeRetryable(row, now))
|
|
1404
|
+
continue;
|
|
1405
|
+
// The failed wake may be the row's own intent or an un-park's blocker intent: re-send whichever failed.
|
|
1406
|
+
// One in flight or delivered is never sent again; only a row with no intent at all takes the plain nudge.
|
|
1407
|
+
const intents = this.outbox ? this.db.prepare(`SELECT outbox_id, delivery_state FROM outbox_entries
|
|
1408
|
+
WHERE audit_pointer = ? AND substr(outbox_id, 1, ?) = ?`)
|
|
1409
|
+
.all(qitem_id, WAKE_INTENT_PREFIX.length, WAKE_INTENT_PREFIX) : [];
|
|
1410
|
+
if (intents.length) {
|
|
1411
|
+
for (const intent of intents)
|
|
1412
|
+
if (intent.delivery_state === "failed")
|
|
1413
|
+
await this.deliverWakeIntent(intent.outbox_id, attempted, eligible);
|
|
1414
|
+
}
|
|
1415
|
+
else
|
|
1416
|
+
await this.maybeNudge(qitem_id, row.destinationSession, undefined, row.sourceSession);
|
|
1417
|
+
}
|
|
1418
|
+
}
|
|
1180
1419
|
/**
|
|
1181
1420
|
* W1 (transactional closure): the shared wake-send CORE. Builds the pane
|
|
1182
1421
|
* envelope, sends with verify, and CLASSIFIES the transport result into the W1
|
|
@@ -1255,7 +1494,7 @@ export class QueueRepository {
|
|
|
1255
1494
|
const genUuid = sourceSession
|
|
1256
1495
|
? (this.resolveOccupantGeneration?.(sourceSession) ?? undefined)
|
|
1257
1496
|
: undefined;
|
|
1258
|
-
text = wrapPaneEnvelope(sourceSession, destinationSession, bareBody, { stampISO, genUuid, replyToQitem: qitemId });
|
|
1497
|
+
text = wrapPaneEnvelope(sourceSession, destinationSession, bareBody, { stampISO, genUuid, replyToQitem: qitemId, ...this.senderReach(sourceSession) });
|
|
1259
1498
|
}
|
|
1260
1499
|
const deliveryId = `guard-nudge-${qitemId}-${createHash("sha256").update(JSON.stringify([sourceSession, destinationSession, bodyOverride ?? null])).digest("hex")}`;
|
|
1261
1500
|
const held = !committedOutboxIds ? this.outbox?.getById(deliveryId) : null;
|
|
@@ -1311,9 +1550,10 @@ export class QueueRepository {
|
|
|
1311
1550
|
async createHumanAnswer(input) {
|
|
1312
1551
|
const { episodeKey, ...create } = input;
|
|
1313
1552
|
// A runner's permission request is answered in its ask, and the runner reads the answer back. No reply row: it
|
|
1314
|
-
// would wake the runner's terminal, where typed text reads as a prompt to its agent.
|
|
1553
|
+
// would wake the runner's terminal, where typed text reads as a prompt to its agent. A host pairing request is
|
|
1554
|
+
// answered in its ask too: the pairing poll reads it there, and nothing reads a reply.
|
|
1315
1555
|
const ask = this.getById(input.inboundReplyTo);
|
|
1316
|
-
if (ask && runnerPermissionOrigin(ask))
|
|
1556
|
+
if (ask && (runnerPermissionOrigin(ask) || isHostPairingAsk(ask)))
|
|
1317
1557
|
return ask;
|
|
1318
1558
|
const qitemId = humanAnswerId(input.inboundReplyTo, episodeKey);
|
|
1319
1559
|
const existing = episodeKey ? this.getById(qitemId) : this.getHumanAnswer(input.inboundReplyTo, input.sourceSession);
|
|
@@ -1516,6 +1756,11 @@ export class QueueRepository {
|
|
|
1516
1756
|
}
|
|
1517
1757
|
this.assertHumanAlert(input.humanAlert, input.destinationSession, input.humanIntent);
|
|
1518
1758
|
const id = input.qitemId ?? newQitemId();
|
|
1759
|
+
// A row queue erasure deleted keeps only its id: a create that reuses it would bring erased work back.
|
|
1760
|
+
if (input.qitemId && this.hasErasedIdsTable
|
|
1761
|
+
&& this.db.prepare("SELECT 1 FROM queue_erased_ids WHERE qitem_id = ?").get(input.qitemId)) {
|
|
1762
|
+
throw new QueueRepositoryError("qitem_erased", `qitem ${input.qitemId} was erased; its id can't be used again.`);
|
|
1763
|
+
}
|
|
1519
1764
|
const ts = new Date().toISOString();
|
|
1520
1765
|
const priority = input.priority ?? "routine";
|
|
1521
1766
|
const tier = input.tier ?? null;
|
|
@@ -1594,8 +1839,11 @@ export class QueueRepository {
|
|
|
1594
1839
|
}
|
|
1595
1840
|
if (humanAlert !== true)
|
|
1596
1841
|
return;
|
|
1597
|
-
if (!this.isPersonAddress(destination)
|
|
1598
|
-
throw new QueueRepositoryError("invalid_human_notification", "humanAlert marks an ask to a person as alert-worthy: it needs a human destination
|
|
1842
|
+
if (!this.isPersonAddress(destination)) {
|
|
1843
|
+
throw new QueueRepositoryError("invalid_human_notification", "humanAlert marks an ask to a person as alert-worthy: it needs a human destination.");
|
|
1844
|
+
}
|
|
1845
|
+
if (humanIntent === "update") {
|
|
1846
|
+
throw new QueueRepositoryError("invalid_human_notification", "humanAlert marks an ask to a person as alert-worthy, and an update isn't an ask: send it without --alert; updates are notices; delivery depends on the person's connector and settings.");
|
|
1599
1847
|
}
|
|
1600
1848
|
}
|
|
1601
1849
|
/** A person by address or by the registry: a registered person may be addressed as their seat or an alias. */
|
|
@@ -1672,6 +1920,11 @@ export class QueueRepository {
|
|
|
1672
1920
|
* with `handed_off_from` recording the chain. One atomic transaction.
|
|
1673
1921
|
*/
|
|
1674
1922
|
async handoff(input) {
|
|
1923
|
+
return this.handoffNow(input);
|
|
1924
|
+
}
|
|
1925
|
+
/** {@link handoff}'s whole act, synchronously: its transaction commits before this returns, and the wake is delivered
|
|
1926
|
+
* after commit without being awaited, so a synchronous caller (an answer's close path) can hand a row on. */
|
|
1927
|
+
handoffNow(input) {
|
|
1675
1928
|
const source = this.getById(input.qitemId);
|
|
1676
1929
|
if (!source) {
|
|
1677
1930
|
throw new QueueRepositoryError("qitem_not_found", `qitem ${input.qitemId} not found`);
|
|
@@ -1808,8 +2061,11 @@ export class QueueRepository {
|
|
|
1808
2061
|
this.assertTerminalClosureHasIntent(source.qitemId, newId, input.nudge);
|
|
1809
2062
|
});
|
|
1810
2063
|
txn();
|
|
2064
|
+
// Inside a caller's notify envelope (an answer's close path), the events join it; otherwise they're notified now.
|
|
1811
2065
|
for (const e of events) {
|
|
1812
|
-
|
|
2066
|
+
const event = e.payload;
|
|
2067
|
+
if (!this.eventBus.registerPersistedWithinActiveEnvelope(event))
|
|
2068
|
+
this.eventBus.notifySubscribers(event);
|
|
1813
2069
|
}
|
|
1814
2070
|
// Closure and successor are persisted. Delivery is separate and recoverable
|
|
1815
2071
|
// from the committed intent; a slow terminal must not hold the receipt.
|
|
@@ -2009,6 +2265,9 @@ export class QueueRepository {
|
|
|
2009
2265
|
}
|
|
2010
2266
|
const ts = new Date().toISOString();
|
|
2011
2267
|
const events = [];
|
|
2268
|
+
const overriddenClaim = input.claimedAtBeforeForward !== undefined && source.claimedAt != null
|
|
2269
|
+
&& source.claimedAt !== input.claimedAtBeforeForward ? source.claimedAt : null;
|
|
2270
|
+
let overrideWake = null;
|
|
2012
2271
|
const txn = this.db.transaction(() => {
|
|
2013
2272
|
this.db
|
|
2014
2273
|
.prepare(`UPDATE queue_items
|
|
@@ -2019,18 +2278,42 @@ export class QueueRepository {
|
|
|
2019
2278
|
closure_target = ?
|
|
2020
2279
|
WHERE qitem_id = ?`)
|
|
2021
2280
|
.run(input.terminalState, ts, input.toSession, input.closureTarget, input.qitemId);
|
|
2022
|
-
|
|
2281
|
+
const note = input.transitionNote ?? `cross-host handoff to ${input.toSession}`;
|
|
2282
|
+
const closeTransition = this.transitionLog.append({
|
|
2023
2283
|
qitemId: input.qitemId,
|
|
2024
2284
|
state: input.terminalState,
|
|
2025
2285
|
actorSession: input.fromSession,
|
|
2026
2286
|
// BR-1: the minted note carries the TWO-PART toSession only — the
|
|
2027
2287
|
// host-qualified successor key is allowed in closure_target and nowhere
|
|
2028
2288
|
// else, and transition_note is a durable carrier.
|
|
2029
|
-
transitionNote:
|
|
2289
|
+
transitionNote: overriddenClaim
|
|
2290
|
+
? `${note} (this overrode ${source.destinationSession}'s claim made at ${overriddenClaim}, while the handoff was forwarded)`
|
|
2291
|
+
: note,
|
|
2030
2292
|
closureReason: "handed_off_to",
|
|
2031
2293
|
closureTarget: input.closureTarget,
|
|
2032
2294
|
identityProvenance: input.identityProvenance ?? null,
|
|
2033
2295
|
});
|
|
2296
|
+
if (overriddenClaim && source.destinationSession !== input.fromSession) {
|
|
2297
|
+
const successor = input.successorQitemId ? ` as ${input.successorQitemId}` : "";
|
|
2298
|
+
try {
|
|
2299
|
+
overrideWake = this.db.transaction(() => this.recordWakeIntent({
|
|
2300
|
+
outboxId: `${CLAIM_OVERRIDDEN_WAKE_PREFIX}${closeTransition.transitionId}`,
|
|
2301
|
+
auditPointer: input.qitemId,
|
|
2302
|
+
qitemId: input.qitemId,
|
|
2303
|
+
fromSession: input.fromSession,
|
|
2304
|
+
toSession: source.destinationSession,
|
|
2305
|
+
identityProvenance: sideEffectProvenance(input.identityProvenance),
|
|
2306
|
+
bareBody: `${input.qitemId} was handed off to ${input.toSession}${successor} while you claimed it, so your claim is superseded and that seat has the work. Stop work on ${input.qitemId}; to carry on with it, coordinate with ${input.toSession}.`,
|
|
2307
|
+
tags: [WAKE_TRIGGER_OPENRIG_TAG],
|
|
2308
|
+
}))();
|
|
2309
|
+
}
|
|
2310
|
+
catch (err) {
|
|
2311
|
+
// As a handoff's own wake: a full held-message quota doesn't undo a close whose successor already exists.
|
|
2312
|
+
if (err.code !== "retained_quota_full")
|
|
2313
|
+
throw err;
|
|
2314
|
+
this.recordNudgeAttempt(input.qitemId, `${WAKE_NOT_RETAINED}${err.message}`);
|
|
2315
|
+
}
|
|
2316
|
+
}
|
|
2034
2317
|
// OPR.0.5.8.1 S1b — third member of the handoff family, same bypass.
|
|
2035
2318
|
this.retireParkGeneratedTimer(input.qitemId, `park_ended:${input.terminalState}`);
|
|
2036
2319
|
const handoffEvent = this.eventBus.persistWithinTransaction({
|
|
@@ -2061,6 +2344,8 @@ export class QueueRepository {
|
|
|
2061
2344
|
for (const e of events) {
|
|
2062
2345
|
this.eventBus.notifySubscribers(e);
|
|
2063
2346
|
}
|
|
2347
|
+
if (overrideWake)
|
|
2348
|
+
this.deliverWakeIntentAfterCommit(overrideWake);
|
|
2064
2349
|
return { item: this.getByIdOrThrow(input.qitemId), absorbed: false };
|
|
2065
2350
|
}
|
|
2066
2351
|
/**
|
|
@@ -3014,6 +3299,9 @@ export class QueueRepository {
|
|
|
3014
3299
|
* button set is already final; its resolve continuation must not overwrite those answers.
|
|
3015
3300
|
*/
|
|
3016
3301
|
resolveDirectHumanReply(input) {
|
|
3302
|
+
const passed = this.passRunnerAnswerToDecider(input);
|
|
3303
|
+
if (passed !== null)
|
|
3304
|
+
return passed;
|
|
3017
3305
|
let mine = true;
|
|
3018
3306
|
const result = this.db.transaction(() => {
|
|
3019
3307
|
const item = this.getById(input.qitemId);
|
|
@@ -3035,10 +3323,139 @@ export class QueueRepository {
|
|
|
3035
3323
|
})();
|
|
3036
3324
|
if (!result)
|
|
3037
3325
|
return false;
|
|
3038
|
-
for (const event of result.persistedEvents)
|
|
3039
|
-
this.eventBus.
|
|
3326
|
+
for (const event of result.persistedEvents) {
|
|
3327
|
+
if (!this.eventBus.registerPersistedWithinActiveEnvelope(event))
|
|
3328
|
+
this.eventBus.notifySubscribers(event);
|
|
3329
|
+
}
|
|
3040
3330
|
return mine;
|
|
3041
3331
|
}
|
|
3332
|
+
/** A runner's permission ask its person answered, where an agent can decide while the runner waits on it: their answer
|
|
3333
|
+
* (a choice, or their words) stays on the ask, and the ask is handed to that agent to decide, never closed with it. The
|
|
3334
|
+
* runner reads pending until the agent decides (`rig seat decide-permission`), or the person uses a direct control.
|
|
3335
|
+
* Null when this doesn't apply (no decider, or another person's answer settles it), and the ask closes as before. */
|
|
3336
|
+
passRunnerAnswerToDecider(input) {
|
|
3337
|
+
const item = this.getById(input.qitemId);
|
|
3338
|
+
if (!this.permissionDecider || item?.state !== "pending" || !runnerPermissionOrigin(item) || item.humanIntent === "update"
|
|
3339
|
+
|| (!this.answersAsk(item, input.actorSession) && !input.primaryUser) || !this.isPersonAddress(item.destinationSession)
|
|
3340
|
+
|| this.committedAnswerFromAnother(item.qitemId, input.actorSession))
|
|
3341
|
+
return null;
|
|
3342
|
+
// The requester is the runner seat that asked: the first row of the request, whoever handed it on since.
|
|
3343
|
+
let root = item;
|
|
3344
|
+
for (let hops = 0; root.handedOffFrom && hops < 10; hops++) {
|
|
3345
|
+
const before = this.getById(root.handedOffFrom);
|
|
3346
|
+
if (!before || !runnerPermissionOrigin(before))
|
|
3347
|
+
break;
|
|
3348
|
+
root = before;
|
|
3349
|
+
}
|
|
3350
|
+
let chosen;
|
|
3351
|
+
try {
|
|
3352
|
+
chosen = this.permissionDecider(item, root.sourceSession);
|
|
3353
|
+
}
|
|
3354
|
+
catch {
|
|
3355
|
+
chosen = null;
|
|
3356
|
+
}
|
|
3357
|
+
const decider = chosen?.session ?? null;
|
|
3358
|
+
if (!decider || !this.validateRig(decider))
|
|
3359
|
+
return this.keepRunnerAnswer(item, input.actorSession, input.decision, root.sourceSession);
|
|
3360
|
+
this.db.transaction(() => { this.placeTypedReply(item, input.decision); })();
|
|
3361
|
+
const answered = this.getById(item.qitemId) ?? item;
|
|
3362
|
+
const question = (this.permissionQuestionsFor(answered) ?? [])[0];
|
|
3363
|
+
const answer = question ? answered.humanAnswers?.[question.id] : undefined;
|
|
3364
|
+
const said = typeof answer === "string" ? `chose "${question?.options.find((o) => o.id === answer)?.label ?? answer}" (option ${answer})`
|
|
3365
|
+
: answer && typeof answer === "object" && "text" in answer ? `wrote "${String(answer.text).trim()}"`
|
|
3366
|
+
: "answered without a choice or words";
|
|
3367
|
+
const person = input.actorSession;
|
|
3368
|
+
// A handoff that fails after persisting its events rolls them back with its savepoint: discardOnThrow takes their
|
|
3369
|
+
// tokens out of the caller's notify envelope too, so the kept answer below still commits.
|
|
3370
|
+
try {
|
|
3371
|
+
this.eventBus.discardOnThrow(() => this.handoffNow({
|
|
3372
|
+
qitemId: item.qitemId, fromSession: person, toSession: decider,
|
|
3373
|
+
summary: `Decide: ${item.summary ?? "a runner's permission request"} (${person} answered)`,
|
|
3374
|
+
transitionNote: `runner-permission-answer-passed: ${person}'s answer goes to ${decider}, the receiving agent, to decide while the runner waits`,
|
|
3375
|
+
body: [
|
|
3376
|
+
`${person} answered ${item.sourceSession}'s permission request ${item.qitemId}: they ${said}. Its runner is waiting on your decision: nothing is permitted or refused until you decide.`,
|
|
3377
|
+
"",
|
|
3378
|
+
`- **Question:** ${question?.question ?? "Allow this tool call?"}`,
|
|
3379
|
+
"- **Options:**",
|
|
3380
|
+
...(question?.options ?? []).map((o) => ` - ${o.label} (${o.id})`),
|
|
3381
|
+
"",
|
|
3382
|
+
`Their whole answer is recorded on the request: rig queue show ${answered.qitemId} --full.`,
|
|
3383
|
+
`Decide with: rig seat decide-permission ${item.qitemId} --option <id> --reason "<why>"`,
|
|
3384
|
+
"Act on a clear answer at once: a clear yes or an allow click is the allow option, a clear no or a reject click the reject option. Don't ask them to confirm a clear answer. If their words are unclear or conditional, ask them back, naming this request, then decide.",
|
|
3385
|
+
"Until it's decided (by you, or by anyone with that command), the runner keeps waiting, with no timeout that refuses it; if its turn ends first, nothing is sent.",
|
|
3386
|
+
].join("\n"),
|
|
3387
|
+
}));
|
|
3388
|
+
}
|
|
3389
|
+
catch (error) {
|
|
3390
|
+
// Kept, and committed with the answer's own write (a throw here would roll it back): the request stays open, and
|
|
3391
|
+
// the person is told it couldn't be passed on. Never a default permit.
|
|
3392
|
+
console.error(`[queue] a runner permission answer couldn't be handed to ${decider}; it's kept and the request stays open`, error);
|
|
3393
|
+
return this.keepRunnerAnswer(item, person, input.decision, root.sourceSession, decider);
|
|
3394
|
+
}
|
|
3395
|
+
// The person learns who decides and in what recorded state, so a delay is shown: one update per request.
|
|
3396
|
+
const toldId = `qitem-runner-permission-passed-${item.qitemId.replace(/^qitem-runner-permission-/, "").replace(/^qitem-/, "")}`;
|
|
3397
|
+
setImmediate(() => {
|
|
3398
|
+
void this.create({ qitemId: toldId, sourceSession: root.sourceSession, destinationSession: person, humanIntent: "update",
|
|
3399
|
+
summary: `Your answer went to ${decider} to decide; ${root.sourceSession} is waiting`,
|
|
3400
|
+
body: [`Your answer to ${root.sourceSession}'s permission request ${root.qitemId} went to ${decider}, which decides it while ${root.sourceSession} waits. Nothing runs until it decides.`,
|
|
3401
|
+
...(chosen?.describe ? [`Receiving agent: ${chosen.describe}`] : []),
|
|
3402
|
+
`To decide directly instead: rig seat decide-permission ${root.qitemId} --option <id>.`].join("\n") })
|
|
3403
|
+
.catch((error) => console.error(`[queue] the update for ${item.qitemId}'s decider wasn't written`, error));
|
|
3404
|
+
});
|
|
3405
|
+
return true;
|
|
3406
|
+
}
|
|
3407
|
+
/** An agent's decision on a runner's permission request, on the row that holds it now: the chosen option under its
|
|
3408
|
+
* question, and the row closed done, in one transaction. False when the row isn't open any more. */
|
|
3409
|
+
recordPermissionDecision(input) {
|
|
3410
|
+
const result = this.db.transaction(() => {
|
|
3411
|
+
const item = this.getById(input.qitemId);
|
|
3412
|
+
if (!item)
|
|
3413
|
+
return null;
|
|
3414
|
+
const answers = { ...item.humanAnswers, [input.questionId]: input.optionId };
|
|
3415
|
+
// A row closed without a decision (an agent's or a person's ordinary close): the decision is recorded on it, with
|
|
3416
|
+
// its own transition, over any kept answer (which the transition names); the runner's next read takes it.
|
|
3417
|
+
// (The caller read it first: a row already decided explicitly, withdrawn or stale never reaches here.)
|
|
3418
|
+
if (item.state === "done" || item.state === "failed") {
|
|
3419
|
+
this.db.prepare("UPDATE queue_items SET human_answers = ? WHERE qitem_id = ?").run(JSON.stringify(answers), item.qitemId);
|
|
3420
|
+
this.transitionLog.append({ qitemId: item.qitemId, state: item.state, actorSession: input.actorSession, transitionNote: input.transitionNote });
|
|
3421
|
+
// The row's state doesn't change, but its decision does: a runner waiting on this request reads it now, and
|
|
3422
|
+
// Steering refreshes.
|
|
3423
|
+
return { persistedEvents: [this.eventBus.persistWithinTransaction({ type: "queue.updated", qitemId: item.qitemId,
|
|
3424
|
+
fromState: item.state, toState: item.state, closureReason: null, closureTarget: null,
|
|
3425
|
+
actorSession: input.actorSession, summary: item.summary ?? null })] };
|
|
3426
|
+
}
|
|
3427
|
+
if (item.state !== "pending" && item.state !== "in-progress" && item.state !== "blocked")
|
|
3428
|
+
return null;
|
|
3429
|
+
this.db.prepare("UPDATE queue_items SET human_answers = ? WHERE qitem_id = ?").run(JSON.stringify(answers), item.qitemId);
|
|
3430
|
+
return this.updateInTransactionalContext({ qitemId: item.qitemId, actorSession: input.actorSession, state: "done",
|
|
3431
|
+
closureReason: "no-follow-on", transitionNote: input.transitionNote });
|
|
3432
|
+
})();
|
|
3433
|
+
if (!result)
|
|
3434
|
+
return false;
|
|
3435
|
+
for (const event of result.persistedEvents) {
|
|
3436
|
+
if (!this.eventBus.registerPersistedWithinActiveEnvelope(event))
|
|
3437
|
+
this.eventBus.notifySubscribers(event);
|
|
3438
|
+
}
|
|
3439
|
+
return true;
|
|
3440
|
+
}
|
|
3441
|
+
/** No agent here can read a runner permission answer before the tool runs (none is set, or the only one is the seat
|
|
3442
|
+
* asking): the person's answer, a click or words, is kept on the ask, the request stays pending, and the person is
|
|
3443
|
+
* told once that the tool hasn't run and how to decide directly. Never a default permit, never read as a refusal. */
|
|
3444
|
+
keepRunnerAnswer(item, person, decision, requester, unreachable) {
|
|
3445
|
+
this.db.transaction(() => { this.placeTypedReply(item, decision); })();
|
|
3446
|
+
const options = (this.permissionQuestionsFor(item) ?? [])[0]?.options ?? [];
|
|
3447
|
+
const receiptId = `qitem-runner-permission-kept-${item.qitemId.replace(/^qitem-runner-permission-/, "")}`;
|
|
3448
|
+
// After the answer's own write settles: one receipt per request (its id is the request's), told to who answered.
|
|
3449
|
+
setImmediate(() => {
|
|
3450
|
+
void this.create({ qitemId: receiptId, sourceSession: requester, destinationSession: person, humanIntent: "update",
|
|
3451
|
+
summary: `Your answer to ${requester}'s permission request is kept; the tool hasn't run`,
|
|
3452
|
+
body: [`Your answer to ${requester}'s permission request ${item.qitemId} is kept, and the request is still waiting: ${unreachable ? `it couldn't be passed to ${unreachable}, the receiving agent, just now (answer again to retry)` : `no receiving agent on this host can read it before the tool runs (none is set, or the only one is ${requester} itself)`}. The tool hasn't run, and nothing was permitted or refused.`,
|
|
3453
|
+
`To decide now: rig seat decide-permission ${item.qitemId} --option <id>${options.length ? ` (options: ${options.map((o) => `${o.id}, ${o.label}`).join("; ")})` : ""}. Or set up a receiving agent that isn't ${requester}: rig config set agents.operator_session <seat>@<rig>.`,
|
|
3454
|
+
"If the agent's turn ends first, the tool call doesn't happen, and nothing is sent later."].join("\n") })
|
|
3455
|
+
.catch((error) => console.error(`[queue] the kept-answer receipt for ${item.qitemId} wasn't written`, error));
|
|
3456
|
+
});
|
|
3457
|
+
return true;
|
|
3458
|
+
}
|
|
3042
3459
|
/** Another person's committed return to this ask: its shared reply (for a park's question, `episodeKey`'s). It's the
|
|
3043
3460
|
* answer, so a different person's later attempt settles with it rather than their own. Null when there's none, or it's
|
|
3044
3461
|
* this actor's. */
|
|
@@ -3161,10 +3578,20 @@ export class QueueRepository {
|
|
|
3161
3578
|
/** The opaque revision of what a person decides on (#2446): the question (body, intent, questions) and its decision state
|
|
3162
3579
|
* (open, blocked or terminal; who it's addressed to or parked on; its answers, a decision made for them, the current park,
|
|
3163
3580
|
* and the replies returned). A label, a wake, a claim or a note on a park doesn't change it; a new park does, on any blocker. */
|
|
3164
|
-
decisionRevision(item) {
|
|
3581
|
+
decisionRevision(item, opts) {
|
|
3165
3582
|
const phase = item.state === "blocked" ? "blocked" : item.state === "pending" || item.state === "in-progress" ? "open" : item.state;
|
|
3166
|
-
const
|
|
3167
|
-
|
|
3583
|
+
const excludeOp = typeof opts?.excludeOperationReply === "string" && opts.excludeOperationReply.length > 0
|
|
3584
|
+
? mcOperationTag(opts.excludeOperationReply)
|
|
3585
|
+
: null;
|
|
3586
|
+
const replies = this.hasReplyToColumn
|
|
3587
|
+
? (excludeOp
|
|
3588
|
+
? this.db
|
|
3589
|
+
.prepare("SELECT qitem_id FROM queue_items WHERE reply_to = ? AND NOT (tags IS NOT NULL AND json_valid(tags) AND EXISTS (SELECT 1 FROM json_each(tags) WHERE value = ?)) ORDER BY ts_created, rowid")
|
|
3590
|
+
.all(item.qitemId, excludeOp)
|
|
3591
|
+
: this.db
|
|
3592
|
+
.prepare("SELECT qitem_id FROM queue_items WHERE reply_to = ? ORDER BY ts_created, rowid")
|
|
3593
|
+
.all(item.qitemId)).map((row) => row.qitem_id)
|
|
3594
|
+
: [];
|
|
3168
3595
|
// The park this is: the transition into blocked from another state (a later blocked-to-blocked note stays this park).
|
|
3169
3596
|
const transitions = item.state === "blocked" ? this.transitionLog.listForQitem(item.qitemId) : [];
|
|
3170
3597
|
let parkEntry = null;
|
|
@@ -3176,6 +3603,82 @@ export class QueueRepository {
|
|
|
3176
3603
|
item.humanAnswers ?? null, item.delegatedDecision ?? null, this.currentHumanRequiredEpisode(item.qitemId)?.key ?? null, parkEntry, replies];
|
|
3177
3604
|
return `dr1-${createHash("sha256").update(JSON.stringify(decision)).digest("hex").slice(0, 24)}`;
|
|
3178
3605
|
}
|
|
3606
|
+
listRelayOwnerNotificationReceipts(qitemId) {
|
|
3607
|
+
return this.transitionLog.listRelayOwnerNotificationReceipts(qitemId);
|
|
3608
|
+
}
|
|
3609
|
+
getRelayOwnerNotificationReceipt(qitemId, notificationKey, deliveryId) {
|
|
3610
|
+
return this.transitionLog.getRelayOwnerNotificationReceipt(qitemId, notificationKey, deliveryId);
|
|
3611
|
+
}
|
|
3612
|
+
hasRelayOwnerNotificationReceipt(qitemId, notificationKey, deliveryId) {
|
|
3613
|
+
return this.transitionLog.hasRelayOwnerNotificationReceipt(qitemId, notificationKey, deliveryId);
|
|
3614
|
+
}
|
|
3615
|
+
findRelayOwnerNotificationReceiptByReplyRef(replyRef) {
|
|
3616
|
+
return this.transitionLog.findRelayOwnerNotificationReceiptByReplyRef(replyRef);
|
|
3617
|
+
}
|
|
3618
|
+
findRelayOwnerNotificationReceiptByDeliveryId(deliveryId) {
|
|
3619
|
+
return this.transitionLog.findRelayOwnerNotificationReceiptByDeliveryId(deliveryId);
|
|
3620
|
+
}
|
|
3621
|
+
recordRelayOwnerNotificationTransportFailed(input) {
|
|
3622
|
+
const current = this.getByIdOrThrow(input.qitemId);
|
|
3623
|
+
const key = typeof input.notificationKey === "string" && input.notificationKey.trim().length > 0
|
|
3624
|
+
? input.notificationKey.trim()
|
|
3625
|
+
: input.qitemId;
|
|
3626
|
+
const normalizedConnectorRef = typeof input.connectorRef === "string" && input.connectorRef.trim().length > 0
|
|
3627
|
+
? input.connectorRef.trim()
|
|
3628
|
+
: null;
|
|
3629
|
+
const previousFailure = this.transitionLog
|
|
3630
|
+
.listForQitem(input.qitemId)
|
|
3631
|
+
.filter((transition) => (transition.transitionNote?.startsWith("slack-owner-notification-transport-failed ") ||
|
|
3632
|
+
transition.transitionNote?.startsWith(`${RELAY_OWNER_NOTIFICATION_TRANSPORT_FAILED_PREFIX} `)) &&
|
|
3633
|
+
transition.transitionNote.split(/\s+/).includes(`notification_key=${key}`))
|
|
3634
|
+
.at(-1);
|
|
3635
|
+
if (previousFailure?.transitionNote?.startsWith(`${RELAY_OWNER_NOTIFICATION_TRANSPORT_FAILED_PREFIX} `)) {
|
|
3636
|
+
const parsedPrevious = parseRelayOwnerNotificationTransportFailed(previousFailure.transitionNote);
|
|
3637
|
+
if (parsedPrevious && parsedPrevious.connectorRef === normalizedConnectorRef) {
|
|
3638
|
+
return current;
|
|
3639
|
+
}
|
|
3640
|
+
}
|
|
3641
|
+
const note = formatRelayOwnerNotificationTransportFailed({
|
|
3642
|
+
notificationKey: key,
|
|
3643
|
+
connectorRef: normalizedConnectorRef,
|
|
3644
|
+
failureClass: input.failureClass,
|
|
3645
|
+
detail: input.detail,
|
|
3646
|
+
});
|
|
3647
|
+
return this.update({
|
|
3648
|
+
qitemId: input.qitemId,
|
|
3649
|
+
actorSession: input.actorSession ?? "daemon@kernel",
|
|
3650
|
+
transitionNote: note,
|
|
3651
|
+
});
|
|
3652
|
+
}
|
|
3653
|
+
recordRelayOwnerNotificationAccepted(input) {
|
|
3654
|
+
const current = this.getByIdOrThrow(input.qitemId);
|
|
3655
|
+
const isUpdate = current.humanIntent === "update" &&
|
|
3656
|
+
current.state !== "blocked" &&
|
|
3657
|
+
!current.blockedOn &&
|
|
3658
|
+
this.isPersonAddress(current.destinationSession);
|
|
3659
|
+
const shouldCloseUpdate = isUpdate && input.closeUpdate !== false && isBlockerLive(current.state);
|
|
3660
|
+
if (this.transitionLog.hasRelayOwnerNotificationReceipt(input.qitemId, input.notificationKey)) {
|
|
3661
|
+
if (shouldCloseUpdate) {
|
|
3662
|
+
return this.update({
|
|
3663
|
+
qitemId: input.qitemId,
|
|
3664
|
+
actorSession: input.actorSession ?? "daemon@kernel",
|
|
3665
|
+
state: "done",
|
|
3666
|
+
closureReason: "no-follow-on",
|
|
3667
|
+
});
|
|
3668
|
+
}
|
|
3669
|
+
return current;
|
|
3670
|
+
}
|
|
3671
|
+
const note = formatRelayOwnerNotificationAccepted({
|
|
3672
|
+
...input,
|
|
3673
|
+
revision: input.revision ?? this.decisionRevision(current),
|
|
3674
|
+
});
|
|
3675
|
+
return this.update({
|
|
3676
|
+
qitemId: input.qitemId,
|
|
3677
|
+
actorSession: input.actorSession ?? "daemon@kernel",
|
|
3678
|
+
...(shouldCloseUpdate ? { state: "done", closureReason: "no-follow-on" } : {}),
|
|
3679
|
+
transitionNote: note,
|
|
3680
|
+
});
|
|
3681
|
+
}
|
|
3179
3682
|
currentHumanRequiredEpisode(qitemId) {
|
|
3180
3683
|
const episode = this.transitionLog.listForQitem(qitemId).filter((transition) => transition.ownerNotificationKind === "human-required").at(-1);
|
|
3181
3684
|
if (!episode)
|
|
@@ -3278,20 +3781,20 @@ export class QueueRepository {
|
|
|
3278
3781
|
ORDER BY json_extract(delegated_decision, '$.decidedAt'), qitem_id`).all(applicationId);
|
|
3279
3782
|
return rows.map((row) => this.rowToItem(row));
|
|
3280
3783
|
}
|
|
3281
|
-
|
|
3784
|
+
/** opts.waiting: false skips the row's waiting view (the stuck sweep's own reads); the default builds it. Per call:
|
|
3785
|
+
* it never changes what another read returns. */
|
|
3786
|
+
getById(qitemId, opts) {
|
|
3282
3787
|
const row = this.db
|
|
3283
3788
|
.prepare("SELECT * FROM queue_items WHERE qitem_id = ?")
|
|
3284
3789
|
.get(qitemId);
|
|
3285
3790
|
if (!row)
|
|
3286
3791
|
return null;
|
|
3287
|
-
const item = this.rowToItem(row);
|
|
3288
3792
|
// OPR.0.5.6.14 — the row FACE answers "did it reach them" in one read for
|
|
3289
3793
|
// gateway-routed rows; null for pane-bound (absence-governed, no key lies).
|
|
3290
|
-
|
|
3794
|
+
// The same projection as a listing's, for one row: one read of its owner notifications and ledger.
|
|
3795
|
+
const item = this.projectRows([row], opts?.waiting !== false)[0];
|
|
3291
3796
|
return {
|
|
3292
3797
|
...item,
|
|
3293
|
-
deliveryOutcome: ledger?.outcome ?? null,
|
|
3294
|
-
...(ledger && ledger.outcome !== "posted" ? { deliveryFailureDetail: ledger.detail } : {}),
|
|
3295
3798
|
...(item.replyTo ? { replyToFallback: this.replyToFallbackFor(item.qitemId) } : {}),
|
|
3296
3799
|
};
|
|
3297
3800
|
}
|
|
@@ -3421,18 +3924,24 @@ export class QueueRepository {
|
|
|
3421
3924
|
const rows = this.db
|
|
3422
3925
|
.prepare(`SELECT ${columns} FROM queue_items ${where} ORDER BY ${orderBy} LIMIT ?`)
|
|
3423
3926
|
.all(...params);
|
|
3927
|
+
const items = this.projectRows(rows, !opts?.compact);
|
|
3928
|
+
return opts?.compact ? items.map(compactRow) : items;
|
|
3929
|
+
}
|
|
3930
|
+
/** The listing projection (list, and show as a listing of one row): each row's item with its delivery outcome, the
|
|
3931
|
+
* owner notifications, ledgers and shared reads read once for all the rows. includeWaiting: full rows (SELECT *). */
|
|
3932
|
+
projectRows(rows, includeWaiting) {
|
|
3424
3933
|
const owners = this.transitionLog.ownerNotificationsForQitems(rows.map((row) => row.qitem_id));
|
|
3425
3934
|
const ledgers = this.deliveryOutcomesFor(rows, owners, true);
|
|
3426
|
-
const
|
|
3935
|
+
const reads = this.listingReads(rows, includeWaiting);
|
|
3936
|
+
return rows.map((r) => {
|
|
3427
3937
|
const ledger = ledgers.get(r.qitem_id);
|
|
3428
|
-
const item = this.rowToItem(r,
|
|
3938
|
+
const item = this.rowToItem(r, includeWaiting, { owners: owners.get(r.qitem_id) ?? [], ledger: ledger ?? null, reads });
|
|
3429
3939
|
return {
|
|
3430
3940
|
...item,
|
|
3431
3941
|
deliveryOutcome: ledger?.outcome ?? null,
|
|
3432
|
-
...(ledger && ledger.outcome !== "posted" ? { deliveryFailureDetail: ledger.detail } : {}),
|
|
3942
|
+
...(ledger && ledger.outcome !== "posted" && ledger.outcome !== "accepted" ? { deliveryFailureDetail: ledger.detail } : {}),
|
|
3433
3943
|
};
|
|
3434
3944
|
});
|
|
3435
|
-
return opts?.compact ? items.map(compactRow) : items;
|
|
3436
3945
|
}
|
|
3437
3946
|
/**
|
|
3438
3947
|
* OPR.0.3.2.20 — durable attention-class query.
|
|
@@ -3475,10 +3984,20 @@ export class QueueRepository {
|
|
|
3475
3984
|
SELECT q.*, r.ts AS delivered_at, r.transition_note AS delivery_receipt
|
|
3476
3985
|
FROM queue_items q JOIN (${receipts}) r ON r.qitem_id = q.qitem_id
|
|
3477
3986
|
WHERE q.human_intent = 'update' AND is_human_seat_session(q.destination_session) = 1
|
|
3478
|
-
AND r.transition_note LIKE 'slack-owner-notification-posted %'
|
|
3987
|
+
AND (r.transition_note LIKE 'slack-owner-notification-posted %' OR r.transition_note LIKE 'relay-owner-notification-accepted %')
|
|
3479
3988
|
ORDER BY r.ts DESC, q.qitem_id DESC LIMIT ?
|
|
3480
3989
|
`).all(limit);
|
|
3481
|
-
return rows.map((row) =>
|
|
3990
|
+
return rows.map((row) => {
|
|
3991
|
+
const deliveryOutcome = row.delivery_receipt.startsWith(`${RELAY_OWNER_NOTIFICATION_ACCEPTED_PREFIX} `)
|
|
3992
|
+
? "accepted"
|
|
3993
|
+
: "posted";
|
|
3994
|
+
return {
|
|
3995
|
+
...this.rowToItem(row),
|
|
3996
|
+
deliveryOutcome,
|
|
3997
|
+
deliveredAt: row.delivered_at,
|
|
3998
|
+
deliveryReceipt: row.delivery_receipt,
|
|
3999
|
+
};
|
|
4000
|
+
});
|
|
3482
4001
|
}
|
|
3483
4002
|
/** Current explicit human FYIs; delivery receipts are not required for local visibility.
|
|
3484
4003
|
* Filter before the bounded window so agent and malformed destinations cannot hide updates. */
|
|
@@ -3571,6 +4090,10 @@ export class QueueRepository {
|
|
|
3571
4090
|
const cutoff = opts?.now ?? new Date().toISOString();
|
|
3572
4091
|
const conditions = ["state = 'in-progress'", "closure_required_at IS NOT NULL", "closure_required_at <= ?"];
|
|
3573
4092
|
const params = [cutoff];
|
|
4093
|
+
if (opts?.qitemId !== undefined) {
|
|
4094
|
+
conditions.push("qitem_id = ?");
|
|
4095
|
+
params.push(opts.qitemId);
|
|
4096
|
+
}
|
|
3574
4097
|
if (opts?.rig) {
|
|
3575
4098
|
const escaped = opts.rig.replace(/%/g, "\\%").replace(/_/g, "\\_");
|
|
3576
4099
|
conditions.push("(destination_session LIKE ? ESCAPE '\\' OR source_session LIKE ? ESCAPE '\\')");
|
|
@@ -3583,7 +4106,7 @@ export class QueueRepository {
|
|
|
3583
4106
|
params.push(opts.limit);
|
|
3584
4107
|
}
|
|
3585
4108
|
const rows = this.db.prepare(sql).all(...params);
|
|
3586
|
-
const items = rows.map((r) => this.rowToItem(r, !opts?.compact));
|
|
4109
|
+
const items = rows.map((r) => this.rowToItem(r, !opts?.compact && opts?.waiting !== false));
|
|
3587
4110
|
return opts?.compact ? items.map(compactRow) : items;
|
|
3588
4111
|
}
|
|
3589
4112
|
/**
|
|
@@ -3658,9 +4181,15 @@ export class QueueRepository {
|
|
|
3658
4181
|
OR EXISTS (SELECT 1 FROM queue_transitions receipt
|
|
3659
4182
|
WHERE receipt.qitem_id = queue_items.qitem_id
|
|
3660
4183
|
AND (receipt.transition_note LIKE 'slack-owner-notification-posted %'
|
|
3661
|
-
OR receipt.transition_note LIKE '
|
|
4184
|
+
OR receipt.transition_note LIKE 'relay-owner-notification-accepted %'
|
|
4185
|
+
OR receipt.transition_note LIKE 'slack-owner-notification-transport-failed %'
|
|
4186
|
+
OR receipt.transition_note LIKE 'relay-owner-notification-transport-failed %')))`,
|
|
3662
4187
|
];
|
|
3663
4188
|
const params = [];
|
|
4189
|
+
if (opts?.qitemId !== undefined) {
|
|
4190
|
+
conditions.push("qitem_id = ?");
|
|
4191
|
+
params.push(opts.qitemId);
|
|
4192
|
+
}
|
|
3664
4193
|
if (opts?.rig) {
|
|
3665
4194
|
const escaped = opts.rig.replace(/%/g, "\\%").replace(/_/g, "\\_");
|
|
3666
4195
|
conditions.push("(destination_session LIKE ? ESCAPE '\\' OR source_session LIKE ? ESCAPE '\\')");
|
|
@@ -3671,9 +4200,9 @@ export class QueueRepository {
|
|
|
3671
4200
|
const rows = this.db.prepare(sql).all(...params);
|
|
3672
4201
|
const out = [];
|
|
3673
4202
|
for (const r of rows) {
|
|
3674
|
-
const item = this.rowToItem(r, !opts?.compact);
|
|
4203
|
+
const item = this.rowToItem(r, !opts?.compact && opts?.waiting !== false);
|
|
3675
4204
|
const ledger = this.deliveryOutcomeFor(item.qitemId);
|
|
3676
|
-
if (ledger?.outcome === "posted")
|
|
4205
|
+
if (ledger?.outcome === "posted" || ledger?.outcome === "accepted")
|
|
3677
4206
|
continue; // the receipt wins, always
|
|
3678
4207
|
if (ledger?.outcome === "transport-failed") {
|
|
3679
4208
|
out.push({
|
|
@@ -3757,6 +4286,59 @@ export class QueueRepository {
|
|
|
3757
4286
|
return false;
|
|
3758
4287
|
}
|
|
3759
4288
|
}
|
|
4289
|
+
/** Whether the rosters list this address as a hosted member on this host, trigger or not. An unreadable roster reads
|
|
4290
|
+
* false. */
|
|
4291
|
+
isHostedMember(destination) {
|
|
4292
|
+
try {
|
|
4293
|
+
return this.hostedMemberFn(destination);
|
|
4294
|
+
}
|
|
4295
|
+
catch {
|
|
4296
|
+
return false;
|
|
4297
|
+
}
|
|
4298
|
+
}
|
|
4299
|
+
/** Whether two addresses name the same session (one of its canonical or physical names). */
|
|
4300
|
+
isSameSession(a, b) {
|
|
4301
|
+
if (a === b)
|
|
4302
|
+
return true;
|
|
4303
|
+
try {
|
|
4304
|
+
return this.resolveSessionAddresses(a).includes(b) || this.resolveSessionAddresses(b).includes(a);
|
|
4305
|
+
}
|
|
4306
|
+
catch {
|
|
4307
|
+
return false;
|
|
4308
|
+
}
|
|
4309
|
+
}
|
|
4310
|
+
/** A session's successful read of its own pending inbox, as the list route decides: availability, never a receipt,
|
|
4311
|
+
* claim or answer for any row. Written at most once a minute per session; a failed write is logged once and never
|
|
4312
|
+
* fails the read that made it. */
|
|
4313
|
+
recordInboxCheckIn(session, at = new Date()) {
|
|
4314
|
+
const last = this.inboxCheckInWrittenAt.get(session);
|
|
4315
|
+
if (last !== undefined && at.getTime() >= last && at.getTime() - last < INBOX_CHECKIN_WRITE_INTERVAL_MS)
|
|
4316
|
+
return;
|
|
4317
|
+
try {
|
|
4318
|
+
this.db.prepare(`INSERT INTO queue_inbox_checkins (session, checked_at) VALUES (?, ?)
|
|
4319
|
+
ON CONFLICT(session) DO UPDATE SET checked_at = excluded.checked_at WHERE excluded.checked_at > queue_inbox_checkins.checked_at`)
|
|
4320
|
+
.run(session, at.toISOString());
|
|
4321
|
+
this.inboxCheckInWrittenAt.set(session, at.getTime());
|
|
4322
|
+
}
|
|
4323
|
+
catch (err) {
|
|
4324
|
+
if (!this.inboxCheckInWriteFailed) {
|
|
4325
|
+
console.error(`[queue] inbox check-in not recorded for ${session}: ${err instanceof Error ? err.message : String(err)}`);
|
|
4326
|
+
}
|
|
4327
|
+
this.inboxCheckInWriteFailed = true;
|
|
4328
|
+
}
|
|
4329
|
+
}
|
|
4330
|
+
/** This session's latest recorded check-in under any of its names. */
|
|
4331
|
+
lastInboxCheckIn(session) {
|
|
4332
|
+
try {
|
|
4333
|
+
const names = [...new Set([session, ...this.resolveSessionAddresses(session)])];
|
|
4334
|
+
const row = this.db.prepare(`SELECT MAX(checked_at) AS at FROM queue_inbox_checkins WHERE session IN (${names.map(() => "?").join(", ")})`)
|
|
4335
|
+
.get(...names);
|
|
4336
|
+
return row?.at ? { state: "seen", at: row.at } : { state: "never" };
|
|
4337
|
+
}
|
|
4338
|
+
catch {
|
|
4339
|
+
return { state: "unknown" };
|
|
4340
|
+
}
|
|
4341
|
+
}
|
|
3760
4342
|
classifyDestinationOf(destinationSession) {
|
|
3761
4343
|
return classifyDestination(destinationSession, {
|
|
3762
4344
|
entities: (() => {
|
|
@@ -3804,7 +4386,7 @@ export class QueueRepository {
|
|
|
3804
4386
|
/** Null means legacy/no OWNER history; inactive means OWNER history exists
|
|
3805
4387
|
* but the row no longer projects a current human-notification episode.
|
|
3806
4388
|
* owners: the row's owner notifications, newest first. */
|
|
3807
|
-
currentDeliveryEpisode(item, owners, loadRegistry) {
|
|
4389
|
+
currentDeliveryEpisode(item, owners, loadRegistry, loadProfiles, loadPullOutboxKeys) {
|
|
3808
4390
|
let transition = owners[0];
|
|
3809
4391
|
if (!transition)
|
|
3810
4392
|
return null;
|
|
@@ -3833,14 +4415,26 @@ export class QueueRepository {
|
|
|
3833
4415
|
: item.state === "blocked"
|
|
3834
4416
|
? resolveRegisteredHumanAddress(item.blockedOn, registry.entities)
|
|
3835
4417
|
: resolveRegisteredHumanAddress(item.destinationSession, registry.entities);
|
|
4418
|
+
const entity = humanAddress ? registry.entities.find((entry) => entry.address === humanAddress) : undefined;
|
|
3836
4419
|
// A person with no connector is reached in the Feed and Steering only: nothing is posted to them, so nothing is owed.
|
|
3837
|
-
if (
|
|
4420
|
+
if (entity?.connectorBindings.length === 0)
|
|
3838
4421
|
return "inactive";
|
|
4422
|
+
const notificationKey = `${item.qitemId}:${transition.transitionId}`;
|
|
4423
|
+
// A ready pull-mode relay has no required polling cadence (#2742): while the outbox lists the staged envelope, waiting
|
|
4424
|
+
// to be pulled is not a missing post for PULL_OUTBOX_NEVER_POSTED_WINDOW_MS. ledgerOf asks only when nothing else
|
|
4425
|
+
// decides the outcome; a notice the outbox doesn't list gets the usual NEVER_POSTED_WINDOW_MS.
|
|
4426
|
+
const primary = entity?.connectorBindings.find((b) => b.role === "primary") ?? entity?.connectorBindings[0];
|
|
4427
|
+
const awaitingPull = primary?.kind === "relay"
|
|
4428
|
+
? () => {
|
|
4429
|
+
const p = loadProfiles(registry.entities).get(primary.connectorRef);
|
|
4430
|
+
return p?.ready === true && p.mode === "pull" && loadPullOutboxKeys().has(`${primary.connectorRef}\n${notificationKey}`);
|
|
4431
|
+
}
|
|
4432
|
+
: undefined;
|
|
3839
4433
|
// An ask placed on Steering without an alert (RECORD) owes no post: its ledger reports a real receipt (a posting
|
|
3840
4434
|
// dial set to RECORD posts it) and never a missing one.
|
|
3841
4435
|
return humanAddress
|
|
3842
|
-
? { notificationKey
|
|
3843
|
-
...(transition.ownerNotificationLevel === "RECORD" ? { quiet: true } : {}) }
|
|
4436
|
+
? { notificationKey, startedAt: transition.ts,
|
|
4437
|
+
...(transition.ownerNotificationLevel === "RECORD" ? { quiet: true } : awaitingPull ? { awaitingPull } : {}) }
|
|
3844
4438
|
: "inactive";
|
|
3845
4439
|
}
|
|
3846
4440
|
/** OPR.0.5.6.14 — derive the current episode's delivery ledger. Receipt
|
|
@@ -3851,20 +4445,28 @@ export class QueueRepository {
|
|
|
3851
4445
|
const ledger = this.deliveryLedger(qitemId);
|
|
3852
4446
|
return ledger ? { outcome: ledger.outcome, detail: ledger.detail } : null;
|
|
3853
4447
|
}
|
|
3854
|
-
/** #514 — true
|
|
3855
|
-
* to a registered human, aliases included) has a POSTED receipt. Legacy rows with no OWNER
|
|
4448
|
+
/** OPR.0.5.6.14 + #514 — true when the row's CURRENT ask episode (create-time pending ask
|
|
4449
|
+
* to a registered human, aliases included) has a POSTED or ACCEPTED receipt. Legacy rows with no OWNER
|
|
3856
4450
|
* history, inactive episodes, never-posted and transport-failed all read false. Same derivation
|
|
3857
4451
|
* as deliveryOutcomeFor; it reads row fields, never the waiting view. */
|
|
3858
4452
|
humanNotificationPostedThisEpisode(qitemId, listed) {
|
|
4453
|
+
return this.humanNotificationDeliveryThisEpisode(qitemId, listed) !== null;
|
|
4454
|
+
}
|
|
4455
|
+
humanNotificationDeliveryThisEpisode(qitemId, listed) {
|
|
3859
4456
|
if (!this.hasQueueTransitionsTable)
|
|
3860
|
-
return
|
|
4457
|
+
return null;
|
|
3861
4458
|
const owners = listed?.owners ?? this.transitionLog.ownerNotificationsForQitems([qitemId]).get(qitemId) ?? [];
|
|
3862
4459
|
const owner = this.currentAskNotification(qitemId, owners);
|
|
3863
4460
|
if (!owner)
|
|
3864
|
-
return
|
|
4461
|
+
return null;
|
|
3865
4462
|
// The ledger's episode exists only when the destination resolves to a registered human (aliases included).
|
|
3866
4463
|
const ledger = listed ? listed.ledger : this.deliveryLedger(qitemId, owners);
|
|
3867
|
-
|
|
4464
|
+
if (ledger !== null &&
|
|
4465
|
+
(ledger.outcome === "posted" || ledger.outcome === "accepted") &&
|
|
4466
|
+
ledger.episode?.notificationKey === `${qitemId}:${owner.transitionId}`) {
|
|
4467
|
+
return ledger.outcome;
|
|
4468
|
+
}
|
|
4469
|
+
return null;
|
|
3868
4470
|
}
|
|
3869
4471
|
/** The ask's own notification while it still binds its recipient. Only that notification does: create writes it in
|
|
3870
4472
|
* state pending, to the destination of that moment. A park notice (its recipient is not retained), a resolution notice,
|
|
@@ -3928,9 +4530,13 @@ export class QueueRepository {
|
|
|
3928
4530
|
let notes = receiptsAfterEpisodes ? undefined : this.receiptNotesFor(qitemIds);
|
|
3929
4531
|
let registry;
|
|
3930
4532
|
const loadRegistry = () => (registry ??= this.loadHumanRegistryFn());
|
|
4533
|
+
let relayProfiles;
|
|
4534
|
+
const loadProfiles = (entities) => (relayProfiles ??= loadRelayProfiles(undefined, { entities }));
|
|
4535
|
+
let pullOutboxKeys;
|
|
4536
|
+
const loadPullOutboxKeys = () => (pullOutboxKeys ??= listablePullOutboxKeys());
|
|
3931
4537
|
const episodes = rows.map((row) => {
|
|
3932
4538
|
const item = ledgerItem(row);
|
|
3933
|
-
return { item, episode: this.currentDeliveryEpisode(item, owners.get(row.qitem_id) ?? [], loadRegistry) };
|
|
4539
|
+
return { item, episode: this.currentDeliveryEpisode(item, owners.get(row.qitem_id) ?? [], loadRegistry, loadProfiles, loadPullOutboxKeys) };
|
|
3934
4540
|
});
|
|
3935
4541
|
notes ??= this.receiptNotesFor(qitemIds);
|
|
3936
4542
|
for (const { item, episode } of episodes) {
|
|
@@ -3946,7 +4552,9 @@ export class QueueRepository {
|
|
|
3946
4552
|
receiptNotesFor(qitemIds) {
|
|
3947
4553
|
this.receiptNotesStatement ??= this.db.prepare(`SELECT qitem_id, transition_note FROM queue_transitions
|
|
3948
4554
|
WHERE qitem_id IN (SELECT value FROM json_each(?)) AND (transition_note LIKE 'slack-owner-notification-posted %'
|
|
3949
|
-
OR transition_note LIKE '
|
|
4555
|
+
OR transition_note LIKE 'relay-owner-notification-accepted %'
|
|
4556
|
+
OR transition_note LIKE 'slack-owner-notification-transport-failed %'
|
|
4557
|
+
OR transition_note LIKE 'relay-owner-notification-transport-failed %')
|
|
3950
4558
|
ORDER BY transition_id DESC`);
|
|
3951
4559
|
const notes = new Map();
|
|
3952
4560
|
for (const row of this.receiptNotesStatement.all(JSON.stringify(qitemIds))) {
|
|
@@ -3966,7 +4574,11 @@ export class QueueRepository {
|
|
|
3966
4574
|
const posted = currentNotes.find((note) => note.startsWith("slack-owner-notification-posted "));
|
|
3967
4575
|
if (posted)
|
|
3968
4576
|
return { outcome: "posted", detail: posted, episode };
|
|
3969
|
-
const
|
|
4577
|
+
const accepted = currentNotes.find((note) => note.startsWith("relay-owner-notification-accepted "));
|
|
4578
|
+
if (accepted)
|
|
4579
|
+
return { outcome: "accepted", detail: accepted, episode };
|
|
4580
|
+
const failed = currentNotes.find((note) => note.startsWith("slack-owner-notification-transport-failed ") ||
|
|
4581
|
+
note.startsWith(`${RELAY_OWNER_NOTIFICATION_TRANSPORT_FAILED_PREFIX} `));
|
|
3970
4582
|
if (failed)
|
|
3971
4583
|
return { outcome: "transport-failed", detail: failed, episode };
|
|
3972
4584
|
if (episode?.quiet)
|
|
@@ -3975,7 +4587,8 @@ export class QueueRepository {
|
|
|
3975
4587
|
const gatewayRouted = episode !== null || item.lastNudgeResult?.startsWith("gateway-owned") === true;
|
|
3976
4588
|
if (gatewayRouted) {
|
|
3977
4589
|
const ageMs = Date.now() - new Date(startedAt.includes("T") ? startedAt : startedAt + "Z").getTime();
|
|
3978
|
-
if (ageMs > QueueRepository.NEVER_POSTED_WINDOW_MS
|
|
4590
|
+
if (ageMs > QueueRepository.NEVER_POSTED_WINDOW_MS
|
|
4591
|
+
&& !(ageMs <= QueueRepository.PULL_OUTBOX_NEVER_POSTED_WINDOW_MS && episode?.awaitingPull?.())) {
|
|
3979
4592
|
const key = episode ? ` for notification_key=${episode.notificationKey}` : "";
|
|
3980
4593
|
return { outcome: "never-posted", detail: `gateway-routed row with no delivery receipt${key} past the post window`, episode };
|
|
3981
4594
|
}
|
|
@@ -3985,6 +4598,9 @@ export class QueueRepository {
|
|
|
3985
4598
|
/** The grace window before a receiptless gateway-routed row honestly reads
|
|
3986
4599
|
* never-posted (the connector sweep cadence bounds normal posting latency). */
|
|
3987
4600
|
static NEVER_POSTED_WINDOW_MS = 120_000;
|
|
4601
|
+
/** How long a notice staged in the relay pull outbox may wait for the connector's ack before it reads never-posted
|
|
4602
|
+
* (#2742). */
|
|
4603
|
+
static PULL_OUTBOX_NEVER_POSTED_WINDOW_MS = 24 * 60 * 60 * 1000;
|
|
3988
4604
|
/** Record one wake attempt. */
|
|
3989
4605
|
recordNudgeAttempt(qitemId, result) {
|
|
3990
4606
|
const ts = new Date().toISOString();
|
|
@@ -4227,6 +4843,19 @@ export class QueueRepository {
|
|
|
4227
4843
|
}
|
|
4228
4844
|
activityReader;
|
|
4229
4845
|
attachActivityReader(reader) { this.activityReader = reader; }
|
|
4846
|
+
/** #2661 (c): since when (ISO) the daemon owes a seat its managed post-compaction stages, or null. */
|
|
4847
|
+
compactionReader;
|
|
4848
|
+
attachCompactionReader(reader) { this.compactionReader = reader; }
|
|
4849
|
+
compactionOwedSince(session) {
|
|
4850
|
+
if (!session)
|
|
4851
|
+
return null;
|
|
4852
|
+
try {
|
|
4853
|
+
return this.compactionReader?.(session) ?? null;
|
|
4854
|
+
}
|
|
4855
|
+
catch {
|
|
4856
|
+
return null;
|
|
4857
|
+
}
|
|
4858
|
+
}
|
|
4230
4859
|
workflowGuidance;
|
|
4231
4860
|
attachWorkflowGuidance(reader) { this.workflowGuidance = reader; }
|
|
4232
4861
|
evaluateWaitReminder(input) {
|
|
@@ -4254,16 +4883,40 @@ export class QueueRepository {
|
|
|
4254
4883
|
return null;
|
|
4255
4884
|
}
|
|
4256
4885
|
}
|
|
4886
|
+
/** What a listing reads once for all its rows instead of once per row. includeWaiting: the rows' waiting views read
|
|
4887
|
+
* their qitem blockers' last meaningful transitions too. */
|
|
4888
|
+
listingReads(rows, includeWaiting) {
|
|
4889
|
+
const ids = rows.map((r) => r.qitem_id);
|
|
4890
|
+
if (includeWaiting)
|
|
4891
|
+
for (const r of rows)
|
|
4892
|
+
if (r.blocked_on)
|
|
4893
|
+
ids.push(r.blocked_on);
|
|
4894
|
+
// Each owner's activity once per listing: a row and its waiting view (and every other row to that owner) read the
|
|
4895
|
+
// same seat state. ownerActivity reads a failure as null, so one session's failure stays that session's.
|
|
4896
|
+
const activities = new Map();
|
|
4897
|
+
const activity = (session) => {
|
|
4898
|
+
if (!activities.has(session))
|
|
4899
|
+
activities.set(session, this.ownerActivity(session));
|
|
4900
|
+
return activities.get(session) ?? null;
|
|
4901
|
+
};
|
|
4902
|
+
return { meaningful: lastMeaningfulTransitionMany(this.db, ids), statements: new WaitingStatements(this.db), activity };
|
|
4903
|
+
}
|
|
4257
4904
|
/** listed: the row's owner notifications and ledger, when a listing read them for all its rows. */
|
|
4258
4905
|
waitingView(qitemId, listed) {
|
|
4259
|
-
|
|
4906
|
+
// The row in hand, when the listing passed it: its later re-reads below are served by it too.
|
|
4907
|
+
const inHand = listed?.row && listed.row.qitem_id === qitemId ? listed.row : undefined;
|
|
4908
|
+
const reads = listed?.reads && inHand ? { ...listed.reads, row: inHand } : listed?.reads;
|
|
4909
|
+
const view = readWaitingView(this.db, qitemId, listed?.reads?.activity ?? this.activityReader, target => this.acceptsDestination(target), reads);
|
|
4260
4910
|
if (view && ["pending", "in-progress"].includes(view.state)) {
|
|
4261
4911
|
// #514 — the unclaimed sweep skips a pending ask already posted to its human in the current
|
|
4262
4912
|
// episode (same predicate as runStuckSweep), so the view must not promise that sweep.
|
|
4263
|
-
const
|
|
4913
|
+
const episodeDelivery = view.state === "pending" ? this.humanNotificationDeliveryThisEpisode(qitemId, listed) : null;
|
|
4914
|
+
const posted = episodeDelivery !== null;
|
|
4264
4915
|
const onSteering = !posted && view.state === "pending" && this.humanAskWithoutAlert(qitemId, listed);
|
|
4265
4916
|
const row = view.state === "pending" && !onSteering
|
|
4266
|
-
?
|
|
4917
|
+
? inHand
|
|
4918
|
+
? { state: inHand.state, human_intent: inHand.human_intent ?? null, destination_session: inHand.destination_session, last_nudge_result: inHand.last_nudge_result }
|
|
4919
|
+
: this.db.prepare(`SELECT state, ${this.hasHumanIntentColumn ? "human_intent" : "NULL AS human_intent"}, destination_session, last_nudge_result FROM queue_items WHERE qitem_id = ?`).get(qitemId)
|
|
4267
4920
|
: undefined;
|
|
4268
4921
|
const humanUpdate = !!row && this.isRegisteredHumanUpdate({ state: row.state, humanIntent: row.human_intent, destinationSession: row.destination_session });
|
|
4269
4922
|
const noticeOutcome = !posted && !onSteering ? (listed ? listed.ledger?.outcome : this.deliveryOutcomeFor(qitemId)?.outcome) : undefined;
|
|
@@ -4271,13 +4924,14 @@ export class QueueRepository {
|
|
|
4271
4924
|
&& this.isLocalHumanDecisionWithoutGateway({ state: row.state, humanIntent: row.human_intent, destinationSession: row.destination_session, lastNudgeResult: row.last_nudge_result });
|
|
4272
4925
|
const awaitingHuman = posted || onSteering || localOnly;
|
|
4273
4926
|
if (awaitingHuman || humanUpdate) {
|
|
4927
|
+
const deliveryPhrase = episodeDelivery === "accepted" ? "accepted by the bridge" : "posted to the human";
|
|
4274
4928
|
view.nextBackstop = { owner: view.owner, mechanism: localOnly ? "local attention feed (no registered human gateway)" : onSteering
|
|
4275
4929
|
? "none (on Steering for the human, with no Slack alert; awaiting their decision)"
|
|
4276
4930
|
: humanUpdate
|
|
4277
4931
|
? posted
|
|
4278
|
-
?
|
|
4932
|
+
? `none (${deliveryPhrase}; informational correspondence requires no claim)`
|
|
4279
4933
|
: "none (informational correspondence to the human; no claim required)"
|
|
4280
|
-
:
|
|
4934
|
+
: `none (${deliveryPhrase}; awaiting their decision)`, dueAt: null, intervalSeconds: null };
|
|
4281
4935
|
}
|
|
4282
4936
|
// Quiet hours: a held ask is owned by its window's release job until it posts.
|
|
4283
4937
|
const quiet = awaitingHuman ? null : quietCustodyBackstop(view.owner, quietHoldCustody(this.db, qitemId));
|
|
@@ -4291,8 +4945,8 @@ export class QueueRepository {
|
|
|
4291
4945
|
view.laterBackstop = { ...view.nextBackstop, note: "Conditional safety net; current delivery/recovery ownership is evaluated first." };
|
|
4292
4946
|
view.nextBackstop = recovery;
|
|
4293
4947
|
}
|
|
4294
|
-
else if (!awaitingHuman && view.state === "pending" && this.db.prepare("SELECT last_nudge_result FROM queue_items WHERE qitem_id = ?")
|
|
4295
|
-
.get(qitemId)?.last_nudge_result === "retained:typing_guard") {
|
|
4948
|
+
else if (!awaitingHuman && view.state === "pending" && (inHand ?? this.db.prepare("SELECT last_nudge_result FROM queue_items WHERE qitem_id = ?")
|
|
4949
|
+
.get(qitemId))?.last_nudge_result === "retained:typing_guard") {
|
|
4296
4950
|
// Held at the seat on purpose: not stuck, and not picked up. Nothing replays it; reading or delivering it is a
|
|
4297
4951
|
// deliberate step.
|
|
4298
4952
|
view.nextBackstop = { owner: view.owner, mechanism: "held by the seat's typing guard", dueAt: null, intervalSeconds: null, held: true,
|
|
@@ -4333,22 +4987,26 @@ export class QueueRepository {
|
|
|
4333
4987
|
target,
|
|
4334
4988
|
reason: "no-live-local-successor",
|
|
4335
4989
|
message: foreignTarget
|
|
4336
|
-
? `Successor custody for '${target}' is unverified on this daemon: the successor is named on that host, and this daemon cannot read its custody. This closure records a handoff claim, not proof of transfer or pickup. Use 'rig queue handoff' or 'handoff-and-complete'
|
|
4337
|
-
: `Successor custody for '${target}' is unverified on this daemon: no local row with this source's lineage was found. A successor may exist on another host. This closure records a handoff claim, not proof of transfer or pickup; reconcile the successor by ID. Use 'rig queue handoff' or 'handoff-and-complete'
|
|
4990
|
+
? `Successor custody for '${target}' is unverified on this daemon: the successor is named on that host, and this daemon cannot read its custody. This closure records a handoff claim, not proof of transfer or pickup. Use 'rig queue handoff' or 'handoff-and-complete' with '--to <seat@rig>'; add '--host <registered-host>' for another host instead of manually closing to the successor ID; a local handoff is atomic, across hosts the successor is created first and the source closed after, and an uncertain result is reconciled by its exact id, since re-running the same handoff is idempotent.`
|
|
4991
|
+
: `Successor custody for '${target}' is unverified on this daemon: no local row with this source's lineage was found. A successor may exist on another host. This closure records a handoff claim, not proof of transfer or pickup; reconcile the successor by ID. Use 'rig queue handoff' or 'handoff-and-complete' with '--to <seat@rig>'; add '--host <registered-host>' for another host instead of manually closing to the successor ID; a local handoff is atomic, across hosts the successor is created first and the source closed after, and an uncertain result is reconciled by its exact id, since re-running the same handoff is idempotent.`,
|
|
4338
4992
|
};
|
|
4339
4993
|
}
|
|
4340
4994
|
rowToItem(row, includeWaiting = true, listed) {
|
|
4341
4995
|
// S04 — derive the pickup receipt at the ONE shared projection point (list/show/overdue
|
|
4342
4996
|
// all flow through here), so the park-vs-strand question is answered by the row face.
|
|
4343
|
-
const meaningful =
|
|
4344
|
-
|
|
4345
|
-
const
|
|
4997
|
+
const meaningful = meaningfulFor(this.db, row.qitem_id, listed?.reads);
|
|
4998
|
+
// A listing's rows are its own SELECT *: the waiting view reads the row in hand instead of reading it again.
|
|
4999
|
+
const waiting = includeWaiting ? this.waitingView(row.qitem_id, listed?.reads ? { ...listed, row } : listed) : null;
|
|
5000
|
+
const listedActivity = listed?.reads?.activity;
|
|
5001
|
+
const activity = listedActivity ? listedActivity(row.destination_session) : this.ownerActivity(row.destination_session);
|
|
4346
5002
|
const pickup = derivePickup({
|
|
4347
5003
|
state: row.state,
|
|
4348
5004
|
lastMeaningfulAt: meaningful?.at,
|
|
4349
5005
|
activity: activity?.activity,
|
|
4350
5006
|
needsInput: activity?.needsInput.count,
|
|
4351
5007
|
needsInputReason: activity?.needsInput.reason,
|
|
5008
|
+
backgroundWork: activity?.backgroundWork ?? null,
|
|
5009
|
+
compactionOwedSince: this.compactionOwedSince(row.destination_session),
|
|
4352
5010
|
claimedAt: row.claimed_at,
|
|
4353
5011
|
lastHeartbeat: row.last_heartbeat,
|
|
4354
5012
|
postClaimMotionCount: 0, // this reader supplies the current meaningful timestamp
|
|
@@ -4397,6 +5055,7 @@ export class QueueRepository {
|
|
|
4397
5055
|
// PL-007: target_repo present only when migration 038 has applied;
|
|
4398
5056
|
// older test fixtures supply legacy rows where target_repo is undefined.
|
|
4399
5057
|
targetRepo: row.target_repo ?? null,
|
|
5058
|
+
...(row.content_erased_at ? { contentErasedAt: row.content_erased_at } : {}),
|
|
4400
5059
|
};
|
|
4401
5060
|
}
|
|
4402
5061
|
}
|
|
@@ -4414,6 +5073,42 @@ function ledgerItem(row) {
|
|
|
4414
5073
|
function isOutboundOwnerNotice(t) {
|
|
4415
5074
|
return t.ownerNotificationLevel != null && t.ownerNotificationKind != null && t.ownerNotificationKind !== "human-decision-resolved";
|
|
4416
5075
|
}
|
|
5076
|
+
/** The `<connectorRef>\n<notificationKey>` pairs GET /api/gateway/relay/outbox would list now: staged in the
|
|
5077
|
+
* DispatchBuffer and the attempted store, under a connector whose listing isn't refused for an invalid envelope. A store
|
|
5078
|
+
* the outbox can't read (so it answers 503) lists nothing. */
|
|
5079
|
+
function listablePullOutboxKeys() {
|
|
5080
|
+
let pending;
|
|
5081
|
+
let attempted;
|
|
5082
|
+
try {
|
|
5083
|
+
const home = getOpenRigHome();
|
|
5084
|
+
pending = new DispatchBuffer(home).pendingStrict();
|
|
5085
|
+
const { attemptedPath, deliveredPath } = relayStatePaths(home);
|
|
5086
|
+
attempted = new SeenStore(attemptedPath).statuses();
|
|
5087
|
+
new SeenStore(deliveredPath).statuses();
|
|
5088
|
+
}
|
|
5089
|
+
catch {
|
|
5090
|
+
return new Set();
|
|
5091
|
+
}
|
|
5092
|
+
const listed = [];
|
|
5093
|
+
const refused = new Set();
|
|
5094
|
+
for (const decision of pending) {
|
|
5095
|
+
const p = decision.payload && typeof decision.payload === "object" ? decision.payload : null;
|
|
5096
|
+
const ref = p?.relayConnectorRef;
|
|
5097
|
+
if (!p || typeof ref !== "string" || !ref || !attempted.has(decision.decisionId))
|
|
5098
|
+
continue;
|
|
5099
|
+
if (!p.relayEnvelope || !validateRelayOutboundEnvelope(p.relayEnvelope).ok) {
|
|
5100
|
+
refused.add(ref);
|
|
5101
|
+
continue;
|
|
5102
|
+
}
|
|
5103
|
+
const keys = p.deliveryDigestPost && Array.isArray(p.memberReceipts) && p.memberReceipts.length > 0
|
|
5104
|
+
? p.memberReceipts.map((m) => m?.notificationKey)
|
|
5105
|
+
: [p.notificationKey || p.qitemId];
|
|
5106
|
+
for (const key of keys)
|
|
5107
|
+
if (typeof key === "string" && key)
|
|
5108
|
+
listed.push([ref, key]);
|
|
5109
|
+
}
|
|
5110
|
+
return new Set(listed.filter(([ref]) => !refused.has(ref)).map(([ref, key]) => `${ref}\n${key}`));
|
|
5111
|
+
}
|
|
4417
5112
|
function isQueueState(value) {
|
|
4418
5113
|
return typeof value === "string" && QUEUE_STATES.includes(value);
|
|
4419
5114
|
}
|