@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
package/dist/mcp-server.js
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
|
-
import { McpServer } from "@modelcontextprotocol/
|
|
1
|
+
import { McpServer } from "@modelcontextprotocol/server";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
import { randomBytes } from "node:crypto";
|
|
4
|
+
import { statSync } from "node:fs";
|
|
4
5
|
import nodePath from "node:path";
|
|
5
6
|
import { DaemonConnectionError, DaemonTimeoutError, terminalAuthHeaders } from "./client.js";
|
|
6
7
|
import { readOpenRigEnv } from "./openrig-compat.js";
|
|
7
8
|
import { resolveRigHandle } from "./rig-handle.js";
|
|
8
9
|
import { formatSeatActivity } from "./lib/seat-activity.js";
|
|
9
10
|
import { CLI_VERSION } from "./version.js";
|
|
11
|
+
import { ConfigStore } from "./config-store.js";
|
|
12
|
+
import { readRosters } from "./commands/roster.js";
|
|
13
|
+
import { mcpPresenceFilePath, readPresence } from "./mcp-presence.js";
|
|
10
14
|
const LONG_RUNNING_UP_TIMEOUT_MS = 120_000;
|
|
11
15
|
const WAIT_FOR_IDLE_REQUEST_OVERHEAD_MS = 5_000;
|
|
12
16
|
/** The most text rig_context_get and rig_artifact_read return in one call; a longer file or section is cut, and says so. */
|
|
@@ -40,10 +44,13 @@ function structured(data) {
|
|
|
40
44
|
/** Where a handed-on item went. A cross-host handoff records the remote item as qitem-…@<host> in closureTarget (named, not
|
|
41
45
|
* fetched); a local successor is the item whose handedOffFrom is this one, the newest when there are several. null when
|
|
42
46
|
* none is found; { unknown: true, code } when the lookup failed or the daemon can't filter by handedOffFrom. */
|
|
43
|
-
async function successorOf(client, qitemId, closureTarget
|
|
47
|
+
async function successorOf(client, qitemId, closureTarget,
|
|
48
|
+
/** For an external caller: which successor rows it may see; a cross-host successor's parties are unknown here, so it
|
|
49
|
+
* can't. */
|
|
50
|
+
visible) {
|
|
44
51
|
const remote = typeof closureTarget === "string" ? /^(qitem-[^@]+)@([^@]+)$/.exec(closureTarget) : null;
|
|
45
52
|
if (remote)
|
|
46
|
-
return { qitemId: remote[1], host: remote[2] };
|
|
53
|
+
return visible ? { unknown: true, code: "out_of_scope" } : { qitemId: remote[1], host: remote[2] };
|
|
47
54
|
try {
|
|
48
55
|
const res = await client.get(`/api/queue/list?${new URLSearchParams({ handedOffFrom: qitemId, compact: "1", limit: "5" }).toString()}`);
|
|
49
56
|
if (res.status >= 400)
|
|
@@ -52,7 +59,10 @@ async function successorOf(client, qitemId, closureTarget) {
|
|
|
52
59
|
return { unknown: true, code: "unexpected_response" };
|
|
53
60
|
if (ignoredFilter(res.data, { handedOffFrom: qitemId }))
|
|
54
61
|
return { unknown: true, code: "filter_unsupported" };
|
|
55
|
-
const
|
|
62
|
+
const rows = res.data;
|
|
63
|
+
if (visible && rows.length > 0 && !visible(rows[0]))
|
|
64
|
+
return { unknown: true, code: "out_of_scope" };
|
|
65
|
+
const [next, ...others] = visible ? rows.filter((row) => visible(row)) : rows;
|
|
56
66
|
if (!next)
|
|
57
67
|
return null;
|
|
58
68
|
return { qitemId: next.qitemId, destinationSession: next.destinationSession, state: next.state, ...(others.length > 0 ? { otherSuccessors: others.map((o) => o.qitemId) } : {}) };
|
|
@@ -101,6 +111,59 @@ function teamView(detail, inventory) {
|
|
|
101
111
|
}
|
|
102
112
|
return { rig, lead: { session, logicalId: seats.find((seat) => seat.session === session)?.logicalId ?? null }, seats };
|
|
103
113
|
}
|
|
114
|
+
/** The rows a hosted member's latest ring is read from. */
|
|
115
|
+
const PRESENCE_ROWS = 50;
|
|
116
|
+
/** The newest ring among a seat's rows, by its attempt time. Rows for another seat (a daemon that ignored the filter) don't count. */
|
|
117
|
+
function newestWake(rows, seat) {
|
|
118
|
+
let newest = null;
|
|
119
|
+
for (const row of Array.isArray(rows) ? rows : []) {
|
|
120
|
+
if (row.destinationSession !== seat)
|
|
121
|
+
continue;
|
|
122
|
+
const at = row.lastNudgeAttempt, result = row.lastNudgeWireResult ?? row.lastNudgeResult, qitemId = row.qitemId;
|
|
123
|
+
if (typeof at !== "string" || typeof result !== "string" || typeof qitemId !== "string")
|
|
124
|
+
continue;
|
|
125
|
+
if (!newest || at > newest.at)
|
|
126
|
+
newest = { at, result, qitemId };
|
|
127
|
+
}
|
|
128
|
+
return newest;
|
|
129
|
+
}
|
|
130
|
+
const ROSTERS_INCOMPLETE = "Some rosters couldn't be read, so hosted members may be missing.";
|
|
131
|
+
/** The roster members marked hosted, on this host, whose seat is in this rig and isn't one of its nodes. A roster folder that
|
|
132
|
+
* doesn't exist means none. One that can't be inspected or read, or a host id that isn't known yet, is said, never read as
|
|
133
|
+
* none. The note stays generic (a scoped caller doesn't see other rosters' names or errors); the detail goes to this
|
|
134
|
+
* server's log. */
|
|
135
|
+
async function hostedMembersOf(folder, rigName, nodeSeats, selfHostId, presenceOf) {
|
|
136
|
+
try {
|
|
137
|
+
statSync(folder);
|
|
138
|
+
}
|
|
139
|
+
catch (error) {
|
|
140
|
+
if (error.code === "ENOENT")
|
|
141
|
+
return { members: [] };
|
|
142
|
+
console.error(`rig_team: the roster folder ${folder} can't be inspected: ${error.message}`);
|
|
143
|
+
return { members: [], note: ROSTERS_INCOMPLETE };
|
|
144
|
+
}
|
|
145
|
+
const { rosters, warnings } = readRosters(folder);
|
|
146
|
+
if (warnings.length > 0)
|
|
147
|
+
console.error(`rig_team: ${warnings.join("; ")}`);
|
|
148
|
+
const unread = warnings.length > 0 ? { note: ROSTERS_INCOMPLETE } : {};
|
|
149
|
+
const candidates = rosters.flatMap((roster) => roster.members
|
|
150
|
+
.filter((member) => member.hosted === true && member.seat.endsWith(`@${rigName}`) && !nodeSeats.has(member.seat))
|
|
151
|
+
.map((member) => ({ roster: roster.id, member })));
|
|
152
|
+
if (candidates.length === 0)
|
|
153
|
+
return { members: [], ...unread };
|
|
154
|
+
const host = await selfHostId();
|
|
155
|
+
if (!host)
|
|
156
|
+
return { members: [], note: "This daemon's host id isn't known yet, so hosted members on its rosters can't be matched to it." };
|
|
157
|
+
// A seat in two rosters is one member: the first roster (by file name) supplies its entry.
|
|
158
|
+
const members = new Map();
|
|
159
|
+
for (const { roster, member } of candidates) {
|
|
160
|
+
if (member.host !== host || members.has(member.seat))
|
|
161
|
+
continue;
|
|
162
|
+
members.set(member.seat, { session: member.seat, roster, capabilities: member.capabilities, useWhen: member.use_when,
|
|
163
|
+
caveat: member.caveat ?? null, pane: null, activity: "unknown", presence: await presenceOf(member.seat) });
|
|
164
|
+
}
|
|
165
|
+
return { members: [...members.values()], ...unread };
|
|
166
|
+
}
|
|
104
167
|
/** A slice's summary fields, without its paths and readiness detail. */
|
|
105
168
|
function sliceSummary(slice) {
|
|
106
169
|
return {
|
|
@@ -108,9 +171,87 @@ function sliceSummary(slice) {
|
|
|
108
171
|
description: slice.description ?? null, qitemCount: slice.qitemCount, lastActivityAt: slice.lastActivityAt ?? null,
|
|
109
172
|
};
|
|
110
173
|
}
|
|
174
|
+
/** The external projection's predicates, for an external caller's scope only; null for every other caller. */
|
|
175
|
+
function externalView(scope) {
|
|
176
|
+
return scope?.shows && scope.names ? { shows: scope.shows, names: scope.names } : null;
|
|
177
|
+
}
|
|
178
|
+
const ITEM_ID = /qitem-[A-Za-z0-9][A-Za-z0-9_-]*(?:@[A-Za-z0-9._-]+)?/g;
|
|
179
|
+
const SEAT = /[A-Za-z0-9._-]+@[A-Za-z0-9._-]+(?:@[A-Za-z0-9._-]+)?/g;
|
|
180
|
+
/** A transition note with every item id but the row's own, and every seat the external caller may not see, replaced.
|
|
181
|
+
* Notes the daemon writes on a parked row name its blocker ("blocker <id> wake attempted", "auto-unparked: blocker
|
|
182
|
+
* <id> …"), and a team's note can name anyone. */
|
|
183
|
+
function maskNote(note, ownId, names) {
|
|
184
|
+
const ids = [];
|
|
185
|
+
// Item ids first, set aside so a host-qualified id isn't read as a seat.
|
|
186
|
+
const kept = note.replace(ITEM_ID, (id) => { ids.push(id === ownId ? id : "(out of scope)"); return `\u0000${ids.length - 1}\u0000`; });
|
|
187
|
+
return kept.replace(SEAT, (seat) => names(seat) ? seat : "(out of scope)").replace(/\u0000(\d+)\u0000/g, (_m, i) => ids[Number(i)]);
|
|
188
|
+
}
|
|
189
|
+
/** Whether a row's closure target names a party: a new owner, an escalation target, a replacement item or a blocker.
|
|
190
|
+
* A denial's or a cancel's target is the team's own text, kept unless it names a seat or an item. */
|
|
191
|
+
function namesParty(fields) {
|
|
192
|
+
const reason = fields.closureReason;
|
|
193
|
+
return reason === "handed_off_to" || reason === "escalation" || reason === "superseded" || reason === "blocked_on"
|
|
194
|
+
|| fields.state === "blocked" || (typeof fields.closureTarget === "string" && /^qitem-|@/.test(fields.closureTarget));
|
|
195
|
+
}
|
|
196
|
+
/** What a hidden closure target's note says instead: the fact, without the party. */
|
|
197
|
+
const OUT_OF_SCOPE_NOTE = {
|
|
198
|
+
handed_off_to: "handed on (out of scope)", escalation: "escalated (out of scope)", superseded: "superseded (out of scope)",
|
|
199
|
+
blocked_on: "parked (out of scope)",
|
|
200
|
+
};
|
|
201
|
+
/**
|
|
202
|
+
* One projection for every row an external caller receives (show's item and transitions, list rows, create's return).
|
|
203
|
+
* The row's facts stay (state, closure reason); a party it names that the external caller may not see goes, whatever put
|
|
204
|
+
* it there: a handoff, a park, an escalation or a supersede. That is handedOffTo, the closure target (and the note of
|
|
205
|
+
* that closure, which can name it), blockedOn, the daemon's custody advisory, the waiting view's blocker, liveness and
|
|
206
|
+
* backstop owners, the pickup receipt's evidence, a transition's wake arrangement, and the names inside transition
|
|
207
|
+
* notes. The team's answer (resolution) and the task's body are left as written.
|
|
208
|
+
*/
|
|
209
|
+
function projectForExternal(row, view) {
|
|
210
|
+
if (!row || typeof row !== "object" || Array.isArray(row))
|
|
211
|
+
return row;
|
|
212
|
+
const { shows, names } = view;
|
|
213
|
+
const fields = { ...row };
|
|
214
|
+
if (typeof fields.transitionNote === "string")
|
|
215
|
+
fields.transitionNote = maskNote(fields.transitionNote, fields.qitemId, names);
|
|
216
|
+
// A transition's wake arrangement names what it waits on (a blocker's id).
|
|
217
|
+
const wake = fields.wake;
|
|
218
|
+
if (wake && typeof wake === "object" && wake.ref != null && !shows(wake.ref))
|
|
219
|
+
delete fields.wake;
|
|
220
|
+
if (typeof fields.handedOffTo === "string" && !shows(fields.handedOffTo))
|
|
221
|
+
fields.handedOffTo = null;
|
|
222
|
+
if (fields.closureTarget != null && !shows(fields.closureTarget) && namesParty(fields)) {
|
|
223
|
+
fields.closureTarget = null;
|
|
224
|
+
if ("transitionNote" in fields) {
|
|
225
|
+
const reason = typeof fields.closureReason === "string" ? fields.closureReason : null;
|
|
226
|
+
fields.transitionNote = (reason && OUT_OF_SCOPE_NOTE[reason]) ?? `${reason ?? (fields.state === "blocked" ? "parked" : String(fields.state))} (out of scope)`;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
if (fields.blockedOn != null && !shows(fields.blockedOn))
|
|
230
|
+
fields.blockedOn = null;
|
|
231
|
+
if (fields.closingTransition)
|
|
232
|
+
fields.closingTransition = projectForExternal(fields.closingTransition, view);
|
|
233
|
+
// The daemon's custody advisory names the target in its target and its message.
|
|
234
|
+
const advisory = fields.handoffAdvisory;
|
|
235
|
+
if (advisory && typeof advisory === "object" && !shows(advisory.target))
|
|
236
|
+
delete fields.handoffAdvisory;
|
|
237
|
+
// Who owes the next step, only when that's the row's own destination; a blocker's id, owner and state never.
|
|
238
|
+
const waiting = fields.waiting;
|
|
239
|
+
if (waiting && typeof waiting === "object") {
|
|
240
|
+
if (waiting.owner === fields.destinationSession)
|
|
241
|
+
fields.waiting = { owner: waiting.owner, state: waiting.state };
|
|
242
|
+
else
|
|
243
|
+
delete fields.waiting;
|
|
244
|
+
}
|
|
245
|
+
const pickup = fields.pickup;
|
|
246
|
+
if (pickup && typeof pickup === "object")
|
|
247
|
+
fields.pickup = { state: pickup.state };
|
|
248
|
+
return fields;
|
|
249
|
+
}
|
|
111
250
|
/** What an authenticated non-owner caller may reach: its own seat, its rigs' seats, the items they send or own (to read),
|
|
112
251
|
* the items they own (to change), and its shared roots. A person (<entityId>@external) is never in a non-owner's scope. */
|
|
113
252
|
function scopeFor(access, seatOf) {
|
|
253
|
+
if (access.external)
|
|
254
|
+
return externalScope(access, seatOf);
|
|
114
255
|
const rigs = new Set(access.rigs);
|
|
115
256
|
const session = (value) => {
|
|
116
257
|
if (typeof value !== "string" || !value)
|
|
@@ -121,17 +262,67 @@ function scopeFor(access, seatOf) {
|
|
|
121
262
|
const rig = value.split("@")[1];
|
|
122
263
|
return rig !== undefined && rig !== "external" && rigs.has(rig);
|
|
123
264
|
};
|
|
265
|
+
const item = (row) => {
|
|
266
|
+
const fields = (row ?? {});
|
|
267
|
+
return session(fields.sourceSession) || session(fields.destinationSession);
|
|
268
|
+
};
|
|
124
269
|
return {
|
|
125
270
|
session,
|
|
126
|
-
item
|
|
127
|
-
const item = (row ?? {});
|
|
128
|
-
return session(item.sourceSession) || session(item.destinationSession);
|
|
129
|
-
},
|
|
271
|
+
item,
|
|
130
272
|
// The daemon's update has no owner check, so changing a row needs its owner in scope: a row a team seat handed to
|
|
131
273
|
// another team, or a person's pending ask, stays readable and isn't the sender's to close or settle.
|
|
132
274
|
owner: (row) => session((row ?? {}).destinationSession),
|
|
133
275
|
rig: (name) => typeof name === "string" && rigs.has(name),
|
|
134
276
|
root: (name) => typeof name === "string" && access.roots.includes(name),
|
|
277
|
+
destination: session,
|
|
278
|
+
successor: session,
|
|
279
|
+
artifact: item,
|
|
280
|
+
paths: true,
|
|
281
|
+
ownListsOnly: false,
|
|
282
|
+
};
|
|
283
|
+
}
|
|
284
|
+
/** The grant service names an external caller's seat cus-<id>-caller@<rig>. v1 marks no seat as a caller, so an item
|
|
285
|
+
* from a seat of this shape is never the team's question to an external caller, and an external caller can't hand a
|
|
286
|
+
* task to one. The shape never grants anything. */
|
|
287
|
+
const CALLER_SHAPED = /^cus-.+-caller@[^@]+$/;
|
|
288
|
+
/** OpenRig's own tags that decide what a person asked about a row sees of its body: what Slack ingestion records about where
|
|
289
|
+
* the row came from and which parts of its body OpenRig wrote (the sender's channel, the attachments block, the body's
|
|
290
|
+
* digest), and `gate`, which with `workflow` marks a workflow's internal sign-off so the person's post shows its summary in
|
|
291
|
+
* place of the body. An external caller's create can't claim them; its other tags (`workflow` and
|
|
292
|
+
* `workflow:`/`instance:` among them) are kept. */
|
|
293
|
+
const OPENRIG_PROVENANCE_TAG = /^(?:founder-slack|inbound|shared-channel|gate)$|^participant:|^slack-/;
|
|
294
|
+
/** An external grant (openrig.grant/v1): a requester, narrower than a work grant. The grant's own seat is the
|
|
295
|
+
* only caller. It may hand tasks to its rigs' team seats (never a caller-shaped seat, a person or another host's
|
|
296
|
+
* seat), read the items it sent and the team's questions to it (never team-internal or another caller's items), follow
|
|
297
|
+
* a handed-on item only where it came back to it, and read the artifacts of its own items under its named roots. */
|
|
298
|
+
function externalScope(access, seatOf) {
|
|
299
|
+
const rigs = new Set(access.rigs);
|
|
300
|
+
const caller = (value) => typeof value === "string" && value !== "" && value === seatOf();
|
|
301
|
+
// A seat of one of its rigs on this instance: member@rig, never a person or another host's seat.
|
|
302
|
+
const member = (value) => {
|
|
303
|
+
if (typeof value !== "string")
|
|
304
|
+
return false;
|
|
305
|
+
const parts = value.split("@");
|
|
306
|
+
return parts.length === 2 && parts[0] !== "" && parts[1] !== "external" && rigs.has(parts[1]);
|
|
307
|
+
};
|
|
308
|
+
const team = (value) => member(value) && !caller(value) && !CALLER_SHAPED.test(value);
|
|
309
|
+
const field = (row, name) => (row ?? {})[name];
|
|
310
|
+
const item = (row) => caller(field(row, "sourceSession"))
|
|
311
|
+
|| (caller(field(row, "destinationSession")) && team(field(row, "sourceSession")));
|
|
312
|
+
return {
|
|
313
|
+
session: (value) => caller(value) || team(value),
|
|
314
|
+
item,
|
|
315
|
+
owner: () => false,
|
|
316
|
+
rig: (name) => typeof name === "string" && rigs.has(name),
|
|
317
|
+
root: (name) => typeof name === "string" && access.roots.includes(name),
|
|
318
|
+
// A task goes to the team: never to the caller itself or to another caller-shaped seat, which v1 can't tell apart.
|
|
319
|
+
destination: team,
|
|
320
|
+
successor: caller,
|
|
321
|
+
artifact: (row) => caller(field(row, "sourceSession")),
|
|
322
|
+
paths: false,
|
|
323
|
+
ownListsOnly: true,
|
|
324
|
+
shows: caller,
|
|
325
|
+
names: (seat) => caller(seat) || team(seat),
|
|
135
326
|
};
|
|
136
327
|
}
|
|
137
328
|
/** A target outside an authenticated caller's scope. It names the kind of target only, never the record. */
|
|
@@ -209,6 +400,22 @@ function transportRequestOptions(timeout) {
|
|
|
209
400
|
const READ_ONLY = { readOnlyHint: true };
|
|
210
401
|
const ADDITIVE = { readOnlyHint: false, destructiveHint: false };
|
|
211
402
|
const DESTRUCTIVE = { readOnlyHint: false, destructiveHint: true };
|
|
403
|
+
/** The tool each external object/action pair offers. A pair not listed here offers nothing. */
|
|
404
|
+
const EXTERNAL_TOOLS = {
|
|
405
|
+
queue: { create: "rig_queue_create", show: "rig_queue_show", list: "rig_queue_list" },
|
|
406
|
+
artifact: { read: "rig_artifact_read" },
|
|
407
|
+
};
|
|
408
|
+
function externalTools(objects) {
|
|
409
|
+
const tools = new Set();
|
|
410
|
+
for (const [object, actions] of Object.entries(objects)) {
|
|
411
|
+
for (const action of Array.isArray(actions) ? actions : []) {
|
|
412
|
+
const tool = Object.hasOwn(EXTERNAL_TOOLS, object) && Object.hasOwn(EXTERNAL_TOOLS[object], action) ? EXTERNAL_TOOLS[object][action] : undefined;
|
|
413
|
+
if (tool)
|
|
414
|
+
tools.add(tool);
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
return tools;
|
|
418
|
+
}
|
|
212
419
|
/** What each tool calls and what it does, kept beside the registrations. The MCP contract tests check that it names every
|
|
213
420
|
* registered tool, that each tool's annotations match its effect, and that each route is mounted in the daemon. Tools that
|
|
214
421
|
* take a rig name also read GET /api/rigs/summary to resolve it. */
|
|
@@ -239,7 +446,7 @@ export const MCP_OPERATIONS = [
|
|
|
239
446
|
{ tool: "rig_queue_update", routes: ["POST /api/queue/:qitemId/update"], effect: "destructive", access: "work" },
|
|
240
447
|
{ tool: "rig_telemetry_events", routes: ["GET /api/telemetry/v1/events"], effect: "read", access: "owner" },
|
|
241
448
|
{ tool: "rig_whoami", routes: ["GET /api/whoami"], effect: "read", access: "work" },
|
|
242
|
-
{ tool: "rig_team", routes: ["GET /api/rigs/:rigId", "GET /api/rigs/:rigId/nodes"], effect: "read", access: "work" },
|
|
449
|
+
{ tool: "rig_team", routes: ["GET /api/rigs/:rigId", "GET /api/rigs/:rigId/nodes", "GET /healthz"], effect: "read", access: "work" },
|
|
243
450
|
{ tool: "rig_slices", routes: ["GET /api/slices"], effect: "read", access: "workspace" },
|
|
244
451
|
{ tool: "rig_mission", routes: ["GET /api/missions/:missionId"], effect: "read", access: "workspace" },
|
|
245
452
|
{ tool: "rig_context_pack", routes: ["GET /api/context-packs/library/by-ref"], effect: "read", access: "workspace" },
|
|
@@ -250,13 +457,31 @@ export const MCP_OPERATIONS = [
|
|
|
250
457
|
{ tool: "rig_queue_handoff", routes: ["POST /api/queue/:qitemId/handoff"], effect: "destructive", access: "work" },
|
|
251
458
|
{ tool: "rig_queue_unclaim", routes: ["POST /api/queue/:qitemId/unclaim"], effect: "destructive", access: "work" },
|
|
252
459
|
];
|
|
253
|
-
|
|
254
|
-
|
|
460
|
+
/** How a member works its inbox, and asks a person while keeping the work: one versioned text, carried in this server's
|
|
461
|
+
* instructions and quoted in docs/reference/hosted-members.md. Change it here, bump the version, and update the quote. */
|
|
462
|
+
export const MEMBER_WORKFLOW_VERSION = "member-workflow/v2";
|
|
463
|
+
/** What the connection itself authorizes. */
|
|
464
|
+
const MEMBER_AUTHORITY = "If the person connected you, that's basically authorized: claim the items in your inbox and do them without asking whether you may.";
|
|
465
|
+
export const MEMBER_WORKFLOW = [
|
|
466
|
+
`Member workflow (${MEMBER_WORKFLOW_VERSION}). Your inbox is the items addressed to your seat: rig_queue_list with owned set. It's yours, not the team's queue. A wake, a ring or a message only points at it: list your inbox, then act.`,
|
|
467
|
+
"For each item: claim it (rig_queue_claim), do it, then close it done with closure reason no-follow-on and the answer in resolution (rig_queue_update), or hand it on (rig_queue_handoff). Listing or reading an item doesn't take it.",
|
|
468
|
+
"Say what you can reach from your grant, not from the tool list: a listed tool isn't access. rig_artifact_read's answer for an item names the shared roots you may read, and none means no shared files.",
|
|
469
|
+
MEMBER_AUTHORITY,
|
|
470
|
+
"When an item needs a person's approval before you can finish it, don't close it and don't take the action: keep the item and ask.",
|
|
471
|
+
"If it came from a person (an address ending in @external that isn't a shared channel; the item's 'Shared channel:' line names one), set it blocked with blockedOn that person and, as its summary, the question with a short form of what you'll do: the person sees the summary and the item, not your note, which keeps the record. Link a longer draft as an https evidenceRef. Their answer returns the item to you in progress.",
|
|
472
|
+
"Otherwise ask as a new item, to the seat it came from or, for a shared channel's item, to your rig's lead (rig_team shows it), with your question and draft. Then set yours blocked with blockedOn that new qitemId: when that item closes, yours returns to pending, to claim again.",
|
|
473
|
+
"Nothing promises to wake you, so check your inbox again. Then finish the same item; don't open a new one.",
|
|
474
|
+
].join(" ");
|
|
475
|
+
// Short guidance a client may show the model (the server's MCP instructions). An external caller's connection asks the
|
|
476
|
+
// team for work and isn't one of its members, so it isn't given the member workflow.
|
|
477
|
+
const SHARED_INSTRUCTIONS = [
|
|
255
478
|
"This server reaches an OpenRig team as one seat: the one named by OPENRIG_SESSION_NAME where the server was configured, or, over authenticated HTTP, the seat of the caller's grant (rig_whoami shows which, and whether the caller is authenticated; rig_team shows a rig's seats and its lead). The daemon attributes this server's writes to that seat.",
|
|
256
479
|
"To hand work to a seat, use rig_queue_create and keep its qitemId; read the answer later with rig_queue_show, which names the next item when the work was handed on. To pass on work this seat holds, use rig_queue_handoff rather than closing it and creating another, so the work stays one chain. Queue items are durable: they outlive this conversation and this server.",
|
|
257
480
|
"Tools marked read-only change nothing. A seat whose activity is unknown is not idle, and an accepted request (a restore's attemptId) is not a finished one.",
|
|
258
481
|
"A question reserved for a person is theirs to answer: don't answer it on their behalf. rig_queue_decide records a decision only inside the decision room of the mode they have on, beside their answers and never as one.",
|
|
259
|
-
]
|
|
482
|
+
];
|
|
483
|
+
const INSTRUCTIONS = [...SHARED_INSTRUCTIONS, MEMBER_WORKFLOW].join("\n");
|
|
484
|
+
const EXTERNAL_INSTRUCTIONS = SHARED_INSTRUCTIONS.join("\n");
|
|
260
485
|
/**
|
|
261
486
|
* Maps a DaemonResponse to MCP tool result.
|
|
262
487
|
* Three error levels: HTTP status, in-body errors, and structural failure fields.
|
|
@@ -299,13 +524,19 @@ export function createMcpServer(client, options = {}) {
|
|
|
299
524
|
const server = new McpServer({
|
|
300
525
|
name: "openrig",
|
|
301
526
|
version: CLI_VERSION,
|
|
302
|
-
}, { instructions: INSTRUCTIONS });
|
|
527
|
+
}, { instructions: options.access?.external ? EXTERNAL_INSTRUCTIONS : INSTRUCTIONS });
|
|
303
528
|
const { access } = options;
|
|
529
|
+
const rostersFolder = options.rostersFolder ?? (() => nodePath.join(new ConfigStore().get("workspace.root"), "rosters"));
|
|
530
|
+
const presenceFile = options.presenceFile ?? (() => mcpPresenceFilePath());
|
|
304
531
|
// The seat this server acts as: the authenticated caller's, else OPENRIG_SESSION_NAME where it was configured.
|
|
305
532
|
const seatOf = () => options.seat ?? readOpenRigEnv("OPENRIG_SESSION_NAME", "RIGGED_SESSION_NAME")?.trim();
|
|
306
533
|
const accessClass = new Map(MCP_OPERATIONS.map((op) => [op.tool, op.access]));
|
|
307
|
-
// A local caller (no access) is offered every tool; an authenticated one, its class's
|
|
534
|
+
// A local caller (no access) is offered every tool; an authenticated one, its class's; an external caller, its
|
|
535
|
+
// grant's pairs.
|
|
536
|
+
const external = access?.external ? externalTools(access.external.objects) : null;
|
|
308
537
|
const offered = (tool) => {
|
|
538
|
+
if (external)
|
|
539
|
+
return external.has(tool);
|
|
309
540
|
if (!access || access.owner)
|
|
310
541
|
return true;
|
|
311
542
|
const kind = accessClass.get(tool);
|
|
@@ -347,17 +578,21 @@ export function createMcpServer(client, options = {}) {
|
|
|
347
578
|
};
|
|
348
579
|
// 1. rig_up — launch from a spec, bundle or topology, or restore an existing rig by name
|
|
349
580
|
if (offered("rig_up"))
|
|
350
|
-
server.
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
581
|
+
server.registerTool("rig_up", {
|
|
582
|
+
description: "Launch a rig from a rig spec (.yaml), a .rigbundle or a .rigtopology, or restore an existing rig by its name from its latest snapshot",
|
|
583
|
+
inputSchema: z.object({
|
|
584
|
+
sourceRef: z.string().describe("An absolute path to a rig spec (.yaml), .rigbundle or .rigtopology, or the name of an existing rig to restore. The daemon reads the path, so a relative one resolves against the daemon's directory."),
|
|
585
|
+
plan: z.boolean().optional().describe("Plan mode — preview without executing"),
|
|
586
|
+
autoApprove: z.boolean().optional().describe("Auto-approve trusted actions"),
|
|
587
|
+
targetRoot: z.string().optional().describe("Target root directory for package installation"),
|
|
588
|
+
cwd: z.string().refine((dir) => nodePath.isAbsolute(dir), "cwd must be an absolute path").optional().describe("Working directory for a new launch's agents. It must be absolute: this server has no caller directory to resolve a relative one against."),
|
|
589
|
+
// The daemon drops the whole env block when any entry is invalid, so check it here the way rig up --env does.
|
|
590
|
+
env: z.record(z.string().regex(/^[A-Z_][A-Z0-9_]*$/, "env names match ^[A-Z_][A-Z0-9_]*$").refine((name) => !name.startsWith("OPENRIG_"), "OPENRIG_* env names belong to OpenRig"), z.string().min(1, "env values must not be empty").refine((value) => !value.includes("\0"), "env values must not contain a NUL byte")).optional().describe("Environment variables for a new launch from one rig spec or bundle, not saved with the rig (as rig up --env NAME=value). A .rigtopology or a restore by name doesn't use them."),
|
|
591
|
+
rigName: z.string().min(1).optional().describe("A new launch's rig name instead of the spec's (as rig up --name)"),
|
|
592
|
+
fresh: z.array(z.string()).optional().describe("When restoring an existing rig: the seats (logical ids, e.g. dev.impl) to start fresh instead of resuming (as rig up --fresh)"),
|
|
593
|
+
}),
|
|
594
|
+
annotations: DESTRUCTIVE,
|
|
595
|
+
}, async ({ sourceRef, plan, autoApprove, targetRoot, cwd, env, rigName, fresh }) => {
|
|
361
596
|
try {
|
|
362
597
|
const res = await client.post("/api/up", { sourceRef, plan: plan ?? false, autoApprove: autoApprove ?? false, targetRoot, cwdOverride: cwd, envOverride: env, rigName, freshLogicalIds: fresh }, plan ? undefined : { timeoutMs: LONG_RUNNING_UP_TIMEOUT_MS });
|
|
363
598
|
return mapResult(res);
|
|
@@ -368,12 +603,16 @@ export function createMcpServer(client, options = {}) {
|
|
|
368
603
|
});
|
|
369
604
|
// 2. rig_down — rig teardown
|
|
370
605
|
if (offered("rig_down"))
|
|
371
|
-
server.
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
606
|
+
server.registerTool("rig_down", {
|
|
607
|
+
description: "Tear down a rig",
|
|
608
|
+
inputSchema: z.object({
|
|
609
|
+
rigId: z.string().describe("Rig name or identifier to tear down"),
|
|
610
|
+
delete: z.boolean().optional().describe("Delete rig record after stopping"),
|
|
611
|
+
force: z.boolean().optional().describe("Kill sessions immediately"),
|
|
612
|
+
snapshot: z.boolean().optional().describe("Take snapshot before teardown"),
|
|
613
|
+
}),
|
|
614
|
+
annotations: DESTRUCTIVE,
|
|
615
|
+
}, async (params) => {
|
|
377
616
|
try {
|
|
378
617
|
const rig = await rigIdFor(client, params.rigId);
|
|
379
618
|
if ("content" in rig)
|
|
@@ -392,7 +631,11 @@ export function createMcpServer(client, options = {}) {
|
|
|
392
631
|
});
|
|
393
632
|
// 3. rig_ps — list running rigs
|
|
394
633
|
if (offered("rig_ps"))
|
|
395
|
-
server.
|
|
634
|
+
server.registerTool("rig_ps", {
|
|
635
|
+
description: "List rigs and their status",
|
|
636
|
+
inputSchema: z.object({}),
|
|
637
|
+
annotations: READ_ONLY,
|
|
638
|
+
}, async () => {
|
|
396
639
|
try {
|
|
397
640
|
const res = await client.get("/api/ps");
|
|
398
641
|
if (scope && res.status < 400 && Array.isArray(res.data))
|
|
@@ -405,7 +648,11 @@ export function createMcpServer(client, options = {}) {
|
|
|
405
648
|
});
|
|
406
649
|
// 4. rig_status — daemon health
|
|
407
650
|
if (offered("rig_status"))
|
|
408
|
-
server.
|
|
651
|
+
server.registerTool("rig_status", {
|
|
652
|
+
description: "Check daemon health",
|
|
653
|
+
inputSchema: z.object({}),
|
|
654
|
+
annotations: READ_ONLY,
|
|
655
|
+
}, async () => {
|
|
409
656
|
try {
|
|
410
657
|
const res = await client.get("/healthz");
|
|
411
658
|
return mapResult(res);
|
|
@@ -416,9 +663,13 @@ export function createMcpServer(client, options = {}) {
|
|
|
416
663
|
});
|
|
417
664
|
// 5. rig_snapshot_create — create snapshot
|
|
418
665
|
if (offered("rig_snapshot_create"))
|
|
419
|
-
server.
|
|
420
|
-
|
|
421
|
-
|
|
666
|
+
server.registerTool("rig_snapshot_create", {
|
|
667
|
+
description: "Create a snapshot for a rig",
|
|
668
|
+
inputSchema: z.object({
|
|
669
|
+
rigId: z.string().describe("Rig name or identifier"),
|
|
670
|
+
}),
|
|
671
|
+
annotations: ADDITIVE,
|
|
672
|
+
}, async ({ rigId }) => {
|
|
422
673
|
try {
|
|
423
674
|
const rig = await rigIdFor(client, rigId);
|
|
424
675
|
if ("content" in rig)
|
|
@@ -432,9 +683,13 @@ export function createMcpServer(client, options = {}) {
|
|
|
432
683
|
});
|
|
433
684
|
// 6. rig_snapshot_list — list snapshots
|
|
434
685
|
if (offered("rig_snapshot_list"))
|
|
435
|
-
server.
|
|
436
|
-
|
|
437
|
-
|
|
686
|
+
server.registerTool("rig_snapshot_list", {
|
|
687
|
+
description: "List snapshots for a rig",
|
|
688
|
+
inputSchema: z.object({
|
|
689
|
+
rigId: z.string().describe("Rig name or identifier"),
|
|
690
|
+
}),
|
|
691
|
+
annotations: READ_ONLY,
|
|
692
|
+
}, async ({ rigId }) => {
|
|
438
693
|
try {
|
|
439
694
|
const rig = await rigIdFor(client, rigId);
|
|
440
695
|
if ("content" in rig)
|
|
@@ -453,10 +708,14 @@ export function createMcpServer(client, options = {}) {
|
|
|
453
708
|
});
|
|
454
709
|
// 7. rig_restore — restore from snapshot
|
|
455
710
|
if (offered("rig_restore"))
|
|
456
|
-
server.
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
711
|
+
server.registerTool("rig_restore", {
|
|
712
|
+
description: "Start restoring a rig from a snapshot. It answers at once with an attemptId while the restore runs in the background; follow the attempt with rig_restore_status.",
|
|
713
|
+
inputSchema: z.object({
|
|
714
|
+
rigId: z.string().describe("Rig name or identifier"),
|
|
715
|
+
snapshotId: z.string().describe("Snapshot identifier"),
|
|
716
|
+
}),
|
|
717
|
+
annotations: DESTRUCTIVE,
|
|
718
|
+
}, async ({ rigId, snapshotId }) => {
|
|
460
719
|
try {
|
|
461
720
|
const rig = await rigIdFor(client, rigId);
|
|
462
721
|
if ("content" in rig)
|
|
@@ -470,10 +729,14 @@ export function createMcpServer(client, options = {}) {
|
|
|
470
729
|
});
|
|
471
730
|
// 7b. rig_restore_status — follow a restore attempt rig_restore started
|
|
472
731
|
if (offered("rig_restore_status"))
|
|
473
|
-
server.
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
732
|
+
server.registerTool("rig_restore_status", {
|
|
733
|
+
description: "Read where a restore attempt stands: the receipt for the attemptId rig_restore returned. An attempt with no completion yet (still running, or stopped before it finished) answers attempt_incomplete; it isn't a receipt.",
|
|
734
|
+
inputSchema: z.object({
|
|
735
|
+
rigId: z.string().describe("Rig name or identifier"),
|
|
736
|
+
attemptId: z.number().int().positive().describe("The attemptId rig_restore returned"),
|
|
737
|
+
}),
|
|
738
|
+
annotations: READ_ONLY,
|
|
739
|
+
}, async ({ rigId, attemptId }) => {
|
|
477
740
|
try {
|
|
478
741
|
const rig = await rigIdFor(client, rigId);
|
|
479
742
|
if ("content" in rig)
|
|
@@ -486,7 +749,11 @@ export function createMcpServer(client, options = {}) {
|
|
|
486
749
|
});
|
|
487
750
|
// 8. rig_discover — scan for sessions
|
|
488
751
|
if (offered("rig_discover"))
|
|
489
|
-
server.
|
|
752
|
+
server.registerTool("rig_discover", {
|
|
753
|
+
description: "Scan for tmux sessions to discover",
|
|
754
|
+
inputSchema: z.object({}),
|
|
755
|
+
annotations: DESTRUCTIVE,
|
|
756
|
+
}, async () => {
|
|
490
757
|
try {
|
|
491
758
|
const res = await client.post("/api/discovery/scan", {});
|
|
492
759
|
return mapResult(res);
|
|
@@ -497,13 +764,17 @@ export function createMcpServer(client, options = {}) {
|
|
|
497
764
|
});
|
|
498
765
|
// 9. rig_bind — bind discovered session to a rig node (existing or new in pod)
|
|
499
766
|
if (offered("rig_bind"))
|
|
500
|
-
server.
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
767
|
+
server.registerTool("rig_bind", {
|
|
768
|
+
description: "Bind a discovered session to an existing node or create a new node in a pod",
|
|
769
|
+
inputSchema: z.object({
|
|
770
|
+
discoveryId: z.string().describe("Discovery session identifier"),
|
|
771
|
+
rigId: z.string().describe("Target rig name or identifier"),
|
|
772
|
+
logicalId: z.string().optional().describe("Existing node logical ID (mode: bind to existing)"),
|
|
773
|
+
podNamespace: z.string().optional().describe("Pod namespace to create node in (mode: create in pod)"),
|
|
774
|
+
memberName: z.string().optional().describe("Member name for new node (required with podNamespace)"),
|
|
775
|
+
}),
|
|
776
|
+
annotations: DESTRUCTIVE,
|
|
777
|
+
}, async ({ discoveryId, rigId, logicalId, podNamespace, memberName }) => {
|
|
507
778
|
try {
|
|
508
779
|
const rig = await rigIdFor(client, rigId);
|
|
509
780
|
if ("content" in rig)
|
|
@@ -524,9 +795,13 @@ export function createMcpServer(client, options = {}) {
|
|
|
524
795
|
});
|
|
525
796
|
// 10. rig_bundle_inspect — inspect a bundle
|
|
526
797
|
if (offered("rig_bundle_inspect"))
|
|
527
|
-
server.
|
|
528
|
-
|
|
529
|
-
|
|
798
|
+
server.registerTool("rig_bundle_inspect", {
|
|
799
|
+
description: "Inspect a .rigbundle file",
|
|
800
|
+
inputSchema: z.object({
|
|
801
|
+
bundlePath: z.string().describe("Path to .rigbundle file"),
|
|
802
|
+
}),
|
|
803
|
+
annotations: READ_ONLY,
|
|
804
|
+
}, async ({ bundlePath }) => {
|
|
530
805
|
try {
|
|
531
806
|
const res = await client.post("/api/bundles/inspect", { bundlePath });
|
|
532
807
|
return mapResult(res, (data) => {
|
|
@@ -545,9 +820,13 @@ export function createMcpServer(client, options = {}) {
|
|
|
545
820
|
});
|
|
546
821
|
// 11. rig_agent_validate — validate an AgentSpec
|
|
547
822
|
if (offered("rig_agent_validate"))
|
|
548
|
-
server.
|
|
549
|
-
|
|
550
|
-
|
|
823
|
+
server.registerTool("rig_agent_validate", {
|
|
824
|
+
description: "Validate an AgentSpec (agent.yaml) from YAML text",
|
|
825
|
+
inputSchema: z.object({
|
|
826
|
+
yaml: z.string().describe("YAML text of the agent spec"),
|
|
827
|
+
}),
|
|
828
|
+
annotations: READ_ONLY,
|
|
829
|
+
}, async ({ yaml }) => {
|
|
551
830
|
try {
|
|
552
831
|
const res = await client.postText("/api/agents/validate", yaml);
|
|
553
832
|
return mapResult(res);
|
|
@@ -558,9 +837,13 @@ export function createMcpServer(client, options = {}) {
|
|
|
558
837
|
});
|
|
559
838
|
// 12. rig_rig_validate — validate a RigSpec
|
|
560
839
|
if (offered("rig_rig_validate"))
|
|
561
|
-
server.
|
|
562
|
-
|
|
563
|
-
|
|
840
|
+
server.registerTool("rig_rig_validate", {
|
|
841
|
+
description: "Validate a RigSpec (rig.yaml) from YAML text",
|
|
842
|
+
inputSchema: z.object({
|
|
843
|
+
yaml: z.string().describe("YAML text of the rig spec"),
|
|
844
|
+
}),
|
|
845
|
+
annotations: READ_ONLY,
|
|
846
|
+
}, async ({ yaml }) => {
|
|
564
847
|
try {
|
|
565
848
|
const res = await client.postText("/api/rigs/import/validate", yaml);
|
|
566
849
|
return mapResult(res);
|
|
@@ -571,9 +854,13 @@ export function createMcpServer(client, options = {}) {
|
|
|
571
854
|
});
|
|
572
855
|
// 13. rig_rig_nodes — node inventory for a rig
|
|
573
856
|
if (offered("rig_rig_nodes"))
|
|
574
|
-
server.
|
|
575
|
-
|
|
576
|
-
|
|
857
|
+
server.registerTool("rig_rig_nodes", {
|
|
858
|
+
description: "Get node inventory for a rig — session names, status, attach commands, resume commands",
|
|
859
|
+
inputSchema: z.object({
|
|
860
|
+
rigId: z.string().describe("Rig name or identifier"),
|
|
861
|
+
}),
|
|
862
|
+
annotations: READ_ONLY,
|
|
863
|
+
}, async ({ rigId }) => {
|
|
577
864
|
try {
|
|
578
865
|
const denied = await rigOutOfScope(rigId);
|
|
579
866
|
if (denied)
|
|
@@ -590,13 +877,17 @@ export function createMcpServer(client, options = {}) {
|
|
|
590
877
|
});
|
|
591
878
|
// 14. rig_send — send message to agent session
|
|
592
879
|
if (offered("rig_send"))
|
|
593
|
-
server.
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
880
|
+
server.registerTool("rig_send", {
|
|
881
|
+
description: "Send a message to an agent's terminal using reliable two-step send",
|
|
882
|
+
inputSchema: z.object({
|
|
883
|
+
session: z.string().describe("Target session name (e.g. dev-impl@my-rig)"),
|
|
884
|
+
text: z.string().describe("Message text to send"),
|
|
885
|
+
verify: z.boolean().optional().describe("Verify delivery by checking pane content"),
|
|
886
|
+
force: z.boolean().optional().describe("Send even if target appears mid-task"),
|
|
887
|
+
waitForIdleSeconds: z.number().positive().optional().describe("Wait until explicit idle evidence before sending. If the seat is still busy or its activity is unknown when the wait ends, nothing is sent and nothing is kept; separate work belongs in a queue row"),
|
|
888
|
+
}),
|
|
889
|
+
annotations: DESTRUCTIVE,
|
|
890
|
+
}, async ({ session, text, verify, force, waitForIdleSeconds }) => {
|
|
600
891
|
try {
|
|
601
892
|
if (force && waitForIdleSeconds !== undefined) {
|
|
602
893
|
const message = "waitForIdleSeconds cannot be combined with force";
|
|
@@ -620,12 +911,16 @@ export function createMcpServer(client, options = {}) {
|
|
|
620
911
|
});
|
|
621
912
|
// 15. rig_capture — capture terminal output from agent session
|
|
622
913
|
if (offered("rig_capture"))
|
|
623
|
-
server.
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
914
|
+
server.registerTool("rig_capture", {
|
|
915
|
+
description: "Capture terminal output from an agent session",
|
|
916
|
+
inputSchema: z.object({
|
|
917
|
+
session: z.string().optional().describe("Session name (omit for multi-target with rig/pod)"),
|
|
918
|
+
rig: z.string().optional().describe("Capture all sessions in a rig"),
|
|
919
|
+
pod: z.string().optional().describe("Capture all sessions in a pod"),
|
|
920
|
+
lines: z.number().optional().describe("Number of lines to capture (default: 20)"),
|
|
921
|
+
}),
|
|
922
|
+
annotations: READ_ONLY,
|
|
923
|
+
}, async ({ session, rig, pod, lines }) => {
|
|
629
924
|
try {
|
|
630
925
|
let rigName = rig;
|
|
631
926
|
if (scope) {
|
|
@@ -661,10 +956,14 @@ export function createMcpServer(client, options = {}) {
|
|
|
661
956
|
});
|
|
662
957
|
// 16. rig_chatroom_send — send message to rig chatroom
|
|
663
958
|
if (offered("rig_chatroom_send"))
|
|
664
|
-
server.
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
959
|
+
server.registerTool("rig_chatroom_send", {
|
|
960
|
+
description: "Send a message to a rig's chatroom as this server's seat",
|
|
961
|
+
inputSchema: z.object({
|
|
962
|
+
rigName: z.string().describe("Rig name or identifier"),
|
|
963
|
+
body: z.string().describe("Message body"),
|
|
964
|
+
}),
|
|
965
|
+
annotations: ADDITIVE,
|
|
966
|
+
}, async ({ rigName, body }) => {
|
|
668
967
|
try {
|
|
669
968
|
const denied = await rigOutOfScope(rigName);
|
|
670
969
|
if (denied)
|
|
@@ -685,12 +984,16 @@ export function createMcpServer(client, options = {}) {
|
|
|
685
984
|
});
|
|
686
985
|
// 17. rig_chatroom_watch — a rig's recent chatroom history (the name is kept; it reads history, it doesn't stream)
|
|
687
986
|
if (offered("rig_chatroom_watch"))
|
|
688
|
-
server.
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
987
|
+
server.registerTool("rig_chatroom_watch", {
|
|
988
|
+
description: "Read a rig's recent chatroom messages: the most recent ones (default 20), oldest first, optionally one topic's or one sender's. It returns what is there now and doesn't wait for new messages.",
|
|
989
|
+
inputSchema: z.object({
|
|
990
|
+
rigName: z.string().describe("Rig name or identifier"),
|
|
991
|
+
topic: z.string().optional().describe("Only messages in this topic"),
|
|
992
|
+
sender: z.string().optional().describe("Only messages from this seat"),
|
|
993
|
+
limit: z.number().int().positive().optional().describe("How many recent messages (default 20)"),
|
|
994
|
+
}),
|
|
995
|
+
annotations: READ_ONLY,
|
|
996
|
+
}, async ({ rigName, topic, sender, limit }) => {
|
|
694
997
|
try {
|
|
695
998
|
const denied = await rigOutOfScope(rigName);
|
|
696
999
|
if (denied)
|
|
@@ -714,13 +1017,17 @@ export function createMcpServer(client, options = {}) {
|
|
|
714
1017
|
// converge op). Agent parity for `rig add`: the ergonomics live ON the
|
|
715
1018
|
// converge interface, so every future reshape verb inherits this surface.
|
|
716
1019
|
if (offered("rig_add"))
|
|
717
|
-
server.
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
1020
|
+
server.registerTool("rig_add", {
|
|
1021
|
+
description: "Add a single member to an existing pod in a running rig (the add_member converge op). Identity-migration-free: mints a fresh seat, nothing existing re-keys.",
|
|
1022
|
+
inputSchema: z.object({
|
|
1023
|
+
rigId: z.string().describe("Target rig name or identifier"),
|
|
1024
|
+
podNamespace: z.string().describe("Namespace of the existing pod to add the member to"),
|
|
1025
|
+
member: z.record(z.string(), z.unknown()).describe("Member fragment with spec snake_case fields: id, runtime, agent_ref, profile, cwd (and optional model, codex_config_profile, restore_policy, label)"),
|
|
1026
|
+
edges: z.array(z.object({ from: z.string(), to: z.string(), kind: z.string() })).optional().describe("Optional pod-local edges (from/to are member ids within the pod; resolved against the new member + existing pod-mates)"),
|
|
1027
|
+
rigRoot: z.string().optional().describe("Root directory for agent resolution"),
|
|
1028
|
+
}),
|
|
1029
|
+
annotations: ADDITIVE,
|
|
1030
|
+
}, async ({ rigId, podNamespace, member, edges, rigRoot }) => {
|
|
724
1031
|
try {
|
|
725
1032
|
const body = { member };
|
|
726
1033
|
if (edges)
|
|
@@ -748,18 +1055,22 @@ export function createMcpServer(client, options = {}) {
|
|
|
748
1055
|
// DaemonClient, so the identity is configured once, where the server is set up.
|
|
749
1056
|
// 19. rig_queue_create — hand a task to a seat
|
|
750
1057
|
if (offered("rig_queue_create"))
|
|
751
|
-
server.
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
1058
|
+
server.registerTool("rig_queue_create", {
|
|
1059
|
+
description: "Hand a task to another seat as a durable queue item. Returns its qitemId: read the answer later with rig_queue_show. If the call times out, check rig_queue_show with the same qitemId before retrying; never retry with a new id. To ask for a revision of earlier work, name it in revises: the new item opens with 'Revision of <id>' and records it in its chainOfRecord.",
|
|
1060
|
+
inputSchema: z.object({
|
|
1061
|
+
destination: z.string().describe("Destination seat (e.g. dev-impl@my-rig)"),
|
|
1062
|
+
body: z.string().describe("The task: what to do and what to return"),
|
|
1063
|
+
summary: z.string().optional().describe("One-line summary"),
|
|
1064
|
+
tags: z.array(z.string()).optional().describe("Tags, e.g. mission:<name>"),
|
|
1065
|
+
priority: z.string().optional().describe("Priority (as rig queue create --priority)"),
|
|
1066
|
+
tier: z.string().optional().describe("Tier (as rig queue create --tier)"),
|
|
1067
|
+
qitemId: z.string().optional().describe("Request id to reuse when retrying the same create (default: a new id)"),
|
|
1068
|
+
revises: z.string().optional().describe("The qitemId of the work this asks to revise"),
|
|
1069
|
+
alert: z.boolean().optional().describe("For an ask to a person that's urgent: something only they can do, or an approval whose wait costs now (as rig queue create --alert). It stands out in Slack. Without it the ask still posts to Slack unless the person's Slack subscription is urgent-only, in which case it waits on Steering and the TUI"),
|
|
1070
|
+
}),
|
|
1071
|
+
annotations: ADDITIVE,
|
|
1072
|
+
}, async ({ destination, body, summary, tags, priority, tier, qitemId, revises, alert }) => {
|
|
1073
|
+
if (scope && !scope.destination(destination))
|
|
763
1074
|
return outOfScope(`Destination ${destination}`);
|
|
764
1075
|
// A revision carries its original's lineage as a handoff does: the original's chain, then the original.
|
|
765
1076
|
let lineage;
|
|
@@ -782,11 +1093,21 @@ export function createMcpServer(client, options = {}) {
|
|
|
782
1093
|
const id = qitemId ?? `qitem-${new Date().toISOString().replace(/\D/g, "").slice(0, 14)}-${randomBytes(8).toString("hex")}`;
|
|
783
1094
|
try {
|
|
784
1095
|
const res = await client.post("/api/queue/create", {
|
|
785
|
-
qitemId: id, destinationSession: destination, body: lineage?.body ?? body, summary,
|
|
1096
|
+
qitemId: id, destinationSession: destination, body: lineage?.body ?? body, summary, priority, tier,
|
|
1097
|
+
tags: access?.external ? tags?.filter((tag) => !OPENRIG_PROVENANCE_TAG.test(tag)) : tags,
|
|
786
1098
|
...(alert ? { humanAlert: true } : {}),
|
|
787
1099
|
...(lineage ? { chainOfRecord: lineage.chainOfRecord } : {}),
|
|
788
1100
|
});
|
|
789
|
-
|
|
1101
|
+
// An external caller reusing the id of an item it can't see learns only that the id is taken, never that item's
|
|
1102
|
+
// parties.
|
|
1103
|
+
const conflict = (res.data ?? {});
|
|
1104
|
+
if (scope?.shows && res.status === 409 && conflict.error === "qitem_id_reuse"
|
|
1105
|
+
&& !scope.item({ sourceSession: conflict.existingSource, destinationSession: conflict.existingDestination })) {
|
|
1106
|
+
return mapResult({ status: 409, data: { error: "qitem_id_reuse", message: `qitemId ${id} is already taken. Retry with a new one.` } }, undefined, { structured: true });
|
|
1107
|
+
}
|
|
1108
|
+
// A create's return, a retry's stored row included, goes through the same external projection as show and list.
|
|
1109
|
+
const view = externalView(scope);
|
|
1110
|
+
return mapResult(view && res.status < 400 ? { ...res, data: projectForExternal(res.data, view) } : res, undefined, { structured: true });
|
|
790
1111
|
}
|
|
791
1112
|
catch (err) {
|
|
792
1113
|
const failure = caught(err);
|
|
@@ -796,9 +1117,13 @@ export function createMcpServer(client, options = {}) {
|
|
|
796
1117
|
});
|
|
797
1118
|
// 20. rig_queue_show — one item with its transitions: a delegated task's answer is its own record
|
|
798
1119
|
if (offered("rig_queue_show"))
|
|
799
|
-
server.
|
|
800
|
-
|
|
801
|
-
|
|
1120
|
+
server.registerTool("rig_queue_show", {
|
|
1121
|
+
description: "Read one queue item and its transitions. For a task you handed off, this is where its answer is: the state, the closure reason and target, the notes the assignee recorded, and evidenceRef when it names an artifact (read it with rig_artifact_read). When the item was handed on, successor names the next item (on another host: its id and host); follow it with rig_queue_show. null means none was found. A revision names the work it revises in chainOfRecord.",
|
|
1122
|
+
inputSchema: z.object({
|
|
1123
|
+
qitemId: z.string().describe("The qitemId returned by rig_queue_create (or any queue item)"),
|
|
1124
|
+
}),
|
|
1125
|
+
annotations: READ_ONLY,
|
|
1126
|
+
}, async ({ qitemId }) => {
|
|
802
1127
|
try {
|
|
803
1128
|
const id = encodeURIComponent(qitemId);
|
|
804
1129
|
const item = await client.get(`/api/queue/${id}`);
|
|
@@ -811,10 +1136,14 @@ export function createMcpServer(client, options = {}) {
|
|
|
811
1136
|
return mapResult(transitions);
|
|
812
1137
|
const row = (item.data ?? {});
|
|
813
1138
|
const handedOn = row.state === "handed-off" || row.closureReason === "handed_off_to";
|
|
814
|
-
|
|
815
|
-
|
|
1139
|
+
const view = externalView(scope);
|
|
1140
|
+
let successor = handedOn ? await successorOf(client, qitemId, row.closureTarget, view ? scope.item : undefined) : undefined;
|
|
1141
|
+
if (scope && !view && successor && "destinationSession" in successor && !scope.successor(successor.destinationSession))
|
|
816
1142
|
successor = { unknown: true, code: "out_of_scope" };
|
|
817
|
-
|
|
1143
|
+
const data = view
|
|
1144
|
+
? { item: projectForExternal(item.data, view), transitions: Array.isArray(transitions.data) ? transitions.data.map((t) => projectForExternal(t, view)) : transitions.data }
|
|
1145
|
+
: { item: item.data, transitions: transitions.data };
|
|
1146
|
+
return mapResult({ status: 200, data: { ...data, ...(handedOn ? { successor } : {}) } }, undefined, { structured: true });
|
|
818
1147
|
}
|
|
819
1148
|
catch (err) {
|
|
820
1149
|
return caught(err);
|
|
@@ -822,20 +1151,26 @@ export function createMcpServer(client, options = {}) {
|
|
|
822
1151
|
});
|
|
823
1152
|
// 21. rig_queue_list — list queue items
|
|
824
1153
|
if (offered("rig_queue_list"))
|
|
825
|
-
server.
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
1154
|
+
server.registerTool("rig_queue_list", {
|
|
1155
|
+
description: "List queue items. owned: assigned to this seat. mine: this seat is the source or the destination. Without a scope, this seat's rig. Without state, open items only (all adds closed ones); a state filter returns exactly those states, closed ones included. since finds work updated after a time; handedOffFrom finds where a handed-off item went.",
|
|
1156
|
+
inputSchema: z.object({
|
|
1157
|
+
owned: z.boolean().optional().describe("Only items assigned to this seat: its whole inbox (overrides destination)"),
|
|
1158
|
+
mine: z.boolean().optional().describe("Items this seat sent or owns"),
|
|
1159
|
+
destination: z.string().optional().describe("Filter by destination seat"),
|
|
1160
|
+
source: z.string().optional().describe("Filter by source seat"),
|
|
1161
|
+
state: z.string().optional().describe("Only these states, comma-separated; closed states included when named"),
|
|
1162
|
+
all: z.boolean().optional().describe("Without state: include closed items"),
|
|
1163
|
+
since: z.string().optional().describe("Only items updated at or after this ISO-8601 time, e.g. done work since Monday: state done, since 2026-10-19"),
|
|
1164
|
+
handedOffFrom: z.string().optional().describe("The items handed on from this qitemId, in any state and any rig"),
|
|
1165
|
+
limit: z.number().int().positive().optional().describe("Result limit (default 100)"),
|
|
1166
|
+
}),
|
|
1167
|
+
annotations: READ_ONLY,
|
|
1168
|
+
}, async ({ owned, mine: mineAsked, destination, source, state, all, since, handedOffFrom, limit }) => {
|
|
836
1169
|
try {
|
|
837
1170
|
const params = new URLSearchParams();
|
|
838
1171
|
const sessionName = seatOf();
|
|
1172
|
+
// An external caller lists its own items only, so the daemon's limit counts those and not the team's.
|
|
1173
|
+
const mine = mineAsked || (scope?.ownListsOnly === true && !owned);
|
|
839
1174
|
if ((owned || mine) && !sessionName) {
|
|
840
1175
|
const message = "owned and mine need this server's seat: set OPENRIG_SESSION_NAME in its env, or filter by destination or source";
|
|
841
1176
|
return errorResult(JSON.stringify({ ok: false, error: message }), "seat_required", message);
|
|
@@ -877,8 +1212,11 @@ export function createMcpServer(client, options = {}) {
|
|
|
877
1212
|
return errorResult(JSON.stringify({ ok: false, error: message }), "filter_unsupported", message);
|
|
878
1213
|
}
|
|
879
1214
|
// An authenticated caller sees only the rows in its scope, whatever the filters matched.
|
|
880
|
-
if (scope && res.status < 400 && Array.isArray(res.data))
|
|
881
|
-
|
|
1215
|
+
if (scope && res.status < 400 && Array.isArray(res.data)) {
|
|
1216
|
+
const view = externalView(scope);
|
|
1217
|
+
const rows = res.data.filter((row) => scope.item(row));
|
|
1218
|
+
return mapResult({ ...res, data: view ? rows.map((row) => projectForExternal(row, view)) : rows }, undefined, { structured: true });
|
|
1219
|
+
}
|
|
882
1220
|
return mapResult(res, undefined, { structured: true });
|
|
883
1221
|
}
|
|
884
1222
|
catch (err) {
|
|
@@ -887,7 +1225,11 @@ export function createMcpServer(client, options = {}) {
|
|
|
887
1225
|
});
|
|
888
1226
|
// 22. rig_queue_claim — take an item assigned to this seat
|
|
889
1227
|
if (offered("rig_queue_claim"))
|
|
890
|
-
server.
|
|
1228
|
+
server.registerTool("rig_queue_claim", {
|
|
1229
|
+
description: "Claim a queue item assigned to this seat before working on it.",
|
|
1230
|
+
inputSchema: z.object({ qitemId: z.string().describe("The queue item to claim") }),
|
|
1231
|
+
annotations: DESTRUCTIVE,
|
|
1232
|
+
}, async ({ qitemId }) => {
|
|
891
1233
|
try {
|
|
892
1234
|
const denied = await itemOutOfScope(qitemId);
|
|
893
1235
|
if (denied)
|
|
@@ -900,19 +1242,23 @@ export function createMcpServer(client, options = {}) {
|
|
|
900
1242
|
});
|
|
901
1243
|
// 23. rig_queue_update — record progress, block, or close with the answer
|
|
902
1244
|
if (offered("rig_queue_update"))
|
|
903
|
-
server.
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
1245
|
+
server.registerTool("rig_queue_update", {
|
|
1246
|
+
description: "Update a queue item: add a note, block it, close it, or reopen a closed one. To answer a task, close it with state done, a closure reason and the answer in resolution, which the item keeps; note records why this transition happened.",
|
|
1247
|
+
inputSchema: z.object({
|
|
1248
|
+
qitemId: z.string().describe("The queue item to update"),
|
|
1249
|
+
state: z.string().optional().describe("New state (e.g. in-progress, blocked, done)"),
|
|
1250
|
+
closureReason: z.string().optional().describe("Why it closed: no-follow-on for finished work, or handed_off_to, denied, canceled, escalation or superseded (as rig queue update --closure-reason)"),
|
|
1251
|
+
closureTarget: z.string().optional().describe("Closure target, when the reason needs one"),
|
|
1252
|
+
note: z.string().optional().describe("Transition note: progress, or why this transition happened (required to reopen)"),
|
|
1253
|
+
resolution: z.string().optional().describe("The outcome the item keeps, stored only by the update that closes an open item (as rig queue update --resolution)"),
|
|
1254
|
+
reopen: z.boolean().optional().describe("Reopen a closed item: give an active state (pending, in-progress or blocked) and a note (as rig queue update --reopen)"),
|
|
1255
|
+
summary: z.string().optional().describe("Replace the one-line summary"),
|
|
1256
|
+
evidenceRef: z.string().optional().describe("Pointer to the durable artifact, stored on the item when closing with state done or parking on a human seat; other updates refuse it"),
|
|
1257
|
+
blockedOn: z.string().optional().describe("What it waits on, when blocking: another qitemId (this item returns to pending when that one closes), or the address of the person this item came from, not a shared channel (they're asked with this item's summary, and their answer returns it to you in progress)"),
|
|
1258
|
+
wakeAfterSeconds: z.number().int().positive().optional().describe("Wake this seat after this many seconds, when blocking. Delivered only to a seat with a terminal: an attached app can't receive it today, so the item just waits until it is checked."),
|
|
1259
|
+
}),
|
|
1260
|
+
annotations: DESTRUCTIVE,
|
|
1261
|
+
}, async ({ qitemId, state, closureReason, closureTarget, note, resolution, reopen, summary, evidenceRef, blockedOn, wakeAfterSeconds }) => {
|
|
916
1262
|
try {
|
|
917
1263
|
const denied = await itemOutOfScope(qitemId, "owner");
|
|
918
1264
|
if (denied)
|
|
@@ -927,13 +1273,17 @@ export function createMcpServer(client, options = {}) {
|
|
|
927
1273
|
});
|
|
928
1274
|
// 24. rig_telemetry_events — one bounded page of event metadata, the page `rig telemetry events` reads
|
|
929
1275
|
if (offered("rig_telemetry_events"))
|
|
930
|
-
server.
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
1276
|
+
server.registerTool("rig_telemetry_events", {
|
|
1277
|
+
description: "Read one bounded page of event metadata: seq, rig, node, type and time, never payloads. Without a cursor it starts at the newest event and returns no rows; start retained reads the retained past instead. Continue with page.nextCursor and the same filters. coverage.gaps names any history it could not read, including a daemon restart, after which the old cursor can't continue.",
|
|
1278
|
+
inputSchema: z.object({
|
|
1279
|
+
cursor: z.string().optional().describe("page.nextCursor from the previous page; not with start"),
|
|
1280
|
+
start: z.enum(["latest", "retained"]).optional().describe("Without a cursor: latest (default) or retained"),
|
|
1281
|
+
rigId: z.string().optional().describe("Rig name or identifier; events with no rig are left out"),
|
|
1282
|
+
nodeId: z.string().optional().describe("Node identifier"),
|
|
1283
|
+
limit: z.number().int().min(1).max(128).optional().describe("Source rows to scan (default and maximum 128); a filter can return fewer"),
|
|
1284
|
+
}),
|
|
1285
|
+
annotations: READ_ONLY,
|
|
1286
|
+
}, async ({ cursor, start, rigId, nodeId, limit }) => {
|
|
937
1287
|
try {
|
|
938
1288
|
const params = new URLSearchParams();
|
|
939
1289
|
if (rigId) {
|
|
@@ -962,7 +1312,11 @@ export function createMcpServer(client, options = {}) {
|
|
|
962
1312
|
});
|
|
963
1313
|
// 26. rig_whoami — which seat this server acts as
|
|
964
1314
|
if (offered("rig_whoami"))
|
|
965
|
-
server.
|
|
1315
|
+
server.registerTool("rig_whoami", {
|
|
1316
|
+
description: "Show which OpenRig seat this server acts as: its rig, pod, peers and edges, and caller: authenticated (a validated HTTP credential, with its principal) or declared (OPENRIG_SESSION_NAME where the server was configured, which nothing verifies).",
|
|
1317
|
+
inputSchema: z.object({}),
|
|
1318
|
+
annotations: READ_ONLY,
|
|
1319
|
+
}, async () => {
|
|
966
1320
|
try {
|
|
967
1321
|
const seat = seatOf();
|
|
968
1322
|
if (!seat) {
|
|
@@ -974,6 +1328,14 @@ export function createMcpServer(client, options = {}) {
|
|
|
974
1328
|
if (targetRepo)
|
|
975
1329
|
params.set("targetRepo", targetRepo);
|
|
976
1330
|
const res = await client.get(`/api/whoami?${params.toString()}`);
|
|
1331
|
+
// whoami knows a seat by its session. A hosted member (a tool outside any terminal) has none: the seat is its
|
|
1332
|
+
// grant's, so the authenticated caller is answered with that seat. Read only.
|
|
1333
|
+
if (res.status === 404 && access && !access.external && options.seat === seat) {
|
|
1334
|
+
const at = seat.indexOf("@");
|
|
1335
|
+
const member = { ok: true, seat, rig: at >= 0 ? seat.slice(at + 1) : null, session: null, caller,
|
|
1336
|
+
message: "This seat has no session here: it's the seat this connection's grant names, such as a hosted member's. rig_team shows its rig and hosted members, and rig_queue_list with owned set lists its work." };
|
|
1337
|
+
return { content: [{ type: "text", text: JSON.stringify(member) }], structuredContent: member };
|
|
1338
|
+
}
|
|
977
1339
|
if (res.status >= 400)
|
|
978
1340
|
return mapResult(res);
|
|
979
1341
|
return mapResult({ ...res, data: { ...res.data, caller } }, undefined, { structured: true });
|
|
@@ -984,9 +1346,13 @@ export function createMcpServer(client, options = {}) {
|
|
|
984
1346
|
});
|
|
985
1347
|
// 27. rig_team — a rig's seats and its lead
|
|
986
1348
|
if (offered("rig_team"))
|
|
987
|
-
server.
|
|
988
|
-
|
|
989
|
-
|
|
1349
|
+
server.registerTool("rig_team", {
|
|
1350
|
+
description: "Show a rig's team: its lead, the rig's one delegates_to root (the seat that delegates to others and that nothing delegates to: the seat to delegate to), and each seat's pod, role, runtime, delegation (reportsTo, delegatesTo) and activity as the daemon reports it. Activity the daemon doesn't know reads unknown, never idle. hostedMembers are the rig's members that live outside a terminal (roster entries marked hosted): their authored capabilities and limits, with no pane and activity unknown.",
|
|
1351
|
+
inputSchema: z.object({
|
|
1352
|
+
rigId: z.string().describe("Rig name or identifier"),
|
|
1353
|
+
}),
|
|
1354
|
+
annotations: READ_ONLY,
|
|
1355
|
+
}, async ({ rigId }) => {
|
|
990
1356
|
try {
|
|
991
1357
|
const rig = await rigIdFor(client, rigId);
|
|
992
1358
|
if ("content" in rig)
|
|
@@ -1000,7 +1366,20 @@ export function createMcpServer(client, options = {}) {
|
|
|
1000
1366
|
const nodes = await client.get(`/api/rigs/${id}/nodes`);
|
|
1001
1367
|
if (nodes.status >= 400)
|
|
1002
1368
|
return mapResult(nodes);
|
|
1003
|
-
|
|
1369
|
+
const view = teamView((detail.data ?? {}), nodes.data);
|
|
1370
|
+
const rigName = (detail.data ?? {}).rig?.name ?? "";
|
|
1371
|
+
const inventory = Array.isArray(nodes.data) ? nodes.data : [];
|
|
1372
|
+
// A node is a seat whether or not it has a session yet: its address derives from its logical id (pod.member).
|
|
1373
|
+
const nodeSeats = new Set(inventory.flatMap((seat) => [seat.canonicalSessionName,
|
|
1374
|
+
typeof seat.logicalId === "string" ? `${seat.logicalId.replace(".", "-")}@${rigName}` : null]).filter((name) => typeof name === "string"));
|
|
1375
|
+
const hosted = await hostedMembersOf(rostersFolder(), rigName, nodeSeats, async () => inventory.find((seat) => typeof seat.hostSelfId === "string")?.hostSelfId
|
|
1376
|
+
?? await client.get("/healthz").then((res) => (res.status < 400 ? (res.data ?? {}).selfHostId ?? null : null), () => null), async (seat) => {
|
|
1377
|
+
const rows = await client.get(`/api/queue/list?${new URLSearchParams({ destinationSession: seat, compact: "1", limit: String(PRESENCE_ROWS) }).toString()}`)
|
|
1378
|
+
.then((res) => (res.status < 400 ? res.data : null), () => null);
|
|
1379
|
+
return { lastCallAt: readPresence(presenceFile())[seat]?.lastCallAt ?? null, lastWake: newestWake(rows, seat),
|
|
1380
|
+
lastWakeScope: `the latest ring among its ${PRESENCE_ROWS} most recent rows` };
|
|
1381
|
+
});
|
|
1382
|
+
return mapResult({ status: 200, data: { ...view, hostedMembers: hosted.members, ...(hosted.note ? { hostedMembersNote: hosted.note } : {}) } }, undefined, { structured: true });
|
|
1004
1383
|
}
|
|
1005
1384
|
catch (err) {
|
|
1006
1385
|
return caught(err);
|
|
@@ -1008,11 +1387,15 @@ export function createMcpServer(client, options = {}) {
|
|
|
1008
1387
|
});
|
|
1009
1388
|
// 28. rig_slices — the work tree's slices, as summaries
|
|
1010
1389
|
if (offered("rig_slices"))
|
|
1011
|
-
server.
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1390
|
+
server.registerTool("rig_slices", {
|
|
1391
|
+
description: "List the work tree's slices, most recently active first: name, mission, status, description and how many queue items name it. Paths and readiness detail are left out.",
|
|
1392
|
+
inputSchema: z.object({
|
|
1393
|
+
missionId: z.string().optional().describe("Only this mission's slices"),
|
|
1394
|
+
filter: z.enum(["all", "active", "done", "blocked"]).optional().describe("Only slices with this status (default all)"),
|
|
1395
|
+
limit: z.number().int().positive().max(200).optional().describe("Most slices to return (default 50)"),
|
|
1396
|
+
}),
|
|
1397
|
+
annotations: READ_ONLY,
|
|
1398
|
+
}, async ({ missionId, filter, limit }) => {
|
|
1016
1399
|
try {
|
|
1017
1400
|
const res = await client.get(`/api/slices${filter ? `?${new URLSearchParams({ filter }).toString()}` : ""}`);
|
|
1018
1401
|
if (res.status >= 400)
|
|
@@ -1027,9 +1410,13 @@ export function createMcpServer(client, options = {}) {
|
|
|
1027
1410
|
});
|
|
1028
1411
|
// 29. rig_mission — one mission's status and slices
|
|
1029
1412
|
if (offered("rig_mission"))
|
|
1030
|
-
server.
|
|
1031
|
-
|
|
1032
|
-
|
|
1413
|
+
server.registerTool("rig_mission", {
|
|
1414
|
+
description: "Read one mission: its status and its slices as summaries.",
|
|
1415
|
+
inputSchema: z.object({
|
|
1416
|
+
missionId: z.string().describe("The mission's id (its folder name)"),
|
|
1417
|
+
}),
|
|
1418
|
+
annotations: READ_ONLY,
|
|
1419
|
+
}, async ({ missionId }) => {
|
|
1033
1420
|
try {
|
|
1034
1421
|
const res = await client.get(`/api/missions/${encodeURIComponent(missionId)}`);
|
|
1035
1422
|
if (res.status >= 400)
|
|
@@ -1043,9 +1430,13 @@ export function createMcpServer(client, options = {}) {
|
|
|
1043
1430
|
});
|
|
1044
1431
|
// 30. rig_context_pack — one context pack's files
|
|
1045
1432
|
if (offered("rig_context_pack"))
|
|
1046
|
-
server.
|
|
1047
|
-
|
|
1048
|
-
|
|
1433
|
+
server.registerTool("rig_context_pack", {
|
|
1434
|
+
description: "Show one context pack: its purpose and the files it declares (path, role, summary, estimated tokens), so a file can be read with rig_context_get as <pack>/<file>.",
|
|
1435
|
+
inputSchema: z.object({
|
|
1436
|
+
ref: z.string().describe("The pack's ref, as rig context list shows it (e.g. project-world)"),
|
|
1437
|
+
}),
|
|
1438
|
+
annotations: READ_ONLY,
|
|
1439
|
+
}, async ({ ref }) => {
|
|
1049
1440
|
try {
|
|
1050
1441
|
const res = await client.get(`/api/context-packs/library/by-ref?${new URLSearchParams({ ref }).toString()}`);
|
|
1051
1442
|
if (res.status >= 400)
|
|
@@ -1062,9 +1453,13 @@ export function createMcpServer(client, options = {}) {
|
|
|
1062
1453
|
});
|
|
1063
1454
|
// 31. rig_context_get — one context file or section, as rig context get reads it
|
|
1064
1455
|
if (offered("rig_context_get"))
|
|
1065
|
-
server.
|
|
1066
|
-
|
|
1067
|
-
|
|
1456
|
+
server.registerTool("rig_context_get", {
|
|
1457
|
+
description: `Read one context file or one section of it, as rig context get does: <pack>/<file>, or <pack>/<file>#<h2-slug>[/<h3-slug>]. Text over ${CONTEXT_TEXT_LIMIT} characters is cut (truncated: true); address a section to read the rest.`,
|
|
1458
|
+
inputSchema: z.object({
|
|
1459
|
+
address: z.string().describe("<pack>/<file>[#<h2-slug>[/<h3-slug>]]"),
|
|
1460
|
+
}),
|
|
1461
|
+
annotations: READ_ONLY,
|
|
1462
|
+
}, async ({ address }) => {
|
|
1068
1463
|
try {
|
|
1069
1464
|
const res = await client.get(`/api/context-packs/library/resolve-address?${new URLSearchParams({ address }).toString()}`);
|
|
1070
1465
|
if (res.status >= 400)
|
|
@@ -1085,12 +1480,16 @@ export function createMcpServer(client, options = {}) {
|
|
|
1085
1480
|
});
|
|
1086
1481
|
// 32. rig_artifact_read — a result's artifact, read through the daemon's shared roots
|
|
1087
1482
|
if (offered("rig_artifact_read"))
|
|
1088
|
-
server.
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1483
|
+
server.registerTool("rig_artifact_read", {
|
|
1484
|
+
description: `Read a finished item's artifact (its evidenceRef), or a named file, through the daemon's shared roots (OPENRIG_FILES_ALLOWLIST), as text: at most ${CONTEXT_TEXT_LIMIT} characters from offset; nextOffset reads on. An artifact outside every shared root, a link, or an item with no evidenceRef comes back as available: false with the reason and the shared roots' names; nothing outside those roots is read.`,
|
|
1485
|
+
inputSchema: z.object({
|
|
1486
|
+
qitemId: z.string().optional().describe("Read this item's evidenceRef"),
|
|
1487
|
+
root: z.string().optional().describe("A shared root's name: with path, the file to read; with qitemId, the root a relative evidenceRef is under"),
|
|
1488
|
+
path: z.string().optional().describe("With root: the file's path inside that root"),
|
|
1489
|
+
offset: z.number().int().min(0).optional().describe("The character to start from (default 0)"),
|
|
1490
|
+
}),
|
|
1491
|
+
annotations: READ_ONLY,
|
|
1492
|
+
}, async ({ qitemId, root, path, offset }) => {
|
|
1094
1493
|
try {
|
|
1095
1494
|
const read = async (source, rootName, inside) => {
|
|
1096
1495
|
const res = await client.get(`/api/files/read?${new URLSearchParams({ root: rootName, path: inside }).toString()}`);
|
|
@@ -1100,6 +1499,8 @@ export function createMcpServer(client, options = {}) {
|
|
|
1100
1499
|
};
|
|
1101
1500
|
if (scope && root && !scope.root(root))
|
|
1102
1501
|
return outOfScope(`Root ${root}`);
|
|
1502
|
+
if (scope && !scope.paths && !qitemId)
|
|
1503
|
+
return outOfScope("A file named by root and path");
|
|
1103
1504
|
if (!qitemId) {
|
|
1104
1505
|
if (root && path)
|
|
1105
1506
|
return await read("path", root, path);
|
|
@@ -1109,7 +1510,7 @@ export function createMcpServer(client, options = {}) {
|
|
|
1109
1510
|
const item = await client.get(`/api/queue/${encodeURIComponent(qitemId)}`);
|
|
1110
1511
|
if (item.status >= 400)
|
|
1111
1512
|
return mapResult(item);
|
|
1112
|
-
if (scope && !scope.
|
|
1513
|
+
if (scope && !scope.artifact(item.data))
|
|
1113
1514
|
return outOfScope(`Item ${qitemId}`);
|
|
1114
1515
|
const ref = (item.data ?? {}).evidenceRef;
|
|
1115
1516
|
const rootsRes = await client.get("/api/files/roots");
|
|
@@ -1139,9 +1540,13 @@ export function createMcpServer(client, options = {}) {
|
|
|
1139
1540
|
});
|
|
1140
1541
|
// 33. rig_human_decision_room — before deciding a question asked of a person: the room their mode gives the team
|
|
1141
1542
|
if (offered("rig_human_decision_room"))
|
|
1142
|
-
server.
|
|
1143
|
-
|
|
1144
|
-
|
|
1543
|
+
server.registerTool("rig_human_decision_room", {
|
|
1544
|
+
description: "Before deciding a question you asked a person: the decision room of the mode they have on, in their own words (what the team may decide for them meanwhile, and what it may not), or none, with why. You judge whether your decision falls inside it; with none, the question stays theirs to answer.",
|
|
1545
|
+
inputSchema: z.object({
|
|
1546
|
+
qitemId: z.string().describe("Your pending ask to the person (a queue item addressed to <person>@external)"),
|
|
1547
|
+
}),
|
|
1548
|
+
annotations: READ_ONLY,
|
|
1549
|
+
}, async ({ qitemId }) => {
|
|
1145
1550
|
try {
|
|
1146
1551
|
const item = await client.get(`/api/queue/${encodeURIComponent(qitemId)}`);
|
|
1147
1552
|
if (item.status >= 400)
|
|
@@ -1166,16 +1571,20 @@ export function createMcpServer(client, options = {}) {
|
|
|
1166
1571
|
});
|
|
1167
1572
|
// 34. rig_queue_decide — a decision made on a person's behalf, inside their decision room, beside their answers
|
|
1168
1573
|
if (offered("rig_queue_decide"))
|
|
1169
|
-
server.
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1574
|
+
server.registerTool("rig_queue_decide", {
|
|
1575
|
+
description: "Record a decision you made on a person's behalf, on your own pending ask to them, inside the decision room of the mode they have on: read it first with rig_human_decision_room and pass its applicationId. It's recorded beside their answers, never as one, and the ask closes. The daemon refuses it when they have no room, their mode changed since you read it, the ask is a permission prompt or an approval gate, they've started answering, or another seat asked. This server never answers as the person.",
|
|
1576
|
+
inputSchema: z.object({
|
|
1577
|
+
qitemId: z.string().describe("Your pending ask to the person"),
|
|
1578
|
+
applicationId: z.string().describe("decisionRoom.applicationId from rig_human_decision_room: the room you judged against"),
|
|
1579
|
+
choices: z.array(z.object({
|
|
1580
|
+
questionId: z.string().optional().describe("The question's id, when the ask has structured questions"),
|
|
1581
|
+
chosen: z.string().describe("The option's id; for an ask without questions, the choice in words"),
|
|
1582
|
+
})).describe("One choice per structured question; for an ask without questions, one choice without questionId"),
|
|
1583
|
+
reason: z.string().describe("Why this choice"),
|
|
1584
|
+
reversible: z.boolean().describe("Whether the decision can be undone"),
|
|
1585
|
+
}),
|
|
1586
|
+
annotations: DESTRUCTIVE,
|
|
1587
|
+
}, async ({ qitemId, applicationId, choices, reason, reversible }) => {
|
|
1179
1588
|
try {
|
|
1180
1589
|
const denied = await itemOutOfScope(qitemId);
|
|
1181
1590
|
if (denied)
|
|
@@ -1188,16 +1597,20 @@ export function createMcpServer(client, options = {}) {
|
|
|
1188
1597
|
});
|
|
1189
1598
|
// 35. rig_queue_handoff — pass an item on to the next seat in one step, the route `rig queue handoff` uses
|
|
1190
1599
|
if (offered("rig_queue_handoff"))
|
|
1191
|
-
server.
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1600
|
+
server.registerTool("rig_queue_handoff", {
|
|
1601
|
+
description: "Pass a queue item this seat holds on to the next seat in one step: the item closes as handed off and a new item opens for that seat, carrying the work's lineage in chainOfRecord, so whoever follows the work reaches the new item from rig_queue_show. Without body the new item keeps the task's text. If the call times out, check rig_queue_show on this qitemId before retrying: when it reads handed off, its successor is the new item, so don't hand it off again.",
|
|
1602
|
+
inputSchema: z.object({
|
|
1603
|
+
qitemId: z.string().describe("The queue item to pass on"),
|
|
1604
|
+
to: z.string().describe("The next seat (e.g. qa@my-rig)"),
|
|
1605
|
+
body: z.string().optional().describe("The task as the next seat should read it (default: the item's own text)"),
|
|
1606
|
+
note: z.string().optional().describe("Transition note on the item passed on: why it goes there"),
|
|
1607
|
+
summary: z.string().optional().describe("One-line summary for the new item"),
|
|
1608
|
+
tags: z.array(z.string()).optional().describe("Tags for the new item (default: the item's own)"),
|
|
1609
|
+
priority: z.string().optional().describe("Priority for the new item (default: the item's own)"),
|
|
1610
|
+
evidenceRef: z.string().optional().describe("Pointer to the durable artifact, which a new item for a person needs"),
|
|
1611
|
+
}),
|
|
1612
|
+
annotations: DESTRUCTIVE,
|
|
1613
|
+
}, async ({ qitemId, to, body, note, summary, tags, priority, evidenceRef }) => {
|
|
1201
1614
|
if (scope && !scope.session(to))
|
|
1202
1615
|
return outOfScope(`Destination ${to}`);
|
|
1203
1616
|
try {
|
|
@@ -1221,10 +1634,14 @@ export function createMcpServer(client, options = {}) {
|
|
|
1221
1634
|
});
|
|
1222
1635
|
// 36. rig_queue_unclaim — put back an item this seat claimed and won't finish
|
|
1223
1636
|
if (offered("rig_queue_unclaim"))
|
|
1224
|
-
server.
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1637
|
+
server.registerTool("rig_queue_unclaim", {
|
|
1638
|
+
description: "Put back a queue item this seat claimed and won't finish: it returns to pending for its destination seat, ready to be claimed again, and the transition records why. Only a claimed (in-progress) item can be put back. To pass the work to another seat instead, use rig_queue_handoff.",
|
|
1639
|
+
inputSchema: z.object({
|
|
1640
|
+
qitemId: z.string().describe("The claimed queue item to put back"),
|
|
1641
|
+
reason: z.string().optional().describe("Why it's put back, recorded as 'unclaimed: <reason>' (default: manual)"),
|
|
1642
|
+
}),
|
|
1643
|
+
annotations: DESTRUCTIVE,
|
|
1644
|
+
}, async ({ qitemId, reason }) => {
|
|
1228
1645
|
try {
|
|
1229
1646
|
const denied = await itemOutOfScope(qitemId, "owner");
|
|
1230
1647
|
if (denied)
|