@openrig/cli 0.6.11 → 0.6.12

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 (1182) hide show
  1. package/README.md +7 -4
  2. package/daemon/assets/claude-statusline-context.cjs +2 -0
  3. package/daemon/assets/guidance/openrig-start.md +2 -1
  4. package/daemon/assets/plugins/openrig-core/.claude-plugin/plugin.json +1 -1
  5. package/daemon/assets/plugins/openrig-core/.codex-plugin/plugin.json +1 -1
  6. package/daemon/assets/plugins/openrig-core/README.md +30 -7
  7. package/daemon/assets/plugins/openrig-core/hooks/claude.json +7 -7
  8. package/daemon/assets/plugins/openrig-core/hooks/codex.json +2 -2
  9. package/daemon/assets/plugins/openrig-core/hooks/scripts/activity-relay.cjs +77 -0
  10. package/daemon/assets/plugins/openrig-core/hooks/scripts/compaction-restore-bridge.cjs +23 -0
  11. package/daemon/assets/plugins/openrig-core/hooks/scripts/refocus-health.cjs +4 -2
  12. package/daemon/assets/plugins/openrig-core/hooks/scripts/refocus.cjs +69 -16
  13. package/daemon/assets/plugins/openrig-core/skills/claude-compaction-restore/scripts/precompact-hook.mjs +24 -0
  14. package/daemon/assets/plugins/openrig-core/skills/delegating-work/SKILL.md +25 -5
  15. package/daemon/assets/plugins/openrig-core/skills/forming-an-openrig-mental-model/SKILL.md +4 -2
  16. package/daemon/assets/plugins/openrig-core/skills/mission-slice-sop/SKILL.md +10 -1
  17. package/daemon/assets/plugins/openrig-core/skills/openrig-skills/SKILL.md +1 -1
  18. package/daemon/assets/plugins/openrig-core/skills/openrig-user/SKILL.md +172 -11
  19. package/daemon/assets/plugins/openrig-core/skills/orienting-to-an-inherited-seat/SKILL.md +7 -4
  20. package/daemon/assets/plugins/openrig-core/skills/queue-handoff/SKILL.md +8 -0
  21. package/daemon/assets/plugins/openrig-core/skills/retiring-and-inheriting-a-seat/SKILL.md +5 -2
  22. package/daemon/assets/plugins/openrig-core/skills/session-compaction-and-restore/SKILL.md +19 -0
  23. package/daemon/assets/skills/rigs/SKILL.md +55 -9
  24. package/daemon/context-packs/help/manifest.yaml +1 -1
  25. package/daemon/context-packs/onboarding-width/manifest.yaml +1 -1
  26. package/daemon/context-packs/onboarding-width/public-what-you-can-do.md +106 -37
  27. package/daemon/context-packs/reference/getting-started.md +39 -6
  28. package/daemon/context-packs/reference/manifest.yaml +1 -1
  29. package/daemon/context-packs/reference/rig-spec.md +64 -3
  30. package/daemon/context-packs/reference/whats-new.md +167 -146
  31. package/daemon/context-packs/skills/agent-operated-software/manifest.yaml +1 -1
  32. package/daemon/context-packs/skills/agent-operated-workflows/manifest.yaml +1 -1
  33. package/daemon/context-packs/skills/applying-a-permission-policy/manifest.yaml +1 -1
  34. package/daemon/context-packs/skills/claude-compaction-restore/manifest.yaml +1 -1
  35. package/daemon/context-packs/skills/claude-compaction-restore/scripts/precompact-hook.mjs +24 -0
  36. package/daemon/context-packs/skills/core/agent-starters/manifest.yaml +1 -1
  37. package/daemon/context-packs/skills/core/agent-startup-and-context-ingestion/manifest.yaml +1 -1
  38. package/daemon/context-packs/skills/core/cross-host-rig-commands/manifest.yaml +1 -1
  39. package/daemon/context-packs/skills/core/human-in-the-loop/manifest.yaml +1 -1
  40. package/daemon/context-packs/skills/core/messaging-the-human/manifest.yaml +1 -1
  41. package/daemon/context-packs/skills/core/openrig-architect/manifest.yaml +1 -1
  42. package/daemon/context-packs/skills/core/openrig-cmux/manifest.yaml +1 -1
  43. package/daemon/context-packs/skills/core/openrig-herdr/manifest.yaml +1 -1
  44. package/daemon/context-packs/skills/core/openrig-skills/SKILL.md +1 -1
  45. package/daemon/context-packs/skills/core/openrig-skills/manifest.yaml +1 -1
  46. package/daemon/context-packs/skills/core/openrig-software-factory/SKILL.md +0 -1
  47. package/daemon/context-packs/skills/core/openrig-software-factory/manifest.yaml +1 -1
  48. package/daemon/context-packs/skills/core/openrig-software-factory/references/worked-example.md +7 -4
  49. package/daemon/context-packs/skills/core/openrig-upgrade/manifest.yaml +1 -1
  50. package/daemon/context-packs/skills/core/rig-bundles-and-shareable-artifacts/manifest.yaml +1 -1
  51. package/daemon/context-packs/skills/core/rig-lifecycle/manifest.yaml +1 -1
  52. package/daemon/context-packs/skills/core/session-source-fork/manifest.yaml +1 -1
  53. package/daemon/context-packs/skills/core/specification-system/manifest.yaml +1 -1
  54. package/daemon/context-packs/skills/core/topology-mutation-and-seat-management/SKILL.md +1 -1
  55. package/daemon/context-packs/skills/core/topology-mutation-and-seat-management/manifest.yaml +1 -1
  56. package/daemon/context-packs/skills/core/watchdog/manifest.yaml +1 -1
  57. package/daemon/context-packs/skills/delegating-work/SKILL.md +25 -5
  58. package/daemon/context-packs/skills/delegating-work/manifest.yaml +3 -3
  59. package/daemon/context-packs/skills/forming-an-openrig-mental-model/SKILL.md +4 -2
  60. package/daemon/context-packs/skills/forming-an-openrig-mental-model/manifest.yaml +1 -1
  61. package/daemon/context-packs/skills/loading-addressable-markdown/manifest.yaml +1 -1
  62. package/daemon/context-packs/skills/mission-slice-sop/SKILL.md +10 -1
  63. package/daemon/context-packs/skills/mission-slice-sop/manifest.yaml +1 -1
  64. package/daemon/context-packs/skills/openrig-operating-model/manifest.yaml +1 -1
  65. package/daemon/context-packs/skills/openrig-user/SKILL.md +172 -11
  66. package/daemon/context-packs/skills/openrig-user/manifest.yaml +1 -1
  67. package/daemon/context-packs/skills/orienting-to-an-inherited-seat/SKILL.md +7 -4
  68. package/daemon/context-packs/skills/orienting-to-an-inherited-seat/manifest.yaml +1 -1
  69. package/daemon/context-packs/skills/pm/backlog-capture/manifest.yaml +1 -1
  70. package/daemon/context-packs/skills/pm/context-builder/manifest.yaml +1 -1
  71. package/daemon/context-packs/skills/pm/exec-summary/manifest.yaml +1 -1
  72. package/daemon/context-packs/skills/pm/office-hours/manifest.yaml +1 -1
  73. package/daemon/context-packs/skills/pm/plan-review/manifest.yaml +1 -1
  74. package/daemon/context-packs/skills/pm/requirements-writer/manifest.yaml +1 -1
  75. package/daemon/context-packs/skills/pm/ui-mockup/manifest.yaml +1 -1
  76. package/daemon/context-packs/skills/pods/development-team/manifest.yaml +1 -1
  77. package/daemon/context-packs/skills/pods/orchestration-team/SKILL.md +1 -1
  78. package/daemon/context-packs/skills/pods/orchestration-team/manifest.yaml +1 -1
  79. package/daemon/context-packs/skills/pods/oversight-team/manifest.yaml +1 -1
  80. package/daemon/context-packs/skills/pods/review-team/manifest.yaml +1 -1
  81. package/daemon/context-packs/skills/process/agent-browser/manifest.yaml +1 -1
  82. package/daemon/context-packs/skills/process/context-engineering/manifest.yaml +1 -1
  83. package/daemon/context-packs/skills/process/dogfood/manifest.yaml +1 -1
  84. package/daemon/context-packs/skills/process/frontend-design/manifest.yaml +1 -1
  85. package/daemon/context-packs/skills/process/systematic-debugging/manifest.yaml +1 -1
  86. package/daemon/context-packs/skills/process/test-driven-development/manifest.yaml +1 -1
  87. package/daemon/context-packs/skills/process/verification-before-completion/manifest.yaml +1 -1
  88. package/daemon/context-packs/skills/queue-handoff/SKILL.md +8 -0
  89. package/daemon/context-packs/skills/queue-handoff/manifest.yaml +1 -1
  90. package/daemon/context-packs/skills/refocusing/manifest.yaml +1 -1
  91. package/daemon/context-packs/skills/retiring-and-inheriting-a-seat/SKILL.md +5 -2
  92. package/daemon/context-packs/skills/retiring-and-inheriting-a-seat/manifest.yaml +1 -1
  93. package/daemon/context-packs/skills/seat-continuity-and-handover/manifest.yaml +1 -1
  94. package/daemon/context-packs/skills/session-compaction-and-restore/SKILL.md +19 -0
  95. package/daemon/context-packs/skills/session-compaction-and-restore/manifest.yaml +1 -1
  96. package/daemon/context-packs/skills/software-for-agents/manifest.yaml +1 -1
  97. package/daemon/context-packs/world-example/manifest.yaml +1 -1
  98. package/daemon/context-packs/world-public/manifest.yaml +1 -1
  99. package/daemon/dist/adapters/bounded-probe-exec.d.ts +45 -0
  100. package/daemon/dist/adapters/bounded-probe-exec.d.ts.map +1 -0
  101. package/daemon/dist/adapters/bounded-probe-exec.js +204 -0
  102. package/daemon/dist/adapters/bounded-probe-exec.js.map +1 -0
  103. package/daemon/dist/adapters/claude-code-adapter.d.ts +17 -1
  104. package/daemon/dist/adapters/claude-code-adapter.d.ts.map +1 -1
  105. package/daemon/dist/adapters/claude-code-adapter.js +173 -32
  106. package/daemon/dist/adapters/claude-code-adapter.js.map +1 -1
  107. package/daemon/dist/adapters/claude-resume.d.ts.map +1 -1
  108. package/daemon/dist/adapters/claude-resume.js +14 -3
  109. package/daemon/dist/adapters/claude-resume.js.map +1 -1
  110. package/daemon/dist/adapters/codex-resume.d.ts +5 -0
  111. package/daemon/dist/adapters/codex-resume.d.ts.map +1 -1
  112. package/daemon/dist/adapters/codex-resume.js +17 -3
  113. package/daemon/dist/adapters/codex-resume.js.map +1 -1
  114. package/daemon/dist/adapters/codex-runtime-adapter.d.ts +38 -1
  115. package/daemon/dist/adapters/codex-runtime-adapter.d.ts.map +1 -1
  116. package/daemon/dist/adapters/codex-runtime-adapter.js +137 -5
  117. package/daemon/dist/adapters/codex-runtime-adapter.js.map +1 -1
  118. package/daemon/dist/adapters/community-harness-runtime-adapter.d.ts +46 -0
  119. package/daemon/dist/adapters/community-harness-runtime-adapter.d.ts.map +1 -0
  120. package/daemon/dist/adapters/community-harness-runtime-adapter.js +102 -0
  121. package/daemon/dist/adapters/community-harness-runtime-adapter.js.map +1 -0
  122. package/daemon/dist/adapters/compose-services-adapter.d.ts.map +1 -1
  123. package/daemon/dist/adapters/compose-services-adapter.js +2 -1
  124. package/daemon/dist/adapters/compose-services-adapter.js.map +1 -1
  125. package/daemon/dist/adapters/kernel-authority.d.ts +8 -1
  126. package/daemon/dist/adapters/kernel-authority.d.ts.map +1 -1
  127. package/daemon/dist/adapters/kernel-authority.js +35 -10
  128. package/daemon/dist/adapters/kernel-authority.js.map +1 -1
  129. package/daemon/dist/adapters/omp-rpc-frame.d.ts +51 -0
  130. package/daemon/dist/adapters/omp-rpc-frame.d.ts.map +1 -0
  131. package/daemon/dist/adapters/omp-rpc-frame.js +153 -0
  132. package/daemon/dist/adapters/omp-rpc-frame.js.map +1 -0
  133. package/daemon/dist/adapters/pi-openrouter-charge.d.ts +67 -0
  134. package/daemon/dist/adapters/pi-openrouter-charge.d.ts.map +1 -0
  135. package/daemon/dist/adapters/pi-openrouter-charge.js +228 -0
  136. package/daemon/dist/adapters/pi-openrouter-charge.js.map +1 -0
  137. package/daemon/dist/adapters/pi-readiness.d.ts +81 -5
  138. package/daemon/dist/adapters/pi-readiness.d.ts.map +1 -1
  139. package/daemon/dist/adapters/pi-readiness.js +193 -27
  140. package/daemon/dist/adapters/pi-readiness.js.map +1 -1
  141. package/daemon/dist/adapters/pi-resume.d.ts +4 -0
  142. package/daemon/dist/adapters/pi-resume.d.ts.map +1 -1
  143. package/daemon/dist/adapters/pi-resume.js +2 -0
  144. package/daemon/dist/adapters/pi-resume.js.map +1 -1
  145. package/daemon/dist/adapters/pi-runner-protocol.d.ts +4 -0
  146. package/daemon/dist/adapters/pi-runner-protocol.d.ts.map +1 -1
  147. package/daemon/dist/adapters/pi-runner-protocol.js +5 -0
  148. package/daemon/dist/adapters/pi-runner-protocol.js.map +1 -1
  149. package/daemon/dist/adapters/pi-runner.d.ts +67 -2
  150. package/daemon/dist/adapters/pi-runner.d.ts.map +1 -1
  151. package/daemon/dist/adapters/pi-runner.js +333 -13
  152. package/daemon/dist/adapters/pi-runner.js.map +1 -1
  153. package/daemon/dist/adapters/pi-runtime-adapter.d.ts +16 -1
  154. package/daemon/dist/adapters/pi-runtime-adapter.d.ts.map +1 -1
  155. package/daemon/dist/adapters/pi-runtime-adapter.js +17 -0
  156. package/daemon/dist/adapters/pi-runtime-adapter.js.map +1 -1
  157. package/daemon/dist/adapters/preflight-exec.d.ts +3 -0
  158. package/daemon/dist/adapters/preflight-exec.d.ts.map +1 -1
  159. package/daemon/dist/adapters/preflight-exec.js +15 -7
  160. package/daemon/dist/adapters/preflight-exec.js.map +1 -1
  161. package/daemon/dist/adapters/replace-file.d.ts +8 -0
  162. package/daemon/dist/adapters/replace-file.d.ts.map +1 -0
  163. package/daemon/dist/adapters/replace-file.js +32 -0
  164. package/daemon/dist/adapters/replace-file.js.map +1 -0
  165. package/daemon/dist/adapters/tmux-control.d.ts +119 -0
  166. package/daemon/dist/adapters/tmux-control.d.ts.map +1 -0
  167. package/daemon/dist/adapters/tmux-control.js +547 -0
  168. package/daemon/dist/adapters/tmux-control.js.map +1 -0
  169. package/daemon/dist/adapters/tmux-exec.d.ts +18 -4
  170. package/daemon/dist/adapters/tmux-exec.d.ts.map +1 -1
  171. package/daemon/dist/adapters/tmux-exec.js +98 -17
  172. package/daemon/dist/adapters/tmux-exec.js.map +1 -1
  173. package/daemon/dist/adapters/tmux.d.ts +52 -15
  174. package/daemon/dist/adapters/tmux.d.ts.map +1 -1
  175. package/daemon/dist/adapters/tmux.js +232 -58
  176. package/daemon/dist/adapters/tmux.js.map +1 -1
  177. package/daemon/dist/build-info.js +3 -3
  178. package/daemon/dist/composer-prompts-surface.d.ts +2 -0
  179. package/daemon/dist/composer-prompts-surface.d.ts.map +1 -0
  180. package/daemon/dist/composer-prompts-surface.js +2 -0
  181. package/daemon/dist/composer-prompts-surface.js.map +1 -0
  182. package/daemon/dist/db/all-migrations.d.ts.map +1 -1
  183. package/daemon/dist/db/all-migrations.js +24 -0
  184. package/daemon/dist/db/all-migrations.js.map +1 -1
  185. package/daemon/dist/db/migrations/100_typing_guard_modes.d.ts +3 -0
  186. package/daemon/dist/db/migrations/100_typing_guard_modes.d.ts.map +1 -0
  187. package/daemon/dist/db/migrations/100_typing_guard_modes.js +10 -0
  188. package/daemon/dist/db/migrations/100_typing_guard_modes.js.map +1 -0
  189. package/daemon/dist/db/migrations/104_node_effort_choice.d.ts +3 -0
  190. package/daemon/dist/db/migrations/104_node_effort_choice.d.ts.map +1 -0
  191. package/daemon/dist/db/migrations/104_node_effort_choice.js +10 -0
  192. package/daemon/dist/db/migrations/104_node_effort_choice.js.map +1 -0
  193. package/daemon/dist/db/migrations/105_usage_samples_client_cost.d.ts +9 -0
  194. package/daemon/dist/db/migrations/105_usage_samples_client_cost.d.ts.map +1 -0
  195. package/daemon/dist/db/migrations/105_usage_samples_client_cost.js +14 -0
  196. package/daemon/dist/db/migrations/105_usage_samples_client_cost.js.map +1 -0
  197. package/daemon/dist/db/migrations/107_pi_usage_entries.d.ts +10 -0
  198. package/daemon/dist/db/migrations/107_pi_usage_entries.d.ts.map +1 -0
  199. package/daemon/dist/db/migrations/107_pi_usage_entries.js +38 -0
  200. package/daemon/dist/db/migrations/107_pi_usage_entries.js.map +1 -0
  201. package/daemon/dist/db/migrations/108_pi_usage_charges.d.ts +12 -0
  202. package/daemon/dist/db/migrations/108_pi_usage_charges.d.ts.map +1 -0
  203. package/daemon/dist/db/migrations/108_pi_usage_charges.js +39 -0
  204. package/daemon/dist/db/migrations/108_pi_usage_charges.js.map +1 -0
  205. package/daemon/dist/db/migrations/109_mode_posture_coexist.d.ts +5 -0
  206. package/daemon/dist/db/migrations/109_mode_posture_coexist.d.ts.map +1 -0
  207. package/daemon/dist/db/migrations/109_mode_posture_coexist.js +11 -0
  208. package/daemon/dist/db/migrations/109_mode_posture_coexist.js.map +1 -0
  209. package/daemon/dist/db/migrations/110_workflow_instance_scope.d.ts +10 -0
  210. package/daemon/dist/db/migrations/110_workflow_instance_scope.d.ts.map +1 -0
  211. package/daemon/dist/db/migrations/110_workflow_instance_scope.js +14 -0
  212. package/daemon/dist/db/migrations/110_workflow_instance_scope.js.map +1 -0
  213. package/daemon/dist/db/migrations/111_seat_env.d.ts +6 -0
  214. package/daemon/dist/db/migrations/111_seat_env.d.ts.map +1 -0
  215. package/daemon/dist/db/migrations/111_seat_env.js +11 -0
  216. package/daemon/dist/db/migrations/111_seat_env.js.map +1 -0
  217. package/daemon/dist/db/migrations/112_queue_transitions_ts_qitem.d.ts +3 -0
  218. package/daemon/dist/db/migrations/112_queue_transitions_ts_qitem.d.ts.map +1 -0
  219. package/daemon/dist/db/migrations/112_queue_transitions_ts_qitem.js +14 -0
  220. package/daemon/dist/db/migrations/112_queue_transitions_ts_qitem.js.map +1 -0
  221. package/daemon/dist/db/migrations/113_applied_launch_daemon_opt_out.d.ts +3 -0
  222. package/daemon/dist/db/migrations/113_applied_launch_daemon_opt_out.d.ts.map +1 -0
  223. package/daemon/dist/db/migrations/113_applied_launch_daemon_opt_out.js +9 -0
  224. package/daemon/dist/db/migrations/113_applied_launch_daemon_opt_out.js.map +1 -0
  225. package/daemon/dist/db/migrations/114_session_agent_app.d.ts +3 -0
  226. package/daemon/dist/db/migrations/114_session_agent_app.d.ts.map +1 -0
  227. package/daemon/dist/db/migrations/114_session_agent_app.js +11 -0
  228. package/daemon/dist/db/migrations/114_session_agent_app.js.map +1 -0
  229. package/daemon/dist/db/migrations/115_thread_seat_map_channel_key.d.ts +3 -0
  230. package/daemon/dist/db/migrations/115_thread_seat_map_channel_key.d.ts.map +1 -0
  231. package/daemon/dist/db/migrations/115_thread_seat_map_channel_key.js +28 -0
  232. package/daemon/dist/db/migrations/115_thread_seat_map_channel_key.js.map +1 -0
  233. package/daemon/dist/domain/activity-taxonomy.d.ts +13 -5
  234. package/daemon/dist/domain/activity-taxonomy.d.ts.map +1 -1
  235. package/daemon/dist/domain/activity-taxonomy.js +14 -2
  236. package/daemon/dist/domain/activity-taxonomy.js.map +1 -1
  237. package/daemon/dist/domain/agent-activity-store.d.ts +2 -0
  238. package/daemon/dist/domain/agent-activity-store.d.ts.map +1 -1
  239. package/daemon/dist/domain/agent-activity-store.js +14 -8
  240. package/daemon/dist/domain/agent-activity-store.js.map +1 -1
  241. package/daemon/dist/domain/agent-images/agent-image-library-service.js +1 -1
  242. package/daemon/dist/domain/agent-images/agent-image-library-service.js.map +1 -1
  243. package/daemon/dist/domain/agent-images/manifest-parser.js +1 -1
  244. package/daemon/dist/domain/agent-images/manifest-parser.js.map +1 -1
  245. package/daemon/dist/domain/agent-manifest.d.ts.map +1 -1
  246. package/daemon/dist/domain/agent-manifest.js +21 -3
  247. package/daemon/dist/domain/agent-manifest.js.map +1 -1
  248. package/daemon/dist/domain/applied-launch-observation-store.d.ts +2 -0
  249. package/daemon/dist/domain/applied-launch-observation-store.d.ts.map +1 -1
  250. package/daemon/dist/domain/applied-launch-observation-store.js +27 -3
  251. package/daemon/dist/domain/applied-launch-observation-store.js.map +1 -1
  252. package/daemon/dist/domain/bootstrap-orchestrator.d.ts +3 -0
  253. package/daemon/dist/domain/bootstrap-orchestrator.d.ts.map +1 -1
  254. package/daemon/dist/domain/bootstrap-orchestrator.js +49 -16
  255. package/daemon/dist/domain/bootstrap-orchestrator.js.map +1 -1
  256. package/daemon/dist/domain/built-in-runtimes.d.ts +10 -0
  257. package/daemon/dist/domain/built-in-runtimes.d.ts.map +1 -0
  258. package/daemon/dist/domain/built-in-runtimes.js +14 -0
  259. package/daemon/dist/domain/built-in-runtimes.js.map +1 -0
  260. package/daemon/dist/domain/bundle-archive.d.ts +3 -1
  261. package/daemon/dist/domain/bundle-archive.d.ts.map +1 -1
  262. package/daemon/dist/domain/bundle-archive.js +5 -3
  263. package/daemon/dist/domain/bundle-archive.js.map +1 -1
  264. package/daemon/dist/domain/bundle-behaviour.d.ts +20 -0
  265. package/daemon/dist/domain/bundle-behaviour.d.ts.map +1 -1
  266. package/daemon/dist/domain/bundle-behaviour.js +57 -1
  267. package/daemon/dist/domain/bundle-behaviour.js.map +1 -1
  268. package/daemon/dist/domain/bundle-integrity.d.ts +5 -2
  269. package/daemon/dist/domain/bundle-integrity.d.ts.map +1 -1
  270. package/daemon/dist/domain/bundle-integrity.js +39 -8
  271. package/daemon/dist/domain/bundle-integrity.js.map +1 -1
  272. package/daemon/dist/domain/bundle-source-resolver.d.ts +3 -1
  273. package/daemon/dist/domain/bundle-source-resolver.d.ts.map +1 -1
  274. package/daemon/dist/domain/bundle-source-resolver.js +7 -2
  275. package/daemon/dist/domain/bundle-source-resolver.js.map +1 -1
  276. package/daemon/dist/domain/bundle-types.d.ts +6 -0
  277. package/daemon/dist/domain/bundle-types.d.ts.map +1 -1
  278. package/daemon/dist/domain/bundle-types.js +26 -0
  279. package/daemon/dist/domain/bundle-types.js.map +1 -1
  280. package/daemon/dist/domain/chat-repository.d.ts.map +1 -1
  281. package/daemon/dist/domain/chat-repository.js +3 -2
  282. package/daemon/dist/domain/chat-repository.js.map +1 -1
  283. package/daemon/dist/domain/claim-service.d.ts +6 -0
  284. package/daemon/dist/domain/claim-service.d.ts.map +1 -1
  285. package/daemon/dist/domain/claim-service.js +20 -1
  286. package/daemon/dist/domain/claim-service.js.map +1 -1
  287. package/daemon/dist/domain/claude-compaction-enforcer.d.ts +63 -2
  288. package/daemon/dist/domain/claude-compaction-enforcer.d.ts.map +1 -1
  289. package/daemon/dist/domain/claude-compaction-enforcer.js +154 -16
  290. package/daemon/dist/domain/claude-compaction-enforcer.js.map +1 -1
  291. package/daemon/dist/domain/claude-core-plugin-env.d.ts +26 -0
  292. package/daemon/dist/domain/claude-core-plugin-env.d.ts.map +1 -0
  293. package/daemon/dist/domain/claude-core-plugin-env.js +86 -0
  294. package/daemon/dist/domain/claude-core-plugin-env.js.map +1 -0
  295. package/daemon/dist/domain/claude-managed-launch.d.ts +13 -6
  296. package/daemon/dist/domain/claude-managed-launch.d.ts.map +1 -1
  297. package/daemon/dist/domain/claude-managed-launch.js +58 -5
  298. package/daemon/dist/domain/claude-managed-launch.js.map +1 -1
  299. package/daemon/dist/domain/codex-thread-id.d.ts +22 -3
  300. package/daemon/dist/domain/codex-thread-id.d.ts.map +1 -1
  301. package/daemon/dist/domain/codex-thread-id.js +65 -16
  302. package/daemon/dist/domain/codex-thread-id.js.map +1 -1
  303. package/daemon/dist/domain/community-harness-presets.d.ts +38 -0
  304. package/daemon/dist/domain/community-harness-presets.d.ts.map +1 -0
  305. package/daemon/dist/domain/community-harness-presets.js +155 -0
  306. package/daemon/dist/domain/community-harness-presets.js.map +1 -0
  307. package/daemon/dist/domain/composer-prompts.d.ts +118 -0
  308. package/daemon/dist/domain/composer-prompts.d.ts.map +1 -0
  309. package/daemon/dist/domain/composer-prompts.js +165 -0
  310. package/daemon/dist/domain/composer-prompts.js.map +1 -0
  311. package/daemon/dist/domain/context-monitor.d.ts +3 -0
  312. package/daemon/dist/domain/context-monitor.d.ts.map +1 -1
  313. package/daemon/dist/domain/context-monitor.js +14 -2
  314. package/daemon/dist/domain/context-monitor.js.map +1 -1
  315. package/daemon/dist/domain/context-packs/context-pack-library-service.js +2 -2
  316. package/daemon/dist/domain/context-packs/context-pack-library-service.js.map +1 -1
  317. package/daemon/dist/domain/context-packs/manifest-parser.js +1 -1
  318. package/daemon/dist/domain/context-packs/manifest-parser.js.map +1 -1
  319. package/daemon/dist/domain/context-usage-store.d.ts +4 -0
  320. package/daemon/dist/domain/context-usage-store.d.ts.map +1 -1
  321. package/daemon/dist/domain/context-usage-store.js +1 -0
  322. package/daemon/dist/domain/context-usage-store.js.map +1 -1
  323. package/daemon/dist/domain/current-work.js +2 -2
  324. package/daemon/dist/domain/current-work.js.map +1 -1
  325. package/daemon/dist/domain/draft-aware-delivery.d.ts +32 -0
  326. package/daemon/dist/domain/draft-aware-delivery.d.ts.map +1 -0
  327. package/daemon/dist/domain/draft-aware-delivery.js +156 -0
  328. package/daemon/dist/domain/draft-aware-delivery.js.map +1 -0
  329. package/daemon/dist/domain/event-bus.d.ts +10 -1
  330. package/daemon/dist/domain/event-bus.d.ts.map +1 -1
  331. package/daemon/dist/domain/event-bus.js +25 -0
  332. package/daemon/dist/domain/event-bus.js.map +1 -1
  333. package/daemon/dist/domain/execution-view.d.ts.map +1 -1
  334. package/daemon/dist/domain/execution-view.js +76 -10
  335. package/daemon/dist/domain/execution-view.js.map +1 -1
  336. package/daemon/dist/domain/frontmatter.d.ts +11 -0
  337. package/daemon/dist/domain/frontmatter.d.ts.map +1 -0
  338. package/daemon/dist/domain/frontmatter.js +20 -0
  339. package/daemon/dist/domain/frontmatter.js.map +1 -0
  340. package/daemon/dist/domain/gateway/gateway-subsystem.d.ts +11 -0
  341. package/daemon/dist/domain/gateway/gateway-subsystem.d.ts.map +1 -1
  342. package/daemon/dist/domain/gateway/gateway-subsystem.js +7 -0
  343. package/daemon/dist/domain/gateway/gateway-subsystem.js.map +1 -1
  344. package/daemon/dist/domain/gateway/human-registry.d.ts +6 -1
  345. package/daemon/dist/domain/gateway/human-registry.d.ts.map +1 -1
  346. package/daemon/dist/domain/gateway/human-registry.js +7 -0
  347. package/daemon/dist/domain/gateway/human-registry.js.map +1 -1
  348. package/daemon/dist/domain/gateway/slack/bot-inbox.d.ts +54 -0
  349. package/daemon/dist/domain/gateway/slack/bot-inbox.d.ts.map +1 -0
  350. package/daemon/dist/domain/gateway/slack/bot-inbox.js +86 -0
  351. package/daemon/dist/domain/gateway/slack/bot-inbox.js.map +1 -0
  352. package/daemon/dist/domain/gateway/slack/capabilities.d.ts.map +1 -1
  353. package/daemon/dist/domain/gateway/slack/capabilities.js +1 -0
  354. package/daemon/dist/domain/gateway/slack/capabilities.js.map +1 -1
  355. package/daemon/dist/domain/gateway/slack/channel-map.d.ts +11 -1
  356. package/daemon/dist/domain/gateway/slack/channel-map.d.ts.map +1 -1
  357. package/daemon/dist/domain/gateway/slack/channel-map.js +31 -6
  358. package/daemon/dist/domain/gateway/slack/channel-map.js.map +1 -1
  359. package/daemon/dist/domain/gateway/slack/config.d.ts +14 -0
  360. package/daemon/dist/domain/gateway/slack/config.d.ts.map +1 -1
  361. package/daemon/dist/domain/gateway/slack/config.js +28 -0
  362. package/daemon/dist/domain/gateway/slack/config.js.map +1 -1
  363. package/daemon/dist/domain/gateway/slack/forwarding.d.ts +32 -0
  364. package/daemon/dist/domain/gateway/slack/forwarding.d.ts.map +1 -0
  365. package/daemon/dist/domain/gateway/slack/forwarding.js +76 -0
  366. package/daemon/dist/domain/gateway/slack/forwarding.js.map +1 -0
  367. package/daemon/dist/domain/gateway/slack/inbound.d.ts +99 -1
  368. package/daemon/dist/domain/gateway/slack/inbound.d.ts.map +1 -1
  369. package/daemon/dist/domain/gateway/slack/inbound.js +325 -7
  370. package/daemon/dist/domain/gateway/slack/inbound.js.map +1 -1
  371. package/daemon/dist/domain/gateway/slack/message.d.ts +28 -0
  372. package/daemon/dist/domain/gateway/slack/message.d.ts.map +1 -1
  373. package/daemon/dist/domain/gateway/slack/message.js +105 -4
  374. package/daemon/dist/domain/gateway/slack/message.js.map +1 -1
  375. package/daemon/dist/domain/gateway/slack/outbound-driver.d.ts +3 -0
  376. package/daemon/dist/domain/gateway/slack/outbound-driver.d.ts.map +1 -1
  377. package/daemon/dist/domain/gateway/slack/outbound-driver.js +1 -0
  378. package/daemon/dist/domain/gateway/slack/outbound-driver.js.map +1 -1
  379. package/daemon/dist/domain/gateway/slack/queue-access.d.ts +1 -1
  380. package/daemon/dist/domain/gateway/slack/queue-access.d.ts.map +1 -1
  381. package/daemon/dist/domain/gateway/slack/slack-api.d.ts +10 -0
  382. package/daemon/dist/domain/gateway/slack/slack-api.d.ts.map +1 -1
  383. package/daemon/dist/domain/gateway/slack/slack-api.js +13 -0
  384. package/daemon/dist/domain/gateway/slack/slack-api.js.map +1 -1
  385. package/daemon/dist/domain/gateway/slack/slack-delivery.d.ts +2 -0
  386. package/daemon/dist/domain/gateway/slack/slack-delivery.d.ts.map +1 -1
  387. package/daemon/dist/domain/gateway/slack/slack-delivery.js +12 -2
  388. package/daemon/dist/domain/gateway/slack/slack-delivery.js.map +1 -1
  389. package/daemon/dist/domain/gateway/slack/slack-subsystem.d.ts +3 -0
  390. package/daemon/dist/domain/gateway/slack/slack-subsystem.d.ts.map +1 -1
  391. package/daemon/dist/domain/gateway/slack/slack-subsystem.js +133 -20
  392. package/daemon/dist/domain/gateway/slack/slack-subsystem.js.map +1 -1
  393. package/daemon/dist/domain/gateway/slack/state-store.d.ts +9 -2
  394. package/daemon/dist/domain/gateway/slack/state-store.d.ts.map +1 -1
  395. package/daemon/dist/domain/gateway/slack/state-store.js +24 -2
  396. package/daemon/dist/domain/gateway/slack/state-store.js.map +1 -1
  397. package/daemon/dist/domain/gateway/slack/thread-routing.d.ts +3 -0
  398. package/daemon/dist/domain/gateway/slack/thread-routing.d.ts.map +1 -1
  399. package/daemon/dist/domain/gateway/slack/thread-routing.js +18 -7
  400. package/daemon/dist/domain/gateway/slack/thread-routing.js.map +1 -1
  401. package/daemon/dist/domain/gateway/slack/thread-seat-map.d.ts +17 -6
  402. package/daemon/dist/domain/gateway/slack/thread-seat-map.d.ts.map +1 -1
  403. package/daemon/dist/domain/gateway/slack/thread-seat-map.js +41 -23
  404. package/daemon/dist/domain/gateway/slack/thread-seat-map.js.map +1 -1
  405. package/daemon/dist/domain/history-query.d.ts.map +1 -1
  406. package/daemon/dist/domain/history-query.js +2 -1
  407. package/daemon/dist/domain/history-query.js.map +1 -1
  408. package/daemon/dist/domain/home-isolation.d.ts +18 -0
  409. package/daemon/dist/domain/home-isolation.d.ts.map +1 -0
  410. package/daemon/dist/domain/home-isolation.js +75 -0
  411. package/daemon/dist/domain/home-isolation.js.map +1 -0
  412. package/daemon/dist/domain/hosts/remote-daemon-http.d.ts +22 -0
  413. package/daemon/dist/domain/hosts/remote-daemon-http.d.ts.map +1 -1
  414. package/daemon/dist/domain/hosts/remote-daemon-http.js +43 -3
  415. package/daemon/dist/domain/hosts/remote-daemon-http.js.map +1 -1
  416. package/daemon/dist/domain/inbox-handler.d.ts.map +1 -1
  417. package/daemon/dist/domain/inbox-handler.js +34 -32
  418. package/daemon/dist/domain/inbox-handler.js.map +1 -1
  419. package/daemon/dist/domain/mission-control/notification-adapter-ntfy.js +12 -2
  420. package/daemon/dist/domain/mission-control/notification-adapter-ntfy.js.map +1 -1
  421. package/daemon/dist/domain/mission-control/notification-dispatcher.d.ts.map +1 -1
  422. package/daemon/dist/domain/mission-control/notification-dispatcher.js +2 -1
  423. package/daemon/dist/domain/mission-control/notification-dispatcher.js.map +1 -1
  424. package/daemon/dist/domain/model-divergence/current-generation-record.d.ts +63 -0
  425. package/daemon/dist/domain/model-divergence/current-generation-record.d.ts.map +1 -1
  426. package/daemon/dist/domain/model-divergence/current-generation-record.js +130 -1
  427. package/daemon/dist/domain/model-divergence/current-generation-record.js.map +1 -1
  428. package/daemon/dist/domain/model-divergence/effective-model-readers.d.ts +42 -0
  429. package/daemon/dist/domain/model-divergence/effective-model-readers.d.ts.map +1 -1
  430. package/daemon/dist/domain/model-divergence/effective-model-readers.js +160 -5
  431. package/daemon/dist/domain/model-divergence/effective-model-readers.js.map +1 -1
  432. package/daemon/dist/domain/model-divergence/model-divergence-monitor.d.ts +8 -2
  433. package/daemon/dist/domain/model-divergence/model-divergence-monitor.d.ts.map +1 -1
  434. package/daemon/dist/domain/model-divergence/model-divergence-monitor.js +10 -5
  435. package/daemon/dist/domain/model-divergence/model-divergence-monitor.js.map +1 -1
  436. package/daemon/dist/domain/native-process-lineage.d.ts +49 -0
  437. package/daemon/dist/domain/native-process-lineage.d.ts.map +1 -1
  438. package/daemon/dist/domain/native-process-lineage.js +129 -15
  439. package/daemon/dist/domain/native-process-lineage.js.map +1 -1
  440. package/daemon/dist/domain/native-resume-probe.d.ts +3 -1
  441. package/daemon/dist/domain/native-resume-probe.d.ts.map +1 -1
  442. package/daemon/dist/domain/native-resume-probe.js +43 -6
  443. package/daemon/dist/domain/native-resume-probe.js.map +1 -1
  444. package/daemon/dist/domain/node-inventory.d.ts.map +1 -1
  445. package/daemon/dist/domain/node-inventory.js +26 -9
  446. package/daemon/dist/domain/node-inventory.js.map +1 -1
  447. package/daemon/dist/domain/node-launcher.d.ts +18 -0
  448. package/daemon/dist/domain/node-launcher.d.ts.map +1 -1
  449. package/daemon/dist/domain/node-launcher.js +60 -2
  450. package/daemon/dist/domain/node-launcher.js.map +1 -1
  451. package/daemon/dist/domain/openrouter-charge.d.ts +42 -0
  452. package/daemon/dist/domain/openrouter-charge.d.ts.map +1 -0
  453. package/daemon/dist/domain/openrouter-charge.js +57 -0
  454. package/daemon/dist/domain/openrouter-charge.js.map +1 -0
  455. package/daemon/dist/domain/parked-query.d.ts +5 -0
  456. package/daemon/dist/domain/parked-query.d.ts.map +1 -1
  457. package/daemon/dist/domain/parked-query.js +9 -2
  458. package/daemon/dist/domain/parked-query.js.map +1 -1
  459. package/daemon/dist/domain/periodic-snapshot-scheduler.d.ts.map +1 -1
  460. package/daemon/dist/domain/periodic-snapshot-scheduler.js +27 -3
  461. package/daemon/dist/domain/periodic-snapshot-scheduler.js.map +1 -1
  462. package/daemon/dist/domain/permission-drift.d.ts +2 -0
  463. package/daemon/dist/domain/permission-drift.d.ts.map +1 -1
  464. package/daemon/dist/domain/permission-drift.js.map +1 -1
  465. package/daemon/dist/domain/permission-policy/policy-spec.d.ts.map +1 -1
  466. package/daemon/dist/domain/permission-policy/policy-spec.js +5 -7
  467. package/daemon/dist/domain/permission-policy/policy-spec.js.map +1 -1
  468. package/daemon/dist/domain/pi-usage-entries-store.d.ts +41 -0
  469. package/daemon/dist/domain/pi-usage-entries-store.d.ts.map +1 -0
  470. package/daemon/dist/domain/pi-usage-entries-store.js +173 -0
  471. package/daemon/dist/domain/pi-usage-entries-store.js.map +1 -0
  472. package/daemon/dist/domain/pi-usage-facts.d.ts +90 -0
  473. package/daemon/dist/domain/pi-usage-facts.d.ts.map +1 -0
  474. package/daemon/dist/domain/pi-usage-facts.js +165 -0
  475. package/daemon/dist/domain/pi-usage-facts.js.map +1 -0
  476. package/daemon/dist/domain/pod-bundle-assembler.d.ts +2 -0
  477. package/daemon/dist/domain/pod-bundle-assembler.d.ts.map +1 -1
  478. package/daemon/dist/domain/pod-bundle-assembler.js +4 -0
  479. package/daemon/dist/domain/pod-bundle-assembler.js.map +1 -1
  480. package/daemon/dist/domain/policies/artifact-pool-helpers.d.ts.map +1 -1
  481. package/daemon/dist/domain/policies/artifact-pool-helpers.js +6 -4
  482. package/daemon/dist/domain/policies/artifact-pool-helpers.js.map +1 -1
  483. package/daemon/dist/domain/profile-resolver.d.ts +2 -0
  484. package/daemon/dist/domain/profile-resolver.d.ts.map +1 -1
  485. package/daemon/dist/domain/profile-resolver.js +4 -0
  486. package/daemon/dist/domain/profile-resolver.js.map +1 -1
  487. package/daemon/dist/domain/progress/progress-indexer.js +1 -1
  488. package/daemon/dist/domain/progress/progress-indexer.js.map +1 -1
  489. package/daemon/dist/domain/project-lifecycle-compiler.d.ts +4 -0
  490. package/daemon/dist/domain/project-lifecycle-compiler.d.ts.map +1 -1
  491. package/daemon/dist/domain/project-lifecycle-compiler.js +63 -3
  492. package/daemon/dist/domain/project-lifecycle-compiler.js.map +1 -1
  493. package/daemon/dist/domain/proof/judgments.d.ts.map +1 -1
  494. package/daemon/dist/domain/proof/judgments.js +31 -2
  495. package/daemon/dist/domain/proof/judgments.js.map +1 -1
  496. package/daemon/dist/domain/provider/claude-auth-status-reader.d.ts +33 -0
  497. package/daemon/dist/domain/provider/claude-auth-status-reader.d.ts.map +1 -0
  498. package/daemon/dist/domain/provider/claude-auth-status-reader.js +195 -0
  499. package/daemon/dist/domain/provider/claude-auth-status-reader.js.map +1 -0
  500. package/daemon/dist/domain/provider/claude-usage-windows.d.ts +68 -0
  501. package/daemon/dist/domain/provider/claude-usage-windows.d.ts.map +1 -0
  502. package/daemon/dist/domain/provider/claude-usage-windows.js +260 -0
  503. package/daemon/dist/domain/provider/claude-usage-windows.js.map +1 -0
  504. package/daemon/dist/domain/provider/codex-auth-reader.d.ts +14 -0
  505. package/daemon/dist/domain/provider/codex-auth-reader.d.ts.map +1 -1
  506. package/daemon/dist/domain/provider/codex-auth-reader.js +41 -12
  507. package/daemon/dist/domain/provider/codex-auth-reader.js.map +1 -1
  508. package/daemon/dist/domain/provider/codex-usage-reader.d.ts +2 -0
  509. package/daemon/dist/domain/provider/codex-usage-reader.d.ts.map +1 -1
  510. package/daemon/dist/domain/provider/codex-usage-reader.js +3 -1
  511. package/daemon/dist/domain/provider/codex-usage-reader.js.map +1 -1
  512. package/daemon/dist/domain/provider/codex-usage-windows.d.ts +10 -49
  513. package/daemon/dist/domain/provider/codex-usage-windows.d.ts.map +1 -1
  514. package/daemon/dist/domain/provider/codex-usage-windows.js +15 -173
  515. package/daemon/dist/domain/provider/codex-usage-windows.js.map +1 -1
  516. package/daemon/dist/domain/provider/provider-seat-accounts.d.ts +18 -0
  517. package/daemon/dist/domain/provider/provider-seat-accounts.d.ts.map +1 -0
  518. package/daemon/dist/domain/provider/provider-seat-accounts.js +159 -0
  519. package/daemon/dist/domain/provider/provider-seat-accounts.js.map +1 -0
  520. package/daemon/dist/domain/provider/provider-service-impl.d.ts +7 -2
  521. package/daemon/dist/domain/provider/provider-service-impl.d.ts.map +1 -1
  522. package/daemon/dist/domain/provider/provider-service-impl.js +20 -2
  523. package/daemon/dist/domain/provider/provider-service-impl.js.map +1 -1
  524. package/daemon/dist/domain/provider/provider-service.d.ts +4 -2
  525. package/daemon/dist/domain/provider/provider-service.d.ts.map +1 -1
  526. package/daemon/dist/domain/provider/provider-types.d.ts +72 -4
  527. package/daemon/dist/domain/provider/provider-types.d.ts.map +1 -1
  528. package/daemon/dist/domain/provider/reactive-tap.js +2 -0
  529. package/daemon/dist/domain/provider/reactive-tap.js.map +1 -1
  530. package/daemon/dist/domain/provider/subscription-moves.d.ts +77 -0
  531. package/daemon/dist/domain/provider/subscription-moves.d.ts.map +1 -0
  532. package/daemon/dist/domain/provider/subscription-moves.js +140 -0
  533. package/daemon/dist/domain/provider/subscription-moves.js.map +1 -0
  534. package/daemon/dist/domain/provider/usage-across-hosts.d.ts +162 -0
  535. package/daemon/dist/domain/provider/usage-across-hosts.d.ts.map +1 -0
  536. package/daemon/dist/domain/provider/usage-across-hosts.js +563 -0
  537. package/daemon/dist/domain/provider/usage-across-hosts.js.map +1 -0
  538. package/daemon/dist/domain/provider/usage-windows.d.ts +88 -0
  539. package/daemon/dist/domain/provider/usage-windows.d.ts.map +1 -0
  540. package/daemon/dist/domain/provider/usage-windows.js +189 -0
  541. package/daemon/dist/domain/provider/usage-windows.js.map +1 -0
  542. package/daemon/dist/domain/queue-owner.d.ts +6 -0
  543. package/daemon/dist/domain/queue-owner.d.ts.map +1 -1
  544. package/daemon/dist/domain/queue-owner.js +22 -0
  545. package/daemon/dist/domain/queue-owner.js.map +1 -1
  546. package/daemon/dist/domain/queue-repository.d.ts +89 -14
  547. package/daemon/dist/domain/queue-repository.d.ts.map +1 -1
  548. package/daemon/dist/domain/queue-repository.js +331 -86
  549. package/daemon/dist/domain/queue-repository.js.map +1 -1
  550. package/daemon/dist/domain/queue-stuck-sweep.d.ts.map +1 -1
  551. package/daemon/dist/domain/queue-stuck-sweep.js +9 -21
  552. package/daemon/dist/domain/queue-stuck-sweep.js.map +1 -1
  553. package/daemon/dist/domain/queue-transition-log.d.ts +23 -2
  554. package/daemon/dist/domain/queue-transition-log.d.ts.map +1 -1
  555. package/daemon/dist/domain/queue-transition-log.js +98 -39
  556. package/daemon/dist/domain/queue-transition-log.js.map +1 -1
  557. package/daemon/dist/domain/queue-wake-ladder.d.ts +2 -2
  558. package/daemon/dist/domain/queue-wake-ladder.d.ts.map +1 -1
  559. package/daemon/dist/domain/queue-wake-ladder.js +27 -8
  560. package/daemon/dist/domain/queue-wake-ladder.js.map +1 -1
  561. package/daemon/dist/domain/queue-wake-repository.d.ts +7 -1
  562. package/daemon/dist/domain/queue-wake-repository.d.ts.map +1 -1
  563. package/daemon/dist/domain/queue-wake-repository.js +54 -5
  564. package/daemon/dist/domain/queue-wake-repository.js.map +1 -1
  565. package/daemon/dist/domain/reply-to-choice.d.ts +2 -0
  566. package/daemon/dist/domain/reply-to-choice.d.ts.map +1 -1
  567. package/daemon/dist/domain/reply-to-choice.js +2 -0
  568. package/daemon/dist/domain/reply-to-choice.js.map +1 -1
  569. package/daemon/dist/domain/restore-check-service.d.ts.map +1 -1
  570. package/daemon/dist/domain/restore-check-service.js +3 -2
  571. package/daemon/dist/domain/restore-check-service.js.map +1 -1
  572. package/daemon/dist/domain/restore-orchestrator.d.ts.map +1 -1
  573. package/daemon/dist/domain/restore-orchestrator.js +78 -14
  574. package/daemon/dist/domain/restore-orchestrator.js.map +1 -1
  575. package/daemon/dist/domain/restore-plan-preview.d.ts.map +1 -1
  576. package/daemon/dist/domain/restore-plan-preview.js +23 -19
  577. package/daemon/dist/domain/restore-plan-preview.js.map +1 -1
  578. package/daemon/dist/domain/restore-policy.d.ts +26 -0
  579. package/daemon/dist/domain/restore-policy.d.ts.map +1 -0
  580. package/daemon/dist/domain/restore-policy.js +22 -0
  581. package/daemon/dist/domain/restore-policy.js.map +1 -0
  582. package/daemon/dist/domain/restore-preconditions.d.ts +2 -0
  583. package/daemon/dist/domain/restore-preconditions.d.ts.map +1 -1
  584. package/daemon/dist/domain/restore-preconditions.js +6 -1
  585. package/daemon/dist/domain/restore-preconditions.js.map +1 -1
  586. package/daemon/dist/domain/restore-runtime-compatibility.d.ts +3 -0
  587. package/daemon/dist/domain/restore-runtime-compatibility.d.ts.map +1 -0
  588. package/daemon/dist/domain/restore-runtime-compatibility.js +7 -0
  589. package/daemon/dist/domain/restore-runtime-compatibility.js.map +1 -0
  590. package/daemon/dist/domain/resume-metadata-refresher.d.ts +10 -5
  591. package/daemon/dist/domain/resume-metadata-refresher.d.ts.map +1 -1
  592. package/daemon/dist/domain/resume-metadata-refresher.js +109 -21
  593. package/daemon/dist/domain/resume-metadata-refresher.js.map +1 -1
  594. package/daemon/dist/domain/resume-token-capture.d.ts +1 -1
  595. package/daemon/dist/domain/resume-token-capture.d.ts.map +1 -1
  596. package/daemon/dist/domain/resume-token-capture.js +7 -1
  597. package/daemon/dist/domain/resume-token-capture.js.map +1 -1
  598. package/daemon/dist/domain/review/compose.d.ts.map +1 -1
  599. package/daemon/dist/domain/review/compose.js +5 -4
  600. package/daemon/dist/domain/review/compose.js.map +1 -1
  601. package/daemon/dist/domain/review/gather.d.ts +2 -1
  602. package/daemon/dist/domain/review/gather.d.ts.map +1 -1
  603. package/daemon/dist/domain/review/gather.js +25 -17
  604. package/daemon/dist/domain/review/gather.js.map +1 -1
  605. package/daemon/dist/domain/rig-lifecycle-service.d.ts +31 -8
  606. package/daemon/dist/domain/rig-lifecycle-service.d.ts.map +1 -1
  607. package/daemon/dist/domain/rig-lifecycle-service.js +253 -98
  608. package/daemon/dist/domain/rig-lifecycle-service.js.map +1 -1
  609. package/daemon/dist/domain/rig-mode/rig-mode-store.d.ts +11 -1
  610. package/daemon/dist/domain/rig-mode/rig-mode-store.d.ts.map +1 -1
  611. package/daemon/dist/domain/rig-mode/rig-mode-store.js +69 -48
  612. package/daemon/dist/domain/rig-mode/rig-mode-store.js.map +1 -1
  613. package/daemon/dist/domain/rig-repository.d.ts +18 -0
  614. package/daemon/dist/domain/rig-repository.d.ts.map +1 -1
  615. package/daemon/dist/domain/rig-repository.js +52 -1
  616. package/daemon/dist/domain/rig-repository.js.map +1 -1
  617. package/daemon/dist/domain/rig-teardown.d.ts +4 -1
  618. package/daemon/dist/domain/rig-teardown.d.ts.map +1 -1
  619. package/daemon/dist/domain/rig-teardown.js +40 -2
  620. package/daemon/dist/domain/rig-teardown.js.map +1 -1
  621. package/daemon/dist/domain/rigspec-codec.d.ts.map +1 -1
  622. package/daemon/dist/domain/rigspec-codec.js +7 -0
  623. package/daemon/dist/domain/rigspec-codec.js.map +1 -1
  624. package/daemon/dist/domain/rigspec-exporter.d.ts.map +1 -1
  625. package/daemon/dist/domain/rigspec-exporter.js +4 -0
  626. package/daemon/dist/domain/rigspec-exporter.js.map +1 -1
  627. package/daemon/dist/domain/rigspec-instantiator.d.ts +3 -0
  628. package/daemon/dist/domain/rigspec-instantiator.d.ts.map +1 -1
  629. package/daemon/dist/domain/rigspec-instantiator.js +28 -5
  630. package/daemon/dist/domain/rigspec-instantiator.js.map +1 -1
  631. package/daemon/dist/domain/rigspec-preflight.d.ts.map +1 -1
  632. package/daemon/dist/domain/rigspec-preflight.js +18 -5
  633. package/daemon/dist/domain/rigspec-preflight.js.map +1 -1
  634. package/daemon/dist/domain/rigspec-schema.d.ts.map +1 -1
  635. package/daemon/dist/domain/rigspec-schema.js +24 -2
  636. package/daemon/dist/domain/rigspec-schema.js.map +1 -1
  637. package/daemon/dist/domain/runtime-adapter.d.ts +11 -0
  638. package/daemon/dist/domain/runtime-adapter.d.ts.map +1 -1
  639. package/daemon/dist/domain/runtime-adapter.js.map +1 -1
  640. package/daemon/dist/domain/runtime-verifier.d.ts +15 -1
  641. package/daemon/dist/domain/runtime-verifier.d.ts.map +1 -1
  642. package/daemon/dist/domain/runtime-verifier.js +28 -4
  643. package/daemon/dist/domain/runtime-verifier.js.map +1 -1
  644. package/daemon/dist/domain/scope/logical-checkbox.js +1 -1
  645. package/daemon/dist/domain/scope/logical-checkbox.js.map +1 -1
  646. package/daemon/dist/domain/scope/scope-view-projection.d.ts.map +1 -1
  647. package/daemon/dist/domain/scope/scope-view-projection.js +23 -10
  648. package/daemon/dist/domain/scope/scope-view-projection.js.map +1 -1
  649. package/daemon/dist/domain/seat-activity-service.d.ts +9 -2
  650. package/daemon/dist/domain/seat-activity-service.d.ts.map +1 -1
  651. package/daemon/dist/domain/seat-activity-service.js +100 -15
  652. package/daemon/dist/domain/seat-activity-service.js.map +1 -1
  653. package/daemon/dist/domain/seat-attention-reconciler.d.ts +3 -0
  654. package/daemon/dist/domain/seat-attention-reconciler.d.ts.map +1 -1
  655. package/daemon/dist/domain/seat-attention-reconciler.js +114 -7
  656. package/daemon/dist/domain/seat-attention-reconciler.js.map +1 -1
  657. package/daemon/dist/domain/seat-delivery-guard.d.ts +36 -1
  658. package/daemon/dist/domain/seat-delivery-guard.d.ts.map +1 -1
  659. package/daemon/dist/domain/seat-delivery-guard.js +255 -22
  660. package/daemon/dist/domain/seat-delivery-guard.js.map +1 -1
  661. package/daemon/dist/domain/seat-effort.d.ts +115 -0
  662. package/daemon/dist/domain/seat-effort.d.ts.map +1 -0
  663. package/daemon/dist/domain/seat-effort.js +233 -0
  664. package/daemon/dist/domain/seat-effort.js.map +1 -0
  665. package/daemon/dist/domain/seat-env.d.ts +37 -0
  666. package/daemon/dist/domain/seat-env.d.ts.map +1 -0
  667. package/daemon/dist/domain/seat-env.js +94 -0
  668. package/daemon/dist/domain/seat-env.js.map +1 -0
  669. package/daemon/dist/domain/seat-handover-service.d.ts +5 -0
  670. package/daemon/dist/domain/seat-handover-service.d.ts.map +1 -1
  671. package/daemon/dist/domain/seat-handover-service.js +22 -4
  672. package/daemon/dist/domain/seat-handover-service.js.map +1 -1
  673. package/daemon/dist/domain/seat-identity-reconciler.d.ts.map +1 -1
  674. package/daemon/dist/domain/seat-identity-reconciler.js +19 -2
  675. package/daemon/dist/domain/seat-identity-reconciler.js.map +1 -1
  676. package/daemon/dist/domain/seat-lifecycle-service.d.ts +119 -5
  677. package/daemon/dist/domain/seat-lifecycle-service.d.ts.map +1 -1
  678. package/daemon/dist/domain/seat-lifecycle-service.js +318 -23
  679. package/daemon/dist/domain/seat-lifecycle-service.js.map +1 -1
  680. package/daemon/dist/domain/seat-restart-in-place.d.ts +13 -2
  681. package/daemon/dist/domain/seat-restart-in-place.d.ts.map +1 -1
  682. package/daemon/dist/domain/seat-restart-in-place.js +23 -4
  683. package/daemon/dist/domain/seat-restart-in-place.js.map +1 -1
  684. package/daemon/dist/domain/seat-structural-activity-service.d.ts +6 -2
  685. package/daemon/dist/domain/seat-structural-activity-service.d.ts.map +1 -1
  686. package/daemon/dist/domain/seat-structural-activity-service.js +45 -9
  687. package/daemon/dist/domain/seat-structural-activity-service.js.map +1 -1
  688. package/daemon/dist/domain/session-registry.d.ts +13 -1
  689. package/daemon/dist/domain/session-registry.d.ts.map +1 -1
  690. package/daemon/dist/domain/session-registry.js +29 -2
  691. package/daemon/dist/domain/session-registry.js.map +1 -1
  692. package/daemon/dist/domain/session-transport.d.ts +108 -1
  693. package/daemon/dist/domain/session-transport.d.ts.map +1 -1
  694. package/daemon/dist/domain/session-transport.js +1116 -129
  695. package/daemon/dist/domain/session-transport.js.map +1 -1
  696. package/daemon/dist/domain/slices/slice-detail-projector.d.ts +2 -0
  697. package/daemon/dist/domain/slices/slice-detail-projector.d.ts.map +1 -1
  698. package/daemon/dist/domain/slices/slice-detail-projector.js +16 -4
  699. package/daemon/dist/domain/slices/slice-detail-projector.js.map +1 -1
  700. package/daemon/dist/domain/slices/slice-indexer.d.ts +10 -0
  701. package/daemon/dist/domain/slices/slice-indexer.d.ts.map +1 -1
  702. package/daemon/dist/domain/slices/slice-indexer.js +84 -4
  703. package/daemon/dist/domain/slices/slice-indexer.js.map +1 -1
  704. package/daemon/dist/domain/snapshot-repository.d.ts +3 -0
  705. package/daemon/dist/domain/snapshot-repository.d.ts.map +1 -1
  706. package/daemon/dist/domain/snapshot-repository.js +19 -2
  707. package/daemon/dist/domain/snapshot-repository.js.map +1 -1
  708. package/daemon/dist/domain/spec-library-workflow-scanner.d.ts +1 -1
  709. package/daemon/dist/domain/spec-library-workflow-scanner.d.ts.map +1 -1
  710. package/daemon/dist/domain/spec-library-workflow-scanner.js +24 -21
  711. package/daemon/dist/domain/spec-library-workflow-scanner.js.map +1 -1
  712. package/daemon/dist/domain/spec-validation-advisory.js +1 -1
  713. package/daemon/dist/domain/spec-validation-advisory.js.map +1 -1
  714. package/daemon/dist/domain/startup-orchestrator.d.ts +31 -3
  715. package/daemon/dist/domain/startup-orchestrator.d.ts.map +1 -1
  716. package/daemon/dist/domain/startup-orchestrator.js +218 -60
  717. package/daemon/dist/domain/startup-orchestrator.js.map +1 -1
  718. package/daemon/dist/domain/startup-submission-evidence.d.ts +13 -3
  719. package/daemon/dist/domain/startup-submission-evidence.d.ts.map +1 -1
  720. package/daemon/dist/domain/startup-submission-evidence.js +34 -25
  721. package/daemon/dist/domain/startup-submission-evidence.js.map +1 -1
  722. package/daemon/dist/domain/startup-validation.d.ts.map +1 -1
  723. package/daemon/dist/domain/startup-validation.js +3 -0
  724. package/daemon/dist/domain/startup-validation.js.map +1 -1
  725. package/daemon/dist/domain/successor-session-launcher.d.ts +7 -1
  726. package/daemon/dist/domain/successor-session-launcher.d.ts.map +1 -1
  727. package/daemon/dist/domain/successor-session-launcher.js +5 -1
  728. package/daemon/dist/domain/successor-session-launcher.js.map +1 -1
  729. package/daemon/dist/domain/text-cut.d.ts +4 -0
  730. package/daemon/dist/domain/text-cut.d.ts.map +1 -0
  731. package/daemon/dist/domain/text-cut.js +7 -0
  732. package/daemon/dist/domain/text-cut.js.map +1 -0
  733. package/daemon/dist/domain/time-bound-advisory.d.ts +5 -0
  734. package/daemon/dist/domain/time-bound-advisory.d.ts.map +1 -0
  735. package/daemon/dist/domain/time-bound-advisory.js +25 -0
  736. package/daemon/dist/domain/time-bound-advisory.js.map +1 -0
  737. package/daemon/dist/domain/transcript-capture.d.ts +7 -0
  738. package/daemon/dist/domain/transcript-capture.d.ts.map +1 -1
  739. package/daemon/dist/domain/transcript-capture.js +22 -1
  740. package/daemon/dist/domain/transcript-capture.js.map +1 -1
  741. package/daemon/dist/domain/transcript-rotation.d.ts +12 -4
  742. package/daemon/dist/domain/transcript-rotation.d.ts.map +1 -1
  743. package/daemon/dist/domain/transcript-rotation.js +185 -23
  744. package/daemon/dist/domain/transcript-rotation.js.map +1 -1
  745. package/daemon/dist/domain/transcript-store.d.ts +1 -1
  746. package/daemon/dist/domain/transcript-store.d.ts.map +1 -1
  747. package/daemon/dist/domain/transcript-store.js +8 -4
  748. package/daemon/dist/domain/transcript-store.js.map +1 -1
  749. package/daemon/dist/domain/types.d.ts +53 -3
  750. package/daemon/dist/domain/types.d.ts.map +1 -1
  751. package/daemon/dist/domain/types.js.map +1 -1
  752. package/daemon/dist/domain/usage-samples-store.d.ts +8 -0
  753. package/daemon/dist/domain/usage-samples-store.d.ts.map +1 -1
  754. package/daemon/dist/domain/usage-samples-store.js +24 -5
  755. package/daemon/dist/domain/usage-samples-store.js.map +1 -1
  756. package/daemon/dist/domain/usage-series.d.ts +154 -2
  757. package/daemon/dist/domain/usage-series.d.ts.map +1 -1
  758. package/daemon/dist/domain/usage-series.js +208 -9
  759. package/daemon/dist/domain/usage-series.js.map +1 -1
  760. package/daemon/dist/domain/user-settings/settings-store.d.ts +1 -1
  761. package/daemon/dist/domain/user-settings/settings-store.d.ts.map +1 -1
  762. package/daemon/dist/domain/user-settings/settings-store.js +37 -1
  763. package/daemon/dist/domain/user-settings/settings-store.js.map +1 -1
  764. package/daemon/dist/domain/watchdog-jobs-repository.d.ts +3 -1
  765. package/daemon/dist/domain/watchdog-jobs-repository.d.ts.map +1 -1
  766. package/daemon/dist/domain/watchdog-jobs-repository.js +13 -1
  767. package/daemon/dist/domain/watchdog-jobs-repository.js.map +1 -1
  768. package/daemon/dist/domain/watchdog-policy-engine.d.ts +1 -0
  769. package/daemon/dist/domain/watchdog-policy-engine.d.ts.map +1 -1
  770. package/daemon/dist/domain/watchdog-policy-engine.js +31 -2
  771. package/daemon/dist/domain/watchdog-policy-engine.js.map +1 -1
  772. package/daemon/dist/domain/workflow-exception-escalation.d.ts.map +1 -1
  773. package/daemon/dist/domain/workflow-exception-escalation.js +3 -1
  774. package/daemon/dist/domain/workflow-exception-escalation.js.map +1 -1
  775. package/daemon/dist/domain/workflow-exception-readiness.d.ts.map +1 -1
  776. package/daemon/dist/domain/workflow-exception-readiness.js +7 -3
  777. package/daemon/dist/domain/workflow-exception-readiness.js.map +1 -1
  778. package/daemon/dist/domain/workflow-instance-store.d.ts +11 -0
  779. package/daemon/dist/domain/workflow-instance-store.d.ts.map +1 -1
  780. package/daemon/dist/domain/workflow-instance-store.js +18 -4
  781. package/daemon/dist/domain/workflow-instance-store.js.map +1 -1
  782. package/daemon/dist/domain/workflow-projector.d.ts.map +1 -1
  783. package/daemon/dist/domain/workflow-projector.js +5 -3
  784. package/daemon/dist/domain/workflow-projector.js.map +1 -1
  785. package/daemon/dist/domain/workflow-rig-placeholder.d.ts +24 -0
  786. package/daemon/dist/domain/workflow-rig-placeholder.d.ts.map +1 -0
  787. package/daemon/dist/domain/workflow-rig-placeholder.js +43 -0
  788. package/daemon/dist/domain/workflow-rig-placeholder.js.map +1 -0
  789. package/daemon/dist/domain/workflow-runtime.d.ts +10 -1
  790. package/daemon/dist/domain/workflow-runtime.d.ts.map +1 -1
  791. package/daemon/dist/domain/workflow-runtime.js +26 -13
  792. package/daemon/dist/domain/workflow-runtime.js.map +1 -1
  793. package/daemon/dist/domain/workflow-scope.d.ts +50 -0
  794. package/daemon/dist/domain/workflow-scope.d.ts.map +1 -0
  795. package/daemon/dist/domain/workflow-scope.js +129 -0
  796. package/daemon/dist/domain/workflow-scope.js.map +1 -0
  797. package/daemon/dist/domain/workflow-spec-cache.d.ts +10 -0
  798. package/daemon/dist/domain/workflow-spec-cache.d.ts.map +1 -1
  799. package/daemon/dist/domain/workflow-spec-cache.js +13 -0
  800. package/daemon/dist/domain/workflow-spec-cache.js.map +1 -1
  801. package/daemon/dist/domain/workflow-types.d.ts +4 -0
  802. package/daemon/dist/domain/workflow-types.d.ts.map +1 -1
  803. package/daemon/dist/domain/workflow-types.js.map +1 -1
  804. package/daemon/dist/domain/workflow-validator.d.ts.map +1 -1
  805. package/daemon/dist/domain/workflow-validator.js +3 -1
  806. package/daemon/dist/domain/workflow-validator.js.map +1 -1
  807. package/daemon/dist/domain/workspace/project-read.d.ts +2 -0
  808. package/daemon/dist/domain/workspace/project-read.d.ts.map +1 -1
  809. package/daemon/dist/domain/workspace/project-read.js +4 -0
  810. package/daemon/dist/domain/workspace/project-read.js.map +1 -1
  811. package/daemon/dist/index.d.ts.map +1 -1
  812. package/daemon/dist/index.js +10 -0
  813. package/daemon/dist/index.js.map +1 -1
  814. package/daemon/dist/lib/pane-envelope.js +1 -1
  815. package/daemon/dist/lib/pane-envelope.js.map +1 -1
  816. package/daemon/dist/middleware/json-body-error.d.ts +4 -3
  817. package/daemon/dist/middleware/json-body-error.d.ts.map +1 -1
  818. package/daemon/dist/middleware/json-body-error.js +18 -4
  819. package/daemon/dist/middleware/json-body-error.js.map +1 -1
  820. package/daemon/dist/routes/activity.d.ts.map +1 -1
  821. package/daemon/dist/routes/activity.js +78 -0
  822. package/daemon/dist/routes/activity.js.map +1 -1
  823. package/daemon/dist/routes/bundles.d.ts.map +1 -1
  824. package/daemon/dist/routes/bundles.js +39 -16
  825. package/daemon/dist/routes/bundles.js.map +1 -1
  826. package/daemon/dist/routes/community-harnesses.d.ts +3 -0
  827. package/daemon/dist/routes/community-harnesses.d.ts.map +1 -0
  828. package/daemon/dist/routes/community-harnesses.js +18 -0
  829. package/daemon/dist/routes/community-harnesses.js.map +1 -0
  830. package/daemon/dist/routes/compaction.d.ts +3 -0
  831. package/daemon/dist/routes/compaction.d.ts.map +1 -1
  832. package/daemon/dist/routes/compaction.js +14 -2
  833. package/daemon/dist/routes/compaction.js.map +1 -1
  834. package/daemon/dist/routes/events.js +26 -12
  835. package/daemon/dist/routes/events.js.map +1 -1
  836. package/daemon/dist/routes/gateway.d.ts +3 -0
  837. package/daemon/dist/routes/gateway.d.ts.map +1 -1
  838. package/daemon/dist/routes/gateway.js +15 -0
  839. package/daemon/dist/routes/gateway.js.map +1 -1
  840. package/daemon/dist/routes/hosts.d.ts.map +1 -1
  841. package/daemon/dist/routes/hosts.js +2 -1
  842. package/daemon/dist/routes/hosts.js.map +1 -1
  843. package/daemon/dist/routes/provider.d.ts +11 -1
  844. package/daemon/dist/routes/provider.d.ts.map +1 -1
  845. package/daemon/dist/routes/provider.js +182 -10
  846. package/daemon/dist/routes/provider.js.map +1 -1
  847. package/daemon/dist/routes/query-limit.d.ts +1 -0
  848. package/daemon/dist/routes/query-limit.d.ts.map +1 -1
  849. package/daemon/dist/routes/query-limit.js +1 -1
  850. package/daemon/dist/routes/query-limit.js.map +1 -1
  851. package/daemon/dist/routes/queue.d.ts.map +1 -1
  852. package/daemon/dist/routes/queue.js +44 -3
  853. package/daemon/dist/routes/queue.js.map +1 -1
  854. package/daemon/dist/routes/rig-mode.d.ts.map +1 -1
  855. package/daemon/dist/routes/rig-mode.js +66 -11
  856. package/daemon/dist/routes/rig-mode.js.map +1 -1
  857. package/daemon/dist/routes/scope-audit.d.ts.map +1 -1
  858. package/daemon/dist/routes/scope-audit.js +10 -0
  859. package/daemon/dist/routes/scope-audit.js.map +1 -1
  860. package/daemon/dist/routes/seat.d.ts.map +1 -1
  861. package/daemon/dist/routes/seat.js +63 -12
  862. package/daemon/dist/routes/seat.js.map +1 -1
  863. package/daemon/dist/routes/sessions.js +1 -1
  864. package/daemon/dist/routes/startup.d.ts.map +1 -1
  865. package/daemon/dist/routes/startup.js +9 -2
  866. package/daemon/dist/routes/startup.js.map +1 -1
  867. package/daemon/dist/routes/telemetry.d.ts.map +1 -1
  868. package/daemon/dist/routes/telemetry.js +13 -3
  869. package/daemon/dist/routes/telemetry.js.map +1 -1
  870. package/daemon/dist/routes/transcripts.d.ts.map +1 -1
  871. package/daemon/dist/routes/transcripts.js +14 -5
  872. package/daemon/dist/routes/transcripts.js.map +1 -1
  873. package/daemon/dist/routes/transport.d.ts.map +1 -1
  874. package/daemon/dist/routes/transport.js +13 -2
  875. package/daemon/dist/routes/transport.js.map +1 -1
  876. package/daemon/dist/routes/up.d.ts.map +1 -1
  877. package/daemon/dist/routes/up.js +4 -0
  878. package/daemon/dist/routes/up.js.map +1 -1
  879. package/daemon/dist/routes/workflow.d.ts.map +1 -1
  880. package/daemon/dist/routes/workflow.js +50 -1
  881. package/daemon/dist/routes/workflow.js.map +1 -1
  882. package/daemon/dist/server.d.ts.map +1 -1
  883. package/daemon/dist/server.js +4 -1
  884. package/daemon/dist/server.js.map +1 -1
  885. package/daemon/dist/spec-validation-surface.d.ts +1 -1
  886. package/daemon/dist/spec-validation-surface.d.ts.map +1 -1
  887. package/daemon/dist/spec-validation-surface.js +1 -1
  888. package/daemon/dist/spec-validation-surface.js.map +1 -1
  889. package/daemon/dist/startup.d.ts +3 -1
  890. package/daemon/dist/startup.d.ts.map +1 -1
  891. package/daemon/dist/startup.js +140 -54
  892. package/daemon/dist/startup.js.map +1 -1
  893. package/daemon/dist/workflow-scope-surface.d.ts +2 -0
  894. package/daemon/dist/workflow-scope-surface.d.ts.map +1 -0
  895. package/daemon/dist/workflow-scope-surface.js +2 -0
  896. package/daemon/dist/workflow-scope-surface.js.map +1 -0
  897. package/daemon/docs/reference/agent-spec.md +4 -2
  898. package/daemon/docs/reference/agent-startup-guide.md +95 -6
  899. package/daemon/docs/reference/claude-status-line.md +69 -0
  900. package/daemon/docs/reference/getting-started.md +39 -6
  901. package/daemon/docs/reference/keeping-a-watch.md +102 -5
  902. package/daemon/docs/reference/project-workspace.md +70 -1
  903. package/daemon/docs/reference/publishing-a-rig-bundle.md +6 -1
  904. package/daemon/docs/reference/refocus-channel.md +41 -5
  905. package/daemon/docs/reference/rig-bundle.md +26 -2
  906. package/daemon/docs/reference/rig-spec.md +64 -3
  907. package/daemon/docs/reference/schemas/bundle-behaviour.v1.schema.json +105 -2
  908. package/daemon/docs/reference/scoped-operating-posture.md +12 -2
  909. package/daemon/docs/reference/sdlc-conventions.md +39 -1
  910. package/daemon/docs/reference/seat-delivery.md +127 -0
  911. package/daemon/docs/reference/slack-app-setup.md +141 -13
  912. package/daemon/docs/reference/topology-naming.md +9 -0
  913. package/daemon/docs/reference/whats-new.md +167 -146
  914. package/daemon/specs/agents/shared/skills/core/openrig-skills/SKILL.md +1 -1
  915. package/daemon/specs/agents/shared/skills/core/openrig-software-factory/SKILL.md +0 -1
  916. package/daemon/specs/agents/shared/skills/core/openrig-software-factory/references/worked-example.md +7 -4
  917. package/daemon/specs/agents/shared/skills/core/topology-mutation-and-seat-management/SKILL.md +1 -1
  918. package/daemon/specs/agents/shared/skills/pods/orchestration-team/SKILL.md +1 -1
  919. package/daemon/specs/rigs/launch/demo/CULTURE.md +1 -1
  920. package/daemon/specs/rigs/launch/factory/CULTURE.md +1 -1
  921. package/daemon/specs/rigs/launch/factory/topology/rig/CRAFT.md +2 -2
  922. package/daemon/specs/rigs/launch/first-project/CULTURE.md +2 -1
  923. package/daemon/specs/rigs/launch/first-project-claude/CULTURE.md +2 -1
  924. package/daemon/specs/rigs/launch/first-project-mixed/CULTURE.md +2 -1
  925. package/daemon/specs/rigs/launch/kernel/agents/operator/agent/guidance/role.md +9 -2
  926. package/daemon/specs/rigs/launch/starter/CULTURE.md +2 -1
  927. package/daemon/specs/rigs/preview/product-team/CULTURE.md +1 -1
  928. package/dist/bin-wrapper.d.ts +2 -1
  929. package/dist/bin-wrapper.d.ts.map +1 -1
  930. package/dist/bin-wrapper.js +61 -4
  931. package/dist/bin-wrapper.js.map +1 -1
  932. package/dist/build-info.js +3 -3
  933. package/dist/bundle-behaviour.d.ts.map +1 -1
  934. package/dist/bundle-behaviour.js +22 -0
  935. package/dist/bundle-behaviour.js.map +1 -1
  936. package/dist/client.d.ts.map +1 -1
  937. package/dist/client.js +3 -3
  938. package/dist/client.js.map +1 -1
  939. package/dist/commands/add.d.ts.map +1 -1
  940. package/dist/commands/add.js +1 -1
  941. package/dist/commands/add.js.map +1 -1
  942. package/dist/commands/ask.d.ts.map +1 -1
  943. package/dist/commands/ask.js +16 -5
  944. package/dist/commands/ask.js.map +1 -1
  945. package/dist/commands/bootstrap.d.ts.map +1 -1
  946. package/dist/commands/bootstrap.js +9 -5
  947. package/dist/commands/bootstrap.js.map +1 -1
  948. package/dist/commands/bundle.d.ts.map +1 -1
  949. package/dist/commands/bundle.js +8 -0
  950. package/dist/commands/bundle.js.map +1 -1
  951. package/dist/commands/capture.d.ts +4 -0
  952. package/dist/commands/capture.d.ts.map +1 -1
  953. package/dist/commands/capture.js +15 -2
  954. package/dist/commands/capture.js.map +1 -1
  955. package/dist/commands/community-harness.d.ts +4 -0
  956. package/dist/commands/community-harness.d.ts.map +1 -0
  957. package/dist/commands/community-harness.js +48 -0
  958. package/dist/commands/community-harness.js.map +1 -0
  959. package/dist/commands/compact.d.ts.map +1 -1
  960. package/dist/commands/compact.js +8 -4
  961. package/dist/commands/compact.js.map +1 -1
  962. package/dist/commands/config.d.ts.map +1 -1
  963. package/dist/commands/config.js +8 -2
  964. package/dist/commands/config.js.map +1 -1
  965. package/dist/commands/crash-cart.d.ts.map +1 -1
  966. package/dist/commands/crash-cart.js +3 -5
  967. package/dist/commands/crash-cart.js.map +1 -1
  968. package/dist/commands/create.d.ts.map +1 -1
  969. package/dist/commands/create.js +7 -5
  970. package/dist/commands/create.js.map +1 -1
  971. package/dist/commands/down.d.ts.map +1 -1
  972. package/dist/commands/down.js +2 -1
  973. package/dist/commands/down.js.map +1 -1
  974. package/dist/commands/launch.d.ts +1 -0
  975. package/dist/commands/launch.d.ts.map +1 -1
  976. package/dist/commands/launch.js +61 -10
  977. package/dist/commands/launch.js.map +1 -1
  978. package/dist/commands/policy.d.ts +2 -1
  979. package/dist/commands/policy.d.ts.map +1 -1
  980. package/dist/commands/policy.js +66 -7
  981. package/dist/commands/policy.js.map +1 -1
  982. package/dist/commands/provider.d.ts +2 -0
  983. package/dist/commands/provider.d.ts.map +1 -1
  984. package/dist/commands/provider.js +336 -49
  985. package/dist/commands/provider.js.map +1 -1
  986. package/dist/commands/ps.d.ts +11 -0
  987. package/dist/commands/ps.d.ts.map +1 -1
  988. package/dist/commands/ps.js +40 -6
  989. package/dist/commands/ps.js.map +1 -1
  990. package/dist/commands/queue.d.ts.map +1 -1
  991. package/dist/commands/queue.js +59 -10
  992. package/dist/commands/queue.js.map +1 -1
  993. package/dist/commands/requirements.d.ts.map +1 -1
  994. package/dist/commands/requirements.js +8 -5
  995. package/dist/commands/requirements.js.map +1 -1
  996. package/dist/commands/restore.js +1 -1
  997. package/dist/commands/restore.js.map +1 -1
  998. package/dist/commands/rig-mode.d.ts.map +1 -1
  999. package/dist/commands/rig-mode.js +106 -18
  1000. package/dist/commands/rig-mode.js.map +1 -1
  1001. package/dist/commands/scope.d.ts.map +1 -1
  1002. package/dist/commands/scope.js +47 -9
  1003. package/dist/commands/scope.js.map +1 -1
  1004. package/dist/commands/seat.d.ts.map +1 -1
  1005. package/dist/commands/seat.js +131 -20
  1006. package/dist/commands/seat.js.map +1 -1
  1007. package/dist/commands/send.d.ts +2 -2
  1008. package/dist/commands/send.d.ts.map +1 -1
  1009. package/dist/commands/send.js +79 -12
  1010. package/dist/commands/send.js.map +1 -1
  1011. package/dist/commands/slack.d.ts.map +1 -1
  1012. package/dist/commands/slack.js +9 -4
  1013. package/dist/commands/slack.js.map +1 -1
  1014. package/dist/commands/start.d.ts +11 -0
  1015. package/dist/commands/start.d.ts.map +1 -1
  1016. package/dist/commands/start.js +77 -3
  1017. package/dist/commands/start.js.map +1 -1
  1018. package/dist/commands/status.d.ts.map +1 -1
  1019. package/dist/commands/status.js +60 -2
  1020. package/dist/commands/status.js.map +1 -1
  1021. package/dist/commands/up.d.ts.map +1 -1
  1022. package/dist/commands/up.js +58 -0
  1023. package/dist/commands/up.js.map +1 -1
  1024. package/dist/commands/usage.d.ts +12 -0
  1025. package/dist/commands/usage.d.ts.map +1 -1
  1026. package/dist/commands/usage.js +107 -0
  1027. package/dist/commands/usage.js.map +1 -1
  1028. package/dist/commands/watchdog.d.ts.map +1 -1
  1029. package/dist/commands/watchdog.js +20 -7
  1030. package/dist/commands/watchdog.js.map +1 -1
  1031. package/dist/commands/whoami.d.ts +36 -0
  1032. package/dist/commands/whoami.d.ts.map +1 -1
  1033. package/dist/commands/whoami.js +125 -7
  1034. package/dist/commands/whoami.js.map +1 -1
  1035. package/dist/commands/workflow.d.ts.map +1 -1
  1036. package/dist/commands/workflow.js +53 -5
  1037. package/dist/commands/workflow.js.map +1 -1
  1038. package/dist/config-store.d.ts +14 -1
  1039. package/dist/config-store.d.ts.map +1 -1
  1040. package/dist/config-store.js +50 -1
  1041. package/dist/config-store.js.map +1 -1
  1042. package/dist/daemon-lifecycle.d.ts +2 -2
  1043. package/dist/daemon-lifecycle.d.ts.map +1 -1
  1044. package/dist/daemon-lifecycle.js +5 -4
  1045. package/dist/daemon-lifecycle.js.map +1 -1
  1046. package/dist/host-registry.d.ts.map +1 -1
  1047. package/dist/host-registry.js +6 -3
  1048. package/dist/host-registry.js.map +1 -1
  1049. package/dist/index.d.ts +1 -0
  1050. package/dist/index.d.ts.map +1 -1
  1051. package/dist/index.js +4 -7
  1052. package/dist/index.js.map +1 -1
  1053. package/dist/lazy-program.d.ts +9 -0
  1054. package/dist/lazy-program.d.ts.map +1 -0
  1055. package/dist/lazy-program.js +111 -0
  1056. package/dist/lazy-program.js.map +1 -0
  1057. package/dist/lib/bundle-check.js +2 -2
  1058. package/dist/lib/bundle-check.js.map +1 -1
  1059. package/dist/lib/bundle-source.d.ts +1 -0
  1060. package/dist/lib/bundle-source.d.ts.map +1 -1
  1061. package/dist/lib/bundle-source.js +1 -0
  1062. package/dist/lib/bundle-source.js.map +1 -1
  1063. package/dist/lib/codex-auth.d.ts.map +1 -1
  1064. package/dist/lib/codex-auth.js +17 -1
  1065. package/dist/lib/codex-auth.js.map +1 -1
  1066. package/dist/lib/context-install.js +1 -1
  1067. package/dist/lib/context-install.js.map +1 -1
  1068. package/dist/lib/file-transfer.js +1 -1
  1069. package/dist/lib/file-transfer.js.map +1 -1
  1070. package/dist/lib/frontmatter.d.ts +11 -0
  1071. package/dist/lib/frontmatter.d.ts.map +1 -0
  1072. package/dist/lib/frontmatter.js +20 -0
  1073. package/dist/lib/frontmatter.js.map +1 -0
  1074. package/dist/lib/permission-policy/policy-spec.d.ts.map +1 -1
  1075. package/dist/lib/permission-policy/policy-spec.js +5 -7
  1076. package/dist/lib/permission-policy/policy-spec.js.map +1 -1
  1077. package/dist/lib/scope/logical-checkbox.js +1 -1
  1078. package/dist/lib/scope/logical-checkbox.js.map +1 -1
  1079. package/dist/lib/scope/scope-fs.d.ts +8 -0
  1080. package/dist/lib/scope/scope-fs.d.ts.map +1 -1
  1081. package/dist/lib/scope/scope-fs.js +50 -1
  1082. package/dist/lib/scope/scope-fs.js.map +1 -1
  1083. package/dist/lib/work-install.d.ts.map +1 -1
  1084. package/dist/lib/work-install.js +3 -13
  1085. package/dist/lib/work-install.js.map +1 -1
  1086. package/dist/mcp-server.d.ts.map +1 -1
  1087. package/dist/mcp-server.js +113 -0
  1088. package/dist/mcp-server.js.map +1 -1
  1089. package/dist/program-root.d.ts +5 -0
  1090. package/dist/program-root.d.ts.map +1 -0
  1091. package/dist/program-root.js +11 -0
  1092. package/dist/program-root.js.map +1 -0
  1093. package/dist/queue-read-compact.d.ts +29 -0
  1094. package/dist/queue-read-compact.d.ts.map +1 -0
  1095. package/dist/queue-read-compact.js +74 -0
  1096. package/dist/queue-read-compact.js.map +1 -0
  1097. package/dist/remote-host-ops.d.ts +21 -0
  1098. package/dist/remote-host-ops.d.ts.map +1 -1
  1099. package/dist/remote-host-ops.js +25 -12
  1100. package/dist/remote-host-ops.js.map +1 -1
  1101. package/package.json +1 -1
  1102. package/tui/dist/commands/registry.d.ts.map +1 -1
  1103. package/tui/dist/commands/registry.js +3 -0
  1104. package/tui/dist/commands/registry.js.map +1 -1
  1105. package/tui/dist/config/config-model.d.ts.map +1 -1
  1106. package/tui/dist/config/config-model.js +6 -1
  1107. package/tui/dist/config/config-model.js.map +1 -1
  1108. package/tui/dist/cost/cost-model.d.ts +12 -0
  1109. package/tui/dist/cost/cost-model.d.ts.map +1 -0
  1110. package/tui/dist/cost/cost-model.js +141 -0
  1111. package/tui/dist/cost/cost-model.js.map +1 -0
  1112. package/tui/dist/cost/cost-read.d.ts +19 -0
  1113. package/tui/dist/cost/cost-read.d.ts.map +1 -0
  1114. package/tui/dist/cost/cost-read.js +4 -0
  1115. package/tui/dist/cost/cost-read.js.map +1 -0
  1116. package/tui/dist/daemon-client.d.ts +13 -0
  1117. package/tui/dist/daemon-client.d.ts.map +1 -1
  1118. package/tui/dist/daemon-client.js +77 -1
  1119. package/tui/dist/daemon-client.js.map +1 -1
  1120. package/tui/dist/detail.d.ts +2 -0
  1121. package/tui/dist/detail.d.ts.map +1 -1
  1122. package/tui/dist/detail.js +5 -0
  1123. package/tui/dist/detail.js.map +1 -1
  1124. package/tui/dist/execution/execution-model.d.ts.map +1 -1
  1125. package/tui/dist/execution/execution-model.js +38 -18
  1126. package/tui/dist/execution/execution-model.js.map +1 -1
  1127. package/tui/dist/helper-cwd.d.ts +3 -0
  1128. package/tui/dist/helper-cwd.d.ts.map +1 -0
  1129. package/tui/dist/helper-cwd.js +16 -0
  1130. package/tui/dist/helper-cwd.js.map +1 -0
  1131. package/tui/dist/hydrate.d.ts.map +1 -1
  1132. package/tui/dist/hydrate.js +32 -1
  1133. package/tui/dist/hydrate.js.map +1 -1
  1134. package/tui/dist/input.d.ts.map +1 -1
  1135. package/tui/dist/input.js +2 -1
  1136. package/tui/dist/input.js.map +1 -1
  1137. package/tui/dist/local-reading.d.ts.map +1 -1
  1138. package/tui/dist/local-reading.js +2 -1
  1139. package/tui/dist/local-reading.js.map +1 -1
  1140. package/tui/dist/main.js +6 -5
  1141. package/tui/dist/main.js.map +1 -1
  1142. package/tui/dist/pulse/render-pulse.d.ts.map +1 -1
  1143. package/tui/dist/pulse/render-pulse.js +7 -1
  1144. package/tui/dist/pulse/render-pulse.js.map +1 -1
  1145. package/tui/dist/reading.js +1 -1
  1146. package/tui/dist/reading.js.map +1 -1
  1147. package/tui/dist/render.d.ts.map +1 -1
  1148. package/tui/dist/render.js +10 -1
  1149. package/tui/dist/render.js.map +1 -1
  1150. package/tui/dist/scopes/scopes-model.d.ts +6 -1
  1151. package/tui/dist/scopes/scopes-model.d.ts.map +1 -1
  1152. package/tui/dist/scopes/scopes-model.js +33 -13
  1153. package/tui/dist/scopes/scopes-model.js.map +1 -1
  1154. package/tui/dist/sections.d.ts.map +1 -1
  1155. package/tui/dist/sections.js +4 -1
  1156. package/tui/dist/sections.js.map +1 -1
  1157. package/tui/dist/socket-server.d.ts.map +1 -1
  1158. package/tui/dist/socket-server.js +2 -1
  1159. package/tui/dist/socket-server.js.map +1 -1
  1160. package/tui/dist/specs/launch.d.ts.map +1 -1
  1161. package/tui/dist/specs/launch.js +2 -1
  1162. package/tui/dist/specs/launch.js.map +1 -1
  1163. package/tui/dist/startup.js +1 -1
  1164. package/tui/dist/startup.js.map +1 -1
  1165. package/tui/dist/state.d.ts.map +1 -1
  1166. package/tui/dist/state.js +8 -4
  1167. package/tui/dist/state.js.map +1 -1
  1168. package/tui/dist/terminals/open-window.d.ts.map +1 -1
  1169. package/tui/dist/terminals/open-window.js +2 -1
  1170. package/tui/dist/terminals/open-window.js.map +1 -1
  1171. package/tui/dist/types.d.ts +9 -0
  1172. package/tui/dist/types.d.ts.map +1 -1
  1173. package/tui/dist/usage/usage-hosts-model.d.ts +17 -0
  1174. package/tui/dist/usage/usage-hosts-model.d.ts.map +1 -0
  1175. package/tui/dist/usage/usage-hosts-model.js +73 -0
  1176. package/tui/dist/usage/usage-hosts-model.js.map +1 -0
  1177. package/tui/dist/usage/usage-model.d.ts +39 -0
  1178. package/tui/dist/usage/usage-model.d.ts.map +1 -0
  1179. package/tui/dist/usage/usage-model.js +161 -0
  1180. package/tui/dist/usage/usage-model.js.map +1 -0
  1181. package/ui/dist/assets/{index-DhmxKuZf.js → index-Cfbtfd9G.js} +2 -2
  1182. package/ui/dist/index.html +1 -1
@@ -0,0 +1,119 @@
1
+ import type { ChildProcessWithoutNullStreams } from "node:child_process";
2
+ import type { ArgvExecFn } from "./tmux.js";
3
+ /**
4
+ * tmux commands over one long-lived control-mode client (`tmux -C`) instead of a new tmux client per command. Opt-in:
5
+ * the daemon drives tmux this way only with OPENRIG_TMUX_CONTROL=1 (startup.ts); without it, every command spawns a
6
+ * client, as before.
7
+ *
8
+ * Each spawned client costs the daemon a fork of its whole process: some 28 ms of CPU a command at its size, against
9
+ * 0.3 ms for a line written to a client already connected. The client makes a session of its own as it attaches
10
+ * (`new-session`: an existing session is never taken over, whatever its name), named after this daemon's owner id and
11
+ * marked with it (`@openrig-control`), and `destroy-unattached`: tmux destroys it when the client leaves, so the daemon
12
+ * never kills a session itself. Listings leave out this daemon's own session and client, and nothing else: a session
13
+ * another daemon or a person made, whatever its name or mark, is listed as any other.
14
+ *
15
+ * What it runs and what it gives back are the spawned client's: the same commands, their output, the same error text
16
+ * in `execStderr`, a chain stopped at its first failing command, and output past TMUX_MAX_BUFFER failed with execFile's
17
+ * `maxBuffer length exceeded`. The differences: a chain's commands are sent one after the other's reply, so another
18
+ * client's command may run between them, which it cannot in a spawned client's chain; a client that ends partway
19
+ * through a chain fails the rest at once, the outcome of the commands it sent unknown, and none is run again; and the
20
+ * blocks tmux's hooks print on their own (an `after-list-panes` in a user's tmux.conf) are not taken for a command's
21
+ * reply, where a spawned client prints a hook's output after its command's. Anything else (a launch,
22
+ * which takes the spawning process's environment; `load-buffer`, see ROUTED; a command line that cannot be written on
23
+ * one line; a global flag; no server yet, or one before 3.2) goes to the spawned client, as before.
24
+ */
25
+ /** The session option that marks a control session: its value is the owner id of the daemon whose client made it. */
26
+ export declare const CONTROL_OPTION = "@openrig-control";
27
+ /** The name a daemon's control session is made with: one of its own on any server. */
28
+ export declare function controlSessionName(owner: string): string;
29
+ /** The argv's commands, as a spawned tmux reads its arguments (cmd-parse.c): an argument ending in `;` ends its
30
+ * command and keeps the rest (`abc;` is `abc`, then a new command); one ending in `\;` is kept with a literal `;`
31
+ * instead (`abc\;` is `abc;`). An empty command is skipped. Each argument is then sent quoted, as it reads. */
32
+ export declare function commandsOf(args: string[]): string[][];
33
+ /** What starts each row a listing prints for the owner's own session, its windows, panes and client: drawn for each
34
+ * call, so that no other row (whatever its format prints) and no other command's output starts with it. */
35
+ export declare function ownRowTag(): string;
36
+ /** The argv with each listing's `-F` format starting its own rows (the owner's session's, and its client's) with `tag`,
37
+ * which `withoutOwnRows` then drops. No `-f` filter: one needs tmux 3.2 (3.4 for list-clients) of the server, which a
38
+ * client's own version does not tell. A format is all a row shows, so a listing without `-F` is left as is. */
39
+ export declare function markOwnRows(args: string[], owner: string, tag: string): string[];
40
+ /** A listing's output without the rows `markOwnRows` marked with `tag`. */
41
+ export declare function withoutOwnRows(stdout: string, tag: string): string;
42
+ /** Whether tmux's version (`tmux -V`, or a server's `#{version}`) names 3.2 or later: the client flags of
43
+ * `new-session -f`. */
44
+ export declare function supportsControlMode(versionLine: string): boolean;
45
+ /** A command's reply: its output lines, none once they went past the bound (`overflow`). */
46
+ interface Reply {
47
+ ok: boolean;
48
+ lines: string[];
49
+ overflow: boolean;
50
+ }
51
+ interface Pending {
52
+ resolve: (reply: Reply) => void;
53
+ reject: (error: Error) => void;
54
+ }
55
+ /** The replies of one control client, read off its stdout: each command's `%begin` … `%end` (or `%error`) block, in
56
+ * the order the commands were written. A block ends only on the line that repeats its own `%begin` header, so a pane
57
+ * line reading `%end …` never ends it. Only a block whose flags (the header's third field) say the client sent the
58
+ * command answers one: a hook (`after-list-panes` in a user's tmux.conf) prints its own blocks, flagged 0, between
59
+ * them, and those are no command's reply. A reply keeps at most `maxBytes` of output, as a spawned client's stdout is
60
+ * bounded (TMUX_MAX_BUFFER): past it, its lines are dropped as they come, up to its end, so every later reply is still
61
+ * its own command's, and it is answered as overflowed. A line with no end yet is bounded the same way. */
62
+ export declare class ControlReplies {
63
+ private readonly maxBytes;
64
+ private partial;
65
+ /** Set while the rest of a line past the bound is dropped, up to its newline. */
66
+ private skipping;
67
+ private header;
68
+ private lines;
69
+ /** The bytes of the block being read, and whether they went past the bound. */
70
+ private bytes;
71
+ private overflow;
72
+ private readonly pending;
73
+ /** The first block answers the client's own `new-session`, before any command was written. */
74
+ private attached;
75
+ /** Set once the client is gone: nothing will be answered any more. */
76
+ private failure;
77
+ /** Called with the outcome of the client's `new-session`: false when it made no session (a name taken). */
78
+ onAttached?: (ok: boolean) => void;
79
+ /** Called after each command's reply. */
80
+ onReply?: () => void;
81
+ /** Called on tmux's `%sessions-changed`: a session was made or destroyed on the server. */
82
+ onSessionsChanged?: () => void;
83
+ constructor(maxBytes?: number);
84
+ get closed(): boolean;
85
+ /** The commands written and not answered yet. */
86
+ get waiting(): number;
87
+ expect(pending: Pending): void;
88
+ push(chunk: string): void;
89
+ /** Drops the block's output once past the bound: only that it overflowed is kept. */
90
+ private overflowed;
91
+ private line;
92
+ /** Fails every command still waiting, and any expected later: the client is gone, so none will be answered. */
93
+ failAll(error: Error): void;
94
+ }
95
+ /** Starts the control client with these tmux arguments (`spawnTmuxClient`); tests give their own. */
96
+ export type SpawnControlClient = (args: string[]) => ChildProcessWithoutNullStreams | Promise<ChildProcessWithoutNullStreams>;
97
+ export interface TmuxControlOptions {
98
+ spawnClient?: SpawnControlClient;
99
+ /** Once the command at the head of the line has had no reply for this long, the client is ended: the reads it owed
100
+ * are asked again of a spawned client, the writes it owed fail, and the next command starts a new client. Also the
101
+ * time a client has to attach. */
102
+ replyTimeoutMs?: number;
103
+ now?: () => number;
104
+ /** This daemon's id on a tmux server: its control session's name and mark. A random one by default. */
105
+ owner?: string;
106
+ /** The most output a call may give, as a spawned client's stdout is bounded: TMUX_MAX_BUFFER by default. */
107
+ maxBuffer?: number;
108
+ }
109
+ export type TmuxControlExec = ArgvExecFn & {
110
+ close: () => Promise<void>;
111
+ owner: string;
112
+ };
113
+ /**
114
+ * The ArgvExecFn the daemon's TmuxAdapter runs with when control mode is on: routed commands go to the control client,
115
+ * every other one, or any while the client cannot run, to `fallback` (the spawned client).
116
+ */
117
+ export declare function tmuxControlExec(fallback: ArgvExecFn, options?: TmuxControlOptions): TmuxControlExec;
118
+ export {};
119
+ //# sourceMappingURL=tmux-control.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tmux-control.d.ts","sourceRoot":"","sources":["../../src/adapters/tmux-control.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,oBAAoB,CAAC;AAGzE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAE5C;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,qHAAqH;AACrH,eAAO,MAAM,cAAc,qBAAqB,CAAC;AAEjD,sFAAsF;AACtF,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAExD;AAgCD;;gHAEgH;AAChH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,EAAE,CAmBrD;AAED;4GAC4G;AAC5G,wBAAgB,SAAS,IAAI,MAAM,CAElC;AAED;;gHAEgH;AAChH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,CAchF;AAED,2EAA2E;AAC3E,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAGlE;AAQD;wBACwB;AACxB,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAKhE;AAED,4FAA4F;AAC5F,UAAU,KAAK;IACb,EAAE,EAAE,OAAO,CAAC;IACZ,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,UAAU,OAAO;IACf,OAAO,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IAChC,MAAM,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;CAChC;AAED;;;;;;2GAM2G;AAC3G,qBAAa,cAAc;IAqBb,OAAO,CAAC,QAAQ,CAAC,QAAQ;IApBrC,OAAO,CAAC,OAAO,CAAM;IACrB,iFAAiF;IACjF,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,MAAM,CAAuB;IACrC,OAAO,CAAC,KAAK,CAAgB;IAC7B,+EAA+E;IAC/E,OAAO,CAAC,KAAK,CAAK;IAClB,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAiB;IACzC,8FAA8F;IAC9F,OAAO,CAAC,QAAQ,CAAS;IACzB,sEAAsE;IACtE,OAAO,CAAC,OAAO,CAAsB;IACrC,2GAA2G;IAC3G,UAAU,CAAC,EAAE,CAAC,EAAE,EAAE,OAAO,KAAK,IAAI,CAAC;IACnC,yCAAyC;IACzC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,2FAA2F;IAC3F,iBAAiB,CAAC,EAAE,MAAM,IAAI,CAAC;gBAEF,QAAQ,GAAE,MAAwB;IAE/D,IAAI,MAAM,IAAI,OAAO,CAEpB;IAED,iDAAiD;IACjD,IAAI,OAAO,IAAI,MAAM,CAEpB;IAED,MAAM,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI;IAK9B,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAkBzB,qFAAqF;IACrF,OAAO,CAAC,UAAU;IAMlB,OAAO,CAAC,IAAI;IAgCZ,+GAA+G;IAC/G,OAAO,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI;CAI5B;AAoBD,qGAAqG;AACrG,MAAM,MAAM,kBAAkB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,8BAA8B,GAAG,OAAO,CAAC,8BAA8B,CAAC,CAAC;AAE9H,MAAM,WAAW,kBAAkB;IACjC,WAAW,CAAC,EAAE,kBAAkB,CAAC;IACjC;;uCAEmC;IACnC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;IACnB,uGAAuG;IACvG,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,4GAA4G;IAC5G,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAsBD,MAAM,MAAM,eAAe,GAAG,UAAU,GAAG;IAAE,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAEzF;;;GAGG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,UAAU,EAAE,OAAO,GAAE,kBAAuB,GAAG,eAAe,CA0QvG"}
@@ -0,0 +1,547 @@
1
+ import { randomBytes } from "node:crypto";
2
+ import { spawnTmuxClient, TMUX_MAX_BUFFER } from "./tmux-exec.js";
3
+ /**
4
+ * tmux commands over one long-lived control-mode client (`tmux -C`) instead of a new tmux client per command. Opt-in:
5
+ * the daemon drives tmux this way only with OPENRIG_TMUX_CONTROL=1 (startup.ts); without it, every command spawns a
6
+ * client, as before.
7
+ *
8
+ * Each spawned client costs the daemon a fork of its whole process: some 28 ms of CPU a command at its size, against
9
+ * 0.3 ms for a line written to a client already connected. The client makes a session of its own as it attaches
10
+ * (`new-session`: an existing session is never taken over, whatever its name), named after this daemon's owner id and
11
+ * marked with it (`@openrig-control`), and `destroy-unattached`: tmux destroys it when the client leaves, so the daemon
12
+ * never kills a session itself. Listings leave out this daemon's own session and client, and nothing else: a session
13
+ * another daemon or a person made, whatever its name or mark, is listed as any other.
14
+ *
15
+ * What it runs and what it gives back are the spawned client's: the same commands, their output, the same error text
16
+ * in `execStderr`, a chain stopped at its first failing command, and output past TMUX_MAX_BUFFER failed with execFile's
17
+ * `maxBuffer length exceeded`. The differences: a chain's commands are sent one after the other's reply, so another
18
+ * client's command may run between them, which it cannot in a spawned client's chain; a client that ends partway
19
+ * through a chain fails the rest at once, the outcome of the commands it sent unknown, and none is run again; and the
20
+ * blocks tmux's hooks print on their own (an `after-list-panes` in a user's tmux.conf) are not taken for a command's
21
+ * reply, where a spawned client prints a hook's output after its command's. Anything else (a launch,
22
+ * which takes the spawning process's environment; `load-buffer`, see ROUTED; a command line that cannot be written on
23
+ * one line; a global flag; no server yet, or one before 3.2) goes to the spawned client, as before.
24
+ */
25
+ /** The session option that marks a control session: its value is the owner id of the daemon whose client made it. */
26
+ export const CONTROL_OPTION = "@openrig-control";
27
+ /** The name a daemon's control session is made with: one of its own on any server. */
28
+ export function controlSessionName(owner) {
29
+ return `openrig-control-${owner}`;
30
+ }
31
+ /** What the control session's pane runs, exec'd as argv (no `default-shell -c`, so no shell of the user's and none of
32
+ * its rc files): a non-interactive sh that waits forever. */
33
+ const KEEP_ALIVE = ["sh", "-c", "while :; do sleep 86400; done"];
34
+ // Commands that only read the server or write into a pane, whose outcome does not depend on the client that sends
35
+ // them as long as they name their target. A launch or an environment change stays spawned. So does `load-buffer`: it
36
+ // would have the server open the file itself, in its own loop (a FIFO with no writer stops the whole server) and in its
37
+ // own view of the filesystem, where a spawned client reads the file and hands the server its bytes.
38
+ const ROUTED = new Set([
39
+ "capture-pane", "display-message", "has-session", "list-sessions", "list-windows", "list-panes", "list-clients",
40
+ "show-environment", "paste-buffer", "delete-buffer", "send-keys",
41
+ ]);
42
+ const LISTINGS = new Set(["list-sessions", "list-windows", "list-panes", "list-clients"]);
43
+ /** The routed commands that change nothing, which may be run again after their client is lost. Any other one
44
+ * (`send-keys`, `paste-buffer`, `delete-buffer`) is a write: once written, it may have taken effect. */
45
+ const READS = new Set([...LISTINGS, "capture-pane", "display-message", "has-session", "show-environment"]);
46
+ /** Whether a command acts on the same target from any client: a control client's own session would otherwise be the
47
+ * "current" one that a target-less command reads. */
48
+ function namesItsTarget(args) {
49
+ const [command] = args;
50
+ if (args.includes("-t"))
51
+ return true;
52
+ if (command === "list-sessions" || command === "list-clients" || command === "delete-buffer")
53
+ return true;
54
+ if (command === "list-windows" || command === "list-panes")
55
+ return args.includes("-a");
56
+ if (command === "show-environment")
57
+ return args.includes("-g");
58
+ return false;
59
+ }
60
+ /** The argv's commands, as a spawned tmux reads its arguments (cmd-parse.c): an argument ending in `;` ends its
61
+ * command and keeps the rest (`abc;` is `abc`, then a new command); one ending in `\;` is kept with a literal `;`
62
+ * instead (`abc\;` is `abc;`). An empty command is skipped. Each argument is then sent quoted, as it reads. */
63
+ export function commandsOf(args) {
64
+ const commands = [];
65
+ let command = [];
66
+ for (const arg of args) {
67
+ if (!arg.endsWith(";")) {
68
+ command.push(arg);
69
+ continue;
70
+ }
71
+ const rest = arg.slice(0, -1);
72
+ if (rest.endsWith("\\")) {
73
+ command.push(`${rest.slice(0, -1)};`);
74
+ continue;
75
+ }
76
+ if (rest !== "")
77
+ command.push(rest);
78
+ if (command.length > 0)
79
+ commands.push(command);
80
+ command = [];
81
+ }
82
+ if (command.length > 0)
83
+ commands.push(command);
84
+ return commands;
85
+ }
86
+ /** What starts each row a listing prints for the owner's own session, its windows, panes and client: drawn for each
87
+ * call, so that no other row (whatever its format prints) and no other command's output starts with it. */
88
+ export function ownRowTag() {
89
+ return `${randomBytes(8).toString("hex")}:`;
90
+ }
91
+ /** The argv with each listing's `-F` format starting its own rows (the owner's session's, and its client's) with `tag`,
92
+ * which `withoutOwnRows` then drops. No `-f` filter: one needs tmux 3.2 (3.4 for list-clients) of the server, which a
93
+ * client's own version does not tell. A format is all a row shows, so a listing without `-F` is left as is. */
94
+ export function markOwnRows(args, owner, tag) {
95
+ let first = true;
96
+ let listing = false;
97
+ return args.map((arg, i) => {
98
+ let out = arg;
99
+ if (first) {
100
+ listing = LISTINGS.has(arg);
101
+ first = false;
102
+ }
103
+ else if (listing && args[i - 1] === "-F" && !arg.endsWith(";")) {
104
+ out = `#{?#{==:#{${CONTROL_OPTION}},${owner}},${tag},}${arg}`;
105
+ }
106
+ if (arg.endsWith(";") && !arg.endsWith("\\;"))
107
+ first = true;
108
+ return out;
109
+ });
110
+ }
111
+ /** A listing's output without the rows `markOwnRows` marked with `tag`. */
112
+ export function withoutOwnRows(stdout, tag) {
113
+ if (!stdout.includes(tag))
114
+ return stdout;
115
+ return stdout.split("\n").filter((line) => !line.startsWith(tag)).join("\n");
116
+ }
117
+ /** One argument on a control-mode command line: in single quotes, where tmux expands nothing; a ' closes them, is
118
+ * escaped, and opens them again. */
119
+ function quote(arg) {
120
+ return `'${arg.replace(/'/g, "'\\''")}'`;
121
+ }
122
+ /** Whether tmux's version (`tmux -V`, or a server's `#{version}`) names 3.2 or later: the client flags of
123
+ * `new-session -f`. */
124
+ export function supportsControlMode(versionLine) {
125
+ const match = /(\d+)\.(\d+)/.exec(versionLine);
126
+ if (!match)
127
+ return false;
128
+ const major = Number(match[1]);
129
+ return major > 3 || (major === 3 && Number(match[2]) >= 2);
130
+ }
131
+ /** The replies of one control client, read off its stdout: each command's `%begin` … `%end` (or `%error`) block, in
132
+ * the order the commands were written. A block ends only on the line that repeats its own `%begin` header, so a pane
133
+ * line reading `%end …` never ends it. Only a block whose flags (the header's third field) say the client sent the
134
+ * command answers one: a hook (`after-list-panes` in a user's tmux.conf) prints its own blocks, flagged 0, between
135
+ * them, and those are no command's reply. A reply keeps at most `maxBytes` of output, as a spawned client's stdout is
136
+ * bounded (TMUX_MAX_BUFFER): past it, its lines are dropped as they come, up to its end, so every later reply is still
137
+ * its own command's, and it is answered as overflowed. A line with no end yet is bounded the same way. */
138
+ export class ControlReplies {
139
+ maxBytes;
140
+ partial = "";
141
+ /** Set while the rest of a line past the bound is dropped, up to its newline. */
142
+ skipping = false;
143
+ header = null;
144
+ lines = [];
145
+ /** The bytes of the block being read, and whether they went past the bound. */
146
+ bytes = 0;
147
+ overflow = false;
148
+ pending = [];
149
+ /** The first block answers the client's own `new-session`, before any command was written. */
150
+ attached = false;
151
+ /** Set once the client is gone: nothing will be answered any more. */
152
+ failure = null;
153
+ /** Called with the outcome of the client's `new-session`: false when it made no session (a name taken). */
154
+ onAttached;
155
+ /** Called after each command's reply. */
156
+ onReply;
157
+ /** Called on tmux's `%sessions-changed`: a session was made or destroyed on the server. */
158
+ onSessionsChanged;
159
+ constructor(maxBytes = TMUX_MAX_BUFFER) {
160
+ this.maxBytes = maxBytes;
161
+ }
162
+ get closed() {
163
+ return this.failure !== null;
164
+ }
165
+ /** The commands written and not answered yet. */
166
+ get waiting() {
167
+ return this.pending.length;
168
+ }
169
+ expect(pending) {
170
+ if (this.failure)
171
+ pending.reject(this.failure);
172
+ else
173
+ this.pending.push(pending);
174
+ }
175
+ push(chunk) {
176
+ this.partial += chunk;
177
+ let newline;
178
+ while ((newline = this.partial.indexOf("\n")) >= 0) {
179
+ const line = this.partial.slice(0, newline).replace(/\r$/, "");
180
+ this.partial = this.partial.slice(newline + 1);
181
+ if (this.skipping)
182
+ this.skipping = false;
183
+ else
184
+ this.line(line);
185
+ }
186
+ // In bytes, as the bound is: a UTF-16 unit is 1 to 3 bytes, so the count is taken only when the length cannot tell.
187
+ const units = this.partial.length;
188
+ if (units > this.maxBytes || (units * 3 > this.maxBytes && Buffer.byteLength(this.partial) > this.maxBytes)) {
189
+ this.partial = "";
190
+ this.skipping = true;
191
+ this.overflowed();
192
+ }
193
+ }
194
+ /** Drops the block's output once past the bound: only that it overflowed is kept. */
195
+ overflowed() {
196
+ if (this.header === null)
197
+ return;
198
+ this.overflow = true;
199
+ this.lines = [];
200
+ }
201
+ line(line) {
202
+ if (this.header === null) {
203
+ if (line.startsWith("%begin ")) {
204
+ this.header = line.slice("%begin ".length);
205
+ this.lines = [];
206
+ this.bytes = 0;
207
+ this.overflow = false;
208
+ }
209
+ else if (line === "%sessions-changed") {
210
+ this.onSessionsChanged?.();
211
+ }
212
+ return;
213
+ }
214
+ if (line === `%end ${this.header}` || line === `%error ${this.header}`) {
215
+ const ok = line.startsWith("%end ");
216
+ const flags = Number(this.header.split(" ")[2]);
217
+ this.header = null;
218
+ if (!this.attached) {
219
+ this.attached = true;
220
+ this.onAttached?.(ok);
221
+ return;
222
+ }
223
+ if ((flags & 1) === 0)
224
+ return;
225
+ this.pending.shift()?.resolve({ ok, lines: this.lines, overflow: this.overflow });
226
+ this.onReply?.();
227
+ return;
228
+ }
229
+ if (this.overflow)
230
+ return;
231
+ this.bytes += Buffer.byteLength(line) + 1;
232
+ if (this.bytes > this.maxBytes)
233
+ this.overflowed();
234
+ else
235
+ this.lines.push(line);
236
+ }
237
+ /** Fails every command still waiting, and any expected later: the client is gone, so none will be answered. */
238
+ failAll(error) {
239
+ this.failure ??= error;
240
+ for (const p of this.pending.splice(0))
241
+ p.reject(error);
242
+ }
243
+ }
244
+ /** The error a spawned tmux would have thrown for this failure: tmux's text on stderr, the earlier commands' output on
245
+ * stdout. Its message is execFile's (the command, then stderr as is), with the output `execArgvCommand` appends to it. */
246
+ function commandFailed(argv, stdout, stderr) {
247
+ const message = `Command failed: ${argv.join(" ")}\n${stderr}`;
248
+ const output = [stdout.trim(), stderr.trim()].filter(Boolean).join("\n");
249
+ return Object.assign(new Error(output && !message.includes(output) ? `${message}\n${output}` : message), {
250
+ code: 1, stdout, stderr, execStderr: stderr,
251
+ });
252
+ }
253
+ /** The error a spawned client's call fails with once its stdout is past its bound (execFile's maxBuffer): the same
254
+ * first line, which callers match (`capturePanesContent` splits its chain on it), and tmux's stderr empty. */
255
+ function outputTooLarge(stdout) {
256
+ return Object.assign(new RangeError("stdout maxBuffer length exceeded"), {
257
+ code: "ERR_CHILD_PROCESS_STDIO_MAXBUFFER", stdout, stderr: "", execStderr: "",
258
+ });
259
+ }
260
+ const RETRY_MS = [1_000, 5_000, 30_000];
261
+ const NOT_WRITTEN = new Error("tmux control client ended before the command was written");
262
+ /** How long the end of a client (its input closed) may take before it is killed. */
263
+ const END_MS = 2_000;
264
+ /**
265
+ * The ArgvExecFn the daemon's TmuxAdapter runs with when control mode is on: routed commands go to the control client,
266
+ * every other one, or any while the client cannot run, to `fallback` (the spawned client).
267
+ */
268
+ export function tmuxControlExec(fallback, options = {}) {
269
+ const owner = options.owner ?? randomBytes(4).toString("hex");
270
+ const spawnClient = options.spawnClient ?? spawnTmuxClient;
271
+ const replyTimeoutMs = options.replyTimeoutMs ?? 10_000;
272
+ const maxBuffer = options.maxBuffer ?? TMUX_MAX_BUFFER;
273
+ const now = options.now ?? (() => Date.now());
274
+ let client = null;
275
+ let starting = null;
276
+ let failures = 0;
277
+ let retryAt = 0;
278
+ let closed = false;
279
+ /** Every client of this daemon still running: the current one, one attaching, and those retiring. */
280
+ const live = new Set();
281
+ /** Gives up the attach under way: the daemon is stopping. */
282
+ let cancelAttach = null;
283
+ const backOff = () => {
284
+ retryAt = now() + RETRY_MS[Math.min(failures, RETRY_MS.length - 1)];
285
+ failures++;
286
+ };
287
+ /** Ends a client at once and fails what it still owes. The current one, when it ended on its own, is started again
288
+ * after a while; when dropped for a reply overdue, at the next command. */
289
+ const drop = (c, reason, overdue = false) => {
290
+ clearTimeout(c.timer);
291
+ c.replies.failAll(new Error(`tmux control client ended: ${reason}`));
292
+ if (c.child.exitCode === null && c.child.signalCode === null)
293
+ c.child.kill();
294
+ if (client !== c)
295
+ return;
296
+ client = null;
297
+ if (overdue)
298
+ retryAt = 0;
299
+ else
300
+ backOff();
301
+ };
302
+ /** Ends a client as tmux ends one whose input closes: it detaches, after answering what it was sent, and tmux
303
+ * destroys its session (`destroy-unattached`). Killed if it has not gone within END_MS. */
304
+ const end = (c) => new Promise((resolve) => {
305
+ if (!live.has(c)) {
306
+ resolve();
307
+ return;
308
+ }
309
+ const timer = setTimeout(() => {
310
+ drop(c, "did not end");
311
+ resolve();
312
+ }, END_MS);
313
+ c.child.once("exit", () => {
314
+ clearTimeout(timer);
315
+ resolve();
316
+ });
317
+ c.child.stdin.end();
318
+ });
319
+ /** Takes no new call on the client, and ends it once the calls running on it are done. */
320
+ const retire = (c) => {
321
+ c.retiring = true;
322
+ if (client === c) {
323
+ client = null;
324
+ retryAt = 0;
325
+ }
326
+ if (c.users === 0)
327
+ void end(c);
328
+ };
329
+ /** Drops the client once the command at the head of its line has waited past the reply timeout: every later command
330
+ * waits behind it, a write with no deadline of its own included. */
331
+ const watch = (c) => {
332
+ clearTimeout(c.timer);
333
+ if (c.replies.waiting === 0)
334
+ return;
335
+ c.timer = setTimeout(() => {
336
+ if (now() - c.headSince >= replyTimeoutMs)
337
+ drop(c, `no reply within ${replyTimeoutMs} ms`, true);
338
+ else
339
+ watch(c);
340
+ }, Math.max(0, c.headSince + replyTimeoutMs - now()));
341
+ c.timer.unref?.();
342
+ };
343
+ /** The control client's arguments: a session of its own, made as it attaches and never one that exists, marked with
344
+ * this daemon's id, destroyed by tmux once no client is in it, and never moving its client elsewhere when it goes. */
345
+ const clientArgs = () => [
346
+ "-C", "new-session", "-s", controlSessionName(owner), "-x", "80", "-y", "24", "-f", "no-output,ignore-size",
347
+ "--", ...KEEP_ALIVE,
348
+ ";", "set-option", CONTROL_OPTION, owner,
349
+ ";", "set-option", "destroy-unattached", "on",
350
+ ";", "set-option", "detach-on-destroy", "on",
351
+ ];
352
+ /** Whether a server runs that a control client may attach to: one of tmux 3.2 or later (its own version, not the
353
+ * tmux binary's) with a session that is no control session, read by a spawned client. With none, no client is
354
+ * started: it never starts a server, nor keeps one up that would exit without it (`checkAlone`). */
355
+ const serverReady = async () => {
356
+ try {
357
+ const rows = (await fallback(["tmux", "list-sessions", "-F", `#{version}|#{${CONTROL_OPTION}}`])).split("\n").filter(Boolean);
358
+ return supportsControlMode(rows[0] ?? "") && rows.some((row) => row.endsWith("|"));
359
+ }
360
+ catch {
361
+ return false;
362
+ }
363
+ };
364
+ const start = async () => {
365
+ if (!await serverReady()) {
366
+ backOff();
367
+ return null;
368
+ }
369
+ if (closed)
370
+ return null;
371
+ let child;
372
+ try {
373
+ child = await spawnClient(clientArgs());
374
+ }
375
+ catch {
376
+ backOff(); // tmux could not be started at all: asked again later, not at every command.
377
+ return null;
378
+ }
379
+ const replies = new ControlReplies(maxBuffer);
380
+ const started = { child, replies, headSince: 0, users: 0, retiring: false };
381
+ live.add(started);
382
+ replies.onReply = () => {
383
+ started.headSince = now();
384
+ watch(started);
385
+ };
386
+ replies.onSessionsChanged = () => checkAlone(started);
387
+ child.stdout.setEncoding("utf8");
388
+ child.stdout.on("data", (chunk) => replies.push(chunk));
389
+ child.stderr.resume();
390
+ child.on("error", (err) => {
391
+ if (child.pid === undefined)
392
+ live.delete(started); // never started: no exit will follow
393
+ drop(started, err.message);
394
+ });
395
+ child.on("exit", (code, signal) => {
396
+ live.delete(started);
397
+ drop(started, `exited (${signal ?? code})`);
398
+ });
399
+ child.stdin.on("error", (err) => drop(started, err.message));
400
+ // Its output closed, nothing will be answered: what it owes settles now, not at its reply timeout.
401
+ child.stdout.on("close", () => drop(started, "its output closed"));
402
+ // The daemon's exit is never held by its control client.
403
+ child.unref();
404
+ for (const stream of [child.stdin, child.stdout, child.stderr])
405
+ stream.unref?.();
406
+ const attached = await new Promise((resolve) => {
407
+ const timer = setTimeout(() => resolve(false), replyTimeoutMs);
408
+ const settle = (ok) => {
409
+ clearTimeout(timer);
410
+ cancelAttach = null;
411
+ resolve(ok);
412
+ };
413
+ replies.onAttached = settle;
414
+ cancelAttach = () => settle(false);
415
+ child.once("exit", () => settle(false));
416
+ // A spawn error may come without an exit: nothing runs, so nothing will attach.
417
+ child.once("error", () => settle(false));
418
+ if (closed)
419
+ settle(false);
420
+ });
421
+ client = started;
422
+ if (!attached || closed) {
423
+ drop(started, closed ? "closed" : "did not attach");
424
+ return null;
425
+ }
426
+ failures = 0;
427
+ // The server may have lost its last other session while this one was made.
428
+ checkAlone(started);
429
+ return started;
430
+ };
431
+ const connected = async () => {
432
+ if (closed)
433
+ return null;
434
+ if (client)
435
+ return client;
436
+ if (now() < retryAt)
437
+ return null;
438
+ starting ??= start().finally(() => { starting = null; });
439
+ return starting;
440
+ };
441
+ /** One command's reply, or the client's end: the whole line is failed when its head waits too long (`watch`), so no
442
+ * command waits behind a client that stopped answering, and every reply stays its own command's. */
443
+ const send = (target, args) => new Promise((resolve, reject) => {
444
+ // A chain's client may have ended after an earlier command's reply, or be ending: nothing is written to it.
445
+ if (target.replies.closed || target.child.stdin.writableEnded) {
446
+ reject(NOT_WRITTEN);
447
+ return;
448
+ }
449
+ if (target.replies.waiting === 0)
450
+ target.headSince = now();
451
+ target.replies.expect({ resolve, reject });
452
+ target.child.stdin.write(`${args.map(quote).join(" ")}\n`);
453
+ watch(target);
454
+ });
455
+ /** Retires the client once every session left on the server is a control session, this daemon's or another's:
456
+ * it would otherwise keep up a server that, as with spawned clients only, exits with its last session. Asked as the
457
+ * client attaches and at each `%sessions-changed`; a later command starts a client again while sessions remain. */
458
+ const checkAlone = (c) => {
459
+ if (client !== c)
460
+ return;
461
+ send(c, ["list-sessions", "-F", `#{${CONTROL_OPTION}}`]).then((reply) => {
462
+ if (reply.ok && !reply.overflow && reply.lines.every((line) => line !== ""))
463
+ retire(c);
464
+ }, () => { });
465
+ };
466
+ /** The error of a write whose client ended before its reply, with what a spawned client finds of its target now: a
467
+ * server or session gone reads as a spawned client's failure would (`no server running`, `can't find session`), so
468
+ * the adapter classifies it the same way. A client dropped for no reply is not asked about: the server is not
469
+ * answering, and a spawned client would wait on it as long. */
470
+ const failedWrite = async (command, err) => {
471
+ const t = command.indexOf("-t");
472
+ if (err.message.includes("no reply within") || t < 0 || t + 1 >= command.length)
473
+ return err;
474
+ try {
475
+ await fallback(["tmux", "display-message", "-p", "-t", command[t + 1], ""]);
476
+ return err;
477
+ }
478
+ catch (probe) {
479
+ const stderr = probe.execStderr;
480
+ return Object.assign(new Error(`${err.message}; then ${probe.message}`), typeof stderr === "string" ? { execStderr: stderr } : {});
481
+ }
482
+ };
483
+ const exec = async (argvIn) => {
484
+ const [bin, ...argsIn] = argvIn;
485
+ const commandsIn = commandsOf(argsIn);
486
+ const routable = bin === "tmux" && argsIn.length > 0 && !argsIn[0].startsWith("-") && commandsIn.length > 0
487
+ && commandsIn.every((c) => ROUTED.has(c[0]) && namesItsTarget(c))
488
+ && argsIn.every((a) => !/[\n\r\0]/.test(a));
489
+ // Every listing leaves this daemon's own rows out, from the first one on: its session may be made by the very call
490
+ // that lists, or by another one under way. A row is marked only on this daemon's own mark, so before its session
491
+ // exists the output is unchanged.
492
+ const marked = bin === "tmux" && commandsIn.some((c) => LISTINGS.has(c[0]));
493
+ const tag = marked ? ownRowTag() : "";
494
+ const argv = marked ? [bin, ...markOwnRows(argsIn, owner, tag)] : argvIn;
495
+ const own = (text) => marked ? withoutOwnRows(text, tag) : text;
496
+ const target = routable ? await connected() : null;
497
+ if (!target)
498
+ return own(await fallback(argv));
499
+ target.users++;
500
+ try {
501
+ const commands = commandsOf(argv.slice(1));
502
+ let stdout = "";
503
+ let bytes = 0;
504
+ for (const [index, command] of commands.entries()) {
505
+ let reply;
506
+ try {
507
+ reply = await send(target, command);
508
+ }
509
+ catch (err) {
510
+ // The call is run again by a spawned client only when no write of it was written: reads, and a write that
511
+ // never reached the client. A write that was (this one, or one earlier in the chain) may have taken effect,
512
+ // so the call fails, and the commands before this one are not run again.
513
+ const written = commands.slice(0, err === NOT_WRITTEN ? index : index + 1);
514
+ if (written.some((c) => !READS.has(c[0])))
515
+ throw await failedWrite(command, err);
516
+ return own(await fallback(argv));
517
+ }
518
+ const output = reply.lines.length > 0 ? `${reply.lines.join("\n")}\n` : "";
519
+ const text = LISTINGS.has(command[0]) ? own(output) : output;
520
+ // Past the bound, in this reply or in the chain's so far: the call fails as a spawned client's does, and the
521
+ // rest of the chain is not sent.
522
+ bytes += Buffer.byteLength(text);
523
+ if (reply.overflow || bytes > maxBuffer)
524
+ throw outputTooLarge(stdout);
525
+ if (!reply.ok)
526
+ throw commandFailed(argvIn, stdout, text);
527
+ stdout += text;
528
+ }
529
+ return stdout;
530
+ }
531
+ finally {
532
+ target.users--;
533
+ if (target.retiring && target.users === 0)
534
+ void end(target);
535
+ }
536
+ };
537
+ /** Ends every client, one attaching included, each after what it was sent: the daemon is stopping. tmux destroys
538
+ * their sessions as they leave. */
539
+ const close = async () => {
540
+ closed = true;
541
+ cancelAttach?.();
542
+ await starting;
543
+ await Promise.all([...live].map(end));
544
+ };
545
+ return Object.assign(exec, { close, owner });
546
+ }
547
+ //# sourceMappingURL=tmux-control.js.map