@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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { currentParkedOwnerNoInputFailure } from "./policies/parked-owner-consumer.js";
|
|
2
2
|
import { resolveEscalationOwner, ESCALATION_HOP_TAG, hasConsumedEscalationHop } from "./escalation-owner.js";
|
|
3
|
-
import {
|
|
3
|
+
import { createRecoveryLookup, recoveryId, recoveryTag } from "./queue-recovery.js";
|
|
4
4
|
import { quietHoldCustody } from "./quiet-hold-custody.js";
|
|
5
5
|
import { queueWaitNotice } from "./queue-wait-backoff.js";
|
|
6
6
|
import { lastMeaningfulTransition, pendingSince } from "./queue-waiting.js";
|
|
@@ -28,7 +28,7 @@ import { resolvePickupThresholdMinutes } from "./queue-pickup.js";
|
|
|
28
28
|
import { resolveOperatorSeat, resolveRecoveryAgentSeat, resolveSessionNodeId } from "./queue-owner.js";
|
|
29
29
|
import { nodeExecutorStoppedReason } from "./node-inventory.js";
|
|
30
30
|
import { isBoundTerminalSeat } from "./terminal-seat.js";
|
|
31
|
-
import { deriveCrossHostSuccessorId, hasLinkedSuccessor, matchesRecordedHandoffTarget, QueueRepositoryError } from "./queue-repository.js";
|
|
31
|
+
import { createLinkedSuccessorLookup, deriveCrossHostSuccessorId, hasLinkedSuccessor, matchesRecordedHandoffTarget, QueueRepositoryError } from "./queue-repository.js";
|
|
32
32
|
import { stalledPickupFinding } from "./queue-pickup.js";
|
|
33
33
|
import { SettingsStore } from "./user-settings/settings-store.js";
|
|
34
34
|
import { loadHostRegistry } from "./hosts/hosts-registry-reader.js";
|
|
@@ -86,6 +86,12 @@ export function resolveLadderSuppressionMinutes() {
|
|
|
86
86
|
export function findingDedupTag(kind, qitemId) {
|
|
87
87
|
return `stuck-sweep:${kind}:${qitemId}`;
|
|
88
88
|
}
|
|
89
|
+
/** Idempotency key of a seat's standing unclaimed-backlog notice: one open notice per seat. */
|
|
90
|
+
export function unclaimedBacklogTag(seat) {
|
|
91
|
+
return `stuck-sweep:unclaimed-backlog:${seat}`;
|
|
92
|
+
}
|
|
93
|
+
/** How many of a seat's unclaimed rows its standing notice lists by id; the rest are counted. */
|
|
94
|
+
export const UNCLAIMED_BACKLOG_LISTED_ROWS = 20;
|
|
89
95
|
/** The loop's observable heartbeat — surfaced on /healthz so a quiet sweep is cheap but
|
|
90
96
|
* never invisible, and a failing sweep is loud without needing a row. */
|
|
91
97
|
export function createStuckSweepStatus() {
|
|
@@ -95,6 +101,9 @@ export function createStuckSweepStatus() {
|
|
|
95
101
|
lastError: null,
|
|
96
102
|
consecutiveFailures: 0,
|
|
97
103
|
findingsRouted: 0,
|
|
104
|
+
findingsOpen: 0,
|
|
105
|
+
runningSince: null,
|
|
106
|
+
skippedTicks: 0,
|
|
98
107
|
};
|
|
99
108
|
return {
|
|
100
109
|
record(outcome, detail) {
|
|
@@ -102,8 +111,14 @@ export function createStuckSweepStatus() {
|
|
|
102
111
|
state.lastOutcome = outcome;
|
|
103
112
|
state.lastError = outcome === "failed" ? (detail?.error ?? "unknown error") : null;
|
|
104
113
|
state.consecutiveFailures = outcome === "failed" ? state.consecutiveFailures + 1 : 0;
|
|
105
|
-
if (detail?.
|
|
106
|
-
state.findingsRouted += detail.
|
|
114
|
+
if (detail?.created)
|
|
115
|
+
state.findingsRouted += detail.created;
|
|
116
|
+
if (detail?.open !== undefined)
|
|
117
|
+
state.findingsOpen = detail.open;
|
|
118
|
+
},
|
|
119
|
+
pass(pass) {
|
|
120
|
+
state.runningSince = pass.runningSince;
|
|
121
|
+
state.skippedTicks = pass.skippedTicks;
|
|
107
122
|
},
|
|
108
123
|
snapshot() {
|
|
109
124
|
return { ...state };
|
|
@@ -137,8 +152,10 @@ export { resolveSessionNodeId, defaultResolveOrchestrator, resolveOperatorSeat }
|
|
|
137
152
|
* ladder live again. Unrelated transitions do not change the latest marker. */
|
|
138
153
|
/** Durable custody-verification disposition: a transition note on the CLOSED source row,
|
|
139
154
|
* written by whoever performed the registered-host read (never by this detector),
|
|
140
|
-
* `custody-verified: <exact-target> <free-form how/where>`. Prefix-anchored parse;
|
|
141
|
-
*
|
|
155
|
+
* `custody-verified: <exact-target> <free-form how/where>`. Prefix-anchored parse; per note,
|
|
156
|
+
* the first whitespace-delimited word after the prefix that names one of the row's targets
|
|
157
|
+
* (itself or a comma member, matched exactly) is what that note verifies, so prose naming the
|
|
158
|
+
* successor later still verifies it while a later mention of another target doesn't (#2841).
|
|
142
159
|
* Read from the ACTIVE table AND the retention archive: the daily archiver MOVES every
|
|
143
160
|
* transition of an aged terminal qitem into `queue_transitions_archive` (the exact class
|
|
144
161
|
* custody rows belong to) while the row itself keeps participating in this sweep, so an
|
|
@@ -146,7 +163,7 @@ export { resolveSessionNodeId, defaultResolveOrchestrator, resolveOperatorSeat }
|
|
|
146
163
|
* the very finding the verifier already answered. The archive is never deleted, so the
|
|
147
164
|
* union is the complete audit history. */
|
|
148
165
|
export const CUSTODY_VERIFIED_PREFIX = "custody-verified:";
|
|
149
|
-
function custodyVerifiedTargets(db, qitemId) {
|
|
166
|
+
function custodyVerifiedTargets(db, qitemId, targets) {
|
|
150
167
|
const notes = db
|
|
151
168
|
.prepare(`SELECT transition_note FROM queue_transitions WHERE qitem_id = ? AND transition_note LIKE ?
|
|
152
169
|
UNION ALL
|
|
@@ -156,13 +173,13 @@ function custodyVerifiedTargets(db, qitemId) {
|
|
|
156
173
|
for (const { transition_note: note } of notes) {
|
|
157
174
|
if (!note)
|
|
158
175
|
continue;
|
|
159
|
-
const token
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
176
|
+
for (const token of note.slice(CUSTODY_VERIFIED_PREFIX.length).trim().split(/\s+/)) {
|
|
177
|
+
const named = [token, ...token.split(",").map((t) => t.trim())].filter(Boolean);
|
|
178
|
+
if (!named.some((t) => targets.includes(t)))
|
|
179
|
+
continue;
|
|
180
|
+
for (const t of named)
|
|
181
|
+
verified.add(t);
|
|
182
|
+
break;
|
|
166
183
|
}
|
|
167
184
|
}
|
|
168
185
|
return verified;
|
|
@@ -295,7 +312,7 @@ function legacyHumanRecipientRetained(deps, row) {
|
|
|
295
312
|
* source's receipts and dispositions before closing an existing finding; an
|
|
296
313
|
* unavailable source or an unconfirmed send supplies no resolution evidence. */
|
|
297
314
|
function deliveryResolutionEvidence(deps, kind, qitemId, now) {
|
|
298
|
-
const row = deps.queueRepo.getById(qitemId);
|
|
315
|
+
const row = deps.queueRepo.getById(qitemId, { waiting: false });
|
|
299
316
|
if (!row)
|
|
300
317
|
return null;
|
|
301
318
|
if (["done", "failed", "denied", "canceled", "handed-off"].includes(row.state)) {
|
|
@@ -389,7 +406,8 @@ export function custodyHeadline(rowId, targets, ageMinutes) {
|
|
|
389
406
|
function evidenceBody(db, c) {
|
|
390
407
|
if (c.verificationTargets?.length) {
|
|
391
408
|
const checks = c.verificationTargets
|
|
392
|
-
.map((target) => `- ${target}\n ${verificationCommand(target)}`
|
|
409
|
+
.map((target) => `- ${target}\n ${verificationCommand(target)}\n` +
|
|
410
|
+
` rig queue update ${c.row.qitemId} --note "custody-verified: ${target} <how verified>"`)
|
|
393
411
|
.join("\n");
|
|
394
412
|
return (`STUCK SWEEP FINDING (successor-verification-required)\n` +
|
|
395
413
|
`row: ${c.row.qitemId}\n` +
|
|
@@ -397,10 +415,11 @@ function evidenceBody(db, c) {
|
|
|
397
415
|
`age: ${c.ageMinutes} min\n` +
|
|
398
416
|
`last transition: ${lastTransitionLine(db, c.row.qitemId)}\n` +
|
|
399
417
|
`why: ${c.why}\n` +
|
|
400
|
-
`verification targets (indeterminate until checked on the registered host):\n${checks}\n` +
|
|
401
|
-
`After a registered-host read confirms a target, record
|
|
402
|
-
`
|
|
403
|
-
`
|
|
418
|
+
`verification targets (indeterminate until checked on the registered host), each with its check and its note:\n${checks}\n` +
|
|
419
|
+
`After a registered-host read confirms a target, record its note on the closed row so the sweep stops asking. ` +
|
|
420
|
+
`The note starts with "custody-verified:"; its first word that names one of these targets exactly is what it verifies. ` +
|
|
421
|
+
`Name several in one comma-list word (a,b), or write one note each.\n` +
|
|
422
|
+
`Do not rewrite historical custody from this local observation; the note is the separate record of the verification.`);
|
|
404
423
|
}
|
|
405
424
|
return (`STUCK SWEEP FINDING (${c.kind})\n` +
|
|
406
425
|
`row: ${c.row.qitemId}\n` +
|
|
@@ -410,17 +429,139 @@ function evidenceBody(db, c) {
|
|
|
410
429
|
`why: ${c.why}\n` +
|
|
411
430
|
`Resolve the underlying row; the sweep closes this finding itself once the row is no longer stuck.`);
|
|
412
431
|
}
|
|
432
|
+
/** The last line of a standing notice's body: every row it stands for, so the sweep knows what it covered. */
|
|
433
|
+
const BACKLOG_ROWS_PREFIX = "Every row this notice stands for: ";
|
|
434
|
+
/** A standing notice's row lines: oldest first, the first ones by id, the rest counted. */
|
|
435
|
+
function backlogListing(rows) {
|
|
436
|
+
const sorted = [...rows].sort((a, b) => a.since.localeCompare(b.since) || a.qitemId.localeCompare(b.qitemId));
|
|
437
|
+
const listed = sorted.slice(0, UNCLAIMED_BACKLOG_LISTED_ROWS).map((r) => {
|
|
438
|
+
const about = r.summary ? `: ${r.summary.replace(/\s+/g, " ").trim().slice(0, 120)}` : "";
|
|
439
|
+
return `- ${r.qitemId}, unclaimed since ${r.since}, from ${r.from}${about}`;
|
|
440
|
+
});
|
|
441
|
+
if (sorted.length > listed.length)
|
|
442
|
+
listed.push(`- and ${sorted.length - listed.length} more`);
|
|
443
|
+
return { sorted, listed, count: `${rows.length} ${rows.length === 1 ? "row" : "rows"}` };
|
|
444
|
+
}
|
|
445
|
+
/** A seat's standing unclaimed-backlog notice: its rows by id, how to list them, and how to send their findings to a seat
|
|
446
|
+
* that watches this one. Built only from the rows' fixed facts, so a pass rewrites it only when the rows change. */
|
|
447
|
+
function unclaimedBacklogText(seat, rows, thresholdMinutes, node) {
|
|
448
|
+
const { sorted, listed, count } = backlogListing(rows);
|
|
449
|
+
const edge = node ? `rig edge add ${node.rig} ${node.logicalId} <watching seat> --kind escalates_to` : "an escalates_to edge from this seat";
|
|
450
|
+
return {
|
|
451
|
+
summary: `Stuck sweep: unclaimed-backlog on ${seat} (${count})`,
|
|
452
|
+
body: `STUCK SWEEP FINDING (unclaimed-backlog)\n` +
|
|
453
|
+
`seat: ${seat}\n` +
|
|
454
|
+
`unclaimed: ${count} (the threshold is ${thresholdMinutes} min)\n` +
|
|
455
|
+
`${listed.join("\n")}\n` +
|
|
456
|
+
`why: nobody has claimed these rows, and this seat has no delegation parent and no escalates_to route, so this one ` +
|
|
457
|
+
`notice stands for them instead of a finding per row. It follows the rows as they come and go.\n` +
|
|
458
|
+
`List them: rig queue list --destination ${seat} --state pending\n` +
|
|
459
|
+
`To send these findings to a seat that watches this one, one finding per row: ${edge}\n` +
|
|
460
|
+
`The sweep closes this notice itself once every row it stands for is claimed, parked or closed.\n` +
|
|
461
|
+
`${BACKLOG_ROWS_PREFIX}${JSON.stringify(sorted.map((r) => r.qitemId))}`,
|
|
462
|
+
};
|
|
463
|
+
}
|
|
464
|
+
/** A polling hosted member's standing notice: whether it's checking in (its own inbox reads), the rows it hasn't claimed,
|
|
465
|
+
* and what to do. Its work's age runs from each row's own time, which a check-in never resets. Built from the rows' fixed
|
|
466
|
+
* facts and the member's check-in state, never a current check-in's exact time, so a pass rewrites it only when the rows
|
|
467
|
+
* or that state change. */
|
|
468
|
+
function polledBacklogText(member, rows, thresholdMinutes, checkIn, now) {
|
|
469
|
+
const { sorted, listed, count } = backlogListing(rows);
|
|
470
|
+
const recent = checkIn.state === "seen" && now.getTime() - Date.parse(checkIn.at) <= thresholdMinutes * 60_000;
|
|
471
|
+
const checkIns = recent
|
|
472
|
+
? `checking in: it read its own inbox within the last ${thresholdMinutes} min`
|
|
473
|
+
: checkIn.state === "seen"
|
|
474
|
+
? `no check-in observed since ${checkIn.at}`
|
|
475
|
+
: checkIn.state === "never" ? "no check-in observed yet" : "unknown: its check-ins couldn't be read";
|
|
476
|
+
const why = recent
|
|
477
|
+
? "it's checking in, but this work is still unclaimed. Check whether it can do this work, or route it to another seat"
|
|
478
|
+
: checkIn.state === "unknown"
|
|
479
|
+
? "nobody has claimed these rows, and whether it's reading its queue isn't known. Ask its owner, or route the work to another seat"
|
|
480
|
+
: "nobody has claimed these rows, and no read of its own inbox has been observed in that time. Ask its owner to check it's running, or route the work to another seat";
|
|
481
|
+
return {
|
|
482
|
+
summary: `Stuck sweep: unclaimed-backlog on ${member} (${count})`,
|
|
483
|
+
body: `STUCK SWEEP FINDING (unclaimed-backlog)\n` +
|
|
484
|
+
`member: ${member} (a hosted member with no wake trigger: it picks up work when it reads its own queue)\n` +
|
|
485
|
+
`check-ins: ${checkIns}\n` +
|
|
486
|
+
`unclaimed: ${count} (the threshold is ${thresholdMinutes} min)\n` +
|
|
487
|
+
`${listed.join("\n")}\n` +
|
|
488
|
+
`why: ${why}. This one notice stands for these rows instead of a finding per row, and follows them as they come and go.\n` +
|
|
489
|
+
`List them: rig queue list --destination ${member} --state pending\n` +
|
|
490
|
+
`The sweep closes this notice itself once every row it stands for is claimed, parked or closed.\n` +
|
|
491
|
+
`${BACKLOG_ROWS_PREFIX}${JSON.stringify(sorted.map((r) => r.qitemId))}`,
|
|
492
|
+
};
|
|
493
|
+
}
|
|
494
|
+
/** The rows a standing notice's body says it stands for, or null when the line is missing or unreadable: unknown, which is
|
|
495
|
+
* never read as "none". */
|
|
496
|
+
function backlogRowsOf(body) {
|
|
497
|
+
const line = body.split("\n").reverse().find((l) => l.startsWith(BACKLOG_ROWS_PREFIX));
|
|
498
|
+
if (!line)
|
|
499
|
+
return null;
|
|
500
|
+
try {
|
|
501
|
+
const ids = JSON.parse(line.slice(BACKLOG_ROWS_PREFIX.length));
|
|
502
|
+
return Array.isArray(ids) ? new Set(ids.filter((id) => typeof id === "string")) : null;
|
|
503
|
+
}
|
|
504
|
+
catch {
|
|
505
|
+
return null;
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
/** What a pass hands the status: the findings it created (the routed total grows only by these), and the finding
|
|
509
|
+
* rows still open after it. Open is read from the queue, not from the pass's actions: a finding kept open without an
|
|
510
|
+
* action (a live ladder suppresses its reporting, a grace holds it) is still open. */
|
|
511
|
+
function findingCounts(db, findings) {
|
|
512
|
+
const open = db.prepare(`SELECT COUNT(*) AS n FROM queue_items WHERE state IN ('pending', 'in-progress', 'blocked')
|
|
513
|
+
AND tags LIKE ?`).get(`%"${STUCK_SWEEP_FINDING_TAG}"%`);
|
|
514
|
+
return { created: findings.filter((f) => f.action === "created").length, open: open.n };
|
|
515
|
+
}
|
|
413
516
|
/**
|
|
414
517
|
* One sweep pass. Instance-wide (no rig scope — the loop is the net for every rig the
|
|
415
518
|
* daemon carries). Never throws: a sweep that cannot run reports outcome=failed loudly
|
|
416
519
|
* on the status surface and the log, because a silent skip is exactly the class this
|
|
417
520
|
* slice exists to kill.
|
|
418
521
|
*/
|
|
522
|
+
/** Rows a sweep pass handles between two yields of the event loop. A pass over a large queue used to hold the loop
|
|
523
|
+
* for its whole length (seconds on a queue of tens of thousands of rows, with healthz and every request waiting);
|
|
524
|
+
* every this many rows it now lets timers and requests run. */
|
|
525
|
+
export const STUCK_SWEEP_YIELD_EVERY_ROWS = 50;
|
|
526
|
+
/** ...or after this many milliseconds of work since the last yield, whichever comes first: a stretch of slow rows (or
|
|
527
|
+
* of awaited writes that resolve by microtasks alone) holds the loop no longer than this. The clock restarts after the
|
|
528
|
+
* yield, so the time others run during it does not count against the next stretch. */
|
|
529
|
+
export const STUCK_SWEEP_YIELD_AFTER_MS = 50;
|
|
419
530
|
export async function runStuckSweep(deps) {
|
|
420
531
|
const log = deps.log ?? ((line) => console.error(line));
|
|
421
532
|
const status = deps.status;
|
|
422
533
|
try {
|
|
423
534
|
const now = deps.now ?? new Date();
|
|
535
|
+
// One recovery index and one linked-successor read per stretch of the pass, instead of one json_each scan per
|
|
536
|
+
// candidate and per custody row. Each is a snapshot that is only valid while no other code runs, so both are
|
|
537
|
+
// dropped (and rebuilt on the next lookup) after every yield and every awaited write.
|
|
538
|
+
const recoveries = createRecoveryLookup(deps.db);
|
|
539
|
+
let successors = null;
|
|
540
|
+
// Every yield and every awaited write lets other code run: indexes read before it are dropped, and `othersRan`
|
|
541
|
+
// tells a list read before it that its rows need a fresh read.
|
|
542
|
+
let othersRan = 0;
|
|
543
|
+
const othersMayHaveRun = () => { othersRan++; recoveries.invalidate(); successors?.invalidate(); };
|
|
544
|
+
// A successor index whose build took at least half of a stretch that yielded by elapsed time is not rebuilt for
|
|
545
|
+
// the rest of the pass: the yield drops it, the next stretch would pay the build again and end the same way after a
|
|
546
|
+
// few rows, so the rows would pay about one build each instead of one per STUCK_SWEEP_YIELD_EVERY_ROWS. Those rows
|
|
547
|
+
// ask their own narrow query (hasLinkedSuccessor), which costs less than a rebuilt index.
|
|
548
|
+
let successorsPerRow = false;
|
|
549
|
+
// A synchronous read with both indexes lent to what it calls deep inside (a getById's waiting view and handoff
|
|
550
|
+
// advisory ask the same questions per row). Never spans an await: the lend ends when fn returns.
|
|
551
|
+
const indexed = (fn) => recoveries.run(() => (successors && !successorsPerRow ? successors.run(fn) : fn()));
|
|
552
|
+
// `if (dueToYield()) await yieldLoop();` and never a bare await per row: even an await that does not yield lets
|
|
553
|
+
// queued microtasks (other requests' continuations) run and write between two rows the snapshot still covers.
|
|
554
|
+
let rowsSinceYield = 0;
|
|
555
|
+
let lastYieldAt = performance.now();
|
|
556
|
+
const dueToYield = () => ++rowsSinceYield >= STUCK_SWEEP_YIELD_EVERY_ROWS || performance.now() - lastYieldAt >= STUCK_SWEEP_YIELD_AFTER_MS;
|
|
557
|
+
const yieldLoop = async () => {
|
|
558
|
+
const stretchMs = performance.now() - lastYieldAt;
|
|
559
|
+
successorsPerRow ||= successors !== null && stretchMs >= STUCK_SWEEP_YIELD_AFTER_MS && 2 * successors.builtMs() >= stretchMs;
|
|
560
|
+
rowsSinceYield = 0;
|
|
561
|
+
await new Promise((resolve) => setImmediate(resolve));
|
|
562
|
+
lastYieldAt = performance.now();
|
|
563
|
+
othersMayHaveRun();
|
|
564
|
+
};
|
|
424
565
|
const suppressionMinutes = deps.ladderSuppressionMinutes ?? resolveLadderSuppressionMinutes();
|
|
425
566
|
/** The dedup tags of the candidates the LADDER suppressed in this pass, and only those:
|
|
426
567
|
* a row the ladder alone would have stopped. A finding for such a row stays open,
|
|
@@ -446,42 +587,42 @@ export async function runStuckSweep(deps) {
|
|
|
446
587
|
};
|
|
447
588
|
const isRegisteredHost = deps.isRegisteredHost ?? defaultIsRegisteredHost(log);
|
|
448
589
|
const candidates = [];
|
|
590
|
+
const nowIso = now.toISOString();
|
|
591
|
+
// SQLite's LIKE ignores ASCII case; the per-row rules below match the queries they stand in for.
|
|
592
|
+
const startsWithCI = (value, prefix) => (value ?? "").toLowerCase().startsWith(prefix);
|
|
593
|
+
// Each kind's rule for ONE row, applied to the row as it is now. The loops below enumerate the rows; the same
|
|
594
|
+
// rules run again on a fresh read right before a finding is created (stillStuck), because a pass that yields
|
|
595
|
+
// cannot trust what it read before the yield: a claim, a delivered wake, a moved deadline, a note or a new
|
|
596
|
+
// successor may have landed since.
|
|
449
597
|
// Half 1 — claimed-never-closed. The claimant holds the obligation; the finding
|
|
450
598
|
// routes to them.
|
|
451
|
-
|
|
599
|
+
const overdueCandidate = (row) => {
|
|
452
600
|
if (isFindingRow(row))
|
|
453
|
-
|
|
454
|
-
|
|
601
|
+
return null;
|
|
602
|
+
return {
|
|
455
603
|
kind: "overdue-claim",
|
|
456
604
|
row,
|
|
457
605
|
route: row.destinationSession,
|
|
458
606
|
ageMinutes: minutesSince(row.closureRequiredAt ?? row.claimedAt, now),
|
|
459
607
|
evidenceAt: latestIso(lastMeaningfulTransition(deps.db, row.qitemId)?.at, row.closureRequiredAt, row.claimedAt),
|
|
460
608
|
why: "claimed and past closure_required_at with no closure",
|
|
461
|
-
}
|
|
462
|
-
|
|
463
|
-
deps.queueRepo.recordClosureOverdue(row.qitemId, { now: now.toISOString() });
|
|
464
|
-
}
|
|
465
|
-
catch (err) {
|
|
466
|
-
log(`[stuck-sweep] failed to record closure-overdue for ${row.qitemId}: ${err instanceof Error ? err.message : String(err)}`);
|
|
467
|
-
}
|
|
468
|
-
}
|
|
609
|
+
};
|
|
610
|
+
};
|
|
469
611
|
// S04 seam — a claimed row with no later motion past the pickup threshold. The
|
|
470
|
-
// pickup module remains the ONE derivation rule; this
|
|
471
|
-
const
|
|
472
|
-
|
|
473
|
-
.all();
|
|
474
|
-
for (const { qitem_id } of claimedRows) {
|
|
475
|
-
const row = deps.queueRepo.getById(qitem_id);
|
|
612
|
+
// pickup module remains the ONE derivation rule; this only enumerates and routes.
|
|
613
|
+
const stalledCandidate = (qitemId) => {
|
|
614
|
+
const row = indexed(() => deps.queueRepo.getById(qitemId, { waiting: false }));
|
|
476
615
|
if (!row || isFindingRow(row))
|
|
477
|
-
|
|
616
|
+
return null;
|
|
617
|
+
if ((row.state !== "pending" && row.state !== "in-progress") || !row.claimedAt)
|
|
618
|
+
return null;
|
|
478
619
|
const stalled = stalledPickupFinding(row);
|
|
479
620
|
if (!stalled)
|
|
480
|
-
|
|
621
|
+
return null;
|
|
481
622
|
// Keep this null arm for the 0.5.7 mechanized-pull turn-end hook that knows the in-flight row;
|
|
482
623
|
// it is the first honest row-scoped writer, and wiring reopens only in that slice.
|
|
483
624
|
const evidenceAt = latestIso(lastMeaningfulTransition(deps.db, row.qitemId)?.at, row.lastHeartbeat, row.claimedAt);
|
|
484
|
-
|
|
625
|
+
return {
|
|
485
626
|
kind: stalled.kind,
|
|
486
627
|
row,
|
|
487
628
|
route: resolveOrch(stalled.target, row) ?? stalled.target,
|
|
@@ -490,102 +631,122 @@ export async function runStuckSweep(deps) {
|
|
|
490
631
|
ageMinutes: wholeMinutesSince(evidenceAt, now),
|
|
491
632
|
evidenceAt,
|
|
492
633
|
why: stalled.evidence,
|
|
493
|
-
}
|
|
494
|
-
}
|
|
634
|
+
};
|
|
635
|
+
};
|
|
495
636
|
// The timer delivered one transition-specific notice (or recorded a failed
|
|
496
637
|
// attempt). This existing sweep owns its bounded recovery, not another full
|
|
497
638
|
// packet or a parked-owner replay. A real owner response ends the occurrence.
|
|
498
|
-
const
|
|
499
|
-
|
|
500
|
-
|
|
639
|
+
const waitCandidate = (jobId) => {
|
|
640
|
+
const job = deps.db.prepare("SELECT spec_yaml FROM watchdog_jobs WHERE job_id = ? AND state = 'active' AND policy = 'periodic-reminder'")
|
|
641
|
+
.get(jobId);
|
|
642
|
+
const notice = job ? queueWaitNotice(job.spec_yaml) : null;
|
|
501
643
|
if (!notice || now.getTime() - Date.parse(notice.at) <= resolvePickupThresholdMinutes() * 60_000)
|
|
502
|
-
|
|
503
|
-
const binding = deps.db.prepare("SELECT qitem_id FROM queue_transition_wakes WHERE wake_ref = ? AND phase = 'armed' ORDER BY transition_id DESC LIMIT 1").get(
|
|
504
|
-
const row = binding ? deps.queueRepo.getById(binding.qitem_id) : null;
|
|
505
|
-
if (!row || row.state !== "blocked" || deps.queueRepo.getParkWakeStatus(row.qitemId)?.ref !==
|
|
506
|
-
|
|
644
|
+
return null;
|
|
645
|
+
const binding = deps.db.prepare("SELECT qitem_id FROM queue_transition_wakes WHERE wake_ref = ? AND phase = 'armed' ORDER BY transition_id DESC LIMIT 1").get(jobId);
|
|
646
|
+
const row = binding ? indexed(() => deps.queueRepo.getById(binding.qitem_id, { waiting: false })) : null;
|
|
647
|
+
if (!row || row.state !== "blocked" || deps.queueRepo.getParkWakeStatus(row.qitemId)?.ref !== jobId)
|
|
648
|
+
return null;
|
|
507
649
|
const response = lastMeaningfulTransition(deps.db, row.qitemId);
|
|
508
650
|
if (response && Date.parse(response.at) > Date.parse(notice.at))
|
|
509
|
-
|
|
651
|
+
return null;
|
|
510
652
|
const ownerActivity = deps.queueRepo.ownerActivity(row.destinationSession);
|
|
511
653
|
if (ownerActivity?.activity === "working" && !ownerActivity.needsInput.count && notice.deliveryStatus === "ok")
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
ageMinutes: minutesSince(notice.at, now), evidenceAt: notice.at,
|
|
515
|
-
why: `wait notice delivery=${notice.deliveryStatus}; no later owner response; activity=${ownerActivity?.activity ?? "unknown"}; inspect exact blocker ${row.blockedOn}` }
|
|
516
|
-
}
|
|
654
|
+
return null;
|
|
655
|
+
return { kind: "unconsumed-wait", row, route: resolveOrch(row.destinationSession, row) ?? row.sourceSession,
|
|
656
|
+
ageMinutes: minutesSince(notice.at, now), evidenceAt: notice.at, jobId,
|
|
657
|
+
why: `wait notice delivery=${notice.deliveryStatus}; no later owner response; activity=${ownerActivity?.activity ?? "unknown"}; inspect exact blocker ${row.blockedOn}` };
|
|
658
|
+
};
|
|
517
659
|
// The parked policy stops repeating a positively no-input failure. Unhealthy blocked rows
|
|
518
660
|
// have no retry ladder: the same sweep/recovery route owns their actionable disposition.
|
|
519
|
-
const
|
|
520
|
-
|
|
521
|
-
const row = deps.queueRepo.getById(qitem_id);
|
|
661
|
+
const parkedCandidate = (qitemId) => {
|
|
662
|
+
const row = indexed(() => deps.queueRepo.getById(qitemId, { waiting: false }));
|
|
522
663
|
if (!row || isFindingRow(row))
|
|
523
|
-
|
|
524
|
-
|
|
664
|
+
return null;
|
|
665
|
+
if (row.state !== "blocked" || !startsWithCI(row.lastNudgeResult, "failed:"))
|
|
666
|
+
return null;
|
|
667
|
+
const wake = deps.queueRepo.getParkWakeStatus(qitemId);
|
|
525
668
|
if ((wake?.live === true && (!wake.unconsumed || wake.recoveryOwner === "queue-stuck-sweep"))
|
|
526
|
-
|| deps.queueRepo.parkWakeServedByOwnReminder(
|
|
527
|
-
|
|
528
|
-
const transitions = deps.queueRepo.listTransitions(
|
|
669
|
+
|| deps.queueRepo.parkWakeServedByOwnReminder(qitemId))
|
|
670
|
+
return null;
|
|
671
|
+
const transitions = deps.queueRepo.listTransitions(qitemId);
|
|
529
672
|
const failure = currentParkedOwnerNoInputFailure(transitions);
|
|
530
673
|
if (!failure)
|
|
531
|
-
|
|
674
|
+
return null;
|
|
532
675
|
// Another seat's incidental note is not the owner's response. This kind follows
|
|
533
676
|
// the parked policy's owner-or-state-change rule, leaving other sweep kinds alone.
|
|
534
677
|
if (transitions.some((t, i) => t.transitionId > (failure.transitionId ?? Number.POSITIVE_INFINITY)
|
|
535
678
|
&& (t.actorSession === row.destinationSession || t.state !== transitions[i - 1]?.state)))
|
|
536
|
-
|
|
537
|
-
|
|
679
|
+
return null;
|
|
680
|
+
return { kind: "parked-owner-no-input", row, route: resolveOrch(row.destinationSession, row) ?? row.sourceSession,
|
|
538
681
|
ageMinutes: minutesSince(failure.ts, now), evidenceAt: failure.ts,
|
|
539
|
-
why: `Automated parked-owner reminder refused before input (${failure.code}); repeated input stopped. Inspect the retained quota/guard or route terminal work to an agent. Original blocker remains ${row.blockedOn}` }
|
|
540
|
-
}
|
|
682
|
+
why: `Automated parked-owner reminder refused before input (${failure.code}); repeated input stopped. Inspect the retained quota/guard or route terminal work to an agent. Original blocker remains ${row.blockedOn}` };
|
|
683
|
+
};
|
|
541
684
|
// Half 2 — sender-believed-delivered-never-woken. Nobody holds it (the wake failed),
|
|
542
685
|
// so it routes to the destination's orchestrator when one is derivable. Rows with a
|
|
543
686
|
// live S01 ladder are S01's territory; an exhausted ladder is the handback and lands
|
|
544
687
|
// here exactly once (the dedup tag keeps it to one finding).
|
|
545
|
-
|
|
688
|
+
// A wake recorded unroutable because the seat's pane wasn't bound yet (#2151). Once its binding exists, deliver the
|
|
689
|
+
// row's own wake intent instead of reporting it: the intent is claimed and settled, so a startup drain doesn't send it
|
|
690
|
+
// again, and one already in flight or settled isn't sent twice. The next tick reads the new result, so a failed send
|
|
691
|
+
// is reported then. A row with a live retry ladder is left to the ladder.
|
|
692
|
+
// The rule is shared with the reachable-seat retry; a live retry ladder is this sweep's own check.
|
|
693
|
+
const wakeToRetry = (row) => deps.queueRepo.unroutableWakeRetryable(row, now)
|
|
694
|
+
&& !hasLiveLadder(deps.db, row.qitemId, now, suppressionMinutes);
|
|
695
|
+
const isHumanNotice = (row) => row.deliveryOutcome === "never-posted" || row.deliveryOutcome === "transport-failed";
|
|
696
|
+
// A hosted member with no wake trigger picks up its work by reading the queue: nothing can push work to it, by design.
|
|
697
|
+
// Its rows' unroutable wakes aren't failed deliveries, so they get no finding each; work it leaves unclaimed past the
|
|
698
|
+
// unclaimed age is listed in the member's one standing notice instead. Read once per member per pass.
|
|
699
|
+
const pollingMembers = new Map();
|
|
700
|
+
const pollsForWork = (session) => {
|
|
701
|
+
let polls = pollingMembers.get(session);
|
|
702
|
+
if (polls === undefined) {
|
|
703
|
+
polls = deps.queueRepo.isHostedMember(session) && deps.queueRepo.classifyDestinationOf(session).class === "unroutable";
|
|
704
|
+
pollingMembers.set(session, polls);
|
|
705
|
+
}
|
|
706
|
+
return polls;
|
|
707
|
+
};
|
|
708
|
+
const polledRow = (row) => !!row.lastNudgeResult?.startsWith("unroutable:") && pollsForWork(row.destinationSession);
|
|
709
|
+
/** `row` comes from findUndelivered (it carries the delivery verdict). Call it after any wake retry the row needs. */
|
|
710
|
+
const undeliveredCandidate = (row, recordSuppression) => {
|
|
546
711
|
if (isFindingRow(row))
|
|
547
|
-
|
|
548
|
-
const humanNotice = row
|
|
712
|
+
return null;
|
|
713
|
+
const humanNotice = isHumanNotice(row);
|
|
549
714
|
// A claim supersedes a retained failed wake, including on a row returned to
|
|
550
715
|
// pending. Its pickup finding must not be replaced by that historical failure;
|
|
551
716
|
// a separate human notification still needs its own delivery evidence.
|
|
552
717
|
if (!humanNotice && row.claimedAt)
|
|
553
|
-
|
|
718
|
+
return null;
|
|
554
719
|
if (!humanNotice && deps.queueRepo.isLocalHumanDecisionWithoutGateway(row))
|
|
555
|
-
|
|
720
|
+
return null;
|
|
721
|
+
if (!humanNotice && polledRow(row))
|
|
722
|
+
return null;
|
|
556
723
|
const notification = humanNotice ? deps.queueRepo.transitionLog.latestOwnerNotificationForQitem(row.qitemId) : null;
|
|
557
724
|
const resolutionNotice = notification?.ownerNotificationKind === "human-decision-resolved";
|
|
558
725
|
// Match the notification source in slack/queue-access.ts, not the agent wake's escalator.
|
|
559
726
|
const noticeOwner = row.state === "blocked" || resolutionNotice ? row.destinationSession : row.sourceSession;
|
|
560
727
|
const noticeRecipient = resolutionNotice ? notification.actorSession : row.state === "blocked" ? row.blockedOn : row.destinationSession;
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
728
|
+
// Slack answered 2xx but its body couldn't be read (slack-delivery's POSSIBLY_POSTED_CLASS): it may be in Slack.
|
|
729
|
+
const possiblyPosted = humanNotice && /\bclass=possibly-posted\b/.test(row.deliveryFailureDetail ?? "");
|
|
730
|
+
const failure = possiblyPosted
|
|
731
|
+
? `human notice may have posted to ${noticeRecipient}: Slack answered but its reply couldn't be read (${row.deliveryFailureDetail}); the gateway checks Slack for its marker before any resend`
|
|
732
|
+
: humanNotice
|
|
733
|
+
? `human notice ${row.deliveryOutcome} to ${noticeRecipient}: ${row.deliveryFailureDetail}`
|
|
734
|
+
: `wake failed (${row.lastNudgeResult ?? "failed"})`;
|
|
564
735
|
// Quiet hours: a held, turned-back or released ask belongs to its window's release job, so a failed wake, or a post
|
|
565
736
|
// not yet made, isn't "nothing retried it". A release whose post failed is a failed delivery, and a hold with no
|
|
566
737
|
// live release job is orphaned: both stay findings, with their own reason.
|
|
567
738
|
const quiet = quietHoldCustody(deps.db, row.qitemId, now);
|
|
568
739
|
if (quiet && (quiet.state === "held" || quiet.state === "released"))
|
|
569
|
-
|
|
570
|
-
// A wake recorded unroutable because the seat's pane wasn't bound yet (#2151). Once its binding exists, deliver the
|
|
571
|
-
// row's own wake intent instead of reporting it: the intent is claimed and settled, so a startup drain doesn't send it
|
|
572
|
-
// again, and one already in flight or settled isn't sent twice. The next tick reads the new result, so a failed send
|
|
573
|
-
// is reported then. A row with a live retry ladder is left to the ladder.
|
|
574
|
-
if (!humanNotice && row.lastNudgeResult?.startsWith("unroutable:")
|
|
575
|
-
&& !hasLiveLadder(deps.db, row.qitemId, now, suppressionMinutes)
|
|
576
|
-
&& deps.queueRepo.classifyDestinationOf(row.destinationSession).class === "pane-bound") {
|
|
577
|
-
await deps.queueRepo.deliverWakeForSuccessor(row.qitemId, row.destinationSession, true, row.sourceSession);
|
|
578
|
-
if (!deps.queueRepo.getById(row.qitemId)?.lastNudgeResult?.startsWith("unroutable:"))
|
|
579
|
-
continue;
|
|
580
|
-
}
|
|
740
|
+
return null;
|
|
581
741
|
// The ladder check runs LAST, so only a row the ladder ALONE would have stopped counts
|
|
582
742
|
// as ladder-suppressed (#1419). Agent wake retries do not own the separate notice to a
|
|
583
743
|
// person: a human notice is never the ladder's to suppress.
|
|
584
744
|
if (!humanNotice && hasLiveLadder(deps.db, row.qitemId, now, suppressionMinutes)) {
|
|
585
|
-
|
|
586
|
-
|
|
745
|
+
if (recordSuppression)
|
|
746
|
+
suppressedTags.add(findingDedupTag("undelivered-wake", row.qitemId));
|
|
747
|
+
return null;
|
|
587
748
|
}
|
|
588
|
-
|
|
749
|
+
return {
|
|
589
750
|
kind: humanNotice ? "undelivered-human-notice" : "undelivered-wake",
|
|
590
751
|
row,
|
|
591
752
|
route: humanNotice ? noticeOwner : resolveOrch(row.destinationSession, row) ?? row.destinationSession,
|
|
@@ -598,58 +759,56 @@ export async function runStuckSweep(deps) {
|
|
|
598
759
|
: humanNotice
|
|
599
760
|
? `${failure}; check human-notification delivery rather than retrying the agent wake`
|
|
600
761
|
: `${failure} and nothing retried it`,
|
|
601
|
-
}
|
|
602
|
-
}
|
|
762
|
+
};
|
|
763
|
+
};
|
|
764
|
+
const undeliveredNow = (qitemId) => indexed(() => deps.queueRepo.findUndelivered({ qitemId, waiting: false }))[0];
|
|
603
765
|
// The A1 net — created-with-destination rows carrying real obligations, unclaimed past
|
|
604
766
|
// the config-keyed age. Parks (state=blocked) legitimately wait and never appear here;
|
|
605
767
|
// failed-nudge rows already surfaced in half 2; laddered rows are S01's.
|
|
606
768
|
const cutoff = new Date(now.getTime() - ageMinutes * 60_000).toISOString();
|
|
607
|
-
const
|
|
608
|
-
.
|
|
609
|
-
WHERE state = 'pending'
|
|
610
|
-
AND claimed_at IS NULL
|
|
611
|
-
AND destination_session IS NOT NULL AND destination_session != ''
|
|
612
|
-
AND ts_created <= ?
|
|
613
|
-
AND (last_nudge_result IS NULL OR last_nudge_result NOT LIKE 'failed:%')`)
|
|
614
|
-
.all(cutoff);
|
|
615
|
-
for (const { qitem_id } of unclaimedRows) {
|
|
616
|
-
const row = deps.queueRepo.getById(qitem_id);
|
|
769
|
+
const unclaimedCandidate = (qitemId, recordSuppression) => {
|
|
770
|
+
const row = indexed(() => deps.queueRepo.getById(qitemId, { waiting: false }));
|
|
617
771
|
if (!row || isFindingRow(row))
|
|
618
|
-
|
|
772
|
+
return null;
|
|
773
|
+
// The query's own predicate, on the row as it is now.
|
|
774
|
+
if (row.state !== "pending" || row.claimedAt || !row.destinationSession || row.tsCreated > cutoff
|
|
775
|
+
|| startsWithCI(row.lastNudgeResult, "failed:"))
|
|
776
|
+
return null;
|
|
619
777
|
if (deps.queueRepo.isLocalHumanDecisionWithoutGateway(row))
|
|
620
|
-
|
|
778
|
+
return null;
|
|
621
779
|
const actionableAt = pendingSince(deps.db, row.qitemId) ?? row.tsCreated;
|
|
622
780
|
if (actionableAt > cutoff)
|
|
623
|
-
|
|
781
|
+
return null;
|
|
624
782
|
// #514 — an ask already posted to its registered human in the current delivery episode waits on
|
|
625
783
|
// that human; it is not stuck, and a finding would post the human again. Unposted, failed,
|
|
626
784
|
// legacy and non-human rows keep this net.
|
|
627
785
|
if (deps.queueRepo.humanNotificationPostedThisEpisode(row.qitemId))
|
|
628
|
-
|
|
786
|
+
return null;
|
|
629
787
|
// An ask placed on Steering without an alert waits on its person there by design; a finding would alert them.
|
|
630
788
|
if (deps.queueRepo.humanAskWithoutAlert(row.qitemId))
|
|
631
|
-
|
|
789
|
+
return null;
|
|
632
790
|
// Quiet hours: a held ask whose window's release job is live waits on that job, and one already released waits on
|
|
633
791
|
// its post; neither is stuck. A release whose post failed is reported once, by the undelivered-wake loop above. A
|
|
634
792
|
// hold with no live release job is stuck: nothing will ever release it.
|
|
635
793
|
const quiet = quietHoldCustody(deps.db, row.qitemId, now);
|
|
636
794
|
if (quiet && quiet.state !== "orphaned")
|
|
637
|
-
|
|
795
|
+
return null;
|
|
638
796
|
// An explicit informational update to a currently registered human is for reading, not an obligation to claim,
|
|
639
797
|
// unless its quiet-hours hold has been orphaned before release.
|
|
640
798
|
if (!quiet && deps.queueRepo.isRegisteredHumanUpdate(row))
|
|
641
|
-
|
|
799
|
+
return null;
|
|
642
800
|
// The seat's typing guard or interruption level held its wake on purpose: it's held and readable at the seat, not
|
|
643
801
|
// stuck. (A handed-off baton's one held notice is the wake ladder's.)
|
|
644
802
|
if (row.lastNudgeResult === "retained:typing_guard")
|
|
645
|
-
|
|
803
|
+
return null;
|
|
646
804
|
// The ladder check runs LAST here too: a row the ladder alone would have stopped is
|
|
647
805
|
// ladder-suppressed, and its finding stays open (#1419).
|
|
648
806
|
if (hasLiveLadder(deps.db, row.qitemId, now, suppressionMinutes)) {
|
|
649
|
-
|
|
650
|
-
|
|
807
|
+
if (recordSuppression)
|
|
808
|
+
suppressedTags.add(findingDedupTag("unclaimed-obligation", row.qitemId));
|
|
809
|
+
return null;
|
|
651
810
|
}
|
|
652
|
-
|
|
811
|
+
return {
|
|
653
812
|
kind: "unclaimed-obligation",
|
|
654
813
|
row,
|
|
655
814
|
route: resolveOrch(row.destinationSession, row) ?? row.destinationSession,
|
|
@@ -657,8 +816,23 @@ export async function runStuckSweep(deps) {
|
|
|
657
816
|
evidenceAt: actionableAt,
|
|
658
817
|
why: quiet?.state === "orphaned"
|
|
659
818
|
? `held for quiet hours (window ${quiet.windowId}) for ${minutesSince(actionableAt, now)} min, but no release job is live for that window: nothing will release it`
|
|
660
|
-
: `actionable with a destination and unclaimed for ${minutesSince(actionableAt, now)} min (threshold ${ageMinutes})`,
|
|
661
|
-
}
|
|
819
|
+
: `actionable with a destination and unclaimed for ${minutesSince(actionableAt, now)} min (threshold ${ageMinutes})${unreadableOwner(row.destinationSession) ? "; owner activity unknown (can't read the seat)" : ""}`,
|
|
820
|
+
};
|
|
821
|
+
};
|
|
822
|
+
/** The seat's activity can't be read (no reading, or one that reads unknown): said in the finding, so an unreadable
|
|
823
|
+
* seat isn't taken for one ignoring its work. The stalled finding says the same (`queue-pickup.ts`). A person has no
|
|
824
|
+
* seat to read, so their row never says so; nor does a row whose destination can't be classified, since it may be a
|
|
825
|
+
* person's. A classification fault never stops the sweep. */
|
|
826
|
+
function unreadableOwner(session) {
|
|
827
|
+
try {
|
|
828
|
+
if (deps.queueRepo.isHumanDestination(session))
|
|
829
|
+
return false;
|
|
830
|
+
}
|
|
831
|
+
catch {
|
|
832
|
+
return false;
|
|
833
|
+
}
|
|
834
|
+
const activity = deps.queueRepo.ownerActivity(session)?.activity;
|
|
835
|
+
return !activity || activity === "unknown";
|
|
662
836
|
}
|
|
663
837
|
// The custody class — a terminal row whose closure names one or more successor
|
|
664
838
|
// qitems or seat-address targets (closure_reason = 'handed_off_to'). A local miss is
|
|
@@ -682,48 +856,21 @@ export async function runStuckSweep(deps) {
|
|
|
682
856
|
// owner, so skip only recorded handoffs whose current target still matches (#341).
|
|
683
857
|
// Closures outside the recent 24-hour window without open findings are skipped so upgrading
|
|
684
858
|
// a real queue history does not raise a flood of historical findings.
|
|
685
|
-
|
|
686
|
-
const
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
for (const { tags } of deps.db
|
|
690
|
-
.prepare(`SELECT tags FROM queue_items WHERE state IN ('pending', 'in-progress', 'blocked') AND tags LIKE ?`)
|
|
691
|
-
.all(`%"${danglingPrefix}%`)) {
|
|
692
|
-
try {
|
|
693
|
-
for (const tag of JSON.parse(tags)) {
|
|
694
|
-
if (tag.startsWith(danglingPrefix)) {
|
|
695
|
-
openDanglingIds.push(tag.slice(danglingPrefix.length));
|
|
696
|
-
}
|
|
697
|
-
}
|
|
698
|
-
}
|
|
699
|
-
catch {
|
|
700
|
-
// Skip malformed tags
|
|
701
|
-
}
|
|
702
|
-
}
|
|
703
|
-
const custodyRows = deps.db
|
|
704
|
-
.prepare(
|
|
705
|
-
// Bound candidates before checking state: including handed-off in the
|
|
706
|
-
// state index scan would otherwise revisit all historical atomic handoffs.
|
|
707
|
-
`WITH custody_candidates AS MATERIALIZED (
|
|
708
|
-
SELECT qitem_id, state, handed_off_to, closure_target, closure_reason
|
|
709
|
-
FROM queue_items WHERE ts_updated >= ?
|
|
710
|
-
UNION
|
|
711
|
-
SELECT qitem_id, state, handed_off_to, closure_target, closure_reason
|
|
712
|
-
FROM queue_items WHERE qitem_id IN (SELECT value FROM json_each(?))
|
|
713
|
-
)
|
|
714
|
-
SELECT q.qitem_id FROM custody_candidates q
|
|
715
|
-
WHERE (q.state IN ('done', 'canceled') OR (q.state = 'handed-off'
|
|
716
|
-
AND (q.handed_off_to IS NULL OR q.closure_target IS NOT q.handed_off_to)))
|
|
717
|
-
AND (q.closure_target LIKE 'qitem-%' OR q.closure_reason = 'handed_off_to')`)
|
|
718
|
-
.all(custodyCutoff, JSON.stringify(openDanglingIds));
|
|
719
|
-
for (const { qitem_id } of custodyRows) {
|
|
720
|
-
const row = deps.queueRepo.getById(qitem_id);
|
|
859
|
+
/** `recheck`: read live without the lent indexes, and don't log the registry fallback a second time. */
|
|
860
|
+
const custodyCandidate = (qitemId, hasSuccessor, recheck = false) => {
|
|
861
|
+
// A recheck reads live, without the lent indexes: one row's own queries cost less than a rebuilt successor index.
|
|
862
|
+
const row = recheck ? deps.queueRepo.getById(qitemId, { waiting: false }) : indexed(() => deps.queueRepo.getById(qitemId, { waiting: false }));
|
|
721
863
|
if (!row || isFindingRow(row))
|
|
722
|
-
|
|
864
|
+
return null;
|
|
865
|
+
// The query's own predicate, on the row as it is now.
|
|
866
|
+
const closed = row.state === "done" || row.state === "canceled"
|
|
867
|
+
|| (row.state === "handed-off" && (row.handedOffTo == null || (row.closureTarget ?? null) !== row.handedOffTo));
|
|
868
|
+
if (!closed || !(startsWithCI(row.closureTarget, "qitem-") || row.closureReason === "handed_off_to"))
|
|
869
|
+
return null;
|
|
723
870
|
// Local recorded targets were filtered in SQL; remote keys use the same
|
|
724
871
|
// derivation as the cross-host close, without reading successor history.
|
|
725
872
|
if (row.state === "handed-off" && matchesRecordedHandoffTarget(row.qitemId, row.handedOffTo, row.closureTarget))
|
|
726
|
-
|
|
873
|
+
return null;
|
|
727
874
|
const targets = (row.closureTarget ?? row.handedOffTo ?? "")
|
|
728
875
|
.split(",")
|
|
729
876
|
.map((target) => target.trim())
|
|
@@ -731,7 +878,7 @@ export async function runStuckSweep(deps) {
|
|
|
731
878
|
if (targets.length === 0 && row.closureReason === "handed_off_to") {
|
|
732
879
|
targets.push("(unspecified)");
|
|
733
880
|
}
|
|
734
|
-
const verified = custodyVerifiedTargets(deps.db, row.qitemId);
|
|
881
|
+
const verified = custodyVerifiedTargets(deps.db, row.qitemId, targets);
|
|
735
882
|
const verificationTargets = targets.filter((target) => {
|
|
736
883
|
if (verified.has(target))
|
|
737
884
|
return false;
|
|
@@ -746,17 +893,17 @@ export async function runStuckSweep(deps) {
|
|
|
746
893
|
}
|
|
747
894
|
if (target === row.qitemId)
|
|
748
895
|
return true;
|
|
749
|
-
return !deps.queueRepo.getById(target);
|
|
896
|
+
return !indexed(() => deps.queueRepo.getById(target, { waiting: false }));
|
|
750
897
|
}
|
|
751
898
|
try {
|
|
752
|
-
return !
|
|
899
|
+
return !hasSuccessor(row.qitemId, target);
|
|
753
900
|
}
|
|
754
901
|
catch {
|
|
755
902
|
return true;
|
|
756
903
|
}
|
|
757
904
|
});
|
|
758
905
|
if (verificationTargets.length === 0)
|
|
759
|
-
|
|
906
|
+
return null;
|
|
760
907
|
let route = row.destinationSession;
|
|
761
908
|
try {
|
|
762
909
|
route = custodyFindingRoute(deps.db, deps.queueRepo, row);
|
|
@@ -766,9 +913,10 @@ export async function runStuckSweep(deps) {
|
|
|
766
913
|
throw err;
|
|
767
914
|
// The registry may not exist before the first human is registered. Losing
|
|
768
915
|
// owner refinement must not stop unrelated findings or their resolution.
|
|
769
|
-
|
|
916
|
+
if (!recheck)
|
|
917
|
+
log(`[stuck-sweep] keeping custody route for ${row.qitemId} at ${row.destinationSession}: ${err.message}`);
|
|
770
918
|
}
|
|
771
|
-
|
|
919
|
+
return {
|
|
772
920
|
kind: "dangling-closure",
|
|
773
921
|
row,
|
|
774
922
|
route,
|
|
@@ -776,7 +924,176 @@ export async function runStuckSweep(deps) {
|
|
|
776
924
|
evidenceAt: latestIso(row.tsUpdated),
|
|
777
925
|
why: `closed (${row.closureReason ?? "?"}) with successor custody that this local store cannot fully verify`,
|
|
778
926
|
verificationTargets,
|
|
779
|
-
}
|
|
927
|
+
};
|
|
928
|
+
};
|
|
929
|
+
const armedJobOf = (qitemId) => deps.db.prepare("SELECT wake_ref FROM queue_transition_wakes WHERE qitem_id = ? AND phase = 'armed' ORDER BY transition_id DESC LIMIT 1").get(qitemId)?.wake_ref;
|
|
930
|
+
/** A kind's rule, again, on the row as it is now (read live, without the lent indexes): the candidate it makes now,
|
|
931
|
+
* with its current route, reason and targets, or null when it no longer holds. */
|
|
932
|
+
const freshCandidate = (kind, id, jobId) => {
|
|
933
|
+
switch (kind) {
|
|
934
|
+
case "overdue-claim": {
|
|
935
|
+
const row = deps.queueRepo.findOverdue({ now: nowIso, qitemId: id, waiting: false })[0];
|
|
936
|
+
return row ? overdueCandidate(row) : null;
|
|
937
|
+
}
|
|
938
|
+
case "stalled-after-claim": return stalledCandidate(id);
|
|
939
|
+
case "unconsumed-wait": {
|
|
940
|
+
const job = jobId ?? armedJobOf(id);
|
|
941
|
+
const c = job ? waitCandidate(job) : null;
|
|
942
|
+
return c?.row.qitemId === id ? c : null;
|
|
943
|
+
}
|
|
944
|
+
case "parked-owner-no-input": return parkedCandidate(id);
|
|
945
|
+
case "undelivered-wake":
|
|
946
|
+
case "undelivered-human-notice": {
|
|
947
|
+
const row = undeliveredNow(id);
|
|
948
|
+
// the wake retry already ran in this pass; a row that still needs it now was not woken by it
|
|
949
|
+
const c = row ? undeliveredCandidate(row, false) : null;
|
|
950
|
+
return c?.kind === kind ? c : null;
|
|
951
|
+
}
|
|
952
|
+
case "unclaimed-obligation": return unclaimedCandidate(id, false);
|
|
953
|
+
case "dangling-closure": return custodyCandidate(id, (source, target) => hasLinkedSuccessor(deps.db, source, target), true);
|
|
954
|
+
default: return null;
|
|
955
|
+
}
|
|
956
|
+
};
|
|
957
|
+
/** Whether a kind's rule still holds now, leaving the routing notes (routeNotes, routed) as they were. */
|
|
958
|
+
const ruleHolds = (kind, id, jobId) => {
|
|
959
|
+
const notes = new Map(routeNotes);
|
|
960
|
+
const wasRouted = new Set(routed);
|
|
961
|
+
try {
|
|
962
|
+
return !!freshCandidate(kind, id, jobId);
|
|
963
|
+
}
|
|
964
|
+
finally {
|
|
965
|
+
routeNotes.clear();
|
|
966
|
+
for (const [k, v] of notes)
|
|
967
|
+
routeNotes.set(k, v);
|
|
968
|
+
routed.clear();
|
|
969
|
+
for (const k of wasRouted)
|
|
970
|
+
routed.add(k);
|
|
971
|
+
}
|
|
972
|
+
};
|
|
973
|
+
const stillStuck = (c) => ruleHolds(c.kind, c.row.qitemId, c.jobId);
|
|
974
|
+
/** The kinds the resolution closes on "no longer detected" alone (the others need source evidence). */
|
|
975
|
+
const resolvedByRule = new Set(["overdue-claim", "stalled-after-claim", "unconsumed-wait", "parked-owner-no-input", "dangling-closure"]);
|
|
976
|
+
// The rows each rule looks at. The id lists are judged on a fresh getById per row; the two finders return whole
|
|
977
|
+
// rows, which are read again by id once other code may have run since the list was read.
|
|
978
|
+
let listedAt = othersRan;
|
|
979
|
+
for (const listed of indexed(() => deps.queueRepo.findOverdue({ now: nowIso, waiting: false }))) {
|
|
980
|
+
if (dueToYield())
|
|
981
|
+
await yieldLoop();
|
|
982
|
+
const row = listedAt !== othersRan ? indexed(() => deps.queueRepo.findOverdue({ now: nowIso, qitemId: listed.qitemId, waiting: false }))[0] : listed;
|
|
983
|
+
const c = row ? overdueCandidate(row) : null;
|
|
984
|
+
if (!c)
|
|
985
|
+
continue;
|
|
986
|
+
candidates.push(c);
|
|
987
|
+
try {
|
|
988
|
+
// Only a transition and an event: no index or listed row changes.
|
|
989
|
+
deps.queueRepo.recordClosureOverdue(row.qitemId, { now: nowIso });
|
|
990
|
+
}
|
|
991
|
+
catch (err) {
|
|
992
|
+
log(`[stuck-sweep] failed to record closure-overdue for ${row.qitemId}: ${err instanceof Error ? err.message : String(err)}`);
|
|
993
|
+
}
|
|
994
|
+
}
|
|
995
|
+
for (const { qitem_id } of deps.db
|
|
996
|
+
.prepare("SELECT qitem_id FROM queue_items WHERE state IN ('pending', 'in-progress') AND claimed_at IS NOT NULL")
|
|
997
|
+
.all()) {
|
|
998
|
+
if (dueToYield())
|
|
999
|
+
await yieldLoop();
|
|
1000
|
+
const c = stalledCandidate(qitem_id);
|
|
1001
|
+
if (c)
|
|
1002
|
+
candidates.push(c);
|
|
1003
|
+
}
|
|
1004
|
+
for (const { job_id } of deps.db.prepare("SELECT job_id FROM watchdog_jobs WHERE state = 'active' AND policy = 'periodic-reminder'")
|
|
1005
|
+
.all()) {
|
|
1006
|
+
if (dueToYield())
|
|
1007
|
+
await yieldLoop();
|
|
1008
|
+
const c = waitCandidate(job_id);
|
|
1009
|
+
if (c)
|
|
1010
|
+
candidates.push(c);
|
|
1011
|
+
}
|
|
1012
|
+
for (const { qitem_id } of deps.db.prepare("SELECT qitem_id FROM queue_items WHERE state='blocked' AND last_nudge_result LIKE 'failed:%'")
|
|
1013
|
+
.all()) {
|
|
1014
|
+
if (dueToYield())
|
|
1015
|
+
await yieldLoop();
|
|
1016
|
+
const c = parkedCandidate(qitem_id);
|
|
1017
|
+
if (c)
|
|
1018
|
+
candidates.push(c);
|
|
1019
|
+
}
|
|
1020
|
+
listedAt = othersRan;
|
|
1021
|
+
for (const listed of indexed(() => deps.queueRepo.findUndelivered({ waiting: false }))) {
|
|
1022
|
+
if (dueToYield())
|
|
1023
|
+
await yieldLoop();
|
|
1024
|
+
let row = listedAt !== othersRan ? undeliveredNow(listed.qitemId) : listed;
|
|
1025
|
+
if (!row || isFindingRow(row))
|
|
1026
|
+
continue;
|
|
1027
|
+
if (wakeToRetry(row)) {
|
|
1028
|
+
await deps.queueRepo.deliverWakeForSuccessor(row.qitemId, row.destinationSession, true, row.sourceSession);
|
|
1029
|
+
othersMayHaveRun();
|
|
1030
|
+
// judged again on the row as the send (and anyone else during it) left it
|
|
1031
|
+
row = undeliveredNow(row.qitemId);
|
|
1032
|
+
if (!row?.lastNudgeResult?.startsWith("unroutable:"))
|
|
1033
|
+
continue;
|
|
1034
|
+
}
|
|
1035
|
+
const c = undeliveredCandidate(row, true);
|
|
1036
|
+
if (c)
|
|
1037
|
+
candidates.push(c);
|
|
1038
|
+
}
|
|
1039
|
+
for (const { qitem_id } of deps.db
|
|
1040
|
+
.prepare(`SELECT qitem_id FROM queue_items
|
|
1041
|
+
WHERE state = 'pending'
|
|
1042
|
+
AND claimed_at IS NULL
|
|
1043
|
+
AND destination_session IS NOT NULL AND destination_session != ''
|
|
1044
|
+
AND ts_created <= ?
|
|
1045
|
+
AND (last_nudge_result IS NULL OR last_nudge_result NOT LIKE 'failed:%')`)
|
|
1046
|
+
.all(cutoff)) {
|
|
1047
|
+
if (dueToYield())
|
|
1048
|
+
await yieldLoop();
|
|
1049
|
+
const c = unclaimedCandidate(qitem_id, true);
|
|
1050
|
+
if (c)
|
|
1051
|
+
candidates.push(c);
|
|
1052
|
+
}
|
|
1053
|
+
const custodyHours = deps.custodyWindowHours ?? STUCK_SWEEP_CUSTODY_WINDOW_HOURS;
|
|
1054
|
+
const custodyCutoff = new Date(now.getTime() - custodyHours * 3_600_000).toISOString();
|
|
1055
|
+
const openDanglingIds = [];
|
|
1056
|
+
const danglingPrefix = "stuck-sweep:dangling-closure:";
|
|
1057
|
+
for (const { tags } of deps.db
|
|
1058
|
+
.prepare(`SELECT tags FROM queue_items WHERE state IN ('pending', 'in-progress', 'blocked') AND tags LIKE ?`)
|
|
1059
|
+
.all(`%"${danglingPrefix}%`)) {
|
|
1060
|
+
try {
|
|
1061
|
+
for (const tag of JSON.parse(tags)) {
|
|
1062
|
+
if (tag.startsWith(danglingPrefix)) {
|
|
1063
|
+
openDanglingIds.push(tag.slice(danglingPrefix.length));
|
|
1064
|
+
}
|
|
1065
|
+
}
|
|
1066
|
+
}
|
|
1067
|
+
catch {
|
|
1068
|
+
// Skip malformed tags
|
|
1069
|
+
}
|
|
1070
|
+
}
|
|
1071
|
+
const custodyRows = deps.db
|
|
1072
|
+
.prepare(
|
|
1073
|
+
// Bound candidates before checking state: including handed-off in the
|
|
1074
|
+
// state index scan would otherwise revisit all historical atomic handoffs.
|
|
1075
|
+
`WITH custody_candidates AS MATERIALIZED (
|
|
1076
|
+
SELECT qitem_id, state, handed_off_to, closure_target, closure_reason
|
|
1077
|
+
FROM queue_items WHERE ts_updated >= ?
|
|
1078
|
+
UNION
|
|
1079
|
+
SELECT qitem_id, state, handed_off_to, closure_target, closure_reason
|
|
1080
|
+
FROM queue_items WHERE qitem_id IN (SELECT value FROM json_each(?))
|
|
1081
|
+
)
|
|
1082
|
+
SELECT q.qitem_id FROM custody_candidates q
|
|
1083
|
+
WHERE (q.state IN ('done', 'canceled') OR (q.state = 'handed-off'
|
|
1084
|
+
AND (q.handed_off_to IS NULL OR q.closure_target IS NOT q.handed_off_to)))
|
|
1085
|
+
AND (q.closure_target LIKE 'qitem-%' OR q.closure_reason = 'handed_off_to')`)
|
|
1086
|
+
.all(custodyCutoff, JSON.stringify(openDanglingIds));
|
|
1087
|
+
successors = createLinkedSuccessorLookup(deps.db, custodyRows.map((r) => r.qitem_id));
|
|
1088
|
+
const lookup = successors;
|
|
1089
|
+
for (const { qitem_id } of custodyRows) {
|
|
1090
|
+
if (dueToYield())
|
|
1091
|
+
await yieldLoop();
|
|
1092
|
+
const c = custodyCandidate(qitem_id, successorsPerRow
|
|
1093
|
+
? (source, target) => hasLinkedSuccessor(deps.db, source, target)
|
|
1094
|
+
: (source, target) => lookup.has(source, target));
|
|
1095
|
+
if (c)
|
|
1096
|
+
candidates.push(c);
|
|
780
1097
|
}
|
|
781
1098
|
// A finding for a confirmed-missing session goes to a live recovery seat when one is available,
|
|
782
1099
|
// since nothing would ever wake the missing one (the ladder covers handed-off batons only): the
|
|
@@ -790,9 +1107,9 @@ export async function runStuckSweep(deps) {
|
|
|
790
1107
|
};
|
|
791
1108
|
const sessionMissing = deps.sessionConfirmedMissing ?? ((session) => stoppedReason(session) !== null);
|
|
792
1109
|
let recoverySeats;
|
|
793
|
-
|
|
1110
|
+
const routeAroundMissing = (c) => {
|
|
794
1111
|
if (!sessionMissing(c.route))
|
|
795
|
-
|
|
1112
|
+
return;
|
|
796
1113
|
const stoppedDescription = stoppedReason(c.route) === "pane_exited"
|
|
797
1114
|
? "has a confirmed exited pane (pane_exited)" : "is confirmed missing (session_missing)";
|
|
798
1115
|
recoverySeats ??= [(deps.resolveRecoveryAgentSeat ?? resolveRecoveryAgentSeat)(), (deps.resolveOperatorSeat ?? resolveOperatorSeat)()];
|
|
@@ -801,12 +1118,12 @@ export async function runStuckSweep(deps) {
|
|
|
801
1118
|
const floor = chosen < 0 ? null : choices[chosen];
|
|
802
1119
|
if (!floor) {
|
|
803
1120
|
c.why += `; ${c.route} ${stoppedDescription} and no live recovery seat is available (operator agent, operator seat and creator are each unset, missing or this seat; an operator agent setting that's unreadable or isn't an agent's session counts as unset), so this finding stays addressed to it`;
|
|
804
|
-
|
|
1121
|
+
return;
|
|
805
1122
|
}
|
|
806
1123
|
// Name the rule that chose it, so whoever receives the finding knows why, and which setting to change.
|
|
807
1124
|
c.why += `; ${c.route} ${stoppedDescription}, so this finding goes to ${floor}, ${RECOVERY_SEAT_RULES[chosen]}`;
|
|
808
1125
|
c.route = floor;
|
|
809
|
-
}
|
|
1126
|
+
};
|
|
810
1127
|
// A destination its own wake found unroutable, and still is (no terminal, not a person: a hosted member, or a
|
|
811
1128
|
// mistyped address), can't hear its finding either; a seat launched since its wake keeps its own. A hosted member
|
|
812
1129
|
// OpenRig rings, whose work is still unclaimed (its ring failed, or it didn't pick the work up by the unclaimed
|
|
@@ -816,42 +1133,117 @@ export async function runStuckSweep(deps) {
|
|
|
816
1133
|
// unroutable or a terminal seat itself. A bound terminal seat goes the same way: the queue wake types nothing into
|
|
817
1134
|
// it, and nothing there can claim work.
|
|
818
1135
|
const classOf = (seat) => deps.queueRepo.classifyDestinationOf(seat).class;
|
|
819
|
-
for
|
|
1136
|
+
/** Who hears about work for a destination that can't hear it: the index into NO_WAKE_ROUTE_RULES and the seat, or -1. */
|
|
1137
|
+
const noWakeRecipient = (destination, creator) => {
|
|
1138
|
+
const operatorSeat = (deps.resolveOperatorSeat ?? resolveOperatorSeat)();
|
|
1139
|
+
const person = operatorSeat && classOf(operatorSeat) === "gateway-routable" ? operatorSeat : null;
|
|
1140
|
+
const choices = [person, creator, (deps.resolveRecoveryAgentSeat ?? resolveRecoveryAgentSeat)()];
|
|
1141
|
+
const chosen = choices.findIndex((seat) => !!seat && seat !== destination && !sessionMissing(seat) && classOf(seat) !== "unroutable"
|
|
1142
|
+
&& !isBoundTerminalSeat(deps.db, seat));
|
|
1143
|
+
return { chosen, seat: chosen < 0 ? null : choices[chosen] };
|
|
1144
|
+
};
|
|
1145
|
+
/** The person (the operator seat when it's a person's address) or the operator agent: recipients that may see any row. */
|
|
1146
|
+
const seesAnyRow = (seat) => {
|
|
1147
|
+
const operatorSeat = (deps.resolveOperatorSeat ?? resolveOperatorSeat)();
|
|
1148
|
+
if (operatorSeat === seat && classOf(seat) === "gateway-routable")
|
|
1149
|
+
return true;
|
|
1150
|
+
return (deps.resolveRecoveryAgentSeat ?? resolveRecoveryAgentSeat)() === seat;
|
|
1151
|
+
};
|
|
1152
|
+
const routeAroundNoWake = (c) => {
|
|
820
1153
|
if (c.route !== c.row.destinationSession)
|
|
821
|
-
|
|
1154
|
+
return;
|
|
822
1155
|
const destination = classOf(c.row.destinationSession);
|
|
823
1156
|
const noRoute = destination === "unroutable" && !!c.row.lastNudgeResult?.startsWith("unroutable:");
|
|
824
1157
|
const terminalSeat = destination === "pane-bound" && isBoundTerminalSeat(deps.db, c.row.destinationSession);
|
|
825
1158
|
if (!noRoute && !terminalSeat && !(destination === "hosted" && !c.row.claimedAt))
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
const
|
|
829
|
-
const choices = [person, c.row.sourceSession, (deps.resolveRecoveryAgentSeat ?? resolveRecoveryAgentSeat)()];
|
|
830
|
-
const chosen = choices.findIndex((seat) => !!seat && seat !== c.route && !sessionMissing(seat) && classOf(seat) !== "unroutable"
|
|
831
|
-
&& !isBoundTerminalSeat(deps.db, seat));
|
|
1159
|
+
return;
|
|
1160
|
+
c.noWake = true;
|
|
1161
|
+
const recipient = noWakeRecipient(c.route, c.row.sourceSession);
|
|
832
1162
|
c.why += noRoute
|
|
833
1163
|
? `; ${c.route} has no wake route on this daemon (no terminal, not a person). If it's a hosted member, it sees this work only when it next checks, so ask it to; otherwise fix the address`
|
|
834
1164
|
: terminalSeat
|
|
835
1165
|
? `; ${c.route} is a terminal seat; nothing there can claim this work, and no wake is typed into it. Route the work to an agent seat`
|
|
836
1166
|
: `; ${c.route} is a hosted member. OpenRig rang its trigger (${c.row.lastNudgeResult ?? "no ring recorded"}), and it hasn't claimed this work. It sees work only when it checks, so ask it to`;
|
|
837
|
-
if (
|
|
1167
|
+
if (!recipient.seat) {
|
|
838
1168
|
c.why += `. No person, creator or operator agent that can be reached is available, so this finding stays addressed to it`;
|
|
839
|
-
|
|
1169
|
+
return;
|
|
840
1170
|
}
|
|
841
|
-
c.why += `. This finding goes to ${
|
|
842
|
-
c.route =
|
|
1171
|
+
c.why += `. This finding goes to ${recipient.seat}, ${NO_WAKE_ROUTE_RULES[recipient.chosen]}`;
|
|
1172
|
+
c.route = recipient.seat;
|
|
1173
|
+
};
|
|
1174
|
+
/** The two re-routes, in order, for one candidate. */
|
|
1175
|
+
const routeCandidate = (c) => { routeAroundMissing(c); routeAroundNoWake(c); };
|
|
1176
|
+
for (const c of candidates) {
|
|
1177
|
+
if (dueToYield())
|
|
1178
|
+
await yieldLoop();
|
|
1179
|
+
routeAroundMissing(c);
|
|
1180
|
+
}
|
|
1181
|
+
for (const c of candidates) {
|
|
1182
|
+
if (dueToYield())
|
|
1183
|
+
await yieldLoop();
|
|
1184
|
+
routeAroundNoWake(c);
|
|
843
1185
|
}
|
|
844
1186
|
// Route: idempotent per (row, kind). An existing open finding refreshes its age; a
|
|
845
1187
|
// new one is created durable + waking (the create path's default nudge).
|
|
846
1188
|
const findings = [];
|
|
847
1189
|
const liveDedupTags = new Set();
|
|
1190
|
+
const candidateIds = new Set(candidates.map((c) => c.row.qitemId));
|
|
848
1191
|
// A finding that could not be created (a row whose destination no longer resolves, say) must not
|
|
849
1192
|
// stop the others: it is reported, its row stays detected, and the pass is still a failure.
|
|
850
1193
|
const failedCreates = [];
|
|
1194
|
+
// #2430: an unclaimed row whose finding would go back to its own agent seat (no delegation parent and no escalates_to
|
|
1195
|
+
// route declared) tells that seat nothing: it already holds the row. A seat that reads its rows without claiming
|
|
1196
|
+
// them, a person's front door, got one such finding per row. Those rows share one standing notice per seat instead
|
|
1197
|
+
// (below). A finding per row stays for a person's address or a terminal seat, for a declared route that failed (its
|
|
1198
|
+
// finding names why, and a declared delegation parent with no session is one), and for a row that already has a
|
|
1199
|
+
// recovery.
|
|
1200
|
+
const agentSeats = new Map();
|
|
1201
|
+
/** An agent seat's node: one whose runtime isn't a terminal, with no declared delegation parent, at an address that
|
|
1202
|
+
* isn't a person's. An address the human registry can't classify counts as a person's. null for anything else. Read
|
|
1203
|
+
* once per seat per pass. */
|
|
1204
|
+
const agentSeatNode = (session) => {
|
|
1205
|
+
if (agentSeats.has(session))
|
|
1206
|
+
return agentSeats.get(session);
|
|
1207
|
+
const nodeId = resolveSessionNodeId(deps.db, session);
|
|
1208
|
+
const node = nodeId ? deps.db.prepare(`SELECT n.logical_id AS logicalId, n.runtime AS runtime, r.name AS rig,
|
|
1209
|
+
EXISTS (SELECT 1 FROM edges e WHERE e.target_id = n.id AND e.kind = 'delegates_to') AS parent
|
|
1210
|
+
FROM nodes n JOIN rigs r ON r.id = n.rig_id WHERE n.id = ?`)
|
|
1211
|
+
.get(nodeId) : undefined;
|
|
1212
|
+
let agent = null;
|
|
1213
|
+
try {
|
|
1214
|
+
if (node && node.runtime !== "terminal" && !node.parent && !deps.queueRepo.isHumanDestination(session)) {
|
|
1215
|
+
agent = { logicalId: node.logicalId, rig: node.rig };
|
|
1216
|
+
}
|
|
1217
|
+
}
|
|
1218
|
+
catch { /* unclassifiable: a person's, as above */ }
|
|
1219
|
+
agentSeats.set(session, agent);
|
|
1220
|
+
return agent;
|
|
1221
|
+
};
|
|
1222
|
+
const selfRoutedUnclaimed = (c) => c.kind === "unclaimed-obligation"
|
|
1223
|
+
&& c.route === c.row.destinationSession && !routeNotes.has(c.row.qitemId) && agentSeatNode(c.route) !== null;
|
|
1224
|
+
// A hosted member that polls for its work (no wake trigger) can't hear a finding, so each unclaimed row went to a
|
|
1225
|
+
// person as a finding of its own. Those rows share one standing notice per member instead, unless a route the member
|
|
1226
|
+
// declares (a delegation parent or escalates_to) takes them.
|
|
1227
|
+
const polledUnclaimed = (c) => c.kind === "unclaimed-obligation" && c.noWake === true
|
|
1228
|
+
&& !routeNotes.has(c.row.qitemId) && polledRow(c.row);
|
|
1229
|
+
/** The standing notice a candidate belongs to (the seat or member it stands for), or null for a finding of its own. */
|
|
1230
|
+
const backlogKeyOf = (c) => polledUnclaimed(c) ? c.row.destinationSession : selfRoutedUnclaimed(c) ? c.route : null;
|
|
1231
|
+
const unclaimedBacklog = new Map();
|
|
851
1232
|
for (const c of [...new Map(candidates.map(c => [c.row.qitemId, c])).values()]) {
|
|
1233
|
+
if (dueToYield())
|
|
1234
|
+
await yieldLoop();
|
|
852
1235
|
const dedupTag = findingDedupTag(c.kind, c.row.qitemId);
|
|
853
|
-
const shared =
|
|
854
|
-
const
|
|
1236
|
+
const shared = recoveries.find(c.row.qitemId);
|
|
1237
|
+
const backlogKey = shared ? null : backlogKeyOf(c);
|
|
1238
|
+
if (backlogKey) {
|
|
1239
|
+
const rows = unclaimedBacklog.get(backlogKey);
|
|
1240
|
+
if (rows)
|
|
1241
|
+
rows.push(c);
|
|
1242
|
+
else
|
|
1243
|
+
unclaimedBacklog.set(backlogKey, [c]);
|
|
1244
|
+
continue;
|
|
1245
|
+
}
|
|
1246
|
+
const sharedRow = shared ? indexed(() => deps.queueRepo.getById(shared.qitemId, { waiting: false })) : null;
|
|
855
1247
|
// A later accepted deadline can expire after the previous finding closed.
|
|
856
1248
|
// Its newer time is fresh evidence even when the pickup candidate wins this row.
|
|
857
1249
|
// An OPEN recovery still owns custody.
|
|
@@ -874,7 +1266,8 @@ export async function runStuckSweep(deps) {
|
|
|
874
1266
|
const humanUpdateNotice = currentKind === "unclaimed-obligation"
|
|
875
1267
|
&& c.kind === "undelivered-human-notice"
|
|
876
1268
|
&& deps.queueRepo.isRegisteredHumanUpdate(c.row);
|
|
877
|
-
if (currentKind && currentKind !== c.kind && ((pickupOrDeadline(currentKind) && pickupOrDeadline(c.kind)) || humanUpdateNotice)
|
|
1269
|
+
if (currentKind && currentKind !== c.kind && ((pickupOrDeadline(currentKind) && pickupOrDeadline(c.kind)) || humanUpdateNotice)
|
|
1270
|
+
&& stillStuck(c)) { // the new reason must still hold on the row as it is now
|
|
878
1271
|
const marker = "\n\n--- Original finding (historical) ---\n";
|
|
879
1272
|
const original = sharedRow.body.includes(marker) ? sharedRow.body.split(marker, 2)[1] : sharedRow.body;
|
|
880
1273
|
const body = evidenceBody(deps.db, c) + marker + original;
|
|
@@ -904,33 +1297,195 @@ export async function runStuckSweep(deps) {
|
|
|
904
1297
|
findings.push({ kind: c.kind, qitemId: c.row.qitemId, findingQitemId: existing.qitem_id, action: "refreshed" });
|
|
905
1298
|
}
|
|
906
1299
|
else if (renewedDeadline || !existing || evidenceIsNewer(c.evidenceAt, existing.ts_updated)) {
|
|
1300
|
+
// The row was found stuck before the pass's later yields and awaited writes: its rule runs again on the row as
|
|
1301
|
+
// it is now, and a row that no longer qualifies gets no new finding (its dedup tag stays live this pass).
|
|
1302
|
+
// the escalation note and hop recorded at listing belong to that route; keep only what this run records
|
|
1303
|
+
routeNotes.delete(c.row.qitemId);
|
|
1304
|
+
routed.delete(c.row.qitemId);
|
|
1305
|
+
const now_ = freshCandidate(c.kind, c.row.qitemId, c.jobId);
|
|
1306
|
+
if (!now_)
|
|
1307
|
+
continue;
|
|
1308
|
+
routeCandidate(now_); // its destination, reason and targets as they are now
|
|
907
1309
|
const input = {
|
|
908
1310
|
qitemId: recoveryId(deps.db, c.row.qitemId, renewedDeadline ? c.row.closureRequiredAt : undefined),
|
|
909
1311
|
// The detector is machinery, not a seat: the obligation's own creator is the
|
|
910
1312
|
// finding's source (the workflow-exception precedent).
|
|
911
1313
|
sourceSession: c.row.sourceSession,
|
|
912
|
-
destinationSession:
|
|
913
|
-
body: evidenceBody(deps.db,
|
|
914
|
-
summary:
|
|
915
|
-
? custodyHeadline(c.row.qitemId,
|
|
916
|
-
: `Stuck sweep: ${c.kind} on ${c.row.qitemId} (${
|
|
1314
|
+
destinationSession: now_.route,
|
|
1315
|
+
body: evidenceBody(deps.db, now_) + (routeNotes.has(c.row.qitemId) ? `\nescalation route: ${routeNotes.get(c.row.qitemId)}` : ""),
|
|
1316
|
+
summary: now_.verificationTargets
|
|
1317
|
+
? custodyHeadline(c.row.qitemId, now_.verificationTargets, now_.ageMinutes)
|
|
1318
|
+
: `Stuck sweep: ${c.kind} on ${c.row.qitemId} (${now_.ageMinutes} min)`,
|
|
917
1319
|
evidenceRef: `rig queue show ${c.row.qitemId}`,
|
|
918
1320
|
tags: [STUCK_SWEEP_FINDING_TAG, dedupTag, recoveryTag(c.row.qitemId),
|
|
919
|
-
...(routed.has(c.row.qitemId) ||
|
|
1321
|
+
...(routed.has(c.row.qitemId) || now_.row.tags?.includes(ESCALATION_HOP_TAG) ? [ESCALATION_HOP_TAG] : []),
|
|
1322
|
+
...(now_.row.tags ?? []).filter((tag) => /^(project|mission|slice):/.test(tag))],
|
|
920
1323
|
// OpenRig's own finding, whoever created the stuck row.
|
|
921
1324
|
wakeTrigger: "openrig",
|
|
922
1325
|
};
|
|
923
1326
|
try {
|
|
924
1327
|
const created = await deps.queueRepo.create(input);
|
|
1328
|
+
othersMayHaveRun();
|
|
925
1329
|
findings.push({ kind: c.kind, qitemId: c.row.qitemId, findingQitemId: created.qitemId, action: "created" });
|
|
926
1330
|
}
|
|
927
1331
|
catch (err) {
|
|
928
|
-
const message = `${c.kind} finding for ${c.row.qitemId} to ${
|
|
1332
|
+
const message = `${c.kind} finding for ${c.row.qitemId} to ${now_.route} not created: ${err instanceof Error ? err.message : String(err)}`;
|
|
1333
|
+
othersMayHaveRun();
|
|
929
1334
|
log(`[stuck-sweep] ${message}`);
|
|
930
1335
|
failedCreates.push(message);
|
|
931
1336
|
}
|
|
932
1337
|
}
|
|
933
1338
|
}
|
|
1339
|
+
// A seat's standing notice for those rows. It stands for every row it has listed until that row is resolved at its
|
|
1340
|
+
// source (the evidence a finding per row needs to close: claimed, parked, closed) or gets a finding of its own, so a
|
|
1341
|
+
// detection filter (a raised threshold, the wake ladder) never reads as done. While any is left it stays open and is
|
|
1342
|
+
// rewritten in place; once none is, the sweep closes it. A closed notice, dismissed or resolved, holds back only the
|
|
1343
|
+
// rows it stood for, each only until it has newer evidence than the close: any other row files a new notice. It wakes
|
|
1344
|
+
// the seat once, when it's filed.
|
|
1345
|
+
const backlogRow = (c) => ({ qitemId: c.row.qitemId, since: c.evidenceAt, from: c.row.sourceSession, summary: c.row.summary });
|
|
1346
|
+
const backlogPrefix = unclaimedBacklogTag("");
|
|
1347
|
+
const backlogSeats = new Set(unclaimedBacklog.keys());
|
|
1348
|
+
for (const { tags } of deps.db.prepare(`SELECT tags FROM queue_items WHERE state IN ('pending', 'in-progress', 'blocked')
|
|
1349
|
+
AND (tags LIKE '%"stuck-sweep:%') AND tags LIKE ?`).all(`%"${backlogPrefix}%`)) {
|
|
1350
|
+
try {
|
|
1351
|
+
for (const tag of JSON.parse(tags))
|
|
1352
|
+
if (tag.startsWith(backlogPrefix))
|
|
1353
|
+
backlogSeats.add(tag.slice(backlogPrefix.length));
|
|
1354
|
+
}
|
|
1355
|
+
catch { /* Skip malformed tags */ }
|
|
1356
|
+
}
|
|
1357
|
+
for (const seat of backlogSeats) {
|
|
1358
|
+
if (dueToYield())
|
|
1359
|
+
await yieldLoop();
|
|
1360
|
+
const rows = unclaimedBacklog.get(seat) ?? [];
|
|
1361
|
+
const tag = unclaimedBacklogTag(seat);
|
|
1362
|
+
liveDedupTags.add(tag);
|
|
1363
|
+
const node = agentSeatNode(seat);
|
|
1364
|
+
// A polling member's notice says whether it's checking in; an agent seat's names the route to add instead.
|
|
1365
|
+
const polled = rows.length > 0 ? rows.some(polledUnclaimed) : pollsForWork(seat);
|
|
1366
|
+
const backlogText = (standsFor) => polled
|
|
1367
|
+
? polledBacklogText(seat, standsFor, ageMinutes, deps.queueRepo.lastInboxCheckIn(seat), now)
|
|
1368
|
+
: unclaimedBacklogText(seat, standsFor, ageMinutes, node);
|
|
1369
|
+
// A polling member's notice goes where its rows' findings went: the person, else their creator when they share one,
|
|
1370
|
+
// else the operator agent. With none, it stays with the member, which reads it when it next checks.
|
|
1371
|
+
const recipientFor = (creators) => {
|
|
1372
|
+
if (!polled)
|
|
1373
|
+
return seat;
|
|
1374
|
+
const distinct = [...new Set(creators)];
|
|
1375
|
+
return noWakeRecipient(seat, distinct.length === 1 ? distinct[0] : null).seat ?? seat;
|
|
1376
|
+
};
|
|
1377
|
+
/** Files a notice and wakes its recipient; false when the create failed (reported in failedCreates). */
|
|
1378
|
+
const fileNotice = async (text, recipient) => {
|
|
1379
|
+
try {
|
|
1380
|
+
const created = await deps.queueRepo.create({
|
|
1381
|
+
// A notice about a seat's own rows comes from that seat, as a restore notice does; OpenRig wakes its recipient.
|
|
1382
|
+
sourceSession: seat,
|
|
1383
|
+
destinationSession: recipient,
|
|
1384
|
+
body: text.body,
|
|
1385
|
+
summary: text.summary,
|
|
1386
|
+
evidenceRef: `rig queue list --destination ${seat} --state pending`,
|
|
1387
|
+
tags: [STUCK_SWEEP_FINDING_TAG, tag],
|
|
1388
|
+
wakeTrigger: "openrig",
|
|
1389
|
+
});
|
|
1390
|
+
othersMayHaveRun();
|
|
1391
|
+
findings.push({ kind: "unclaimed-backlog", qitemId: seat, findingQitemId: created.qitemId, action: "created" });
|
|
1392
|
+
return true;
|
|
1393
|
+
}
|
|
1394
|
+
catch (err) {
|
|
1395
|
+
const message = `unclaimed-backlog notice for ${seat} not created: ${err instanceof Error ? err.message : String(err)}`;
|
|
1396
|
+
othersMayHaveRun();
|
|
1397
|
+
log(`[stuck-sweep] ${message}`);
|
|
1398
|
+
failedCreates.push(message);
|
|
1399
|
+
return false;
|
|
1400
|
+
}
|
|
1401
|
+
};
|
|
1402
|
+
const last = deps.db
|
|
1403
|
+
.prepare(
|
|
1404
|
+
// The first term lets the planner use idx_queue_items_recovery_tags, as the finding lookup above does.
|
|
1405
|
+
`SELECT qitem_id, state, ts_updated, summary, body, destination_session FROM queue_items
|
|
1406
|
+
WHERE (tags LIKE '%"stuck-sweep:%') AND tags LIKE ? ESCAPE '\\'
|
|
1407
|
+
ORDER BY CASE WHEN state IN ('pending', 'in-progress', 'blocked') THEN 0 ELSE 1 END,
|
|
1408
|
+
ts_updated DESC, ts_created DESC, qitem_id DESC
|
|
1409
|
+
LIMIT 1`)
|
|
1410
|
+
.get(`%"${tag.replace(/[\\%_]/g, (ch) => `\\${ch}`)}"%`);
|
|
1411
|
+
if (last && ["pending", "in-progress", "blocked"].includes(last.state)) {
|
|
1412
|
+
const listedNow = new Set(rows.map((c) => c.row.qitemId));
|
|
1413
|
+
const stoodFor = backlogRowsOf(last.body);
|
|
1414
|
+
const still = [...(stoodFor ?? [])].filter((id) => !listedNow.has(id)).flatMap((id) => {
|
|
1415
|
+
const row = indexed(() => deps.queueRepo.getById(id, { waiting: false }));
|
|
1416
|
+
// Gone, someone else's now, resolved at its source, or held by a finding or recovery of its own: one actually
|
|
1417
|
+
// written, so a create that failed this pass leaves the row here.
|
|
1418
|
+
if (!row || row.destinationSession !== seat || recoveries.find(id)
|
|
1419
|
+
|| deliveryResolutionEvidence(deps, "unclaimed-obligation", id, now))
|
|
1420
|
+
return [];
|
|
1421
|
+
return [{ qitemId: id, since: pendingSince(deps.db, id) ?? row.tsCreated, from: row.sourceSession, summary: row.summary }];
|
|
1422
|
+
});
|
|
1423
|
+
const standsFor = [...rows.map(backlogRow), ...still];
|
|
1424
|
+
// With its list unreadable, the notice may still stand for rows: it's left as it is, never closed.
|
|
1425
|
+
if (standsFor.length === 0 && !stoodFor) {
|
|
1426
|
+
findings.push({ kind: "unclaimed-backlog", qitemId: seat, findingQitemId: last.qitem_id, action: "refreshed" });
|
|
1427
|
+
continue;
|
|
1428
|
+
}
|
|
1429
|
+
if (standsFor.length === 0) {
|
|
1430
|
+
await deps.queueRepo.update({
|
|
1431
|
+
qitemId: last.qitem_id,
|
|
1432
|
+
actorSession: "stuck-sweep@system",
|
|
1433
|
+
state: "done",
|
|
1434
|
+
closureReason: "no-follow-on",
|
|
1435
|
+
transitionNote: `stuck-sweep resolved: unclaimed-backlog on ${seat}: every row it stood for is claimed, parked, closed or has its own finding`,
|
|
1436
|
+
});
|
|
1437
|
+
othersMayHaveRun();
|
|
1438
|
+
findings.push({ kind: "unclaimed-backlog", qitemId: seat, findingQitemId: last.qitem_id, action: "closed" });
|
|
1439
|
+
continue;
|
|
1440
|
+
}
|
|
1441
|
+
// A notice that went to one of its rows' creators (no person reachable) shows that creator only rows it sent. When a
|
|
1442
|
+
// row from anyone else would join it, one notice for every row it stands for goes where a new notice would go now,
|
|
1443
|
+
// which wakes that recipient, and only then does this one close: a notice the sweep closed holds its rows back, so a
|
|
1444
|
+
// failed create leaves it open as it was (not rewritten), and the next pass tries again. A person, the operator
|
|
1445
|
+
// agent and the member see any of the rows.
|
|
1446
|
+
if (polled && last.destination_session !== seat && !seesAnyRow(last.destination_session)
|
|
1447
|
+
&& standsFor.some((r) => r.from !== last.destination_session)) {
|
|
1448
|
+
const recipient = recipientFor(standsFor.map((r) => r.from));
|
|
1449
|
+
if (!(await fileNotice(backlogText(standsFor), recipient)))
|
|
1450
|
+
continue;
|
|
1451
|
+
await deps.queueRepo.update({
|
|
1452
|
+
qitemId: last.qitem_id,
|
|
1453
|
+
actorSession: "stuck-sweep@system",
|
|
1454
|
+
state: "done",
|
|
1455
|
+
closureReason: "no-follow-on",
|
|
1456
|
+
transitionNote: `stuck-sweep re-filed: unclaimed-backlog on ${seat}: a row it stands for didn't come from ${last.destination_session}, the creator it went to; one notice for every row went to ${recipient}`,
|
|
1457
|
+
});
|
|
1458
|
+
othersMayHaveRun();
|
|
1459
|
+
findings.push({ kind: "unclaimed-backlog", qitemId: seat, findingQitemId: last.qitem_id, action: "closed" });
|
|
1460
|
+
continue;
|
|
1461
|
+
}
|
|
1462
|
+
const text = backlogText(standsFor);
|
|
1463
|
+
if (text.summary !== last.summary || text.body !== last.body) {
|
|
1464
|
+
deps.db.prepare("UPDATE queue_items SET body = ?, summary = ? WHERE qitem_id = ? AND body = ? AND summary IS ? AND state IN ('pending', 'in-progress', 'blocked')")
|
|
1465
|
+
.run(text.body, text.summary, last.qitem_id, last.body, last.summary);
|
|
1466
|
+
}
|
|
1467
|
+
findings.push({ kind: "unclaimed-backlog", qitemId: seat, findingQitemId: last.qitem_id, action: "refreshed" });
|
|
1468
|
+
continue;
|
|
1469
|
+
}
|
|
1470
|
+
if (rows.length === 0)
|
|
1471
|
+
continue;
|
|
1472
|
+
// Each row's rule again, on the row as it is now, as a finding per row is checked right before it's created.
|
|
1473
|
+
const current = rows.flatMap((c) => {
|
|
1474
|
+
routeNotes.delete(c.row.qitemId);
|
|
1475
|
+
routed.delete(c.row.qitemId);
|
|
1476
|
+
const now_ = freshCandidate(c.kind, c.row.qitemId);
|
|
1477
|
+
if (now_)
|
|
1478
|
+
routeCandidate(now_);
|
|
1479
|
+
return now_ && backlogKeyOf(now_) === seat && !recoveries.find(now_.row.qitemId) ? [now_] : [];
|
|
1480
|
+
});
|
|
1481
|
+
if (current.length === 0)
|
|
1482
|
+
continue;
|
|
1483
|
+
// A closed notice whose list is unreadable holds back every row, each until it has newer evidence than the close.
|
|
1484
|
+
const covered = last ? backlogRowsOf(last.body) : null;
|
|
1485
|
+
if (last && !current.some((c) => (covered !== null && !covered.has(c.row.qitemId)) || evidenceIsNewer(c.evidenceAt, last.ts_updated)))
|
|
1486
|
+
continue;
|
|
1487
|
+
await fileNotice(backlogText(current.map(backlogRow)), recipientFor(current.map((c) => c.row.sourceSession)));
|
|
1488
|
+
}
|
|
934
1489
|
// Resolution: an open finding whose underlying condition is no longer detected closes
|
|
935
1490
|
// with its reason — the sweep cleans up after itself, no human unwind.
|
|
936
1491
|
const openFindings = deps.db
|
|
@@ -939,6 +1494,8 @@ export async function runStuckSweep(deps) {
|
|
|
939
1494
|
AND tags LIKE ?`)
|
|
940
1495
|
.all(`%"${STUCK_SWEEP_FINDING_TAG}"%`);
|
|
941
1496
|
for (const f of openFindings) {
|
|
1497
|
+
if (dueToYield())
|
|
1498
|
+
await yieldLoop();
|
|
942
1499
|
let tags = [];
|
|
943
1500
|
try {
|
|
944
1501
|
tags = JSON.parse(f.tags);
|
|
@@ -955,6 +1512,10 @@ export async function runStuckSweep(deps) {
|
|
|
955
1512
|
// prove resolution either: delivery/pickup findings need source evidence.
|
|
956
1513
|
if (suppressedTags.has(dedupTag))
|
|
957
1514
|
continue;
|
|
1515
|
+
// #2661: a claim working only on a grace (a background shell, a pending managed restore) is not resolved: the
|
|
1516
|
+
// grace stops new detection, and an open stall recovery stays open, so the ceiling's expiry stays actionable.
|
|
1517
|
+
if (kind === "stalled-after-claim" && stuckId && deps.queueRepo.getById(stuckId, { waiting: false })?.pickup?.grace)
|
|
1518
|
+
continue;
|
|
958
1519
|
let resolution = "no longer detected";
|
|
959
1520
|
if (stuckId && (kind === "undelivered-wake" || kind === "undelivered-human-notice" || kind === "unclaimed-obligation")) {
|
|
960
1521
|
const evidence = deliveryResolutionEvidence(deps, kind, stuckId, now);
|
|
@@ -962,6 +1523,17 @@ export async function runStuckSweep(deps) {
|
|
|
962
1523
|
continue;
|
|
963
1524
|
resolution = evidence;
|
|
964
1525
|
}
|
|
1526
|
+
// The list was read before this loop's yields: the finding's owner may have closed it since (done -> done is
|
|
1527
|
+
// refused, and would fail the whole pass).
|
|
1528
|
+
const current = deps.db.prepare("SELECT state FROM queue_items WHERE qitem_id = ?").get(f.qitem_id);
|
|
1529
|
+
if (!current || !["pending", "in-progress", "blocked"].includes(current.state))
|
|
1530
|
+
continue;
|
|
1531
|
+
// "No longer detected" rests on lists read before this loop's yields: a row that came back (blocked, then
|
|
1532
|
+
// in-progress past its deadline) during the pass still holds, so its rule runs again on the row as it is now.
|
|
1533
|
+
// (A row this pass did find, whose finding isn't live because another recovery now holds its custody, closes as
|
|
1534
|
+
// the base closed it.)
|
|
1535
|
+
if (kind && stuckId && resolvedByRule.has(kind) && !candidateIds.has(stuckId) && ruleHolds(kind, stuckId))
|
|
1536
|
+
continue;
|
|
965
1537
|
await deps.queueRepo.update({
|
|
966
1538
|
qitemId: f.qitem_id,
|
|
967
1539
|
// The sweep performed this transition; ownership stays on the existing row.
|
|
@@ -970,6 +1542,7 @@ export async function runStuckSweep(deps) {
|
|
|
970
1542
|
closureReason: "no-follow-on",
|
|
971
1543
|
transitionNote: `stuck-sweep resolved: ${kind ?? "finding"} on ${stuckId ?? "row"} ${resolution}`,
|
|
972
1544
|
});
|
|
1545
|
+
othersMayHaveRun();
|
|
973
1546
|
if (kind && stuckId) {
|
|
974
1547
|
findings.push({
|
|
975
1548
|
kind: kind,
|
|
@@ -982,11 +1555,11 @@ export async function runStuckSweep(deps) {
|
|
|
982
1555
|
if (failedCreates.length > 0) {
|
|
983
1556
|
// Not a clean or complete pass: say so, while keeping the findings that were made.
|
|
984
1557
|
const error = failedCreates.join("; ");
|
|
985
|
-
status?.record("failed", { error,
|
|
1558
|
+
status?.record("failed", { error, ...findingCounts(deps.db, findings) });
|
|
986
1559
|
return { outcome: "failed", findings, error };
|
|
987
1560
|
}
|
|
988
1561
|
const outcome = findings.length > 0 ? "findings" : "clean";
|
|
989
|
-
status?.record(outcome,
|
|
1562
|
+
status?.record(outcome, findingCounts(deps.db, findings));
|
|
990
1563
|
return { outcome, findings };
|
|
991
1564
|
}
|
|
992
1565
|
catch (err) {
|