@prestyj/cli 5.28.0 → 5.29.0

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 (398) hide show
  1. package/README.md +2 -2
  2. package/assets/motion/THIRD-PARTY.md +14 -19
  3. package/assets/motion/bin/contact-sheet.mjs +9 -3
  4. package/assets/motion/bin/cues.mjs +337 -0
  5. package/assets/motion/bin/flash-check.mjs +314 -0
  6. package/assets/motion/bin/fonts.mjs +17 -13
  7. package/assets/motion/bin/library.mjs +61 -18
  8. package/assets/motion/bin/motion-blur.mjs +943 -0
  9. package/assets/motion/bin/motion-check.mjs +366 -9
  10. package/assets/motion/bin/music-fit.mjs +436 -0
  11. package/assets/motion/bin/pdf-extract.mjs +22 -10
  12. package/assets/motion/bin/reference-study.mjs +346 -0
  13. package/assets/motion/bin/score-synth.mjs +1052 -93
  14. package/assets/motion/fonts/finger-paint/OFL.txt +93 -0
  15. package/assets/motion/fonts/finger-paint/finger-paint-normal.woff2 +0 -0
  16. package/assets/motion/fonts/fonts.json +56 -0
  17. package/assets/motion/fonts/short-stack/OFL.txt +94 -0
  18. package/assets/motion/fonts/short-stack/short-stack-normal.woff2 +0 -0
  19. package/assets/motion/fonts/sora/OFL.txt +93 -0
  20. package/assets/motion/fonts/sora/sora-normal.woff2 +0 -0
  21. package/assets/motion/fonts/specimen.jpg +0 -0
  22. package/assets/motion/fonts/unbounded/OFL.txt +93 -0
  23. package/assets/motion/fonts/unbounded/unbounded-normal.woff2 +0 -0
  24. package/assets/motion/library/README.md +52 -14
  25. package/assets/motion/library/kit/moves.js +1981 -0
  26. package/assets/motion/library/library.json +232 -0
  27. package/assets/motion/library/pieces/camera-rig/meta.json +13 -0
  28. package/assets/motion/library/pieces/camera-rig/piece.html +153 -0
  29. package/assets/motion/library/pieces/camera-rig/preview.jpg +0 -0
  30. package/assets/motion/library/pieces/chain-knock/meta.json +13 -0
  31. package/assets/motion/library/pieces/chain-knock/piece.html +195 -0
  32. package/assets/motion/library/pieces/chain-knock/preview.jpg +0 -0
  33. package/assets/motion/library/pieces/gather-to-logo/meta.json +13 -0
  34. package/assets/motion/library/pieces/gather-to-logo/piece.html +159 -0
  35. package/assets/motion/library/pieces/gather-to-logo/preview.jpg +0 -0
  36. package/assets/motion/library/pieces/morph-carry/meta.json +13 -0
  37. package/assets/motion/library/pieces/morph-carry/piece.html +173 -0
  38. package/assets/motion/library/pieces/morph-carry/preview.jpg +0 -0
  39. package/assets/motion/library/pieces/one-shape-journey/meta.json +13 -0
  40. package/assets/motion/library/pieces/one-shape-journey/piece.html +195 -0
  41. package/assets/motion/library/pieces/one-shape-journey/preview.jpg +0 -0
  42. package/assets/motion/library/pieces/open-from-subject/meta.json +13 -0
  43. package/assets/motion/library/pieces/open-from-subject/piece.html +168 -0
  44. package/assets/motion/library/pieces/open-from-subject/preview.jpg +0 -0
  45. package/assets/motion/library/pieces/request-to-result/meta.json +13 -0
  46. package/assets/motion/library/pieces/request-to-result/piece.html +212 -0
  47. package/assets/motion/library/pieces/request-to-result/preview.jpg +0 -0
  48. package/assets/motion/library/pieces/scale-dive/meta.json +13 -0
  49. package/assets/motion/library/pieces/scale-dive/piece.html +321 -0
  50. package/assets/motion/library/pieces/scale-dive/preview.jpg +0 -0
  51. package/assets/motion/library/pieces/screen-replica-steps/meta.json +13 -0
  52. package/assets/motion/library/pieces/screen-replica-steps/piece.html +366 -0
  53. package/assets/motion/library/pieces/screen-replica-steps/preview.jpg +0 -0
  54. package/assets/motion/library/pieces/zoom-into-card/meta.json +13 -0
  55. package/assets/motion/library/pieces/zoom-into-card/piece.html +179 -0
  56. package/assets/motion/library/pieces/zoom-into-card/preview.jpg +0 -0
  57. package/assets/motion/library/sheets/diagram.jpg +0 -0
  58. package/assets/motion/library/sheets/frame.jpg +0 -0
  59. package/assets/motion/library/sheets/transition.jpg +0 -0
  60. package/assets/motion/library/sheets/ui.jpg +0 -0
  61. package/assets/motion/plugin.json +1 -1
  62. package/assets/motion/references/build-sheet.md +206 -0
  63. package/assets/motion/references/runtime/determinism-rules.md +3 -3
  64. package/assets/motion/references/runtime/gsap-easing-and-stagger.md +28 -28
  65. package/assets/motion/references/runtime/gsap.md +3 -3
  66. package/assets/motion/references/runtime/inputs-and-assets.md +21 -16
  67. package/assets/motion/references/runtime/lint-validate-inspect.md +3 -3
  68. package/assets/motion/references/runtime/minimal-composition.md +6 -0
  69. package/assets/motion/references/runtime/preview-render.md +3 -3
  70. package/assets/motion/skills/app-walkthrough/SKILL.md +66 -0
  71. package/assets/motion/skills/before-after/SKILL.md +53 -0
  72. package/assets/motion/skills/brand-kit/SKILL.md +17 -16
  73. package/assets/motion/skills/dev-tool-video/SKILL.md +57 -0
  74. package/assets/motion/skills/launch-video/SKILL.md +62 -0
  75. package/assets/motion/skills/match-reference/SKILL.md +58 -0
  76. package/assets/motion/skills/motion/SKILL.md +167 -98
  77. package/assets/motion/skills/source-ingest/SKILL.md +23 -15
  78. package/assets/motion/skills/website-video/SKILL.md +59 -0
  79. package/assets/skills/bulletproof/SKILL.md +36 -11
  80. package/assets/skills/bulletproof/references/agent-surface.md +19 -9
  81. package/assets/skills/bulletproof/references/audit-protocol.md +20 -5
  82. package/assets/skills/bulletproof/references/platform-playbooks.md +5 -4
  83. package/assets/skills/bulletproof/references/provenance.md +26 -1
  84. package/assets/skills/bulletproof/references/secure-defaults.md +6 -5
  85. package/assets/skills/bulletproof/references/supply-chain.md +21 -17
  86. package/assets/skills/bulletproof/references/threat-landscape.md +28 -26
  87. package/assets/skills/bulletproof/references/verification.md +2 -0
  88. package/assets/skills/clarify/SKILL.md +25 -16
  89. package/assets/skills/code-review/SKILL.md +71 -13
  90. package/assets/skills/code-review/references/agent-diffs.md +27 -0
  91. package/assets/skills/code-review/references/tests.md +19 -0
  92. package/assets/skills/compliance-guard/SKILL.md +20 -5
  93. package/assets/skills/compliance-guard/references/artifacts.md +1 -1
  94. package/assets/skills/compliance-guard/references/eu-uk.md +16 -16
  95. package/assets/skills/compliance-guard/references/lawsuit-vectors.md +5 -5
  96. package/assets/skills/compliance-guard/references/provenance.md +41 -2
  97. package/assets/skills/compliance-guard/references/sector-gates.md +3 -3
  98. package/assets/skills/compliance-guard/references/security-baseline.md +2 -2
  99. package/assets/skills/compliance-guard/references/trigger-map.md +5 -5
  100. package/assets/skills/compliance-guard/references/us.md +27 -21
  101. package/assets/skills/durable/SKILL.md +87 -79
  102. package/assets/skills/durable/references/agent-db-safety.md +69 -0
  103. package/assets/skills/durable/references/backups-and-runtime.md +19 -12
  104. package/assets/skills/durable/references/migrations-and-schema.md +13 -6
  105. package/assets/skills/evidence-led-ui/SKILL.md +69 -127
  106. package/assets/skills/evidence-led-ui/references/anti-defaults.md +107 -208
  107. package/assets/skills/evidence-led-ui/references/direction.md +124 -0
  108. package/assets/skills/evidence-led-ui/references/production-contract.md +8 -0
  109. package/assets/skills/evidence-led-ui/references/provenance.md +24 -1
  110. package/assets/skills/lean/SKILL.md +90 -71
  111. package/assets/skills/lean/references/memory-and-processes.md +3 -2
  112. package/assets/skills/lean/references/playbooks.md +37 -12
  113. package/assets/skills/refactoring/SKILL.md +24 -3
  114. package/assets/skills/refactoring/references/agent-pitfalls.md +4 -1
  115. package/assets/skills/refactoring/references/legacy.md +21 -0
  116. package/assets/skills/root-cause/SKILL.md +20 -10
  117. package/assets/skills/shared-language/SKILL.md +16 -14
  118. package/assets/skills/tdd/SKILL.md +27 -15
  119. package/dist/app-sidecar.js +203 -47
  120. package/dist/app-sidecar.js.map +1 -1
  121. package/dist/cli.js +20 -28
  122. package/dist/cli.js.map +1 -1
  123. package/dist/core/acceptance-checks.d.ts +48 -0
  124. package/dist/core/acceptance-checks.js +144 -0
  125. package/dist/core/acceptance-checks.js.map +1 -0
  126. package/dist/core/agent-session.d.ts +119 -75
  127. package/dist/core/agent-session.js +561 -395
  128. package/dist/core/agent-session.js.map +1 -1
  129. package/dist/core/agents.d.ts +6 -5
  130. package/dist/core/agents.js +12 -3
  131. package/dist/core/agents.js.map +1 -1
  132. package/dist/core/ask-user.d.ts +90 -8
  133. package/dist/core/ask-user.js +124 -13
  134. package/dist/core/ask-user.js.map +1 -1
  135. package/dist/core/auth-providers.js +1 -1
  136. package/dist/core/auth-providers.js.map +1 -1
  137. package/dist/core/autopilot-verdict.d.ts +5 -1
  138. package/dist/core/autopilot-verdict.js +30 -13
  139. package/dist/core/autopilot-verdict.js.map +1 -1
  140. package/dist/core/bundled-agents.js +1 -3
  141. package/dist/core/bundled-agents.js.map +1 -1
  142. package/dist/core/cache-diagnostics.d.ts +68 -0
  143. package/dist/core/cache-diagnostics.js +196 -0
  144. package/dist/core/cache-diagnostics.js.map +1 -0
  145. package/dist/core/cache-expiry.d.ts +87 -0
  146. package/dist/core/cache-expiry.js +111 -0
  147. package/dist/core/cache-expiry.js.map +1 -0
  148. package/dist/core/compaction/compactor.js +78 -48
  149. package/dist/core/compaction/compactor.js.map +1 -1
  150. package/dist/core/compaction/plan-step-policy.d.ts +46 -0
  151. package/dist/core/compaction/plan-step-policy.js +57 -0
  152. package/dist/core/compaction/plan-step-policy.js.map +1 -0
  153. package/dist/core/destructive-git-guard.d.ts +90 -0
  154. package/dist/core/destructive-git-guard.js +871 -0
  155. package/dist/core/destructive-git-guard.js.map +1 -0
  156. package/dist/core/event-bus.d.ts +3 -0
  157. package/dist/core/event-bus.js +5 -0
  158. package/dist/core/event-bus.js.map +1 -1
  159. package/dist/core/fast-apply-benchmark.d.ts +1 -1
  160. package/dist/core/fast-apply-benchmark.js +2 -2
  161. package/dist/core/fast-apply-benchmark.js.map +1 -1
  162. package/dist/core/injection-detect.d.ts +38 -0
  163. package/dist/core/injection-detect.js +232 -0
  164. package/dist/core/injection-detect.js.map +1 -0
  165. package/dist/core/keep-awake.d.ts +88 -0
  166. package/dist/core/keep-awake.js +251 -0
  167. package/dist/core/keep-awake.js.map +1 -0
  168. package/dist/core/mcp/client.d.ts +72 -0
  169. package/dist/core/mcp/client.js +264 -41
  170. package/dist/core/mcp/client.js.map +1 -1
  171. package/dist/core/mcp/content.js +6 -2
  172. package/dist/core/mcp/content.js.map +1 -1
  173. package/dist/core/mcp/store.d.ts +6 -1
  174. package/dist/core/mcp/store.js +12 -1
  175. package/dist/core/mcp/store.js.map +1 -1
  176. package/dist/core/mcp/types.d.ts +18 -0
  177. package/dist/core/model-unavailable.d.ts +14 -0
  178. package/dist/core/model-unavailable.js +23 -0
  179. package/dist/core/model-unavailable.js.map +1 -0
  180. package/dist/core/node-debugger.d.ts +148 -0
  181. package/dist/core/node-debugger.js +642 -0
  182. package/dist/core/node-debugger.js.map +1 -0
  183. package/dist/core/nolan-context.d.ts +7 -5
  184. package/dist/core/nolan-context.js +106 -16
  185. package/dist/core/nolan-context.js.map +1 -1
  186. package/dist/core/nolan-prompt.js +24 -21
  187. package/dist/core/nolan-prompt.js.map +1 -1
  188. package/dist/core/package-threats.d.ts +18 -0
  189. package/dist/core/package-threats.js +168 -0
  190. package/dist/core/package-threats.js.map +1 -0
  191. package/dist/core/persistent-shell.d.ts +58 -6
  192. package/dist/core/persistent-shell.js +331 -49
  193. package/dist/core/persistent-shell.js.map +1 -1
  194. package/dist/core/process-manager.d.ts +14 -0
  195. package/dist/core/process-manager.js +61 -0
  196. package/dist/core/process-manager.js.map +1 -1
  197. package/dist/core/progress/git-xp.js +8 -14
  198. package/dist/core/progress/git-xp.js.map +1 -1
  199. package/dist/core/project-discovery.js +77 -26
  200. package/dist/core/project-discovery.js.map +1 -1
  201. package/dist/core/semantic-search-benchmark.d.ts +1 -1
  202. package/dist/core/semantic-search-benchmark.js +2 -2
  203. package/dist/core/semantic-search-benchmark.js.map +1 -1
  204. package/dist/core/session-history.d.ts +12 -0
  205. package/dist/core/session-history.js +27 -0
  206. package/dist/core/session-history.js.map +1 -1
  207. package/dist/core/session-manager.d.ts +13 -1
  208. package/dist/core/session-manager.js +38 -18
  209. package/dist/core/session-manager.js.map +1 -1
  210. package/dist/core/session-summary-index.d.ts +37 -0
  211. package/dist/core/session-summary-index.js +172 -0
  212. package/dist/core/session-summary-index.js.map +1 -0
  213. package/dist/core/settings-manager.d.ts +2 -0
  214. package/dist/core/settings-manager.js +10 -0
  215. package/dist/core/settings-manager.js.map +1 -1
  216. package/dist/core/shell-threats-popular-packages.d.ts +11 -0
  217. package/dist/core/shell-threats-popular-packages.js +675 -0
  218. package/dist/core/shell-threats-popular-packages.js.map +1 -0
  219. package/dist/core/shell-threats.d.ts +8 -0
  220. package/dist/core/shell-threats.js +186 -0
  221. package/dist/core/shell-threats.js.map +1 -0
  222. package/dist/core/skills.js +16 -4
  223. package/dist/core/skills.js.map +1 -1
  224. package/dist/core/stream-rules.d.ts +30 -0
  225. package/dist/core/stream-rules.js +151 -0
  226. package/dist/core/stream-rules.js.map +1 -0
  227. package/dist/core/subagent-manager.d.ts +23 -6
  228. package/dist/core/subagent-manager.js +25 -9
  229. package/dist/core/subagent-manager.js.map +1 -1
  230. package/dist/core/subagent-policy.js +1 -1
  231. package/dist/core/subagent-policy.js.map +1 -1
  232. package/dist/core/subagent-receipt.d.ts +54 -0
  233. package/dist/core/subagent-receipt.js +276 -0
  234. package/dist/core/subagent-receipt.js.map +1 -0
  235. package/dist/core/subagent-turn-record.d.ts +2 -0
  236. package/dist/core/subagent-turn-record.js.map +1 -1
  237. package/dist/core/test-impact.d.ts +73 -0
  238. package/dist/core/test-impact.js +467 -0
  239. package/dist/core/test-impact.js.map +1 -0
  240. package/dist/core/thinking-level.d.ts +1 -1
  241. package/dist/core/thinking-level.js +1 -1
  242. package/dist/core/thinking-level.js.map +1 -1
  243. package/dist/core/verification-gate.d.ts +2 -0
  244. package/dist/core/verification-gate.js +4 -0
  245. package/dist/core/verification-gate.js.map +1 -1
  246. package/dist/core/verification-snapshot.js +3 -5
  247. package/dist/core/verification-snapshot.js.map +1 -1
  248. package/dist/core/workspace-guard.d.ts +18 -7
  249. package/dist/core/workspace-guard.js +227 -60
  250. package/dist/core/workspace-guard.js.map +1 -1
  251. package/dist/core/worktree-setup.d.ts +23 -0
  252. package/dist/core/worktree-setup.js +128 -9
  253. package/dist/core/worktree-setup.js.map +1 -1
  254. package/dist/core/worktree.d.ts +20 -2
  255. package/dist/core/worktree.js +74 -31
  256. package/dist/core/worktree.js.map +1 -1
  257. package/dist/interactive.js +2 -1
  258. package/dist/interactive.js.map +1 -1
  259. package/dist/modes/json-mode.js +11 -2
  260. package/dist/modes/json-mode.js.map +1 -1
  261. package/dist/modes/subagent-worker-mode.d.ts +36 -1
  262. package/dist/modes/subagent-worker-mode.js +100 -42
  263. package/dist/modes/subagent-worker-mode.js.map +1 -1
  264. package/dist/motion-agent/motion-agent.d.ts +7 -3
  265. package/dist/motion-agent/motion-agent.js +6 -8
  266. package/dist/motion-agent/motion-agent.js.map +1 -1
  267. package/dist/motion-agent/motion-prompt.d.ts +1 -1
  268. package/dist/motion-agent/motion-prompt.js +16 -25
  269. package/dist/motion-agent/motion-prompt.js.map +1 -1
  270. package/dist/motion-agent/motion-review-session.js +1 -1
  271. package/dist/motion-agent/motion-review-session.js.map +1 -1
  272. package/dist/motion-agent/motion-review.d.ts +10 -3
  273. package/dist/motion-agent/motion-review.js +15 -7
  274. package/dist/motion-agent/motion-review.js.map +1 -1
  275. package/dist/motion-agent/motion-studio-context.js +1 -1
  276. package/dist/motion-agent/motion-studio-context.js.map +1 -1
  277. package/dist/system-prompt.d.ts +2 -1
  278. package/dist/system-prompt.js +15 -4
  279. package/dist/system-prompt.js.map +1 -1
  280. package/dist/test-support/keep-alive.d.ts +14 -0
  281. package/dist/test-support/keep-alive.js +17 -0
  282. package/dist/test-support/keep-alive.js.map +1 -0
  283. package/dist/tools/ask-user.js +3 -3
  284. package/dist/tools/ask-user.js.map +1 -1
  285. package/dist/tools/bash-read-evidence.d.ts +10 -0
  286. package/dist/tools/bash-read-evidence.js +133 -0
  287. package/dist/tools/bash-read-evidence.js.map +1 -0
  288. package/dist/tools/bash.d.ts +10 -1
  289. package/dist/tools/bash.js +179 -7
  290. package/dist/tools/bash.js.map +1 -1
  291. package/dist/tools/debug.d.ts +54 -0
  292. package/dist/tools/debug.js +233 -0
  293. package/dist/tools/debug.js.map +1 -0
  294. package/dist/tools/edit.js +13 -5
  295. package/dist/tools/edit.js.map +1 -1
  296. package/dist/tools/goals.d.ts +1 -1
  297. package/dist/tools/index.d.ts +25 -2
  298. package/dist/tools/index.js +48 -7
  299. package/dist/tools/index.js.map +1 -1
  300. package/dist/tools/prompt-hints.js +2 -0
  301. package/dist/tools/prompt-hints.js.map +1 -1
  302. package/dist/tools/read-tracker.d.ts +35 -2
  303. package/dist/tools/read-tracker.js +108 -11
  304. package/dist/tools/read-tracker.js.map +1 -1
  305. package/dist/tools/read.js +39 -7
  306. package/dist/tools/read.js.map +1 -1
  307. package/dist/tools/skill.js +5 -0
  308. package/dist/tools/skill.js.map +1 -1
  309. package/dist/tools/subagent-control.js +44 -8
  310. package/dist/tools/subagent-control.js.map +1 -1
  311. package/dist/tools/subagent-shared.d.ts +48 -8
  312. package/dist/tools/subagent-shared.js +75 -14
  313. package/dist/tools/subagent-shared.js.map +1 -1
  314. package/dist/tools/subagent.d.ts +8 -2
  315. package/dist/tools/subagent.js +28 -10
  316. package/dist/tools/subagent.js.map +1 -1
  317. package/dist/tools/task-output.js +3 -2
  318. package/dist/tools/task-output.js.map +1 -1
  319. package/dist/tools/task-send.d.ts +1 -1
  320. package/dist/tools/task-send.js +15 -1
  321. package/dist/tools/task-send.js.map +1 -1
  322. package/dist/tools/tool-tiers.d.ts +2 -2
  323. package/dist/tools/tool-tiers.js +3 -2
  324. package/dist/tools/tool-tiers.js.map +1 -1
  325. package/dist/tools/truncate.d.ts +21 -0
  326. package/dist/tools/truncate.js +187 -0
  327. package/dist/tools/truncate.js.map +1 -1
  328. package/dist/tools/ui-adopt.js +2 -0
  329. package/dist/tools/ui-adopt.js.map +1 -1
  330. package/dist/tools/write.js +4 -3
  331. package/dist/tools/write.js.map +1 -1
  332. package/dist/ui/App.d.ts +0 -4
  333. package/dist/ui/App.js +5 -28
  334. package/dist/ui/App.js.map +1 -1
  335. package/dist/ui/components/ActivityIndicator.js +1 -0
  336. package/dist/ui/components/ActivityIndicator.js.map +1 -1
  337. package/dist/ui/components/Footer.js +1 -1
  338. package/dist/ui/components/Footer.js.map +1 -1
  339. package/dist/ui/hooks/useAgentLoop.d.ts +1 -8
  340. package/dist/ui/hooks/useAgentLoop.js +1 -119
  341. package/dist/ui/hooks/useAgentLoop.js.map +1 -1
  342. package/dist/ui/render.d.ts +2 -4
  343. package/dist/ui/render.js +3 -2
  344. package/dist/ui/render.js.map +1 -1
  345. package/dist/utils/git.d.ts +77 -0
  346. package/dist/utils/git.js +285 -21
  347. package/dist/utils/git.js.map +1 -1
  348. package/dist/utils/github-ci.js +2 -1
  349. package/dist/utils/github-ci.js.map +1 -1
  350. package/dist/utils/github.js +11 -9
  351. package/dist/utils/github.js.map +1 -1
  352. package/dist/utils/image.d.ts +14 -0
  353. package/dist/utils/image.js +16 -0
  354. package/dist/utils/image.js.map +1 -1
  355. package/dist/utils/process.d.ts +20 -0
  356. package/dist/utils/process.js +98 -0
  357. package/dist/utils/process.js.map +1 -1
  358. package/dist/utils/text.d.ts +12 -0
  359. package/dist/utils/text.js +11 -0
  360. package/dist/utils/text.js.map +1 -1
  361. package/package.json +6 -6
  362. package/assets/motion/skills/mixkit-split-text-617/SKILL.md +0 -115
  363. package/assets/motion/skills/mixkit-split-text-617/data/compositions/comp-480.json +0 -1
  364. package/assets/motion/skills/mixkit-split-text-617/data/compositions/comp-494.json +0 -1
  365. package/assets/motion/skills/mixkit-split-text-617/data/compositions/comp-5.json +0 -1
  366. package/assets/motion/skills/mixkit-split-text-617/data/compositions/comp-508.json +0 -1
  367. package/assets/motion/skills/mixkit-split-text-617/data/compositions/comp-6525.json +0 -1
  368. package/assets/motion/skills/mixkit-split-text-617/data/compositions/comp-6539.json +0 -1
  369. package/assets/motion/skills/mixkit-split-text-617/data/compositions/comp-6647.json +0 -1
  370. package/assets/motion/skills/mixkit-split-text-617/data/compositions/comp-6663.json +0 -1
  371. package/assets/motion/skills/mixkit-split-text-617/data/compositions/comp-6677.json +0 -1
  372. package/assets/motion/skills/mixkit-split-text-617/data/compositions/comp-6691.json +0 -1
  373. package/assets/motion/skills/mixkit-split-text-617/data/compositions/comp-6706.json +0 -1
  374. package/assets/motion/skills/mixkit-split-text-617/data/compositions/comp-6722.json +0 -1
  375. package/assets/motion/skills/mixkit-split-text-617/data/compositions/comp-6736.json +0 -1
  376. package/assets/motion/skills/mixkit-split-text-617/data/compositions/comp-6750.json +0 -1
  377. package/assets/motion/skills/mixkit-split-text-617/data/compositions/comp-6764.json +0 -1
  378. package/assets/motion/skills/mixkit-split-text-617/data/compositions/comp-6780.json +0 -1
  379. package/assets/motion/skills/mixkit-split-text-617/data/compositions/comp-6794.json +0 -1
  380. package/assets/motion/skills/mixkit-split-text-617/data/compositions/comp-6810.json +0 -1
  381. package/assets/motion/skills/mixkit-split-text-617/data/compositions/comp-6823.json +0 -1
  382. package/assets/motion/skills/mixkit-split-text-617/data/compositions/comp-6872.json +0 -1
  383. package/assets/motion/skills/mixkit-split-text-617/data/compositions/comp-6936.json +0 -1
  384. package/assets/motion/skills/mixkit-split-text-617/data/compositions/comp-76.json +0 -1
  385. package/assets/motion/skills/mixkit-split-text-617/data/manifest.json +0 -495
  386. package/assets/motion/skills/mixkit-split-text-617/references/RECONSTRUCTION.md +0 -201
  387. package/assets/motion/skills/mixkit-split-text-617/references/VERIFICATION.md +0 -107
  388. package/assets/motion/skills/mixkit-split-text-617/tools/inspect_motion.py +0 -130
  389. package/assets/motion/skills/video-qa/SKILL.md +0 -66
  390. package/dist/core/ideal-review-subagent.d.ts +0 -42
  391. package/dist/core/ideal-review-subagent.js +0 -95
  392. package/dist/core/ideal-review-subagent.js.map +0 -1
  393. package/dist/core/ideal-review.d.ts +0 -82
  394. package/dist/core/ideal-review.js +0 -242
  395. package/dist/core/ideal-review.js.map +0 -1
  396. package/dist/motion-agent/motion-check-tool.d.ts +0 -21
  397. package/dist/motion-agent/motion-check-tool.js +0 -206
  398. package/dist/motion-agent/motion-check-tool.js.map +0 -1
@@ -6,14 +6,89 @@
6
6
  * per call vs ~6.4ms for spawn-per-call (see bash-spawn-benchmark.ts), and —
7
7
  * the real win — cd/env/shell state survive across calls.
8
8
  *
9
- * POSIX-only (needs a real bash). Callers must fall back to spawn-per-call
10
- * when bash is unavailable (Windows cmd.exe fallback path).
9
+ * Losing that state silently is the failure mode this file guards against:
10
+ *
11
+ * - Timeout / abort stops only the running command: the shell gets SIGUSR1
12
+ * (its trap breaks out of the wrapper loop, so the rest of the command list
13
+ * is skipped) and every descendant of the shell is SIGTERM'd, then
14
+ * SIGKILL'd. The shell itself survives with its cwd/env. Only if it still
15
+ * has not printed the sentinel after a grace period (a builtin busy loop, a
16
+ * user trap) is the whole shell killed.
17
+ * - After every command the sentinel line snapshots the physical cwd and
18
+ * `export -p` to a private temp file (builtins + one redirect, no fork).
19
+ * - When the shell dies (`exit`, `kill -9 $$`, OOM, or the fallback kill
20
+ * above) a fresh shell is started at once and restored from that snapshot,
21
+ * and the result carries a one-line note saying so. The command that killed
22
+ * it is never re-run.
23
+ *
24
+ * Callers must fall back to spawn-per-call when bash is unavailable (Windows
25
+ * cmd.exe fallback path). On Windows (Git Bash) a command cannot be stopped
26
+ * without the shell — MSYS pids are not native pids and there are no POSIX
27
+ * signals — so timeout/abort still kills the shell tree, but the restart
28
+ * restores cwd/env the same way.
11
29
  */
12
30
  import { spawn } from "node:child_process";
13
31
  import { randomUUID } from "node:crypto";
32
+ import { mkdtempSync, readFileSync, rmSync } from "node:fs";
33
+ import os from "node:os";
34
+ import path from "node:path";
14
35
  import { sliceHead } from "@prestyj/ai";
15
36
  import { resolveShell } from "./shell.js";
16
- import { killProcessTree } from "../utils/process.js";
37
+ import { killProcessTree, listDescendantPids, signalDescendants } from "../utils/process.js";
38
+ /** How long a stopped command's shell gets to print its sentinel before it is killed. */
39
+ const INTERRUPT_GRACE_MS = 2_000;
40
+ /** Re-sweep for descendants the command forked after the first signal. */
41
+ const INTERRUPT_SWEEP_MS = 200;
42
+ /** Startup handshake / state restore of a freshly spawned shell. */
43
+ const SETUP_TIMEOUT_MS = 10_000;
44
+ /** Interrupt trap: `break` out of every loop, including the per-command wrapper loop. */
45
+ const SETUP_SCRIPT = "trap 'break 1000 2>/dev/null' USR1";
46
+ const stateDirs = new Set();
47
+ let exitHookInstalled = false;
48
+ function trackStateDir(dir) {
49
+ stateDirs.add(dir);
50
+ if (exitHookInstalled)
51
+ return;
52
+ exitHookInstalled = true;
53
+ process.once("exit", () => {
54
+ for (const d of stateDirs)
55
+ rmSync(d, { recursive: true, force: true });
56
+ });
57
+ }
58
+ /** Single-quote for bash. */
59
+ export function shellQuote(value) {
60
+ return `'${value.replace(/'/g, `'\\''`)}'`;
61
+ }
62
+ /**
63
+ * Split a state file (`pwd -P` line, then `export -p`) into cwd + env script.
64
+ * Variables the new shell must own (PWD, OLDPWD, SHLVL) are dropped.
65
+ */
66
+ export function parseStateSnapshot(text) {
67
+ if (!text.trim())
68
+ return null;
69
+ // The cwd may in theory contain a newline, so split at the first export line.
70
+ const m = /\n(?=declare -|export )/.exec(text);
71
+ const cwd = (m ? text.slice(0, m.index) : text.replace(/\n$/, "")) || null;
72
+ const env = m
73
+ ? text
74
+ .slice(m.index + 1)
75
+ .split("\n")
76
+ .filter((line) => !/^(declare -\S+|export) (PWD|OLDPWD|SHLVL)(=|$)/.test(line))
77
+ .join("\n")
78
+ : "";
79
+ return { cwd, env };
80
+ }
81
+ /** Restore script: env first (its PWD is filtered), then cd, then report where we landed. */
82
+ export function buildRestoreScript(snapshot) {
83
+ const env = snapshot.env.trim() ? `{ ${snapshot.env}\n} >/dev/null 2>&1\n` : "";
84
+ const cd = snapshot.cwd ? `builtin cd -- ${shellQuote(snapshot.cwd)} >/dev/null 2>&1\n` : "";
85
+ return `${env}${cd}builtin pwd -P`;
86
+ }
87
+ function describeExit(code, signal) {
88
+ if (signal)
89
+ return `killed by ${signal}`;
90
+ return code === null ? "exited" : `exited with code ${code}`;
91
+ }
17
92
  export class PersistentShell {
18
93
  cwd;
19
94
  env;
@@ -21,8 +96,17 @@ export class PersistentShell {
21
96
  shellOpts;
22
97
  launch;
23
98
  child = null;
24
- buffer = "";
99
+ /** The shell's own `$$`, used to stop just its command. */
100
+ shellPid = null;
25
101
  busy = false;
102
+ stateDir = null;
103
+ /**
104
+ * One-line notes about restarts, kept until `takeRestartNote()` so a helper
105
+ * run (e.g. a guard's `pwd`) cannot swallow the note meant for the model.
106
+ */
107
+ pendingNotes = [];
108
+ /** Bumped by kill(): a run cut short by an explicit kill must not restart the shell. */
109
+ generation = 0;
26
110
  constructor(cwd, env, maxOutputBytes, shellOpts, launch) {
27
111
  this.cwd = cwd;
28
112
  this.env = env;
@@ -30,14 +114,45 @@ export class PersistentShell {
30
114
  this.shellOpts = shellOpts;
31
115
  this.launch = launch;
32
116
  }
117
+ /**
118
+ * Consume the note(s) for the model about shell restarts since the last
119
+ * call, e.g. `[Shell exited with code 3, so it was restarted; restored
120
+ * working directory /x and exported environment variables. …]`.
121
+ */
122
+ takeRestartNote() {
123
+ const note = this.pendingNotes.join("\n") || undefined;
124
+ this.pendingNotes = [];
125
+ return note;
126
+ }
33
127
  /** True while a previous persistent command is still running. */
34
128
  get isBusy() {
35
129
  return this.busy;
36
130
  }
37
- ensureChild() {
38
- if (this.child && this.child.exitCode === null && !this.child.killed) {
39
- return this.child;
131
+ /** Private 0700 temp dir holding the state snapshot; null if unavailable. */
132
+ get statePath() {
133
+ if (!this.stateDir) {
134
+ try {
135
+ this.stateDir = mkdtempSync(path.join(os.tmpdir(), "ez-psh-"));
136
+ trackStateDir(this.stateDir);
137
+ }
138
+ catch {
139
+ return null;
140
+ }
141
+ }
142
+ return path.join(this.stateDir, "state.sh");
143
+ }
144
+ readSnapshot() {
145
+ const file = this.stateDir ? path.join(this.stateDir, "state.sh") : null;
146
+ if (!file)
147
+ return null;
148
+ try {
149
+ return parseStateSnapshot(readFileSync(file, "utf-8"));
40
150
  }
151
+ catch {
152
+ return null;
153
+ }
154
+ }
155
+ spawnChild() {
41
156
  // Fresh session: no rc files so startup is fast and deterministic.
42
157
  //
43
158
  // Spawn the SAME bash the one-shot path resolved, not a bare `bash`: on
@@ -56,36 +171,101 @@ export class PersistentShell {
56
171
  // past a parent crash instead of grouping it for a clean tree-kill.
57
172
  detached: process.platform !== "win32",
58
173
  });
174
+ // Writing to a shell that just died is EPIPE on stdin; the exit handler
175
+ // reports it, so don't let the stream error crash the process.
176
+ child.stdin?.on("error", () => { });
59
177
  // Don't let a lingering session shell keep the parent process alive.
60
178
  child.unref();
61
179
  this.child = child;
62
- this.buffer = "";
180
+ this.shellPid = null;
63
181
  return child;
64
182
  }
183
+ /** Spawn a shell, install the interrupt trap and learn its pid. */
184
+ async startShell() {
185
+ const child = this.spawnChild();
186
+ const res = await this.send(child, `${SETUP_SCRIPT}; builtin echo "$$"`, SETUP_TIMEOUT_MS);
187
+ if (res.kind !== "done") {
188
+ this.hardKill(child);
189
+ return false;
190
+ }
191
+ const pid = parseInt(res.output.trim().split("\n").pop() ?? "", 10);
192
+ this.shellPid = Number.isNaN(pid) ? null : pid;
193
+ return true;
194
+ }
65
195
  /**
66
- * Run one command in the session shell. Serialized by the tool's sequential
67
- * execution mode; a concurrent call while busy is rejected defensively.
68
- * On timeout or abort the whole session is killed (state is gone — the next
69
- * call starts a fresh shell) because a wedged command cannot be safely
70
- * skipped within the same shell.
196
+ * Replace a dead (or killed) shell with a fresh one restored from the
197
+ * snapshot taken after the last completed command. Returns the one-line
198
+ * note for the tool result: `[Shell <how>, so it was restarted; <restored>.
199
+ * <lost> <tail>]`.
71
200
  */
72
- run(command, timeoutMs, signal, onChunk) {
73
- if (this.busy) {
74
- return Promise.resolve({
75
- exitCode: 1,
76
- output: "persistent shell is busy with a previous command",
77
- });
201
+ async restart(how, tail) {
202
+ const snapshot = this.readSnapshot();
203
+ const lost = "Shell functions, aliases, unexported variables and background jobs are gone.";
204
+ const started = await this.startShell().catch(() => false);
205
+ if (!started || !this.child) {
206
+ this.child = null;
207
+ return `[Shell ${how}, and starting a new shell failed; the next command starts a fresh shell in ${this.cwd} without the previous cwd/env. ${tail}]`;
78
208
  }
79
- this.busy = true;
80
- const child = this.ensureChild();
209
+ if (!snapshot) {
210
+ return `[Shell ${how}, so it was restarted in ${this.cwd}; there was no saved state, so earlier cd/exported variables are gone. ${tail}]`;
211
+ }
212
+ const res = await this.send(this.child, buildRestoreScript(snapshot), SETUP_TIMEOUT_MS);
213
+ if (res.kind !== "done") {
214
+ this.hardKill(this.child);
215
+ return `[Shell ${how}, and restoring its state failed; the next command starts a fresh shell in ${this.cwd} without the previous cwd/env. ${tail}]`;
216
+ }
217
+ const landed = res.output.trim().split("\n").pop() || this.cwd;
218
+ const restored = snapshot.cwd && landed === snapshot.cwd
219
+ ? `restored working directory ${landed} and exported environment variables`
220
+ : `restored exported environment variables; the previous working directory ${snapshot.cwd ?? "(unknown)"} no longer exists, so it is ${landed}`;
221
+ return `[Shell ${how}, so it was restarted; ${restored}. ${lost} ${tail}]`;
222
+ }
223
+ /**
224
+ * The shell's own pid, if it is a real descendant of the spawned process
225
+ * (inside a Linux sandbox's pid namespace `$$` is not a host pid). Never on
226
+ * Windows, where MSYS pids are not native pids.
227
+ */
228
+ verifiedShellPid(child) {
229
+ const pid = this.shellPid;
230
+ if (process.platform === "win32" || !pid || !child.pid)
231
+ return null;
232
+ if (pid === child.pid)
233
+ return pid;
234
+ return listDescendantPids(child.pid).includes(pid) ? pid : null;
235
+ }
236
+ hardKill(child) {
237
+ if (child.pid)
238
+ killProcessTree(child.pid);
239
+ if (this.child === child) {
240
+ this.child = null;
241
+ this.shellPid = null;
242
+ }
243
+ }
244
+ /**
245
+ * Write one script and wait for its sentinel. `run()` passes a signal and
246
+ * gets the stop-the-command-not-the-shell interrupt; setup scripts don't.
247
+ */
248
+ send(child, script, timeoutMs, signal, onChunk) {
81
249
  const sentinel = `__EZ_PSH_${randomUUID()}__`;
82
- // `</dev/null` keeps stdin-reading commands (cat, read) from eating the
83
- // next sentinel line instead of hanging the session.
84
- const wrapped = `{ ${command}\n} </dev/null; echo "${sentinel}$?"\n`;
250
+ const statePath = this.statePath;
251
+ // Snapshot cwd + exported env before the sentinel, so a shell that dies
252
+ // in the next command can be restored to exactly this point. Builtins and
253
+ // one redirect only — no fork. On Windows Git Bash accepts `C:/…` paths.
254
+ const snapshot = statePath
255
+ ? `{ builtin pwd -P; builtin export -p; } >${shellQuote(statePath.replace(/\\/g, "/"))} 2>/dev/null; `
256
+ : "";
257
+ // The one-iteration loop is what the USR1 trap breaks out of, skipping the
258
+ // rest of an interrupted command list. `</dev/null` keeps stdin-reading
259
+ // commands (cat, read) from eating the next sentinel line.
260
+ const wrapped = `for __ez_psh_once in 1; do { ${script}\n} </dev/null; done; ` +
261
+ `__ez_psh_rc=$?; ${snapshot}builtin echo "${sentinel}$__ez_psh_rc"\n`;
85
262
  return new Promise((resolve) => {
86
263
  let out = "";
87
264
  let capped = false;
88
265
  let done = false;
266
+ let interrupted = null;
267
+ let sweep;
268
+ let grace;
89
269
  const finish = (result) => {
90
270
  if (done)
91
271
  return;
@@ -95,10 +275,12 @@ export class PersistentShell {
95
275
  child.off("exit", onExit);
96
276
  child.off("error", onError);
97
277
  clearTimeout(timer);
98
- signal.removeEventListener("abort", onAbort);
99
- this.busy = false;
278
+ clearInterval(sweep);
279
+ clearTimeout(grace);
280
+ signal?.removeEventListener("abort", onAbort);
100
281
  resolve(result);
101
282
  };
283
+ const capNote = () => `\n[Output capped at ${this.maxOutputBytes} bytes]`;
102
284
  // When output is capped we stop growing `out` but MUST keep scanning for
103
285
  // the sentinel — otherwise an over-cap command hangs until timeout and
104
286
  // needlessly destroys the session. `scanTail` keeps a small rolling
@@ -109,12 +291,13 @@ export class PersistentShell {
109
291
  if (idx === -1)
110
292
  return;
111
293
  const code = parseInt(scan.slice(idx + sentinel.length), 10);
112
- const body = fromCapped ? out : scan.slice(0, idx);
113
- finish({
114
- exitCode: Number.isNaN(code) ? 1 : code,
115
- output: body.replace(/\n$/, "") +
116
- (fromCapped ? `\n[Output capped at ${this.maxOutputBytes} bytes]` : ""),
117
- });
294
+ const body = (fromCapped ? out : scan.slice(0, idx)).replace(/\n$/, "");
295
+ const output = body + (fromCapped ? capNote() : "");
296
+ if (interrupted) {
297
+ finish({ kind: interrupted, shellKept: true, output });
298
+ return;
299
+ }
300
+ finish({ kind: "done", code: Number.isNaN(code) ? 1 : code, output });
118
301
  };
119
302
  const onData = (d) => {
120
303
  const text = d.toString("utf-8");
@@ -134,36 +317,135 @@ export class PersistentShell {
134
317
  onChunk?.(text);
135
318
  checkSentinel(capped ? scanTail : out, capped);
136
319
  };
137
- const timer = setTimeout(() => {
138
- this.kill();
139
- finish({ exitCode: "TIMEOUT", output: out });
140
- }, timeoutMs);
141
- const onAbort = () => {
142
- this.kill();
143
- finish({ exitCode: 1, output: out });
320
+ const giveUp = (kind, stuck = false) => {
321
+ this.hardKill(child);
322
+ finish({ kind, shellKept: false, stuck, output: out + (capped ? capNote() : "") });
323
+ };
324
+ const interrupt = (kind) => {
325
+ if (done || interrupted)
326
+ return;
327
+ interrupted = kind;
328
+ if (!signal) {
329
+ // Setup scripts: nothing worth preserving yet.
330
+ giveUp(kind);
331
+ return;
332
+ }
333
+ const pid = this.verifiedShellPid(child);
334
+ if (pid === null) {
335
+ giveUp(kind);
336
+ return;
337
+ }
338
+ // Order matters: the trap is deferred until the foreground child dies,
339
+ // so it must be pending before the children are killed.
340
+ try {
341
+ process.kill(pid, "SIGUSR1");
342
+ }
343
+ catch {
344
+ giveUp(kind);
345
+ return;
346
+ }
347
+ signalDescendants(pid, "SIGTERM");
348
+ // Anything that ignored SIGTERM, or was forked since, gets SIGKILL.
349
+ sweep = setInterval(() => signalDescendants(pid, "SIGKILL"), INTERRUPT_SWEEP_MS);
350
+ grace = setTimeout(() => giveUp(kind, true), INTERRUPT_GRACE_MS);
144
351
  };
145
- signal.addEventListener("abort", onAbort, { once: true });
352
+ const timer = setTimeout(() => interrupt("timeout"), timeoutMs);
353
+ const onAbort = () => interrupt("abort");
354
+ signal?.addEventListener("abort", onAbort, { once: true });
146
355
  // `exit N` (or a crash) ends the session shell itself — the sentinel
147
- // never prints, so settle from the shell's own exit code. The next run()
148
- // starts a fresh session.
149
- const onExit = (code) => {
150
- this.child = null;
151
- finish({ exitCode: code ?? 1, output: out.replace(/\n$/, "") });
356
+ // never prints, so settle from the shell's own exit status.
357
+ const onExit = (code, sig) => {
358
+ if (this.child === child) {
359
+ this.child = null;
360
+ this.shellPid = null;
361
+ }
362
+ const output = out.replace(/\n$/, "") + (capped ? capNote() : "");
363
+ if (interrupted)
364
+ finish({ kind: interrupted, shellKept: false, output });
365
+ else
366
+ finish({ kind: "exited", code, signal: sig, output });
152
367
  };
153
368
  child.on("exit", onExit);
154
- const onError = () => finish({ exitCode: 1, output: "failed to spawn session bash" });
369
+ const onError = () => finish({ kind: "error", output: "failed to spawn session bash" });
155
370
  child.on("error", onError);
156
371
  child.stdout?.on("data", onData);
157
372
  child.stderr?.on("data", onData);
158
373
  child.stdin?.write(wrapped);
159
374
  });
160
375
  }
161
- /** Kill the session shell; the next run() starts a fresh one. */
376
+ /**
377
+ * Run one command in the session shell. Serialized by the tool's sequential
378
+ * execution mode; a concurrent call while busy is rejected defensively.
379
+ */
380
+ async run(command, timeoutMs, signal, onChunk) {
381
+ if (this.busy) {
382
+ return { exitCode: 1, output: "persistent shell is busy with a previous command" };
383
+ }
384
+ this.busy = true;
385
+ try {
386
+ const notes = this.pendingNotes;
387
+ const current = this.child;
388
+ if (current && (current.exitCode !== null || current.signalCode !== null)) {
389
+ // Died between commands (external kill, OOM). Nothing has been sent,
390
+ // so restarting here cannot double-execute anything.
391
+ this.child = null;
392
+ notes.push(await this.restart(`had ${describeExit(current.exitCode, current.signalCode)} since the last command`, "This command ran in the new shell."));
393
+ }
394
+ if (!this.child && !(await this.startShell().catch(() => false))) {
395
+ this.child = null;
396
+ return { exitCode: 1, output: "failed to spawn session bash" };
397
+ }
398
+ const child = this.child;
399
+ const generation = this.generation;
400
+ const res = await this.send(child, command, timeoutMs, signal, onChunk);
401
+ if (generation !== this.generation) {
402
+ return { exitCode: res.kind === "done" ? res.code : 1, output: res.output };
403
+ }
404
+ switch (res.kind) {
405
+ case "done":
406
+ return { exitCode: res.code, output: res.output };
407
+ case "error":
408
+ this.hardKill(child);
409
+ return { exitCode: 1, output: res.output };
410
+ case "exited": {
411
+ notes.push(await this.restart(describeExit(res.code, res.signal), "The command was not re-run."));
412
+ // A signal death has no code; report it the way bash would (128+n).
413
+ const code = res.code ?? (res.signal ? 128 + (os.constants.signals[res.signal] ?? 0) : 1);
414
+ return { exitCode: code, output: res.output };
415
+ }
416
+ case "timeout":
417
+ case "abort": {
418
+ const exitCode = res.kind === "timeout" ? "TIMEOUT" : 1;
419
+ if (res.shellKept) {
420
+ return { exitCode, output: res.output, shellKept: true };
421
+ }
422
+ const event = res.kind === "timeout" ? "timed out" : "was aborted";
423
+ const how = res.stuck
424
+ ? `did not stop when the command ${event}, so it was killed`
425
+ : `was killed to stop the command that ${event}`;
426
+ notes.push(await this.restart(how, "The command was not re-run."));
427
+ return { exitCode, output: res.output, shellKept: false };
428
+ }
429
+ }
430
+ }
431
+ finally {
432
+ this.busy = false;
433
+ }
434
+ }
435
+ /** Kill the session shell and drop its saved state; the next run() starts fresh. */
162
436
  kill() {
163
- if (this.child?.pid)
164
- killProcessTree(this.child.pid);
437
+ this.generation++;
438
+ if (this.child)
439
+ this.hardKill(this.child);
165
440
  this.child = null;
441
+ this.shellPid = null;
166
442
  this.busy = false;
443
+ this.pendingNotes = [];
444
+ if (this.stateDir) {
445
+ rmSync(this.stateDir, { recursive: true, force: true });
446
+ stateDirs.delete(this.stateDir);
447
+ this.stateDir = null;
448
+ }
167
449
  }
168
450
  }
169
451
  //# sourceMappingURL=persistent-shell.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"persistent-shell.js","sourceRoot":"","sources":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,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;gBAC5D,CAAC;YACH,CAAC;QACH,CAAC;gBAAS,CAAC;YACT,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC;QACpB,CAAC;IACH,CAAC;IAED,oFAAoF;IACpF,IAAI;QACF,IAAI,CAAC,UAAU,EAAE,CAAC;QAClB,IAAI,IAAI,CAAC,KAAK;YAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC1C,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAClB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QACrB,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC;QAClB,IAAI,CAAC,YAAY,GAAG,EAAE,CAAC;QACvB,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YAClB,MAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;YACxD,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YAChC,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QACvB,CAAC;IACH,CAAC;CACF"}
@@ -1,4 +1,5 @@
1
1
  import type { spawnSync } from "node:child_process";
2
+ import { type ChildProcess } from "node:child_process";
2
3
  import { type ShellResolution } from "./shell.js";
3
4
  import type { AgentNotificationQueue } from "./agent-notifications.js";
4
5
  export interface BackgroundProcess {
@@ -108,6 +109,19 @@ export declare class ProcessManager {
108
109
  */
109
110
  private pruneOldLogs;
110
111
  start(command: string, cwd: string, launch?: ShellResolution, wake?: WakeRules): Promise<StartResult>;
112
+ /**
113
+ * Take over a foreground command that is still running, so the caller can
114
+ * return without killing it. Output captured so far seeds the log (its last
115
+ * {@link ADOPTED_PRIOR_OUTPUT_BYTES} only); later stdout/stderr is appended
116
+ * as it arrives. The process keeps its cwd and environment because it is the
117
+ * same process. Its stdin was never a pipe, so `sendInput` reports it closed.
118
+ *
119
+ * Synchronous on purpose: the caller hands over a live child whose 'close'
120
+ * has not fired yet, and an `await` here could let it fire unobserved.
121
+ */
122
+ adopt(child: ChildProcess, command: string, startedAt: number, priorOutput: Buffer): StartResult;
123
+ /** Register a running child and arm its exit bookkeeping and watchers. */
124
+ private track;
111
125
  /**
112
126
  * Arm a backing-off, budgeted progress watcher for one background process.
113
127
  * Emits at most one latest-only checkpoint per interval, only when the log
@@ -58,6 +58,9 @@ const CHECKPOINT_TAIL_CHARS = 320;
58
58
  /** Ceiling on a single blocking `waitForExitOrWake`, so one wedged process cannot
59
59
  * hold the agent loop indefinitely; callers re-wait if they still want to. */
60
60
  export const MAX_PROCESS_WAIT_MS = 600_000;
61
+ /** Output a foreground command produced before {@link ProcessManager.adopt} that
62
+ * is kept in its log; the rest was already shown to nobody and only costs disk. */
63
+ const ADOPTED_PRIOR_OUTPUT_BYTES = 1024 * 1024;
61
64
  /** Chars of the matched log line carried in a pattern-wake notification. */
62
65
  const WAKE_LINE_CHARS = 200;
63
66
  /** One log line, whitespace-collapsed and tail-bounded — never the raw log. */
@@ -179,6 +182,64 @@ export class ProcessManager {
179
182
  lastReadOffset: 0,
180
183
  logSize: 0,
181
184
  };
185
+ return this.track(child, proc, wake);
186
+ }
187
+ /**
188
+ * Take over a foreground command that is still running, so the caller can
189
+ * return without killing it. Output captured so far seeds the log (its last
190
+ * {@link ADOPTED_PRIOR_OUTPUT_BYTES} only); later stdout/stderr is appended
191
+ * as it arrives. The process keeps its cwd and environment because it is the
192
+ * same process. Its stdin was never a pipe, so `sendInput` reports it closed.
193
+ *
194
+ * Synchronous on purpose: the caller hands over a live child whose 'close'
195
+ * has not fired yet, and an `await` here could let it fire unobserved.
196
+ */
197
+ adopt(child, command, startedAt, priorOutput) {
198
+ fs.mkdirSync(this.bgDir, { recursive: true });
199
+ void this.pruneOldLogs();
200
+ const id = crypto.randomUUID().slice(0, 8);
201
+ const logFile = path.join(this.bgDir, `${id}.log`);
202
+ const prior = priorOutput.length > ADOPTED_PRIOR_OUTPUT_BYTES
203
+ ? Buffer.concat([
204
+ Buffer.from(`[earlier output dropped; last ${ADOPTED_PRIOR_OUTPUT_BYTES / 1024 / 1024} MiB kept]\n`),
205
+ priorOutput.subarray(priorOutput.length - ADOPTED_PRIOR_OUTPUT_BYTES),
206
+ ])
207
+ : priorOutput;
208
+ const fd = fs.openSync(logFile, "w");
209
+ fs.writeSync(fd, prior);
210
+ // Synchronous appends keep the log ordered and complete by the time
211
+ // 'close' fires, which the exit bookkeeping and waiters rely on.
212
+ const append = (data) => {
213
+ try {
214
+ fs.writeSync(fd, data);
215
+ }
216
+ catch {
217
+ // Disk full or log removed: drop output rather than crash the host.
218
+ }
219
+ };
220
+ child.stdout?.on("data", append);
221
+ child.stderr?.on("data", append);
222
+ child.once("close", () => fs.closeSync(fd));
223
+ // Never hold the host's event loop open for a process it no longer awaits.
224
+ child.unref();
225
+ for (const stream of [child.stdout, child.stderr]) {
226
+ stream?.unref?.();
227
+ }
228
+ const proc = {
229
+ id,
230
+ pid: child.pid ?? 0,
231
+ command,
232
+ logFile,
233
+ startedAt,
234
+ exitCode: null,
235
+ lastReadOffset: 0,
236
+ logSize: prior.length,
237
+ };
238
+ return this.track(child, proc);
239
+ }
240
+ /** Register a running child and arm its exit bookkeeping and watchers. */
241
+ track(child, proc, wake) {
242
+ const { id, pid, logFile } = proc;
182
243
  this.processes.set(id, proc);
183
244
  this.children.set(id, child);
184
245
  // A child that fails to spawn emits 'error', and an 'error' with no listener