@openrig/cli 0.7.4 → 0.7.6
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 +5 -0
- package/daemon/assets/plugins/openrig-core/skills/queue-handoff/SKILL.md +5 -1
- 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 +49 -8
- package/daemon/context-packs/reference/getting-started.md +47 -3
- package/daemon/context-packs/reference/manifest.yaml +1 -1
- package/daemon/context-packs/reference/rig-spec.md +147 -4
- package/daemon/context-packs/reference/whats-new.md +104 -117
- 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/SKILL.md +0 -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/SKILL.md +0 -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/SKILL.md +2 -2
- 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 +5 -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 +76 -28
- 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 +20 -4
- package/daemon/dist/adapters/claude-resume.js.map +1 -1
- package/daemon/dist/adapters/codex-runtime-adapter.d.ts +1 -1
- package/daemon/dist/adapters/codex-runtime-adapter.d.ts.map +1 -1
- package/daemon/dist/adapters/codex-runtime-adapter.js +5 -2
- package/daemon/dist/adapters/codex-runtime-adapter.js.map +1 -1
- package/daemon/dist/adapters/community-harness-runtime-adapter.d.ts +2 -0
- package/daemon/dist/adapters/community-harness-runtime-adapter.d.ts.map +1 -1
- package/daemon/dist/adapters/community-harness-runtime-adapter.js +37 -14
- package/daemon/dist/adapters/community-harness-runtime-adapter.js.map +1 -1
- package/daemon/dist/adapters/pi-runner-protocol.d.ts +1 -1
- package/daemon/dist/adapters/pi-runner-protocol.d.ts.map +1 -1
- package/daemon/dist/adapters/pi-runner-protocol.js +3 -1
- package/daemon/dist/adapters/pi-runner-protocol.js.map +1 -1
- package/daemon/dist/adapters/tmux.d.ts +6 -5
- package/daemon/dist/adapters/tmux.d.ts.map +1 -1
- package/daemon/dist/adapters/tmux.js +16 -12
- 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 +6 -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/141_node_account_home.d.ts +3 -0
- package/daemon/dist/db/migrations/141_node_account_home.d.ts.map +1 -0
- package/daemon/dist/db/migrations/141_node_account_home.js +6 -0
- package/daemon/dist/db/migrations/141_node_account_home.js.map +1 -0
- package/daemon/dist/db/migrations/141_session_agent_runner.d.ts +3 -0
- package/daemon/dist/db/migrations/141_session_agent_runner.d.ts.map +1 -0
- package/daemon/dist/db/migrations/141_session_agent_runner.js +11 -0
- package/daemon/dist/db/migrations/141_session_agent_runner.js.map +1 -0
- package/daemon/dist/domain/activity-taxonomy.d.ts +7 -2
- package/daemon/dist/domain/activity-taxonomy.d.ts.map +1 -1
- package/daemon/dist/domain/activity-taxonomy.js +10 -2
- package/daemon/dist/domain/activity-taxonomy.js.map +1 -1
- package/daemon/dist/domain/agent-activity-store.d.ts +6 -3
- package/daemon/dist/domain/agent-activity-store.d.ts.map +1 -1
- package/daemon/dist/domain/agent-activity-store.js +18 -10
- package/daemon/dist/domain/agent-activity-store.js.map +1 -1
- package/daemon/dist/domain/claim-service.js +1 -1
- package/daemon/dist/domain/claim-service.js.map +1 -1
- package/daemon/dist/domain/claude-credential-precedence.d.ts +8 -0
- package/daemon/dist/domain/claude-credential-precedence.d.ts.map +1 -1
- package/daemon/dist/domain/claude-credential-precedence.js +49 -4
- package/daemon/dist/domain/claude-credential-precedence.js.map +1 -1
- package/daemon/dist/domain/claude-managed-launch.d.ts +24 -3
- package/daemon/dist/domain/claude-managed-launch.d.ts.map +1 -1
- package/daemon/dist/domain/claude-managed-launch.js +92 -29
- package/daemon/dist/domain/claude-managed-launch.js.map +1 -1
- package/daemon/dist/domain/claude-seat-token.d.ts +14 -2
- package/daemon/dist/domain/claude-seat-token.d.ts.map +1 -1
- package/daemon/dist/domain/claude-seat-token.js +54 -7
- package/daemon/dist/domain/claude-seat-token.js.map +1 -1
- package/daemon/dist/domain/codex-rebuild-permissions.d.ts.map +1 -1
- package/daemon/dist/domain/codex-rebuild-permissions.js +6 -4
- package/daemon/dist/domain/codex-rebuild-permissions.js.map +1 -1
- package/daemon/dist/domain/community-harness-presets.d.ts +5 -0
- package/daemon/dist/domain/community-harness-presets.d.ts.map +1 -1
- package/daemon/dist/domain/community-harness-presets.js +9 -2
- package/daemon/dist/domain/community-harness-presets.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/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 +2 -0
- package/daemon/dist/domain/gateway/destination-resolver.d.ts.map +1 -1
- package/daemon/dist/domain/gateway/destination-resolver.js +10 -1
- package/daemon/dist/domain/gateway/destination-resolver.js.map +1 -1
- package/daemon/dist/domain/gateway/slack/config.d.ts +7 -0
- package/daemon/dist/domain/gateway/slack/config.d.ts.map +1 -1
- package/daemon/dist/domain/gateway/slack/config.js +5 -0
- package/daemon/dist/domain/gateway/slack/config.js.map +1 -1
- package/daemon/dist/domain/gateway/slack/inbound.d.ts +4 -0
- package/daemon/dist/domain/gateway/slack/inbound.d.ts.map +1 -1
- package/daemon/dist/domain/gateway/slack/inbound.js +11 -3
- package/daemon/dist/domain/gateway/slack/inbound.js.map +1 -1
- package/daemon/dist/domain/gateway/slack/queue-access.d.ts.map +1 -1
- package/daemon/dist/domain/gateway/slack/queue-access.js +8 -15
- package/daemon/dist/domain/gateway/slack/queue-access.js.map +1 -1
- package/daemon/dist/domain/gateway/slack/slack-api.d.ts +5 -1
- package/daemon/dist/domain/gateway/slack/slack-api.d.ts.map +1 -1
- package/daemon/dist/domain/gateway/slack/slack-api.js +7 -1
- package/daemon/dist/domain/gateway/slack/slack-api.js.map +1 -1
- package/daemon/dist/domain/gateway/slack/slack-delivery.d.ts +3 -0
- package/daemon/dist/domain/gateway/slack/slack-delivery.d.ts.map +1 -1
- package/daemon/dist/domain/gateway/slack/slack-delivery.js +12 -5
- package/daemon/dist/domain/gateway/slack/slack-delivery.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 +19 -5
- 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/markdown-address.d.ts.map +1 -1
- package/daemon/dist/domain/markdown-address.js +14 -1
- package/daemon/dist/domain/markdown-address.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/model-divergence/current-model-reader.d.ts +1 -1
- package/daemon/dist/domain/model-divergence/current-model-reader.d.ts.map +1 -1
- package/daemon/dist/domain/model-divergence/current-model-reader.js.map +1 -1
- package/daemon/dist/domain/native-process-arguments.d.ts +7 -0
- package/daemon/dist/domain/native-process-arguments.d.ts.map +1 -0
- package/daemon/dist/domain/native-process-arguments.js +188 -0
- package/daemon/dist/domain/native-process-arguments.js.map +1 -0
- package/daemon/dist/domain/native-process-lineage.d.ts +8 -0
- package/daemon/dist/domain/native-process-lineage.d.ts.map +1 -1
- package/daemon/dist/domain/native-process-lineage.js +87 -29
- package/daemon/dist/domain/native-process-lineage.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 +3 -3
- package/daemon/dist/domain/node-inventory.d.ts.map +1 -1
- package/daemon/dist/domain/node-inventory.js +40 -29
- package/daemon/dist/domain/node-inventory.js.map +1 -1
- package/daemon/dist/domain/node-launcher.d.ts.map +1 -1
- package/daemon/dist/domain/node-launcher.js +6 -4
- package/daemon/dist/domain/node-launcher.js.map +1 -1
- package/daemon/dist/domain/pane-cutover.d.ts +1 -1
- package/daemon/dist/domain/pane-cutover.d.ts.map +1 -1
- package/daemon/dist/domain/pane-cutover.js +3 -3
- package/daemon/dist/domain/pane-cutover.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/parked-owner-consumer.js +1 -1
- package/daemon/dist/domain/policies/parked-owner-consumer.js.map +1 -1
- package/daemon/dist/domain/process-table.d.ts +2 -0
- package/daemon/dist/domain/process-table.d.ts.map +1 -1
- package/daemon/dist/domain/process-table.js +3 -0
- package/daemon/dist/domain/process-table.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 +14 -1
- package/daemon/dist/domain/proof/source-watch.js.map +1 -1
- package/daemon/dist/domain/provider/claude-seat-switch.d.ts.map +1 -1
- package/daemon/dist/domain/provider/claude-seat-switch.js +19 -9
- package/daemon/dist/domain/provider/claude-seat-switch.js.map +1 -1
- package/daemon/dist/domain/provider/provider-service-impl.d.ts.map +1 -1
- package/daemon/dist/domain/provider/provider-service-impl.js +3 -0
- package/daemon/dist/domain/provider/provider-service-impl.js.map +1 -1
- package/daemon/dist/domain/provider/provider-service.d.ts +6 -0
- package/daemon/dist/domain/provider/provider-service.d.ts.map +1 -1
- package/daemon/dist/domain/provider/provider-types.d.ts +3 -2
- package/daemon/dist/domain/provider/provider-types.d.ts.map +1 -1
- package/daemon/dist/domain/ps-projection.d.ts +4 -3
- package/daemon/dist/domain/ps-projection.d.ts.map +1 -1
- package/daemon/dist/domain/ps-projection.js +10 -7
- package/daemon/dist/domain/ps-projection.js.map +1 -1
- package/daemon/dist/domain/queue-repository.d.ts +16 -2
- package/daemon/dist/domain/queue-repository.d.ts.map +1 -1
- package/daemon/dist/domain/queue-repository.js +102 -24
- package/daemon/dist/domain/queue-repository.js.map +1 -1
- package/daemon/dist/domain/queue-stuck-sweep.d.ts +2 -2
- package/daemon/dist/domain/queue-stuck-sweep.d.ts.map +1 -1
- package/daemon/dist/domain/queue-stuck-sweep.js +151 -27
- package/daemon/dist/domain/queue-stuck-sweep.js.map +1 -1
- package/daemon/dist/domain/queue-transition-log.d.ts +14 -0
- package/daemon/dist/domain/queue-transition-log.d.ts.map +1 -1
- package/daemon/dist/domain/queue-transition-log.js +53 -0
- 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 +1 -1
- package/daemon/dist/domain/queue-wake-ladder.d.ts.map +1 -1
- package/daemon/dist/domain/queue-wake-ladder.js +186 -48
- package/daemon/dist/domain/queue-wake-ladder.js.map +1 -1
- package/daemon/dist/domain/reply-to-choice.d.ts +3 -0
- package/daemon/dist/domain/reply-to-choice.d.ts.map +1 -1
- package/daemon/dist/domain/reply-to-choice.js +12 -0
- package/daemon/dist/domain/reply-to-choice.js.map +1 -1
- package/daemon/dist/domain/restore-orchestrator.d.ts +7 -2
- package/daemon/dist/domain/restore-orchestrator.d.ts.map +1 -1
- package/daemon/dist/domain/restore-orchestrator.js +69 -22
- package/daemon/dist/domain/restore-orchestrator.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-expansion-service.d.ts.map +1 -1
- package/daemon/dist/domain/rig-expansion-service.js +20 -35
- package/daemon/dist/domain/rig-expansion-service.js.map +1 -1
- package/daemon/dist/domain/rig-repository.d.ts +3 -1
- package/daemon/dist/domain/rig-repository.d.ts.map +1 -1
- package/daemon/dist/domain/rig-repository.js +37 -9
- 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-codec.d.ts.map +1 -1
- package/daemon/dist/domain/rigspec-codec.js +4 -0
- package/daemon/dist/domain/rigspec-codec.js.map +1 -1
- package/daemon/dist/domain/rigspec-exporter.d.ts.map +1 -1
- package/daemon/dist/domain/rigspec-exporter.js +7 -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 +12 -8
- 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 +37 -2
- package/daemon/dist/domain/rigspec-schema.js.map +1 -1
- package/daemon/dist/domain/rosters.d.ts +2 -0
- package/daemon/dist/domain/rosters.d.ts.map +1 -1
- package/daemon/dist/domain/rosters.js +6 -0
- package/daemon/dist/domain/rosters.js.map +1 -1
- package/daemon/dist/domain/runtime-adapter.d.ts +11 -0
- package/daemon/dist/domain/runtime-adapter.d.ts.map +1 -1
- package/daemon/dist/domain/runtime-adapter.js.map +1 -1
- package/daemon/dist/domain/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-activity-service.d.ts +8 -1
- package/daemon/dist/domain/seat-activity-service.d.ts.map +1 -1
- package/daemon/dist/domain/seat-activity-service.js +92 -35
- package/daemon/dist/domain/seat-activity-service.js.map +1 -1
- package/daemon/dist/domain/seat-attention-reconciler.js +2 -2
- 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-identity-reconciler.d.ts.map +1 -1
- package/daemon/dist/domain/seat-identity-reconciler.js +13 -1
- package/daemon/dist/domain/seat-identity-reconciler.js.map +1 -1
- package/daemon/dist/domain/seat-launch-environment.d.ts +4 -1
- package/daemon/dist/domain/seat-launch-environment.d.ts.map +1 -1
- package/daemon/dist/domain/seat-launch-environment.js +21 -8
- package/daemon/dist/domain/seat-launch-environment.js.map +1 -1
- package/daemon/dist/domain/seat-lifecycle-service.d.ts.map +1 -1
- package/daemon/dist/domain/seat-lifecycle-service.js +19 -11
- package/daemon/dist/domain/seat-lifecycle-service.js.map +1 -1
- package/daemon/dist/domain/seat-restart-in-place.d.ts +1 -1
- package/daemon/dist/domain/seat-restart-in-place.d.ts.map +1 -1
- package/daemon/dist/domain/seat-restart-in-place.js +66 -13
- package/daemon/dist/domain/seat-restart-in-place.js.map +1 -1
- package/daemon/dist/domain/seat-runtime-home.d.ts +7 -3
- package/daemon/dist/domain/seat-runtime-home.d.ts.map +1 -1
- package/daemon/dist/domain/seat-runtime-home.js +32 -3
- package/daemon/dist/domain/seat-runtime-home.js.map +1 -1
- package/daemon/dist/domain/seat-runtime-switch-service.d.ts +13 -0
- package/daemon/dist/domain/seat-runtime-switch-service.d.ts.map +1 -1
- package/daemon/dist/domain/seat-runtime-switch-service.js +48 -6
- package/daemon/dist/domain/seat-runtime-switch-service.js.map +1 -1
- package/daemon/dist/domain/seat-status-service.d.ts +4 -2
- package/daemon/dist/domain/seat-status-service.d.ts.map +1 -1
- package/daemon/dist/domain/seat-status-service.js +5 -3
- package/daemon/dist/domain/seat-status-service.js.map +1 -1
- package/daemon/dist/domain/session-registry.d.ts +10 -2
- package/daemon/dist/domain/session-registry.d.ts.map +1 -1
- package/daemon/dist/domain/session-registry.js +24 -2
- package/daemon/dist/domain/session-registry.js.map +1 -1
- package/daemon/dist/domain/session-transport.d.ts.map +1 -1
- package/daemon/dist/domain/session-transport.js +39 -18
- package/daemon/dist/domain/session-transport.js.map +1 -1
- package/daemon/dist/domain/startup-orchestrator.d.ts.map +1 -1
- package/daemon/dist/domain/startup-orchestrator.js +12 -2
- package/daemon/dist/domain/startup-orchestrator.js.map +1 -1
- package/daemon/dist/domain/startup-proof.d.ts +3 -1
- package/daemon/dist/domain/startup-proof.d.ts.map +1 -1
- package/daemon/dist/domain/startup-proof.js +7 -2
- package/daemon/dist/domain/startup-proof.js.map +1 -1
- package/daemon/dist/domain/successor-session-launcher.d.ts +1 -1
- package/daemon/dist/domain/successor-session-launcher.d.ts.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 +355 -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 +34 -9
- package/daemon/dist/domain/terminal/herdr-sessions.js.map +1 -1
- package/daemon/dist/domain/terminal/herdr-transport.d.ts +3 -2
- package/daemon/dist/domain/terminal/herdr-transport.d.ts.map +1 -1
- package/daemon/dist/domain/terminal/herdr-transport.js +10 -6
- package/daemon/dist/domain/terminal/herdr-transport.js.map +1 -1
- package/daemon/dist/domain/terminal/herdr-viewer.d.ts +84 -0
- package/daemon/dist/domain/terminal/herdr-viewer.d.ts.map +1 -0
- package/daemon/dist/domain/terminal/herdr-viewer.js +311 -0
- package/daemon/dist/domain/terminal/herdr-viewer.js.map +1 -0
- package/daemon/dist/domain/terminal/scope-task-terminal-view.d.ts +28 -0
- package/daemon/dist/domain/terminal/scope-task-terminal-view.d.ts.map +1 -0
- package/daemon/dist/domain/terminal/scope-task-terminal-view.js +268 -0
- package/daemon/dist/domain/terminal/scope-task-terminal-view.js.map +1 -0
- package/daemon/dist/domain/terminal/task-terminal-view.d.ts +12 -2
- package/daemon/dist/domain/terminal/task-terminal-view.d.ts.map +1 -1
- package/daemon/dist/domain/terminal/task-terminal-view.js +6 -1
- package/daemon/dist/domain/terminal/task-terminal-view.js.map +1 -1
- 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 +10 -0
- package/daemon/dist/domain/terminal/terminal-provider.d.ts.map +1 -1
- package/daemon/dist/domain/terminal/terminal-service.d.ts +29 -0
- package/daemon/dist/domain/terminal/terminal-service.d.ts.map +1 -1
- package/daemon/dist/domain/terminal/terminal-service.js +143 -35
- 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 +37 -2
- package/daemon/dist/domain/types.d.ts.map +1 -1
- package/daemon/dist/domain/types.js +5 -0
- package/daemon/dist/domain/types.js.map +1 -1
- package/daemon/dist/domain/workflow-runtime.js +1 -1
- package/daemon/dist/domain/workflow-runtime.js.map +1 -1
- package/daemon/dist/index.d.ts.map +1 -1
- package/daemon/dist/index.js +1 -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 +58 -7
- package/daemon/dist/routes/activity.js.map +1 -1
- package/daemon/dist/routes/provider.d.ts +1 -0
- package/daemon/dist/routes/provider.d.ts.map +1 -1
- package/daemon/dist/routes/provider.js +49 -10
- package/daemon/dist/routes/provider.js.map +1 -1
- package/daemon/dist/routes/rigs.js +3 -97
- package/daemon/dist/routes/rigs.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/seat.d.ts +4 -1
- package/daemon/dist/routes/seat.d.ts.map +1 -1
- package/daemon/dist/routes/seat.js +8 -2
- package/daemon/dist/routes/seat.js.map +1 -1
- package/daemon/dist/routes/sessions.js +4 -3
- package/daemon/dist/routes/sessions.js.map +1 -1
- package/daemon/dist/routes/slices.d.ts.map +1 -1
- package/daemon/dist/routes/slices.js +1 -0
- package/daemon/dist/routes/slices.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 +61 -3
- package/daemon/dist/routes/terminal.js.map +1 -1
- package/daemon/dist/routes/transport.d.ts.map +1 -1
- package/daemon/dist/routes/transport.js +3 -0
- 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 +35 -11
- 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 +21 -1
- package/daemon/docs/reference/author-contracts.md +74 -0
- package/daemon/docs/reference/community-harness-examples/cursor/cursor.yaml +1 -0
- package/daemon/docs/reference/community-harness-examples/cursor/openrig-cursor-launch +6 -0
- package/daemon/docs/reference/community-harness-examples/hermes/hermes.yaml +1 -0
- package/daemon/docs/reference/community-harness-examples/hermes/openrig-hermes-launch +15 -0
- 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 +155 -3
- package/daemon/docs/reference/edge-types.md +40 -11
- package/daemon/docs/reference/execution-platform-contract.md +138 -0
- package/daemon/docs/reference/getting-started.md +47 -3
- package/daemon/docs/reference/harness-runner-contract.md +242 -0
- package/daemon/docs/reference/hosted-members.md +5 -1
- package/daemon/docs/reference/publishing-a-rig-bundle.md +5 -0
- package/daemon/docs/reference/quickstart.md +1 -1
- package/daemon/docs/reference/rig-spec.md +147 -4
- package/daemon/docs/reference/sdlc-conventions.md +6 -0
- package/daemon/docs/reference/seat-delivery.md +6 -0
- package/daemon/docs/reference/slack-app-setup.md +8 -0
- package/daemon/docs/reference/terminal-sessions.md +215 -7
- package/daemon/docs/reference/whats-new.md +104 -117
- package/daemon/specs/agents/shared/skills/core/openrig-architect/SKILL.md +0 -1
- package/daemon/specs/agents/shared/skills/core/openrig-upgrade/SKILL.md +0 -1
- package/daemon/specs/agents/shared/skills/core/rig-bundles-and-shareable-artifacts/SKILL.md +11 -0
- package/daemon/specs/agents/shared/skills/core/rig-lifecycle/SKILL.md +2 -2
- package/daemon/specs/rigs/launch/kernel/agents/operator/agent/guidance/role.md +11 -2
- package/daemon/specs/rigs/launch/kernel/culture/CULTURE.md +2 -1
- package/dist/build-info.js +3 -3
- package/dist/client.js +3 -3
- 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/chatroom.d.ts +7 -0
- package/dist/commands/chatroom.d.ts.map +1 -1
- package/dist/commands/chatroom.js +21 -4
- package/dist/commands/chatroom.js.map +1 -1
- package/dist/commands/crash-cart.d.ts +6 -0
- package/dist/commands/crash-cart.d.ts.map +1 -1
- package/dist/commands/crash-cart.js +10 -5
- package/dist/commands/crash-cart.js.map +1 -1
- package/dist/commands/edge.d.ts.map +1 -1
- package/dist/commands/edge.js +10 -5
- package/dist/commands/edge.js.map +1 -1
- package/dist/commands/host.d.ts +8 -0
- package/dist/commands/host.d.ts.map +1 -1
- package/dist/commands/host.js +74 -8
- package/dist/commands/host.js.map +1 -1
- package/dist/commands/mcp.d.ts.map +1 -1
- package/dist/commands/mcp.js +4 -1
- package/dist/commands/mcp.js.map +1 -1
- package/dist/commands/provider.d.ts +1 -0
- package/dist/commands/provider.d.ts.map +1 -1
- package/dist/commands/provider.js +146 -7
- package/dist/commands/provider.js.map +1 -1
- package/dist/commands/queue.d.ts.map +1 -1
- package/dist/commands/queue.js +40 -11
- package/dist/commands/queue.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 +1 -0
- package/dist/commands/seat.d.ts.map +1 -1
- package/dist/commands/seat.js +61 -9
- package/dist/commands/seat.js.map +1 -1
- package/dist/commands/send.d.ts.map +1 -1
- package/dist/commands/send.js +18 -23
- package/dist/commands/send.js.map +1 -1
- package/dist/commands/slack.d.ts.map +1 -1
- package/dist/commands/slack.js +2 -0
- package/dist/commands/slack.js.map +1 -1
- package/dist/commands/start.d.ts.map +1 -1
- package/dist/commands/start.js +7 -0
- package/dist/commands/start.js.map +1 -1
- package/dist/commands/startup-proof.d.ts.map +1 -1
- package/dist/commands/startup-proof.js +4 -1
- package/dist/commands/startup-proof.js.map +1 -1
- package/dist/commands/status.d.ts.map +1 -1
- package/dist/commands/status.js +3 -1
- package/dist/commands/status.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/daemon-lifecycle.d.ts.map +1 -1
- package/dist/daemon-lifecycle.js +29 -4
- package/dist/daemon-lifecycle.js.map +1 -1
- package/dist/lib/account-home-switch.d.ts +6 -0
- package/dist/lib/account-home-switch.d.ts.map +1 -0
- package/dist/lib/account-home-switch.js +8 -0
- package/dist/lib/account-home-switch.js.map +1 -0
- 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/lib/scope/scope-fs.d.ts.map +1 -1
- package/dist/lib/scope/scope-fs.js +13 -4
- package/dist/lib/scope/scope-fs.js.map +1 -1
- package/dist/mcp-server.d.ts +1 -1
- package/dist/mcp-server.d.ts.map +1 -1
- package/dist/mcp-server.js +4 -3
- package/dist/mcp-server.js.map +1 -1
- package/dist/openrig-compat.d.ts +9 -1
- package/dist/openrig-compat.d.ts.map +1 -1
- package/dist/openrig-compat.js +19 -3
- package/dist/openrig-compat.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 +31 -5
- package/dist/terminal-window.js.map +1 -1
- package/package.json +1 -1
- package/tui/dist/attention/attention-model.js +9 -7
- package/tui/dist/attention/attention-model.js.map +1 -1
- package/tui/dist/config/config-model.d.ts.map +1 -1
- package/tui/dist/config/config-model.js +2 -2
- package/tui/dist/config/config-model.js.map +1 -1
- package/tui/dist/daemon-client.d.ts +1 -0
- package/tui/dist/daemon-client.d.ts.map +1 -1
- package/tui/dist/daemon-client.js +1 -1
- package/tui/dist/daemon-client.js.map +1 -1
- package/tui/dist/health/health-model.d.ts.map +1 -1
- package/tui/dist/health/health-model.js +2 -2
- package/tui/dist/health/health-model.js.map +1 -1
- package/tui/dist/hydrate.d.ts.map +1 -1
- package/tui/dist/hydrate.js +3 -0
- package/tui/dist/hydrate.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.map +1 -1
- package/tui/dist/render.js +17 -14
- 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/stylize.js +1 -1
- package/tui/dist/stylize.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-CMBgYrS7.js} +166 -166
- package/ui/dist/index.html +1 -1
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
import { resolveEscalationOwner, ESCALATION_HOP_TAG, hasConsumedEscalationHop } from "./escalation-owner.js";
|
|
1
2
|
import { seatRuntimeHomeBySession } from "./seat-runtime-home.js";
|
|
3
|
+
import { OPENRIG_SENDER } from "../lib/pane-envelope.js";
|
|
4
|
+
import { renderQueueHandoffNudge } from "./queue-nudge-text.js";
|
|
2
5
|
import { quietHoldCustody } from "./quiet-hold-custody.js";
|
|
3
6
|
import { latestHookMovedOn, latestHookPermissionPending, latestHookWaitsOnPerson } from "./agent-activity-store.js";
|
|
4
7
|
import { openPromptRefusals, CLOSE_PREFIX, PARKED_OWNER_POLICY_NAME, REFUSED_PREFIX } from "./policies/parked-owner-consumer.js";
|
|
@@ -9,7 +12,7 @@ import { USAGE_LIMIT_BLOCKER_TAG, USAGE_LIMIT_POOL_TAG_PREFIX, } from "./queue-w
|
|
|
9
12
|
import { SettingsStore } from "./user-settings/settings-store.js";
|
|
10
13
|
import { loadHumanRegistry, resolveRegisteredHumanAddress } from "./gateway/human-registry.js";
|
|
11
14
|
import { parseSessionName } from "./session-name.js";
|
|
12
|
-
import { LADDER_ATTEMPT_PREFIX, LADDER_RUNG_PREFIX, LADDER_EXHAUSTED_PREFIX,
|
|
15
|
+
import { LADDER_ATTEMPT_PREFIX, LADDER_RUNG_PREFIX, LADDER_EXHAUSTED_PREFIX, resolveOperatorSeat, resolveSessionNodeId, } from "./queue-stuck-sweep.js";
|
|
13
16
|
export const WAKE_RETRY_INTERVAL_KEY = "queue.wake_retry_interval_seconds";
|
|
14
17
|
export const DEFAULT_WAKE_RETRY_INTERVAL_SECONDS = 300;
|
|
15
18
|
export const WAKE_RETRY_CAP_KEY = "queue.wake_retry_cap";
|
|
@@ -326,14 +329,16 @@ function suspensionReason(db, destination, graceSeconds, now) {
|
|
|
326
329
|
/** Read the existing ladder's next eligible action; never create an intent,
|
|
327
330
|
* reserve a retry, consume provider state or change its policy. The scheduler
|
|
328
331
|
* still makes the final live-state decision at delivery time. */
|
|
329
|
-
export function readWakeLadderBackstop(db, qitemId) {
|
|
332
|
+
export function readWakeLadderBackstop(db, qitemId, acceptsDestination) {
|
|
330
333
|
const row = db.prepare(`SELECT qitem_id AS qitemId, state, source_session AS sourceSession,
|
|
331
334
|
destination_session AS destinationSession, claimed_at AS claimedAt, handed_off_from AS handedOffFrom,
|
|
332
335
|
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 = ?`)
|
|
336
|
+
last_nudge_attempt AS lastNudgeAttempt, ts_created AS tsCreated, tags AS tagsJson FROM queue_items WHERE qitem_id = ?`)
|
|
334
337
|
.get(qitemId);
|
|
335
338
|
if (!row || !["pending", "in-progress"].includes(row.state))
|
|
336
339
|
return null;
|
|
340
|
+
const escalationOwner = () => hasConsumedEscalationHop(db, qitemId)
|
|
341
|
+
? null : resolveEscalationOwner(db, row.destinationSession, acceptsDestination).owner;
|
|
337
342
|
const recovery = findWakeRecovery(db, qitemId);
|
|
338
343
|
const disposition = recovery ? db.prepare("SELECT destination_session, tags FROM queue_items WHERE qitem_id = ?")
|
|
339
344
|
.get(recovery.qitemId) : null;
|
|
@@ -354,7 +359,7 @@ export function readWakeLadderBackstop(db, qitemId) {
|
|
|
354
359
|
const ladder = readLadder(db, qitemId);
|
|
355
360
|
if (ladder.exhausted)
|
|
356
361
|
return recovery ? recoveryBackstop() : {
|
|
357
|
-
owner:
|
|
362
|
+
owner: escalationOwner() ?? row.destinationSession,
|
|
358
363
|
mechanism: "queue-wake-ladder:exhausted; queue-stuck-sweep:undelivered", dueAt: null, intervalSeconds: null,
|
|
359
364
|
note: "No further ladder retry. Inspect the retained exhaustion and delivery evidence; the stuck sweep is the safety net.",
|
|
360
365
|
};
|
|
@@ -381,7 +386,7 @@ export function readWakeLadderBackstop(db, qitemId) {
|
|
|
381
386
|
const suspension = readSuspension(db, row.destinationSession, resolveWakeSwapGraceSeconds(), now);
|
|
382
387
|
if (suspension)
|
|
383
388
|
due = Math.max(due, Date.parse(suspension.until));
|
|
384
|
-
const orch =
|
|
389
|
+
const orch = disposition?.destination_session ?? escalationOwner();
|
|
385
390
|
const operator = ladder.orchRung || orch === null || orch === row.destinationSession;
|
|
386
391
|
return {
|
|
387
392
|
owner: retry ? row.destinationSession : operator ? resolveOperatorSeat() ?? row.sourceSession : orch,
|
|
@@ -481,11 +486,16 @@ export async function runWakeLadderTick(deps) {
|
|
|
481
486
|
const cap = deps.retryCap ?? resolveWakeRetryCap();
|
|
482
487
|
const windowMin = deps.unconfirmedWindowMinutes ?? resolveWakeUnconfirmedWindowMinutes();
|
|
483
488
|
const graceS = deps.swapGraceSeconds ?? resolveWakeSwapGraceSeconds();
|
|
484
|
-
const resolveOrch = deps.resolveOrchestrator ?? ((session) =>
|
|
489
|
+
const resolveOrch = deps.resolveOrchestrator ?? ((session) => {
|
|
490
|
+
return resolveEscalationOwner(deps.db, session, target => deps.queueRepo.acceptsDestination(target)).owner;
|
|
491
|
+
});
|
|
485
492
|
const attemptWake = deps.attemptWake ??
|
|
486
493
|
(async (qitemId, target) => {
|
|
487
494
|
// A ladder retry is OpenRig's own scheduling on the row, whoever created it.
|
|
488
|
-
|
|
495
|
+
// It is sent as OpenRig (daemon@kernel); the row's original source stays visible in the body.
|
|
496
|
+
const row = deps.queueRepo.getById(qitemId);
|
|
497
|
+
const bodyOverride = `${renderQueueHandoffNudge(qitemId, null)}${row?.sourceSession ? ` Row source: ${row.sourceSession}.` : ""}`;
|
|
498
|
+
await deps.queueRepo.maybeNudge(qitemId, target, true, OPENRIG_SENDER, bodyOverride, "openrig");
|
|
489
499
|
return deps.queueRepo.getById(qitemId)?.lastNudgeWireResult ?? "indeterminate:no transport available";
|
|
490
500
|
});
|
|
491
501
|
const actions = [];
|
|
@@ -657,6 +667,20 @@ export async function runWakeLadderTick(deps) {
|
|
|
657
667
|
: mode === "held"
|
|
658
668
|
? `held by ${row.destinationSession}'s typing guard for ${minutesSince(row.tsCreated, now)} min: nothing was typed, and it isn't retried`
|
|
659
669
|
: `unconfirmed delivery with no pickup evidence over ${minutesSince(row.tsCreated, now)} min`;
|
|
670
|
+
if (hasConsumedEscalationHop(deps.db, row.qitemId)) {
|
|
671
|
+
if (!due || suspended)
|
|
672
|
+
continue;
|
|
673
|
+
const consumedReason = `${reason}; escalates_to one-hop delivery already used; existing fallback retained`;
|
|
674
|
+
// Keep this recovery visible without sharing the ordinary destination aggregate or forwarding another hop.
|
|
675
|
+
await ensureEscalationRow(deps, row.destinationSession, humanAlertCarrier(deps, row.destinationSession, row.sourceSession), [{ row, reason: consumedReason }], consumedReason, `consumed-hop:${row.qitemId}`, [ESCALATION_HOP_TAG]);
|
|
676
|
+
if (!view.orchRung)
|
|
677
|
+
appendMarker(deps.queueRepo, row, `${LADDER_RUNG_PREFIX} orchestrator self-skip reason=${consumedReason}`);
|
|
678
|
+
if (await operatorRung(deps, row, consumedReason, actions, view)) {
|
|
679
|
+
appendExhausted(deps.queueRepo, row, "consumed escalation hop reached operator fallback");
|
|
680
|
+
exhaustedThisTick += 1;
|
|
681
|
+
}
|
|
682
|
+
continue;
|
|
683
|
+
}
|
|
660
684
|
const dest = row.destinationSession;
|
|
661
685
|
if (!escalating.has(dest))
|
|
662
686
|
escalating.set(dest, []);
|
|
@@ -665,7 +689,13 @@ export async function runWakeLadderTick(deps) {
|
|
|
665
689
|
// F3 — per-destination aggregation: ONE escalation carrying the row list, refreshed
|
|
666
690
|
// not duplicated (the S02 idempotency shape), and rung markers on every member baton.
|
|
667
691
|
for (const [dest, members] of escalating) {
|
|
668
|
-
const orch = resolveOrch(dest);
|
|
692
|
+
const orch = openEscalationOwner(deps.db, escalationDedupTag(dest)) ?? resolveOrch(dest);
|
|
693
|
+
const route = !deps.resolveOrchestrator
|
|
694
|
+
? resolveEscalationOwner(deps.db, dest, target => deps.queueRepo.acceptsDestination(target)) : null;
|
|
695
|
+
const routeReason = route && route.outcome !== "none" && route.outcome !== "parent" ? route.reason : "";
|
|
696
|
+
for (const member of members)
|
|
697
|
+
if (routeReason)
|
|
698
|
+
member.reason += `; ${routeReason}`;
|
|
669
699
|
// F3 — the aggregate refresh is detection-gated (the S02 idempotency shape): a
|
|
670
700
|
// live escalation group refreshes its one open row every pass, no wake attached.
|
|
671
701
|
await refreshEscalationRowIfExists(deps, dest, members);
|
|
@@ -677,10 +707,10 @@ export async function runWakeLadderTick(deps) {
|
|
|
677
707
|
// F4: rung 1 self-skips when it resolves to the destination itself (or nowhere)
|
|
678
708
|
// — never escalate INTO the dead seat; fall through to the operator rung now.
|
|
679
709
|
// The operator floor must be a VISIBLE OBJECT, not markers alone: ensure the
|
|
680
|
-
// per-destination escalation row
|
|
681
|
-
//
|
|
710
|
+
// per-destination escalation row has an admissible carrier so the
|
|
711
|
+
// escalations view and the health count
|
|
682
712
|
// expose it — it stays open past the batons' exhaustion.
|
|
683
|
-
const floorDest =
|
|
713
|
+
const floorDest = humanAlertCarrier(deps, dest, needsOrchRung[0].row.sourceSession);
|
|
684
714
|
await ensureEscalationRow(deps, dest, floorDest, needsOrchRung, reason);
|
|
685
715
|
for (const m of needsOrchRung) {
|
|
686
716
|
appendMarker(deps.queueRepo, m.row, `${LADDER_RUNG_PREFIX} orchestrator self-skip (resolves to ${orch === null ? "no orchestrator" : "destination"}) reason=${m.reason}`);
|
|
@@ -692,10 +722,12 @@ export async function runWakeLadderTick(deps) {
|
|
|
692
722
|
}
|
|
693
723
|
else {
|
|
694
724
|
const escRow = await ensureEscalationRow(deps, dest, orch, members, reason);
|
|
695
|
-
|
|
725
|
+
// An already-open recovery retains its owner, including a claim made before topology changed.
|
|
726
|
+
const recoveryOwner = deps.queueRepo.getById(escRow.qitemId)?.destinationSession ?? orch;
|
|
727
|
+
const outcome = await attemptWake(escRow.qitemId, recoveryOwner);
|
|
696
728
|
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:
|
|
729
|
+
appendMarker(deps.queueRepo, m.row, `${LADDER_RUNG_PREFIX} orchestrator -> ${recoveryOwner} outcome=${outcome} reason=${m.reason}`);
|
|
730
|
+
actions.push({ qitemId: m.row.qitemId, action: "escalate-orchestrator", target: recoveryOwner });
|
|
699
731
|
if (!outcome.startsWith("failed:")) {
|
|
700
732
|
// Delivered (or durable-unconfirmed — the aggregate row itself is now the
|
|
701
733
|
// orchestrator's durable obligation; S02 nets it if it sits unclaimed).
|
|
@@ -833,6 +865,23 @@ function postedPromptAlert(db, except) {
|
|
|
833
865
|
ORDER BY ts_created LIMIT 1`).get(except, PROMPT_ALERT_TAG, PROMPT_CHOICE_TAG, `${LADDER_RUNG_PREFIX} operator dispatched-to-engine%`);
|
|
834
866
|
return row?.qitem_id ?? null;
|
|
835
867
|
}
|
|
868
|
+
/** Keep both ordinary and consumed-recovery choice alerts behind the same durable gate. */
|
|
869
|
+
function waitsOnPostedPromptAlert(deps, row, choiceOnly) {
|
|
870
|
+
const posted = choiceOnly && deps.deliveryEngine ? postedPromptAlert(deps.db, row.qitemId) : null;
|
|
871
|
+
if (!posted)
|
|
872
|
+
return false;
|
|
873
|
+
const waiting = `${LADDER_RUNG_PREFIX} operator waiting on ${posted}`;
|
|
874
|
+
if (!deps.queueRepo.listTransitions(row.qitemId).some(t => t.transitionNote?.startsWith(waiting))) {
|
|
875
|
+
appendMarker(deps.queueRepo, row, `${waiting} reason=one person alert at a time for seats blocked at a prompt`);
|
|
876
|
+
}
|
|
877
|
+
return true;
|
|
878
|
+
}
|
|
879
|
+
// The operator engine owns actual human delivery. Its non-nudged queue carrier
|
|
880
|
+
// must still be locally admissible; cross-host source provenance is not a local destination.
|
|
881
|
+
function humanAlertCarrier(deps, dest, source) {
|
|
882
|
+
const candidates = [resolveOperatorSeat(), source];
|
|
883
|
+
return candidates.find((candidate) => Boolean(candidate && deps.queueRepo.acceptsDestination(candidate))) ?? dest;
|
|
884
|
+
}
|
|
836
885
|
/** Positive refusals enter the existing rungs without ever retrying the blocked
|
|
837
886
|
* seat. One aggregate carries the episode's obligations and notification key;
|
|
838
887
|
* original work remains owned by its current recipient. */
|
|
@@ -891,16 +940,14 @@ async function advancePromptRefusals(deps, now, intervalS, graceS, resolveOrch,
|
|
|
891
940
|
for (const episode of openPromptRefusals(deps.queueRepo.listTransitions(qitem_id))) {
|
|
892
941
|
if (!episode.key.startsWith(`${primary.destinationSession}|`))
|
|
893
942
|
continue;
|
|
894
|
-
//
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
continue;
|
|
898
|
-
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)));
|
|
943
|
+
// Ordinary work shares an episode; consumed recoveries retain independent dispositions.
|
|
944
|
+
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)
|
|
945
|
+
&& !closedEpisode(`${PROMPT_EPISODE_TAG}${episode.key}${hasConsumedEscalationHop(deps.db, row.qitemId) ? `|consumed:${row.qitemId}` : ""}`)));
|
|
899
946
|
if (!rows.length)
|
|
900
947
|
continue;
|
|
901
948
|
let group = groups.get(primary.destinationSession);
|
|
902
949
|
if (!group) {
|
|
903
|
-
group = { keys: [], rows: new Map(), jobs: new Map(), refusedAt: episode.refusedAt };
|
|
950
|
+
group = { keys: [], rowKeys: new Map(), jobKeys: new Set(), rows: new Map(), jobs: new Map(), refusedAt: episode.refusedAt };
|
|
904
951
|
groups.set(primary.destinationSession, group);
|
|
905
952
|
}
|
|
906
953
|
if (Date.parse(episode.refusedAt) > Date.parse(group.refusedAt))
|
|
@@ -918,9 +965,15 @@ async function advancePromptRefusals(deps, now, intervalS, graceS, resolveOrch,
|
|
|
918
965
|
&& (!group.choiceSince || Date.parse(episode.refusedAt) < Date.parse(group.choiceSince)))
|
|
919
966
|
group.choiceSince = episode.refusedAt;
|
|
920
967
|
}
|
|
921
|
-
|
|
922
|
-
|
|
968
|
+
for (const row of rows) {
|
|
969
|
+
const key = `${PROMPT_EPISODE_TAG}${episode.key}${hasConsumedEscalationHop(deps.db, row.qitemId) ? `|consumed:${row.qitemId}` : ""}`;
|
|
970
|
+
if (!group.keys.includes(key))
|
|
971
|
+
group.keys.push(key);
|
|
972
|
+
if (!group.rowKeys.has(row.qitemId))
|
|
973
|
+
group.rowKeys.set(row.qitemId, new Set());
|
|
974
|
+
group.rowKeys.get(row.qitemId).add(key);
|
|
923
975
|
group.rows.set(row.qitemId, row);
|
|
976
|
+
}
|
|
924
977
|
}
|
|
925
978
|
}
|
|
926
979
|
// A watchdog reminder refused twice at the same prompt joins its seat's episode; the row carries the job ids. The
|
|
@@ -942,7 +995,7 @@ async function advancePromptRefusals(deps, now, intervalS, graceS, resolveOrch,
|
|
|
942
995
|
continue;
|
|
943
996
|
let group = groups.get(job.dest);
|
|
944
997
|
if (!group) {
|
|
945
|
-
group = { keys: [], rows: new Map(), jobs: new Map(), refusedAt: job.refusedAt };
|
|
998
|
+
group = { keys: [], rowKeys: new Map(), jobKeys: new Set(), rows: new Map(), jobs: new Map(), refusedAt: job.refusedAt };
|
|
946
999
|
groups.set(job.dest, group);
|
|
947
1000
|
}
|
|
948
1001
|
if (Date.parse(job.refusedAt) > Date.parse(group.refusedAt))
|
|
@@ -950,12 +1003,40 @@ async function advancePromptRefusals(deps, now, intervalS, graceS, resolveOrch,
|
|
|
950
1003
|
if (job.refusedAt === group.refusedAt)
|
|
951
1004
|
group.latestChoice = job.choice;
|
|
952
1005
|
group.keys.push(tag);
|
|
1006
|
+
group.jobKeys.add(tag);
|
|
953
1007
|
group.jobs.set(job.jobId, job.registeredBy);
|
|
954
1008
|
if (job.choice)
|
|
955
1009
|
group.choice = true;
|
|
956
1010
|
else
|
|
957
1011
|
group.other = true;
|
|
958
1012
|
}
|
|
1013
|
+
// A recovery returned to the blocked seat inherits only its source row's episodes.
|
|
1014
|
+
// Reconstruct this membership before retirement, even when the recovery has no refusal of its own.
|
|
1015
|
+
for (const [dest, group] of groups) {
|
|
1016
|
+
for (const row of [...group.rows.values()]) {
|
|
1017
|
+
if (hasConsumedEscalationHop(deps.db, row.qitemId))
|
|
1018
|
+
continue;
|
|
1019
|
+
// The newer ordinary alert must not hide the underlying returned recovery on the next tick.
|
|
1020
|
+
const recovery = findQueueRecovery(deps.db, row.qitemId, PROMPT_ALERT_TAG);
|
|
1021
|
+
if (!recovery || !["pending", "in-progress", "blocked"].includes(recovery.state))
|
|
1022
|
+
continue;
|
|
1023
|
+
const held = readCandidate(recovery.qitemId, dest);
|
|
1024
|
+
if (!held || held.destinationSession !== dest || held.tags?.includes(PROMPT_ALERT_TAG))
|
|
1025
|
+
continue;
|
|
1026
|
+
const suffix = hasConsumedEscalationHop(deps.db, held.qitemId) ? `|consumed:${held.qitemId}` : "";
|
|
1027
|
+
for (const sourceKey of group.rowKeys.get(row.qitemId) ?? []) {
|
|
1028
|
+
const key = `${sourceKey}${suffix}`;
|
|
1029
|
+
if (closedEpisode(key))
|
|
1030
|
+
continue;
|
|
1031
|
+
if (!group.keys.includes(key))
|
|
1032
|
+
group.keys.push(key);
|
|
1033
|
+
if (!group.rowKeys.has(held.qitemId))
|
|
1034
|
+
group.rowKeys.set(held.qitemId, new Set());
|
|
1035
|
+
group.rowKeys.get(held.qitemId).add(key);
|
|
1036
|
+
group.rows.set(held.qitemId, held);
|
|
1037
|
+
}
|
|
1038
|
+
}
|
|
1039
|
+
}
|
|
959
1040
|
const promptState = (dest) => {
|
|
960
1041
|
const group = groups.get(dest);
|
|
961
1042
|
const state = readAt(dest, group?.refusedAt ?? now.toISOString());
|
|
@@ -974,8 +1055,10 @@ async function advancePromptRefusals(deps, now, intervalS, graceS, resolveOrch,
|
|
|
974
1055
|
const aggregate = deps.queueRepo.getById(qitem_id);
|
|
975
1056
|
if (!aggregate || !Array.isArray(aggregate.tags))
|
|
976
1057
|
continue;
|
|
977
|
-
const destinationTag = aggregate.tags.find(t => typeof t === "string"
|
|
978
|
-
|
|
1058
|
+
const destinationTag = aggregate.tags.find(t => typeof t === "string"
|
|
1059
|
+
&& (t.startsWith("prompt-destination:") || t.startsWith("consumed-prompt-destination:")));
|
|
1060
|
+
const dest = destinationTag?.slice(destinationTag.startsWith("consumed-")
|
|
1061
|
+
? "consumed-prompt-destination:".length : "prompt-destination:".length);
|
|
979
1062
|
if (!dest)
|
|
980
1063
|
continue;
|
|
981
1064
|
// Incomplete membership is not evidence that an episode ended.
|
|
@@ -1010,8 +1093,9 @@ async function advancePromptRefusals(deps, now, intervalS, graceS, resolveOrch,
|
|
|
1010
1093
|
// Recovery owned elsewhere already has a route. A fallback finding sent
|
|
1011
1094
|
// into this same blocked seat does not: include it in the aggregate while
|
|
1012
1095
|
// retaining its original body/custody, rather than treating it as delivery.
|
|
1013
|
-
const selfRecoveries = new Map();
|
|
1014
1096
|
const ownedElsewhere = members.some(({ row }) => {
|
|
1097
|
+
if (hasConsumedEscalationHop(deps.db, row.qitemId))
|
|
1098
|
+
return false;
|
|
1015
1099
|
const recovery = findQueueRecovery(deps.db, row.qitemId);
|
|
1016
1100
|
if (!recovery || !["pending", "in-progress", "blocked"].includes(recovery.state))
|
|
1017
1101
|
return false;
|
|
@@ -1020,29 +1104,78 @@ async function advancePromptRefusals(deps, now, intervalS, graceS, resolveOrch,
|
|
|
1020
1104
|
return false;
|
|
1021
1105
|
if (held.tags?.includes(PROMPT_ALERT_TAG))
|
|
1022
1106
|
return false;
|
|
1023
|
-
|
|
1024
|
-
return true;
|
|
1025
|
-
selfRecoveries.set(held.qitemId, held);
|
|
1026
|
-
return false;
|
|
1107
|
+
return held.destinationSession !== dest;
|
|
1027
1108
|
});
|
|
1028
1109
|
if (ownedElsewhere)
|
|
1029
1110
|
continue;
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1111
|
+
// A consumed recovery owns its own operator continuation. It must not change
|
|
1112
|
+
// the route or one-hop marker of unrelated work/watchdogs at the same prompt.
|
|
1113
|
+
for (let i = members.length - 1; i >= 0; i--) {
|
|
1114
|
+
const member = members[i];
|
|
1115
|
+
if (!hasConsumedEscalationHop(deps.db, member.row.qitemId))
|
|
1116
|
+
continue;
|
|
1117
|
+
const recovery = findQueueRecovery(deps.db, member.row.qitemId);
|
|
1118
|
+
const heldRecovery = recovery ? deps.queueRepo.getById(recovery.qitemId) : null;
|
|
1119
|
+
if (recovery && ["pending", "in-progress", "blocked"].includes(recovery.state)
|
|
1120
|
+
&& heldRecovery?.destinationSession !== dest
|
|
1121
|
+
&& !heldRecovery?.tags?.includes(`consumed-hop:${member.row.qitemId}`)) {
|
|
1122
|
+
members.splice(i, 1);
|
|
1123
|
+
continue;
|
|
1124
|
+
}
|
|
1125
|
+
const view = readLadder(deps.db, member.row.qitemId, 0);
|
|
1126
|
+
if (!view.exhausted && (view.lastMarkerTs === null || now.getTime() - view.lastMarkerTs >= intervalS * 1000)) {
|
|
1127
|
+
const reason = "interactive prompt blocks recovery; escalates_to one-hop delivery already used; existing fallback retained";
|
|
1128
|
+
const choiceOnly = Boolean(group.choice && !group.other);
|
|
1129
|
+
const promptTags = choiceOnly ? [PROMPT_ALERT_TAG, PROMPT_CHOICE_TAG, `consumed-prompt-destination:${dest}`,
|
|
1130
|
+
...(group.rowKeys.get(member.row.qitemId) ?? [])] : [];
|
|
1131
|
+
const continuation = await ensureEscalationRow(deps, dest, humanAlertCarrier(deps, dest, member.row.sourceSession), [{ row: member.row, reason }], reason, `consumed-hop:${member.row.qitemId}`, [ESCALATION_HOP_TAG, ...promptTags]);
|
|
1132
|
+
if (!view.orchRung)
|
|
1133
|
+
appendMarker(deps.queueRepo, member.row, `${LADDER_RUNG_PREFIX} orchestrator self-skip reason=${reason}`);
|
|
1134
|
+
// A choice alert's tags and dispatch marker must live on the same durable row the shared gate reads.
|
|
1135
|
+
const operatorRow = choiceOnly ? deps.queueRepo.getById(continuation.qitemId) : member.row;
|
|
1136
|
+
if (choiceOnly) {
|
|
1137
|
+
const missing = promptTags.filter(tag => !operatorRow.tags?.includes(tag));
|
|
1138
|
+
if (missing.length)
|
|
1139
|
+
deps.db.prepare("UPDATE queue_items SET tags=? WHERE qitem_id=?")
|
|
1140
|
+
.run(JSON.stringify([...(operatorRow.tags ?? []), ...missing]), operatorRow.qitemId);
|
|
1141
|
+
}
|
|
1142
|
+
if (waitsOnPostedPromptAlert(deps, operatorRow, choiceOnly)) {
|
|
1143
|
+
members.splice(i, 1);
|
|
1144
|
+
continue;
|
|
1145
|
+
}
|
|
1146
|
+
const operatorView = choiceOnly ? readLadder(deps.db, operatorRow.qitemId, 0) : view;
|
|
1147
|
+
if (choiceOnly && operatorView.exhausted) {
|
|
1148
|
+
members.splice(i, 1);
|
|
1149
|
+
continue;
|
|
1150
|
+
}
|
|
1151
|
+
if (await operatorRung(deps, operatorRow, reason, actions, operatorView, choiceOnly)) {
|
|
1152
|
+
// Choice custody stays on the alert until it closes; exhausting its source now would retire the alert next tick.
|
|
1153
|
+
if (!choiceOnly)
|
|
1154
|
+
appendExhausted(deps.queueRepo, member.row, "consumed escalation hop reached operator fallback");
|
|
1155
|
+
if (choiceOnly)
|
|
1156
|
+
appendExhausted(deps.queueRepo, operatorRow, "operator rung resolved");
|
|
1157
|
+
}
|
|
1158
|
+
}
|
|
1159
|
+
members.splice(i, 1);
|
|
1033
1160
|
}
|
|
1034
|
-
|
|
1161
|
+
if (!members.length && !group.jobs.size)
|
|
1162
|
+
continue;
|
|
1163
|
+
const orch = openEscalationOwner(deps.db, `prompt-destination:${dest}`) ?? resolveOrch(dest);
|
|
1035
1164
|
const toOperator = orch === null || orch === dest;
|
|
1036
|
-
const
|
|
1165
|
+
const route = !deps.resolveOrchestrator
|
|
1166
|
+
? resolveEscalationOwner(deps.db, dest, target => deps.queueRepo.acceptsDestination(target)) : null;
|
|
1167
|
+
const reason = "interactive prompt blocks outstanding work; no input was sent"
|
|
1168
|
+
+ (route && route.outcome !== "none" && route.outcome !== "parent" ? `; ${route.reason}` : "");
|
|
1037
1169
|
// Every refusal at a choice prompt: the alert follows queue.wake_human_rung and holds for other choice alerts. Any other
|
|
1038
1170
|
// prompt keeps the permission-prompt route.
|
|
1039
1171
|
const choiceOnly = Boolean(group.choice && !group.other);
|
|
1040
1172
|
const kindTags = choiceOnly ? [PROMPT_CHOICE_TAG] : [];
|
|
1041
|
-
const
|
|
1173
|
+
const keys = group.keys.filter(key => group.jobKeys.has(key) || members.some(m => group.rowKeys.get(m.row.qitemId)?.has(key)));
|
|
1174
|
+
const aggregate = await ensureEscalationRow(deps, dest, toOperator ? humanAlertCarrier(deps, dest, members[0]?.row.sourceSession ?? [...group.jobs.values()][0]) : orch, members, reason, `prompt-destination:${dest}`, [PROMPT_ALERT_TAG, ...kindTags, ...keys], group.jobs);
|
|
1042
1175
|
const row = deps.queueRepo.getById(aggregate.qitemId);
|
|
1043
1176
|
if (!row)
|
|
1044
1177
|
continue;
|
|
1045
|
-
const addedKeys =
|
|
1178
|
+
const addedKeys = keys.filter(key => !row.tags?.includes(key));
|
|
1046
1179
|
// A reminder's run keeps its key while its latest refusal changes kind, so the kind is recomputed on its own too.
|
|
1047
1180
|
const kindChanged = choiceOnly !== Boolean(row.tags?.includes(PROMPT_CHOICE_TAG));
|
|
1048
1181
|
if (addedKeys.length || kindChanged) {
|
|
@@ -1079,9 +1212,10 @@ async function advancePromptRefusals(deps, now, intervalS, graceS, resolveOrch,
|
|
|
1079
1212
|
continue;
|
|
1080
1213
|
if (!view.orchRung) {
|
|
1081
1214
|
if (!toOperator) {
|
|
1082
|
-
const
|
|
1083
|
-
|
|
1084
|
-
|
|
1215
|
+
const recoveryOwner = row.destinationSession;
|
|
1216
|
+
const outcome = await attemptWake(row.qitemId, recoveryOwner);
|
|
1217
|
+
appendMarker(deps.queueRepo, row, `${LADDER_RUNG_PREFIX} orchestrator -> ${recoveryOwner} outcome=${outcome} reason=${reason}`);
|
|
1218
|
+
actions.push({ qitemId: row.qitemId, action: "escalate-orchestrator", target: recoveryOwner });
|
|
1085
1219
|
if (!outcome.startsWith("failed:"))
|
|
1086
1220
|
appendExhausted(deps.queueRepo, row, `escalated to orchestrator (${outcome})`);
|
|
1087
1221
|
continue;
|
|
@@ -1091,14 +1225,8 @@ async function advancePromptRefusals(deps, now, intervalS, graceS, resolveOrch,
|
|
|
1091
1225
|
// One choice-prompt alert to a person at a time on this machine: a prompt many seats hit together, such as a shared usage
|
|
1092
1226
|
// limit, posts once. Each other choice alert stays open, names the alert it waits on, and posts after that one retires.
|
|
1093
1227
|
// A permission prompt, which only a person can approve, never waits behind it.
|
|
1094
|
-
|
|
1095
|
-
if (posted) {
|
|
1096
|
-
const waiting = `${LADDER_RUNG_PREFIX} operator waiting on ${posted}`;
|
|
1097
|
-
if (!deps.queueRepo.listTransitions(row.qitemId).some(t => t.transitionNote?.startsWith(waiting))) {
|
|
1098
|
-
appendMarker(deps.queueRepo, row, `${waiting} reason=one person alert at a time for seats blocked at a prompt`);
|
|
1099
|
-
}
|
|
1228
|
+
if (waitsOnPostedPromptAlert(deps, row, choiceOnly))
|
|
1100
1229
|
continue;
|
|
1101
|
-
}
|
|
1102
1230
|
if (await operatorRung(deps, row, reason, actions, view, choiceOnly)) {
|
|
1103
1231
|
const floor = deps.queueRepo.listTransitions(row.qitemId).at(-1)?.transitionNote?.includes("human rung explicit-only");
|
|
1104
1232
|
appendExhausted(deps.queueRepo, row, floor ? PROMPT_FLOOR_EXHAUSTED : "operator rung resolved");
|
|
@@ -1190,6 +1318,12 @@ async function refreshEscalationRowIfExists(deps, dest, members, dedupTag = esca
|
|
|
1190
1318
|
closureTarget: row.state === "in-progress" ? deps.queueRepo.retainedClaimBlocker(existing.qitem_id) : undefined });
|
|
1191
1319
|
})();
|
|
1192
1320
|
}
|
|
1321
|
+
/** Existing recovery custody takes precedence over a newly resolved topology fallback. */
|
|
1322
|
+
function openEscalationOwner(db, dedupTag) {
|
|
1323
|
+
return db.prepare(`SELECT destination_session FROM queue_items WHERE state IN ('pending','in-progress','blocked')
|
|
1324
|
+
AND json_valid(tags) AND EXISTS (SELECT 1 FROM json_each(tags) WHERE value = ?) LIMIT 1`)
|
|
1325
|
+
.get(dedupTag)?.destination_session ?? null;
|
|
1326
|
+
}
|
|
1193
1327
|
async function ensureEscalationRow(deps, dest, orch, members, reason, dedupTag = escalationDedupTag(dest), extraTags = [],
|
|
1194
1328
|
/** Watchdog reminders refused at this seat's prompt: job id to the session that registered it. */
|
|
1195
1329
|
jobs = new Map()) {
|
|
@@ -1208,12 +1342,16 @@ jobs = new Map()) {
|
|
|
1208
1342
|
members.map((m) => `- ${m.row.qitemId}: ${m.row.summary ?? "outstanding work"} (${m.reason})`).join("\n") +
|
|
1209
1343
|
(jobs.size ? `\nwatchdog reminders refused at its prompt (${jobs.size}):\n${[...jobs.keys()].map(id => `- ${id}`).join("\n")}` : "") +
|
|
1210
1344
|
`\nThe rows above still carry their obligations exactly-once; this escalation is the wake, not the content.`;
|
|
1345
|
+
const route = !deps.resolveOrchestrator
|
|
1346
|
+
? resolveEscalationOwner(deps.db, dest, target => deps.queueRepo.acceptsDestination(target)) : null;
|
|
1347
|
+
const oneHop = route?.outcome === "routed" && route.owner === orch;
|
|
1211
1348
|
const created = await deps.queueRepo.create({
|
|
1212
1349
|
sourceSession: members[0]?.row.sourceSession ?? [...jobs.values()][0],
|
|
1213
1350
|
destinationSession: orch,
|
|
1214
1351
|
body,
|
|
1215
1352
|
summary: `Wake escalation: ${members.length} baton(s)${jobs.size ? ` and ${jobs.size} watchdog reminder(s)` : ""} stuck at ${dest} — ${reason}`,
|
|
1216
|
-
tags: [WAKE_ESCALATION_TAG, dedupTag,
|
|
1353
|
+
tags: [WAKE_ESCALATION_TAG, dedupTag,
|
|
1354
|
+
...(oneHop ? [ESCALATION_HOP_TAG] : []), ...extraTags, ...members.map(m => recoveryTag(m.row.qitemId))],
|
|
1217
1355
|
nudge: false, // delivery is the ladder's own rung attempt, recorded with its outcome
|
|
1218
1356
|
});
|
|
1219
1357
|
return { qitemId: created.qitemId };
|