@openrig/cli 0.7.12 → 0.7.14
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 +5 -5
- package/daemon/assets/plugins/openrig/.claude-plugin/icon.png +0 -0
- package/daemon/assets/plugins/openrig/.claude-plugin/plugin.json +2 -2
- package/daemon/assets/plugins/openrig/.codex-plugin/plugin.json +4 -2
- package/daemon/assets/plugins/openrig/.cursor-plugin/plugin.json +1 -1
- package/daemon/assets/plugins/openrig/plugin.json +2 -2
- package/daemon/assets/plugins/openrig/skills/working-with-an-openrig-team/SKILL.md +7 -0
- package/daemon/assets/plugins/openrig-core/.claude-plugin/plugin.json +2 -2
- package/daemon/assets/plugins/openrig-core/.codex-plugin/plugin.json +5 -3
- package/daemon/assets/plugins/openrig-core/README.md +6 -0
- package/daemon/assets/plugins/openrig-core/hooks/scripts/activity-relay.cjs +125 -0
- package/daemon/assets/plugins/openrig-core/hooks/scripts/refocus.cjs +24 -1
- package/daemon/assets/skills/rigs/SKILL.md +11 -4
- 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 +87 -22
- package/daemon/context-packs/reference/getting-started.md +30 -13
- package/daemon/context-packs/reference/manifest.yaml +1 -1
- package/daemon/context-packs/reference/rig-spec.md +18 -0
- package/daemon/context-packs/reference/tmux-servers.md +10 -1
- package/daemon/context-packs/reference/whats-new.md +302 -179
- package/daemon/context-packs/skills/agent-operated-software/manifest.yaml +1 -1
- package/daemon/context-packs/skills/agent-operated-workflows/manifest.yaml +1 -1
- package/daemon/context-packs/skills/applying-a-permission-policy/manifest.yaml +1 -1
- package/daemon/context-packs/skills/claude-compaction-restore/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/agent-starters/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/agent-startup-and-context-ingestion/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/cross-host-rig-commands/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/human-in-the-loop/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/messaging-the-human/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/openrig-architect/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/openrig-cmux/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/openrig-herdr/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/openrig-skills/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/openrig-software-factory/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/openrig-upgrade/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/rig-bundles-and-shareable-artifacts/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/rig-lifecycle/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/session-source-fork/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/specification-system/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/topology-mutation-and-seat-management/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/watchdog/SKILL.md +5 -0
- package/daemon/context-packs/skills/core/watchdog/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/working-with-an-openrig-team/SKILL.md +7 -0
- package/daemon/context-packs/skills/core/working-with-an-openrig-team/manifest.yaml +1 -1
- package/daemon/context-packs/skills/delegating-work/manifest.yaml +1 -1
- package/daemon/context-packs/skills/forming-an-openrig-mental-model/manifest.yaml +1 -1
- package/daemon/context-packs/skills/loading-addressable-markdown/manifest.yaml +1 -1
- package/daemon/context-packs/skills/mission-slice-sop/manifest.yaml +1 -1
- package/daemon/context-packs/skills/openrig-operating-model/manifest.yaml +1 -1
- package/daemon/context-packs/skills/openrig-user/manifest.yaml +1 -1
- package/daemon/context-packs/skills/orienting-to-an-inherited-seat/manifest.yaml +1 -1
- package/daemon/context-packs/skills/pm/backlog-capture/manifest.yaml +1 -1
- package/daemon/context-packs/skills/pm/context-builder/manifest.yaml +1 -1
- package/daemon/context-packs/skills/pm/exec-summary/manifest.yaml +1 -1
- package/daemon/context-packs/skills/pm/office-hours/manifest.yaml +1 -1
- package/daemon/context-packs/skills/pm/plan-review/manifest.yaml +1 -1
- package/daemon/context-packs/skills/pm/requirements-writer/manifest.yaml +1 -1
- package/daemon/context-packs/skills/pm/ui-mockup/manifest.yaml +1 -1
- package/daemon/context-packs/skills/pods/development-team/manifest.yaml +1 -1
- package/daemon/context-packs/skills/pods/orchestration-team/manifest.yaml +1 -1
- package/daemon/context-packs/skills/pods/oversight-team/manifest.yaml +1 -1
- package/daemon/context-packs/skills/pods/review-team/manifest.yaml +1 -1
- package/daemon/context-packs/skills/process/agent-browser/manifest.yaml +1 -1
- package/daemon/context-packs/skills/process/context-engineering/manifest.yaml +1 -1
- package/daemon/context-packs/skills/process/dogfood/manifest.yaml +1 -1
- package/daemon/context-packs/skills/process/frontend-design/manifest.yaml +1 -1
- package/daemon/context-packs/skills/process/systematic-debugging/manifest.yaml +1 -1
- package/daemon/context-packs/skills/process/test-driven-development/manifest.yaml +1 -1
- package/daemon/context-packs/skills/process/verification-before-completion/manifest.yaml +1 -1
- package/daemon/context-packs/skills/queue-handoff/manifest.yaml +1 -1
- package/daemon/context-packs/skills/refocusing/manifest.yaml +1 -1
- package/daemon/context-packs/skills/retiring-and-inheriting-a-seat/manifest.yaml +1 -1
- package/daemon/context-packs/skills/seat-continuity-and-handover/manifest.yaml +1 -1
- package/daemon/context-packs/skills/session-compaction-and-restore/manifest.yaml +1 -1
- package/daemon/context-packs/skills/software-for-agents/manifest.yaml +1 -1
- package/daemon/context-packs/world-example/manifest.yaml +1 -1
- package/daemon/context-packs/world-public/manifest.yaml +1 -1
- package/daemon/dist/adapters/claude-code-adapter.d.ts.map +1 -1
- package/daemon/dist/adapters/claude-code-adapter.js +27 -4
- package/daemon/dist/adapters/claude-code-adapter.js.map +1 -1
- package/daemon/dist/adapters/codex-runtime-adapter.d.ts +11 -2
- package/daemon/dist/adapters/codex-runtime-adapter.d.ts.map +1 -1
- package/daemon/dist/adapters/codex-runtime-adapter.js +32 -9
- package/daemon/dist/adapters/codex-runtime-adapter.js.map +1 -1
- package/daemon/dist/adapters/pi-runner.d.ts +49 -1
- package/daemon/dist/adapters/pi-runner.d.ts.map +1 -1
- package/daemon/dist/adapters/pi-runner.js +343 -28
- package/daemon/dist/adapters/pi-runner.js.map +1 -1
- package/daemon/dist/adapters/tmux-exec.d.ts +4 -4
- package/daemon/dist/adapters/tmux-exec.d.ts.map +1 -1
- package/daemon/dist/adapters/tmux-exec.js +37 -8
- package/daemon/dist/adapters/tmux-exec.js.map +1 -1
- package/daemon/dist/adapters/tmux-server.d.ts +9 -1
- package/daemon/dist/adapters/tmux-server.d.ts.map +1 -1
- package/daemon/dist/adapters/tmux-server.js +36 -4
- package/daemon/dist/adapters/tmux-server.js.map +1 -1
- package/daemon/dist/adapters/tmux.d.ts +9 -0
- package/daemon/dist/adapters/tmux.d.ts.map +1 -1
- package/daemon/dist/adapters/tmux.js +23 -3
- package/daemon/dist/adapters/tmux.js.map +1 -1
- package/daemon/dist/attention-surface.d.ts +8 -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/connection-contract-surface.d.ts +2 -0
- package/daemon/dist/connection-contract-surface.d.ts.map +1 -0
- package/daemon/dist/connection-contract-surface.js +4 -0
- package/daemon/dist/connection-contract-surface.js.map +1 -0
- package/daemon/dist/db/all-migrations.d.ts.map +1 -1
- package/daemon/dist/db/all-migrations.js +12 -0
- package/daemon/dist/db/all-migrations.js.map +1 -1
- package/daemon/dist/db/migrations/160_network_bindings.d.ts +7 -0
- package/daemon/dist/db/migrations/160_network_bindings.d.ts.map +1 -0
- package/daemon/dist/db/migrations/160_network_bindings.js +26 -0
- package/daemon/dist/db/migrations/160_network_bindings.js.map +1 -0
- package/daemon/dist/db/migrations/161_network_receipts.d.ts +8 -0
- package/daemon/dist/db/migrations/161_network_receipts.d.ts.map +1 -0
- package/daemon/dist/db/migrations/161_network_receipts.js +25 -0
- package/daemon/dist/db/migrations/161_network_receipts.js.map +1 -0
- package/daemon/dist/db/migrations/162_session_address_read_indexes.d.ts +5 -0
- package/daemon/dist/db/migrations/162_session_address_read_indexes.d.ts.map +1 -0
- package/daemon/dist/db/migrations/162_session_address_read_indexes.js +12 -0
- package/daemon/dist/db/migrations/162_session_address_read_indexes.js.map +1 -0
- package/daemon/dist/db/migrations/163_network_installations.d.ts +7 -0
- package/daemon/dist/db/migrations/163_network_installations.d.ts.map +1 -0
- package/daemon/dist/db/migrations/163_network_installations.js +23 -0
- package/daemon/dist/db/migrations/163_network_installations.js.map +1 -0
- package/daemon/dist/db/migrations/164_queue_items_reply_to_index.d.ts +5 -0
- package/daemon/dist/db/migrations/164_queue_items_reply_to_index.d.ts.map +1 -0
- package/daemon/dist/db/migrations/164_queue_items_reply_to_index.js +9 -0
- package/daemon/dist/db/migrations/164_queue_items_reply_to_index.js.map +1 -0
- package/daemon/dist/db/migrations/166_queue_list_read_indexes.d.ts +4 -0
- package/daemon/dist/db/migrations/166_queue_list_read_indexes.d.ts.map +1 -0
- package/daemon/dist/db/migrations/166_queue_list_read_indexes.js +17 -0
- package/daemon/dist/db/migrations/166_queue_list_read_indexes.js.map +1 -0
- package/daemon/dist/domain/agent-activity-store.d.ts +8 -0
- package/daemon/dist/domain/agent-activity-store.d.ts.map +1 -1
- package/daemon/dist/domain/agent-activity-store.js +14 -0
- package/daemon/dist/domain/agent-activity-store.js.map +1 -1
- package/daemon/dist/domain/bootstrap-orchestrator.d.ts.map +1 -1
- package/daemon/dist/domain/bootstrap-orchestrator.js +5 -0
- package/daemon/dist/domain/bootstrap-orchestrator.js.map +1 -1
- package/daemon/dist/domain/claude-compaction-enforcer.d.ts +5 -0
- package/daemon/dist/domain/claude-compaction-enforcer.d.ts.map +1 -1
- package/daemon/dist/domain/claude-compaction-enforcer.js +12 -3
- package/daemon/dist/domain/claude-compaction-enforcer.js.map +1 -1
- package/daemon/dist/domain/connection-contract.d.ts +111 -0
- package/daemon/dist/domain/connection-contract.d.ts.map +1 -0
- package/daemon/dist/domain/connection-contract.js +113 -0
- package/daemon/dist/domain/connection-contract.js.map +1 -0
- package/daemon/dist/domain/context-monitor.d.ts.map +1 -1
- package/daemon/dist/domain/context-monitor.js +8 -3
- package/daemon/dist/domain/context-monitor.js.map +1 -1
- package/daemon/dist/domain/draft-aware-delivery.d.ts.map +1 -1
- package/daemon/dist/domain/draft-aware-delivery.js +2 -1
- package/daemon/dist/domain/draft-aware-delivery.js.map +1 -1
- package/daemon/dist/domain/execution-view.js +2 -2
- package/daemon/dist/domain/execution-view.js.map +1 -1
- package/daemon/dist/domain/hosts/pairing-ask.d.ts +8 -0
- package/daemon/dist/domain/hosts/pairing-ask.d.ts.map +1 -1
- package/daemon/dist/domain/hosts/pairing-ask.js +20 -0
- package/daemon/dist/domain/hosts/pairing-ask.js.map +1 -1
- package/daemon/dist/domain/input-read-diagnostic.d.ts +30 -0
- package/daemon/dist/domain/input-read-diagnostic.d.ts.map +1 -0
- package/daemon/dist/domain/input-read-diagnostic.js +32 -0
- package/daemon/dist/domain/input-read-diagnostic.js.map +1 -0
- package/daemon/dist/domain/install-engine.d.ts +5 -0
- package/daemon/dist/domain/install-engine.d.ts.map +1 -1
- package/daemon/dist/domain/install-engine.js +28 -26
- package/daemon/dist/domain/install-engine.js.map +1 -1
- package/daemon/dist/domain/install-verifier.d.ts +5 -1
- package/daemon/dist/domain/install-verifier.d.ts.map +1 -1
- package/daemon/dist/domain/install-verifier.js +12 -1
- package/daemon/dist/domain/install-verifier.js.map +1 -1
- package/daemon/dist/domain/managed-block-records.d.ts +9 -3
- package/daemon/dist/domain/managed-block-records.d.ts.map +1 -1
- package/daemon/dist/domain/managed-block-records.js +43 -8
- package/daemon/dist/domain/managed-block-records.js.map +1 -1
- package/daemon/dist/domain/managed-blocks.d.ts +40 -3
- package/daemon/dist/domain/managed-blocks.d.ts.map +1 -1
- package/daemon/dist/domain/managed-blocks.js +151 -39
- package/daemon/dist/domain/managed-blocks.js.map +1 -1
- package/daemon/dist/domain/mission-control/mission-control-write-contract.d.ts.map +1 -1
- package/daemon/dist/domain/mission-control/mission-control-write-contract.js +3 -2
- package/daemon/dist/domain/mission-control/mission-control-write-contract.js.map +1 -1
- package/daemon/dist/domain/native-model-picker.d.ts +8 -0
- package/daemon/dist/domain/native-model-picker.d.ts.map +1 -0
- package/daemon/dist/domain/native-model-picker.js +35 -0
- package/daemon/dist/domain/native-model-picker.js.map +1 -0
- package/daemon/dist/domain/native-process-lineage.d.ts +6 -0
- package/daemon/dist/domain/native-process-lineage.d.ts.map +1 -1
- package/daemon/dist/domain/native-process-lineage.js +34 -29
- package/daemon/dist/domain/native-process-lineage.js.map +1 -1
- package/daemon/dist/domain/native-resume-probe.d.ts +6 -0
- package/daemon/dist/domain/native-resume-probe.d.ts.map +1 -1
- package/daemon/dist/domain/native-resume-probe.js +124 -2
- package/daemon/dist/domain/native-resume-probe.js.map +1 -1
- package/daemon/dist/domain/network/hub-client.d.ts +40 -0
- package/daemon/dist/domain/network/hub-client.d.ts.map +1 -0
- package/daemon/dist/domain/network/hub-client.js +102 -0
- package/daemon/dist/domain/network/hub-client.js.map +1 -0
- package/daemon/dist/domain/network/network-bindings.d.ts +104 -0
- package/daemon/dist/domain/network/network-bindings.d.ts.map +1 -0
- package/daemon/dist/domain/network/network-bindings.js +272 -0
- package/daemon/dist/domain/network/network-bindings.js.map +1 -0
- package/daemon/dist/domain/network/network-connector.d.ts +77 -0
- package/daemon/dist/domain/network/network-connector.d.ts.map +1 -0
- package/daemon/dist/domain/network/network-connector.js +380 -0
- package/daemon/dist/domain/network/network-connector.js.map +1 -0
- package/daemon/dist/domain/network/network-installations.d.ts +97 -0
- package/daemon/dist/domain/network/network-installations.d.ts.map +1 -0
- package/daemon/dist/domain/network/network-installations.js +371 -0
- package/daemon/dist/domain/network/network-installations.js.map +1 -0
- package/daemon/dist/domain/node-inventory.d.ts.map +1 -1
- package/daemon/dist/domain/node-inventory.js +6 -5
- package/daemon/dist/domain/node-inventory.js.map +1 -1
- package/daemon/dist/domain/operation-correlation.d.ts +1 -1
- package/daemon/dist/domain/operation-correlation.d.ts.map +1 -1
- package/daemon/dist/domain/operation-correlation.js +1 -1
- package/daemon/dist/domain/operation-correlation.js.map +1 -1
- package/daemon/dist/domain/package-install-service.d.ts +1 -0
- package/daemon/dist/domain/package-install-service.d.ts.map +1 -1
- package/daemon/dist/domain/package-install-service.js +2 -1
- package/daemon/dist/domain/package-install-service.js.map +1 -1
- package/daemon/dist/domain/plugin-vendor-service.d.ts +9 -0
- package/daemon/dist/domain/plugin-vendor-service.d.ts.map +1 -1
- package/daemon/dist/domain/plugin-vendor-service.js +50 -8
- package/daemon/dist/domain/plugin-vendor-service.js.map +1 -1
- package/daemon/dist/domain/process-observation-pass.d.ts +20 -0
- package/daemon/dist/domain/process-observation-pass.d.ts.map +1 -0
- package/daemon/dist/domain/process-observation-pass.js +80 -0
- package/daemon/dist/domain/process-observation-pass.js.map +1 -0
- package/daemon/dist/domain/proof/judgments.d.ts +12 -13
- package/daemon/dist/domain/proof/judgments.d.ts.map +1 -1
- package/daemon/dist/domain/proof/judgments.js +14 -0
- package/daemon/dist/domain/proof/judgments.js.map +1 -1
- package/daemon/dist/domain/proof/source-watch.d.ts +1 -1
- package/daemon/dist/domain/proof/source-watch.d.ts.map +1 -1
- package/daemon/dist/domain/proof/source-watch.js +45 -22
- package/daemon/dist/domain/proof/source-watch.js.map +1 -1
- package/daemon/dist/domain/provider/claude-usage-reader.d.ts +3 -3
- package/daemon/dist/domain/provider/claude-usage-reader.d.ts.map +1 -1
- package/daemon/dist/domain/provider/claude-usage-reader.js +16 -5
- package/daemon/dist/domain/provider/claude-usage-reader.js.map +1 -1
- package/daemon/dist/domain/provider/codex-limit-banner.d.ts.map +1 -1
- package/daemon/dist/domain/provider/codex-limit-banner.js +2 -1
- package/daemon/dist/domain/provider/codex-limit-banner.js.map +1 -1
- package/daemon/dist/domain/provider/provider-signals.d.ts +6 -0
- package/daemon/dist/domain/provider/provider-signals.d.ts.map +1 -1
- package/daemon/dist/domain/provider/provider-signals.js +9 -3
- package/daemon/dist/domain/provider/provider-signals.js.map +1 -1
- package/daemon/dist/domain/provider/reactive-tap.d.ts.map +1 -1
- package/daemon/dist/domain/provider/reactive-tap.js +6 -0
- package/daemon/dist/domain/provider/reactive-tap.js.map +1 -1
- package/daemon/dist/domain/queue-erasure.d.ts +10 -6
- package/daemon/dist/domain/queue-erasure.d.ts.map +1 -1
- package/daemon/dist/domain/queue-erasure.js +31 -18
- package/daemon/dist/domain/queue-erasure.js.map +1 -1
- package/daemon/dist/domain/queue-recovery.d.ts +10 -1
- package/daemon/dist/domain/queue-recovery.d.ts.map +1 -1
- package/daemon/dist/domain/queue-recovery.js +25 -3
- package/daemon/dist/domain/queue-recovery.js.map +1 -1
- package/daemon/dist/domain/queue-repository.d.ts +39 -3
- package/daemon/dist/domain/queue-repository.d.ts.map +1 -1
- package/daemon/dist/domain/queue-repository.js +132 -6
- package/daemon/dist/domain/queue-repository.js.map +1 -1
- package/daemon/dist/domain/queue-retention.d.ts +1 -1
- package/daemon/dist/domain/queue-retention.d.ts.map +1 -1
- package/daemon/dist/domain/queue-retention.js +1 -0
- package/daemon/dist/domain/queue-retention.js.map +1 -1
- package/daemon/dist/domain/queue-stuck-sweep.d.ts +5 -0
- package/daemon/dist/domain/queue-stuck-sweep.d.ts.map +1 -1
- package/daemon/dist/domain/queue-stuck-sweep.js +408 -68
- package/daemon/dist/domain/queue-stuck-sweep.js.map +1 -1
- package/daemon/dist/domain/queue-wake-ladder.d.ts.map +1 -1
- package/daemon/dist/domain/queue-wake-ladder.js +45 -27
- package/daemon/dist/domain/queue-wake-ladder.js.map +1 -1
- package/daemon/dist/domain/queue-wake-repository.d.ts +3 -0
- package/daemon/dist/domain/queue-wake-repository.d.ts.map +1 -1
- package/daemon/dist/domain/queue-wake-repository.js +6 -0
- package/daemon/dist/domain/queue-wake-repository.js.map +1 -1
- package/daemon/dist/domain/receiver-context.d.ts +9 -0
- package/daemon/dist/domain/receiver-context.d.ts.map +1 -0
- package/daemon/dist/domain/receiver-context.js +25 -0
- package/daemon/dist/domain/receiver-context.js.map +1 -0
- package/daemon/dist/domain/reconciler.d.ts +15 -6
- package/daemon/dist/domain/reconciler.d.ts.map +1 -1
- package/daemon/dist/domain/reconciler.js +26 -26
- package/daemon/dist/domain/reconciler.js.map +1 -1
- package/daemon/dist/domain/restore-guidance.d.ts +9 -4
- package/daemon/dist/domain/restore-guidance.d.ts.map +1 -1
- package/daemon/dist/domain/restore-guidance.js +43 -27
- package/daemon/dist/domain/restore-guidance.js.map +1 -1
- package/daemon/dist/domain/restore-orchestrator.d.ts +6 -0
- package/daemon/dist/domain/restore-orchestrator.d.ts.map +1 -1
- package/daemon/dist/domain/restore-orchestrator.js +69 -5
- package/daemon/dist/domain/restore-orchestrator.js.map +1 -1
- package/daemon/dist/domain/restore-preconditions.d.ts.map +1 -1
- package/daemon/dist/domain/restore-preconditions.js +2 -1
- package/daemon/dist/domain/restore-preconditions.js.map +1 -1
- package/daemon/dist/domain/rigspec-instantiator.d.ts +1 -0
- package/daemon/dist/domain/rigspec-instantiator.d.ts.map +1 -1
- package/daemon/dist/domain/rigspec-instantiator.js +1 -1
- package/daemon/dist/domain/rigspec-instantiator.js.map +1 -1
- package/daemon/dist/domain/rosters.d.ts +12 -0
- package/daemon/dist/domain/rosters.d.ts.map +1 -1
- package/daemon/dist/domain/rosters.js +24 -1
- package/daemon/dist/domain/rosters.js.map +1 -1
- package/daemon/dist/domain/runner-permissions.d.ts.map +1 -1
- package/daemon/dist/domain/runner-permissions.js +9 -2
- package/daemon/dist/domain/runner-permissions.js.map +1 -1
- package/daemon/dist/domain/runtime-adapter.d.ts +9 -0
- package/daemon/dist/domain/runtime-adapter.d.ts.map +1 -1
- package/daemon/dist/domain/runtime-adapter.js +2 -0
- package/daemon/dist/domain/runtime-adapter.js.map +1 -1
- package/daemon/dist/domain/seat-delivery-guard.d.ts +3 -1
- package/daemon/dist/domain/seat-delivery-guard.d.ts.map +1 -1
- package/daemon/dist/domain/seat-delivery-guard.js +8 -5
- package/daemon/dist/domain/seat-delivery-guard.js.map +1 -1
- package/daemon/dist/domain/seat-handover-service.d.ts +9 -1
- package/daemon/dist/domain/seat-handover-service.d.ts.map +1 -1
- package/daemon/dist/domain/seat-handover-service.js +75 -9
- package/daemon/dist/domain/seat-handover-service.js.map +1 -1
- package/daemon/dist/domain/seat-identity-reconciler.d.ts +4 -0
- package/daemon/dist/domain/seat-identity-reconciler.d.ts.map +1 -1
- package/daemon/dist/domain/seat-identity-reconciler.js +18 -2
- package/daemon/dist/domain/seat-identity-reconciler.js.map +1 -1
- package/daemon/dist/domain/seat-lifecycle-service.d.ts +13 -8
- package/daemon/dist/domain/seat-lifecycle-service.d.ts.map +1 -1
- package/daemon/dist/domain/seat-lifecycle-service.js +46 -26
- package/daemon/dist/domain/seat-lifecycle-service.js.map +1 -1
- package/daemon/dist/domain/seat-structural-activity-service.d.ts.map +1 -1
- package/daemon/dist/domain/seat-structural-activity-service.js +7 -4
- package/daemon/dist/domain/seat-structural-activity-service.js.map +1 -1
- package/daemon/dist/domain/session-registry.d.ts.map +1 -1
- package/daemon/dist/domain/session-registry.js +16 -5
- package/daemon/dist/domain/session-registry.js.map +1 -1
- package/daemon/dist/domain/session-transport.d.ts +4 -0
- package/daemon/dist/domain/session-transport.d.ts.map +1 -1
- package/daemon/dist/domain/session-transport.js +44 -10
- package/daemon/dist/domain/session-transport.js.map +1 -1
- package/daemon/dist/domain/slices/slice-indexer.d.ts +5 -2
- package/daemon/dist/domain/slices/slice-indexer.d.ts.map +1 -1
- package/daemon/dist/domain/slices/slice-indexer.js +60 -16
- package/daemon/dist/domain/slices/slice-indexer.js.map +1 -1
- package/daemon/dist/domain/slow-op-recorder.d.ts +0 -3
- package/daemon/dist/domain/slow-op-recorder.d.ts.map +1 -1
- package/daemon/dist/domain/slow-op-recorder.js +5 -34
- package/daemon/dist/domain/slow-op-recorder.js.map +1 -1
- package/daemon/dist/domain/spec-library-workflow-scanner.d.ts +2 -0
- package/daemon/dist/domain/spec-library-workflow-scanner.d.ts.map +1 -1
- package/daemon/dist/domain/spec-library-workflow-scanner.js +22 -13
- package/daemon/dist/domain/spec-library-workflow-scanner.js.map +1 -1
- package/daemon/dist/domain/startup-orchestrator.d.ts.map +1 -1
- package/daemon/dist/domain/startup-orchestrator.js +8 -3
- package/daemon/dist/domain/startup-orchestrator.js.map +1 -1
- package/daemon/dist/domain/successor-session-launcher.d.ts +5 -0
- package/daemon/dist/domain/successor-session-launcher.d.ts.map +1 -1
- package/daemon/dist/domain/successor-session-launcher.js +11 -6
- package/daemon/dist/domain/successor-session-launcher.js.map +1 -1
- package/daemon/dist/domain/team-operations.d.ts +20 -0
- package/daemon/dist/domain/team-operations.d.ts.map +1 -0
- package/daemon/dist/domain/team-operations.js +23 -0
- package/daemon/dist/domain/team-operations.js.map +1 -0
- package/daemon/dist/domain/terminal/herdr-adapter.d.ts +12 -2
- package/daemon/dist/domain/terminal/herdr-adapter.d.ts.map +1 -1
- package/daemon/dist/domain/terminal/herdr-adapter.js +52 -2
- package/daemon/dist/domain/terminal/herdr-adapter.js.map +1 -1
- package/daemon/dist/domain/terminal/herdr-live-workspace.d.ts +42 -0
- package/daemon/dist/domain/terminal/herdr-live-workspace.d.ts.map +1 -0
- package/daemon/dist/domain/terminal/herdr-live-workspace.js +118 -0
- package/daemon/dist/domain/terminal/herdr-live-workspace.js.map +1 -0
- package/daemon/dist/domain/terminal/herdr-sessions.d.ts.map +1 -1
- package/daemon/dist/domain/terminal/herdr-sessions.js +3 -0
- package/daemon/dist/domain/terminal/herdr-sessions.js.map +1 -1
- package/daemon/dist/domain/terminal/rex-adapter.d.ts +3 -0
- package/daemon/dist/domain/terminal/rex-adapter.d.ts.map +1 -1
- package/daemon/dist/domain/terminal/rex-adapter.js +10 -1
- package/daemon/dist/domain/terminal/rex-adapter.js.map +1 -1
- package/daemon/dist/domain/terminal/rex-agent-status.d.ts +76 -0
- package/daemon/dist/domain/terminal/rex-agent-status.d.ts.map +1 -0
- package/daemon/dist/domain/terminal/rex-agent-status.js +168 -0
- package/daemon/dist/domain/terminal/rex-agent-status.js.map +1 -0
- package/daemon/dist/domain/terminal/terminal-provider.d.ts +12 -1
- package/daemon/dist/domain/terminal/terminal-provider.d.ts.map +1 -1
- package/daemon/dist/domain/terminal/terminal-service.d.ts +2 -0
- package/daemon/dist/domain/terminal/terminal-service.d.ts.map +1 -1
- package/daemon/dist/domain/terminal/terminal-service.js +3 -2
- package/daemon/dist/domain/terminal/terminal-service.js.map +1 -1
- package/daemon/dist/domain/tmux-option-defaults.d.ts +4 -4
- package/daemon/dist/domain/tmux-option-defaults.d.ts.map +1 -1
- package/daemon/dist/domain/tmux-option-defaults.js +25 -12
- package/daemon/dist/domain/tmux-option-defaults.js.map +1 -1
- package/daemon/dist/domain/types.d.ts +12 -0
- 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 +8 -2
- package/daemon/dist/domain/user-settings/settings-browser.d.ts.map +1 -1
- package/daemon/dist/domain/user-settings/settings-browser.js +5 -2
- package/daemon/dist/domain/user-settings/settings-browser.js.map +1 -1
- package/daemon/dist/domain/user-settings/settings-store.d.ts +15 -1
- package/daemon/dist/domain/user-settings/settings-store.d.ts.map +1 -1
- package/daemon/dist/domain/user-settings/settings-store.js +108 -44
- package/daemon/dist/domain/user-settings/settings-store.js.map +1 -1
- package/daemon/dist/domain/watchdog-delivery-receipts.d.ts.map +1 -1
- package/daemon/dist/domain/watchdog-delivery-receipts.js +8 -3
- package/daemon/dist/domain/watchdog-delivery-receipts.js.map +1 -1
- package/daemon/dist/domain/workflow-exception-escalation.d.ts.map +1 -1
- package/daemon/dist/domain/workflow-exception-escalation.js +4 -2
- package/daemon/dist/domain/workflow-exception-escalation.js.map +1 -1
- package/daemon/dist/domain/workflow-spec-cache.d.ts +8 -0
- package/daemon/dist/domain/workflow-spec-cache.d.ts.map +1 -1
- package/daemon/dist/domain/workflow-spec-cache.js +34 -10
- package/daemon/dist/domain/workflow-spec-cache.js.map +1 -1
- package/daemon/dist/domain/workflow-validator.d.ts.map +1 -1
- package/daemon/dist/domain/workflow-validator.js +16 -0
- package/daemon/dist/domain/workflow-validator.js.map +1 -1
- package/daemon/dist/herdr-live-workspace-surface.d.ts +2 -0
- package/daemon/dist/herdr-live-workspace-surface.d.ts.map +1 -0
- package/daemon/dist/herdr-live-workspace-surface.js +2 -0
- package/daemon/dist/herdr-live-workspace-surface.js.map +1 -0
- package/daemon/dist/index.d.ts.map +1 -1
- package/daemon/dist/index.js +3 -0
- package/daemon/dist/index.js.map +1 -1
- package/daemon/dist/routes/activity.d.ts.map +1 -1
- package/daemon/dist/routes/activity.js +12 -0
- package/daemon/dist/routes/activity.js.map +1 -1
- package/daemon/dist/routes/attention.d.ts.map +1 -1
- package/daemon/dist/routes/attention.js +5 -1
- package/daemon/dist/routes/attention.js.map +1 -1
- package/daemon/dist/routes/hosts.d.ts.map +1 -1
- package/daemon/dist/routes/hosts.js +30 -46
- package/daemon/dist/routes/hosts.js.map +1 -1
- package/daemon/dist/routes/network.d.ts +13 -0
- package/daemon/dist/routes/network.d.ts.map +1 -0
- package/daemon/dist/routes/network.js +93 -0
- package/daemon/dist/routes/network.js.map +1 -0
- package/daemon/dist/routes/packages.js +3 -1
- package/daemon/dist/routes/packages.js.map +1 -1
- package/daemon/dist/routes/proof.d.ts.map +1 -1
- package/daemon/dist/routes/proof.js +6 -4
- package/daemon/dist/routes/proof.js.map +1 -1
- package/daemon/dist/routes/queue.d.ts.map +1 -1
- package/daemon/dist/routes/queue.js +13 -0
- package/daemon/dist/routes/queue.js.map +1 -1
- package/daemon/dist/routes/rigspec.js +13 -4
- package/daemon/dist/routes/rigspec.js.map +1 -1
- package/daemon/dist/routes/sessions.d.ts.map +1 -1
- package/daemon/dist/routes/sessions.js +24 -5
- package/daemon/dist/routes/sessions.js.map +1 -1
- package/daemon/dist/routes/slices.d.ts +1 -0
- package/daemon/dist/routes/slices.d.ts.map +1 -1
- package/daemon/dist/routes/slices.js +66 -16
- package/daemon/dist/routes/slices.js.map +1 -1
- package/daemon/dist/routes/spec-library.d.ts.map +1 -1
- package/daemon/dist/routes/spec-library.js +7 -3
- package/daemon/dist/routes/spec-library.js.map +1 -1
- package/daemon/dist/routes/terminal.js +1 -1
- package/daemon/dist/routes/terminal.js.map +1 -1
- package/daemon/dist/server.d.ts +3 -0
- package/daemon/dist/server.d.ts.map +1 -1
- package/daemon/dist/server.js +7 -0
- package/daemon/dist/server.js.map +1 -1
- package/daemon/dist/startup.d.ts.map +1 -1
- package/daemon/dist/startup.js +35 -31
- package/daemon/dist/startup.js.map +1 -1
- package/daemon/dist/tmux-server-start-surface.d.ts +2 -0
- package/daemon/dist/tmux-server-start-surface.d.ts.map +1 -0
- package/daemon/dist/tmux-server-start-surface.js +2 -0
- package/daemon/dist/tmux-server-start-surface.js.map +1 -0
- package/daemon/dist/tmux-server-start.d.ts +13 -0
- package/daemon/dist/tmux-server-start.d.ts.map +1 -0
- package/daemon/dist/tmux-server-start.js +36 -0
- package/daemon/dist/tmux-server-start.js.map +1 -0
- package/daemon/docs/reference/agent-startup-guide.md +52 -17
- package/daemon/docs/reference/agent-state-taxonomy.md +2 -1
- package/daemon/docs/reference/claude-status-line.md +25 -9
- package/daemon/docs/reference/daemon-http-clients.md +42 -0
- package/daemon/docs/reference/getting-started.md +30 -13
- package/daemon/docs/reference/herdr-app.md +3 -2
- package/daemon/docs/reference/hosted-members.md +60 -4
- package/daemon/docs/reference/keeping-a-watch.md +28 -0
- package/daemon/docs/reference/network-connector.md +185 -0
- package/daemon/docs/reference/operation-correlation.md +18 -2
- package/daemon/docs/reference/queue-erasure.md +7 -5
- package/daemon/docs/reference/quickstart.md +4 -4
- package/daemon/docs/reference/rig-spec.md +18 -0
- package/daemon/docs/reference/rosters.md +5 -0
- package/daemon/docs/reference/seat-delivery.md +16 -1
- package/daemon/docs/reference/terminal-sessions.md +12 -0
- package/daemon/docs/reference/tmux-servers.md +10 -1
- package/daemon/docs/reference/whats-new.md +302 -179
- package/daemon/specs/agents/shared/skills/core/watchdog/SKILL.md +5 -0
- package/daemon/specs/agents/shared/skills/core/working-with-an-openrig-team/SKILL.md +7 -0
- package/daemon/specs/rigs/launch/kernel/agents/operator/agent/guidance/role.md +66 -24
- package/daemon/specs/rigs/launch/kernel/agents/operator/agent/startup/context.md +11 -3
- package/dist/build-info.js +3 -3
- package/dist/commands/broadcast.js +7 -3
- package/dist/commands/broadcast.js.map +1 -1
- package/dist/commands/chatroom.d.ts.map +1 -1
- package/dist/commands/chatroom.js +8 -3
- package/dist/commands/chatroom.js.map +1 -1
- package/dist/commands/config.d.ts.map +1 -1
- package/dist/commands/config.js +50 -10
- package/dist/commands/config.js.map +1 -1
- package/dist/commands/daemon.d.ts +4 -2
- package/dist/commands/daemon.d.ts.map +1 -1
- package/dist/commands/daemon.js +28 -4
- package/dist/commands/daemon.js.map +1 -1
- package/dist/commands/doctor.js +1 -1
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/down.d.ts.map +1 -1
- package/dist/commands/down.js +2 -1
- package/dist/commands/down.js.map +1 -1
- package/dist/commands/gateway.d.ts.map +1 -1
- package/dist/commands/gateway.js +5 -0
- package/dist/commands/gateway.js.map +1 -1
- package/dist/commands/host.d.ts +4 -10
- package/dist/commands/host.d.ts.map +1 -1
- package/dist/commands/host.js +9 -36
- package/dist/commands/host.js.map +1 -1
- package/dist/commands/import.d.ts.map +1 -1
- package/dist/commands/import.js +96 -3
- package/dist/commands/import.js.map +1 -1
- package/dist/commands/network.d.ts +12 -0
- package/dist/commands/network.d.ts.map +1 -0
- package/dist/commands/network.js +150 -0
- package/dist/commands/network.js.map +1 -0
- package/dist/commands/package.d.ts.map +1 -1
- package/dist/commands/package.js +5 -0
- package/dist/commands/package.js.map +1 -1
- package/dist/commands/ps.d.ts.map +1 -1
- package/dist/commands/ps.js +44 -0
- package/dist/commands/ps.js.map +1 -1
- package/dist/commands/queue.d.ts.map +1 -1
- package/dist/commands/queue.js +68 -3
- package/dist/commands/queue.js.map +1 -1
- package/dist/commands/roster.d.ts +15 -0
- package/dist/commands/roster.d.ts.map +1 -1
- package/dist/commands/roster.js +38 -2
- package/dist/commands/roster.js.map +1 -1
- package/dist/commands/seat.d.ts.map +1 -1
- package/dist/commands/seat.js +6 -5
- package/dist/commands/seat.js.map +1 -1
- package/dist/commands/send.d.ts +4 -0
- package/dist/commands/send.d.ts.map +1 -1
- package/dist/commands/send.js +6 -1
- 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/terminal.d.ts.map +1 -1
- package/dist/commands/terminal.js +9 -7
- package/dist/commands/terminal.js.map +1 -1
- package/dist/commands/watchdog.d.ts.map +1 -1
- package/dist/commands/watchdog.js +22 -2
- package/dist/commands/watchdog.js.map +1 -1
- package/dist/config-store.d.ts +14 -1
- package/dist/config-store.d.ts.map +1 -1
- package/dist/config-store.js +34 -5
- package/dist/config-store.js.map +1 -1
- package/dist/cross-host-executor.d.ts.map +1 -1
- package/dist/cross-host-executor.js +6 -1
- package/dist/cross-host-executor.js.map +1 -1
- package/dist/daemon-lifecycle.d.ts +11 -0
- package/dist/daemon-lifecycle.d.ts.map +1 -1
- package/dist/daemon-lifecycle.js +61 -9
- package/dist/daemon-lifecycle.js.map +1 -1
- package/dist/daemon-reachability.js +1 -1
- package/dist/daemon-reachability.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/lazy-program.d.ts.map +1 -1
- package/dist/lazy-program.js +1 -0
- package/dist/lazy-program.js.map +1 -1
- package/dist/lib/check-in.d.ts +7 -0
- package/dist/lib/check-in.d.ts.map +1 -0
- package/dist/lib/check-in.js +13 -0
- package/dist/lib/check-in.js.map +1 -0
- package/dist/mcp-http.d.ts.map +1 -1
- package/dist/mcp-http.js +25 -2
- package/dist/mcp-http.js.map +1 -1
- package/dist/mcp-server.d.ts +12 -1
- package/dist/mcp-server.d.ts.map +1 -1
- package/dist/mcp-server.js +185 -57
- package/dist/mcp-server.js.map +1 -1
- package/dist/person-registration-offer.d.ts +10 -0
- package/dist/person-registration-offer.d.ts.map +1 -0
- package/dist/person-registration-offer.js +25 -0
- package/dist/person-registration-offer.js.map +1 -0
- package/dist/terminal-window.d.ts.map +1 -1
- package/dist/terminal-window.js +20 -102
- package/dist/terminal-window.js.map +1 -1
- package/dist/tmux-attachment.d.ts.map +1 -1
- package/dist/tmux-attachment.js +3 -1
- package/dist/tmux-attachment.js.map +1 -1
- package/package.json +1 -1
- package/tui/dist/attention/attention-model.d.ts.map +1 -1
- package/tui/dist/attention/attention-model.js +10 -5
- package/tui/dist/attention/attention-model.js.map +1 -1
- package/tui/dist/config/pairing.d.ts.map +1 -1
- package/tui/dist/config/pairing.js +8 -3
- package/tui/dist/config/pairing.js.map +1 -1
- package/tui/dist/connected-assistants.d.ts +20 -0
- package/tui/dist/connected-assistants.d.ts.map +1 -0
- package/tui/dist/connected-assistants.js +51 -0
- package/tui/dist/connected-assistants.js.map +1 -0
- package/tui/dist/daemon-client.d.ts +8 -0
- package/tui/dist/daemon-client.d.ts.map +1 -1
- package/tui/dist/daemon-client.js +8 -0
- package/tui/dist/daemon-client.js.map +1 -1
- package/tui/dist/hydrate.d.ts.map +1 -1
- package/tui/dist/hydrate.js +19 -4
- package/tui/dist/hydrate.js.map +1 -1
- package/tui/dist/navigator.js +1 -1
- package/tui/dist/navigator.js.map +1 -1
- package/tui/dist/render.d.ts.map +1 -1
- package/tui/dist/render.js +48 -29
- package/tui/dist/render.js.map +1 -1
- package/tui/dist/state.js +2 -2
- package/tui/dist/state.js.map +1 -1
- package/tui/dist/stylize.d.ts.map +1 -1
- package/tui/dist/stylize.js +4 -0
- package/tui/dist/stylize.js.map +1 -1
- package/tui/dist/topology/glyphs.d.ts.map +1 -1
- package/tui/dist/topology/glyphs.js +4 -0
- package/tui/dist/topology/glyphs.js.map +1 -1
- package/tui/dist/topology/host-label.d.ts +2 -0
- package/tui/dist/topology/host-label.d.ts.map +1 -1
- package/tui/dist/topology/host-label.js +7 -1
- package/tui/dist/topology/host-label.js.map +1 -1
- package/tui/dist/types.d.ts +13 -1
- package/tui/dist/types.d.ts.map +1 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { currentParkedOwnerNoInputFailure } from "./policies/parked-owner-consumer.js";
|
|
2
2
|
import { resolveEscalationOwner, ESCALATION_HOP_TAG, hasConsumedEscalationHop } from "./escalation-owner.js";
|
|
3
|
-
import { createRecoveryLookup,
|
|
3
|
+
import { BACKLOG_FOLDED_TAG, createRecoveryLookup, findQueueRecovery, freshRecoveryId, recoveryTag } from "./queue-recovery.js";
|
|
4
|
+
export { BACKLOG_FOLDED_TAG };
|
|
4
5
|
import { quietHoldCustody } from "./quiet-hold-custody.js";
|
|
5
6
|
import { queueWaitNotice } from "./queue-wait-backoff.js";
|
|
6
7
|
import { lastMeaningfulTransition, pendingSince } from "./queue-waiting.js";
|
|
@@ -32,6 +33,7 @@ import { createLinkedSuccessorLookup, deriveCrossHostSuccessorId, hasLinkedSucce
|
|
|
32
33
|
import { stalledPickupFinding } from "./queue-pickup.js";
|
|
33
34
|
import { SettingsStore } from "./user-settings/settings-store.js";
|
|
34
35
|
import { loadHostRegistry } from "./hosts/hosts-registry-reader.js";
|
|
36
|
+
import { describeCheckIn, readWakeOutcome } from "./connection-contract.js";
|
|
35
37
|
export const STUCK_SWEEP_INTERVAL_KEY = "queue.stuck_sweep_interval_seconds";
|
|
36
38
|
export const DEFAULT_STUCK_SWEEP_INTERVAL_SECONDS = 300;
|
|
37
39
|
export const STUCK_SWEEP_UNCLAIMED_AGE_KEY = "queue.stuck_sweep_unclaimed_age_minutes";
|
|
@@ -51,6 +53,11 @@ const NO_WAKE_ROUTE_RULES = [
|
|
|
51
53
|
"the row's creator",
|
|
52
54
|
"the operator agent (agents.operator_session)",
|
|
53
55
|
];
|
|
56
|
+
/** How a failed wake's finding at a seat with no declared route names the rule that chose its recipient, in the order tried. */
|
|
57
|
+
const FAILED_WAKE_ROUTE_RULES = [
|
|
58
|
+
"the row's creator",
|
|
59
|
+
"the operator agent (agents.operator_session)",
|
|
60
|
+
];
|
|
54
61
|
// S01 ladder marker vocabulary (the seam contract). S01 writes these transition-note
|
|
55
62
|
// prefixes; the sweep derives "live ladder" from the latest marker. An attempt/rung is
|
|
56
63
|
// LIVE, an exhausted marker hands the row back, and a later attempt starts a live cycle
|
|
@@ -92,6 +99,41 @@ export function unclaimedBacklogTag(seat) {
|
|
|
92
99
|
}
|
|
93
100
|
/** How many of a seat's unclaimed rows its standing notice lists by id; the rest are counted. */
|
|
94
101
|
export const UNCLAIMED_BACKLOG_LISTED_ROWS = 20;
|
|
102
|
+
/** #2988: the key of a notice sent to a seat's delegation parent is `<child seat>=><parent>`; a seat's own notice is keyed
|
|
103
|
+
* by the seat alone. */
|
|
104
|
+
const PARENT_BACKLOG_SEPARATOR = "=>";
|
|
105
|
+
/** Review of #3049: a polling member's notice the sweep filed to the one creator of every row it listed carries this
|
|
106
|
+
* prefix followed by that creator. Only this mark establishes that the notice shows that creator's rows alone; an old
|
|
107
|
+
* recipient the sweep doesn't recognize proves nothing (the operator setting may have changed). It names the creator
|
|
108
|
+
* rather than trusting the notice's destination: a queue handoff copies the tags to a successor elsewhere, and a
|
|
109
|
+
* fallback changes the destination in place. */
|
|
110
|
+
const BACKLOG_TO_CREATOR_PREFIX = "stuck-sweep-backlog-to-creator:";
|
|
111
|
+
const creatorMark = (creator) => `${BACKLOG_TO_CREATOR_PREFIX}${creator}`;
|
|
112
|
+
/** The creator a notice's stored tags name in its mark, or null: no mark, more than one, or tags that don't read as a JSON
|
|
113
|
+
* array name none. */
|
|
114
|
+
function markedCreator(tags) {
|
|
115
|
+
try {
|
|
116
|
+
const parsed = JSON.parse(tags ?? "[]");
|
|
117
|
+
if (!Array.isArray(parsed))
|
|
118
|
+
return null;
|
|
119
|
+
const marks = parsed.filter((t) => typeof t === "string" && t.startsWith(BACKLOG_TO_CREATOR_PREFIX)
|
|
120
|
+
&& t.length > BACKLOG_TO_CREATOR_PREFIX.length);
|
|
121
|
+
return marks.length === 1 ? marks[0].slice(BACKLOG_TO_CREATOR_PREFIX.length) : null;
|
|
122
|
+
}
|
|
123
|
+
catch {
|
|
124
|
+
return null;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
/** Idempotency key of the standing unclaimed-backlog notice a delegation parent gets for one child seat's rows: one open
|
|
128
|
+
* notice per (parent, child). */
|
|
129
|
+
export function parentBacklogTag(parent, child) {
|
|
130
|
+
return unclaimedBacklogTag(`${child}${PARENT_BACKLOG_SEPARATOR}${parent}`);
|
|
131
|
+
}
|
|
132
|
+
/** The seat a notice's key stands for and, for a notice sent to its delegation parent, that parent. */
|
|
133
|
+
function backlogKeyParts(key) {
|
|
134
|
+
const at = key.indexOf(PARENT_BACKLOG_SEPARATOR);
|
|
135
|
+
return at < 0 ? { seat: key, parent: null } : { seat: key.slice(0, at), parent: key.slice(at + PARENT_BACKLOG_SEPARATOR.length) };
|
|
136
|
+
}
|
|
95
137
|
/** The loop's observable heartbeat — surfaced on /healthz so a quiet sweep is cheap but
|
|
96
138
|
* never invisible, and a failing sweep is loud without needing a row. */
|
|
97
139
|
export function createStuckSweepStatus() {
|
|
@@ -174,7 +216,9 @@ function custodyVerifiedTargets(db, qitemId, targets) {
|
|
|
174
216
|
if (!note)
|
|
175
217
|
continue;
|
|
176
218
|
for (const token of note.slice(CUSTODY_VERIFIED_PREFIX.length).trim().split(/\s+/)) {
|
|
177
|
-
const named = [token, ...token.split(",").map((t) => t.trim())]
|
|
219
|
+
const named = [token, ...token.split(",").map((t) => t.trim())]
|
|
220
|
+
.filter(Boolean)
|
|
221
|
+
.map((t) => targets.includes(t) ? t : t.replace(/[.,;:)]$/, ""));
|
|
178
222
|
if (!named.some((t) => targets.includes(t)))
|
|
179
223
|
continue;
|
|
180
224
|
for (const t of named)
|
|
@@ -212,6 +256,11 @@ function defaultIsRegisteredHost(log) {
|
|
|
212
256
|
* Use the closing transition, including archived history; later same-state notes
|
|
213
257
|
* and delivery receipts do not transfer responsibility. A newer cancellation
|
|
214
258
|
* without closure metadata still supersedes an older closing actor. */
|
|
259
|
+
/** OpenRig's own machinery (the daemon, or a `@system` actor such as this sweep): it creates and closes rows, but it isn't
|
|
260
|
+
* a seat that can act on a finding. */
|
|
261
|
+
function isMachinerySession(session) {
|
|
262
|
+
return session === "daemon@kernel" || session.endsWith("@system");
|
|
263
|
+
}
|
|
215
264
|
function custodyFindingRoute(db, queueRepo, row) {
|
|
216
265
|
// Unknown identity cannot establish a new owner. The caller retains this row's
|
|
217
266
|
// established destination if the registry needed for classification is unavailable.
|
|
@@ -229,7 +278,7 @@ function custodyFindingRoute(db, queueRepo, row) {
|
|
|
229
278
|
AND (state IS NOT previous_state OR closure_reason IS NOT NULL)
|
|
230
279
|
ORDER BY transition_id DESC LIMIT 1`).get(row.qitemId, row.qitemId);
|
|
231
280
|
for (const session of [closure?.actor_session, row.sourceSession]) {
|
|
232
|
-
if (!session || session
|
|
281
|
+
if (!session || isMachinerySession(session))
|
|
233
282
|
continue;
|
|
234
283
|
if (!queueRepo.isHumanDestination(session) && queueRepo.acceptsDestination(session)) {
|
|
235
284
|
return session;
|
|
@@ -328,9 +377,10 @@ function deliveryResolutionEvidence(deps, kind, qitemId, now) {
|
|
|
328
377
|
if (row.state === "blocked")
|
|
329
378
|
return "source parked";
|
|
330
379
|
if (kind === "undelivered-wake") {
|
|
331
|
-
|
|
380
|
+
const wake = readWakeOutcome(row.lastNudgeResult);
|
|
381
|
+
if (wake?.fact === "accepted" && wake.renderVerified)
|
|
332
382
|
return "source wake verified";
|
|
333
|
-
if (
|
|
383
|
+
if (wake?.fact === "accepted" && wake.route === "hosted-trigger")
|
|
334
384
|
return "source wake accepted by its hosted trigger";
|
|
335
385
|
}
|
|
336
386
|
}
|
|
@@ -365,7 +415,8 @@ function deliveryResolutionEvidence(deps, kind, qitemId, now) {
|
|
|
365
415
|
if (kind === "unclaimed-obligation" && !quiet && deps.queueRepo.isRegisteredHumanUpdate(row) && !deps.queueRepo.deliveryOutcomeFor(qitemId)) {
|
|
366
416
|
return "informational update to a registered human requires no claim";
|
|
367
417
|
}
|
|
368
|
-
|
|
418
|
+
// A temporary hold resolves a failed wake, but unclaimed work still needs its existing standing finding.
|
|
419
|
+
if (kind === "undelivered-wake" && row.lastNudgeResult === "retained:typing_guard") {
|
|
369
420
|
return "source wake held by the seat typing guard";
|
|
370
421
|
}
|
|
371
422
|
return null;
|
|
@@ -461,23 +512,63 @@ function unclaimedBacklogText(seat, rows, thresholdMinutes, node) {
|
|
|
461
512
|
`${BACKLOG_ROWS_PREFIX}${JSON.stringify(sorted.map((r) => r.qitemId))}`,
|
|
462
513
|
};
|
|
463
514
|
}
|
|
515
|
+
/** #2988: the standing notice a delegation parent gets for one child seat's unclaimed rows. It tells the parent about the
|
|
516
|
+
* child's backlog; it claims, moves and completes none of it. Built from the rows' fixed facts, as the seat's own notice
|
|
517
|
+
* is, so a pass rewrites it only when the rows change. */
|
|
518
|
+
function parentBacklogText(child, parent, rows, thresholdMinutes, routedHere) {
|
|
519
|
+
const { sorted, listed, count } = backlogListing(rows);
|
|
520
|
+
return {
|
|
521
|
+
summary: `Stuck sweep: unclaimed-backlog on ${child}, for its delegation parent ${parent} (${count})`,
|
|
522
|
+
body: `STUCK SWEEP FINDING (unclaimed-backlog)\n` +
|
|
523
|
+
`parent: ${parent}\n` +
|
|
524
|
+
`child seat: ${child}\n` +
|
|
525
|
+
`unclaimed: ${count} (the threshold is ${thresholdMinutes} min)\n` +
|
|
526
|
+
`${listed.join("\n")}\n` +
|
|
527
|
+
`why: this is the backlog of ${child}, a seat ${parent} delegates to. Nobody has claimed these rows there, so ` +
|
|
528
|
+
`${parent} is told about them in this one notice instead of a finding per row. It follows the rows as they come and ` +
|
|
529
|
+
`go, and is rewritten in place without a new wake. This notice doesn't claim, move or complete any of them: they ` +
|
|
530
|
+
`stay with ${child} until someone claims, reroutes or closes them.\n` +
|
|
531
|
+
(routedHere ? "" : `note: ${child}'s rows no longer go to ${parent}. This notice keeps standing for them until the sweep ` +
|
|
532
|
+
`finds them stuck again and they go where ${child}'s rows go now.\n`) +
|
|
533
|
+
`List them: rig queue list --destination ${child} --state pending\n` +
|
|
534
|
+
`The sweep closes this notice itself once every row it stands for is claimed, parked or closed, or no longer goes ` +
|
|
535
|
+
`to ${parent}.\n` +
|
|
536
|
+
`${BACKLOG_ROWS_PREFIX}${JSON.stringify(sorted.map((r) => r.qitemId))}`,
|
|
537
|
+
};
|
|
538
|
+
}
|
|
464
539
|
/** A polling hosted member's standing notice: whether it's checking in (its own inbox reads), the rows it hasn't claimed,
|
|
465
540
|
* 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
541
|
* 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
542
|
* or that state change. */
|
|
468
543
|
function polledBacklogText(member, rows, thresholdMinutes, checkIn, now) {
|
|
469
544
|
const { sorted, listed, count } = backlogListing(rows);
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
545
|
+
// The member's shared check-in status, in the same words `rig roster` uses (`describeCheckIn`). Only the words follow
|
|
546
|
+
// it; when this notice is filed doesn't. Where that line would carry the time of a check-in that keeps moving (checking
|
|
547
|
+
// in, on request, unknown), the notice says instead whether the member read its inbox within the threshold, so a
|
|
548
|
+
// check-in rewrites the notice only when it changes that, never its time alone. An overdue or never-seen member's line
|
|
549
|
+
// is fixed until it checks in, so it keeps its evidence.
|
|
550
|
+
const at = checkIn.lastCheckInAt;
|
|
551
|
+
const lately = at !== null && now.getTime() - Date.parse(at) <= thresholdMinutes * 60_000;
|
|
552
|
+
const recency = at === null ? "" : lately ? `; it read its own inbox within the last ${thresholdMinutes} min` : `; no check-in since ${at}`;
|
|
553
|
+
const recent = checkIn.status === "checking-in" || ((checkIn.status === "on-request" || checkIn.status === "unknown") && lately);
|
|
554
|
+
const checkIns = (() => {
|
|
555
|
+
switch (checkIn.status) {
|
|
556
|
+
case "checking-in": return `checking in: its last check-in is within twice its expected ${checkIn.expectedMinutes} min`;
|
|
557
|
+
case "on-request": return `on request: it checks its queue when a person asks it${recency}`;
|
|
558
|
+
case "unknown": return `unknown (${checkIn.reason ?? "its check-in status couldn't be read"})${recency}`;
|
|
559
|
+
case "check-in-overdue":
|
|
560
|
+
case "no-check-in-yet":
|
|
561
|
+
case "disconnected":
|
|
562
|
+
return describeCheckIn(checkIn);
|
|
563
|
+
}
|
|
564
|
+
})();
|
|
476
565
|
const why = recent
|
|
477
|
-
? "it's
|
|
478
|
-
: checkIn.
|
|
479
|
-
? "nobody has claimed these rows, and
|
|
480
|
-
:
|
|
566
|
+
? "it's reading its own inbox, but this work is still unclaimed. Check whether it can do this work, or route it to another seat"
|
|
567
|
+
: checkIn.status === "check-in-overdue"
|
|
568
|
+
? "nobody has claimed these rows, and it hasn't checked in as often as its setup expects. Ask its owner to check its schedule or a pending approval, or route the work to another seat"
|
|
569
|
+
: checkIn.status === "unknown" && at === null
|
|
570
|
+
? "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"
|
|
571
|
+
: "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
572
|
return {
|
|
482
573
|
summary: `Stuck sweep: unclaimed-backlog on ${member} (${count})`,
|
|
483
574
|
body: `STUCK SWEEP FINDING (unclaimed-backlog)\n` +
|
|
@@ -540,7 +631,12 @@ export async function runStuckSweep(deps) {
|
|
|
540
631
|
// Every yield and every awaited write lets other code run: indexes read before it are dropped, and `othersRan`
|
|
541
632
|
// tells a list read before it that its rows need a fresh read.
|
|
542
633
|
let othersRan = 0;
|
|
543
|
-
|
|
634
|
+
/** Each seat's agent-seat reading (agentSeatNode, below), dropped with the indexes: another writer can declare a
|
|
635
|
+
* seat's delegation parent while the pass yields or awaits a write. */
|
|
636
|
+
const agentSeats = new Map();
|
|
637
|
+
/** #2988: each seat's one declared delegation parent (parentNow, below), dropped with agentSeats. */
|
|
638
|
+
const parentsNow = new Map();
|
|
639
|
+
const othersMayHaveRun = () => { othersRan++; recoveries.invalidate(); successors?.invalidate(); agentSeats.clear(); parentsNow.clear(); };
|
|
544
640
|
// A successor index whose build took at least half of a stretch that yielded by elapsed time is not rebuilt for
|
|
545
641
|
// 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
642
|
// few rows, so the rows would pay about one build each instead of one per STUCK_SWEEP_YIELD_EVERY_ROWS. Those rows
|
|
@@ -571,6 +667,8 @@ export async function runStuckSweep(deps) {
|
|
|
571
667
|
const ageMinutes = deps.unclaimedAgeMinutes ?? resolveStuckSweepUnclaimedAgeMinutes();
|
|
572
668
|
const routeNotes = new Map();
|
|
573
669
|
const routed = new Set();
|
|
670
|
+
/** #2988: the row's route was its seat's one declared delegation parent (resolveEscalationOwner outcome "parent"). */
|
|
671
|
+
const delegationParent = new Map();
|
|
574
672
|
const resolveOrch = (session, row) => {
|
|
575
673
|
if (hasConsumedEscalationHop(deps.db, row.qitemId)) {
|
|
576
674
|
routeNotes.set(row.qitemId, "escalates_to one-hop delivery already used; existing fallback retained");
|
|
@@ -583,6 +681,10 @@ export async function runStuckSweep(deps) {
|
|
|
583
681
|
routeNotes.set(row.qitemId, route.reason);
|
|
584
682
|
if (route.outcome === "routed")
|
|
585
683
|
routed.add(row.qitemId);
|
|
684
|
+
if (route.outcome === "parent" && route.owner)
|
|
685
|
+
delegationParent.set(row.qitemId, route.owner);
|
|
686
|
+
else
|
|
687
|
+
delegationParent.delete(row.qitemId);
|
|
586
688
|
return route.owner;
|
|
587
689
|
};
|
|
588
690
|
const isRegisteredHost = deps.isRegisteredHost ?? defaultIsRegisteredHost(log);
|
|
@@ -1171,8 +1273,6 @@ export async function runStuckSweep(deps) {
|
|
|
1171
1273
|
c.why += `. This finding goes to ${recipient.seat}, ${NO_WAKE_ROUTE_RULES[recipient.chosen]}`;
|
|
1172
1274
|
c.route = recipient.seat;
|
|
1173
1275
|
};
|
|
1174
|
-
/** The two re-routes, in order, for one candidate. */
|
|
1175
|
-
const routeCandidate = (c) => { routeAroundMissing(c); routeAroundNoWake(c); };
|
|
1176
1276
|
for (const c of candidates) {
|
|
1177
1277
|
if (dueToYield())
|
|
1178
1278
|
await yieldLoop();
|
|
@@ -1197,10 +1297,9 @@ export async function runStuckSweep(deps) {
|
|
|
1197
1297
|
// (below). A finding per row stays for a person's address or a terminal seat, for a declared route that failed (its
|
|
1198
1298
|
// finding names why, and a declared delegation parent with no session is one), and for a row that already has a
|
|
1199
1299
|
// recovery.
|
|
1200
|
-
const agentSeats = new Map();
|
|
1201
1300
|
/** An agent seat's node: one whose runtime isn't a terminal, with no declared delegation parent, at an address that
|
|
1202
1301
|
* 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
|
|
1302
|
+
* once per seat until other code may have run (agentSeats). */
|
|
1204
1303
|
const agentSeatNode = (session) => {
|
|
1205
1304
|
if (agentSeats.has(session))
|
|
1206
1305
|
return agentSeats.get(session);
|
|
@@ -1219,6 +1318,31 @@ export async function runStuckSweep(deps) {
|
|
|
1219
1318
|
agentSeats.set(session, agent);
|
|
1220
1319
|
return agent;
|
|
1221
1320
|
};
|
|
1321
|
+
// A wake that failed at a live agent seat with no delegation parent or escalates_to made its finding that same seat's,
|
|
1322
|
+
// so the finding's own wake went to the seat that had just failed to take one, onto whatever was in its input box.
|
|
1323
|
+
// The row's creator can act on it (resend, reroute or ask), as the waiting and parked-owner findings already route;
|
|
1324
|
+
// for a seat that sent itself the work, a row OpenRig's own machinery created, or a creator that is a bound terminal
|
|
1325
|
+
// seat (nothing there can claim it, as for the no-wake rule), the operator agent can. A declared
|
|
1326
|
+
// route that failed keeps its fallback, and a finding the two re-routes above moved keeps its recipient. A wake that
|
|
1327
|
+
// found no route never reached the seat, so a seat launched since keeps its own finding, whose wake is the one it missed.
|
|
1328
|
+
const routeAroundFailedWake = (c) => {
|
|
1329
|
+
if (c.kind !== "undelivered-wake" || !startsWithCI(c.row.lastNudgeResult, "failed:") || c.noWake
|
|
1330
|
+
|| c.route !== c.row.destinationSession
|
|
1331
|
+
|| routeNotes.has(c.row.qitemId) || agentSeatNode(c.route) === null)
|
|
1332
|
+
return;
|
|
1333
|
+
const choices = [c.row.sourceSession, (deps.resolveRecoveryAgentSeat ?? resolveRecoveryAgentSeat)()];
|
|
1334
|
+
const chosen = choices.findIndex((seat) => !!seat && seat !== c.route && !isMachinerySession(seat)
|
|
1335
|
+
&& !sessionMissing(seat) && deps.queueRepo.acceptsDestination(seat) && !isBoundTerminalSeat(deps.db, seat));
|
|
1336
|
+
if (chosen < 0) {
|
|
1337
|
+
c.why += `; ${c.route} declares no delegation parent or escalates_to, and its creator and the operator agent (agents.operator_session) are each unset, missing, this seat, OpenRig's own machinery, a terminal seat or not an address this queue takes, so this finding stays addressed to it`;
|
|
1338
|
+
return;
|
|
1339
|
+
}
|
|
1340
|
+
c.why += `; ${c.route} declares no delegation parent or escalates_to, so this finding goes to ${choices[chosen]}, ${FAILED_WAKE_ROUTE_RULES[chosen]}`;
|
|
1341
|
+
c.route = choices[chosen];
|
|
1342
|
+
};
|
|
1343
|
+
/** The three re-routes, in order, for one candidate. The third reads no earlier pass: a failed wake's finding is
|
|
1344
|
+
* routed only here, on the row as it is right before the finding is created. */
|
|
1345
|
+
const routeCandidate = (c) => { routeAroundMissing(c); routeAroundNoWake(c); routeAroundFailedWake(c); };
|
|
1222
1346
|
const selfRoutedUnclaimed = (c) => c.kind === "unclaimed-obligation"
|
|
1223
1347
|
&& c.route === c.row.destinationSession && !routeNotes.has(c.row.qitemId) && agentSeatNode(c.route) !== null;
|
|
1224
1348
|
// A hosted member that polls for its work (no wake trigger) can't hear a finding, so each unclaimed row went to a
|
|
@@ -1226,16 +1350,43 @@ export async function runStuckSweep(deps) {
|
|
|
1226
1350
|
// declares (a delegation parent or escalates_to) takes them.
|
|
1227
1351
|
const polledUnclaimed = (c) => c.kind === "unclaimed-obligation" && c.noWake === true
|
|
1228
1352
|
&& !routeNotes.has(c.row.qitemId) && polledRow(c.row);
|
|
1229
|
-
|
|
1230
|
-
|
|
1353
|
+
// #2988: an unclaimed row whose finding goes to its seat's one declared delegation parent (a live seat the re-routes
|
|
1354
|
+
// left in place) shares one standing notice per (parent, child seat) instead of a finding per row, each waking the
|
|
1355
|
+
// parent. A route the row's seat declares otherwise (escalates_to, a consumed hop, a re-route) keeps a finding per row.
|
|
1356
|
+
const parentRoutedUnclaimed = (c) => c.kind === "unclaimed-obligation" && c.noWake !== true
|
|
1357
|
+
&& c.route !== c.row.destinationSession && delegationParent.get(c.row.qitemId) === c.route
|
|
1358
|
+
&& !routeNotes.has(c.row.qitemId) && !routed.has(c.row.qitemId);
|
|
1359
|
+
/** The standing notice a candidate belongs to (the seat or member it stands for, or the parent and child seat), or null
|
|
1360
|
+
* for a finding of its own. */
|
|
1361
|
+
const backlogKeyOf = (c) => polledUnclaimed(c) ? c.row.destinationSession : selfRoutedUnclaimed(c) ? c.route
|
|
1362
|
+
: parentRoutedUnclaimed(c) ? `${c.row.destinationSession}${PARENT_BACKLOG_SEPARATOR}${c.route}` : null;
|
|
1363
|
+
/** #2988's transition: an open per-row unclaimed finding the sweep filed to the parent before, for a row that now joins
|
|
1364
|
+
* that parent's notice. It's folded in (closed, once the notice that takes its row is written) rather than kept
|
|
1365
|
+
* beside the notice. Keyed by the row; the value is the per-row finding. */
|
|
1366
|
+
const foldFrom = new Map();
|
|
1367
|
+
/** The per-row finding this candidate's row would fold into a parent's notice, or null. */
|
|
1368
|
+
const foldable = (c, shared) => {
|
|
1369
|
+
// Only one nobody has taken up: a finding the parent claimed or parked is its work now, and stays as it is.
|
|
1370
|
+
if (!shared || shared.state !== "pending" || !parentRoutedUnclaimed(c))
|
|
1371
|
+
return null;
|
|
1372
|
+
const finding = indexed(() => deps.queueRepo.getById(shared.qitemId, { waiting: false }));
|
|
1373
|
+
return finding && isFindingRow(finding) && finding.state === "pending" && !finding.claimedAt
|
|
1374
|
+
&& finding.destinationSession === c.route
|
|
1375
|
+
&& (finding.tags ?? []).includes(findingDedupTag("unclaimed-obligation", c.row.qitemId)) ? finding.qitemId : null;
|
|
1376
|
+
};
|
|
1231
1377
|
const unclaimedBacklog = new Map();
|
|
1232
1378
|
for (const c of [...new Map(candidates.map(c => [c.row.qitemId, c])).values()]) {
|
|
1233
1379
|
if (dueToYield())
|
|
1234
1380
|
await yieldLoop();
|
|
1235
1381
|
const dedupTag = findingDedupTag(c.kind, c.row.qitemId);
|
|
1236
1382
|
const shared = recoveries.find(c.row.qitemId);
|
|
1237
|
-
const
|
|
1383
|
+
const fold = foldable(c, shared);
|
|
1384
|
+
const backlogKey = shared && !fold ? null : backlogKeyOf(c);
|
|
1238
1385
|
if (backlogKey) {
|
|
1386
|
+
if (fold)
|
|
1387
|
+
foldFrom.set(c.row.qitemId, fold);
|
|
1388
|
+
else
|
|
1389
|
+
foldFrom.delete(c.row.qitemId);
|
|
1239
1390
|
const rows = unclaimedBacklog.get(backlogKey);
|
|
1240
1391
|
if (rows)
|
|
1241
1392
|
rows.push(c);
|
|
@@ -1286,7 +1437,7 @@ export async function runStuckSweep(deps) {
|
|
|
1286
1437
|
// The first term is implied by the second (its pattern starts with that literal); it lets
|
|
1287
1438
|
// the planner use idx_queue_items_recovery_tags (migration 099) instead of a full scan.
|
|
1288
1439
|
`SELECT qitem_id, source_session, state, ts_updated FROM queue_items
|
|
1289
|
-
WHERE (tags LIKE '%"stuck-sweep:%') AND tags LIKE ?
|
|
1440
|
+
WHERE (tags LIKE '%"stuck-sweep:%') AND tags LIKE ? AND tags NOT LIKE '%"${BACKLOG_FOLDED_TAG}"%'
|
|
1290
1441
|
ORDER BY CASE WHEN state IN ('pending', 'in-progress', 'blocked') THEN 0 ELSE 1 END,
|
|
1291
1442
|
ts_updated DESC, ts_created DESC, qitem_id DESC
|
|
1292
1443
|
LIMIT 1`)
|
|
@@ -1307,7 +1458,8 @@ export async function runStuckSweep(deps) {
|
|
|
1307
1458
|
continue;
|
|
1308
1459
|
routeCandidate(now_); // its destination, reason and targets as they are now
|
|
1309
1460
|
const input = {
|
|
1310
|
-
|
|
1461
|
+
// A finding folded into a parent's notice (#2988) holds its id without owning the row: a new one gets its own.
|
|
1462
|
+
qitemId: freshRecoveryId(deps.db, c.row.qitemId, renewedDeadline ? c.row.closureRequiredAt : undefined),
|
|
1311
1463
|
// The detector is machinery, not a seat: the obligation's own creator is the
|
|
1312
1464
|
// finding's source (the workflow-exception precedent).
|
|
1313
1465
|
sourceSession: c.row.sourceSession,
|
|
@@ -1326,6 +1478,11 @@ export async function runStuckSweep(deps) {
|
|
|
1326
1478
|
try {
|
|
1327
1479
|
const created = await deps.queueRepo.create(input);
|
|
1328
1480
|
othersMayHaveRun();
|
|
1481
|
+
// An existing row with this id, same source and destination, comes back as an idempotent retry: a closed one is
|
|
1482
|
+
// no finding for the row now, so it's reported, never counted as created.
|
|
1483
|
+
if (!["pending", "in-progress", "blocked"].includes(created.state)) {
|
|
1484
|
+
throw new Error(`${created.qitemId} already exists and is ${created.state}`);
|
|
1485
|
+
}
|
|
1329
1486
|
findings.push({ kind: c.kind, qitemId: c.row.qitemId, findingQitemId: created.qitemId, action: "created" });
|
|
1330
1487
|
}
|
|
1331
1488
|
catch (err) {
|
|
@@ -1354,28 +1511,134 @@ export async function runStuckSweep(deps) {
|
|
|
1354
1511
|
}
|
|
1355
1512
|
catch { /* Skip malformed tags */ }
|
|
1356
1513
|
}
|
|
1357
|
-
|
|
1514
|
+
/** #2988: the one declared delegation parent a seat's rows go to now, or null (none, several, another route, or a
|
|
1515
|
+
* resolver the caller supplied, whose outcome isn't known). Read once per seat until other code may have run. */
|
|
1516
|
+
const parentNow = (seat) => {
|
|
1517
|
+
if (deps.resolveOrchestrator)
|
|
1518
|
+
return null;
|
|
1519
|
+
if (!parentsNow.has(seat)) {
|
|
1520
|
+
const route = resolveEscalationOwner(deps.db, seat, target => deps.queueRepo.acceptsDestination(target));
|
|
1521
|
+
parentsNow.set(seat, route.outcome === "parent" ? route.owner : null);
|
|
1522
|
+
}
|
|
1523
|
+
return parentsNow.get(seat);
|
|
1524
|
+
};
|
|
1525
|
+
/** #2988: the open notice with this key lists the row (one actually written: a create that failed leaves the row
|
|
1526
|
+
* where it was). */
|
|
1527
|
+
const openNoticeLists = (tag, id) => {
|
|
1528
|
+
const open = deps.db.prepare(`SELECT body FROM queue_items WHERE state IN ('pending', 'in-progress', 'blocked')
|
|
1529
|
+
AND (tags LIKE '%"stuck-sweep:%') AND tags LIKE ? ESCAPE '\\' LIMIT 1`)
|
|
1530
|
+
.get(`%"${tag.replace(/[\\%_]/g, (ch) => `\\${ch}`)}"%`);
|
|
1531
|
+
return open ? backlogRowsOf(open.body)?.has(id) === true : false;
|
|
1532
|
+
};
|
|
1533
|
+
/** #2988: an open notice to this seat's delegation parent lists the row. */
|
|
1534
|
+
const parentNoticeStandsFor = (seat, id) => {
|
|
1535
|
+
const parent = parentNow(seat);
|
|
1536
|
+
return parent ? openNoticeLists(parentBacklogTag(parent, seat), id) : false;
|
|
1537
|
+
};
|
|
1538
|
+
/** #2988: a row a parent's notice stands for no longer goes to that parent (another parent, none, or a used hop). The
|
|
1539
|
+
* notice lets go of it only once something written stands for it where it goes now: the open notice it goes to lists
|
|
1540
|
+
* it, or a closed one there holds it back this pass (a finding of its own lets go of it before this). Under a detection
|
|
1541
|
+
* filter (a raised threshold, the wake ladder), or while that notice can't be written, nothing does, and the old notice
|
|
1542
|
+
* keeps standing for it: a detection filter never reads as done. A pass files a seat's rows before it reads the notices no row goes to, so a
|
|
1543
|
+
* row usually moves in one pass; at worst it is in both notices for one more. */
|
|
1544
|
+
/** #2988: per notice key, the rows a closed notice held back this pass (below), so a notice a row leaves can tell. */
|
|
1545
|
+
const heldBack = new Map();
|
|
1546
|
+
const coveredElsewhere = (seat, id) => {
|
|
1547
|
+
if (hasConsumedEscalationHop(deps.db, id))
|
|
1548
|
+
return false;
|
|
1549
|
+
const next = parentNow(seat);
|
|
1550
|
+
const tag = next ? parentBacklogTag(next, seat) : unclaimedBacklogTag(seat);
|
|
1551
|
+
// A closed notice there that holds the row back (dismissed by where it goes now) stands for it too.
|
|
1552
|
+
return openNoticeLists(tag, id) || heldBack.get(tag)?.has(id) === true;
|
|
1553
|
+
};
|
|
1554
|
+
/** Closes the per-row findings a parent's notice now stands for (#2988's transition), once that notice is written. The
|
|
1555
|
+
* rows and their findings were read before the pass yielded and awaited writes, so each fold rechecks, right before
|
|
1556
|
+
* it writes and with nothing awaited in between, everything it rests on: the row still waits unclaimed at the
|
|
1557
|
+
* seat, the seat's one declared delegation parent is still this parent (and the row's one hop unused), the
|
|
1558
|
+
* finding is still the row's open recovery, nobody's taken it up, and the written notice is open and lists the
|
|
1559
|
+
* row. Anything else, or anything it can't read, leaves the finding open and unmarked. */
|
|
1560
|
+
const foldInto = async (noticeId, seat, parent, rowIds) => {
|
|
1561
|
+
for (const id of rowIds) {
|
|
1562
|
+
const findingId = foldFrom.get(id);
|
|
1563
|
+
if (!findingId)
|
|
1564
|
+
continue;
|
|
1565
|
+
foldFrom.delete(id);
|
|
1566
|
+
if (dueToYield())
|
|
1567
|
+
await yieldLoop();
|
|
1568
|
+
const row = deps.queueRepo.getById(id, { waiting: false });
|
|
1569
|
+
if (!row || row.state !== "pending" || row.claimedAt || row.destinationSession !== seat)
|
|
1570
|
+
continue;
|
|
1571
|
+
if (deps.resolveOrchestrator || hasConsumedEscalationHop(deps.db, id))
|
|
1572
|
+
continue;
|
|
1573
|
+
// The whole rule that made the row's finding, on the row as it is now (a wake that failed meanwhile, a person's
|
|
1574
|
+
// ask, a live ladder), not only its state.
|
|
1575
|
+
if (!unclaimedCandidate(id, false))
|
|
1576
|
+
continue;
|
|
1577
|
+
const route = resolveEscalationOwner(deps.db, seat, target => deps.queueRepo.acceptsDestination(target));
|
|
1578
|
+
if (route.outcome !== "parent" || route.owner !== parent)
|
|
1579
|
+
continue;
|
|
1580
|
+
const finding = deps.db.prepare("SELECT state, claimed_at, destination_session FROM queue_items WHERE qitem_id = ?").get(findingId);
|
|
1581
|
+
if (!finding || finding.state !== "pending" || finding.claimed_at || finding.destination_session !== parent)
|
|
1582
|
+
continue;
|
|
1583
|
+
if (findQueueRecovery(deps.db, id)?.qitemId !== findingId)
|
|
1584
|
+
continue;
|
|
1585
|
+
// The notice still reaches the parent: one that changed hands (a handoff, a fallback) isn't the parent's signal.
|
|
1586
|
+
const notice = deps.db.prepare("SELECT state, body, destination_session FROM queue_items WHERE qitem_id = ?").get(noticeId);
|
|
1587
|
+
if (!notice || !["pending", "in-progress", "blocked"].includes(notice.state) || notice.destination_session !== parent
|
|
1588
|
+
|| backlogRowsOf(notice.body)?.has(id) !== true)
|
|
1589
|
+
continue;
|
|
1590
|
+
try {
|
|
1591
|
+
// The mark and the close together: a close that fails leaves the finding open and unmarked, as it was.
|
|
1592
|
+
deps.db.transaction(() => {
|
|
1593
|
+
deps.db.prepare(`UPDATE queue_items SET tags = json_insert(tags, '$[#]', ?) WHERE qitem_id = ? AND json_valid(tags)
|
|
1594
|
+
AND NOT EXISTS (SELECT 1 FROM json_each(tags) WHERE value = ?)`).run(BACKLOG_FOLDED_TAG, findingId, BACKLOG_FOLDED_TAG);
|
|
1595
|
+
deps.queueRepo.update({
|
|
1596
|
+
qitemId: findingId,
|
|
1597
|
+
actorSession: "stuck-sweep@system",
|
|
1598
|
+
state: "done",
|
|
1599
|
+
closureReason: "no-follow-on",
|
|
1600
|
+
transitionNote: `stuck-sweep folded: unclaimed-obligation on ${id} into the standing unclaimed-backlog notice ${noticeId} for ${parent}, which now stands for this row`,
|
|
1601
|
+
});
|
|
1602
|
+
})();
|
|
1603
|
+
findings.push({ kind: "unclaimed-obligation", qitemId: id, findingQitemId: findingId, action: "closed" });
|
|
1604
|
+
}
|
|
1605
|
+
catch (err) {
|
|
1606
|
+
const message = `unclaimed-obligation finding ${findingId} for ${id} not folded into ${noticeId}: ${err instanceof Error ? err.message : String(err)}`;
|
|
1607
|
+
log(`[stuck-sweep] ${message}`);
|
|
1608
|
+
failedCreates.push(message);
|
|
1609
|
+
}
|
|
1610
|
+
othersMayHaveRun();
|
|
1611
|
+
}
|
|
1612
|
+
};
|
|
1613
|
+
for (const key of backlogSeats) {
|
|
1358
1614
|
if (dueToYield())
|
|
1359
1615
|
await yieldLoop();
|
|
1360
|
-
const rows = unclaimedBacklog.get(
|
|
1361
|
-
const
|
|
1616
|
+
const rows = unclaimedBacklog.get(key) ?? [];
|
|
1617
|
+
const { seat, parent } = backlogKeyParts(key);
|
|
1618
|
+
const tag = parent ? parentBacklogTag(parent, seat) : unclaimedBacklogTag(seat);
|
|
1362
1619
|
liveDedupTags.add(tag);
|
|
1363
1620
|
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
|
-
|
|
1366
|
-
const
|
|
1367
|
-
|
|
1368
|
-
|
|
1621
|
+
// A polling member's notice says whether it's checking in; an agent seat's names the route to add instead; a
|
|
1622
|
+
// parent's says whose backlog it is.
|
|
1623
|
+
const polled = !parent && (rows.length > 0 ? rows.some(polledUnclaimed) : pollsForWork(seat));
|
|
1624
|
+
const backlogText = (standsFor) => parent
|
|
1625
|
+
? parentBacklogText(seat, parent, standsFor, ageMinutes, parentNow(seat) === parent)
|
|
1626
|
+
: polled
|
|
1627
|
+
? polledBacklogText(seat, standsFor, ageMinutes, deps.queueRepo.hostedMemberCheckIn(seat, now), now)
|
|
1628
|
+
: unclaimedBacklogText(seat, standsFor, ageMinutes, node);
|
|
1369
1629
|
// 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.
|
|
1630
|
+
// else the operator agent. With none, it stays with the member, which reads it when it next checks. A parent's
|
|
1631
|
+
// notice goes to the parent.
|
|
1371
1632
|
const recipientFor = (creators) => {
|
|
1633
|
+
if (parent)
|
|
1634
|
+
return parent;
|
|
1372
1635
|
if (!polled)
|
|
1373
1636
|
return seat;
|
|
1374
1637
|
const distinct = [...new Set(creators)];
|
|
1375
1638
|
return noWakeRecipient(seat, distinct.length === 1 ? distinct[0] : null).seat ?? seat;
|
|
1376
1639
|
};
|
|
1377
|
-
/** Files a notice and wakes its recipient;
|
|
1378
|
-
const fileNotice = async (text, recipient) => {
|
|
1640
|
+
/** Files a notice and wakes its recipient; its id, or null when the create failed (reported in failedCreates). */
|
|
1641
|
+
const fileNotice = async (text, recipient, creators = []) => {
|
|
1379
1642
|
try {
|
|
1380
1643
|
const created = await deps.queueRepo.create({
|
|
1381
1644
|
// A notice about a seat's own rows comes from that seat, as a restore notice does; OpenRig wakes its recipient.
|
|
@@ -1384,25 +1647,27 @@ export async function runStuckSweep(deps) {
|
|
|
1384
1647
|
body: text.body,
|
|
1385
1648
|
summary: text.summary,
|
|
1386
1649
|
evidenceRef: `rig queue list --destination ${seat} --state pending`,
|
|
1387
|
-
tags: [STUCK_SWEEP_FINDING_TAG, tag
|
|
1650
|
+
tags: [STUCK_SWEEP_FINDING_TAG, tag,
|
|
1651
|
+
...(polled && recipient !== seat && creators.length > 0 && creators.every((c) => c === recipient)
|
|
1652
|
+
? [creatorMark(recipient)] : [])],
|
|
1388
1653
|
wakeTrigger: "openrig",
|
|
1389
1654
|
});
|
|
1390
1655
|
othersMayHaveRun();
|
|
1391
|
-
findings.push({ kind: "unclaimed-backlog", qitemId:
|
|
1392
|
-
return
|
|
1656
|
+
findings.push({ kind: "unclaimed-backlog", qitemId: key, findingQitemId: created.qitemId, action: "created" });
|
|
1657
|
+
return created.qitemId;
|
|
1393
1658
|
}
|
|
1394
1659
|
catch (err) {
|
|
1395
|
-
const message = `unclaimed-backlog notice for ${seat} not created: ${err instanceof Error ? err.message : String(err)}`;
|
|
1660
|
+
const message = `unclaimed-backlog notice for ${parent ? `${seat}, to its delegation parent ${parent},` : seat} not created: ${err instanceof Error ? err.message : String(err)}`;
|
|
1396
1661
|
othersMayHaveRun();
|
|
1397
1662
|
log(`[stuck-sweep] ${message}`);
|
|
1398
1663
|
failedCreates.push(message);
|
|
1399
|
-
return
|
|
1664
|
+
return null;
|
|
1400
1665
|
}
|
|
1401
1666
|
};
|
|
1402
1667
|
const last = deps.db
|
|
1403
1668
|
.prepare(
|
|
1404
1669
|
// 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
|
|
1670
|
+
`SELECT qitem_id, state, ts_updated, summary, body, destination_session, tags FROM queue_items
|
|
1406
1671
|
WHERE (tags LIKE '%"stuck-sweep:%') AND tags LIKE ? ESCAPE '\\'
|
|
1407
1672
|
ORDER BY CASE WHEN state IN ('pending', 'in-progress', 'blocked') THEN 0 ELSE 1 END,
|
|
1408
1673
|
ts_updated DESC, ts_created DESC, qitem_id DESC
|
|
@@ -1410,32 +1675,90 @@ export async function runStuckSweep(deps) {
|
|
|
1410
1675
|
.get(`%"${tag.replace(/[\\%_]/g, (ch) => `\\${ch}`)}"%`);
|
|
1411
1676
|
if (last && ["pending", "in-progress", "blocked"].includes(last.state)) {
|
|
1412
1677
|
const listedNow = new Set(rows.map((c) => c.row.qitemId));
|
|
1413
|
-
|
|
1414
|
-
|
|
1678
|
+
// An unreadable list is rebuilt as every row still waiting unclaimed at the seat: all it could have stood for that
|
|
1679
|
+
// nothing has resolved yet, and maybe more, never just the rows that qualify on this pass (review of #3049). From
|
|
1680
|
+
// there the notice follows its rows as any other: it lets go of each one only as it's resolved or covered elsewhere.
|
|
1681
|
+
// A member's notice the sweep marked as filed to the one creator of its rows only ever listed that creator's rows:
|
|
1682
|
+
// the mark alone proves it, and it names that creator, whoever holds the notice now (any rewrite that brings in
|
|
1683
|
+
// another creator's row drops it). Without the mark (an operator that is no longer recognized, an older notice,
|
|
1684
|
+
// unreadable tags), it carries every unresolved row.
|
|
1685
|
+
const readable = backlogRowsOf(last.body);
|
|
1686
|
+
const onlyFrom = markedCreator(last.tags);
|
|
1687
|
+
const stoodFor = readable ?? new Set(deps.db.prepare(`SELECT qitem_id FROM queue_items WHERE destination_session = ?
|
|
1688
|
+
AND state = 'pending' AND claimed_at IS NULL AND (? IS NULL OR source_session = ?)
|
|
1689
|
+
AND NOT (json_valid(tags) AND EXISTS (SELECT 1 FROM json_each(tags) WHERE value = ?))`)
|
|
1690
|
+
.all(seat, onlyFrom, onlyFrom, STUCK_SWEEP_FINDING_TAG).map((r) => r.qitem_id));
|
|
1691
|
+
// #2988: rows this notice lets go of only because something else stands for them now (a finding of their own,
|
|
1692
|
+
// another parent's or the seat's own notice, a temporary typing hold, or this pass's route for them). Nothing resolved them, so a notice the
|
|
1693
|
+
// sweep closes doesn't hold them back: they leave its list before it closes.
|
|
1694
|
+
const routedAway = new Set();
|
|
1695
|
+
// Read within the sweep's bounded yield (a rebuilt list can be long); a notice changed meanwhile is left for the next pass.
|
|
1696
|
+
const still = [];
|
|
1697
|
+
let yielded = false;
|
|
1698
|
+
for (const id of [...stoodFor].filter((x) => !listedNow.has(x))) {
|
|
1699
|
+
if (dueToYield()) {
|
|
1700
|
+
await yieldLoop();
|
|
1701
|
+
yielded = true;
|
|
1702
|
+
}
|
|
1415
1703
|
const row = indexed(() => deps.queueRepo.getById(id, { waiting: false }));
|
|
1416
|
-
// Gone, someone else's now, resolved at its source
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1704
|
+
// Gone, someone else's now, or resolved at its source.
|
|
1705
|
+
if (!row || row.destinationSession !== seat)
|
|
1706
|
+
continue;
|
|
1707
|
+
// A typing hold is temporary custody, not a dismissal of this work. Let the closed notice release the row:
|
|
1708
|
+
// when the hold clears, it can qualify again even without a newer pending timestamp or wake attempt.
|
|
1709
|
+
if (row.state === "pending" && !row.claimedAt && row.lastNudgeResult === "retained:typing_guard") {
|
|
1710
|
+
routedAway.add(id);
|
|
1711
|
+
continue;
|
|
1712
|
+
}
|
|
1713
|
+
if (deliveryResolutionEvidence(deps, "unclaimed-obligation", id, now))
|
|
1714
|
+
continue;
|
|
1715
|
+
// Held by a finding or recovery of its own (one actually written, so a create that failed this pass leaves the row
|
|
1716
|
+
// here): that finding holds it back from now on, a dismissed one too. The notice lets go of it rather than also
|
|
1717
|
+
// holding it once closed: a fold into a parent's notice (#2988) can release that finding's custody, and the row
|
|
1718
|
+
// must then be able to reach a notice again.
|
|
1719
|
+
if (recoveries.find(id)) {
|
|
1720
|
+
routedAway.add(id);
|
|
1721
|
+
continue;
|
|
1722
|
+
}
|
|
1723
|
+
// A parent's notice lets go of a row whose seat's delegation parent is now another seat (or none), or whose one
|
|
1724
|
+
// escalation hop is used; a seat's own notice, of a row its new parent's notice already stands for (#2988).
|
|
1725
|
+
if (parent
|
|
1726
|
+
? (parentNow(seat) !== parent || hasConsumedEscalationHop(deps.db, id)) && coveredElsewhere(seat, id)
|
|
1727
|
+
: parentNoticeStandsFor(seat, id)) {
|
|
1728
|
+
routedAway.add(id);
|
|
1729
|
+
continue;
|
|
1730
|
+
}
|
|
1731
|
+
still.push({ qitemId: id, since: pendingSince(deps.db, id) ?? row.tsCreated, from: row.sourceSession, summary: row.summary });
|
|
1732
|
+
}
|
|
1733
|
+
if (yielded) {
|
|
1734
|
+
const noticeNow = deps.db.prepare("SELECT state, body FROM queue_items WHERE qitem_id = ?").get(last.qitem_id);
|
|
1735
|
+
if (!noticeNow || !["pending", "in-progress", "blocked"].includes(noticeNow.state) || noticeNow.body !== last.body) {
|
|
1736
|
+
findings.push({ kind: "unclaimed-backlog", qitemId: key, findingQitemId: last.qitem_id, action: "refreshed" });
|
|
1737
|
+
continue;
|
|
1738
|
+
}
|
|
1428
1739
|
}
|
|
1740
|
+
const standsFor = [...rows.map(backlogRow), ...still];
|
|
1429
1741
|
if (standsFor.length === 0) {
|
|
1742
|
+
if (routedAway.size > 0 || !readable) {
|
|
1743
|
+
// Only the rows something resolved stay in the list the closed notice holds back. A notice whose list was
|
|
1744
|
+
// unreadable never knew its rows, so it holds none back.
|
|
1745
|
+
const kept = readable ? [...readable].filter((id) => !routedAway.has(id)) : [];
|
|
1746
|
+
const body = last.body.split("\n").filter((l) => !l.startsWith(BACKLOG_ROWS_PREFIX)).join("\n")
|
|
1747
|
+
+ `\n${BACKLOG_ROWS_PREFIX}${JSON.stringify(kept)}`;
|
|
1748
|
+
deps.db.prepare("UPDATE queue_items SET body = ? WHERE qitem_id = ? AND body = ? AND state IN ('pending', 'in-progress', 'blocked')")
|
|
1749
|
+
.run(body, last.qitem_id, last.body);
|
|
1750
|
+
}
|
|
1430
1751
|
await deps.queueRepo.update({
|
|
1431
1752
|
qitemId: last.qitem_id,
|
|
1432
1753
|
actorSession: "stuck-sweep@system",
|
|
1433
1754
|
state: "done",
|
|
1434
1755
|
closureReason: "no-follow-on",
|
|
1435
|
-
transitionNote:
|
|
1756
|
+
transitionNote: parent
|
|
1757
|
+
? `stuck-sweep resolved: unclaimed-backlog on ${seat} for ${parent}: every row it stood for is claimed, parked, closed, temporarily held, has its own finding or no longer goes to ${parent}`
|
|
1758
|
+
: `stuck-sweep resolved: unclaimed-backlog on ${seat}: every row it stood for is claimed, parked, closed, temporarily held, has its own finding or is in its delegation parent's notice`,
|
|
1436
1759
|
});
|
|
1437
1760
|
othersMayHaveRun();
|
|
1438
|
-
findings.push({ kind: "unclaimed-backlog", qitemId:
|
|
1761
|
+
findings.push({ kind: "unclaimed-backlog", qitemId: key, findingQitemId: last.qitem_id, action: "closed" });
|
|
1439
1762
|
continue;
|
|
1440
1763
|
}
|
|
1441
1764
|
// A notice that went to one of its rows' creators (no person reachable) shows that creator only rows it sent. When a
|
|
@@ -1446,7 +1769,7 @@ export async function runStuckSweep(deps) {
|
|
|
1446
1769
|
if (polled && last.destination_session !== seat && !seesAnyRow(last.destination_session)
|
|
1447
1770
|
&& standsFor.some((r) => r.from !== last.destination_session)) {
|
|
1448
1771
|
const recipient = recipientFor(standsFor.map((r) => r.from));
|
|
1449
|
-
if (!(await fileNotice(backlogText(standsFor), recipient)))
|
|
1772
|
+
if (!(await fileNotice(backlogText(standsFor), recipient, standsFor.map((r) => r.from))))
|
|
1450
1773
|
continue;
|
|
1451
1774
|
await deps.queueRepo.update({
|
|
1452
1775
|
qitemId: last.qitem_id,
|
|
@@ -1456,15 +1779,24 @@ export async function runStuckSweep(deps) {
|
|
|
1456
1779
|
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
1780
|
});
|
|
1458
1781
|
othersMayHaveRun();
|
|
1459
|
-
findings.push({ kind: "unclaimed-backlog", qitemId:
|
|
1782
|
+
findings.push({ kind: "unclaimed-backlog", qitemId: key, findingQitemId: last.qitem_id, action: "closed" });
|
|
1460
1783
|
continue;
|
|
1461
1784
|
}
|
|
1785
|
+
// A creator's notice that now stands for another creator's row (its recipient sees any row) is no longer creator-only.
|
|
1786
|
+
if (onlyFrom !== null && standsFor.some((r) => r.from !== onlyFrom)) {
|
|
1787
|
+
deps.db.prepare(`UPDATE queue_items SET tags = (SELECT json_group_array(value) FROM json_each(tags)
|
|
1788
|
+
WHERE NOT (type = 'text' AND substr(value, 1, length(?)) = ?))
|
|
1789
|
+
WHERE qitem_id = ? AND json_valid(tags)`).run(BACKLOG_TO_CREATOR_PREFIX, BACKLOG_TO_CREATOR_PREFIX, last.qitem_id);
|
|
1790
|
+
}
|
|
1462
1791
|
const text = backlogText(standsFor);
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1792
|
+
let written = text.summary === last.summary && text.body === last.body;
|
|
1793
|
+
if (!written) {
|
|
1794
|
+
written = deps.db.prepare("UPDATE queue_items SET body = ?, summary = ? WHERE qitem_id = ? AND body = ? AND summary IS ? AND state IN ('pending', 'in-progress', 'blocked')")
|
|
1795
|
+
.run(text.body, text.summary, last.qitem_id, last.body, last.summary).changes === 1;
|
|
1466
1796
|
}
|
|
1467
|
-
findings.push({ kind: "unclaimed-backlog", qitemId:
|
|
1797
|
+
findings.push({ kind: "unclaimed-backlog", qitemId: key, findingQitemId: last.qitem_id, action: "refreshed" });
|
|
1798
|
+
if (parent && written)
|
|
1799
|
+
await foldInto(last.qitem_id, seat, parent, standsFor.map((r) => r.qitemId));
|
|
1468
1800
|
continue;
|
|
1469
1801
|
}
|
|
1470
1802
|
if (rows.length === 0)
|
|
@@ -1476,15 +1808,23 @@ export async function runStuckSweep(deps) {
|
|
|
1476
1808
|
const now_ = freshCandidate(c.kind, c.row.qitemId);
|
|
1477
1809
|
if (now_)
|
|
1478
1810
|
routeCandidate(now_);
|
|
1479
|
-
|
|
1811
|
+
if (!now_ || backlogKeyOf(now_) !== key)
|
|
1812
|
+
return [];
|
|
1813
|
+
// A row held by a recovery stays out, unless that recovery is the per-row finding this notice folds in.
|
|
1814
|
+
const held = recoveries.find(now_.row.qitemId);
|
|
1815
|
+
return !held || (parent && foldFrom.get(now_.row.qitemId) === held.qitemId) ? [now_] : [];
|
|
1480
1816
|
});
|
|
1481
1817
|
if (current.length === 0)
|
|
1482
1818
|
continue;
|
|
1483
1819
|
// A closed notice whose list is unreadable holds back every row, each until it has newer evidence than the close.
|
|
1484
1820
|
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)))
|
|
1821
|
+
if (last && !current.some((c) => (covered !== null && !covered.has(c.row.qitemId)) || evidenceIsNewer(c.evidenceAt, last.ts_updated))) {
|
|
1822
|
+
heldBack.set(tag, new Set(current.map((c) => c.row.qitemId)));
|
|
1486
1823
|
continue;
|
|
1487
|
-
|
|
1824
|
+
}
|
|
1825
|
+
const filed = await fileNotice(backlogText(current.map(backlogRow)), recipientFor(current.map((c) => c.row.sourceSession)), current.map((c) => c.row.sourceSession));
|
|
1826
|
+
if (filed && parent)
|
|
1827
|
+
await foldInto(filed, seat, parent, current.map((c) => c.row.qitemId));
|
|
1488
1828
|
}
|
|
1489
1829
|
// Resolution: an open finding whose underlying condition is no longer detected closes
|
|
1490
1830
|
// with its reason — the sweep cleans up after itself, no human unwind.
|