@openrig/cli 0.7.18 → 0.7.19

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 (647) hide show
  1. package/README.md +7 -6
  2. package/daemon/assets/claude-hook-bridge.cjs +146 -0
  3. package/daemon/assets/plugins/openrig/.claude-plugin/plugin.json +1 -1
  4. package/daemon/assets/plugins/openrig/.codex-plugin/plugin.json +1 -1
  5. package/daemon/assets/plugins/openrig/.cursor-plugin/plugin.json +1 -1
  6. package/daemon/assets/plugins/openrig/plugin.json +1 -1
  7. package/daemon/assets/plugins/openrig-core/.claude-plugin/plugin.json +1 -1
  8. package/daemon/assets/plugins/openrig-core/.codex-plugin/plugin.json +1 -1
  9. package/daemon/assets/plugins/openrig-core/README.md +1 -1
  10. package/daemon/assets/plugins/openrig-core/hooks/claude.json +14 -14
  11. package/daemon/assets/plugins/openrig-core/hooks/scripts/activity-relay.cjs +43 -22
  12. package/daemon/assets/plugins/openrig-core/hooks/scripts/refocus.cjs +1 -0
  13. package/daemon/assets/plugins/openrig-core/skills/mission-slice-sop/SKILL.md +1 -1
  14. package/daemon/assets/plugins/openrig-core/skills/refocusing/scripts/trace-to-root.py +70 -2
  15. package/daemon/assets/skills/rigs/SKILL.md +40 -19
  16. package/daemon/context-packs/help/manifest.yaml +1 -1
  17. package/daemon/context-packs/onboarding-width/manifest.yaml +1 -1
  18. package/daemon/context-packs/onboarding-width/public-what-you-can-do.md +16 -7
  19. package/daemon/context-packs/reference/getting-started.md +9 -4
  20. package/daemon/context-packs/reference/manifest.yaml +1 -1
  21. package/daemon/context-packs/reference/rig-spec.md +56 -26
  22. package/daemon/context-packs/reference/whats-new.md +82 -11
  23. package/daemon/context-packs/skills/agent-operated-software/manifest.yaml +1 -1
  24. package/daemon/context-packs/skills/agent-operated-workflows/manifest.yaml +1 -1
  25. package/daemon/context-packs/skills/applying-a-permission-policy/manifest.yaml +1 -1
  26. package/daemon/context-packs/skills/claude-compaction-restore/manifest.yaml +1 -1
  27. package/daemon/context-packs/skills/core/agent-starters/manifest.yaml +1 -1
  28. package/daemon/context-packs/skills/core/agent-startup-and-context-ingestion/manifest.yaml +1 -1
  29. package/daemon/context-packs/skills/core/cross-host-rig-commands/manifest.yaml +1 -1
  30. package/daemon/context-packs/skills/core/human-in-the-loop/manifest.yaml +1 -1
  31. package/daemon/context-packs/skills/core/messaging-the-human/manifest.yaml +1 -1
  32. package/daemon/context-packs/skills/core/openrig-architect/manifest.yaml +1 -1
  33. package/daemon/context-packs/skills/core/openrig-cmux/manifest.yaml +1 -1
  34. package/daemon/context-packs/skills/core/openrig-herdr/manifest.yaml +1 -1
  35. package/daemon/context-packs/skills/core/openrig-skills/manifest.yaml +1 -1
  36. package/daemon/context-packs/skills/core/openrig-software-factory/manifest.yaml +1 -1
  37. package/daemon/context-packs/skills/core/openrig-upgrade/manifest.yaml +1 -1
  38. package/daemon/context-packs/skills/core/rig-bundles-and-shareable-artifacts/manifest.yaml +1 -1
  39. package/daemon/context-packs/skills/core/rig-lifecycle/manifest.yaml +1 -1
  40. package/daemon/context-packs/skills/core/session-source-fork/manifest.yaml +1 -1
  41. package/daemon/context-packs/skills/core/specification-system/manifest.yaml +1 -1
  42. package/daemon/context-packs/skills/core/topology-mutation-and-seat-management/manifest.yaml +1 -1
  43. package/daemon/context-packs/skills/core/watchdog/manifest.yaml +1 -1
  44. package/daemon/context-packs/skills/core/working-with-an-openrig-team/manifest.yaml +1 -1
  45. package/daemon/context-packs/skills/delegating-work/manifest.yaml +1 -1
  46. package/daemon/context-packs/skills/forming-an-openrig-mental-model/manifest.yaml +1 -1
  47. package/daemon/context-packs/skills/loading-addressable-markdown/manifest.yaml +1 -1
  48. package/daemon/context-packs/skills/mission-slice-sop/SKILL.md +1 -1
  49. package/daemon/context-packs/skills/mission-slice-sop/manifest.yaml +1 -1
  50. package/daemon/context-packs/skills/openrig-operating-model/manifest.yaml +1 -1
  51. package/daemon/context-packs/skills/openrig-user/manifest.yaml +1 -1
  52. package/daemon/context-packs/skills/orienting-to-an-inherited-seat/manifest.yaml +1 -1
  53. package/daemon/context-packs/skills/pm/backlog-capture/manifest.yaml +1 -1
  54. package/daemon/context-packs/skills/pm/context-builder/manifest.yaml +1 -1
  55. package/daemon/context-packs/skills/pm/exec-summary/manifest.yaml +1 -1
  56. package/daemon/context-packs/skills/pm/office-hours/manifest.yaml +1 -1
  57. package/daemon/context-packs/skills/pm/plan-review/manifest.yaml +1 -1
  58. package/daemon/context-packs/skills/pm/requirements-writer/manifest.yaml +1 -1
  59. package/daemon/context-packs/skills/pm/ui-mockup/manifest.yaml +1 -1
  60. package/daemon/context-packs/skills/pods/development-team/manifest.yaml +1 -1
  61. package/daemon/context-packs/skills/pods/orchestration-team/manifest.yaml +1 -1
  62. package/daemon/context-packs/skills/pods/oversight-team/manifest.yaml +1 -1
  63. package/daemon/context-packs/skills/pods/review-team/manifest.yaml +1 -1
  64. package/daemon/context-packs/skills/process/agent-browser/manifest.yaml +1 -1
  65. package/daemon/context-packs/skills/process/context-engineering/manifest.yaml +1 -1
  66. package/daemon/context-packs/skills/process/dogfood/manifest.yaml +1 -1
  67. package/daemon/context-packs/skills/process/frontend-design/manifest.yaml +1 -1
  68. package/daemon/context-packs/skills/process/systematic-debugging/manifest.yaml +1 -1
  69. package/daemon/context-packs/skills/process/test-driven-development/manifest.yaml +1 -1
  70. package/daemon/context-packs/skills/process/verification-before-completion/manifest.yaml +1 -1
  71. package/daemon/context-packs/skills/queue-handoff/manifest.yaml +1 -1
  72. package/daemon/context-packs/skills/refocusing/manifest.yaml +1 -1
  73. package/daemon/context-packs/skills/refocusing/scripts/trace-to-root.py +70 -2
  74. package/daemon/context-packs/skills/retiring-and-inheriting-a-seat/manifest.yaml +1 -1
  75. package/daemon/context-packs/skills/seat-continuity-and-handover/manifest.yaml +1 -1
  76. package/daemon/context-packs/skills/session-compaction-and-restore/manifest.yaml +1 -1
  77. package/daemon/context-packs/skills/software-for-agents/manifest.yaml +1 -1
  78. package/daemon/context-packs/world-example/manifest.yaml +1 -1
  79. package/daemon/context-packs/world-public/manifest.yaml +1 -1
  80. package/daemon/dist/adapters/claude-code-adapter.d.ts +9 -0
  81. package/daemon/dist/adapters/claude-code-adapter.d.ts.map +1 -1
  82. package/daemon/dist/adapters/claude-code-adapter.js +41 -4
  83. package/daemon/dist/adapters/claude-code-adapter.js.map +1 -1
  84. package/daemon/dist/adapters/claude-resume.d.ts +2 -0
  85. package/daemon/dist/adapters/claude-resume.d.ts.map +1 -1
  86. package/daemon/dist/adapters/claude-resume.js +3 -1
  87. package/daemon/dist/adapters/claude-resume.js.map +1 -1
  88. package/daemon/dist/adapters/codex-runtime-adapter.d.ts +5 -0
  89. package/daemon/dist/adapters/codex-runtime-adapter.d.ts.map +1 -1
  90. package/daemon/dist/adapters/codex-runtime-adapter.js +45 -10
  91. package/daemon/dist/adapters/codex-runtime-adapter.js.map +1 -1
  92. package/daemon/dist/adapters/kernel-authority.d.ts +7 -0
  93. package/daemon/dist/adapters/kernel-authority.d.ts.map +1 -1
  94. package/daemon/dist/adapters/kernel-authority.js +24 -1
  95. package/daemon/dist/adapters/kernel-authority.js.map +1 -1
  96. package/daemon/dist/adapters/pi-resume.d.ts.map +1 -1
  97. package/daemon/dist/adapters/pi-resume.js +5 -7
  98. package/daemon/dist/adapters/pi-resume.js.map +1 -1
  99. package/daemon/dist/adapters/pi-runner-protocol.d.ts +5 -1
  100. package/daemon/dist/adapters/pi-runner-protocol.d.ts.map +1 -1
  101. package/daemon/dist/adapters/pi-runner.d.ts +34 -0
  102. package/daemon/dist/adapters/pi-runner.d.ts.map +1 -1
  103. package/daemon/dist/adapters/pi-runner.js +359 -26
  104. package/daemon/dist/adapters/pi-runner.js.map +1 -1
  105. package/daemon/dist/adapters/pi-runtime-adapter.d.ts +7 -1
  106. package/daemon/dist/adapters/pi-runtime-adapter.d.ts.map +1 -1
  107. package/daemon/dist/adapters/pi-runtime-adapter.js +29 -19
  108. package/daemon/dist/adapters/pi-runtime-adapter.js.map +1 -1
  109. package/daemon/dist/adapters/tmux.d.ts +54 -34
  110. package/daemon/dist/adapters/tmux.d.ts.map +1 -1
  111. package/daemon/dist/adapters/tmux.js +183 -57
  112. package/daemon/dist/adapters/tmux.js.map +1 -1
  113. package/daemon/dist/build-info.js +3 -3
  114. package/daemon/dist/db/all-migrations.d.ts.map +1 -1
  115. package/daemon/dist/db/all-migrations.js +6 -0
  116. package/daemon/dist/db/all-migrations.js.map +1 -1
  117. package/daemon/dist/db/migrations/171_seat_hook_bridge.d.ts +5 -0
  118. package/daemon/dist/db/migrations/171_seat_hook_bridge.d.ts.map +1 -0
  119. package/daemon/dist/db/migrations/171_seat_hook_bridge.js +25 -0
  120. package/daemon/dist/db/migrations/171_seat_hook_bridge.js.map +1 -0
  121. package/daemon/dist/db/migrations/174_session_launched_cwd.d.ts +6 -0
  122. package/daemon/dist/db/migrations/174_session_launched_cwd.d.ts.map +1 -0
  123. package/daemon/dist/db/migrations/174_session_launched_cwd.js +8 -0
  124. package/daemon/dist/db/migrations/174_session_launched_cwd.js.map +1 -0
  125. package/daemon/dist/db/migrations/175_core_app_access.d.ts +3 -0
  126. package/daemon/dist/db/migrations/175_core_app_access.d.ts.map +1 -0
  127. package/daemon/dist/db/migrations/175_core_app_access.js +26 -0
  128. package/daemon/dist/db/migrations/175_core_app_access.js.map +1 -0
  129. package/daemon/dist/domain/activity-grants.d.ts.map +1 -1
  130. package/daemon/dist/domain/activity-grants.js +6 -4
  131. package/daemon/dist/domain/activity-grants.js.map +1 -1
  132. package/daemon/dist/domain/agent-activity-store.d.ts +23 -0
  133. package/daemon/dist/domain/agent-activity-store.d.ts.map +1 -1
  134. package/daemon/dist/domain/agent-activity-store.js +62 -5
  135. package/daemon/dist/domain/agent-activity-store.js.map +1 -1
  136. package/daemon/dist/domain/claude-activity-hooks.d.ts +4 -2
  137. package/daemon/dist/domain/claude-activity-hooks.d.ts.map +1 -1
  138. package/daemon/dist/domain/claude-activity-hooks.js +5 -3
  139. package/daemon/dist/domain/claude-activity-hooks.js.map +1 -1
  140. package/daemon/dist/domain/claude-compaction-enforcer.d.ts +64 -3
  141. package/daemon/dist/domain/claude-compaction-enforcer.d.ts.map +1 -1
  142. package/daemon/dist/domain/claude-compaction-enforcer.js +203 -6
  143. package/daemon/dist/domain/claude-compaction-enforcer.js.map +1 -1
  144. package/daemon/dist/domain/compaction-restore-notice.d.ts +3 -1
  145. package/daemon/dist/domain/compaction-restore-notice.d.ts.map +1 -1
  146. package/daemon/dist/domain/compaction-restore-notice.js +22 -3
  147. package/daemon/dist/domain/compaction-restore-notice.js.map +1 -1
  148. package/daemon/dist/domain/configured-account.d.ts +3 -0
  149. package/daemon/dist/domain/configured-account.d.ts.map +1 -0
  150. package/daemon/dist/domain/configured-account.js +10 -0
  151. package/daemon/dist/domain/configured-account.js.map +1 -0
  152. package/daemon/dist/domain/core-app-access.d.ts +51 -0
  153. package/daemon/dist/domain/core-app-access.d.ts.map +1 -0
  154. package/daemon/dist/domain/core-app-access.js +107 -0
  155. package/daemon/dist/domain/core-app-access.js.map +1 -0
  156. package/daemon/dist/domain/core-app-job.d.ts +411 -0
  157. package/daemon/dist/domain/core-app-job.d.ts.map +1 -0
  158. package/daemon/dist/domain/core-app-job.js +537 -0
  159. package/daemon/dist/domain/core-app-job.js.map +1 -0
  160. package/daemon/dist/domain/current-park-arm.d.ts +4 -0
  161. package/daemon/dist/domain/current-park-arm.d.ts.map +1 -0
  162. package/daemon/dist/domain/current-park-arm.js +14 -0
  163. package/daemon/dist/domain/current-park-arm.js.map +1 -0
  164. package/daemon/dist/domain/cwd-resolution.d.ts +12 -0
  165. package/daemon/dist/domain/cwd-resolution.d.ts.map +1 -1
  166. package/daemon/dist/domain/cwd-resolution.js +21 -1
  167. package/daemon/dist/domain/cwd-resolution.js.map +1 -1
  168. package/daemon/dist/domain/execution-view.d.ts.map +1 -1
  169. package/daemon/dist/domain/execution-view.js +9 -3
  170. package/daemon/dist/domain/execution-view.js.map +1 -1
  171. package/daemon/dist/domain/gateway/participants.d.ts +2 -0
  172. package/daemon/dist/domain/gateway/participants.d.ts.map +1 -1
  173. package/daemon/dist/domain/gateway/participants.js +5 -1
  174. package/daemon/dist/domain/gateway/participants.js.map +1 -1
  175. package/daemon/dist/domain/gateway/slack/message.d.ts +1 -0
  176. package/daemon/dist/domain/gateway/slack/message.d.ts.map +1 -1
  177. package/daemon/dist/domain/gateway/slack/message.js +37 -17
  178. package/daemon/dist/domain/gateway/slack/message.js.map +1 -1
  179. package/daemon/dist/domain/gateway/slack/settled-asks.js +1 -1
  180. package/daemon/dist/domain/gateway/slack/settled-asks.js.map +1 -1
  181. package/daemon/dist/domain/gateway/slack/slack-delivery.d.ts +1 -0
  182. package/daemon/dist/domain/gateway/slack/slack-delivery.d.ts.map +1 -1
  183. package/daemon/dist/domain/gateway/slack/slack-delivery.js +2 -0
  184. package/daemon/dist/domain/gateway/slack/slack-delivery.js.map +1 -1
  185. package/daemon/dist/domain/gateway/slack/slack-subsystem.d.ts +4 -0
  186. package/daemon/dist/domain/gateway/slack/slack-subsystem.d.ts.map +1 -1
  187. package/daemon/dist/domain/gateway/slack/slack-subsystem.js +26 -2
  188. package/daemon/dist/domain/gateway/slack/slack-subsystem.js.map +1 -1
  189. package/daemon/dist/domain/hook-bridge.d.ts +345 -0
  190. package/daemon/dist/domain/hook-bridge.d.ts.map +1 -0
  191. package/daemon/dist/domain/hook-bridge.js +547 -0
  192. package/daemon/dist/domain/hook-bridge.js.map +1 -0
  193. package/daemon/dist/domain/hosted-wake.d.ts +9 -0
  194. package/daemon/dist/domain/hosted-wake.d.ts.map +1 -1
  195. package/daemon/dist/domain/hosted-wake.js +45 -6
  196. package/daemon/dist/domain/hosted-wake.js.map +1 -1
  197. package/daemon/dist/domain/human-ask-attention.d.ts +10 -0
  198. package/daemon/dist/domain/human-ask-attention.d.ts.map +1 -0
  199. package/daemon/dist/domain/human-ask-attention.js +22 -0
  200. package/daemon/dist/domain/human-ask-attention.js.map +1 -0
  201. package/daemon/dist/domain/mission-control/mission-control-action-log.d.ts +4 -0
  202. package/daemon/dist/domain/mission-control/mission-control-action-log.d.ts.map +1 -1
  203. package/daemon/dist/domain/mission-control/mission-control-action-log.js +8 -1
  204. package/daemon/dist/domain/mission-control/mission-control-action-log.js.map +1 -1
  205. package/daemon/dist/domain/mission-control/mission-control-write-contract.d.ts +10 -0
  206. package/daemon/dist/domain/mission-control/mission-control-write-contract.d.ts.map +1 -1
  207. package/daemon/dist/domain/mission-control/mission-control-write-contract.js +64 -12
  208. package/daemon/dist/domain/mission-control/mission-control-write-contract.js.map +1 -1
  209. package/daemon/dist/domain/native-continuation-notice.d.ts +16 -0
  210. package/daemon/dist/domain/native-continuation-notice.d.ts.map +1 -0
  211. package/daemon/dist/domain/native-continuation-notice.js +79 -0
  212. package/daemon/dist/domain/native-continuation-notice.js.map +1 -0
  213. package/daemon/dist/domain/native-process-lineage.d.ts +16 -0
  214. package/daemon/dist/domain/native-process-lineage.d.ts.map +1 -1
  215. package/daemon/dist/domain/native-process-lineage.js +48 -3
  216. package/daemon/dist/domain/native-process-lineage.js.map +1 -1
  217. package/daemon/dist/domain/node-inventory.d.ts.map +1 -1
  218. package/daemon/dist/domain/node-inventory.js +27 -6
  219. package/daemon/dist/domain/node-inventory.js.map +1 -1
  220. package/daemon/dist/domain/node-launcher.d.ts +6 -0
  221. package/daemon/dist/domain/node-launcher.d.ts.map +1 -1
  222. package/daemon/dist/domain/node-launcher.js +16 -2
  223. package/daemon/dist/domain/node-launcher.js.map +1 -1
  224. package/daemon/dist/domain/outbox-handler.d.ts +21 -3
  225. package/daemon/dist/domain/outbox-handler.d.ts.map +1 -1
  226. package/daemon/dist/domain/outbox-handler.js +88 -8
  227. package/daemon/dist/domain/outbox-handler.js.map +1 -1
  228. package/daemon/dist/domain/park-wake-text.d.ts +18 -0
  229. package/daemon/dist/domain/park-wake-text.d.ts.map +1 -1
  230. package/daemon/dist/domain/park-wake-text.js +44 -0
  231. package/daemon/dist/domain/park-wake-text.js.map +1 -1
  232. package/daemon/dist/domain/policies/idle-gate-qitem.d.ts +3 -0
  233. package/daemon/dist/domain/policies/idle-gate-qitem.d.ts.map +1 -1
  234. package/daemon/dist/domain/policies/idle-gate-qitem.js +15 -0
  235. package/daemon/dist/domain/policies/idle-gate-qitem.js.map +1 -1
  236. package/daemon/dist/domain/policies/parked-owner-consumer.d.ts +6 -1
  237. package/daemon/dist/domain/policies/parked-owner-consumer.d.ts.map +1 -1
  238. package/daemon/dist/domain/policies/parked-owner-consumer.js +28 -1
  239. package/daemon/dist/domain/policies/parked-owner-consumer.js.map +1 -1
  240. package/daemon/dist/domain/process-limits.d.ts +21 -11
  241. package/daemon/dist/domain/process-limits.d.ts.map +1 -1
  242. package/daemon/dist/domain/process-limits.js +74 -20
  243. package/daemon/dist/domain/process-limits.js.map +1 -1
  244. package/daemon/dist/domain/process-table.d.ts +15 -0
  245. package/daemon/dist/domain/process-table.d.ts.map +1 -1
  246. package/daemon/dist/domain/process-table.js +39 -0
  247. package/daemon/dist/domain/process-table.js.map +1 -1
  248. package/daemon/dist/domain/queue-erasure.d.ts.map +1 -1
  249. package/daemon/dist/domain/queue-erasure.js +3 -0
  250. package/daemon/dist/domain/queue-erasure.js.map +1 -1
  251. package/daemon/dist/domain/queue-repository.d.ts +60 -7
  252. package/daemon/dist/domain/queue-repository.d.ts.map +1 -1
  253. package/daemon/dist/domain/queue-repository.js +178 -36
  254. package/daemon/dist/domain/queue-repository.js.map +1 -1
  255. package/daemon/dist/domain/queue-stuck-sweep.d.ts +2 -0
  256. package/daemon/dist/domain/queue-stuck-sweep.d.ts.map +1 -1
  257. package/daemon/dist/domain/queue-stuck-sweep.js +29 -0
  258. package/daemon/dist/domain/queue-stuck-sweep.js.map +1 -1
  259. package/daemon/dist/domain/queue-waiting.d.ts.map +1 -1
  260. package/daemon/dist/domain/queue-waiting.js +28 -3
  261. package/daemon/dist/domain/queue-waiting.js.map +1 -1
  262. package/daemon/dist/domain/queue-wake-ladder.d.ts +12 -0
  263. package/daemon/dist/domain/queue-wake-ladder.d.ts.map +1 -1
  264. package/daemon/dist/domain/queue-wake-ladder.js +115 -14
  265. package/daemon/dist/domain/queue-wake-ladder.js.map +1 -1
  266. package/daemon/dist/domain/queue-wake-repository.d.ts +8 -0
  267. package/daemon/dist/domain/queue-wake-repository.d.ts.map +1 -1
  268. package/daemon/dist/domain/queue-wake-repository.js +48 -8
  269. package/daemon/dist/domain/queue-wake-repository.js.map +1 -1
  270. package/daemon/dist/domain/reconciler.d.ts +18 -2
  271. package/daemon/dist/domain/reconciler.d.ts.map +1 -1
  272. package/daemon/dist/domain/reconciler.js +40 -0
  273. package/daemon/dist/domain/reconciler.js.map +1 -1
  274. package/daemon/dist/domain/restore-attempt-receipt.d.ts.map +1 -1
  275. package/daemon/dist/domain/restore-attempt-receipt.js +3 -2
  276. package/daemon/dist/domain/restore-attempt-receipt.js.map +1 -1
  277. package/daemon/dist/domain/restore-orchestrator.d.ts +5 -1
  278. package/daemon/dist/domain/restore-orchestrator.d.ts.map +1 -1
  279. package/daemon/dist/domain/restore-orchestrator.js +73 -8
  280. package/daemon/dist/domain/restore-orchestrator.js.map +1 -1
  281. package/daemon/dist/domain/restore-topology.d.ts +7 -1
  282. package/daemon/dist/domain/restore-topology.d.ts.map +1 -1
  283. package/daemon/dist/domain/restore-topology.js +21 -0
  284. package/daemon/dist/domain/restore-topology.js.map +1 -1
  285. package/daemon/dist/domain/resume-metadata-refresher.d.ts +2 -3
  286. package/daemon/dist/domain/resume-metadata-refresher.d.ts.map +1 -1
  287. package/daemon/dist/domain/resume-metadata-refresher.js +6 -25
  288. package/daemon/dist/domain/resume-metadata-refresher.js.map +1 -1
  289. package/daemon/dist/domain/rig-repository.d.ts.map +1 -1
  290. package/daemon/dist/domain/rig-repository.js +7 -6
  291. package/daemon/dist/domain/rig-repository.js.map +1 -1
  292. package/daemon/dist/domain/rig-teardown.d.ts +16 -3
  293. package/daemon/dist/domain/rig-teardown.d.ts.map +1 -1
  294. package/daemon/dist/domain/rig-teardown.js +73 -9
  295. package/daemon/dist/domain/rig-teardown.js.map +1 -1
  296. package/daemon/dist/domain/rigspec-exporter.js +2 -2
  297. package/daemon/dist/domain/rigspec-exporter.js.map +1 -1
  298. package/daemon/dist/domain/rigspec-instantiator.d.ts +5 -0
  299. package/daemon/dist/domain/rigspec-instantiator.d.ts.map +1 -1
  300. package/daemon/dist/domain/rigspec-instantiator.js +17 -7
  301. package/daemon/dist/domain/rigspec-instantiator.js.map +1 -1
  302. package/daemon/dist/domain/rosters.d.ts +11 -0
  303. package/daemon/dist/domain/rosters.d.ts.map +1 -1
  304. package/daemon/dist/domain/rosters.js +21 -2
  305. package/daemon/dist/domain/rosters.js.map +1 -1
  306. package/daemon/dist/domain/runner-channel.d.ts +35 -3
  307. package/daemon/dist/domain/runner-channel.d.ts.map +1 -1
  308. package/daemon/dist/domain/runner-channel.js +177 -8
  309. package/daemon/dist/domain/runner-channel.js.map +1 -1
  310. package/daemon/dist/domain/runner-permissions.d.ts +26 -3
  311. package/daemon/dist/domain/runner-permissions.d.ts.map +1 -1
  312. package/daemon/dist/domain/runner-permissions.js +160 -39
  313. package/daemon/dist/domain/runner-permissions.js.map +1 -1
  314. package/daemon/dist/domain/scope/mission-parent.d.ts +19 -0
  315. package/daemon/dist/domain/scope/mission-parent.d.ts.map +1 -0
  316. package/daemon/dist/domain/scope/mission-parent.js +134 -0
  317. package/daemon/dist/domain/scope/mission-parent.js.map +1 -0
  318. package/daemon/dist/domain/scope/scope-audit.d.ts.map +1 -1
  319. package/daemon/dist/domain/scope/scope-audit.js +8 -0
  320. package/daemon/dist/domain/scope/scope-audit.js.map +1 -1
  321. package/daemon/dist/domain/scope/types.d.ts +3 -1
  322. package/daemon/dist/domain/scope/types.d.ts.map +1 -1
  323. package/daemon/dist/domain/scope/types.js +5 -1
  324. package/daemon/dist/domain/scope/types.js.map +1 -1
  325. package/daemon/dist/domain/seat-delivery-guard.d.ts +14 -2
  326. package/daemon/dist/domain/seat-delivery-guard.d.ts.map +1 -1
  327. package/daemon/dist/domain/seat-delivery-guard.js +53 -14
  328. package/daemon/dist/domain/seat-delivery-guard.js.map +1 -1
  329. package/daemon/dist/domain/seat-handover-service.d.ts.map +1 -1
  330. package/daemon/dist/domain/seat-handover-service.js +9 -4
  331. package/daemon/dist/domain/seat-handover-service.js.map +1 -1
  332. package/daemon/dist/domain/seat-identity-reconciler.d.ts +4 -3
  333. package/daemon/dist/domain/seat-identity-reconciler.d.ts.map +1 -1
  334. package/daemon/dist/domain/seat-identity-reconciler.js +40 -5
  335. package/daemon/dist/domain/seat-identity-reconciler.js.map +1 -1
  336. package/daemon/dist/domain/seat-lifecycle-service.d.ts +14 -6
  337. package/daemon/dist/domain/seat-lifecycle-service.d.ts.map +1 -1
  338. package/daemon/dist/domain/seat-lifecycle-service.js +104 -22
  339. package/daemon/dist/domain/seat-lifecycle-service.js.map +1 -1
  340. package/daemon/dist/domain/seat-restart-in-place.d.ts.map +1 -1
  341. package/daemon/dist/domain/seat-restart-in-place.js +4 -1
  342. package/daemon/dist/domain/seat-restart-in-place.js.map +1 -1
  343. package/daemon/dist/domain/seat-runtime-switch-service.d.ts.map +1 -1
  344. package/daemon/dist/domain/seat-runtime-switch-service.js +2 -0
  345. package/daemon/dist/domain/seat-runtime-switch-service.js.map +1 -1
  346. package/daemon/dist/domain/seat-skill-apply.d.ts +1 -1
  347. package/daemon/dist/domain/seat-skill-apply.d.ts.map +1 -1
  348. package/daemon/dist/domain/seat-skill-apply.js +3 -2
  349. package/daemon/dist/domain/seat-skill-apply.js.map +1 -1
  350. package/daemon/dist/domain/session-registry.d.ts +5 -1
  351. package/daemon/dist/domain/session-registry.d.ts.map +1 -1
  352. package/daemon/dist/domain/session-registry.js +12 -1
  353. package/daemon/dist/domain/session-registry.js.map +1 -1
  354. package/daemon/dist/domain/session-transport.d.ts +40 -1
  355. package/daemon/dist/domain/session-transport.d.ts.map +1 -1
  356. package/daemon/dist/domain/session-transport.js +211 -10
  357. package/daemon/dist/domain/session-transport.js.map +1 -1
  358. package/daemon/dist/domain/shared-history-selection.d.ts.map +1 -1
  359. package/daemon/dist/domain/shared-history-selection.js +9 -5
  360. package/daemon/dist/domain/shared-history-selection.js.map +1 -1
  361. package/daemon/dist/domain/slices/slice-indexer.d.ts +1 -1
  362. package/daemon/dist/domain/slices/slice-indexer.d.ts.map +1 -1
  363. package/daemon/dist/domain/slices/slice-indexer.js +4 -0
  364. package/daemon/dist/domain/slices/slice-indexer.js.map +1 -1
  365. package/daemon/dist/domain/startup-orchestrator.d.ts +1 -0
  366. package/daemon/dist/domain/startup-orchestrator.d.ts.map +1 -1
  367. package/daemon/dist/domain/startup-orchestrator.js +6 -4
  368. package/daemon/dist/domain/startup-orchestrator.js.map +1 -1
  369. package/daemon/dist/domain/successor-session-launcher.d.ts.map +1 -1
  370. package/daemon/dist/domain/successor-session-launcher.js +10 -4
  371. package/daemon/dist/domain/successor-session-launcher.js.map +1 -1
  372. package/daemon/dist/domain/terminal/herdr-adapter.d.ts +35 -1
  373. package/daemon/dist/domain/terminal/herdr-adapter.d.ts.map +1 -1
  374. package/daemon/dist/domain/terminal/herdr-adapter.js +231 -33
  375. package/daemon/dist/domain/terminal/herdr-adapter.js.map +1 -1
  376. package/daemon/dist/domain/terminal/herdr-sessions.d.ts.map +1 -1
  377. package/daemon/dist/domain/terminal/herdr-sessions.js +2 -1
  378. package/daemon/dist/domain/terminal/herdr-sessions.js.map +1 -1
  379. package/daemon/dist/domain/terminal/rig-viewer-records.d.ts +59 -0
  380. package/daemon/dist/domain/terminal/rig-viewer-records.d.ts.map +1 -0
  381. package/daemon/dist/domain/terminal/rig-viewer-records.js +210 -0
  382. package/daemon/dist/domain/terminal/rig-viewer-records.js.map +1 -0
  383. package/daemon/dist/domain/terminal/terminal-provider.d.ts +2 -0
  384. package/daemon/dist/domain/terminal/terminal-provider.d.ts.map +1 -1
  385. package/daemon/dist/domain/terminal/terminal-service.d.ts +99 -4
  386. package/daemon/dist/domain/terminal/terminal-service.d.ts.map +1 -1
  387. package/daemon/dist/domain/terminal/terminal-service.js +556 -36
  388. package/daemon/dist/domain/terminal/terminal-service.js.map +1 -1
  389. package/daemon/dist/domain/terminal/tile-layout.js +1 -1
  390. package/daemon/dist/domain/terminal/tile-layout.js.map +1 -1
  391. package/daemon/dist/domain/terminal/tmux-viewer-guard.d.ts +25 -0
  392. package/daemon/dist/domain/terminal/tmux-viewer-guard.d.ts.map +1 -0
  393. package/daemon/dist/domain/terminal/tmux-viewer-guard.js +70 -0
  394. package/daemon/dist/domain/terminal/tmux-viewer-guard.js.map +1 -0
  395. package/daemon/dist/domain/transcript-grep-worker.d.ts +2 -0
  396. package/daemon/dist/domain/transcript-grep-worker.d.ts.map +1 -0
  397. package/daemon/dist/domain/transcript-grep-worker.js +108 -0
  398. package/daemon/dist/domain/transcript-grep-worker.js.map +1 -0
  399. package/daemon/dist/domain/transcript-grep.d.ts +26 -0
  400. package/daemon/dist/domain/transcript-grep.d.ts.map +1 -0
  401. package/daemon/dist/domain/transcript-grep.js +90 -0
  402. package/daemon/dist/domain/transcript-grep.js.map +1 -0
  403. package/daemon/dist/domain/transcript-store.d.ts +8 -2
  404. package/daemon/dist/domain/transcript-store.d.ts.map +1 -1
  405. package/daemon/dist/domain/transcript-store.js +10 -60
  406. package/daemon/dist/domain/transcript-store.js.map +1 -1
  407. package/daemon/dist/domain/types.d.ts +69 -2
  408. package/daemon/dist/domain/types.d.ts.map +1 -1
  409. package/daemon/dist/domain/types.js.map +1 -1
  410. package/daemon/dist/domain/watchdog-delivery-receipts.d.ts +4 -0
  411. package/daemon/dist/domain/watchdog-delivery-receipts.d.ts.map +1 -1
  412. package/daemon/dist/domain/watchdog-delivery-receipts.js +35 -2
  413. package/daemon/dist/domain/watchdog-delivery-receipts.js.map +1 -1
  414. package/daemon/dist/domain/watchdog-delivery.d.ts +44 -0
  415. package/daemon/dist/domain/watchdog-delivery.d.ts.map +1 -1
  416. package/daemon/dist/domain/watchdog-delivery.js +60 -2
  417. package/daemon/dist/domain/watchdog-delivery.js.map +1 -1
  418. package/daemon/dist/domain/watchdog-history-log.d.ts +12 -0
  419. package/daemon/dist/domain/watchdog-history-log.d.ts.map +1 -1
  420. package/daemon/dist/domain/watchdog-history-log.js +19 -1
  421. package/daemon/dist/domain/watchdog-history-log.js.map +1 -1
  422. package/daemon/dist/domain/watchdog-jobs-repository.d.ts +32 -0
  423. package/daemon/dist/domain/watchdog-jobs-repository.d.ts.map +1 -1
  424. package/daemon/dist/domain/watchdog-jobs-repository.js +78 -0
  425. package/daemon/dist/domain/watchdog-jobs-repository.js.map +1 -1
  426. package/daemon/dist/domain/watchdog-policy-engine.d.ts +17 -3
  427. package/daemon/dist/domain/watchdog-policy-engine.d.ts.map +1 -1
  428. package/daemon/dist/domain/watchdog-policy-engine.js +19 -5
  429. package/daemon/dist/domain/watchdog-policy-engine.js.map +1 -1
  430. package/daemon/dist/domain/workflow-projector.js +1 -1
  431. package/daemon/dist/domain/workflow-projector.js.map +1 -1
  432. package/daemon/dist/domain/workflow-runtime.d.ts +12 -0
  433. package/daemon/dist/domain/workflow-runtime.d.ts.map +1 -1
  434. package/daemon/dist/domain/workflow-runtime.js +64 -7
  435. package/daemon/dist/domain/workflow-runtime.js.map +1 -1
  436. package/daemon/dist/domain/workflow-step-trail-log.d.ts +2 -2
  437. package/daemon/dist/domain/workflow-step-trail-log.d.ts.map +1 -1
  438. package/daemon/dist/domain/workflow-step-trail-log.js.map +1 -1
  439. package/daemon/dist/domain/workflow-types.d.ts +3 -1
  440. package/daemon/dist/domain/workflow-types.d.ts.map +1 -1
  441. package/daemon/dist/domain/workflow-types.js.map +1 -1
  442. package/daemon/dist/index.d.ts.map +1 -1
  443. package/daemon/dist/index.js +5 -1
  444. package/daemon/dist/index.js.map +1 -1
  445. package/daemon/dist/lib/pane-envelope.d.ts +3 -0
  446. package/daemon/dist/lib/pane-envelope.d.ts.map +1 -1
  447. package/daemon/dist/lib/pane-envelope.js +3 -1
  448. package/daemon/dist/lib/pane-envelope.js.map +1 -1
  449. package/daemon/dist/mission-parent-surface.d.ts +2 -0
  450. package/daemon/dist/mission-parent-surface.d.ts.map +1 -0
  451. package/daemon/dist/mission-parent-surface.js +2 -0
  452. package/daemon/dist/mission-parent-surface.js.map +1 -0
  453. package/daemon/dist/routes/activity.d.ts +18 -1
  454. package/daemon/dist/routes/activity.d.ts.map +1 -1
  455. package/daemon/dist/routes/activity.js +47 -9
  456. package/daemon/dist/routes/activity.js.map +1 -1
  457. package/daemon/dist/routes/attention.d.ts.map +1 -1
  458. package/daemon/dist/routes/attention.js +194 -177
  459. package/daemon/dist/routes/attention.js.map +1 -1
  460. package/daemon/dist/routes/core-app.d.ts +10 -0
  461. package/daemon/dist/routes/core-app.d.ts.map +1 -0
  462. package/daemon/dist/routes/core-app.js +175 -0
  463. package/daemon/dist/routes/core-app.js.map +1 -0
  464. package/daemon/dist/routes/hook-bridge.d.ts +3 -0
  465. package/daemon/dist/routes/hook-bridge.d.ts.map +1 -0
  466. package/daemon/dist/routes/hook-bridge.js +158 -0
  467. package/daemon/dist/routes/hook-bridge.js.map +1 -0
  468. package/daemon/dist/routes/missions.d.ts.map +1 -1
  469. package/daemon/dist/routes/missions.js +14 -2
  470. package/daemon/dist/routes/missions.js.map +1 -1
  471. package/daemon/dist/routes/queue.d.ts +1 -1
  472. package/daemon/dist/routes/queue.d.ts.map +1 -1
  473. package/daemon/dist/routes/queue.js +8 -5
  474. package/daemon/dist/routes/queue.js.map +1 -1
  475. package/daemon/dist/routes/rigspec.js +1 -1
  476. package/daemon/dist/routes/rigspec.js.map +1 -1
  477. package/daemon/dist/routes/scope-audit.d.ts.map +1 -1
  478. package/daemon/dist/routes/scope-audit.js +7 -1
  479. package/daemon/dist/routes/scope-audit.js.map +1 -1
  480. package/daemon/dist/routes/seat.d.ts.map +1 -1
  481. package/daemon/dist/routes/seat.js +30 -4
  482. package/daemon/dist/routes/seat.js.map +1 -1
  483. package/daemon/dist/routes/slices.d.ts.map +1 -1
  484. package/daemon/dist/routes/slices.js +21 -2
  485. package/daemon/dist/routes/slices.js.map +1 -1
  486. package/daemon/dist/routes/startup.js +2 -1
  487. package/daemon/dist/routes/startup.js.map +1 -1
  488. package/daemon/dist/routes/terminal.d.ts.map +1 -1
  489. package/daemon/dist/routes/terminal.js +47 -6
  490. package/daemon/dist/routes/terminal.js.map +1 -1
  491. package/daemon/dist/routes/transcripts.d.ts.map +1 -1
  492. package/daemon/dist/routes/transcripts.js +16 -1
  493. package/daemon/dist/routes/transcripts.js.map +1 -1
  494. package/daemon/dist/routes/watchdog.d.ts.map +1 -1
  495. package/daemon/dist/routes/watchdog.js +3 -2
  496. package/daemon/dist/routes/watchdog.js.map +1 -1
  497. package/daemon/dist/routes/workflow.d.ts.map +1 -1
  498. package/daemon/dist/routes/workflow.js +5 -0
  499. package/daemon/dist/routes/workflow.js.map +1 -1
  500. package/daemon/dist/server.d.ts +2 -0
  501. package/daemon/dist/server.d.ts.map +1 -1
  502. package/daemon/dist/server.js +11 -0
  503. package/daemon/dist/server.js.map +1 -1
  504. package/daemon/dist/startup.d.ts.map +1 -1
  505. package/daemon/dist/startup.js +90 -33
  506. package/daemon/dist/startup.js.map +1 -1
  507. package/daemon/dist/terminal-viewer-guard-surface.d.ts +2 -0
  508. package/daemon/dist/terminal-viewer-guard-surface.d.ts.map +1 -0
  509. package/daemon/dist/terminal-viewer-guard-surface.js +2 -0
  510. package/daemon/dist/terminal-viewer-guard-surface.js.map +1 -0
  511. package/daemon/docs/reference/agent-startup-guide.md +4 -1
  512. package/daemon/docs/reference/claude-status-line.md +3 -2
  513. package/daemon/docs/reference/community-harness-examples/cursor/openrig-cursor-launch +6 -0
  514. package/daemon/docs/reference/community-harness-examples/dsh/README.md +1 -1
  515. package/daemon/docs/reference/community-harness-examples/dsh/openrig-dsh-runner.mjs +186 -30
  516. package/daemon/docs/reference/community-harness-examples/hermes/openrig-hermes-launch +6 -0
  517. package/daemon/docs/reference/community-harness-examples/openclaw/openrig-openclaw-launch +6 -0
  518. package/daemon/docs/reference/community-harness-examples/openshell/README.md +2 -0
  519. package/daemon/docs/reference/community-harness-examples/pi-tui/openrig-pi-tui-launch +6 -0
  520. package/daemon/docs/reference/community-harness-presets.md +6 -5
  521. package/daemon/docs/reference/core-app.md +212 -0
  522. package/daemon/docs/reference/daemon-http-clients.md +6 -0
  523. package/daemon/docs/reference/getting-started.md +9 -4
  524. package/daemon/docs/reference/harness-runner-contract.md +50 -4
  525. package/daemon/docs/reference/hosted-members.md +21 -1
  526. package/daemon/docs/reference/quickstart.md +4 -3
  527. package/daemon/docs/reference/rig-spec.md +56 -26
  528. package/daemon/docs/reference/rosters.md +8 -0
  529. package/daemon/docs/reference/sdlc-conventions.md +42 -5
  530. package/daemon/docs/reference/seat-delivery.md +87 -6
  531. package/daemon/docs/reference/terminal-sessions.md +99 -1
  532. package/daemon/docs/reference/whats-new.md +82 -11
  533. package/daemon/specs/rigs/launch/factory/guidance/lead-first-move.md +4 -3
  534. package/daemon/specs/rigs/launch/kernel/agents/operator/agent/guidance/role.md +13 -3
  535. package/daemon/specs/rigs/launch/starter/guidance/lead-first-move.md +4 -3
  536. package/dist/ask-wake.d.ts.map +1 -1
  537. package/dist/ask-wake.js +8 -1
  538. package/dist/ask-wake.js.map +1 -1
  539. package/dist/build-info.js +3 -3
  540. package/dist/commands/archive.js +1 -1
  541. package/dist/commands/archive.js.map +1 -1
  542. package/dist/commands/daemon.d.ts.map +1 -1
  543. package/dist/commands/daemon.js +7 -0
  544. package/dist/commands/daemon.js.map +1 -1
  545. package/dist/commands/down.d.ts.map +1 -1
  546. package/dist/commands/down.js +5 -0
  547. package/dist/commands/down.js.map +1 -1
  548. package/dist/commands/ps.d.ts +2 -1
  549. package/dist/commands/ps.d.ts.map +1 -1
  550. package/dist/commands/ps.js +9 -4
  551. package/dist/commands/ps.js.map +1 -1
  552. package/dist/commands/queue.js +4 -4
  553. package/dist/commands/queue.js.map +1 -1
  554. package/dist/commands/roster.d.ts +5 -0
  555. package/dist/commands/roster.d.ts.map +1 -1
  556. package/dist/commands/scope.d.ts.map +1 -1
  557. package/dist/commands/scope.js +346 -9
  558. package/dist/commands/scope.js.map +1 -1
  559. package/dist/commands/seat.d.ts.map +1 -1
  560. package/dist/commands/seat.js +90 -8
  561. package/dist/commands/seat.js.map +1 -1
  562. package/dist/commands/send.d.ts +2 -0
  563. package/dist/commands/send.d.ts.map +1 -1
  564. package/dist/commands/send.js +3 -1
  565. package/dist/commands/send.js.map +1 -1
  566. package/dist/commands/terminal.d.ts +56 -0
  567. package/dist/commands/terminal.d.ts.map +1 -1
  568. package/dist/commands/terminal.js +194 -4
  569. package/dist/commands/terminal.js.map +1 -1
  570. package/dist/commands/transcript.js +1 -1
  571. package/dist/commands/transcript.js.map +1 -1
  572. package/dist/commands/unarchive.js +1 -1
  573. package/dist/commands/unarchive.js.map +1 -1
  574. package/dist/commands/workflow-follow.d.ts +3 -1
  575. package/dist/commands/workflow-follow.d.ts.map +1 -1
  576. package/dist/commands/workflow-follow.js +25 -6
  577. package/dist/commands/workflow-follow.js.map +1 -1
  578. package/dist/commands/workflow-render.d.ts.map +1 -1
  579. package/dist/commands/workflow-render.js +5 -1
  580. package/dist/commands/workflow-render.js.map +1 -1
  581. package/dist/commands/workflow.d.ts.map +1 -1
  582. package/dist/commands/workflow.js +14 -4
  583. package/dist/commands/workflow.js.map +1 -1
  584. package/dist/daemon-lifecycle.d.ts.map +1 -1
  585. package/dist/daemon-lifecycle.js +11 -0
  586. package/dist/daemon-lifecycle.js.map +1 -1
  587. package/dist/lib/scope/mission-composition.d.ts +1 -0
  588. package/dist/lib/scope/mission-composition.d.ts.map +1 -1
  589. package/dist/lib/scope/mission-composition.js +14 -0
  590. package/dist/lib/scope/mission-composition.js.map +1 -1
  591. package/dist/lib/scope/scope-audit.d.ts.map +1 -1
  592. package/dist/lib/scope/scope-audit.js +8 -0
  593. package/dist/lib/scope/scope-audit.js.map +1 -1
  594. package/dist/lib/scope/scope-fs.d.ts +10 -0
  595. package/dist/lib/scope/scope-fs.d.ts.map +1 -1
  596. package/dist/lib/scope/scope-fs.js +60 -0
  597. package/dist/lib/scope/scope-fs.js.map +1 -1
  598. package/dist/lib/scope/types.d.ts +3 -1
  599. package/dist/lib/scope/types.d.ts.map +1 -1
  600. package/dist/lib/scope/types.js +5 -1
  601. package/dist/lib/scope/types.js.map +1 -1
  602. package/dist/mcp-server.d.ts.map +1 -1
  603. package/dist/mcp-server.js +18 -8
  604. package/dist/mcp-server.js.map +1 -1
  605. package/dist/restore-packet/packet-writer.d.ts.map +1 -1
  606. package/dist/restore-packet/packet-writer.js +8 -5
  607. package/dist/restore-packet/packet-writer.js.map +1 -1
  608. package/dist/terminal-window.d.ts +2 -1
  609. package/dist/terminal-window.d.ts.map +1 -1
  610. package/dist/terminal-window.js +567 -41
  611. package/dist/terminal-window.js.map +1 -1
  612. package/package.json +1 -1
  613. package/tui/dist/daemon-client.d.ts +4 -0
  614. package/tui/dist/daemon-client.d.ts.map +1 -1
  615. package/tui/dist/daemon-client.js.map +1 -1
  616. package/tui/dist/execution/execution-model.d.ts.map +1 -1
  617. package/tui/dist/execution/execution-model.js +22 -5
  618. package/tui/dist/execution/execution-model.js.map +1 -1
  619. package/tui/dist/hydrate.d.ts.map +1 -1
  620. package/tui/dist/hydrate.js +6 -3
  621. package/tui/dist/hydrate.js.map +1 -1
  622. package/tui/dist/navigator.d.ts +1 -1
  623. package/tui/dist/navigator.d.ts.map +1 -1
  624. package/tui/dist/navigator.js +4 -2
  625. package/tui/dist/navigator.js.map +1 -1
  626. package/tui/dist/pulse/render-pulse.d.ts.map +1 -1
  627. package/tui/dist/pulse/render-pulse.js +7 -14
  628. package/tui/dist/pulse/render-pulse.js.map +1 -1
  629. package/tui/dist/render.d.ts.map +1 -1
  630. package/tui/dist/render.js +29 -21
  631. package/tui/dist/render.js.map +1 -1
  632. package/tui/dist/stylize.d.ts.map +1 -1
  633. package/tui/dist/stylize.js +3 -3
  634. package/tui/dist/stylize.js.map +1 -1
  635. package/tui/dist/terminals/terminal-model.d.ts +1 -0
  636. package/tui/dist/terminals/terminal-model.d.ts.map +1 -1
  637. package/tui/dist/terminals/terminal-model.js +4 -2
  638. package/tui/dist/terminals/terminal-model.js.map +1 -1
  639. package/tui/dist/types.d.ts +1 -0
  640. package/tui/dist/types.d.ts.map +1 -1
  641. package/tui/dist/visual-layout.d.ts +3 -0
  642. package/tui/dist/visual-layout.d.ts.map +1 -1
  643. package/tui/dist/visual-layout.js +17 -0
  644. package/tui/dist/visual-layout.js.map +1 -1
  645. package/ui/dist/assets/{index-1O1f3A7K.js → index-B-sMy02c.js} +107 -107
  646. package/ui/dist/assets/{index-BX8TUZ0E.css → index-DiN7RwWg.css} +1 -1
  647. package/ui/dist/index.html +2 -2
@@ -8,20 +8,22 @@
8
8
  import fs from "node:fs";
9
9
  import path from "node:path";
10
10
  import { Command } from "commander";
11
+ import YAML from "yaml";
12
+ import { readParentScope, validateMissionParent } from "../../daemon/dist/mission-parent-surface.js";
11
13
  import { DaemonClient } from "../client.js";
12
14
  import { attestationLineage } from "../lib/scope/attestation-lineage.js";
13
15
  import { getDaemonStatus, getDaemonUrl, statusGuardMessage } from "../daemon-lifecycle.js";
14
16
  import { renderDaemonTransportError } from "../cli-error.js";
15
17
  import { daemonMayAnswer } from "../daemon-reachability.js";
16
18
  import { realDeps } from "./daemon.js";
17
- import { CLOSE_REASONS, MISSION_TEMPLATE_KINDS, SLICE_TEMPLATE_KINDS, STAGE_VALUES, ScopeCliError, } from "../lib/scope/types.js";
19
+ import { CLOSE_REASONS, MISSION_TEMPLATE_KINDS, NON_DELIVERY_CLOSE_REASONS, SLICE_TEMPLATE_KINDS, STAGE_VALUES, ScopeCliError, } from "../lib/scope/types.js";
18
20
  import { DEFAULT_PROJECT_PREFIX, inferMissionDotId, isMissionDotId, isSliceDotId, nextEscapeBandOrdinal, sliceIdFromMission, } from "../lib/scope/dot-id.js";
19
- import { buildMissionDependencyGraph, ensureMissionId, ensureMissionIdPersisted, findMission, resolveNodeFile, findSlice, listMissions, listSlices, moveSlice, rollbackMovedSlice, nextSliceNN, tryClaimSliceNN, NOTES_FILE_PRECEDENCE, pad2, readFrontmatter, resolveNotesFile, readProjectMissionsRoot, resolveMissionsRoot, splitFrontmatter, todayDateISO, updateFrontmatter, } from "../lib/scope/scope-fs.js";
21
+ import { buildMissionDependencyGraph, ensureMissionId, ensureMissionIdPersisted, findMission, indexerReadsStatusIn, readIndexerSliceStatus, resolveNodeFile, findSlice, listMissions, listSlices, moveSlice, rollbackMovedSlice, nextSliceNN, tryClaimSliceNN, NOTES_FILE_PRECEDENCE, pad2, readFrontmatter, resolveNotesFile, readProjectMissionsRoot, resolveMissionsRoot, splitFrontmatter, todayDateISO, updateFrontmatter, } from "../lib/scope/scope-fs.js";
20
22
  import { renderCapabilityDeltaTemplate, renderNotesTemplate, renderMissionProgressTemplate, renderMissionTemplate, renderSliceProofTemplate, renderSliceProgressTemplate, renderSliceTemplate, titleFromSlug, } from "../lib/scope/templates.js";
21
23
  import { addProgressRow, DEFAULT_PROGRESS_SECTION, parseStatus, PROGRESS_STATUSES, setProgressRow, } from "../lib/scope/progress-edit.js";
22
24
  import { deriveScopeTrust } from "../lib/scope/trust.js";
23
25
  import { capabilityDeltaExpiryFindings } from "../lib/scope/capability-delta.js";
24
- import { applyMissionCompositionEdits, appendMissionMembership, nextMissionMembershipOrder, planMissionMembershipAdd, planMissionMembershipRemove, } from "../lib/scope/mission-composition.js";
26
+ import { applyMissionCompositionEdits, appendMissionMembership, nextMissionMembershipOrder, planMissionMembershipAdd, planMissionMembershipRemove, planMissionMembershipSetActive, } from "../lib/scope/mission-composition.js";
25
27
  function makeStdout() {
26
28
  return { write: (text) => process.stdout.write(text) };
27
29
  }
@@ -190,6 +192,9 @@ function buildSliceShowCommand() {
190
192
  .map((e) => ({ name: e.name, kind: e.isDirectory() ? "dir" : "file" }));
191
193
  // FR-5: derive read-time trust from (stage x verified) — NEVER stored.
192
194
  const trust = deriveScopeTrust(slice.frontmatter);
195
+ const parentWarnings = [];
196
+ const scopeNodes = readParentScope(missionsRoot, { onInvalid: (message) => parentWarnings.push(message) });
197
+ const childMissions = slice.id && scopeNodes.filter((node) => node.id === slice.id).length === 1 ? scopeNodes.filter((node) => node.kind === "mission" && node.parent === slice.id) : [];
193
198
  const payload = {
194
199
  ok: true,
195
200
  slice: {
@@ -202,6 +207,8 @@ function buildSliceShowCommand() {
202
207
  trust,
203
208
  readme,
204
209
  children,
210
+ childMissions,
211
+ parentWarnings,
205
212
  },
206
213
  };
207
214
  if (json) {
@@ -214,6 +221,10 @@ function buildSliceShowCommand() {
214
221
  out.write(formatTrustLine(trust));
215
222
  out.write(` path: ${slice.absPath}\n`);
216
223
  out.write(` children: ${children.length}\n`);
224
+ for (const warning of parentWarnings)
225
+ out.write(` warning: ${warning}\n`);
226
+ if (childMissions.length)
227
+ out.write(` child missions: ${childMissions.map((node) => node.name).join(", ")}\n`);
217
228
  if (readme) {
218
229
  out.write("\n--- README ---\n");
219
230
  out.write(readme);
@@ -461,11 +472,25 @@ function buildSliceShipCommand() {
461
472
  // ---------------------------------------------------------------------
462
473
  // rig scope slice close
463
474
  // ---------------------------------------------------------------------
475
+ /** How many judgment files the slice records, or `null` when the judgments folder cannot be read (unknown, not zero).
476
+ * A folder that does not exist records none. */
477
+ function countRecordedSliceJudgments(sliceAbsPath) {
478
+ const judgmentsDir = path.join(sliceAbsPath, "proof", "judgments");
479
+ try {
480
+ return fs.readdirSync(judgmentsDir, { withFileTypes: true })
481
+ .filter((entry) => entry.isFile() && entry.name.toLowerCase().endsWith(".md"))
482
+ .length;
483
+ }
484
+ catch (err) {
485
+ return err.code === "ENOENT" ? 0 : null;
486
+ }
487
+ }
464
488
  function buildSliceCloseCommand() {
465
489
  return new Command("close")
466
- .description("Close a slice (move to <mission>/closed/, update status)")
490
+ .description("Close a slice (move to <mission>/closed/ by default, or update status in place with --in-place)")
467
491
  .argument("<slice-path>", "Slice path (absolute, relative, or NN-slug)")
468
492
  .requiredOption("--reason <reason>", `Closure reason: ${CLOSE_REASONS.join(" | ")}`)
493
+ .option("--in-place", "Keep the slice under <mission>/slices/ instead of moving to <mission>/closed/")
469
494
  .option("--note <text>", "Optional closure note")
470
495
  .option("--mission <name>", "Hint mission when slice-path is just NN-slug")
471
496
  .option("--json", "Machine-readable output")
@@ -473,6 +498,7 @@ function buildSliceCloseCommand() {
473
498
  const out = makeStdout();
474
499
  const json = Boolean(opts.json);
475
500
  try {
501
+ const inPlace = Boolean(opts.inPlace);
476
502
  const reason = opts.reason;
477
503
  if (!CLOSE_REASONS.includes(reason)) {
478
504
  throw new ScopeCliError({
@@ -481,10 +507,161 @@ function buildSliceCloseCommand() {
481
507
  action: `Pick one of: ${CLOSE_REASONS.join(", ")}.`,
482
508
  });
483
509
  }
510
+ if (!inPlace && reason === "delivered") {
511
+ throw new ScopeCliError({
512
+ fact: `--reason "delivered" requires --in-place.`,
513
+ consequence: "Slice not closed; moving to closed/ is reserved for non-delivery closures.",
514
+ action: `Pass --in-place with --reason delivered, or use rig scope slice ship, or pick a non-delivery reason (${NON_DELIVERY_CLOSE_REASONS.join(", ")}).`,
515
+ });
516
+ }
484
517
  const missionsRoot = resolveMissionsRoot({ override: getOpts(command).workspace });
485
518
  const slice = findSlice(missionsRoot, slicePath, opts.mission ?? null);
486
519
  const mission = findMission(missionsRoot, slice.missionName);
487
520
  const closedDir = path.join(mission.absPath, "closed");
521
+ const judgmentCount = countRecordedSliceJudgments(slice.absPath);
522
+ if (inPlace) {
523
+ const resolvedSliceAbs = path.resolve(slice.absPath);
524
+ const resolvedClosedDir = path.resolve(closedDir);
525
+ if (resolvedSliceAbs === resolvedClosedDir || resolvedSliceAbs.startsWith(`${resolvedClosedDir}${path.sep}`)) {
526
+ throw new ScopeCliError({
527
+ fact: `Slice "${slice.name}" is already under ${slice.missionName}/closed/.`,
528
+ consequence: "Slice not closed in place.",
529
+ action: "Inspect the slice under closed/, or move it back under slices/ before updating in place.",
530
+ });
531
+ }
532
+ if (!slice.readmePath) {
533
+ throw new ScopeCliError({
534
+ fact: `Slice "${slice.name}" at ${slice.absPath} has no SPEC.md or README.md.`,
535
+ consequence: "Cannot record in-place closure status without a slice node file.",
536
+ action: "Repair or add SPEC.md before closing --in-place.",
537
+ });
538
+ }
539
+ const targetStatus = reason === "delivered" ? "done" : `closed-${reason}`;
540
+ const compositionEdit = planMissionMembershipSetActive(mission.absPath, sliceManifestRef(mission.absPath, slice.absPath), reason === "delivered");
541
+ const edits = compositionEdit ? [compositionEdit] : [];
542
+ const nodePath = slice.readmePath;
543
+ const originalNode = fs.readFileSync(nodePath, "utf8");
544
+ const progressPath = path.join(slice.absPath, "PROGRESS.md");
545
+ let originalProgress = null;
546
+ try {
547
+ originalProgress = fs.readFileSync(progressPath, "utf8");
548
+ }
549
+ catch (err) {
550
+ if (err.code !== "ENOENT")
551
+ throw err;
552
+ }
553
+ // The slice indexer lets PROGRESS.md override the node file, so a status it reads there is reconciled too.
554
+ const shouldReconcileProgressStatus = originalProgress !== null && indexerReadsStatusIn(originalProgress);
555
+ applyMissionCompositionEdits(edits);
556
+ let attemptedProgressWrite = false;
557
+ let readBackMismatch = null;
558
+ try {
559
+ const updates = {
560
+ status: targetStatus,
561
+ "closed-on": todayDateISO(),
562
+ };
563
+ if (opts.note)
564
+ updates["closure-note"] = opts.note;
565
+ updateFrontmatter(nodePath, updates);
566
+ if (shouldReconcileProgressStatus) {
567
+ attemptedProgressWrite = true;
568
+ updateFrontmatter(progressPath, { status: targetStatus });
569
+ }
570
+ // Read the status back the way the slice indexer does; a shape that reads differently rolls everything back.
571
+ const readBack = readIndexerSliceStatus(slice.absPath);
572
+ if (readBack.status !== targetStatus) {
573
+ const readFile = readBack.file ?? nodePath;
574
+ readBackMismatch = new ScopeCliError({
575
+ fact: `After writing status "${targetStatus}", the slice indexer reads ${readBack.status === null ? "no status" : `"${readBack.status}"`} from ${readFile}.`,
576
+ consequence: "In-place closure refused.",
577
+ action: `Give ${path.basename(readFile)} one top-level scalar "status:" line, with no inline "#" comment and no duplicate or nested "status:" entry, or close without --in-place, then retry.`,
578
+ });
579
+ throw readBackMismatch;
580
+ }
581
+ }
582
+ catch (error) {
583
+ const rollbackFailures = [];
584
+ try {
585
+ fs.writeFileSync(nodePath, originalNode, "utf8");
586
+ }
587
+ catch (rbErr) {
588
+ rollbackFailures.push(`restore ${nodePath}: ${rbErr instanceof Error ? rbErr.message : String(rbErr)}`);
589
+ }
590
+ if (attemptedProgressWrite && originalProgress !== null) {
591
+ try {
592
+ fs.writeFileSync(progressPath, originalProgress, "utf8");
593
+ }
594
+ catch (rbErr) {
595
+ rollbackFailures.push(`restore ${progressPath}: ${rbErr instanceof Error ? rbErr.message : String(rbErr)}`);
596
+ }
597
+ }
598
+ if (edits.length > 0) {
599
+ try {
600
+ rollbackComposition(edits);
601
+ }
602
+ catch (rbErr) {
603
+ rollbackFailures.push(`rollback mission composition: ${rbErr instanceof Error ? rbErr.message : String(rbErr)}`);
604
+ }
605
+ }
606
+ if (rollbackFailures.length > 0) {
607
+ if (error instanceof ScopeCliError) {
608
+ // Never promise restoration here: the slice may be left partly changed, and the failures below say where.
609
+ const stateKnown = error === readBackMismatch
610
+ ? ` Rollback did NOT complete (${rollbackFailures.join("; ")}). The slice's files and ${path.join(mission.absPath, "mission.yaml")} may be partly changed and their current state is unknown.`
611
+ : ` (rollback failure(s): ${rollbackFailures.join("; ")})`;
612
+ throw new ScopeCliError({
613
+ fact: error.fact,
614
+ consequence: `${error.consequence}${stateKnown}`,
615
+ action: error === readBackMismatch
616
+ ? `Inspect ${nodePath}, ${progressPath} and ${path.join(mission.absPath, "mission.yaml")} and repair any leftover change before closing this slice again. ${error.action}`
617
+ : error.action,
618
+ });
619
+ }
620
+ const origMessage = error instanceof Error ? error.message : String(error);
621
+ throw new Error(`${origMessage} (rollback failure(s): ${rollbackFailures.join("; ")})`, { cause: error });
622
+ }
623
+ if (error instanceof ScopeCliError && error === readBackMismatch) {
624
+ throw new ScopeCliError({
625
+ fact: error.fact,
626
+ consequence: "In-place closure rolled back: every file it changed was restored, so readers cannot disagree about this slice's status.",
627
+ action: error.action,
628
+ });
629
+ }
630
+ throw error;
631
+ }
632
+ emit(out, {
633
+ ok: true,
634
+ closed: {
635
+ mission: slice.missionName,
636
+ name: slice.name,
637
+ id: slice.id,
638
+ reason,
639
+ status: targetStatus,
640
+ inPlace: true,
641
+ note: opts.note ?? null,
642
+ path: slice.absPath,
643
+ git: { usedGit: false, repoRoot: null },
644
+ proofApplicability: {
645
+ evaluated: false,
646
+ changed: null,
647
+ pathPreserved: true,
648
+ receiptFilesPreserved: true,
649
+ judgmentCount,
650
+ },
651
+ },
652
+ }, json, [
653
+ `Closed ${slice.missionName}/${slice.name} in place (${targetStatus})`,
654
+ ` reason: ${reason}`,
655
+ ` status: ${targetStatus}`,
656
+ ` path: ${slice.absPath}`,
657
+ ...(judgmentCount === null
658
+ ? [" proof: judgment folder could not be read (judgment count unknown; applicability not evaluated; run rig proof show to check current readiness)"]
659
+ : judgmentCount > 0
660
+ ? [` proof: ${judgmentCount} recorded judgment file(s) kept in place (applicability not evaluated; run rig proof show to check current readiness)`]
661
+ : []),
662
+ ]);
663
+ return;
664
+ }
488
665
  const destName = slice.name;
489
666
  const destAbs = path.join(closedDir, destName);
490
667
  const compositionEdit = planMissionMembershipRemove(mission.absPath, sliceManifestRef(mission.absPath, slice.absPath));
@@ -501,10 +678,11 @@ function buildSliceCloseCommand() {
501
678
  }
502
679
  const { usedGit, repoRoot } = moveResult;
503
680
  const newReadme = resolveNodeFile(destAbs);
681
+ const targetStatus = `closed-${reason}`;
504
682
  try {
505
683
  if (newReadme) {
506
684
  const updates = {
507
- status: `closed-${reason}`,
685
+ status: targetStatus,
508
686
  "closed-on": todayDateISO(),
509
687
  };
510
688
  if (opts.note)
@@ -526,14 +704,28 @@ function buildSliceCloseCommand() {
526
704
  name: destName,
527
705
  id: slice.id,
528
706
  reason,
707
+ status: targetStatus,
708
+ inPlace: false,
529
709
  note: opts.note ?? null,
530
710
  path: destAbs,
531
711
  git: { usedGit, repoRoot },
712
+ proofApplicability: {
713
+ evaluated: false,
714
+ changed: judgmentCount === null ? null : judgmentCount > 0,
715
+ pathPreserved: false,
716
+ receiptFilesPreserved: true,
717
+ judgmentCount,
718
+ },
532
719
  },
533
720
  }, json, [
534
721
  `Closed ${slice.missionName}/${slice.name} → ${slice.missionName}/closed/${destName}`,
535
722
  ` reason: ${reason}`,
536
723
  ` git: ${usedGit ? "git mv" : "fs.rename (not in a git repo)"}`,
724
+ ...(judgmentCount === null
725
+ ? [" proof: judgment folder could not be read, so recorded judgments (if any) now read unknown after path move (use --in-place to keep slice path in place; accepted proof still requires unchanged item, policy, and cited evidence)"]
726
+ : judgmentCount > 0
727
+ ? [` proof: ${judgmentCount} recorded judgment(s) now read unknown after path move (use --in-place to keep slice path in place; accepted proof still requires unchanged item, policy, and cited evidence)`]
728
+ : []),
537
729
  ]);
538
730
  }
539
731
  catch (err) {
@@ -673,6 +865,40 @@ function buildMissionShowCommand() {
673
865
  }));
674
866
  // FR-5: derive read-time trust from (stage x verified) — NEVER stored.
675
867
  const trust = deriveScopeTrust(mission.frontmatter);
868
+ const parentWarnings = [];
869
+ const scopeNodes = readParentScope(missionsRoot, { onInvalid: (message) => parentWarnings.push(message) });
870
+ const own = scopeNodes.find((node) => node.kind === "mission" && node.path === mission.absPath);
871
+ const parentMatches = own?.parent ? scopeNodes.filter((node) => node.id === own.parent) : [];
872
+ const parent = parentMatches.length === 1 ? parentMatches[0] : null;
873
+ const parentChain = [];
874
+ let parentGap = null;
875
+ const seenParents = new Set();
876
+ let currentParent = own;
877
+ while (currentParent?.parent) {
878
+ const matches = scopeNodes.filter((node) => node.id === currentParent.parent);
879
+ if (matches.length !== 1) {
880
+ parentGap = `${currentParent.parent} does not resolve uniquely`;
881
+ break;
882
+ }
883
+ const next = matches[0];
884
+ if (seenParents.has(next.id) || next.id === own?.id) {
885
+ parentGap = `cycle at ${next.id}`;
886
+ break;
887
+ }
888
+ seenParents.add(next.id);
889
+ parentChain.push(next);
890
+ if (next.kind === "slice") {
891
+ const owners = scopeNodes.filter((node) => node.kind === "mission" && node.id === next.missionId);
892
+ if (owners.length !== 1) {
893
+ parentGap = `${next.missionId} does not resolve uniquely`;
894
+ break;
895
+ }
896
+ currentParent = owners[0];
897
+ }
898
+ else
899
+ currentParent = next;
900
+ }
901
+ const childMissions = mission.id && scopeNodes.filter((node) => node.id === mission.id).length === 1 ? scopeNodes.filter((node) => node.kind === "mission" && node.parent === mission.id) : [];
676
902
  const payload = {
677
903
  ok: true,
678
904
  mission: {
@@ -686,6 +912,12 @@ function buildMissionShowCommand() {
686
912
  trust,
687
913
  readme,
688
914
  slices,
915
+ parent,
916
+ parentId: own?.parent ?? null,
917
+ parentChain,
918
+ parentGap,
919
+ parentWarnings,
920
+ childMissions,
689
921
  },
690
922
  };
691
923
  if (json) {
@@ -694,6 +926,12 @@ function buildMissionShowCommand() {
694
926
  else {
695
927
  out.write(`Mission: ${mission.name}\n`);
696
928
  out.write(` id: ${mission.id ?? "—"}\n`);
929
+ if (own?.parent)
930
+ out.write(` parent: ${parent?.name ?? own.parent} (${own.parent})\n`);
931
+ for (const warning of parentWarnings)
932
+ out.write(` warning: ${warning}\n`);
933
+ if (childMissions.length)
934
+ out.write(` child missions: ${childMissions.map((node) => node.name).join(", ")}\n`);
697
935
  out.write(formatTrustLine(trust));
698
936
  out.write(` active slices: ${mission.activeSliceCount}\n`);
699
937
  out.write(` shipped slices: ${mission.shippedSliceCount}\n`);
@@ -758,6 +996,7 @@ function buildMissionCreateCommand() {
758
996
  .option("--title <text>", "Display title (defaults to titlecased name)")
759
997
  .option("--intent <text>", "Authored intent stored in SPEC.md frontmatter (defaults to title)")
760
998
  .option("--depends-on <dot-id...>", "Advisory build-order dependencies on sibling mission dot-IDs")
999
+ .option("--parent <dot-id>", "Mission or slice this mission breaks down")
761
1000
  .option("--no-notes", "Skip NOTES.md scaffolding")
762
1001
  .option("--no-mission-notes", "Deprecated alias for --no-notes")
763
1002
  .option("--json", "Machine-readable output")
@@ -826,6 +1065,13 @@ function buildMissionCreateCommand() {
826
1065
  const title = opts.title ?? titleFromSlug(name.replace(/^release-/, ""));
827
1066
  const intent = opts.intent ?? title;
828
1067
  const dependsOn = Array.isArray(opts.dependsOn) ? [...new Set(opts.dependsOn)] : [];
1068
+ const parentWarnings = [];
1069
+ if (opts.parent !== undefined) {
1070
+ const nodes = readParentScope(missionsRoot, { onInvalid: (message) => parentWarnings.push(message) });
1071
+ for (const node of nodes.filter((node) => node.id === id))
1072
+ parentWarnings.push(`Mission ID ${id} is already in use at ${node.path}.`);
1073
+ validateMissionParent(nodes, id, opts.parent, (message) => parentWarnings.push(message));
1074
+ }
829
1075
  const project = id.split(".")[0];
830
1076
  for (const dependency of dependsOn) {
831
1077
  if (dependency === id) {
@@ -881,7 +1127,13 @@ function buildMissionCreateCommand() {
881
1127
  // New scaffolds author SPEC.md; existing README-backed nodes are never rewritten.
882
1128
  const readmePath = path.join(absPath, "SPEC.md");
883
1129
  fs.writeFileSync(readmePath, readmeBody, "utf8");
884
- fs.writeFileSync(path.join(absPath, "mission.yaml"), missionManifest(name), "utf8");
1130
+ let manifestBody = missionManifest(name);
1131
+ if (opts.parent !== undefined) {
1132
+ const manifest = YAML.parseDocument(manifestBody);
1133
+ manifest.setIn(["metadata", "parent"], opts.parent);
1134
+ manifestBody = manifest.toString();
1135
+ }
1136
+ fs.writeFileSync(path.join(absPath, "mission.yaml"), manifestBody, "utf8");
885
1137
  const progressPath = path.join(absPath, "PROGRESS.md");
886
1138
  fs.writeFileSync(progressPath, progressBody, "utf8");
887
1139
  const capabilityDeltaPath = capabilityDeltaBody
@@ -908,6 +1160,7 @@ function buildMissionCreateCommand() {
908
1160
  humanLines.push(` capability delta: ${capabilityDeltaPath}`);
909
1161
  const advisories = [
910
1162
  ...rootAdvisories,
1163
+ ...parentWarnings,
911
1164
  ...(notesRendered?.resolvedFrom === "legacy-env"
912
1165
  ? ["OPENRIG_MISSION_NOTES_TEMPLATE_PATH is deprecated; use OPENRIG_NOTES_TEMPLATE_PATH"]
913
1166
  : []),
@@ -934,6 +1187,66 @@ function buildMissionCreateCommand() {
934
1187
  }
935
1188
  });
936
1189
  }
1190
+ function buildMissionParentCommand() {
1191
+ return new Command("parent")
1192
+ .description("Set or clear the mission or slice this mission breaks down")
1193
+ .argument("<mission>", "Mission name or path")
1194
+ .argument("[parent]", "Parent mission or slice dot-ID")
1195
+ .option("--clear", "Remove the parent link")
1196
+ .option("--json", "Machine-readable output")
1197
+ .action(async (name, parent, opts, command) => {
1198
+ const out = makeStdout(), json = Boolean(opts.json);
1199
+ try {
1200
+ if (Boolean(parent) === Boolean(opts.clear))
1201
+ throw new ScopeCliError({ fact: "Choose a parent ID or --clear.", consequence: "No parent was changed.", action: "Pass exactly one parent ID or --clear." });
1202
+ const root = resolveMissionsRoot({ override: getOpts(command).workspace, strictOverride: true });
1203
+ const mission = findMission(root, name);
1204
+ const realRoot = fs.realpathSync(root);
1205
+ const realMission = fs.realpathSync(mission.absPath);
1206
+ if (path.dirname(realMission) !== realRoot)
1207
+ throw new ScopeCliError({ fact: `Mission ${name} is outside the selected missions root.`, consequence: "No parent was changed.", action: "Select a mission inside the selected workspace." });
1208
+ const writeTarget = fs.existsSync(path.join(mission.absPath, "mission.yaml")) ? path.join(mission.absPath, "mission.yaml") : mission.readmePath;
1209
+ if (path.dirname(fs.realpathSync(writeTarget)) !== realMission)
1210
+ throw new ScopeCliError({ fact: `Mission file for ${name} is outside its directory.`, consequence: "No parent was changed.", action: "Use a mission whose authored files are inside its directory." });
1211
+ const warnings = [];
1212
+ if (parent) {
1213
+ const nodes = readParentScope(root, { onInvalid: (message) => warnings.push(message) });
1214
+ validateMissionParent(nodes, mission.id ?? "", parent, (message) => warnings.push(message));
1215
+ }
1216
+ const manifestPath = path.join(mission.absPath, "mission.yaml");
1217
+ if (fs.existsSync(manifestPath)) {
1218
+ const doc = YAML.parseDocument(fs.readFileSync(manifestPath, "utf8"));
1219
+ if (doc.errors.length)
1220
+ throw doc.errors[0];
1221
+ if (parent)
1222
+ doc.setIn(["metadata", "parent"], parent);
1223
+ else
1224
+ doc.deleteIn(["metadata", "parent"]);
1225
+ fs.writeFileSync(manifestPath, doc.toString(), "utf8");
1226
+ }
1227
+ else if (parent) {
1228
+ updateFrontmatter(mission.readmePath, { parent });
1229
+ }
1230
+ else {
1231
+ const original = fs.readFileSync(mission.readmePath, "utf8");
1232
+ const match = /^---[ \t]*\r?\n([\s\S]*?)\r?\n---[ \t]*(?=\r?\n|$)/.exec(original);
1233
+ if (match) {
1234
+ const doc = YAML.parseDocument(match[1]);
1235
+ if (doc.errors.length)
1236
+ updateFrontmatter(mission.readmePath, { parent: null });
1237
+ else {
1238
+ doc.delete("parent");
1239
+ fs.writeFileSync(mission.readmePath, `---\n${doc.toString()}---${original.slice(match[0].length)}`, "utf8");
1240
+ }
1241
+ }
1242
+ }
1243
+ emit(out, { ok: true, mission: mission.name, parent: parent ?? null, warnings }, json, [`Mission ${mission.name} parent: ${parent ?? "(none)"}`, ...warnings.map((message) => `Warning: ${message}`)]);
1244
+ }
1245
+ catch (err) {
1246
+ fail(err, json, out);
1247
+ }
1248
+ });
1249
+ }
937
1250
  function buildMissionGraphCommand() {
938
1251
  return new Command("graph")
939
1252
  .description("Show advisory sibling build-order edges and the current ready set")
@@ -1151,6 +1464,27 @@ function buildAuditCommand() {
1151
1464
  ...missionResult.findings.map((f) => ({ ...f, scope: "mission", scopeName: missionName })),
1152
1465
  ...sliceResults.flatMap((s) => s.result.findings.map((f) => ({ ...f, scope: "slice", scopeName: s.name }))),
1153
1466
  ];
1467
+ const parentFindings = [];
1468
+ const parentNodes = readParentScope(missionsRoot, { onInvalid: (message) => parentFindings.push(message) });
1469
+ const audited = parentNodes.find((node) => node.kind === "mission" && node.path === missionDir);
1470
+ if (audited?.parent) {
1471
+ try {
1472
+ validateMissionParent(parentNodes, audited.id ?? "", audited.parent, (message) => parentFindings.push(message));
1473
+ }
1474
+ catch (error) {
1475
+ parentFindings.push(error.message);
1476
+ }
1477
+ }
1478
+ if (audited) {
1479
+ const children = parentNodes.filter((node) => node.kind === "mission" && node.parent && (node.parent === audited.id || parentNodes.some((target) => target.kind === "slice" && target.missionId === audited.id && target.id === node.parent)));
1480
+ for (const child of children) {
1481
+ const target = parentNodes.filter((node) => node.id === child.parent);
1482
+ if (target.length !== 1)
1483
+ parentFindings.push(`Child ${child.id} has an ambiguous parent ${child.parent}.`);
1484
+ else if (target[0].kind === "slice" && /^(done|closed|shipped)(?:$|-)/.test(target[0].status ?? "") && ["active", "in-progress", "wip", "blocked"].includes(child.status ?? ""))
1485
+ parentFindings.push(`Child ${child.id} is active while parent slice ${child.parent} is complete.`);
1486
+ }
1487
+ }
1154
1488
  const hardFindings = allFindings.filter((f) => f.severity === "high");
1155
1489
  if (json) {
1156
1490
  out.write(JSON.stringify({
@@ -1164,8 +1498,8 @@ function buildAuditCommand() {
1164
1498
  // OPR.0.5.0.18 — amendment lineage (present only when re-stamped).
1165
1499
  ...(s.attestations ? { attestations: s.attestations } : {}),
1166
1500
  })),
1167
- graph,
1168
- totalFindings: allFindings.length,
1501
+ graph, parentFindings,
1502
+ totalFindings: allFindings.length + parentFindings.length,
1169
1503
  }, null, 2));
1170
1504
  out.write("\n");
1171
1505
  if (hardFindings.length > 0)
@@ -1195,6 +1529,8 @@ function buildAuditCommand() {
1195
1529
  }
1196
1530
  out.write("\n");
1197
1531
  }
1532
+ for (const finding of parentFindings)
1533
+ out.write(`PARENT LINK: ${finding}\n`);
1198
1534
  if (allFindings.length > 0) {
1199
1535
  out.write("FINDINGS:\n");
1200
1536
  for (const f of allFindings) {
@@ -1210,7 +1546,7 @@ function buildAuditCommand() {
1210
1546
  out.write(`\nWARN: ${allFindings.length} advisory finding(s)\n`);
1211
1547
  }
1212
1548
  }
1213
- else {
1549
+ else if (!parentFindings.length) {
1214
1550
  out.write("PASS: all scope items have valid rails\n");
1215
1551
  }
1216
1552
  }
@@ -2066,6 +2402,7 @@ export function scopeCommand() {
2066
2402
  mission.addCommand(buildMissionLsCommand());
2067
2403
  mission.addCommand(buildMissionShowCommand());
2068
2404
  mission.addCommand(buildMissionCreateCommand());
2405
+ mission.addCommand(buildMissionParentCommand());
2069
2406
  mission.addCommand(buildMissionGraphCommand());
2070
2407
  mission.addCommand(buildMissionProgressCommand());
2071
2408
  mission.addCommand(buildMissionRepairCommand());