@openrig/cli 0.7.18 → 0.7.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (647) hide show
  1. package/README.md +7 -6
  2. package/daemon/assets/claude-hook-bridge.cjs +146 -0
  3. package/daemon/assets/plugins/openrig/.claude-plugin/plugin.json +1 -1
  4. package/daemon/assets/plugins/openrig/.codex-plugin/plugin.json +1 -1
  5. package/daemon/assets/plugins/openrig/.cursor-plugin/plugin.json +1 -1
  6. package/daemon/assets/plugins/openrig/plugin.json +1 -1
  7. package/daemon/assets/plugins/openrig-core/.claude-plugin/plugin.json +1 -1
  8. package/daemon/assets/plugins/openrig-core/.codex-plugin/plugin.json +1 -1
  9. package/daemon/assets/plugins/openrig-core/README.md +1 -1
  10. package/daemon/assets/plugins/openrig-core/hooks/claude.json +14 -14
  11. package/daemon/assets/plugins/openrig-core/hooks/scripts/activity-relay.cjs +43 -22
  12. package/daemon/assets/plugins/openrig-core/hooks/scripts/refocus.cjs +1 -0
  13. package/daemon/assets/plugins/openrig-core/skills/mission-slice-sop/SKILL.md +1 -1
  14. package/daemon/assets/plugins/openrig-core/skills/refocusing/scripts/trace-to-root.py +70 -2
  15. package/daemon/assets/skills/rigs/SKILL.md +40 -19
  16. package/daemon/context-packs/help/manifest.yaml +1 -1
  17. package/daemon/context-packs/onboarding-width/manifest.yaml +1 -1
  18. package/daemon/context-packs/onboarding-width/public-what-you-can-do.md +16 -7
  19. package/daemon/context-packs/reference/getting-started.md +9 -4
  20. package/daemon/context-packs/reference/manifest.yaml +1 -1
  21. package/daemon/context-packs/reference/rig-spec.md +56 -26
  22. package/daemon/context-packs/reference/whats-new.md +82 -11
  23. package/daemon/context-packs/skills/agent-operated-software/manifest.yaml +1 -1
  24. package/daemon/context-packs/skills/agent-operated-workflows/manifest.yaml +1 -1
  25. package/daemon/context-packs/skills/applying-a-permission-policy/manifest.yaml +1 -1
  26. package/daemon/context-packs/skills/claude-compaction-restore/manifest.yaml +1 -1
  27. package/daemon/context-packs/skills/core/agent-starters/manifest.yaml +1 -1
  28. package/daemon/context-packs/skills/core/agent-startup-and-context-ingestion/manifest.yaml +1 -1
  29. package/daemon/context-packs/skills/core/cross-host-rig-commands/manifest.yaml +1 -1
  30. package/daemon/context-packs/skills/core/human-in-the-loop/manifest.yaml +1 -1
  31. package/daemon/context-packs/skills/core/messaging-the-human/manifest.yaml +1 -1
  32. package/daemon/context-packs/skills/core/openrig-architect/manifest.yaml +1 -1
  33. package/daemon/context-packs/skills/core/openrig-cmux/manifest.yaml +1 -1
  34. package/daemon/context-packs/skills/core/openrig-herdr/manifest.yaml +1 -1
  35. package/daemon/context-packs/skills/core/openrig-skills/manifest.yaml +1 -1
  36. package/daemon/context-packs/skills/core/openrig-software-factory/manifest.yaml +1 -1
  37. package/daemon/context-packs/skills/core/openrig-upgrade/manifest.yaml +1 -1
  38. package/daemon/context-packs/skills/core/rig-bundles-and-shareable-artifacts/manifest.yaml +1 -1
  39. package/daemon/context-packs/skills/core/rig-lifecycle/manifest.yaml +1 -1
  40. package/daemon/context-packs/skills/core/session-source-fork/manifest.yaml +1 -1
  41. package/daemon/context-packs/skills/core/specification-system/manifest.yaml +1 -1
  42. package/daemon/context-packs/skills/core/topology-mutation-and-seat-management/manifest.yaml +1 -1
  43. package/daemon/context-packs/skills/core/watchdog/manifest.yaml +1 -1
  44. package/daemon/context-packs/skills/core/working-with-an-openrig-team/manifest.yaml +1 -1
  45. package/daemon/context-packs/skills/delegating-work/manifest.yaml +1 -1
  46. package/daemon/context-packs/skills/forming-an-openrig-mental-model/manifest.yaml +1 -1
  47. package/daemon/context-packs/skills/loading-addressable-markdown/manifest.yaml +1 -1
  48. package/daemon/context-packs/skills/mission-slice-sop/SKILL.md +1 -1
  49. package/daemon/context-packs/skills/mission-slice-sop/manifest.yaml +1 -1
  50. package/daemon/context-packs/skills/openrig-operating-model/manifest.yaml +1 -1
  51. package/daemon/context-packs/skills/openrig-user/manifest.yaml +1 -1
  52. package/daemon/context-packs/skills/orienting-to-an-inherited-seat/manifest.yaml +1 -1
  53. package/daemon/context-packs/skills/pm/backlog-capture/manifest.yaml +1 -1
  54. package/daemon/context-packs/skills/pm/context-builder/manifest.yaml +1 -1
  55. package/daemon/context-packs/skills/pm/exec-summary/manifest.yaml +1 -1
  56. package/daemon/context-packs/skills/pm/office-hours/manifest.yaml +1 -1
  57. package/daemon/context-packs/skills/pm/plan-review/manifest.yaml +1 -1
  58. package/daemon/context-packs/skills/pm/requirements-writer/manifest.yaml +1 -1
  59. package/daemon/context-packs/skills/pm/ui-mockup/manifest.yaml +1 -1
  60. package/daemon/context-packs/skills/pods/development-team/manifest.yaml +1 -1
  61. package/daemon/context-packs/skills/pods/orchestration-team/manifest.yaml +1 -1
  62. package/daemon/context-packs/skills/pods/oversight-team/manifest.yaml +1 -1
  63. package/daemon/context-packs/skills/pods/review-team/manifest.yaml +1 -1
  64. package/daemon/context-packs/skills/process/agent-browser/manifest.yaml +1 -1
  65. package/daemon/context-packs/skills/process/context-engineering/manifest.yaml +1 -1
  66. package/daemon/context-packs/skills/process/dogfood/manifest.yaml +1 -1
  67. package/daemon/context-packs/skills/process/frontend-design/manifest.yaml +1 -1
  68. package/daemon/context-packs/skills/process/systematic-debugging/manifest.yaml +1 -1
  69. package/daemon/context-packs/skills/process/test-driven-development/manifest.yaml +1 -1
  70. package/daemon/context-packs/skills/process/verification-before-completion/manifest.yaml +1 -1
  71. package/daemon/context-packs/skills/queue-handoff/manifest.yaml +1 -1
  72. package/daemon/context-packs/skills/refocusing/manifest.yaml +1 -1
  73. package/daemon/context-packs/skills/refocusing/scripts/trace-to-root.py +70 -2
  74. package/daemon/context-packs/skills/retiring-and-inheriting-a-seat/manifest.yaml +1 -1
  75. package/daemon/context-packs/skills/seat-continuity-and-handover/manifest.yaml +1 -1
  76. package/daemon/context-packs/skills/session-compaction-and-restore/manifest.yaml +1 -1
  77. package/daemon/context-packs/skills/software-for-agents/manifest.yaml +1 -1
  78. package/daemon/context-packs/world-example/manifest.yaml +1 -1
  79. package/daemon/context-packs/world-public/manifest.yaml +1 -1
  80. package/daemon/dist/adapters/claude-code-adapter.d.ts +9 -0
  81. package/daemon/dist/adapters/claude-code-adapter.d.ts.map +1 -1
  82. package/daemon/dist/adapters/claude-code-adapter.js +41 -4
  83. package/daemon/dist/adapters/claude-code-adapter.js.map +1 -1
  84. package/daemon/dist/adapters/claude-resume.d.ts +2 -0
  85. package/daemon/dist/adapters/claude-resume.d.ts.map +1 -1
  86. package/daemon/dist/adapters/claude-resume.js +3 -1
  87. package/daemon/dist/adapters/claude-resume.js.map +1 -1
  88. package/daemon/dist/adapters/codex-runtime-adapter.d.ts +5 -0
  89. package/daemon/dist/adapters/codex-runtime-adapter.d.ts.map +1 -1
  90. package/daemon/dist/adapters/codex-runtime-adapter.js +45 -10
  91. package/daemon/dist/adapters/codex-runtime-adapter.js.map +1 -1
  92. package/daemon/dist/adapters/kernel-authority.d.ts +7 -0
  93. package/daemon/dist/adapters/kernel-authority.d.ts.map +1 -1
  94. package/daemon/dist/adapters/kernel-authority.js +24 -1
  95. package/daemon/dist/adapters/kernel-authority.js.map +1 -1
  96. package/daemon/dist/adapters/pi-resume.d.ts.map +1 -1
  97. package/daemon/dist/adapters/pi-resume.js +5 -7
  98. package/daemon/dist/adapters/pi-resume.js.map +1 -1
  99. package/daemon/dist/adapters/pi-runner-protocol.d.ts +5 -1
  100. package/daemon/dist/adapters/pi-runner-protocol.d.ts.map +1 -1
  101. package/daemon/dist/adapters/pi-runner.d.ts +34 -0
  102. package/daemon/dist/adapters/pi-runner.d.ts.map +1 -1
  103. package/daemon/dist/adapters/pi-runner.js +359 -26
  104. package/daemon/dist/adapters/pi-runner.js.map +1 -1
  105. package/daemon/dist/adapters/pi-runtime-adapter.d.ts +7 -1
  106. package/daemon/dist/adapters/pi-runtime-adapter.d.ts.map +1 -1
  107. package/daemon/dist/adapters/pi-runtime-adapter.js +29 -19
  108. package/daemon/dist/adapters/pi-runtime-adapter.js.map +1 -1
  109. package/daemon/dist/adapters/tmux.d.ts +54 -34
  110. package/daemon/dist/adapters/tmux.d.ts.map +1 -1
  111. package/daemon/dist/adapters/tmux.js +183 -57
  112. package/daemon/dist/adapters/tmux.js.map +1 -1
  113. package/daemon/dist/build-info.js +3 -3
  114. package/daemon/dist/db/all-migrations.d.ts.map +1 -1
  115. package/daemon/dist/db/all-migrations.js +6 -0
  116. package/daemon/dist/db/all-migrations.js.map +1 -1
  117. package/daemon/dist/db/migrations/171_seat_hook_bridge.d.ts +5 -0
  118. package/daemon/dist/db/migrations/171_seat_hook_bridge.d.ts.map +1 -0
  119. package/daemon/dist/db/migrations/171_seat_hook_bridge.js +25 -0
  120. package/daemon/dist/db/migrations/171_seat_hook_bridge.js.map +1 -0
  121. package/daemon/dist/db/migrations/174_session_launched_cwd.d.ts +6 -0
  122. package/daemon/dist/db/migrations/174_session_launched_cwd.d.ts.map +1 -0
  123. package/daemon/dist/db/migrations/174_session_launched_cwd.js +8 -0
  124. package/daemon/dist/db/migrations/174_session_launched_cwd.js.map +1 -0
  125. package/daemon/dist/db/migrations/175_core_app_access.d.ts +3 -0
  126. package/daemon/dist/db/migrations/175_core_app_access.d.ts.map +1 -0
  127. package/daemon/dist/db/migrations/175_core_app_access.js +26 -0
  128. package/daemon/dist/db/migrations/175_core_app_access.js.map +1 -0
  129. package/daemon/dist/domain/activity-grants.d.ts.map +1 -1
  130. package/daemon/dist/domain/activity-grants.js +6 -4
  131. package/daemon/dist/domain/activity-grants.js.map +1 -1
  132. package/daemon/dist/domain/agent-activity-store.d.ts +23 -0
  133. package/daemon/dist/domain/agent-activity-store.d.ts.map +1 -1
  134. package/daemon/dist/domain/agent-activity-store.js +62 -5
  135. package/daemon/dist/domain/agent-activity-store.js.map +1 -1
  136. package/daemon/dist/domain/claude-activity-hooks.d.ts +4 -2
  137. package/daemon/dist/domain/claude-activity-hooks.d.ts.map +1 -1
  138. package/daemon/dist/domain/claude-activity-hooks.js +5 -3
  139. package/daemon/dist/domain/claude-activity-hooks.js.map +1 -1
  140. package/daemon/dist/domain/claude-compaction-enforcer.d.ts +64 -3
  141. package/daemon/dist/domain/claude-compaction-enforcer.d.ts.map +1 -1
  142. package/daemon/dist/domain/claude-compaction-enforcer.js +203 -6
  143. package/daemon/dist/domain/claude-compaction-enforcer.js.map +1 -1
  144. package/daemon/dist/domain/compaction-restore-notice.d.ts +3 -1
  145. package/daemon/dist/domain/compaction-restore-notice.d.ts.map +1 -1
  146. package/daemon/dist/domain/compaction-restore-notice.js +22 -3
  147. package/daemon/dist/domain/compaction-restore-notice.js.map +1 -1
  148. package/daemon/dist/domain/configured-account.d.ts +3 -0
  149. package/daemon/dist/domain/configured-account.d.ts.map +1 -0
  150. package/daemon/dist/domain/configured-account.js +10 -0
  151. package/daemon/dist/domain/configured-account.js.map +1 -0
  152. package/daemon/dist/domain/core-app-access.d.ts +51 -0
  153. package/daemon/dist/domain/core-app-access.d.ts.map +1 -0
  154. package/daemon/dist/domain/core-app-access.js +107 -0
  155. package/daemon/dist/domain/core-app-access.js.map +1 -0
  156. package/daemon/dist/domain/core-app-job.d.ts +411 -0
  157. package/daemon/dist/domain/core-app-job.d.ts.map +1 -0
  158. package/daemon/dist/domain/core-app-job.js +537 -0
  159. package/daemon/dist/domain/core-app-job.js.map +1 -0
  160. package/daemon/dist/domain/current-park-arm.d.ts +4 -0
  161. package/daemon/dist/domain/current-park-arm.d.ts.map +1 -0
  162. package/daemon/dist/domain/current-park-arm.js +14 -0
  163. package/daemon/dist/domain/current-park-arm.js.map +1 -0
  164. package/daemon/dist/domain/cwd-resolution.d.ts +12 -0
  165. package/daemon/dist/domain/cwd-resolution.d.ts.map +1 -1
  166. package/daemon/dist/domain/cwd-resolution.js +21 -1
  167. package/daemon/dist/domain/cwd-resolution.js.map +1 -1
  168. package/daemon/dist/domain/execution-view.d.ts.map +1 -1
  169. package/daemon/dist/domain/execution-view.js +9 -3
  170. package/daemon/dist/domain/execution-view.js.map +1 -1
  171. package/daemon/dist/domain/gateway/participants.d.ts +2 -0
  172. package/daemon/dist/domain/gateway/participants.d.ts.map +1 -1
  173. package/daemon/dist/domain/gateway/participants.js +5 -1
  174. package/daemon/dist/domain/gateway/participants.js.map +1 -1
  175. package/daemon/dist/domain/gateway/slack/message.d.ts +1 -0
  176. package/daemon/dist/domain/gateway/slack/message.d.ts.map +1 -1
  177. package/daemon/dist/domain/gateway/slack/message.js +37 -17
  178. package/daemon/dist/domain/gateway/slack/message.js.map +1 -1
  179. package/daemon/dist/domain/gateway/slack/settled-asks.js +1 -1
  180. package/daemon/dist/domain/gateway/slack/settled-asks.js.map +1 -1
  181. package/daemon/dist/domain/gateway/slack/slack-delivery.d.ts +1 -0
  182. package/daemon/dist/domain/gateway/slack/slack-delivery.d.ts.map +1 -1
  183. package/daemon/dist/domain/gateway/slack/slack-delivery.js +2 -0
  184. package/daemon/dist/domain/gateway/slack/slack-delivery.js.map +1 -1
  185. package/daemon/dist/domain/gateway/slack/slack-subsystem.d.ts +4 -0
  186. package/daemon/dist/domain/gateway/slack/slack-subsystem.d.ts.map +1 -1
  187. package/daemon/dist/domain/gateway/slack/slack-subsystem.js +26 -2
  188. package/daemon/dist/domain/gateway/slack/slack-subsystem.js.map +1 -1
  189. package/daemon/dist/domain/hook-bridge.d.ts +345 -0
  190. package/daemon/dist/domain/hook-bridge.d.ts.map +1 -0
  191. package/daemon/dist/domain/hook-bridge.js +547 -0
  192. package/daemon/dist/domain/hook-bridge.js.map +1 -0
  193. package/daemon/dist/domain/hosted-wake.d.ts +9 -0
  194. package/daemon/dist/domain/hosted-wake.d.ts.map +1 -1
  195. package/daemon/dist/domain/hosted-wake.js +45 -6
  196. package/daemon/dist/domain/hosted-wake.js.map +1 -1
  197. package/daemon/dist/domain/human-ask-attention.d.ts +10 -0
  198. package/daemon/dist/domain/human-ask-attention.d.ts.map +1 -0
  199. package/daemon/dist/domain/human-ask-attention.js +22 -0
  200. package/daemon/dist/domain/human-ask-attention.js.map +1 -0
  201. package/daemon/dist/domain/mission-control/mission-control-action-log.d.ts +4 -0
  202. package/daemon/dist/domain/mission-control/mission-control-action-log.d.ts.map +1 -1
  203. package/daemon/dist/domain/mission-control/mission-control-action-log.js +8 -1
  204. package/daemon/dist/domain/mission-control/mission-control-action-log.js.map +1 -1
  205. package/daemon/dist/domain/mission-control/mission-control-write-contract.d.ts +10 -0
  206. package/daemon/dist/domain/mission-control/mission-control-write-contract.d.ts.map +1 -1
  207. package/daemon/dist/domain/mission-control/mission-control-write-contract.js +64 -12
  208. package/daemon/dist/domain/mission-control/mission-control-write-contract.js.map +1 -1
  209. package/daemon/dist/domain/native-continuation-notice.d.ts +16 -0
  210. package/daemon/dist/domain/native-continuation-notice.d.ts.map +1 -0
  211. package/daemon/dist/domain/native-continuation-notice.js +79 -0
  212. package/daemon/dist/domain/native-continuation-notice.js.map +1 -0
  213. package/daemon/dist/domain/native-process-lineage.d.ts +16 -0
  214. package/daemon/dist/domain/native-process-lineage.d.ts.map +1 -1
  215. package/daemon/dist/domain/native-process-lineage.js +48 -3
  216. package/daemon/dist/domain/native-process-lineage.js.map +1 -1
  217. package/daemon/dist/domain/node-inventory.d.ts.map +1 -1
  218. package/daemon/dist/domain/node-inventory.js +27 -6
  219. package/daemon/dist/domain/node-inventory.js.map +1 -1
  220. package/daemon/dist/domain/node-launcher.d.ts +6 -0
  221. package/daemon/dist/domain/node-launcher.d.ts.map +1 -1
  222. package/daemon/dist/domain/node-launcher.js +16 -2
  223. package/daemon/dist/domain/node-launcher.js.map +1 -1
  224. package/daemon/dist/domain/outbox-handler.d.ts +21 -3
  225. package/daemon/dist/domain/outbox-handler.d.ts.map +1 -1
  226. package/daemon/dist/domain/outbox-handler.js +88 -8
  227. package/daemon/dist/domain/outbox-handler.js.map +1 -1
  228. package/daemon/dist/domain/park-wake-text.d.ts +18 -0
  229. package/daemon/dist/domain/park-wake-text.d.ts.map +1 -1
  230. package/daemon/dist/domain/park-wake-text.js +44 -0
  231. package/daemon/dist/domain/park-wake-text.js.map +1 -1
  232. package/daemon/dist/domain/policies/idle-gate-qitem.d.ts +3 -0
  233. package/daemon/dist/domain/policies/idle-gate-qitem.d.ts.map +1 -1
  234. package/daemon/dist/domain/policies/idle-gate-qitem.js +15 -0
  235. package/daemon/dist/domain/policies/idle-gate-qitem.js.map +1 -1
  236. package/daemon/dist/domain/policies/parked-owner-consumer.d.ts +6 -1
  237. package/daemon/dist/domain/policies/parked-owner-consumer.d.ts.map +1 -1
  238. package/daemon/dist/domain/policies/parked-owner-consumer.js +28 -1
  239. package/daemon/dist/domain/policies/parked-owner-consumer.js.map +1 -1
  240. package/daemon/dist/domain/process-limits.d.ts +21 -11
  241. package/daemon/dist/domain/process-limits.d.ts.map +1 -1
  242. package/daemon/dist/domain/process-limits.js +74 -20
  243. package/daemon/dist/domain/process-limits.js.map +1 -1
  244. package/daemon/dist/domain/process-table.d.ts +15 -0
  245. package/daemon/dist/domain/process-table.d.ts.map +1 -1
  246. package/daemon/dist/domain/process-table.js +39 -0
  247. package/daemon/dist/domain/process-table.js.map +1 -1
  248. package/daemon/dist/domain/queue-erasure.d.ts.map +1 -1
  249. package/daemon/dist/domain/queue-erasure.js +3 -0
  250. package/daemon/dist/domain/queue-erasure.js.map +1 -1
  251. package/daemon/dist/domain/queue-repository.d.ts +60 -7
  252. package/daemon/dist/domain/queue-repository.d.ts.map +1 -1
  253. package/daemon/dist/domain/queue-repository.js +178 -36
  254. package/daemon/dist/domain/queue-repository.js.map +1 -1
  255. package/daemon/dist/domain/queue-stuck-sweep.d.ts +2 -0
  256. package/daemon/dist/domain/queue-stuck-sweep.d.ts.map +1 -1
  257. package/daemon/dist/domain/queue-stuck-sweep.js +29 -0
  258. package/daemon/dist/domain/queue-stuck-sweep.js.map +1 -1
  259. package/daemon/dist/domain/queue-waiting.d.ts.map +1 -1
  260. package/daemon/dist/domain/queue-waiting.js +28 -3
  261. package/daemon/dist/domain/queue-waiting.js.map +1 -1
  262. package/daemon/dist/domain/queue-wake-ladder.d.ts +12 -0
  263. package/daemon/dist/domain/queue-wake-ladder.d.ts.map +1 -1
  264. package/daemon/dist/domain/queue-wake-ladder.js +115 -14
  265. package/daemon/dist/domain/queue-wake-ladder.js.map +1 -1
  266. package/daemon/dist/domain/queue-wake-repository.d.ts +8 -0
  267. package/daemon/dist/domain/queue-wake-repository.d.ts.map +1 -1
  268. package/daemon/dist/domain/queue-wake-repository.js +48 -8
  269. package/daemon/dist/domain/queue-wake-repository.js.map +1 -1
  270. package/daemon/dist/domain/reconciler.d.ts +18 -2
  271. package/daemon/dist/domain/reconciler.d.ts.map +1 -1
  272. package/daemon/dist/domain/reconciler.js +40 -0
  273. package/daemon/dist/domain/reconciler.js.map +1 -1
  274. package/daemon/dist/domain/restore-attempt-receipt.d.ts.map +1 -1
  275. package/daemon/dist/domain/restore-attempt-receipt.js +3 -2
  276. package/daemon/dist/domain/restore-attempt-receipt.js.map +1 -1
  277. package/daemon/dist/domain/restore-orchestrator.d.ts +5 -1
  278. package/daemon/dist/domain/restore-orchestrator.d.ts.map +1 -1
  279. package/daemon/dist/domain/restore-orchestrator.js +73 -8
  280. package/daemon/dist/domain/restore-orchestrator.js.map +1 -1
  281. package/daemon/dist/domain/restore-topology.d.ts +7 -1
  282. package/daemon/dist/domain/restore-topology.d.ts.map +1 -1
  283. package/daemon/dist/domain/restore-topology.js +21 -0
  284. package/daemon/dist/domain/restore-topology.js.map +1 -1
  285. package/daemon/dist/domain/resume-metadata-refresher.d.ts +2 -3
  286. package/daemon/dist/domain/resume-metadata-refresher.d.ts.map +1 -1
  287. package/daemon/dist/domain/resume-metadata-refresher.js +6 -25
  288. package/daemon/dist/domain/resume-metadata-refresher.js.map +1 -1
  289. package/daemon/dist/domain/rig-repository.d.ts.map +1 -1
  290. package/daemon/dist/domain/rig-repository.js +7 -6
  291. package/daemon/dist/domain/rig-repository.js.map +1 -1
  292. package/daemon/dist/domain/rig-teardown.d.ts +16 -3
  293. package/daemon/dist/domain/rig-teardown.d.ts.map +1 -1
  294. package/daemon/dist/domain/rig-teardown.js +73 -9
  295. package/daemon/dist/domain/rig-teardown.js.map +1 -1
  296. package/daemon/dist/domain/rigspec-exporter.js +2 -2
  297. package/daemon/dist/domain/rigspec-exporter.js.map +1 -1
  298. package/daemon/dist/domain/rigspec-instantiator.d.ts +5 -0
  299. package/daemon/dist/domain/rigspec-instantiator.d.ts.map +1 -1
  300. package/daemon/dist/domain/rigspec-instantiator.js +17 -7
  301. package/daemon/dist/domain/rigspec-instantiator.js.map +1 -1
  302. package/daemon/dist/domain/rosters.d.ts +11 -0
  303. package/daemon/dist/domain/rosters.d.ts.map +1 -1
  304. package/daemon/dist/domain/rosters.js +21 -2
  305. package/daemon/dist/domain/rosters.js.map +1 -1
  306. package/daemon/dist/domain/runner-channel.d.ts +35 -3
  307. package/daemon/dist/domain/runner-channel.d.ts.map +1 -1
  308. package/daemon/dist/domain/runner-channel.js +177 -8
  309. package/daemon/dist/domain/runner-channel.js.map +1 -1
  310. package/daemon/dist/domain/runner-permissions.d.ts +26 -3
  311. package/daemon/dist/domain/runner-permissions.d.ts.map +1 -1
  312. package/daemon/dist/domain/runner-permissions.js +160 -39
  313. package/daemon/dist/domain/runner-permissions.js.map +1 -1
  314. package/daemon/dist/domain/scope/mission-parent.d.ts +19 -0
  315. package/daemon/dist/domain/scope/mission-parent.d.ts.map +1 -0
  316. package/daemon/dist/domain/scope/mission-parent.js +134 -0
  317. package/daemon/dist/domain/scope/mission-parent.js.map +1 -0
  318. package/daemon/dist/domain/scope/scope-audit.d.ts.map +1 -1
  319. package/daemon/dist/domain/scope/scope-audit.js +8 -0
  320. package/daemon/dist/domain/scope/scope-audit.js.map +1 -1
  321. package/daemon/dist/domain/scope/types.d.ts +3 -1
  322. package/daemon/dist/domain/scope/types.d.ts.map +1 -1
  323. package/daemon/dist/domain/scope/types.js +5 -1
  324. package/daemon/dist/domain/scope/types.js.map +1 -1
  325. package/daemon/dist/domain/seat-delivery-guard.d.ts +14 -2
  326. package/daemon/dist/domain/seat-delivery-guard.d.ts.map +1 -1
  327. package/daemon/dist/domain/seat-delivery-guard.js +53 -14
  328. package/daemon/dist/domain/seat-delivery-guard.js.map +1 -1
  329. package/daemon/dist/domain/seat-handover-service.d.ts.map +1 -1
  330. package/daemon/dist/domain/seat-handover-service.js +9 -4
  331. package/daemon/dist/domain/seat-handover-service.js.map +1 -1
  332. package/daemon/dist/domain/seat-identity-reconciler.d.ts +4 -3
  333. package/daemon/dist/domain/seat-identity-reconciler.d.ts.map +1 -1
  334. package/daemon/dist/domain/seat-identity-reconciler.js +40 -5
  335. package/daemon/dist/domain/seat-identity-reconciler.js.map +1 -1
  336. package/daemon/dist/domain/seat-lifecycle-service.d.ts +14 -6
  337. package/daemon/dist/domain/seat-lifecycle-service.d.ts.map +1 -1
  338. package/daemon/dist/domain/seat-lifecycle-service.js +104 -22
  339. package/daemon/dist/domain/seat-lifecycle-service.js.map +1 -1
  340. package/daemon/dist/domain/seat-restart-in-place.d.ts.map +1 -1
  341. package/daemon/dist/domain/seat-restart-in-place.js +4 -1
  342. package/daemon/dist/domain/seat-restart-in-place.js.map +1 -1
  343. package/daemon/dist/domain/seat-runtime-switch-service.d.ts.map +1 -1
  344. package/daemon/dist/domain/seat-runtime-switch-service.js +2 -0
  345. package/daemon/dist/domain/seat-runtime-switch-service.js.map +1 -1
  346. package/daemon/dist/domain/seat-skill-apply.d.ts +1 -1
  347. package/daemon/dist/domain/seat-skill-apply.d.ts.map +1 -1
  348. package/daemon/dist/domain/seat-skill-apply.js +3 -2
  349. package/daemon/dist/domain/seat-skill-apply.js.map +1 -1
  350. package/daemon/dist/domain/session-registry.d.ts +5 -1
  351. package/daemon/dist/domain/session-registry.d.ts.map +1 -1
  352. package/daemon/dist/domain/session-registry.js +12 -1
  353. package/daemon/dist/domain/session-registry.js.map +1 -1
  354. package/daemon/dist/domain/session-transport.d.ts +40 -1
  355. package/daemon/dist/domain/session-transport.d.ts.map +1 -1
  356. package/daemon/dist/domain/session-transport.js +211 -10
  357. package/daemon/dist/domain/session-transport.js.map +1 -1
  358. package/daemon/dist/domain/shared-history-selection.d.ts.map +1 -1
  359. package/daemon/dist/domain/shared-history-selection.js +9 -5
  360. package/daemon/dist/domain/shared-history-selection.js.map +1 -1
  361. package/daemon/dist/domain/slices/slice-indexer.d.ts +1 -1
  362. package/daemon/dist/domain/slices/slice-indexer.d.ts.map +1 -1
  363. package/daemon/dist/domain/slices/slice-indexer.js +4 -0
  364. package/daemon/dist/domain/slices/slice-indexer.js.map +1 -1
  365. package/daemon/dist/domain/startup-orchestrator.d.ts +1 -0
  366. package/daemon/dist/domain/startup-orchestrator.d.ts.map +1 -1
  367. package/daemon/dist/domain/startup-orchestrator.js +6 -4
  368. package/daemon/dist/domain/startup-orchestrator.js.map +1 -1
  369. package/daemon/dist/domain/successor-session-launcher.d.ts.map +1 -1
  370. package/daemon/dist/domain/successor-session-launcher.js +10 -4
  371. package/daemon/dist/domain/successor-session-launcher.js.map +1 -1
  372. package/daemon/dist/domain/terminal/herdr-adapter.d.ts +35 -1
  373. package/daemon/dist/domain/terminal/herdr-adapter.d.ts.map +1 -1
  374. package/daemon/dist/domain/terminal/herdr-adapter.js +231 -33
  375. package/daemon/dist/domain/terminal/herdr-adapter.js.map +1 -1
  376. package/daemon/dist/domain/terminal/herdr-sessions.d.ts.map +1 -1
  377. package/daemon/dist/domain/terminal/herdr-sessions.js +2 -1
  378. package/daemon/dist/domain/terminal/herdr-sessions.js.map +1 -1
  379. package/daemon/dist/domain/terminal/rig-viewer-records.d.ts +59 -0
  380. package/daemon/dist/domain/terminal/rig-viewer-records.d.ts.map +1 -0
  381. package/daemon/dist/domain/terminal/rig-viewer-records.js +210 -0
  382. package/daemon/dist/domain/terminal/rig-viewer-records.js.map +1 -0
  383. package/daemon/dist/domain/terminal/terminal-provider.d.ts +2 -0
  384. package/daemon/dist/domain/terminal/terminal-provider.d.ts.map +1 -1
  385. package/daemon/dist/domain/terminal/terminal-service.d.ts +99 -4
  386. package/daemon/dist/domain/terminal/terminal-service.d.ts.map +1 -1
  387. package/daemon/dist/domain/terminal/terminal-service.js +556 -36
  388. package/daemon/dist/domain/terminal/terminal-service.js.map +1 -1
  389. package/daemon/dist/domain/terminal/tile-layout.js +1 -1
  390. package/daemon/dist/domain/terminal/tile-layout.js.map +1 -1
  391. package/daemon/dist/domain/terminal/tmux-viewer-guard.d.ts +25 -0
  392. package/daemon/dist/domain/terminal/tmux-viewer-guard.d.ts.map +1 -0
  393. package/daemon/dist/domain/terminal/tmux-viewer-guard.js +70 -0
  394. package/daemon/dist/domain/terminal/tmux-viewer-guard.js.map +1 -0
  395. package/daemon/dist/domain/transcript-grep-worker.d.ts +2 -0
  396. package/daemon/dist/domain/transcript-grep-worker.d.ts.map +1 -0
  397. package/daemon/dist/domain/transcript-grep-worker.js +108 -0
  398. package/daemon/dist/domain/transcript-grep-worker.js.map +1 -0
  399. package/daemon/dist/domain/transcript-grep.d.ts +26 -0
  400. package/daemon/dist/domain/transcript-grep.d.ts.map +1 -0
  401. package/daemon/dist/domain/transcript-grep.js +90 -0
  402. package/daemon/dist/domain/transcript-grep.js.map +1 -0
  403. package/daemon/dist/domain/transcript-store.d.ts +8 -2
  404. package/daemon/dist/domain/transcript-store.d.ts.map +1 -1
  405. package/daemon/dist/domain/transcript-store.js +10 -60
  406. package/daemon/dist/domain/transcript-store.js.map +1 -1
  407. package/daemon/dist/domain/types.d.ts +69 -2
  408. package/daemon/dist/domain/types.d.ts.map +1 -1
  409. package/daemon/dist/domain/types.js.map +1 -1
  410. package/daemon/dist/domain/watchdog-delivery-receipts.d.ts +4 -0
  411. package/daemon/dist/domain/watchdog-delivery-receipts.d.ts.map +1 -1
  412. package/daemon/dist/domain/watchdog-delivery-receipts.js +35 -2
  413. package/daemon/dist/domain/watchdog-delivery-receipts.js.map +1 -1
  414. package/daemon/dist/domain/watchdog-delivery.d.ts +44 -0
  415. package/daemon/dist/domain/watchdog-delivery.d.ts.map +1 -1
  416. package/daemon/dist/domain/watchdog-delivery.js +60 -2
  417. package/daemon/dist/domain/watchdog-delivery.js.map +1 -1
  418. package/daemon/dist/domain/watchdog-history-log.d.ts +12 -0
  419. package/daemon/dist/domain/watchdog-history-log.d.ts.map +1 -1
  420. package/daemon/dist/domain/watchdog-history-log.js +19 -1
  421. package/daemon/dist/domain/watchdog-history-log.js.map +1 -1
  422. package/daemon/dist/domain/watchdog-jobs-repository.d.ts +32 -0
  423. package/daemon/dist/domain/watchdog-jobs-repository.d.ts.map +1 -1
  424. package/daemon/dist/domain/watchdog-jobs-repository.js +78 -0
  425. package/daemon/dist/domain/watchdog-jobs-repository.js.map +1 -1
  426. package/daemon/dist/domain/watchdog-policy-engine.d.ts +17 -3
  427. package/daemon/dist/domain/watchdog-policy-engine.d.ts.map +1 -1
  428. package/daemon/dist/domain/watchdog-policy-engine.js +19 -5
  429. package/daemon/dist/domain/watchdog-policy-engine.js.map +1 -1
  430. package/daemon/dist/domain/workflow-projector.js +1 -1
  431. package/daemon/dist/domain/workflow-projector.js.map +1 -1
  432. package/daemon/dist/domain/workflow-runtime.d.ts +12 -0
  433. package/daemon/dist/domain/workflow-runtime.d.ts.map +1 -1
  434. package/daemon/dist/domain/workflow-runtime.js +64 -7
  435. package/daemon/dist/domain/workflow-runtime.js.map +1 -1
  436. package/daemon/dist/domain/workflow-step-trail-log.d.ts +2 -2
  437. package/daemon/dist/domain/workflow-step-trail-log.d.ts.map +1 -1
  438. package/daemon/dist/domain/workflow-step-trail-log.js.map +1 -1
  439. package/daemon/dist/domain/workflow-types.d.ts +3 -1
  440. package/daemon/dist/domain/workflow-types.d.ts.map +1 -1
  441. package/daemon/dist/domain/workflow-types.js.map +1 -1
  442. package/daemon/dist/index.d.ts.map +1 -1
  443. package/daemon/dist/index.js +5 -1
  444. package/daemon/dist/index.js.map +1 -1
  445. package/daemon/dist/lib/pane-envelope.d.ts +3 -0
  446. package/daemon/dist/lib/pane-envelope.d.ts.map +1 -1
  447. package/daemon/dist/lib/pane-envelope.js +3 -1
  448. package/daemon/dist/lib/pane-envelope.js.map +1 -1
  449. package/daemon/dist/mission-parent-surface.d.ts +2 -0
  450. package/daemon/dist/mission-parent-surface.d.ts.map +1 -0
  451. package/daemon/dist/mission-parent-surface.js +2 -0
  452. package/daemon/dist/mission-parent-surface.js.map +1 -0
  453. package/daemon/dist/routes/activity.d.ts +18 -1
  454. package/daemon/dist/routes/activity.d.ts.map +1 -1
  455. package/daemon/dist/routes/activity.js +47 -9
  456. package/daemon/dist/routes/activity.js.map +1 -1
  457. package/daemon/dist/routes/attention.d.ts.map +1 -1
  458. package/daemon/dist/routes/attention.js +194 -177
  459. package/daemon/dist/routes/attention.js.map +1 -1
  460. package/daemon/dist/routes/core-app.d.ts +10 -0
  461. package/daemon/dist/routes/core-app.d.ts.map +1 -0
  462. package/daemon/dist/routes/core-app.js +175 -0
  463. package/daemon/dist/routes/core-app.js.map +1 -0
  464. package/daemon/dist/routes/hook-bridge.d.ts +3 -0
  465. package/daemon/dist/routes/hook-bridge.d.ts.map +1 -0
  466. package/daemon/dist/routes/hook-bridge.js +158 -0
  467. package/daemon/dist/routes/hook-bridge.js.map +1 -0
  468. package/daemon/dist/routes/missions.d.ts.map +1 -1
  469. package/daemon/dist/routes/missions.js +14 -2
  470. package/daemon/dist/routes/missions.js.map +1 -1
  471. package/daemon/dist/routes/queue.d.ts +1 -1
  472. package/daemon/dist/routes/queue.d.ts.map +1 -1
  473. package/daemon/dist/routes/queue.js +8 -5
  474. package/daemon/dist/routes/queue.js.map +1 -1
  475. package/daemon/dist/routes/rigspec.js +1 -1
  476. package/daemon/dist/routes/rigspec.js.map +1 -1
  477. package/daemon/dist/routes/scope-audit.d.ts.map +1 -1
  478. package/daemon/dist/routes/scope-audit.js +7 -1
  479. package/daemon/dist/routes/scope-audit.js.map +1 -1
  480. package/daemon/dist/routes/seat.d.ts.map +1 -1
  481. package/daemon/dist/routes/seat.js +30 -4
  482. package/daemon/dist/routes/seat.js.map +1 -1
  483. package/daemon/dist/routes/slices.d.ts.map +1 -1
  484. package/daemon/dist/routes/slices.js +21 -2
  485. package/daemon/dist/routes/slices.js.map +1 -1
  486. package/daemon/dist/routes/startup.js +2 -1
  487. package/daemon/dist/routes/startup.js.map +1 -1
  488. package/daemon/dist/routes/terminal.d.ts.map +1 -1
  489. package/daemon/dist/routes/terminal.js +47 -6
  490. package/daemon/dist/routes/terminal.js.map +1 -1
  491. package/daemon/dist/routes/transcripts.d.ts.map +1 -1
  492. package/daemon/dist/routes/transcripts.js +16 -1
  493. package/daemon/dist/routes/transcripts.js.map +1 -1
  494. package/daemon/dist/routes/watchdog.d.ts.map +1 -1
  495. package/daemon/dist/routes/watchdog.js +3 -2
  496. package/daemon/dist/routes/watchdog.js.map +1 -1
  497. package/daemon/dist/routes/workflow.d.ts.map +1 -1
  498. package/daemon/dist/routes/workflow.js +5 -0
  499. package/daemon/dist/routes/workflow.js.map +1 -1
  500. package/daemon/dist/server.d.ts +2 -0
  501. package/daemon/dist/server.d.ts.map +1 -1
  502. package/daemon/dist/server.js +11 -0
  503. package/daemon/dist/server.js.map +1 -1
  504. package/daemon/dist/startup.d.ts.map +1 -1
  505. package/daemon/dist/startup.js +90 -33
  506. package/daemon/dist/startup.js.map +1 -1
  507. package/daemon/dist/terminal-viewer-guard-surface.d.ts +2 -0
  508. package/daemon/dist/terminal-viewer-guard-surface.d.ts.map +1 -0
  509. package/daemon/dist/terminal-viewer-guard-surface.js +2 -0
  510. package/daemon/dist/terminal-viewer-guard-surface.js.map +1 -0
  511. package/daemon/docs/reference/agent-startup-guide.md +4 -1
  512. package/daemon/docs/reference/claude-status-line.md +3 -2
  513. package/daemon/docs/reference/community-harness-examples/cursor/openrig-cursor-launch +6 -0
  514. package/daemon/docs/reference/community-harness-examples/dsh/README.md +1 -1
  515. package/daemon/docs/reference/community-harness-examples/dsh/openrig-dsh-runner.mjs +186 -30
  516. package/daemon/docs/reference/community-harness-examples/hermes/openrig-hermes-launch +6 -0
  517. package/daemon/docs/reference/community-harness-examples/openclaw/openrig-openclaw-launch +6 -0
  518. package/daemon/docs/reference/community-harness-examples/openshell/README.md +2 -0
  519. package/daemon/docs/reference/community-harness-examples/pi-tui/openrig-pi-tui-launch +6 -0
  520. package/daemon/docs/reference/community-harness-presets.md +6 -5
  521. package/daemon/docs/reference/core-app.md +212 -0
  522. package/daemon/docs/reference/daemon-http-clients.md +6 -0
  523. package/daemon/docs/reference/getting-started.md +9 -4
  524. package/daemon/docs/reference/harness-runner-contract.md +50 -4
  525. package/daemon/docs/reference/hosted-members.md +21 -1
  526. package/daemon/docs/reference/quickstart.md +4 -3
  527. package/daemon/docs/reference/rig-spec.md +56 -26
  528. package/daemon/docs/reference/rosters.md +8 -0
  529. package/daemon/docs/reference/sdlc-conventions.md +42 -5
  530. package/daemon/docs/reference/seat-delivery.md +87 -6
  531. package/daemon/docs/reference/terminal-sessions.md +99 -1
  532. package/daemon/docs/reference/whats-new.md +82 -11
  533. package/daemon/specs/rigs/launch/factory/guidance/lead-first-move.md +4 -3
  534. package/daemon/specs/rigs/launch/kernel/agents/operator/agent/guidance/role.md +13 -3
  535. package/daemon/specs/rigs/launch/starter/guidance/lead-first-move.md +4 -3
  536. package/dist/ask-wake.d.ts.map +1 -1
  537. package/dist/ask-wake.js +8 -1
  538. package/dist/ask-wake.js.map +1 -1
  539. package/dist/build-info.js +3 -3
  540. package/dist/commands/archive.js +1 -1
  541. package/dist/commands/archive.js.map +1 -1
  542. package/dist/commands/daemon.d.ts.map +1 -1
  543. package/dist/commands/daemon.js +7 -0
  544. package/dist/commands/daemon.js.map +1 -1
  545. package/dist/commands/down.d.ts.map +1 -1
  546. package/dist/commands/down.js +5 -0
  547. package/dist/commands/down.js.map +1 -1
  548. package/dist/commands/ps.d.ts +2 -1
  549. package/dist/commands/ps.d.ts.map +1 -1
  550. package/dist/commands/ps.js +9 -4
  551. package/dist/commands/ps.js.map +1 -1
  552. package/dist/commands/queue.js +4 -4
  553. package/dist/commands/queue.js.map +1 -1
  554. package/dist/commands/roster.d.ts +5 -0
  555. package/dist/commands/roster.d.ts.map +1 -1
  556. package/dist/commands/scope.d.ts.map +1 -1
  557. package/dist/commands/scope.js +346 -9
  558. package/dist/commands/scope.js.map +1 -1
  559. package/dist/commands/seat.d.ts.map +1 -1
  560. package/dist/commands/seat.js +90 -8
  561. package/dist/commands/seat.js.map +1 -1
  562. package/dist/commands/send.d.ts +2 -0
  563. package/dist/commands/send.d.ts.map +1 -1
  564. package/dist/commands/send.js +3 -1
  565. package/dist/commands/send.js.map +1 -1
  566. package/dist/commands/terminal.d.ts +56 -0
  567. package/dist/commands/terminal.d.ts.map +1 -1
  568. package/dist/commands/terminal.js +194 -4
  569. package/dist/commands/terminal.js.map +1 -1
  570. package/dist/commands/transcript.js +1 -1
  571. package/dist/commands/transcript.js.map +1 -1
  572. package/dist/commands/unarchive.js +1 -1
  573. package/dist/commands/unarchive.js.map +1 -1
  574. package/dist/commands/workflow-follow.d.ts +3 -1
  575. package/dist/commands/workflow-follow.d.ts.map +1 -1
  576. package/dist/commands/workflow-follow.js +25 -6
  577. package/dist/commands/workflow-follow.js.map +1 -1
  578. package/dist/commands/workflow-render.d.ts.map +1 -1
  579. package/dist/commands/workflow-render.js +5 -1
  580. package/dist/commands/workflow-render.js.map +1 -1
  581. package/dist/commands/workflow.d.ts.map +1 -1
  582. package/dist/commands/workflow.js +14 -4
  583. package/dist/commands/workflow.js.map +1 -1
  584. package/dist/daemon-lifecycle.d.ts.map +1 -1
  585. package/dist/daemon-lifecycle.js +11 -0
  586. package/dist/daemon-lifecycle.js.map +1 -1
  587. package/dist/lib/scope/mission-composition.d.ts +1 -0
  588. package/dist/lib/scope/mission-composition.d.ts.map +1 -1
  589. package/dist/lib/scope/mission-composition.js +14 -0
  590. package/dist/lib/scope/mission-composition.js.map +1 -1
  591. package/dist/lib/scope/scope-audit.d.ts.map +1 -1
  592. package/dist/lib/scope/scope-audit.js +8 -0
  593. package/dist/lib/scope/scope-audit.js.map +1 -1
  594. package/dist/lib/scope/scope-fs.d.ts +10 -0
  595. package/dist/lib/scope/scope-fs.d.ts.map +1 -1
  596. package/dist/lib/scope/scope-fs.js +60 -0
  597. package/dist/lib/scope/scope-fs.js.map +1 -1
  598. package/dist/lib/scope/types.d.ts +3 -1
  599. package/dist/lib/scope/types.d.ts.map +1 -1
  600. package/dist/lib/scope/types.js +5 -1
  601. package/dist/lib/scope/types.js.map +1 -1
  602. package/dist/mcp-server.d.ts.map +1 -1
  603. package/dist/mcp-server.js +18 -8
  604. package/dist/mcp-server.js.map +1 -1
  605. package/dist/restore-packet/packet-writer.d.ts.map +1 -1
  606. package/dist/restore-packet/packet-writer.js +8 -5
  607. package/dist/restore-packet/packet-writer.js.map +1 -1
  608. package/dist/terminal-window.d.ts +2 -1
  609. package/dist/terminal-window.d.ts.map +1 -1
  610. package/dist/terminal-window.js +567 -41
  611. package/dist/terminal-window.js.map +1 -1
  612. package/package.json +1 -1
  613. package/tui/dist/daemon-client.d.ts +4 -0
  614. package/tui/dist/daemon-client.d.ts.map +1 -1
  615. package/tui/dist/daemon-client.js.map +1 -1
  616. package/tui/dist/execution/execution-model.d.ts.map +1 -1
  617. package/tui/dist/execution/execution-model.js +22 -5
  618. package/tui/dist/execution/execution-model.js.map +1 -1
  619. package/tui/dist/hydrate.d.ts.map +1 -1
  620. package/tui/dist/hydrate.js +6 -3
  621. package/tui/dist/hydrate.js.map +1 -1
  622. package/tui/dist/navigator.d.ts +1 -1
  623. package/tui/dist/navigator.d.ts.map +1 -1
  624. package/tui/dist/navigator.js +4 -2
  625. package/tui/dist/navigator.js.map +1 -1
  626. package/tui/dist/pulse/render-pulse.d.ts.map +1 -1
  627. package/tui/dist/pulse/render-pulse.js +7 -14
  628. package/tui/dist/pulse/render-pulse.js.map +1 -1
  629. package/tui/dist/render.d.ts.map +1 -1
  630. package/tui/dist/render.js +29 -21
  631. package/tui/dist/render.js.map +1 -1
  632. package/tui/dist/stylize.d.ts.map +1 -1
  633. package/tui/dist/stylize.js +3 -3
  634. package/tui/dist/stylize.js.map +1 -1
  635. package/tui/dist/terminals/terminal-model.d.ts +1 -0
  636. package/tui/dist/terminals/terminal-model.d.ts.map +1 -1
  637. package/tui/dist/terminals/terminal-model.js +4 -2
  638. package/tui/dist/terminals/terminal-model.js.map +1 -1
  639. package/tui/dist/types.d.ts +1 -0
  640. package/tui/dist/types.d.ts.map +1 -1
  641. package/tui/dist/visual-layout.d.ts +3 -0
  642. package/tui/dist/visual-layout.d.ts.map +1 -1
  643. package/tui/dist/visual-layout.js +17 -0
  644. package/tui/dist/visual-layout.js.map +1 -1
  645. package/ui/dist/assets/{index-1O1f3A7K.js → index-B-sMy02c.js} +107 -107
  646. package/ui/dist/assets/{index-BX8TUZ0E.css → index-DiN7RwWg.css} +1 -1
  647. package/ui/dist/index.html +2 -2
@@ -215,6 +215,8 @@ function execStderrText(error) {
215
215
  const NO_EXPAND_ENVIRONMENT = /(?:unrecognized|unknown) option[^\n]*--expand-environment/i;
216
216
  /** The user manager's refusal of OOMPolicy= for a scope (before 253), read from systemd-run's stderr only. */
217
217
  const NO_OOM_POLICY = /Cannot set property OOMPolicy|Unknown (?:property|assignment)[^\n]*OOMPolicy/i;
218
+ /** systemd-run's or the user manager's refusal of MemoryMax= for a scope, read from systemd-run's stderr only. */
219
+ const NO_MEMORY_MAX = /Unknown (?:property|assignment)[^\n]*MemoryMax|Failed to parse MemoryMax/i;
218
220
  /** A systemd too old for a seat scope: systemctl without --value (before 230) or systemd-run without --collect (before
219
221
  * 236), read from their stderr only. */
220
222
  const SYSTEMD_TOO_OLD = /(?:unrecognized|unknown) option[^\n]*--(?:value|collect)\b/i;
@@ -364,14 +366,16 @@ export function restoreEnvArgv(values) {
364
366
  }
365
367
  /** The systemd-run options of a seat scope, up to (not including) the `--` before the command. `systemdRun` is the
366
368
  * absolute path the check resolved, so the check and the launch run the same binary whatever PATH the seat has. */
367
- function seatScopeArgv(opts, unit, description, tasksMax, systemdRun) {
369
+ function seatScopeArgv(opts, unit, description, limits, systemdRun) {
368
370
  return [systemdRun, "--user", "--scope", "--quiet", "--collect", "--slice", SEAT_SCOPE_SLICE, "--unit", unit,
369
371
  "--description", description,
370
372
  // As for the server's scope: the command's arguments must reach /bin/sh exactly as written (254+).
371
373
  ...(opts.literal ? ["--expand-environment=no"] : []),
372
374
  // As for the server's scope: one OOM kill must not stop every process of the seat (253+).
373
375
  ...(opts.oomPolicy ? ["-p", "OOMPolicy=continue"] : []),
374
- "-p", `TasksMax=${tasksMax}`];
376
+ ...(limits.tasksMax !== undefined ? ["-p", `TasksMax=${limits.tasksMax}`] : []),
377
+ // Bytes, as memory.max reads back: the probe and the status compare the two as written.
378
+ ...(limits.memoryMax !== undefined ? ["-p", `MemoryMax=${limits.memoryMax}`] : [])];
375
379
  }
376
380
  /** The command that runs first inside a seat scope: it empties the launch's marker file (a builtin and a redirection, no
377
381
  * fork, so it works under TasksMax=1), then execs the seat's command. A pane that died with the marker still pending
@@ -407,6 +411,12 @@ function createdIdentity(printed) {
407
411
  const m = /^(%\d+) (\$\d+) (\d+) (\d+)$/.exec(printed);
408
412
  return m ? { pane: m[1], session: m[2], server: { pid: m[3], start: m[4] } } : null;
409
413
  }
414
+ /** A command that ended by SIGKILL: the signal itself (the shell replaced by the command) or 137 (128 + 9, from a shell
415
+ * that ran it, or from timeout, which exits that way when the command it ran was killed). */
416
+ function killedBySigkill(error) {
417
+ const e = error;
418
+ return e.signal === "SIGKILL" || e.code === 137;
419
+ }
410
420
  /** A check's failure, classified (#3253): `unsupported` only on a positive answer that the facility is not there. */
411
421
  function classifyScopeFailure(error, what) {
412
422
  const reason = execFailureReason(error);
@@ -417,6 +427,9 @@ function classifyScopeFailure(error, what) {
417
427
  if (SYSTEMD_TOO_OLD.test(execStderrText(error))) {
418
428
  return { kind: "unsupported", reason: `${what}: systemd is too old for seat scopes (it needs 236+ for --collect, 230+ for --value): ${reason}` };
419
429
  }
430
+ if (NO_MEMORY_MAX.test(execStderrText(error))) {
431
+ return { kind: "unsupported", limit: "memory_max", reason: `${what}: systemd refused MemoryMax= for the seat's scope: ${reason}` };
432
+ }
420
433
  // Only a message that names the tool: an exit status of 127 alone does not say which program was missing.
421
434
  if (/(?:systemd-run|systemctl)\S{0,2}: (?:(?:command )?not found|No such file or directory)|No such file or directory[^\n]*(?:systemd-run|systemctl)/i.test(reason)) {
422
435
  return { kind: "unsupported", reason: `${what}: systemd-run or systemctl is not installed (${reason})` };
@@ -431,6 +444,54 @@ function classifyScopeFailure(error, what) {
431
444
  }
432
445
  return { kind: "unverified", reason: `${what} failed: ${reason}` };
433
446
  }
447
+ /** What a throwaway scope with memory_max printed (proveSeatScope), checked limit by limit against the request: null
448
+ * when each requested limit reads back as its value, else the first that doesn't, named. */
449
+ /** A host with no cgroup v2 for the user manager's scopes: no limit can be made, whatever is asked. */
450
+ const NO_CGROUP2 = "the user manager's scopes have no cgroup v2 path (a cgroup v1 host)";
451
+ /** The limits a positive inability is about: the one a probe's answer names; from the tasks-only probe, whose answers
452
+ * name none, the task limit when it is about the pids controller; any other (no cgroup v2, no systemd tools or user
453
+ * manager, a systemd too old) is about the host, so about every limit. */
454
+ function inabilityLimits(problem, probed) {
455
+ if (problem.limit)
456
+ return [problem.limit];
457
+ if (probed.memoryMax === undefined && problem.reason !== NO_CGROUP2 && /\bpids\b/.test(problem.reason)) {
458
+ return ["tasks_max"];
459
+ }
460
+ return ["tasks_max", "memory_max"];
461
+ }
462
+ function scopeProbeProblem(got, limits) {
463
+ if (got === "nocgroup2")
464
+ return { kind: "unsupported", reason: NO_CGROUP2 };
465
+ const read = new Map();
466
+ for (const line of got.split("\n")) {
467
+ const m = /^(memory|pids) (.*)$/.exec(line.trim());
468
+ if (m)
469
+ read.set(m[1], m[2]);
470
+ }
471
+ const asked = [
472
+ ["memory_max", "memory", "MemoryMax", limits.memoryMax], ["tasks_max", "pids", "TasksMax", limits.tasksMax]
473
+ ];
474
+ for (const [limit, controller, property, value] of asked) {
475
+ if (value === undefined)
476
+ continue;
477
+ const file = `${controller}.max`;
478
+ const seen = read.get(controller);
479
+ if (seen === undefined)
480
+ return { kind: "unverified", limit, reason: `a throwaway seat scope read no ${file}` };
481
+ if (seen === `no${controller}`) {
482
+ return { kind: "unsupported", limit, reason: `a throwaway seat scope has no ${file}: the ${controller} controller is not delegated to the user manager` };
483
+ }
484
+ // Only a readable limit that isn't the one asked for is a positive answer; anything else can't be read.
485
+ if (!/^(\d+|max)$/.test(seen)) {
486
+ return { kind: "unverified", limit, reason: `a throwaway seat scope's ${file} read could not be understood ("${seen.slice(0, 80)}")` };
487
+ }
488
+ if (seen !== String(value)) {
489
+ return { kind: "unsupported", limit,
490
+ reason: `a throwaway seat scope got ${file} "${seen}" for ${property}=${value}: the ${controller} limit is not enforced here (is the ${controller} controller delegated to the user manager?)` };
491
+ }
492
+ }
493
+ return null;
494
+ }
434
495
  /** The cgroup v2 path of a process, from the `0::` line of /proc/<pid>/cgroup; null on cgroup v1 or no such line. */
435
496
  export function cgroupV2Path(procCgroup) {
436
497
  const line = procCgroup.split(/\r?\n/).find((l) => l.startsWith("0::"));
@@ -475,11 +536,12 @@ export class TmuxAdapter {
475
536
  return false;
476
537
  }
477
538
  };
478
- /** systemd-run's options proven by a throwaway scope, per systemd-run binary and task limit (memoized on success only). */
539
+ /** systemd-run's options proven by a throwaway scope, per systemd-run binary and pair of limits (memoized on success
540
+ * only). */
479
541
  seatScopeProven = new Map();
480
542
  /** The last check that failed without a positive answer (a timeout, an empty probe, an error not recognized), and when,
481
- * per step ("bus", or the probe of one tasks_max value): a launch within SEAT_SCOPE_RETRY_MS reads it as
482
- * `unverified`, with its age, never as a fresh result; the first launch after that asks again. A positive answer is
543
+ * per step ("bus", or the probe of one tasks_max and memory_max pair): a launch within SEAT_SCOPE_RETRY_MS reads it
544
+ * as `unverified`, with its age, never as a fresh result; the first launch after that asks again. A positive answer is
483
545
  * not cached: every launch asks again, so a setup fixed since is seen at once. */
484
546
  seatScopeFailedAt = new Map();
485
547
  /** The last positive inability, for the status only (as `unsupported`, with its age, for SEAT_SCOPE_RETRY_MS). */
@@ -488,7 +550,8 @@ export class TmuxAdapter {
488
550
  seatLimitsLookup(nodeId) {
489
551
  try {
490
552
  const limits = this.seatProcessLimits?.(nodeId);
491
- return limits ? { limits } : undefined;
553
+ // A value with neither limit is no request (the stored value's parse refuses it anyway).
554
+ return limits && (limits.tasksMax !== undefined || limits.memoryMax !== undefined) ? { limits } : undefined;
492
555
  }
493
556
  catch (error) {
494
557
  return { invalid: error.message };
@@ -521,7 +584,7 @@ export class TmuxAdapter {
521
584
  const report = await this.readSeatProcessLimits(paneTarget, lookup.limits, nodeId);
522
585
  if (report.state === "applied")
523
586
  return null;
524
- const requested = { tasksMax: lookup.limits.tasksMax };
587
+ const requested = { ...lookup.limits };
525
588
  // The restart keeps this process: a readback that failed can't say whether it is under the limit.
526
589
  if (report.state === "unknown") {
527
590
  return unknownNotice({ kind: "unverified", requested,
@@ -556,7 +619,7 @@ export class TmuxAdapter {
556
619
  return null;
557
620
  if ("invalid" in lookup)
558
621
  return { keep: false, notice: notAppliedNotice({ kind: "invalid", reason: lookup.invalid }) };
559
- const requested = { tasksMax: lookup.limits.tasksMax };
622
+ const requested = { ...lookup.limits };
560
623
  const report = await this.readSeatProcessLimits(paneTarget, lookup.limits, nodeId);
561
624
  if (report.state === "applied") {
562
625
  const outcome = await this.seatScope(lookup.limits, { OPENRIG_NODE_ID: nodeId }, this.readLaunchPolicy());
@@ -626,16 +689,16 @@ export class TmuxAdapter {
626
689
  }
627
690
  return { systemdRun, systemctl, timeout };
628
691
  }
629
- /** The prefix that starts a seat's pane command in a systemd user scope of its own with TasksMax: the tmux server
630
- * stays where it is, and only this seat's processes are under the limit (#3253). systemd-run registers itself in the
631
- * new scope and then execs the command, so the pane's process is the seat's. Or why it can't, classified: never a
632
- * silent start without the limit. */
692
+ /** The prefix that starts a seat's pane command in a systemd user scope of its own with TasksMax and/or MemoryMax:
693
+ * the tmux server stays where it is, and only this seat's processes are under the limits (#3253). systemd-run
694
+ * registers itself in the new scope and then execs the command, so the pane's process is the seat's. Or why it
695
+ * can't, classified: never a silent start without the limit. */
633
696
  async seatScope(limits, seatEnv, policy) {
634
- const requested = { tasksMax: limits.tasksMax };
697
+ const requested = { ...limits };
635
698
  const fail = (problem) => ({ ok: false, problem: { ...problem, requested } });
636
699
  const positive = (problem) => {
637
700
  if (problem.kind === "unsupported")
638
- this.seatScopeLastPositive = { at: Date.now(), problem };
701
+ this.seatScopeLastPositive = { at: Date.now(), problem, probed: limits };
639
702
  return fail(problem);
640
703
  };
641
704
  const fixed = this.seatScopeStaticProblem(policy, seatEnv.OPENRIG_NODE_ID, seatEnv.OPENRIG_SESSION_NAME);
@@ -645,8 +708,9 @@ export class TmuxAdapter {
645
708
  if ("problem" in tools)
646
709
  return positive(tools.problem);
647
710
  const runtimeDir = this.scopeRuntimeDir();
648
- // A systemd-run that changed since (another PATH, an upgrade) is proven again.
649
- const provenKey = `${tools.systemdRun}\0${limits.tasksMax}`;
711
+ // A systemd-run that changed since (another PATH, an upgrade) is proven again, and so is each pair of limits: a
712
+ // memory limit is never taken as proven by a scope that had only the task limit.
713
+ const provenKey = `${tools.systemdRun}\0${limits.tasksMax ?? "-"}\0${limits.memoryMax ?? "-"}`;
650
714
  const probeKey = `probe:${provenKey}`;
651
715
  for (const key of ["bus", probeKey]) {
652
716
  const failed = this.seatScopeFailedAt.get(key);
@@ -672,7 +736,7 @@ export class TmuxAdapter {
672
736
  this.seatScopeFailedAt.delete("bus");
673
737
  let opts = this.seatScopeProven.get(provenKey);
674
738
  if (!opts) {
675
- const proven = await this.proveSeatScope(runtimeDir, limits.tasksMax, tools);
739
+ const proven = await this.proveSeatScope(runtimeDir, limits, tools);
676
740
  if (!proven.ok)
677
741
  return remember(probeKey, proven.problem);
678
742
  opts = proven.opts;
@@ -684,24 +748,36 @@ export class TmuxAdapter {
684
748
  // Unit names take ASCII letters, digits and ":-_.\\"; an "@" would read as a template instance.
685
749
  const unit = `openrig-seat-${name.replace(/[^A-Za-z0-9_.-]/g, "_").slice(0, 120)}-${randomUUID().slice(0, 8)}`;
686
750
  return { ok: true, prefix: [...seatScopeBusEnv(runtimeDir),
687
- ...seatScopeArgv(opts, unit, `OpenRig seat ${name}`, limits.tasksMax, tools.systemdRun), "--"] };
688
- }
689
- /** One throwaway scope with the seat's own options, whose command prints the pids.max of its own cgroup: the limit
690
- * counts as supported only when that is the requested value. Options this systemd lacks are dropped from its stderr,
691
- * as for the server's scope. A pids.max that is another value (e.g. "max": TasksMax accepted but the pids controller
692
- * not delegated) is a positive inability; an empty result or an error not recognized is unverified. */
693
- async proveSeatScope(runtimeDir, tasksMax, tools) {
751
+ ...seatScopeArgv(opts, unit, `OpenRig seat ${name}`, limits, tools.systemdRun), "--"] };
752
+ }
753
+ /** One throwaway scope with the seat's own options, whose command prints the pids.max of its own cgroup (and, with
754
+ * memory_max, its memory.max: one line per limit): the limits count as supported only when each one requested is the
755
+ * requested value. Options this systemd lacks are dropped from its stderr, as for the server's scope. A pids.max or
756
+ * memory.max that is another value (e.g. "max": TasksMax or MemoryMax= accepted but the controller not delegated) is a
757
+ * positive inability; an empty result or an error not recognized is unverified. */
758
+ async proveSeatScope(runtimeDir, limits, tools) {
694
759
  const opts = { literal: true, oomPolicy: true };
760
+ const tasksMax = limits.tasksMax;
695
761
  // Shell builtins only: no fork inside the scope, so even TasksMax=1 can be proven (the probe is the scope's one task).
696
762
  const readOwnPidsMax = 'p=; while IFS= read -r l; do case $l in 0::*) p=${l#0::};; esac; done < /proc/self/cgroup; ' +
697
763
  'if [ -z "$p" ]; then printf "nocgroup2\\n"; elif [ ! -e "/sys/fs/cgroup$p/pids.max" ]; then printf "nopids\\n"; ' +
698
764
  'else IFS= read -r m < "/sys/fs/cgroup$p/pids.max" && printf "%s\\n" "$m"; fi';
765
+ // With memory_max, the same builtins print one line per requested limit: `memory <memory.max|nomemory>`, then
766
+ // `pids <pids.max|nopids>` when tasks_max is requested too (a seat without tasks_max has its user manager's own
767
+ // pids.max, which is not judged).
768
+ const readOwnLimits = 'p=; while IFS= read -r l; do case $l in 0::*) p=${l#0::};; esac; done < /proc/self/cgroup; ' +
769
+ 'if [ -z "$p" ]; then printf "nocgroup2\\n"; else ' +
770
+ 'if [ ! -e "/sys/fs/cgroup$p/memory.max" ]; then printf "memory nomemory\\n"; ' +
771
+ 'else IFS= read -r m < "/sys/fs/cgroup$p/memory.max" && printf "memory %s\\n" "$m"; fi; ' +
772
+ (tasksMax !== undefined ? 'if [ ! -e "/sys/fs/cgroup$p/pids.max" ]; then printf "pids nopids\\n"; ' +
773
+ 'else IFS= read -r t < "/sys/fs/cgroup$p/pids.max" && printf "pids %s\\n" "$t"; fi; ' : '') +
774
+ 'fi';
699
775
  for (;;) {
700
776
  let out;
701
777
  try {
702
778
  out = await this.exec(posixJoinArgv([...seatScopeBusEnv(runtimeDir), tools.timeout, "10",
703
- ...seatScopeArgv(opts, `openrig-seat-probe-${randomUUID().slice(0, 8)}`, "OpenRig seat scope probe", tasksMax, tools.systemdRun),
704
- "--", "/bin/sh", "-c", readOwnPidsMax]));
779
+ ...seatScopeArgv(opts, `openrig-seat-probe-${randomUUID().slice(0, 8)}`, "OpenRig seat scope probe", limits, tools.systemdRun),
780
+ "--", "/bin/sh", "-c", limits.memoryMax === undefined ? readOwnPidsMax : readOwnLimits]));
705
781
  }
706
782
  catch (error) {
707
783
  const stderr = execStderrText(error);
@@ -713,13 +789,26 @@ export class TmuxAdapter {
713
789
  opts.oomPolicy = false;
714
790
  continue;
715
791
  }
792
+ // The probe command ended with SIGKILL (the signal, or exit 137 from timeout or a shell) under a memory limit.
793
+ // That does not say which process died nor why (the OOM killer at that MemoryMax=, the host's OOM killer,
794
+ // systemd-oomd, a manual kill, or before the scope was entered), and the scope that could tell (its memory.events
795
+ // `oom`) is collected with it. So it says only what was seen, names the limit and stays retryable (unverified).
796
+ if (limits.memoryMax !== undefined && killedBySigkill(error)) {
797
+ return { ok: false, problem: { kind: "unverified", limit: "memory_max",
798
+ reason: `the probe command ended with SIGKILL (exit 137) under the requested MemoryMax=${limits.memoryMax}; ` +
799
+ "the process and the cause aren't confirmed; a larger memory_max may help" } };
800
+ }
716
801
  return { ok: false, problem: classifyScopeFailure(error, "a throwaway seat scope") };
717
802
  }
718
803
  const got = out.trim();
804
+ if (limits.memoryMax !== undefined) {
805
+ const problem = scopeProbeProblem(got, limits);
806
+ return problem ? { ok: false, problem } : { ok: true, opts };
807
+ }
719
808
  if (!got)
720
809
  return { ok: false, problem: { kind: "unverified", reason: "a throwaway seat scope read no pids.max" } };
721
810
  if (got === "nocgroup2")
722
- return { ok: false, problem: { kind: "unsupported", reason: "the user manager's scopes have no cgroup v2 path (a cgroup v1 host)" } };
811
+ return { ok: false, problem: { kind: "unsupported", reason: NO_CGROUP2 } };
723
812
  if (got === "nopids") {
724
813
  return { ok: false, problem: { kind: "unsupported", reason: "a throwaway seat scope has no pids.max: the pids controller is not delegated to the user manager" } };
725
814
  }
@@ -799,8 +888,10 @@ export class TmuxAdapter {
799
888
  }
800
889
  }
801
890
  /** The seat scope a pane's process runs in, read from the kernel: unknown when it can't be read, outside a seat scope,
802
- * or in one, with its pids.max, pids.current and how many times a fork hit the limit (pids.events `max`). */
803
- async readPaneScope(paneTarget) {
891
+ * or in one, with the files of the limits requested only: for tasks_max, its pids.max, pids.current and how many
892
+ * times a fork hit the limit (pids.events `max`); for memory_max, its memory.max, memory.current, how many times its
893
+ * usage was about to go over the limit (memory.events `max`) and how many of its processes an OOM killer killed (memory.events `oom_kill`). */
894
+ async readPaneScope(paneTarget, requested) {
804
895
  const pid = await this.getPanePid(paneTarget);
805
896
  if (pid === null)
806
897
  return { at: "unknown", reason: "the seat's pane process is not readable (not running?)" };
@@ -818,21 +909,35 @@ export class TmuxAdapter {
818
909
  return { at: "outside", scope };
819
910
  try {
820
911
  const dir = `/sys/fs/cgroup${path}`;
821
- const pidsMax = (await this.procRead(`${dir}/pids.max`)).trim();
822
- const pidsCurrent = Number((await this.procRead(`${dir}/pids.current`)).trim());
823
- const hits = /^max (\d+)$/m.exec(await this.procRead(`${dir}/pids.events`));
824
- return { at: "seat", scope, pidsMax, pidsCurrent, limitHits: hits ? Number(hits[1]) : 0 };
912
+ let pids = {};
913
+ if (requested.tasksMax !== undefined) {
914
+ const pidsMax = (await this.procRead(`${dir}/pids.max`)).trim();
915
+ const pidsCurrent = Number((await this.procRead(`${dir}/pids.current`)).trim());
916
+ const hits = /^max (\d+)$/m.exec(await this.procRead(`${dir}/pids.events`));
917
+ pids = { pidsMax, pidsCurrent, limitHits: hits ? Number(hits[1]) : 0 };
918
+ }
919
+ let memory = {};
920
+ if (requested.memoryMax !== undefined) {
921
+ const memoryMax = (await this.procRead(`${dir}/memory.max`)).trim();
922
+ const memoryCurrent = Number((await this.procRead(`${dir}/memory.current`)).trim());
923
+ const events = await this.procRead(`${dir}/memory.events`);
924
+ const hits = /^max (\d+)$/m.exec(events);
925
+ const kills = /^oom_kill (\d+)$/m.exec(events);
926
+ memory = { memoryMax, memoryCurrent, memoryLimitHits: hits ? Number(hits[1]) : 0, oomKills: kills ? Number(kills[1]) : 0 };
927
+ }
928
+ return { at: "seat", scope, ...pids, ...memory };
825
929
  }
826
930
  catch (error) {
827
931
  return { at: "unknown", scope, reason: `scope files unreadable: ${error.message}` };
828
932
  }
829
933
  }
830
- /** Where a seat's task limit stands, read back from its pane's process (#3253): its cgroup must be a seat scope whose
831
- * pids.max is the requested value. pids.events `max` counts the forks the limit refused. `paneTarget` is the seat's
832
- * pane id (`%N`) when known, else its session (whose active pane is read). With `nodeId`, a seat in an environment
833
- * guest reads `not_applied` (its pane holds only a local viewer). Read only. */
934
+ /** Where a seat's limits stand, read back from its pane's process (#3253): its cgroup must be a seat scope whose
935
+ * pids.max and memory.max are the requested values (each one requested). pids.events `max` counts the forks the
936
+ * limit refused; memory.events `max` the times usage was about to go over the memory limit, and `oom_kill` the processes in the scope any OOM killer killed.
937
+ * `paneTarget` is the seat's pane id (`%N`) when known, else its session (whose active pane is read). With `nodeId`, a
938
+ * seat in an environment guest reads `not_applied` (its pane holds only a local viewer). Read only. */
834
939
  async readSeatProcessLimits(paneTarget, requested, nodeId) {
835
- const base = { requested: { tasksMax: requested.tasksMax } };
940
+ const base = { requested: { ...requested } };
836
941
  const policy = this.readLaunchPolicy();
837
942
  // The running process is read first: a seat already under its limit reads `applied` whatever this daemon could
838
943
  // create now. A seat not under it reads `unsupported` only on a positive inability (from the environment, or the
@@ -841,23 +946,34 @@ export class TmuxAdapter {
841
946
  // A guest seat's pane holds only a local viewer: its readback says nothing of the agent's processes.
842
947
  if (nodeId && this.seatInEnvironmentGuest?.(nodeId))
843
948
  return { ...base, state: "not_applied", reason: fixed.reason };
844
- const last = this.seatScopeLastPositive && Date.now() - this.seatScopeLastPositive.at < SEAT_SCOPE_RETRY_MS
949
+ // The last positive answer counts only for a request that asks a limit it was about: a failed memory probe says
950
+ // nothing of a tasks-only seat (nor a pids answer of a memory-only one); no cgroup v2 is about every limit.
951
+ const recent = this.seatScopeLastPositive && Date.now() - this.seatScopeLastPositive.at < SEAT_SCOPE_RETRY_MS
845
952
  ? this.seatScopeLastPositive : undefined;
953
+ const last = recent && inabilityLimits(recent.problem, recent.probed)
954
+ .some((k) => (k === "tasks_max" ? requested.tasksMax : requested.memoryMax) !== undefined) ? recent : undefined;
846
955
  const unsupported = fixed?.kind === "unsupported" ? fixed.reason
847
956
  : last ? `${last.problem.reason}, observed ${Math.floor((Date.now() - last.at) / 1000)}s ago` : null;
848
957
  const notUnder = (reason) => unsupported ? { ...base, state: "unsupported", reason: `${reason}; and this host can't make the scope: ${unsupported}` }
849
958
  : fixed ? { ...base, state: "not_applied", reason: `${reason}; and this setup can't make the scope: ${fixed.reason}` }
850
959
  : { ...base, state: "not_applied", reason };
851
- const read = await this.readPaneScope(paneTarget);
960
+ const read = await this.readPaneScope(paneTarget, requested);
852
961
  if (read.at === "unknown")
853
962
  return { ...base, state: "unknown", ...(read.scope ? { scope: read.scope } : {}), reason: read.reason };
854
963
  if (read.at === "outside") {
855
964
  return notUnder(`the seat's process is not in a seat scope (${read.scope}); the limit applies at its next fresh launch`);
856
965
  }
857
966
  const { at: _at, ...scopeRead } = read;
858
- return read.pidsMax === String(requested.tasksMax)
967
+ // Applied only when every requested limit reads back as its value; the reason names each one that doesn't.
968
+ const off = [
969
+ ...(requested.tasksMax !== undefined && read.pidsMax !== String(requested.tasksMax)
970
+ ? [`pids.max is ${read.pidsMax}, not ${requested.tasksMax}`] : []),
971
+ ...(requested.memoryMax !== undefined && read.memoryMax !== String(requested.memoryMax)
972
+ ? [`memory.max is ${read.memoryMax}, not ${requested.memoryMax}`] : []),
973
+ ];
974
+ return off.length === 0
859
975
  ? { ...base, state: "applied", ...scopeRead }
860
- : { ...base, state: "not_applied", ...scopeRead, reason: `pids.max is ${read.pidsMax}, not ${requested.tasksMax}; the limit applies at its next fresh launch` };
976
+ : { ...base, state: "not_applied", ...scopeRead, reason: `${off.join("; ")}; the limit applies at its next fresh launch` };
861
977
  }
862
978
  /** Reset before the selected user shell runs, without changing the server or other sessions.
863
979
  * Multiple tmux command arguments execute directly; only this fixed non-interactive sh runs
@@ -888,7 +1004,7 @@ export class TmuxAdapter {
888
1004
  if ("invalid" in lookup)
889
1005
  notApplied({ kind: "invalid", reason: lookup.invalid });
890
1006
  else if (notices?.failedStart)
891
- notApplied({ ...notices.failedStart, requested: { tasksMax: lookup.limits.tasksMax } });
1007
+ notApplied({ ...notices.failedStart, requested: { ...lookup.limits } });
892
1008
  else {
893
1009
  const outcome = await this.seatScope(lookup.limits, seatEnv, policy);
894
1010
  if (outcome.ok) {
@@ -903,7 +1019,7 @@ export class TmuxAdapter {
903
1019
  return null;
904
1020
  if (!(policy instanceof Error) && policy.inheritTmuxEnvironment) {
905
1021
  if (limited)
906
- notApplied({ kind: "setup", reason: INHERIT_TMUX_ENVIRONMENT_REASON, requested: { tasksMax: lookup.limits.tasksMax } });
1022
+ notApplied({ kind: "setup", reason: INHERIT_TMUX_ENVIRONMENT_REASON, requested: { ...lookup.limits } });
907
1023
  return null;
908
1024
  }
909
1025
  try {
@@ -960,16 +1076,15 @@ export class TmuxAdapter {
960
1076
  notices.capped = seatScope.length > 0;
961
1077
  if (marker) {
962
1078
  notices.marker = marker;
963
- notices.tasksMax = lookup.limits.tasksMax;
1079
+ notices.requested = { ...lookup.limits };
964
1080
  }
965
1081
  }
966
1082
  return ["/bin/sh", "-c", reset, "sh", file, ...seatScope, ...restore, shell, ...(command ? ["-c", command] : ["-l"])];
967
1083
  }
968
1084
  catch (error) {
969
1085
  if (limited) {
970
- const tasksMax = lookup.limits.tasksMax;
971
1086
  notApplied({ kind: "unverified", reason: `the scoped launch environment failed: ${error.message}`,
972
- requested: { tasksMax } });
1087
+ requested: { ...lookup.limits } });
973
1088
  }
974
1089
  // Keep the working launch, with a diagnostic; this option is not a new admission gate.
975
1090
  const warning = "Scoped tmux environment unavailable; retaining the previous environment for this launch.";
@@ -994,7 +1109,7 @@ export class TmuxAdapter {
994
1109
  };
995
1110
  if ("invalid" in lookup)
996
1111
  return notApplied({ kind: "invalid", reason: lookup.invalid });
997
- const requested = { tasksMax: lookup.limits.tasksMax };
1112
+ const requested = { ...lookup.limits };
998
1113
  if (notices.failedStart)
999
1114
  return notApplied({ ...notices.failedStart, requested });
1000
1115
  const outcome = await this.seatScope(lookup.limits, { OPENRIG_NODE_ID: nodeId }, this.readLaunchPolicy());
@@ -1013,7 +1128,7 @@ export class TmuxAdapter {
1013
1128
  const marker = await this.scopeMarker();
1014
1129
  notices.capped = true;
1015
1130
  notices.marker = marker;
1016
- notices.tasksMax = requested.tasksMax;
1131
+ notices.requested = requested;
1017
1132
  return [...outcome.prefix, ...scopeMarkArgv(marker), ...restore, shell, "-c", command];
1018
1133
  }
1019
1134
  catch (error) {
@@ -1051,7 +1166,7 @@ export class TmuxAdapter {
1051
1166
  await this.fileOps.unlink(notices.marker).catch(() => { });
1052
1167
  if (start === "started")
1053
1168
  return null;
1054
- const requested = notices.tasksMax !== undefined ? { requested: { tasksMax: notices.tasksMax } } : {};
1169
+ const requested = notices.requested ? { requested: { ...notices.requested } } : {};
1055
1170
  const failedBefore = "the seat's scope did not start: its pane's command exited before entering it";
1056
1171
  if (mode !== "recovery") {
1057
1172
  if (start === "ran_and_ended")
@@ -1069,7 +1184,8 @@ export class TmuxAdapter {
1069
1184
  }
1070
1185
  if (start === "failed_before_command")
1071
1186
  return { retryUncapped: { kind: "unverified", reason: failedBefore } };
1072
- const notice = unknownNotice({ kind: "unverified", ...requested,
1187
+ // As in the fresh refusal: what was seen of the command, apart from the limit (nothing here is run again).
1188
+ const notice = unknownNotice({ kind: "unverified", ...requested, commandStarted: start === "unknown" ? "unknown" : true,
1073
1189
  reason: start === "ran_and_ended"
1074
1190
  ? "the seat's command started in its scope and ended before it was seen running; it was not run again"
1075
1191
  : start === "ran_unconfirmed"
@@ -1677,6 +1793,8 @@ export class TmuxAdapter {
1677
1793
  printed = (await this.runEnvironmentCommand(argv, legacyParts.join(" "), true)).trim();
1678
1794
  }
1679
1795
  catch (err) {
1796
+ if (notices.marker)
1797
+ await this.fileOps.unlink(notices.marker).catch(() => { });
1680
1798
  return classifyWriteError(err);
1681
1799
  }
1682
1800
  // A capped launch reads its pane and identity from the same, first, printed line (a hook may print more after it).
@@ -1695,11 +1813,15 @@ export class TmuxAdapter {
1695
1813
  if (notices.marker)
1696
1814
  await this.fileOps.unlink(notices.marker).catch(() => { });
1697
1815
  return processLimitsNotAppliedResult(new SeatProcessLimitsNotApplied({ kind: "unverified", commandStarted: "unknown",
1698
- ...(notices.tasksMax !== undefined ? { requested: { tasksMax: notices.tasksMax } } : {}),
1816
+ ...(notices.requested ? { requested: { ...notices.requested } } : {}),
1699
1817
  reason: `tmux printed no pane for the launch and its session couldn't be read back (${unconfirmed.message})` }), await this.removeRefusedSession(name, null));
1700
1818
  }
1701
- if (unconfirmed)
1819
+ if (unconfirmed) {
1820
+ // the scope start is never checked on this way out: its marker would be left pending in the temp dir
1821
+ if (notices.marker)
1822
+ await this.fileOps.unlink(notices.marker).catch(() => { });
1702
1823
  return { ok: false, ...unconfirmed };
1824
+ }
1703
1825
  }
1704
1826
  // #3253: a capped launch counts only once its scope is seen to start. A fresh one that isn't is refused and the
1705
1827
  // session it made is removed (never a retry without the limit). A recovery (a provider switch's staged successor)
@@ -2071,7 +2193,9 @@ export class TmuxAdapter {
2071
2193
  }
2072
2194
  /** With a delivery guard, terminate by immutable tmux session ID; checked callers validate before detach and kill.
2073
2195
  * A seat's session is stopped only when it carries that seat's OpenRig marker, and each effect runs only while that
2074
- * id still names a session on the server it was read from: a replaced server reuses ids for other terminals. */
2196
+ * id still names a session on the server it was read from: a replaced server reuses ids for other terminals.
2197
+ * A checked caller's validation may be asynchronous (a fresh process observation); it's awaited right before each
2198
+ * effect, after this method's own reads, and the guard's synchronous check runs after it. */
2075
2199
  async killSession(name, beforeEffect) {
2076
2200
  let stopPhase = "none";
2077
2201
  if (this.deliveryGuard) {
@@ -2088,7 +2212,7 @@ export class TmuxAdapter {
2088
2212
  return unproven;
2089
2213
  }
2090
2214
  const kill = async () => {
2091
- const result = await this.killSessionUnchecked(sessionId, beforeEffect && (() => { beforeWrite(); beforeEffect(); }), phase => { stopPhase = phase; }, { pid, start });
2215
+ const result = await this.killSessionUnchecked(sessionId, beforeEffect && (async () => { await beforeEffect(); beforeWrite(); }), phase => { stopPhase = phase; }, { pid, start });
2092
2216
  if (result.ok) {
2093
2217
  this.freshProbes.delete(name);
2094
2218
  this.freshProbes.delete(pane);
@@ -2144,7 +2268,7 @@ export class TmuxAdapter {
2144
2268
  `${verb} ${flag} '${session}'`, `display-message -p ${changed}`]
2145
2269
  : ["tmux", verb, flag, session];
2146
2270
  // Detach first so `detach-on-destroy off` cannot switch views onto another session.
2147
- beforeEffect?.();
2271
+ await beforeEffect?.();
2148
2272
  phase?.("detach_attempted");
2149
2273
  try {
2150
2274
  const out = await this.run(effect("detach-client", "-s"), server ? undefined : `tmux detach-client -s ${shellQuote(session)}`);
@@ -2158,7 +2282,7 @@ export class TmuxAdapter {
2158
2282
  return classifyWriteError(err);
2159
2283
  }
2160
2284
  phase?.("detached");
2161
- beforeEffect?.();
2285
+ await beforeEffect?.();
2162
2286
  phase?.("kill_attempted");
2163
2287
  try {
2164
2288
  const out = await this.run(effect("kill-session", "-t"), server ? undefined : `tmux kill-session -t ${shellQuote(session)}`);
@@ -2269,6 +2393,8 @@ export class TmuxAdapter {
2269
2393
  return this.launched(warnings, notices);
2270
2394
  }
2271
2395
  catch (err) {
2396
+ if (notices.marker)
2397
+ await this.fileOps.unlink(notices.marker).catch(() => { });
2272
2398
  return classifyWriteError(err);
2273
2399
  }
2274
2400
  }