@with-logic/elwood 0.2.0 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (878) hide show
  1. package/CHANGELOG.md +571 -1
  2. package/CONTRIBUTING.md +3 -0
  3. package/README.md +6 -2
  4. package/dist/bridge/socket-release.d.ts +15 -0
  5. package/dist/bridge/socket-release.d.ts.map +1 -0
  6. package/dist/bridge/socket-release.js +22 -0
  7. package/dist/bridge/socket-release.js.map +1 -0
  8. package/dist/claude/composer/border.d.ts +12 -0
  9. package/dist/claude/composer/border.d.ts.map +1 -0
  10. package/dist/claude/composer/border.js +12 -0
  11. package/dist/claude/composer/border.js.map +1 -0
  12. package/dist/claude/composer/empty-input.d.ts +15 -0
  13. package/dist/claude/composer/empty-input.d.ts.map +1 -1
  14. package/dist/claude/composer/empty-input.js +30 -11
  15. package/dist/claude/composer/empty-input.js.map +1 -1
  16. package/dist/claude/composer/footer.d.ts +26 -2
  17. package/dist/claude/composer/footer.d.ts.map +1 -1
  18. package/dist/claude/composer/footer.js +29 -2
  19. package/dist/claude/composer/footer.js.map +1 -1
  20. package/dist/claude/composer/idle.d.ts +14 -0
  21. package/dist/claude/composer/idle.d.ts.map +1 -0
  22. package/dist/claude/composer/idle.js +17 -0
  23. package/dist/claude/composer/idle.js.map +1 -0
  24. package/dist/claude/composer/last.d.ts +2 -0
  25. package/dist/claude/composer/last.d.ts.map +1 -0
  26. package/dist/claude/composer/last.js +15 -0
  27. package/dist/claude/composer/last.js.map +1 -0
  28. package/dist/claude/composer/staged-input.d.ts.map +1 -1
  29. package/dist/claude/composer/staged-input.js +2 -1
  30. package/dist/claude/composer/staged-input.js.map +1 -1
  31. package/dist/claude/hooks/stop-failure.d.ts +15 -2
  32. package/dist/claude/hooks/stop-failure.d.ts.map +1 -1
  33. package/dist/claude/hooks/stop-failure.js +32 -9
  34. package/dist/claude/hooks/stop-failure.js.map +1 -1
  35. package/dist/claude/login/stages.d.ts.map +1 -1
  36. package/dist/claude/login/stages.js +2 -2
  37. package/dist/claude/login/stages.js.map +1 -1
  38. package/dist/claude/model-picker.d.ts +1 -1
  39. package/dist/claude/model-picker.d.ts.map +1 -1
  40. package/dist/claude/model-picker.js +27 -10
  41. package/dist/claude/model-picker.js.map +1 -1
  42. package/dist/claude/preflight.d.ts +1 -1
  43. package/dist/claude/preflight.d.ts.map +1 -1
  44. package/dist/claude/preflight.js +18 -12
  45. package/dist/claude/preflight.js.map +1 -1
  46. package/dist/claude/questions/navigation.d.ts.map +1 -1
  47. package/dist/claude/questions/navigation.js +1 -2
  48. package/dist/claude/questions/navigation.js.map +1 -1
  49. package/dist/claude/questions/screen.d.ts.map +1 -1
  50. package/dist/claude/questions/screen.js +10 -2
  51. package/dist/claude/questions/screen.js.map +1 -1
  52. package/dist/claude/screen-table.d.ts +8 -5
  53. package/dist/claude/screen-table.d.ts.map +1 -1
  54. package/dist/claude/screen-table.js +20 -12
  55. package/dist/claude/screen-table.js.map +1 -1
  56. package/dist/claude/session/bridge.d.ts +2 -1
  57. package/dist/claude/session/bridge.d.ts.map +1 -1
  58. package/dist/claude/session/bridge.js +3 -1
  59. package/dist/claude/session/bridge.js.map +1 -1
  60. package/dist/claude/session/build.d.ts.map +1 -1
  61. package/dist/claude/session/build.js +13 -11
  62. package/dist/claude/session/build.js.map +1 -1
  63. package/dist/claude/session/cleanup.d.ts +18 -0
  64. package/dist/claude/session/cleanup.d.ts.map +1 -0
  65. package/dist/claude/session/cleanup.js +10 -0
  66. package/dist/claude/session/cleanup.js.map +1 -0
  67. package/dist/claude/session/index.d.ts.map +1 -1
  68. package/dist/claude/session/index.js +27 -13
  69. package/dist/claude/session/index.js.map +1 -1
  70. package/dist/claude/session/instance.d.ts +7 -8
  71. package/dist/claude/session/instance.d.ts.map +1 -1
  72. package/dist/claude/session/instance.js +9 -13
  73. package/dist/claude/session/instance.js.map +1 -1
  74. package/dist/claude/session/resume.d.ts.map +1 -1
  75. package/dist/claude/session/resume.js +14 -5
  76. package/dist/claude/session/resume.js.map +1 -1
  77. package/dist/claude/session/transcript.js +2 -2
  78. package/dist/claude/session/transcript.js.map +1 -1
  79. package/dist/claude/simple.d.ts +1 -1
  80. package/dist/claude/simple.d.ts.map +1 -1
  81. package/dist/claude/simple.js +3 -3
  82. package/dist/claude/simple.js.map +1 -1
  83. package/dist/claude/startup-prompts.d.ts +2 -0
  84. package/dist/claude/startup-prompts.d.ts.map +1 -1
  85. package/dist/claude/startup-prompts.js +5 -1
  86. package/dist/claude/startup-prompts.js.map +1 -1
  87. package/dist/claude/transcript/cursor-io.d.ts +1 -1
  88. package/dist/claude/transcript/cursor-io.d.ts.map +1 -1
  89. package/dist/claude/transcript/cursor-io.js +1 -1
  90. package/dist/claude/transcript/cursor-io.js.map +1 -1
  91. package/dist/claude/transcript/cursor.d.ts +5 -3
  92. package/dist/claude/transcript/cursor.d.ts.map +1 -1
  93. package/dist/claude/transcript/cursor.js +18 -8
  94. package/dist/claude/transcript/cursor.js.map +1 -1
  95. package/dist/claude/transcript/drain-context.d.ts +4 -3
  96. package/dist/claude/transcript/drain-context.d.ts.map +1 -1
  97. package/dist/claude/transcript/drain-context.js.map +1 -1
  98. package/dist/claude/transcript/emit.d.ts +2 -1
  99. package/dist/claude/transcript/emit.d.ts.map +1 -1
  100. package/dist/claude/transcript/emit.js +1 -0
  101. package/dist/claude/transcript/emit.js.map +1 -1
  102. package/dist/claude/transcript/index.d.ts.map +1 -1
  103. package/dist/claude/transcript/index.js +2 -2
  104. package/dist/claude/transcript/index.js.map +1 -1
  105. package/dist/claude/transcript/warnings.d.ts +2 -1
  106. package/dist/claude/transcript/warnings.d.ts.map +1 -1
  107. package/dist/claude/transcript/warnings.js +3 -2
  108. package/dist/claude/transcript/warnings.js.map +1 -1
  109. package/dist/cli/config/effective.d.ts +2 -2
  110. package/dist/cli/config/effective.d.ts.map +1 -1
  111. package/dist/cli/config/effective.js +0 -2
  112. package/dist/cli/config/effective.js.map +1 -1
  113. package/dist/cli/interactive/spawn.d.ts +0 -2
  114. package/dist/cli/interactive/spawn.d.ts.map +1 -1
  115. package/dist/cli/interactive/spawn.js +27 -24
  116. package/dist/cli/interactive/spawn.js.map +1 -1
  117. package/dist/cli/lifecycle/index.d.ts.map +1 -1
  118. package/dist/cli/lifecycle/index.js +5 -3
  119. package/dist/cli/lifecycle/index.js.map +1 -1
  120. package/dist/cli/main-failure.d.ts.map +1 -1
  121. package/dist/cli/main-failure.js +5 -2
  122. package/dist/cli/main-failure.js.map +1 -1
  123. package/dist/cli/models/combined.d.ts.map +1 -1
  124. package/dist/cli/models/combined.js +3 -2
  125. package/dist/cli/models/combined.js.map +1 -1
  126. package/dist/cli/models/render.d.ts.map +1 -1
  127. package/dist/cli/models/render.js +2 -1
  128. package/dist/cli/models/render.js.map +1 -1
  129. package/dist/cli/output/cleanup-error.d.ts +22 -0
  130. package/dist/cli/output/cleanup-error.d.ts.map +1 -0
  131. package/dist/cli/output/cleanup-error.js +67 -0
  132. package/dist/cli/output/cleanup-error.js.map +1 -0
  133. package/dist/cli/output/types.d.ts +6 -2
  134. package/dist/cli/output/types.d.ts.map +1 -1
  135. package/dist/cli/request/agent-detect.d.ts +6 -2
  136. package/dist/cli/request/agent-detect.d.ts.map +1 -1
  137. package/dist/cli/request/agent-detect.js +14 -6
  138. package/dist/cli/request/agent-detect.js.map +1 -1
  139. package/dist/cli/request/finalize.d.ts +1 -1
  140. package/dist/cli/request/finalize.d.ts.map +1 -1
  141. package/dist/cli/request/finalize.js +4 -25
  142. package/dist/cli/request/finalize.js.map +1 -1
  143. package/dist/cli/request/index.d.ts.map +1 -1
  144. package/dist/cli/request/index.js +11 -5
  145. package/dist/cli/request/index.js.map +1 -1
  146. package/dist/cli/request/path-replacement.d.ts +27 -0
  147. package/dist/cli/request/path-replacement.d.ts.map +1 -0
  148. package/dist/cli/request/path-replacement.js +79 -0
  149. package/dist/cli/request/path-replacement.js.map +1 -0
  150. package/dist/cli/request/workspace.d.ts +8 -0
  151. package/dist/cli/request/workspace.d.ts.map +1 -0
  152. package/dist/cli/request/workspace.js +50 -0
  153. package/dist/cli/request/workspace.js.map +1 -0
  154. package/dist/cli/run/output.d.ts.map +1 -1
  155. package/dist/cli/run/output.js +2 -1
  156. package/dist/cli/run/output.js.map +1 -1
  157. package/dist/cli/run/subscribe.d.ts.map +1 -1
  158. package/dist/cli/run/subscribe.js +1 -1
  159. package/dist/cli/run/subscribe.js.map +1 -1
  160. package/dist/cli/session/index.d.ts +4 -4
  161. package/dist/cli/session/index.d.ts.map +1 -1
  162. package/dist/cli/session/index.js +5 -5
  163. package/dist/cli/session/index.js.map +1 -1
  164. package/dist/cli/session/launch.d.ts +2 -2
  165. package/dist/cli/session/launch.d.ts.map +1 -1
  166. package/dist/cli/session/launch.js +12 -3
  167. package/dist/cli/session/launch.js.map +1 -1
  168. package/dist/cli/session/turn-readers.d.ts +14 -0
  169. package/dist/cli/session/turn-readers.d.ts.map +1 -0
  170. package/dist/cli/session/turn-readers.js +13 -0
  171. package/dist/cli/session/turn-readers.js.map +1 -0
  172. package/dist/codex/config/default-model.d.ts +24 -0
  173. package/dist/codex/config/default-model.d.ts.map +1 -0
  174. package/dist/codex/config/default-model.js +133 -0
  175. package/dist/codex/config/default-model.js.map +1 -0
  176. package/dist/codex/config/home.d.ts +35 -0
  177. package/dist/codex/config/home.d.ts.map +1 -0
  178. package/dist/codex/config/home.js +122 -0
  179. package/dist/codex/config/home.js.map +1 -0
  180. package/dist/codex/config/lock.d.ts +17 -11
  181. package/dist/codex/config/lock.d.ts.map +1 -1
  182. package/dist/codex/config/lock.js +102 -11
  183. package/dist/codex/config/lock.js.map +1 -1
  184. package/dist/codex/config/read.d.ts +16 -0
  185. package/dist/codex/config/read.d.ts.map +1 -0
  186. package/dist/codex/config/read.js +75 -0
  187. package/dist/codex/config/read.js.map +1 -0
  188. package/dist/codex/config/restore.d.ts +17 -7
  189. package/dist/codex/config/restore.d.ts.map +1 -1
  190. package/dist/codex/config/restore.js +33 -20
  191. package/dist/codex/config/restore.js.map +1 -1
  192. package/dist/codex/config/transaction.d.ts +6 -4
  193. package/dist/codex/config/transaction.d.ts.map +1 -1
  194. package/dist/codex/config/transaction.js +4 -3
  195. package/dist/codex/config/transaction.js.map +1 -1
  196. package/dist/codex/images/clipboard-copies.d.ts +39 -0
  197. package/dist/codex/images/clipboard-copies.d.ts.map +1 -0
  198. package/dist/codex/images/clipboard-copies.js +91 -0
  199. package/dist/codex/images/clipboard-copies.js.map +1 -0
  200. package/dist/codex/model-picker.d.ts +1 -1
  201. package/dist/codex/model-picker.d.ts.map +1 -1
  202. package/dist/codex/model-picker.js +16 -6
  203. package/dist/codex/model-picker.js.map +1 -1
  204. package/dist/codex/preflight.d.ts +2 -2
  205. package/dist/codex/preflight.d.ts.map +1 -1
  206. package/dist/codex/preflight.js +28 -21
  207. package/dist/codex/preflight.js.map +1 -1
  208. package/dist/codex/pty.d.ts +25 -3
  209. package/dist/codex/pty.d.ts.map +1 -1
  210. package/dist/codex/pty.js +53 -7
  211. package/dist/codex/pty.js.map +1 -1
  212. package/dist/codex/questions/candidates.d.ts.map +1 -1
  213. package/dist/codex/questions/candidates.js +4 -5
  214. package/dist/codex/questions/candidates.js.map +1 -1
  215. package/dist/codex/questions/driver.js +2 -2
  216. package/dist/codex/questions/driver.js.map +1 -1
  217. package/dist/codex/questions/records.d.ts +1 -1
  218. package/dist/codex/questions/records.d.ts.map +1 -1
  219. package/dist/codex/questions/records.js +1 -3
  220. package/dist/codex/questions/records.js.map +1 -1
  221. package/dist/codex/screen/clearance.d.ts +6 -0
  222. package/dist/codex/screen/clearance.d.ts.map +1 -1
  223. package/dist/codex/screen/clearance.js +10 -0
  224. package/dist/codex/screen/clearance.js.map +1 -1
  225. package/dist/codex/screen-table.d.ts.map +1 -1
  226. package/dist/codex/screen-table.js +6 -2
  227. package/dist/codex/screen-table.js.map +1 -1
  228. package/dist/codex/session/bridge.d.ts +1 -0
  229. package/dist/codex/session/bridge.d.ts.map +1 -1
  230. package/dist/codex/session/bridge.js +3 -1
  231. package/dist/codex/session/bridge.js.map +1 -1
  232. package/dist/codex/session/build.d.ts.map +1 -1
  233. package/dist/codex/session/build.js +14 -12
  234. package/dist/codex/session/build.js.map +1 -1
  235. package/dist/codex/session/cleanup.d.ts +2 -2
  236. package/dist/codex/session/cleanup.d.ts.map +1 -1
  237. package/dist/codex/session/cleanup.js +8 -11
  238. package/dist/codex/session/cleanup.js.map +1 -1
  239. package/dist/codex/session/config-switch.d.ts +20 -0
  240. package/dist/codex/session/config-switch.d.ts.map +1 -0
  241. package/dist/codex/session/config-switch.js +42 -0
  242. package/dist/codex/session/config-switch.js.map +1 -0
  243. package/dist/codex/session/hooks.d.ts.map +1 -1
  244. package/dist/codex/session/hooks.js +7 -0
  245. package/dist/codex/session/hooks.js.map +1 -1
  246. package/dist/codex/session/index.d.ts.map +1 -1
  247. package/dist/codex/session/index.js +34 -16
  248. package/dist/codex/session/index.js.map +1 -1
  249. package/dist/codex/session/instance.d.ts +10 -12
  250. package/dist/codex/session/instance.d.ts.map +1 -1
  251. package/dist/codex/session/instance.js +42 -37
  252. package/dist/codex/session/instance.js.map +1 -1
  253. package/dist/codex/session/readiness.d.ts +11 -0
  254. package/dist/codex/session/readiness.d.ts.map +1 -0
  255. package/dist/codex/session/readiness.js +22 -0
  256. package/dist/codex/session/readiness.js.map +1 -0
  257. package/dist/codex/session/resume.d.ts.map +1 -1
  258. package/dist/codex/session/resume.js +9 -4
  259. package/dist/codex/session/resume.js.map +1 -1
  260. package/dist/codex/session/transcript.d.ts.map +1 -1
  261. package/dist/codex/session/transcript.js +12 -1
  262. package/dist/codex/session/transcript.js.map +1 -1
  263. package/dist/codex/session/turn-commit.d.ts +58 -0
  264. package/dist/codex/session/turn-commit.d.ts.map +1 -0
  265. package/dist/codex/session/turn-commit.js +97 -0
  266. package/dist/codex/session/turn-commit.js.map +1 -0
  267. package/dist/codex/session/warnings.d.ts +13 -6
  268. package/dist/codex/session/warnings.d.ts.map +1 -1
  269. package/dist/codex/session/warnings.js +36 -9
  270. package/dist/codex/session/warnings.js.map +1 -1
  271. package/dist/codex/startup-prompts.d.ts +3 -0
  272. package/dist/codex/startup-prompts.d.ts.map +1 -1
  273. package/dist/codex/startup-prompts.js +20 -13
  274. package/dist/codex/startup-prompts.js.map +1 -1
  275. package/dist/codex/startup-warnings.d.ts +2 -0
  276. package/dist/codex/startup-warnings.d.ts.map +1 -1
  277. package/dist/codex/startup-warnings.js +6 -0
  278. package/dist/codex/startup-warnings.js.map +1 -1
  279. package/dist/codex/transcript/payload.d.ts +8 -0
  280. package/dist/codex/transcript/payload.d.ts.map +1 -0
  281. package/dist/codex/transcript/payload.js +11 -0
  282. package/dist/codex/transcript/payload.js.map +1 -0
  283. package/dist/codex/transcript/rejection.d.ts +15 -0
  284. package/dist/codex/transcript/rejection.d.ts.map +1 -0
  285. package/dist/codex/transcript/rejection.js +44 -0
  286. package/dist/codex/transcript/rejection.js.map +1 -0
  287. package/dist/codex/transcript/turn-end.d.ts +8 -0
  288. package/dist/codex/transcript/turn-end.d.ts.map +1 -0
  289. package/dist/codex/transcript/turn-end.js +17 -0
  290. package/dist/codex/transcript/turn-end.js.map +1 -0
  291. package/dist/codex/transcript/watcher.d.ts +5 -2
  292. package/dist/codex/transcript/watcher.d.ts.map +1 -1
  293. package/dist/codex/transcript/watcher.js +11 -6
  294. package/dist/codex/transcript/watcher.js.map +1 -1
  295. package/dist/codex/trust-retry.d.ts +12 -0
  296. package/dist/codex/trust-retry.d.ts.map +1 -0
  297. package/dist/codex/trust-retry.js +12 -0
  298. package/dist/codex/trust-retry.js.map +1 -0
  299. package/dist/codex/update/skip-attempt.d.ts +2 -0
  300. package/dist/codex/update/skip-attempt.d.ts.map +1 -1
  301. package/dist/codex/update/skip-attempt.js +4 -0
  302. package/dist/codex/update/skip-attempt.js.map +1 -1
  303. package/dist/codex/update/tracker.d.ts +2 -0
  304. package/dist/codex/update/tracker.d.ts.map +1 -1
  305. package/dist/codex/update/tracker.js +4 -0
  306. package/dist/codex/update/tracker.js.map +1 -1
  307. package/dist/core/delay.d.ts +3 -2
  308. package/dist/core/delay.d.ts.map +1 -1
  309. package/dist/core/delay.js +3 -2
  310. package/dist/core/delay.js.map +1 -1
  311. package/dist/core/errors.d.ts +33 -4
  312. package/dist/core/errors.d.ts.map +1 -1
  313. package/dist/core/errors.js +51 -7
  314. package/dist/core/errors.js.map +1 -1
  315. package/dist/core/images/materialize.d.ts +13 -4
  316. package/dist/core/images/materialize.d.ts.map +1 -1
  317. package/dist/core/images/materialize.js +48 -11
  318. package/dist/core/images/materialize.js.map +1 -1
  319. package/dist/core/input/abort.d.ts +15 -0
  320. package/dist/core/input/abort.d.ts.map +1 -1
  321. package/dist/core/input/abort.js +18 -2
  322. package/dist/core/input/abort.js.map +1 -1
  323. package/dist/core/input/constants.d.ts +4 -1
  324. package/dist/core/input/constants.d.ts.map +1 -1
  325. package/dist/core/input/constants.js +4 -1
  326. package/dist/core/input/constants.js.map +1 -1
  327. package/dist/core/input/index.d.ts +1 -1
  328. package/dist/core/input/index.d.ts.map +1 -1
  329. package/dist/core/input/index.js +1 -1
  330. package/dist/core/input/index.js.map +1 -1
  331. package/dist/core/models/clearance.d.ts +38 -0
  332. package/dist/core/models/clearance.d.ts.map +1 -0
  333. package/dist/core/models/clearance.js +38 -0
  334. package/dist/core/models/clearance.js.map +1 -0
  335. package/dist/core/models/close-wait.d.ts +17 -0
  336. package/dist/core/models/close-wait.d.ts.map +1 -0
  337. package/dist/core/models/close-wait.js +44 -0
  338. package/dist/core/models/close-wait.js.map +1 -0
  339. package/dist/core/models/dialog-region.d.ts +18 -3
  340. package/dist/core/models/dialog-region.d.ts.map +1 -1
  341. package/dist/core/models/dialog-region.js +29 -40
  342. package/dist/core/models/dialog-region.js.map +1 -1
  343. package/dist/core/models/input.d.ts +10 -1
  344. package/dist/core/models/input.d.ts.map +1 -1
  345. package/dist/core/models/input.js +15 -2
  346. package/dist/core/models/input.js.map +1 -1
  347. package/dist/core/models/intervention.d.ts +2 -2
  348. package/dist/core/models/intervention.d.ts.map +1 -1
  349. package/dist/core/models/intervention.js +6 -3
  350. package/dist/core/models/intervention.js.map +1 -1
  351. package/dist/core/models/own-picker.d.ts +21 -0
  352. package/dist/core/models/own-picker.d.ts.map +1 -0
  353. package/dist/core/models/own-picker.js +21 -0
  354. package/dist/core/models/own-picker.js.map +1 -0
  355. package/dist/core/models/picker.d.ts +34 -4
  356. package/dist/core/models/picker.d.ts.map +1 -1
  357. package/dist/core/models/picker.js +50 -44
  358. package/dist/core/models/picker.js.map +1 -1
  359. package/dist/core/models/row-block.d.ts +66 -0
  360. package/dist/core/models/row-block.d.ts.map +1 -0
  361. package/dist/core/models/row-block.js +87 -0
  362. package/dist/core/models/row-block.js.map +1 -0
  363. package/dist/core/models/rows.d.ts +32 -3
  364. package/dist/core/models/rows.d.ts.map +1 -1
  365. package/dist/core/models/rows.js +48 -20
  366. package/dist/core/models/rows.js.map +1 -1
  367. package/dist/core/models/tui-screen.d.ts +6 -1
  368. package/dist/core/models/tui-screen.d.ts.map +1 -1
  369. package/dist/core/models/tui-screen.js +25 -10
  370. package/dist/core/models/tui-screen.js.map +1 -1
  371. package/dist/core/models/window.d.ts +49 -0
  372. package/dist/core/models/window.d.ts.map +1 -0
  373. package/dist/core/models/window.js +105 -0
  374. package/dist/core/models/window.js.map +1 -0
  375. package/dist/core/path-trust.d.ts +11 -0
  376. package/dist/core/path-trust.d.ts.map +1 -0
  377. package/dist/core/path-trust.js +21 -0
  378. package/dist/core/path-trust.js.map +1 -0
  379. package/dist/core/screen-facts.d.ts +3 -1
  380. package/dist/core/screen-facts.d.ts.map +1 -1
  381. package/dist/core/screen-facts.js +1 -0
  382. package/dist/core/screen-facts.js.map +1 -1
  383. package/dist/core/simple/boundary-signal.d.ts +41 -6
  384. package/dist/core/simple/boundary-signal.d.ts.map +1 -1
  385. package/dist/core/simple/boundary-signal.js +43 -3
  386. package/dist/core/simple/boundary-signal.js.map +1 -1
  387. package/dist/core/simple/close.d.ts +2 -1
  388. package/dist/core/simple/close.d.ts.map +1 -1
  389. package/dist/core/simple/close.js +10 -2
  390. package/dist/core/simple/close.js.map +1 -1
  391. package/dist/core/simple/turn-boundary.d.ts +2 -0
  392. package/dist/core/simple/turn-boundary.d.ts.map +1 -1
  393. package/dist/core/simple/turn-boundary.js +1 -1
  394. package/dist/core/simple/turn-boundary.js.map +1 -1
  395. package/dist/core/simple/turn-types.d.ts +9 -3
  396. package/dist/core/simple/turn-types.d.ts.map +1 -1
  397. package/dist/core/simple/turn-types.js +10 -2
  398. package/dist/core/simple/turn-types.js.map +1 -1
  399. package/dist/core/simple/turn.d.ts +2 -0
  400. package/dist/core/simple/turn.d.ts.map +1 -1
  401. package/dist/core/simple/turn.js +11 -5
  402. package/dist/core/simple/turn.js.map +1 -1
  403. package/dist/core/terminal-options.d.ts +17 -1
  404. package/dist/core/terminal-options.d.ts.map +1 -1
  405. package/dist/core/terminal-options.js +20 -8
  406. package/dist/core/terminal-options.js.map +1 -1
  407. package/dist/core/transcript/cursor-io.d.ts +8 -0
  408. package/dist/core/transcript/cursor-io.d.ts.map +1 -1
  409. package/dist/core/transcript/cursor-io.js +11 -5
  410. package/dist/core/transcript/cursor-io.js.map +1 -1
  411. package/dist/core/transcript/cursor.d.ts +28 -4
  412. package/dist/core/transcript/cursor.d.ts.map +1 -1
  413. package/dist/core/transcript/cursor.js +53 -7
  414. package/dist/core/transcript/cursor.js.map +1 -1
  415. package/dist/core/transcript/drain.d.ts +43 -0
  416. package/dist/core/transcript/drain.d.ts.map +1 -0
  417. package/dist/core/transcript/drain.js +67 -0
  418. package/dist/core/transcript/drain.js.map +1 -0
  419. package/dist/core/trust/abortable.d.ts +12 -0
  420. package/dist/core/trust/abortable.d.ts.map +1 -0
  421. package/dist/core/trust/abortable.js +48 -0
  422. package/dist/core/trust/abortable.js.map +1 -0
  423. package/dist/core/trust/allowlist.d.ts +2 -0
  424. package/dist/core/trust/allowlist.d.ts.map +1 -1
  425. package/dist/core/trust/allowlist.js +4 -1
  426. package/dist/core/trust/allowlist.js.map +1 -1
  427. package/dist/core/trust/blocking.d.ts +11 -0
  428. package/dist/core/trust/blocking.d.ts.map +1 -1
  429. package/dist/core/trust/blocking.js +5 -4
  430. package/dist/core/trust/blocking.js.map +1 -1
  431. package/dist/core/trust/copy.d.ts.map +1 -1
  432. package/dist/core/trust/copy.js +7 -1
  433. package/dist/core/trust/copy.js.map +1 -1
  434. package/dist/core/trust/deadline.d.ts +24 -0
  435. package/dist/core/trust/deadline.d.ts.map +1 -0
  436. package/dist/core/trust/deadline.js +56 -0
  437. package/dist/core/trust/deadline.js.map +1 -0
  438. package/dist/core/trust/dialog.d.ts +11 -2
  439. package/dist/core/trust/dialog.d.ts.map +1 -1
  440. package/dist/core/trust/dialog.js +12 -3
  441. package/dist/core/trust/dialog.js.map +1 -1
  442. package/dist/core/trust/options.d.ts +5 -1
  443. package/dist/core/trust/options.d.ts.map +1 -1
  444. package/dist/core/trust/options.js +8 -2
  445. package/dist/core/trust/options.js.map +1 -1
  446. package/dist/core/trust/prompts.d.ts +3 -0
  447. package/dist/core/trust/prompts.d.ts.map +1 -1
  448. package/dist/core/trust/prompts.js +2 -1
  449. package/dist/core/trust/prompts.js.map +1 -1
  450. package/dist/core/trust/responder.d.ts +10 -5
  451. package/dist/core/trust/responder.d.ts.map +1 -1
  452. package/dist/core/trust/responder.js +37 -33
  453. package/dist/core/trust/responder.js.map +1 -1
  454. package/dist/core/trust/step.d.ts +67 -0
  455. package/dist/core/trust/step.d.ts.map +1 -0
  456. package/dist/core/trust/step.js +45 -0
  457. package/dist/core/trust/step.js.map +1 -0
  458. package/dist/core/trust/types.d.ts +21 -1
  459. package/dist/core/trust/types.d.ts.map +1 -1
  460. package/dist/core/trust/types.js +25 -1
  461. package/dist/core/trust/types.js.map +1 -1
  462. package/dist/core/trust/view.d.ts +2 -0
  463. package/dist/core/trust/view.d.ts.map +1 -1
  464. package/dist/core/trust/view.js +3 -0
  465. package/dist/core/trust/view.js.map +1 -1
  466. package/dist/core/trust/write.d.ts +31 -6
  467. package/dist/core/trust/write.d.ts.map +1 -1
  468. package/dist/core/trust/write.js +95 -80
  469. package/dist/core/trust/write.js.map +1 -1
  470. package/dist/core/turn-state.d.ts +18 -4
  471. package/dist/core/turn-state.d.ts.map +1 -1
  472. package/dist/core/turn-state.js +47 -25
  473. package/dist/core/turn-state.js.map +1 -1
  474. package/dist/core/warnings/images.d.ts +22 -0
  475. package/dist/core/warnings/images.d.ts.map +1 -0
  476. package/dist/core/warnings/images.js +3 -0
  477. package/dist/core/warnings/images.js.map +1 -0
  478. package/dist/core/warnings/index.d.ts +3 -2
  479. package/dist/core/warnings/index.d.ts.map +1 -1
  480. package/dist/core/warnings/lifecycle.d.ts +35 -4
  481. package/dist/core/warnings/lifecycle.d.ts.map +1 -1
  482. package/dist/core/warnings/lifecycle.js +1 -1
  483. package/dist/core/warnings/update.d.ts +8 -4
  484. package/dist/core/warnings/update.d.ts.map +1 -1
  485. package/dist/core/warnings/update.js +21 -6
  486. package/dist/core/warnings/update.js.map +1 -1
  487. package/dist/pty/exit-latch.d.ts +28 -0
  488. package/dist/pty/exit-latch.d.ts.map +1 -0
  489. package/dist/pty/exit-latch.js +50 -0
  490. package/dist/pty/exit-latch.js.map +1 -0
  491. package/dist/runtime/exit-status.d.ts +7 -0
  492. package/dist/runtime/exit-status.d.ts.map +1 -0
  493. package/dist/runtime/exit-status.js +13 -0
  494. package/dist/runtime/exit-status.js.map +1 -0
  495. package/dist/runtime/home-guard/index.d.ts +45 -0
  496. package/dist/runtime/home-guard/index.d.ts.map +1 -0
  497. package/dist/runtime/home-guard/index.js +69 -0
  498. package/dist/runtime/home-guard/index.js.map +1 -0
  499. package/dist/runtime/loop-restore.d.ts +9 -9
  500. package/dist/runtime/loop-restore.d.ts.map +1 -1
  501. package/dist/runtime/loop-restore.js +10 -10
  502. package/dist/runtime/loop-restore.js.map +1 -1
  503. package/dist/runtime/probe/capped-buffer.d.ts +16 -0
  504. package/dist/runtime/probe/capped-buffer.d.ts.map +1 -0
  505. package/dist/runtime/probe/capped-buffer.js +38 -0
  506. package/dist/runtime/probe/capped-buffer.js.map +1 -0
  507. package/dist/runtime/probe/capture.d.ts +55 -0
  508. package/dist/runtime/probe/capture.d.ts.map +1 -0
  509. package/dist/runtime/probe/capture.js +71 -0
  510. package/dist/runtime/probe/capture.js.map +1 -0
  511. package/dist/runtime/{probe-cleanup.d.ts → probe/cleanup.d.ts} +2 -2
  512. package/dist/runtime/probe/cleanup.d.ts.map +1 -0
  513. package/dist/runtime/{probe-cleanup.js → probe/cleanup.js} +3 -3
  514. package/dist/runtime/probe/cleanup.js.map +1 -0
  515. package/dist/runtime/probe/directory-key.d.ts +26 -0
  516. package/dist/runtime/probe/directory-key.d.ts.map +1 -0
  517. package/dist/runtime/probe/directory-key.js +46 -0
  518. package/dist/runtime/probe/directory-key.js.map +1 -0
  519. package/dist/runtime/probe/index.d.ts +25 -0
  520. package/dist/runtime/probe/index.d.ts.map +1 -0
  521. package/dist/runtime/probe/index.js +153 -0
  522. package/dist/runtime/probe/index.js.map +1 -0
  523. package/dist/runtime/probe/lookup.d.ts +12 -0
  524. package/dist/runtime/probe/lookup.d.ts.map +1 -0
  525. package/dist/runtime/probe/lookup.js +29 -0
  526. package/dist/runtime/probe/lookup.js.map +1 -0
  527. package/dist/runtime/probe/named-pipes.d.ts +35 -0
  528. package/dist/runtime/probe/named-pipes.d.ts.map +1 -0
  529. package/dist/runtime/probe/named-pipes.js +167 -0
  530. package/dist/runtime/probe/named-pipes.js.map +1 -0
  531. package/dist/runtime/probe/private-directory.d.ts +14 -0
  532. package/dist/runtime/probe/private-directory.d.ts.map +1 -0
  533. package/dist/runtime/probe/private-directory.js +50 -0
  534. package/dist/runtime/probe/private-directory.js.map +1 -0
  535. package/dist/runtime/probe/results.d.ts +14 -0
  536. package/dist/runtime/probe/results.d.ts.map +1 -0
  537. package/dist/runtime/probe/results.js +38 -0
  538. package/dist/runtime/probe/results.js.map +1 -0
  539. package/dist/runtime/probe/slots.d.ts +17 -0
  540. package/dist/runtime/probe/slots.d.ts.map +1 -0
  541. package/dist/runtime/probe/slots.js +35 -0
  542. package/dist/runtime/probe/slots.js.map +1 -0
  543. package/dist/runtime/probe/start.d.ts +64 -0
  544. package/dist/runtime/probe/start.d.ts.map +1 -0
  545. package/dist/runtime/probe/start.js +80 -0
  546. package/dist/runtime/probe/start.js.map +1 -0
  547. package/dist/runtime/probe-cache.d.ts +19 -0
  548. package/dist/runtime/probe-cache.d.ts.map +1 -0
  549. package/dist/runtime/probe-cache.js +56 -0
  550. package/dist/runtime/probe-cache.js.map +1 -0
  551. package/dist/runtime/readiness/initial-ready.d.ts +31 -5
  552. package/dist/runtime/readiness/initial-ready.d.ts.map +1 -1
  553. package/dist/runtime/readiness/initial-ready.js +64 -18
  554. package/dist/runtime/readiness/initial-ready.js.map +1 -1
  555. package/dist/runtime/seams.d.ts +14 -2
  556. package/dist/runtime/seams.d.ts.map +1 -1
  557. package/dist/runtime/seams.js +2 -2
  558. package/dist/runtime/seams.js.map +1 -1
  559. package/dist/runtime/session/base.d.ts.map +1 -1
  560. package/dist/runtime/session/base.js +9 -6
  561. package/dist/runtime/session/base.js.map +1 -1
  562. package/dist/runtime/session/commands.d.ts +6 -4
  563. package/dist/runtime/session/commands.d.ts.map +1 -1
  564. package/dist/runtime/session/commands.js +5 -2
  565. package/dist/runtime/session/commands.js.map +1 -1
  566. package/dist/runtime/session/frames.d.ts +12 -2
  567. package/dist/runtime/session/frames.d.ts.map +1 -1
  568. package/dist/runtime/session/frames.js +10 -3
  569. package/dist/runtime/session/frames.js.map +1 -1
  570. package/dist/runtime/session/image-attach.js +7 -2
  571. package/dist/runtime/session/image-attach.js.map +1 -1
  572. package/dist/runtime/session/launch-directory.d.ts +33 -0
  573. package/dist/runtime/session/launch-directory.d.ts.map +1 -0
  574. package/dist/runtime/session/launch-directory.js +84 -0
  575. package/dist/runtime/session/launch-directory.js.map +1 -0
  576. package/dist/runtime/session/lifecycle.d.ts +3 -3
  577. package/dist/runtime/session/lifecycle.d.ts.map +1 -1
  578. package/dist/runtime/session/lifecycle.js +1 -5
  579. package/dist/runtime/session/lifecycle.js.map +1 -1
  580. package/dist/runtime/session/loops.d.ts +1 -1
  581. package/dist/runtime/session/loops.d.ts.map +1 -1
  582. package/dist/runtime/session/loops.js +6 -3
  583. package/dist/runtime/session/loops.js.map +1 -1
  584. package/dist/runtime/session/picker-cleanup.d.ts +6 -21
  585. package/dist/runtime/session/picker-cleanup.d.ts.map +1 -1
  586. package/dist/runtime/session/picker-cleanup.js +19 -31
  587. package/dist/runtime/session/picker-cleanup.js.map +1 -1
  588. package/dist/runtime/session/picker-hold.d.ts +24 -0
  589. package/dist/runtime/session/picker-hold.d.ts.map +1 -0
  590. package/dist/runtime/session/picker-hold.js +42 -0
  591. package/dist/runtime/session/picker-hold.js.map +1 -0
  592. package/dist/runtime/session/picker.d.ts +15 -13
  593. package/dist/runtime/session/picker.d.ts.map +1 -1
  594. package/dist/runtime/session/picker.js +49 -27
  595. package/dist/runtime/session/picker.js.map +1 -1
  596. package/dist/runtime/session/prepare-state.d.ts +6 -0
  597. package/dist/runtime/session/prepare-state.d.ts.map +1 -0
  598. package/dist/runtime/session/prepare-state.js +14 -0
  599. package/dist/runtime/session/prepare-state.js.map +1 -0
  600. package/dist/runtime/session/questions.d.ts +2 -2
  601. package/dist/runtime/session/questions.d.ts.map +1 -1
  602. package/dist/runtime/session/questions.js.map +1 -1
  603. package/dist/runtime/session/readiness.d.ts +14 -5
  604. package/dist/runtime/session/readiness.d.ts.map +1 -1
  605. package/dist/runtime/session/readiness.js +22 -6
  606. package/dist/runtime/session/readiness.js.map +1 -1
  607. package/dist/runtime/session/reap.d.ts +11 -7
  608. package/dist/runtime/session/reap.d.ts.map +1 -1
  609. package/dist/runtime/session/reap.js +16 -10
  610. package/dist/runtime/session/reap.js.map +1 -1
  611. package/dist/runtime/session/runtime-cleanup.d.ts +18 -0
  612. package/dist/runtime/session/runtime-cleanup.d.ts.map +1 -0
  613. package/dist/runtime/session/runtime-cleanup.js +18 -0
  614. package/dist/runtime/session/runtime-cleanup.js.map +1 -0
  615. package/dist/runtime/session/session-input.d.ts +32 -0
  616. package/dist/runtime/session/session-input.d.ts.map +1 -0
  617. package/dist/runtime/session/{picker-input.js → session-input.js} +35 -7
  618. package/dist/runtime/session/session-input.js.map +1 -0
  619. package/dist/runtime/session/shutdown-binding.d.ts +12 -1
  620. package/dist/runtime/session/shutdown-binding.d.ts.map +1 -1
  621. package/dist/runtime/session/shutdown-binding.js +33 -1
  622. package/dist/runtime/session/shutdown-binding.js.map +1 -1
  623. package/dist/runtime/session/shutdown-cleanup.d.ts +17 -0
  624. package/dist/runtime/session/shutdown-cleanup.d.ts.map +1 -0
  625. package/dist/runtime/session/shutdown-cleanup.js +49 -0
  626. package/dist/runtime/session/shutdown-cleanup.js.map +1 -0
  627. package/dist/runtime/session/shutdown.d.ts +3 -2
  628. package/dist/runtime/session/shutdown.d.ts.map +1 -1
  629. package/dist/runtime/session/shutdown.js +13 -24
  630. package/dist/runtime/session/shutdown.js.map +1 -1
  631. package/dist/runtime/shell-quote.d.ts +8 -0
  632. package/dist/runtime/shell-quote.d.ts.map +1 -0
  633. package/dist/runtime/shell-quote.js +10 -0
  634. package/dist/runtime/shell-quote.js.map +1 -0
  635. package/dist/runtime/shell.d.ts +36 -12
  636. package/dist/runtime/shell.d.ts.map +1 -1
  637. package/dist/runtime/shell.js +90 -14
  638. package/dist/runtime/shell.js.map +1 -1
  639. package/dist/runtime/shutdown/coalesce.d.ts +15 -0
  640. package/dist/runtime/shutdown/coalesce.d.ts.map +1 -0
  641. package/dist/runtime/shutdown/coalesce.js +42 -0
  642. package/dist/runtime/shutdown/coalesce.js.map +1 -0
  643. package/dist/runtime/shutdown/detached-sweep/failures.d.ts +24 -0
  644. package/dist/runtime/shutdown/detached-sweep/failures.d.ts.map +1 -0
  645. package/dist/runtime/shutdown/detached-sweep/failures.js +32 -0
  646. package/dist/runtime/shutdown/detached-sweep/failures.js.map +1 -0
  647. package/dist/runtime/shutdown/detached-sweep/index.d.ts +55 -0
  648. package/dist/runtime/shutdown/detached-sweep/index.d.ts.map +1 -0
  649. package/dist/runtime/shutdown/detached-sweep/index.js +129 -0
  650. package/dist/runtime/shutdown/detached-sweep/index.js.map +1 -0
  651. package/dist/runtime/shutdown/detached-sweep/kill.d.ts +37 -0
  652. package/dist/runtime/shutdown/detached-sweep/kill.d.ts.map +1 -0
  653. package/dist/runtime/shutdown/detached-sweep/kill.js +87 -0
  654. package/dist/runtime/shutdown/detached-sweep/kill.js.map +1 -0
  655. package/dist/runtime/shutdown/detached-sweep/record.d.ts +67 -0
  656. package/dist/runtime/shutdown/detached-sweep/record.d.ts.map +1 -0
  657. package/dist/runtime/shutdown/detached-sweep/record.js +111 -0
  658. package/dist/runtime/shutdown/detached-sweep/record.js.map +1 -0
  659. package/dist/runtime/shutdown/detached-sweep/rounds.d.ts +78 -0
  660. package/dist/runtime/shutdown/detached-sweep/rounds.d.ts.map +1 -0
  661. package/dist/runtime/shutdown/detached-sweep/rounds.js +116 -0
  662. package/dist/runtime/shutdown/detached-sweep/rounds.js.map +1 -0
  663. package/dist/runtime/shutdown/detached-sweep/survivors.d.ts +40 -0
  664. package/dist/runtime/shutdown/detached-sweep/survivors.d.ts.map +1 -0
  665. package/dist/runtime/shutdown/detached-sweep/survivors.js +112 -0
  666. package/dist/runtime/shutdown/detached-sweep/survivors.js.map +1 -0
  667. package/dist/runtime/shutdown/leader-group.d.ts +29 -0
  668. package/dist/runtime/shutdown/leader-group.d.ts.map +1 -0
  669. package/dist/runtime/shutdown/leader-group.js +35 -0
  670. package/dist/runtime/shutdown/leader-group.js.map +1 -0
  671. package/dist/runtime/shutdown/native-read-admission.d.ts +13 -0
  672. package/dist/runtime/shutdown/native-read-admission.d.ts.map +1 -0
  673. package/dist/runtime/shutdown/native-read-admission.js +64 -0
  674. package/dist/runtime/shutdown/native-read-admission.js.map +1 -0
  675. package/dist/runtime/shutdown/process-table.d.ts +80 -0
  676. package/dist/runtime/shutdown/process-table.d.ts.map +1 -0
  677. package/dist/runtime/shutdown/process-table.js +147 -0
  678. package/dist/runtime/shutdown/process-table.js.map +1 -0
  679. package/dist/runtime/shutdown/process-tree-ops.d.ts +39 -0
  680. package/dist/runtime/shutdown/process-tree-ops.d.ts.map +1 -0
  681. package/dist/runtime/shutdown/process-tree-ops.js +73 -0
  682. package/dist/runtime/shutdown/process-tree-ops.js.map +1 -0
  683. package/dist/runtime/shutdown/read-timeout.d.ts +4 -0
  684. package/dist/runtime/shutdown/read-timeout.d.ts.map +1 -0
  685. package/dist/runtime/shutdown/read-timeout.js +6 -0
  686. package/dist/runtime/shutdown/read-timeout.js.map +1 -0
  687. package/dist/runtime/shutdown/reap-queue.d.ts +10 -0
  688. package/dist/runtime/shutdown/reap-queue.d.ts.map +1 -0
  689. package/dist/runtime/shutdown/reap-queue.js +29 -0
  690. package/dist/runtime/shutdown/reap-queue.js.map +1 -0
  691. package/dist/runtime/shutdown/reap-tree.d.ts +42 -32
  692. package/dist/runtime/shutdown/reap-tree.d.ts.map +1 -1
  693. package/dist/runtime/shutdown/reap-tree.js +78 -71
  694. package/dist/runtime/shutdown/reap-tree.js.map +1 -1
  695. package/dist/runtime/shutdown/shared-daemon.d.ts +59 -0
  696. package/dist/runtime/shutdown/shared-daemon.d.ts.map +1 -0
  697. package/dist/runtime/shutdown/shared-daemon.js +139 -0
  698. package/dist/runtime/shutdown/shared-daemon.js.map +1 -0
  699. package/dist/runtime/shutdown/teardown.d.ts +15 -0
  700. package/dist/runtime/shutdown/teardown.d.ts.map +1 -1
  701. package/dist/runtime/shutdown/teardown.js +19 -6
  702. package/dist/runtime/shutdown/teardown.js.map +1 -1
  703. package/dist/runtime/shutdown/terminate.d.ts +21 -1
  704. package/dist/runtime/shutdown/terminate.d.ts.map +1 -1
  705. package/dist/runtime/shutdown/terminate.js +83 -56
  706. package/dist/runtime/shutdown/terminate.js.map +1 -1
  707. package/dist/runtime/startup/buffer.d.ts +26 -7
  708. package/dist/runtime/startup/buffer.d.ts.map +1 -1
  709. package/dist/runtime/startup/buffer.js +42 -19
  710. package/dist/runtime/startup/buffer.js.map +1 -1
  711. package/dist/runtime/startup/cleanup.d.ts +37 -11
  712. package/dist/runtime/startup/cleanup.d.ts.map +1 -1
  713. package/dist/runtime/startup/cleanup.js +55 -25
  714. package/dist/runtime/startup/cleanup.js.map +1 -1
  715. package/dist/runtime/startup/index.d.ts +13 -1
  716. package/dist/runtime/startup/index.d.ts.map +1 -1
  717. package/dist/runtime/startup/index.js +38 -6
  718. package/dist/runtime/startup/index.js.map +1 -1
  719. package/dist/runtime/stream-marker.d.ts +17 -0
  720. package/dist/runtime/stream-marker.d.ts.map +1 -0
  721. package/dist/runtime/stream-marker.js +35 -0
  722. package/dist/runtime/stream-marker.js.map +1 -0
  723. package/dist/runtime/update/acquire.d.ts +16 -0
  724. package/dist/runtime/update/acquire.d.ts.map +1 -0
  725. package/dist/runtime/update/acquire.js +62 -0
  726. package/dist/runtime/update/acquire.js.map +1 -0
  727. package/dist/runtime/update/completion.d.ts +12 -0
  728. package/dist/runtime/update/completion.d.ts.map +1 -0
  729. package/dist/runtime/update/completion.js +50 -0
  730. package/dist/runtime/update/completion.js.map +1 -0
  731. package/dist/runtime/update/lock.d.ts +1 -1
  732. package/dist/runtime/update/lock.d.ts.map +1 -1
  733. package/dist/runtime/update/lock.js +21 -38
  734. package/dist/runtime/update/lock.js.map +1 -1
  735. package/dist/runtime/update/once.d.ts +16 -13
  736. package/dist/runtime/update/once.d.ts.map +1 -1
  737. package/dist/runtime/update/once.js +41 -31
  738. package/dist/runtime/update/once.js.map +1 -1
  739. package/dist/runtime/update/owner.js +1 -1
  740. package/dist/runtime/update/retained-lease.js +1 -1
  741. package/dist/runtime/update/waiting.d.ts +14 -1
  742. package/dist/runtime/update/waiting.d.ts.map +1 -1
  743. package/dist/runtime/update/waiting.js +20 -12
  744. package/dist/runtime/update/waiting.js.map +1 -1
  745. package/dist/state/canonical-path.d.ts +5 -0
  746. package/dist/state/canonical-path.d.ts.map +1 -1
  747. package/dist/state/canonical-path.js +11 -5
  748. package/dist/state/canonical-path.js.map +1 -1
  749. package/dist/state/directories.d.ts +31 -1
  750. package/dist/state/directories.d.ts.map +1 -1
  751. package/dist/state/directories.js +75 -13
  752. package/dist/state/directories.js.map +1 -1
  753. package/dist/state/files.d.ts +3 -3
  754. package/dist/state/files.d.ts.map +1 -1
  755. package/dist/state/files.js +4 -10
  756. package/dist/state/files.js.map +1 -1
  757. package/dist/state/launch-ownership.d.ts +4 -2
  758. package/dist/state/launch-ownership.d.ts.map +1 -1
  759. package/dist/state/launch-ownership.js +18 -10
  760. package/dist/state/launch-ownership.js.map +1 -1
  761. package/dist/state/launch-publication.d.ts +7 -1
  762. package/dist/state/launch-publication.d.ts.map +1 -1
  763. package/dist/state/launch-publication.js +14 -2
  764. package/dist/state/launch-publication.js.map +1 -1
  765. package/dist/state/loop-store.d.ts +15 -4
  766. package/dist/state/loop-store.d.ts.map +1 -1
  767. package/dist/state/loop-store.js +13 -7
  768. package/dist/state/loop-store.js.map +1 -1
  769. package/dist/state/preparation/created-directories.d.ts +13 -0
  770. package/dist/state/preparation/created-directories.d.ts.map +1 -0
  771. package/dist/state/preparation/created-directories.js +45 -0
  772. package/dist/state/preparation/created-directories.js.map +1 -0
  773. package/dist/state/preparation/ignore-sync.d.ts +9 -0
  774. package/dist/state/preparation/ignore-sync.d.ts.map +1 -0
  775. package/dist/state/preparation/ignore-sync.js +47 -0
  776. package/dist/state/preparation/ignore-sync.js.map +1 -0
  777. package/dist/state/preparation/index.d.ts +25 -0
  778. package/dist/state/preparation/index.d.ts.map +1 -0
  779. package/dist/state/preparation/index.js +31 -0
  780. package/dist/state/preparation/index.js.map +1 -0
  781. package/dist/state/preparation/install-ignore.d.ts +6 -0
  782. package/dist/state/preparation/install-ignore.d.ts.map +1 -0
  783. package/dist/state/preparation/install-ignore.js +87 -0
  784. package/dist/state/preparation/install-ignore.js.map +1 -0
  785. package/dist/state/preparation/rollback-parent.d.ts +3 -0
  786. package/dist/state/preparation/rollback-parent.d.ts.map +1 -0
  787. package/dist/state/preparation/rollback-parent.js +18 -0
  788. package/dist/state/preparation/rollback-parent.js.map +1 -0
  789. package/dist/state/preparation/root-trust.d.ts +3 -0
  790. package/dist/state/preparation/root-trust.d.ts.map +1 -0
  791. package/dist/state/preparation/root-trust.js +70 -0
  792. package/dist/state/preparation/root-trust.js.map +1 -0
  793. package/dist/state/private-session.d.ts +5 -2
  794. package/dist/state/private-session.d.ts.map +1 -1
  795. package/dist/state/private-session.js +21 -9
  796. package/dist/state/private-session.js.map +1 -1
  797. package/dist/state/root.d.ts +25 -0
  798. package/dist/state/root.d.ts.map +1 -0
  799. package/dist/state/root.js +84 -0
  800. package/dist/state/root.js.map +1 -0
  801. package/dist/state/runtime-paths.d.ts +5 -4
  802. package/dist/state/runtime-paths.d.ts.map +1 -1
  803. package/dist/state/runtime-paths.js +5 -4
  804. package/dist/state/runtime-paths.js.map +1 -1
  805. package/dist/state/setup-failure.d.ts +3 -0
  806. package/dist/state/setup-failure.d.ts.map +1 -0
  807. package/dist/state/setup-failure.js +13 -0
  808. package/dist/state/setup-failure.js.map +1 -0
  809. package/dist/state/socket-home.d.ts +17 -12
  810. package/dist/state/socket-home.d.ts.map +1 -1
  811. package/dist/state/socket-home.js +31 -14
  812. package/dist/state/socket-home.js.map +1 -1
  813. package/dist/state/store.d.ts +1 -3
  814. package/dist/state/store.d.ts.map +1 -1
  815. package/dist/state/store.js +3 -18
  816. package/dist/state/store.js.map +1 -1
  817. package/dist/terminal/cursor.d.ts +1 -1
  818. package/dist/terminal/cursor.d.ts.map +1 -1
  819. package/dist/terminal/cursor.js +36 -1
  820. package/dist/terminal/cursor.js.map +1 -1
  821. package/dist/terminal/headless.d.ts +1 -1
  822. package/dist/terminal/headless.d.ts.map +1 -1
  823. package/dist/terminal/headless.js +1 -3
  824. package/dist/terminal/headless.js.map +1 -1
  825. package/docs/cli-behavior.md +1218 -28
  826. package/docs/cli.md +2 -0
  827. package/docs/codex/cli.md +4 -2
  828. package/docs/embedding.md +7 -0
  829. package/docs/performance/terminal-engines.md +88 -0
  830. package/docs/performance.md +120 -0
  831. package/package.json +4 -4
  832. package/prd/04-architecture.md +32 -0
  833. package/prd/05-api/5.1-starting-claude.md +17 -1
  834. package/prd/05-api/5.2-resuming-claude.md +5 -0
  835. package/prd/05-api/5.3-claude-session-api.md +267 -40
  836. package/prd/05-api/5.4-events.md +77 -10
  837. package/prd/05-api/5.5-starting-codex.md +3 -1
  838. package/prd/05-api/5.6-resuming-codex.md +4 -1
  839. package/prd/05-api/5.7-codex-session-api.md +87 -5
  840. package/prd/05-api/5.8-session-api.md +32 -1
  841. package/prd/06-claude-hook-bridge.md +2 -0
  842. package/prd/07a-codex-hook-bridge.md +5 -0
  843. package/prd/08-state.md +63 -7
  844. package/prd/09-lifecycle.md +126 -35
  845. package/prd/10-errors.md +11 -4
  846. package/prd/12-e2e.md +81 -0
  847. package/prd/12a-cli.md +63 -9
  848. package/prd/14-conformance.md +52 -35
  849. package/prd/16-maintainer-review.md +11 -0
  850. package/dist/claude/model-composer.d.ts +0 -2
  851. package/dist/claude/model-composer.d.ts.map +0 -1
  852. package/dist/claude/model-composer.js +0 -12
  853. package/dist/claude/model-composer.js.map +0 -1
  854. package/dist/claude/transcript/drain.d.ts +0 -33
  855. package/dist/claude/transcript/drain.d.ts.map +0 -1
  856. package/dist/claude/transcript/drain.js +0 -56
  857. package/dist/claude/transcript/drain.js.map +0 -1
  858. package/dist/codex/session/cli-exit.d.ts +0 -24
  859. package/dist/codex/session/cli-exit.d.ts.map +0 -1
  860. package/dist/codex/session/cli-exit.js +0 -43
  861. package/dist/codex/session/cli-exit.js.map +0 -1
  862. package/dist/codex/transcript/drain.d.ts +0 -30
  863. package/dist/codex/transcript/drain.d.ts.map +0 -1
  864. package/dist/codex/transcript/drain.js +0 -48
  865. package/dist/codex/transcript/drain.js.map +0 -1
  866. package/dist/runtime/probe-cleanup.d.ts.map +0 -1
  867. package/dist/runtime/probe-cleanup.js.map +0 -1
  868. package/dist/runtime/probe.d.ts +0 -11
  869. package/dist/runtime/probe.d.ts.map +0 -1
  870. package/dist/runtime/probe.js +0 -113
  871. package/dist/runtime/probe.js.map +0 -1
  872. package/dist/runtime/session/foreign-picker.d.ts +0 -8
  873. package/dist/runtime/session/foreign-picker.d.ts.map +0 -1
  874. package/dist/runtime/session/foreign-picker.js +0 -18
  875. package/dist/runtime/session/foreign-picker.js.map +0 -1
  876. package/dist/runtime/session/picker-input.d.ts +0 -17
  877. package/dist/runtime/session/picker-input.d.ts.map +0 -1
  878. package/dist/runtime/session/picker-input.js.map +0 -1
@@ -0,0 +1,50 @@
1
+ /**
2
+ * A directory made for one probe's output, mode 0700 under the system temp directory, and its
3
+ * removal however the probe ends (PRD §9.2, C-PERF-05).
4
+ */
5
+ import { mkdtempSync, rmdirSync, rmSync } from "node:fs";
6
+ import { chmod, readdir, rm } from "node:fs/promises";
7
+ import { tmpdir } from "node:os";
8
+ import { join } from "node:path";
9
+ /** Makes a probe's private directory; `mkdtemp` makes it mode 0700. */
10
+ export function makePrivateDirectory() {
11
+ return mkdtempSync(join(tmpdir(), "elwood-probe-"));
12
+ }
13
+ /**
14
+ * Removes a probe's private directory, which holds at most `entries`, as the probe settles: an
15
+ * unlink each and an `rmdir`, done at once. A directory the command changed, by what it made, locked,
16
+ * or removed there, is removed off the event loop instead, however large a tree it left. Never
17
+ * throws.
18
+ */
19
+ export function removePrivateDirectory(dir, entries) {
20
+ try {
21
+ // `force`: setup that failed may not have made them.
22
+ for (const entry of entries)
23
+ rmSync(join(dir, entry), { force: true });
24
+ rmdirSync(dir);
25
+ }
26
+ catch {
27
+ void removeTree(dir);
28
+ }
29
+ }
30
+ async function removeTree(dir) {
31
+ try {
32
+ // The command may have made the directory, or one it made inside it, unreadable. Elwood
33
+ // owns them, so it can open them again.
34
+ await unlock(dir);
35
+ await rm(dir, { recursive: true, force: true });
36
+ }
37
+ catch {
38
+ // Mostly, the command removed the directory itself. Any other failure leaves it behind,
39
+ // unreported: the probe has settled, and nothing reads a removal's outcome yet.
40
+ }
41
+ }
42
+ /** Gives `dir` and every directory under it back their owner's access. */
43
+ async function unlock(dir) {
44
+ await chmod(dir, 0o700);
45
+ for (const entry of await readdir(dir, { withFileTypes: true })) {
46
+ if (entry.isDirectory())
47
+ await unlock(join(dir, entry.name));
48
+ }
49
+ }
50
+ //# sourceMappingURL=private-directory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"private-directory.js","sourceRoot":"","sources":["../../../src/runtime/probe/private-directory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACzD,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,uEAAuE;AACvE,MAAM,UAAU,oBAAoB;IAClC,OAAO,WAAW,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,eAAe,CAAC,CAAC,CAAC;AACtD,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,sBAAsB,CAAC,GAAW,EAAE,OAA0B;IAC5E,IAAI,CAAC;QACH,qDAAqD;QACrD,KAAK,MAAM,KAAK,IAAI,OAAO;YAAE,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;QACvE,SAAS,CAAC,GAAG,CAAC,CAAC;IACjB,CAAC;IAAC,MAAM,CAAC;QACP,KAAK,UAAU,CAAC,GAAG,CAAC,CAAC;IACvB,CAAC;AACH,CAAC;AAED,KAAK,UAAU,UAAU,CAAC,GAAW;IACnC,IAAI,CAAC;QACH,wFAAwF;QACxF,wCAAwC;QACxC,MAAM,MAAM,CAAC,GAAG,CAAC,CAAC;QAClB,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IAClD,CAAC;IAAC,MAAM,CAAC;QACP,wFAAwF;QACxF,gFAAgF;IAClF,CAAC;AACH,CAAC;AAED,0EAA0E;AAC1E,KAAK,UAAU,MAAM,CAAC,GAAW;IAC/B,MAAM,KAAK,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IACxB,KAAK,MAAM,KAAK,IAAI,MAAM,OAAO,CAAC,GAAG,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;QAChE,IAAI,KAAK,CAAC,WAAW,EAAE;YAAE,MAAM,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;IAC/D,CAAC;AACH,CAAC"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * The results a probe settles with when its command did not simply exit: a spawn error, a
3
+ * bound, an overflow, a login shell that never started the command, or the e2e home guard
4
+ * (PRD §9.2, C-PERF-03, C-PERF-05, C-E2E-24; native spawn diagnostics, C-ERR-08).
5
+ */
6
+ import type { CommandResult } from "../seams.ts";
7
+ export declare function mapError(error: NodeJS.ErrnoException): NonNullable<CommandResult["error"]>;
8
+ export declare function commandTimedOut(ms: number, stdout: string, stderr: string): CommandResult;
9
+ export declare function launchTimedOut(ms: number, stdout: string, stderr: string): CommandResult;
10
+ export declare function shellExited(status: number | null, stdout: string, stderr: string): CommandResult;
11
+ /** A probe the e2e home guard stopped: the login shell's failure, with only the fixed reason. */
12
+ export declare function guardStopped(stdout: string, stderr: string): CommandResult;
13
+ export declare function overflow(stdout: string, stderr: string): CommandResult;
14
+ //# sourceMappingURL=results.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"results.d.ts","sourceRoot":"","sources":["../../../src/runtime/probe/results.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAGjD,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,cAAc,GAAG,WAAW,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,CAE1F;AAED,wBAAgB,eAAe,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,aAAa,CAGzF;AAED,wBAAgB,cAAc,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,aAAa,CAIxF;AAED,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,aAAa,CAIhG;AAED,iGAAiG;AACjG,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,aAAa,CAO1E;AAED,wBAAgB,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,aAAa,CAGtE"}
@@ -0,0 +1,38 @@
1
+ /**
2
+ * The results a probe settles with when its command did not simply exit: a spawn error, a
3
+ * bound, an overflow, a login shell that never started the command, or the e2e home guard
4
+ * (PRD §9.2, C-PERF-03, C-PERF-05, C-E2E-24; native spawn diagnostics, C-ERR-08).
5
+ */
6
+ import { homeGuardExitCode, homeGuardStoppedReason } from "../home-guard/index.js";
7
+ import { maxProbeStreamOutputBytes } from "./capped-buffer.js";
8
+ export function mapError(error) {
9
+ return { code: error.code, syscall: error.syscall, path: error.path, message: error.message };
10
+ }
11
+ export function commandTimedOut(ms, stdout, stderr) {
12
+ const message = `probe timed out after ${ms} ms`;
13
+ return { status: null, stdout, stderr, error: { code: "ETIMEDOUT", message } };
14
+ }
15
+ export function launchTimedOut(ms, stdout, stderr) {
16
+ const message = `login shell did not start the probe command within ${ms} ms`;
17
+ const error = { code: "ETIMEDOUT", message, phase: "login_shell" };
18
+ return { status: null, stdout, stderr, error };
19
+ }
20
+ export function shellExited(status, stdout, stderr) {
21
+ const message = `login shell exited with status ${status} before starting the probe command`;
22
+ const error = { message, phase: "login_shell", shellStatus: status };
23
+ return { status: null, stdout, stderr, error };
24
+ }
25
+ /** A probe the e2e home guard stopped: the login shell's failure, with only the fixed reason. */
26
+ export function guardStopped(stdout, stderr) {
27
+ const error = {
28
+ message: homeGuardStoppedReason,
29
+ phase: "login_shell",
30
+ shellStatus: homeGuardExitCode,
31
+ };
32
+ return { status: null, stdout, stderr, error };
33
+ }
34
+ export function overflow(stdout, stderr) {
35
+ const message = `a probe output stream exceeded ${maxProbeStreamOutputBytes} bytes`;
36
+ return { status: null, stdout, stderr, error: { code: "E2BIG", message } };
37
+ }
38
+ //# sourceMappingURL=results.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"results.js","sourceRoot":"","sources":["../../../src/runtime/probe/results.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAEnF,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAE/D,MAAM,UAAU,QAAQ,CAAC,KAA4B;IACnD,OAAO,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC;AAChG,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,EAAU,EAAE,MAAc,EAAE,MAAc;IACxE,MAAM,OAAO,GAAG,yBAAyB,EAAE,KAAK,CAAC;IACjD,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,EAAE,CAAC;AACjF,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,EAAU,EAAE,MAAc,EAAE,MAAc;IACvE,MAAM,OAAO,GAAG,sDAAsD,EAAE,KAAK,CAAC;IAC9E,MAAM,KAAK,GAAG,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,KAAK,EAAE,aAAa,EAAW,CAAC;IAC5E,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;AACjD,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,MAAqB,EAAE,MAAc,EAAE,MAAc;IAC/E,MAAM,OAAO,GAAG,kCAAkC,MAAM,oCAAoC,CAAC;IAC7F,MAAM,KAAK,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,EAAW,CAAC;IAC9E,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;AACjD,CAAC;AAED,iGAAiG;AACjG,MAAM,UAAU,YAAY,CAAC,MAAc,EAAE,MAAc;IACzD,MAAM,KAAK,GAAG;QACZ,OAAO,EAAE,sBAAsB;QAC/B,KAAK,EAAE,aAAa;QACpB,WAAW,EAAE,iBAAiB;KACtB,CAAC;IACX,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;AACjD,CAAC;AAED,MAAM,UAAU,QAAQ,CAAC,MAAc,EAAE,MAAc;IACrD,MAAM,OAAO,GAAG,kCAAkC,yBAAyB,QAAQ,CAAC;IACpF,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,CAAC;AAC7E,CAAC"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Caps how many probe shells run at once in this process. Each probe starts an interactive
3
+ * login shell, and a heavy profile is CPU-bound: one took about 2 s at 4 concurrent shells and
4
+ * 7-19 s at 16 on a loaded host. Without a cap, a fleet starting in many directories would start
5
+ * a shell for every probe at once and slow all of them. Implements PRD §9.2 and C-PERF-07.
6
+ */
7
+ /**
8
+ * At most this many probes run at once; the rest wait their turn in arrival order. Eight keeps a
9
+ * heavy profile near 5 s per probe on a loaded 16-CPU host, against about 2 s at four and 7-19 s
10
+ * at sixteen, so a cold fleet still starts eight sessions at a time while each stays well inside
11
+ * its 60 s launch bound (C-PERF-05). The measurements are in docs/cli-behavior.md, "Probe shell
12
+ * startup under concurrency".
13
+ */
14
+ export declare const maxConcurrentProbes = 8;
15
+ /** Runs `probe` once a slot is free, and frees the slot when it settles either way. */
16
+ export declare function withProbeSlot<T>(probe: () => Promise<T>): Promise<T>;
17
+ //# sourceMappingURL=slots.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"slots.d.ts","sourceRoot":"","sources":["../../../src/runtime/probe/slots.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,IAAI,CAAC;AAKrC,uFAAuF;AACvF,wBAAsB,aAAa,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAW1E"}
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Caps how many probe shells run at once in this process. Each probe starts an interactive
3
+ * login shell, and a heavy profile is CPU-bound: one took about 2 s at 4 concurrent shells and
4
+ * 7-19 s at 16 on a loaded host. Without a cap, a fleet starting in many directories would start
5
+ * a shell for every probe at once and slow all of them. Implements PRD §9.2 and C-PERF-07.
6
+ */
7
+ /**
8
+ * At most this many probes run at once; the rest wait their turn in arrival order. Eight keeps a
9
+ * heavy profile near 5 s per probe on a loaded 16-CPU host, against about 2 s at four and 7-19 s
10
+ * at sixteen, so a cold fleet still starts eight sessions at a time while each stays well inside
11
+ * its 60 s launch bound (C-PERF-05). The measurements are in docs/cli-behavior.md, "Probe shell
12
+ * startup under concurrency".
13
+ */
14
+ export const maxConcurrentProbes = 8;
15
+ let running = 0;
16
+ const waiting = [];
17
+ /** Runs `probe` once a slot is free, and frees the slot when it settles either way. */
18
+ export async function withProbeSlot(probe) {
19
+ if (running < maxConcurrentProbes)
20
+ running += 1;
21
+ else
22
+ await new Promise((resolve) => waiting.push(resolve));
23
+ try {
24
+ return await probe();
25
+ }
26
+ finally {
27
+ // Hand the slot straight to the longest waiter, so a newcomer cannot take it first.
28
+ const next = waiting.shift();
29
+ if (next)
30
+ next();
31
+ else
32
+ running -= 1;
33
+ }
34
+ }
35
+ //# sourceMappingURL=slots.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"slots.js","sourceRoot":"","sources":["../../../src/runtime/probe/slots.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC;AAErC,IAAI,OAAO,GAAG,CAAC,CAAC;AAChB,MAAM,OAAO,GAAmB,EAAE,CAAC;AAEnC,uFAAuF;AACvF,MAAM,CAAC,KAAK,UAAU,aAAa,CAAI,KAAuB;IAC5D,IAAI,OAAO,GAAG,mBAAmB;QAAE,OAAO,IAAI,CAAC,CAAC;;QAC3C,MAAM,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;IACjE,IAAI,CAAC;QACH,OAAO,MAAM,KAAK,EAAE,CAAC;IACvB,CAAC;YAAS,CAAC;QACT,oFAAoF;QACpF,MAAM,IAAI,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC;QAC7B,IAAI,IAAI;YAAE,IAAI,EAAE,CAAC;;YACZ,OAAO,IAAI,CAAC,CAAC;IACpB,CAAC;AACH,CAAC"}
@@ -0,0 +1,64 @@
1
+ /**
2
+ * Recognizes the probe shell's start line, which ends the login shell's launch phase and starts
3
+ * the probe command's own bound: on the runner's private control descriptor, or on stdout from a
4
+ * shell that closed that descriptor at startup. Implements PRD §9.2 and C-PERF-05.
5
+ */
6
+ /**
7
+ * The line a probe shell writes once the user's startup files have loaded, before the probe
8
+ * command runs. It separates the profile's launch time from the command's own bound, which
9
+ * covers everything after the line: the not-found handlers' removal, then the command
10
+ * (PRD §9.2, C-PERF-05). Owned here, by the reader, so the runner never loads the shell
11
+ * helpers that the writer, `probeShellCommand`, lives in. It ends in a token drawn once per
12
+ * parent process: stdout, which the runner also watches, carries the profile's own output,
13
+ * and no profile can print a line it cannot predict.
14
+ */
15
+ export declare const probeCommandStartLine: string;
16
+ /**
17
+ * The start line's primary channel: a fourth pipe the runner opens for every probe. Not stdout
18
+ * or stderr, so a profile that redirects those (`exec 2>&1`, `exec 2>/dev/null`) cannot hide
19
+ * the line, and captured output stays exactly the profile's and the command's. A shell that
20
+ * closed it at startup writes the line on stdout instead (`probeStartScript`).
21
+ */
22
+ export declare const probeControlFd = 3;
23
+ /**
24
+ * The probe shell's script prefix: it writes the start line on the control descriptor. macOS's
25
+ * bash 3.2 started with both `-l` and `-i` closes every inherited descriptor above stderr before
26
+ * running the script, so there the write fails, silently, and the line goes to stdout. Not
27
+ * stderr: a profile may send that to `/dev/null` or into stdout, while a profile that hid stdout
28
+ * would hide the line, and so fail the probe as the login shell's. The runner removes the line
29
+ * from captured stdout. The descriptor stays open for the e2e home guard, which writes its stop
30
+ * line where the start line went (PRD §12), until `probeControlClose`.
31
+ */
32
+ export declare const probeStartScript: string;
33
+ /** Closes the control descriptor before the probe command, so the command does not inherit it. */
34
+ export declare const probeControlClose = "exec 3>&-; ";
35
+ /**
36
+ * The redirection a probe script gives the command it `exec`s: a placeholder that a named-pipe
37
+ * capture replaces with its two pipes' quoted paths once it has made them (`named-pipes.ts`).
38
+ * The paths are never in the login shell's environment, so nothing its startup files run is
39
+ * told where the probe's output goes.
40
+ */
41
+ export declare const probeOutputRedirect = ">%elwood-probe-stdout% 2>%elwood-probe-stderr%";
42
+ /**
43
+ * Removes the user's not-found handlers before the probe command runs: zsh's
44
+ * `command_not_found_handler` and bash's `command_not_found_handle`. A shell that finds no
45
+ * command runs its handler, so its output would be captured as the command's, and the status
46
+ * the handler returns would replace the 127 that tells preflight the CLI is missing. Each
47
+ * shell ignores the other's name, and a failed `unset` cannot end the shell under `errexit`.
48
+ */
49
+ export declare const probeNotFoundHandlerReset = "unset -f command_not_found_handler command_not_found_handle 2>/dev/null || :; ";
50
+ /** Whether a probe runs a script that announces its command with the start line. */
51
+ export declare function announcesStart(args: readonly string[]): boolean;
52
+ /** The two streams a probe's start line can arrive on. */
53
+ export type ProbeStartChannel = "control" | "stdout";
54
+ /** Watches both channels; the first to carry the start line starts the command. */
55
+ export declare class ProbeStart {
56
+ private readonly watchers;
57
+ /** Whether any channel has carried the start line. */
58
+ get started(): boolean;
59
+ /** True exactly once across both channels: for the chunk that completes the start line. */
60
+ feed(channel: ProbeStartChannel, chunk: Buffer): boolean;
61
+ /** Removes the start line from captured stdout if the shell wrote it there (C-PERF-05). */
62
+ stripFromStdout(captured: string): string;
63
+ }
64
+ //# sourceMappingURL=start.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"start.d.ts","sourceRoot":"","sources":["../../../src/runtime/probe/start.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH;;;;;;;;GAQG;AACH,eAAO,MAAM,qBAAqB,QAAiE,CAAC;AAEpG;;;;;GAKG;AACH,eAAO,MAAM,cAAc,IAAI,CAAC;AAEhC;;;;;;;;GAQG;AACH,eAAO,MAAM,gBAAgB,QAA0G,CAAC;AAExI,kGAAkG;AAClG,eAAO,MAAM,iBAAiB,gBAAgC,CAAC;AAE/D;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,mDAAmD,CAAC;AAEpF;;;;;;GAMG;AACH,eAAO,MAAM,yBAAyB,mFAC4C,CAAC;AAEnF,oFAAoF;AACpF,wBAAgB,cAAc,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAE/D;AAKD,0DAA0D;AAC1D,MAAM,MAAM,iBAAiB,GAAG,SAAS,GAAG,QAAQ,CAAC;AAErD,mFAAmF;AACnF,qBAAa,UAAU;IAErB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAGvB;IAEF,sDAAsD;IACtD,IAAI,OAAO,IAAI,OAAO,CAErB;IAED,2FAA2F;IAC3F,IAAI,CAAC,OAAO,EAAE,iBAAiB,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO;IAKxD,2FAA2F;IAC3F,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;CAG1C"}
@@ -0,0 +1,80 @@
1
+ /**
2
+ * Recognizes the probe shell's start line, which ends the login shell's launch phase and starts
3
+ * the probe command's own bound: on the runner's private control descriptor, or on stdout from a
4
+ * shell that closed that descriptor at startup. Implements PRD §9.2 and C-PERF-05.
5
+ */
6
+ import { randomBytes } from "node:crypto";
7
+ import { StreamMarkerWatcher } from "../stream-marker.js";
8
+ /**
9
+ * The line a probe shell writes once the user's startup files have loaded, before the probe
10
+ * command runs. It separates the profile's launch time from the command's own bound, which
11
+ * covers everything after the line: the not-found handlers' removal, then the command
12
+ * (PRD §9.2, C-PERF-05). Owned here, by the reader, so the runner never loads the shell
13
+ * helpers that the writer, `probeShellCommand`, lives in. It ends in a token drawn once per
14
+ * parent process: stdout, which the runner also watches, carries the profile's own output,
15
+ * and no profile can print a line it cannot predict.
16
+ */
17
+ export const probeCommandStartLine = `elwood-probe-command-start-${randomBytes(8).toString("hex")}`;
18
+ /**
19
+ * The start line's primary channel: a fourth pipe the runner opens for every probe. Not stdout
20
+ * or stderr, so a profile that redirects those (`exec 2>&1`, `exec 2>/dev/null`) cannot hide
21
+ * the line, and captured output stays exactly the profile's and the command's. A shell that
22
+ * closed it at startup writes the line on stdout instead (`probeStartScript`).
23
+ */
24
+ export const probeControlFd = 3;
25
+ /**
26
+ * The probe shell's script prefix: it writes the start line on the control descriptor. macOS's
27
+ * bash 3.2 started with both `-l` and `-i` closes every inherited descriptor above stderr before
28
+ * running the script, so there the write fails, silently, and the line goes to stdout. Not
29
+ * stderr: a profile may send that to `/dev/null` or into stdout, while a profile that hid stdout
30
+ * would hide the line, and so fail the probe as the login shell's. The runner removes the line
31
+ * from captured stdout. The descriptor stays open for the e2e home guard, which writes its stop
32
+ * line where the start line went (PRD §12), until `probeControlClose`.
33
+ */
34
+ export const probeStartScript = `{ echo ${probeCommandStartLine} >&${probeControlFd}; } 2>/dev/null || echo ${probeCommandStartLine}; `;
35
+ /** Closes the control descriptor before the probe command, so the command does not inherit it. */
36
+ export const probeControlClose = `exec ${probeControlFd}>&-; `;
37
+ /**
38
+ * The redirection a probe script gives the command it `exec`s: a placeholder that a named-pipe
39
+ * capture replaces with its two pipes' quoted paths once it has made them (`named-pipes.ts`).
40
+ * The paths are never in the login shell's environment, so nothing its startup files run is
41
+ * told where the probe's output goes.
42
+ */
43
+ export const probeOutputRedirect = ">%elwood-probe-stdout% 2>%elwood-probe-stderr%";
44
+ /**
45
+ * Removes the user's not-found handlers before the probe command runs: zsh's
46
+ * `command_not_found_handler` and bash's `command_not_found_handle`. A shell that finds no
47
+ * command runs its handler, so its output would be captured as the command's, and the status
48
+ * the handler returns would replace the 127 that tells preflight the CLI is missing. Each
49
+ * shell ignores the other's name, and a failed `unset` cannot end the shell under `errexit`.
50
+ */
51
+ export const probeNotFoundHandlerReset = "unset -f command_not_found_handler command_not_found_handle 2>/dev/null || :; ";
52
+ /** Whether a probe runs a script that announces its command with the start line. */
53
+ export function announcesStart(args) {
54
+ return args.at(-1)?.startsWith(probeStartScript) ?? false;
55
+ }
56
+ const startText = `${probeCommandStartLine}\n`;
57
+ const startBytes = Buffer.from(startText);
58
+ /** Watches both channels; the first to carry the start line starts the command. */
59
+ export class ProbeStart {
60
+ // One watcher per channel: a channel added to `ProbeStartChannel` must be given its own.
61
+ watchers = {
62
+ control: new StreamMarkerWatcher(startBytes),
63
+ stdout: new StreamMarkerWatcher(startBytes),
64
+ };
65
+ /** Whether any channel has carried the start line. */
66
+ get started() {
67
+ return Object.values(this.watchers).some((watcher) => watcher.seen);
68
+ }
69
+ /** True exactly once across both channels: for the chunk that completes the start line. */
70
+ feed(channel, chunk) {
71
+ if (this.started)
72
+ return false; // later copies are the command's own output
73
+ return this.watchers[channel].feed(chunk);
74
+ }
75
+ /** Removes the start line from captured stdout if the shell wrote it there (C-PERF-05). */
76
+ stripFromStdout(captured) {
77
+ return this.watchers.stdout.seen ? captured.replace(startText, "") : captured;
78
+ }
79
+ }
80
+ //# sourceMappingURL=start.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"start.js","sourceRoot":"","sources":["../../../src/runtime/probe/start.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAE1D;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,8BAA8B,WAAW,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;AAEpG;;;;;GAKG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC;AAEhC;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,UAAU,qBAAqB,MAAM,cAAc,2BAA2B,qBAAqB,IAAI,CAAC;AAExI,kGAAkG;AAClG,MAAM,CAAC,MAAM,iBAAiB,GAAG,QAAQ,cAAc,OAAO,CAAC;AAE/D;;;;;GAKG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,gDAAgD,CAAC;AAEpF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,yBAAyB,GACpC,gFAAgF,CAAC;AAEnF,oFAAoF;AACpF,MAAM,UAAU,cAAc,CAAC,IAAuB;IACpD,OAAO,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC,gBAAgB,CAAC,IAAI,KAAK,CAAC;AAC5D,CAAC;AAED,MAAM,SAAS,GAAG,GAAG,qBAAqB,IAAI,CAAC;AAC/C,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;AAK1C,mFAAmF;AACnF,MAAM,OAAO,UAAU;IACrB,yFAAyF;IACxE,QAAQ,GAA6D;QACpF,OAAO,EAAE,IAAI,mBAAmB,CAAC,UAAU,CAAC;QAC5C,MAAM,EAAE,IAAI,mBAAmB,CAAC,UAAU,CAAC;KAC5C,CAAC;IAEF,sDAAsD;IACtD,IAAI,OAAO;QACT,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACtE,CAAC;IAED,2FAA2F;IAC3F,IAAI,CAAC,OAA0B,EAAE,KAAa;QAC5C,IAAI,IAAI,CAAC,OAAO;YAAE,OAAO,KAAK,CAAC,CAAC,4CAA4C;QAC5E,OAAO,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC5C,CAAC;IAED,2FAA2F;IAC3F,eAAe,CAAC,QAAgB;QAC9B,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;IAChF,CAAC;CACF"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * A keyed cache for probe results that stays bounded for a long-lived host. Implements the
3
+ * per-process version and capability caches of PRD §9.2 (C-PERF-02) and the
4
+ * never-cache-a-rejection rule of C-LIFE-11.
5
+ */
6
+ export type ProbeCache<T> = {
7
+ /** The cached or in-flight result for `key`, else the result of a new `run()`. */
8
+ readonly get: (key: string, run: () => Promise<T>) => Promise<T>;
9
+ readonly clear: () => void;
10
+ };
11
+ /**
12
+ * Concurrent callers for one key share its single in-flight run, which is never evicted. Only
13
+ * the `maxSettledSuccesses` most recently used SUCCESSES are kept once settled; the least
14
+ * recently used goes first. In-flight runs do not count toward that bound. A rejection, or a value `succeeded` refuses (a probe that resolves with its failure),
15
+ * is never kept, so a failure cannot poison later callers. A run that settles after `clear()`
16
+ * is dropped rather than cached.
17
+ */
18
+ export declare function createProbeCache<T>(maxSettledSuccesses: number, succeeded?: (value: T) => boolean): ProbeCache<T>;
19
+ //# sourceMappingURL=probe-cache.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"probe-cache.d.ts","sourceRoot":"","sources":["../../src/runtime/probe-cache.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,MAAM,UAAU,CAAC,CAAC,IAAI;IAC1B,kFAAkF;IAClF,QAAQ,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC;IACjE,QAAQ,CAAC,KAAK,EAAE,MAAM,IAAI,CAAC;CAC5B,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAChC,mBAAmB,EAAE,MAAM,EAC3B,SAAS,GAAE,CAAC,KAAK,EAAE,CAAC,KAAK,OAAoB,GAC5C,UAAU,CAAC,CAAC,CAAC,CAwCf"}
@@ -0,0 +1,56 @@
1
+ /**
2
+ * A keyed cache for probe results that stays bounded for a long-lived host. Implements the
3
+ * per-process version and capability caches of PRD §9.2 (C-PERF-02) and the
4
+ * never-cache-a-rejection rule of C-LIFE-11.
5
+ */
6
+ /**
7
+ * Concurrent callers for one key share its single in-flight run, which is never evicted. Only
8
+ * the `maxSettledSuccesses` most recently used SUCCESSES are kept once settled; the least
9
+ * recently used goes first. In-flight runs do not count toward that bound. A rejection, or a value `succeeded` refuses (a probe that resolves with its failure),
10
+ * is never kept, so a failure cannot poison later callers. A run that settles after `clear()`
11
+ * is dropped rather than cached.
12
+ */
13
+ export function createProbeCache(maxSettledSuccesses, succeeded = () => true) {
14
+ const running = new Map();
15
+ // Map order is recency order: a hit is re-inserted at the end, eviction takes the front.
16
+ const settled = new Map();
17
+ const get = (key, run) => {
18
+ const hit = settled.get(key);
19
+ if (hit) {
20
+ settled.delete(key);
21
+ settled.set(key, hit);
22
+ return Promise.resolve(hit.value);
23
+ }
24
+ const existing = running.get(key);
25
+ if (existing)
26
+ return existing;
27
+ const pending = run();
28
+ running.set(key, pending);
29
+ const current = () => running.get(key) === pending;
30
+ pending.then((value) => {
31
+ if (!current())
32
+ return;
33
+ running.delete(key);
34
+ if (!succeeded(value))
35
+ return;
36
+ settled.set(key, { value });
37
+ for (const oldest of settled.keys()) {
38
+ if (settled.size <= maxSettledSuccesses)
39
+ break;
40
+ settled.delete(oldest);
41
+ }
42
+ }, () => {
43
+ if (current())
44
+ running.delete(key);
45
+ });
46
+ return pending;
47
+ };
48
+ return {
49
+ get,
50
+ clear: () => {
51
+ running.clear();
52
+ settled.clear();
53
+ },
54
+ };
55
+ }
56
+ //# sourceMappingURL=probe-cache.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"probe-cache.js","sourceRoot":"","sources":["../../src/runtime/probe-cache.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAQH;;;;;;GAMG;AACH,MAAM,UAAU,gBAAgB,CAC9B,mBAA2B,EAC3B,YAAmC,GAAG,EAAE,CAAC,IAAI;IAE7C,MAAM,OAAO,GAAG,IAAI,GAAG,EAAsB,CAAC;IAC9C,yFAAyF;IACzF,MAAM,OAAO,GAAG,IAAI,GAAG,EAAiC,CAAC;IACzD,MAAM,GAAG,GAAG,CAAC,GAAW,EAAE,GAAqB,EAAc,EAAE;QAC7D,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAC7B,IAAI,GAAG,EAAE,CAAC;YACR,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YACpB,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;YACtB,OAAO,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QACpC,CAAC;QACD,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAClC,IAAI,QAAQ;YAAE,OAAO,QAAQ,CAAC;QAC9B,MAAM,OAAO,GAAG,GAAG,EAAE,CAAC;QACtB,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;QAC1B,MAAM,OAAO,GAAG,GAAG,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,OAAO,CAAC;QACnD,OAAO,CAAC,IAAI,CACV,CAAC,KAAK,EAAE,EAAE;YACR,IAAI,CAAC,OAAO,EAAE;gBAAE,OAAO;YACvB,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YACpB,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC;gBAAE,OAAO;YAC9B,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;YAC5B,KAAK,MAAM,MAAM,IAAI,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC;gBACpC,IAAI,OAAO,CAAC,IAAI,IAAI,mBAAmB;oBAAE,MAAM;gBAC/C,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;YACzB,CAAC;QACH,CAAC,EACD,GAAG,EAAE;YACH,IAAI,OAAO,EAAE;gBAAE,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QACrC,CAAC,CACF,CAAC;QACF,OAAO,OAAO,CAAC;IACjB,CAAC,CAAC;IACF,OAAO;QACL,GAAG;QACH,KAAK,EAAE,GAAG,EAAE;YACV,OAAO,CAAC,KAAK,EAAE,CAAC;YAChB,OAAO,CAAC,KAAK,EAAE,CAAC;QAClB,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Shared hook-backed initial-readiness marker with a starvation deadline.
2
+ * Shared hook-backed initial-readiness marker with a two-stage starvation deadline.
3
3
  * Implements PRD §5.3/§9.4, C-API-19, and C-API-28.
4
4
  *
5
5
  * On a COLD start both adapters gate the first queued message on a pre-input
@@ -15,7 +15,8 @@
15
15
  * Claude's `InstructionsLoaded` DOES re-fire — so a resumed Claude is a hook/composer
16
16
  * race, whichever arrives first (readiness is idempotent). `armDeadline` is the ultimate
17
17
  * fallback for both start and resume so a missing readiness signal never starves the
18
- * queue forever.
18
+ * queue forever: its deadline marks onto a configured composer, and its backstop marks
19
+ * regardless.
19
20
  */
20
21
  export type InitialReady = {
21
22
  /** Permanently cancel readiness, including frames drained after process exit. */
@@ -25,8 +26,9 @@ export type InitialReady = {
25
26
  /** Fire readiness now (one-shot) — the pre-input readiness hook path. */
26
27
  readonly mark: () => void;
27
28
  /**
28
- * Re-attempt a deferred hook/deadline mark once the composite readiness hold
29
- * releases: a dialog must clear to a nonblocking idle composer (C-API-28).
29
+ * Per rendered frame: re-attempt a hook/deadline mark the composite readiness hold
30
+ * deferred, once it releases (a dialog must clear to a nonblocking idle composer), or
31
+ * a deadline mark still waiting for a configured composer (C-API-28).
30
32
  */
31
33
  readonly retryWhenReleased: (readinessHeld: boolean) => void;
32
34
  };
@@ -47,5 +49,29 @@ export type ComposerReadyFacts = {
47
49
  * composer stays an unsafe signal there (C-API-28).
48
50
  */
49
51
  export declare function markReadyOnResumeComposer(ready: Pick<InitialReady, "mark">, resumed: boolean, facts: ComposerReadyFacts, readinessHeld?: boolean): void;
50
- export declare function initialReady(callback: () => void, maxWaitMs?: number, isReadinessHeld?: () => boolean): InitialReady;
52
+ /**
53
+ * Twice the longest measured Codex 0.164 trust-gate delay (30.6 s after first output,
54
+ * docs/cli-behavior.md): readiness without a configured composer this long after the
55
+ * first frame is no longer racing a late gate (C-API-28).
56
+ */
57
+ export declare const initialBackstopMs = 60000;
58
+ /** An adapter's evidence that a rendered composer belongs to a configured session. */
59
+ export type ConfiguredComposerEvidence = {
60
+ /** The latest frame shows a configured session's composer outside any blocking dialog. */
61
+ readonly shown: () => boolean;
62
+ /** Readiness was released after the backstop without that composer on screen. */
63
+ readonly onBackstopRelease: () => void;
64
+ readonly backstopMs?: number;
65
+ };
66
+ /**
67
+ * With `composer` evidence, the initial deadline marks only onto a frame showing a
68
+ * configured session's composer: a CLI that has not configured its session is still
69
+ * booting, and under load can paint a trust gate after the deadline, so an earlier mark
70
+ * would drain the queue into the boot screen or that gate. A deadline that expires first
71
+ * waits for that frame, and the backstop after the first frame marks anyway, so an
72
+ * unrecognized composer delays readiness but never starves it. A release after the
73
+ * backstop without that composer is reported once through `onBackstopRelease`, so a host
74
+ * can tell it from ordinary readiness (C-API-28).
75
+ */
76
+ export declare function initialReady(callback: () => void, initialDeadlineMs?: number, isReadinessHeld?: () => boolean, composer?: ConfiguredComposerEvidence): InitialReady;
51
77
  //# sourceMappingURL=initial-ready.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"initial-ready.d.ts","sourceRoot":"","sources":["../../../src/runtime/readiness/initial-ready.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,MAAM,MAAM,YAAY,GAAG;IACzB,iFAAiF;IACjF,QAAQ,CAAC,MAAM,EAAE,MAAM,IAAI,CAAC;IAC5B,QAAQ,CAAC,MAAM,EAAE,MAAM,IAAI,CAAC;IAC5B,QAAQ,CAAC,WAAW,EAAE,MAAM,IAAI,CAAC;IACjC,yEAAyE;IACzE,QAAQ,CAAC,IAAI,EAAE,MAAM,IAAI,CAAC;IAC1B;;;OAGG;IACH,QAAQ,CAAC,iBAAiB,EAAE,CAAC,aAAa,EAAE,OAAO,KAAK,IAAI,CAAC;CAC9D,CAAC;AAEF,4EAA4E;AAC5E,MAAM,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,CAAC,gBAAgB,EAAE,OAAO,CAAC;IACnC,sFAAsF;IACtF,QAAQ,CAAC,eAAe,CAAC,EAAE,OAAO,CAAC;IACnC,QAAQ,CAAC,uBAAuB,EAAE,OAAO,CAAC;CAC3C,CAAC;AAEF;;;;;;;;GAQG;AACH,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,IAAI,CAAC,YAAY,EAAE,MAAM,CAAC,EACjC,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,kBAAkB,EACzB,aAAa,UAAQ,GACpB,IAAI,CAGN;AAED,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,MAAM,IAAI,EACpB,SAAS,SAAS,EAClB,eAAe,GAAE,MAAM,OAAqB,GAC3C,YAAY,CA+Cd"}
1
+ {"version":3,"file":"initial-ready.d.ts","sourceRoot":"","sources":["../../../src/runtime/readiness/initial-ready.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,MAAM,MAAM,YAAY,GAAG;IACzB,iFAAiF;IACjF,QAAQ,CAAC,MAAM,EAAE,MAAM,IAAI,CAAC;IAC5B,QAAQ,CAAC,MAAM,EAAE,MAAM,IAAI,CAAC;IAC5B,QAAQ,CAAC,WAAW,EAAE,MAAM,IAAI,CAAC;IACjC,yEAAyE;IACzE,QAAQ,CAAC,IAAI,EAAE,MAAM,IAAI,CAAC;IAC1B;;;;OAIG;IACH,QAAQ,CAAC,iBAAiB,EAAE,CAAC,aAAa,EAAE,OAAO,KAAK,IAAI,CAAC;CAC9D,CAAC;AAEF,4EAA4E;AAC5E,MAAM,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,CAAC,gBAAgB,EAAE,OAAO,CAAC;IACnC,sFAAsF;IACtF,QAAQ,CAAC,eAAe,CAAC,EAAE,OAAO,CAAC;IACnC,QAAQ,CAAC,uBAAuB,EAAE,OAAO,CAAC;CAC3C,CAAC;AAEF;;;;;;;;GAQG;AACH,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,IAAI,CAAC,YAAY,EAAE,MAAM,CAAC,EACjC,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,kBAAkB,EACzB,aAAa,UAAQ,GACpB,IAAI,CAGN;AAED;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,QAAS,CAAC;AAExC,sFAAsF;AACtF,MAAM,MAAM,0BAA0B,GAAG;IACvC,0FAA0F;IAC1F,QAAQ,CAAC,KAAK,EAAE,MAAM,OAAO,CAAC;IAC9B,iFAAiF;IACjF,QAAQ,CAAC,iBAAiB,EAAE,MAAM,IAAI,CAAC;IACvC,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;CAC9B,CAAC;AAEF;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,MAAM,IAAI,EACpB,iBAAiB,SAAS,EAC1B,eAAe,GAAE,MAAM,OAAqB,EAC5C,QAAQ,CAAC,EAAE,0BAA0B,GACpC,YAAY,CAyEd"}
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Shared hook-backed initial-readiness marker with a starvation deadline.
2
+ * Shared hook-backed initial-readiness marker with a two-stage starvation deadline.
3
3
  * Implements PRD §5.3/§9.4, C-API-19, and C-API-28.
4
4
  *
5
5
  * On a COLD start both adapters gate the first queued message on a pre-input
@@ -15,7 +15,8 @@
15
15
  * Claude's `InstructionsLoaded` DOES re-fire — so a resumed Claude is a hook/composer
16
16
  * race, whichever arrives first (readiness is idempotent). `armDeadline` is the ultimate
17
17
  * fallback for both start and resume so a missing readiness signal never starves the
18
- * queue forever.
18
+ * queue forever: its deadline marks onto a configured composer, and its backstop marks
19
+ * regardless.
19
20
  */
20
21
  /**
21
22
  * On RESUME, mark readiness on the first genuine composer frame: the composer is
@@ -30,11 +31,45 @@ export function markReadyOnResumeComposer(ready, resumed, facts, readinessHeld =
30
31
  if (resumed && facts.composer_visible && !facts.blocking_prompt_visible && !readinessHeld)
31
32
  ready.mark();
32
33
  }
33
- export function initialReady(callback, maxWaitMs = 10_000, isReadinessHeld = () => false) {
34
+ /**
35
+ * Twice the longest measured Codex 0.164 trust-gate delay (30.6 s after first output,
36
+ * docs/cli-behavior.md): readiness without a configured composer this long after the
37
+ * first frame is no longer racing a late gate (C-API-28).
38
+ */
39
+ export const initialBackstopMs = 60_000;
40
+ /**
41
+ * With `composer` evidence, the initial deadline marks only onto a frame showing a
42
+ * configured session's composer: a CLI that has not configured its session is still
43
+ * booting, and under load can paint a trust gate after the deadline, so an earlier mark
44
+ * would drain the queue into the boot screen or that gate. A deadline that expires first
45
+ * waits for that frame, and the backstop after the first frame marks anyway, so an
46
+ * unrecognized composer delays readiness but never starves it. A release after the
47
+ * backstop without that composer is reported once through `onBackstopRelease`, so a host
48
+ * can tell it from ordinary readiness (C-API-28).
49
+ */
50
+ export function initialReady(callback, initialDeadlineMs = 10_000, isReadinessHeld = () => false, composer) {
51
+ const isComposerConfigured = () => composer === undefined || composer.shown();
34
52
  let ready = false;
35
53
  let cancelled = false;
36
54
  let deferredByHold = false;
55
+ let awaitingComposer = false;
56
+ let backstopFired = false;
37
57
  let deadline;
58
+ let backstop;
59
+ /**
60
+ * Timer marks are contained. A mark whose callback throws leaves `ready` false; a later
61
+ * readiness hook, or for the deadline the backstop, retries it.
62
+ */
63
+ const markFromTimer = (composerRequired) => {
64
+ try {
65
+ awaitingComposer = composerRequired && !isComposerConfigured();
66
+ if (!awaitingComposer)
67
+ mark();
68
+ }
69
+ catch {
70
+ // Retried by a later readiness hook or timer, as above.
71
+ }
72
+ };
38
73
  const mark = () => {
39
74
  if (ready || cancelled)
40
75
  return;
@@ -47,39 +82,50 @@ export function initialReady(callback, maxWaitMs = 10_000, isReadinessHeld = ()
47
82
  return;
48
83
  }
49
84
  deferredByHold = false;
85
+ const withoutComposer = composer !== undefined && backstopFired && !composer.shown();
50
86
  // Latch AFTER the callback returns, so if it throws (a throwing status/activity
51
87
  // listener) readiness is NOT consumed and a later hook/deadline/frame retries —
52
88
  // a failed transition must never permanently starve the queue (C-API-28).
53
89
  callback();
54
90
  ready = true;
91
+ clearTimeout(deadline);
92
+ clearTimeout(backstop);
93
+ try {
94
+ if (withoutComposer)
95
+ composer.onBackstopRelease();
96
+ }
97
+ catch {
98
+ // A failing warning sink must not undo or block the readiness just released.
99
+ }
55
100
  };
56
101
  return {
57
102
  cancel: () => {
58
103
  cancelled = true;
59
- if (deadline)
60
- clearTimeout(deadline);
104
+ clearTimeout(deadline);
105
+ clearTimeout(backstop);
61
106
  },
62
107
  mark,
63
108
  retryWhenReleased: (readinessHeld) => {
64
- if (!ready && deferredByHold && !readinessHeld)
109
+ if (ready || readinessHeld)
110
+ return;
111
+ // A hold-deferred mark retries once the hold releases; a deadline that expired
112
+ // before the configured composer retries on the first frame showing it, even
113
+ // while work is on screen.
114
+ if (deferredByHold || (awaitingComposer && isComposerConfigured()))
65
115
  mark();
66
116
  },
67
117
  replay: () => void (!cancelled && ready && callback()),
68
118
  // Arms on the first frame regardless of hook arrival, so a missing or failed
69
- // readiness hook cannot starve readiness forever. The deadline's mark is contained
70
- // (a throwing callback on a timer would otherwise be an uncaught exception); if it
71
- // fails, `ready` stays false so a later hook or composer frame still retries.
119
+ // readiness hook cannot starve readiness forever. Timer marks are contained (a
120
+ // throwing callback on a timer would otherwise be an uncaught exception).
72
121
  armDeadline: () => {
73
- if (cancelled)
122
+ if (cancelled || ready)
74
123
  return;
75
- deadline ??= setTimeout(() => {
76
- try {
77
- mark();
78
- }
79
- catch {
80
- // Retried by a subsequent readiness hook or rendered composer frame.
81
- }
82
- }, maxWaitMs);
124
+ deadline ??= setTimeout(() => markFromTimer(true), initialDeadlineMs);
125
+ backstop ??= setTimeout(() => {
126
+ backstopFired = true;
127
+ markFromTimer(false);
128
+ }, composer?.backstopMs ?? initialBackstopMs);
83
129
  },
84
130
  };
85
131
  }