@openrig/cli 0.7.15 → 0.7.17

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.
Files changed (603) hide show
  1. package/README.md +9 -9
  2. package/daemon/assets/onboarding/02-self-and-competent-action.md +5 -41
  3. package/daemon/assets/plugins/openrig/.claude-plugin/plugin.json +1 -1
  4. package/daemon/assets/plugins/openrig/.codex-plugin/plugin.json +1 -1
  5. package/daemon/assets/plugins/openrig/.cursor-plugin/plugin.json +1 -1
  6. package/daemon/assets/plugins/openrig/README.md +26 -7
  7. package/daemon/assets/plugins/openrig/plugin.json +1 -1
  8. package/daemon/assets/plugins/openrig/skills/working-with-an-openrig-team/SKILL.md +22 -6
  9. package/daemon/assets/plugins/openrig-core/.claude-plugin/plugin.json +1 -1
  10. package/daemon/assets/plugins/openrig-core/.codex-plugin/plugin.json +1 -1
  11. package/daemon/assets/plugins/openrig-core/skills/claude-compaction-restore/SKILL.md +4 -1
  12. package/daemon/assets/plugins/openrig-core/skills/seat-continuity-and-handover/SKILL.md +1 -1
  13. package/daemon/assets/skills/rigs/SKILL.md +155 -41
  14. package/daemon/assets/skills/rigs/references/installing-for-someone.md +47 -0
  15. package/daemon/context-packs/help/manifest.yaml +1 -1
  16. package/daemon/context-packs/onboarding-width/manifest.yaml +1 -1
  17. package/daemon/context-packs/onboarding-width/public-what-you-can-do.md +169 -40
  18. package/daemon/context-packs/reference/getting-started.md +12 -11
  19. package/daemon/context-packs/reference/manifest.yaml +4 -1
  20. package/daemon/context-packs/reference/product-journey-sdlc.md +348 -0
  21. package/daemon/context-packs/reference/rig-spec.md +92 -4
  22. package/daemon/context-packs/reference/whats-new.md +397 -5
  23. package/daemon/context-packs/skills/agent-operated-software/manifest.yaml +1 -1
  24. package/daemon/context-packs/skills/agent-operated-workflows/manifest.yaml +1 -1
  25. package/daemon/context-packs/skills/applying-a-permission-policy/manifest.yaml +1 -1
  26. package/daemon/context-packs/skills/claude-compaction-restore/SKILL.md +4 -1
  27. package/daemon/context-packs/skills/claude-compaction-restore/manifest.yaml +1 -1
  28. package/daemon/context-packs/skills/core/agent-starters/manifest.yaml +1 -1
  29. package/daemon/context-packs/skills/core/agent-startup-and-context-ingestion/manifest.yaml +1 -1
  30. package/daemon/context-packs/skills/core/cross-host-rig-commands/manifest.yaml +1 -1
  31. package/daemon/context-packs/skills/core/human-in-the-loop/manifest.yaml +1 -1
  32. package/daemon/context-packs/skills/core/messaging-the-human/manifest.yaml +1 -1
  33. package/daemon/context-packs/skills/core/openrig-architect/manifest.yaml +1 -1
  34. package/daemon/context-packs/skills/core/openrig-cmux/manifest.yaml +1 -1
  35. package/daemon/context-packs/skills/core/openrig-herdr/manifest.yaml +1 -1
  36. package/daemon/context-packs/skills/core/openrig-skills/manifest.yaml +1 -1
  37. package/daemon/context-packs/skills/core/openrig-software-factory/manifest.yaml +1 -1
  38. package/daemon/context-packs/skills/core/openrig-software-factory/references/worked-example.md +1 -1
  39. package/daemon/context-packs/skills/core/openrig-upgrade/SKILL.md +2 -0
  40. package/daemon/context-packs/skills/core/openrig-upgrade/manifest.yaml +1 -1
  41. package/daemon/context-packs/skills/core/rig-bundles-and-shareable-artifacts/manifest.yaml +1 -1
  42. package/daemon/context-packs/skills/core/rig-lifecycle/manifest.yaml +1 -1
  43. package/daemon/context-packs/skills/core/session-source-fork/manifest.yaml +1 -1
  44. package/daemon/context-packs/skills/core/specification-system/manifest.yaml +1 -1
  45. package/daemon/context-packs/skills/core/topology-mutation-and-seat-management/manifest.yaml +1 -1
  46. package/daemon/context-packs/skills/core/watchdog/manifest.yaml +1 -1
  47. package/daemon/context-packs/skills/core/working-with-an-openrig-team/SKILL.md +22 -6
  48. package/daemon/context-packs/skills/core/working-with-an-openrig-team/manifest.yaml +1 -1
  49. package/daemon/context-packs/skills/delegating-work/manifest.yaml +1 -1
  50. package/daemon/context-packs/skills/forming-an-openrig-mental-model/manifest.yaml +1 -1
  51. package/daemon/context-packs/skills/loading-addressable-markdown/manifest.yaml +1 -1
  52. package/daemon/context-packs/skills/mission-slice-sop/manifest.yaml +1 -1
  53. package/daemon/context-packs/skills/openrig-operating-model/manifest.yaml +1 -1
  54. package/daemon/context-packs/skills/openrig-user/manifest.yaml +1 -1
  55. package/daemon/context-packs/skills/orienting-to-an-inherited-seat/manifest.yaml +1 -1
  56. package/daemon/context-packs/skills/pm/backlog-capture/manifest.yaml +1 -1
  57. package/daemon/context-packs/skills/pm/context-builder/manifest.yaml +1 -1
  58. package/daemon/context-packs/skills/pm/exec-summary/manifest.yaml +1 -1
  59. package/daemon/context-packs/skills/pm/office-hours/manifest.yaml +1 -1
  60. package/daemon/context-packs/skills/pm/plan-review/manifest.yaml +1 -1
  61. package/daemon/context-packs/skills/pm/requirements-writer/manifest.yaml +1 -1
  62. package/daemon/context-packs/skills/pm/ui-mockup/manifest.yaml +1 -1
  63. package/daemon/context-packs/skills/pods/development-team/manifest.yaml +1 -1
  64. package/daemon/context-packs/skills/pods/orchestration-team/manifest.yaml +1 -1
  65. package/daemon/context-packs/skills/pods/oversight-team/manifest.yaml +1 -1
  66. package/daemon/context-packs/skills/pods/review-team/manifest.yaml +1 -1
  67. package/daemon/context-packs/skills/process/agent-browser/manifest.yaml +1 -1
  68. package/daemon/context-packs/skills/process/context-engineering/manifest.yaml +1 -1
  69. package/daemon/context-packs/skills/process/dogfood/manifest.yaml +1 -1
  70. package/daemon/context-packs/skills/process/frontend-design/manifest.yaml +1 -1
  71. package/daemon/context-packs/skills/process/systematic-debugging/manifest.yaml +1 -1
  72. package/daemon/context-packs/skills/process/test-driven-development/manifest.yaml +1 -1
  73. package/daemon/context-packs/skills/process/verification-before-completion/manifest.yaml +1 -1
  74. package/daemon/context-packs/skills/queue-handoff/manifest.yaml +1 -1
  75. package/daemon/context-packs/skills/refocusing/manifest.yaml +1 -1
  76. package/daemon/context-packs/skills/retiring-and-inheriting-a-seat/manifest.yaml +1 -1
  77. package/daemon/context-packs/skills/seat-continuity-and-handover/SKILL.md +1 -1
  78. package/daemon/context-packs/skills/seat-continuity-and-handover/manifest.yaml +1 -1
  79. package/daemon/context-packs/skills/session-compaction-and-restore/manifest.yaml +1 -1
  80. package/daemon/context-packs/skills/software-for-agents/manifest.yaml +1 -1
  81. package/daemon/context-packs/world-example/manifest.yaml +1 -1
  82. package/daemon/context-packs/world-public/manifest.yaml +1 -1
  83. package/daemon/dist/adapters/claude-code-adapter.d.ts.map +1 -1
  84. package/daemon/dist/adapters/claude-code-adapter.js +42 -6
  85. package/daemon/dist/adapters/claude-code-adapter.js.map +1 -1
  86. package/daemon/dist/adapters/claude-resume.d.ts.map +1 -1
  87. package/daemon/dist/adapters/claude-resume.js +4 -2
  88. package/daemon/dist/adapters/claude-resume.js.map +1 -1
  89. package/daemon/dist/adapters/codex-resume.d.ts +2 -0
  90. package/daemon/dist/adapters/codex-resume.d.ts.map +1 -1
  91. package/daemon/dist/adapters/codex-resume.js +28 -11
  92. package/daemon/dist/adapters/codex-resume.js.map +1 -1
  93. package/daemon/dist/adapters/codex-runtime-adapter.d.ts +15 -0
  94. package/daemon/dist/adapters/codex-runtime-adapter.d.ts.map +1 -1
  95. package/daemon/dist/adapters/codex-runtime-adapter.js +75 -28
  96. package/daemon/dist/adapters/codex-runtime-adapter.js.map +1 -1
  97. package/daemon/dist/adapters/openshell-driver.d.ts +1 -0
  98. package/daemon/dist/adapters/openshell-driver.d.ts.map +1 -1
  99. package/daemon/dist/adapters/openshell-driver.js +3 -0
  100. package/daemon/dist/adapters/openshell-driver.js.map +1 -1
  101. package/daemon/dist/adapters/openshell-podman-observer.d.ts +9 -7
  102. package/daemon/dist/adapters/openshell-podman-observer.d.ts.map +1 -1
  103. package/daemon/dist/adapters/openshell-podman-observer.js +20 -3
  104. package/daemon/dist/adapters/openshell-podman-observer.js.map +1 -1
  105. package/daemon/dist/adapters/pi-runner.d.ts +38 -4
  106. package/daemon/dist/adapters/pi-runner.d.ts.map +1 -1
  107. package/daemon/dist/adapters/pi-runner.js +244 -30
  108. package/daemon/dist/adapters/pi-runner.js.map +1 -1
  109. package/daemon/dist/adapters/tmux.d.ts +6 -0
  110. package/daemon/dist/adapters/tmux.d.ts.map +1 -1
  111. package/daemon/dist/adapters/tmux.js +17 -3
  112. package/daemon/dist/adapters/tmux.js.map +1 -1
  113. package/daemon/dist/build-info.js +3 -3
  114. package/daemon/dist/db/all-migrations.d.ts.map +1 -1
  115. package/daemon/dist/db/all-migrations.js +8 -0
  116. package/daemon/dist/db/all-migrations.js.map +1 -1
  117. package/daemon/dist/db/migrations/167_seat_handover_attempts.d.ts +14 -0
  118. package/daemon/dist/db/migrations/167_seat_handover_attempts.d.ts.map +1 -0
  119. package/daemon/dist/db/migrations/167_seat_handover_attempts.js +54 -0
  120. package/daemon/dist/db/migrations/167_seat_handover_attempts.js.map +1 -0
  121. package/daemon/dist/db/migrations/168_context_usage_occupant_generation.d.ts +6 -0
  122. package/daemon/dist/db/migrations/168_context_usage_occupant_generation.d.ts.map +1 -0
  123. package/daemon/dist/db/migrations/168_context_usage_occupant_generation.js +10 -0
  124. package/daemon/dist/db/migrations/168_context_usage_occupant_generation.js.map +1 -0
  125. package/daemon/dist/db/migrations/169_seat_runtime_home_records.d.ts +5 -0
  126. package/daemon/dist/db/migrations/169_seat_runtime_home_records.d.ts.map +1 -0
  127. package/daemon/dist/db/migrations/169_seat_runtime_home_records.js +25 -0
  128. package/daemon/dist/db/migrations/169_seat_runtime_home_records.js.map +1 -0
  129. package/daemon/dist/db/migrations/170_rig_delivery_drains.d.ts +3 -0
  130. package/daemon/dist/db/migrations/170_rig_delivery_drains.d.ts.map +1 -0
  131. package/daemon/dist/db/migrations/170_rig_delivery_drains.js +21 -0
  132. package/daemon/dist/db/migrations/170_rig_delivery_drains.js.map +1 -0
  133. package/daemon/dist/domain/claim-service.d.ts +1 -3
  134. package/daemon/dist/domain/claim-service.d.ts.map +1 -1
  135. package/daemon/dist/domain/claim-service.js +3 -1
  136. package/daemon/dist/domain/claim-service.js.map +1 -1
  137. package/daemon/dist/domain/claude-compaction-enforcer.d.ts +11 -0
  138. package/daemon/dist/domain/claude-compaction-enforcer.d.ts.map +1 -1
  139. package/daemon/dist/domain/claude-compaction-enforcer.js +83 -36
  140. package/daemon/dist/domain/claude-compaction-enforcer.js.map +1 -1
  141. package/daemon/dist/domain/codex-filesystem-preflight.d.ts +33 -0
  142. package/daemon/dist/domain/codex-filesystem-preflight.d.ts.map +1 -0
  143. package/daemon/dist/domain/codex-filesystem-preflight.js +255 -0
  144. package/daemon/dist/domain/codex-filesystem-preflight.js.map +1 -0
  145. package/daemon/dist/domain/codex-member-permissions.d.ts +23 -2
  146. package/daemon/dist/domain/codex-member-permissions.d.ts.map +1 -1
  147. package/daemon/dist/domain/codex-member-permissions.js +55 -9
  148. package/daemon/dist/domain/codex-member-permissions.js.map +1 -1
  149. package/daemon/dist/domain/codex-network-default.d.ts +13 -0
  150. package/daemon/dist/domain/codex-network-default.d.ts.map +1 -1
  151. package/daemon/dist/domain/codex-network-default.js +37 -30
  152. package/daemon/dist/domain/codex-network-default.js.map +1 -1
  153. package/daemon/dist/domain/codex-thread-id.d.ts +13 -0
  154. package/daemon/dist/domain/codex-thread-id.d.ts.map +1 -1
  155. package/daemon/dist/domain/codex-thread-id.js +132 -9
  156. package/daemon/dist/domain/codex-thread-id.js.map +1 -1
  157. package/daemon/dist/domain/compaction-restore-notice.d.ts.map +1 -1
  158. package/daemon/dist/domain/compaction-restore-notice.js +59 -13
  159. package/daemon/dist/domain/compaction-restore-notice.js.map +1 -1
  160. package/daemon/dist/domain/connection-contract.d.ts.map +1 -1
  161. package/daemon/dist/domain/connection-contract.js +2 -1
  162. package/daemon/dist/domain/connection-contract.js.map +1 -1
  163. package/daemon/dist/domain/context-usage-store.d.ts +11 -2
  164. package/daemon/dist/domain/context-usage-store.d.ts.map +1 -1
  165. package/daemon/dist/domain/context-usage-store.js +33 -13
  166. package/daemon/dist/domain/context-usage-store.js.map +1 -1
  167. package/daemon/dist/domain/current-work.d.ts +5 -0
  168. package/daemon/dist/domain/current-work.d.ts.map +1 -1
  169. package/daemon/dist/domain/current-work.js +66 -4
  170. package/daemon/dist/domain/current-work.js.map +1 -1
  171. package/daemon/dist/domain/destination-successor.d.ts +3 -0
  172. package/daemon/dist/domain/destination-successor.d.ts.map +1 -0
  173. package/daemon/dist/domain/destination-successor.js +49 -0
  174. package/daemon/dist/domain/destination-successor.js.map +1 -0
  175. package/daemon/dist/domain/environment-lifecycle.d.ts +15 -0
  176. package/daemon/dist/domain/environment-lifecycle.d.ts.map +1 -1
  177. package/daemon/dist/domain/environment-lifecycle.js +22 -4
  178. package/daemon/dist/domain/environment-lifecycle.js.map +1 -1
  179. package/daemon/dist/domain/expected-conversation.d.ts.map +1 -1
  180. package/daemon/dist/domain/expected-conversation.js +26 -11
  181. package/daemon/dist/domain/expected-conversation.js.map +1 -1
  182. package/daemon/dist/domain/gateway/destination-resolver.d.ts +4 -0
  183. package/daemon/dist/domain/gateway/destination-resolver.d.ts.map +1 -1
  184. package/daemon/dist/domain/gateway/destination-resolver.js +10 -3
  185. package/daemon/dist/domain/gateway/destination-resolver.js.map +1 -1
  186. package/daemon/dist/domain/gateway/operator-delivery-engine.d.ts +3 -1
  187. package/daemon/dist/domain/gateway/operator-delivery-engine.d.ts.map +1 -1
  188. package/daemon/dist/domain/gateway/operator-delivery-engine.js +14 -4
  189. package/daemon/dist/domain/gateway/operator-delivery-engine.js.map +1 -1
  190. package/daemon/dist/domain/health-diagnosis.d.ts.map +1 -1
  191. package/daemon/dist/domain/health-diagnosis.js +4 -0
  192. package/daemon/dist/domain/health-diagnosis.js.map +1 -1
  193. package/daemon/dist/domain/health-passive-ceremony.d.ts +3 -0
  194. package/daemon/dist/domain/health-passive-ceremony.d.ts.map +1 -1
  195. package/daemon/dist/domain/health-passive-ceremony.js +45 -4
  196. package/daemon/dist/domain/health-passive-ceremony.js.map +1 -1
  197. package/daemon/dist/domain/hosts/fleet-scopes.d.ts +111 -0
  198. package/daemon/dist/domain/hosts/fleet-scopes.d.ts.map +1 -0
  199. package/daemon/dist/domain/hosts/fleet-scopes.js +231 -0
  200. package/daemon/dist/domain/hosts/fleet-scopes.js.map +1 -0
  201. package/daemon/dist/domain/hosts/read-through.d.ts +1 -1
  202. package/daemon/dist/domain/hosts/read-through.d.ts.map +1 -1
  203. package/daemon/dist/domain/hosts/read-through.js +4 -0
  204. package/daemon/dist/domain/hosts/read-through.js.map +1 -1
  205. package/daemon/dist/domain/mission-control/mission-control-write-contract.d.ts.map +1 -1
  206. package/daemon/dist/domain/mission-control/mission-control-write-contract.js +1 -1
  207. package/daemon/dist/domain/mission-control/mission-control-write-contract.js.map +1 -1
  208. package/daemon/dist/domain/native-model-picker.d.ts +2 -0
  209. package/daemon/dist/domain/native-model-picker.d.ts.map +1 -1
  210. package/daemon/dist/domain/native-model-picker.js +8 -2
  211. package/daemon/dist/domain/native-model-picker.js.map +1 -1
  212. package/daemon/dist/domain/native-permission-store.d.ts.map +1 -1
  213. package/daemon/dist/domain/native-permission-store.js +12 -5
  214. package/daemon/dist/domain/native-permission-store.js.map +1 -1
  215. package/daemon/dist/domain/native-process-lineage.d.ts +11 -1
  216. package/daemon/dist/domain/native-process-lineage.d.ts.map +1 -1
  217. package/daemon/dist/domain/native-process-lineage.js +25 -4
  218. package/daemon/dist/domain/native-process-lineage.js.map +1 -1
  219. package/daemon/dist/domain/native-resume-probe.d.ts.map +1 -1
  220. package/daemon/dist/domain/native-resume-probe.js +109 -26
  221. package/daemon/dist/domain/native-resume-probe.js.map +1 -1
  222. package/daemon/dist/domain/network/network-connector.d.ts.map +1 -1
  223. package/daemon/dist/domain/network/network-connector.js +5 -3
  224. package/daemon/dist/domain/network/network-connector.js.map +1 -1
  225. package/daemon/dist/domain/network/network-installations.d.ts +5 -4
  226. package/daemon/dist/domain/network/network-installations.d.ts.map +1 -1
  227. package/daemon/dist/domain/network/network-installations.js +42 -11
  228. package/daemon/dist/domain/network/network-installations.js.map +1 -1
  229. package/daemon/dist/domain/node-launcher.d.ts +6 -0
  230. package/daemon/dist/domain/node-launcher.d.ts.map +1 -1
  231. package/daemon/dist/domain/node-launcher.js +10 -3
  232. package/daemon/dist/domain/node-launcher.js.map +1 -1
  233. package/daemon/dist/domain/occupant-invalidator.d.ts +4 -1
  234. package/daemon/dist/domain/occupant-invalidator.d.ts.map +1 -1
  235. package/daemon/dist/domain/occupant-invalidator.js +10 -2
  236. package/daemon/dist/domain/occupant-invalidator.js.map +1 -1
  237. package/daemon/dist/domain/operation-correlation.d.ts +1 -1
  238. package/daemon/dist/domain/operation-correlation.d.ts.map +1 -1
  239. package/daemon/dist/domain/operation-correlation.js +1 -1
  240. package/daemon/dist/domain/operation-correlation.js.map +1 -1
  241. package/daemon/dist/domain/permission-account.d.ts.map +1 -1
  242. package/daemon/dist/domain/permission-account.js +8 -6
  243. package/daemon/dist/domain/permission-account.js.map +1 -1
  244. package/daemon/dist/domain/permission-drift.d.ts.map +1 -1
  245. package/daemon/dist/domain/permission-drift.js +1 -1
  246. package/daemon/dist/domain/permission-drift.js.map +1 -1
  247. package/daemon/dist/domain/queue-destination-check.d.ts +2 -0
  248. package/daemon/dist/domain/queue-destination-check.d.ts.map +1 -1
  249. package/daemon/dist/domain/queue-destination-check.js +8 -11
  250. package/daemon/dist/domain/queue-destination-check.js.map +1 -1
  251. package/daemon/dist/domain/queue-erasure.d.ts +7 -1
  252. package/daemon/dist/domain/queue-erasure.d.ts.map +1 -1
  253. package/daemon/dist/domain/queue-erasure.js +226 -20
  254. package/daemon/dist/domain/queue-erasure.js.map +1 -1
  255. package/daemon/dist/domain/queue-repository.d.ts +39 -17
  256. package/daemon/dist/domain/queue-repository.d.ts.map +1 -1
  257. package/daemon/dist/domain/queue-repository.js +96 -64
  258. package/daemon/dist/domain/queue-repository.js.map +1 -1
  259. package/daemon/dist/domain/queue-stuck-sweep.d.ts.map +1 -1
  260. package/daemon/dist/domain/queue-stuck-sweep.js +49 -21
  261. package/daemon/dist/domain/queue-stuck-sweep.js.map +1 -1
  262. package/daemon/dist/domain/queue-transition-log.d.ts +6 -0
  263. package/daemon/dist/domain/queue-transition-log.d.ts.map +1 -1
  264. package/daemon/dist/domain/queue-transition-log.js +9 -0
  265. package/daemon/dist/domain/queue-transition-log.js.map +1 -1
  266. package/daemon/dist/domain/queue-waiting.d.ts +4 -4
  267. package/daemon/dist/domain/queue-waiting.d.ts.map +1 -1
  268. package/daemon/dist/domain/queue-waiting.js +30 -16
  269. package/daemon/dist/domain/queue-waiting.js.map +1 -1
  270. package/daemon/dist/domain/queue-wake-ladder.d.ts.map +1 -1
  271. package/daemon/dist/domain/queue-wake-ladder.js +90 -24
  272. package/daemon/dist/domain/queue-wake-ladder.js.map +1 -1
  273. package/daemon/dist/domain/receiver-context.js +1 -1
  274. package/daemon/dist/domain/receiver-context.js.map +1 -1
  275. package/daemon/dist/domain/restore-check-service.d.ts +13 -0
  276. package/daemon/dist/domain/restore-check-service.d.ts.map +1 -1
  277. package/daemon/dist/domain/restore-check-service.js +122 -9
  278. package/daemon/dist/domain/restore-check-service.js.map +1 -1
  279. package/daemon/dist/domain/restore-orchestrator.d.ts +4 -1
  280. package/daemon/dist/domain/restore-orchestrator.d.ts.map +1 -1
  281. package/daemon/dist/domain/restore-orchestrator.js +132 -48
  282. package/daemon/dist/domain/restore-orchestrator.js.map +1 -1
  283. package/daemon/dist/domain/restore-preconditions.d.ts +2 -0
  284. package/daemon/dist/domain/restore-preconditions.d.ts.map +1 -1
  285. package/daemon/dist/domain/restore-preconditions.js +2 -0
  286. package/daemon/dist/domain/restore-preconditions.js.map +1 -1
  287. package/daemon/dist/domain/resume-metadata-refresher.d.ts +17 -4
  288. package/daemon/dist/domain/resume-metadata-refresher.d.ts.map +1 -1
  289. package/daemon/dist/domain/resume-metadata-refresher.js +64 -15
  290. package/daemon/dist/domain/resume-metadata-refresher.js.map +1 -1
  291. package/daemon/dist/domain/resume-token-capture.d.ts +6 -0
  292. package/daemon/dist/domain/resume-token-capture.d.ts.map +1 -1
  293. package/daemon/dist/domain/resume-token-capture.js +14 -8
  294. package/daemon/dist/domain/resume-token-capture.js.map +1 -1
  295. package/daemon/dist/domain/rig-delivery-drain.d.ts +46 -0
  296. package/daemon/dist/domain/rig-delivery-drain.d.ts.map +1 -0
  297. package/daemon/dist/domain/rig-delivery-drain.js +128 -0
  298. package/daemon/dist/domain/rig-delivery-drain.js.map +1 -0
  299. package/daemon/dist/domain/rig-edge-ops.js +1 -1
  300. package/daemon/dist/domain/rig-edge-ops.js.map +1 -1
  301. package/daemon/dist/domain/rig-lifecycle-service.d.ts.map +1 -1
  302. package/daemon/dist/domain/rig-lifecycle-service.js +4 -1
  303. package/daemon/dist/domain/rig-lifecycle-service.js.map +1 -1
  304. package/daemon/dist/domain/rig-teardown.d.ts +20 -3
  305. package/daemon/dist/domain/rig-teardown.d.ts.map +1 -1
  306. package/daemon/dist/domain/rig-teardown.js +71 -11
  307. package/daemon/dist/domain/rig-teardown.js.map +1 -1
  308. package/daemon/dist/domain/rigspec-instantiator.d.ts.map +1 -1
  309. package/daemon/dist/domain/rigspec-instantiator.js +6 -2
  310. package/daemon/dist/domain/rigspec-instantiator.js.map +1 -1
  311. package/daemon/dist/domain/rigspec-preflight.d.ts +1 -1
  312. package/daemon/dist/domain/rigspec-preflight.d.ts.map +1 -1
  313. package/daemon/dist/domain/rigspec-preflight.js +36 -1
  314. package/daemon/dist/domain/rigspec-preflight.js.map +1 -1
  315. package/daemon/dist/domain/rosters.d.ts +19 -0
  316. package/daemon/dist/domain/rosters.d.ts.map +1 -1
  317. package/daemon/dist/domain/rosters.js +69 -12
  318. package/daemon/dist/domain/rosters.js.map +1 -1
  319. package/daemon/dist/domain/runtime-adapter.d.ts +15 -0
  320. package/daemon/dist/domain/runtime-adapter.d.ts.map +1 -1
  321. package/daemon/dist/domain/runtime-adapter.js.map +1 -1
  322. package/daemon/dist/domain/seat-delivery-guard.d.ts +8 -2
  323. package/daemon/dist/domain/seat-delivery-guard.d.ts.map +1 -1
  324. package/daemon/dist/domain/seat-delivery-guard.js +38 -3
  325. package/daemon/dist/domain/seat-delivery-guard.js.map +1 -1
  326. package/daemon/dist/domain/seat-handover-attempts.d.ts +50 -0
  327. package/daemon/dist/domain/seat-handover-attempts.d.ts.map +1 -0
  328. package/daemon/dist/domain/seat-handover-attempts.js +75 -0
  329. package/daemon/dist/domain/seat-handover-attempts.js.map +1 -0
  330. package/daemon/dist/domain/seat-handover-service.d.ts +64 -1
  331. package/daemon/dist/domain/seat-handover-service.d.ts.map +1 -1
  332. package/daemon/dist/domain/seat-handover-service.js +443 -29
  333. package/daemon/dist/domain/seat-handover-service.js.map +1 -1
  334. package/daemon/dist/domain/seat-launch-environment.d.ts +3 -2
  335. package/daemon/dist/domain/seat-launch-environment.d.ts.map +1 -1
  336. package/daemon/dist/domain/seat-launch-environment.js +16 -4
  337. package/daemon/dist/domain/seat-launch-environment.js.map +1 -1
  338. package/daemon/dist/domain/seat-lifecycle-service.d.ts +47 -2
  339. package/daemon/dist/domain/seat-lifecycle-service.d.ts.map +1 -1
  340. package/daemon/dist/domain/seat-lifecycle-service.js +48 -2
  341. package/daemon/dist/domain/seat-lifecycle-service.js.map +1 -1
  342. package/daemon/dist/domain/seat-runtime-home-record-types.d.ts +16 -0
  343. package/daemon/dist/domain/seat-runtime-home-record-types.d.ts.map +1 -0
  344. package/daemon/dist/domain/seat-runtime-home-record-types.js +2 -0
  345. package/daemon/dist/domain/seat-runtime-home-record-types.js.map +1 -0
  346. package/daemon/dist/domain/seat-runtime-home-record.d.ts +173 -0
  347. package/daemon/dist/domain/seat-runtime-home-record.d.ts.map +1 -0
  348. package/daemon/dist/domain/seat-runtime-home-record.js +317 -0
  349. package/daemon/dist/domain/seat-runtime-home-record.js.map +1 -0
  350. package/daemon/dist/domain/seat-runtime-switch-service.d.ts +7 -0
  351. package/daemon/dist/domain/seat-runtime-switch-service.d.ts.map +1 -1
  352. package/daemon/dist/domain/seat-runtime-switch-service.js +47 -2
  353. package/daemon/dist/domain/seat-runtime-switch-service.js.map +1 -1
  354. package/daemon/dist/domain/seat-skill-storage.d.ts +16 -1
  355. package/daemon/dist/domain/seat-skill-storage.d.ts.map +1 -1
  356. package/daemon/dist/domain/seat-skill-storage.js +178 -1
  357. package/daemon/dist/domain/seat-skill-storage.js.map +1 -1
  358. package/daemon/dist/domain/session-name.d.ts +13 -0
  359. package/daemon/dist/domain/session-name.d.ts.map +1 -1
  360. package/daemon/dist/domain/session-name.js +77 -0
  361. package/daemon/dist/domain/session-name.js.map +1 -1
  362. package/daemon/dist/domain/session-registry.d.ts +7 -1
  363. package/daemon/dist/domain/session-registry.d.ts.map +1 -1
  364. package/daemon/dist/domain/session-registry.js +7 -4
  365. package/daemon/dist/domain/session-registry.js.map +1 -1
  366. package/daemon/dist/domain/session-transport.d.ts +1 -0
  367. package/daemon/dist/domain/session-transport.d.ts.map +1 -1
  368. package/daemon/dist/domain/session-transport.js +33 -9
  369. package/daemon/dist/domain/session-transport.js.map +1 -1
  370. package/daemon/dist/domain/shared-history-selection.d.ts +1 -0
  371. package/daemon/dist/domain/shared-history-selection.d.ts.map +1 -1
  372. package/daemon/dist/domain/shared-history-selection.js +3 -1
  373. package/daemon/dist/domain/shared-history-selection.js.map +1 -1
  374. package/daemon/dist/domain/skill-catalog.d.ts +3 -0
  375. package/daemon/dist/domain/skill-catalog.d.ts.map +1 -1
  376. package/daemon/dist/domain/skill-catalog.js +7 -3
  377. package/daemon/dist/domain/skill-catalog.js.map +1 -1
  378. package/daemon/dist/domain/snapshot-capture.d.ts +4 -1
  379. package/daemon/dist/domain/snapshot-capture.d.ts.map +1 -1
  380. package/daemon/dist/domain/snapshot-capture.js +24 -12
  381. package/daemon/dist/domain/snapshot-capture.js.map +1 -1
  382. package/daemon/dist/domain/startup-submission-evidence.d.ts.map +1 -1
  383. package/daemon/dist/domain/startup-submission-evidence.js +3 -2
  384. package/daemon/dist/domain/startup-submission-evidence.js.map +1 -1
  385. package/daemon/dist/domain/successor-session-launcher.d.ts +16 -0
  386. package/daemon/dist/domain/successor-session-launcher.d.ts.map +1 -1
  387. package/daemon/dist/domain/successor-session-launcher.js +70 -38
  388. package/daemon/dist/domain/successor-session-launcher.js.map +1 -1
  389. package/daemon/dist/domain/types.d.ts +43 -2
  390. package/daemon/dist/domain/types.d.ts.map +1 -1
  391. package/daemon/dist/domain/types.js.map +1 -1
  392. package/daemon/dist/domain/user-settings/settings-browser.d.ts.map +1 -1
  393. package/daemon/dist/domain/user-settings/settings-browser.js +3 -1
  394. package/daemon/dist/domain/user-settings/settings-browser.js.map +1 -1
  395. package/daemon/dist/domain/user-settings/settings-store.d.ts +1 -1
  396. package/daemon/dist/domain/user-settings/settings-store.d.ts.map +1 -1
  397. package/daemon/dist/domain/user-settings/settings-store.js +6 -0
  398. package/daemon/dist/domain/user-settings/settings-store.js.map +1 -1
  399. package/daemon/dist/domain/watchdog-policy-engine.d.ts +4 -0
  400. package/daemon/dist/domain/watchdog-policy-engine.d.ts.map +1 -1
  401. package/daemon/dist/domain/watchdog-policy-engine.js +28 -1
  402. package/daemon/dist/domain/watchdog-policy-engine.js.map +1 -1
  403. package/daemon/dist/domain/workflow-exception-escalation.d.ts.map +1 -1
  404. package/daemon/dist/domain/workflow-exception-escalation.js +13 -8
  405. package/daemon/dist/domain/workflow-exception-escalation.js.map +1 -1
  406. package/daemon/dist/domain/workflow-instance-store.d.ts +14 -2
  407. package/daemon/dist/domain/workflow-instance-store.d.ts.map +1 -1
  408. package/daemon/dist/domain/workflow-instance-store.js +41 -4
  409. package/daemon/dist/domain/workflow-instance-store.js.map +1 -1
  410. package/daemon/dist/domain/workflow-projector.d.ts +55 -0
  411. package/daemon/dist/domain/workflow-projector.d.ts.map +1 -1
  412. package/daemon/dist/domain/workflow-projector.js +355 -174
  413. package/daemon/dist/domain/workflow-projector.js.map +1 -1
  414. package/daemon/dist/domain/workflow-reconciliation.d.ts +7 -1
  415. package/daemon/dist/domain/workflow-reconciliation.d.ts.map +1 -1
  416. package/daemon/dist/domain/workflow-reconciliation.js +51 -13
  417. package/daemon/dist/domain/workflow-reconciliation.js.map +1 -1
  418. package/daemon/dist/domain/workflow-runtime.d.ts +11 -3
  419. package/daemon/dist/domain/workflow-runtime.d.ts.map +1 -1
  420. package/daemon/dist/domain/workflow-runtime.js +141 -27
  421. package/daemon/dist/domain/workflow-runtime.js.map +1 -1
  422. package/daemon/dist/lib/pane-envelope.d.ts.map +1 -1
  423. package/daemon/dist/lib/pane-envelope.js +12 -7
  424. package/daemon/dist/lib/pane-envelope.js.map +1 -1
  425. package/daemon/dist/routes/compaction.d.ts.map +1 -1
  426. package/daemon/dist/routes/compaction.js +6 -3
  427. package/daemon/dist/routes/compaction.js.map +1 -1
  428. package/daemon/dist/routes/queue.d.ts.map +1 -1
  429. package/daemon/dist/routes/queue.js +78 -31
  430. package/daemon/dist/routes/queue.js.map +1 -1
  431. package/daemon/dist/routes/restore-check.d.ts.map +1 -1
  432. package/daemon/dist/routes/restore-check.js +17 -0
  433. package/daemon/dist/routes/restore-check.js.map +1 -1
  434. package/daemon/dist/routes/rig-delivery-drain.d.ts +3 -0
  435. package/daemon/dist/routes/rig-delivery-drain.d.ts.map +1 -0
  436. package/daemon/dist/routes/rig-delivery-drain.js +46 -0
  437. package/daemon/dist/routes/rig-delivery-drain.js.map +1 -0
  438. package/daemon/dist/routes/scopes.d.ts.map +1 -1
  439. package/daemon/dist/routes/scopes.js +102 -19
  440. package/daemon/dist/routes/scopes.js.map +1 -1
  441. package/daemon/dist/routes/seat.d.ts.map +1 -1
  442. package/daemon/dist/routes/seat.js +50 -2
  443. package/daemon/dist/routes/seat.js.map +1 -1
  444. package/daemon/dist/routes/sessions.d.ts.map +1 -1
  445. package/daemon/dist/routes/sessions.js +54 -10
  446. package/daemon/dist/routes/sessions.js.map +1 -1
  447. package/daemon/dist/routes/startup.d.ts.map +1 -1
  448. package/daemon/dist/routes/startup.js +230 -40
  449. package/daemon/dist/routes/startup.js.map +1 -1
  450. package/daemon/dist/routes/transport.d.ts.map +1 -1
  451. package/daemon/dist/routes/transport.js +36 -2
  452. package/daemon/dist/routes/transport.js.map +1 -1
  453. package/daemon/dist/routes/up.js +2 -0
  454. package/daemon/dist/routes/up.js.map +1 -1
  455. package/daemon/dist/routes/watchdog.d.ts.map +1 -1
  456. package/daemon/dist/routes/watchdog.js +7 -1
  457. package/daemon/dist/routes/watchdog.js.map +1 -1
  458. package/daemon/dist/routes/workflow.d.ts.map +1 -1
  459. package/daemon/dist/routes/workflow.js +23 -5
  460. package/daemon/dist/routes/workflow.js.map +1 -1
  461. package/daemon/dist/server.d.ts.map +1 -1
  462. package/daemon/dist/server.js +2 -0
  463. package/daemon/dist/server.js.map +1 -1
  464. package/daemon/dist/startup.d.ts.map +1 -1
  465. package/daemon/dist/startup.js +111 -37
  466. package/daemon/dist/startup.js.map +1 -1
  467. package/daemon/docs/reference/agent-startup-guide.md +90 -2
  468. package/daemon/docs/reference/daemon-http-clients.md +69 -0
  469. package/daemon/docs/reference/developing.md +1 -1
  470. package/daemon/docs/reference/gateway-participants.md +5 -3
  471. package/daemon/docs/reference/getting-started.md +12 -11
  472. package/daemon/docs/reference/hosted-members.md +4 -2
  473. package/daemon/docs/reference/network-connector.md +4 -3
  474. package/daemon/docs/reference/queue-erasure.md +16 -1
  475. package/daemon/docs/reference/quickstart.md +2 -2
  476. package/daemon/docs/reference/rig-spec.md +92 -4
  477. package/daemon/docs/reference/rosters.md +26 -0
  478. package/daemon/docs/reference/seat-delivery.md +7 -1
  479. package/daemon/docs/reference/whats-new.md +397 -5
  480. package/daemon/specs/agents/shared/skills/core/openrig-software-factory/references/worked-example.md +1 -1
  481. package/daemon/specs/agents/shared/skills/core/openrig-upgrade/SKILL.md +2 -0
  482. package/daemon/specs/agents/shared/skills/core/working-with-an-openrig-team/SKILL.md +22 -6
  483. package/daemon/specs/rigs/launch/kernel/agents/operator/agent/guidance/role.md +78 -18
  484. package/daemon/specs/rigs/launch/kernel/agents/operator/agent/startup/context.md +9 -6
  485. package/dist/build-info.js +3 -3
  486. package/dist/client.d.ts +7 -3
  487. package/dist/client.d.ts.map +1 -1
  488. package/dist/client.js +11 -2
  489. package/dist/client.js.map +1 -1
  490. package/dist/commands/config.d.ts.map +1 -1
  491. package/dist/commands/config.js +2 -0
  492. package/dist/commands/config.js.map +1 -1
  493. package/dist/commands/down.d.ts.map +1 -1
  494. package/dist/commands/down.js +5 -1
  495. package/dist/commands/down.js.map +1 -1
  496. package/dist/commands/environment.js +1 -1
  497. package/dist/commands/environment.js.map +1 -1
  498. package/dist/commands/launch.d.ts.map +1 -1
  499. package/dist/commands/launch.js +8 -0
  500. package/dist/commands/launch.js.map +1 -1
  501. package/dist/commands/mcp.d.ts.map +1 -1
  502. package/dist/commands/mcp.js +18 -1
  503. package/dist/commands/mcp.js.map +1 -1
  504. package/dist/commands/network.d.ts +2 -0
  505. package/dist/commands/network.d.ts.map +1 -1
  506. package/dist/commands/network.js +14 -1
  507. package/dist/commands/network.js.map +1 -1
  508. package/dist/commands/ps.d.ts.map +1 -1
  509. package/dist/commands/ps.js +11 -5
  510. package/dist/commands/ps.js.map +1 -1
  511. package/dist/commands/queue.d.ts +1 -1
  512. package/dist/commands/queue.d.ts.map +1 -1
  513. package/dist/commands/queue.js +49 -12
  514. package/dist/commands/queue.js.map +1 -1
  515. package/dist/commands/restore.d.ts.map +1 -1
  516. package/dist/commands/restore.js +6 -1
  517. package/dist/commands/restore.js.map +1 -1
  518. package/dist/commands/roster.d.ts +4 -2
  519. package/dist/commands/roster.d.ts.map +1 -1
  520. package/dist/commands/roster.js +2 -2
  521. package/dist/commands/roster.js.map +1 -1
  522. package/dist/commands/seat.d.ts +2 -0
  523. package/dist/commands/seat.d.ts.map +1 -1
  524. package/dist/commands/seat.js +201 -14
  525. package/dist/commands/seat.js.map +1 -1
  526. package/dist/commands/send.d.ts.map +1 -1
  527. package/dist/commands/send.js +31 -6
  528. package/dist/commands/send.js.map +1 -1
  529. package/dist/commands/setup.d.ts.map +1 -1
  530. package/dist/commands/setup.js +5 -3
  531. package/dist/commands/setup.js.map +1 -1
  532. package/dist/commands/up.d.ts.map +1 -1
  533. package/dist/commands/up.js +7 -0
  534. package/dist/commands/up.js.map +1 -1
  535. package/dist/commands/walk.d.ts.map +1 -1
  536. package/dist/commands/walk.js +4 -0
  537. package/dist/commands/walk.js.map +1 -1
  538. package/dist/commands/workflow.d.ts.map +1 -1
  539. package/dist/commands/workflow.js +30 -4
  540. package/dist/commands/workflow.js.map +1 -1
  541. package/dist/config-store.d.ts +3 -1
  542. package/dist/config-store.d.ts.map +1 -1
  543. package/dist/config-store.js +5 -0
  544. package/dist/config-store.js.map +1 -1
  545. package/dist/lib/bundle-check.d.ts.map +1 -1
  546. package/dist/lib/bundle-check.js +33 -3
  547. package/dist/lib/bundle-check.js.map +1 -1
  548. package/dist/mcp-http.d.ts +3 -0
  549. package/dist/mcp-http.d.ts.map +1 -1
  550. package/dist/mcp-http.js +13 -0
  551. package/dist/mcp-http.js.map +1 -1
  552. package/dist/mcp-server.d.ts +9 -2
  553. package/dist/mcp-server.d.ts.map +1 -1
  554. package/dist/mcp-server.js +287 -69
  555. package/dist/mcp-server.js.map +1 -1
  556. package/dist/person-registration-offer.d.ts.map +1 -1
  557. package/dist/person-registration-offer.js +2 -1
  558. package/dist/person-registration-offer.js.map +1 -1
  559. package/package.json +2 -2
  560. package/tui/dist/commands/registry.d.ts.map +1 -1
  561. package/tui/dist/commands/registry.js +1 -0
  562. package/tui/dist/commands/registry.js.map +1 -1
  563. package/tui/dist/config/config-model.js +1 -1
  564. package/tui/dist/config/config-model.js.map +1 -1
  565. package/tui/dist/crash-cart/start-daemon.d.ts.map +1 -1
  566. package/tui/dist/crash-cart/start-daemon.js +4 -2
  567. package/tui/dist/crash-cart/start-daemon.js.map +1 -1
  568. package/tui/dist/daemon-client.d.ts +12 -1
  569. package/tui/dist/daemon-client.d.ts.map +1 -1
  570. package/tui/dist/daemon-client.js +44 -2
  571. package/tui/dist/daemon-client.js.map +1 -1
  572. package/tui/dist/hydrate.d.ts +1 -1
  573. package/tui/dist/hydrate.d.ts.map +1 -1
  574. package/tui/dist/hydrate.js +43 -1
  575. package/tui/dist/hydrate.js.map +1 -1
  576. package/tui/dist/main.js +3 -0
  577. package/tui/dist/main.js.map +1 -1
  578. package/tui/dist/page-read.d.ts.map +1 -1
  579. package/tui/dist/page-read.js +2 -1
  580. package/tui/dist/page-read.js.map +1 -1
  581. package/tui/dist/render.d.ts.map +1 -1
  582. package/tui/dist/render.js +110 -16
  583. package/tui/dist/render.js.map +1 -1
  584. package/tui/dist/scopes/fleet-scopes-model.d.ts +73 -0
  585. package/tui/dist/scopes/fleet-scopes-model.d.ts.map +1 -0
  586. package/tui/dist/scopes/fleet-scopes-model.js +102 -0
  587. package/tui/dist/scopes/fleet-scopes-model.js.map +1 -0
  588. package/tui/dist/scopes/scopes-model.d.ts +2 -0
  589. package/tui/dist/scopes/scopes-model.d.ts.map +1 -1
  590. package/tui/dist/scopes/scopes-model.js +7 -4
  591. package/tui/dist/scopes/scopes-model.js.map +1 -1
  592. package/tui/dist/sections.d.ts.map +1 -1
  593. package/tui/dist/sections.js +5 -0
  594. package/tui/dist/sections.js.map +1 -1
  595. package/tui/dist/startup.d.ts +5 -0
  596. package/tui/dist/startup.d.ts.map +1 -1
  597. package/tui/dist/startup.js +12 -0
  598. package/tui/dist/startup.js.map +1 -1
  599. package/tui/dist/state.d.ts.map +1 -1
  600. package/tui/dist/state.js +12 -5
  601. package/tui/dist/state.js.map +1 -1
  602. package/tui/dist/types.d.ts +18 -1
  603. package/tui/dist/types.d.ts.map +1 -1
@@ -3,13 +3,16 @@ import { z } from "zod";
3
3
  import { createHash, randomBytes } from "node:crypto";
4
4
  import { statSync } from "node:fs";
5
5
  import nodePath from "node:path";
6
- import { DaemonConnectionError, DaemonTimeoutError, terminalAuthHeaders } from "./client.js";
6
+ import { DaemonClient, DaemonConnectionError, DaemonTimeoutError, remoteDaemonClient, terminalAuthHeaders } from "./client.js";
7
+ import { bearerAuthHeaders, loadHostRegistry, resolveHost, resolveRemoteBearer } from "./host-registry.js";
8
+ import { loadHostBindings } from "./host-bindings.js";
9
+ import { eligibleQueueBindings, ineligibleBindingDetail } from "../daemon/dist/learned-host-bindings-surface.js";
7
10
  import { readOpenRigEnv } from "./openrig-compat.js";
8
11
  import { resolveRigHandle } from "./rig-handle.js";
9
12
  import { formatSeatActivity } from "./lib/seat-activity.js";
10
13
  import { CLI_VERSION } from "./version.js";
11
14
  import { ConfigStore } from "./config-store.js";
12
- import { readRosters } from "./commands/roster.js";
15
+ import { readRosters, rosterTeamName, teamPhrase } from "./commands/roster.js";
13
16
  import { mcpPresenceFilePath, readPresence } from "./mcp-presence.js";
14
17
  import { codeResultOf, planItemArtifact } from "./queue-artifact.js";
15
18
  const LONG_RUNNING_UP_TIMEOUT_MS = 120_000;
@@ -54,7 +57,7 @@ function structured(data) {
54
57
  /** Where a handed-on item went. A cross-host handoff records the remote item as qitem-…@<host> in closureTarget (named, not
55
58
  * fetched); a local successor is the item whose handedOffFrom is this one, the newest when there are several. null when
56
59
  * none is found; { unknown: true, code } when the lookup failed or the daemon can't filter by handedOffFrom. */
57
- async function successorOf(client, qitemId, closureTarget,
60
+ async function successorOf(get, qitemId, closureTarget,
58
61
  /** For an external caller: which successor rows it may see; a cross-host successor's parties are unknown here, so it
59
62
  * can't. */
60
63
  visible) {
@@ -62,7 +65,7 @@ visible) {
62
65
  if (remote)
63
66
  return visible ? { unknown: true, code: "out_of_scope" } : { qitemId: remote[1], host: remote[2] };
64
67
  try {
65
- const res = await client.get(`/api/queue/list?${new URLSearchParams({ handedOffFrom: qitemId, compact: "1", limit: "5" }).toString()}`);
68
+ const res = await get(`/api/queue/list?${new URLSearchParams({ handedOffFrom: qitemId, compact: "1", limit: "5" }).toString()}`);
66
69
  if (res.status >= 400)
67
70
  return { unknown: true, code: mapResult(res).structuredContent.code };
68
71
  if (!Array.isArray(res.data))
@@ -145,41 +148,57 @@ function newestWake(rows, seat) {
145
148
  return newest;
146
149
  }
147
150
  const ROSTERS_INCOMPLETE = "Some rosters couldn't be read, so hosted members may be missing.";
148
- /** 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
149
- * 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
150
- * none. The note stays generic (a scoped caller doesn't see other rosters' names or errors); the detail goes to this
151
- * server's log. */
152
- async function hostedMembersOf(folder, rigName, nodeSeats, selfHostId, presenceOf) {
151
+ /** An external caller's answer also carries the roster entries of the team's seats, and loses those too. */
152
+ const ROSTERS_INCOMPLETE_EXTERNAL = "Some rosters couldn't be read, so hosted members, and the labels, caveats and presence they give the team's seats, may be missing.";
153
+ /** The roster members on this host whose seat is in this rig and marked hosted, that aren't one of its nodes. For an
154
+ * external caller, also the entries of its node seats (by seat) and each member's label (or why it isn't used): the names
155
+ * a person knows them by. An internal caller's answer is as it was. A roster folder that doesn't exist means none. One
156
+ * that can't be inspected or read, or a host id that isn't known yet, is said, never read as none. The note stays generic
157
+ * (a scoped caller doesn't see other rosters' names or errors); the detail goes to this server's log. presenceOf gives
158
+ * null for a seat whose presence isn't shown (an external caller's own), and that entry has none. */
159
+ async function hostedMembersOf(folder, rigName, nodeSeats, selfHostId, presenceOf, external) {
160
+ const incomplete = external ? ROSTERS_INCOMPLETE_EXTERNAL : ROSTERS_INCOMPLETE;
161
+ const seats = new Map();
153
162
  try {
154
163
  statSync(folder);
155
164
  }
156
165
  catch (error) {
157
166
  if (error.code === "ENOENT")
158
- return { members: [] };
167
+ return { members: [], seats };
159
168
  console.error(`rig_team: the roster folder ${folder} can't be inspected: ${error.message}`);
160
- return { members: [], note: ROSTERS_INCOMPLETE };
169
+ return { members: [], seats, note: incomplete };
161
170
  }
162
171
  const { rosters, warnings } = readRosters(folder);
163
172
  if (warnings.length > 0)
164
173
  console.error(`rig_team: ${warnings.join("; ")}`);
165
- const unread = warnings.length > 0 ? { note: ROSTERS_INCOMPLETE } : {};
174
+ const unread = warnings.length > 0 ? { note: incomplete } : {};
175
+ const hostedHere = (member) => member.hosted === true && member.seat.endsWith(`@${rigName}`);
166
176
  const candidates = rosters.flatMap((roster) => roster.members
167
- .filter((member) => member.hosted === true && member.seat.endsWith(`@${rigName}`) && !nodeSeats.has(member.seat))
177
+ .filter((member) => external ? nodeSeats.has(member.seat) || hostedHere(member) : hostedHere(member) && !nodeSeats.has(member.seat))
168
178
  .map((member) => ({ roster: roster.id, member })));
169
179
  if (candidates.length === 0)
170
- return { members: [], ...unread };
180
+ return { members: [], seats, ...unread };
171
181
  const host = await selfHostId();
172
- if (!host)
173
- return { members: [], note: "This daemon's host id isn't known yet, so hosted members on its rosters can't be matched to it." };
182
+ if (!host) {
183
+ return { members: [], seats, note: external
184
+ ? "This daemon's host id isn't known yet, so hosted members on its rosters, and the roster entries of the team's seats, can't be matched to it."
185
+ : "This daemon's host id isn't known yet, so hosted members on its rosters can't be matched to it." };
186
+ }
174
187
  // A seat in two rosters is one member: the first roster (by file name) supplies its entry.
175
188
  const members = new Map();
176
189
  for (const { roster, member } of candidates) {
177
- if (member.host !== host || members.has(member.seat))
190
+ if (member.host !== host || members.has(member.seat) || seats.has(member.seat))
178
191
  continue;
179
- members.set(member.seat, { session: member.seat, roster, capabilities: member.capabilities, useWhen: member.use_when,
180
- caveat: member.caveat ?? null, pane: null, activity: "unknown", presence: await presenceOf(member.seat) });
192
+ // A label that can't be used says why, so it doesn't read as absent.
193
+ const named = !external ? {} : member.label ? { label: member.label } : member.label_problem ? { label_problem: member.label_problem } : {};
194
+ const entry = { ...named, roster, capabilities: member.capabilities, useWhen: member.use_when, caveat: member.caveat ?? null };
195
+ const presence = await presenceOf(member.seat);
196
+ if (nodeSeats.has(member.seat))
197
+ seats.set(member.seat, { ...entry, ...(presence ? { presence } : {}) });
198
+ else
199
+ members.set(member.seat, { session: member.seat, ...entry, pane: null, activity: "unknown", ...(presence ? { presence } : {}) });
181
200
  }
182
- return { members: [...members.values()], ...unread };
201
+ return { members: [...members.values()], seats, ...unread };
183
202
  }
184
203
  /** A slice's summary fields, without its paths and readiness detail. */
185
204
  function sliceSummary(slice) {
@@ -264,6 +283,40 @@ function projectForExternal(row, view) {
264
283
  fields.pickup = { state: pickup.state };
265
284
  return fields;
266
285
  }
286
+ /** Who acted, apart from who's reading: a recorded principal (the grant service's JSON, or a bare id) as its id and grant. */
287
+ function recordedPrincipal(value) {
288
+ if (typeof value !== "string" || !value)
289
+ return { principal: null, grant: null };
290
+ try {
291
+ const parsed = JSON.parse(value);
292
+ if (parsed && typeof parsed === "object") {
293
+ return { principal: typeof parsed.id === "string" ? parsed.id : null, grant: typeof parsed.grant === "string" ? parsed.grant : null };
294
+ }
295
+ }
296
+ catch { /* a bare id */ }
297
+ return { principal: value, grant: null };
298
+ }
299
+ /** An external connection's show labels the creator and each transition's actor apart from itself: a connected assistant
300
+ * once read the creator's principal and grant as its own and stopped before claiming the request it was sent. An actor
301
+ * is you only when it's this connection's seat with this connection's recorded principal; another seat or another
302
+ * principal isn't, and the same seat with no principal recorded can't be told, so it reads null, never you. */
303
+ function labelActors(shown, viewer) {
304
+ const label = (seat, recorded) => {
305
+ const who = recordedPrincipal(recorded);
306
+ const sameSeat = typeof seat === "string" && seat === viewer.seat;
307
+ const you = !sameSeat ? false : who.principal === null || viewer.principal === null ? null : who.principal === viewer.principal;
308
+ return { seat: typeof seat === "string" ? seat : null, ...who, you };
309
+ };
310
+ const transitions = Array.isArray(shown.transitions)
311
+ ? shown.transitions.map((t) => t && typeof t === "object"
312
+ ? { ...t, actor: label(t.actorSession, t.identityPrincipal) } : t)
313
+ : shown.transitions;
314
+ const item = shown.item && typeof shown.item === "object" ? shown.item : null;
315
+ // The creator's principal is the one its created transition recorded, when that transition is the creator's.
316
+ const created = Array.isArray(shown.transitions)
317
+ ? shown.transitions.find((t) => t && t.actorSession === item?.sourceSession) : undefined;
318
+ return { viewer: { ...viewer, you: true }, item: item ? { ...item, createdBy: label(item.sourceSession, created?.identityPrincipal) } : shown.item, transitions };
319
+ }
267
320
  /** An item as a scoped caller receives it: without the daemon's own fields that carry other rows regardless of this
268
321
  * caller's scope. Those are the successor fields (successors, successorsTruncated, successorNote), which name rows and
269
322
  * remote ids; a handed-on item's answer is show's scope-checked successor (successorOf). And the answers people returned
@@ -570,11 +623,34 @@ function sharedInstructions(has) {
570
623
  }
571
624
  const SHARED_INSTRUCTIONS = sharedInstructions(() => true);
572
625
  const INSTRUCTIONS = [...SHARED_INSTRUCTIONS, MEMBER_WORKFLOW].join("\n");
626
+ /** For a connection that relays a person's request to another assistant (an external caller, or the front door): which one
627
+ * they mean is theirs to say when more than one fits, never inferred from the agent's own history. The listing steps need
628
+ * rig_team, so a connection without it is told only to ask. Pickup is said only where it's true: another connected
629
+ * assistant waits for its person; on the front door, a running team seat is woken, and one sent to anyway waits until it's
630
+ * back. A member, which works items, isn't given it. */
631
+ function askWhichAssistant(canList, frontDoor) {
632
+ if (!canList) {
633
+ return "If more than one assistant could be the one your person means, ask which; don't pick from your own history or memory. If your person names one clearly, go ahead.";
634
+ }
635
+ return [
636
+ "Before sending a request to another assistant, list the team's members.",
637
+ "If more than one could be the one your person means, ask which, using their names from the list (like \"Sam's Claude\"); if the list shows only addresses, describe each in plain words from what the list says about it (like \"the Claude chat agent\"), never reading the address out.",
638
+ "Don't pick from your own history or memory.",
639
+ "If the list shows the chosen one detached or stopped, or a connected assistant with no check-in yet or overdue, say so before sending and ask whether to send it anyway.",
640
+ "If the list says the chosen one's person is no longer on the team, don't send; tell your person and ask whether to send it to someone else.",
641
+ ...(frontDoor ? ["When you send to a running team seat, tell your person that seat will pick it up on its own."] : []),
642
+ "When you send to another connected assistant, tell your person it will be picked up the next time that assistant's person opens it, or on a schedule they've set up.",
643
+ ...(frontDoor ? ["If you sent it anyway, tell your person it waits until that one is back."] : []),
644
+ "If your person names one clearly, or says to send it anyway to one that isn't connected, go ahead without asking again.",
645
+ "If your person still asks to send to one whose person is no longer on the team, tell them it can't be delivered: requests to an assistant whose person is no longer on the team are closed unanswered.",
646
+ ].join(" ");
647
+ }
573
648
  /** rig mcp serve --front-door: the seat is a person's agent in their own app, the front door to their team, not a member
574
649
  * that works its inbox. The team's questions to it are the person's to answer. */
575
- export const FRONT_DOOR_WORKFLOW_VERSION = "front-door/v2";
650
+ export const FRONT_DOOR_WORKFLOW_VERSION = "front-door/v3";
576
651
  export const FRONT_DOOR_WORKFLOW = [
577
652
  `Front door (${FRONT_DOOR_WORKFLOW_VERSION}). This seat is a person's agent in their own app: you hand the team their work and bring back what it produced, and you aren't one of its members.`,
653
+ askWhichAssistant(true, true),
578
654
  "Items addressed to your seat (rig_queue_list with owned set) are usually the team's questions about work you handed it. They're the person's to answer, not yours: show each to the person with the team's draft, and record only what the person tells you.",
579
655
  "To record an answer, claim the item (rig_queue_claim), then close it done with closure reason no-follow-on and exactly what the person typed in resolution, with no label, quotation marks or words of your own (rig_queue_update). If the person isn't there, leave the item open and tell them it's waiting. Never choose an answer for them, and don't claim an item you can't close with their words.",
580
656
  "Nothing wakes this conversation when the team finishes: check your work and your items when the person asks or comes back.",
@@ -611,8 +687,11 @@ function instructionsFor(access, frontDoor = false) {
611
687
  if (!access?.external)
612
688
  return frontDoor ? FRONT_DOOR_INSTRUCTIONS : INSTRUCTIONS;
613
689
  const tools = externalTools(access.external);
614
- const instructions = tools.has("rig_queue_claim") && tools.has("rig_queue_update") ? externalInboxInstructions(tools)
690
+ const workflow = tools.has("rig_queue_claim") && tools.has("rig_queue_update") ? externalInboxInstructions(tools)
615
691
  : tools.has("rig_question_list") || tools.has("rig_question_answer") ? EXTERNAL_PERSON_INSTRUCTIONS : EXTERNAL_INSTRUCTIONS;
692
+ // Only a grant with team/list may reach another connected assistant's seat, and it lists the team with rig_team.
693
+ const instructions = tools.has("rig_queue_create")
694
+ ? `${workflow}\n${askWhichAssistant(tools.has("rig_team"), false)}` : workflow;
616
695
  return tools.has("rig_team") ? `Discover the team this grant connects you to by calling rig_team without rigId. A sole granted rig is selected automatically; with several, it returns the granted names to choose from.\n${instructions}` : instructions;
617
696
  }
618
697
  /** The seats of `rigName` that `name` names, each as its actual session: its node's canonical session, or the
@@ -637,11 +716,16 @@ async function namedSeats(client, rigName, name, addressable) {
637
716
  if (typeof logicalId !== "string" || inRig !== rigName)
638
717
  throw new Error(`the node list for ${rigName} has a malformed entry`);
639
718
  const dot = logicalId.indexOf(".");
640
- if (dot <= 0 || dot === logicalId.length - 1)
719
+ if (dot === 0 || dot === logicalId.length - 1)
641
720
  throw new Error(`the node list for ${rigName} has a malformed entry`);
642
- const podMember = `${logicalId.slice(0, dot)}-${logicalId.slice(dot + 1)}`;
643
- const session = typeof canonicalSessionName === "string" && canonicalSessionName.endsWith(`@${rigName}`)
644
- && canonicalSessionName.length > rigName.length + 1 ? canonicalSessionName : `${podMember}@${rigName}`;
721
+ const recorded = typeof canonicalSessionName === "string" && canonicalSessionName.endsWith(`@${rigName}`)
722
+ && canonicalSessionName.length > rigName.length + 1 ? canonicalSessionName : null;
723
+ // A seat of a rig without pods has no pod in its logical id: it's named only by its recorded session, and one with
724
+ // none yet can't be named, so it's left out rather than read as a broken team.
725
+ if (dot === -1 && !recorded)
726
+ continue;
727
+ const podMember = dot === -1 ? null : `${logicalId.slice(0, dot)}-${logicalId.slice(dot + 1)}`;
728
+ const session = recorded ?? `${podMember}@${rigName}`;
645
729
  const own = session.slice(0, -(rigName.length + 1));
646
730
  if (!addressable(session))
647
731
  continue;
@@ -733,10 +817,65 @@ export function createMcpServer(client, options = {}) {
733
817
  version: CLI_VERSION,
734
818
  }, { instructions: instructionsFor(options.access, options.frontDoor === true) });
735
819
  const { access } = options;
736
- const rostersFolder = options.rostersFolder ?? (() => nodePath.join(new ConfigStore().get("workspace.root"), "rosters"));
737
- const presenceFile = options.presenceFile ?? (() => mcpPresenceFilePath());
820
+ const clientFactory = options.clientFactory ?? ((url) => new DaemonClient(url));
821
+ const hostRegistryLoader = options.hostRegistryLoader ?? loadHostRegistry;
822
+ const hostBindingsLoader = options.hostBindingsLoader ?? loadHostBindings;
738
823
  // The seat this server acts as: the authenticated caller's, else OPENRIG_SESSION_NAME where it was configured.
739
824
  const seatOf = () => options.seat ?? readOpenRigEnv("OPENRIG_SESSION_NAME", "RIGGED_SESSION_NAME")?.trim();
825
+ /** A tool's optional `host`: that registered http host's client and bearer, or this server's own client when none is
826
+ * named. A granted connection (an authenticated non-owner) reaches only the daemon serving it, so it can't name one.
827
+ * The remote client is bound to this server's seat, so a write it makes there names the calling agent as its sender
828
+ * (principal headers stay local: only this host's daemon trusts them). */
829
+ const hostTarget = (host) => {
830
+ const name = host?.trim();
831
+ if (host !== undefined && !name) {
832
+ const message = "A host name can't be blank: omit host to act on this daemon, or name a registered host (rig host list shows them).";
833
+ return errorResult(message, "invalid_host", message);
834
+ }
835
+ if (!name || name === "local")
836
+ return { client, headers: {}, remote: false };
837
+ if (access && !access.owner) {
838
+ const message = "Naming a host needs the daemon's owner (the stdio server, an HTTP owner token, or unauthenticated loopback), not an ordinary scoped grant; a granted connection reaches only the daemon serving it.";
839
+ return errorResult(message, "host_not_available", message);
840
+ }
841
+ const registry = hostRegistryLoader();
842
+ if (!registry.ok) {
843
+ const message = `Host ${name} can't be reached: this CLI's host registry can't be read (${registry.error}).`;
844
+ return errorResult(message, "host_registry_unreadable", message);
845
+ }
846
+ const learned = hostBindingsLoader();
847
+ // Queue forwarding's one policy: a learned self-id routes only through a binding admitted by
848
+ // `eligibleQueueBindings`, so a stale, conflicted or SSH-declared binding never sends this call elsewhere.
849
+ const match = resolveHost(registry.registry, name, eligibleQueueBindings(registry.registry, learned));
850
+ if (!match.ok) {
851
+ const unused = ineligibleBindingDetail(registry.registry, learned, name);
852
+ const message = `Host ${name} isn't in this CLI's host registry. rig host list shows the registered hosts.${unused ? ` ${unused}` : ""}`;
853
+ return errorResult(message, "unknown_host", message);
854
+ }
855
+ if (match.host.transport !== "http") {
856
+ const message = `Host ${name} is registered over SSH, not as a daemon URL; MCP reaches http hosts only. Use rig <verb> --host ${name} for an SSH host.`;
857
+ return errorResult(message, "host_not_http", message);
858
+ }
859
+ const bearer = resolveRemoteBearer(match.host);
860
+ if (!bearer.ok)
861
+ return errorResult(bearer.error, "host_bearer_unavailable", bearer.error);
862
+ return { client: remoteDaemonClient(clientFactory, match.host.url, undefined, seatOf()), headers: bearerAuthHeaders(bearer.token), remote: true, name: match.host.id };
863
+ };
864
+ /** Request options for a host target: a remote call carries that host's bearer; a local one keeps the terminal token. */
865
+ const hostOptions = (target, timeout) => target.remote
866
+ ? { ...(timeout ?? {}), ...(Object.keys(target.headers).length > 0 ? { headers: target.headers } : {}) }
867
+ : transportRequestOptions(timeout);
868
+ /** A call with no options stays a one-argument call (the request shape existing callers and tests expect). */
869
+ const hostGet = (target, path, timeout) => {
870
+ const options = hostOptions(target, timeout);
871
+ return options === undefined ? target.client.get(path) : target.client.get(path, options);
872
+ };
873
+ const hostPost = (target, path, body, timeout) => {
874
+ const options = hostOptions(target, timeout);
875
+ return options === undefined ? target.client.post(path, body) : target.client.post(path, body, options);
876
+ };
877
+ const rostersFolder = options.rostersFolder ?? (() => nodePath.join(new ConfigStore().get("workspace.root"), "rosters"));
878
+ const presenceFile = options.presenceFile ?? (() => mcpPresenceFilePath());
740
879
  // With no seat (none configured, or one an app left unfilled), messages, new tasks and chat still go through, as an
741
880
  // unknown sender. Its label is this server's own and no seat's, so two unknown callers never count as one author (a
742
881
  // delegated decision compares authors). Its note says only what is known: why there's no seat, and how the client
@@ -865,12 +1004,17 @@ export function createMcpServer(client, options = {}) {
865
1004
  // 3. rig_ps — list running rigs
866
1005
  if (offered("rig_ps"))
867
1006
  server.registerTool("rig_ps", {
868
- description: "List rigs and their status",
869
- inputSchema: z.object({}),
1007
+ description: "List rigs and their status. host reads a registered remote host instead of this daemon; it needs the daemon's owner (the stdio server, an HTTP owner token, or unauthenticated loopback), not an ordinary scoped grant.",
1008
+ inputSchema: z.object({
1009
+ host: z.string().min(1).optional().describe("Act on a REGISTERED remote host's daemon instead of this one (rig host list shows the hosts; as --host on the matching rig verb); a write there names this server's seat (rig_whoami) as its sender, as a local write does"),
1010
+ }),
870
1011
  annotations: READ_ONLY,
871
- }, async () => {
1012
+ }, async ({ host }) => {
872
1013
  try {
873
- const res = await client.get("/api/ps");
1014
+ const target = hostTarget(host);
1015
+ if ("content" in target)
1016
+ return target;
1017
+ const res = await hostGet(target, "/api/ps");
874
1018
  if (scope && res.status < 400 && Array.isArray(res.data))
875
1019
  return mapResult({ ...res, data: res.data.filter((entry) => scope.rig(entry.name)) });
876
1020
  return mapResult(res);
@@ -1111,17 +1255,21 @@ export function createMcpServer(client, options = {}) {
1111
1255
  // 14. rig_send — send message to agent session
1112
1256
  if (offered("rig_send"))
1113
1257
  server.registerTool("rig_send", {
1114
- description: "Send a message to an agent's terminal using reliable two-step send",
1258
+ description: "Send a message to an agent's terminal using reliable two-step send. host needs the daemon's owner (the stdio server, an HTTP owner token, or unauthenticated loopback), not an ordinary scoped grant.",
1115
1259
  inputSchema: z.object({
1116
1260
  session: z.string().describe("Target session name (e.g. dev-impl@my-rig)"),
1117
1261
  text: z.string().describe("Message text to send"),
1118
1262
  verify: z.boolean().optional().describe("Verify delivery by checking pane content"),
1119
1263
  force: z.boolean().optional().describe("Send even if target appears mid-task"),
1120
1264
  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"),
1265
+ host: z.string().min(1).optional().describe("Act on a REGISTERED remote host's daemon instead of this one (rig host list shows the hosts; as --host on the matching rig verb); a write there names this server's seat (rig_whoami) as its sender, as a local write does"),
1121
1266
  }),
1122
1267
  annotations: DESTRUCTIVE,
1123
- }, async ({ session, text, verify, force, waitForIdleSeconds }) => {
1268
+ }, async ({ session, text, verify, force, waitForIdleSeconds, host }) => {
1124
1269
  try {
1270
+ const target = hostTarget(host);
1271
+ if ("content" in target)
1272
+ return target;
1125
1273
  if (force && waitForIdleSeconds !== undefined) {
1126
1274
  const message = "waitForIdleSeconds cannot be combined with force";
1127
1275
  return errorResult(JSON.stringify({ ok: false, error: message }), "invalid_arguments", message);
@@ -1131,13 +1279,13 @@ export function createMcpServer(client, options = {}) {
1131
1279
  const waitForIdleMs = waitForIdleSeconds === undefined ? undefined : Math.ceil(waitForIdleSeconds * 1000);
1132
1280
  // Unsigned, as before (the transport names it "<unknown sender>"); the note tells the recipient what is known.
1133
1281
  const note = unknownSenderNote("message");
1134
- const res = await client.post("/api/transport/send", {
1282
+ const res = await hostPost(target, "/api/transport/send", {
1135
1283
  session,
1136
1284
  text: note ? `${note}\n${text}` : text,
1137
1285
  verify,
1138
1286
  force,
1139
1287
  waitForIdleMs,
1140
- }, transportRequestOptions(waitForIdleRequestOptions(waitForIdleMs)));
1288
+ }, waitForIdleRequestOptions(waitForIdleMs));
1141
1289
  return mapResult(res);
1142
1290
  }
1143
1291
  catch (err) {
@@ -1147,16 +1295,20 @@ export function createMcpServer(client, options = {}) {
1147
1295
  // 15. rig_capture — capture terminal output from agent session
1148
1296
  if (offered("rig_capture"))
1149
1297
  server.registerTool("rig_capture", {
1150
- description: "Capture terminal output from an agent session",
1298
+ description: "Capture terminal output from an agent session. host needs the daemon's owner (the stdio server, an HTTP owner token, or unauthenticated loopback), not an ordinary scoped grant.",
1151
1299
  inputSchema: z.object({
1152
1300
  session: z.string().optional().describe("Session name (omit for multi-target with rig/pod)"),
1153
1301
  rig: z.string().optional().describe("Capture all sessions in a rig"),
1154
1302
  pod: z.string().optional().describe("Capture all sessions in a pod"),
1155
1303
  lines: z.number().optional().describe("Number of lines to capture (default: 20)"),
1304
+ host: z.string().min(1).optional().describe("Act on a REGISTERED remote host's daemon instead of this one (rig host list shows the hosts; as --host on the matching rig verb); a write there names this server's seat (rig_whoami) as its sender, as a local write does"),
1156
1305
  }),
1157
1306
  annotations: READ_ONLY,
1158
- }, async ({ session, rig, pod, lines }) => {
1307
+ }, async ({ session, rig, pod, lines, host }) => {
1159
1308
  try {
1309
+ const target = hostTarget(host);
1310
+ if ("content" in target)
1311
+ return target;
1160
1312
  let rigName = rig;
1161
1313
  if (scope) {
1162
1314
  if (session && !scope.session(session))
@@ -1182,7 +1334,7 @@ export function createMcpServer(client, options = {}) {
1182
1334
  if (lines)
1183
1335
  body.lines = lines;
1184
1336
  body.inputBox = true; // what the live input box holds, in the result's inputBox
1185
- const res = await client.post("/api/transport/capture", body, transportRequestOptions());
1337
+ const res = await hostPost(target, "/api/transport/capture", body);
1186
1338
  return mapResult(res);
1187
1339
  }
1188
1340
  catch (err) {
@@ -1291,7 +1443,7 @@ export function createMcpServer(client, options = {}) {
1291
1443
  // 19. rig_queue_create — hand a task to a seat
1292
1444
  if (offered("rig_queue_create"))
1293
1445
  server.registerTool("rig_queue_create", {
1294
- ...worded("rig_queue_create", "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.", ADDITIVE),
1446
+ ...worded("rig_queue_create", "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. host needs the daemon's owner (the stdio server, an HTTP owner token, or unauthenticated loopback), not an ordinary scoped grant.", ADDITIVE),
1295
1447
  inputSchema: z.object({
1296
1448
  destination: access?.external
1297
1449
  ? z.string().optional().describe("Destination seat: member@rig, or its name alone as the team shows it (e.g. workshop-lead) within this connection's team; omit to use the connected team's configured receiver")
@@ -1304,8 +1456,12 @@ export function createMcpServer(client, options = {}) {
1304
1456
  qitemId: z.string().optional().describe("Request id to reuse when retrying the same create (default: a new id)"),
1305
1457
  revises: z.string().optional().describe("The qitemId of the work this asks to revise"),
1306
1458
  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"),
1459
+ host: z.string().min(1).optional().describe("Act on a REGISTERED remote host's daemon instead of this one (rig host list shows the hosts; as --host on the matching rig verb); a write there names this server's seat (rig_whoami) as its sender, as a local write does"),
1307
1460
  }),
1308
- }, async ({ destination, body, summary, tags, priority, tier, qitemId, revises, alert }) => {
1461
+ }, async ({ destination, body, summary, tags, priority, tier, qitemId, revises, alert, host }) => {
1462
+ const target = hostTarget(host);
1463
+ if ("content" in target)
1464
+ return target;
1309
1465
  // The server's one receiver counts for this connection only when its grant reaches it. Then a refused destination
1310
1466
  // says how to reach it, so the assistant retries instead of telling the person the connection lacks access. It
1311
1467
  // never names the receiver.
@@ -1374,7 +1530,7 @@ export function createMcpServer(client, options = {}) {
1374
1530
  let lineage;
1375
1531
  if (revises) {
1376
1532
  try {
1377
- const original = await client.get(`/api/queue/${encodeURIComponent(revises)}`);
1533
+ const original = await hostGet(target, `/api/queue/${encodeURIComponent(revises)}`);
1378
1534
  if (original.status >= 400)
1379
1535
  return mapResult(original);
1380
1536
  if (scope && !scope.item(original.data))
@@ -1409,7 +1565,7 @@ export function createMcpServer(client, options = {}) {
1409
1565
  // With no seat, the task goes to its destination as from the unknown sender, with the note at the top of its body.
1410
1566
  const note = unknownSenderNote("task");
1411
1567
  try {
1412
- const res = await client.post("/api/queue/create", {
1568
+ const res = await hostPost(target, "/api/queue/create", {
1413
1569
  qitemId: id, destinationSession: destination, body: note ? `${note}\n\n${lineage?.body ?? body}` : lineage?.body ?? body,
1414
1570
  ...(note ? { sourceSession: unknownSender } : {}), summary, priority, tier,
1415
1571
  tags: access?.external ? tags?.filter((tag) => !OPENRIG_PROVENANCE_TAG.test(tag)) : tags,
@@ -1427,42 +1583,46 @@ export function createMcpServer(client, options = {}) {
1427
1583
  const view = externalView(scope);
1428
1584
  // An unknown sender has no return address, so it says how to follow the task.
1429
1585
  const sent = note && res.status < 400 && res.data && typeof res.data === "object" ? { ...res, data: { ...res.data,
1430
- unknownSender: { label: unknownSender, followUp: `No return address: read this task with rig_queue_show and qitemId ${id}.` } } } : res;
1586
+ unknownSender: { label: unknownSender, followUp: `No return address: read this task with rig_queue_show and qitemId ${id}${target.remote && target.name ? ` and host ${target.name}` : ""}.` } } } : res;
1431
1587
  return mapResult(view && sent.status < 400 ? { ...sent, data: projectForExternal(sent.data, view) } : sent, undefined, { structured: true });
1432
1588
  }
1433
1589
  catch (err) {
1434
1590
  const failure = caught(err);
1435
- const text = `${err.message} The outcome is unknown: check rig_queue_show with qitemId ${id} before retrying, and retry only with that same qitemId.`;
1436
- return { ...failure, content: [{ type: "text", text }], structuredContent: { ...failure.structuredContent, qitemId: id, outcome: "unknown" } };
1591
+ const text = `${err.message} The outcome is unknown: check rig_queue_show with qitemId ${id}${target.remote && target.name ? ` and host ${target.name}` : ""} before retrying, and retry only with that same qitemId.`;
1592
+ return { ...failure, content: [{ type: "text", text }], structuredContent: { ...failure.structuredContent, qitemId: id, outcome: "unknown", ...(target.remote && target.name ? { host: target.name } : {}) } };
1437
1593
  }
1438
1594
  });
1439
1595
  // 20. rig_queue_show — one item with its transitions: a delegated task's answer is its own record
1440
1596
  if (offered("rig_queue_show"))
1441
1597
  server.registerTool("rig_queue_show", {
1442
- ...worded("rig_queue_show", "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.", READ_ONLY),
1598
+ ...worded("rig_queue_show", "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. The item's sourceSession is who created it, and each transition's actorSession and identityPrincipal (with its grant) name who made that change, not necessarily you; for an external connection, viewer is you (this connection), and createdBy and each transition's actor say whether that one is you (you: null when no principal was recorded to tell). host needs the daemon's owner (the stdio server, an HTTP owner token, or unauthenticated loopback), not an ordinary scoped grant.", READ_ONLY),
1443
1599
  inputSchema: z.object({
1444
1600
  qitemId: z.string().describe("The qitemId returned by rig_queue_create (or any queue item)"),
1601
+ host: z.string().min(1).optional().describe("Act on a REGISTERED remote host's daemon instead of this one (rig host list shows the hosts; as --host on the matching rig verb); a write there names this server's seat (rig_whoami) as its sender, as a local write does"),
1445
1602
  }),
1446
- }, async ({ qitemId }) => {
1603
+ }, async ({ qitemId, host }) => {
1447
1604
  try {
1605
+ const target = hostTarget(host);
1606
+ if ("content" in target)
1607
+ return target;
1448
1608
  const id = encodeURIComponent(qitemId);
1449
- const item = await client.get(`/api/queue/${id}`);
1609
+ const item = await hostGet(target, `/api/queue/${id}`);
1450
1610
  if (item.status >= 400)
1451
1611
  return mapResult(item);
1452
1612
  if (scope && !scope.item(item.data))
1453
1613
  return outOfScope(`Item ${qitemId}`);
1454
- const transitions = await client.get(`/api/queue/${id}/transitions`);
1614
+ const transitions = await hostGet(target, `/api/queue/${id}/transitions`);
1455
1615
  if (transitions.status >= 400)
1456
1616
  return mapResult(transitions);
1457
1617
  const row = (item.data ?? {});
1458
1618
  const handedOn = row.state === "handed-off" || row.closureReason === "handed_off_to";
1459
1619
  const view = externalView(scope);
1460
- let successor = handedOn ? await successorOf(client, qitemId, row.closureTarget, view ? scope.item : undefined) : undefined;
1620
+ let successor = handedOn ? await successorOf((path) => hostGet(target, path), qitemId, row.closureTarget, view ? scope.item : undefined) : undefined;
1461
1621
  if (scope && !view && successor && "destinationSession" in successor && !scope.successor(successor.destinationSession))
1462
1622
  successor = { unknown: true, code: "out_of_scope" };
1463
1623
  const shownItem = scope ? withoutDaemonLinkedRows(item.data) : item.data;
1464
1624
  const data = view
1465
- ? { item: projectForExternal(shownItem, view), transitions: Array.isArray(transitions.data) ? transitions.data.map((t) => projectForExternal(t, view)) : transitions.data }
1625
+ ? labelActors({ item: projectForExternal(shownItem, view), transitions: Array.isArray(transitions.data) ? transitions.data.map((t) => projectForExternal(t, view)) : transitions.data }, { seat: seatOf() ?? null, principal: access?.principal ?? null, grant: access?.external?.grant?.id ?? null })
1466
1626
  : { item: shownItem, transitions: transitions.data };
1467
1627
  return mapResult({ status: 200, data: { ...data, ...(handedOn ? { successor } : {}) } }, undefined, { structured: true });
1468
1628
  }
@@ -1473,7 +1633,7 @@ export function createMcpServer(client, options = {}) {
1473
1633
  // 21. rig_queue_list — list queue items
1474
1634
  if (offered("rig_queue_list"))
1475
1635
  server.registerTool("rig_queue_list", {
1476
- ...worded("rig_queue_list", "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. tags are exact, case-sensitive AND filters; mission and slice add their corresponding exact tags.", READ_ONLY),
1636
+ ...worded("rig_queue_list", "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. tags are exact, case-sensitive AND filters; mission and slice add their corresponding exact tags. host needs the daemon's owner (the stdio server, an HTTP owner token, or unauthenticated loopback), not an ordinary scoped grant.", READ_ONLY),
1477
1637
  inputSchema: z.object({
1478
1638
  owned: z.boolean().optional().describe("Only items assigned to this seat: its whole inbox (overrides destination)"),
1479
1639
  mine: z.boolean().optional().describe("Items this seat sent or owns"),
@@ -1487,9 +1647,13 @@ export function createMcpServer(client, options = {}) {
1487
1647
  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"),
1488
1648
  handedOffFrom: z.string().optional().describe("The items handed on from this qitemId, in any state and any rig"),
1489
1649
  limit: z.number().int().positive().optional().describe("Result limit (default 100)"),
1650
+ host: z.string().min(1).optional().describe("Act on a REGISTERED remote host's daemon instead of this one (rig host list shows the hosts; as --host on the matching rig verb); a write there names this server's seat (rig_whoami) as its sender, as a local write does"),
1490
1651
  }),
1491
- }, async ({ owned, mine: mineAsked, destination, source, state, tags: requestedTags, mission, slice, all, since, handedOffFrom, limit }) => {
1652
+ }, async ({ owned, mine: mineAsked, destination, source, state, tags: requestedTags, mission, slice, all, since, handedOffFrom, limit, host }) => {
1492
1653
  try {
1654
+ const target = hostTarget(host);
1655
+ if ("content" in target)
1656
+ return target;
1493
1657
  if ([...(requestedTags ?? []), ...(mission === undefined ? [] : [mission]), ...(slice === undefined ? [] : [slice])]
1494
1658
  .some((value) => value.trim().length === 0)) {
1495
1659
  const message = "tag filters cannot be blank";
@@ -1540,7 +1704,7 @@ export function createMcpServer(client, options = {}) {
1540
1704
  if (handedOffFrom)
1541
1705
  params.set("handedOffFrom", handedOffFrom);
1542
1706
  params.set("limit", String(limit ?? 100));
1543
- const res = await client.get(`/api/queue/list?${params.toString()}`);
1707
+ const res = await hostGet(target, `/api/queue/list?${params.toString()}`);
1544
1708
  const ignored = res.status < 400 ? ignoredFilter(res.data, { since, handedOffFrom, tags }) : null;
1545
1709
  if (ignored) {
1546
1710
  const message = `The daemon didn't apply ${ignored}, so this list isn't filtered by it; it needs a newer daemon.`;
@@ -1550,7 +1714,16 @@ export function createMcpServer(client, options = {}) {
1550
1714
  if (scope && res.status < 400 && Array.isArray(res.data)) {
1551
1715
  const view = externalView(scope);
1552
1716
  const rows = res.data.filter((row) => scope.item(row));
1553
- return mapResult({ ...res, data: view ? rows.map((row) => projectForExternal(row, view)) : rows }, undefined, { structured: true });
1717
+ const result = mapResult({ ...res, data: view ? rows.map((row) => projectForExternal(row, view)) : rows }, undefined, { structured: true });
1718
+ // An external caller's empty inbox says so in a line its assistant can repeat, naming the team as the person
1719
+ // knows it. The rows keep their shape; the line rides beside them, only when nothing narrowed the list. The
1720
+ // default list holds open items only, so its empty answer says no open requests, never none at all.
1721
+ const inbox = access?.external && (owned || mine) && !destination && !source && !state && tags.length === 0 && !since && !handedOffFrom;
1722
+ if (!inbox || rows.length > 0)
1723
+ return result;
1724
+ const team = teamPhrase(rosterTeamName(rostersFolder(), sessionName.split("@")[1] ?? "").name);
1725
+ const message = `No ${all ? "" : "open "}requests are addressed to you on ${team}.`;
1726
+ return { ...result, content: [...result.content, { type: "text", text: message }], structuredContent: { ...result.structuredContent, message } };
1554
1727
  }
1555
1728
  return mapResult(res, undefined, { structured: true });
1556
1729
  }
@@ -1580,7 +1753,7 @@ export function createMcpServer(client, options = {}) {
1580
1753
  // 23. rig_queue_update — record progress, block, or close with the answer
1581
1754
  if (offered("rig_queue_update"))
1582
1755
  server.registerTool("rig_queue_update", {
1583
- ...worded("rig_queue_update", "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.", DESTRUCTIVE),
1756
+ ...worded("rig_queue_update", "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. host needs the daemon's owner (the stdio server, an HTTP owner token, or unauthenticated loopback), not an ordinary scoped grant.", DESTRUCTIVE),
1584
1757
  inputSchema: z.object({
1585
1758
  qitemId: z.string().describe("The queue item to update"),
1586
1759
  state: z.string().optional().describe("New state (e.g. in-progress, blocked, done)"),
@@ -1590,12 +1763,16 @@ export function createMcpServer(client, options = {}) {
1590
1763
  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)"),
1591
1764
  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)"),
1592
1765
  summary: z.string().optional().describe("Replace the one-line summary"),
1593
- 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. For a code result, a JSON file of kind openrig.code-result/v1 with repo, base and revision (full commit ids) and paths lets a reader diff it exactly"),
1766
+ evidenceRef: z.string().optional().describe("Pointer to the durable artifact, stored on the item with a state change (a park, a done close; a blank one isn't stored). For a code result, a JSON file of kind openrig.code-result/v1 with repo, base and revision (full commit ids) and paths lets a reader diff it exactly"),
1594
1767
  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)"),
1595
1768
  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."),
1769
+ host: z.string().min(1).optional().describe("Act on a REGISTERED remote host's daemon instead of this one (rig host list shows the hosts; as --host on the matching rig verb); a write there names this server's seat (rig_whoami) as its sender, as a local write does"),
1596
1770
  }),
1597
- }, async ({ qitemId, state, closureReason, closureTarget, note, resolution, reopen, summary, evidenceRef, blockedOn, wakeAfterSeconds }) => {
1771
+ }, async ({ qitemId, state, closureReason, closureTarget, note, resolution, reopen, summary, evidenceRef, blockedOn, wakeAfterSeconds, host }) => {
1598
1772
  try {
1773
+ const target = hostTarget(host);
1774
+ if ("content" in target)
1775
+ return target;
1599
1776
  const denied = await itemOutOfScope(qitemId, "owner");
1600
1777
  if (denied)
1601
1778
  return denied;
@@ -1606,7 +1783,7 @@ export function createMcpServer(client, options = {}) {
1606
1783
  if (!blocker || blocker.status >= 400 || !scope?.item(blocker.data))
1607
1784
  return outOfScope(`Blocker ${blockedOn ?? "(none named)"}`);
1608
1785
  }
1609
- const res = await client.post(`/api/queue/${encodeURIComponent(qitemId)}/update`, {
1786
+ const res = await hostPost(target, `/api/queue/${encodeURIComponent(qitemId)}/update`, {
1610
1787
  state, closureReason, closureTarget, summary, evidenceRef, blockedOn, wakeAfterSeconds, transitionNote: note, resolution, reopen,
1611
1788
  });
1612
1789
  // An external caller's updated item goes through the same projection as show and list.
@@ -1738,7 +1915,7 @@ export function createMcpServer(client, options = {}) {
1738
1915
  // 27. rig_team — a rig's seats and its lead
1739
1916
  if (offered("rig_team"))
1740
1917
  server.registerTool("rig_team", {
1741
- ...worded("rig_team", "Show a rig's team. For an external grant, omit rigId to use its sole rig or see its granted names to choose from. The answer includes 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.", READ_ONLY),
1918
+ ...worded("rig_team", "Show a rig's team. For an external grant, omit rigId to use its sole rig or see its granted names to choose from. The answer includes 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. rig.displayName and a member's label, where a roster authors them, are the names the person knows them by.", READ_ONLY),
1742
1919
  inputSchema: z.object({
1743
1920
  rigId: z.string().optional().describe("Rig name or id. A connection from outside the rig (an external grant) usually leaves this out, and the tool finds its team; if it passes one, it must be the granted rig's name, never its id or the team's display name."),
1744
1921
  }),
@@ -1779,8 +1956,15 @@ export function createMcpServer(client, options = {}) {
1779
1956
  const rigName = (detail.data ?? {}).rig?.name ?? "";
1780
1957
  const inventory = Array.isArray(nodes.data) ? nodes.data : [];
1781
1958
  // A node is a seat whether or not it has a session yet: its address derives from its logical id (pod.member).
1782
- const nodeSeats = new Set(inventory.flatMap((seat) => [seat.canonicalSessionName,
1783
- typeof seat.logicalId === "string" ? `${seat.logicalId.replace(".", "-")}@${rigName}` : null]).filter((name) => typeof name === "string"));
1959
+ const logicalAddress = (logicalId) => typeof logicalId === "string" ? `${logicalId.replace(".", "-")}@${rigName}` : null;
1960
+ const nodeSeats = new Set(inventory.flatMap((seat) => [seat.canonicalSessionName, logicalAddress(seat.logicalId)])
1961
+ .filter((name) => typeof name === "string"));
1962
+ // An external caller's own seat, under any name it's matched by: its session's name or its logical address, the
1963
+ // same mapping the roster match uses. Its node's other name is its too.
1964
+ const caller = access?.external ? seatOf() : undefined;
1965
+ const callerNode = caller ? inventory.find((seat) => seat.canonicalSessionName === caller || logicalAddress(seat.logicalId) === caller) : undefined;
1966
+ const ownNames = new Set([caller, callerNode?.canonicalSessionName, logicalAddress(callerNode?.logicalId)]
1967
+ .filter((name) => typeof name === "string"));
1784
1968
  // One read of the daemon's check-ins serves every member in this answer.
1785
1969
  let checkIns;
1786
1970
  const checkInOf = async (seat) => {
@@ -1798,14 +1982,44 @@ export function createMcpServer(client, options = {}) {
1798
1982
  };
1799
1983
  const hosted = await hostedMembersOf(rostersFolder(), rigName, nodeSeats, async () => inventory.find((seat) => typeof seat.hostSelfId === "string")?.hostSelfId
1800
1984
  ?? await client.get("/healthz").then((res) => (res.status < 400 ? (res.data ?? {}).selfHostId ?? null : null), () => null), async (seat) => {
1985
+ // An external caller's own seat is listed so it can see its address, without a line about its own activity.
1986
+ if (ownNames.has(seat))
1987
+ return null;
1801
1988
  const rows = await client.get(`/api/queue/list?${new URLSearchParams({ destinationSession: seat, compact: "1", limit: String(PRESENCE_ROWS) }).toString()}`)
1802
1989
  .then((res) => (res.status < 400 ? res.data : null), () => null);
1803
1990
  // An external caller sees a ring only on an item it may read, so another pair's item isn't named.
1804
1991
  const visible = access?.external && Array.isArray(rows) ? rows.filter((row) => scope?.item(row)) : rows;
1805
1992
  return { lastCallAt: readPresence(presenceFile())[seat]?.lastCallAt ?? null, lastWake: newestWake(visible, seat),
1806
1993
  lastWakeScope: `the latest ring among its ${PRESENCE_ROWS} most recent rows`, checkIn: await checkInOf(seat) };
1994
+ }, !!access?.external);
1995
+ const note = hosted.note ? { hostedMembersNote: hosted.note } : {};
1996
+ // The names a person knows the team by are for a person's assistant on an external grant; an internal caller's
1997
+ // answer is as it was.
1998
+ if (!access?.external)
1999
+ return mapResult({ status: 200, data: { ...view, hostedMembers: hosted.members, ...note } }, undefined, { structured: true });
2000
+ // The caller's own entry keeps its address and identity, with no line about its own activity.
2001
+ // A node seat on a roster carries its authored entry and presence; a seat on none is as the daemon reports it.
2002
+ const seats = view.seats.map((seat) => {
2003
+ const address = logicalAddress(seat.logicalId);
2004
+ const entry = hosted.seats.get(seat.session) ?? (address ? hosted.seats.get(address) : undefined);
2005
+ const merged = entry ? { ...seat, ...entry } : seat;
2006
+ if (!ownNames.has(merged.session) && !(address && ownNames.has(address)))
2007
+ return merged;
2008
+ const { activity: _activity, sessionStatus: _status, ...identity } = merged;
2009
+ return identity;
2010
+ });
2011
+ const hostedMembers = hosted.members.map((member) => {
2012
+ if (!ownNames.has(member.session))
2013
+ return member;
2014
+ const { activity: _activity, ...identity } = member;
2015
+ return identity;
1807
2016
  });
1808
- return mapResult({ status: 200, data: { ...view, hostedMembers: hosted.members, ...(hosted.note ? { hostedMembersNote: hosted.note } : {}) } }, undefined, { structured: true });
2017
+ // The name the person knows the team by, where its network roster names it; otherwise the rig's own fields, and why
2018
+ // an authored name isn't shown.
2019
+ const team = rosterTeamName(rostersFolder(), rigName);
2020
+ const rigView = { ...view.rig, ...(team.name ? { displayName: team.name } : {}),
2021
+ ...(team.problem ? { displayNameProblem: team.problem } : {}) };
2022
+ return mapResult({ status: 200, data: { ...view, rig: rigView, seats, hostedMembers, ...note } }, undefined, { structured: true });
1809
2023
  }
1810
2024
  catch (err) {
1811
2025
  return caught(err);
@@ -2243,7 +2457,7 @@ export function createMcpServer(client, options = {}) {
2243
2457
  // 35. rig_queue_handoff — pass an item on to the next seat in one step, the route `rig queue handoff` uses
2244
2458
  if (offered("rig_queue_handoff"))
2245
2459
  server.registerTool("rig_queue_handoff", {
2246
- 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.",
2460
+ 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. host needs the daemon's owner (the stdio server, an HTTP owner token, or unauthenticated loopback), not an ordinary scoped grant.",
2247
2461
  inputSchema: z.object({
2248
2462
  qitemId: z.string().describe("The queue item to pass on"),
2249
2463
  to: z.string().describe("The next seat (e.g. qa@my-rig)"),
@@ -2253,9 +2467,13 @@ export function createMcpServer(client, options = {}) {
2253
2467
  tags: z.array(z.string()).optional().describe("Tags for the new item (default: the item's own)"),
2254
2468
  priority: z.string().optional().describe("Priority for the new item (default: the item's own)"),
2255
2469
  evidenceRef: z.string().optional().describe("Pointer to the durable artifact, which a new item for a person needs"),
2470
+ host: z.string().min(1).optional().describe("Act on a REGISTERED remote host's daemon instead of this one (rig host list shows the hosts; as --host on the matching rig verb); a write there names this server's seat (rig_whoami) as its sender, as a local write does"),
2256
2471
  }),
2257
2472
  annotations: DESTRUCTIVE,
2258
- }, async ({ qitemId, to, body, note, summary, tags, priority, evidenceRef }) => {
2473
+ }, async ({ qitemId, to, body, note, summary, tags, priority, evidenceRef, host }) => {
2474
+ const target = hostTarget(host);
2475
+ if ("content" in target)
2476
+ return target;
2259
2477
  if (scope && !scope.session(to))
2260
2478
  return outOfScope(`Destination ${to}`);
2261
2479
  try {
@@ -2267,14 +2485,14 @@ export function createMcpServer(client, options = {}) {
2267
2485
  return caught(err);
2268
2486
  }
2269
2487
  try {
2270
- return mapResult(await client.post(`/api/queue/${encodeURIComponent(qitemId)}/handoff`, {
2488
+ return mapResult(await hostPost(target, `/api/queue/${encodeURIComponent(qitemId)}/handoff`, {
2271
2489
  toSession: to, body, transitionNote: note, summary, tags, priority, evidenceRef,
2272
2490
  }), undefined, { structured: true });
2273
2491
  }
2274
2492
  catch (err) {
2275
2493
  const failure = caught(err);
2276
- const text = `${err.message} The outcome is unknown: check rig_queue_show with qitemId ${qitemId} before retrying. If it reads handed off, its successor is the new item, so don't hand it off again.`;
2277
- return { ...failure, content: [{ type: "text", text }], structuredContent: { ...failure.structuredContent, qitemId, outcome: "unknown" } };
2494
+ const text = `${err.message} The outcome is unknown: check rig_queue_show with qitemId ${qitemId}${target.remote && target.name ? ` and host ${target.name}` : ""} before retrying. If it reads handed off, its successor is the new item, so don't hand it off again.`;
2495
+ return { ...failure, content: [{ type: "text", text }], structuredContent: { ...failure.structuredContent, qitemId, outcome: "unknown", ...(target.remote && target.name ? { host: target.name } : {}) } };
2278
2496
  }
2279
2497
  });
2280
2498
  // 36. rig_queue_unclaim — put back an item this seat claimed and won't finish