@openrig/cli 0.7.1 → 0.7.2

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 (738) hide show
  1. package/README.md +5 -5
  2. package/daemon/assets/plugins/openrig-core/.claude-plugin/plugin.json +1 -1
  3. package/daemon/assets/plugins/openrig-core/.codex-plugin/plugin.json +1 -1
  4. package/daemon/assets/plugins/openrig-core/skills/delegating-work/SKILL.md +1 -1
  5. package/daemon/assets/plugins/openrig-core/skills/openrig-user/SKILL.md +90 -9
  6. package/daemon/assets/skills/rigs/SKILL.md +40 -9
  7. package/daemon/context-packs/help/help.md +6 -0
  8. package/daemon/context-packs/help/manifest.yaml +1 -1
  9. package/daemon/context-packs/onboarding-width/manifest.yaml +1 -1
  10. package/daemon/context-packs/onboarding-width/public-what-you-can-do.md +70 -15
  11. package/daemon/context-packs/reference/acp-agents.md +77 -0
  12. package/daemon/context-packs/reference/getting-started.md +82 -10
  13. package/daemon/context-packs/reference/manifest.yaml +6 -3
  14. package/daemon/context-packs/reference/rig-spec.md +93 -3
  15. package/daemon/context-packs/reference/whats-new.md +262 -149
  16. package/daemon/context-packs/skills/agent-operated-software/manifest.yaml +1 -1
  17. package/daemon/context-packs/skills/agent-operated-workflows/manifest.yaml +1 -1
  18. package/daemon/context-packs/skills/applying-a-permission-policy/manifest.yaml +1 -1
  19. package/daemon/context-packs/skills/claude-compaction-restore/manifest.yaml +1 -1
  20. package/daemon/context-packs/skills/core/agent-starters/manifest.yaml +1 -1
  21. package/daemon/context-packs/skills/core/agent-startup-and-context-ingestion/manifest.yaml +1 -1
  22. package/daemon/context-packs/skills/core/cross-host-rig-commands/manifest.yaml +1 -1
  23. package/daemon/context-packs/skills/core/human-in-the-loop/manifest.yaml +1 -1
  24. package/daemon/context-packs/skills/core/messaging-the-human/manifest.yaml +1 -1
  25. package/daemon/context-packs/skills/core/openrig-architect/manifest.yaml +1 -1
  26. package/daemon/context-packs/skills/core/openrig-cmux/manifest.yaml +1 -1
  27. package/daemon/context-packs/skills/core/openrig-herdr/SKILL.md +17 -5
  28. package/daemon/context-packs/skills/core/openrig-herdr/manifest.yaml +1 -1
  29. package/daemon/context-packs/skills/core/openrig-skills/manifest.yaml +1 -1
  30. package/daemon/context-packs/skills/core/openrig-software-factory/manifest.yaml +1 -1
  31. package/daemon/context-packs/skills/core/openrig-upgrade/manifest.yaml +1 -1
  32. package/daemon/context-packs/skills/core/rig-bundles-and-shareable-artifacts/manifest.yaml +1 -1
  33. package/daemon/context-packs/skills/core/rig-lifecycle/manifest.yaml +1 -1
  34. package/daemon/context-packs/skills/core/session-source-fork/manifest.yaml +1 -1
  35. package/daemon/context-packs/skills/core/specification-system/manifest.yaml +1 -1
  36. package/daemon/context-packs/skills/core/topology-mutation-and-seat-management/manifest.yaml +1 -1
  37. package/daemon/context-packs/skills/core/watchdog/manifest.yaml +1 -1
  38. package/daemon/context-packs/skills/delegating-work/SKILL.md +1 -1
  39. package/daemon/context-packs/skills/delegating-work/manifest.yaml +1 -1
  40. package/daemon/context-packs/skills/forming-an-openrig-mental-model/manifest.yaml +1 -1
  41. package/daemon/context-packs/skills/loading-addressable-markdown/manifest.yaml +1 -1
  42. package/daemon/context-packs/skills/mission-slice-sop/manifest.yaml +1 -1
  43. package/daemon/context-packs/skills/openrig-operating-model/manifest.yaml +1 -1
  44. package/daemon/context-packs/skills/openrig-user/SKILL.md +90 -9
  45. package/daemon/context-packs/skills/openrig-user/manifest.yaml +1 -1
  46. package/daemon/context-packs/skills/orienting-to-an-inherited-seat/manifest.yaml +1 -1
  47. package/daemon/context-packs/skills/pm/backlog-capture/manifest.yaml +1 -1
  48. package/daemon/context-packs/skills/pm/context-builder/manifest.yaml +1 -1
  49. package/daemon/context-packs/skills/pm/exec-summary/manifest.yaml +1 -1
  50. package/daemon/context-packs/skills/pm/office-hours/manifest.yaml +1 -1
  51. package/daemon/context-packs/skills/pm/plan-review/manifest.yaml +1 -1
  52. package/daemon/context-packs/skills/pm/requirements-writer/manifest.yaml +1 -1
  53. package/daemon/context-packs/skills/pm/ui-mockup/manifest.yaml +1 -1
  54. package/daemon/context-packs/skills/pods/development-team/manifest.yaml +1 -1
  55. package/daemon/context-packs/skills/pods/orchestration-team/manifest.yaml +1 -1
  56. package/daemon/context-packs/skills/pods/oversight-team/manifest.yaml +1 -1
  57. package/daemon/context-packs/skills/pods/review-team/manifest.yaml +1 -1
  58. package/daemon/context-packs/skills/process/agent-browser/LICENSE.txt +201 -0
  59. package/daemon/context-packs/skills/process/agent-browser/OPENRIG.md +13 -29
  60. package/daemon/context-packs/skills/process/agent-browser/SKILL.md +7 -7
  61. package/daemon/context-packs/skills/process/agent-browser/manifest.yaml +3 -1
  62. package/daemon/context-packs/skills/process/context-engineering/manifest.yaml +1 -1
  63. package/daemon/context-packs/skills/process/dogfood/LICENSE.txt +201 -0
  64. package/daemon/context-packs/skills/process/dogfood/SKILL.md +6 -2
  65. package/daemon/context-packs/skills/process/dogfood/manifest.yaml +3 -1
  66. package/daemon/context-packs/skills/process/frontend-design/manifest.yaml +1 -1
  67. package/daemon/context-packs/skills/process/systematic-debugging/LICENSE.txt +21 -0
  68. package/daemon/context-packs/skills/process/systematic-debugging/SKILL.md +6 -2
  69. package/daemon/context-packs/skills/process/systematic-debugging/manifest.yaml +3 -1
  70. package/daemon/context-packs/skills/process/test-driven-development/LICENSE.txt +21 -0
  71. package/daemon/context-packs/skills/process/test-driven-development/SKILL.md +5 -1
  72. package/daemon/context-packs/skills/process/test-driven-development/manifest.yaml +3 -1
  73. package/daemon/context-packs/skills/process/verification-before-completion/LICENSE.txt +21 -0
  74. package/daemon/context-packs/skills/process/verification-before-completion/SKILL.md +5 -1
  75. package/daemon/context-packs/skills/process/verification-before-completion/manifest.yaml +3 -1
  76. package/daemon/context-packs/skills/queue-handoff/manifest.yaml +1 -1
  77. package/daemon/context-packs/skills/refocusing/manifest.yaml +1 -1
  78. package/daemon/context-packs/skills/retiring-and-inheriting-a-seat/manifest.yaml +1 -1
  79. package/daemon/context-packs/skills/seat-continuity-and-handover/manifest.yaml +1 -1
  80. package/daemon/context-packs/skills/session-compaction-and-restore/manifest.yaml +1 -1
  81. package/daemon/context-packs/skills/software-for-agents/manifest.yaml +1 -1
  82. package/daemon/context-packs/world-example/manifest.yaml +1 -1
  83. package/daemon/context-packs/world-public/manifest.yaml +1 -1
  84. package/daemon/dist/adapters/claude-code-adapter.d.ts +4 -0
  85. package/daemon/dist/adapters/claude-code-adapter.d.ts.map +1 -1
  86. package/daemon/dist/adapters/claude-code-adapter.js +46 -17
  87. package/daemon/dist/adapters/claude-code-adapter.js.map +1 -1
  88. package/daemon/dist/adapters/claude-resume.d.ts +8 -1
  89. package/daemon/dist/adapters/claude-resume.d.ts.map +1 -1
  90. package/daemon/dist/adapters/claude-resume.js +29 -10
  91. package/daemon/dist/adapters/claude-resume.js.map +1 -1
  92. package/daemon/dist/adapters/codex-resume.d.ts +10 -4
  93. package/daemon/dist/adapters/codex-resume.d.ts.map +1 -1
  94. package/daemon/dist/adapters/codex-resume.js +59 -14
  95. package/daemon/dist/adapters/codex-resume.js.map +1 -1
  96. package/daemon/dist/adapters/codex-runtime-adapter.d.ts +44 -12
  97. package/daemon/dist/adapters/codex-runtime-adapter.d.ts.map +1 -1
  98. package/daemon/dist/adapters/codex-runtime-adapter.js +445 -88
  99. package/daemon/dist/adapters/codex-runtime-adapter.js.map +1 -1
  100. package/daemon/dist/adapters/community-harness-runtime-adapter.d.ts +4 -0
  101. package/daemon/dist/adapters/community-harness-runtime-adapter.d.ts.map +1 -1
  102. package/daemon/dist/adapters/community-harness-runtime-adapter.js +38 -7
  103. package/daemon/dist/adapters/community-harness-runtime-adapter.js.map +1 -1
  104. package/daemon/dist/adapters/compose-services-adapter.d.ts +16 -0
  105. package/daemon/dist/adapters/compose-services-adapter.d.ts.map +1 -1
  106. package/daemon/dist/adapters/compose-services-adapter.js +46 -2
  107. package/daemon/dist/adapters/compose-services-adapter.js.map +1 -1
  108. package/daemon/dist/adapters/kernel-authority.d.ts +1 -1
  109. package/daemon/dist/adapters/kernel-authority.d.ts.map +1 -1
  110. package/daemon/dist/adapters/kernel-authority.js +13 -2
  111. package/daemon/dist/adapters/kernel-authority.js.map +1 -1
  112. package/daemon/dist/adapters/pi-runner.d.ts.map +1 -1
  113. package/daemon/dist/adapters/pi-runner.js +22 -15
  114. package/daemon/dist/adapters/pi-runner.js.map +1 -1
  115. package/daemon/dist/adapters/tmux-server.d.ts +3 -0
  116. package/daemon/dist/adapters/tmux-server.d.ts.map +1 -1
  117. package/daemon/dist/adapters/tmux-server.js +11 -2
  118. package/daemon/dist/adapters/tmux-server.js.map +1 -1
  119. package/daemon/dist/adapters/tmux.d.ts +38 -0
  120. package/daemon/dist/adapters/tmux.d.ts.map +1 -1
  121. package/daemon/dist/adapters/tmux.js +157 -14
  122. package/daemon/dist/adapters/tmux.js.map +1 -1
  123. package/daemon/dist/adapters/yolo-mode.d.ts +7 -0
  124. package/daemon/dist/adapters/yolo-mode.d.ts.map +1 -1
  125. package/daemon/dist/adapters/yolo-mode.js +8 -0
  126. package/daemon/dist/adapters/yolo-mode.js.map +1 -1
  127. package/daemon/dist/build-info.js +3 -3
  128. package/daemon/dist/codex-auth-surface.d.ts +2 -0
  129. package/daemon/dist/codex-auth-surface.d.ts.map +1 -0
  130. package/daemon/dist/codex-auth-surface.js +2 -0
  131. package/daemon/dist/codex-auth-surface.js.map +1 -0
  132. package/daemon/dist/daemon-db-path.d.ts.map +1 -1
  133. package/daemon/dist/daemon-db-path.js +45 -12
  134. package/daemon/dist/daemon-db-path.js.map +1 -1
  135. package/daemon/dist/db/all-migrations.d.ts.map +1 -1
  136. package/daemon/dist/db/all-migrations.js +12 -0
  137. package/daemon/dist/db/all-migrations.js.map +1 -1
  138. package/daemon/dist/db/migrations/132_seat_runtime_switches.d.ts +10 -0
  139. package/daemon/dist/db/migrations/132_seat_runtime_switches.d.ts.map +1 -0
  140. package/daemon/dist/db/migrations/132_seat_runtime_switches.js +46 -0
  141. package/daemon/dist/db/migrations/132_seat_runtime_switches.js.map +1 -0
  142. package/daemon/dist/db/migrations/133_stream_reader_actions.d.ts +8 -0
  143. package/daemon/dist/db/migrations/133_stream_reader_actions.d.ts.map +1 -0
  144. package/daemon/dist/db/migrations/133_stream_reader_actions.js +25 -0
  145. package/daemon/dist/db/migrations/133_stream_reader_actions.js.map +1 -0
  146. package/daemon/dist/db/migrations/134_claude_token_readings.d.ts +3 -0
  147. package/daemon/dist/db/migrations/134_claude_token_readings.d.ts.map +1 -0
  148. package/daemon/dist/db/migrations/134_claude_token_readings.js +21 -0
  149. package/daemon/dist/db/migrations/134_claude_token_readings.js.map +1 -0
  150. package/daemon/dist/db/migrations/136_node_launch_recipe.d.ts +9 -0
  151. package/daemon/dist/db/migrations/136_node_launch_recipe.d.ts.map +1 -0
  152. package/daemon/dist/db/migrations/136_node_launch_recipe.js +11 -0
  153. package/daemon/dist/db/migrations/136_node_launch_recipe.js.map +1 -0
  154. package/daemon/dist/db/migrations/138_node_claude_token_ref.d.ts +3 -0
  155. package/daemon/dist/db/migrations/138_node_claude_token_ref.d.ts.map +1 -0
  156. package/daemon/dist/db/migrations/138_node_claude_token_ref.js +8 -0
  157. package/daemon/dist/db/migrations/138_node_claude_token_ref.js.map +1 -0
  158. package/daemon/dist/db/migrations/139_node_claude_permissions.d.ts +3 -0
  159. package/daemon/dist/db/migrations/139_node_claude_permissions.d.ts.map +1 -0
  160. package/daemon/dist/db/migrations/139_node_claude_permissions.js +5 -0
  161. package/daemon/dist/db/migrations/139_node_claude_permissions.js.map +1 -0
  162. package/daemon/dist/domain/bootstrap-orchestrator.d.ts.map +1 -1
  163. package/daemon/dist/domain/bootstrap-orchestrator.js +15 -0
  164. package/daemon/dist/domain/bootstrap-orchestrator.js.map +1 -1
  165. package/daemon/dist/domain/claim-service.js +1 -1
  166. package/daemon/dist/domain/claim-service.js.map +1 -1
  167. package/daemon/dist/domain/claude-compaction-enforcer.d.ts +24 -1
  168. package/daemon/dist/domain/claude-compaction-enforcer.d.ts.map +1 -1
  169. package/daemon/dist/domain/claude-compaction-enforcer.js +70 -16
  170. package/daemon/dist/domain/claude-compaction-enforcer.js.map +1 -1
  171. package/daemon/dist/domain/claude-credential-precedence.d.ts +33 -0
  172. package/daemon/dist/domain/claude-credential-precedence.d.ts.map +1 -0
  173. package/daemon/dist/domain/claude-credential-precedence.js +62 -0
  174. package/daemon/dist/domain/claude-credential-precedence.js.map +1 -0
  175. package/daemon/dist/domain/claude-managed-launch.d.ts +43 -4
  176. package/daemon/dist/domain/claude-managed-launch.d.ts.map +1 -1
  177. package/daemon/dist/domain/claude-managed-launch.js +129 -27
  178. package/daemon/dist/domain/claude-managed-launch.js.map +1 -1
  179. package/daemon/dist/domain/claude-permission-rules.d.ts +10 -0
  180. package/daemon/dist/domain/claude-permission-rules.d.ts.map +1 -0
  181. package/daemon/dist/domain/claude-permission-rules.js +41 -0
  182. package/daemon/dist/domain/claude-permission-rules.js.map +1 -0
  183. package/daemon/dist/domain/claude-seat-token.d.ts +30 -0
  184. package/daemon/dist/domain/claude-seat-token.d.ts.map +1 -0
  185. package/daemon/dist/domain/claude-seat-token.js +78 -0
  186. package/daemon/dist/domain/claude-seat-token.js.map +1 -0
  187. package/daemon/dist/domain/codex-auth.d.ts +148 -0
  188. package/daemon/dist/domain/codex-auth.d.ts.map +1 -0
  189. package/daemon/dist/domain/codex-auth.js +506 -0
  190. package/daemon/dist/domain/codex-auth.js.map +1 -0
  191. package/daemon/dist/domain/codex-daemon-support.d.ts +2 -1
  192. package/daemon/dist/domain/codex-daemon-support.d.ts.map +1 -1
  193. package/daemon/dist/domain/codex-daemon-support.js +3 -2
  194. package/daemon/dist/domain/codex-daemon-support.js.map +1 -1
  195. package/daemon/dist/domain/codex-git-add-dirs.d.ts +1 -1
  196. package/daemon/dist/domain/codex-git-add-dirs.d.ts.map +1 -1
  197. package/daemon/dist/domain/codex-network-default.d.ts +2 -1
  198. package/daemon/dist/domain/codex-network-default.d.ts.map +1 -1
  199. package/daemon/dist/domain/codex-network-default.js +3 -2
  200. package/daemon/dist/domain/codex-network-default.js.map +1 -1
  201. package/daemon/dist/domain/codex-team-workspace.d.ts +5 -0
  202. package/daemon/dist/domain/codex-team-workspace.d.ts.map +1 -1
  203. package/daemon/dist/domain/codex-team-workspace.js +37 -0
  204. package/daemon/dist/domain/codex-team-workspace.js.map +1 -1
  205. package/daemon/dist/domain/community-harness-first-input.d.ts +7 -0
  206. package/daemon/dist/domain/community-harness-first-input.d.ts.map +1 -0
  207. package/daemon/dist/domain/community-harness-first-input.js +16 -0
  208. package/daemon/dist/domain/community-harness-first-input.js.map +1 -0
  209. package/daemon/dist/domain/community-harness-presets.d.ts +2 -0
  210. package/daemon/dist/domain/community-harness-presets.d.ts.map +1 -1
  211. package/daemon/dist/domain/community-harness-presets.js +4 -2
  212. package/daemon/dist/domain/community-harness-presets.js.map +1 -1
  213. package/daemon/dist/domain/compaction-restore-notice.d.ts +6 -0
  214. package/daemon/dist/domain/compaction-restore-notice.d.ts.map +1 -0
  215. package/daemon/dist/domain/compaction-restore-notice.js +27 -0
  216. package/daemon/dist/domain/compaction-restore-notice.js.map +1 -0
  217. package/daemon/dist/domain/context-packs/seat-recap-store.d.ts +14 -0
  218. package/daemon/dist/domain/context-packs/seat-recap-store.d.ts.map +1 -1
  219. package/daemon/dist/domain/context-packs/seat-recap-store.js +57 -1
  220. package/daemon/dist/domain/context-packs/seat-recap-store.js.map +1 -1
  221. package/daemon/dist/domain/context-usage-store.d.ts.map +1 -1
  222. package/daemon/dist/domain/context-usage-store.js +6 -1
  223. package/daemon/dist/domain/context-usage-store.js.map +1 -1
  224. package/daemon/dist/domain/current-work.d.ts +15 -4
  225. package/daemon/dist/domain/current-work.d.ts.map +1 -1
  226. package/daemon/dist/domain/current-work.js +26 -13
  227. package/daemon/dist/domain/current-work.js.map +1 -1
  228. package/daemon/dist/domain/execution-view.d.ts.map +1 -1
  229. package/daemon/dist/domain/execution-view.js +5 -2
  230. package/daemon/dist/domain/execution-view.js.map +1 -1
  231. package/daemon/dist/domain/gateway/operator-delivery-engine.d.ts.map +1 -1
  232. package/daemon/dist/domain/gateway/operator-delivery-engine.js +3 -1
  233. package/daemon/dist/domain/gateway/operator-delivery-engine.js.map +1 -1
  234. package/daemon/dist/domain/gateway/slack/inbound.d.ts +1 -0
  235. package/daemon/dist/domain/gateway/slack/inbound.d.ts.map +1 -1
  236. package/daemon/dist/domain/gateway/slack/inbound.js +6 -5
  237. package/daemon/dist/domain/gateway/slack/inbound.js.map +1 -1
  238. package/daemon/dist/domain/gateway/slack/message.d.ts +3 -1
  239. package/daemon/dist/domain/gateway/slack/message.d.ts.map +1 -1
  240. package/daemon/dist/domain/gateway/slack/message.js +11 -9
  241. package/daemon/dist/domain/gateway/slack/message.js.map +1 -1
  242. package/daemon/dist/domain/gateway/slack/slack-subsystem.d.ts.map +1 -1
  243. package/daemon/dist/domain/gateway/slack/slack-subsystem.js +4 -0
  244. package/daemon/dist/domain/gateway/slack/slack-subsystem.js.map +1 -1
  245. package/daemon/dist/domain/managed-restore-read-access.d.ts +20 -0
  246. package/daemon/dist/domain/managed-restore-read-access.d.ts.map +1 -0
  247. package/daemon/dist/domain/managed-restore-read-access.js +77 -0
  248. package/daemon/dist/domain/managed-restore-read-access.js.map +1 -0
  249. package/daemon/dist/domain/markdown-address.d.ts.map +1 -1
  250. package/daemon/dist/domain/markdown-address.js +21 -2
  251. package/daemon/dist/domain/markdown-address.js.map +1 -1
  252. package/daemon/dist/domain/mission-control/mission-control-write-contract.d.ts +3 -3
  253. package/daemon/dist/domain/mission-control/mission-control-write-contract.d.ts.map +1 -1
  254. package/daemon/dist/domain/mission-control/mission-control-write-contract.js +11 -8
  255. package/daemon/dist/domain/mission-control/mission-control-write-contract.js.map +1 -1
  256. package/daemon/dist/domain/model-divergence/model-divergence-monitor.d.ts.map +1 -1
  257. package/daemon/dist/domain/model-divergence/model-divergence-monitor.js +18 -1
  258. package/daemon/dist/domain/model-divergence/model-divergence-monitor.js.map +1 -1
  259. package/daemon/dist/domain/native-permission-store.d.ts +7 -2
  260. package/daemon/dist/domain/native-permission-store.d.ts.map +1 -1
  261. package/daemon/dist/domain/native-permission-store.js +13 -8
  262. package/daemon/dist/domain/native-permission-store.js.map +1 -1
  263. package/daemon/dist/domain/native-resume-probe.d.ts +2 -0
  264. package/daemon/dist/domain/native-resume-probe.d.ts.map +1 -1
  265. package/daemon/dist/domain/native-resume-probe.js +162 -35
  266. package/daemon/dist/domain/native-resume-probe.js.map +1 -1
  267. package/daemon/dist/domain/node-inventory.d.ts +4 -0
  268. package/daemon/dist/domain/node-inventory.d.ts.map +1 -1
  269. package/daemon/dist/domain/node-inventory.js +18 -0
  270. package/daemon/dist/domain/node-inventory.js.map +1 -1
  271. package/daemon/dist/domain/node-launcher.d.ts +11 -0
  272. package/daemon/dist/domain/node-launcher.d.ts.map +1 -1
  273. package/daemon/dist/domain/node-launcher.js +41 -6
  274. package/daemon/dist/domain/node-launcher.js.map +1 -1
  275. package/daemon/dist/domain/parent-session-env.d.ts +1 -1
  276. package/daemon/dist/domain/parent-session-env.d.ts.map +1 -1
  277. package/daemon/dist/domain/parent-session-env.js +3 -1
  278. package/daemon/dist/domain/parent-session-env.js.map +1 -1
  279. package/daemon/dist/domain/parked-query.d.ts +3 -0
  280. package/daemon/dist/domain/parked-query.d.ts.map +1 -1
  281. package/daemon/dist/domain/parked-query.js +1 -0
  282. package/daemon/dist/domain/parked-query.js.map +1 -1
  283. package/daemon/dist/domain/permission-account.d.ts +3 -0
  284. package/daemon/dist/domain/permission-account.d.ts.map +1 -1
  285. package/daemon/dist/domain/permission-account.js +17 -3
  286. package/daemon/dist/domain/permission-account.js.map +1 -1
  287. package/daemon/dist/domain/policies/parked-owner-consumer.d.ts +8 -0
  288. package/daemon/dist/domain/policies/parked-owner-consumer.d.ts.map +1 -1
  289. package/daemon/dist/domain/policies/parked-owner-consumer.js +15 -1
  290. package/daemon/dist/domain/policies/parked-owner-consumer.js.map +1 -1
  291. package/daemon/dist/domain/proof/judgments.d.ts +7 -4
  292. package/daemon/dist/domain/proof/judgments.d.ts.map +1 -1
  293. package/daemon/dist/domain/proof/judgments.js +12 -8
  294. package/daemon/dist/domain/proof/judgments.js.map +1 -1
  295. package/daemon/dist/domain/proof/source-watch.d.ts +6 -1
  296. package/daemon/dist/domain/proof/source-watch.d.ts.map +1 -1
  297. package/daemon/dist/domain/proof/source-watch.js +241 -35
  298. package/daemon/dist/domain/proof/source-watch.js.map +1 -1
  299. package/daemon/dist/domain/provider/claude-auth-status-reader.d.ts +12 -0
  300. package/daemon/dist/domain/provider/claude-auth-status-reader.d.ts.map +1 -1
  301. package/daemon/dist/domain/provider/claude-auth-status-reader.js +4 -4
  302. package/daemon/dist/domain/provider/claude-auth-status-reader.js.map +1 -1
  303. package/daemon/dist/domain/provider/claude-seat-switch.d.ts +32 -0
  304. package/daemon/dist/domain/provider/claude-seat-switch.d.ts.map +1 -0
  305. package/daemon/dist/domain/provider/claude-seat-switch.js +136 -0
  306. package/daemon/dist/domain/provider/claude-seat-switch.js.map +1 -0
  307. package/daemon/dist/domain/provider/claude-token-usage.d.ts +34 -0
  308. package/daemon/dist/domain/provider/claude-token-usage.d.ts.map +1 -0
  309. package/daemon/dist/domain/provider/claude-token-usage.js +168 -0
  310. package/daemon/dist/domain/provider/claude-token-usage.js.map +1 -0
  311. package/daemon/dist/domain/provider/provider-account-readings.d.ts +7 -6
  312. package/daemon/dist/domain/provider/provider-account-readings.d.ts.map +1 -1
  313. package/daemon/dist/domain/provider/provider-account-readings.js +31 -10
  314. package/daemon/dist/domain/provider/provider-account-readings.js.map +1 -1
  315. package/daemon/dist/domain/provider/provider-collect.d.ts +3 -0
  316. package/daemon/dist/domain/provider/provider-collect.d.ts.map +1 -1
  317. package/daemon/dist/domain/provider/provider-collect.js +3 -2
  318. package/daemon/dist/domain/provider/provider-collect.js.map +1 -1
  319. package/daemon/dist/domain/provider/provider-seat-accounts.d.ts +1 -1
  320. package/daemon/dist/domain/provider/provider-seat-accounts.d.ts.map +1 -1
  321. package/daemon/dist/domain/provider/provider-seat-accounts.js +29 -2
  322. package/daemon/dist/domain/provider/provider-seat-accounts.js.map +1 -1
  323. package/daemon/dist/domain/provider/provider-service-impl.d.ts +38 -4
  324. package/daemon/dist/domain/provider/provider-service-impl.d.ts.map +1 -1
  325. package/daemon/dist/domain/provider/provider-service-impl.js +147 -5
  326. package/daemon/dist/domain/provider/provider-service-impl.js.map +1 -1
  327. package/daemon/dist/domain/provider/provider-service.d.ts +109 -4
  328. package/daemon/dist/domain/provider/provider-service.d.ts.map +1 -1
  329. package/daemon/dist/domain/provider/provider-signals.d.ts +3 -0
  330. package/daemon/dist/domain/provider/provider-signals.d.ts.map +1 -1
  331. package/daemon/dist/domain/provider/provider-signals.js +7 -2
  332. package/daemon/dist/domain/provider/provider-signals.js.map +1 -1
  333. package/daemon/dist/domain/provider/provider-types.d.ts +61 -5
  334. package/daemon/dist/domain/provider/provider-types.d.ts.map +1 -1
  335. package/daemon/dist/domain/provider/reactive-tap.d.ts +4 -0
  336. package/daemon/dist/domain/provider/reactive-tap.d.ts.map +1 -1
  337. package/daemon/dist/domain/provider/reactive-tap.js +3 -0
  338. package/daemon/dist/domain/provider/reactive-tap.js.map +1 -1
  339. package/daemon/dist/domain/provider/usage-across-hosts.d.ts.map +1 -1
  340. package/daemon/dist/domain/provider/usage-across-hosts.js +8 -2
  341. package/daemon/dist/domain/provider/usage-across-hosts.js.map +1 -1
  342. package/daemon/dist/domain/provider/usage-windows.d.ts +2 -0
  343. package/daemon/dist/domain/provider/usage-windows.d.ts.map +1 -1
  344. package/daemon/dist/domain/provider/usage-windows.js +4 -0
  345. package/daemon/dist/domain/provider/usage-windows.js.map +1 -1
  346. package/daemon/dist/domain/queue-owner.d.ts +9 -0
  347. package/daemon/dist/domain/queue-owner.d.ts.map +1 -1
  348. package/daemon/dist/domain/queue-owner.js +28 -0
  349. package/daemon/dist/domain/queue-owner.js.map +1 -1
  350. package/daemon/dist/domain/queue-repository.d.ts +18 -3
  351. package/daemon/dist/domain/queue-repository.d.ts.map +1 -1
  352. package/daemon/dist/domain/queue-repository.js +94 -10
  353. package/daemon/dist/domain/queue-repository.js.map +1 -1
  354. package/daemon/dist/domain/queue-retention.d.ts +1 -1
  355. package/daemon/dist/domain/queue-retention.d.ts.map +1 -1
  356. package/daemon/dist/domain/queue-retention.js +6 -1
  357. package/daemon/dist/domain/queue-retention.js.map +1 -1
  358. package/daemon/dist/domain/queue-stuck-sweep.d.ts +14 -3
  359. package/daemon/dist/domain/queue-stuck-sweep.d.ts.map +1 -1
  360. package/daemon/dist/domain/queue-stuck-sweep.js +50 -8
  361. package/daemon/dist/domain/queue-stuck-sweep.js.map +1 -1
  362. package/daemon/dist/domain/queue-wake-ladder.d.ts.map +1 -1
  363. package/daemon/dist/domain/queue-wake-ladder.js +90 -28
  364. package/daemon/dist/domain/queue-wake-ladder.js.map +1 -1
  365. package/daemon/dist/domain/queue-wake-repository.d.ts +3 -0
  366. package/daemon/dist/domain/queue-wake-repository.d.ts.map +1 -1
  367. package/daemon/dist/domain/queue-wake-repository.js +5 -1
  368. package/daemon/dist/domain/queue-wake-repository.js.map +1 -1
  369. package/daemon/dist/domain/restore-orchestrator.d.ts +26 -1
  370. package/daemon/dist/domain/restore-orchestrator.d.ts.map +1 -1
  371. package/daemon/dist/domain/restore-orchestrator.js +117 -11
  372. package/daemon/dist/domain/restore-orchestrator.js.map +1 -1
  373. package/daemon/dist/domain/resume-metadata-refresher.d.ts +11 -2
  374. package/daemon/dist/domain/resume-metadata-refresher.d.ts.map +1 -1
  375. package/daemon/dist/domain/resume-metadata-refresher.js +32 -14
  376. package/daemon/dist/domain/resume-metadata-refresher.js.map +1 -1
  377. package/daemon/dist/domain/resume-token-capture.d.ts +5 -1
  378. package/daemon/dist/domain/resume-token-capture.d.ts.map +1 -1
  379. package/daemon/dist/domain/resume-token-capture.js +3 -1
  380. package/daemon/dist/domain/resume-token-capture.js.map +1 -1
  381. package/daemon/dist/domain/rig-expansion-service.d.ts.map +1 -1
  382. package/daemon/dist/domain/rig-expansion-service.js +1 -0
  383. package/daemon/dist/domain/rig-expansion-service.js.map +1 -1
  384. package/daemon/dist/domain/rig-repository.d.ts +19 -2
  385. package/daemon/dist/domain/rig-repository.d.ts.map +1 -1
  386. package/daemon/dist/domain/rig-repository.js +247 -2
  387. package/daemon/dist/domain/rig-repository.js.map +1 -1
  388. package/daemon/dist/domain/rig-teardown.d.ts +1 -1
  389. package/daemon/dist/domain/rig-teardown.d.ts.map +1 -1
  390. package/daemon/dist/domain/rig-teardown.js +3 -1
  391. package/daemon/dist/domain/rig-teardown.js.map +1 -1
  392. package/daemon/dist/domain/rigspec-codec.d.ts.map +1 -1
  393. package/daemon/dist/domain/rigspec-codec.js +4 -0
  394. package/daemon/dist/domain/rigspec-codec.js.map +1 -1
  395. package/daemon/dist/domain/rigspec-exporter.d.ts.map +1 -1
  396. package/daemon/dist/domain/rigspec-exporter.js +7 -0
  397. package/daemon/dist/domain/rigspec-exporter.js.map +1 -1
  398. package/daemon/dist/domain/rigspec-instantiator.d.ts +41 -1
  399. package/daemon/dist/domain/rigspec-instantiator.d.ts.map +1 -1
  400. package/daemon/dist/domain/rigspec-instantiator.js +174 -13
  401. package/daemon/dist/domain/rigspec-instantiator.js.map +1 -1
  402. package/daemon/dist/domain/rigspec-schema.d.ts.map +1 -1
  403. package/daemon/dist/domain/rigspec-schema.js +24 -1
  404. package/daemon/dist/domain/rigspec-schema.js.map +1 -1
  405. package/daemon/dist/domain/running-name-guard.d.ts.map +1 -1
  406. package/daemon/dist/domain/running-name-guard.js +2 -1
  407. package/daemon/dist/domain/running-name-guard.js.map +1 -1
  408. package/daemon/dist/domain/runtime-adapter.d.ts +17 -1
  409. package/daemon/dist/domain/runtime-adapter.d.ts.map +1 -1
  410. package/daemon/dist/domain/runtime-adapter.js.map +1 -1
  411. package/daemon/dist/domain/runtime-switch-materials.d.ts +77 -0
  412. package/daemon/dist/domain/runtime-switch-materials.d.ts.map +1 -0
  413. package/daemon/dist/domain/runtime-switch-materials.js +253 -0
  414. package/daemon/dist/domain/runtime-switch-materials.js.map +1 -0
  415. package/daemon/dist/domain/scope/scope-approve.d.ts +1 -1
  416. package/daemon/dist/domain/seat-activity-service.d.ts +4 -0
  417. package/daemon/dist/domain/seat-activity-service.d.ts.map +1 -1
  418. package/daemon/dist/domain/seat-activity-service.js +17 -0
  419. package/daemon/dist/domain/seat-activity-service.js.map +1 -1
  420. package/daemon/dist/domain/seat-attention-reconciler.d.ts +8 -2
  421. package/daemon/dist/domain/seat-attention-reconciler.d.ts.map +1 -1
  422. package/daemon/dist/domain/seat-attention-reconciler.js +31 -2
  423. package/daemon/dist/domain/seat-attention-reconciler.js.map +1 -1
  424. package/daemon/dist/domain/seat-handover-service.js +2 -2
  425. package/daemon/dist/domain/seat-handover-service.js.map +1 -1
  426. package/daemon/dist/domain/seat-launch-environment.d.ts +5 -0
  427. package/daemon/dist/domain/seat-launch-environment.d.ts.map +1 -1
  428. package/daemon/dist/domain/seat-launch-environment.js +8 -4
  429. package/daemon/dist/domain/seat-launch-environment.js.map +1 -1
  430. package/daemon/dist/domain/seat-lifecycle-service.d.ts +19 -3
  431. package/daemon/dist/domain/seat-lifecycle-service.d.ts.map +1 -1
  432. package/daemon/dist/domain/seat-lifecycle-service.js +59 -13
  433. package/daemon/dist/domain/seat-lifecycle-service.js.map +1 -1
  434. package/daemon/dist/domain/seat-restart-in-place.d.ts +9 -2
  435. package/daemon/dist/domain/seat-restart-in-place.d.ts.map +1 -1
  436. package/daemon/dist/domain/seat-restart-in-place.js +27 -7
  437. package/daemon/dist/domain/seat-restart-in-place.js.map +1 -1
  438. package/daemon/dist/domain/seat-runtime-dir.d.ts +17 -0
  439. package/daemon/dist/domain/seat-runtime-dir.d.ts.map +1 -0
  440. package/daemon/dist/domain/seat-runtime-dir.js +27 -0
  441. package/daemon/dist/domain/seat-runtime-dir.js.map +1 -0
  442. package/daemon/dist/domain/seat-runtime-home.d.ts +42 -0
  443. package/daemon/dist/domain/seat-runtime-home.d.ts.map +1 -0
  444. package/daemon/dist/domain/seat-runtime-home.js +89 -0
  445. package/daemon/dist/domain/seat-runtime-home.js.map +1 -0
  446. package/daemon/dist/domain/seat-runtime-switch-service.d.ts +220 -0
  447. package/daemon/dist/domain/seat-runtime-switch-service.d.ts.map +1 -0
  448. package/daemon/dist/domain/seat-runtime-switch-service.js +593 -0
  449. package/daemon/dist/domain/seat-runtime-switch-service.js.map +1 -0
  450. package/daemon/dist/domain/seat-skills-pointer.d.ts +5 -0
  451. package/daemon/dist/domain/seat-skills-pointer.d.ts.map +1 -0
  452. package/daemon/dist/domain/seat-skills-pointer.js +15 -0
  453. package/daemon/dist/domain/seat-skills-pointer.js.map +1 -0
  454. package/daemon/dist/domain/seat-status-service.d.ts +31 -0
  455. package/daemon/dist/domain/seat-status-service.d.ts.map +1 -1
  456. package/daemon/dist/domain/seat-status-service.js +44 -0
  457. package/daemon/dist/domain/seat-status-service.js.map +1 -1
  458. package/daemon/dist/domain/seat-structural-activity-service.d.ts +3 -0
  459. package/daemon/dist/domain/seat-structural-activity-service.d.ts.map +1 -1
  460. package/daemon/dist/domain/seat-structural-activity-service.js +6 -0
  461. package/daemon/dist/domain/seat-structural-activity-service.js.map +1 -1
  462. package/daemon/dist/domain/service-orchestrator.d.ts +7 -0
  463. package/daemon/dist/domain/service-orchestrator.d.ts.map +1 -1
  464. package/daemon/dist/domain/service-orchestrator.js +4 -0
  465. package/daemon/dist/domain/service-orchestrator.js.map +1 -1
  466. package/daemon/dist/domain/session-transport.d.ts +19 -1
  467. package/daemon/dist/domain/session-transport.d.ts.map +1 -1
  468. package/daemon/dist/domain/session-transport.js +227 -47
  469. package/daemon/dist/domain/session-transport.js.map +1 -1
  470. package/daemon/dist/domain/snapshot-capture.d.ts +4 -1
  471. package/daemon/dist/domain/snapshot-capture.d.ts.map +1 -1
  472. package/daemon/dist/domain/snapshot-capture.js +4 -1
  473. package/daemon/dist/domain/snapshot-capture.js.map +1 -1
  474. package/daemon/dist/domain/snapshot-repository.d.ts +4 -3
  475. package/daemon/dist/domain/snapshot-repository.d.ts.map +1 -1
  476. package/daemon/dist/domain/snapshot-repository.js +6 -5
  477. package/daemon/dist/domain/snapshot-repository.js.map +1 -1
  478. package/daemon/dist/domain/startup-orchestrator.d.ts +3 -0
  479. package/daemon/dist/domain/startup-orchestrator.d.ts.map +1 -1
  480. package/daemon/dist/domain/startup-orchestrator.js +58 -16
  481. package/daemon/dist/domain/startup-orchestrator.js.map +1 -1
  482. package/daemon/dist/domain/startup-submission-evidence.d.ts +1 -0
  483. package/daemon/dist/domain/startup-submission-evidence.d.ts.map +1 -1
  484. package/daemon/dist/domain/startup-submission-evidence.js +1 -0
  485. package/daemon/dist/domain/startup-submission-evidence.js.map +1 -1
  486. package/daemon/dist/domain/stream-reader-actions.d.ts +49 -0
  487. package/daemon/dist/domain/stream-reader-actions.d.ts.map +1 -0
  488. package/daemon/dist/domain/stream-reader-actions.js +104 -0
  489. package/daemon/dist/domain/stream-reader-actions.js.map +1 -0
  490. package/daemon/dist/domain/successor-session-launcher.d.ts +35 -1
  491. package/daemon/dist/domain/successor-session-launcher.d.ts.map +1 -1
  492. package/daemon/dist/domain/successor-session-launcher.js +58 -3
  493. package/daemon/dist/domain/successor-session-launcher.js.map +1 -1
  494. package/daemon/dist/domain/terminal/herdr-adapter.d.ts +6 -28
  495. package/daemon/dist/domain/terminal/herdr-adapter.d.ts.map +1 -1
  496. package/daemon/dist/domain/terminal/herdr-adapter.js +16 -66
  497. package/daemon/dist/domain/terminal/herdr-adapter.js.map +1 -1
  498. package/daemon/dist/domain/terminal/rex-adapter.d.ts +42 -0
  499. package/daemon/dist/domain/terminal/rex-adapter.d.ts.map +1 -0
  500. package/daemon/dist/domain/terminal/rex-adapter.js +228 -0
  501. package/daemon/dist/domain/terminal/rex-adapter.js.map +1 -0
  502. package/daemon/dist/domain/terminal/rex-layout.d.ts +26 -0
  503. package/daemon/dist/domain/terminal/rex-layout.d.ts.map +1 -0
  504. package/daemon/dist/domain/terminal/rex-layout.js +21 -0
  505. package/daemon/dist/domain/terminal/rex-layout.js.map +1 -0
  506. package/daemon/dist/domain/terminal/rex-transport.d.ts +43 -0
  507. package/daemon/dist/domain/terminal/rex-transport.d.ts.map +1 -0
  508. package/daemon/dist/domain/terminal/rex-transport.js +176 -0
  509. package/daemon/dist/domain/terminal/rex-transport.js.map +1 -0
  510. package/daemon/dist/domain/terminal/terminal-provider.d.ts +11 -0
  511. package/daemon/dist/domain/terminal/terminal-provider.d.ts.map +1 -1
  512. package/daemon/dist/domain/terminal/terminal-service.d.ts +2 -2
  513. package/daemon/dist/domain/terminal/terminal-service.d.ts.map +1 -1
  514. package/daemon/dist/domain/terminal/terminal-service.js +10 -11
  515. package/daemon/dist/domain/terminal/terminal-service.js.map +1 -1
  516. package/daemon/dist/domain/terminal/tile-attach.d.ts +2 -0
  517. package/daemon/dist/domain/terminal/tile-attach.d.ts.map +1 -0
  518. package/daemon/dist/domain/terminal/tile-attach.js +42 -0
  519. package/daemon/dist/domain/terminal/tile-attach.js.map +1 -0
  520. package/daemon/dist/domain/terminal/tile-layout.d.ts +32 -0
  521. package/daemon/dist/domain/terminal/tile-layout.d.ts.map +1 -0
  522. package/daemon/dist/domain/terminal/tile-layout.js +36 -0
  523. package/daemon/dist/domain/terminal/tile-layout.js.map +1 -0
  524. package/daemon/dist/domain/terminal/view-composer.d.ts.map +1 -1
  525. package/daemon/dist/domain/terminal/view-composer.js +11 -7
  526. package/daemon/dist/domain/terminal/view-composer.js.map +1 -1
  527. package/daemon/dist/domain/types.d.ts +61 -0
  528. package/daemon/dist/domain/types.d.ts.map +1 -1
  529. package/daemon/dist/domain/types.js.map +1 -1
  530. package/daemon/dist/domain/wake-recovery.d.ts +16 -0
  531. package/daemon/dist/domain/wake-recovery.d.ts.map +1 -0
  532. package/daemon/dist/domain/wake-recovery.js +31 -0
  533. package/daemon/dist/domain/wake-recovery.js.map +1 -0
  534. package/daemon/dist/index.d.ts.map +1 -1
  535. package/daemon/dist/index.js +5 -1
  536. package/daemon/dist/index.js.map +1 -1
  537. package/daemon/dist/lib/pane-envelope.d.ts +5 -0
  538. package/daemon/dist/lib/pane-envelope.d.ts.map +1 -1
  539. package/daemon/dist/lib/pane-envelope.js +8 -1
  540. package/daemon/dist/lib/pane-envelope.js.map +1 -1
  541. package/daemon/dist/routes/activity.d.ts.map +1 -1
  542. package/daemon/dist/routes/activity.js +12 -0
  543. package/daemon/dist/routes/activity.js.map +1 -1
  544. package/daemon/dist/routes/agent-images.d.ts.map +1 -1
  545. package/daemon/dist/routes/agent-images.js +9 -0
  546. package/daemon/dist/routes/agent-images.js.map +1 -1
  547. package/daemon/dist/routes/context-packs.d.ts.map +1 -1
  548. package/daemon/dist/routes/context-packs.js +22 -0
  549. package/daemon/dist/routes/context-packs.js.map +1 -1
  550. package/daemon/dist/routes/mission-control.js +2 -2
  551. package/daemon/dist/routes/mission-control.js.map +1 -1
  552. package/daemon/dist/routes/provider.d.ts.map +1 -1
  553. package/daemon/dist/routes/provider.js +83 -3
  554. package/daemon/dist/routes/provider.js.map +1 -1
  555. package/daemon/dist/routes/queue.d.ts.map +1 -1
  556. package/daemon/dist/routes/queue.js +102 -10
  557. package/daemon/dist/routes/queue.js.map +1 -1
  558. package/daemon/dist/routes/require-sender-identity.d.ts +10 -8
  559. package/daemon/dist/routes/require-sender-identity.d.ts.map +1 -1
  560. package/daemon/dist/routes/require-sender-identity.js +13 -11
  561. package/daemon/dist/routes/require-sender-identity.js.map +1 -1
  562. package/daemon/dist/routes/rigs.js +2 -0
  563. package/daemon/dist/routes/rigs.js.map +1 -1
  564. package/daemon/dist/routes/runtime-switch-custody.d.ts +21 -0
  565. package/daemon/dist/routes/runtime-switch-custody.d.ts.map +1 -0
  566. package/daemon/dist/routes/runtime-switch-custody.js +55 -0
  567. package/daemon/dist/routes/runtime-switch-custody.js.map +1 -0
  568. package/daemon/dist/routes/scope-approve.js +2 -2
  569. package/daemon/dist/routes/scope-approve.js.map +1 -1
  570. package/daemon/dist/routes/seat.d.ts.map +1 -1
  571. package/daemon/dist/routes/seat.js +90 -7
  572. package/daemon/dist/routes/seat.js.map +1 -1
  573. package/daemon/dist/routes/sessions.d.ts.map +1 -1
  574. package/daemon/dist/routes/sessions.js +9 -0
  575. package/daemon/dist/routes/sessions.js.map +1 -1
  576. package/daemon/dist/routes/startup.js +15 -5
  577. package/daemon/dist/routes/startup.js.map +1 -1
  578. package/daemon/dist/routes/stream.d.ts.map +1 -1
  579. package/daemon/dist/routes/stream.js +25 -2
  580. package/daemon/dist/routes/stream.js.map +1 -1
  581. package/daemon/dist/routes/transport.d.ts.map +1 -1
  582. package/daemon/dist/routes/transport.js +31 -3
  583. package/daemon/dist/routes/transport.js.map +1 -1
  584. package/daemon/dist/seat-recap-store-surface.d.ts +1 -1
  585. package/daemon/dist/seat-recap-store-surface.d.ts.map +1 -1
  586. package/daemon/dist/seat-recap-store-surface.js +1 -1
  587. package/daemon/dist/seat-recap-store-surface.js.map +1 -1
  588. package/daemon/dist/server.d.ts +2 -0
  589. package/daemon/dist/server.d.ts.map +1 -1
  590. package/daemon/dist/server.js +1 -0
  591. package/daemon/dist/server.js.map +1 -1
  592. package/daemon/dist/startup.d.ts +5 -0
  593. package/daemon/dist/startup.d.ts.map +1 -1
  594. package/daemon/dist/startup.js +106 -28
  595. package/daemon/dist/startup.js.map +1 -1
  596. package/daemon/dist/terminal/TerminalSessionBroker.d.ts.map +1 -1
  597. package/daemon/dist/terminal/TerminalSessionBroker.js +5 -0
  598. package/daemon/dist/terminal/TerminalSessionBroker.js.map +1 -1
  599. package/daemon/docs/reference/community-harness-examples/cursor/cursor.yaml +2 -2
  600. package/daemon/docs/reference/community-harness-examples/cursor/openrig-cursor-launch +7 -0
  601. package/daemon/docs/reference/community-harness-examples/openclaw/openclaw-gateway.yaml +15 -0
  602. package/daemon/docs/reference/community-harness-examples/openclaw/openclaw.yaml +5 -2
  603. package/daemon/docs/reference/community-harness-examples/openclaw/openrig-openclaw-launch +56 -24
  604. package/daemon/docs/reference/community-harness-presets.md +33 -18
  605. package/daemon/docs/reference/getting-started.md +82 -10
  606. package/daemon/docs/reference/health-diagnosis.md +13 -0
  607. package/daemon/docs/reference/help.md +6 -0
  608. package/daemon/docs/reference/keeping-a-watch.md +21 -0
  609. package/daemon/docs/reference/project-workspace.md +18 -0
  610. package/daemon/docs/reference/publishing-a-rig-bundle.md +11 -0
  611. package/daemon/docs/reference/quickstart.md +1 -1
  612. package/daemon/docs/reference/rig-spec.md +93 -3
  613. package/daemon/docs/reference/sdlc-conventions.md +3 -1
  614. package/daemon/docs/reference/seat-delivery.md +16 -5
  615. package/daemon/docs/reference/slack-app-setup.md +1 -1
  616. package/daemon/docs/reference/terminal-sessions.md +51 -0
  617. package/daemon/docs/reference/whats-new.md +262 -149
  618. package/daemon/specs/agents/shared/skills/core/openrig-herdr/SKILL.md +17 -5
  619. package/daemon/specs/agents/shared/skills/process/agent-browser/LICENSE.txt +201 -0
  620. package/daemon/specs/agents/shared/skills/process/agent-browser/OPENRIG.md +13 -29
  621. package/daemon/specs/agents/shared/skills/process/agent-browser/SKILL.md +7 -7
  622. package/daemon/specs/agents/shared/skills/process/dogfood/LICENSE.txt +201 -0
  623. package/daemon/specs/agents/shared/skills/process/dogfood/SKILL.md +6 -2
  624. package/daemon/specs/agents/shared/skills/process/systematic-debugging/LICENSE.txt +21 -0
  625. package/daemon/specs/agents/shared/skills/process/systematic-debugging/SKILL.md +6 -2
  626. package/daemon/specs/agents/shared/skills/process/test-driven-development/LICENSE.txt +21 -0
  627. package/daemon/specs/agents/shared/skills/process/test-driven-development/SKILL.md +5 -1
  628. package/daemon/specs/agents/shared/skills/process/verification-before-completion/LICENSE.txt +21 -0
  629. package/daemon/specs/agents/shared/skills/process/verification-before-completion/SKILL.md +5 -1
  630. package/daemon/specs/rigs/launch/kernel/agents/operator/agent/guidance/role.md +18 -1
  631. package/daemon/specs/rigs/launch/kernel/agents/operator/agent/startup/context.md +3 -0
  632. package/daemon/specs/rigs/launch/kernel/agents/queue/worker/guidance/role.md +3 -2
  633. package/dist/build-info.js +3 -3
  634. package/dist/client.d.ts +8 -0
  635. package/dist/client.d.ts.map +1 -1
  636. package/dist/client.js +16 -1
  637. package/dist/client.js.map +1 -1
  638. package/dist/commands/auth.d.ts.map +1 -1
  639. package/dist/commands/auth.js +2 -1
  640. package/dist/commands/auth.js.map +1 -1
  641. package/dist/commands/capture.d.ts.map +1 -1
  642. package/dist/commands/capture.js +8 -0
  643. package/dist/commands/capture.js.map +1 -1
  644. package/dist/commands/chatroom.d.ts.map +1 -1
  645. package/dist/commands/chatroom.js +6 -0
  646. package/dist/commands/chatroom.js.map +1 -1
  647. package/dist/commands/context.d.ts.map +1 -1
  648. package/dist/commands/context.js +29 -23
  649. package/dist/commands/context.js.map +1 -1
  650. package/dist/commands/down.d.ts.map +1 -1
  651. package/dist/commands/down.js +6 -2
  652. package/dist/commands/down.js.map +1 -1
  653. package/dist/commands/env.d.ts.map +1 -1
  654. package/dist/commands/env.js +3 -0
  655. package/dist/commands/env.js.map +1 -1
  656. package/dist/commands/export.d.ts.map +1 -1
  657. package/dist/commands/export.js +47 -0
  658. package/dist/commands/export.js.map +1 -1
  659. package/dist/commands/health.js +1 -1
  660. package/dist/commands/health.js.map +1 -1
  661. package/dist/commands/launch.js +1 -1
  662. package/dist/commands/launch.js.map +1 -1
  663. package/dist/commands/project.d.ts.map +1 -1
  664. package/dist/commands/project.js +6 -1
  665. package/dist/commands/project.js.map +1 -1
  666. package/dist/commands/proof.d.ts.map +1 -1
  667. package/dist/commands/proof.js +33 -2
  668. package/dist/commands/proof.js.map +1 -1
  669. package/dist/commands/provider.d.ts.map +1 -1
  670. package/dist/commands/provider.js +172 -24
  671. package/dist/commands/provider.js.map +1 -1
  672. package/dist/commands/queue.d.ts.map +1 -1
  673. package/dist/commands/queue.js +154 -30
  674. package/dist/commands/queue.js.map +1 -1
  675. package/dist/commands/scope.d.ts.map +1 -1
  676. package/dist/commands/scope.js +5 -2
  677. package/dist/commands/scope.js.map +1 -1
  678. package/dist/commands/seat.d.ts.map +1 -1
  679. package/dist/commands/seat.js +212 -5
  680. package/dist/commands/seat.js.map +1 -1
  681. package/dist/commands/skill.d.ts.map +1 -1
  682. package/dist/commands/skill.js +21 -0
  683. package/dist/commands/skill.js.map +1 -1
  684. package/dist/commands/stream-outcome.d.ts +586 -1
  685. package/dist/commands/stream-outcome.d.ts.map +1 -1
  686. package/dist/commands/stream-outcome.js +38 -1
  687. package/dist/commands/stream-outcome.js.map +1 -1
  688. package/dist/commands/stream.d.ts.map +1 -1
  689. package/dist/commands/stream.js +22 -0
  690. package/dist/commands/stream.js.map +1 -1
  691. package/dist/commands/terminal.d.ts +4 -0
  692. package/dist/commands/terminal.d.ts.map +1 -1
  693. package/dist/commands/terminal.js +7 -5
  694. package/dist/commands/terminal.js.map +1 -1
  695. package/dist/commands/up.d.ts.map +1 -1
  696. package/dist/commands/up.js +7 -1
  697. package/dist/commands/up.js.map +1 -1
  698. package/dist/lib/codex-auth.d.ts +1 -147
  699. package/dist/lib/codex-auth.d.ts.map +1 -1
  700. package/dist/lib/codex-auth.js +2 -505
  701. package/dist/lib/codex-auth.js.map +1 -1
  702. package/dist/mcp-server.d.ts.map +1 -1
  703. package/dist/mcp-server.js +52 -1
  704. package/dist/mcp-server.js.map +1 -1
  705. package/dist/terminal-window-rex.d.ts +6 -0
  706. package/dist/terminal-window-rex.d.ts.map +1 -0
  707. package/dist/terminal-window-rex.js +129 -0
  708. package/dist/terminal-window-rex.js.map +1 -0
  709. package/dist/terminal-window.d.ts +2 -0
  710. package/dist/terminal-window.d.ts.map +1 -1
  711. package/dist/terminal-window.js +19 -7
  712. package/dist/terminal-window.js.map +1 -1
  713. package/package.json +1 -1
  714. package/tui/dist/commands/registry.js +1 -1
  715. package/tui/dist/commands/registry.js.map +1 -1
  716. package/tui/dist/daemon-client.d.ts +4 -3
  717. package/tui/dist/daemon-client.d.ts.map +1 -1
  718. package/tui/dist/daemon-client.js +5 -4
  719. package/tui/dist/daemon-client.js.map +1 -1
  720. package/tui/dist/hydrate.d.ts.map +1 -1
  721. package/tui/dist/hydrate.js +4 -1
  722. package/tui/dist/hydrate.js.map +1 -1
  723. package/tui/dist/live.d.ts.map +1 -1
  724. package/tui/dist/live.js +6 -4
  725. package/tui/dist/live.js.map +1 -1
  726. package/tui/dist/terminals/open-window.d.ts +9 -5
  727. package/tui/dist/terminals/open-window.d.ts.map +1 -1
  728. package/tui/dist/terminals/open-window.js +29 -12
  729. package/tui/dist/terminals/open-window.js.map +1 -1
  730. package/tui/dist/terminals/terminal-model.d.ts +2 -1
  731. package/tui/dist/terminals/terminal-model.d.ts.map +1 -1
  732. package/tui/dist/terminals/terminal-model.js +5 -4
  733. package/tui/dist/terminals/terminal-model.js.map +1 -1
  734. package/tui/dist/usage/usage-model.d.ts.map +1 -1
  735. package/tui/dist/usage/usage-model.js +5 -3
  736. package/tui/dist/usage/usage-model.js.map +1 -1
  737. package/ui/dist/assets/{index-Blg-p32B.js → index-DLP1ipGq.js} +1 -1
  738. package/ui/dist/index.html +1 -1
@@ -33,7 +33,7 @@ const defaultCodexCli = (args, env) => new Promise((resolve) => {
33
33
  });
34
34
  // Codex's hook trust recipe (the key and hash Codex records for a trusted hook), kept in one script.
35
35
  const codexHookTrust = createRequire(import.meta.url)("../../assets/plugins/openrig-core/hooks/scripts/codex-hook-trust.cjs");
36
- import { listNativeProcesses, observeCodexPaneProcess, observeCodexForkProcess, verifyPaneIdleShell } from "../domain/native-process-lineage.js";
36
+ import { listNativeProcesses, observeCodexPaneProcess, observeCodexForkProcess, verifyCodexPaneProcess, verifyPaneIdleShell } from "../domain/native-process-lineage.js";
37
37
  import { recordSeatSkillWrite, seatPluginSkillsLossNote, seatProjectionComplete, seatSkillWriteRefusal } from "../domain/seat-skill-storage.js";
38
38
  import { codexPluginContentHash, planOwnedCodexContentApproval, recordOwnedCodexApproval } from "../domain/codex-owned-plugin-trust.js";
39
39
  // The managed resume check's poll window: a quick phase, then an extended one for a slow boot.
@@ -58,6 +58,10 @@ export class CodexRuntimeAdapter {
58
58
  sleep;
59
59
  resolveHomeDirByPid;
60
60
  codexHome;
61
+ /** A seat's own CODEX_HOME from its member or rig `env:`, when it declares one. */
62
+ seatHome;
63
+ /** One thread-id resolver per Codex home its seats use, the daemon's included. */
64
+ threadResolvers = new Map();
61
65
  launchPath;
62
66
  // Housekeeping B1 fixback (guard-blocking, arch HK-AR-1 = whole-probe DI):
63
67
  // the Codex profile-LOAD probe is an injectable dep in the adapter's
@@ -72,9 +76,11 @@ export class CodexRuntimeAdapter {
72
76
  // #275: Codex's own answer on whether the plain floor may get network access. Startup wires the
73
77
  // real reader; absent keeps every invocation unchanged.
74
78
  readNetworkDefault;
75
- // Issue #121: git metadata dirs for the fresh-launch `--add-dir`s (a linked worktree's `.git` is a file).
79
+ // Issue #121: git metadata dirs for the `--add-dir`s of fresh, resume and fork (a linked worktree's `.git` is a file).
76
80
  // Default = the real resolver; tests may inject a controlled one.
77
81
  resolveGitAddDirs;
82
+ // The seat's own topology folder for the `--add-dir`s of fresh, resume and fork. Absent: none is added.
83
+ prepareSeatFolder;
78
84
  prepareTeamWorkspace;
79
85
  resolveManagedConfigSettings;
80
86
  resolveHooksEnabled;
@@ -102,9 +108,11 @@ export class CodexRuntimeAdapter {
102
108
  this.resolveManagedConfigSettings = deps.resolveManagedConfigSettings;
103
109
  this.resolveHooksEnabled = deps.resolveHooksEnabled;
104
110
  this.prepareTeamWorkspace = deps.prepareTeamWorkspace;
111
+ this.prepareSeatFolder = deps.prepareSeatFolder;
105
112
  this.seatLaunchEnvironment = deps.seatLaunchEnvironment;
106
113
  this.fs = deps.fsOps;
107
114
  this.codexHome = deps.codexHome;
115
+ this.seatHome = deps.seatHome;
108
116
  this.launchPath = deps.launchPath;
109
117
  this.detectDaemonSupport = deps.detectDaemonSupport;
110
118
  this.readNetworkDefault = deps.readNetworkDefault;
@@ -112,28 +120,63 @@ export class CodexRuntimeAdapter {
112
120
  this.activityRelayPath = deps.activityRelayPath;
113
121
  this.listProcesses = deps.listProcesses ?? defaultListProcesses;
114
122
  this.resolveHomeDirByPid = deps.resolveHomeDirByPid ?? defaultResolveHomeDirByPid;
115
- const threadIdResolver = new CodexThreadIdResolver({
116
- defaultHome: this.fs.homedir ?? os.homedir(), codexHome: this.codexHome,
117
- resolveHomeDirByPid: this.resolveHomeDirByPid,
118
- });
119
- this.readThreadIdByPid = deps.readThreadIdByPid ?? ((pid, identity) => identity === undefined
120
- ? this.readThreadIdFromLogs(pid) : threadIdResolver.resolveForkChild(pid, identity));
123
+ // A seat with its own CODEX_HOME logs its threads there, so each read names the home it searches.
124
+ this.readThreadIdByPid = deps.readThreadIdByPid ?? ((pid, identity, home) => identity === undefined
125
+ ? this.readThreadIdFromLogs(pid, home) : this.threadResolverFor(home).resolveForkChild(pid, identity));
121
126
  // A just-launched resume may log only inside its start second, so this reads like a fork child's ("by-process").
122
127
  this.readResumeEvidence = deps.readResumeEvidence ?? (deps.readThreadIdByPid
123
- ? async (pid, identity) => {
124
- const threadId = (await deps.readThreadIdByPid(pid, identity))?.trim();
128
+ ? async (pid, identity, home) => {
129
+ const threadId = (await deps.readThreadIdByPid(pid, identity, home))?.trim();
125
130
  return threadId ? { threadId } : { reason: "no_log_row" };
126
131
  }
127
- : async (pid, identity) => {
132
+ : async (pid, identity, home) => {
128
133
  let reason;
129
- const threadId = (await threadIdResolver.resolveForkChild(pid, identity, (d) => { reason = d.reason; }))?.trim();
134
+ const threadId = (await this.threadResolverFor(home).resolveForkChild(pid, identity, (d) => { reason = d.reason; }))?.trim();
130
135
  return threadId ? { threadId } : { reason: reason ?? "no_log_row" };
131
136
  });
132
137
  this.resumeProofWindowMs = deps.resumeProofWindowMs ?? RESUME_QUICK_ATTEMPTS * RESUME_QUICK_SLEEP_MS + RESUME_EXTENDED_ATTEMPTS * RESUME_EXTENDED_SLEEP_MS;
133
138
  this.readinessSettings = deps.readinessSettings;
134
139
  this.sleep = deps.sleep ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
135
- this.verifyProfilePreflight = deps.verifyProfilePreflight
136
- ?? ((profile, cwd) => defaultProfilePreflight(profile, this.codexHome ? { cwd, codexHome: this.codexHome, launchPath: this.launchPath } : undefined));
140
+ this.verifyProfilePreflight = deps.verifyProfilePreflight ?? ((profile, cwd, home) => {
141
+ const selected = home ?? this.codexHome;
142
+ return defaultProfilePreflight(profile, selected ? { cwd, codexHome: selected, launchPath: this.launchPath } : undefined);
143
+ });
144
+ }
145
+ /** The home a seat's Codex uses: its own from its member or rig `env:`, else the daemon's explicit CODEX_HOME. Undefined
146
+ * keeps the legacy OS/PID home behavior. */
147
+ homeFor(binding) {
148
+ return this.ownHome(binding) ?? this.codexHome;
149
+ }
150
+ /** Only the seat's own CODEX_HOME, undefined when it declares none. Probes and readers get it as an extra argument
151
+ * only when it's set, so a seat without one calls them exactly as before. */
152
+ ownHome(binding) {
153
+ return binding?.nodeId ? this.seatHome?.(binding.nodeId) : undefined;
154
+ }
155
+ ownHomeCommandOpt(binding) {
156
+ const own = this.ownHome(binding);
157
+ return own ? { codexHome: own } : {};
158
+ }
159
+ ownHomeOpt(binding) {
160
+ const own = this.ownHome(binding);
161
+ return own ? { home: own } : {};
162
+ }
163
+ /** A thread id read for this seat's process, in the seat's own home when it declares one. */
164
+ readThreadIdForSeat(binding, pid, identity) {
165
+ const own = this.ownHome(binding);
166
+ if (own)
167
+ return this.readThreadIdByPid(pid, identity, own);
168
+ return identity === undefined ? this.readThreadIdByPid(pid) : this.readThreadIdByPid(pid, identity);
169
+ }
170
+ /** The thread-id resolver for one Codex home (undefined: the daemon's), kept so its process-home cache is reused. */
171
+ threadResolverFor(home) {
172
+ const selected = home ?? this.codexHome;
173
+ let resolver = this.threadResolvers.get(selected ?? "");
174
+ if (!resolver) {
175
+ resolver = new CodexThreadIdResolver({ defaultHome: this.fs.homedir ?? os.homedir(), codexHome: selected,
176
+ resolveHomeDirByPid: this.resolveHomeDirByPid });
177
+ this.threadResolvers.set(selected ?? "", resolver);
178
+ }
179
+ return resolver;
137
180
  }
138
181
  /**
139
182
  * Bring the Codex config.toml to the state OpenRig-managed seats need: feature flag,
@@ -142,8 +185,8 @@ export class CodexRuntimeAdapter {
142
185
  * them: a rig with no Codex seat leaves the user's config alone. A failure warns and does
143
186
  * not block the launch.
144
187
  */
145
- async ensureManagedConfig() {
146
- return this.withConfigLock(() => this.applyManagedConfig());
188
+ async ensureManagedConfig(home) {
189
+ return this.withConfigLock(() => this.applyManagedConfig(home));
147
190
  }
148
191
  /** Run `task` after every earlier config setup on this adapter has finished, whatever its outcome. */
149
192
  withConfigLock(task) {
@@ -151,16 +194,16 @@ export class CodexRuntimeAdapter {
151
194
  this.configLock = run.catch(() => undefined);
152
195
  return run;
153
196
  }
154
- async applyManagedConfig() {
197
+ async applyManagedConfig(home) {
155
198
  if (!this.resolveManagedConfigSettings)
156
199
  return undefined;
157
200
  try {
158
201
  const { enabled, codexVersion } = await this.resolveManagedConfigSettings();
159
- this.ensureCodexFeatureFlag(enabled, { codexVersion });
202
+ this.ensureCodexFeatureFlag(enabled, { codexVersion }, home);
160
203
  if (enabled)
161
- this.ensureCodexActivityHooks();
204
+ this.ensureCodexActivityHooks(home);
162
205
  else
163
- this.removeCodexActivityHooks();
206
+ this.removeCodexActivityHooks(home);
164
207
  return { hooksEnabled: enabled };
165
208
  }
166
209
  catch (err) {
@@ -192,7 +235,7 @@ export class CodexRuntimeAdapter {
192
235
  * doesn't disable the plugin (codexCorePluginEnablement), and only when the installed version differs from the vendored
193
236
  * one. Codex owns its plugin cache; its immutable legacy trust baseline is never rewritten.
194
237
  */
195
- async ensureCodexCorePlugin() {
238
+ async ensureCodexCorePlugin(home) {
196
239
  const report = (outcome, reason) => {
197
240
  if (outcome !== "current")
198
241
  console.error(`[openrig] codex core plugin ${outcome}: ${reason}`);
@@ -242,7 +285,7 @@ export class CodexRuntimeAdapter {
242
285
  return false;
243
286
  }
244
287
  };
245
- const codexHome = nodePath.dirname(this.resolveCodexConfigPath());
288
+ const codexHome = nodePath.dirname(this.resolveCodexConfigPath(home));
246
289
  const readLayers = () => codexReadableConfigLayers(codexHome, this.codexSystemConfigDir).map((layer) => {
247
290
  if (!this.fs.exists(layer.path))
248
291
  return { ...layer, state: "absent" };
@@ -283,7 +326,7 @@ export class CodexRuntimeAdapter {
283
326
  const firstInstall = !this.fs.exists(cacheRoot) && !layers.some(layer => layer.state === "read"
284
327
  && Object.hasOwn((parseToml(layer.content).plugins ?? {}), CODEX_CORE_PLUGIN_KEY));
285
328
  const renewContentApproval = (freshGrant = false) => {
286
- const configPath = this.resolveCodexConfigPath();
329
+ const configPath = this.resolveCodexConfigPath(home);
287
330
  const currentLayers = readLayers();
288
331
  if (codexCorePluginEnablement(currentLayers).decision !== "allow")
289
332
  return;
@@ -338,7 +381,7 @@ export class CodexRuntimeAdapter {
338
381
  let freshGrants = 0;
339
382
  const grantLayers = readLayers();
340
383
  if (firstInstall && codexCorePluginEnablement(grantLayers).decision === "allow" && matchesShippedTree(cachedDir)) {
341
- let content = this.fs.readFile(this.resolveCodexConfigPath());
384
+ let content = this.fs.readFile(this.resolveCodexConfigPath(home));
342
385
  const hookManifest = JSON.parse(fs.readFileSync(nodePath.join(shipped, "hooks/codex.json"), "utf8"));
343
386
  for (const [event, groups] of Object.entries(hookManifest.hooks)) {
344
387
  groups.forEach((group, groupIndex) => group.hooks.forEach((handler, handlerIndex) => {
@@ -359,7 +402,7 @@ export class CodexRuntimeAdapter {
359
402
  }
360
403
  }));
361
404
  }
362
- this.fs.writeFile(this.resolveCodexConfigPath(), content);
405
+ this.fs.writeFile(this.resolveCodexConfigPath(home), content);
363
406
  }
364
407
  renewContentApproval(freshGrants === 6);
365
408
  return report("installed", `${CODEX_CORE_PLUGIN_KEY} ${version} through Codex's own install (${enablement.reason})`);
@@ -394,14 +437,14 @@ export class CodexRuntimeAdapter {
394
437
  * that lived inside the auto-injected activity-hook provisioning path
395
438
  * pre-rip (plugin-primitive Phase 3a slice 3.1).
396
439
  */
397
- ensureCodexFeatureFlag(enabled, opts) {
440
+ ensureCodexFeatureFlag(enabled, opts, home) {
398
441
  if (!enabled)
399
442
  return;
400
443
  if (!opts?.codexVersion)
401
444
  return;
402
445
  if (isCodex013xOrLater(opts.codexVersion))
403
446
  return;
404
- const configPath = this.resolveCodexConfigPath();
447
+ const configPath = this.resolveCodexConfigPath(home);
405
448
  const existing = this.fs.exists(configPath) ? this.fs.readFile(configPath) : "";
406
449
  const updated = upsertCodexHooksFeature(existing);
407
450
  if (updated !== existing) {
@@ -430,7 +473,7 @@ export class CodexRuntimeAdapter {
430
473
  * codex TUI launch lacks that context and may not deliver SessionStart — not how OpenRig
431
474
  * launches seats.)
432
475
  */
433
- ensureCodexActivityHooks() {
476
+ ensureCodexActivityHooks(home) {
434
477
  const relay = this.activityRelayPath;
435
478
  if (!relay || !this.fs.exists(relay)) {
436
479
  if (relay) {
@@ -438,8 +481,15 @@ export class CodexRuntimeAdapter {
438
481
  }
439
482
  return;
440
483
  }
441
- const configPath = this.resolveCodexConfigPath();
484
+ const configPath = this.resolveCodexConfigPath(home);
442
485
  const existing = this.fs.exists(configPath) ? this.fs.readFile(configPath) : "";
486
+ // A Codex home that keeps its hooks in hooks.json gets OpenRig's there too: Codex warns when one layer mixes both
487
+ // formats. Without a hooks.json, the inline config.toml block below is unchanged.
488
+ const hooksPath = nodePath.join(nodePath.dirname(configPath), "hooks.json");
489
+ if (this.fs.exists(hooksPath)) {
490
+ this.ensureCodexJsonActivityHooks(existing, configPath, hooksPath, relay);
491
+ return;
492
+ }
443
493
  const withHooks = upsertCodexActivityHooks(existing, relay);
444
494
  if (withHooks !== existing) {
445
495
  this.fs.mkdirp(nodePath.dirname(configPath));
@@ -458,6 +508,75 @@ export class CodexRuntimeAdapter {
458
508
  this.fs.writeFile(configPath, trusted);
459
509
  }
460
510
  }
511
+ /**
512
+ * OpenRig's activity hooks in an existing hooks.json: one marked group per event (statusMessage "OpenRig activity"),
513
+ * replaced where it already is or appended after the user's groups, so their positions (and the trust Codex keys by
514
+ * position) don't move. OpenRig's own inline block from an earlier launch moves out of config.toml; the user's hooks,
515
+ * in either file, stay where they are. Trust is written for exactly our groups, keyed by the hooks.json path. A file
516
+ * OpenRig can't read as hooks is left untouched, with a warning.
517
+ */
518
+ ensureCodexJsonActivityHooks(existing, configPath, hooksPath, relay) {
519
+ const original = this.fs.readFile(hooksPath);
520
+ let document;
521
+ try {
522
+ document = parseCodexHooksJson(original);
523
+ }
524
+ catch (err) {
525
+ console.error(`[openrig] codex activity hooks skipped: ${hooksPath} can't be read as hooks (${err.message}); left untouched`);
526
+ return;
527
+ }
528
+ const command = `node "${relay}"`;
529
+ const keySource = canonicalCodexHookSource(hooksPath);
530
+ const stripped = upsertCodexFeaturesHooksEnabled(stripCodexActivityHooks(existing));
531
+ let before = null;
532
+ let expected = null;
533
+ try {
534
+ before = parseToml(existing);
535
+ expected = parseToml(stripped);
536
+ }
537
+ catch (err) {
538
+ console.error(`[openrig] codex activity hooks skipped: ${configPath} can't be read as TOML (${err.message}); left untouched`);
539
+ return;
540
+ }
541
+ if (!expected)
542
+ return;
543
+ const inlineSource = canonicalCodexHookSource(configPath);
544
+ let config = stripped;
545
+ for (const event of OPENRIG_ACTIVITY_HOOK_EVENTS) {
546
+ const groups = document.hooks[event] ?? [];
547
+ const found = groups.findIndex(isOpenRigActivityGroup);
548
+ const groupIndex = found < 0 ? groups.length : found;
549
+ groups[groupIndex] = openRigActivityGroup(command);
550
+ document.hooks[event] = groups;
551
+ const { key, hash } = computeCodexHookTrust(event, { keySource, command, timeoutSec: 5, groupIndex, statusMessage: OPENRIG_ACTIVITY_STATUS });
552
+ config = upsertCodexHookTrust(config, key, hash);
553
+ // A person's disable of OpenRig's inline hook moves with it; an existing choice at the new key is kept as it is.
554
+ const inlineIndex = openRigInlineGroupIndex(before, event);
555
+ const disabled = inlineIndex >= 0
556
+ && codexHookStateOf(before)[`${inlineSource}:${CODEX_HOOK_EVENT_KEY_LABEL[event]}:${inlineIndex}:0`]?.enabled === false;
557
+ if (disabled)
558
+ config = upsertCodexHookDisabled(config, key);
559
+ const state = ((expected.hooks ??= {}).state ??= {});
560
+ state[key] = { ...state[key], trusted_hash: hash, ...(disabled ? { enabled: false } : {}) };
561
+ }
562
+ // The line writers must give exactly the planned fields in valid TOML (they don't read every TOML spelling);
563
+ // otherwise neither file changes, and OpenRig's old inline block, if any, stays working.
564
+ try {
565
+ if (!isDeepStrictEqual(parseToml(config), expected))
566
+ throw new Error("its trust records couldn't be written exactly");
567
+ }
568
+ catch (err) {
569
+ console.error(`[openrig] codex activity hooks skipped: ${configPath}: ${err.message}; left untouched`);
570
+ return;
571
+ }
572
+ const json = `${JSON.stringify(document, null, 2)}\n`;
573
+ if (json !== original)
574
+ this.fs.writeFile(hooksPath, json);
575
+ if (config !== existing) {
576
+ this.fs.mkdirp(nodePath.dirname(configPath));
577
+ this.fs.writeFile(configPath, config);
578
+ }
579
+ }
461
580
  /**
462
581
  * OPR.0.4.3.33 — compute + splice Codex's `[hooks.state."<key>"] trusted_hash` for our 4
463
582
  * authored activity hooks into `content`. `key_source` is the canonicalized config path
@@ -478,9 +597,15 @@ export class CodexRuntimeAdapter {
478
597
  // absolute path is the honest best guess; a canonicalization delta is fail-safe (gate reappears).
479
598
  }
480
599
  const command = `node "${relay}"`;
600
+ // upsertCodexActivityHooks has just written our marked block. Codex keys by the
601
+ // group's position among this event's groups, not its position inside our block.
602
+ // Count only the groups before the marker: a person's groups after it do not
603
+ // move ours, and their trust/disable records must not be written as ours.
604
+ const prefix = parseToml(content.slice(0, content.indexOf(OPENRIG_ACTIVITY_HOOKS_BEGIN)));
481
605
  let next = content;
482
606
  for (const event of OPENRIG_ACTIVITY_HOOK_EVENTS) {
483
- const { key, hash } = computeCodexHookTrust(event, { keySource, command, timeoutSec: 5 });
607
+ const groupIndex = prefix.hooks?.[event]?.length ?? 0;
608
+ const { key, hash } = computeCodexHookTrust(event, { keySource, command, timeoutSec: 5, groupIndex });
484
609
  next = upsertCodexHookTrust(next, key, hash);
485
610
  }
486
611
  return next;
@@ -492,13 +617,50 @@ export class CodexRuntimeAdapter {
492
617
  * Removes ONLY the managed block — preserves any user-owned hooks and leaves [features].hooks
493
618
  * (the Codex 0.139 default) intact. Idempotent; no-op when the config or the block is absent.
494
619
  */
495
- removeCodexActivityHooks() {
496
- const configPath = this.resolveCodexConfigPath();
497
- if (!this.fs.exists(configPath))
498
- return;
499
- const existing = this.fs.readFile(configPath);
500
- const updated = stripCodexActivityHooks(existing);
501
- if (updated !== existing) {
620
+ removeCodexActivityHooks(home) {
621
+ const configPath = this.resolveCodexConfigPath(home);
622
+ const hooksPath = nodePath.join(nodePath.dirname(configPath), "hooks.json");
623
+ const existing = this.fs.exists(configPath) ? this.fs.readFile(configPath) : null;
624
+ let updated = existing === null ? null : stripCodexActivityHooks(existing);
625
+ if (this.fs.exists(hooksPath)) {
626
+ // Only OpenRig's groups leave. Codex keys trust and disables by position, so each later group's state moves with it.
627
+ try {
628
+ const original = this.fs.readFile(hooksPath);
629
+ const document = parseCodexHooksJson(original);
630
+ const keySource = canonicalCodexHookSource(hooksPath);
631
+ let config = updated ?? "";
632
+ const expected = parseToml(config);
633
+ for (const event of OPENRIG_ACTIVITY_HOOK_EVENTS) {
634
+ const groups = document.hooks[event];
635
+ if (!groups)
636
+ continue;
637
+ const kept = groups.flatMap((group, index) => isOpenRigActivityGroup(group) ? [] : [index]);
638
+ if (kept.length === groups.length)
639
+ continue;
640
+ const prefix = `${keySource}:${CODEX_HOOK_EVENT_KEY_LABEL[event]}:`;
641
+ const newIndexOf = (index) => { const at = kept.indexOf(index); return at < 0 ? null : at; };
642
+ config = rekeyCodexHookStateText(config, prefix, newIndexOf);
643
+ if (expected.hooks?.state)
644
+ expected.hooks.state = rekeyCodexHookState(expected.hooks.state, prefix, newIndexOf);
645
+ if (kept.length > 0)
646
+ document.hooks[event] = kept.map((index) => groups[index]);
647
+ else
648
+ delete document.hooks[event];
649
+ }
650
+ if (!isDeepStrictEqual(withoutEmptyHookTables(parseToml(config)), withoutEmptyHookTables(expected))) {
651
+ throw new Error("its hooks' trust records couldn't be moved exactly");
652
+ }
653
+ const json = `${JSON.stringify(document, null, 2)}\n`;
654
+ if (json !== original)
655
+ this.fs.writeFile(hooksPath, json);
656
+ if (updated !== null)
657
+ updated = config;
658
+ }
659
+ catch (err) {
660
+ console.error(`[openrig] codex activity hook removal skipped for ${hooksPath}: ${err.message}; left untouched`);
661
+ }
662
+ }
663
+ if (existing !== null && updated !== null && updated !== existing) {
502
664
  this.fs.writeFile(configPath, updated);
503
665
  }
504
666
  }
@@ -523,7 +685,7 @@ export class CodexRuntimeAdapter {
523
685
  continue;
524
686
  }
525
687
  try {
526
- const didProject = this.projectEntry(entry, binding.cwd, warnings, binding.seatSkillsRoot, binding.seatSkillsRefused);
688
+ const didProject = this.projectEntry(entry, binding.cwd, warnings, binding.seatSkillsRoot, binding.seatSkillsRefused, this.homeFor(binding));
527
689
  if (didProject) {
528
690
  projected.push(entry.effectiveId);
529
691
  }
@@ -609,7 +771,7 @@ export class CodexRuntimeAdapter {
609
771
  const prepared = await this.prepareLaunch(binding, opts.name, undefined, { installCorePlugin: !opts.resumeToken });
610
772
  if (!prepared.ok)
611
773
  return prepared;
612
- const { modelArg, effortArg, appliedLaunch, postureArg, queueStateDirArg, daemonArg, networkArg, suppressAutoAddDirs } = prepared;
774
+ const { modelArg, effortArg, appliedLaunch, postureArg, queueStateDirArg, gitDirArg, seatFolderArg, daemonArg, networkArg } = prepared;
613
775
  // Fork branch: `codex fork <parent_thread_id>`. Captures the NEW thread id
614
776
  // post-fork. Parent thread id is NOT persisted onto the new seat record
615
777
  // (identity-honesty bedrock).
@@ -628,7 +790,9 @@ export class CodexRuntimeAdapter {
628
790
  // -s danger-full-access on every seat; otherwise the named profile, or OpenRig's explicit
629
791
  // -s workspace-write floor flag.
630
792
  // 0.5.2-07 A2-3: the FORK path threads the SPEC model too (fork-instantiate reverted it before).
631
- const cmd = `codex${daemonArg}${postureArg}${networkArg}${modelArg}${effortArg} fork${queueStateDirArg} ${shellQuote(parentId)}`;
793
+ // The git dirs and the seat folder follow the parent id: ps flattens argv, so a path with a space placed before the
794
+ // id would be read as the id when the fork is verified.
795
+ const cmd = `codex${daemonArg}${postureArg}${networkArg}${modelArg}${effortArg} fork${queueStateDirArg} ${shellQuote(parentId)}${gitDirArg}${seatFolderArg}`;
632
796
  const textResult = await this.tmux.sendShellCommand(binding.tmuxSession, await this.seatCommand(binding, cmd));
633
797
  if (!textResult.ok) {
634
798
  return { ok: false, error: `Failed to send launch command: ${textResult.message}` };
@@ -662,15 +826,11 @@ export class CodexRuntimeAdapter {
662
826
  // OPR.0.4.8.2: one posture decision (codexPostureArg) for the fresh launch too — YOLO forces
663
827
  // -s danger-full-access (overrides even a named profile); otherwise the named profile, or
664
828
  // OpenRig's explicit -s workspace-write floor flag.
665
- // Issue #121: only the fresh launch adds git metadata dirs; resume and fork never did.
666
- const gitDirArg = opts.resumeToken || binding.codexRebuildPermissions
667
- ? ""
668
- : suppressAutoAddDirs ? "" : (await this.resolveGitAddDirs(binding.cwd)).map((dir) => ` --add-dir ${shellQuote(dir)}`).join("");
669
829
  const cmd = opts.resumeToken
670
830
  // 0.5.2-07 A2-3: the pod-aware RESUME path threads the SPEC model too (reverted before — the
671
831
  // grounding map assumed codex parity with the claude adapter, but only fresh emitted -m).
672
832
  ? this.resumeCore(prepared, opts.resumeToken, binding)
673
- : `codex${daemonArg}${postureArg}${networkArg} -C ${shellQuote(binding.cwd)}${gitDirArg}${queueStateDirArg}${modelArg}${effortArg}`;
833
+ : `codex${daemonArg}${postureArg}${networkArg} -C ${shellQuote(binding.cwd)}${gitDirArg}${seatFolderArg}${queueStateDirArg}${modelArg}${effortArg}`;
674
834
  const textResult = await this.tmux.sendShellCommand(binding.tmuxSession, await this.seatCommand(binding, cmd));
675
835
  if (!textResult.ok) {
676
836
  return { ok: false, error: `Failed to send launch command: ${textResult.message}` };
@@ -679,7 +839,7 @@ export class CodexRuntimeAdapter {
679
839
  if (updatePrompt.failure)
680
840
  return updatePrompt.failure;
681
841
  if (opts.resumeToken) {
682
- const verification = await this.verifyResumeLaunch(binding.tmuxSession, updatePrompt, { resumeToken: opts.resumeToken });
842
+ const verification = await this.verifyResumeLaunch(binding.tmuxSession, updatePrompt, { resumeToken: opts.resumeToken, ...this.ownHomeOpt(binding) });
683
843
  if (!verification.ok)
684
844
  return verification;
685
845
  return { ok: true, resumeToken: opts.resumeToken, resumeType: "codex_id", appliedLaunch,
@@ -707,31 +867,36 @@ export class CodexRuntimeAdapter {
707
867
  }
708
868
  /** Type a command buildResumeCommand built into the pane's shell, then verify the resume as launchHarness
709
869
  * does. Nothing is prepared again, so the command runs exactly as it was built and checked. */
710
- async sendResumeCommand(tmuxSession, command, resumeToken) {
870
+ async sendResumeCommand(tmuxSession, command, resumeToken, nodeId, home) {
711
871
  const textResult = await this.tmux.sendShellCommand(tmuxSession, command);
712
872
  if (!textResult.ok)
713
873
  return { ok: false, error: `Failed to send launch command: ${textResult.message}` };
714
- return this.verifyResumeInPane(tmuxSession, resumeToken);
874
+ return this.verifyResumeInPane(tmuxSession, resumeToken, nodeId, home);
715
875
  }
716
876
  /** launchHarness's resume verification for a resume the caller started itself: dismiss a skippable update
717
- * prompt, then require a proven resumed conversation (never process-alive alone). */
718
- async verifyResumeInPane(tmuxSession, resumeToken) {
877
+ * prompt, then require a proven resumed conversation (never process-alive alone). The proof reads `home` when the
878
+ * caller read it from the running Codex, else the seat's own CODEX_HOME when `nodeId` names a seat that declares one,
879
+ * where its resumed Codex logs. */
880
+ async verifyResumeInPane(tmuxSession, resumeToken, nodeId, home) {
719
881
  const updatePrompt = { handled: false };
720
882
  await this.dismissSkippableCodexUpdatePrompt(tmuxSession, updatePrompt);
721
883
  if (updatePrompt.failure)
722
884
  return updatePrompt.failure;
723
- return this.verifyResumeLaunch(tmuxSession, updatePrompt, { resumeToken });
885
+ return this.verifyResumeLaunch(tmuxSession, updatePrompt, { resumeToken, ...(home ? { home } : this.ownHomeOpt({ nodeId })) });
724
886
  }
725
887
  /** Launch flags shared by fresh, fork and resume, decided once per launch. With `running`, the probed and
726
888
  * prepared parts come from the running Codex instead, and no Codex process is started to decide them. */
727
889
  async prepareLaunch(binding, name, running, opts) {
728
890
  // The config write and, for a seat that selected openrig-core, its install run as one step under the config lock, so
729
891
  // concurrent launches never interleave them. An unselected seat's launch never installs.
892
+ // A seat with its own CODEX_HOME gets OpenRig's managed config (hooks, feature flag) and plugin in that home.
893
+ const home = this.homeFor(binding);
894
+ const own = this.ownHome(binding);
730
895
  await this.withConfigLock(async () => {
731
- const managed = await this.applyManagedConfig();
896
+ const managed = await this.applyManagedConfig(home);
732
897
  if (opts.installCorePlugin && managed?.hooksEnabled && this.resolveCorePluginSelected?.(binding.nodeId)) {
733
898
  try {
734
- await this.ensureCodexCorePlugin();
899
+ await this.ensureCodexCorePlugin(home);
735
900
  }
736
901
  catch (err) {
737
902
  console.error(`[openrig] runtime setup warning: ${err.message}`);
@@ -754,9 +919,12 @@ export class CodexRuntimeAdapter {
754
919
  const postureArg = posture + operationalLaunchArg(this.runtime, binding);
755
920
  if (running) {
756
921
  // The running Codex already loaded its profile; drift in -p is the caller's to compare.
922
+ // Its own --add-dirs, git dirs included, carry over as they ran; none are resolved again. They follow the
923
+ // conversation id, as on every resume, so the resume proof reads the id even when a dir has a space.
757
924
  return { ok: true, model, modelArg, effort, effortArg, profile, appliedLaunch, postureArg,
758
- queueStateDirArg: running.addDirs.map((dir) => ` --add-dir ${shellQuote(dir)}`).join(""),
759
- suppressAutoAddDirs: false,
925
+ queueStateDirArg: "",
926
+ gitDirArg: running.addDirs.map((dir) => ` --add-dir ${shellQuote(dir)}`).join(""),
927
+ seatFolderArg: "",
760
928
  daemonOptOut: running.daemonOptOut, daemonArg: running.daemonOptOut ? " --no-daemon" : "",
761
929
  networkArg: running.networkOverride ? ` -c ${shellQuote(CODEX_NETWORK_DEFAULT_OVERRIDE)}` : "" };
762
930
  }
@@ -765,7 +933,7 @@ export class CodexRuntimeAdapter {
765
933
  // `codex -p <profile> resume` failure. An absent .config.toml passes
766
934
  // (Codex default-layers it; advisor Option B).
767
935
  if (profile) {
768
- const probeResult = await this.verifyProfilePreflight(profile, binding.cwd);
936
+ const probeResult = await (own ? this.verifyProfilePreflight(profile, binding.cwd, own) : this.verifyProfilePreflight(profile, binding.cwd));
769
937
  if (!probeResult.ok) {
770
938
  return {
771
939
  ok: false,
@@ -776,7 +944,14 @@ export class CodexRuntimeAdapter {
776
944
  // Codex rejects writable --add-dir roots under a read-only sandbox. Only
777
945
  // suppress OpenRig's generated roots when later project layers cannot make it writable.
778
946
  const suppressAutoAddDirs = Boolean(!binding.codexRebuildPermissions && profile
779
- && posture === profileArg && this.profileRemainsReadOnly(profile, binding.cwd));
947
+ && posture === profileArg && this.profileRemainsReadOnly(profile, binding.cwd, home));
948
+ // Issue #121: fresh, resume and fork get the same git metadata dirs, so a restored or forked seat can still commit.
949
+ // A rebuild keeps the writable roots its observed envelope names instead.
950
+ const gitDirArg = binding.codexRebuildPermissions || suppressAutoAddDirs
951
+ ? "" : (await this.resolveGitAddDirs(binding.cwd)).map((dir) => ` --add-dir ${shellQuote(dir)}`).join("");
952
+ // The seat's own topology folder, so it can keep its LEARNED.md and recap: the same launches and the same suppression.
953
+ const seatFolder = binding.codexRebuildPermissions || suppressAutoAddDirs ? undefined : this.prepareSeatFolder?.(name);
954
+ const seatFolderArg = seatFolder ? ` --add-dir ${shellQuote(seatFolder)}` : "";
780
955
  const teamWorkspaceArg = !binding.codexRebuildPermissions && binding.teamPermissionDefault && !profile
781
956
  && appliedLaunch.state === "observed" && appliedLaunch.value === "workspace-write"
782
957
  ? codexTeamWorkspaceArg(this.prepareTeamWorkspace, name) : "";
@@ -784,7 +959,7 @@ export class CodexRuntimeAdapter {
784
959
  ? "" : teamWorkspaceArg || this.buildQueueStateAddDirArg(name);
785
960
  // #69: one daemon-support decision for this launch, for the Codex the seat pane runs
786
961
  // (its cwd, the launch PATH), applied to fresh, fork and resume.
787
- const daemonSupport = this.detectDaemonSupport ? await this.detectDaemonSupport(binding.cwd) : undefined;
962
+ const daemonSupport = this.detectDaemonSupport ? await (own ? this.detectDaemonSupport(binding.cwd, own) : this.detectDaemonSupport(binding.cwd)) : undefined;
788
963
  if (daemonSupport?.kind === "unknown") {
789
964
  return { ok: false, error: unknownDaemonSupportMessage(daemonSupport.detail) };
790
965
  }
@@ -792,19 +967,22 @@ export class CodexRuntimeAdapter {
792
967
  const daemonArg = daemonOptOut ? " --no-daemon" : "";
793
968
  // #275: on the plain floor, network access unless Codex reports an opt-out or policy.
794
969
  const networkArg = binding.codexRebuildPermissions ? ""
795
- : await codexNetworkDefaultArg(this.readNetworkDefault, appliedLaunch, binding.cwd, name);
970
+ : await codexNetworkDefaultArg(own && this.readNetworkDefault ? ((cwd) => this.readNetworkDefault(cwd, own)) : this.readNetworkDefault, appliedLaunch, binding.cwd, name);
796
971
  // The launch facts keep the probed daemon choice, so a printed recovery command can repeat it; no probe, no fact.
797
972
  const launchFacts = daemonSupport ? { ...appliedLaunch, daemonOptOut } : appliedLaunch;
798
- return { ok: true, model, modelArg, effort, effortArg, profile, appliedLaunch: launchFacts, postureArg, queueStateDirArg, suppressAutoAddDirs, daemonOptOut, daemonArg, networkArg };
973
+ return { ok: true, model, modelArg, effort, effortArg, profile, appliedLaunch: launchFacts, postureArg, queueStateDirArg, gitDirArg, seatFolderArg, daemonOptOut, daemonArg, networkArg };
799
974
  }
800
975
  resumeCore(prepared, resumeToken, binding) {
801
- const { profile, queueStateDirArg, model, postureArg, networkArg, daemonOptOut, effort } = prepared;
802
- return buildCodexResumeCore(resumeToken, profile, false, queueStateDirArg.trim() || undefined, binding.launchPosture, model, `${postureArg}${networkArg}`, daemonOptOut, effort);
976
+ const { profile, queueStateDirArg, gitDirArg, seatFolderArg, model, postureArg, networkArg, daemonOptOut, effort } = prepared;
977
+ // The git dirs and the seat folder follow the conversation id, as on a fork, so the resume proof reads the id even
978
+ // from a path with a space.
979
+ return buildCodexResumeCore(resumeToken, profile, false, queueStateDirArg.trim() || undefined, binding.launchPosture, model, `${postureArg}${networkArg}`, daemonOptOut, effort)
980
+ + gitDirArg + seatFolderArg;
803
981
  }
804
982
  async seatCommand(binding, cmd) {
805
983
  return this.seatLaunchEnvironment
806
- ? await this.seatLaunchEnvironment.command(binding.tmuxSession, cmd, { codexCwd: binding.cwd, nodeId: binding.nodeId, generation: binding.launchGeneration, runtime: this.runtime })
807
- : this.launchCommand(cmd);
984
+ ? await this.seatLaunchEnvironment.command(binding.tmuxSession, cmd, { codexCwd: binding.cwd, nodeId: binding.nodeId, generation: binding.launchGeneration, runtime: this.runtime, ...this.ownHomeCommandOpt(binding) })
985
+ : this.launchCommand(cmd, this.homeFor(binding));
808
986
  }
809
987
  buildQueueStateAddDirArg(sessionName) {
810
988
  const sharedDocsRoot = process.env.OPENRIG_SHARED_DOCS_ROOT?.trim()
@@ -816,8 +994,8 @@ export class CodexRuntimeAdapter {
816
994
  * Return true only when visible config proves a read-only profile within Codex's default project root.
817
995
  * Unknown markers or unreadable layers retain the generated roots for native launch handling.
818
996
  */
819
- profileRemainsReadOnly(profile, cwd) {
820
- const root = this.codexHome ?? nodePath.join(this.fs.homedir ?? os.homedir(), ".codex");
997
+ profileRemainsReadOnly(profile, cwd, home = this.codexHome) {
998
+ const root = home ?? nodePath.join(this.fs.homedir ?? os.homedir(), ".codex");
821
999
  const path = nodePath.join(root, `${profile}.config.toml`);
822
1000
  const userPath = nodePath.join(root, "config.toml");
823
1001
  if (!this.fs.exists(path))
@@ -904,11 +1082,21 @@ export class CodexRuntimeAdapter {
904
1082
  }
905
1083
  const paneCommand = await this.tmux.getPaneCommand(binding.tmuxSession);
906
1084
  const paneContent = await this.captureProbeScreen(binding.tmuxSession);
907
- const probe = assessNativeResumeProbe({
1085
+ let probe = assessNativeResumeProbe({
908
1086
  runtime: "codex",
909
1087
  paneCommand,
910
1088
  paneContent,
911
1089
  });
1090
+ if (probe.code === "returned_to_shell" || probe.code === "awaiting_runtime") {
1091
+ const process = await verifyCodexPaneProcess({ target: binding.tmuxSession, tmux: this.tmux,
1092
+ listProcesses: this.listProcesses });
1093
+ if (process) {
1094
+ const currentPaneCommand = await this.tmux.getPaneCommand(binding.tmuxSession);
1095
+ const currentPaneContent = await this.captureProbeScreen(binding.tmuxSession);
1096
+ probe = assessNativeResumeProbe({ runtime: "codex", paneCommand: currentPaneCommand,
1097
+ paneContent: currentPaneContent, codexProcessVerified: true });
1098
+ }
1099
+ }
912
1100
  if (probe.code === "returned_to_shell") {
913
1101
  const isIdleShell = await verifyPaneIdleShell({
914
1102
  target: binding.tmuxSession,
@@ -937,7 +1125,7 @@ export class CodexRuntimeAdapter {
937
1125
  return null;
938
1126
  // Gate PID logs by process start time, then re-observe the whole foreground
939
1127
  // chain. Neither a reused PID nor a replacement pane proves this child.
940
- const child = (await this.readThreadIdByPid(before.process.pid, before.process.startedAt))?.trim();
1128
+ const child = (await this.readThreadIdForSeat(binding, before.process.pid, before.process.startedAt))?.trim();
941
1129
  if (!child || child === parentToken)
942
1130
  return null;
943
1131
  const after = await observeCodexForkProcess(input);
@@ -1011,10 +1199,10 @@ export class CodexRuntimeAdapter {
1011
1199
  return observation ? JSON.stringify([paneCommand, observation.fingerprint]) : null;
1012
1200
  }
1013
1201
  ensureManagedBootstrap(binding) {
1014
- this.provisionWorkspaceTrust(binding.cwd ?? null);
1202
+ this.provisionWorkspaceTrust(binding.cwd ?? null, this.homeFor(binding));
1015
1203
  }
1016
- projectEntry(entry, cwd, warnings, seatSkillsRoot, seatSkillsRefused) {
1017
- if (entry.category === "runtime_resource" && this.applyRuntimeResource(entry)) {
1204
+ projectEntry(entry, cwd, warnings, seatSkillsRoot, seatSkillsRefused, home) {
1205
+ if (entry.category === "runtime_resource" && this.applyRuntimeResource(entry, home)) {
1018
1206
  return true;
1019
1207
  }
1020
1208
  if (entry.category === "guidance" && entry.mergeStrategy === "managed_block") {
@@ -1157,11 +1345,11 @@ export class CodexRuntimeAdapter {
1157
1345
  default: return null;
1158
1346
  }
1159
1347
  }
1160
- applyRuntimeResource(entry) {
1348
+ applyRuntimeResource(entry, home) {
1161
1349
  if (entry.resourceType !== "codex_config_fragment") {
1162
1350
  return false;
1163
1351
  }
1164
- const configPath = this.resolveCodexConfigPath();
1352
+ const configPath = this.resolveCodexConfigPath(home);
1165
1353
  this.fs.mkdirp(nodePath.dirname(configPath));
1166
1354
  const existing = this.fs.exists(configPath) ? this.fs.readFile(configPath) : "";
1167
1355
  const fragment = this.fs.readFile(entry.absolutePath);
@@ -1204,10 +1392,10 @@ export class CodexRuntimeAdapter {
1204
1392
  detectDeliveryHint(path, content, orientation) {
1205
1393
  return resolveConcreteHint(path, content, orientation);
1206
1394
  }
1207
- provisionWorkspaceTrust(cwd) {
1395
+ provisionWorkspaceTrust(cwd, home) {
1208
1396
  if (!cwd)
1209
1397
  return;
1210
- const configPath = this.resolveCodexConfigPath();
1398
+ const configPath = this.resolveCodexConfigPath(home);
1211
1399
  this.fs.mkdirp(nodePath.dirname(configPath));
1212
1400
  let content = "";
1213
1401
  try {
@@ -1222,8 +1410,8 @@ export class CodexRuntimeAdapter {
1222
1410
  }
1223
1411
  this.fs.writeFile(configPath, content);
1224
1412
  }
1225
- resolveCodexConfigPath() {
1226
- const root = this.codexHome
1413
+ resolveCodexConfigPath(home = this.codexHome) {
1414
+ const root = home
1227
1415
  ?? nodePath.join(this.fs.homedir ?? os.homedir(), ".codex");
1228
1416
  return nodePath.join(root, "config.toml");
1229
1417
  }
@@ -1265,7 +1453,7 @@ export class CodexRuntimeAdapter {
1265
1453
  if (shellPid) {
1266
1454
  const codexPids = await this.findCodexDescendantPids(shellPid);
1267
1455
  for (const codexPid of codexPids) {
1268
- const threadId = await this.readThreadIdByPid(codexPid);
1456
+ const threadId = await this.readThreadIdForSeat(binding, codexPid);
1269
1457
  if (threadId)
1270
1458
  return threadId;
1271
1459
  }
@@ -1330,7 +1518,7 @@ export class CodexRuntimeAdapter {
1330
1518
  const value = await this.withinDeadline(Promise.resolve().then(work), deadline);
1331
1519
  return Date.now() >= deadline ? null : value;
1332
1520
  }
1333
- async proveResumedProcess(tmuxSession, resumeToken, deadline) {
1521
+ async proveResumedProcess(tmuxSession, resumeToken, deadline, home) {
1334
1522
  if (!this.tmux.getPanePid)
1335
1523
  return { kind: "unknown", reason: "the pane's process can't be read" };
1336
1524
  if (Date.now() >= deadline)
@@ -1347,7 +1535,7 @@ export class CodexRuntimeAdapter {
1347
1535
  }
1348
1536
  let evidence;
1349
1537
  try {
1350
- evidence = await this.beforeResumeDeadline(() => this.readResumeEvidence(before.process.pid, before.process.startedAt), deadline);
1538
+ evidence = await this.beforeResumeDeadline(() => home ? this.readResumeEvidence(before.process.pid, before.process.startedAt, home) : this.readResumeEvidence(before.process.pid, before.process.startedAt), deadline);
1351
1539
  }
1352
1540
  catch (err) {
1353
1541
  return { kind: "unknown", reason: `Codex's records couldn't be read (${err.message})` };
@@ -1447,6 +1635,27 @@ export class CodexRuntimeAdapter {
1447
1635
  paneCommand,
1448
1636
  paneContent,
1449
1637
  });
1638
+ if (probe.code === "returned_to_shell" || probe.code === "awaiting_runtime") {
1639
+ const process = resumeToken
1640
+ ? await this.beforeResumeDeadline(() => verifyCodexPaneProcess({ target: tmuxSession, tmux: this.tmux,
1641
+ listProcesses: this.listProcesses }), deadline)
1642
+ : await verifyCodexPaneProcess({ target: tmuxSession, tmux: this.tmux,
1643
+ listProcesses: this.listProcesses });
1644
+ if (process) {
1645
+ const current = resumeToken
1646
+ ? await this.beforeResumeDeadline(async () => ({
1647
+ command: await this.tmux.getPaneCommand(tmuxSession),
1648
+ content: await this.captureProbeScreen(tmuxSession),
1649
+ }), deadline)
1650
+ : { command: await this.tmux.getPaneCommand(tmuxSession), content: await this.captureProbeScreen(tmuxSession) };
1651
+ if (!current)
1652
+ break;
1653
+ paneCommand = current.command;
1654
+ paneContent = current.content;
1655
+ lastPaneContent = paneContent;
1656
+ probe = assessNativeResumeProbe({ runtime: "codex", paneCommand, paneContent, codexProcessVerified: true });
1657
+ }
1658
+ }
1450
1659
  if (probe.code === "no_saved_session") {
1451
1660
  return {
1452
1661
  ok: false,
@@ -1480,15 +1689,17 @@ export class CodexRuntimeAdapter {
1480
1689
  return { ok: true, resumeToken: undefined, resumeType: undefined };
1481
1690
  }
1482
1691
  if (probe.status === "resumed" && resumeToken) {
1483
- const proof = await this.proveResumedProcess(tmuxSession, resumeToken, deadline);
1692
+ const proof = await this.proveResumedProcess(tmuxSession, resumeToken, deadline, opts?.home);
1484
1693
  if (proof.kind === "match")
1485
1694
  return { ok: true, resumeToken, resumeType: "codex_id", resumedProcess: proof.process };
1486
1695
  if (proof.kind === "mismatch") {
1696
+ const detail = `Codex resume opened a different conversation: the resumed process's records name ${proof.threadId}, not the requested ${resumeToken}.`;
1487
1697
  return {
1488
1698
  ok: false,
1489
- error: `Codex resume opened a different conversation: the resumed process's records name ${proof.threadId}, not the requested ${resumeToken}. The session was preserved; nothing was restarted.`,
1699
+ error: `${detail} The session was preserved; nothing was restarted.`,
1490
1700
  recovery: "attention_required",
1491
1701
  resumeMismatch: { opened: proof.threadId },
1702
+ resumeDetail: detail,
1492
1703
  verifierInput: verifierInput(),
1493
1704
  evidence: paneContent.split("\n").slice(-12).join("\n"),
1494
1705
  };
@@ -1540,9 +1751,10 @@ export class CodexRuntimeAdapter {
1540
1751
  // Report the newest screen observed; a resumed or booting one names no gate. The loop's own decisions above used
1541
1752
  // lastUnresolved. The text follows the newest screen too, so an older gate's text never stands for a newer screen.
1542
1753
  const shown = report && report.probe.status !== "resumed" && report.probe.code !== "awaiting_runtime" ? report : null;
1543
- const unprovenText = unproven && report?.probe.status === "resumed"
1544
- ? `Codex resume could not be proven within the resume window: ${unproven}. The session was preserved; nothing was restarted.`
1754
+ const unprovenDetail = unproven && report?.probe.status === "resumed"
1755
+ ? `Codex resume could not be proven within the resume window: ${unproven}.`
1545
1756
  : null;
1757
+ const unprovenText = unprovenDetail ? `${unprovenDetail} The session was preserved; nothing was restarted.` : null;
1546
1758
  const newestText = unprovenText ? unprovenText : shown ? shown.probe.detail
1547
1759
  : report?.probe.status === "resumed" ? "Codex resume could not be confirmed: the last screen observed looked ready, but the resume check ended before proving a restored conversation."
1548
1760
  : report ? report.probe.detail
@@ -1558,6 +1770,7 @@ export class CodexRuntimeAdapter {
1558
1770
  // With a conversation to prove and no gate on the newest screen, the end is "not proven": whatever the last frame
1559
1771
  // was (a boot, a ready screen, or no capture at all before the deadline), the resumed Codex may be running.
1560
1772
  ...(resumeToken && !shown ? { resumeUnproven: true } : {}),
1773
+ ...(unprovenDetail ? { resumeDetail: unprovenDetail } : {}),
1561
1774
  verifierInput: verifierInput(),
1562
1775
  evidence: (report?.paneContent ?? lastPaneContent).split("\n").slice(-12).join("\n"),
1563
1776
  };
@@ -1566,11 +1779,11 @@ export class CodexRuntimeAdapter {
1566
1779
  const processes = await this.listProcesses();
1567
1780
  return findCodexDescendantPids(processes, parentPid);
1568
1781
  }
1569
- async readThreadIdFromLogs(pid) {
1570
- return readCodexThreadIdFromCandidateHomes(pid, this.codexHome ? [] : [await this.resolveHomeDirByPid(pid), this.fs.homedir, os.homedir()], (path) => this.fs.exists(path), this.codexHome);
1782
+ async readThreadIdFromLogs(pid, home = this.codexHome) {
1783
+ return readCodexThreadIdFromCandidateHomes(pid, home ? [] : [await this.resolveHomeDirByPid(pid), this.fs.homedir, os.homedir()], (path) => this.fs.exists(path), home);
1571
1784
  }
1572
- launchCommand(command) {
1573
- const env = [this.launchPath ? `PATH=${shellQuote(this.launchPath)}` : "", this.codexHome ? `CODEX_HOME=${shellQuote(this.codexHome)}` : ""].filter(Boolean);
1785
+ launchCommand(command, home = this.codexHome) {
1786
+ const env = [this.launchPath ? `PATH=${shellQuote(this.launchPath)}` : "", home ? `CODEX_HOME=${shellQuote(home)}` : ""].filter(Boolean);
1574
1787
  return env.length ? `env ${env.join(" ")} ${command}` : command;
1575
1788
  }
1576
1789
  }
@@ -1762,6 +1975,8 @@ function upsertCodexHooksFeature(content) {
1762
1975
  }
1763
1976
  // OPR.0.4.1.10 FR-A — config-layer activity-hook projection.
1764
1977
  const OPENRIG_ACTIVITY_HOOKS_BEGIN = "# BEGIN OPENRIG MANAGED ACTIVITY HOOKS";
1978
+ /** The status Codex shows while OpenRig's hooks.json activity hook runs; it also marks the group as OpenRig's. */
1979
+ const OPENRIG_ACTIVITY_STATUS = "OpenRig activity";
1765
1980
  const OPENRIG_ACTIVITY_HOOKS_END = "# END OPENRIG MANAGED ACTIVITY HOOKS";
1766
1981
  const OPENRIG_ACTIVITY_HOOK_EVENTS = ["SessionStart", "UserPromptSubmit", "Stop", "PermissionRequest"];
1767
1982
  /**
@@ -1788,6 +2003,148 @@ function upsertCodexActivityHooks(content, relayPath) {
1788
2003
  const prefix = next.replace(/\n*$/, "");
1789
2004
  return prefix.length > 0 ? `${prefix}\n\n${block}` : block;
1790
2005
  }
2006
+ function canonicalCodexHookSource(path) {
2007
+ // Codex keys hook trust by the canonical source path; a file not on the real filesystem keeps its plain path.
2008
+ try {
2009
+ return fs.realpathSync.native(path);
2010
+ }
2011
+ catch {
2012
+ return path;
2013
+ }
2014
+ }
2015
+ /** A hooks.json document as Codex reads it: `hooks` maps each event to matcher groups, each with a `hooks` list. */
2016
+ function parseCodexHooksJson(content) {
2017
+ const value = JSON.parse(content);
2018
+ if (value === null || typeof value !== "object" || Array.isArray(value))
2019
+ throw new Error("not a JSON object");
2020
+ const record = value;
2021
+ if (record.hooks === undefined)
2022
+ record.hooks = {};
2023
+ const hooks = record.hooks;
2024
+ if (hooks === null || typeof hooks !== "object" || Array.isArray(hooks)
2025
+ || Object.values(hooks).some((groups) => !Array.isArray(groups)
2026
+ || groups.some((group) => group === null || typeof group !== "object" || !Array.isArray(group.hooks)))) {
2027
+ throw new Error("expected hooks to map each event to matcher groups with a hooks list");
2028
+ }
2029
+ return record;
2030
+ }
2031
+ function openRigActivityGroup(command) {
2032
+ return { hooks: [{ type: "command", command, timeout: 5, statusMessage: OPENRIG_ACTIVITY_STATUS }] };
2033
+ }
2034
+ /** Where OpenRig's activity relay ships, in this install or an earlier one (the absolute path moves on upgrade). */
2035
+ const OPENRIG_ACTIVITY_RELAY_SUFFIX = "/assets/plugins/openrig-core/hooks/scripts/activity-relay.cjs";
2036
+ /** A hook command that runs OpenRig's own shipped activity relay, not a person's script that shares its name. */
2037
+ function isOpenRigRelayCommand(command) {
2038
+ const relay = typeof command === "string" ? /^node "(.*)"$/.exec(command)?.[1] : undefined;
2039
+ return relay !== undefined && relay.replaceAll("\\", "/").endsWith(OPENRIG_ACTIVITY_RELAY_SUFFIX);
2040
+ }
2041
+ /** OpenRig's own group, exactly as it authors it: no matcher, and one handler with only our fields, our status and
2042
+ * timeout, running OpenRig's shipped relay. Anything else is a person's group and is left alone. */
2043
+ function isOpenRigActivityGroup(group) {
2044
+ if (group === null || typeof group !== "object")
2045
+ return false;
2046
+ const { hooks, ...rest } = group;
2047
+ if (Object.keys(rest).length > 0 || !Array.isArray(hooks) || hooks.length !== 1)
2048
+ return false;
2049
+ const handler = hooks[0];
2050
+ if (handler === null || typeof handler !== "object")
2051
+ return false;
2052
+ const { type, command, timeout, statusMessage, ...extra } = handler;
2053
+ return Object.keys(extra).length === 0 && type === "command" && timeout === 5 && statusMessage === OPENRIG_ACTIVITY_STATUS
2054
+ && isOpenRigRelayCommand(command);
2055
+ }
2056
+ function codexHookStateOf(document) {
2057
+ return document?.hooks?.state ?? {};
2058
+ }
2059
+ /** A parsed config without an empty `hooks.state`, or then an empty `hooks`: the text drops a table with its last
2060
+ * entry, and an empty table means the same as none. */
2061
+ function withoutEmptyHookTables(document) {
2062
+ const { hooks, ...rest } = document;
2063
+ if (hooks === undefined)
2064
+ return document;
2065
+ const { state, ...otherHooks } = hooks;
2066
+ const kept = state !== undefined && Object.keys(state).length > 0 ? hooks : otherHooks;
2067
+ return Object.keys(kept).length > 0 ? { ...rest, hooks: kept } : rest;
2068
+ }
2069
+ /** The index of OpenRig's inline group for `event` among a parsed config.toml's inline groups, or -1. */
2070
+ function openRigInlineGroupIndex(document, event) {
2071
+ const groups = document?.hooks?.[event];
2072
+ if (!Array.isArray(groups))
2073
+ return -1;
2074
+ return groups.findIndex((group) => {
2075
+ const handlers = group?.hooks;
2076
+ const handler = Array.isArray(handlers) && handlers.length === 1 ? handlers[0] : null;
2077
+ return !!handler && handler.type === "command" && Number(handler.timeout) === 5 && isOpenRigRelayCommand(handler.command);
2078
+ });
2079
+ }
2080
+ /** Write `enabled = false` into one `[hooks.state."<key>"]` table (the trust write creates it first). */
2081
+ function upsertCodexHookDisabled(content, key) {
2082
+ const header = `[hooks.state.${JSON.stringify(key)}]`;
2083
+ const lines = content.split("\n");
2084
+ const at = lines.findIndex((line) => line.trim() === header);
2085
+ if (at < 0)
2086
+ return `${content.replace(/\n*$/, "")}\n\n${header}\nenabled = false\n`;
2087
+ let end = lines.length;
2088
+ for (let i = at + 1; i < lines.length; i++)
2089
+ if (lines[i].trim().startsWith("[")) {
2090
+ end = i;
2091
+ break;
2092
+ }
2093
+ const enabledAt = lines.findIndex((line, i) => i > at && i < end && /^\s*enabled\s*=/.test(line));
2094
+ if (enabledAt >= 0)
2095
+ lines[enabledAt] = "enabled = false";
2096
+ else
2097
+ lines.splice(at + 1, 0, "enabled = false");
2098
+ return lines.join("\n");
2099
+ }
2100
+ /** The parsed `hooks.state` after an event's groups move (`newIndexOf`; null = the group left): a group's tables move with it. */
2101
+ function rekeyCodexHookState(state, prefix, newIndexOf) {
2102
+ const next = {};
2103
+ for (const [key, value] of Object.entries(state)) {
2104
+ const tail = key.startsWith(prefix) ? /^(\d+):(\d+)$/.exec(key.slice(prefix.length)) : null;
2105
+ if (!tail) {
2106
+ next[key] = value;
2107
+ continue;
2108
+ }
2109
+ const index = newIndexOf(Number(tail[1]));
2110
+ if (index !== null)
2111
+ next[`${prefix}${index}:${tail[2]}`] = value;
2112
+ }
2113
+ return next;
2114
+ }
2115
+ /** The same move on config.toml's text: rename each moved group's `[hooks.state."<key>"]` header, and drop a removed
2116
+ * group's table. Other spellings aren't touched; the caller compares the parsed result before writing. */
2117
+ function rekeyCodexHookStateText(content, prefix, newIndexOf) {
2118
+ const out = [];
2119
+ let dropping = false;
2120
+ for (const line of content.split("\n")) {
2121
+ const trimmed = line.trim();
2122
+ if (trimmed.startsWith("[")) {
2123
+ dropping = false;
2124
+ const quoted = /^\[hooks\.state\.(".*")\]$/.exec(trimmed)?.[1];
2125
+ let key;
2126
+ try {
2127
+ key = quoted ? JSON.parse(quoted) : undefined;
2128
+ }
2129
+ catch {
2130
+ key = undefined;
2131
+ }
2132
+ const tail = key?.startsWith(prefix) ? /^(\d+):(\d+)$/.exec(key.slice(prefix.length)) : null;
2133
+ if (tail) {
2134
+ const index = newIndexOf(Number(tail[1]));
2135
+ if (index === null) {
2136
+ dropping = true;
2137
+ continue;
2138
+ }
2139
+ out.push(`[hooks.state.${JSON.stringify(`${prefix}${index}:${tail[2]}`)}]`);
2140
+ continue;
2141
+ }
2142
+ }
2143
+ if (!dropping)
2144
+ out.push(line);
2145
+ }
2146
+ return out.join("\n");
2147
+ }
1791
2148
  /**
1792
2149
  * OPR.0.4.1.10 B3 — remove the OpenRig-managed activity-hooks sentinel block (durable disable).
1793
2150
  * Strips ONLY the BEGIN..END block (plus the leading blank-line separator it was appended with);