@openrig/cli 0.7.3 → 0.7.5
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-core/.claude-plugin/plugin.json +1 -1
- package/daemon/assets/plugins/openrig-core/.codex-plugin/plugin.json +1 -1
- package/daemon/assets/plugins/openrig-core/hooks/claude.json +11 -0
- package/daemon/assets/plugins/openrig-core/hooks/scripts/activity-relay.cjs +13 -9
- package/daemon/assets/plugins/openrig-core/skills/queue-handoff/SKILL.md +9 -1
- package/daemon/context-packs/help/help.md +6 -3
- 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 +53 -7
- package/daemon/context-packs/reference/getting-started.md +17 -5
- package/daemon/context-packs/reference/manifest.yaml +1 -1
- package/daemon/context-packs/reference/rig-spec.md +10 -3
- package/daemon/context-packs/reference/whats-new.md +153 -155
- 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/SKILL.md +11 -0
- 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/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/SKILL.md +9 -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 +3 -3
- package/daemon/dist/adapters/claude-code-adapter.d.ts.map +1 -1
- package/daemon/dist/adapters/claude-code-adapter.js +52 -22
- package/daemon/dist/adapters/claude-code-adapter.js.map +1 -1
- package/daemon/dist/adapters/claude-resume.d.ts +1 -1
- package/daemon/dist/adapters/claude-resume.d.ts.map +1 -1
- package/daemon/dist/adapters/claude-resume.js +18 -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 +9 -3
- package/daemon/dist/adapters/codex-resume.js.map +1 -1
- package/daemon/dist/adapters/codex-runtime-adapter.d.ts +1 -0
- package/daemon/dist/adapters/codex-runtime-adapter.d.ts.map +1 -1
- package/daemon/dist/adapters/codex-runtime-adapter.js +7 -1
- package/daemon/dist/adapters/codex-runtime-adapter.js.map +1 -1
- package/daemon/dist/adapters/pi-openrouter-charge.d.ts.map +1 -1
- package/daemon/dist/adapters/pi-openrouter-charge.js +3 -0
- package/daemon/dist/adapters/pi-openrouter-charge.js.map +1 -1
- package/daemon/dist/adapters/pi-runner.d.ts.map +1 -1
- package/daemon/dist/adapters/pi-runner.js +11 -2
- package/daemon/dist/adapters/pi-runner.js.map +1 -1
- package/daemon/dist/adapters/tmux.d.ts.map +1 -1
- package/daemon/dist/adapters/tmux.js +10 -2
- package/daemon/dist/adapters/tmux.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 +4 -0
- package/daemon/dist/db/all-migrations.js.map +1 -1
- package/daemon/dist/db/migrations/126_escalation_target_refs.d.ts +4 -0
- package/daemon/dist/db/migrations/126_escalation_target_refs.d.ts.map +1 -0
- package/daemon/dist/db/migrations/126_escalation_target_refs.js +30 -0
- package/daemon/dist/db/migrations/126_escalation_target_refs.js.map +1 -0
- package/daemon/dist/db/migrations/140_identity_principal.d.ts +12 -0
- package/daemon/dist/db/migrations/140_identity_principal.d.ts.map +1 -0
- package/daemon/dist/db/migrations/140_identity_principal.js +20 -0
- package/daemon/dist/db/migrations/140_identity_principal.js.map +1 -0
- package/daemon/dist/domain/agent-activity-store.d.ts.map +1 -1
- package/daemon/dist/domain/agent-activity-store.js +3 -1
- package/daemon/dist/domain/agent-activity-store.js.map +1 -1
- package/daemon/dist/domain/composer-prompts.d.ts +13 -0
- package/daemon/dist/domain/composer-prompts.d.ts.map +1 -1
- package/daemon/dist/domain/composer-prompts.js +32 -0
- package/daemon/dist/domain/composer-prompts.js.map +1 -1
- package/daemon/dist/domain/current-restore-snapshot.d.ts +8 -0
- package/daemon/dist/domain/current-restore-snapshot.d.ts.map +1 -0
- package/daemon/dist/domain/current-restore-snapshot.js +26 -0
- package/daemon/dist/domain/current-restore-snapshot.js.map +1 -0
- package/daemon/dist/domain/draft-aware-delivery.js +1 -1
- package/daemon/dist/domain/draft-aware-delivery.js.map +1 -1
- package/daemon/dist/domain/escalation-owner.d.ts +13 -0
- package/daemon/dist/domain/escalation-owner.d.ts.map +1 -0
- package/daemon/dist/domain/escalation-owner.js +92 -0
- package/daemon/dist/domain/escalation-owner.js.map +1 -0
- package/daemon/dist/domain/escalation-target-ref.d.ts +3 -0
- package/daemon/dist/domain/escalation-target-ref.d.ts.map +1 -0
- package/daemon/dist/domain/escalation-target-ref.js +6 -0
- package/daemon/dist/domain/escalation-target-ref.js.map +1 -0
- package/daemon/dist/domain/gateway/destination-resolver.d.ts +8 -0
- package/daemon/dist/domain/gateway/destination-resolver.d.ts.map +1 -1
- package/daemon/dist/domain/gateway/destination-resolver.js +17 -1
- package/daemon/dist/domain/gateway/destination-resolver.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 +3 -2
- package/daemon/dist/domain/gateway/slack/slack-subsystem.js.map +1 -1
- package/daemon/dist/domain/graph-projection.d.ts.map +1 -1
- package/daemon/dist/domain/graph-projection.js +2 -1
- package/daemon/dist/domain/graph-projection.js.map +1 -1
- package/daemon/dist/domain/hosted-wake.d.ts +19 -0
- package/daemon/dist/domain/hosted-wake.d.ts.map +1 -0
- package/daemon/dist/domain/hosted-wake.js +56 -0
- package/daemon/dist/domain/hosted-wake.js.map +1 -0
- package/daemon/dist/domain/kernel-boot.d.ts +10 -4
- package/daemon/dist/domain/kernel-boot.d.ts.map +1 -1
- package/daemon/dist/domain/kernel-boot.js +14 -7
- package/daemon/dist/domain/kernel-boot.js.map +1 -1
- package/daemon/dist/domain/mission-control/notification-adapter-ntfy.d.ts.map +1 -1
- package/daemon/dist/domain/mission-control/notification-adapter-ntfy.js +2 -0
- package/daemon/dist/domain/mission-control/notification-adapter-ntfy.js.map +1 -1
- package/daemon/dist/domain/mission-control/notification-adapter-webhook.d.ts.map +1 -1
- package/daemon/dist/domain/mission-control/notification-adapter-webhook.js +2 -0
- package/daemon/dist/domain/mission-control/notification-adapter-webhook.js.map +1 -1
- package/daemon/dist/domain/native-resume-probe.d.ts +3 -0
- package/daemon/dist/domain/native-resume-probe.d.ts.map +1 -1
- package/daemon/dist/domain/native-resume-probe.js +7 -0
- package/daemon/dist/domain/native-resume-probe.js.map +1 -1
- package/daemon/dist/domain/node-inventory.d.ts +1 -1
- package/daemon/dist/domain/node-inventory.d.ts.map +1 -1
- package/daemon/dist/domain/node-inventory.js +12 -6
- package/daemon/dist/domain/node-inventory.js.map +1 -1
- package/daemon/dist/domain/node-launcher.d.ts +5 -0
- package/daemon/dist/domain/node-launcher.d.ts.map +1 -1
- package/daemon/dist/domain/node-launcher.js +35 -1
- package/daemon/dist/domain/node-launcher.js.map +1 -1
- package/daemon/dist/domain/outbox-handler.d.ts +3 -0
- package/daemon/dist/domain/outbox-handler.d.ts.map +1 -1
- package/daemon/dist/domain/outbox-handler.js +10 -4
- package/daemon/dist/domain/outbox-handler.js.map +1 -1
- package/daemon/dist/domain/periodic-snapshot-scheduler.d.ts +3 -0
- package/daemon/dist/domain/periodic-snapshot-scheduler.d.ts.map +1 -1
- package/daemon/dist/domain/periodic-snapshot-scheduler.js +15 -11
- package/daemon/dist/domain/periodic-snapshot-scheduler.js.map +1 -1
- package/daemon/dist/domain/policies/artifact-pool-helpers.d.ts +3 -1
- package/daemon/dist/domain/policies/artifact-pool-helpers.d.ts.map +1 -1
- package/daemon/dist/domain/policies/artifact-pool-helpers.js +1 -1
- package/daemon/dist/domain/policies/artifact-pool-helpers.js.map +1 -1
- package/daemon/dist/domain/policies/edge-artifact-required.d.ts.map +1 -1
- package/daemon/dist/domain/policies/edge-artifact-required.js +3 -0
- package/daemon/dist/domain/policies/edge-artifact-required.js.map +1 -1
- package/daemon/dist/domain/provider/claude-interruption.d.ts +3 -0
- package/daemon/dist/domain/provider/claude-interruption.d.ts.map +1 -0
- package/daemon/dist/domain/provider/claude-interruption.js +5 -0
- package/daemon/dist/domain/provider/claude-interruption.js.map +1 -0
- package/daemon/dist/domain/provider/host-usage-rollup.js +18 -8
- package/daemon/dist/domain/provider/host-usage-rollup.js.map +1 -1
- package/daemon/dist/domain/provider/provider-signals.d.ts +12 -5
- package/daemon/dist/domain/provider/provider-signals.d.ts.map +1 -1
- package/daemon/dist/domain/provider/provider-signals.js +31 -8
- package/daemon/dist/domain/provider/provider-signals.js.map +1 -1
- package/daemon/dist/domain/provider/reactive-tap.d.ts +4 -4
- package/daemon/dist/domain/provider/reactive-tap.d.ts.map +1 -1
- package/daemon/dist/domain/provider/reactive-tap.js +20 -4
- package/daemon/dist/domain/provider/reactive-tap.js.map +1 -1
- package/daemon/dist/domain/ps-projection.d.ts +2 -1
- package/daemon/dist/domain/ps-projection.d.ts.map +1 -1
- package/daemon/dist/domain/ps-projection.js +7 -3
- package/daemon/dist/domain/ps-projection.js.map +1 -1
- package/daemon/dist/domain/queue-repository.d.ts +18 -1
- package/daemon/dist/domain/queue-repository.d.ts.map +1 -1
- package/daemon/dist/domain/queue-repository.js +83 -12
- package/daemon/dist/domain/queue-repository.js.map +1 -1
- package/daemon/dist/domain/queue-retention.d.ts.map +1 -1
- package/daemon/dist/domain/queue-retention.js +4 -2
- package/daemon/dist/domain/queue-retention.js.map +1 -1
- package/daemon/dist/domain/queue-stuck-sweep.d.ts.map +1 -1
- package/daemon/dist/domain/queue-stuck-sweep.js +166 -16
- package/daemon/dist/domain/queue-stuck-sweep.js.map +1 -1
- package/daemon/dist/domain/queue-transition-log.d.ts +6 -0
- package/daemon/dist/domain/queue-transition-log.d.ts.map +1 -1
- package/daemon/dist/domain/queue-transition-log.js +11 -2
- package/daemon/dist/domain/queue-transition-log.js.map +1 -1
- package/daemon/dist/domain/queue-waiting.d.ts +1 -1
- package/daemon/dist/domain/queue-waiting.d.ts.map +1 -1
- package/daemon/dist/domain/queue-waiting.js +5 -4
- package/daemon/dist/domain/queue-waiting.js.map +1 -1
- package/daemon/dist/domain/queue-wake-ladder.d.ts +2 -2
- package/daemon/dist/domain/queue-wake-ladder.d.ts.map +1 -1
- package/daemon/dist/domain/queue-wake-ladder.js +173 -45
- package/daemon/dist/domain/queue-wake-ladder.js.map +1 -1
- package/daemon/dist/domain/reconciler.d.ts +2 -0
- package/daemon/dist/domain/reconciler.d.ts.map +1 -1
- package/daemon/dist/domain/reconciler.js +5 -2
- package/daemon/dist/domain/reconciler.js.map +1 -1
- package/daemon/dist/domain/restore-orchestrator.d.ts +17 -2
- package/daemon/dist/domain/restore-orchestrator.d.ts.map +1 -1
- package/daemon/dist/domain/restore-orchestrator.js +169 -42
- package/daemon/dist/domain/restore-orchestrator.js.map +1 -1
- package/daemon/dist/domain/restore-plan-preview.d.ts +27 -1
- package/daemon/dist/domain/restore-plan-preview.d.ts.map +1 -1
- package/daemon/dist/domain/restore-plan-preview.js +51 -29
- package/daemon/dist/domain/restore-plan-preview.js.map +1 -1
- package/daemon/dist/domain/review/gather.d.ts +11 -0
- package/daemon/dist/domain/review/gather.d.ts.map +1 -1
- package/daemon/dist/domain/review/gather.js +64 -26
- package/daemon/dist/domain/review/gather.js.map +1 -1
- package/daemon/dist/domain/rig-edge-ops.d.ts +1 -1
- package/daemon/dist/domain/rig-edge-ops.d.ts.map +1 -1
- package/daemon/dist/domain/rig-edge-ops.js +8 -6
- package/daemon/dist/domain/rig-edge-ops.js.map +1 -1
- package/daemon/dist/domain/rig-repository.d.ts.map +1 -1
- package/daemon/dist/domain/rig-repository.js +12 -4
- package/daemon/dist/domain/rig-repository.js.map +1 -1
- package/daemon/dist/domain/rig-teardown.d.ts +2 -2
- package/daemon/dist/domain/rig-teardown.d.ts.map +1 -1
- package/daemon/dist/domain/rig-teardown.js +9 -5
- package/daemon/dist/domain/rig-teardown.js.map +1 -1
- package/daemon/dist/domain/rigspec-exporter.js +3 -3
- package/daemon/dist/domain/rigspec-exporter.js.map +1 -1
- package/daemon/dist/domain/rigspec-instantiator.d.ts.map +1 -1
- package/daemon/dist/domain/rigspec-instantiator.js +8 -7
- package/daemon/dist/domain/rigspec-instantiator.js.map +1 -1
- package/daemon/dist/domain/rigspec-schema.d.ts.map +1 -1
- package/daemon/dist/domain/rigspec-schema.js +8 -1
- package/daemon/dist/domain/rigspec-schema.js.map +1 -1
- package/daemon/dist/domain/rosters.d.ts +48 -0
- package/daemon/dist/domain/rosters.d.ts.map +1 -0
- package/daemon/dist/domain/rosters.js +86 -0
- package/daemon/dist/domain/rosters.js.map +1 -0
- 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/scope/scope-audit.d.ts +1 -0
- package/daemon/dist/domain/scope/scope-audit.d.ts.map +1 -1
- package/daemon/dist/domain/scope/scope-audit.js +4 -0
- package/daemon/dist/domain/scope/scope-audit.js.map +1 -1
- package/daemon/dist/domain/seat-attention-reconciler.d.ts +2 -0
- package/daemon/dist/domain/seat-attention-reconciler.d.ts.map +1 -1
- package/daemon/dist/domain/seat-attention-reconciler.js +10 -1
- package/daemon/dist/domain/seat-attention-reconciler.js.map +1 -1
- package/daemon/dist/domain/seat-delivery-guard.d.ts +1 -1
- package/daemon/dist/domain/seat-delivery-guard.d.ts.map +1 -1
- package/daemon/dist/domain/seat-delivery-guard.js +11 -2
- package/daemon/dist/domain/seat-delivery-guard.js.map +1 -1
- package/daemon/dist/domain/seat-handover-service.d.ts +6 -0
- package/daemon/dist/domain/seat-handover-service.d.ts.map +1 -1
- package/daemon/dist/domain/seat-handover-service.js +83 -2
- package/daemon/dist/domain/seat-handover-service.js.map +1 -1
- package/daemon/dist/domain/seat-lifecycle-service.d.ts.map +1 -1
- package/daemon/dist/domain/session-registry.d.ts +3 -0
- package/daemon/dist/domain/session-registry.d.ts.map +1 -1
- package/daemon/dist/domain/session-registry.js +5 -0
- package/daemon/dist/domain/session-registry.js.map +1 -1
- package/daemon/dist/domain/session-transport.d.ts +2 -0
- package/daemon/dist/domain/session-transport.d.ts.map +1 -1
- package/daemon/dist/domain/session-transport.js +50 -23
- package/daemon/dist/domain/session-transport.js.map +1 -1
- package/daemon/dist/domain/shared-history-selection.d.ts +34 -0
- package/daemon/dist/domain/shared-history-selection.d.ts.map +1 -0
- package/daemon/dist/domain/shared-history-selection.js +74 -0
- package/daemon/dist/domain/shared-history-selection.js.map +1 -0
- package/daemon/dist/domain/snapshot-capture.d.ts +1 -0
- package/daemon/dist/domain/snapshot-capture.d.ts.map +1 -1
- package/daemon/dist/domain/snapshot-capture.js +43 -1
- package/daemon/dist/domain/snapshot-capture.js.map +1 -1
- package/daemon/dist/domain/startup-orchestrator.d.ts +2 -0
- package/daemon/dist/domain/startup-orchestrator.d.ts.map +1 -1
- package/daemon/dist/domain/startup-orchestrator.js +9 -5
- package/daemon/dist/domain/startup-orchestrator.js.map +1 -1
- package/daemon/dist/domain/startup-submission-evidence.d.ts +6 -0
- package/daemon/dist/domain/startup-submission-evidence.d.ts.map +1 -1
- package/daemon/dist/domain/startup-submission-evidence.js +6 -0
- package/daemon/dist/domain/startup-submission-evidence.js.map +1 -1
- package/daemon/dist/domain/terminal/herdr-adapter.d.ts +13 -5
- package/daemon/dist/domain/terminal/herdr-adapter.d.ts.map +1 -1
- package/daemon/dist/domain/terminal/herdr-adapter.js +55 -79
- package/daemon/dist/domain/terminal/herdr-adapter.js.map +1 -1
- package/daemon/dist/domain/terminal/herdr-follow-view.d.ts +28 -0
- package/daemon/dist/domain/terminal/herdr-follow-view.d.ts.map +1 -0
- package/daemon/dist/domain/terminal/herdr-follow-view.js +338 -0
- package/daemon/dist/domain/terminal/herdr-follow-view.js.map +1 -0
- package/daemon/dist/domain/terminal/herdr-sessions.d.ts +2 -1
- package/daemon/dist/domain/terminal/herdr-sessions.d.ts.map +1 -1
- package/daemon/dist/domain/terminal/herdr-sessions.js +32 -8
- package/daemon/dist/domain/terminal/herdr-sessions.js.map +1 -1
- package/daemon/dist/domain/terminal/herdr-viewer.d.ts +69 -0
- package/daemon/dist/domain/terminal/herdr-viewer.d.ts.map +1 -0
- package/daemon/dist/domain/terminal/herdr-viewer.js +285 -0
- package/daemon/dist/domain/terminal/herdr-viewer.js.map +1 -0
- package/daemon/dist/domain/terminal/task-terminal-view.d.ts +51 -0
- package/daemon/dist/domain/terminal/task-terminal-view.d.ts.map +1 -0
- package/daemon/dist/domain/terminal/task-terminal-view.js +227 -0
- package/daemon/dist/domain/terminal/task-terminal-view.js.map +1 -0
- package/daemon/dist/domain/terminal/terminal-follow-policy.d.ts +65 -0
- package/daemon/dist/domain/terminal/terminal-follow-policy.d.ts.map +1 -0
- package/daemon/dist/domain/terminal/terminal-follow-policy.js +93 -0
- package/daemon/dist/domain/terminal/terminal-follow-policy.js.map +1 -0
- package/daemon/dist/domain/terminal/terminal-following.d.ts +39 -0
- package/daemon/dist/domain/terminal/terminal-following.d.ts.map +1 -0
- package/daemon/dist/domain/terminal/terminal-following.js +135 -0
- package/daemon/dist/domain/terminal/terminal-following.js.map +1 -0
- package/daemon/dist/domain/terminal/terminal-provider.d.ts +19 -0
- package/daemon/dist/domain/terminal/terminal-provider.d.ts.map +1 -1
- package/daemon/dist/domain/terminal/terminal-provider.js +0 -15
- package/daemon/dist/domain/terminal/terminal-provider.js.map +1 -1
- package/daemon/dist/domain/terminal/terminal-service.d.ts +27 -2
- package/daemon/dist/domain/terminal/terminal-service.d.ts.map +1 -1
- package/daemon/dist/domain/terminal/terminal-service.js +133 -37
- package/daemon/dist/domain/terminal/terminal-service.js.map +1 -1
- package/daemon/dist/domain/terminal/tile-attach.js +1 -1
- package/daemon/dist/domain/terminal/tile-attach.js.map +1 -1
- package/daemon/dist/domain/terminal/view-composer.js +1 -1
- package/daemon/dist/domain/terminal/view-composer.js.map +1 -1
- package/daemon/dist/domain/types.d.ts +9 -0
- package/daemon/dist/domain/types.d.ts.map +1 -1
- package/daemon/dist/domain/types.js.map +1 -1
- package/daemon/dist/domain/usage-series.d.ts.map +1 -1
- package/daemon/dist/domain/usage-series.js +17 -3
- package/daemon/dist/domain/usage-series.js.map +1 -1
- package/daemon/dist/index.d.ts.map +1 -1
- package/daemon/dist/index.js +5 -1
- package/daemon/dist/index.js.map +1 -1
- package/daemon/dist/rosters-surface.d.ts +2 -0
- package/daemon/dist/rosters-surface.d.ts.map +1 -0
- package/daemon/dist/rosters-surface.js +4 -0
- package/daemon/dist/rosters-surface.js.map +1 -0
- package/daemon/dist/routes/queue.d.ts.map +1 -1
- package/daemon/dist/routes/queue.js +7 -6
- package/daemon/dist/routes/queue.js.map +1 -1
- package/daemon/dist/routes/require-sender-identity.d.ts +26 -0
- package/daemon/dist/routes/require-sender-identity.d.ts.map +1 -1
- package/daemon/dist/routes/require-sender-identity.js +54 -0
- package/daemon/dist/routes/require-sender-identity.js.map +1 -1
- package/daemon/dist/routes/scope-audit.d.ts.map +1 -1
- package/daemon/dist/routes/scope-audit.js +2 -2
- package/daemon/dist/routes/scope-audit.js.map +1 -1
- package/daemon/dist/routes/startup.d.ts.map +1 -1
- package/daemon/dist/routes/startup.js +269 -3
- package/daemon/dist/routes/startup.js.map +1 -1
- package/daemon/dist/routes/terminal.d.ts +3 -1
- package/daemon/dist/routes/terminal.d.ts.map +1 -1
- package/daemon/dist/routes/terminal.js +57 -1
- 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 +12 -3
- package/daemon/dist/routes/transport.js.map +1 -1
- package/daemon/dist/server.js +1 -1
- package/daemon/dist/server.js.map +1 -1
- package/daemon/dist/startup.d.ts.map +1 -1
- package/daemon/dist/startup.js +25 -3
- package/daemon/dist/startup.js.map +1 -1
- package/daemon/docs/reference/agent-startup-guide.md +9 -0
- package/daemon/docs/reference/agent-state-taxonomy.md +7 -0
- package/daemon/docs/reference/claude-status-line.md +42 -0
- package/daemon/docs/reference/community-harness-examples/hermes/hermes.yaml +1 -1
- package/daemon/docs/reference/community-harness-examples/pi-tui/openrig-pi-tui-launch +100 -0
- package/daemon/docs/reference/community-harness-examples/pi-tui/pi-tui.yaml +15 -0
- package/daemon/docs/reference/community-harness-presets.md +90 -3
- package/daemon/docs/reference/edge-types.md +40 -11
- package/daemon/docs/reference/getting-started.md +17 -5
- package/daemon/docs/reference/help.md +6 -3
- package/daemon/docs/reference/hosted-members.md +114 -0
- package/daemon/docs/reference/publishing-a-rig-bundle.md +5 -0
- package/daemon/docs/reference/quickstart.md +3 -3
- package/daemon/docs/reference/rig-spec.md +10 -3
- package/daemon/docs/reference/rosters.md +6 -0
- package/daemon/docs/reference/sdlc-conventions.md +6 -0
- package/daemon/docs/reference/seat-delivery.md +6 -0
- package/daemon/docs/reference/terminal-sessions.md +152 -0
- package/daemon/docs/reference/whats-new.md +153 -155
- package/daemon/specs/agents/shared/skills/core/rig-bundles-and-shareable-artifacts/SKILL.md +11 -0
- package/dist/build-info.js +3 -3
- package/dist/client.d.ts +16 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +53 -25
- package/dist/client.js.map +1 -1
- package/dist/commands/attach.d.ts.map +1 -1
- package/dist/commands/attach.js +9 -9
- package/dist/commands/attach.js.map +1 -1
- package/dist/commands/capture.d.ts.map +1 -1
- package/dist/commands/capture.js +12 -4
- package/dist/commands/capture.js.map +1 -1
- package/dist/commands/daemon.d.ts.map +1 -1
- package/dist/commands/daemon.js +6 -1
- package/dist/commands/daemon.js.map +1 -1
- package/dist/commands/edge.d.ts.map +1 -1
- package/dist/commands/edge.js +2 -1
- package/dist/commands/edge.js.map +1 -1
- package/dist/commands/host.d.ts.map +1 -1
- package/dist/commands/host.js +17 -2
- package/dist/commands/host.js.map +1 -1
- package/dist/commands/mcp.d.ts.map +1 -1
- package/dist/commands/mcp.js +62 -15
- package/dist/commands/mcp.js.map +1 -1
- package/dist/commands/queue.d.ts.map +1 -1
- package/dist/commands/queue.js +4 -2
- package/dist/commands/queue.js.map +1 -1
- package/dist/commands/roster.d.ts +7 -27
- package/dist/commands/roster.d.ts.map +1 -1
- package/dist/commands/roster.js +17 -52
- package/dist/commands/roster.js.map +1 -1
- package/dist/commands/scope.js +3 -3
- package/dist/commands/scope.js.map +1 -1
- package/dist/commands/seat.d.ts.map +1 -1
- package/dist/commands/seat.js +41 -0
- package/dist/commands/seat.js.map +1 -1
- package/dist/commands/send.d.ts.map +1 -1
- package/dist/commands/send.js +16 -21
- package/dist/commands/send.js.map +1 -1
- package/dist/commands/start.d.ts.map +1 -1
- package/dist/commands/start.js +10 -6
- package/dist/commands/start.js.map +1 -1
- package/dist/commands/terminal.d.ts +32 -0
- package/dist/commands/terminal.d.ts.map +1 -1
- package/dist/commands/terminal.js +31 -9
- package/dist/commands/terminal.js.map +1 -1
- package/dist/commands/transcript.js +1 -1
- package/dist/commands/transcript.js.map +1 -1
- package/dist/commands/whoami.d.ts.map +1 -1
- package/dist/commands/whoami.js +2 -1
- package/dist/commands/whoami.js.map +1 -1
- package/dist/daemon-lifecycle.d.ts +4 -0
- package/dist/daemon-lifecycle.d.ts.map +1 -1
- package/dist/daemon-lifecycle.js +11 -0
- package/dist/daemon-lifecycle.js.map +1 -1
- package/dist/lib/scope/scope-audit.d.ts +1 -0
- package/dist/lib/scope/scope-audit.d.ts.map +1 -1
- package/dist/lib/scope/scope-audit.js +4 -0
- package/dist/lib/scope/scope-audit.js.map +1 -1
- package/dist/mcp-http.d.ts +38 -2
- package/dist/mcp-http.d.ts.map +1 -1
- package/dist/mcp-http.js +303 -36
- package/dist/mcp-http.js.map +1 -1
- package/dist/mcp-presence.d.ts +14 -0
- package/dist/mcp-presence.d.ts.map +1 -0
- package/dist/mcp-presence.js +50 -0
- package/dist/mcp-presence.js.map +1 -0
- package/dist/mcp-server.d.ts +12 -2
- package/dist/mcp-server.d.ts.map +1 -1
- package/dist/mcp-server.js +621 -204
- package/dist/mcp-server.js.map +1 -1
- package/dist/rig-handle.d.ts +1 -0
- package/dist/rig-handle.d.ts.map +1 -1
- package/dist/rig-handle.js +9 -0
- package/dist/rig-handle.js.map +1 -1
- package/dist/terminal-window.d.ts +3 -3
- package/dist/terminal-window.d.ts.map +1 -1
- package/dist/terminal-window.js +33 -5
- package/dist/terminal-window.js.map +1 -1
- package/package.json +5 -2
- package/tui/dist/daemon-client.d.ts +3 -1
- package/tui/dist/daemon-client.d.ts.map +1 -1
- package/tui/dist/daemon-client.js +4 -3
- package/tui/dist/daemon-client.js.map +1 -1
- package/tui/dist/hydrate.d.ts.map +1 -1
- package/tui/dist/hydrate.js +10 -2
- package/tui/dist/hydrate.js.map +1 -1
- package/tui/dist/main.js +7 -3
- package/tui/dist/main.js.map +1 -1
- package/tui/dist/navigator.d.ts.map +1 -1
- package/tui/dist/navigator.js +8 -5
- package/tui/dist/navigator.js.map +1 -1
- package/tui/dist/render.d.ts +6 -0
- package/tui/dist/render.d.ts.map +1 -1
- package/tui/dist/render.js +12 -5
- package/tui/dist/render.js.map +1 -1
- package/tui/dist/state.d.ts.map +1 -1
- package/tui/dist/state.js +2 -1
- package/tui/dist/state.js.map +1 -1
- package/tui/dist/terminals/open-window.js +2 -2
- package/tui/dist/terminals/open-window.js.map +1 -1
- package/tui/dist/topology/host-label.d.ts +7 -0
- package/tui/dist/topology/host-label.d.ts.map +1 -0
- package/tui/dist/topology/host-label.js +34 -0
- package/tui/dist/topology/host-label.js.map +1 -0
- package/tui/dist/types.d.ts +3 -0
- package/tui/dist/types.d.ts.map +1 -1
- package/ui/dist/assets/{index-DV0UNxFw.js → index-ozBodLrS.js} +168 -168
- package/ui/dist/index.html +1 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { resolveEscalationOwner, ESCALATION_HOP_TAG, hasConsumedEscalationHop } from "./escalation-owner.js";
|
|
1
2
|
import { seatRuntimeHomeBySession } from "./seat-runtime-home.js";
|
|
2
3
|
import { quietHoldCustody } from "./quiet-hold-custody.js";
|
|
3
4
|
import { latestHookMovedOn, latestHookPermissionPending, latestHookWaitsOnPerson } from "./agent-activity-store.js";
|
|
@@ -9,7 +10,7 @@ import { USAGE_LIMIT_BLOCKER_TAG, USAGE_LIMIT_POOL_TAG_PREFIX, } from "./queue-w
|
|
|
9
10
|
import { SettingsStore } from "./user-settings/settings-store.js";
|
|
10
11
|
import { loadHumanRegistry, resolveRegisteredHumanAddress } from "./gateway/human-registry.js";
|
|
11
12
|
import { parseSessionName } from "./session-name.js";
|
|
12
|
-
import { LADDER_ATTEMPT_PREFIX, LADDER_RUNG_PREFIX, LADDER_EXHAUSTED_PREFIX,
|
|
13
|
+
import { LADDER_ATTEMPT_PREFIX, LADDER_RUNG_PREFIX, LADDER_EXHAUSTED_PREFIX, resolveOperatorSeat, resolveSessionNodeId, } from "./queue-stuck-sweep.js";
|
|
13
14
|
export const WAKE_RETRY_INTERVAL_KEY = "queue.wake_retry_interval_seconds";
|
|
14
15
|
export const DEFAULT_WAKE_RETRY_INTERVAL_SECONDS = 300;
|
|
15
16
|
export const WAKE_RETRY_CAP_KEY = "queue.wake_retry_cap";
|
|
@@ -326,14 +327,16 @@ function suspensionReason(db, destination, graceSeconds, now) {
|
|
|
326
327
|
/** Read the existing ladder's next eligible action; never create an intent,
|
|
327
328
|
* reserve a retry, consume provider state or change its policy. The scheduler
|
|
328
329
|
* still makes the final live-state decision at delivery time. */
|
|
329
|
-
export function readWakeLadderBackstop(db, qitemId) {
|
|
330
|
+
export function readWakeLadderBackstop(db, qitemId, acceptsDestination) {
|
|
330
331
|
const row = db.prepare(`SELECT qitem_id AS qitemId, state, source_session AS sourceSession,
|
|
331
332
|
destination_session AS destinationSession, claimed_at AS claimedAt, handed_off_from AS handedOffFrom,
|
|
332
333
|
last_heartbeat AS lastHeartbeat, last_nudge_result AS lastNudgeResult,
|
|
333
|
-
last_nudge_attempt AS lastNudgeAttempt, ts_created AS tsCreated FROM queue_items WHERE qitem_id = ?`)
|
|
334
|
+
last_nudge_attempt AS lastNudgeAttempt, ts_created AS tsCreated, tags AS tagsJson FROM queue_items WHERE qitem_id = ?`)
|
|
334
335
|
.get(qitemId);
|
|
335
336
|
if (!row || !["pending", "in-progress"].includes(row.state))
|
|
336
337
|
return null;
|
|
338
|
+
const escalationOwner = () => hasConsumedEscalationHop(db, qitemId)
|
|
339
|
+
? null : resolveEscalationOwner(db, row.destinationSession, acceptsDestination).owner;
|
|
337
340
|
const recovery = findWakeRecovery(db, qitemId);
|
|
338
341
|
const disposition = recovery ? db.prepare("SELECT destination_session, tags FROM queue_items WHERE qitem_id = ?")
|
|
339
342
|
.get(recovery.qitemId) : null;
|
|
@@ -354,7 +357,7 @@ export function readWakeLadderBackstop(db, qitemId) {
|
|
|
354
357
|
const ladder = readLadder(db, qitemId);
|
|
355
358
|
if (ladder.exhausted)
|
|
356
359
|
return recovery ? recoveryBackstop() : {
|
|
357
|
-
owner:
|
|
360
|
+
owner: escalationOwner() ?? row.destinationSession,
|
|
358
361
|
mechanism: "queue-wake-ladder:exhausted; queue-stuck-sweep:undelivered", dueAt: null, intervalSeconds: null,
|
|
359
362
|
note: "No further ladder retry. Inspect the retained exhaustion and delivery evidence; the stuck sweep is the safety net.",
|
|
360
363
|
};
|
|
@@ -381,7 +384,7 @@ export function readWakeLadderBackstop(db, qitemId) {
|
|
|
381
384
|
const suspension = readSuspension(db, row.destinationSession, resolveWakeSwapGraceSeconds(), now);
|
|
382
385
|
if (suspension)
|
|
383
386
|
due = Math.max(due, Date.parse(suspension.until));
|
|
384
|
-
const orch =
|
|
387
|
+
const orch = disposition?.destination_session ?? escalationOwner();
|
|
385
388
|
const operator = ladder.orchRung || orch === null || orch === row.destinationSession;
|
|
386
389
|
return {
|
|
387
390
|
owner: retry ? row.destinationSession : operator ? resolveOperatorSeat() ?? row.sourceSession : orch,
|
|
@@ -481,7 +484,9 @@ export async function runWakeLadderTick(deps) {
|
|
|
481
484
|
const cap = deps.retryCap ?? resolveWakeRetryCap();
|
|
482
485
|
const windowMin = deps.unconfirmedWindowMinutes ?? resolveWakeUnconfirmedWindowMinutes();
|
|
483
486
|
const graceS = deps.swapGraceSeconds ?? resolveWakeSwapGraceSeconds();
|
|
484
|
-
const resolveOrch = deps.resolveOrchestrator ?? ((session) =>
|
|
487
|
+
const resolveOrch = deps.resolveOrchestrator ?? ((session) => {
|
|
488
|
+
return resolveEscalationOwner(deps.db, session, target => deps.queueRepo.acceptsDestination(target)).owner;
|
|
489
|
+
});
|
|
485
490
|
const attemptWake = deps.attemptWake ??
|
|
486
491
|
(async (qitemId, target) => {
|
|
487
492
|
// A ladder retry is OpenRig's own scheduling on the row, whoever created it.
|
|
@@ -657,6 +662,20 @@ export async function runWakeLadderTick(deps) {
|
|
|
657
662
|
: mode === "held"
|
|
658
663
|
? `held by ${row.destinationSession}'s typing guard for ${minutesSince(row.tsCreated, now)} min: nothing was typed, and it isn't retried`
|
|
659
664
|
: `unconfirmed delivery with no pickup evidence over ${minutesSince(row.tsCreated, now)} min`;
|
|
665
|
+
if (hasConsumedEscalationHop(deps.db, row.qitemId)) {
|
|
666
|
+
if (!due || suspended)
|
|
667
|
+
continue;
|
|
668
|
+
const consumedReason = `${reason}; escalates_to one-hop delivery already used; existing fallback retained`;
|
|
669
|
+
// Keep this recovery visible without sharing the ordinary destination aggregate or forwarding another hop.
|
|
670
|
+
await ensureEscalationRow(deps, row.destinationSession, resolveOperatorSeat() ?? row.sourceSession, [{ row, reason: consumedReason }], consumedReason, `consumed-hop:${row.qitemId}`, [ESCALATION_HOP_TAG]);
|
|
671
|
+
if (!view.orchRung)
|
|
672
|
+
appendMarker(deps.queueRepo, row, `${LADDER_RUNG_PREFIX} orchestrator self-skip reason=${consumedReason}`);
|
|
673
|
+
if (await operatorRung(deps, row, consumedReason, actions, view)) {
|
|
674
|
+
appendExhausted(deps.queueRepo, row, "consumed escalation hop reached operator fallback");
|
|
675
|
+
exhaustedThisTick += 1;
|
|
676
|
+
}
|
|
677
|
+
continue;
|
|
678
|
+
}
|
|
660
679
|
const dest = row.destinationSession;
|
|
661
680
|
if (!escalating.has(dest))
|
|
662
681
|
escalating.set(dest, []);
|
|
@@ -665,7 +684,13 @@ export async function runWakeLadderTick(deps) {
|
|
|
665
684
|
// F3 — per-destination aggregation: ONE escalation carrying the row list, refreshed
|
|
666
685
|
// not duplicated (the S02 idempotency shape), and rung markers on every member baton.
|
|
667
686
|
for (const [dest, members] of escalating) {
|
|
668
|
-
const orch = resolveOrch(dest);
|
|
687
|
+
const orch = openEscalationOwner(deps.db, escalationDedupTag(dest)) ?? resolveOrch(dest);
|
|
688
|
+
const route = !deps.resolveOrchestrator
|
|
689
|
+
? resolveEscalationOwner(deps.db, dest, target => deps.queueRepo.acceptsDestination(target)) : null;
|
|
690
|
+
const routeReason = route && route.outcome !== "none" && route.outcome !== "parent" ? route.reason : "";
|
|
691
|
+
for (const member of members)
|
|
692
|
+
if (routeReason)
|
|
693
|
+
member.reason += `; ${routeReason}`;
|
|
669
694
|
// F3 — the aggregate refresh is detection-gated (the S02 idempotency shape): a
|
|
670
695
|
// live escalation group refreshes its one open row every pass, no wake attached.
|
|
671
696
|
await refreshEscalationRowIfExists(deps, dest, members);
|
|
@@ -692,10 +717,12 @@ export async function runWakeLadderTick(deps) {
|
|
|
692
717
|
}
|
|
693
718
|
else {
|
|
694
719
|
const escRow = await ensureEscalationRow(deps, dest, orch, members, reason);
|
|
695
|
-
|
|
720
|
+
// An already-open recovery retains its owner, including a claim made before topology changed.
|
|
721
|
+
const recoveryOwner = deps.queueRepo.getById(escRow.qitemId)?.destinationSession ?? orch;
|
|
722
|
+
const outcome = await attemptWake(escRow.qitemId, recoveryOwner);
|
|
696
723
|
for (const m of needsOrchRung) {
|
|
697
|
-
appendMarker(deps.queueRepo, m.row, `${LADDER_RUNG_PREFIX} orchestrator -> ${
|
|
698
|
-
actions.push({ qitemId: m.row.qitemId, action: "escalate-orchestrator", target:
|
|
724
|
+
appendMarker(deps.queueRepo, m.row, `${LADDER_RUNG_PREFIX} orchestrator -> ${recoveryOwner} outcome=${outcome} reason=${m.reason}`);
|
|
725
|
+
actions.push({ qitemId: m.row.qitemId, action: "escalate-orchestrator", target: recoveryOwner });
|
|
699
726
|
if (!outcome.startsWith("failed:")) {
|
|
700
727
|
// Delivered (or durable-unconfirmed — the aggregate row itself is now the
|
|
701
728
|
// orchestrator's durable obligation; S02 nets it if it sits unclaimed).
|
|
@@ -766,7 +793,8 @@ export function makePromptStateReader(deps) {
|
|
|
766
793
|
if (verdict !== "unknown" || !nodeId)
|
|
767
794
|
return verdict;
|
|
768
795
|
const node = deps.db.prepare("SELECT runtime FROM nodes WHERE id = ?").get(nodeId);
|
|
769
|
-
const
|
|
796
|
+
const runtime = node?.runtime ?? null;
|
|
797
|
+
const hook = deps.getLatestHook?.(destination, runtime);
|
|
770
798
|
if (latestHookWaitsOnPerson(hook, runtime) || latestHookPermissionPending(hook, runtime))
|
|
771
799
|
return "blocked";
|
|
772
800
|
if ((runtime === "codex" || runtime === "claude-code") && hook?.rawEvent === "PermissionPromptCleared" &&
|
|
@@ -832,6 +860,17 @@ function postedPromptAlert(db, except) {
|
|
|
832
860
|
ORDER BY ts_created LIMIT 1`).get(except, PROMPT_ALERT_TAG, PROMPT_CHOICE_TAG, `${LADDER_RUNG_PREFIX} operator dispatched-to-engine%`);
|
|
833
861
|
return row?.qitem_id ?? null;
|
|
834
862
|
}
|
|
863
|
+
/** Keep both ordinary and consumed-recovery choice alerts behind the same durable gate. */
|
|
864
|
+
function waitsOnPostedPromptAlert(deps, row, choiceOnly) {
|
|
865
|
+
const posted = choiceOnly && deps.deliveryEngine ? postedPromptAlert(deps.db, row.qitemId) : null;
|
|
866
|
+
if (!posted)
|
|
867
|
+
return false;
|
|
868
|
+
const waiting = `${LADDER_RUNG_PREFIX} operator waiting on ${posted}`;
|
|
869
|
+
if (!deps.queueRepo.listTransitions(row.qitemId).some(t => t.transitionNote?.startsWith(waiting))) {
|
|
870
|
+
appendMarker(deps.queueRepo, row, `${waiting} reason=one person alert at a time for seats blocked at a prompt`);
|
|
871
|
+
}
|
|
872
|
+
return true;
|
|
873
|
+
}
|
|
835
874
|
/** Positive refusals enter the existing rungs without ever retrying the blocked
|
|
836
875
|
* seat. One aggregate carries the episode's obligations and notification key;
|
|
837
876
|
* original work remains owned by its current recipient. */
|
|
@@ -890,16 +929,14 @@ async function advancePromptRefusals(deps, now, intervalS, graceS, resolveOrch,
|
|
|
890
929
|
for (const episode of openPromptRefusals(deps.queueRepo.listTransitions(qitem_id))) {
|
|
891
930
|
if (!episode.key.startsWith(`${primary.destinationSession}|`))
|
|
892
931
|
continue;
|
|
893
|
-
//
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
continue;
|
|
897
|
-
const rows = episode.ids.map(id => readCandidate(id, primary.destinationSession)).filter((row) => Boolean(row && row.destinationSession === primary.destinationSession && ["pending", "in-progress", "blocked"].includes(row.state)));
|
|
932
|
+
// Ordinary work shares an episode; consumed recoveries retain independent dispositions.
|
|
933
|
+
const rows = episode.ids.map(id => readCandidate(id, primary.destinationSession)).filter((row) => Boolean(row && row.destinationSession === primary.destinationSession && ["pending", "in-progress", "blocked"].includes(row.state)
|
|
934
|
+
&& !closedEpisode(`${PROMPT_EPISODE_TAG}${episode.key}${hasConsumedEscalationHop(deps.db, row.qitemId) ? `|consumed:${row.qitemId}` : ""}`)));
|
|
898
935
|
if (!rows.length)
|
|
899
936
|
continue;
|
|
900
937
|
let group = groups.get(primary.destinationSession);
|
|
901
938
|
if (!group) {
|
|
902
|
-
group = { keys: [], rows: new Map(), jobs: new Map(), refusedAt: episode.refusedAt };
|
|
939
|
+
group = { keys: [], rowKeys: new Map(), jobKeys: new Set(), rows: new Map(), jobs: new Map(), refusedAt: episode.refusedAt };
|
|
903
940
|
groups.set(primary.destinationSession, group);
|
|
904
941
|
}
|
|
905
942
|
if (Date.parse(episode.refusedAt) > Date.parse(group.refusedAt))
|
|
@@ -917,9 +954,15 @@ async function advancePromptRefusals(deps, now, intervalS, graceS, resolveOrch,
|
|
|
917
954
|
&& (!group.choiceSince || Date.parse(episode.refusedAt) < Date.parse(group.choiceSince)))
|
|
918
955
|
group.choiceSince = episode.refusedAt;
|
|
919
956
|
}
|
|
920
|
-
|
|
921
|
-
|
|
957
|
+
for (const row of rows) {
|
|
958
|
+
const key = `${PROMPT_EPISODE_TAG}${episode.key}${hasConsumedEscalationHop(deps.db, row.qitemId) ? `|consumed:${row.qitemId}` : ""}`;
|
|
959
|
+
if (!group.keys.includes(key))
|
|
960
|
+
group.keys.push(key);
|
|
961
|
+
if (!group.rowKeys.has(row.qitemId))
|
|
962
|
+
group.rowKeys.set(row.qitemId, new Set());
|
|
963
|
+
group.rowKeys.get(row.qitemId).add(key);
|
|
922
964
|
group.rows.set(row.qitemId, row);
|
|
965
|
+
}
|
|
923
966
|
}
|
|
924
967
|
}
|
|
925
968
|
// A watchdog reminder refused twice at the same prompt joins its seat's episode; the row carries the job ids. The
|
|
@@ -941,7 +984,7 @@ async function advancePromptRefusals(deps, now, intervalS, graceS, resolveOrch,
|
|
|
941
984
|
continue;
|
|
942
985
|
let group = groups.get(job.dest);
|
|
943
986
|
if (!group) {
|
|
944
|
-
group = { keys: [], rows: new Map(), jobs: new Map(), refusedAt: job.refusedAt };
|
|
987
|
+
group = { keys: [], rowKeys: new Map(), jobKeys: new Set(), rows: new Map(), jobs: new Map(), refusedAt: job.refusedAt };
|
|
945
988
|
groups.set(job.dest, group);
|
|
946
989
|
}
|
|
947
990
|
if (Date.parse(job.refusedAt) > Date.parse(group.refusedAt))
|
|
@@ -949,12 +992,40 @@ async function advancePromptRefusals(deps, now, intervalS, graceS, resolveOrch,
|
|
|
949
992
|
if (job.refusedAt === group.refusedAt)
|
|
950
993
|
group.latestChoice = job.choice;
|
|
951
994
|
group.keys.push(tag);
|
|
995
|
+
group.jobKeys.add(tag);
|
|
952
996
|
group.jobs.set(job.jobId, job.registeredBy);
|
|
953
997
|
if (job.choice)
|
|
954
998
|
group.choice = true;
|
|
955
999
|
else
|
|
956
1000
|
group.other = true;
|
|
957
1001
|
}
|
|
1002
|
+
// A recovery returned to the blocked seat inherits only its source row's episodes.
|
|
1003
|
+
// Reconstruct this membership before retirement, even when the recovery has no refusal of its own.
|
|
1004
|
+
for (const [dest, group] of groups) {
|
|
1005
|
+
for (const row of [...group.rows.values()]) {
|
|
1006
|
+
if (hasConsumedEscalationHop(deps.db, row.qitemId))
|
|
1007
|
+
continue;
|
|
1008
|
+
// The newer ordinary alert must not hide the underlying returned recovery on the next tick.
|
|
1009
|
+
const recovery = findQueueRecovery(deps.db, row.qitemId, PROMPT_ALERT_TAG);
|
|
1010
|
+
if (!recovery || !["pending", "in-progress", "blocked"].includes(recovery.state))
|
|
1011
|
+
continue;
|
|
1012
|
+
const held = readCandidate(recovery.qitemId, dest);
|
|
1013
|
+
if (!held || held.destinationSession !== dest || held.tags?.includes(PROMPT_ALERT_TAG))
|
|
1014
|
+
continue;
|
|
1015
|
+
const suffix = hasConsumedEscalationHop(deps.db, held.qitemId) ? `|consumed:${held.qitemId}` : "";
|
|
1016
|
+
for (const sourceKey of group.rowKeys.get(row.qitemId) ?? []) {
|
|
1017
|
+
const key = `${sourceKey}${suffix}`;
|
|
1018
|
+
if (closedEpisode(key))
|
|
1019
|
+
continue;
|
|
1020
|
+
if (!group.keys.includes(key))
|
|
1021
|
+
group.keys.push(key);
|
|
1022
|
+
if (!group.rowKeys.has(held.qitemId))
|
|
1023
|
+
group.rowKeys.set(held.qitemId, new Set());
|
|
1024
|
+
group.rowKeys.get(held.qitemId).add(key);
|
|
1025
|
+
group.rows.set(held.qitemId, held);
|
|
1026
|
+
}
|
|
1027
|
+
}
|
|
1028
|
+
}
|
|
958
1029
|
const promptState = (dest) => {
|
|
959
1030
|
const group = groups.get(dest);
|
|
960
1031
|
const state = readAt(dest, group?.refusedAt ?? now.toISOString());
|
|
@@ -973,8 +1044,10 @@ async function advancePromptRefusals(deps, now, intervalS, graceS, resolveOrch,
|
|
|
973
1044
|
const aggregate = deps.queueRepo.getById(qitem_id);
|
|
974
1045
|
if (!aggregate || !Array.isArray(aggregate.tags))
|
|
975
1046
|
continue;
|
|
976
|
-
const destinationTag = aggregate.tags.find(t => typeof t === "string"
|
|
977
|
-
|
|
1047
|
+
const destinationTag = aggregate.tags.find(t => typeof t === "string"
|
|
1048
|
+
&& (t.startsWith("prompt-destination:") || t.startsWith("consumed-prompt-destination:")));
|
|
1049
|
+
const dest = destinationTag?.slice(destinationTag.startsWith("consumed-")
|
|
1050
|
+
? "consumed-prompt-destination:".length : "prompt-destination:".length);
|
|
978
1051
|
if (!dest)
|
|
979
1052
|
continue;
|
|
980
1053
|
// Incomplete membership is not evidence that an episode ended.
|
|
@@ -1009,8 +1082,9 @@ async function advancePromptRefusals(deps, now, intervalS, graceS, resolveOrch,
|
|
|
1009
1082
|
// Recovery owned elsewhere already has a route. A fallback finding sent
|
|
1010
1083
|
// into this same blocked seat does not: include it in the aggregate while
|
|
1011
1084
|
// retaining its original body/custody, rather than treating it as delivery.
|
|
1012
|
-
const selfRecoveries = new Map();
|
|
1013
1085
|
const ownedElsewhere = members.some(({ row }) => {
|
|
1086
|
+
if (hasConsumedEscalationHop(deps.db, row.qitemId))
|
|
1087
|
+
return false;
|
|
1014
1088
|
const recovery = findQueueRecovery(deps.db, row.qitemId);
|
|
1015
1089
|
if (!recovery || !["pending", "in-progress", "blocked"].includes(recovery.state))
|
|
1016
1090
|
return false;
|
|
@@ -1019,29 +1093,78 @@ async function advancePromptRefusals(deps, now, intervalS, graceS, resolveOrch,
|
|
|
1019
1093
|
return false;
|
|
1020
1094
|
if (held.tags?.includes(PROMPT_ALERT_TAG))
|
|
1021
1095
|
return false;
|
|
1022
|
-
|
|
1023
|
-
return true;
|
|
1024
|
-
selfRecoveries.set(held.qitemId, held);
|
|
1025
|
-
return false;
|
|
1096
|
+
return held.destinationSession !== dest;
|
|
1026
1097
|
});
|
|
1027
1098
|
if (ownedElsewhere)
|
|
1028
1099
|
continue;
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1100
|
+
// A consumed recovery owns its own operator continuation. It must not change
|
|
1101
|
+
// the route or one-hop marker of unrelated work/watchdogs at the same prompt.
|
|
1102
|
+
for (let i = members.length - 1; i >= 0; i--) {
|
|
1103
|
+
const member = members[i];
|
|
1104
|
+
if (!hasConsumedEscalationHop(deps.db, member.row.qitemId))
|
|
1105
|
+
continue;
|
|
1106
|
+
const recovery = findQueueRecovery(deps.db, member.row.qitemId);
|
|
1107
|
+
const heldRecovery = recovery ? deps.queueRepo.getById(recovery.qitemId) : null;
|
|
1108
|
+
if (recovery && ["pending", "in-progress", "blocked"].includes(recovery.state)
|
|
1109
|
+
&& heldRecovery?.destinationSession !== dest
|
|
1110
|
+
&& !heldRecovery?.tags?.includes(`consumed-hop:${member.row.qitemId}`)) {
|
|
1111
|
+
members.splice(i, 1);
|
|
1112
|
+
continue;
|
|
1113
|
+
}
|
|
1114
|
+
const view = readLadder(deps.db, member.row.qitemId, 0);
|
|
1115
|
+
if (!view.exhausted && (view.lastMarkerTs === null || now.getTime() - view.lastMarkerTs >= intervalS * 1000)) {
|
|
1116
|
+
const reason = "interactive prompt blocks recovery; escalates_to one-hop delivery already used; existing fallback retained";
|
|
1117
|
+
const choiceOnly = Boolean(group.choice && !group.other);
|
|
1118
|
+
const promptTags = choiceOnly ? [PROMPT_ALERT_TAG, PROMPT_CHOICE_TAG, `consumed-prompt-destination:${dest}`,
|
|
1119
|
+
...(group.rowKeys.get(member.row.qitemId) ?? [])] : [];
|
|
1120
|
+
const continuation = await ensureEscalationRow(deps, dest, resolveOperatorSeat() ?? member.row.sourceSession, [{ row: member.row, reason }], reason, `consumed-hop:${member.row.qitemId}`, [ESCALATION_HOP_TAG, ...promptTags]);
|
|
1121
|
+
if (!view.orchRung)
|
|
1122
|
+
appendMarker(deps.queueRepo, member.row, `${LADDER_RUNG_PREFIX} orchestrator self-skip reason=${reason}`);
|
|
1123
|
+
// A choice alert's tags and dispatch marker must live on the same durable row the shared gate reads.
|
|
1124
|
+
const operatorRow = choiceOnly ? deps.queueRepo.getById(continuation.qitemId) : member.row;
|
|
1125
|
+
if (choiceOnly) {
|
|
1126
|
+
const missing = promptTags.filter(tag => !operatorRow.tags?.includes(tag));
|
|
1127
|
+
if (missing.length)
|
|
1128
|
+
deps.db.prepare("UPDATE queue_items SET tags=? WHERE qitem_id=?")
|
|
1129
|
+
.run(JSON.stringify([...(operatorRow.tags ?? []), ...missing]), operatorRow.qitemId);
|
|
1130
|
+
}
|
|
1131
|
+
if (waitsOnPostedPromptAlert(deps, operatorRow, choiceOnly)) {
|
|
1132
|
+
members.splice(i, 1);
|
|
1133
|
+
continue;
|
|
1134
|
+
}
|
|
1135
|
+
const operatorView = choiceOnly ? readLadder(deps.db, operatorRow.qitemId, 0) : view;
|
|
1136
|
+
if (choiceOnly && operatorView.exhausted) {
|
|
1137
|
+
members.splice(i, 1);
|
|
1138
|
+
continue;
|
|
1139
|
+
}
|
|
1140
|
+
if (await operatorRung(deps, operatorRow, reason, actions, operatorView, choiceOnly)) {
|
|
1141
|
+
// Choice custody stays on the alert until it closes; exhausting its source now would retire the alert next tick.
|
|
1142
|
+
if (!choiceOnly)
|
|
1143
|
+
appendExhausted(deps.queueRepo, member.row, "consumed escalation hop reached operator fallback");
|
|
1144
|
+
if (choiceOnly)
|
|
1145
|
+
appendExhausted(deps.queueRepo, operatorRow, "operator rung resolved");
|
|
1146
|
+
}
|
|
1147
|
+
}
|
|
1148
|
+
members.splice(i, 1);
|
|
1032
1149
|
}
|
|
1033
|
-
|
|
1150
|
+
if (!members.length && !group.jobs.size)
|
|
1151
|
+
continue;
|
|
1152
|
+
const orch = openEscalationOwner(deps.db, `prompt-destination:${dest}`) ?? resolveOrch(dest);
|
|
1034
1153
|
const toOperator = orch === null || orch === dest;
|
|
1035
|
-
const
|
|
1154
|
+
const route = !deps.resolveOrchestrator
|
|
1155
|
+
? resolveEscalationOwner(deps.db, dest, target => deps.queueRepo.acceptsDestination(target)) : null;
|
|
1156
|
+
const reason = "interactive prompt blocks outstanding work; no input was sent"
|
|
1157
|
+
+ (route && route.outcome !== "none" && route.outcome !== "parent" ? `; ${route.reason}` : "");
|
|
1036
1158
|
// Every refusal at a choice prompt: the alert follows queue.wake_human_rung and holds for other choice alerts. Any other
|
|
1037
1159
|
// prompt keeps the permission-prompt route.
|
|
1038
1160
|
const choiceOnly = Boolean(group.choice && !group.other);
|
|
1039
1161
|
const kindTags = choiceOnly ? [PROMPT_CHOICE_TAG] : [];
|
|
1040
|
-
const
|
|
1162
|
+
const keys = group.keys.filter(key => group.jobKeys.has(key) || members.some(m => group.rowKeys.get(m.row.qitemId)?.has(key)));
|
|
1163
|
+
const aggregate = await ensureEscalationRow(deps, dest, toOperator ? resolveOperatorSeat() ?? members[0]?.row.sourceSession ?? [...group.jobs.values()][0] : orch, members, reason, `prompt-destination:${dest}`, [PROMPT_ALERT_TAG, ...kindTags, ...keys], group.jobs);
|
|
1041
1164
|
const row = deps.queueRepo.getById(aggregate.qitemId);
|
|
1042
1165
|
if (!row)
|
|
1043
1166
|
continue;
|
|
1044
|
-
const addedKeys =
|
|
1167
|
+
const addedKeys = keys.filter(key => !row.tags?.includes(key));
|
|
1045
1168
|
// A reminder's run keeps its key while its latest refusal changes kind, so the kind is recomputed on its own too.
|
|
1046
1169
|
const kindChanged = choiceOnly !== Boolean(row.tags?.includes(PROMPT_CHOICE_TAG));
|
|
1047
1170
|
if (addedKeys.length || kindChanged) {
|
|
@@ -1078,9 +1201,10 @@ async function advancePromptRefusals(deps, now, intervalS, graceS, resolveOrch,
|
|
|
1078
1201
|
continue;
|
|
1079
1202
|
if (!view.orchRung) {
|
|
1080
1203
|
if (!toOperator) {
|
|
1081
|
-
const
|
|
1082
|
-
|
|
1083
|
-
|
|
1204
|
+
const recoveryOwner = row.destinationSession;
|
|
1205
|
+
const outcome = await attemptWake(row.qitemId, recoveryOwner);
|
|
1206
|
+
appendMarker(deps.queueRepo, row, `${LADDER_RUNG_PREFIX} orchestrator -> ${recoveryOwner} outcome=${outcome} reason=${reason}`);
|
|
1207
|
+
actions.push({ qitemId: row.qitemId, action: "escalate-orchestrator", target: recoveryOwner });
|
|
1084
1208
|
if (!outcome.startsWith("failed:"))
|
|
1085
1209
|
appendExhausted(deps.queueRepo, row, `escalated to orchestrator (${outcome})`);
|
|
1086
1210
|
continue;
|
|
@@ -1090,14 +1214,8 @@ async function advancePromptRefusals(deps, now, intervalS, graceS, resolveOrch,
|
|
|
1090
1214
|
// One choice-prompt alert to a person at a time on this machine: a prompt many seats hit together, such as a shared usage
|
|
1091
1215
|
// limit, posts once. Each other choice alert stays open, names the alert it waits on, and posts after that one retires.
|
|
1092
1216
|
// A permission prompt, which only a person can approve, never waits behind it.
|
|
1093
|
-
|
|
1094
|
-
if (posted) {
|
|
1095
|
-
const waiting = `${LADDER_RUNG_PREFIX} operator waiting on ${posted}`;
|
|
1096
|
-
if (!deps.queueRepo.listTransitions(row.qitemId).some(t => t.transitionNote?.startsWith(waiting))) {
|
|
1097
|
-
appendMarker(deps.queueRepo, row, `${waiting} reason=one person alert at a time for seats blocked at a prompt`);
|
|
1098
|
-
}
|
|
1217
|
+
if (waitsOnPostedPromptAlert(deps, row, choiceOnly))
|
|
1099
1218
|
continue;
|
|
1100
|
-
}
|
|
1101
1219
|
if (await operatorRung(deps, row, reason, actions, view, choiceOnly)) {
|
|
1102
1220
|
const floor = deps.queueRepo.listTransitions(row.qitemId).at(-1)?.transitionNote?.includes("human rung explicit-only");
|
|
1103
1221
|
appendExhausted(deps.queueRepo, row, floor ? PROMPT_FLOOR_EXHAUSTED : "operator rung resolved");
|
|
@@ -1189,6 +1307,12 @@ async function refreshEscalationRowIfExists(deps, dest, members, dedupTag = esca
|
|
|
1189
1307
|
closureTarget: row.state === "in-progress" ? deps.queueRepo.retainedClaimBlocker(existing.qitem_id) : undefined });
|
|
1190
1308
|
})();
|
|
1191
1309
|
}
|
|
1310
|
+
/** Existing recovery custody takes precedence over a newly resolved topology fallback. */
|
|
1311
|
+
function openEscalationOwner(db, dedupTag) {
|
|
1312
|
+
return db.prepare(`SELECT destination_session FROM queue_items WHERE state IN ('pending','in-progress','blocked')
|
|
1313
|
+
AND json_valid(tags) AND EXISTS (SELECT 1 FROM json_each(tags) WHERE value = ?) LIMIT 1`)
|
|
1314
|
+
.get(dedupTag)?.destination_session ?? null;
|
|
1315
|
+
}
|
|
1192
1316
|
async function ensureEscalationRow(deps, dest, orch, members, reason, dedupTag = escalationDedupTag(dest), extraTags = [],
|
|
1193
1317
|
/** Watchdog reminders refused at this seat's prompt: job id to the session that registered it. */
|
|
1194
1318
|
jobs = new Map()) {
|
|
@@ -1207,12 +1331,16 @@ jobs = new Map()) {
|
|
|
1207
1331
|
members.map((m) => `- ${m.row.qitemId}: ${m.row.summary ?? "outstanding work"} (${m.reason})`).join("\n") +
|
|
1208
1332
|
(jobs.size ? `\nwatchdog reminders refused at its prompt (${jobs.size}):\n${[...jobs.keys()].map(id => `- ${id}`).join("\n")}` : "") +
|
|
1209
1333
|
`\nThe rows above still carry their obligations exactly-once; this escalation is the wake, not the content.`;
|
|
1334
|
+
const route = !deps.resolveOrchestrator
|
|
1335
|
+
? resolveEscalationOwner(deps.db, dest, target => deps.queueRepo.acceptsDestination(target)) : null;
|
|
1336
|
+
const oneHop = route?.outcome === "routed" && route.owner === orch;
|
|
1210
1337
|
const created = await deps.queueRepo.create({
|
|
1211
1338
|
sourceSession: members[0]?.row.sourceSession ?? [...jobs.values()][0],
|
|
1212
1339
|
destinationSession: orch,
|
|
1213
1340
|
body,
|
|
1214
1341
|
summary: `Wake escalation: ${members.length} baton(s)${jobs.size ? ` and ${jobs.size} watchdog reminder(s)` : ""} stuck at ${dest} — ${reason}`,
|
|
1215
|
-
tags: [WAKE_ESCALATION_TAG, dedupTag,
|
|
1342
|
+
tags: [WAKE_ESCALATION_TAG, dedupTag,
|
|
1343
|
+
...(oneHop ? [ESCALATION_HOP_TAG] : []), ...extraTags, ...members.map(m => recoveryTag(m.row.qitemId))],
|
|
1216
1344
|
nudge: false, // delivery is the ladder's own rung attempt, recorded with its outcome
|
|
1217
1345
|
});
|
|
1218
1346
|
return { qitemId: created.qitemId };
|