@openrig/cli 0.7.23 → 0.7.24

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 (666) hide show
  1. package/README.md +7 -7
  2. package/daemon/assets/claude-hook-bridge.cjs +575 -6
  3. package/daemon/assets/claude-hook-bridge.d.cts +5 -0
  4. package/daemon/assets/claude-permission-policies.cjs +4 -3
  5. package/daemon/assets/guidance/openrig-context-entry.md +1 -0
  6. package/daemon/assets/plugins/openrig/.claude-plugin/plugin.json +4 -3
  7. package/daemon/assets/plugins/openrig/.codex-plugin/plugin.json +3 -2
  8. package/daemon/assets/plugins/openrig/.cursor-plugin/plugin.json +1 -1
  9. package/daemon/assets/plugins/openrig/README.md +64 -9
  10. package/daemon/assets/plugins/openrig/hooks/claude.json +39 -0
  11. package/daemon/assets/plugins/openrig/hooks/codex.json +27 -0
  12. package/daemon/assets/plugins/openrig/hooks/scripts/claude-hook-bridge.cjs +715 -0
  13. package/daemon/assets/plugins/openrig/plugin.json +1 -1
  14. package/daemon/assets/plugins/openrig/scripts/run-rig.cjs +30 -0
  15. package/daemon/assets/plugins/openrig/skills/working-with-an-openrig-team/SKILL.md +71 -9
  16. package/daemon/assets/plugins/openrig-codex/.agents/plugins/marketplace.json +15 -0
  17. package/daemon/assets/plugins/openrig-codex/.codex-plugin/plugin.json +42 -0
  18. package/daemon/assets/plugins/openrig-codex/LICENSE +200 -0
  19. package/daemon/assets/plugins/openrig-codex/assets/logo.svg +1 -0
  20. package/daemon/assets/plugins/openrig-codex/hooks/codex.json +27 -0
  21. package/daemon/assets/plugins/openrig-codex/hooks/scripts/claude-hook-bridge.cjs +715 -0
  22. package/daemon/assets/plugins/openrig-codex/skills/working-with-an-openrig-team/SKILL.md +175 -0
  23. package/daemon/assets/plugins/openrig-core/.claude-plugin/plugin.json +1 -1
  24. package/daemon/assets/plugins/openrig-core/.codex-plugin/plugin.json +1 -1
  25. package/daemon/assets/plugins/openrig-core/README.md +10 -2
  26. package/daemon/assets/plugins/openrig-core/hooks/claude.json +9 -0
  27. package/daemon/assets/plugins/openrig-core/hooks/scripts/activity-relay.cjs +37 -0
  28. package/daemon/assets/plugins/openrig-core/hooks/scripts/compaction-restore-bridge.cjs +3 -1
  29. package/daemon/assets/plugins/openrig-core/hooks/scripts/permission-answer.cjs +270 -0
  30. package/daemon/assets/plugins/openrig-core/hooks/scripts/refocus.cjs +24 -6
  31. package/daemon/assets/plugins/openrig-core/skills/claude-compaction-restore/scripts/precompact-hook.mjs +7 -8
  32. package/daemon/assets/plugins/openrig-core/skills/claude-compaction-restore/scripts/restore-from-jsonl.mjs +45 -5
  33. package/daemon/assets/plugins/openrig-core/skills/openrig-user/SKILL.md +4 -2
  34. package/daemon/assets/plugins/openrig-core/skills/refocusing/scripts/trace-to-root.py +163 -23
  35. package/daemon/assets/skills/rigs/SKILL.md +122 -21
  36. package/daemon/context-packs/help/manifest.yaml +1 -1
  37. package/daemon/context-packs/onboarding-width/manifest.yaml +1 -1
  38. package/daemon/context-packs/onboarding-width/public-what-you-can-do.md +113 -12
  39. package/daemon/context-packs/reference/acp-agents.md +9 -2
  40. package/daemon/context-packs/reference/getting-started.md +31 -7
  41. package/daemon/context-packs/reference/manifest.yaml +1 -1
  42. package/daemon/context-packs/reference/rig-spec.md +8 -0
  43. package/daemon/context-packs/reference/tmux-servers.md +16 -0
  44. package/daemon/context-packs/reference/whats-new.md +106 -12
  45. package/daemon/context-packs/skills/agent-operated-software/manifest.yaml +1 -1
  46. package/daemon/context-packs/skills/agent-operated-workflows/manifest.yaml +1 -1
  47. package/daemon/context-packs/skills/applying-a-permission-policy/manifest.yaml +1 -1
  48. package/daemon/context-packs/skills/claude-compaction-restore/manifest.yaml +1 -1
  49. package/daemon/context-packs/skills/claude-compaction-restore/scripts/precompact-hook.mjs +7 -8
  50. package/daemon/context-packs/skills/claude-compaction-restore/scripts/restore-from-jsonl.mjs +45 -5
  51. package/daemon/context-packs/skills/core/agent-starters/manifest.yaml +1 -1
  52. package/daemon/context-packs/skills/core/agent-startup-and-context-ingestion/manifest.yaml +1 -1
  53. package/daemon/context-packs/skills/core/cross-host-rig-commands/manifest.yaml +1 -1
  54. package/daemon/context-packs/skills/core/human-in-the-loop/manifest.yaml +1 -1
  55. package/daemon/context-packs/skills/core/messaging-the-human/manifest.yaml +1 -1
  56. package/daemon/context-packs/skills/core/openrig-architect/manifest.yaml +1 -1
  57. package/daemon/context-packs/skills/core/openrig-cmux/manifest.yaml +1 -1
  58. package/daemon/context-packs/skills/core/openrig-herdr/manifest.yaml +1 -1
  59. package/daemon/context-packs/skills/core/openrig-skills/manifest.yaml +1 -1
  60. package/daemon/context-packs/skills/core/openrig-software-factory/manifest.yaml +1 -1
  61. package/daemon/context-packs/skills/core/openrig-upgrade/manifest.yaml +1 -1
  62. package/daemon/context-packs/skills/core/rig-bundles-and-shareable-artifacts/manifest.yaml +1 -1
  63. package/daemon/context-packs/skills/core/rig-lifecycle/manifest.yaml +1 -1
  64. package/daemon/context-packs/skills/core/session-source-fork/manifest.yaml +1 -1
  65. package/daemon/context-packs/skills/core/specification-system/manifest.yaml +1 -1
  66. package/daemon/context-packs/skills/core/topology-mutation-and-seat-management/manifest.yaml +1 -1
  67. package/daemon/context-packs/skills/core/watchdog/manifest.yaml +1 -1
  68. package/daemon/context-packs/skills/core/working-with-an-openrig-team/SKILL.md +71 -9
  69. package/daemon/context-packs/skills/core/working-with-an-openrig-team/manifest.yaml +1 -1
  70. package/daemon/context-packs/skills/delegating-work/manifest.yaml +1 -1
  71. package/daemon/context-packs/skills/forming-an-openrig-mental-model/manifest.yaml +1 -1
  72. package/daemon/context-packs/skills/loading-addressable-markdown/manifest.yaml +1 -1
  73. package/daemon/context-packs/skills/mission-slice-sop/manifest.yaml +1 -1
  74. package/daemon/context-packs/skills/openrig-operating-model/manifest.yaml +1 -1
  75. package/daemon/context-packs/skills/openrig-user/SKILL.md +4 -2
  76. package/daemon/context-packs/skills/openrig-user/manifest.yaml +1 -1
  77. package/daemon/context-packs/skills/orienting-to-an-inherited-seat/manifest.yaml +1 -1
  78. package/daemon/context-packs/skills/pm/backlog-capture/manifest.yaml +1 -1
  79. package/daemon/context-packs/skills/pm/context-builder/manifest.yaml +1 -1
  80. package/daemon/context-packs/skills/pm/exec-summary/manifest.yaml +1 -1
  81. package/daemon/context-packs/skills/pm/office-hours/manifest.yaml +1 -1
  82. package/daemon/context-packs/skills/pm/plan-review/manifest.yaml +1 -1
  83. package/daemon/context-packs/skills/pm/requirements-writer/manifest.yaml +1 -1
  84. package/daemon/context-packs/skills/pm/ui-mockup/manifest.yaml +1 -1
  85. package/daemon/context-packs/skills/pods/development-team/manifest.yaml +1 -1
  86. package/daemon/context-packs/skills/pods/orchestration-team/manifest.yaml +1 -1
  87. package/daemon/context-packs/skills/pods/oversight-team/manifest.yaml +1 -1
  88. package/daemon/context-packs/skills/pods/review-team/manifest.yaml +1 -1
  89. package/daemon/context-packs/skills/process/agent-browser/manifest.yaml +1 -1
  90. package/daemon/context-packs/skills/process/context-engineering/manifest.yaml +1 -1
  91. package/daemon/context-packs/skills/process/dogfood/manifest.yaml +1 -1
  92. package/daemon/context-packs/skills/process/frontend-design/manifest.yaml +1 -1
  93. package/daemon/context-packs/skills/process/systematic-debugging/manifest.yaml +1 -1
  94. package/daemon/context-packs/skills/process/test-driven-development/manifest.yaml +1 -1
  95. package/daemon/context-packs/skills/process/verification-before-completion/manifest.yaml +1 -1
  96. package/daemon/context-packs/skills/queue-handoff/manifest.yaml +1 -1
  97. package/daemon/context-packs/skills/refocusing/manifest.yaml +1 -1
  98. package/daemon/context-packs/skills/refocusing/scripts/trace-to-root.py +163 -23
  99. package/daemon/context-packs/skills/retiring-and-inheriting-a-seat/manifest.yaml +1 -1
  100. package/daemon/context-packs/skills/seat-continuity-and-handover/manifest.yaml +1 -1
  101. package/daemon/context-packs/skills/session-compaction-and-restore/manifest.yaml +1 -1
  102. package/daemon/context-packs/skills/software-for-agents/manifest.yaml +1 -1
  103. package/daemon/context-packs/world-example/manifest.yaml +1 -1
  104. package/daemon/context-packs/world-public/manifest.yaml +1 -1
  105. package/daemon/dist/adapters/claude-code-adapter.d.ts +10 -1
  106. package/daemon/dist/adapters/claude-code-adapter.d.ts.map +1 -1
  107. package/daemon/dist/adapters/claude-code-adapter.js +231 -33
  108. package/daemon/dist/adapters/claude-code-adapter.js.map +1 -1
  109. package/daemon/dist/adapters/claude-resume-launch.d.ts +3 -0
  110. package/daemon/dist/adapters/claude-resume-launch.d.ts.map +1 -1
  111. package/daemon/dist/adapters/claude-resume-launch.js +5 -0
  112. package/daemon/dist/adapters/claude-resume-launch.js.map +1 -1
  113. package/daemon/dist/adapters/claude-resume.d.ts.map +1 -1
  114. package/daemon/dist/adapters/claude-resume.js +59 -21
  115. package/daemon/dist/adapters/claude-resume.js.map +1 -1
  116. package/daemon/dist/adapters/community-harness-runtime-adapter.d.ts +22 -0
  117. package/daemon/dist/adapters/community-harness-runtime-adapter.d.ts.map +1 -1
  118. package/daemon/dist/adapters/community-harness-runtime-adapter.js +53 -16
  119. package/daemon/dist/adapters/community-harness-runtime-adapter.js.map +1 -1
  120. package/daemon/dist/adapters/pi-community-runtime-adapter.d.ts +9 -0
  121. package/daemon/dist/adapters/pi-community-runtime-adapter.d.ts.map +1 -1
  122. package/daemon/dist/adapters/pi-community-runtime-adapter.js +6 -0
  123. package/daemon/dist/adapters/pi-community-runtime-adapter.js.map +1 -1
  124. package/daemon/dist/adapters/pi-runtime-adapter.d.ts +3 -0
  125. package/daemon/dist/adapters/pi-runtime-adapter.d.ts.map +1 -1
  126. package/daemon/dist/adapters/pi-runtime-adapter.js +9 -3
  127. package/daemon/dist/adapters/pi-runtime-adapter.js.map +1 -1
  128. package/daemon/dist/adapters/tmux.d.ts +52 -9
  129. package/daemon/dist/adapters/tmux.d.ts.map +1 -1
  130. package/daemon/dist/adapters/tmux.js +102 -19
  131. package/daemon/dist/adapters/tmux.js.map +1 -1
  132. package/daemon/dist/build-info.js +3 -3
  133. package/daemon/dist/conversation-key-surface.d.ts +2 -0
  134. package/daemon/dist/conversation-key-surface.d.ts.map +1 -0
  135. package/daemon/dist/conversation-key-surface.js +5 -0
  136. package/daemon/dist/conversation-key-surface.js.map +1 -0
  137. package/daemon/dist/daemon-shutdown.d.ts +3 -0
  138. package/daemon/dist/daemon-shutdown.d.ts.map +1 -1
  139. package/daemon/dist/daemon-shutdown.js +5 -0
  140. package/daemon/dist/daemon-shutdown.js.map +1 -1
  141. package/daemon/dist/db/all-migrations.d.ts.map +1 -1
  142. package/daemon/dist/db/all-migrations.js +8 -0
  143. package/daemon/dist/db/all-migrations.js.map +1 -1
  144. package/daemon/dist/db/migrations/179_community_harness_runtime_switches.d.ts +14 -0
  145. package/daemon/dist/db/migrations/179_community_harness_runtime_switches.d.ts.map +1 -0
  146. package/daemon/dist/db/migrations/179_community_harness_runtime_switches.js +54 -0
  147. package/daemon/dist/db/migrations/179_community_harness_runtime_switches.js.map +1 -0
  148. package/daemon/dist/db/migrations/195_workflow_start_operations.d.ts +4 -0
  149. package/daemon/dist/db/migrations/195_workflow_start_operations.d.ts.map +1 -0
  150. package/daemon/dist/db/migrations/195_workflow_start_operations.js +13 -0
  151. package/daemon/dist/db/migrations/195_workflow_start_operations.js.map +1 -0
  152. package/daemon/dist/db/migrations/196_queue_item_evidence_ref_roots.d.ts +5 -0
  153. package/daemon/dist/db/migrations/196_queue_item_evidence_ref_roots.d.ts.map +1 -0
  154. package/daemon/dist/db/migrations/196_queue_item_evidence_ref_roots.js +7 -0
  155. package/daemon/dist/db/migrations/196_queue_item_evidence_ref_roots.js.map +1 -0
  156. package/daemon/dist/db/migrations/199_queue_items_native_permission_index.d.ts +9 -0
  157. package/daemon/dist/db/migrations/199_queue_items_native_permission_index.d.ts.map +1 -0
  158. package/daemon/dist/db/migrations/199_queue_items_native_permission_index.js +14 -0
  159. package/daemon/dist/db/migrations/199_queue_items_native_permission_index.js.map +1 -0
  160. package/daemon/dist/domain/agent-manifest.d.ts.map +1 -1
  161. package/daemon/dist/domain/agent-manifest.js +8 -0
  162. package/daemon/dist/domain/agent-manifest.js.map +1 -1
  163. package/daemon/dist/domain/background-process-evidence.d.ts +23 -0
  164. package/daemon/dist/domain/background-process-evidence.d.ts.map +1 -0
  165. package/daemon/dist/domain/background-process-evidence.js +81 -0
  166. package/daemon/dist/domain/background-process-evidence.js.map +1 -0
  167. package/daemon/dist/domain/chat-repository.d.ts +1 -1
  168. package/daemon/dist/domain/chat-repository.d.ts.map +1 -1
  169. package/daemon/dist/domain/chat-repository.js +2 -2
  170. package/daemon/dist/domain/chat-repository.js.map +1 -1
  171. package/daemon/dist/domain/claude-compaction-enforcer.d.ts +16 -6
  172. package/daemon/dist/domain/claude-compaction-enforcer.d.ts.map +1 -1
  173. package/daemon/dist/domain/claude-compaction-enforcer.js +13 -8
  174. package/daemon/dist/domain/claude-compaction-enforcer.js.map +1 -1
  175. package/daemon/dist/domain/codex-member-permissions.d.ts +35 -0
  176. package/daemon/dist/domain/codex-member-permissions.d.ts.map +1 -1
  177. package/daemon/dist/domain/codex-member-permissions.js +106 -1
  178. package/daemon/dist/domain/codex-member-permissions.js.map +1 -1
  179. package/daemon/dist/domain/community-harness-presets.d.ts +9 -0
  180. package/daemon/dist/domain/community-harness-presets.d.ts.map +1 -1
  181. package/daemon/dist/domain/community-harness-presets.js +25 -1
  182. package/daemon/dist/domain/community-harness-presets.js.map +1 -1
  183. package/daemon/dist/domain/current-work.d.ts +31 -4
  184. package/daemon/dist/domain/current-work.d.ts.map +1 -1
  185. package/daemon/dist/domain/current-work.js +48 -3
  186. package/daemon/dist/domain/current-work.js.map +1 -1
  187. package/daemon/dist/domain/feed/attention-aggregator.d.ts +5 -5
  188. package/daemon/dist/domain/feed/attention-aggregator.d.ts.map +1 -1
  189. package/daemon/dist/domain/feed/attention-aggregator.js +10 -4
  190. package/daemon/dist/domain/feed/attention-aggregator.js.map +1 -1
  191. package/daemon/dist/domain/files/path-safety.d.ts +7 -0
  192. package/daemon/dist/domain/files/path-safety.d.ts.map +1 -1
  193. package/daemon/dist/domain/files/path-safety.js +23 -0
  194. package/daemon/dist/domain/files/path-safety.js.map +1 -1
  195. package/daemon/dist/domain/frontmatter.d.ts.map +1 -1
  196. package/daemon/dist/domain/frontmatter.js +4 -2
  197. package/daemon/dist/domain/frontmatter.js.map +1 -1
  198. package/daemon/dist/domain/gateway/destination-resolver.d.ts +3 -0
  199. package/daemon/dist/domain/gateway/destination-resolver.d.ts.map +1 -1
  200. package/daemon/dist/domain/gateway/destination-resolver.js +9 -0
  201. package/daemon/dist/domain/gateway/destination-resolver.js.map +1 -1
  202. package/daemon/dist/domain/gateway/human-quiet-windows.d.ts.map +1 -1
  203. package/daemon/dist/domain/gateway/human-quiet-windows.js +2 -1
  204. package/daemon/dist/domain/gateway/human-quiet-windows.js.map +1 -1
  205. package/daemon/dist/domain/gateway/slack/inbound.d.ts +6 -1
  206. package/daemon/dist/domain/gateway/slack/inbound.d.ts.map +1 -1
  207. package/daemon/dist/domain/gateway/slack/inbound.js +4 -1
  208. package/daemon/dist/domain/gateway/slack/inbound.js.map +1 -1
  209. package/daemon/dist/domain/gateway/slack/message.d.ts +3 -0
  210. package/daemon/dist/domain/gateway/slack/message.d.ts.map +1 -1
  211. package/daemon/dist/domain/gateway/slack/message.js +3 -2
  212. package/daemon/dist/domain/gateway/slack/message.js.map +1 -1
  213. package/daemon/dist/domain/gateway/slack/outbound-driver.d.ts +4 -0
  214. package/daemon/dist/domain/gateway/slack/outbound-driver.d.ts.map +1 -1
  215. package/daemon/dist/domain/gateway/slack/outbound-driver.js +1 -0
  216. package/daemon/dist/domain/gateway/slack/outbound-driver.js.map +1 -1
  217. package/daemon/dist/domain/gateway/slack/queue-access.d.ts +2 -0
  218. package/daemon/dist/domain/gateway/slack/queue-access.d.ts.map +1 -1
  219. package/daemon/dist/domain/gateway/slack/queue-access.js +1 -0
  220. package/daemon/dist/domain/gateway/slack/queue-access.js.map +1 -1
  221. package/daemon/dist/domain/gateway/slack/slack-delivery.d.ts +10 -2
  222. package/daemon/dist/domain/gateway/slack/slack-delivery.d.ts.map +1 -1
  223. package/daemon/dist/domain/gateway/slack/slack-delivery.js +60 -6
  224. package/daemon/dist/domain/gateway/slack/slack-delivery.js.map +1 -1
  225. package/daemon/dist/domain/gateway/slack/slack-subsystem.d.ts +3 -13
  226. package/daemon/dist/domain/gateway/slack/slack-subsystem.d.ts.map +1 -1
  227. package/daemon/dist/domain/gateway/slack/slack-subsystem.js +70 -22
  228. package/daemon/dist/domain/gateway/slack/slack-subsystem.js.map +1 -1
  229. package/daemon/dist/domain/health-detectors.d.ts +4 -0
  230. package/daemon/dist/domain/health-detectors.d.ts.map +1 -1
  231. package/daemon/dist/domain/health-detectors.js +4 -1
  232. package/daemon/dist/domain/health-detectors.js.map +1 -1
  233. package/daemon/dist/domain/health-diagnosis.d.ts.map +1 -1
  234. package/daemon/dist/domain/health-diagnosis.js +14 -9
  235. package/daemon/dist/domain/health-diagnosis.js.map +1 -1
  236. package/daemon/dist/domain/health-passive-ceremony.d.ts +2 -0
  237. package/daemon/dist/domain/health-passive-ceremony.d.ts.map +1 -1
  238. package/daemon/dist/domain/health-passive-ceremony.js +71 -13
  239. package/daemon/dist/domain/health-passive-ceremony.js.map +1 -1
  240. package/daemon/dist/domain/history-query.d.ts +1 -1
  241. package/daemon/dist/domain/history-query.d.ts.map +1 -1
  242. package/daemon/dist/domain/history-query.js +1 -2
  243. package/daemon/dist/domain/history-query.js.map +1 -1
  244. package/daemon/dist/domain/hosts/read-through.d.ts.map +1 -1
  245. package/daemon/dist/domain/hosts/read-through.js +6 -0
  246. package/daemon/dist/domain/hosts/read-through.js.map +1 -1
  247. package/daemon/dist/domain/managed-restore-read-access.d.ts +18 -0
  248. package/daemon/dist/domain/managed-restore-read-access.d.ts.map +1 -1
  249. package/daemon/dist/domain/managed-restore-read-access.js +41 -1
  250. package/daemon/dist/domain/managed-restore-read-access.js.map +1 -1
  251. package/daemon/dist/domain/mission-control/audit-browse.d.ts +1 -1
  252. package/daemon/dist/domain/mission-control/audit-browse.d.ts.map +1 -1
  253. package/daemon/dist/domain/mission-control/audit-browse.js +3 -6
  254. package/daemon/dist/domain/mission-control/audit-browse.js.map +1 -1
  255. package/daemon/dist/domain/mission-control/mission-control-write-contract.d.ts.map +1 -1
  256. package/daemon/dist/domain/mission-control/mission-control-write-contract.js +21 -4
  257. package/daemon/dist/domain/mission-control/mission-control-write-contract.js.map +1 -1
  258. package/daemon/dist/domain/native-resume-probe.d.ts +22 -0
  259. package/daemon/dist/domain/native-resume-probe.d.ts.map +1 -1
  260. package/daemon/dist/domain/native-resume-probe.js +30 -0
  261. package/daemon/dist/domain/native-resume-probe.js.map +1 -1
  262. package/daemon/dist/domain/network/network-requests.d.ts +3 -2
  263. package/daemon/dist/domain/network/network-requests.d.ts.map +1 -1
  264. package/daemon/dist/domain/network/network-requests.js +34 -8
  265. package/daemon/dist/domain/network/network-requests.js.map +1 -1
  266. package/daemon/dist/domain/node-launcher.d.ts +2 -2
  267. package/daemon/dist/domain/node-launcher.d.ts.map +1 -1
  268. package/daemon/dist/domain/node-launcher.js +9 -7
  269. package/daemon/dist/domain/node-launcher.js.map +1 -1
  270. package/daemon/dist/domain/pane-cutover.d.ts +36 -9
  271. package/daemon/dist/domain/pane-cutover.d.ts.map +1 -1
  272. package/daemon/dist/domain/pane-cutover.js +82 -13
  273. package/daemon/dist/domain/pane-cutover.js.map +1 -1
  274. package/daemon/dist/domain/projection-planner.d.ts +17 -3
  275. package/daemon/dist/domain/projection-planner.d.ts.map +1 -1
  276. package/daemon/dist/domain/projection-planner.js +9 -1
  277. package/daemon/dist/domain/projection-planner.js.map +1 -1
  278. package/daemon/dist/domain/queue-destination-check.d.ts +8 -0
  279. package/daemon/dist/domain/queue-destination-check.d.ts.map +1 -1
  280. package/daemon/dist/domain/queue-destination-check.js +17 -4
  281. package/daemon/dist/domain/queue-destination-check.js.map +1 -1
  282. package/daemon/dist/domain/queue-erasure.js +1 -1
  283. package/daemon/dist/domain/queue-repository.d.ts +20 -1
  284. package/daemon/dist/domain/queue-repository.d.ts.map +1 -1
  285. package/daemon/dist/domain/queue-repository.js +93 -14
  286. package/daemon/dist/domain/queue-repository.js.map +1 -1
  287. package/daemon/dist/domain/queue-stuck-sweep.d.ts +23 -3
  288. package/daemon/dist/domain/queue-stuck-sweep.d.ts.map +1 -1
  289. package/daemon/dist/domain/queue-stuck-sweep.js +618 -13
  290. package/daemon/dist/domain/queue-stuck-sweep.js.map +1 -1
  291. package/daemon/dist/domain/queue-transfer-export.d.ts +1 -1
  292. package/daemon/dist/domain/queue-transfer-export.d.ts.map +1 -1
  293. package/daemon/dist/domain/queue-transfer-export.js +3 -1
  294. package/daemon/dist/domain/queue-transfer-export.js.map +1 -1
  295. package/daemon/dist/domain/queue-transition-log.d.ts +6 -0
  296. package/daemon/dist/domain/queue-transition-log.d.ts.map +1 -1
  297. package/daemon/dist/domain/queue-transition-log.js +1 -1
  298. package/daemon/dist/domain/queue-transition-log.js.map +1 -1
  299. package/daemon/dist/domain/queue-waiting.d.ts.map +1 -1
  300. package/daemon/dist/domain/queue-waiting.js +7 -0
  301. package/daemon/dist/domain/queue-waiting.js.map +1 -1
  302. package/daemon/dist/domain/queue-wake-ladder.d.ts.map +1 -1
  303. package/daemon/dist/domain/queue-wake-ladder.js +20 -4
  304. package/daemon/dist/domain/queue-wake-ladder.js.map +1 -1
  305. package/daemon/dist/domain/rehydrate-eligibility.d.ts +8 -0
  306. package/daemon/dist/domain/rehydrate-eligibility.d.ts.map +1 -1
  307. package/daemon/dist/domain/rehydrate-eligibility.js +61 -9
  308. package/daemon/dist/domain/rehydrate-eligibility.js.map +1 -1
  309. package/daemon/dist/domain/restore-check-service.d.ts.map +1 -1
  310. package/daemon/dist/domain/restore-check-service.js +5 -2
  311. package/daemon/dist/domain/restore-check-service.js.map +1 -1
  312. package/daemon/dist/domain/restore-orchestrator.d.ts +3 -0
  313. package/daemon/dist/domain/restore-orchestrator.d.ts.map +1 -1
  314. package/daemon/dist/domain/restore-orchestrator.js +42 -0
  315. package/daemon/dist/domain/restore-orchestrator.js.map +1 -1
  316. package/daemon/dist/domain/return-route.d.ts +13 -2
  317. package/daemon/dist/domain/return-route.d.ts.map +1 -1
  318. package/daemon/dist/domain/return-route.js +30 -1
  319. package/daemon/dist/domain/return-route.js.map +1 -1
  320. package/daemon/dist/domain/rig-lifecycle-service.d.ts +1 -0
  321. package/daemon/dist/domain/rig-lifecycle-service.d.ts.map +1 -1
  322. package/daemon/dist/domain/rig-lifecycle-service.js +23 -2
  323. package/daemon/dist/domain/rig-lifecycle-service.js.map +1 -1
  324. package/daemon/dist/domain/rig-mode/operating-posture.d.ts.map +1 -1
  325. package/daemon/dist/domain/rig-mode/operating-posture.js +23 -4
  326. package/daemon/dist/domain/rig-mode/operating-posture.js.map +1 -1
  327. package/daemon/dist/domain/rig-teardown.d.ts +30 -2
  328. package/daemon/dist/domain/rig-teardown.d.ts.map +1 -1
  329. package/daemon/dist/domain/rig-teardown.js +76 -8
  330. package/daemon/dist/domain/rig-teardown.js.map +1 -1
  331. package/daemon/dist/domain/rigspec-instantiator.d.ts +11 -9
  332. package/daemon/dist/domain/rigspec-instantiator.d.ts.map +1 -1
  333. package/daemon/dist/domain/rigspec-instantiator.js +100 -43
  334. package/daemon/dist/domain/rigspec-instantiator.js.map +1 -1
  335. package/daemon/dist/domain/rigspec-preflight.d.ts.map +1 -1
  336. package/daemon/dist/domain/rigspec-preflight.js +26 -3
  337. package/daemon/dist/domain/rigspec-preflight.js.map +1 -1
  338. package/daemon/dist/domain/roster-ready-notice.d.ts +11 -0
  339. package/daemon/dist/domain/roster-ready-notice.d.ts.map +1 -0
  340. package/daemon/dist/domain/roster-ready-notice.js +35 -0
  341. package/daemon/dist/domain/roster-ready-notice.js.map +1 -0
  342. package/daemon/dist/domain/runner-permissions.d.ts +140 -5
  343. package/daemon/dist/domain/runner-permissions.d.ts.map +1 -1
  344. package/daemon/dist/domain/runner-permissions.js +593 -16
  345. package/daemon/dist/domain/runner-permissions.js.map +1 -1
  346. package/daemon/dist/domain/runtime-adapter.d.ts +3 -1
  347. package/daemon/dist/domain/runtime-adapter.d.ts.map +1 -1
  348. package/daemon/dist/domain/runtime-exit.d.ts +79 -0
  349. package/daemon/dist/domain/runtime-exit.d.ts.map +1 -0
  350. package/daemon/dist/domain/runtime-exit.js +301 -0
  351. package/daemon/dist/domain/runtime-exit.js.map +1 -0
  352. package/daemon/dist/domain/runtime-switch-materials.d.ts +4 -1
  353. package/daemon/dist/domain/runtime-switch-materials.d.ts.map +1 -1
  354. package/daemon/dist/domain/runtime-switch-materials.js +66 -13
  355. package/daemon/dist/domain/runtime-switch-materials.js.map +1 -1
  356. package/daemon/dist/domain/scope/attestation-lineage.generated.js +2 -2
  357. package/daemon/dist/domain/scope/attestation-lineage.generated.js.map +1 -1
  358. package/daemon/dist/domain/scope/logical-checkbox.d.ts.map +1 -1
  359. package/daemon/dist/domain/scope/logical-checkbox.js +18 -0
  360. package/daemon/dist/domain/scope/logical-checkbox.js.map +1 -1
  361. package/daemon/dist/domain/scope/scaffold-placeholder.js +2 -2
  362. package/daemon/dist/domain/scope/scaffold-placeholder.js.map +1 -1
  363. package/daemon/dist/domain/seat-attention-reconciler.d.ts.map +1 -1
  364. package/daemon/dist/domain/seat-attention-reconciler.js +5 -2
  365. package/daemon/dist/domain/seat-attention-reconciler.js.map +1 -1
  366. package/daemon/dist/domain/seat-handover-service.d.ts +5 -2
  367. package/daemon/dist/domain/seat-handover-service.d.ts.map +1 -1
  368. package/daemon/dist/domain/seat-handover-service.js +30 -6
  369. package/daemon/dist/domain/seat-handover-service.js.map +1 -1
  370. package/daemon/dist/domain/seat-identity-reconciler.d.ts +18 -0
  371. package/daemon/dist/domain/seat-identity-reconciler.d.ts.map +1 -1
  372. package/daemon/dist/domain/seat-identity-reconciler.js +155 -6
  373. package/daemon/dist/domain/seat-identity-reconciler.js.map +1 -1
  374. package/daemon/dist/domain/seat-launch-environment.d.ts +6 -0
  375. package/daemon/dist/domain/seat-launch-environment.d.ts.map +1 -1
  376. package/daemon/dist/domain/seat-launch-environment.js +28 -4
  377. package/daemon/dist/domain/seat-launch-environment.js.map +1 -1
  378. package/daemon/dist/domain/seat-lifecycle-service.d.ts +37 -1
  379. package/daemon/dist/domain/seat-lifecycle-service.d.ts.map +1 -1
  380. package/daemon/dist/domain/seat-lifecycle-service.js +44 -8
  381. package/daemon/dist/domain/seat-lifecycle-service.js.map +1 -1
  382. package/daemon/dist/domain/seat-pool-executor.d.ts +61 -3
  383. package/daemon/dist/domain/seat-pool-executor.d.ts.map +1 -1
  384. package/daemon/dist/domain/seat-pool-executor.js +735 -59
  385. package/daemon/dist/domain/seat-pool-executor.js.map +1 -1
  386. package/daemon/dist/domain/seat-pool-slots.d.ts +24 -0
  387. package/daemon/dist/domain/seat-pool-slots.d.ts.map +1 -1
  388. package/daemon/dist/domain/seat-pool-slots.js +50 -0
  389. package/daemon/dist/domain/seat-pool-slots.js.map +1 -1
  390. package/daemon/dist/domain/seat-runtime-switch-service.d.ts +2 -1
  391. package/daemon/dist/domain/seat-runtime-switch-service.d.ts.map +1 -1
  392. package/daemon/dist/domain/seat-runtime-switch-service.js +68 -20
  393. package/daemon/dist/domain/seat-runtime-switch-service.js.map +1 -1
  394. package/daemon/dist/domain/session-transport.d.ts.map +1 -1
  395. package/daemon/dist/domain/session-transport.js +9 -2
  396. package/daemon/dist/domain/session-transport.js.map +1 -1
  397. package/daemon/dist/domain/skill-catalog.d.ts.map +1 -1
  398. package/daemon/dist/domain/skill-catalog.js +24 -10
  399. package/daemon/dist/domain/skill-catalog.js.map +1 -1
  400. package/daemon/dist/domain/startup-orchestrator.d.ts +5 -1
  401. package/daemon/dist/domain/startup-orchestrator.d.ts.map +1 -1
  402. package/daemon/dist/domain/startup-orchestrator.js +43 -7
  403. package/daemon/dist/domain/startup-orchestrator.js.map +1 -1
  404. package/daemon/dist/domain/startup-submission-evidence.d.ts +1 -0
  405. package/daemon/dist/domain/startup-submission-evidence.d.ts.map +1 -1
  406. package/daemon/dist/domain/startup-submission-evidence.js +5 -0
  407. package/daemon/dist/domain/startup-submission-evidence.js.map +1 -1
  408. package/daemon/dist/domain/stream-reader-actions.d.ts +23 -0
  409. package/daemon/dist/domain/stream-reader-actions.d.ts.map +1 -1
  410. package/daemon/dist/domain/stream-reader-actions.js +43 -0
  411. package/daemon/dist/domain/stream-reader-actions.js.map +1 -1
  412. package/daemon/dist/domain/successor-session-launcher.d.ts +24 -3
  413. package/daemon/dist/domain/successor-session-launcher.d.ts.map +1 -1
  414. package/daemon/dist/domain/successor-session-launcher.js +54 -23
  415. package/daemon/dist/domain/successor-session-launcher.js.map +1 -1
  416. package/daemon/dist/domain/terminal/earlier-tile-attach-0723.d.ts +2 -0
  417. package/daemon/dist/domain/terminal/earlier-tile-attach-0723.d.ts.map +1 -0
  418. package/daemon/dist/domain/terminal/earlier-tile-attach-0723.js +48 -0
  419. package/daemon/dist/domain/terminal/earlier-tile-attach-0723.js.map +1 -0
  420. package/daemon/dist/domain/terminal/rex-agent-status.d.ts.map +1 -1
  421. package/daemon/dist/domain/terminal/rex-agent-status.js +5 -2
  422. package/daemon/dist/domain/terminal/rex-agent-status.js.map +1 -1
  423. package/daemon/dist/domain/terminal/tile-attach.d.ts +11 -5
  424. package/daemon/dist/domain/terminal/tile-attach.d.ts.map +1 -1
  425. package/daemon/dist/domain/terminal/tile-attach.js +32 -12
  426. package/daemon/dist/domain/terminal/tile-attach.js.map +1 -1
  427. package/daemon/dist/domain/transcript-redaction.d.ts +10 -8
  428. package/daemon/dist/domain/transcript-redaction.d.ts.map +1 -1
  429. package/daemon/dist/domain/transcript-redaction.js +51 -22
  430. package/daemon/dist/domain/transcript-redaction.js.map +1 -1
  431. package/daemon/dist/domain/types.d.ts +7 -1
  432. package/daemon/dist/domain/types.d.ts.map +1 -1
  433. package/daemon/dist/domain/types.js +3 -0
  434. package/daemon/dist/domain/types.js.map +1 -1
  435. package/daemon/dist/domain/whoami-service.d.ts +11 -0
  436. package/daemon/dist/domain/whoami-service.d.ts.map +1 -1
  437. package/daemon/dist/domain/whoami-service.js +13 -0
  438. package/daemon/dist/domain/whoami-service.js.map +1 -1
  439. package/daemon/dist/domain/workflow-reconciliation.d.ts.map +1 -1
  440. package/daemon/dist/domain/workflow-reconciliation.js +9 -0
  441. package/daemon/dist/domain/workflow-reconciliation.js.map +1 -1
  442. package/daemon/dist/domain/workflow-runtime.d.ts +2 -0
  443. package/daemon/dist/domain/workflow-runtime.d.ts.map +1 -1
  444. package/daemon/dist/domain/workflow-runtime.js +45 -2
  445. package/daemon/dist/domain/workflow-runtime.js.map +1 -1
  446. package/daemon/dist/routes/activity.d.ts.map +1 -1
  447. package/daemon/dist/routes/activity.js +59 -2
  448. package/daemon/dist/routes/activity.js.map +1 -1
  449. package/daemon/dist/routes/compaction.d.ts.map +1 -1
  450. package/daemon/dist/routes/compaction.js +26 -9
  451. package/daemon/dist/routes/compaction.js.map +1 -1
  452. package/daemon/dist/routes/queue.d.ts.map +1 -1
  453. package/daemon/dist/routes/queue.js +64 -25
  454. package/daemon/dist/routes/queue.js.map +1 -1
  455. package/daemon/dist/routes/require-sender-identity.d.ts +15 -0
  456. package/daemon/dist/routes/require-sender-identity.d.ts.map +1 -1
  457. package/daemon/dist/routes/require-sender-identity.js +51 -5
  458. package/daemon/dist/routes/require-sender-identity.js.map +1 -1
  459. package/daemon/dist/routes/seat.js +6 -0
  460. package/daemon/dist/routes/seat.js.map +1 -1
  461. package/daemon/dist/routes/stream.d.ts.map +1 -1
  462. package/daemon/dist/routes/stream.js +28 -1
  463. package/daemon/dist/routes/stream.js.map +1 -1
  464. package/daemon/dist/routes/workflow.d.ts.map +1 -1
  465. package/daemon/dist/routes/workflow.js +48 -41
  466. package/daemon/dist/routes/workflow.js.map +1 -1
  467. package/daemon/dist/server.d.ts.map +1 -1
  468. package/daemon/dist/server.js +17 -1
  469. package/daemon/dist/server.js.map +1 -1
  470. package/daemon/dist/startup.d.ts.map +1 -1
  471. package/daemon/dist/startup.js +34 -6
  472. package/daemon/dist/startup.js.map +1 -1
  473. package/daemon/dist/transcript-redaction-surface.d.ts +2 -0
  474. package/daemon/dist/transcript-redaction-surface.d.ts.map +1 -0
  475. package/daemon/dist/transcript-redaction-surface.js +2 -0
  476. package/daemon/dist/transcript-redaction-surface.js.map +1 -0
  477. package/daemon/docs/reference/acp-agents.md +9 -2
  478. package/daemon/docs/reference/agent-spec.md +22 -1
  479. package/daemon/docs/reference/agent-startup-guide.md +10 -0
  480. package/daemon/docs/reference/community-harness-examples/cursor/cursor.yaml +3 -1
  481. package/daemon/docs/reference/community-harness-presets.md +27 -2
  482. package/daemon/docs/reference/daemon-http-clients.md +57 -0
  483. package/daemon/docs/reference/developing.md +3 -2
  484. package/daemon/docs/reference/getting-started.md +31 -7
  485. package/daemon/docs/reference/harness-runner-contract.md +72 -0
  486. package/daemon/docs/reference/hosted-members.md +21 -2
  487. package/daemon/docs/reference/network-connector.md +32 -3
  488. package/daemon/docs/reference/quickstart.md +4 -4
  489. package/daemon/docs/reference/refocus-channel.md +48 -0
  490. package/daemon/docs/reference/rig-bundle.md +11 -1
  491. package/daemon/docs/reference/rig-spec.md +8 -0
  492. package/daemon/docs/reference/seat-node-targeting.md +10 -0
  493. package/daemon/docs/reference/seat-pools.md +76 -10
  494. package/daemon/docs/reference/slack-app-setup.md +15 -0
  495. package/daemon/docs/reference/terminal-sessions.md +71 -3
  496. package/daemon/docs/reference/tmux-servers.md +16 -0
  497. package/daemon/docs/reference/whats-new.md +106 -12
  498. package/daemon/specs/agents/shared/skills/core/working-with-an-openrig-team/SKILL.md +71 -9
  499. package/daemon/specs/rigs/launch/factory/guidance/lead-first-move.md +4 -1
  500. package/daemon/specs/rigs/launch/kernel/agents/operator/agent/guidance/role.md +2 -1
  501. package/daemon/specs/rigs/launch/starter/guidance/lead-first-move.md +4 -1
  502. package/dist/bin-wrapper.d.ts.map +1 -1
  503. package/dist/bin-wrapper.js +24 -5
  504. package/dist/bin-wrapper.js.map +1 -1
  505. package/dist/build-info.js +3 -3
  506. package/dist/client.d.ts +4 -0
  507. package/dist/client.d.ts.map +1 -1
  508. package/dist/client.js +7 -1
  509. package/dist/client.js.map +1 -1
  510. package/dist/commands/add.js +1 -1
  511. package/dist/commands/add.js.map +1 -1
  512. package/dist/commands/agent.js +1 -1
  513. package/dist/commands/agent.js.map +1 -1
  514. package/dist/commands/bundle.d.ts.map +1 -1
  515. package/dist/commands/bundle.js +18 -4
  516. package/dist/commands/bundle.js.map +1 -1
  517. package/dist/commands/create.d.ts.map +1 -1
  518. package/dist/commands/create.js +6 -2
  519. package/dist/commands/create.js.map +1 -1
  520. package/dist/commands/down.d.ts.map +1 -1
  521. package/dist/commands/down.js +12 -1
  522. package/dist/commands/down.js.map +1 -1
  523. package/dist/commands/expand.js +1 -1
  524. package/dist/commands/expand.js.map +1 -1
  525. package/dist/commands/fork.js +1 -1
  526. package/dist/commands/fork.js.map +1 -1
  527. package/dist/commands/grow.d.ts.map +1 -1
  528. package/dist/commands/grow.js +9 -4
  529. package/dist/commands/grow.js.map +1 -1
  530. package/dist/commands/import.js +1 -1
  531. package/dist/commands/import.js.map +1 -1
  532. package/dist/commands/mcp.d.ts.map +1 -1
  533. package/dist/commands/mcp.js +57 -22
  534. package/dist/commands/mcp.js.map +1 -1
  535. package/dist/commands/network.d.ts +2 -3
  536. package/dist/commands/network.d.ts.map +1 -1
  537. package/dist/commands/network.js +54 -9
  538. package/dist/commands/network.js.map +1 -1
  539. package/dist/commands/ps.d.ts +1 -0
  540. package/dist/commands/ps.d.ts.map +1 -1
  541. package/dist/commands/ps.js +22 -19
  542. package/dist/commands/ps.js.map +1 -1
  543. package/dist/commands/queue.d.ts +2 -0
  544. package/dist/commands/queue.d.ts.map +1 -1
  545. package/dist/commands/queue.js +29 -6
  546. package/dist/commands/queue.js.map +1 -1
  547. package/dist/commands/reconcile-session.js +1 -1
  548. package/dist/commands/reconcile-session.js.map +1 -1
  549. package/dist/commands/restore.js +1 -1
  550. package/dist/commands/restore.js.map +1 -1
  551. package/dist/commands/rig.js +2 -2
  552. package/dist/commands/rig.js.map +1 -1
  553. package/dist/commands/seat.d.ts.map +1 -1
  554. package/dist/commands/seat.js +55 -16
  555. package/dist/commands/seat.js.map +1 -1
  556. package/dist/commands/skill.js +1 -1
  557. package/dist/commands/skill.js.map +1 -1
  558. package/dist/commands/start.d.ts.map +1 -1
  559. package/dist/commands/start.js +3 -2
  560. package/dist/commands/start.js.map +1 -1
  561. package/dist/commands/terminal.d.ts.map +1 -1
  562. package/dist/commands/terminal.js +20 -4
  563. package/dist/commands/terminal.js.map +1 -1
  564. package/dist/commands/up.d.ts.map +1 -1
  565. package/dist/commands/up.js +2 -1
  566. package/dist/commands/up.js.map +1 -1
  567. package/dist/commands/whoami.d.ts.map +1 -1
  568. package/dist/commands/whoami.js +6 -0
  569. package/dist/commands/whoami.js.map +1 -1
  570. package/dist/commands/workflow-follow.d.ts.map +1 -1
  571. package/dist/commands/workflow-follow.js +37 -34
  572. package/dist/commands/workflow-follow.js.map +1 -1
  573. package/dist/commands/workflow-render.d.ts +1 -1
  574. package/dist/commands/workflow-render.d.ts.map +1 -1
  575. package/dist/commands/workflow-render.js +2 -7
  576. package/dist/commands/workflow-render.js.map +1 -1
  577. package/dist/commands/workflow.d.ts.map +1 -1
  578. package/dist/commands/workflow.js +22 -2
  579. package/dist/commands/workflow.js.map +1 -1
  580. package/dist/daemon-lifecycle.d.ts +24 -0
  581. package/dist/daemon-lifecycle.d.ts.map +1 -1
  582. package/dist/daemon-lifecycle.js +45 -8
  583. package/dist/daemon-lifecycle.js.map +1 -1
  584. package/dist/lib/bundle-source.d.ts +4 -0
  585. package/dist/lib/bundle-source.d.ts.map +1 -1
  586. package/dist/lib/bundle-source.js +14 -2
  587. package/dist/lib/bundle-source.js.map +1 -1
  588. package/dist/lib/context-git.js +2 -2
  589. package/dist/lib/context-git.js.map +1 -1
  590. package/dist/lib/frontmatter.d.ts.map +1 -1
  591. package/dist/lib/frontmatter.js +4 -2
  592. package/dist/lib/frontmatter.js.map +1 -1
  593. package/dist/lib/scope/attestation-lineage.js +2 -2
  594. package/dist/lib/scope/attestation-lineage.js.map +1 -1
  595. package/dist/lib/scope/logical-checkbox.d.ts.map +1 -1
  596. package/dist/lib/scope/logical-checkbox.js +18 -0
  597. package/dist/lib/scope/logical-checkbox.js.map +1 -1
  598. package/dist/lib/scope/progress-edit.js +1 -1
  599. package/dist/lib/scope/progress-edit.js.map +1 -1
  600. package/dist/lib/scope/scaffold-placeholder.js +2 -2
  601. package/dist/lib/scope/scaffold-placeholder.js.map +1 -1
  602. package/dist/lib/terminal-cell.d.ts +5 -0
  603. package/dist/lib/terminal-cell.d.ts.map +1 -0
  604. package/dist/lib/terminal-cell.js +22 -0
  605. package/dist/lib/terminal-cell.js.map +1 -0
  606. package/dist/mcp-http.d.ts +1 -1
  607. package/dist/mcp-http.d.ts.map +1 -1
  608. package/dist/mcp-http.js +6 -3
  609. package/dist/mcp-http.js.map +1 -1
  610. package/dist/mcp-server.d.ts +5 -1
  611. package/dist/mcp-server.d.ts.map +1 -1
  612. package/dist/mcp-server.js +111 -13
  613. package/dist/mcp-server.js.map +1 -1
  614. package/dist/release-surface/extract-surface.d.ts.map +1 -1
  615. package/dist/release-surface/extract-surface.js +38 -20
  616. package/dist/release-surface/extract-surface.js.map +1 -1
  617. package/dist/release-surface/generate.d.ts.map +1 -1
  618. package/dist/release-surface/generate.js +3 -0
  619. package/dist/release-surface/generate.js.map +1 -1
  620. package/dist/release-surface/surface-diff.d.ts +1 -0
  621. package/dist/release-surface/surface-diff.d.ts.map +1 -1
  622. package/dist/release-surface/surface-diff.js +19 -18
  623. package/dist/release-surface/surface-diff.js.map +1 -1
  624. package/dist/restore-packet/redaction.d.ts +4 -26
  625. package/dist/restore-packet/redaction.d.ts.map +1 -1
  626. package/dist/restore-packet/redaction.js +19 -63
  627. package/dist/restore-packet/redaction.js.map +1 -1
  628. package/dist/terminal-orca.d.ts +7 -0
  629. package/dist/terminal-orca.d.ts.map +1 -0
  630. package/dist/terminal-orca.js +239 -0
  631. package/dist/terminal-orca.js.map +1 -0
  632. package/package.json +1 -1
  633. package/tui/dist/connected-assistants.d.ts +1 -1
  634. package/tui/dist/connected-assistants.d.ts.map +1 -1
  635. package/tui/dist/connected-assistants.js +3 -1
  636. package/tui/dist/connected-assistants.js.map +1 -1
  637. package/tui/dist/daemon-client.d.ts +4 -0
  638. package/tui/dist/daemon-client.d.ts.map +1 -1
  639. package/tui/dist/daemon-client.js +12 -8
  640. package/tui/dist/daemon-client.js.map +1 -1
  641. package/tui/dist/health/health-model.d.ts.map +1 -1
  642. package/tui/dist/health/health-model.js +2 -0
  643. package/tui/dist/health/health-model.js.map +1 -1
  644. package/tui/dist/hydrate.d.ts +3 -1
  645. package/tui/dist/hydrate.d.ts.map +1 -1
  646. package/tui/dist/hydrate.js +40 -25
  647. package/tui/dist/hydrate.js.map +1 -1
  648. package/tui/dist/live.d.ts +5 -1
  649. package/tui/dist/live.d.ts.map +1 -1
  650. package/tui/dist/live.js +20 -2
  651. package/tui/dist/live.js.map +1 -1
  652. package/tui/dist/main.js +5 -2
  653. package/tui/dist/main.js.map +1 -1
  654. package/tui/dist/pulse/pulse-model.d.ts.map +1 -1
  655. package/tui/dist/pulse/pulse-model.js +3 -2
  656. package/tui/dist/pulse/pulse-model.js.map +1 -1
  657. package/tui/dist/render.d.ts.map +1 -1
  658. package/tui/dist/render.js +6 -5
  659. package/tui/dist/render.js.map +1 -1
  660. package/tui/dist/types.d.ts +10 -4
  661. package/tui/dist/types.d.ts.map +1 -1
  662. package/ui/dist/assets/index-Chh-NS8Z.css +32 -0
  663. package/ui/dist/assets/index-DG_7XFcL.js +628 -0
  664. package/ui/dist/index.html +2 -2
  665. package/ui/dist/assets/index-B-sMy02c.js +0 -623
  666. package/ui/dist/assets/index-DiN7RwWg.css +0 -32
package/README.md CHANGED
@@ -26,14 +26,14 @@ use:
26
26
 
27
27
  ```sh
28
28
  # Claude Code
29
- npx skills add https://github.com/mvschwarz/openrig/tree/v0.7.23/skills/rigs --skill rigs --agent claude-code
29
+ npx skills add https://github.com/mvschwarz/openrig/tree/v0.7.24/skills/rigs --skill rigs --agent claude-code
30
30
  # Codex
31
- npx skills add https://github.com/mvschwarz/openrig/tree/v0.7.23/skills/rigs --skill rigs --agent codex
31
+ npx skills add https://github.com/mvschwarz/openrig/tree/v0.7.24/skills/rigs --skill rigs --agent codex
32
32
  # OMP (Oh My Pi): the pi target installs to .agents/skills, which OMP reads
33
- npx skills add https://github.com/mvschwarz/openrig/tree/v0.7.23/skills/rigs --skill rigs --agent pi
33
+ npx skills add https://github.com/mvschwarz/openrig/tree/v0.7.24/skills/rigs --skill rigs --agent pi
34
34
  ```
35
35
 
36
- **OMP:** this pin installs the shared skill only. The `v0.7.23` skill includes OMP attachment guidance (`rig attach --self … --runtime omp`),
36
+ **OMP:** this pin installs the shared skill only. The `v0.7.24` skill includes OMP attachment guidance (`rig attach --self … --runtime omp`),
37
37
  but complete setup from OMP has not been verified. OMP isn't a kernel provider; Claude Code or Codex must still be
38
38
  signed in.
39
39
 
@@ -76,11 +76,11 @@ Setting up Node.js on Linux, on a Mac where you aren't an administrator, or on W
76
76
 
77
77
  ### Install it yourself
78
78
 
79
- This runs OpenRig's install script from the `v0.7.23` release. It checks Node.js and npm, installs the latest published `@openrig/cli` with `npm install -g`, runs the Node.js and SQLite check, then runs `rig setup --dry-run` and `rig setup`. The first line prints that plan and changes nothing:
79
+ This runs OpenRig's install script from the `v0.7.24` release. It checks Node.js and npm, installs the latest published `@openrig/cli` with `npm install -g`, runs the Node.js and SQLite check, then runs `rig setup --dry-run` and `rig setup`. The first line prints that plan and changes nothing:
80
80
 
81
81
  ```bash
82
- curl -fsSL https://raw.githubusercontent.com/mvschwarz/openrig/v0.7.23/scripts/install.sh | sh -s -- --dry-run
83
- curl -fsSL https://raw.githubusercontent.com/mvschwarz/openrig/v0.7.23/scripts/install.sh | sh
82
+ curl -fsSL https://raw.githubusercontent.com/mvschwarz/openrig/v0.7.24/scripts/install.sh | sh -s -- --dry-run
83
+ curl -fsSL https://raw.githubusercontent.com/mvschwarz/openrig/v0.7.24/scripts/install.sh | sh
84
84
  ```
85
85
 
86
86
  If the last step isn't ready, the installer reports `INSTALLED, SETUP NOT COMPLETE` and points to the details from `rig setup` above. Follow that output and any reported Fix, then rerun `rig setup`; the CLI does not need reinstalling. If the only remaining failures are provider sign-ins, sign in to each selected provider as below and continue.
@@ -1,16 +1,39 @@
1
1
  #!/usr/bin/env node
2
- // Slice 13: an opted-in Claude seat's hook bridge, run by the hooks its OpenRig launch adds.
2
+ // The hook bridge: hooks that wake an agent at a turn boundary with what OpenRig holds for it. It never types into a terminal.
3
3
  //
4
+ // Slice 13, an opted-in Claude seat, run by the hooks its OpenRig launch adds:
4
5
  // node claude-hook-bridge.cjs waiter SessionStart and Stop, as `asyncRewake` command hooks: arm with the daemon at
5
6
  // this turn boundary, poll for the seat's queued messages, write them to stderr
6
7
  // and exit 2, which wakes Claude with them in its context. Exits 0 when superseded
7
8
  // by a newer waiter, when the occupant was replaced, or at its own deadline.
8
9
  // node claude-hook-bridge.cjs turn UserPromptSubmit: tell the daemon a turn started, so nothing is delivered into
9
10
  // a running turn. Always exits 0 at once: it never blocks a prompt.
10
- //
11
11
  // It reaches the daemon the way the activity relay does (OPENRIG_URL and OPENRIG_ACTIVITY_HOOK_TOKEN, else
12
12
  // $OPENRIG_HOME/activity-endpoint.json) and names its seat by OPENRIG_SESSION_NAME, OPENRIG_NODE_ID and
13
- // OPENRIG_OCCUPANT_GENERATION. It never types into the terminal.
13
+ // OPENRIG_OCCUPANT_GENERATION.
14
+ //
15
+ // Slice 15, a person's own conversation in Claude Code or Codex (not a seat), run by the hooks the `openrig` plugin ships:
16
+ // conversation-waiter Claude Code SessionStart and Stop, as `asyncRewake` hooks: read the return-route addresses OpenRig
17
+ // issued to this conversation from OpenRig's own record (the rows tagged with this conversation's key,
18
+ // see conversationKey), poll their pending tasks, and write the ones not yet shown in this session,
19
+ // each with its sender as the daemon recorded it, to stderr and exit 2, which wakes Claude. Exits 0
20
+ // when the conversation has no such address, when superseded by a newer waiter, or at its
21
+ // deadline. A read that fails is tried again after a longer wait each time.
22
+ // conversation-turn Claude Code UserPromptSubmit: mark that a turn is running, so a waiter never wakes into it.
23
+ // codex-start Codex SessionStart (async): start one detached watcher for this session and exit 0. A Codex hook
24
+ // can't start a turn itself; `codex queue` can.
25
+ // codex-end Codex SessionEnd: tell this session's watcher to stop.
26
+ // codex-watch <session id> <transcript path>
27
+ // The watcher: the same reads, and it wakes the thread with
28
+ // `codex queue --thread <session id> --message … --resume` (exit 0 there means stored, not delivered).
29
+ // A failed read or queue is tried again after a longer wait each time, up to five minutes. On a
30
+ // Codex whose `codex queue` has no `--resume`, it queues without it, for the thread's next turn,
31
+ // and says so once in the thread.
32
+ // These modes exit at once in an OpenRig seat (OPENRIG_SESSION_NAME or OPENRIG_NODE_ID set), which keeps slice 13 and typed
33
+ // delivery. They read OpenRig with the `rig` command, as the person's agent does: the one findRig names, which the plugin's
34
+ // MCP launcher (scripts/run-rig.cjs) runs too. With none, they read nothing and say so once for the plugin's install, again
35
+ // only after one was found and then lost. The openrig plugin ships a copy of this file in hooks/scripts/, byte-equal to
36
+ // this one (a plugin can't reach files outside its own folder).
14
37
  "use strict";
15
38
  const fs = require("node:fs");
16
39
  const os = require("node:os");
@@ -130,12 +153,554 @@ async function waiter({ hookEvent, out = process.stderr, deps = {} } = {}) {
130
153
  return 0;
131
154
  }
132
155
 
156
+ // ---- Slice 15: a person's own conversation (Claude Code or Codex, not a seat) ----
157
+
158
+ /** The tag `rig queue create --return-route auto` (and the MCP server's create) records beside an issued address: the key of
159
+ * the conversation that handed the work over. The hooks read the addresses recorded under their own key back with
160
+ * `rig queue list --tag`, so an address only mentioned or pasted in a chat never subscribes it. */
161
+ const CONVERSATION_KEY_TAG_PREFIX = "conversation-key:";
162
+ const CONVERSATION_POLL_MS = 15000;
163
+ /** A conversation's routes are read again when its transcript grows (its creates happen in its turns), and at least this
164
+ * often. */
165
+ const ROUTES_REFRESH_MS = 5 * 60 * 1000;
166
+ /** A Codex watcher waits twice as long after each tick whose read or `codex queue` failed, up to this. */
167
+ const RETRY_MAX_MS = 5 * 60 * 1000;
168
+ /** As slice 13's waiter: its hook timeout (7200 s, the plugin's hooks file) less a margin, after which it exits 0. */
169
+ const CONVERSATION_WAITER_MS = (7200 - 120) * 1000;
170
+ /** Without a Codex pid to observe, stop an orphan watcher after this long without rollout growth. */
171
+ const CODEX_IDLE_EXIT_MS = 6 * 3600 * 1000;
172
+ /** A watcher that hasn't ticked for this long isn't live, whatever its recorded pid says. */
173
+ const WATCHER_LIVE_MS = 3 * CONVERSATION_POLL_MS;
174
+ /** A conversation's state folder untouched for this long is removed. */
175
+ const STATE_KEEP_MS = 7 * 24 * 3600 * 1000;
176
+ /** Only addresses OpenRig issued for this conversation's own creates are read; a named or inherited route isn't its own. */
177
+ const ISSUED_BASES = new Set(["issued", "issued-actor"]);
178
+ const UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
179
+ const CONVERSATION_MODES = new Set(["conversation-waiter", "conversation-turn", "codex-start", "codex-end", "codex-watch"]);
180
+
181
+ /** An OpenRig seat runs its own delivery (slice 13, typed delivery): the conversation modes never run there, even when the
182
+ * plugin is enabled in a config folder its seats share. */
183
+ function inSeat(env = process.env) {
184
+ return !!first(env.OPENRIG_SESSION_NAME, env.RIGGED_SESSION_NAME, env.OPENRIG_NODE_ID, env.RIGGED_NODE_ID);
185
+ }
186
+
187
+ /** A reader of one process: its parent, a start time that tells a reused pid apart, and its names. Linux reads /proc
188
+ * (the start time is the boot id's prefix and the start tick); macOS and the BSDs read one `ps` table; elsewhere nothing
189
+ * is read, so no key is derived. */
190
+ function processReader({ platform = process.platform, fsImpl = fs, ps } = {}) {
191
+ if (platform === "linux") {
192
+ let boot = "";
193
+ try { boot = fsImpl.readFileSync("/proc/sys/kernel/random/boot_id", "utf8").trim().slice(0, 8); } catch { /* unreadable: the tick alone */ }
194
+ return (pid) => {
195
+ try {
196
+ const stat = fsImpl.readFileSync(`/proc/${pid}/stat`, "utf8");
197
+ const close = stat.lastIndexOf(")");
198
+ const fields = stat.slice(close + 2).split(" ");
199
+ let argv0 = "";
200
+ try { argv0 = fsImpl.readFileSync(`/proc/${pid}/cmdline`, "utf8").split("\0")[0] || ""; } catch { /* the comm still names it */ }
201
+ return { pid, ppid: Number(fields[1]), start: `${boot}.${fields[19]}`, names: [stat.slice(stat.indexOf("(") + 1, close), argv0] };
202
+ } catch { return null; }
203
+ };
204
+ }
205
+ if (platform === "darwin" || /bsd$/.test(platform)) {
206
+ let table = null;
207
+ return (pid) => {
208
+ if (table === null) {
209
+ table = new Map();
210
+ try {
211
+ const text = ps ? ps() : require("node:child_process").execFileSync("ps", ["-A", "-o", "pid=", "-o", "ppid=", "-o", "lstart=", "-o", "comm="],
212
+ { encoding: "utf8", timeout: 3000, stdio: ["ignore", "pipe", "ignore"] });
213
+ for (const line of String(text).split("\n")) {
214
+ const m = line.match(/^\s*(\d+)\s+(\d+)\s+(\S+\s+\S+\s+\d+\s+[\d:]+\s+\d+)\s+(.+)$/);
215
+ if (m) table.set(Number(m[1]), { pid: Number(m[1]), ppid: Number(m[2]), start: m[3].replace(/\s+/g, "-"), names: [m[4].trim()] });
216
+ }
217
+ } catch { /* no table: no key */ }
218
+ }
219
+ return table.get(pid) ?? null;
220
+ };
221
+ }
222
+ return () => null;
223
+ }
224
+
225
+ const baseName = (name) => String(name).split(/[\\/]/).pop();
226
+ /** Claude Code's and Codex's own processes, by the name they run under. */
227
+ function agentKind(proc) {
228
+ const names = proc.names.map(baseName);
229
+ if (names.some((name) => name === "claude" || name === "claude.exe")) return "claude";
230
+ if (names.some((name) => name === "codex" || name === "codex.exe")) return "codex";
231
+ return null;
232
+ }
233
+
234
+ /** The key that names this conversation, derived the same way, with no help from the model, by the CLI and the MCP server
235
+ * (recording it with an issued address) and by the hooks (reading the addresses under it). Walking up from this process,
236
+ * the nearest Claude Code or Codex process decides:
237
+ * - Claude Code documents no variable that names the session to its commands, so the key is that process, by its start
238
+ * time and pid (`claude:<start>:<pid>`): a Bash command, a stdio MCP server and a hook are all its descendants.
239
+ * - Codex gives its commands the root session id (CODEX_SESSION_ID; the main thread's CODEX_THREAD_ID, the same id, on a
240
+ * Codex without it), which its hooks receive as session_id: the key is `codex:<that id>`. It's also taken when the walk
241
+ * sees neither (a sandbox can hide ancestors), unless the command runs under Claude Code (CLAUDECODE), where the id
242
+ * could be an outer Codex's.
243
+ * Otherwise there's no key: nothing is recorded or read, so nothing wakes, and never with another conversation's
244
+ * addresses. */
245
+ function conversationKey({ pid = process.pid, env = process.env, read = processReader() } = {}) {
246
+ const found = nearestAgentProcess(pid, read);
247
+ if (found?.kind === "claude") return `claude:${found.proc.start}:${found.proc.pid}`;
248
+ const codex = first(env.CODEX_SESSION_ID, env.CODEX_THREAD_ID);
249
+ if (!UUID_RE.test(codex)) return null;
250
+ return found?.kind === "codex" || (!found && !first(env.CLAUDECODE)) ? `codex:${codex.toLowerCase()}` : null;
251
+ }
252
+ const conversationKeyTag = (key) => `${CONVERSATION_KEY_TAG_PREFIX}${key}`;
253
+
254
+ /** The nearest Claude Code or Codex process at or above pid, with its kind; null when the walk sees neither. */
255
+ function nearestAgentProcess(pid, read) {
256
+ for (let current = pid, hops = 0; current > 1 && hops < 64; hops++) {
257
+ const proc = read(current);
258
+ if (!proc) return null;
259
+ const kind = agentKind(proc);
260
+ if (kind) return { kind, proc };
261
+ current = proc.ppid;
262
+ }
263
+ return null;
264
+ }
265
+ /** The pid of the nearest process of that kind, when it's the nearest agent; 0 otherwise. */
266
+ function nearestAgent(pid, read, kind) {
267
+ const found = nearestAgentProcess(pid, read);
268
+ return found?.kind === kind ? found.proc.pid : 0;
269
+ }
270
+
271
+ /** One conversation's state: which waiter or watcher is current, the turn marker, and the tasks already shown. In the
272
+ * plugin's data folder (CLAUDE_PLUGIN_DATA, or Codex's PLUGIN_DATA), else a per-user temporary folder. Null when it can't
273
+ * be made: nothing wakes. `install` holds the few markers kept for the plugin's install, beside every conversation's. */
274
+ function conversationState(runtime, sessionId, { env = process.env, now = Date.now } = {}) {
275
+ const data = first(env.CLAUDE_PLUGIN_DATA, env.PLUGIN_DATA)
276
+ || path.join(os.tmpdir(), `openrig-hook-bridge-${typeof process.getuid === "function" ? process.getuid() : "user"}`);
277
+ const root = path.join(data, "conversations");
278
+ const dir = path.join(root, `${runtime}-${String(sessionId).replace(/[^A-Za-z0-9_-]/g, "")}`);
279
+ try { fs.mkdirSync(dir, { recursive: true, mode: 0o700 }); } catch { return null; }
280
+ const file = (name) => path.join(dir, name);
281
+ return {
282
+ dir,
283
+ install: {
284
+ /** Creates the marker unless it's there: true for the one caller that made it. */
285
+ claim: (name, value) => { try { fs.writeFileSync(path.join(data, name), JSON.stringify(value), { flag: "wx" }); return true; } catch { return false; } },
286
+ remove: (name) => { try { fs.unlinkSync(path.join(data, name)); } catch { /* absent */ } },
287
+ },
288
+ read: (name, fallback) => { try { return JSON.parse(fs.readFileSync(file(name), "utf8")); } catch { return fallback; } },
289
+ write: (name, value) => { try { fs.writeFileSync(file(name), JSON.stringify(value)); } catch { /* best effort */ } },
290
+ exists: (name) => fs.existsSync(file(name)),
291
+ remove: (name) => { try { fs.unlinkSync(file(name)); } catch { /* absent */ } },
292
+ log: (line) => { try { fs.appendFileSync(file("wake.log"), `${new Date(now()).toISOString()} ${process.pid} ${line}\n`); } catch { /* best effort */ } },
293
+ prune: () => {
294
+ try {
295
+ for (const entry of fs.readdirSync(root)) {
296
+ const other = path.join(root, entry);
297
+ if (other !== dir && now() - fs.statSync(other).mtimeMs > STATE_KEEP_MS) fs.rmSync(other, { recursive: true, force: true });
298
+ }
299
+ } catch { /* best effort */ }
300
+ },
301
+ };
302
+ }
303
+
304
+ /** A file this process can run. */
305
+ function runnable(file) {
306
+ try { fs.accessSync(file, fs.constants.X_OK); return fs.statSync(file).isFile(); } catch { return false; }
307
+ }
308
+
309
+ /** The `rig` the openrig plugin runs, for its hooks and its MCP server alike: OPENRIG_RIG_BIN when it names a file that
310
+ * runs, else the first `rig` on PATH, else the project's own install, <project>/node_modules/.bin/rig (the project is
311
+ * Claude Code's CLAUDE_PROJECT_DIR, or the folder given, a Codex session's). Null when there's none: an OpenRig installed
312
+ * only inside another project, or not at all. */
313
+ function findRig({ env = process.env, projectDir = first(env.CLAUDE_PROJECT_DIR) } = {}) {
314
+ const onPath = String(env.PATH ?? "").split(path.delimiter).filter(Boolean).map((dir) => path.join(dir, "rig"));
315
+ const inProject = projectDir ? [path.join(projectDir, "node_modules", ".bin", "rig")] : [];
316
+ return [first(env.OPENRIG_RIG_BIN), ...onPath, ...inProject].find((file) => file && runnable(file)) ?? null;
317
+ }
318
+
319
+ /** That `rig`, with --json: what it printed, parsed, or null when it couldn't be read (no daemon, say). */
320
+ function runRig(args, { env = process.env, bin = "rig", spawnSync = require("node:child_process").spawnSync } = {}) {
321
+ try {
322
+ const result = spawnSync(bin, args, { env, encoding: "utf8", timeout: 30000, stdio: ["ignore", "pipe", "ignore"] });
323
+ if (result.error || result.status !== 0) return null;
324
+ return JSON.parse(result.stdout || "null");
325
+ } catch { return null; }
326
+ }
327
+
328
+ /** OpenRig read through findRig's `rig`; null when there's no `rig` to run. */
329
+ function rigReader(env, projectDir) {
330
+ const bin = findRig({ env, projectDir });
331
+ return bin ? (args) => runRig(args, { env, bin }) : null;
332
+ }
333
+
334
+ /** What a conversation is told when there's no `rig`: without it the hooks read nothing, and nothing else would tell the
335
+ * person that the team's questions won't come in by themselves. */
336
+ const NO_RIG_NOTICE = "OpenRig's automatic wake can't run in this conversation: the openrig plugin found no `rig` command "
337
+ + "(OPENRIG_RIG_BIN doesn't name one, there's none on PATH, and none in this project's node_modules/.bin). Until it finds "
338
+ + "one, your OpenRig team's questions and replies won't come into this conversation by themselves. To fix it, install "
339
+ + "OpenRig where every session finds it (`npm install -g @openrig/cli`), or set OPENRIG_RIG_BIN to the full path of `rig` "
340
+ + "in the environment this app starts with. The plugin says this once, not in every session; tell the person in plain words.\n";
341
+ const NO_RIG = "no-rig.json";
342
+
343
+ /** Says NO_RIG_NOTICE through `say` once for the plugin's install: someone who keeps OpenRig inside one project isn't told
344
+ * again in every other project's sessions. A session's own marker keeps its later Stops from looking again. True once
345
+ * said now. */
346
+ async function sayNoRigOnce(state, say, now) {
347
+ if (state.exists(NO_RIG)) return false;
348
+ state.write(NO_RIG, { at: now() });
349
+ if (!state.install.claim(NO_RIG, { at: now() })) { state.log("no rig: already told for this plugin install"); return false; }
350
+ if (await say(NO_RIG_NOTICE)) { state.log("no rig: told once for this plugin install"); return true; }
351
+ state.install.remove(NO_RIG);
352
+ state.remove(NO_RIG);
353
+ state.log("no rig: the notice couldn't be written");
354
+ return false;
355
+ }
356
+
357
+ /** A `rig` was found: a later loss is told once more. */
358
+ function forgetNoRig(state) {
359
+ state.remove(NO_RIG);
360
+ state.install.remove(NO_RIG);
361
+ }
362
+
363
+ /** The CLI lists newest first and has no cursor. Widen a full page until it includes the whole matching set: shown
364
+ * pending tasks and newer inherited handoffs must not hide an older question or the original issued route. */
365
+ function conversationRows(args, limit, rig) {
366
+ for (;;) {
367
+ const rows = rig(["queue", "list", ...args, "--limit", String(limit), "--json"]);
368
+ if (!Array.isArray(rows)) return null;
369
+ if (rows.length < limit) return rows;
370
+ limit *= 2;
371
+ }
372
+ }
373
+
374
+ /** The return-route addresses OpenRig issued under this conversation's key, each with the handed-over row that issued it;
375
+ * null when OpenRig couldn't be read. A row without the tag (an older daemon that ignored the filter) is never taken. */
376
+ function conversationRoutes(key, rig) {
377
+ const tag = conversationKeyTag(key);
378
+ const rows = conversationRows(["--tag", tag, "--all"], 100, rig);
379
+ if (!Array.isArray(rows)) return null;
380
+ const routes = new Map();
381
+ for (const row of rows) {
382
+ if (!row || typeof row.returnRoute !== "string" || !ISSUED_BASES.has(row.returnRouteBasis)) continue;
383
+ if (!Array.isArray(row.tags) || !row.tags.includes(tag)) continue;
384
+ // A route kept as member@rig@host names a conversation on another host, which this host's prompts don't reach.
385
+ if (row.returnRoute.split("@").length !== 2 || routes.has(row.returnRoute)) continue;
386
+ routes.set(row.returnRoute, { qitemId: String(row.qitemId), summary: typeof row.summary === "string" ? row.summary : null });
387
+ }
388
+ return routes;
389
+ }
390
+
391
+ /** The pending tasks at one route; null when OpenRig couldn't be read. */
392
+ function pendingAt(route, rig) {
393
+ const rows = conversationRows(["--destination", route, "--state", "pending"], 50, rig);
394
+ return Array.isArray(rows) ? rows.filter((row) => row && row.state === "pending" && row.destinationSession === route && typeof row.qitemId === "string") : null;
395
+ }
396
+
397
+ /** The task's sender as the daemon recorded it: the row's source, and the identity provenance its create recorded
398
+ * (undefined when the log couldn't be read). */
399
+ function recordedSender(row, rig) {
400
+ const transitions = rig(["queue", "transitions", row.qitemId, "--full", "--json"]);
401
+ const created = Array.isArray(transitions)
402
+ ? transitions.filter((t) => t && typeof t.transitionId === "number").sort((a, b) => a.transitionId - b.transitionId)[0] : undefined;
403
+ return { session: String(row.sourceSession ?? "unknown"),
404
+ provenance: created && created.actorSession === row.sourceSession ? (created.identityProvenance ?? null) : undefined };
405
+ }
406
+
407
+ function provenanceText(session, provenance) {
408
+ switch (provenance) {
409
+ case undefined: return "its identity provenance couldn't be read";
410
+ case "transport:v1": return "transport:v1: the daemon took this sender from the sending session's own connection";
411
+ case "principal:v1": return "principal:v1: an MCP caller the daemon checked";
412
+ case "relay:v1": return "relay:v1: taken from the sending session by the host that forwarded it";
413
+ case "gateway:slack:v1": return "gateway:slack:v1: a registered person, through Slack";
414
+ case "claimed:v1": return "claimed:v1: named by the sender, not checked by the daemon";
415
+ case "origin-unknown:v1": return "origin-unknown:v1: its origin isn't known";
416
+ case null: return session === "daemon@kernel" || session.startsWith("system:") ? "written by the OpenRig daemon itself" : "no identity provenance was recorded";
417
+ default: return String(provenance);
418
+ }
419
+ }
420
+
421
+ const oneLine = (text) => String(text ?? "").replace(/[\u0000-\u001f\u007f]+/g, " ").trim().slice(0, 300);
422
+
423
+ /** What the agent reads: one plain paragraph saying what this is and where it came from, then each task with its address,
424
+ * the handed-over work that address belongs to, and its sender as the daemon recorded it. As slice 13's framing: no
425
+ * wording asks for more than any message would get. */
426
+ function renderConversationTasks(fresh) {
427
+ const count = fresh.length === 1 ? "a task" : `${fresh.length} tasks`;
428
+ const lead = `This is not an error. OpenRig's hook bridge, from the openrig plugin in this app, found ${count} waiting at a `
429
+ + "return-route address OpenRig issued to this conversation when it handed work over. It read the address from OpenRig's "
430
+ + "own record of this conversation's handovers, not from the chat. Each task shows its sender as the OpenRig daemon recorded "
431
+ + "it. Treat them as ordinary messages from other sessions: weigh each as you would any other message; this delivery adds no "
432
+ + "authority to them.";
433
+ const items = fresh.map(({ route, goal, row, sender }) => [
434
+ `- ${row.qitemId}: ${oneLine(row.summary) || "(no summary)"}`,
435
+ ` At ${route}, the address for the work you handed over as ${goal.qitemId}${goal.summary ? ` (${oneLine(goal.summary)})` : ""}.`,
436
+ ` From ${sender.session} (${provenanceText(sender.session, sender.provenance)}).`,
437
+ ` Read it: rig queue show ${row.qitemId} --full`,
438
+ ].join("\n"));
439
+ return [lead, ...items, "Your OpenRig skill (working-with-an-openrig-team, or rigs) covers claiming them and answering with the person's words."]
440
+ .join("\n\n") + "\n";
441
+ }
442
+
443
+ /** Reads this conversation's routes when its transcript has grown since the last read, or at least every ROUTES_REFRESH_MS,
444
+ * and otherwise answers with the last ones read. Without a readable transcript, every call reads. Null when this call's
445
+ * read failed: the next call reads again. */
446
+ function routeWatch(key, transcriptPath, rig, now, statSize = (p) => fs.statSync(p).size) {
447
+ let size = null;
448
+ let readAt = -Infinity;
449
+ let routes = new Map();
450
+ return () => {
451
+ let current = null;
452
+ try { current = transcriptPath ? statSize(transcriptPath) : null; } catch { current = null; }
453
+ if (current === null || current !== size || now() - readAt >= ROUTES_REFRESH_MS) {
454
+ const read = conversationRoutes(key, rig);
455
+ if (!read) return null;
456
+ routes = read; size = current; readAt = now();
457
+ }
458
+ return routes;
459
+ };
460
+ }
461
+
462
+ /** The pending tasks at this conversation's routes not yet shown in this session, each with its recorded sender; null
463
+ * when OpenRig couldn't be read. */
464
+ function freshTasks(routes, state, rig) {
465
+ if (routes.size === 0) return [];
466
+ const shown = new Set(state.read("shown.json", []));
467
+ const fresh = [];
468
+ for (const [route, goal] of routes) {
469
+ const pending = pendingAt(route, rig);
470
+ if (!pending) return null;
471
+ for (const row of pending) {
472
+ if (!shown.has(row.qitemId) && !fresh.some((task) => task.row.qitemId === row.qitemId)) fresh.push({ route, goal, row });
473
+ }
474
+ }
475
+ for (const task of fresh) task.sender = recordedSender(task.row, rig);
476
+ return fresh;
477
+ }
478
+
479
+ /** A task is shown once per session: one the agent leaves pending doesn't wake it again (its skill's own check is the
480
+ * backstop), so a pending task can't loop the conversation. */
481
+ function markShown(state, fresh) {
482
+ const shown = new Set(state.read("shown.json", []));
483
+ for (const task of fresh) shown.add(task.row.qitemId);
484
+ state.write("shown.json", [...shown]);
485
+ }
486
+
487
+ const alive = (pid) => { try { process.kill(pid, 0); return true; } catch { return false; } };
488
+
489
+ /** Claude Code UserPromptSubmit: a turn is running. */
490
+ function conversationTurn({ input = {}, deps = {} } = {}) {
491
+ const env = deps.env ?? process.env;
492
+ if (inSeat(env) || typeof input.session_id !== "string" || !input.session_id) return 0;
493
+ const state = deps.state ?? conversationState("claude", input.session_id, { env });
494
+ state?.write("turn.json", { at: (deps.now ?? Date.now)() });
495
+ return 0;
496
+ }
497
+
498
+ /** Claude Code SessionStart and Stop (`asyncRewake`). Returns the exit code: 2 after writing tasks, or the no-`rig`
499
+ * notice, 0 otherwise. Only a conversation that handed work over with an address of its own waits: those addresses come
500
+ * from its own turns, and each turn's Stop starts a new waiter that reads them again. So a read that finds none ends
501
+ * this waiter rather than polling for two hours. A read that fails (a daemon restarting, say) doesn't: a conversation
502
+ * that handed work over is waiting for its team precisely because no turn is coming, so it's tried again after a
503
+ * longer wait each time, as the Codex watcher does, until the deadline. */
504
+ async function conversationWaiter({ input = {}, out = process.stderr, deps = {} } = {}) {
505
+ const env = deps.env ?? process.env;
506
+ if (inSeat(env)) return 0;
507
+ const key = deps.key !== undefined ? deps.key : conversationKey({ env });
508
+ if (typeof key !== "string" || !key.startsWith("claude:")) return 0;
509
+ if (typeof input.session_id !== "string" || !input.session_id) return 0;
510
+ const state = deps.state ?? conversationState("claude", input.session_id, { env });
511
+ if (!state) return 0;
512
+ const now = deps.now ?? Date.now;
513
+ const wait = deps.sleep ?? sleep;
514
+ const rig = deps.rig !== undefined ? deps.rig : rigReader(env);
515
+ // Nothing to read with: tell the conversation the way a task wakes it, once for the plugin's install.
516
+ if (!rig) return (await sayNoRigOnce(state, (text) => writeAll(out, text), now)) ? 2 : 0;
517
+ forgetNoRig(state);
518
+ const me = { pid: deps.pid ?? process.pid, startedAt: now(), event: typeof input.hook_event_name === "string" ? input.hook_event_name : "unknown" };
519
+ state.write("waiter.json", me);
520
+ state.prune();
521
+ state.log(`armed ${me.event} for ${key}`);
522
+ const routes = routeWatch(key, input.transcript_path, rig, now, deps.statSize);
523
+ const deadline = me.startedAt + (deps.waiterMs ?? CONVERSATION_WAITER_MS);
524
+ // The key ends with the conversation's claude pid: a waiter whose Claude Code has exited (killed with its terminal, say,
525
+ // which needn't end its hooks) stops rather than polling to its deadline.
526
+ const claudePid = Number(key.slice(key.lastIndexOf(":") + 1));
527
+ // Consecutive failed reads: each waits twice as long as the one before, up to RETRY_MAX_MS.
528
+ let failures = 0;
529
+ const retryIn = () => Math.min(CONVERSATION_POLL_MS * 2 ** failures, RETRY_MAX_MS);
530
+ while (now() < deadline) {
531
+ if (state.read("waiter.json", {}).pid !== me.pid) { state.log("superseded"); return 0; }
532
+ if (!(deps.alive ?? alive)(claudePid)) { state.log("stopped: the conversation's claude process ended"); return 0; }
533
+ // A turn started after this waiter: nothing is written into it, and the turn's own Stop starts the next waiter.
534
+ if (Number(state.read("turn.json", {}).at ?? 0) > me.startedAt) { await wait(CONVERSATION_POLL_MS); continue; }
535
+ const current = routes();
536
+ if (current && current.size === 0) { state.log("no address under this conversation's key: nothing to wait for until a turn hands work over"); return 0; }
537
+ const fresh = current && freshTasks(current, state, rig);
538
+ if (!fresh) {
539
+ failures += 1;
540
+ state.log(`OpenRig couldn't be read, trying again in ${retryIn() / 1000} s`);
541
+ await wait(retryIn());
542
+ continue;
543
+ }
544
+ failures = 0;
545
+ if (fresh.length > 0) {
546
+ if (!(await writeAll(out, renderConversationTasks(fresh)))) return 0;
547
+ markShown(state, fresh);
548
+ state.log(`woke with ${fresh.map((task) => task.row.qitemId).join(",")}`);
549
+ return 2;
550
+ }
551
+ await wait(CONVERSATION_POLL_MS);
552
+ }
553
+ state.log("deadline");
554
+ return 0;
555
+ }
556
+
557
+ /** Codex SessionStart (async): one detached watcher per session. A resumed, cleared or compacted session keeps the live one. */
558
+ function codexStart({ input = {}, deps = {} } = {}) {
559
+ const env = deps.env ?? process.env;
560
+ const sessionId = String(input.session_id ?? "");
561
+ if (inSeat(env) || !UUID_RE.test(sessionId)) return 0;
562
+ const state = deps.state ?? conversationState("codex", sessionId, { env });
563
+ if (!state) return 0;
564
+ const now = deps.now ?? Date.now;
565
+ state.remove("stop.json");
566
+ const current = state.read("watcher.json", {});
567
+ if (current.pid && (deps.alive ?? alive)(current.pid) && now() - Number(current.beat ?? 0) < WATCHER_LIVE_MS) return 0;
568
+ const spawn = deps.spawn ?? require("node:child_process").spawn;
569
+ // The Codex process this hook runs under, so the watcher stops if it exits without a SessionEnd; 0 when it can't be seen.
570
+ const codexPid = deps.codexPid !== undefined ? deps.codexPid : nearestAgent(process.pid, processReader(), "codex");
571
+ const child = spawn(process.execPath, [__filename, "codex-watch", sessionId, typeof input.transcript_path === "string" ? input.transcript_path : "", String(codexPid || 0)],
572
+ { detached: true, stdio: "ignore", env, cwd: typeof input.cwd === "string" && input.cwd ? input.cwd : undefined });
573
+ state.write("watcher.json", { pid: child.pid, beat: now() });
574
+ child.unref?.();
575
+ state.log(`started watcher ${child.pid}`);
576
+ return 0;
577
+ }
578
+
579
+ /** Codex SessionEnd: the watcher stops at its next tick. */
580
+ function codexEnd({ input = {}, deps = {} } = {}) {
581
+ const env = deps.env ?? process.env;
582
+ const sessionId = String(input.session_id ?? "");
583
+ if (inSeat(env) || !UUID_RE.test(sessionId)) return 0;
584
+ const state = deps.state ?? conversationState("codex", sessionId, { env });
585
+ state?.write("stop.json", { at: (deps.now ?? Date.now)() });
586
+ state?.log("session ended");
587
+ return 0;
588
+ }
589
+
590
+ /** How a Codex without `--resume` on `codex queue` (0.162.1, say) answers it: an unknown argument, before doing anything. */
591
+ const RESUME_REJECTED = /unexpected argument '--resume'|Found argument '--resume'|unrecognized (?:argument|option):? '?--resume/i;
592
+ /** Said once in a thread whose Codex has no `--resume`, ahead of the first tasks queued without it. */
593
+ const NO_RESUME_NOTICE = "This Codex's `codex queue` has no `--resume`, so OpenRig's hook bridge, from the openrig plugin, can "
594
+ + "store the team's tasks for this chat but can't start a turn for them while the chat is idle: they come in at its next "
595
+ + "turn, as these did. Codex 0.171.0 starts that turn by itself, so updating Codex brings them in as they arrive. The "
596
+ + "plugin says this once in this chat; tell the person in plain words.\n\n";
597
+ const NO_RESUME = "no-resume.json";
598
+
599
+ /** `codex queue` stores the message for the thread, and with `--resume` (Codex 0.171.0) wakes it when idle; a busy thread,
600
+ * or one queued without `--resume`, gets it when its next turn ends. `resumeRejected` when this Codex refused the flag. */
601
+ function codexQueue(sessionId, text, { env = process.env, resume = true, spawnSync = require("node:child_process").spawnSync } = {}) {
602
+ try {
603
+ const result = spawnSync("codex", ["queue", "--thread", sessionId, "--message", text, ...(resume ? ["--resume"] : [])],
604
+ { env, encoding: "utf8", timeout: 60000, stdio: ["ignore", "pipe", "pipe"] });
605
+ const ok = !result.error && result.status === 0;
606
+ return { ok, detail: oneLine(result.error?.message ?? result.stderr ?? `exit ${result.status}`),
607
+ resumeRejected: !ok && resume && RESUME_REJECTED.test(String(result.stderr ?? "")) };
608
+ } catch (error) { return { ok: false, detail: oneLine(error?.message), resumeRejected: false }; }
609
+ }
610
+
611
+ /** The watcher's `codex queue`: with `--resume` until this Codex refuses it, then without it for the rest of the watch (the
612
+ * task waits for the thread's next turn), and the thread is told why once, ahead of the first tasks queued that way. */
613
+ function codexQueuer(sessionId, state, { env = process.env, now = Date.now, run = codexQueue } = {}) {
614
+ let resume = true;
615
+ return (text, { tasks = false } = {}) => {
616
+ if (resume) {
617
+ const tried = run(sessionId, text, { env, resume: true });
618
+ if (!tried.resumeRejected) return tried;
619
+ resume = false;
620
+ state.log(`this codex queue has no --resume: queueing for the thread's next turn (${tried.detail})`);
621
+ }
622
+ const tell = tasks && !state.exists(NO_RESUME);
623
+ const sent = run(sessionId, tell ? NO_RESUME_NOTICE + text : text, { env, resume: false });
624
+ if (sent.ok && tell) state.write(NO_RESUME, { at: now() });
625
+ return sent;
626
+ };
627
+ }
628
+
629
+ /** The Codex watcher. Returns 0 when its session ended, its Codex process exited, a newer watcher replaced it, or its
630
+ * rollout went idle with no Codex process to observe. */
631
+ async function codexWatch({ sessionId = "", transcriptPath = "", codexPid = 0, deps = {} } = {}) {
632
+ const env = deps.env ?? process.env;
633
+ if (inSeat(env) || !UUID_RE.test(sessionId)) return 0;
634
+ const key = `codex:${sessionId.toLowerCase()}`;
635
+ const state = deps.state ?? conversationState("codex", sessionId, { env });
636
+ if (!state) return 0;
637
+ const now = deps.now ?? Date.now;
638
+ const wait = deps.sleep ?? sleep;
639
+ // codex-start runs the watcher in the session's folder, which stands in for Claude Code's CLAUDE_PROJECT_DIR.
640
+ const rig = deps.rig !== undefined ? deps.rig : rigReader(env, deps.projectDir ?? process.cwd());
641
+ const queue = deps.queue ?? codexQueuer(sessionId, state, { env, now });
642
+ const statSize = deps.statSize ?? ((p) => fs.statSync(p).size);
643
+ const me = deps.pid ?? process.pid;
644
+ state.write("watcher.json", { pid: me, beat: now() });
645
+ state.prune();
646
+ if (!rig) { await sayNoRigOnce(state, (text) => queue(text).ok, now); return 0; }
647
+ forgetNoRig(state);
648
+ state.log(`watching for ${key}`);
649
+ const routes = routeWatch(key, transcriptPath, rig, now, statSize);
650
+ let size = null;
651
+ let grewAt = now();
652
+ // Consecutive ticks whose read or queue failed: each waits twice as long as the one before, up to RETRY_MAX_MS, so a
653
+ // stopped daemon or a failing `codex queue` isn't retried, with a new process each time, every 15 seconds.
654
+ let failures = 0;
655
+ const retryIn = () => Math.min(CONVERSATION_POLL_MS * 2 ** failures, RETRY_MAX_MS);
656
+ for (;;) {
657
+ if (state.exists("stop.json")) { state.log("stopped: the session ended"); return 0; }
658
+ if (state.read("watcher.json", {}).pid !== me) { state.log("superseded"); return 0; }
659
+ if (codexPid > 0 && !(deps.alive ?? alive)(codexPid)) { state.log("stopped: the session's codex process ended"); return 0; }
660
+ state.write("watcher.json", { pid: me, beat: now() });
661
+ let current = null;
662
+ try { current = transcriptPath ? statSize(transcriptPath) : null; } catch { current = null; }
663
+ if (current !== size) { size = current; grewAt = now(); }
664
+ if (codexPid <= 0 && now() - grewAt > CODEX_IDLE_EXIT_MS) { state.log("stopped: the session's rollout went idle"); return 0; }
665
+ const read = routes();
666
+ const fresh = read && freshTasks(read, state, rig);
667
+ if (!fresh) {
668
+ failures += 1;
669
+ state.log(`OpenRig couldn't be read, trying again in ${retryIn() / 1000} s`);
670
+ } else if (fresh.length > 0) {
671
+ const queued = queue(renderConversationTasks(fresh), { tasks: true });
672
+ if (queued.ok) {
673
+ failures = 0;
674
+ markShown(state, fresh);
675
+ state.log(`queued for the thread (stored, not proof it was read): ${fresh.map((task) => task.row.qitemId).join(",")}`);
676
+ } else {
677
+ failures += 1;
678
+ state.log(`codex queue failed, trying again in ${retryIn() / 1000} s: ${queued.detail}`);
679
+ }
680
+ } else {
681
+ failures = 0;
682
+ }
683
+ await wait(retryIn());
684
+ }
685
+ }
686
+
133
687
  async function main() {
134
688
  const mode = process.argv[2];
689
+ // A seat keeps its own delivery: the conversation modes end before reading anything.
690
+ if (CONVERSATION_MODES.has(mode) && inSeat()) { process.exitCode = 0; return; }
691
+ if (mode === "codex-watch") {
692
+ await codexWatch({ sessionId: process.argv[3] ?? "", transcriptPath: process.argv[4] ?? "", codexPid: Number(process.argv[5] ?? 0) || 0 }).catch(() => 0);
693
+ process.exit(0);
694
+ }
135
695
  const input = await readHookInput();
136
696
  if (mode === "turn") { await post("turn", { hookEvent: "UserPromptSubmit" }); process.exitCode = 0; return; }
137
- if (mode !== "waiter") { process.exitCode = 0; return; }
138
- const code = await waiter({ hookEvent: typeof input.hook_event_name === "string" ? input.hook_event_name : "unknown" }).catch(() => 0);
697
+ if (mode === "conversation-turn") { process.exitCode = conversationTurn({ input }); return; }
698
+ if (mode === "codex-start") { process.exitCode = codexStart({ input }); return; }
699
+ if (mode === "codex-end") { process.exitCode = codexEnd({ input }); return; }
700
+ if (mode !== "waiter" && mode !== "conversation-waiter") { process.exitCode = 0; return; }
701
+ const code = mode === "waiter"
702
+ ? await waiter({ hookEvent: typeof input.hook_event_name === "string" ? input.hook_event_name : "unknown" }).catch(() => 0)
703
+ : await conversationWaiter({ input }).catch(() => 0);
139
704
  // exitCode, not exit(): the process ends once its output is flushed. The batch was already written in full above; if
140
705
  // an idle connection still holds the loop open, end it shortly after, with the same code.
141
706
  process.exitCode = code;
@@ -143,4 +708,8 @@ async function main() {
143
708
  }
144
709
 
145
710
  if (require.main === module) void main();
146
- module.exports = { render, waiter, endpoint };
711
+ module.exports = {
712
+ render, waiter, endpoint,
713
+ CONVERSATION_KEY_TAG_PREFIX, conversationKey, conversationKeyTag, processReader, conversationRoutes, renderConversationTasks,
714
+ conversationWaiter, conversationTurn, codexStart, codexEnd, codexWatch, findRig,
715
+ };
@@ -0,0 +1,5 @@
1
+ // The declarations TypeScript callers use (the conversation key, recorded by the CLI and the MCP server); the script itself
2
+ // is plain CommonJS so the openrig plugin can ship and run a copy of it.
3
+ export const CONVERSATION_KEY_TAG_PREFIX: string;
4
+ export function conversationKey(opts?: { pid?: number; env?: NodeJS.ProcessEnv; read?: (pid: number) => { pid: number; ppid: number; start: string; names: string[] } | null }): string | null;
5
+ export function conversationKeyTag(key: string): string;