@openrig/cli 0.7.3 → 0.7.4
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 +4 -0
- 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 +37 -5
- package/daemon/context-packs/reference/getting-started.md +7 -5
- package/daemon/context-packs/reference/manifest.yaml +1 -1
- package/daemon/context-packs/reference/rig-spec.md +5 -2
- package/daemon/context-packs/reference/whats-new.md +109 -148
- package/daemon/context-packs/skills/agent-operated-software/manifest.yaml +1 -1
- package/daemon/context-packs/skills/agent-operated-workflows/manifest.yaml +1 -1
- package/daemon/context-packs/skills/applying-a-permission-policy/manifest.yaml +1 -1
- package/daemon/context-packs/skills/claude-compaction-restore/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/agent-starters/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/agent-startup-and-context-ingestion/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/cross-host-rig-commands/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/human-in-the-loop/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/messaging-the-human/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/openrig-architect/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/openrig-cmux/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/openrig-herdr/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/openrig-skills/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/openrig-software-factory/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/openrig-upgrade/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/rig-bundles-and-shareable-artifacts/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/rig-lifecycle/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/session-source-fork/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/specification-system/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/topology-mutation-and-seat-management/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/watchdog/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 +4 -0
- 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 +1 -0
- package/daemon/dist/adapters/claude-code-adapter.d.ts.map +1 -1
- package/daemon/dist/adapters/claude-code-adapter.js +17 -4
- 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 +9 -1
- 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 +2 -0
- package/daemon/dist/db/all-migrations.js.map +1 -1
- 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/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/gateway/destination-resolver.d.ts +6 -0
- package/daemon/dist/domain/gateway/destination-resolver.d.ts.map +1 -1
- package/daemon/dist/domain/gateway/destination-resolver.js +8 -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/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/node-inventory.d.ts +1 -1
- package/daemon/dist/domain/node-inventory.d.ts.map +1 -1
- package/daemon/dist/domain/node-inventory.js +10 -5
- 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/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.map +1 -1
- package/daemon/dist/domain/ps-projection.js +3 -2
- package/daemon/dist/domain/ps-projection.js.map +1 -1
- package/daemon/dist/domain/queue-repository.d.ts +15 -1
- package/daemon/dist/domain/queue-repository.d.ts.map +1 -1
- package/daemon/dist/domain/queue-repository.js +66 -10
- 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 +35 -0
- 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-wake-ladder.d.ts +1 -1
- package/daemon/dist/domain/queue-wake-ladder.d.ts.map +1 -1
- package/daemon/dist/domain/queue-wake-ladder.js +2 -1
- 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/rosters.d.ts +46 -0
- package/daemon/dist/domain/rosters.d.ts.map +1 -0
- package/daemon/dist/domain/rosters.js +80 -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/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-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-transport.d.ts +2 -0
- package/daemon/dist/domain/session-transport.d.ts.map +1 -1
- package/daemon/dist/domain/session-transport.js +11 -5
- 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/task-terminal-view.d.ts +50 -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-provider.d.ts +9 -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 +7 -2
- package/daemon/dist/domain/terminal/terminal-service.d.ts.map +1 -1
- package/daemon/dist/domain/terminal/terminal-service.js +25 -3
- package/daemon/dist/domain/terminal/terminal-service.js.map +1 -1
- package/daemon/dist/domain/types.d.ts +7 -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 +4 -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/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/transport.d.ts.map +1 -1
- package/daemon/dist/routes/transport.js +9 -3
- package/daemon/dist/routes/transport.js.map +1 -1
- package/daemon/dist/startup.d.ts.map +1 -1
- package/daemon/dist/startup.js +16 -1
- package/daemon/dist/startup.js.map +1 -1
- 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-presets.md +13 -3
- package/daemon/docs/reference/getting-started.md +7 -5
- package/daemon/docs/reference/help.md +6 -3
- package/daemon/docs/reference/hosted-members.md +110 -0
- package/daemon/docs/reference/quickstart.md +3 -3
- package/daemon/docs/reference/rig-spec.md +5 -2
- package/daemon/docs/reference/rosters.md +6 -0
- package/daemon/docs/reference/terminal-sessions.md +45 -0
- package/daemon/docs/reference/whats-new.md +109 -148
- 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/daemon.d.ts.map +1 -1
- package/dist/commands/daemon.js +6 -1
- package/dist/commands/daemon.js.map +1 -1
- package/dist/commands/mcp.d.ts.map +1 -1
- package/dist/commands/mcp.js +58 -14
- 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/seat.d.ts.map +1 -1
- package/dist/commands/seat.js +41 -0
- package/dist/commands/seat.js.map +1 -1
- package/dist/commands/start.d.ts.map +1 -1
- package/dist/commands/start.js +3 -6
- package/dist/commands/start.js.map +1 -1
- package/dist/commands/terminal.js +1 -1
- package/dist/commands/terminal.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/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 +620 -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/package.json +5 -2
- package/tui/dist/daemon-client.d.ts +2 -1
- package/tui/dist/daemon-client.d.ts.map +1 -1
- package/tui/dist/daemon-client.js +3 -2
- package/tui/dist/daemon-client.js.map +1 -1
- package/tui/dist/hydrate.d.ts.map +1 -1
- package/tui/dist/hydrate.js +7 -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/render.d.ts +6 -0
- package/tui/dist/render.d.ts.map +1 -1
- package/tui/dist/render.js +6 -0
- package/tui/dist/render.js.map +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,30 @@ 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/v1";
|
|
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 the answer in resolution (rig_queue_update), or hand it on (rig_queue_handoff). Listing or reading an item doesn't take it.",
|
|
468
|
+
MEMBER_AUTHORITY,
|
|
469
|
+
"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.",
|
|
470
|
+
"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.",
|
|
471
|
+
"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.",
|
|
472
|
+
"Nothing promises to wake you, so check your inbox again. Then finish the same item; don't open a new one.",
|
|
473
|
+
].join(" ");
|
|
474
|
+
// Short guidance a client may show the model (the server's MCP instructions). An external caller's connection asks the
|
|
475
|
+
// team for work and isn't one of its members, so it isn't given the member workflow.
|
|
476
|
+
const SHARED_INSTRUCTIONS = [
|
|
255
477
|
"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
478
|
"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
479
|
"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
480
|
"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
|
-
]
|
|
481
|
+
];
|
|
482
|
+
const INSTRUCTIONS = [...SHARED_INSTRUCTIONS, MEMBER_WORKFLOW].join("\n");
|
|
483
|
+
const EXTERNAL_INSTRUCTIONS = SHARED_INSTRUCTIONS.join("\n");
|
|
260
484
|
/**
|
|
261
485
|
* Maps a DaemonResponse to MCP tool result.
|
|
262
486
|
* Three error levels: HTTP status, in-body errors, and structural failure fields.
|
|
@@ -299,13 +523,19 @@ export function createMcpServer(client, options = {}) {
|
|
|
299
523
|
const server = new McpServer({
|
|
300
524
|
name: "openrig",
|
|
301
525
|
version: CLI_VERSION,
|
|
302
|
-
}, { instructions: INSTRUCTIONS });
|
|
526
|
+
}, { instructions: options.access?.external ? EXTERNAL_INSTRUCTIONS : INSTRUCTIONS });
|
|
303
527
|
const { access } = options;
|
|
528
|
+
const rostersFolder = options.rostersFolder ?? (() => nodePath.join(new ConfigStore().get("workspace.root"), "rosters"));
|
|
529
|
+
const presenceFile = options.presenceFile ?? (() => mcpPresenceFilePath());
|
|
304
530
|
// The seat this server acts as: the authenticated caller's, else OPENRIG_SESSION_NAME where it was configured.
|
|
305
531
|
const seatOf = () => options.seat ?? readOpenRigEnv("OPENRIG_SESSION_NAME", "RIGGED_SESSION_NAME")?.trim();
|
|
306
532
|
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
|
|
533
|
+
// A local caller (no access) is offered every tool; an authenticated one, its class's; an external caller, its
|
|
534
|
+
// grant's pairs.
|
|
535
|
+
const external = access?.external ? externalTools(access.external.objects) : null;
|
|
308
536
|
const offered = (tool) => {
|
|
537
|
+
if (external)
|
|
538
|
+
return external.has(tool);
|
|
309
539
|
if (!access || access.owner)
|
|
310
540
|
return true;
|
|
311
541
|
const kind = accessClass.get(tool);
|
|
@@ -347,17 +577,21 @@ export function createMcpServer(client, options = {}) {
|
|
|
347
577
|
};
|
|
348
578
|
// 1. rig_up — launch from a spec, bundle or topology, or restore an existing rig by name
|
|
349
579
|
if (offered("rig_up"))
|
|
350
|
-
server.
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
580
|
+
server.registerTool("rig_up", {
|
|
581
|
+
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",
|
|
582
|
+
inputSchema: z.object({
|
|
583
|
+
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."),
|
|
584
|
+
plan: z.boolean().optional().describe("Plan mode — preview without executing"),
|
|
585
|
+
autoApprove: z.boolean().optional().describe("Auto-approve trusted actions"),
|
|
586
|
+
targetRoot: z.string().optional().describe("Target root directory for package installation"),
|
|
587
|
+
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."),
|
|
588
|
+
// The daemon drops the whole env block when any entry is invalid, so check it here the way rig up --env does.
|
|
589
|
+
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."),
|
|
590
|
+
rigName: z.string().min(1).optional().describe("A new launch's rig name instead of the spec's (as rig up --name)"),
|
|
591
|
+
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)"),
|
|
592
|
+
}),
|
|
593
|
+
annotations: DESTRUCTIVE,
|
|
594
|
+
}, async ({ sourceRef, plan, autoApprove, targetRoot, cwd, env, rigName, fresh }) => {
|
|
361
595
|
try {
|
|
362
596
|
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
597
|
return mapResult(res);
|
|
@@ -368,12 +602,16 @@ export function createMcpServer(client, options = {}) {
|
|
|
368
602
|
});
|
|
369
603
|
// 2. rig_down — rig teardown
|
|
370
604
|
if (offered("rig_down"))
|
|
371
|
-
server.
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
605
|
+
server.registerTool("rig_down", {
|
|
606
|
+
description: "Tear down a rig",
|
|
607
|
+
inputSchema: z.object({
|
|
608
|
+
rigId: z.string().describe("Rig name or identifier to tear down"),
|
|
609
|
+
delete: z.boolean().optional().describe("Delete rig record after stopping"),
|
|
610
|
+
force: z.boolean().optional().describe("Kill sessions immediately"),
|
|
611
|
+
snapshot: z.boolean().optional().describe("Take snapshot before teardown"),
|
|
612
|
+
}),
|
|
613
|
+
annotations: DESTRUCTIVE,
|
|
614
|
+
}, async (params) => {
|
|
377
615
|
try {
|
|
378
616
|
const rig = await rigIdFor(client, params.rigId);
|
|
379
617
|
if ("content" in rig)
|
|
@@ -392,7 +630,11 @@ export function createMcpServer(client, options = {}) {
|
|
|
392
630
|
});
|
|
393
631
|
// 3. rig_ps — list running rigs
|
|
394
632
|
if (offered("rig_ps"))
|
|
395
|
-
server.
|
|
633
|
+
server.registerTool("rig_ps", {
|
|
634
|
+
description: "List rigs and their status",
|
|
635
|
+
inputSchema: z.object({}),
|
|
636
|
+
annotations: READ_ONLY,
|
|
637
|
+
}, async () => {
|
|
396
638
|
try {
|
|
397
639
|
const res = await client.get("/api/ps");
|
|
398
640
|
if (scope && res.status < 400 && Array.isArray(res.data))
|
|
@@ -405,7 +647,11 @@ export function createMcpServer(client, options = {}) {
|
|
|
405
647
|
});
|
|
406
648
|
// 4. rig_status — daemon health
|
|
407
649
|
if (offered("rig_status"))
|
|
408
|
-
server.
|
|
650
|
+
server.registerTool("rig_status", {
|
|
651
|
+
description: "Check daemon health",
|
|
652
|
+
inputSchema: z.object({}),
|
|
653
|
+
annotations: READ_ONLY,
|
|
654
|
+
}, async () => {
|
|
409
655
|
try {
|
|
410
656
|
const res = await client.get("/healthz");
|
|
411
657
|
return mapResult(res);
|
|
@@ -416,9 +662,13 @@ export function createMcpServer(client, options = {}) {
|
|
|
416
662
|
});
|
|
417
663
|
// 5. rig_snapshot_create — create snapshot
|
|
418
664
|
if (offered("rig_snapshot_create"))
|
|
419
|
-
server.
|
|
420
|
-
|
|
421
|
-
|
|
665
|
+
server.registerTool("rig_snapshot_create", {
|
|
666
|
+
description: "Create a snapshot for a rig",
|
|
667
|
+
inputSchema: z.object({
|
|
668
|
+
rigId: z.string().describe("Rig name or identifier"),
|
|
669
|
+
}),
|
|
670
|
+
annotations: ADDITIVE,
|
|
671
|
+
}, async ({ rigId }) => {
|
|
422
672
|
try {
|
|
423
673
|
const rig = await rigIdFor(client, rigId);
|
|
424
674
|
if ("content" in rig)
|
|
@@ -432,9 +682,13 @@ export function createMcpServer(client, options = {}) {
|
|
|
432
682
|
});
|
|
433
683
|
// 6. rig_snapshot_list — list snapshots
|
|
434
684
|
if (offered("rig_snapshot_list"))
|
|
435
|
-
server.
|
|
436
|
-
|
|
437
|
-
|
|
685
|
+
server.registerTool("rig_snapshot_list", {
|
|
686
|
+
description: "List snapshots for a rig",
|
|
687
|
+
inputSchema: z.object({
|
|
688
|
+
rigId: z.string().describe("Rig name or identifier"),
|
|
689
|
+
}),
|
|
690
|
+
annotations: READ_ONLY,
|
|
691
|
+
}, async ({ rigId }) => {
|
|
438
692
|
try {
|
|
439
693
|
const rig = await rigIdFor(client, rigId);
|
|
440
694
|
if ("content" in rig)
|
|
@@ -453,10 +707,14 @@ export function createMcpServer(client, options = {}) {
|
|
|
453
707
|
});
|
|
454
708
|
// 7. rig_restore — restore from snapshot
|
|
455
709
|
if (offered("rig_restore"))
|
|
456
|
-
server.
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
710
|
+
server.registerTool("rig_restore", {
|
|
711
|
+
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.",
|
|
712
|
+
inputSchema: z.object({
|
|
713
|
+
rigId: z.string().describe("Rig name or identifier"),
|
|
714
|
+
snapshotId: z.string().describe("Snapshot identifier"),
|
|
715
|
+
}),
|
|
716
|
+
annotations: DESTRUCTIVE,
|
|
717
|
+
}, async ({ rigId, snapshotId }) => {
|
|
460
718
|
try {
|
|
461
719
|
const rig = await rigIdFor(client, rigId);
|
|
462
720
|
if ("content" in rig)
|
|
@@ -470,10 +728,14 @@ export function createMcpServer(client, options = {}) {
|
|
|
470
728
|
});
|
|
471
729
|
// 7b. rig_restore_status — follow a restore attempt rig_restore started
|
|
472
730
|
if (offered("rig_restore_status"))
|
|
473
|
-
server.
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
731
|
+
server.registerTool("rig_restore_status", {
|
|
732
|
+
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.",
|
|
733
|
+
inputSchema: z.object({
|
|
734
|
+
rigId: z.string().describe("Rig name or identifier"),
|
|
735
|
+
attemptId: z.number().int().positive().describe("The attemptId rig_restore returned"),
|
|
736
|
+
}),
|
|
737
|
+
annotations: READ_ONLY,
|
|
738
|
+
}, async ({ rigId, attemptId }) => {
|
|
477
739
|
try {
|
|
478
740
|
const rig = await rigIdFor(client, rigId);
|
|
479
741
|
if ("content" in rig)
|
|
@@ -486,7 +748,11 @@ export function createMcpServer(client, options = {}) {
|
|
|
486
748
|
});
|
|
487
749
|
// 8. rig_discover — scan for sessions
|
|
488
750
|
if (offered("rig_discover"))
|
|
489
|
-
server.
|
|
751
|
+
server.registerTool("rig_discover", {
|
|
752
|
+
description: "Scan for tmux sessions to discover",
|
|
753
|
+
inputSchema: z.object({}),
|
|
754
|
+
annotations: DESTRUCTIVE,
|
|
755
|
+
}, async () => {
|
|
490
756
|
try {
|
|
491
757
|
const res = await client.post("/api/discovery/scan", {});
|
|
492
758
|
return mapResult(res);
|
|
@@ -497,13 +763,17 @@ export function createMcpServer(client, options = {}) {
|
|
|
497
763
|
});
|
|
498
764
|
// 9. rig_bind — bind discovered session to a rig node (existing or new in pod)
|
|
499
765
|
if (offered("rig_bind"))
|
|
500
|
-
server.
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
766
|
+
server.registerTool("rig_bind", {
|
|
767
|
+
description: "Bind a discovered session to an existing node or create a new node in a pod",
|
|
768
|
+
inputSchema: z.object({
|
|
769
|
+
discoveryId: z.string().describe("Discovery session identifier"),
|
|
770
|
+
rigId: z.string().describe("Target rig name or identifier"),
|
|
771
|
+
logicalId: z.string().optional().describe("Existing node logical ID (mode: bind to existing)"),
|
|
772
|
+
podNamespace: z.string().optional().describe("Pod namespace to create node in (mode: create in pod)"),
|
|
773
|
+
memberName: z.string().optional().describe("Member name for new node (required with podNamespace)"),
|
|
774
|
+
}),
|
|
775
|
+
annotations: DESTRUCTIVE,
|
|
776
|
+
}, async ({ discoveryId, rigId, logicalId, podNamespace, memberName }) => {
|
|
507
777
|
try {
|
|
508
778
|
const rig = await rigIdFor(client, rigId);
|
|
509
779
|
if ("content" in rig)
|
|
@@ -524,9 +794,13 @@ export function createMcpServer(client, options = {}) {
|
|
|
524
794
|
});
|
|
525
795
|
// 10. rig_bundle_inspect — inspect a bundle
|
|
526
796
|
if (offered("rig_bundle_inspect"))
|
|
527
|
-
server.
|
|
528
|
-
|
|
529
|
-
|
|
797
|
+
server.registerTool("rig_bundle_inspect", {
|
|
798
|
+
description: "Inspect a .rigbundle file",
|
|
799
|
+
inputSchema: z.object({
|
|
800
|
+
bundlePath: z.string().describe("Path to .rigbundle file"),
|
|
801
|
+
}),
|
|
802
|
+
annotations: READ_ONLY,
|
|
803
|
+
}, async ({ bundlePath }) => {
|
|
530
804
|
try {
|
|
531
805
|
const res = await client.post("/api/bundles/inspect", { bundlePath });
|
|
532
806
|
return mapResult(res, (data) => {
|
|
@@ -545,9 +819,13 @@ export function createMcpServer(client, options = {}) {
|
|
|
545
819
|
});
|
|
546
820
|
// 11. rig_agent_validate — validate an AgentSpec
|
|
547
821
|
if (offered("rig_agent_validate"))
|
|
548
|
-
server.
|
|
549
|
-
|
|
550
|
-
|
|
822
|
+
server.registerTool("rig_agent_validate", {
|
|
823
|
+
description: "Validate an AgentSpec (agent.yaml) from YAML text",
|
|
824
|
+
inputSchema: z.object({
|
|
825
|
+
yaml: z.string().describe("YAML text of the agent spec"),
|
|
826
|
+
}),
|
|
827
|
+
annotations: READ_ONLY,
|
|
828
|
+
}, async ({ yaml }) => {
|
|
551
829
|
try {
|
|
552
830
|
const res = await client.postText("/api/agents/validate", yaml);
|
|
553
831
|
return mapResult(res);
|
|
@@ -558,9 +836,13 @@ export function createMcpServer(client, options = {}) {
|
|
|
558
836
|
});
|
|
559
837
|
// 12. rig_rig_validate — validate a RigSpec
|
|
560
838
|
if (offered("rig_rig_validate"))
|
|
561
|
-
server.
|
|
562
|
-
|
|
563
|
-
|
|
839
|
+
server.registerTool("rig_rig_validate", {
|
|
840
|
+
description: "Validate a RigSpec (rig.yaml) from YAML text",
|
|
841
|
+
inputSchema: z.object({
|
|
842
|
+
yaml: z.string().describe("YAML text of the rig spec"),
|
|
843
|
+
}),
|
|
844
|
+
annotations: READ_ONLY,
|
|
845
|
+
}, async ({ yaml }) => {
|
|
564
846
|
try {
|
|
565
847
|
const res = await client.postText("/api/rigs/import/validate", yaml);
|
|
566
848
|
return mapResult(res);
|
|
@@ -571,9 +853,13 @@ export function createMcpServer(client, options = {}) {
|
|
|
571
853
|
});
|
|
572
854
|
// 13. rig_rig_nodes — node inventory for a rig
|
|
573
855
|
if (offered("rig_rig_nodes"))
|
|
574
|
-
server.
|
|
575
|
-
|
|
576
|
-
|
|
856
|
+
server.registerTool("rig_rig_nodes", {
|
|
857
|
+
description: "Get node inventory for a rig — session names, status, attach commands, resume commands",
|
|
858
|
+
inputSchema: z.object({
|
|
859
|
+
rigId: z.string().describe("Rig name or identifier"),
|
|
860
|
+
}),
|
|
861
|
+
annotations: READ_ONLY,
|
|
862
|
+
}, async ({ rigId }) => {
|
|
577
863
|
try {
|
|
578
864
|
const denied = await rigOutOfScope(rigId);
|
|
579
865
|
if (denied)
|
|
@@ -590,13 +876,17 @@ export function createMcpServer(client, options = {}) {
|
|
|
590
876
|
});
|
|
591
877
|
// 14. rig_send — send message to agent session
|
|
592
878
|
if (offered("rig_send"))
|
|
593
|
-
server.
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
879
|
+
server.registerTool("rig_send", {
|
|
880
|
+
description: "Send a message to an agent's terminal using reliable two-step send",
|
|
881
|
+
inputSchema: z.object({
|
|
882
|
+
session: z.string().describe("Target session name (e.g. dev-impl@my-rig)"),
|
|
883
|
+
text: z.string().describe("Message text to send"),
|
|
884
|
+
verify: z.boolean().optional().describe("Verify delivery by checking pane content"),
|
|
885
|
+
force: z.boolean().optional().describe("Send even if target appears mid-task"),
|
|
886
|
+
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"),
|
|
887
|
+
}),
|
|
888
|
+
annotations: DESTRUCTIVE,
|
|
889
|
+
}, async ({ session, text, verify, force, waitForIdleSeconds }) => {
|
|
600
890
|
try {
|
|
601
891
|
if (force && waitForIdleSeconds !== undefined) {
|
|
602
892
|
const message = "waitForIdleSeconds cannot be combined with force";
|
|
@@ -620,12 +910,16 @@ export function createMcpServer(client, options = {}) {
|
|
|
620
910
|
});
|
|
621
911
|
// 15. rig_capture — capture terminal output from agent session
|
|
622
912
|
if (offered("rig_capture"))
|
|
623
|
-
server.
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
913
|
+
server.registerTool("rig_capture", {
|
|
914
|
+
description: "Capture terminal output from an agent session",
|
|
915
|
+
inputSchema: z.object({
|
|
916
|
+
session: z.string().optional().describe("Session name (omit for multi-target with rig/pod)"),
|
|
917
|
+
rig: z.string().optional().describe("Capture all sessions in a rig"),
|
|
918
|
+
pod: z.string().optional().describe("Capture all sessions in a pod"),
|
|
919
|
+
lines: z.number().optional().describe("Number of lines to capture (default: 20)"),
|
|
920
|
+
}),
|
|
921
|
+
annotations: READ_ONLY,
|
|
922
|
+
}, async ({ session, rig, pod, lines }) => {
|
|
629
923
|
try {
|
|
630
924
|
let rigName = rig;
|
|
631
925
|
if (scope) {
|
|
@@ -661,10 +955,14 @@ export function createMcpServer(client, options = {}) {
|
|
|
661
955
|
});
|
|
662
956
|
// 16. rig_chatroom_send — send message to rig chatroom
|
|
663
957
|
if (offered("rig_chatroom_send"))
|
|
664
|
-
server.
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
958
|
+
server.registerTool("rig_chatroom_send", {
|
|
959
|
+
description: "Send a message to a rig's chatroom as this server's seat",
|
|
960
|
+
inputSchema: z.object({
|
|
961
|
+
rigName: z.string().describe("Rig name or identifier"),
|
|
962
|
+
body: z.string().describe("Message body"),
|
|
963
|
+
}),
|
|
964
|
+
annotations: ADDITIVE,
|
|
965
|
+
}, async ({ rigName, body }) => {
|
|
668
966
|
try {
|
|
669
967
|
const denied = await rigOutOfScope(rigName);
|
|
670
968
|
if (denied)
|
|
@@ -685,12 +983,16 @@ export function createMcpServer(client, options = {}) {
|
|
|
685
983
|
});
|
|
686
984
|
// 17. rig_chatroom_watch — a rig's recent chatroom history (the name is kept; it reads history, it doesn't stream)
|
|
687
985
|
if (offered("rig_chatroom_watch"))
|
|
688
|
-
server.
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
986
|
+
server.registerTool("rig_chatroom_watch", {
|
|
987
|
+
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.",
|
|
988
|
+
inputSchema: z.object({
|
|
989
|
+
rigName: z.string().describe("Rig name or identifier"),
|
|
990
|
+
topic: z.string().optional().describe("Only messages in this topic"),
|
|
991
|
+
sender: z.string().optional().describe("Only messages from this seat"),
|
|
992
|
+
limit: z.number().int().positive().optional().describe("How many recent messages (default 20)"),
|
|
993
|
+
}),
|
|
994
|
+
annotations: READ_ONLY,
|
|
995
|
+
}, async ({ rigName, topic, sender, limit }) => {
|
|
694
996
|
try {
|
|
695
997
|
const denied = await rigOutOfScope(rigName);
|
|
696
998
|
if (denied)
|
|
@@ -714,13 +1016,17 @@ export function createMcpServer(client, options = {}) {
|
|
|
714
1016
|
// converge op). Agent parity for `rig add`: the ergonomics live ON the
|
|
715
1017
|
// converge interface, so every future reshape verb inherits this surface.
|
|
716
1018
|
if (offered("rig_add"))
|
|
717
|
-
server.
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
1019
|
+
server.registerTool("rig_add", {
|
|
1020
|
+
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.",
|
|
1021
|
+
inputSchema: z.object({
|
|
1022
|
+
rigId: z.string().describe("Target rig name or identifier"),
|
|
1023
|
+
podNamespace: z.string().describe("Namespace of the existing pod to add the member to"),
|
|
1024
|
+
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)"),
|
|
1025
|
+
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)"),
|
|
1026
|
+
rigRoot: z.string().optional().describe("Root directory for agent resolution"),
|
|
1027
|
+
}),
|
|
1028
|
+
annotations: ADDITIVE,
|
|
1029
|
+
}, async ({ rigId, podNamespace, member, edges, rigRoot }) => {
|
|
724
1030
|
try {
|
|
725
1031
|
const body = { member };
|
|
726
1032
|
if (edges)
|
|
@@ -748,18 +1054,22 @@ export function createMcpServer(client, options = {}) {
|
|
|
748
1054
|
// DaemonClient, so the identity is configured once, where the server is set up.
|
|
749
1055
|
// 19. rig_queue_create — hand a task to a seat
|
|
750
1056
|
if (offered("rig_queue_create"))
|
|
751
|
-
server.
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
1057
|
+
server.registerTool("rig_queue_create", {
|
|
1058
|
+
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.",
|
|
1059
|
+
inputSchema: z.object({
|
|
1060
|
+
destination: z.string().describe("Destination seat (e.g. dev-impl@my-rig)"),
|
|
1061
|
+
body: z.string().describe("The task: what to do and what to return"),
|
|
1062
|
+
summary: z.string().optional().describe("One-line summary"),
|
|
1063
|
+
tags: z.array(z.string()).optional().describe("Tags, e.g. mission:<name>"),
|
|
1064
|
+
priority: z.string().optional().describe("Priority (as rig queue create --priority)"),
|
|
1065
|
+
tier: z.string().optional().describe("Tier (as rig queue create --tier)"),
|
|
1066
|
+
qitemId: z.string().optional().describe("Request id to reuse when retrying the same create (default: a new id)"),
|
|
1067
|
+
revises: z.string().optional().describe("The qitemId of the work this asks to revise"),
|
|
1068
|
+
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"),
|
|
1069
|
+
}),
|
|
1070
|
+
annotations: ADDITIVE,
|
|
1071
|
+
}, async ({ destination, body, summary, tags, priority, tier, qitemId, revises, alert }) => {
|
|
1072
|
+
if (scope && !scope.destination(destination))
|
|
763
1073
|
return outOfScope(`Destination ${destination}`);
|
|
764
1074
|
// A revision carries its original's lineage as a handoff does: the original's chain, then the original.
|
|
765
1075
|
let lineage;
|
|
@@ -782,11 +1092,21 @@ export function createMcpServer(client, options = {}) {
|
|
|
782
1092
|
const id = qitemId ?? `qitem-${new Date().toISOString().replace(/\D/g, "").slice(0, 14)}-${randomBytes(8).toString("hex")}`;
|
|
783
1093
|
try {
|
|
784
1094
|
const res = await client.post("/api/queue/create", {
|
|
785
|
-
qitemId: id, destinationSession: destination, body: lineage?.body ?? body, summary,
|
|
1095
|
+
qitemId: id, destinationSession: destination, body: lineage?.body ?? body, summary, priority, tier,
|
|
1096
|
+
tags: access?.external ? tags?.filter((tag) => !OPENRIG_PROVENANCE_TAG.test(tag)) : tags,
|
|
786
1097
|
...(alert ? { humanAlert: true } : {}),
|
|
787
1098
|
...(lineage ? { chainOfRecord: lineage.chainOfRecord } : {}),
|
|
788
1099
|
});
|
|
789
|
-
|
|
1100
|
+
// An external caller reusing the id of an item it can't see learns only that the id is taken, never that item's
|
|
1101
|
+
// parties.
|
|
1102
|
+
const conflict = (res.data ?? {});
|
|
1103
|
+
if (scope?.shows && res.status === 409 && conflict.error === "qitem_id_reuse"
|
|
1104
|
+
&& !scope.item({ sourceSession: conflict.existingSource, destinationSession: conflict.existingDestination })) {
|
|
1105
|
+
return mapResult({ status: 409, data: { error: "qitem_id_reuse", message: `qitemId ${id} is already taken. Retry with a new one.` } }, undefined, { structured: true });
|
|
1106
|
+
}
|
|
1107
|
+
// A create's return, a retry's stored row included, goes through the same external projection as show and list.
|
|
1108
|
+
const view = externalView(scope);
|
|
1109
|
+
return mapResult(view && res.status < 400 ? { ...res, data: projectForExternal(res.data, view) } : res, undefined, { structured: true });
|
|
790
1110
|
}
|
|
791
1111
|
catch (err) {
|
|
792
1112
|
const failure = caught(err);
|
|
@@ -796,9 +1116,13 @@ export function createMcpServer(client, options = {}) {
|
|
|
796
1116
|
});
|
|
797
1117
|
// 20. rig_queue_show — one item with its transitions: a delegated task's answer is its own record
|
|
798
1118
|
if (offered("rig_queue_show"))
|
|
799
|
-
server.
|
|
800
|
-
|
|
801
|
-
|
|
1119
|
+
server.registerTool("rig_queue_show", {
|
|
1120
|
+
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.",
|
|
1121
|
+
inputSchema: z.object({
|
|
1122
|
+
qitemId: z.string().describe("The qitemId returned by rig_queue_create (or any queue item)"),
|
|
1123
|
+
}),
|
|
1124
|
+
annotations: READ_ONLY,
|
|
1125
|
+
}, async ({ qitemId }) => {
|
|
802
1126
|
try {
|
|
803
1127
|
const id = encodeURIComponent(qitemId);
|
|
804
1128
|
const item = await client.get(`/api/queue/${id}`);
|
|
@@ -811,10 +1135,14 @@ export function createMcpServer(client, options = {}) {
|
|
|
811
1135
|
return mapResult(transitions);
|
|
812
1136
|
const row = (item.data ?? {});
|
|
813
1137
|
const handedOn = row.state === "handed-off" || row.closureReason === "handed_off_to";
|
|
814
|
-
|
|
815
|
-
|
|
1138
|
+
const view = externalView(scope);
|
|
1139
|
+
let successor = handedOn ? await successorOf(client, qitemId, row.closureTarget, view ? scope.item : undefined) : undefined;
|
|
1140
|
+
if (scope && !view && successor && "destinationSession" in successor && !scope.successor(successor.destinationSession))
|
|
816
1141
|
successor = { unknown: true, code: "out_of_scope" };
|
|
817
|
-
|
|
1142
|
+
const data = view
|
|
1143
|
+
? { item: projectForExternal(item.data, view), transitions: Array.isArray(transitions.data) ? transitions.data.map((t) => projectForExternal(t, view)) : transitions.data }
|
|
1144
|
+
: { item: item.data, transitions: transitions.data };
|
|
1145
|
+
return mapResult({ status: 200, data: { ...data, ...(handedOn ? { successor } : {}) } }, undefined, { structured: true });
|
|
818
1146
|
}
|
|
819
1147
|
catch (err) {
|
|
820
1148
|
return caught(err);
|
|
@@ -822,20 +1150,26 @@ export function createMcpServer(client, options = {}) {
|
|
|
822
1150
|
});
|
|
823
1151
|
// 21. rig_queue_list — list queue items
|
|
824
1152
|
if (offered("rig_queue_list"))
|
|
825
|
-
server.
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
1153
|
+
server.registerTool("rig_queue_list", {
|
|
1154
|
+
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.",
|
|
1155
|
+
inputSchema: z.object({
|
|
1156
|
+
owned: z.boolean().optional().describe("Only items assigned to this seat: its whole inbox (overrides destination)"),
|
|
1157
|
+
mine: z.boolean().optional().describe("Items this seat sent or owns"),
|
|
1158
|
+
destination: z.string().optional().describe("Filter by destination seat"),
|
|
1159
|
+
source: z.string().optional().describe("Filter by source seat"),
|
|
1160
|
+
state: z.string().optional().describe("Only these states, comma-separated; closed states included when named"),
|
|
1161
|
+
all: z.boolean().optional().describe("Without state: include closed items"),
|
|
1162
|
+
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"),
|
|
1163
|
+
handedOffFrom: z.string().optional().describe("The items handed on from this qitemId, in any state and any rig"),
|
|
1164
|
+
limit: z.number().int().positive().optional().describe("Result limit (default 100)"),
|
|
1165
|
+
}),
|
|
1166
|
+
annotations: READ_ONLY,
|
|
1167
|
+
}, async ({ owned, mine: mineAsked, destination, source, state, all, since, handedOffFrom, limit }) => {
|
|
836
1168
|
try {
|
|
837
1169
|
const params = new URLSearchParams();
|
|
838
1170
|
const sessionName = seatOf();
|
|
1171
|
+
// An external caller lists its own items only, so the daemon's limit counts those and not the team's.
|
|
1172
|
+
const mine = mineAsked || (scope?.ownListsOnly === true && !owned);
|
|
839
1173
|
if ((owned || mine) && !sessionName) {
|
|
840
1174
|
const message = "owned and mine need this server's seat: set OPENRIG_SESSION_NAME in its env, or filter by destination or source";
|
|
841
1175
|
return errorResult(JSON.stringify({ ok: false, error: message }), "seat_required", message);
|
|
@@ -877,8 +1211,11 @@ export function createMcpServer(client, options = {}) {
|
|
|
877
1211
|
return errorResult(JSON.stringify({ ok: false, error: message }), "filter_unsupported", message);
|
|
878
1212
|
}
|
|
879
1213
|
// 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
|
-
|
|
1214
|
+
if (scope && res.status < 400 && Array.isArray(res.data)) {
|
|
1215
|
+
const view = externalView(scope);
|
|
1216
|
+
const rows = res.data.filter((row) => scope.item(row));
|
|
1217
|
+
return mapResult({ ...res, data: view ? rows.map((row) => projectForExternal(row, view)) : rows }, undefined, { structured: true });
|
|
1218
|
+
}
|
|
882
1219
|
return mapResult(res, undefined, { structured: true });
|
|
883
1220
|
}
|
|
884
1221
|
catch (err) {
|
|
@@ -887,7 +1224,11 @@ export function createMcpServer(client, options = {}) {
|
|
|
887
1224
|
});
|
|
888
1225
|
// 22. rig_queue_claim — take an item assigned to this seat
|
|
889
1226
|
if (offered("rig_queue_claim"))
|
|
890
|
-
server.
|
|
1227
|
+
server.registerTool("rig_queue_claim", {
|
|
1228
|
+
description: "Claim a queue item assigned to this seat before working on it.",
|
|
1229
|
+
inputSchema: z.object({ qitemId: z.string().describe("The queue item to claim") }),
|
|
1230
|
+
annotations: DESTRUCTIVE,
|
|
1231
|
+
}, async ({ qitemId }) => {
|
|
891
1232
|
try {
|
|
892
1233
|
const denied = await itemOutOfScope(qitemId);
|
|
893
1234
|
if (denied)
|
|
@@ -900,19 +1241,23 @@ export function createMcpServer(client, options = {}) {
|
|
|
900
1241
|
});
|
|
901
1242
|
// 23. rig_queue_update — record progress, block, or close with the answer
|
|
902
1243
|
if (offered("rig_queue_update"))
|
|
903
|
-
server.
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
1244
|
+
server.registerTool("rig_queue_update", {
|
|
1245
|
+
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.",
|
|
1246
|
+
inputSchema: z.object({
|
|
1247
|
+
qitemId: z.string().describe("The queue item to update"),
|
|
1248
|
+
state: z.string().optional().describe("New state (e.g. in-progress, blocked, done)"),
|
|
1249
|
+
closureReason: z.string().optional().describe("Why it closed (as rig queue update --closure-reason)"),
|
|
1250
|
+
closureTarget: z.string().optional().describe("Closure target, when the reason needs one"),
|
|
1251
|
+
note: z.string().optional().describe("Transition note: progress, or why this transition happened (required to reopen)"),
|
|
1252
|
+
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)"),
|
|
1253
|
+
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)"),
|
|
1254
|
+
summary: z.string().optional().describe("Replace the one-line summary"),
|
|
1255
|
+
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"),
|
|
1256
|
+
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)"),
|
|
1257
|
+
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."),
|
|
1258
|
+
}),
|
|
1259
|
+
annotations: DESTRUCTIVE,
|
|
1260
|
+
}, async ({ qitemId, state, closureReason, closureTarget, note, resolution, reopen, summary, evidenceRef, blockedOn, wakeAfterSeconds }) => {
|
|
916
1261
|
try {
|
|
917
1262
|
const denied = await itemOutOfScope(qitemId, "owner");
|
|
918
1263
|
if (denied)
|
|
@@ -927,13 +1272,17 @@ export function createMcpServer(client, options = {}) {
|
|
|
927
1272
|
});
|
|
928
1273
|
// 24. rig_telemetry_events — one bounded page of event metadata, the page `rig telemetry events` reads
|
|
929
1274
|
if (offered("rig_telemetry_events"))
|
|
930
|
-
server.
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
1275
|
+
server.registerTool("rig_telemetry_events", {
|
|
1276
|
+
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.",
|
|
1277
|
+
inputSchema: z.object({
|
|
1278
|
+
cursor: z.string().optional().describe("page.nextCursor from the previous page; not with start"),
|
|
1279
|
+
start: z.enum(["latest", "retained"]).optional().describe("Without a cursor: latest (default) or retained"),
|
|
1280
|
+
rigId: z.string().optional().describe("Rig name or identifier; events with no rig are left out"),
|
|
1281
|
+
nodeId: z.string().optional().describe("Node identifier"),
|
|
1282
|
+
limit: z.number().int().min(1).max(128).optional().describe("Source rows to scan (default and maximum 128); a filter can return fewer"),
|
|
1283
|
+
}),
|
|
1284
|
+
annotations: READ_ONLY,
|
|
1285
|
+
}, async ({ cursor, start, rigId, nodeId, limit }) => {
|
|
937
1286
|
try {
|
|
938
1287
|
const params = new URLSearchParams();
|
|
939
1288
|
if (rigId) {
|
|
@@ -962,7 +1311,11 @@ export function createMcpServer(client, options = {}) {
|
|
|
962
1311
|
});
|
|
963
1312
|
// 26. rig_whoami — which seat this server acts as
|
|
964
1313
|
if (offered("rig_whoami"))
|
|
965
|
-
server.
|
|
1314
|
+
server.registerTool("rig_whoami", {
|
|
1315
|
+
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).",
|
|
1316
|
+
inputSchema: z.object({}),
|
|
1317
|
+
annotations: READ_ONLY,
|
|
1318
|
+
}, async () => {
|
|
966
1319
|
try {
|
|
967
1320
|
const seat = seatOf();
|
|
968
1321
|
if (!seat) {
|
|
@@ -974,6 +1327,14 @@ export function createMcpServer(client, options = {}) {
|
|
|
974
1327
|
if (targetRepo)
|
|
975
1328
|
params.set("targetRepo", targetRepo);
|
|
976
1329
|
const res = await client.get(`/api/whoami?${params.toString()}`);
|
|
1330
|
+
// whoami knows a seat by its session. A hosted member (a tool outside any terminal) has none: the seat is its
|
|
1331
|
+
// grant's, so the authenticated caller is answered with that seat. Read only.
|
|
1332
|
+
if (res.status === 404 && access && !access.external && options.seat === seat) {
|
|
1333
|
+
const at = seat.indexOf("@");
|
|
1334
|
+
const member = { ok: true, seat, rig: at >= 0 ? seat.slice(at + 1) : null, session: null, caller,
|
|
1335
|
+
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." };
|
|
1336
|
+
return { content: [{ type: "text", text: JSON.stringify(member) }], structuredContent: member };
|
|
1337
|
+
}
|
|
977
1338
|
if (res.status >= 400)
|
|
978
1339
|
return mapResult(res);
|
|
979
1340
|
return mapResult({ ...res, data: { ...res.data, caller } }, undefined, { structured: true });
|
|
@@ -984,9 +1345,13 @@ export function createMcpServer(client, options = {}) {
|
|
|
984
1345
|
});
|
|
985
1346
|
// 27. rig_team — a rig's seats and its lead
|
|
986
1347
|
if (offered("rig_team"))
|
|
987
|
-
server.
|
|
988
|
-
|
|
989
|
-
|
|
1348
|
+
server.registerTool("rig_team", {
|
|
1349
|
+
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.",
|
|
1350
|
+
inputSchema: z.object({
|
|
1351
|
+
rigId: z.string().describe("Rig name or identifier"),
|
|
1352
|
+
}),
|
|
1353
|
+
annotations: READ_ONLY,
|
|
1354
|
+
}, async ({ rigId }) => {
|
|
990
1355
|
try {
|
|
991
1356
|
const rig = await rigIdFor(client, rigId);
|
|
992
1357
|
if ("content" in rig)
|
|
@@ -1000,7 +1365,20 @@ export function createMcpServer(client, options = {}) {
|
|
|
1000
1365
|
const nodes = await client.get(`/api/rigs/${id}/nodes`);
|
|
1001
1366
|
if (nodes.status >= 400)
|
|
1002
1367
|
return mapResult(nodes);
|
|
1003
|
-
|
|
1368
|
+
const view = teamView((detail.data ?? {}), nodes.data);
|
|
1369
|
+
const rigName = (detail.data ?? {}).rig?.name ?? "";
|
|
1370
|
+
const inventory = Array.isArray(nodes.data) ? nodes.data : [];
|
|
1371
|
+
// A node is a seat whether or not it has a session yet: its address derives from its logical id (pod.member).
|
|
1372
|
+
const nodeSeats = new Set(inventory.flatMap((seat) => [seat.canonicalSessionName,
|
|
1373
|
+
typeof seat.logicalId === "string" ? `${seat.logicalId.replace(".", "-")}@${rigName}` : null]).filter((name) => typeof name === "string"));
|
|
1374
|
+
const hosted = await hostedMembersOf(rostersFolder(), rigName, nodeSeats, async () => inventory.find((seat) => typeof seat.hostSelfId === "string")?.hostSelfId
|
|
1375
|
+
?? await client.get("/healthz").then((res) => (res.status < 400 ? (res.data ?? {}).selfHostId ?? null : null), () => null), async (seat) => {
|
|
1376
|
+
const rows = await client.get(`/api/queue/list?${new URLSearchParams({ destinationSession: seat, compact: "1", limit: String(PRESENCE_ROWS) }).toString()}`)
|
|
1377
|
+
.then((res) => (res.status < 400 ? res.data : null), () => null);
|
|
1378
|
+
return { lastCallAt: readPresence(presenceFile())[seat]?.lastCallAt ?? null, lastWake: newestWake(rows, seat),
|
|
1379
|
+
lastWakeScope: `the latest ring among its ${PRESENCE_ROWS} most recent rows` };
|
|
1380
|
+
});
|
|
1381
|
+
return mapResult({ status: 200, data: { ...view, hostedMembers: hosted.members, ...(hosted.note ? { hostedMembersNote: hosted.note } : {}) } }, undefined, { structured: true });
|
|
1004
1382
|
}
|
|
1005
1383
|
catch (err) {
|
|
1006
1384
|
return caught(err);
|
|
@@ -1008,11 +1386,15 @@ export function createMcpServer(client, options = {}) {
|
|
|
1008
1386
|
});
|
|
1009
1387
|
// 28. rig_slices — the work tree's slices, as summaries
|
|
1010
1388
|
if (offered("rig_slices"))
|
|
1011
|
-
server.
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1389
|
+
server.registerTool("rig_slices", {
|
|
1390
|
+
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.",
|
|
1391
|
+
inputSchema: z.object({
|
|
1392
|
+
missionId: z.string().optional().describe("Only this mission's slices"),
|
|
1393
|
+
filter: z.enum(["all", "active", "done", "blocked"]).optional().describe("Only slices with this status (default all)"),
|
|
1394
|
+
limit: z.number().int().positive().max(200).optional().describe("Most slices to return (default 50)"),
|
|
1395
|
+
}),
|
|
1396
|
+
annotations: READ_ONLY,
|
|
1397
|
+
}, async ({ missionId, filter, limit }) => {
|
|
1016
1398
|
try {
|
|
1017
1399
|
const res = await client.get(`/api/slices${filter ? `?${new URLSearchParams({ filter }).toString()}` : ""}`);
|
|
1018
1400
|
if (res.status >= 400)
|
|
@@ -1027,9 +1409,13 @@ export function createMcpServer(client, options = {}) {
|
|
|
1027
1409
|
});
|
|
1028
1410
|
// 29. rig_mission — one mission's status and slices
|
|
1029
1411
|
if (offered("rig_mission"))
|
|
1030
|
-
server.
|
|
1031
|
-
|
|
1032
|
-
|
|
1412
|
+
server.registerTool("rig_mission", {
|
|
1413
|
+
description: "Read one mission: its status and its slices as summaries.",
|
|
1414
|
+
inputSchema: z.object({
|
|
1415
|
+
missionId: z.string().describe("The mission's id (its folder name)"),
|
|
1416
|
+
}),
|
|
1417
|
+
annotations: READ_ONLY,
|
|
1418
|
+
}, async ({ missionId }) => {
|
|
1033
1419
|
try {
|
|
1034
1420
|
const res = await client.get(`/api/missions/${encodeURIComponent(missionId)}`);
|
|
1035
1421
|
if (res.status >= 400)
|
|
@@ -1043,9 +1429,13 @@ export function createMcpServer(client, options = {}) {
|
|
|
1043
1429
|
});
|
|
1044
1430
|
// 30. rig_context_pack — one context pack's files
|
|
1045
1431
|
if (offered("rig_context_pack"))
|
|
1046
|
-
server.
|
|
1047
|
-
|
|
1048
|
-
|
|
1432
|
+
server.registerTool("rig_context_pack", {
|
|
1433
|
+
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>.",
|
|
1434
|
+
inputSchema: z.object({
|
|
1435
|
+
ref: z.string().describe("The pack's ref, as rig context list shows it (e.g. project-world)"),
|
|
1436
|
+
}),
|
|
1437
|
+
annotations: READ_ONLY,
|
|
1438
|
+
}, async ({ ref }) => {
|
|
1049
1439
|
try {
|
|
1050
1440
|
const res = await client.get(`/api/context-packs/library/by-ref?${new URLSearchParams({ ref }).toString()}`);
|
|
1051
1441
|
if (res.status >= 400)
|
|
@@ -1062,9 +1452,13 @@ export function createMcpServer(client, options = {}) {
|
|
|
1062
1452
|
});
|
|
1063
1453
|
// 31. rig_context_get — one context file or section, as rig context get reads it
|
|
1064
1454
|
if (offered("rig_context_get"))
|
|
1065
|
-
server.
|
|
1066
|
-
|
|
1067
|
-
|
|
1455
|
+
server.registerTool("rig_context_get", {
|
|
1456
|
+
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.`,
|
|
1457
|
+
inputSchema: z.object({
|
|
1458
|
+
address: z.string().describe("<pack>/<file>[#<h2-slug>[/<h3-slug>]]"),
|
|
1459
|
+
}),
|
|
1460
|
+
annotations: READ_ONLY,
|
|
1461
|
+
}, async ({ address }) => {
|
|
1068
1462
|
try {
|
|
1069
1463
|
const res = await client.get(`/api/context-packs/library/resolve-address?${new URLSearchParams({ address }).toString()}`);
|
|
1070
1464
|
if (res.status >= 400)
|
|
@@ -1085,12 +1479,16 @@ export function createMcpServer(client, options = {}) {
|
|
|
1085
1479
|
});
|
|
1086
1480
|
// 32. rig_artifact_read — a result's artifact, read through the daemon's shared roots
|
|
1087
1481
|
if (offered("rig_artifact_read"))
|
|
1088
|
-
server.
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1482
|
+
server.registerTool("rig_artifact_read", {
|
|
1483
|
+
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.`,
|
|
1484
|
+
inputSchema: z.object({
|
|
1485
|
+
qitemId: z.string().optional().describe("Read this item's evidenceRef"),
|
|
1486
|
+
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"),
|
|
1487
|
+
path: z.string().optional().describe("With root: the file's path inside that root"),
|
|
1488
|
+
offset: z.number().int().min(0).optional().describe("The character to start from (default 0)"),
|
|
1489
|
+
}),
|
|
1490
|
+
annotations: READ_ONLY,
|
|
1491
|
+
}, async ({ qitemId, root, path, offset }) => {
|
|
1094
1492
|
try {
|
|
1095
1493
|
const read = async (source, rootName, inside) => {
|
|
1096
1494
|
const res = await client.get(`/api/files/read?${new URLSearchParams({ root: rootName, path: inside }).toString()}`);
|
|
@@ -1100,6 +1498,8 @@ export function createMcpServer(client, options = {}) {
|
|
|
1100
1498
|
};
|
|
1101
1499
|
if (scope && root && !scope.root(root))
|
|
1102
1500
|
return outOfScope(`Root ${root}`);
|
|
1501
|
+
if (scope && !scope.paths && !qitemId)
|
|
1502
|
+
return outOfScope("A file named by root and path");
|
|
1103
1503
|
if (!qitemId) {
|
|
1104
1504
|
if (root && path)
|
|
1105
1505
|
return await read("path", root, path);
|
|
@@ -1109,7 +1509,7 @@ export function createMcpServer(client, options = {}) {
|
|
|
1109
1509
|
const item = await client.get(`/api/queue/${encodeURIComponent(qitemId)}`);
|
|
1110
1510
|
if (item.status >= 400)
|
|
1111
1511
|
return mapResult(item);
|
|
1112
|
-
if (scope && !scope.
|
|
1512
|
+
if (scope && !scope.artifact(item.data))
|
|
1113
1513
|
return outOfScope(`Item ${qitemId}`);
|
|
1114
1514
|
const ref = (item.data ?? {}).evidenceRef;
|
|
1115
1515
|
const rootsRes = await client.get("/api/files/roots");
|
|
@@ -1139,9 +1539,13 @@ export function createMcpServer(client, options = {}) {
|
|
|
1139
1539
|
});
|
|
1140
1540
|
// 33. rig_human_decision_room — before deciding a question asked of a person: the room their mode gives the team
|
|
1141
1541
|
if (offered("rig_human_decision_room"))
|
|
1142
|
-
server.
|
|
1143
|
-
|
|
1144
|
-
|
|
1542
|
+
server.registerTool("rig_human_decision_room", {
|
|
1543
|
+
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.",
|
|
1544
|
+
inputSchema: z.object({
|
|
1545
|
+
qitemId: z.string().describe("Your pending ask to the person (a queue item addressed to <person>@external)"),
|
|
1546
|
+
}),
|
|
1547
|
+
annotations: READ_ONLY,
|
|
1548
|
+
}, async ({ qitemId }) => {
|
|
1145
1549
|
try {
|
|
1146
1550
|
const item = await client.get(`/api/queue/${encodeURIComponent(qitemId)}`);
|
|
1147
1551
|
if (item.status >= 400)
|
|
@@ -1166,16 +1570,20 @@ export function createMcpServer(client, options = {}) {
|
|
|
1166
1570
|
});
|
|
1167
1571
|
// 34. rig_queue_decide — a decision made on a person's behalf, inside their decision room, beside their answers
|
|
1168
1572
|
if (offered("rig_queue_decide"))
|
|
1169
|
-
server.
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1573
|
+
server.registerTool("rig_queue_decide", {
|
|
1574
|
+
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.",
|
|
1575
|
+
inputSchema: z.object({
|
|
1576
|
+
qitemId: z.string().describe("Your pending ask to the person"),
|
|
1577
|
+
applicationId: z.string().describe("decisionRoom.applicationId from rig_human_decision_room: the room you judged against"),
|
|
1578
|
+
choices: z.array(z.object({
|
|
1579
|
+
questionId: z.string().optional().describe("The question's id, when the ask has structured questions"),
|
|
1580
|
+
chosen: z.string().describe("The option's id; for an ask without questions, the choice in words"),
|
|
1581
|
+
})).describe("One choice per structured question; for an ask without questions, one choice without questionId"),
|
|
1582
|
+
reason: z.string().describe("Why this choice"),
|
|
1583
|
+
reversible: z.boolean().describe("Whether the decision can be undone"),
|
|
1584
|
+
}),
|
|
1585
|
+
annotations: DESTRUCTIVE,
|
|
1586
|
+
}, async ({ qitemId, applicationId, choices, reason, reversible }) => {
|
|
1179
1587
|
try {
|
|
1180
1588
|
const denied = await itemOutOfScope(qitemId);
|
|
1181
1589
|
if (denied)
|
|
@@ -1188,16 +1596,20 @@ export function createMcpServer(client, options = {}) {
|
|
|
1188
1596
|
});
|
|
1189
1597
|
// 35. rig_queue_handoff — pass an item on to the next seat in one step, the route `rig queue handoff` uses
|
|
1190
1598
|
if (offered("rig_queue_handoff"))
|
|
1191
|
-
server.
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1599
|
+
server.registerTool("rig_queue_handoff", {
|
|
1600
|
+
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.",
|
|
1601
|
+
inputSchema: z.object({
|
|
1602
|
+
qitemId: z.string().describe("The queue item to pass on"),
|
|
1603
|
+
to: z.string().describe("The next seat (e.g. qa@my-rig)"),
|
|
1604
|
+
body: z.string().optional().describe("The task as the next seat should read it (default: the item's own text)"),
|
|
1605
|
+
note: z.string().optional().describe("Transition note on the item passed on: why it goes there"),
|
|
1606
|
+
summary: z.string().optional().describe("One-line summary for the new item"),
|
|
1607
|
+
tags: z.array(z.string()).optional().describe("Tags for the new item (default: the item's own)"),
|
|
1608
|
+
priority: z.string().optional().describe("Priority for the new item (default: the item's own)"),
|
|
1609
|
+
evidenceRef: z.string().optional().describe("Pointer to the durable artifact, which a new item for a person needs"),
|
|
1610
|
+
}),
|
|
1611
|
+
annotations: DESTRUCTIVE,
|
|
1612
|
+
}, async ({ qitemId, to, body, note, summary, tags, priority, evidenceRef }) => {
|
|
1201
1613
|
if (scope && !scope.session(to))
|
|
1202
1614
|
return outOfScope(`Destination ${to}`);
|
|
1203
1615
|
try {
|
|
@@ -1221,10 +1633,14 @@ export function createMcpServer(client, options = {}) {
|
|
|
1221
1633
|
});
|
|
1222
1634
|
// 36. rig_queue_unclaim — put back an item this seat claimed and won't finish
|
|
1223
1635
|
if (offered("rig_queue_unclaim"))
|
|
1224
|
-
server.
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1636
|
+
server.registerTool("rig_queue_unclaim", {
|
|
1637
|
+
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.",
|
|
1638
|
+
inputSchema: z.object({
|
|
1639
|
+
qitemId: z.string().describe("The claimed queue item to put back"),
|
|
1640
|
+
reason: z.string().optional().describe("Why it's put back, recorded as 'unclaimed: <reason>' (default: manual)"),
|
|
1641
|
+
}),
|
|
1642
|
+
annotations: DESTRUCTIVE,
|
|
1643
|
+
}, async ({ qitemId, reason }) => {
|
|
1228
1644
|
try {
|
|
1229
1645
|
const denied = await itemOutOfScope(qitemId, "owner");
|
|
1230
1646
|
if (denied)
|