@openrig/cli 0.4.3 → 0.4.6

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 (634) hide show
  1. package/daemon/assets/guidance/openrig-start.md +6 -0
  2. package/daemon/assets/plugins/openrig-core/skills/mission-slice-sop/SKILL.md +47 -21
  3. package/daemon/assets/plugins/openrig-core/skills/openrig-cmux/SKILL.md +86 -0
  4. package/daemon/assets/plugins/openrig-core/skills/openrig-herdr/SKILL.md +158 -0
  5. package/daemon/assets/plugins/openrig-core/skills/openrig-user/SKILL.md +742 -94
  6. package/daemon/dist/adapters/codex-runtime-adapter.d.ts.map +1 -1
  7. package/daemon/dist/adapters/codex-runtime-adapter.js +12 -8
  8. package/daemon/dist/adapters/codex-runtime-adapter.js.map +1 -1
  9. package/daemon/dist/adapters/pi-resume.d.ts +32 -0
  10. package/daemon/dist/adapters/pi-resume.d.ts.map +1 -0
  11. package/daemon/dist/adapters/pi-resume.js +125 -0
  12. package/daemon/dist/adapters/pi-resume.js.map +1 -0
  13. package/daemon/dist/adapters/pi-runner-protocol.d.ts +88 -0
  14. package/daemon/dist/adapters/pi-runner-protocol.d.ts.map +1 -0
  15. package/daemon/dist/adapters/pi-runner-protocol.js +153 -0
  16. package/daemon/dist/adapters/pi-runner-protocol.js.map +1 -0
  17. package/daemon/dist/adapters/pi-runner.d.ts +99 -0
  18. package/daemon/dist/adapters/pi-runner.d.ts.map +1 -0
  19. package/daemon/dist/adapters/pi-runner.js +519 -0
  20. package/daemon/dist/adapters/pi-runner.js.map +1 -0
  21. package/daemon/dist/adapters/pi-runtime-adapter.d.ts +61 -0
  22. package/daemon/dist/adapters/pi-runtime-adapter.d.ts.map +1 -0
  23. package/daemon/dist/adapters/pi-runtime-adapter.js +356 -0
  24. package/daemon/dist/adapters/pi-runtime-adapter.js.map +1 -0
  25. package/daemon/dist/adapters/tmux.d.ts +22 -1
  26. package/daemon/dist/adapters/tmux.d.ts.map +1 -1
  27. package/daemon/dist/adapters/tmux.js +40 -1
  28. package/daemon/dist/adapters/tmux.js.map +1 -1
  29. package/daemon/dist/build-info.d.ts +12 -0
  30. package/daemon/dist/build-info.d.ts.map +1 -0
  31. package/daemon/dist/build-info.js +11 -0
  32. package/daemon/dist/build-info.js.map +1 -0
  33. package/daemon/dist/builtins/workflow-specs/branched-remediation.yaml +31 -0
  34. package/daemon/dist/builtins/workflow-specs/factory-rsi.yaml +152 -0
  35. package/daemon/dist/builtins/workflow-specs/gated-release.yaml +26 -0
  36. package/daemon/dist/builtins/workflow-specs/linear-build.yaml +21 -0
  37. package/daemon/dist/db/migrations/048_queue_item_evidence_ref.d.ts +18 -0
  38. package/daemon/dist/db/migrations/048_queue_item_evidence_ref.d.ts.map +1 -0
  39. package/daemon/dist/db/migrations/048_queue_item_evidence_ref.js +22 -0
  40. package/daemon/dist/db/migrations/048_queue_item_evidence_ref.js.map +1 -0
  41. package/daemon/dist/db/migrations/049_workflow_instance_version.d.ts +20 -0
  42. package/daemon/dist/db/migrations/049_workflow_instance_version.d.ts.map +1 -0
  43. package/daemon/dist/db/migrations/049_workflow_instance_version.js +24 -0
  44. package/daemon/dist/db/migrations/049_workflow_instance_version.js.map +1 -0
  45. package/daemon/dist/db/migrations/050_workflow_spec_json.d.ts +22 -0
  46. package/daemon/dist/db/migrations/050_workflow_spec_json.d.ts.map +1 -0
  47. package/daemon/dist/db/migrations/050_workflow_spec_json.js +26 -0
  48. package/daemon/dist/db/migrations/050_workflow_spec_json.js.map +1 -0
  49. package/daemon/dist/db/migrations/051_workflow_resume.d.ts +22 -0
  50. package/daemon/dist/db/migrations/051_workflow_resume.d.ts.map +1 -0
  51. package/daemon/dist/db/migrations/051_workflow_resume.js +27 -0
  52. package/daemon/dist/db/migrations/051_workflow_resume.js.map +1 -0
  53. package/daemon/dist/db/migrations/052_workflow_instance_bound_rig.d.ts +26 -0
  54. package/daemon/dist/db/migrations/052_workflow_instance_bound_rig.d.ts.map +1 -0
  55. package/daemon/dist/db/migrations/052_workflow_instance_bound_rig.js +30 -0
  56. package/daemon/dist/db/migrations/052_workflow_instance_bound_rig.js.map +1 -0
  57. package/daemon/dist/db/migrations/053_sessions_node_id_index.d.ts +48 -0
  58. package/daemon/dist/db/migrations/053_sessions_node_id_index.d.ts.map +1 -0
  59. package/daemon/dist/db/migrations/053_sessions_node_id_index.js +53 -0
  60. package/daemon/dist/db/migrations/053_sessions_node_id_index.js.map +1 -0
  61. package/daemon/dist/db/migrations/054_queue_transitions_archive.d.ts +34 -0
  62. package/daemon/dist/db/migrations/054_queue_transitions_archive.d.ts.map +1 -0
  63. package/daemon/dist/db/migrations/054_queue_transitions_archive.js +49 -0
  64. package/daemon/dist/db/migrations/054_queue_transitions_archive.js.map +1 -0
  65. package/daemon/dist/domain/claim-service.d.ts +11 -0
  66. package/daemon/dist/domain/claim-service.d.ts.map +1 -1
  67. package/daemon/dist/domain/claim-service.js +3 -1
  68. package/daemon/dist/domain/claim-service.js.map +1 -1
  69. package/daemon/dist/domain/discovery-types.d.ts +1 -1
  70. package/daemon/dist/domain/discovery-types.d.ts.map +1 -1
  71. package/daemon/dist/domain/feed/attention-aggregator.d.ts +31 -0
  72. package/daemon/dist/domain/feed/attention-aggregator.d.ts.map +1 -0
  73. package/daemon/dist/domain/feed/attention-aggregator.js +119 -0
  74. package/daemon/dist/domain/feed/attention-aggregator.js.map +1 -0
  75. package/daemon/dist/domain/files/file-write-service.d.ts +11 -2
  76. package/daemon/dist/domain/files/file-write-service.d.ts.map +1 -1
  77. package/daemon/dist/domain/files/file-write-service.js +77 -0
  78. package/daemon/dist/domain/files/file-write-service.js.map +1 -1
  79. package/daemon/dist/domain/hosts/fanout-contract.d.ts +33 -0
  80. package/daemon/dist/domain/hosts/fanout-contract.d.ts.map +1 -0
  81. package/daemon/dist/domain/hosts/fanout-contract.js +23 -0
  82. package/daemon/dist/domain/hosts/fanout-contract.js.map +1 -0
  83. package/daemon/dist/domain/hosts/hosts-registry-reader.d.ts +50 -0
  84. package/daemon/dist/domain/hosts/hosts-registry-reader.d.ts.map +1 -0
  85. package/daemon/dist/domain/hosts/hosts-registry-reader.js +184 -0
  86. package/daemon/dist/domain/hosts/hosts-registry-reader.js.map +1 -0
  87. package/daemon/dist/domain/hosts/hosts-registry-writer.d.ts +11 -0
  88. package/daemon/dist/domain/hosts/hosts-registry-writer.d.ts.map +1 -0
  89. package/daemon/dist/domain/hosts/hosts-registry-writer.js +54 -0
  90. package/daemon/dist/domain/hosts/hosts-registry-writer.js.map +1 -0
  91. package/daemon/dist/domain/hosts/read-through.d.ts +28 -0
  92. package/daemon/dist/domain/hosts/read-through.d.ts.map +1 -0
  93. package/daemon/dist/domain/hosts/read-through.js +139 -0
  94. package/daemon/dist/domain/hosts/read-through.js.map +1 -0
  95. package/daemon/dist/domain/hosts/remote-daemon-http.d.ts +56 -0
  96. package/daemon/dist/domain/hosts/remote-daemon-http.d.ts.map +1 -0
  97. package/daemon/dist/domain/hosts/remote-daemon-http.js +154 -0
  98. package/daemon/dist/domain/hosts/remote-daemon-http.js.map +1 -0
  99. package/daemon/dist/domain/human-route-enforcer.d.ts +71 -0
  100. package/daemon/dist/domain/human-route-enforcer.d.ts.map +1 -0
  101. package/daemon/dist/domain/human-route-enforcer.js +80 -0
  102. package/daemon/dist/domain/human-route-enforcer.js.map +1 -0
  103. package/daemon/dist/domain/mission-control/audit-browse.d.ts +8 -0
  104. package/daemon/dist/domain/mission-control/audit-browse.d.ts.map +1 -1
  105. package/daemon/dist/domain/mission-control/audit-browse.js +19 -0
  106. package/daemon/dist/domain/mission-control/audit-browse.js.map +1 -1
  107. package/daemon/dist/domain/mission-control/mission-control-action-log.d.ts +1 -1
  108. package/daemon/dist/domain/mission-control/mission-control-action-log.d.ts.map +1 -1
  109. package/daemon/dist/domain/mission-control/mission-control-action-log.js +4 -0
  110. package/daemon/dist/domain/mission-control/mission-control-action-log.js.map +1 -1
  111. package/daemon/dist/domain/mission-control/mission-control-fleet-cli-capability.js +1 -1
  112. package/daemon/dist/domain/mission-control/mission-control-fleet-cli-capability.js.map +1 -1
  113. package/daemon/dist/domain/mission-control/mission-control-read-layer.js +1 -1
  114. package/daemon/dist/domain/mission-control/mission-control-read-layer.js.map +1 -1
  115. package/daemon/dist/domain/mission-control/mission-control-write-contract.d.ts +28 -0
  116. package/daemon/dist/domain/mission-control/mission-control-write-contract.d.ts.map +1 -1
  117. package/daemon/dist/domain/mission-control/mission-control-write-contract.js +125 -0
  118. package/daemon/dist/domain/mission-control/mission-control-write-contract.js.map +1 -1
  119. package/daemon/dist/domain/node-inventory.d.ts +18 -0
  120. package/daemon/dist/domain/node-inventory.d.ts.map +1 -1
  121. package/daemon/dist/domain/node-inventory.js +206 -95
  122. package/daemon/dist/domain/node-inventory.js.map +1 -1
  123. package/daemon/dist/domain/node-launcher.d.ts +11 -0
  124. package/daemon/dist/domain/node-launcher.d.ts.map +1 -1
  125. package/daemon/dist/domain/node-launcher.js +10 -0
  126. package/daemon/dist/domain/node-launcher.js.map +1 -1
  127. package/daemon/dist/domain/policies/workflow-keepalive.d.ts +7 -0
  128. package/daemon/dist/domain/policies/workflow-keepalive.d.ts.map +1 -1
  129. package/daemon/dist/domain/policies/workflow-keepalive.js +93 -13
  130. package/daemon/dist/domain/policies/workflow-keepalive.js.map +1 -1
  131. package/daemon/dist/domain/ps-projection.d.ts +28 -1
  132. package/daemon/dist/domain/ps-projection.d.ts.map +1 -1
  133. package/daemon/dist/domain/ps-projection.js +76 -26
  134. package/daemon/dist/domain/ps-projection.js.map +1 -1
  135. package/daemon/dist/domain/queue-repository.d.ts +130 -1
  136. package/daemon/dist/domain/queue-repository.d.ts.map +1 -1
  137. package/daemon/dist/domain/queue-repository.js +304 -11
  138. package/daemon/dist/domain/queue-repository.js.map +1 -1
  139. package/daemon/dist/domain/queue-retention.d.ts +130 -0
  140. package/daemon/dist/domain/queue-retention.d.ts.map +1 -0
  141. package/daemon/dist/domain/queue-retention.js +224 -0
  142. package/daemon/dist/domain/queue-retention.js.map +1 -0
  143. package/daemon/dist/domain/restore-orchestrator.d.ts +5 -0
  144. package/daemon/dist/domain/restore-orchestrator.d.ts.map +1 -1
  145. package/daemon/dist/domain/restore-orchestrator.js +29 -2
  146. package/daemon/dist/domain/restore-orchestrator.js.map +1 -1
  147. package/daemon/dist/domain/resume-token-capture.d.ts +13 -0
  148. package/daemon/dist/domain/resume-token-capture.d.ts.map +1 -1
  149. package/daemon/dist/domain/resume-token-capture.js +14 -1
  150. package/daemon/dist/domain/resume-token-capture.js.map +1 -1
  151. package/daemon/dist/domain/resume-token-validation.d.ts +1 -1
  152. package/daemon/dist/domain/resume-token-validation.d.ts.map +1 -1
  153. package/daemon/dist/domain/resume-token-validation.js +58 -10
  154. package/daemon/dist/domain/resume-token-validation.js.map +1 -1
  155. package/daemon/dist/domain/review/brief-spine.d.ts +19 -0
  156. package/daemon/dist/domain/review/brief-spine.d.ts.map +1 -0
  157. package/daemon/dist/domain/review/brief-spine.js +86 -0
  158. package/daemon/dist/domain/review/brief-spine.js.map +1 -0
  159. package/daemon/dist/domain/review/compose.d.ts +277 -0
  160. package/daemon/dist/domain/review/compose.d.ts.map +1 -0
  161. package/daemon/dist/domain/review/compose.js +862 -0
  162. package/daemon/dist/domain/review/compose.js.map +1 -0
  163. package/daemon/dist/domain/review/fleet-compose.d.ts +52 -0
  164. package/daemon/dist/domain/review/fleet-compose.d.ts.map +1 -0
  165. package/daemon/dist/domain/review/fleet-compose.js +294 -0
  166. package/daemon/dist/domain/review/fleet-compose.js.map +1 -0
  167. package/daemon/dist/domain/review/freeze.d.ts +31 -0
  168. package/daemon/dist/domain/review/freeze.d.ts.map +1 -0
  169. package/daemon/dist/domain/review/freeze.js +257 -0
  170. package/daemon/dist/domain/review/freeze.js.map +1 -0
  171. package/daemon/dist/domain/review/gather.d.ts +115 -0
  172. package/daemon/dist/domain/review/gather.d.ts.map +1 -0
  173. package/daemon/dist/domain/review/gather.js +812 -0
  174. package/daemon/dist/domain/review/gather.js.map +1 -0
  175. package/daemon/dist/domain/review/types.d.ts +361 -0
  176. package/daemon/dist/domain/review/types.d.ts.map +1 -0
  177. package/daemon/dist/domain/review/types.js +35 -0
  178. package/daemon/dist/domain/review/types.js.map +1 -0
  179. package/daemon/dist/domain/rig-expansion-service.d.ts.map +1 -1
  180. package/daemon/dist/domain/rig-expansion-service.js +3 -0
  181. package/daemon/dist/domain/rig-expansion-service.js.map +1 -1
  182. package/daemon/dist/domain/rig-repository.d.ts +7 -6
  183. package/daemon/dist/domain/rig-repository.d.ts.map +1 -1
  184. package/daemon/dist/domain/rig-repository.js +33 -11
  185. package/daemon/dist/domain/rig-repository.js.map +1 -1
  186. package/daemon/dist/domain/rigspec-codec.d.ts.map +1 -1
  187. package/daemon/dist/domain/rigspec-codec.js +3 -0
  188. package/daemon/dist/domain/rigspec-codec.js.map +1 -1
  189. package/daemon/dist/domain/rigspec-exporter.d.ts.map +1 -1
  190. package/daemon/dist/domain/rigspec-exporter.js +4 -0
  191. package/daemon/dist/domain/rigspec-exporter.js.map +1 -1
  192. package/daemon/dist/domain/rigspec-instantiator.d.ts.map +1 -1
  193. package/daemon/dist/domain/rigspec-instantiator.js +11 -0
  194. package/daemon/dist/domain/rigspec-instantiator.js.map +1 -1
  195. package/daemon/dist/domain/rigspec-preflight.d.ts +6 -0
  196. package/daemon/dist/domain/rigspec-preflight.d.ts.map +1 -1
  197. package/daemon/dist/domain/rigspec-preflight.js +26 -1
  198. package/daemon/dist/domain/rigspec-preflight.js.map +1 -1
  199. package/daemon/dist/domain/rigspec-schema.d.ts.map +1 -1
  200. package/daemon/dist/domain/rigspec-schema.js +20 -1
  201. package/daemon/dist/domain/rigspec-schema.js.map +1 -1
  202. package/daemon/dist/domain/runtime-verifier.d.ts +7 -1
  203. package/daemon/dist/domain/runtime-verifier.d.ts.map +1 -1
  204. package/daemon/dist/domain/runtime-verifier.js +39 -1
  205. package/daemon/dist/domain/runtime-verifier.js.map +1 -1
  206. package/daemon/dist/domain/scope/scope-approve.d.ts +64 -0
  207. package/daemon/dist/domain/scope/scope-approve.d.ts.map +1 -0
  208. package/daemon/dist/domain/scope/scope-approve.js +153 -0
  209. package/daemon/dist/domain/scope/scope-approve.js.map +1 -0
  210. package/daemon/dist/domain/scope/scope-audit.d.ts +9 -1
  211. package/daemon/dist/domain/scope/scope-audit.d.ts.map +1 -1
  212. package/daemon/dist/domain/scope/scope-audit.js +173 -1
  213. package/daemon/dist/domain/scope/scope-audit.js.map +1 -1
  214. package/daemon/dist/domain/seat-handover-service.d.ts +9 -0
  215. package/daemon/dist/domain/seat-handover-service.d.ts.map +1 -1
  216. package/daemon/dist/domain/seat-handover-service.js +2 -0
  217. package/daemon/dist/domain/seat-handover-service.js.map +1 -1
  218. package/daemon/dist/domain/seat-identity-store.d.ts +7 -0
  219. package/daemon/dist/domain/seat-identity-store.d.ts.map +1 -1
  220. package/daemon/dist/domain/seat-identity-store.js +27 -0
  221. package/daemon/dist/domain/seat-identity-store.js.map +1 -1
  222. package/daemon/dist/domain/seat-status-service.d.ts.map +1 -1
  223. package/daemon/dist/domain/seat-status-service.js +6 -4
  224. package/daemon/dist/domain/seat-status-service.js.map +1 -1
  225. package/daemon/dist/domain/session-name.d.ts +22 -0
  226. package/daemon/dist/domain/session-name.d.ts.map +1 -1
  227. package/daemon/dist/domain/session-name.js +29 -0
  228. package/daemon/dist/domain/session-name.js.map +1 -1
  229. package/daemon/dist/domain/slices/slice-detail-projector.d.ts.map +1 -1
  230. package/daemon/dist/domain/slices/slice-detail-projector.js +4 -5
  231. package/daemon/dist/domain/slices/slice-detail-projector.js.map +1 -1
  232. package/daemon/dist/domain/spec-library-workflow-scanner.d.ts +18 -2
  233. package/daemon/dist/domain/spec-library-workflow-scanner.d.ts.map +1 -1
  234. package/daemon/dist/domain/spec-library-workflow-scanner.js +23 -1
  235. package/daemon/dist/domain/spec-library-workflow-scanner.js.map +1 -1
  236. package/daemon/dist/domain/startup-proof.d.ts +10 -6
  237. package/daemon/dist/domain/startup-proof.d.ts.map +1 -1
  238. package/daemon/dist/domain/startup-proof.js +35 -7
  239. package/daemon/dist/domain/startup-proof.js.map +1 -1
  240. package/daemon/dist/domain/successor-session-launcher.d.ts +16 -0
  241. package/daemon/dist/domain/successor-session-launcher.d.ts.map +1 -1
  242. package/daemon/dist/domain/successor-session-launcher.js +13 -0
  243. package/daemon/dist/domain/successor-session-launcher.js.map +1 -1
  244. package/daemon/dist/domain/terminal/cmux-provider-adapter.d.ts +27 -0
  245. package/daemon/dist/domain/terminal/cmux-provider-adapter.d.ts.map +1 -0
  246. package/daemon/dist/domain/terminal/cmux-provider-adapter.js +67 -0
  247. package/daemon/dist/domain/terminal/cmux-provider-adapter.js.map +1 -0
  248. package/daemon/dist/domain/terminal/herdr-adapter.d.ts +77 -0
  249. package/daemon/dist/domain/terminal/herdr-adapter.d.ts.map +1 -0
  250. package/daemon/dist/domain/terminal/herdr-adapter.js +266 -0
  251. package/daemon/dist/domain/terminal/herdr-adapter.js.map +1 -0
  252. package/daemon/dist/domain/terminal/herdr-transport.d.ts +50 -0
  253. package/daemon/dist/domain/terminal/herdr-transport.d.ts.map +1 -0
  254. package/daemon/dist/domain/terminal/herdr-transport.js +145 -0
  255. package/daemon/dist/domain/terminal/herdr-transport.js.map +1 -0
  256. package/daemon/dist/domain/terminal/terminal-provider.d.ts +88 -0
  257. package/daemon/dist/domain/terminal/terminal-provider.d.ts.map +1 -0
  258. package/daemon/dist/domain/terminal/terminal-provider.js +17 -0
  259. package/daemon/dist/domain/terminal/terminal-provider.js.map +1 -0
  260. package/daemon/dist/domain/terminal/terminal-service.d.ts +60 -0
  261. package/daemon/dist/domain/terminal/terminal-service.d.ts.map +1 -0
  262. package/daemon/dist/domain/terminal/terminal-service.js +174 -0
  263. package/daemon/dist/domain/terminal/terminal-service.js.map +1 -0
  264. package/daemon/dist/domain/terminal/terminal-views-store.d.ts +77 -0
  265. package/daemon/dist/domain/terminal/terminal-views-store.d.ts.map +1 -0
  266. package/daemon/dist/domain/terminal/terminal-views-store.js +146 -0
  267. package/daemon/dist/domain/terminal/terminal-views-store.js.map +1 -0
  268. package/daemon/dist/domain/terminal/view-composer.d.ts +42 -0
  269. package/daemon/dist/domain/terminal/view-composer.d.ts.map +1 -0
  270. package/daemon/dist/domain/terminal/view-composer.js +137 -0
  271. package/daemon/dist/domain/terminal/view-composer.js.map +1 -0
  272. package/daemon/dist/domain/tmux-option-defaults.d.ts +89 -0
  273. package/daemon/dist/domain/tmux-option-defaults.d.ts.map +1 -0
  274. package/daemon/dist/domain/tmux-option-defaults.js +132 -0
  275. package/daemon/dist/domain/tmux-option-defaults.js.map +1 -0
  276. package/daemon/dist/domain/topology/multi-rig-launcher.d.ts +49 -0
  277. package/daemon/dist/domain/topology/multi-rig-launcher.d.ts.map +1 -0
  278. package/daemon/dist/domain/topology/multi-rig-launcher.js +132 -0
  279. package/daemon/dist/domain/topology/multi-rig-launcher.js.map +1 -0
  280. package/daemon/dist/domain/topology/remote-up-leaf.d.ts +29 -0
  281. package/daemon/dist/domain/topology/remote-up-leaf.d.ts.map +1 -0
  282. package/daemon/dist/domain/topology/remote-up-leaf.js +60 -0
  283. package/daemon/dist/domain/topology/remote-up-leaf.js.map +1 -0
  284. package/daemon/dist/domain/topology/topology-manifest.d.ts +34 -0
  285. package/daemon/dist/domain/topology/topology-manifest.d.ts.map +1 -0
  286. package/daemon/dist/domain/topology/topology-manifest.js +195 -0
  287. package/daemon/dist/domain/topology/topology-manifest.js.map +1 -0
  288. package/daemon/dist/domain/types.d.ts +39 -1
  289. package/daemon/dist/domain/types.d.ts.map +1 -1
  290. package/daemon/dist/domain/types.js.map +1 -1
  291. package/daemon/dist/domain/up-command-router.d.ts +1 -1
  292. package/daemon/dist/domain/up-command-router.d.ts.map +1 -1
  293. package/daemon/dist/domain/up-command-router.js +34 -2
  294. package/daemon/dist/domain/up-command-router.js.map +1 -1
  295. package/daemon/dist/domain/user-settings/settings-store.d.ts +18 -1
  296. package/daemon/dist/domain/user-settings/settings-store.d.ts.map +1 -1
  297. package/daemon/dist/domain/user-settings/settings-store.js +201 -0
  298. package/daemon/dist/domain/user-settings/settings-store.js.map +1 -1
  299. package/daemon/dist/domain/workflow/slice-workflow-projection.d.ts.map +1 -1
  300. package/daemon/dist/domain/workflow/slice-workflow-projection.js +6 -2
  301. package/daemon/dist/domain/workflow/slice-workflow-projection.js.map +1 -1
  302. package/daemon/dist/domain/workflow-boot-sweep.d.ts +28 -0
  303. package/daemon/dist/domain/workflow-boot-sweep.d.ts.map +1 -0
  304. package/daemon/dist/domain/workflow-boot-sweep.js +102 -0
  305. package/daemon/dist/domain/workflow-boot-sweep.js.map +1 -0
  306. package/daemon/dist/domain/workflow-deadline.d.ts +74 -0
  307. package/daemon/dist/domain/workflow-deadline.d.ts.map +1 -0
  308. package/daemon/dist/domain/workflow-deadline.js +165 -0
  309. package/daemon/dist/domain/workflow-deadline.js.map +1 -0
  310. package/daemon/dist/domain/workflow-exception-escalation.d.ts +33 -0
  311. package/daemon/dist/domain/workflow-exception-escalation.d.ts.map +1 -0
  312. package/daemon/dist/domain/workflow-exception-escalation.js +104 -0
  313. package/daemon/dist/domain/workflow-exception-escalation.js.map +1 -0
  314. package/daemon/dist/domain/workflow-exception-router.d.ts +33 -0
  315. package/daemon/dist/domain/workflow-exception-router.d.ts.map +1 -0
  316. package/daemon/dist/domain/workflow-exception-router.js +96 -0
  317. package/daemon/dist/domain/workflow-exception-router.js.map +1 -0
  318. package/daemon/dist/domain/workflow-exception.d.ts +90 -0
  319. package/daemon/dist/domain/workflow-exception.d.ts.map +1 -0
  320. package/daemon/dist/domain/workflow-exception.js +122 -0
  321. package/daemon/dist/domain/workflow-exception.js.map +1 -0
  322. package/daemon/dist/domain/workflow-frontier-guard.d.ts +24 -0
  323. package/daemon/dist/domain/workflow-frontier-guard.d.ts.map +1 -0
  324. package/daemon/dist/domain/workflow-frontier-guard.js +30 -0
  325. package/daemon/dist/domain/workflow-frontier-guard.js.map +1 -0
  326. package/daemon/dist/domain/workflow-instance-store.d.ts +28 -0
  327. package/daemon/dist/domain/workflow-instance-store.d.ts.map +1 -1
  328. package/daemon/dist/domain/workflow-instance-store.js +66 -10
  329. package/daemon/dist/domain/workflow-instance-store.js.map +1 -1
  330. package/daemon/dist/domain/workflow-keepalive-arming.d.ts +35 -0
  331. package/daemon/dist/domain/workflow-keepalive-arming.d.ts.map +1 -0
  332. package/daemon/dist/domain/workflow-keepalive-arming.js +87 -0
  333. package/daemon/dist/domain/workflow-keepalive-arming.js.map +1 -0
  334. package/daemon/dist/domain/workflow-projector.d.ts +117 -2
  335. package/daemon/dist/domain/workflow-projector.d.ts.map +1 -1
  336. package/daemon/dist/domain/workflow-projector.js +672 -41
  337. package/daemon/dist/domain/workflow-projector.js.map +1 -1
  338. package/daemon/dist/domain/workflow-role-context.d.ts +57 -0
  339. package/daemon/dist/domain/workflow-role-context.d.ts.map +1 -0
  340. package/daemon/dist/domain/workflow-role-context.js +120 -0
  341. package/daemon/dist/domain/workflow-role-context.js.map +1 -0
  342. package/daemon/dist/domain/workflow-role-resolver.d.ts +65 -0
  343. package/daemon/dist/domain/workflow-role-resolver.d.ts.map +1 -0
  344. package/daemon/dist/domain/workflow-role-resolver.js +108 -0
  345. package/daemon/dist/domain/workflow-role-resolver.js.map +1 -0
  346. package/daemon/dist/domain/workflow-runtime.d.ts +157 -1
  347. package/daemon/dist/domain/workflow-runtime.d.ts.map +1 -1
  348. package/daemon/dist/domain/workflow-runtime.js +718 -11
  349. package/daemon/dist/domain/workflow-runtime.js.map +1 -1
  350. package/daemon/dist/domain/workflow-spec-cache.d.ts +26 -1
  351. package/daemon/dist/domain/workflow-spec-cache.d.ts.map +1 -1
  352. package/daemon/dist/domain/workflow-spec-cache.js +327 -13
  353. package/daemon/dist/domain/workflow-spec-cache.js.map +1 -1
  354. package/daemon/dist/domain/workflow-types.d.ts +143 -8
  355. package/daemon/dist/domain/workflow-types.d.ts.map +1 -1
  356. package/daemon/dist/domain/workflow-types.js +14 -1
  357. package/daemon/dist/domain/workflow-types.js.map +1 -1
  358. package/daemon/dist/domain/workflow-validator.d.ts +11 -1
  359. package/daemon/dist/domain/workflow-validator.d.ts.map +1 -1
  360. package/daemon/dist/domain/workflow-validator.js +246 -1
  361. package/daemon/dist/domain/workflow-validator.js.map +1 -1
  362. package/daemon/dist/domain/workspace/default-workspace-scaffold.d.ts.map +1 -1
  363. package/daemon/dist/domain/workspace/default-workspace-scaffold.js +51 -6
  364. package/daemon/dist/domain/workspace/default-workspace-scaffold.js.map +1 -1
  365. package/daemon/dist/domain/workspace/workspace-doctor.d.ts +11 -0
  366. package/daemon/dist/domain/workspace/workspace-doctor.d.ts.map +1 -1
  367. package/daemon/dist/domain/workspace/workspace-doctor.js +82 -0
  368. package/daemon/dist/domain/workspace/workspace-doctor.js.map +1 -1
  369. package/daemon/dist/index.d.ts +17 -0
  370. package/daemon/dist/index.d.ts.map +1 -1
  371. package/daemon/dist/index.js +44 -0
  372. package/daemon/dist/index.js.map +1 -1
  373. package/daemon/dist/routes/activity.js +22 -0
  374. package/daemon/dist/routes/activity.js.map +1 -1
  375. package/daemon/dist/routes/config.d.ts.map +1 -1
  376. package/daemon/dist/routes/config.js +15 -6
  377. package/daemon/dist/routes/config.js.map +1 -1
  378. package/daemon/dist/routes/files.d.ts.map +1 -1
  379. package/daemon/dist/routes/files.js +45 -1
  380. package/daemon/dist/routes/files.js.map +1 -1
  381. package/daemon/dist/routes/hosts.d.ts +5 -0
  382. package/daemon/dist/routes/hosts.d.ts.map +1 -0
  383. package/daemon/dist/routes/hosts.js +346 -0
  384. package/daemon/dist/routes/hosts.js.map +1 -0
  385. package/daemon/dist/routes/mission-control.d.ts.map +1 -1
  386. package/daemon/dist/routes/mission-control.js +67 -2
  387. package/daemon/dist/routes/mission-control.js.map +1 -1
  388. package/daemon/dist/routes/queue.d.ts +10 -9
  389. package/daemon/dist/routes/queue.d.ts.map +1 -1
  390. package/daemon/dist/routes/queue.js +305 -10
  391. package/daemon/dist/routes/queue.js.map +1 -1
  392. package/daemon/dist/routes/review.d.ts +3 -0
  393. package/daemon/dist/routes/review.d.ts.map +1 -0
  394. package/daemon/dist/routes/review.js +195 -0
  395. package/daemon/dist/routes/review.js.map +1 -0
  396. package/daemon/dist/routes/scope-approve.d.ts +3 -0
  397. package/daemon/dist/routes/scope-approve.d.ts.map +1 -0
  398. package/daemon/dist/routes/scope-approve.js +55 -0
  399. package/daemon/dist/routes/scope-approve.js.map +1 -0
  400. package/daemon/dist/routes/scope-audit.d.ts.map +1 -1
  401. package/daemon/dist/routes/scope-audit.js +28 -1
  402. package/daemon/dist/routes/scope-audit.js.map +1 -1
  403. package/daemon/dist/routes/seat.js +13 -0
  404. package/daemon/dist/routes/seat.js.map +1 -1
  405. package/daemon/dist/routes/slices.d.ts.map +1 -1
  406. package/daemon/dist/routes/slices.js +49 -9
  407. package/daemon/dist/routes/slices.js.map +1 -1
  408. package/daemon/dist/routes/terminal-ws.d.ts.map +1 -1
  409. package/daemon/dist/routes/terminal-ws.js +58 -21
  410. package/daemon/dist/routes/terminal-ws.js.map +1 -1
  411. package/daemon/dist/routes/terminal.d.ts +11 -0
  412. package/daemon/dist/routes/terminal.d.ts.map +1 -0
  413. package/daemon/dist/routes/terminal.js +104 -0
  414. package/daemon/dist/routes/terminal.js.map +1 -0
  415. package/daemon/dist/routes/up.d.ts.map +1 -1
  416. package/daemon/dist/routes/up.js +84 -0
  417. package/daemon/dist/routes/up.js.map +1 -1
  418. package/daemon/dist/routes/workflow.d.ts.map +1 -1
  419. package/daemon/dist/routes/workflow.js +102 -10
  420. package/daemon/dist/routes/workflow.js.map +1 -1
  421. package/daemon/dist/routes/workspace.js +2 -2
  422. package/daemon/dist/server.d.ts +6 -0
  423. package/daemon/dist/server.d.ts.map +1 -1
  424. package/daemon/dist/server.js +36 -1
  425. package/daemon/dist/server.js.map +1 -1
  426. package/daemon/dist/startup.d.ts.map +1 -1
  427. package/daemon/dist/startup.js +238 -14
  428. package/daemon/dist/startup.js.map +1 -1
  429. package/daemon/docs/reference/agent-startup-guide.md +1 -1
  430. package/daemon/docs/reference/product-factory-vps-runbook.md +132 -0
  431. package/daemon/docs/reference/sdlc-conventions.md +187 -0
  432. package/daemon/specs/agents/conveyor/builder/agent.yaml +1 -1
  433. package/daemon/specs/agents/conveyor/builder/guidance/role.md +1 -0
  434. package/daemon/specs/agents/conveyor/lead/agent.yaml +1 -1
  435. package/daemon/specs/agents/conveyor/lead/guidance/role.md +1 -0
  436. package/daemon/specs/agents/conveyor/planner/agent.yaml +1 -1
  437. package/daemon/specs/agents/conveyor/planner/guidance/role.md +1 -0
  438. package/daemon/specs/agents/conveyor/reviewer/agent.yaml +1 -1
  439. package/daemon/specs/agents/conveyor/reviewer/guidance/role.md +1 -0
  440. package/daemon/specs/agents/design/product-designer/agent.yaml +1 -1
  441. package/daemon/specs/agents/design/product-designer/guidance/role.md +1 -0
  442. package/daemon/specs/agents/development/implementer/agent.yaml +1 -1
  443. package/daemon/specs/agents/development/implementer/guidance/role.md +1 -0
  444. package/daemon/specs/agents/development/qa/agent.yaml +1 -1
  445. package/daemon/specs/agents/development/qa/guidance/role.md +1 -0
  446. package/daemon/specs/agents/factory-rsi/dogfood/agent.yaml +29 -0
  447. package/daemon/specs/agents/factory-rsi/dogfood/guidance/role.md +37 -0
  448. package/daemon/specs/agents/factory-rsi/release-manager/agent.yaml +29 -0
  449. package/daemon/specs/agents/factory-rsi/release-manager/guidance/role.md +40 -0
  450. package/daemon/specs/agents/orchestration/orchestrator/agent.yaml +1 -1
  451. package/daemon/specs/agents/orchestration/orchestrator/guidance/role.md +1 -0
  452. package/daemon/specs/agents/product-management/pm/agent.yaml +1 -0
  453. package/daemon/specs/agents/product-management/pm/guidance/role.md +13 -0
  454. package/daemon/specs/agents/review/independent-reviewer/agent.yaml +1 -1
  455. package/daemon/specs/agents/review/independent-reviewer/guidance/role.md +1 -0
  456. package/daemon/specs/agents/shared/agent.yaml +2 -0
  457. package/daemon/specs/agents/shared/skills/core/mission-slice-sop/SKILL.md +113 -0
  458. package/daemon/specs/agents/shared/skills/core/openrig-cmux/SKILL.md +86 -0
  459. package/daemon/specs/agents/shared/skills/core/openrig-herdr/SKILL.md +158 -0
  460. package/daemon/specs/agents/shared/skills/core/openrig-operator/SKILL.md +4 -4
  461. package/daemon/specs/agents/shared/skills/core/openrig-user/SKILL.md +75 -29
  462. package/daemon/specs/agents/shared/skills/pods/orchestration-team/SKILL.md +2 -2
  463. package/daemon/specs/rigs/focused/pm-team/CULTURE.md +4 -0
  464. package/daemon/specs/rigs/launch/factory-rsi/CULTURE.md +47 -0
  465. package/daemon/specs/rigs/launch/factory-rsi/rig.yaml +115 -0
  466. package/daemon/specs/rigs/launch/kernel/agents/operator/agent/guidance/role.md +1 -1
  467. package/daemon/specs/rigs/launch/kernel/agents/operator/agent/startup/context.md +1 -1
  468. package/daemon/specs/rigs/preview/product-team/CULTURE.md +4 -0
  469. package/dist/build-info.d.ts +8 -0
  470. package/dist/build-info.d.ts.map +1 -0
  471. package/dist/build-info.js +11 -0
  472. package/dist/build-info.js.map +1 -0
  473. package/dist/commands/broadcast.d.ts +6 -1
  474. package/dist/commands/broadcast.d.ts.map +1 -1
  475. package/dist/commands/broadcast.js +101 -15
  476. package/dist/commands/broadcast.js.map +1 -1
  477. package/dist/commands/capture.d.ts.map +1 -1
  478. package/dist/commands/capture.js +99 -8
  479. package/dist/commands/capture.js.map +1 -1
  480. package/dist/commands/config-init-workspace.d.ts.map +1 -1
  481. package/dist/commands/config-init-workspace.js +20 -4
  482. package/dist/commands/config-init-workspace.js.map +1 -1
  483. package/dist/commands/config.d.ts.map +1 -1
  484. package/dist/commands/config.js +4 -0
  485. package/dist/commands/config.js.map +1 -1
  486. package/dist/commands/doctor.js +2 -2
  487. package/dist/commands/doctor.js.map +1 -1
  488. package/dist/commands/down.d.ts.map +1 -1
  489. package/dist/commands/down.js +5 -0
  490. package/dist/commands/down.js.map +1 -1
  491. package/dist/commands/expand.js +1 -1
  492. package/dist/commands/expand.js.map +1 -1
  493. package/dist/commands/file.d.ts +7 -0
  494. package/dist/commands/file.d.ts.map +1 -0
  495. package/dist/commands/file.js +77 -0
  496. package/dist/commands/file.js.map +1 -0
  497. package/dist/commands/host.d.ts +48 -0
  498. package/dist/commands/host.d.ts.map +1 -0
  499. package/dist/commands/host.js +772 -0
  500. package/dist/commands/host.js.map +1 -0
  501. package/dist/commands/launch.d.ts.map +1 -1
  502. package/dist/commands/launch.js +5 -0
  503. package/dist/commands/launch.js.map +1 -1
  504. package/dist/commands/proof.d.ts +54 -0
  505. package/dist/commands/proof.d.ts.map +1 -0
  506. package/dist/commands/proof.js +311 -0
  507. package/dist/commands/proof.js.map +1 -0
  508. package/dist/commands/ps.d.ts +41 -7
  509. package/dist/commands/ps.d.ts.map +1 -1
  510. package/dist/commands/ps.js +353 -135
  511. package/dist/commands/ps.js.map +1 -1
  512. package/dist/commands/queue.d.ts +36 -0
  513. package/dist/commands/queue.d.ts.map +1 -1
  514. package/dist/commands/queue.js +149 -7
  515. package/dist/commands/queue.js.map +1 -1
  516. package/dist/commands/restore-packet.d.ts.map +1 -1
  517. package/dist/commands/restore-packet.js +13 -2
  518. package/dist/commands/restore-packet.js.map +1 -1
  519. package/dist/commands/scope.d.ts.map +1 -1
  520. package/dist/commands/scope.js +140 -3
  521. package/dist/commands/scope.js.map +1 -1
  522. package/dist/commands/send.d.ts.map +1 -1
  523. package/dist/commands/send.js +127 -13
  524. package/dist/commands/send.js.map +1 -1
  525. package/dist/commands/terminal.d.ts +6 -0
  526. package/dist/commands/terminal.d.ts.map +1 -0
  527. package/dist/commands/terminal.js +116 -0
  528. package/dist/commands/terminal.js.map +1 -0
  529. package/dist/commands/transcript.d.ts +6 -1
  530. package/dist/commands/transcript.d.ts.map +1 -1
  531. package/dist/commands/transcript.js +113 -30
  532. package/dist/commands/transcript.js.map +1 -1
  533. package/dist/commands/up.d.ts +2 -0
  534. package/dist/commands/up.d.ts.map +1 -1
  535. package/dist/commands/up.js +78 -2
  536. package/dist/commands/up.js.map +1 -1
  537. package/dist/commands/whoami.d.ts.map +1 -1
  538. package/dist/commands/whoami.js +11 -0
  539. package/dist/commands/whoami.js.map +1 -1
  540. package/dist/commands/workflow-errors.d.ts +23 -0
  541. package/dist/commands/workflow-errors.d.ts.map +1 -0
  542. package/dist/commands/workflow-errors.js +100 -0
  543. package/dist/commands/workflow-errors.js.map +1 -0
  544. package/dist/commands/workflow-follow.d.ts +71 -0
  545. package/dist/commands/workflow-follow.d.ts.map +1 -0
  546. package/dist/commands/workflow-follow.js +259 -0
  547. package/dist/commands/workflow-follow.js.map +1 -0
  548. package/dist/commands/workflow-render.d.ts +114 -0
  549. package/dist/commands/workflow-render.d.ts.map +1 -0
  550. package/dist/commands/workflow-render.js +223 -0
  551. package/dist/commands/workflow-render.js.map +1 -0
  552. package/dist/commands/workflow.d.ts +1 -0
  553. package/dist/commands/workflow.d.ts.map +1 -1
  554. package/dist/commands/workflow.js +278 -14
  555. package/dist/commands/workflow.js.map +1 -1
  556. package/dist/commands/workspace.js +6 -6
  557. package/dist/commands/workspace.js.map +1 -1
  558. package/dist/config-store.d.ts +19 -1
  559. package/dist/config-store.d.ts.map +1 -1
  560. package/dist/config-store.js +171 -0
  561. package/dist/config-store.js.map +1 -1
  562. package/dist/cross-host-cli-helpers.d.ts +13 -0
  563. package/dist/cross-host-cli-helpers.d.ts.map +1 -1
  564. package/dist/cross-host-cli-helpers.js +27 -0
  565. package/dist/cross-host-cli-helpers.js.map +1 -1
  566. package/dist/cross-host-executor.d.ts +1 -0
  567. package/dist/cross-host-executor.d.ts.map +1 -1
  568. package/dist/cross-host-executor.js +4 -1
  569. package/dist/cross-host-executor.js.map +1 -1
  570. package/dist/cross-host-target.d.ts +49 -0
  571. package/dist/cross-host-target.d.ts.map +1 -0
  572. package/dist/cross-host-target.js +35 -0
  573. package/dist/cross-host-target.js.map +1 -0
  574. package/dist/daemon-lifecycle.d.ts.map +1 -1
  575. package/dist/daemon-lifecycle.js +4 -1
  576. package/dist/daemon-lifecycle.js.map +1 -1
  577. package/dist/host-registry.d.ts +17 -0
  578. package/dist/host-registry.d.ts.map +1 -1
  579. package/dist/host-registry.js +64 -2
  580. package/dist/host-registry.js.map +1 -1
  581. package/dist/host-selection.d.ts +13 -0
  582. package/dist/host-selection.d.ts.map +1 -0
  583. package/dist/host-selection.js +54 -0
  584. package/dist/host-selection.js.map +1 -0
  585. package/dist/index.d.ts +2 -0
  586. package/dist/index.d.ts.map +1 -1
  587. package/dist/index.js +9 -0
  588. package/dist/index.js.map +1 -1
  589. package/dist/lib/file-transfer.d.ts +89 -0
  590. package/dist/lib/file-transfer.d.ts.map +1 -0
  591. package/dist/lib/file-transfer.js +300 -0
  592. package/dist/lib/file-transfer.js.map +1 -0
  593. package/dist/lib/hosts/fanout-contract.d.ts +33 -0
  594. package/dist/lib/hosts/fanout-contract.d.ts.map +1 -0
  595. package/dist/lib/hosts/fanout-contract.js +23 -0
  596. package/dist/lib/hosts/fanout-contract.js.map +1 -0
  597. package/dist/lib/scope/scope-audit.d.ts +9 -1
  598. package/dist/lib/scope/scope-audit.d.ts.map +1 -1
  599. package/dist/lib/scope/scope-audit.js +173 -1
  600. package/dist/lib/scope/scope-audit.js.map +1 -1
  601. package/dist/lib/scope/templates.d.ts +1 -0
  602. package/dist/lib/scope/templates.d.ts.map +1 -1
  603. package/dist/lib/scope/templates.js +9 -0
  604. package/dist/lib/scope/templates.js.map +1 -1
  605. package/dist/lib/scope-templates/backlog-deprecation.md +16 -0
  606. package/dist/lib/scope-templates/backlog-tech-debt.md +16 -0
  607. package/dist/lib/scope-templates/bug-fix.md +16 -0
  608. package/dist/lib/scope-templates/implementation-prd.md +33 -0
  609. package/dist/lib/scope-templates/mission-placeholder.md +1 -1
  610. package/dist/lib/scope-templates/mission-progress.md +1 -1
  611. package/dist/lib/scope-templates/mission-release.md +1 -1
  612. package/dist/lib/scope-templates/placeholder.md +11 -7
  613. package/dist/lib/scope-templates/proof.md +5 -1
  614. package/dist/lib/scope-templates/release-feature.md +14 -6
  615. package/dist/lib/scope-templates/research.md +16 -0
  616. package/dist/lib/scope-templates/slice-progress.md +1 -1
  617. package/dist/remote-host-ops.d.ts +1 -0
  618. package/dist/remote-host-ops.d.ts.map +1 -1
  619. package/dist/remote-host-ops.js +11 -4
  620. package/dist/remote-host-ops.js.map +1 -1
  621. package/dist/session-name.d.ts +23 -0
  622. package/dist/session-name.d.ts.map +1 -0
  623. package/dist/session-name.js +61 -0
  624. package/dist/session-name.js.map +1 -0
  625. package/dist/version.d.ts +5 -0
  626. package/dist/version.d.ts.map +1 -1
  627. package/dist/version.js +11 -1
  628. package/dist/version.js.map +1 -1
  629. package/package.json +1 -1
  630. package/ui/dist/assets/index-CFqxa0zW.css +32 -0
  631. package/ui/dist/assets/index-zrFqS7gL.js +623 -0
  632. package/ui/dist/index.html +2 -2
  633. package/ui/dist/assets/index-DYZniQcc.js +0 -597
  634. package/ui/dist/assets/index-trcb4Yf_.css +0 -32
@@ -0,0 +1,77 @@
1
+ import type { ViewMemberInput } from "./view-composer.js";
2
+ /** One persisted member of a saved view. Optionals are omitted-when-absent on write. */
3
+ export interface SavedViewMember {
4
+ /** Canonical session name of the seat. */
5
+ seat: string;
6
+ /** Pane label — `<agent> · <slice>`. */
7
+ label?: string;
8
+ /** Structured host id (never a `member@rig@host` string). Omitted for a local seat. */
9
+ host?: string;
10
+ /** The tmux session to attach to. */
11
+ tmuxSession?: string;
12
+ /** View-only / read-only attach. Omitted (defaults false) when not read-only. */
13
+ readOnly?: boolean;
14
+ }
15
+ export interface SavedView {
16
+ id: string;
17
+ name: string;
18
+ members: SavedViewMember[];
19
+ }
20
+ export interface TerminalViewsFile {
21
+ version: 1;
22
+ views: SavedView[];
23
+ }
24
+ export declare class TerminalViewsStore {
25
+ private readonly path;
26
+ constructor(path?: string);
27
+ /** The resolved on-disk path (useful for tests / diagnostics). */
28
+ getPath(): string;
29
+ /**
30
+ * Read-at-launch. An absent file yields the empty set. A malformed file
31
+ * throws (honest — never a silent reset that would discard operator layouts).
32
+ */
33
+ read(): TerminalViewsFile;
34
+ list(): SavedView[];
35
+ get(id: string): SavedView | null;
36
+ /**
37
+ * Persist a SAVED view (upsert by id). Atomic (tmp + rename) and byte-stable.
38
+ * Returns the resulting file. Only accepts `SavedView` — a derived view can
39
+ * never reach disk through this path (A3).
40
+ */
41
+ save(view: SavedView): TerminalViewsFile;
42
+ /** Remove a saved view by id (idempotent). Atomic. */
43
+ remove(id: string): TerminalViewsFile;
44
+ private writeAtomic;
45
+ }
46
+ /**
47
+ * The minimal structural shape of a live seat row the derived-view mapper
48
+ * needs. Deliberately a subset (not an import of `NodeInventoryEntry`) so this
49
+ * module stays free of the inventory's transitive deps and is trivially
50
+ * testable. Field names match `NodeInventoryEntry`.
51
+ */
52
+ export interface LiveSeatRow {
53
+ canonicalSessionName: string | null;
54
+ /** "tmux" for tmux-backed seats; other kinds have no attachable pane. */
55
+ attachmentType: string | null;
56
+ /** The tmux session name (canonical session name for tmux-backed seats). */
57
+ tmuxSession?: string | null;
58
+ rigName?: string | null;
59
+ logicalId?: string | null;
60
+ }
61
+ /** Options controlling how a derived view labels/scopes its members. */
62
+ export interface DeriveOptions {
63
+ /** Structured host id to stamp on every derived member (remote scope); omit for local. */
64
+ host?: string | null;
65
+ /** When true, members attach read-only (`-r`) — cross-rig / view-only derived scopes. */
66
+ readOnly?: boolean;
67
+ /** Slice/mission label suffix for the pane label (`<agent> · <slice>`); optional. */
68
+ labelSuffix?: string;
69
+ }
70
+ /**
71
+ * Map a live seat inventory into composer-ready members. PURE and IN-MEMORY —
72
+ * the result is handed straight to `composeView`; it is NEVER written to the
73
+ * saved-views file. Non-tmux / session-less rows are dropped from the derived
74
+ * set (a derived view only tiles attachable seats; saved views name absents).
75
+ */
76
+ export declare function deriveViewMembers(rows: LiveSeatRow[], opts?: DeriveOptions): ViewMemberInput[];
77
+ //# sourceMappingURL=terminal-views-store.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"terminal-views-store.d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,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B;AAED,wEAAwE;AACxE,MAAM,WAAW,aAAa;IAC5B,0FAA0F;IAC1F,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,yFAAyF;IACzF,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,qFAAqF;IACrF,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,WAAW,EAAE,EACnB,IAAI,GAAE,aAAkB,GACvB,eAAe,EAAE,CAsBnB"}
@@ -0,0 +1,146 @@
1
+ // OPR.0.4.6.02 C2 — the terminal-views store.
2
+ //
3
+ // SAVED views persist to `terminal-views.yaml` at the OPENRIG_HOME root
4
+ // (VM-isolatable via OPENRIG_HOME). They are write-once/read-at-launch: the
5
+ // daemon reads them at launch and the operator's saved layouts survive
6
+ // restarts. Each saved member carries a STRUCTURED `host` field (a host id,
7
+ // never a `member@rig@host` string — MH BR-1).
8
+ //
9
+ // DERIVED views (per-rig / per-mission / per-slice) are computed LIVE from the
10
+ // live seat inventory + the review agents band and are NEVER written to disk
11
+ // (A3). That invariant is structural, not conventional: this module exposes
12
+ // `deriveViewMembers` (a pure mapper) and a `save()` that only ever accepts a
13
+ // `SavedView` — there is no code path that persists a derived view.
14
+ //
15
+ // Writes are atomic (tmp + rename on the same filesystem) and byte-stable:
16
+ // serialization uses a fixed field order and OMITS absent optionals (never
17
+ // null), so a read→save round-trip of the same logical content is idempotent.
18
+ import { existsSync, readFileSync, renameSync, writeFileSync } from "node:fs";
19
+ import { parse as parseYaml, stringify as stringifyYaml } from "yaml";
20
+ import { getDefaultOpenRigPath } from "../../openrig-compat.js";
21
+ const EMPTY_FILE = { version: 1, views: [] };
22
+ /** Build a member object in fixed key order, omitting absent optionals (never null). */
23
+ function normalizeMember(m) {
24
+ const out = { seat: m.seat };
25
+ if (m.label != null && m.label !== "")
26
+ out.label = m.label;
27
+ if (m.host != null && m.host !== "")
28
+ out.host = m.host;
29
+ if (m.tmuxSession != null && m.tmuxSession !== "")
30
+ out.tmuxSession = m.tmuxSession;
31
+ if (m.readOnly === true)
32
+ out.readOnly = true;
33
+ return out;
34
+ }
35
+ function normalizeView(v) {
36
+ return { id: v.id, name: v.name, members: v.members.map(normalizeMember) };
37
+ }
38
+ /** Canonical byte-stable serialization of the whole file (fixed order, omit-when-absent). */
39
+ function serialize(file) {
40
+ const normalized = {
41
+ version: 1,
42
+ views: file.views.map(normalizeView),
43
+ };
44
+ return stringifyYaml(normalized);
45
+ }
46
+ export class TerminalViewsStore {
47
+ path;
48
+ constructor(path = getDefaultOpenRigPath("terminal-views.yaml")) {
49
+ this.path = path;
50
+ }
51
+ /** The resolved on-disk path (useful for tests / diagnostics). */
52
+ getPath() {
53
+ return this.path;
54
+ }
55
+ /**
56
+ * Read-at-launch. An absent file yields the empty set. A malformed file
57
+ * throws (honest — never a silent reset that would discard operator layouts).
58
+ */
59
+ read() {
60
+ if (!existsSync(this.path))
61
+ return { version: 1, views: [] };
62
+ const raw = readFileSync(this.path, "utf-8");
63
+ const parsed = parseYaml(raw);
64
+ if (parsed == null)
65
+ return { version: 1, views: [] };
66
+ if (typeof parsed !== "object") {
67
+ throw new Error(`terminal views file at ${this.path} must be a YAML object with a 'views' array`);
68
+ }
69
+ const obj = parsed;
70
+ const views = obj["views"];
71
+ if (!Array.isArray(views)) {
72
+ throw new Error(`terminal views file at ${this.path}: 'views' must be an array`);
73
+ }
74
+ return { version: 1, views: views };
75
+ }
76
+ list() {
77
+ return this.read().views;
78
+ }
79
+ get(id) {
80
+ return this.read().views.find((v) => v.id === id) ?? null;
81
+ }
82
+ /**
83
+ * Persist a SAVED view (upsert by id). Atomic (tmp + rename) and byte-stable.
84
+ * Returns the resulting file. Only accepts `SavedView` — a derived view can
85
+ * never reach disk through this path (A3).
86
+ */
87
+ save(view) {
88
+ const current = this.read();
89
+ const idx = current.views.findIndex((v) => v.id === view.id);
90
+ const next = [...current.views];
91
+ if (idx >= 0)
92
+ next[idx] = view;
93
+ else
94
+ next.push(view);
95
+ const file = { version: 1, views: next };
96
+ this.writeAtomic(file);
97
+ return { version: 1, views: file.views.map(normalizeView) };
98
+ }
99
+ /** Remove a saved view by id (idempotent). Atomic. */
100
+ remove(id) {
101
+ const current = this.read();
102
+ const file = {
103
+ version: 1,
104
+ views: current.views.filter((v) => v.id !== id),
105
+ };
106
+ this.writeAtomic(file);
107
+ return { version: 1, views: file.views.map(normalizeView) };
108
+ }
109
+ writeAtomic(file) {
110
+ const tmp = `${this.path}.tmp`;
111
+ writeFileSync(tmp, serialize(file), "utf-8");
112
+ renameSync(tmp, this.path);
113
+ }
114
+ }
115
+ /**
116
+ * Map a live seat inventory into composer-ready members. PURE and IN-MEMORY —
117
+ * the result is handed straight to `composeView`; it is NEVER written to the
118
+ * saved-views file. Non-tmux / session-less rows are dropped from the derived
119
+ * set (a derived view only tiles attachable seats; saved views name absents).
120
+ */
121
+ export function deriveViewMembers(rows, opts = {}) {
122
+ const members = [];
123
+ for (const row of rows) {
124
+ if (row.attachmentType !== "tmux")
125
+ continue;
126
+ const seat = row.canonicalSessionName;
127
+ if (!seat)
128
+ continue;
129
+ const tmuxSession = row.tmuxSession ?? row.canonicalSessionName;
130
+ const agent = row.logicalId ?? seat;
131
+ const label = opts.labelSuffix ? `${agent} · ${opts.labelSuffix}` : agent;
132
+ members.push({
133
+ seat,
134
+ label,
135
+ tmuxSession,
136
+ host: opts.host ?? null,
137
+ readOnly: opts.readOnly === true,
138
+ // Derived views are live: presence in the inventory IS the liveness
139
+ // signal for the derived set; a stricter has-session probe layers on at
140
+ // compose time for local members if the caller supplies one.
141
+ alive: true,
142
+ });
143
+ }
144
+ return members;
145
+ }
146
+ //# sourceMappingURL=terminal-views-store.js.map
@@ -0,0 +1 @@
1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AAG,KAAK,MAAM,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC;QAC1E,OAAO,CAAC,IAAI,CAAC;YACX,IAAI;YACJ,KAAK;YACL,WAAW;YACX,IAAI,EAAE,IAAI,CAAC,IAAI,IAAI,IAAI;YACvB,QAAQ,EAAE,IAAI,CAAC,QAAQ,KAAK,IAAI;YAChC,oEAAoE;YACpE,wEAAwE;YACxE,6DAA6D;YAC7D,KAAK,EAAE,IAAI;SACZ,CAAC,CAAC;IACL,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
@@ -0,0 +1,42 @@
1
+ import type { HostEntry } from "../hosts/hosts-registry-reader.js";
2
+ import type { ComposedPane, ComposedView } from "./terminal-provider.js";
3
+ /**
4
+ * Panes per grid page (3×3). Overflow spills to the next provider tab/page.
5
+ * A module constant in v1 — a future per-rig `terminal.tiles_per_page` config
6
+ * key is a natural extension, but no config key ships in this slice (the plan
7
+ * keeps the C1 config surface to the single `terminal.status_bar` key).
8
+ */
9
+ export declare const PANES_PER_PAGE = 9;
10
+ /**
11
+ * One resolved member of a view, ready to compose. `alive` and `readOnly` are
12
+ * decided upstream (liveness probe + cross-rig/saved-read-only policy); the
13
+ * composer only routes on them. `host` is a structured host id or null (local).
14
+ */
15
+ export interface ViewMemberInput {
16
+ /** Canonical session name of the seat. */
17
+ seat: string;
18
+ /** Pane label — `<agent> · <slice>` (AC-7). */
19
+ label: string;
20
+ /** The tmux session to attach to (may be null if the seat has no tmux binding). */
21
+ tmuxSession: string | null;
22
+ /** Structured host id when remote; null for a local seat. */
23
+ host: string | null;
24
+ /** View-only / cross-rig membership → read-only (`-r`) attach. */
25
+ readOnly: boolean;
26
+ /** Local liveness (has-session). Ignored for remote members (reachability is an ssh concern). */
27
+ alive: boolean;
28
+ }
29
+ /** The composer's only side-channel: read-only host resolution from the registry. */
30
+ export interface ComposeContext {
31
+ /** Resolve a host id to its registry entry, or null if the id is unknown. */
32
+ resolveHost(id: string): HostEntry | null;
33
+ }
34
+ /** Chunk panes into fixed-size grid pages (one provider tab per page). */
35
+ export declare function chunkPanes(panes: ComposedPane[], perPage?: number): ComposedPane[][];
36
+ /**
37
+ * Compose a resolved member list into a provider-neutral view. Pure: same
38
+ * inputs → byte-identical output. Member order is preserved into `opened`
39
+ * (and therefore into page assignment), so paging is deterministic.
40
+ */
41
+ export declare function composeView(id: string, members: ViewMemberInput[], ctx: ComposeContext): ComposedView;
42
+ //# sourceMappingURL=view-composer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"view-composer.d.ts","sourceRoot":"","sources":["../../../src/domain/terminal/view-composer.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mCAAmC,CAAC;AACnE,OAAO,KAAK,EAEV,YAAY,EACZ,YAAY,EAEb,MAAM,wBAAwB,CAAC;AAEhC;;;;;GAKG;AACH,eAAO,MAAM,cAAc,IAAI,CAAC;AAEhC;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B,0CAA0C;IAC1C,IAAI,EAAE,MAAM,CAAC;IACb,+CAA+C;IAC/C,KAAK,EAAE,MAAM,CAAC;IACd,mFAAmF;IACnF,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,6DAA6D;IAC7D,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,kEAAkE;IAClE,QAAQ,EAAE,OAAO,CAAC;IAClB,iGAAiG;IACjG,KAAK,EAAE,OAAO,CAAC;CAChB;AAED,qFAAqF;AACrF,MAAM,WAAW,cAAc;IAC7B,6EAA6E;IAC7E,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC;CAC3C;AAYD,0EAA0E;AAC1E,wBAAgB,UAAU,CACxB,KAAK,EAAE,YAAY,EAAE,EACrB,OAAO,GAAE,MAAuB,GAC/B,YAAY,EAAE,EAAE,CAOlB;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CACzB,EAAE,EAAE,MAAM,EACV,OAAO,EAAE,eAAe,EAAE,EAC1B,GAAG,EAAE,cAAc,GAClB,YAAY,CA2Fd"}
@@ -0,0 +1,137 @@
1
+ // OPR.0.4.6.02 C2 — the PURE view composer.
2
+ //
3
+ // Turns a resolved list of view members into a provider-neutral `ComposedView`
4
+ // (`{ opened, absent, degraded, pages }`, BR-6 honest-partial). All of the
5
+ // partition rules live here, in one testable pure function, so no provider
6
+ // re-implements them:
7
+ //
8
+ // local live → `tmux attach -t <session>`
9
+ // view-only / cross-rig (read-only)
10
+ // → `tmux attach -r -t <session>`
11
+ // ssh host → `ssh <dest> tmux attach [-r] -t <session>`
12
+ // http host → NO pane; honest-degrade { seat, host, reason }
13
+ // dead / no session → absent[] (named, never silently dropped)
14
+ //
15
+ // The composer takes members that already carry a STRUCTURED `host` field (a
16
+ // host id, never a `member@rig@host` string — MH BR-1). Host classification
17
+ // (ssh vs http vs unknown) is resolved through the operator's read-only hosts
18
+ // registry via the injected `resolveHost`.
19
+ /**
20
+ * Panes per grid page (3×3). Overflow spills to the next provider tab/page.
21
+ * A module constant in v1 — a future per-rig `terminal.tiles_per_page` config
22
+ * key is a natural extension, but no config key ships in this slice (the plan
23
+ * keeps the C1 config surface to the single `terminal.status_bar` key).
24
+ */
25
+ export const PANES_PER_PAGE = 9;
26
+ /** POSIX single-quote a string so session names / targets are shell-inert in the composed command. */
27
+ function shellQuote(s) {
28
+ return "'" + s.replace(/'/g, "'\"'\"'") + "'";
29
+ }
30
+ /** The remote ssh destination — `user@target` when a user is declared, else `target`. */
31
+ function sshDest(host) {
32
+ return host.user ? `${host.user}@${host.target}` : host.target;
33
+ }
34
+ /** Chunk panes into fixed-size grid pages (one provider tab per page). */
35
+ export function chunkPanes(panes, perPage = PANES_PER_PAGE) {
36
+ if (perPage < 1)
37
+ throw new Error(`chunkPanes: perPage must be >= 1 (got ${perPage})`);
38
+ const pages = [];
39
+ for (let i = 0; i < panes.length; i += perPage) {
40
+ pages.push(panes.slice(i, i + perPage));
41
+ }
42
+ return pages;
43
+ }
44
+ /**
45
+ * Compose a resolved member list into a provider-neutral view. Pure: same
46
+ * inputs → byte-identical output. Member order is preserved into `opened`
47
+ * (and therefore into page assignment), so paging is deterministic.
48
+ */
49
+ export function composeView(id, members, ctx) {
50
+ const opened = [];
51
+ const absent = [];
52
+ const degraded = [];
53
+ for (const m of members) {
54
+ const attachFlag = m.readOnly ? "-r " : "";
55
+ if (m.host !== null) {
56
+ // Remote member: classify by the registry entry's transport.
57
+ const host = ctx.resolveHost(m.host);
58
+ if (!host) {
59
+ // Unknown host id is a config gap, not a live seat — degrade named,
60
+ // never a silent omission.
61
+ degraded.push({
62
+ seat: m.seat,
63
+ host: m.host,
64
+ reason: `host ${m.host} is not in the hosts registry`,
65
+ });
66
+ continue;
67
+ }
68
+ if (host.transport === "http") {
69
+ // http hosts speak daemon REST, not interactive ssh panes — the tile
70
+ // surface needs ssh. Honest-degrade, R1(a).
71
+ degraded.push({
72
+ seat: m.seat,
73
+ host: m.host,
74
+ reason: `host ${m.host} is http-registered; tiles need ssh`,
75
+ });
76
+ continue;
77
+ }
78
+ // ssh host: a seat with no recorded tmux session cannot be attached.
79
+ if (!m.tmuxSession) {
80
+ absent.push({
81
+ seat: m.seat,
82
+ host: m.host,
83
+ reason: "no tmux session recorded for this seat",
84
+ });
85
+ continue;
86
+ }
87
+ // Guard G1: the host registry is STRUCTURED data, but the pane command is a
88
+ // shell string — so the ssh destination must be shell-inert AND not
89
+ // option-shaped. A registry `user`/`target` with whitespace or shell
90
+ // metacharacters would otherwise split into extra shell words; a leading
91
+ // `-` would be parsed BY ssh as an option (option injection). We shell-quote
92
+ // the destination so it stays exactly ONE argument, and honest-degrade (named,
93
+ // never run) a destination that begins with `-`.
94
+ const dest = sshDest(host);
95
+ if (dest.startsWith("-")) {
96
+ degraded.push({
97
+ seat: m.seat,
98
+ host: m.host,
99
+ reason: `host ${m.host} ssh destination '${dest}' is option-shaped (leading '-'); refusing to compose an ssh tile`,
100
+ });
101
+ continue;
102
+ }
103
+ opened.push({
104
+ seat: m.seat,
105
+ label: m.label,
106
+ paneCommand: `ssh ${shellQuote(dest)} tmux attach ${attachFlag}-t ${shellQuote(m.tmuxSession)}`,
107
+ readOnly: m.readOnly,
108
+ });
109
+ continue;
110
+ }
111
+ // Local member.
112
+ if (!m.tmuxSession) {
113
+ absent.push({
114
+ seat: m.seat,
115
+ host: null,
116
+ reason: "no tmux session recorded for this seat",
117
+ });
118
+ continue;
119
+ }
120
+ if (!m.alive) {
121
+ absent.push({
122
+ seat: m.seat,
123
+ host: null,
124
+ reason: `tmux session ${m.tmuxSession} is not alive`,
125
+ });
126
+ continue;
127
+ }
128
+ opened.push({
129
+ seat: m.seat,
130
+ label: m.label,
131
+ paneCommand: `tmux attach ${attachFlag}-t ${shellQuote(m.tmuxSession)}`,
132
+ readOnly: m.readOnly,
133
+ });
134
+ }
135
+ return { id, opened, absent, degraded, pages: chunkPanes(opened) };
136
+ }
137
+ //# sourceMappingURL=view-composer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"view-composer.js","sourceRoot":"","sources":["../../../src/domain/terminal/view-composer.ts"],"names":[],"mappings":"AAAA,4CAA4C;AAC5C,EAAE;AACF,+EAA+E;AAC/E,2EAA2E;AAC3E,2EAA2E;AAC3E,sBAAsB;AACtB,EAAE;AACF,kDAAkD;AAClD,sCAAsC;AACtC,qDAAqD;AACrD,kEAAkE;AAClE,sEAAsE;AACtE,iEAAiE;AACjE,EAAE;AACF,6EAA6E;AAC7E,4EAA4E;AAC5E,8EAA8E;AAC9E,2CAA2C;AAU3C;;;;;GAKG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC;AA4BhC,sGAAsG;AACtG,SAAS,UAAU,CAAC,CAAS;IAC3B,OAAO,GAAG,GAAG,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,SAAS,CAAC,GAAG,GAAG,CAAC;AAChD,CAAC;AAED,yFAAyF;AACzF,SAAS,OAAO,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AAE,OAAO,UAAU,CAAC,IAAI,CAAC,gBAAgB,UAAU,MAAM,UAAU,CAAC,CAAC,CAAC,WAAW,CAAC,EAAE;gBAC/F,QAAQ,EAAE,CAAC,CAAC,QAAQ;aACrB,CAAC,CAAC;YACH,SAAS;QACX,CAAC;QAED,gBAAgB;QAChB,IAAI,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;YACnB,MAAM,CAAC,IAAI,CAAC;gBACV,IAAI,EAAE,CAAC,CAAC,IAAI;gBACZ,IAAI,EAAE,IAAI;gBACV,MAAM,EAAE,wCAAwC;aACjD,CAAC,CAAC;YACH,SAAS;QACX,CAAC;QACD,IAAI,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC;YACb,MAAM,CAAC,IAAI,CAAC;gBACV,IAAI,EAAE,CAAC,CAAC,IAAI;gBACZ,IAAI,EAAE,IAAI;gBACV,MAAM,EAAE,gBAAgB,CAAC,CAAC,WAAW,eAAe;aACrD,CAAC,CAAC;YACH,SAAS;QACX,CAAC;QACD,MAAM,CAAC,IAAI,CAAC;YACV,IAAI,EAAE,CAAC,CAAC,IAAI;YACZ,KAAK,EAAE,CAAC,CAAC,KAAK;YACd,WAAW,EAAE,eAAe,UAAU,MAAM,UAAU,CAAC,CAAC,CAAC,WAAW,CAAC,EAAE;YACvE,QAAQ,EAAE,CAAC,CAAC,QAAQ;SACrB,CAAC,CAAC;IACL,CAAC;IAED,OAAO,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;AACrE,CAAC"}
@@ -0,0 +1,89 @@
1
+ import type { TmuxAdapter } from "../adapters/tmux.js";
2
+ export interface TmuxOptionDefaultsDeps {
3
+ tmuxAdapter: TmuxAdapter;
4
+ /**
5
+ * OPR.0.4.6.02 S1 — reads the daemon's tmux option defaults at APPLY time.
6
+ * Resolved fresh per call (from the SettingsStore in startup) so an
7
+ * operator's `terminal.status_bar` flip applies to FUTURE launches only.
8
+ * Defaults to `statusBar: false` (bar hidden) when omitted.
9
+ */
10
+ readTmuxOptionDefaults?: () => {
11
+ statusBar: boolean;
12
+ };
13
+ /**
14
+ * OPR.0.4.6.02 S1 — platform selector for the server-scope `copy-command`
15
+ * table. Defaults to `process.platform`; injectable for the scope tests.
16
+ */
17
+ platform?: NodeJS.Platform;
18
+ /**
19
+ * OPR.0.4.6.02 S1 — cheap `command -v <bin>` probe for the linux
20
+ * copy-command fallback chain. Defaults to a real shell probe; injectable
21
+ * for deterministic tests.
22
+ */
23
+ hasCommand?: (bin: string) => boolean;
24
+ }
25
+ /**
26
+ * OPR.0.4.6.02 S1 — applies the daemon's tmux option defaults to a
27
+ * FRESHLY-CREATED session. Shared by `NodeLauncher` (the launch path) and
28
+ * `SuccessorSessionLauncher` (the fresh seat-handover successor path) so
29
+ * every fresh operator/agent seat gets consistent mouse/status/clipboard
30
+ * defaults (orch C1 scope ruling: fold fresh successors in via ONE helper).
31
+ *
32
+ * Scope discipline (guard b2): SESSION-scope options (`mouse`, `status`) are
33
+ * applied ONLY to the just-created session name passed in — never a
34
+ * pre-existing/discovered session — so the never-retro-flip rail (BR-1)
35
+ * holds and a `terminal.status_bar` flip affects future launches only.
36
+ * SERVER-scope options (`set-clipboard`, `copy-command`) are asserted ONCE
37
+ * per daemon lifetime via the shared memo on this single instance; a daemon
38
+ * RESTART re-asserts (a fresh applier). Callers MUST only invoke this after
39
+ * a successful `createSession` on a freshly-created session.
40
+ */
41
+ export declare class TmuxOptionDefaultsApplier {
42
+ private tmuxAdapter;
43
+ private readTmuxOptionDefaults;
44
+ private platform;
45
+ private hasCommand;
46
+ private serverDefaultsAsserted;
47
+ constructor(deps: TmuxOptionDefaultsDeps);
48
+ /**
49
+ * Apply the option defaults to a JUST-CREATED session. `mouse` is always
50
+ * on; the inner status bar follows the `terminal.status_bar` config key
51
+ * (default off), read at apply time so a flip applies to FUTURE launches
52
+ * only (this touches only `sessionName`). Then assert the server-scope
53
+ * defaults once per daemon lifetime.
54
+ *
55
+ * Returns the list of non-fatal warnings (empty when all sets succeed) so
56
+ * the caller can fold them into its own launch-warning channel. NEVER
57
+ * throws for an option-set failure — a seat without mouse-scroll is
58
+ * degraded, not dead (and a handover successor must not be handover-fatal
59
+ * over a cosmetic option).
60
+ */
61
+ applyToFreshSession(sessionName: string): Promise<string[]>;
62
+ /**
63
+ * Assert the SERVER-scope tmux defaults (`set-clipboard on` + the
64
+ * per-platform `copy-command`) on the daemon's OWN tmux server, ONCE per
65
+ * daemon lifetime. Written only through `setServerOption` (`set-option
66
+ * -s`) — never a `-t` session target (guard b2 scope contract).
67
+ *
68
+ * Per-process memoization means a daemon RESTART re-asserts these (a fresh
69
+ * applier instance): an operator's manual `copy-command` / `set-clipboard`
70
+ * override does NOT survive a daemon restart — the named off-switch
71
+ * follow-up is the customization path. Re-running is harmless (idempotent
72
+ * set of the same values); the memo is an optimization, not a correctness
73
+ * gate.
74
+ */
75
+ private ensureServerDefaults;
76
+ }
77
+ /**
78
+ * OPR.0.4.6.02 S1 — the per-platform tmux `copy-command` table (arch rail
79
+ * b). Ref: the tmux "Clipboard" wiki — `copy-command` is the shell command
80
+ * tmux pipes a copy-mode selection into to reach the system clipboard.
81
+ * - darwin → `pbcopy`
82
+ * - linux → `wl-copy` if present, else `xclip -selection clipboard -i`,
83
+ * else UNSET (null) — fall back to `set-clipboard on` OSC 52.
84
+ * - other → UNSET (null).
85
+ * Pure: platform + a `command -v` probe in, the command string (or null)
86
+ * out. One table, no side effects — the applier decides whether to write.
87
+ */
88
+ export declare function resolveCopyCommand(platform: NodeJS.Platform, hasCommand: (bin: string) => boolean): string | null;
89
+ //# sourceMappingURL=tmux-option-defaults.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tmux-option-defaults.d.ts","sourceRoot":"","sources":["../../src/domain/tmux-option-defaults.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEvD,MAAM,WAAW,sBAAsB;IACrC,WAAW,EAAE,WAAW,CAAC;IACzB;;;;;OAKG;IACH,sBAAsB,CAAC,EAAE,MAAM;QAAE,SAAS,EAAE,OAAO,CAAA;KAAE,CAAC;IACtD;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC,QAAQ,CAAC;IAC3B;;;;OAIG;IACH,UAAU,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC;CACvC;AAED;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,yBAAyB;IACpC,OAAO,CAAC,WAAW,CAAc;IACjC,OAAO,CAAC,sBAAsB,CAA+B;IAC7D,OAAO,CAAC,QAAQ,CAAkB;IAClC,OAAO,CAAC,UAAU,CAA2B;IAC7C,OAAO,CAAC,sBAAsB,CAAS;gBAE3B,IAAI,EAAE,sBAAsB;IAOxC;;;;;;;;;;;;OAYG;IACG,mBAAmB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAuBjE;;;;;;;;;;;;OAYG;YACW,oBAAoB;CAmBnC;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,MAAM,CAAC,QAAQ,EACzB,UAAU,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,GACnC,MAAM,GAAG,IAAI,CAQf"}
@@ -0,0 +1,132 @@
1
+ import { spawnSync } from "node:child_process";
2
+ /**
3
+ * OPR.0.4.6.02 S1 — applies the daemon's tmux option defaults to a
4
+ * FRESHLY-CREATED session. Shared by `NodeLauncher` (the launch path) and
5
+ * `SuccessorSessionLauncher` (the fresh seat-handover successor path) so
6
+ * every fresh operator/agent seat gets consistent mouse/status/clipboard
7
+ * defaults (orch C1 scope ruling: fold fresh successors in via ONE helper).
8
+ *
9
+ * Scope discipline (guard b2): SESSION-scope options (`mouse`, `status`) are
10
+ * applied ONLY to the just-created session name passed in — never a
11
+ * pre-existing/discovered session — so the never-retro-flip rail (BR-1)
12
+ * holds and a `terminal.status_bar` flip affects future launches only.
13
+ * SERVER-scope options (`set-clipboard`, `copy-command`) are asserted ONCE
14
+ * per daemon lifetime via the shared memo on this single instance; a daemon
15
+ * RESTART re-asserts (a fresh applier). Callers MUST only invoke this after
16
+ * a successful `createSession` on a freshly-created session.
17
+ */
18
+ export class TmuxOptionDefaultsApplier {
19
+ tmuxAdapter;
20
+ readTmuxOptionDefaults;
21
+ platform;
22
+ hasCommand;
23
+ serverDefaultsAsserted = false;
24
+ constructor(deps) {
25
+ this.tmuxAdapter = deps.tmuxAdapter;
26
+ this.readTmuxOptionDefaults = deps.readTmuxOptionDefaults ?? (() => ({ statusBar: false }));
27
+ this.platform = deps.platform ?? process.platform;
28
+ this.hasCommand = deps.hasCommand ?? defaultHasCommand;
29
+ }
30
+ /**
31
+ * Apply the option defaults to a JUST-CREATED session. `mouse` is always
32
+ * on; the inner status bar follows the `terminal.status_bar` config key
33
+ * (default off), read at apply time so a flip applies to FUTURE launches
34
+ * only (this touches only `sessionName`). Then assert the server-scope
35
+ * defaults once per daemon lifetime.
36
+ *
37
+ * Returns the list of non-fatal warnings (empty when all sets succeed) so
38
+ * the caller can fold them into its own launch-warning channel. NEVER
39
+ * throws for an option-set failure — a seat without mouse-scroll is
40
+ * degraded, not dead (and a handover successor must not be handover-fatal
41
+ * over a cosmetic option).
42
+ */
43
+ async applyToFreshSession(sessionName) {
44
+ const warnings = [];
45
+ const mouse = await this.tmuxAdapter.setSessionOption(sessionName, "mouse", "on");
46
+ if (!mouse.ok) {
47
+ warnings.push(`tmux "mouse" option not set for ${sessionName}: ${mouse.message}`);
48
+ }
49
+ let statusBar = false;
50
+ try {
51
+ statusBar = this.readTmuxOptionDefaults().statusBar === true;
52
+ }
53
+ catch {
54
+ statusBar = false;
55
+ }
56
+ const status = await this.tmuxAdapter.setSessionOption(sessionName, "status", statusBar ? "on" : "off");
57
+ if (!status.ok) {
58
+ warnings.push(`tmux "status" option not set for ${sessionName}: ${status.message}`);
59
+ }
60
+ await this.ensureServerDefaults(warnings);
61
+ return warnings;
62
+ }
63
+ /**
64
+ * Assert the SERVER-scope tmux defaults (`set-clipboard on` + the
65
+ * per-platform `copy-command`) on the daemon's OWN tmux server, ONCE per
66
+ * daemon lifetime. Written only through `setServerOption` (`set-option
67
+ * -s`) — never a `-t` session target (guard b2 scope contract).
68
+ *
69
+ * Per-process memoization means a daemon RESTART re-asserts these (a fresh
70
+ * applier instance): an operator's manual `copy-command` / `set-clipboard`
71
+ * override does NOT survive a daemon restart — the named off-switch
72
+ * follow-up is the customization path. Re-running is harmless (idempotent
73
+ * set of the same values); the memo is an optimization, not a correctness
74
+ * gate.
75
+ */
76
+ async ensureServerDefaults(warnings) {
77
+ if (this.serverDefaultsAsserted)
78
+ return;
79
+ // Set first so concurrent applies don't double-assert; either way the
80
+ // sets are idempotent.
81
+ this.serverDefaultsAsserted = true;
82
+ const clip = await this.tmuxAdapter.setServerOption("set-clipboard", "on");
83
+ if (!clip.ok) {
84
+ warnings.push(`tmux "set-clipboard" server option not set: ${clip.message}`);
85
+ }
86
+ const copyCommand = resolveCopyCommand(this.platform, this.hasCommand);
87
+ if (copyCommand !== null) {
88
+ const cc = await this.tmuxAdapter.setServerOption("copy-command", copyCommand);
89
+ if (!cc.ok) {
90
+ warnings.push(`tmux "copy-command" server option not set: ${cc.message}`);
91
+ }
92
+ }
93
+ }
94
+ }
95
+ /**
96
+ * OPR.0.4.6.02 S1 — the per-platform tmux `copy-command` table (arch rail
97
+ * b). Ref: the tmux "Clipboard" wiki — `copy-command` is the shell command
98
+ * tmux pipes a copy-mode selection into to reach the system clipboard.
99
+ * - darwin → `pbcopy`
100
+ * - linux → `wl-copy` if present, else `xclip -selection clipboard -i`,
101
+ * else UNSET (null) — fall back to `set-clipboard on` OSC 52.
102
+ * - other → UNSET (null).
103
+ * Pure: platform + a `command -v` probe in, the command string (or null)
104
+ * out. One table, no side effects — the applier decides whether to write.
105
+ */
106
+ export function resolveCopyCommand(platform, hasCommand) {
107
+ if (platform === "darwin")
108
+ return "pbcopy";
109
+ if (platform === "linux") {
110
+ if (hasCommand("wl-copy"))
111
+ return "wl-copy";
112
+ if (hasCommand("xclip"))
113
+ return "xclip -selection clipboard -i";
114
+ return null;
115
+ }
116
+ return null;
117
+ }
118
+ /**
119
+ * OPR.0.4.6.02 S1 — default `command -v <bin>` probe (POSIX shell builtin).
120
+ * Returns true when the binary resolves on PATH. Cheap + best-effort; any
121
+ * failure (spawn error, non-shell env) reads as absent.
122
+ */
123
+ function defaultHasCommand(bin) {
124
+ try {
125
+ const r = spawnSync(`command -v ${bin}`, { shell: true, stdio: "ignore" });
126
+ return r.status === 0;
127
+ }
128
+ catch {
129
+ return false;
130
+ }
131
+ }
132
+ //# sourceMappingURL=tmux-option-defaults.js.map