@tickernelz/paperclip-pro-adapter-utils 2026.925.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 (1826) hide show
  1. package/README.md +37 -0
  2. package/dist/acpx-engine/cli.d.ts +2 -0
  3. package/dist/acpx-engine/cli.d.ts.map +1 -0
  4. package/dist/acpx-engine/cli.js +128 -0
  5. package/dist/acpx-engine/cli.js.map +1 -0
  6. package/dist/acpx-engine/composed-run-characterization.test.d.ts +2 -0
  7. package/dist/acpx-engine/composed-run-characterization.test.d.ts.map +1 -0
  8. package/dist/acpx-engine/composed-run-characterization.test.js +739 -0
  9. package/dist/acpx-engine/composed-run-characterization.test.js.map +1 -0
  10. package/dist/acpx-engine/constants.d.ts +20 -0
  11. package/dist/acpx-engine/constants.d.ts.map +1 -0
  12. package/dist/acpx-engine/constants.js +37 -0
  13. package/dist/acpx-engine/constants.js.map +1 -0
  14. package/dist/acpx-engine/execute-identity.test.d.ts +2 -0
  15. package/dist/acpx-engine/execute-identity.test.d.ts.map +1 -0
  16. package/dist/acpx-engine/execute-identity.test.js +218 -0
  17. package/dist/acpx-engine/execute-identity.test.js.map +1 -0
  18. package/dist/acpx-engine/execute.d.ts +325 -0
  19. package/dist/acpx-engine/execute.d.ts.map +1 -0
  20. package/dist/acpx-engine/execute.js +4448 -0
  21. package/dist/acpx-engine/execute.js.map +1 -0
  22. package/dist/acpx-engine/execute.test.d.ts +2 -0
  23. package/dist/acpx-engine/execute.test.d.ts.map +1 -0
  24. package/dist/acpx-engine/execute.test.js +6694 -0
  25. package/dist/acpx-engine/execute.test.js.map +1 -0
  26. package/dist/acpx-engine/index.d.ts +6 -0
  27. package/dist/acpx-engine/index.d.ts.map +1 -0
  28. package/dist/acpx-engine/index.js +6 -0
  29. package/dist/acpx-engine/index.js.map +1 -0
  30. package/dist/acpx-engine/local-process-control.d.ts +5 -0
  31. package/dist/acpx-engine/local-process-control.d.ts.map +1 -0
  32. package/dist/acpx-engine/local-process-control.js +39 -0
  33. package/dist/acpx-engine/local-process-control.js.map +1 -0
  34. package/dist/acpx-engine/local-process-control.test.d.ts +2 -0
  35. package/dist/acpx-engine/local-process-control.test.d.ts.map +1 -0
  36. package/dist/acpx-engine/local-process-control.test.js +38 -0
  37. package/dist/acpx-engine/local-process-control.test.js.map +1 -0
  38. package/dist/acpx-engine/operator-stop.test.d.ts +2 -0
  39. package/dist/acpx-engine/operator-stop.test.d.ts.map +1 -0
  40. package/dist/acpx-engine/operator-stop.test.js +107 -0
  41. package/dist/acpx-engine/operator-stop.test.js.map +1 -0
  42. package/dist/acpx-engine/remote-spawn-smoke.test.d.ts +2 -0
  43. package/dist/acpx-engine/remote-spawn-smoke.test.d.ts.map +1 -0
  44. package/dist/acpx-engine/remote-spawn-smoke.test.js +151 -0
  45. package/dist/acpx-engine/remote-spawn-smoke.test.js.map +1 -0
  46. package/dist/acpx-engine/run-contracts.d.ts +413 -0
  47. package/dist/acpx-engine/run-contracts.d.ts.map +1 -0
  48. package/dist/acpx-engine/run-contracts.js +20 -0
  49. package/dist/acpx-engine/run-contracts.js.map +1 -0
  50. package/dist/acpx-engine/run-contracts.test.d.ts +2 -0
  51. package/dist/acpx-engine/run-contracts.test.d.ts.map +1 -0
  52. package/dist/acpx-engine/run-contracts.test.js +57 -0
  53. package/dist/acpx-engine/run-contracts.test.js.map +1 -0
  54. package/dist/acpx-engine/run-coordinator.d.ts +57 -0
  55. package/dist/acpx-engine/run-coordinator.d.ts.map +1 -0
  56. package/dist/acpx-engine/run-coordinator.js +63 -0
  57. package/dist/acpx-engine/run-coordinator.js.map +1 -0
  58. package/dist/acpx-engine/run-coordinator.test.d.ts +2 -0
  59. package/dist/acpx-engine/run-coordinator.test.d.ts.map +1 -0
  60. package/dist/acpx-engine/run-coordinator.test.js +160 -0
  61. package/dist/acpx-engine/run-coordinator.test.js.map +1 -0
  62. package/dist/acpx-engine/run-fault-matrix.test.d.ts +2 -0
  63. package/dist/acpx-engine/run-fault-matrix.test.d.ts.map +1 -0
  64. package/dist/acpx-engine/run-fault-matrix.test.js +829 -0
  65. package/dist/acpx-engine/run-fault-matrix.test.js.map +1 -0
  66. package/dist/acpx-engine/run-resource-ledger.d.ts +30 -0
  67. package/dist/acpx-engine/run-resource-ledger.d.ts.map +1 -0
  68. package/dist/acpx-engine/run-resource-ledger.js +148 -0
  69. package/dist/acpx-engine/run-resource-ledger.js.map +1 -0
  70. package/dist/acpx-engine/run-resource-ledger.test.d.ts +2 -0
  71. package/dist/acpx-engine/run-resource-ledger.test.d.ts.map +1 -0
  72. package/dist/acpx-engine/run-resource-ledger.test.js +154 -0
  73. package/dist/acpx-engine/run-resource-ledger.test.js.map +1 -0
  74. package/dist/acpx-engine/run-site-host.d.ts +73 -0
  75. package/dist/acpx-engine/run-site-host.d.ts.map +1 -0
  76. package/dist/acpx-engine/run-site-host.js +65 -0
  77. package/dist/acpx-engine/run-site-host.js.map +1 -0
  78. package/dist/acpx-engine/run-site-host.test.d.ts +2 -0
  79. package/dist/acpx-engine/run-site-host.test.d.ts.map +1 -0
  80. package/dist/acpx-engine/run-site-host.test.js +98 -0
  81. package/dist/acpx-engine/run-site-host.test.js.map +1 -0
  82. package/dist/acpx-engine/run-site-sandbox.d.ts +142 -0
  83. package/dist/acpx-engine/run-site-sandbox.d.ts.map +1 -0
  84. package/dist/acpx-engine/run-site-sandbox.js +278 -0
  85. package/dist/acpx-engine/run-site-sandbox.js.map +1 -0
  86. package/dist/acpx-engine/run-site-sandbox.test.d.ts +2 -0
  87. package/dist/acpx-engine/run-site-sandbox.test.d.ts.map +1 -0
  88. package/dist/acpx-engine/run-site-sandbox.test.js +275 -0
  89. package/dist/acpx-engine/run-site-sandbox.test.js.map +1 -0
  90. package/dist/acpx-engine/session-codec.d.ts +3 -0
  91. package/dist/acpx-engine/session-codec.d.ts.map +1 -0
  92. package/dist/acpx-engine/session-codec.js +49 -0
  93. package/dist/acpx-engine/session-codec.js.map +1 -0
  94. package/dist/acpx-engine/session-reuse-store.d.ts +62 -0
  95. package/dist/acpx-engine/session-reuse-store.d.ts.map +1 -0
  96. package/dist/acpx-engine/session-reuse-store.js +134 -0
  97. package/dist/acpx-engine/session-reuse-store.js.map +1 -0
  98. package/dist/acpx-engine/session-reuse-store.test.d.ts +2 -0
  99. package/dist/acpx-engine/session-reuse-store.test.d.ts.map +1 -0
  100. package/dist/acpx-engine/session-reuse-store.test.js +134 -0
  101. package/dist/acpx-engine/session-reuse-store.test.js.map +1 -0
  102. package/dist/acpx-engine/settlement-characterization.test.d.ts +2 -0
  103. package/dist/acpx-engine/settlement-characterization.test.d.ts.map +1 -0
  104. package/dist/acpx-engine/settlement-characterization.test.js +880 -0
  105. package/dist/acpx-engine/settlement-characterization.test.js.map +1 -0
  106. package/dist/acpx-engine/settlement-sequence.d.ts +77 -0
  107. package/dist/acpx-engine/settlement-sequence.d.ts.map +1 -0
  108. package/dist/acpx-engine/settlement-sequence.js +119 -0
  109. package/dist/acpx-engine/settlement-sequence.js.map +1 -0
  110. package/dist/acpx-engine/settlement-sequence.test.d.ts +2 -0
  111. package/dist/acpx-engine/settlement-sequence.test.d.ts.map +1 -0
  112. package/dist/acpx-engine/settlement-sequence.test.js +272 -0
  113. package/dist/acpx-engine/settlement-sequence.test.js.map +1 -0
  114. package/dist/acpx-engine/spawn-smoke.test.d.ts +2 -0
  115. package/dist/acpx-engine/spawn-smoke.test.d.ts.map +1 -0
  116. package/dist/acpx-engine/spawn-smoke.test.js +184 -0
  117. package/dist/acpx-engine/spawn-smoke.test.js.map +1 -0
  118. package/dist/acpx-engine/startup-cancellation.d.ts +8 -0
  119. package/dist/acpx-engine/startup-cancellation.d.ts.map +1 -0
  120. package/dist/acpx-engine/startup-cancellation.js +92 -0
  121. package/dist/acpx-engine/startup-cancellation.js.map +1 -0
  122. package/dist/acpx-engine/startup-cancellation.test.d.ts +2 -0
  123. package/dist/acpx-engine/startup-cancellation.test.d.ts.map +1 -0
  124. package/dist/acpx-engine/startup-cancellation.test.js +115 -0
  125. package/dist/acpx-engine/startup-cancellation.test.js.map +1 -0
  126. package/dist/acpx-engine/startup-characterization.test.d.ts +2 -0
  127. package/dist/acpx-engine/startup-characterization.test.d.ts.map +1 -0
  128. package/dist/acpx-engine/startup-characterization.test.js +742 -0
  129. package/dist/acpx-engine/startup-characterization.test.js.map +1 -0
  130. package/dist/acpx-engine/startup-timing.d.ts +419 -0
  131. package/dist/acpx-engine/startup-timing.d.ts.map +1 -0
  132. package/dist/acpx-engine/startup-timing.js +616 -0
  133. package/dist/acpx-engine/startup-timing.js.map +1 -0
  134. package/dist/acpx-engine/startup-timing.test.d.ts +2 -0
  135. package/dist/acpx-engine/startup-timing.test.d.ts.map +1 -0
  136. package/dist/acpx-engine/startup-timing.test.js +619 -0
  137. package/dist/acpx-engine/startup-timing.test.js.map +1 -0
  138. package/dist/acpx-engine/turn-characterization.test.d.ts +2 -0
  139. package/dist/acpx-engine/turn-characterization.test.d.ts.map +1 -0
  140. package/dist/acpx-engine/turn-characterization.test.js +566 -0
  141. package/dist/acpx-engine/turn-characterization.test.js.map +1 -0
  142. package/dist/acpx-engine/turn-sequence.d.ts +54 -0
  143. package/dist/acpx-engine/turn-sequence.d.ts.map +1 -0
  144. package/dist/acpx-engine/turn-sequence.js +75 -0
  145. package/dist/acpx-engine/turn-sequence.js.map +1 -0
  146. package/dist/acpx-engine/turn-sequence.test.d.ts +2 -0
  147. package/dist/acpx-engine/turn-sequence.test.d.ts.map +1 -0
  148. package/dist/acpx-engine/turn-sequence.test.js +177 -0
  149. package/dist/acpx-engine/turn-sequence.test.js.map +1 -0
  150. package/dist/acpx-engine/ui.d.ts +3 -0
  151. package/dist/acpx-engine/ui.d.ts.map +1 -0
  152. package/dist/acpx-engine/ui.js +162 -0
  153. package/dist/acpx-engine/ui.js.map +1 -0
  154. package/dist/billing.d.ts +2 -0
  155. package/dist/billing.d.ts.map +1 -0
  156. package/dist/billing.js +16 -0
  157. package/dist/billing.js.map +1 -0
  158. package/dist/billing.test.d.ts +2 -0
  159. package/dist/billing.test.d.ts.map +1 -0
  160. package/dist/billing.test.js +14 -0
  161. package/dist/billing.test.js.map +1 -0
  162. package/dist/bridge-transport-contract.d.ts +43 -0
  163. package/dist/bridge-transport-contract.d.ts.map +1 -0
  164. package/dist/bridge-transport-contract.js +33 -0
  165. package/dist/bridge-transport-contract.js.map +1 -0
  166. package/dist/chat-file-delivery.d.ts +10 -0
  167. package/dist/chat-file-delivery.d.ts.map +1 -0
  168. package/dist/chat-file-delivery.js +38 -0
  169. package/dist/chat-file-delivery.js.map +1 -0
  170. package/dist/chat-file-delivery.test.d.ts +2 -0
  171. package/dist/chat-file-delivery.test.d.ts.map +1 -0
  172. package/dist/chat-file-delivery.test.js +92 -0
  173. package/dist/chat-file-delivery.test.js.map +1 -0
  174. package/dist/command-managed-runtime.d.ts +162 -0
  175. package/dist/command-managed-runtime.d.ts.map +1 -0
  176. package/dist/command-managed-runtime.js +456 -0
  177. package/dist/command-managed-runtime.js.map +1 -0
  178. package/dist/command-managed-runtime.test.d.ts +2 -0
  179. package/dist/command-managed-runtime.test.d.ts.map +1 -0
  180. package/dist/command-managed-runtime.test.js +908 -0
  181. package/dist/command-managed-runtime.test.js.map +1 -0
  182. package/dist/command-redaction.d.ts +15 -0
  183. package/dist/command-redaction.d.ts.map +1 -0
  184. package/dist/command-redaction.js +97 -0
  185. package/dist/command-redaction.js.map +1 -0
  186. package/dist/command-redaction.test.d.ts +2 -0
  187. package/dist/command-redaction.test.d.ts.map +1 -0
  188. package/dist/command-redaction.test.js +80 -0
  189. package/dist/command-redaction.test.js.map +1 -0
  190. package/dist/duplex-frame-codec.d.ts +124 -0
  191. package/dist/duplex-frame-codec.d.ts.map +1 -0
  192. package/dist/duplex-frame-codec.js +134 -0
  193. package/dist/duplex-frame-codec.js.map +1 -0
  194. package/dist/duplex-frame-codec.test.d.ts +2 -0
  195. package/dist/duplex-frame-codec.test.d.ts.map +1 -0
  196. package/dist/duplex-frame-codec.test.js +172 -0
  197. package/dist/duplex-frame-codec.test.js.map +1 -0
  198. package/dist/duplex-observability.d.ts +220 -0
  199. package/dist/duplex-observability.d.ts.map +1 -0
  200. package/dist/duplex-observability.js +248 -0
  201. package/dist/duplex-observability.js.map +1 -0
  202. package/dist/duplex-observability.test.d.ts +2 -0
  203. package/dist/duplex-observability.test.d.ts.map +1 -0
  204. package/dist/duplex-observability.test.js +55 -0
  205. package/dist/duplex-observability.test.js.map +1 -0
  206. package/dist/env-bindings.d.ts +17 -0
  207. package/dist/env-bindings.d.ts.map +1 -0
  208. package/dist/env-bindings.js +98 -0
  209. package/dist/env-bindings.js.map +1 -0
  210. package/dist/env-bindings.test.d.ts +2 -0
  211. package/dist/env-bindings.test.d.ts.map +1 -0
  212. package/dist/env-bindings.test.js +66 -0
  213. package/dist/env-bindings.test.js.map +1 -0
  214. package/dist/exclude-patterns.d.ts +4 -0
  215. package/dist/exclude-patterns.d.ts.map +1 -0
  216. package/dist/exclude-patterns.js +26 -0
  217. package/dist/exclude-patterns.js.map +1 -0
  218. package/dist/execution-target-sandbox.test.d.ts +2 -0
  219. package/dist/execution-target-sandbox.test.d.ts.map +1 -0
  220. package/dist/execution-target-sandbox.test.js +6522 -0
  221. package/dist/execution-target-sandbox.test.js.map +1 -0
  222. package/dist/execution-target-stdin-race.test.d.ts +2 -0
  223. package/dist/execution-target-stdin-race.test.d.ts.map +1 -0
  224. package/dist/execution-target-stdin-race.test.js +1842 -0
  225. package/dist/execution-target-stdin-race.test.js.map +1 -0
  226. package/dist/execution-target.d.ts +537 -0
  227. package/dist/execution-target.d.ts.map +1 -0
  228. package/dist/execution-target.js +3877 -0
  229. package/dist/execution-target.js.map +1 -0
  230. package/dist/execution-target.test.d.ts +2 -0
  231. package/dist/execution-target.test.d.ts.map +1 -0
  232. package/dist/execution-target.test.js +346 -0
  233. package/dist/execution-target.test.js.map +1 -0
  234. package/dist/git-workspace-sync.d.ts +193 -0
  235. package/dist/git-workspace-sync.d.ts.map +1 -0
  236. package/dist/git-workspace-sync.js +786 -0
  237. package/dist/git-workspace-sync.js.map +1 -0
  238. package/dist/git-workspace-sync.test.d.ts +2 -0
  239. package/dist/git-workspace-sync.test.d.ts.map +1 -0
  240. package/dist/git-workspace-sync.test.js +830 -0
  241. package/dist/git-workspace-sync.test.js.map +1 -0
  242. package/dist/github-launcher-environment.test.d.ts +2 -0
  243. package/dist/github-launcher-environment.test.d.ts.map +1 -0
  244. package/dist/github-launcher-environment.test.js +285 -0
  245. package/dist/github-launcher-environment.test.js.map +1 -0
  246. package/dist/github-launcher.d.ts +8 -0
  247. package/dist/github-launcher.d.ts.map +1 -0
  248. package/dist/github-launcher.js +127 -0
  249. package/dist/github-launcher.js.map +1 -0
  250. package/dist/github-launcher.test.d.ts +2 -0
  251. package/dist/github-launcher.test.d.ts.map +1 -0
  252. package/dist/github-launcher.test.js +166 -0
  253. package/dist/github-launcher.test.js.map +1 -0
  254. package/dist/http2-bridge-server.d.ts +465 -0
  255. package/dist/http2-bridge-server.d.ts.map +1 -0
  256. package/dist/http2-bridge-server.js +1087 -0
  257. package/dist/http2-bridge-server.js.map +1 -0
  258. package/dist/http2-bridge-server.test.d.ts +2 -0
  259. package/dist/http2-bridge-server.test.d.ts.map +1 -0
  260. package/dist/http2-bridge-server.test.js +2129 -0
  261. package/dist/http2-bridge-server.test.js.map +1 -0
  262. package/dist/index.d.ts +20 -0
  263. package/dist/index.d.ts.map +1 -0
  264. package/dist/index.js +12 -0
  265. package/dist/index.js.map +1 -0
  266. package/dist/local-process-sandbox.d.ts +41 -0
  267. package/dist/local-process-sandbox.d.ts.map +1 -0
  268. package/dist/local-process-sandbox.js +432 -0
  269. package/dist/local-process-sandbox.js.map +1 -0
  270. package/dist/local-process-sandbox.test.d.ts +2 -0
  271. package/dist/local-process-sandbox.test.d.ts.map +1 -0
  272. package/dist/local-process-sandbox.test.js +399 -0
  273. package/dist/local-process-sandbox.test.js.map +1 -0
  274. package/dist/log-redaction.d.ts +9 -0
  275. package/dist/log-redaction.d.ts.map +1 -0
  276. package/dist/log-redaction.js +88 -0
  277. package/dist/log-redaction.js.map +1 -0
  278. package/dist/login-capability.d.ts +88 -0
  279. package/dist/login-capability.d.ts.map +1 -0
  280. package/dist/login-capability.js +78 -0
  281. package/dist/login-capability.js.map +1 -0
  282. package/dist/login-capability.test.d.ts +2 -0
  283. package/dist/login-capability.test.d.ts.map +1 -0
  284. package/dist/login-capability.test.js +78 -0
  285. package/dist/login-capability.test.js.map +1 -0
  286. package/dist/login-pty-transport.d.ts +80 -0
  287. package/dist/login-pty-transport.d.ts.map +1 -0
  288. package/dist/login-pty-transport.js +75 -0
  289. package/dist/login-pty-transport.js.map +1 -0
  290. package/dist/login-pty-transport.test.d.ts +2 -0
  291. package/dist/login-pty-transport.test.d.ts.map +1 -0
  292. package/dist/login-pty-transport.test.js +185 -0
  293. package/dist/login-pty-transport.test.js.map +1 -0
  294. package/dist/login-runner-lifecycle.d.ts +70 -0
  295. package/dist/login-runner-lifecycle.d.ts.map +1 -0
  296. package/dist/login-runner-lifecycle.js +52 -0
  297. package/dist/login-runner-lifecycle.js.map +1 -0
  298. package/dist/login-runner-lifecycle.test.d.ts +2 -0
  299. package/dist/login-runner-lifecycle.test.d.ts.map +1 -0
  300. package/dist/login-runner-lifecycle.test.js +122 -0
  301. package/dist/login-runner-lifecycle.test.js.map +1 -0
  302. package/dist/mcp-isolation.integration.test.d.ts +2 -0
  303. package/dist/mcp-isolation.integration.test.d.ts.map +1 -0
  304. package/dist/mcp-isolation.integration.test.js +202 -0
  305. package/dist/mcp-isolation.integration.test.js.map +1 -0
  306. package/dist/paperclip-runner-permissions.d.ts +110 -0
  307. package/dist/paperclip-runner-permissions.d.ts.map +1 -0
  308. package/dist/paperclip-runner-permissions.js +150 -0
  309. package/dist/paperclip-runner-permissions.js.map +1 -0
  310. package/dist/paperclip-runner-permissions.test.d.ts +2 -0
  311. package/dist/paperclip-runner-permissions.test.d.ts.map +1 -0
  312. package/dist/paperclip-runner-permissions.test.js +47 -0
  313. package/dist/paperclip-runner-permissions.test.js.map +1 -0
  314. package/dist/published-exports.test.d.ts +2 -0
  315. package/dist/published-exports.test.d.ts.map +1 -0
  316. package/dist/published-exports.test.js +17 -0
  317. package/dist/published-exports.test.js.map +1 -0
  318. package/dist/remote-execution-env.d.ts +2 -0
  319. package/dist/remote-execution-env.d.ts.map +1 -0
  320. package/dist/remote-execution-env.js +46 -0
  321. package/dist/remote-execution-env.js.map +1 -0
  322. package/dist/remote-managed-runtime.d.ts +45 -0
  323. package/dist/remote-managed-runtime.d.ts.map +1 -0
  324. package/dist/remote-managed-runtime.js +183 -0
  325. package/dist/remote-managed-runtime.js.map +1 -0
  326. package/dist/remote-managed-runtime.test.d.ts +2 -0
  327. package/dist/remote-managed-runtime.test.d.ts.map +1 -0
  328. package/dist/remote-managed-runtime.test.js +294 -0
  329. package/dist/remote-managed-runtime.test.js.map +1 -0
  330. package/dist/runner-connectivity.d.ts +61 -0
  331. package/dist/runner-connectivity.d.ts.map +1 -0
  332. package/dist/runner-connectivity.js +81 -0
  333. package/dist/runner-connectivity.js.map +1 -0
  334. package/dist/runner-connectivity.test.d.ts +2 -0
  335. package/dist/runner-connectivity.test.d.ts.map +1 -0
  336. package/dist/runner-connectivity.test.js +183 -0
  337. package/dist/runner-connectivity.test.js.map +1 -0
  338. package/dist/runtime-progress.d.ts +48 -0
  339. package/dist/runtime-progress.d.ts.map +1 -0
  340. package/dist/runtime-progress.js +99 -0
  341. package/dist/runtime-progress.js.map +1 -0
  342. package/dist/runtime-progress.test.d.ts +2 -0
  343. package/dist/runtime-progress.test.d.ts.map +1 -0
  344. package/dist/runtime-progress.test.js +240 -0
  345. package/dist/runtime-progress.test.js.map +1 -0
  346. package/dist/sandbox-callback-bridge-body.d.ts +12 -0
  347. package/dist/sandbox-callback-bridge-body.d.ts.map +1 -0
  348. package/dist/sandbox-callback-bridge-body.js +39 -0
  349. package/dist/sandbox-callback-bridge-body.js.map +1 -0
  350. package/dist/sandbox-callback-bridge-body.test.d.ts +2 -0
  351. package/dist/sandbox-callback-bridge-body.test.d.ts.map +1 -0
  352. package/dist/sandbox-callback-bridge-body.test.js +31 -0
  353. package/dist/sandbox-callback-bridge-body.test.js.map +1 -0
  354. package/dist/sandbox-callback-bridge.d.ts +268 -0
  355. package/dist/sandbox-callback-bridge.d.ts.map +1 -0
  356. package/dist/sandbox-callback-bridge.js +2357 -0
  357. package/dist/sandbox-callback-bridge.js.map +1 -0
  358. package/dist/sandbox-callback-bridge.test.d.ts +2 -0
  359. package/dist/sandbox-callback-bridge.test.d.ts.map +1 -0
  360. package/dist/sandbox-callback-bridge.test.js +3253 -0
  361. package/dist/sandbox-callback-bridge.test.js.map +1 -0
  362. package/dist/sandbox-file-sync.test.d.ts +2 -0
  363. package/dist/sandbox-file-sync.test.d.ts.map +1 -0
  364. package/dist/sandbox-file-sync.test.js +419 -0
  365. package/dist/sandbox-file-sync.test.js.map +1 -0
  366. package/dist/sandbox-install-command.d.ts +2 -0
  367. package/dist/sandbox-install-command.d.ts.map +1 -0
  368. package/dist/sandbox-install-command.js +47 -0
  369. package/dist/sandbox-install-command.js.map +1 -0
  370. package/dist/sandbox-install-command.test.d.ts +2 -0
  371. package/dist/sandbox-install-command.test.d.ts.map +1 -0
  372. package/dist/sandbox-install-command.test.js +22 -0
  373. package/dist/sandbox-install-command.test.js.map +1 -0
  374. package/dist/sandbox-managed-runtime.d.ts +417 -0
  375. package/dist/sandbox-managed-runtime.d.ts.map +1 -0
  376. package/dist/sandbox-managed-runtime.js +1337 -0
  377. package/dist/sandbox-managed-runtime.js.map +1 -0
  378. package/dist/sandbox-managed-runtime.test.d.ts +2 -0
  379. package/dist/sandbox-managed-runtime.test.d.ts.map +1 -0
  380. package/dist/sandbox-managed-runtime.test.js +3746 -0
  381. package/dist/sandbox-managed-runtime.test.js.map +1 -0
  382. package/dist/sandbox-run-log-stream.d.ts +44 -0
  383. package/dist/sandbox-run-log-stream.d.ts.map +1 -0
  384. package/dist/sandbox-run-log-stream.js +203 -0
  385. package/dist/sandbox-run-log-stream.js.map +1 -0
  386. package/dist/sandbox-shell.d.ts +3 -0
  387. package/dist/sandbox-shell.d.ts.map +1 -0
  388. package/dist/sandbox-shell.js +7 -0
  389. package/dist/sandbox-shell.js.map +1 -0
  390. package/dist/server-utils-env.test.d.ts +2 -0
  391. package/dist/server-utils-env.test.d.ts.map +1 -0
  392. package/dist/server-utils-env.test.js +15 -0
  393. package/dist/server-utils-env.test.js.map +1 -0
  394. package/dist/server-utils.d.ts +617 -0
  395. package/dist/server-utils.d.ts.map +1 -0
  396. package/dist/server-utils.js +3258 -0
  397. package/dist/server-utils.js.map +1 -0
  398. package/dist/server-utils.test.d.ts +2 -0
  399. package/dist/server-utils.test.d.ts.map +1 -0
  400. package/dist/server-utils.test.js +3047 -0
  401. package/dist/server-utils.test.js.map +1 -0
  402. package/dist/session-compaction.d.ts +25 -0
  403. package/dist/session-compaction.d.ts.map +1 -0
  404. package/dist/session-compaction.js +165 -0
  405. package/dist/session-compaction.js.map +1 -0
  406. package/dist/skill-library-manifest.d.ts +6 -0
  407. package/dist/skill-library-manifest.d.ts.map +1 -0
  408. package/dist/skill-library-manifest.js +53 -0
  409. package/dist/skill-library-manifest.js.map +1 -0
  410. package/dist/skill-library-manifest.test.d.ts +2 -0
  411. package/dist/skill-library-manifest.test.d.ts.map +1 -0
  412. package/dist/skill-library-manifest.test.js +84 -0
  413. package/dist/skill-library-manifest.test.js.map +1 -0
  414. package/dist/skills-staging-follow-symlinks.test.d.ts +2 -0
  415. package/dist/skills-staging-follow-symlinks.test.d.ts.map +1 -0
  416. package/dist/skills-staging-follow-symlinks.test.js +126 -0
  417. package/dist/skills-staging-follow-symlinks.test.js.map +1 -0
  418. package/dist/ssh-fixture.test.d.ts +2 -0
  419. package/dist/ssh-fixture.test.d.ts.map +1 -0
  420. package/dist/ssh-fixture.test.js +832 -0
  421. package/dist/ssh-fixture.test.js.map +1 -0
  422. package/dist/ssh.d.ts +124 -0
  423. package/dist/ssh.d.ts.map +1 -0
  424. package/dist/ssh.js +1667 -0
  425. package/dist/ssh.js.map +1 -0
  426. package/dist/sync-operation-schedule.d.ts +17 -0
  427. package/dist/sync-operation-schedule.d.ts.map +1 -0
  428. package/dist/sync-operation-schedule.js +66 -0
  429. package/dist/sync-operation-schedule.js.map +1 -0
  430. package/dist/sync-operation-schedule.test.d.ts +2 -0
  431. package/dist/sync-operation-schedule.test.d.ts.map +1 -0
  432. package/dist/sync-operation-schedule.test.js +130 -0
  433. package/dist/sync-operation-schedule.test.js.map +1 -0
  434. package/dist/test-support/mcp-isolation-harness.d.ts +23 -0
  435. package/dist/test-support/mcp-isolation-harness.d.ts.map +1 -0
  436. package/dist/test-support/mcp-isolation-harness.js +67 -0
  437. package/dist/test-support/mcp-isolation-harness.js.map +1 -0
  438. package/dist/types.d.ts +780 -0
  439. package/dist/types.d.ts.map +1 -0
  440. package/dist/types.js +5 -0
  441. package/dist/types.js.map +1 -0
  442. package/dist/workspace-restore-merge.d.ts +77 -0
  443. package/dist/workspace-restore-merge.d.ts.map +1 -0
  444. package/dist/workspace-restore-merge.js +396 -0
  445. package/dist/workspace-restore-merge.js.map +1 -0
  446. package/dist/workspace-restore-merge.test.d.ts +2 -0
  447. package/dist/workspace-restore-merge.test.d.ts.map +1 -0
  448. package/dist/workspace-restore-merge.test.js +438 -0
  449. package/dist/workspace-restore-merge.test.js.map +1 -0
  450. package/dist/workspace-restore-teardown.d.ts +29 -0
  451. package/dist/workspace-restore-teardown.d.ts.map +1 -0
  452. package/dist/workspace-restore-teardown.js +34 -0
  453. package/dist/workspace-restore-teardown.js.map +1 -0
  454. package/dist/workspace-restore-teardown.test.d.ts +2 -0
  455. package/dist/workspace-restore-teardown.test.d.ts.map +1 -0
  456. package/dist/workspace-restore-teardown.test.js +71 -0
  457. package/dist/workspace-restore-teardown.test.js.map +1 -0
  458. package/node_modules/@agentclientprotocol/sdk/LICENSE +191 -0
  459. package/node_modules/@agentclientprotocol/sdk/README.md +70 -0
  460. package/node_modules/@agentclientprotocol/sdk/dist/acp.d.ts +1803 -0
  461. package/node_modules/@agentclientprotocol/sdk/dist/acp.js +1869 -0
  462. package/node_modules/@agentclientprotocol/sdk/dist/acp.js.map +1 -0
  463. package/node_modules/@agentclientprotocol/sdk/dist/acp.test.d.ts +1 -0
  464. package/node_modules/@agentclientprotocol/sdk/dist/acp.test.js +5036 -0
  465. package/node_modules/@agentclientprotocol/sdk/dist/acp.test.js.map +1 -0
  466. package/node_modules/@agentclientprotocol/sdk/dist/connection.d.ts +89 -0
  467. package/node_modules/@agentclientprotocol/sdk/dist/connection.js +490 -0
  468. package/node_modules/@agentclientprotocol/sdk/dist/connection.js.map +1 -0
  469. package/node_modules/@agentclientprotocol/sdk/dist/connection.test.d.ts +1 -0
  470. package/node_modules/@agentclientprotocol/sdk/dist/connection.test.js +507 -0
  471. package/node_modules/@agentclientprotocol/sdk/dist/connection.test.js.map +1 -0
  472. package/node_modules/@agentclientprotocol/sdk/dist/cookie-store.d.ts +26 -0
  473. package/node_modules/@agentclientprotocol/sdk/dist/cookie-store.js +96 -0
  474. package/node_modules/@agentclientprotocol/sdk/dist/cookie-store.js.map +1 -0
  475. package/node_modules/@agentclientprotocol/sdk/dist/cookie-store.test.d.ts +1 -0
  476. package/node_modules/@agentclientprotocol/sdk/dist/cookie-store.test.js +77 -0
  477. package/node_modules/@agentclientprotocol/sdk/dist/cookie-store.test.js.map +1 -0
  478. package/node_modules/@agentclientprotocol/sdk/dist/examples/agent.d.ts +2 -0
  479. package/node_modules/@agentclientprotocol/sdk/dist/examples/agent.js +232 -0
  480. package/node_modules/@agentclientprotocol/sdk/dist/examples/agent.js.map +1 -0
  481. package/node_modules/@agentclientprotocol/sdk/dist/examples/client.d.ts +2 -0
  482. package/node_modules/@agentclientprotocol/sdk/dist/examples/client.js +132 -0
  483. package/node_modules/@agentclientprotocol/sdk/dist/examples/client.js.map +1 -0
  484. package/node_modules/@agentclientprotocol/sdk/dist/examples/dual-version-agent.d.ts +9 -0
  485. package/node_modules/@agentclientprotocol/sdk/dist/examples/dual-version-agent.js +221 -0
  486. package/node_modules/@agentclientprotocol/sdk/dist/examples/dual-version-agent.js.map +1 -0
  487. package/node_modules/@agentclientprotocol/sdk/dist/examples/http-client.d.ts +2 -0
  488. package/node_modules/@agentclientprotocol/sdk/dist/examples/http-client.js +86 -0
  489. package/node_modules/@agentclientprotocol/sdk/dist/examples/http-client.js.map +1 -0
  490. package/node_modules/@agentclientprotocol/sdk/dist/examples/http-server.d.ts +2 -0
  491. package/node_modules/@agentclientprotocol/sdk/dist/examples/http-server.js +112 -0
  492. package/node_modules/@agentclientprotocol/sdk/dist/examples/http-server.js.map +1 -0
  493. package/node_modules/@agentclientprotocol/sdk/dist/examples/ws-client.d.ts +2 -0
  494. package/node_modules/@agentclientprotocol/sdk/dist/examples/ws-client.js +88 -0
  495. package/node_modules/@agentclientprotocol/sdk/dist/examples/ws-client.js.map +1 -0
  496. package/node_modules/@agentclientprotocol/sdk/dist/http-stream.d.ts +33 -0
  497. package/node_modules/@agentclientprotocol/sdk/dist/http-stream.js +435 -0
  498. package/node_modules/@agentclientprotocol/sdk/dist/http-stream.js.map +1 -0
  499. package/node_modules/@agentclientprotocol/sdk/dist/http-stream.test.d.ts +1 -0
  500. package/node_modules/@agentclientprotocol/sdk/dist/http-stream.test.js +1380 -0
  501. package/node_modules/@agentclientprotocol/sdk/dist/http-stream.test.js.map +1 -0
  502. package/node_modules/@agentclientprotocol/sdk/dist/jsonrpc.d.ts +603 -0
  503. package/node_modules/@agentclientprotocol/sdk/dist/jsonrpc.js +1076 -0
  504. package/node_modules/@agentclientprotocol/sdk/dist/jsonrpc.js.map +1 -0
  505. package/node_modules/@agentclientprotocol/sdk/dist/jsonrpc.test.d.ts +1 -0
  506. package/node_modules/@agentclientprotocol/sdk/dist/jsonrpc.test.js +917 -0
  507. package/node_modules/@agentclientprotocol/sdk/dist/jsonrpc.test.js.map +1 -0
  508. package/node_modules/@agentclientprotocol/sdk/dist/line-buffer.d.ts +22 -0
  509. package/node_modules/@agentclientprotocol/sdk/dist/line-buffer.js +64 -0
  510. package/node_modules/@agentclientprotocol/sdk/dist/line-buffer.js.map +1 -0
  511. package/node_modules/@agentclientprotocol/sdk/dist/line-buffer.test.d.ts +1 -0
  512. package/node_modules/@agentclientprotocol/sdk/dist/line-buffer.test.js +45 -0
  513. package/node_modules/@agentclientprotocol/sdk/dist/line-buffer.test.js.map +1 -0
  514. package/node_modules/@agentclientprotocol/sdk/dist/node-adapter.d.ts +17 -0
  515. package/node_modules/@agentclientprotocol/sdk/dist/node-adapter.js +426 -0
  516. package/node_modules/@agentclientprotocol/sdk/dist/node-adapter.js.map +1 -0
  517. package/node_modules/@agentclientprotocol/sdk/dist/node-adapter.test.d.ts +1 -0
  518. package/node_modules/@agentclientprotocol/sdk/dist/node-adapter.test.js +499 -0
  519. package/node_modules/@agentclientprotocol/sdk/dist/node-adapter.test.js.map +1 -0
  520. package/node_modules/@agentclientprotocol/sdk/dist/protocol-router.d.ts +37 -0
  521. package/node_modules/@agentclientprotocol/sdk/dist/protocol-router.js +474 -0
  522. package/node_modules/@agentclientprotocol/sdk/dist/protocol-router.js.map +1 -0
  523. package/node_modules/@agentclientprotocol/sdk/dist/protocol-router.test.d.ts +1 -0
  524. package/node_modules/@agentclientprotocol/sdk/dist/protocol-router.test.js +535 -0
  525. package/node_modules/@agentclientprotocol/sdk/dist/protocol-router.test.js.map +1 -0
  526. package/node_modules/@agentclientprotocol/sdk/dist/protocol.d.ts +11 -0
  527. package/node_modules/@agentclientprotocol/sdk/dist/protocol.js +69 -0
  528. package/node_modules/@agentclientprotocol/sdk/dist/protocol.js.map +1 -0
  529. package/node_modules/@agentclientprotocol/sdk/dist/protocol.test.d.ts +1 -0
  530. package/node_modules/@agentclientprotocol/sdk/dist/protocol.test.js +82 -0
  531. package/node_modules/@agentclientprotocol/sdk/dist/protocol.test.js.map +1 -0
  532. package/node_modules/@agentclientprotocol/sdk/dist/schema/guards.gen.d.ts +183 -0
  533. package/node_modules/@agentclientprotocol/sdk/dist/schema/guards.gen.js +207 -0
  534. package/node_modules/@agentclientprotocol/sdk/dist/schema/guards.gen.js.map +1 -0
  535. package/node_modules/@agentclientprotocol/sdk/dist/schema/index.d.ts +51 -0
  536. package/node_modules/@agentclientprotocol/sdk/dist/schema/index.js +52 -0
  537. package/node_modules/@agentclientprotocol/sdk/dist/schema/index.js.map +1 -0
  538. package/node_modules/@agentclientprotocol/sdk/dist/schema/types.gen.d.ts +6219 -0
  539. package/node_modules/@agentclientprotocol/sdk/dist/schema/types.gen.js +3 -0
  540. package/node_modules/@agentclientprotocol/sdk/dist/schema/types.gen.js.map +1 -0
  541. package/node_modules/@agentclientprotocol/sdk/dist/schema/zod.gen.d.ts +15215 -0
  542. package/node_modules/@agentclientprotocol/sdk/dist/schema/zod.gen.js +3084 -0
  543. package/node_modules/@agentclientprotocol/sdk/dist/schema/zod.gen.js.map +1 -0
  544. package/node_modules/@agentclientprotocol/sdk/dist/schema-deserialize.d.ts +30 -0
  545. package/node_modules/@agentclientprotocol/sdk/dist/schema-deserialize.js +98 -0
  546. package/node_modules/@agentclientprotocol/sdk/dist/schema-deserialize.js.map +1 -0
  547. package/node_modules/@agentclientprotocol/sdk/dist/schema-deserialize.test.d.ts +1 -0
  548. package/node_modules/@agentclientprotocol/sdk/dist/schema-deserialize.test.js +93 -0
  549. package/node_modules/@agentclientprotocol/sdk/dist/schema-deserialize.test.js.map +1 -0
  550. package/node_modules/@agentclientprotocol/sdk/dist/server-permission.test.d.ts +1 -0
  551. package/node_modules/@agentclientprotocol/sdk/dist/server-permission.test.js +261 -0
  552. package/node_modules/@agentclientprotocol/sdk/dist/server-permission.test.js.map +1 -0
  553. package/node_modules/@agentclientprotocol/sdk/dist/server-session-sse.test.d.ts +1 -0
  554. package/node_modules/@agentclientprotocol/sdk/dist/server-session-sse.test.js +536 -0
  555. package/node_modules/@agentclientprotocol/sdk/dist/server-session-sse.test.js.map +1 -0
  556. package/node_modules/@agentclientprotocol/sdk/dist/server-sse.d.ts +2 -0
  557. package/node_modules/@agentclientprotocol/sdk/dist/server-sse.js +88 -0
  558. package/node_modules/@agentclientprotocol/sdk/dist/server-sse.js.map +1 -0
  559. package/node_modules/@agentclientprotocol/sdk/dist/server-sse.test.d.ts +1 -0
  560. package/node_modules/@agentclientprotocol/sdk/dist/server-sse.test.js +53 -0
  561. package/node_modules/@agentclientprotocol/sdk/dist/server-sse.test.js.map +1 -0
  562. package/node_modules/@agentclientprotocol/sdk/dist/server-websocket-upgrade.test.d.ts +1 -0
  563. package/node_modules/@agentclientprotocol/sdk/dist/server-websocket-upgrade.test.js +992 -0
  564. package/node_modules/@agentclientprotocol/sdk/dist/server-websocket-upgrade.test.js.map +1 -0
  565. package/node_modules/@agentclientprotocol/sdk/dist/server.d.ts +81 -0
  566. package/node_modules/@agentclientprotocol/sdk/dist/server.js +386 -0
  567. package/node_modules/@agentclientprotocol/sdk/dist/server.js.map +1 -0
  568. package/node_modules/@agentclientprotocol/sdk/dist/server.test.d.ts +1 -0
  569. package/node_modules/@agentclientprotocol/sdk/dist/server.test.js +1116 -0
  570. package/node_modules/@agentclientprotocol/sdk/dist/server.test.js.map +1 -0
  571. package/node_modules/@agentclientprotocol/sdk/dist/sse.d.ts +4 -0
  572. package/node_modules/@agentclientprotocol/sdk/dist/sse.js +91 -0
  573. package/node_modules/@agentclientprotocol/sdk/dist/sse.js.map +1 -0
  574. package/node_modules/@agentclientprotocol/sdk/dist/sse.test.d.ts +1 -0
  575. package/node_modules/@agentclientprotocol/sdk/dist/sse.test.js +126 -0
  576. package/node_modules/@agentclientprotocol/sdk/dist/sse.test.js.map +1 -0
  577. package/node_modules/@agentclientprotocol/sdk/dist/stream.d.ts +35 -0
  578. package/node_modules/@agentclientprotocol/sdk/dist/stream.js +115 -0
  579. package/node_modules/@agentclientprotocol/sdk/dist/stream.js.map +1 -0
  580. package/node_modules/@agentclientprotocol/sdk/dist/stream.test.d.ts +1 -0
  581. package/node_modules/@agentclientprotocol/sdk/dist/stream.test.js +195 -0
  582. package/node_modules/@agentclientprotocol/sdk/dist/stream.test.js.map +1 -0
  583. package/node_modules/@agentclientprotocol/sdk/dist/test-support/streams.d.ts +8 -0
  584. package/node_modules/@agentclientprotocol/sdk/dist/test-support/streams.js +51 -0
  585. package/node_modules/@agentclientprotocol/sdk/dist/test-support/streams.js.map +1 -0
  586. package/node_modules/@agentclientprotocol/sdk/dist/test-support/test-agent.d.ts +24 -0
  587. package/node_modules/@agentclientprotocol/sdk/dist/test-support/test-agent.js +163 -0
  588. package/node_modules/@agentclientprotocol/sdk/dist/test-support/test-agent.js.map +1 -0
  589. package/node_modules/@agentclientprotocol/sdk/dist/test-support/test-http-server.d.ts +9 -0
  590. package/node_modules/@agentclientprotocol/sdk/dist/test-support/test-http-server.js +74 -0
  591. package/node_modules/@agentclientprotocol/sdk/dist/test-support/test-http-server.js.map +1 -0
  592. package/node_modules/@agentclientprotocol/sdk/dist/v2/acp.d.ts +957 -0
  593. package/node_modules/@agentclientprotocol/sdk/dist/v2/acp.js +1484 -0
  594. package/node_modules/@agentclientprotocol/sdk/dist/v2/acp.js.map +1 -0
  595. package/node_modules/@agentclientprotocol/sdk/dist/v2/acp.test.d.ts +1 -0
  596. package/node_modules/@agentclientprotocol/sdk/dist/v2/acp.test.js +1287 -0
  597. package/node_modules/@agentclientprotocol/sdk/dist/v2/acp.test.js.map +1 -0
  598. package/node_modules/@agentclientprotocol/sdk/dist/v2/schema/guards.gen.d.ts +946 -0
  599. package/node_modules/@agentclientprotocol/sdk/dist/v2/schema/guards.gen.js +1046 -0
  600. package/node_modules/@agentclientprotocol/sdk/dist/v2/schema/guards.gen.js.map +1 -0
  601. package/node_modules/@agentclientprotocol/sdk/dist/v2/schema/index.d.ts +42 -0
  602. package/node_modules/@agentclientprotocol/sdk/dist/v2/schema/index.js +43 -0
  603. package/node_modules/@agentclientprotocol/sdk/dist/v2/schema/index.js.map +1 -0
  604. package/node_modules/@agentclientprotocol/sdk/dist/v2/schema/types.gen.d.ts +6208 -0
  605. package/node_modules/@agentclientprotocol/sdk/dist/v2/schema/types.gen.js +3 -0
  606. package/node_modules/@agentclientprotocol/sdk/dist/v2/schema/types.gen.js.map +1 -0
  607. package/node_modules/@agentclientprotocol/sdk/dist/v2/schema/zod.gen.d.ts +33267 -0
  608. package/node_modules/@agentclientprotocol/sdk/dist/v2/schema/zod.gen.js +3199 -0
  609. package/node_modules/@agentclientprotocol/sdk/dist/v2/schema/zod.gen.js.map +1 -0
  610. package/node_modules/@agentclientprotocol/sdk/dist/ws-server.d.ts +14 -0
  611. package/node_modules/@agentclientprotocol/sdk/dist/ws-server.js +357 -0
  612. package/node_modules/@agentclientprotocol/sdk/dist/ws-server.js.map +1 -0
  613. package/node_modules/@agentclientprotocol/sdk/dist/ws-stream.d.ts +54 -0
  614. package/node_modules/@agentclientprotocol/sdk/dist/ws-stream.js +253 -0
  615. package/node_modules/@agentclientprotocol/sdk/dist/ws-stream.js.map +1 -0
  616. package/node_modules/@agentclientprotocol/sdk/dist/ws-stream.test.d.ts +1 -0
  617. package/node_modules/@agentclientprotocol/sdk/dist/ws-stream.test.js +836 -0
  618. package/node_modules/@agentclientprotocol/sdk/dist/ws-stream.test.js.map +1 -0
  619. package/node_modules/@agentclientprotocol/sdk/dist/ws-utils.d.ts +13 -0
  620. package/node_modules/@agentclientprotocol/sdk/dist/ws-utils.js +78 -0
  621. package/node_modules/@agentclientprotocol/sdk/dist/ws-utils.js.map +1 -0
  622. package/node_modules/@agentclientprotocol/sdk/dist/ws-utils.test.d.ts +1 -0
  623. package/node_modules/@agentclientprotocol/sdk/dist/ws-utils.test.js +42 -0
  624. package/node_modules/@agentclientprotocol/sdk/dist/ws-utils.test.js.map +1 -0
  625. package/node_modules/@agentclientprotocol/sdk/package.json +104 -0
  626. package/node_modules/@agentclientprotocol/sdk/schema/schema.json +8967 -0
  627. package/node_modules/@agentclientprotocol/sdk/schema/v2/schema.unstable.json +10242 -0
  628. package/node_modules/@clack/core/LICENSE +9 -0
  629. package/node_modules/@clack/core/README.md +22 -0
  630. package/node_modules/@clack/core/dist/index.d.mts +503 -0
  631. package/node_modules/@clack/core/dist/index.mjs +1003 -0
  632. package/node_modules/@clack/core/package.json +63 -0
  633. package/node_modules/@clack/prompts/LICENSE +9 -0
  634. package/node_modules/@clack/prompts/README.md +396 -0
  635. package/node_modules/@clack/prompts/dist/index.d.mts +949 -0
  636. package/node_modules/@clack/prompts/dist/index.mjs +1423 -0
  637. package/node_modules/@clack/prompts/package.json +67 -0
  638. package/node_modules/@esbuild/linux-x64/README.md +3 -0
  639. package/node_modules/@esbuild/linux-x64/bin/esbuild +0 -0
  640. package/node_modules/@esbuild/linux-x64/package.json +20 -0
  641. package/node_modules/acpx/LICENSE +21 -0
  642. package/node_modules/acpx/README.md +424 -0
  643. package/node_modules/acpx/dist/cli-CxsS1XQp.js +197 -0
  644. package/node_modules/acpx/dist/cli-CxsS1XQp.js.map +1 -0
  645. package/node_modules/acpx/dist/cli.d.ts +14 -0
  646. package/node_modules/acpx/dist/cli.d.ts.map +1 -0
  647. package/node_modules/acpx/dist/cli.js +2683 -0
  648. package/node_modules/acpx/dist/cli.js.map +1 -0
  649. package/node_modules/acpx/dist/client-DwNyFauq.d.ts +192 -0
  650. package/node_modules/acpx/dist/client-DwNyFauq.d.ts.map +1 -0
  651. package/node_modules/acpx/dist/flags-Bjq_XQ4-.js +260 -0
  652. package/node_modules/acpx/dist/flags-Bjq_XQ4-.js.map +1 -0
  653. package/node_modules/acpx/dist/flows-Db_LZKu9.js +1920 -0
  654. package/node_modules/acpx/dist/flows-Db_LZKu9.js.map +1 -0
  655. package/node_modules/acpx/dist/flows.d.ts +318 -0
  656. package/node_modules/acpx/dist/flows.d.ts.map +1 -0
  657. package/node_modules/acpx/dist/flows.js +2 -0
  658. package/node_modules/acpx/dist/live-checkpoint-ClPCSdrW.js +6210 -0
  659. package/node_modules/acpx/dist/live-checkpoint-ClPCSdrW.js.map +1 -0
  660. package/node_modules/acpx/dist/output-CjdF5rHk.js +4593 -0
  661. package/node_modules/acpx/dist/output-CjdF5rHk.js.map +1 -0
  662. package/node_modules/acpx/dist/runtime.d.ts +472 -0
  663. package/node_modules/acpx/dist/runtime.d.ts.map +1 -0
  664. package/node_modules/acpx/dist/runtime.js +1711 -0
  665. package/node_modules/acpx/dist/runtime.js.map +1 -0
  666. package/node_modules/acpx/dist/session-options-jkYbBxGE.d.ts +278 -0
  667. package/node_modules/acpx/dist/session-options-jkYbBxGE.d.ts.map +1 -0
  668. package/node_modules/acpx/package.json +129 -0
  669. package/node_modules/acpx/skills/acpx/SKILL.md +617 -0
  670. package/node_modules/b4a/LICENSE +201 -0
  671. package/node_modules/b4a/README.md +153 -0
  672. package/node_modules/b4a/browser.js +546 -0
  673. package/node_modules/b4a/index.d.ts +144 -0
  674. package/node_modules/b4a/index.js +193 -0
  675. package/node_modules/b4a/lib/ascii.js +31 -0
  676. package/node_modules/b4a/lib/base64.js +64 -0
  677. package/node_modules/b4a/lib/hex.js +51 -0
  678. package/node_modules/b4a/lib/latin1.js +31 -0
  679. package/node_modules/b4a/lib/utf16le.js +40 -0
  680. package/node_modules/b4a/lib/utf8.js +144 -0
  681. package/node_modules/b4a/package.json +54 -0
  682. package/node_modules/b4a/react-native.js +5 -0
  683. package/node_modules/b4a/runtime.d.ts +14 -0
  684. package/node_modules/bare-events/LICENSE +201 -0
  685. package/node_modules/bare-events/README.md +25 -0
  686. package/node_modules/bare-events/global.d.ts +15 -0
  687. package/node_modules/bare-events/global.js +5 -0
  688. package/node_modules/bare-events/index.d.ts +89 -0
  689. package/node_modules/bare-events/index.js +397 -0
  690. package/node_modules/bare-events/lib/errors.js +23 -0
  691. package/node_modules/bare-events/package.json +63 -0
  692. package/node_modules/bare-events/web.d.ts +79 -0
  693. package/node_modules/bare-events/web.js +417 -0
  694. package/node_modules/bare-fs/CMakeLists.txt +13 -0
  695. package/node_modules/bare-fs/LICENSE +201 -0
  696. package/node_modules/bare-fs/README.md +33 -0
  697. package/node_modules/bare-fs/binding.c +2913 -0
  698. package/node_modules/bare-fs/binding.js +1 -0
  699. package/node_modules/bare-fs/index.d.ts +1502 -0
  700. package/node_modules/bare-fs/index.js +2855 -0
  701. package/node_modules/bare-fs/lib/constants.d.ts +50 -0
  702. package/node_modules/bare-fs/lib/constants.js +49 -0
  703. package/node_modules/bare-fs/lib/errors.d.ts +13 -0
  704. package/node_modules/bare-fs/lib/errors.js +55 -0
  705. package/node_modules/bare-fs/package.json +74 -0
  706. package/node_modules/bare-fs/prebuilds/android-arm/bare-fs.bare +0 -0
  707. package/node_modules/bare-fs/prebuilds/android-arm64/bare-fs.bare +0 -0
  708. package/node_modules/bare-fs/prebuilds/android-ia32/bare-fs.bare +0 -0
  709. package/node_modules/bare-fs/prebuilds/android-x64/bare-fs.bare +0 -0
  710. package/node_modules/bare-fs/prebuilds/darwin-arm64/bare-fs.bare +0 -0
  711. package/node_modules/bare-fs/prebuilds/darwin-x64/bare-fs.bare +0 -0
  712. package/node_modules/bare-fs/prebuilds/ios-arm64/bare-fs.bare +0 -0
  713. package/node_modules/bare-fs/prebuilds/ios-arm64-simulator/bare-fs.bare +0 -0
  714. package/node_modules/bare-fs/prebuilds/ios-x64-simulator/bare-fs.bare +0 -0
  715. package/node_modules/bare-fs/prebuilds/linux-arm64/bare-fs.bare +0 -0
  716. package/node_modules/bare-fs/prebuilds/linux-x64/bare-fs.bare +0 -0
  717. package/node_modules/bare-fs/prebuilds/win32-arm64/bare-fs.bare +0 -0
  718. package/node_modules/bare-fs/prebuilds/win32-x64/bare-fs.bare +0 -0
  719. package/node_modules/bare-fs/promises.d.ts +480 -0
  720. package/node_modules/bare-fs/promises.js +119 -0
  721. package/node_modules/bare-path/CMakeLists.txt +13 -0
  722. package/node_modules/bare-path/LICENSE +201 -0
  723. package/node_modules/bare-path/NOTICE +28 -0
  724. package/node_modules/bare-path/README.md +19 -0
  725. package/node_modules/bare-path/binding.c +106 -0
  726. package/node_modules/bare-path/binding.js +1 -0
  727. package/node_modules/bare-path/index.d.ts +27 -0
  728. package/node_modules/bare-path/index.js +9 -0
  729. package/node_modules/bare-path/lib/constants.js +11 -0
  730. package/node_modules/bare-path/lib/posix.js +263 -0
  731. package/node_modules/bare-path/lib/shared.js +81 -0
  732. package/node_modules/bare-path/lib/win32.js +564 -0
  733. package/node_modules/bare-path/package.json +47 -0
  734. package/node_modules/bare-path/prebuilds/android-arm/bare-path.bare +0 -0
  735. package/node_modules/bare-path/prebuilds/android-arm64/bare-path.bare +0 -0
  736. package/node_modules/bare-path/prebuilds/android-ia32/bare-path.bare +0 -0
  737. package/node_modules/bare-path/prebuilds/android-x64/bare-path.bare +0 -0
  738. package/node_modules/bare-path/prebuilds/darwin-arm64/bare-path.bare +0 -0
  739. package/node_modules/bare-path/prebuilds/darwin-x64/bare-path.bare +0 -0
  740. package/node_modules/bare-path/prebuilds/ios-arm64/bare-path.bare +0 -0
  741. package/node_modules/bare-path/prebuilds/ios-arm64-simulator/bare-path.bare +0 -0
  742. package/node_modules/bare-path/prebuilds/ios-x64-simulator/bare-path.bare +0 -0
  743. package/node_modules/bare-path/prebuilds/linux-arm64/bare-path.bare +0 -0
  744. package/node_modules/bare-path/prebuilds/linux-x64/bare-path.bare +0 -0
  745. package/node_modules/bare-path/prebuilds/win32-arm64/bare-path.bare +0 -0
  746. package/node_modules/bare-path/prebuilds/win32-x64/bare-path.bare +0 -0
  747. package/node_modules/bare-stream/LICENSE +201 -0
  748. package/node_modules/bare-stream/README.md +354 -0
  749. package/node_modules/bare-stream/global.d.ts +31 -0
  750. package/node_modules/bare-stream/global.js +15 -0
  751. package/node_modules/bare-stream/index.d.ts +235 -0
  752. package/node_modules/bare-stream/index.js +493 -0
  753. package/node_modules/bare-stream/package.json +75 -0
  754. package/node_modules/bare-stream/promises.js +3 -0
  755. package/node_modules/bare-stream/web.d.ts +152 -0
  756. package/node_modules/bare-stream/web.js +607 -0
  757. package/node_modules/bare-url/CMakeLists.txt +36 -0
  758. package/node_modules/bare-url/LICENSE +201 -0
  759. package/node_modules/bare-url/README.md +33 -0
  760. package/node_modules/bare-url/binding.c +422 -0
  761. package/node_modules/bare-url/binding.js +1 -0
  762. package/node_modules/bare-url/global.d.ts +24 -0
  763. package/node_modules/bare-url/global.js +2 -0
  764. package/node_modules/bare-url/index.d.ts +96 -0
  765. package/node_modules/bare-url/index.js +676 -0
  766. package/node_modules/bare-url/lib/errors.d.ts +10 -0
  767. package/node_modules/bare-url/lib/errors.js +33 -0
  768. package/node_modules/bare-url/lib/url-search-params.d.ts +66 -0
  769. package/node_modules/bare-url/lib/url-search-params.js +276 -0
  770. package/node_modules/bare-url/package.json +54 -0
  771. package/node_modules/bare-url/prebuilds/android-arm/bare-url.bare +0 -0
  772. package/node_modules/bare-url/prebuilds/android-arm64/bare-url.bare +0 -0
  773. package/node_modules/bare-url/prebuilds/android-ia32/bare-url.bare +0 -0
  774. package/node_modules/bare-url/prebuilds/android-x64/bare-url.bare +0 -0
  775. package/node_modules/bare-url/prebuilds/darwin-arm64/bare-url.bare +0 -0
  776. package/node_modules/bare-url/prebuilds/darwin-x64/bare-url.bare +0 -0
  777. package/node_modules/bare-url/prebuilds/ios-arm64/bare-url.bare +0 -0
  778. package/node_modules/bare-url/prebuilds/ios-arm64-simulator/bare-url.bare +0 -0
  779. package/node_modules/bare-url/prebuilds/ios-x64-simulator/bare-url.bare +0 -0
  780. package/node_modules/bare-url/prebuilds/linux-arm64/bare-url.bare +0 -0
  781. package/node_modules/bare-url/prebuilds/linux-x64/bare-url.bare +0 -0
  782. package/node_modules/bare-url/prebuilds/win32-arm64/bare-url.bare +0 -0
  783. package/node_modules/bare-url/prebuilds/win32-x64/bare-url.bare +0 -0
  784. package/node_modules/commander/LICENSE +22 -0
  785. package/node_modules/commander/Readme.md +1172 -0
  786. package/node_modules/commander/index.js +21 -0
  787. package/node_modules/commander/lib/argument.js +147 -0
  788. package/node_modules/commander/lib/command.js +2790 -0
  789. package/node_modules/commander/lib/error.js +36 -0
  790. package/node_modules/commander/lib/help.js +731 -0
  791. package/node_modules/commander/lib/option.js +377 -0
  792. package/node_modules/commander/lib/suggestSimilar.js +99 -0
  793. package/node_modules/commander/package-support.json +19 -0
  794. package/node_modules/commander/package.json +64 -0
  795. package/node_modules/commander/typings/index.d.ts +1113 -0
  796. package/node_modules/esbuild/LICENSE.md +21 -0
  797. package/node_modules/esbuild/README.md +3 -0
  798. package/node_modules/esbuild/bin/esbuild +223 -0
  799. package/node_modules/esbuild/install.js +300 -0
  800. package/node_modules/esbuild/lib/main.d.ts +720 -0
  801. package/node_modules/esbuild/lib/main.js +2536 -0
  802. package/node_modules/esbuild/package.json +74 -0
  803. package/node_modules/events-universal/LICENSE +201 -0
  804. package/node_modules/events-universal/README.md +17 -0
  805. package/node_modules/events-universal/bare.js +1 -0
  806. package/node_modules/events-universal/default.js +1 -0
  807. package/node_modules/events-universal/index.js +1 -0
  808. package/node_modules/events-universal/package.json +39 -0
  809. package/node_modules/events-universal/react-native.js +1 -0
  810. package/node_modules/fast-fifo/LICENSE +21 -0
  811. package/node_modules/fast-fifo/README.md +78 -0
  812. package/node_modules/fast-fifo/fixed-size.js +39 -0
  813. package/node_modules/fast-fifo/index.js +48 -0
  814. package/node_modules/fast-fifo/package.json +28 -0
  815. package/node_modules/fast-string-truncated-width/dist/index.d.ts +4 -0
  816. package/node_modules/fast-string-truncated-width/dist/index.js +111 -0
  817. package/node_modules/fast-string-truncated-width/dist/types.d.ts +19 -0
  818. package/node_modules/fast-string-truncated-width/dist/types.js +2 -0
  819. package/node_modules/fast-string-truncated-width/dist/utils.d.ts +4 -0
  820. package/node_modules/fast-string-truncated-width/dist/utils.js +20 -0
  821. package/node_modules/fast-string-truncated-width/license +21 -0
  822. package/node_modules/fast-string-truncated-width/package.json +35 -0
  823. package/node_modules/fast-string-truncated-width/readme.md +59 -0
  824. package/node_modules/fast-string-width/dist/index.d.ts +4 -0
  825. package/node_modules/fast-string-width/dist/index.js +14 -0
  826. package/node_modules/fast-string-width/license +21 -0
  827. package/node_modules/fast-string-width/package.json +34 -0
  828. package/node_modules/fast-string-width/readme.md +42 -0
  829. package/node_modules/fast-wrap-ansi/LICENSE +23 -0
  830. package/node_modules/fast-wrap-ansi/README.md +26 -0
  831. package/node_modules/fast-wrap-ansi/lib/main.d.ts +6 -0
  832. package/node_modules/fast-wrap-ansi/lib/main.js +218 -0
  833. package/node_modules/fast-wrap-ansi/package.json +51 -0
  834. package/node_modules/sisteransi/license +21 -0
  835. package/node_modules/sisteransi/package.json +34 -0
  836. package/node_modules/sisteransi/readme.md +113 -0
  837. package/node_modules/sisteransi/src/index.js +58 -0
  838. package/node_modules/sisteransi/src/sisteransi.d.ts +35 -0
  839. package/node_modules/skillflag/LICENSE +21 -0
  840. package/node_modules/skillflag/README.md +44 -0
  841. package/node_modules/skillflag/dist/bin/skill-install.d.ts +3 -0
  842. package/node_modules/skillflag/dist/bin/skill-install.d.ts.map +1 -0
  843. package/node_modules/skillflag/dist/bin/skill-install.js +6 -0
  844. package/node_modules/skillflag/dist/bin/skill-install.js.map +1 -0
  845. package/node_modules/skillflag/dist/bin/skillflag.d.ts +3 -0
  846. package/node_modules/skillflag/dist/bin/skillflag.d.ts.map +1 -0
  847. package/node_modules/skillflag/dist/bin/skillflag.js +25 -0
  848. package/node_modules/skillflag/dist/bin/skillflag.js.map +1 -0
  849. package/node_modules/skillflag/dist/core/digest.d.ts +2 -0
  850. package/node_modules/skillflag/dist/core/digest.d.ts.map +1 -0
  851. package/node_modules/skillflag/dist/core/digest.js +15 -0
  852. package/node_modules/skillflag/dist/core/digest.js.map +1 -0
  853. package/node_modules/skillflag/dist/core/errors.d.ts +6 -0
  854. package/node_modules/skillflag/dist/core/errors.d.ts.map +1 -0
  855. package/node_modules/skillflag/dist/core/errors.js +13 -0
  856. package/node_modules/skillflag/dist/core/errors.js.map +1 -0
  857. package/node_modules/skillflag/dist/core/export.d.ts +2 -0
  858. package/node_modules/skillflag/dist/core/export.d.ts.map +1 -0
  859. package/node_modules/skillflag/dist/core/export.js +28 -0
  860. package/node_modules/skillflag/dist/core/export.js.map +1 -0
  861. package/node_modules/skillflag/dist/core/list.d.ts +21 -0
  862. package/node_modules/skillflag/dist/core/list.d.ts.map +1 -0
  863. package/node_modules/skillflag/dist/core/list.js +71 -0
  864. package/node_modules/skillflag/dist/core/list.js.map +1 -0
  865. package/node_modules/skillflag/dist/core/paths.d.ts +15 -0
  866. package/node_modules/skillflag/dist/core/paths.d.ts.map +1 -0
  867. package/node_modules/skillflag/dist/core/paths.js +149 -0
  868. package/node_modules/skillflag/dist/core/paths.js.map +1 -0
  869. package/node_modules/skillflag/dist/core/show.d.ts +2 -0
  870. package/node_modules/skillflag/dist/core/show.d.ts.map +1 -0
  871. package/node_modules/skillflag/dist/core/show.js +8 -0
  872. package/node_modules/skillflag/dist/core/show.js.map +1 -0
  873. package/node_modules/skillflag/dist/core/skillflag.d.ts +3 -0
  874. package/node_modules/skillflag/dist/core/skillflag.d.ts.map +1 -0
  875. package/node_modules/skillflag/dist/core/skillflag.js +2 -0
  876. package/node_modules/skillflag/dist/core/skillflag.js.map +1 -0
  877. package/node_modules/skillflag/dist/core/tar.d.ts +16 -0
  878. package/node_modules/skillflag/dist/core/tar.d.ts.map +1 -0
  879. package/node_modules/skillflag/dist/core/tar.js +140 -0
  880. package/node_modules/skillflag/dist/core/tar.js.map +1 -0
  881. package/node_modules/skillflag/dist/index.d.ts +5 -0
  882. package/node_modules/skillflag/dist/index.d.ts.map +1 -0
  883. package/node_modules/skillflag/dist/index.js +3 -0
  884. package/node_modules/skillflag/dist/index.js.map +1 -0
  885. package/node_modules/skillflag/dist/install/cli.d.ts +57 -0
  886. package/node_modules/skillflag/dist/install/cli.d.ts.map +1 -0
  887. package/node_modules/skillflag/dist/install/cli.js +653 -0
  888. package/node_modules/skillflag/dist/install/cli.js.map +1 -0
  889. package/node_modules/skillflag/dist/install/copy.d.ts +2 -0
  890. package/node_modules/skillflag/dist/install/copy.d.ts.map +1 -0
  891. package/node_modules/skillflag/dist/install/copy.js +19 -0
  892. package/node_modules/skillflag/dist/install/copy.js.map +1 -0
  893. package/node_modules/skillflag/dist/install/errors.d.ts +6 -0
  894. package/node_modules/skillflag/dist/install/errors.d.ts.map +1 -0
  895. package/node_modules/skillflag/dist/install/errors.js +13 -0
  896. package/node_modules/skillflag/dist/install/errors.js.map +1 -0
  897. package/node_modules/skillflag/dist/install/extract.d.ts +3 -0
  898. package/node_modules/skillflag/dist/install/extract.d.ts.map +1 -0
  899. package/node_modules/skillflag/dist/install/extract.js +76 -0
  900. package/node_modules/skillflag/dist/install/extract.js.map +1 -0
  901. package/node_modules/skillflag/dist/install/install.d.ts +21 -0
  902. package/node_modules/skillflag/dist/install/install.d.ts.map +1 -0
  903. package/node_modules/skillflag/dist/install/install.js +35 -0
  904. package/node_modules/skillflag/dist/install/install.js.map +1 -0
  905. package/node_modules/skillflag/dist/install/resolve.d.ts +12 -0
  906. package/node_modules/skillflag/dist/install/resolve.d.ts.map +1 -0
  907. package/node_modules/skillflag/dist/install/resolve.js +119 -0
  908. package/node_modules/skillflag/dist/install/resolve.js.map +1 -0
  909. package/node_modules/skillflag/dist/install/validate.d.ts +7 -0
  910. package/node_modules/skillflag/dist/install/validate.d.ts.map +1 -0
  911. package/node_modules/skillflag/dist/install/validate.js +28 -0
  912. package/node_modules/skillflag/dist/install/validate.js.map +1 -0
  913. package/node_modules/skillflag/dist/shared/frontmatter.d.ts +2 -0
  914. package/node_modules/skillflag/dist/shared/frontmatter.d.ts.map +1 -0
  915. package/node_modules/skillflag/dist/shared/frontmatter.js +28 -0
  916. package/node_modules/skillflag/dist/shared/frontmatter.js.map +1 -0
  917. package/node_modules/skillflag/dist/skillflag.d.ts +29 -0
  918. package/node_modules/skillflag/dist/skillflag.d.ts.map +1 -0
  919. package/node_modules/skillflag/dist/skillflag.js +230 -0
  920. package/node_modules/skillflag/dist/skillflag.js.map +1 -0
  921. package/node_modules/skillflag/dist/utils/collections.d.ts +3 -0
  922. package/node_modules/skillflag/dist/utils/collections.d.ts.map +1 -0
  923. package/node_modules/skillflag/dist/utils/collections.js +18 -0
  924. package/node_modules/skillflag/dist/utils/collections.js.map +1 -0
  925. package/node_modules/skillflag/package.json +78 -0
  926. package/node_modules/skillflag/skills/skillflag/SKILL.md +144 -0
  927. package/node_modules/streamx/LICENSE +21 -0
  928. package/node_modules/streamx/README.md +550 -0
  929. package/node_modules/streamx/index.d.ts +198 -0
  930. package/node_modules/streamx/index.js +1314 -0
  931. package/node_modules/streamx/lib/errors.d.ts +13 -0
  932. package/node_modules/streamx/lib/errors.js +47 -0
  933. package/node_modules/streamx/package.json +51 -0
  934. package/node_modules/streamx/runtime.d.ts +55 -0
  935. package/node_modules/tar-stream/LICENSE +21 -0
  936. package/node_modules/tar-stream/README.md +183 -0
  937. package/node_modules/tar-stream/constants.js +14 -0
  938. package/node_modules/tar-stream/extract.js +418 -0
  939. package/node_modules/tar-stream/headers.js +322 -0
  940. package/node_modules/tar-stream/index.d.ts +60 -0
  941. package/node_modules/tar-stream/index.js +2 -0
  942. package/node_modules/tar-stream/pack.js +287 -0
  943. package/node_modules/tar-stream/package.json +50 -0
  944. package/node_modules/teex/LICENSE +21 -0
  945. package/node_modules/teex/README.md +31 -0
  946. package/node_modules/teex/example.js +16 -0
  947. package/node_modules/teex/index.js +52 -0
  948. package/node_modules/teex/package.json +26 -0
  949. package/node_modules/teex/test.js +68 -0
  950. package/node_modules/text-decoder/LICENSE +201 -0
  951. package/node_modules/text-decoder/README.md +36 -0
  952. package/node_modules/text-decoder/index.js +64 -0
  953. package/node_modules/text-decoder/lib/pass-through-decoder.js +19 -0
  954. package/node_modules/text-decoder/lib/utf8-decoder.js +185 -0
  955. package/node_modules/text-decoder/package.json +39 -0
  956. package/node_modules/tsx/LICENSE +21 -0
  957. package/node_modules/tsx/README.md +32 -0
  958. package/node_modules/tsx/dist/cjs/api/index.cjs +2 -0
  959. package/node_modules/tsx/dist/cjs/api/index.d.cts +35 -0
  960. package/node_modules/tsx/dist/cjs/api/index.d.mts +35 -0
  961. package/node_modules/tsx/dist/cjs/api/index.mjs +2 -0
  962. package/node_modules/tsx/dist/cjs/index.cjs +1 -0
  963. package/node_modules/tsx/dist/cli.mjs +55 -0
  964. package/node_modules/tsx/dist/client-XItNFmsq.cjs +1 -0
  965. package/node_modules/tsx/dist/esm/api/index.cjs +2 -0
  966. package/node_modules/tsx/dist/esm/api/index.d.cts +37 -0
  967. package/node_modules/tsx/dist/esm/api/index.d.mts +37 -0
  968. package/node_modules/tsx/dist/esm/api/index.mjs +2 -0
  969. package/node_modules/tsx/dist/esm/index.mjs +2 -0
  970. package/node_modules/tsx/dist/index-Bqjv9TxC.mjs +1 -0
  971. package/node_modules/tsx/dist/index-DE3OBZuV.mjs +14 -0
  972. package/node_modules/tsx/dist/lexer-CGfpMDSb.cjs +3 -0
  973. package/node_modules/tsx/dist/lexer-CanA6ArK.mjs +3 -0
  974. package/node_modules/tsx/dist/loader.mjs +2 -0
  975. package/node_modules/tsx/dist/package-Dj0mHsMt.mjs +1 -0
  976. package/node_modules/tsx/dist/patch-repl.cjs +1 -0
  977. package/node_modules/tsx/dist/preflight.cjs +1 -0
  978. package/node_modules/tsx/dist/register-B1c7OH6V.cjs +23 -0
  979. package/node_modules/tsx/dist/register-nyXW-TH3.mjs +2 -0
  980. package/node_modules/tsx/dist/repl.mjs +4 -0
  981. package/node_modules/tsx/dist/require-CBjy4Foe.mjs +10 -0
  982. package/node_modules/tsx/dist/require-CVaYn9z3.cjs +1 -0
  983. package/node_modules/tsx/dist/suppress-warnings.cjs +1 -0
  984. package/node_modules/tsx/dist/temporary-directory-Du7LpLp9.mjs +1 -0
  985. package/node_modules/tsx/package.json +70 -0
  986. package/node_modules/zod/LICENSE +21 -0
  987. package/node_modules/zod/README.md +218 -0
  988. package/node_modules/zod/compile.cjs +96 -0
  989. package/node_modules/zod/compile.d.cts +1 -0
  990. package/node_modules/zod/compile.d.ts +1 -0
  991. package/node_modules/zod/compile.js +52 -0
  992. package/node_modules/zod/index.cjs +52 -0
  993. package/node_modules/zod/index.d.cts +3 -0
  994. package/node_modules/zod/index.d.ts +3 -0
  995. package/node_modules/zod/index.js +7 -0
  996. package/node_modules/zod/locales/index.cjs +36 -0
  997. package/node_modules/zod/locales/index.d.cts +1 -0
  998. package/node_modules/zod/locales/index.d.ts +1 -0
  999. package/node_modules/zod/locales/index.js +1 -0
  1000. package/node_modules/zod/locales/package.json +7 -0
  1001. package/node_modules/zod/mini/index.cjs +51 -0
  1002. package/node_modules/zod/mini/index.d.cts +3 -0
  1003. package/node_modules/zod/mini/index.d.ts +3 -0
  1004. package/node_modules/zod/mini/index.js +3 -0
  1005. package/node_modules/zod/mini/package.json +7 -0
  1006. package/node_modules/zod/package.json +147 -0
  1007. package/node_modules/zod/src/compile.ts +56 -0
  1008. package/node_modules/zod/src/index.ts +7 -0
  1009. package/node_modules/zod/src/locales/index.ts +1 -0
  1010. package/node_modules/zod/src/mini/index.ts +3 -0
  1011. package/node_modules/zod/src/v3/ZodError.ts +340 -0
  1012. package/node_modules/zod/src/v3/benchmarks/datetime.ts +58 -0
  1013. package/node_modules/zod/src/v3/benchmarks/discriminatedUnion.ts +80 -0
  1014. package/node_modules/zod/src/v3/benchmarks/index.ts +59 -0
  1015. package/node_modules/zod/src/v3/benchmarks/ipv4.ts +57 -0
  1016. package/node_modules/zod/src/v3/benchmarks/object.ts +69 -0
  1017. package/node_modules/zod/src/v3/benchmarks/primitives.ts +162 -0
  1018. package/node_modules/zod/src/v3/benchmarks/realworld.ts +63 -0
  1019. package/node_modules/zod/src/v3/benchmarks/string.ts +55 -0
  1020. package/node_modules/zod/src/v3/benchmarks/union.ts +80 -0
  1021. package/node_modules/zod/src/v3/errors.ts +13 -0
  1022. package/node_modules/zod/src/v3/external.ts +6 -0
  1023. package/node_modules/zod/src/v3/helpers/enumUtil.ts +17 -0
  1024. package/node_modules/zod/src/v3/helpers/errorUtil.ts +8 -0
  1025. package/node_modules/zod/src/v3/helpers/parseUtil.ts +176 -0
  1026. package/node_modules/zod/src/v3/helpers/partialUtil.ts +34 -0
  1027. package/node_modules/zod/src/v3/helpers/typeAliases.ts +2 -0
  1028. package/node_modules/zod/src/v3/helpers/util.ts +224 -0
  1029. package/node_modules/zod/src/v3/index.ts +4 -0
  1030. package/node_modules/zod/src/v3/locales/en.ts +124 -0
  1031. package/node_modules/zod/src/v3/standard-schema.ts +113 -0
  1032. package/node_modules/zod/src/v3/tests/Mocker.ts +54 -0
  1033. package/node_modules/zod/src/v3/tests/all-errors.test.ts +157 -0
  1034. package/node_modules/zod/src/v3/tests/anyunknown.test.ts +28 -0
  1035. package/node_modules/zod/src/v3/tests/array.test.ts +71 -0
  1036. package/node_modules/zod/src/v3/tests/async-parsing.test.ts +388 -0
  1037. package/node_modules/zod/src/v3/tests/async-refinements.test.ts +46 -0
  1038. package/node_modules/zod/src/v3/tests/base.test.ts +29 -0
  1039. package/node_modules/zod/src/v3/tests/bigint.test.ts +55 -0
  1040. package/node_modules/zod/src/v3/tests/branded.test.ts +53 -0
  1041. package/node_modules/zod/src/v3/tests/catch.test.ts +220 -0
  1042. package/node_modules/zod/src/v3/tests/coerce.test.ts +133 -0
  1043. package/node_modules/zod/src/v3/tests/complex.test.ts +70 -0
  1044. package/node_modules/zod/src/v3/tests/custom.test.ts +31 -0
  1045. package/node_modules/zod/src/v3/tests/date.test.ts +32 -0
  1046. package/node_modules/zod/src/v3/tests/deepmasking.test.ts +186 -0
  1047. package/node_modules/zod/src/v3/tests/default.test.ts +112 -0
  1048. package/node_modules/zod/src/v3/tests/description.test.ts +33 -0
  1049. package/node_modules/zod/src/v3/tests/discriminated-unions.test.ts +315 -0
  1050. package/node_modules/zod/src/v3/tests/enum.test.ts +80 -0
  1051. package/node_modules/zod/src/v3/tests/error.test.ts +586 -0
  1052. package/node_modules/zod/src/v3/tests/firstparty.test.ts +87 -0
  1053. package/node_modules/zod/src/v3/tests/firstpartyschematypes.test.ts +21 -0
  1054. package/node_modules/zod/src/v3/tests/function.test.ts +261 -0
  1055. package/node_modules/zod/src/v3/tests/generics.test.ts +48 -0
  1056. package/node_modules/zod/src/v3/tests/instanceof.test.ts +37 -0
  1057. package/node_modules/zod/src/v3/tests/intersection.test.ts +128 -0
  1058. package/node_modules/zod/src/v3/tests/language-server.source.ts +76 -0
  1059. package/node_modules/zod/src/v3/tests/language-server.test.ts +206 -0
  1060. package/node_modules/zod/src/v3/tests/literal.test.ts +36 -0
  1061. package/node_modules/zod/src/v3/tests/map.test.ts +110 -0
  1062. package/node_modules/zod/src/v3/tests/masking.test.ts +4 -0
  1063. package/node_modules/zod/src/v3/tests/mocker.test.ts +19 -0
  1064. package/node_modules/zod/src/v3/tests/nan.test.ts +24 -0
  1065. package/node_modules/zod/src/v3/tests/nativeEnum.test.ts +87 -0
  1066. package/node_modules/zod/src/v3/tests/nullable.test.ts +42 -0
  1067. package/node_modules/zod/src/v3/tests/number.test.ts +176 -0
  1068. package/node_modules/zod/src/v3/tests/object-augmentation.test.ts +29 -0
  1069. package/node_modules/zod/src/v3/tests/object-in-es5-env.test.ts +29 -0
  1070. package/node_modules/zod/src/v3/tests/object.test.ts +431 -0
  1071. package/node_modules/zod/src/v3/tests/optional.test.ts +42 -0
  1072. package/node_modules/zod/src/v3/tests/parseUtil.test.ts +23 -0
  1073. package/node_modules/zod/src/v3/tests/parser.test.ts +41 -0
  1074. package/node_modules/zod/src/v3/tests/partials.test.ts +243 -0
  1075. package/node_modules/zod/src/v3/tests/pickomit.test.ts +111 -0
  1076. package/node_modules/zod/src/v3/tests/pipeline.test.ts +29 -0
  1077. package/node_modules/zod/src/v3/tests/preprocess.test.ts +186 -0
  1078. package/node_modules/zod/src/v3/tests/primitive.test.ts +440 -0
  1079. package/node_modules/zod/src/v3/tests/promise.test.ts +90 -0
  1080. package/node_modules/zod/src/v3/tests/readonly.test.ts +114 -0
  1081. package/node_modules/zod/src/v3/tests/record.test.ts +171 -0
  1082. package/node_modules/zod/src/v3/tests/recursive.test.ts +197 -0
  1083. package/node_modules/zod/src/v3/tests/refine.test.ts +313 -0
  1084. package/node_modules/zod/src/v3/tests/safeparse.test.ts +27 -0
  1085. package/node_modules/zod/src/v3/tests/set.test.ts +142 -0
  1086. package/node_modules/zod/src/v3/tests/standard-schema.test.ts +83 -0
  1087. package/node_modules/zod/src/v3/tests/string.test.ts +922 -0
  1088. package/node_modules/zod/src/v3/tests/transformer.test.ts +233 -0
  1089. package/node_modules/zod/src/v3/tests/tuple.test.ts +90 -0
  1090. package/node_modules/zod/src/v3/tests/unions.test.ts +57 -0
  1091. package/node_modules/zod/src/v3/tests/validations.test.ts +133 -0
  1092. package/node_modules/zod/src/v3/tests/void.test.ts +15 -0
  1093. package/node_modules/zod/src/v3/types.ts +5138 -0
  1094. package/node_modules/zod/src/v4/classic/checks.ts +33 -0
  1095. package/node_modules/zod/src/v4/classic/coerce.ts +27 -0
  1096. package/node_modules/zod/src/v4/classic/compat.ts +78 -0
  1097. package/node_modules/zod/src/v4/classic/deep-partial.ts +76 -0
  1098. package/node_modules/zod/src/v4/classic/errors.ts +97 -0
  1099. package/node_modules/zod/src/v4/classic/external.ts +57 -0
  1100. package/node_modules/zod/src/v4/classic/from-json-schema.ts +944 -0
  1101. package/node_modules/zod/src/v4/classic/in-out.ts +45 -0
  1102. package/node_modules/zod/src/v4/classic/index.ts +5 -0
  1103. package/node_modules/zod/src/v4/classic/iso.ts +20 -0
  1104. package/node_modules/zod/src/v4/classic/parse.ts +88 -0
  1105. package/node_modules/zod/src/v4/classic/schemas.ts +2937 -0
  1106. package/node_modules/zod/src/v4/classic/tests/anyunknown.test.ts +26 -0
  1107. package/node_modules/zod/src/v4/classic/tests/apply.test.ts +86 -0
  1108. package/node_modules/zod/src/v4/classic/tests/array.test.ts +264 -0
  1109. package/node_modules/zod/src/v4/classic/tests/assignability.test.ts +402 -0
  1110. package/node_modules/zod/src/v4/classic/tests/async-parsing.test.ts +381 -0
  1111. package/node_modules/zod/src/v4/classic/tests/async-refinements.test.ts +68 -0
  1112. package/node_modules/zod/src/v4/classic/tests/base.test.ts +7 -0
  1113. package/node_modules/zod/src/v4/classic/tests/bigint.test.ts +89 -0
  1114. package/node_modules/zod/src/v4/classic/tests/brand.test.ts +106 -0
  1115. package/node_modules/zod/src/v4/classic/tests/catch.test.ts +604 -0
  1116. package/node_modules/zod/src/v4/classic/tests/coalesce.test.ts +20 -0
  1117. package/node_modules/zod/src/v4/classic/tests/codec-examples.test.ts +572 -0
  1118. package/node_modules/zod/src/v4/classic/tests/codec.test.ts +704 -0
  1119. package/node_modules/zod/src/v4/classic/tests/coerce.test.ts +160 -0
  1120. package/node_modules/zod/src/v4/classic/tests/continuability.test.ts +374 -0
  1121. package/node_modules/zod/src/v4/classic/tests/credit-card.test.ts +76 -0
  1122. package/node_modules/zod/src/v4/classic/tests/custom.test.ts +40 -0
  1123. package/node_modules/zod/src/v4/classic/tests/cyclic-data.test.ts +985 -0
  1124. package/node_modules/zod/src/v4/classic/tests/date.test.ts +92 -0
  1125. package/node_modules/zod/src/v4/classic/tests/datetime.test.ts +316 -0
  1126. package/node_modules/zod/src/v4/classic/tests/deep-partial.test.ts +380 -0
  1127. package/node_modules/zod/src/v4/classic/tests/default-locale.test.ts +32 -0
  1128. package/node_modules/zod/src/v4/classic/tests/default.test.ts +455 -0
  1129. package/node_modules/zod/src/v4/classic/tests/describe-meta-checks.test.ts +27 -0
  1130. package/node_modules/zod/src/v4/classic/tests/description.test.ts +32 -0
  1131. package/node_modules/zod/src/v4/classic/tests/detached-methods.test.ts +221 -0
  1132. package/node_modules/zod/src/v4/classic/tests/discriminated-unions.test.ts +942 -0
  1133. package/node_modules/zod/src/v4/classic/tests/enum.test.ts +305 -0
  1134. package/node_modules/zod/src/v4/classic/tests/error-utils.test.ts +917 -0
  1135. package/node_modules/zod/src/v4/classic/tests/error.test.ts +1108 -0
  1136. package/node_modules/zod/src/v4/classic/tests/file.test.ts +96 -0
  1137. package/node_modules/zod/src/v4/classic/tests/firstparty.test.ts +179 -0
  1138. package/node_modules/zod/src/v4/classic/tests/fix-json-issue.test.ts +26 -0
  1139. package/node_modules/zod/src/v4/classic/tests/from-json-schema.test.ts +1467 -0
  1140. package/node_modules/zod/src/v4/classic/tests/function.test.ts +391 -0
  1141. package/node_modules/zod/src/v4/classic/tests/generics.test.ts +72 -0
  1142. package/node_modules/zod/src/v4/classic/tests/global-config.test.ts +32 -0
  1143. package/node_modules/zod/src/v4/classic/tests/hash.test.ts +67 -0
  1144. package/node_modules/zod/src/v4/classic/tests/iban.test.ts +81 -0
  1145. package/node_modules/zod/src/v4/classic/tests/in-out.test.ts +159 -0
  1146. package/node_modules/zod/src/v4/classic/tests/index.test.ts +958 -0
  1147. package/node_modules/zod/src/v4/classic/tests/instance-footprint.test.ts +319 -0
  1148. package/node_modules/zod/src/v4/classic/tests/instanceof.test.ts +127 -0
  1149. package/node_modules/zod/src/v4/classic/tests/intersection.test.ts +334 -0
  1150. package/node_modules/zod/src/v4/classic/tests/issue-schema.test.ts +215 -0
  1151. package/node_modules/zod/src/v4/classic/tests/jitless-allows-eval.test.ts +39 -0
  1152. package/node_modules/zod/src/v4/classic/tests/json.test.ts +109 -0
  1153. package/node_modules/zod/src/v4/classic/tests/lazy.test.ts +262 -0
  1154. package/node_modules/zod/src/v4/classic/tests/literal.test.ts +128 -0
  1155. package/node_modules/zod/src/v4/classic/tests/locales_ka.test.ts +29 -0
  1156. package/node_modules/zod/src/v4/classic/tests/locales_ro.test.ts +24 -0
  1157. package/node_modules/zod/src/v4/classic/tests/map.test.ts +342 -0
  1158. package/node_modules/zod/src/v4/classic/tests/nan.test.ts +21 -0
  1159. package/node_modules/zod/src/v4/classic/tests/nested-refine.test.ts +168 -0
  1160. package/node_modules/zod/src/v4/classic/tests/nonoptional.test.ts +101 -0
  1161. package/node_modules/zod/src/v4/classic/tests/nullable.test.ts +22 -0
  1162. package/node_modules/zod/src/v4/classic/tests/number.test.ts +401 -0
  1163. package/node_modules/zod/src/v4/classic/tests/object.test.ts +1006 -0
  1164. package/node_modules/zod/src/v4/classic/tests/optin-ladder.test.ts +235 -0
  1165. package/node_modules/zod/src/v4/classic/tests/optional.test.ts +366 -0
  1166. package/node_modules/zod/src/v4/classic/tests/partial.test.ts +497 -0
  1167. package/node_modules/zod/src/v4/classic/tests/pickomit.test.ts +211 -0
  1168. package/node_modules/zod/src/v4/classic/tests/pipe.test.ts +101 -0
  1169. package/node_modules/zod/src/v4/classic/tests/prefault.test.ts +144 -0
  1170. package/node_modules/zod/src/v4/classic/tests/preprocess-types.test.ts +44 -0
  1171. package/node_modules/zod/src/v4/classic/tests/preprocess.test.ts +351 -0
  1172. package/node_modules/zod/src/v4/classic/tests/primitive.test.ts +175 -0
  1173. package/node_modules/zod/src/v4/classic/tests/promise.test.ts +81 -0
  1174. package/node_modules/zod/src/v4/classic/tests/properties.test.ts +141 -0
  1175. package/node_modules/zod/src/v4/classic/tests/prototypes.test.ts +23 -0
  1176. package/node_modules/zod/src/v4/classic/tests/readonly.test.ts +184 -0
  1177. package/node_modules/zod/src/v4/classic/tests/record.test.ts +885 -0
  1178. package/node_modules/zod/src/v4/classic/tests/recursive-types.test.ts +707 -0
  1179. package/node_modules/zod/src/v4/classic/tests/redos.test.ts +68 -0
  1180. package/node_modules/zod/src/v4/classic/tests/refine.test.ts +693 -0
  1181. package/node_modules/zod/src/v4/classic/tests/registries.test.ts +243 -0
  1182. package/node_modules/zod/src/v4/classic/tests/set.test.ts +190 -0
  1183. package/node_modules/zod/src/v4/classic/tests/standard-schema.test.ts +153 -0
  1184. package/node_modules/zod/src/v4/classic/tests/string-formats.test.ts +125 -0
  1185. package/node_modules/zod/src/v4/classic/tests/string.test.ts +1440 -0
  1186. package/node_modules/zod/src/v4/classic/tests/stringbool.test.ts +124 -0
  1187. package/node_modules/zod/src/v4/classic/tests/template-literal.test.ts +812 -0
  1188. package/node_modules/zod/src/v4/classic/tests/to-json-schema-methods.test.ts +438 -0
  1189. package/node_modules/zod/src/v4/classic/tests/to-json-schema.test.ts +4733 -0
  1190. package/node_modules/zod/src/v4/classic/tests/transform.test.ts +378 -0
  1191. package/node_modules/zod/src/v4/classic/tests/tuple.test.ts +511 -0
  1192. package/node_modules/zod/src/v4/classic/tests/union.test.ts +310 -0
  1193. package/node_modules/zod/src/v4/classic/tests/url.test.ts +13 -0
  1194. package/node_modules/zod/src/v4/classic/tests/validate.test.ts +645 -0
  1195. package/node_modules/zod/src/v4/classic/tests/validations.test.ts +283 -0
  1196. package/node_modules/zod/src/v4/classic/tests/void.test.ts +12 -0
  1197. package/node_modules/zod/src/v4/core/api.ts +1875 -0
  1198. package/node_modules/zod/src/v4/core/checks.ts +1266 -0
  1199. package/node_modules/zod/src/v4/core/compile.ts +2313 -0
  1200. package/node_modules/zod/src/v4/core/core.ts +230 -0
  1201. package/node_modules/zod/src/v4/core/doc.ts +52 -0
  1202. package/node_modules/zod/src/v4/core/errors.ts +543 -0
  1203. package/node_modules/zod/src/v4/core/index.ts +19 -0
  1204. package/node_modules/zod/src/v4/core/json-schema-generator.ts +131 -0
  1205. package/node_modules/zod/src/v4/core/json-schema-processors.ts +934 -0
  1206. package/node_modules/zod/src/v4/core/json-schema.ts +148 -0
  1207. package/node_modules/zod/src/v4/core/memoizer.ts +331 -0
  1208. package/node_modules/zod/src/v4/core/parse.ts +309 -0
  1209. package/node_modules/zod/src/v4/core/regexes.ts +217 -0
  1210. package/node_modules/zod/src/v4/core/registries.ts +105 -0
  1211. package/node_modules/zod/src/v4/core/schemas.ts +5192 -0
  1212. package/node_modules/zod/src/v4/core/standard-schema.ts +159 -0
  1213. package/node_modules/zod/src/v4/core/tests/cached.test.ts +54 -0
  1214. package/node_modules/zod/src/v4/core/tests/compile-differential.test.ts +1004 -0
  1215. package/node_modules/zod/src/v4/core/tests/compile-generative.test.ts +445 -0
  1216. package/node_modules/zod/src/v4/core/tests/compile-global.test.ts +89 -0
  1217. package/node_modules/zod/src/v4/core/tests/compile-off-by-default.test.ts +26 -0
  1218. package/node_modules/zod/src/v4/core/tests/compile-stats.test.ts +34 -0
  1219. package/node_modules/zod/src/v4/core/tests/compile.test.ts +2036 -0
  1220. package/node_modules/zod/src/v4/core/tests/email-regex.test.ts +140 -0
  1221. package/node_modules/zod/src/v4/core/tests/extend.test.ts +59 -0
  1222. package/node_modules/zod/src/v4/core/tests/index.test.ts +46 -0
  1223. package/node_modules/zod/src/v4/core/tests/locales/be.test.ts +124 -0
  1224. package/node_modules/zod/src/v4/core/tests/locales/el.test.ts +214 -0
  1225. package/node_modules/zod/src/v4/core/tests/locales/en.test.ts +22 -0
  1226. package/node_modules/zod/src/v4/core/tests/locales/es.test.ts +180 -0
  1227. package/node_modules/zod/src/v4/core/tests/locales/fr.test.ts +72 -0
  1228. package/node_modules/zod/src/v4/core/tests/locales/he.test.ts +379 -0
  1229. package/node_modules/zod/src/v4/core/tests/locales/hr.test.ts +163 -0
  1230. package/node_modules/zod/src/v4/core/tests/locales/nl.test.ts +46 -0
  1231. package/node_modules/zod/src/v4/core/tests/locales/parity.test.ts +42 -0
  1232. package/node_modules/zod/src/v4/core/tests/locales/ru.test.ts +128 -0
  1233. package/node_modules/zod/src/v4/core/tests/locales/tg.test.ts +85 -0
  1234. package/node_modules/zod/src/v4/core/tests/locales/tk.test.ts +69 -0
  1235. package/node_modules/zod/src/v4/core/tests/locales/tr.test.ts +69 -0
  1236. package/node_modules/zod/src/v4/core/tests/locales/uz.test.ts +105 -0
  1237. package/node_modules/zod/src/v4/core/tests/polyfill-collision.test.ts +46 -0
  1238. package/node_modules/zod/src/v4/core/tests/record-constructor.test.ts +125 -0
  1239. package/node_modules/zod/src/v4/core/tests/recursive-tuples.test.ts +45 -0
  1240. package/node_modules/zod/src/v4/core/tests/treeshake.test.ts +51 -0
  1241. package/node_modules/zod/src/v4/core/tests/url-no-canparse.test.ts +133 -0
  1242. package/node_modules/zod/src/v4/core/to-json-schema.ts +857 -0
  1243. package/node_modules/zod/src/v4/core/util.ts +1280 -0
  1244. package/node_modules/zod/src/v4/core/versions.ts +5 -0
  1245. package/node_modules/zod/src/v4/core/visit.ts +193 -0
  1246. package/node_modules/zod/src/v4/core/zsf.ts +323 -0
  1247. package/node_modules/zod/src/v4/index.ts +4 -0
  1248. package/node_modules/zod/src/v4/locales/ar.ts +120 -0
  1249. package/node_modules/zod/src/v4/locales/az.ts +116 -0
  1250. package/node_modules/zod/src/v4/locales/be.ts +188 -0
  1251. package/node_modules/zod/src/v4/locales/bg.ts +133 -0
  1252. package/node_modules/zod/src/v4/locales/bn.ts +123 -0
  1253. package/node_modules/zod/src/v4/locales/ca.ts +121 -0
  1254. package/node_modules/zod/src/v4/locales/ckb.ts +140 -0
  1255. package/node_modules/zod/src/v4/locales/cs.ts +123 -0
  1256. package/node_modules/zod/src/v4/locales/da.ts +128 -0
  1257. package/node_modules/zod/src/v4/locales/de.ts +121 -0
  1258. package/node_modules/zod/src/v4/locales/el.ts +124 -0
  1259. package/node_modules/zod/src/v4/locales/en.ts +136 -0
  1260. package/node_modules/zod/src/v4/locales/eo.ts +123 -0
  1261. package/node_modules/zod/src/v4/locales/es.ts +145 -0
  1262. package/node_modules/zod/src/v4/locales/fa.ts +131 -0
  1263. package/node_modules/zod/src/v4/locales/fi.ts +126 -0
  1264. package/node_modules/zod/src/v4/locales/fr-CA.ts +121 -0
  1265. package/node_modules/zod/src/v4/locales/fr.ts +139 -0
  1266. package/node_modules/zod/src/v4/locales/gu.ts +123 -0
  1267. package/node_modules/zod/src/v4/locales/he.ts +253 -0
  1268. package/node_modules/zod/src/v4/locales/hi.ts +126 -0
  1269. package/node_modules/zod/src/v4/locales/hr.ts +135 -0
  1270. package/node_modules/zod/src/v4/locales/hu.ts +122 -0
  1271. package/node_modules/zod/src/v4/locales/hy.ts +175 -0
  1272. package/node_modules/zod/src/v4/locales/id.ts +120 -0
  1273. package/node_modules/zod/src/v4/locales/index.ts +63 -0
  1274. package/node_modules/zod/src/v4/locales/is.ts +124 -0
  1275. package/node_modules/zod/src/v4/locales/it.ts +121 -0
  1276. package/node_modules/zod/src/v4/locales/ja.ts +119 -0
  1277. package/node_modules/zod/src/v4/locales/ka.ts +128 -0
  1278. package/node_modules/zod/src/v4/locales/kh.ts +7 -0
  1279. package/node_modules/zod/src/v4/locales/km.ts +124 -0
  1280. package/node_modules/zod/src/v4/locales/kn.ts +126 -0
  1281. package/node_modules/zod/src/v4/locales/ko.ts +126 -0
  1282. package/node_modules/zod/src/v4/locales/lt.ts +243 -0
  1283. package/node_modules/zod/src/v4/locales/mk.ts +123 -0
  1284. package/node_modules/zod/src/v4/locales/ms.ts +120 -0
  1285. package/node_modules/zod/src/v4/locales/ne.ts +128 -0
  1286. package/node_modules/zod/src/v4/locales/nl.ts +126 -0
  1287. package/node_modules/zod/src/v4/locales/nn.ts +121 -0
  1288. package/node_modules/zod/src/v4/locales/no.ts +121 -0
  1289. package/node_modules/zod/src/v4/locales/ota.ts +122 -0
  1290. package/node_modules/zod/src/v4/locales/pl.ts +123 -0
  1291. package/node_modules/zod/src/v4/locales/ps.ts +131 -0
  1292. package/node_modules/zod/src/v4/locales/pt-BR.ts +161 -0
  1293. package/node_modules/zod/src/v4/locales/pt.ts +159 -0
  1294. package/node_modules/zod/src/v4/locales/ro.ts +132 -0
  1295. package/node_modules/zod/src/v4/locales/ru.ts +188 -0
  1296. package/node_modules/zod/src/v4/locales/sk.ts +123 -0
  1297. package/node_modules/zod/src/v4/locales/sl.ts +123 -0
  1298. package/node_modules/zod/src/v4/locales/sv.ts +124 -0
  1299. package/node_modules/zod/src/v4/locales/ta.ts +123 -0
  1300. package/node_modules/zod/src/v4/locales/tg.ts +135 -0
  1301. package/node_modules/zod/src/v4/locales/th.ts +124 -0
  1302. package/node_modules/zod/src/v4/locales/tk.ts +113 -0
  1303. package/node_modules/zod/src/v4/locales/tr.ts +116 -0
  1304. package/node_modules/zod/src/v4/locales/ua.ts +7 -0
  1305. package/node_modules/zod/src/v4/locales/uk.ts +122 -0
  1306. package/node_modules/zod/src/v4/locales/ur.ts +124 -0
  1307. package/node_modules/zod/src/v4/locales/uz.ts +120 -0
  1308. package/node_modules/zod/src/v4/locales/vi.ts +122 -0
  1309. package/node_modules/zod/src/v4/locales/yo.ts +129 -0
  1310. package/node_modules/zod/src/v4/locales/zh-CN.ts +121 -0
  1311. package/node_modules/zod/src/v4/locales/zh-TW.ts +120 -0
  1312. package/node_modules/zod/src/v4/mini/checks.ts +33 -0
  1313. package/node_modules/zod/src/v4/mini/coerce.ts +27 -0
  1314. package/node_modules/zod/src/v4/mini/deep-partial.ts +73 -0
  1315. package/node_modules/zod/src/v4/mini/external.ts +52 -0
  1316. package/node_modules/zod/src/v4/mini/in-out.ts +45 -0
  1317. package/node_modules/zod/src/v4/mini/index.ts +3 -0
  1318. package/node_modules/zod/src/v4/mini/iso.ts +66 -0
  1319. package/node_modules/zod/src/v4/mini/parse.ts +16 -0
  1320. package/node_modules/zod/src/v4/mini/schemas.ts +2051 -0
  1321. package/node_modules/zod/src/v4/mini/tests/apply.test.ts +57 -0
  1322. package/node_modules/zod/src/v4/mini/tests/assignability.test.ts +190 -0
  1323. package/node_modules/zod/src/v4/mini/tests/brand.test.ts +94 -0
  1324. package/node_modules/zod/src/v4/mini/tests/checks.test.ts +158 -0
  1325. package/node_modules/zod/src/v4/mini/tests/codec.test.ts +582 -0
  1326. package/node_modules/zod/src/v4/mini/tests/computed.test.ts +30 -0
  1327. package/node_modules/zod/src/v4/mini/tests/cyclic-data.test.ts +84 -0
  1328. package/node_modules/zod/src/v4/mini/tests/deep-partial.test.ts +54 -0
  1329. package/node_modules/zod/src/v4/mini/tests/error.test.ts +41 -0
  1330. package/node_modules/zod/src/v4/mini/tests/functions.test.ts +14 -0
  1331. package/node_modules/zod/src/v4/mini/tests/index.test.ts +1146 -0
  1332. package/node_modules/zod/src/v4/mini/tests/number.test.ts +109 -0
  1333. package/node_modules/zod/src/v4/mini/tests/object.test.ts +292 -0
  1334. package/node_modules/zod/src/v4/mini/tests/prototypes.test.ts +43 -0
  1335. package/node_modules/zod/src/v4/mini/tests/recursive-types.test.ts +341 -0
  1336. package/node_modules/zod/src/v4/mini/tests/standard-schema.test.ts +50 -0
  1337. package/node_modules/zod/src/v4/mini/tests/string.test.ts +396 -0
  1338. package/node_modules/zod/src/v4-mini/index.ts +3 -0
  1339. package/node_modules/zod/v3/ZodError.cjs +167 -0
  1340. package/node_modules/zod/v3/ZodError.d.cts +164 -0
  1341. package/node_modules/zod/v3/ZodError.d.ts +164 -0
  1342. package/node_modules/zod/v3/ZodError.js +143 -0
  1343. package/node_modules/zod/v3/errors.cjs +36 -0
  1344. package/node_modules/zod/v3/errors.d.cts +5 -0
  1345. package/node_modules/zod/v3/errors.d.ts +5 -0
  1346. package/node_modules/zod/v3/errors.js +9 -0
  1347. package/node_modules/zod/v3/external.cjs +41 -0
  1348. package/node_modules/zod/v3/external.d.cts +6 -0
  1349. package/node_modules/zod/v3/external.d.ts +6 -0
  1350. package/node_modules/zod/v3/external.js +6 -0
  1351. package/node_modules/zod/v3/helpers/enumUtil.cjs +21 -0
  1352. package/node_modules/zod/v3/helpers/enumUtil.d.cts +8 -0
  1353. package/node_modules/zod/v3/helpers/enumUtil.d.ts +8 -0
  1354. package/node_modules/zod/v3/helpers/enumUtil.js +1 -0
  1355. package/node_modules/zod/v3/helpers/errorUtil.cjs +28 -0
  1356. package/node_modules/zod/v3/helpers/errorUtil.d.cts +9 -0
  1357. package/node_modules/zod/v3/helpers/errorUtil.d.ts +9 -0
  1358. package/node_modules/zod/v3/helpers/errorUtil.js +6 -0
  1359. package/node_modules/zod/v3/helpers/parseUtil.cjs +143 -0
  1360. package/node_modules/zod/v3/helpers/parseUtil.d.cts +78 -0
  1361. package/node_modules/zod/v3/helpers/parseUtil.d.ts +78 -0
  1362. package/node_modules/zod/v3/helpers/parseUtil.js +109 -0
  1363. package/node_modules/zod/v3/helpers/partialUtil.cjs +21 -0
  1364. package/node_modules/zod/v3/helpers/partialUtil.d.cts +8 -0
  1365. package/node_modules/zod/v3/helpers/partialUtil.d.ts +8 -0
  1366. package/node_modules/zod/v3/helpers/partialUtil.js +1 -0
  1367. package/node_modules/zod/v3/helpers/typeAliases.cjs +21 -0
  1368. package/node_modules/zod/v3/helpers/typeAliases.d.cts +2 -0
  1369. package/node_modules/zod/v3/helpers/typeAliases.d.ts +2 -0
  1370. package/node_modules/zod/v3/helpers/typeAliases.js +1 -0
  1371. package/node_modules/zod/v3/helpers/util.cjs +156 -0
  1372. package/node_modules/zod/v3/helpers/util.d.cts +85 -0
  1373. package/node_modules/zod/v3/helpers/util.d.ts +85 -0
  1374. package/node_modules/zod/v3/helpers/util.js +133 -0
  1375. package/node_modules/zod/v3/index.cjs +52 -0
  1376. package/node_modules/zod/v3/index.d.cts +4 -0
  1377. package/node_modules/zod/v3/index.d.ts +4 -0
  1378. package/node_modules/zod/v3/index.js +4 -0
  1379. package/node_modules/zod/v3/locales/en.cjs +112 -0
  1380. package/node_modules/zod/v3/locales/en.d.cts +3 -0
  1381. package/node_modules/zod/v3/locales/en.d.ts +3 -0
  1382. package/node_modules/zod/v3/locales/en.js +109 -0
  1383. package/node_modules/zod/v3/package.json +7 -0
  1384. package/node_modules/zod/v3/standard-schema.cjs +21 -0
  1385. package/node_modules/zod/v3/standard-schema.d.cts +102 -0
  1386. package/node_modules/zod/v3/standard-schema.d.ts +102 -0
  1387. package/node_modules/zod/v3/standard-schema.js +1 -0
  1388. package/node_modules/zod/v3/types.cjs +3798 -0
  1389. package/node_modules/zod/v3/types.d.cts +1034 -0
  1390. package/node_modules/zod/v3/types.d.ts +1034 -0
  1391. package/node_modules/zod/v3/types.js +3697 -0
  1392. package/node_modules/zod/v4/classic/checks.cjs +53 -0
  1393. package/node_modules/zod/v4/classic/checks.d.cts +1 -0
  1394. package/node_modules/zod/v4/classic/checks.d.ts +1 -0
  1395. package/node_modules/zod/v4/classic/checks.js +1 -0
  1396. package/node_modules/zod/v4/classic/coerce.cjs +66 -0
  1397. package/node_modules/zod/v4/classic/coerce.d.cts +17 -0
  1398. package/node_modules/zod/v4/classic/coerce.d.ts +17 -0
  1399. package/node_modules/zod/v4/classic/coerce.js +17 -0
  1400. package/node_modules/zod/v4/classic/compat.cjs +80 -0
  1401. package/node_modules/zod/v4/classic/compat.d.cts +48 -0
  1402. package/node_modules/zod/v4/classic/compat.d.ts +48 -0
  1403. package/node_modules/zod/v4/classic/compat.js +31 -0
  1404. package/node_modules/zod/v4/classic/deep-partial.cjs +58 -0
  1405. package/node_modules/zod/v4/classic/deep-partial.d.cts +14 -0
  1406. package/node_modules/zod/v4/classic/deep-partial.d.ts +14 -0
  1407. package/node_modules/zod/v4/classic/deep-partial.js +13 -0
  1408. package/node_modules/zod/v4/classic/errors.cjs +102 -0
  1409. package/node_modules/zod/v4/classic/errors.d.cts +29 -0
  1410. package/node_modules/zod/v4/classic/errors.d.ts +29 -0
  1411. package/node_modules/zod/v4/classic/errors.js +57 -0
  1412. package/node_modules/zod/v4/classic/external.cjs +97 -0
  1413. package/node_modules/zod/v4/classic/external.d.cts +19 -0
  1414. package/node_modules/zod/v4/classic/external.d.ts +19 -0
  1415. package/node_modules/zod/v4/classic/external.js +17 -0
  1416. package/node_modules/zod/v4/classic/from-json-schema.cjs +926 -0
  1417. package/node_modules/zod/v4/classic/from-json-schema.d.cts +12 -0
  1418. package/node_modules/zod/v4/classic/from-json-schema.d.ts +12 -0
  1419. package/node_modules/zod/v4/classic/from-json-schema.js +881 -0
  1420. package/node_modules/zod/v4/classic/in-out.cjs +82 -0
  1421. package/node_modules/zod/v4/classic/in-out.d.cts +8 -0
  1422. package/node_modules/zod/v4/classic/in-out.d.ts +8 -0
  1423. package/node_modules/zod/v4/classic/in-out.js +36 -0
  1424. package/node_modules/zod/v4/classic/index.cjs +52 -0
  1425. package/node_modules/zod/v4/classic/index.d.cts +3 -0
  1426. package/node_modules/zod/v4/classic/index.d.ts +3 -0
  1427. package/node_modules/zod/v4/classic/index.js +4 -0
  1428. package/node_modules/zod/v4/classic/iso.cjs +68 -0
  1429. package/node_modules/zod/v4/classic/iso.d.cts +7 -0
  1430. package/node_modules/zod/v4/classic/iso.d.ts +7 -0
  1431. package/node_modules/zod/v4/classic/iso.js +15 -0
  1432. package/node_modules/zod/v4/classic/package.json +7 -0
  1433. package/node_modules/zod/v4/classic/parse.cjs +63 -0
  1434. package/node_modules/zod/v4/classic/parse.d.cts +44 -0
  1435. package/node_modules/zod/v4/classic/parse.d.ts +44 -0
  1436. package/node_modules/zod/v4/classic/parse.js +16 -0
  1437. package/node_modules/zod/v4/classic/schemas.cjs +1676 -0
  1438. package/node_modules/zod/v4/classic/schemas.d.cts +816 -0
  1439. package/node_modules/zod/v4/classic/schemas.d.ts +816 -0
  1440. package/node_modules/zod/v4/classic/schemas.js +1535 -0
  1441. package/node_modules/zod/v4/core/api.cjs +1269 -0
  1442. package/node_modules/zod/v4/core/api.d.cts +335 -0
  1443. package/node_modules/zod/v4/core/api.d.ts +335 -0
  1444. package/node_modules/zod/v4/core/api.js +1107 -0
  1445. package/node_modules/zod/v4/core/checks.cjs +561 -0
  1446. package/node_modules/zod/v4/core/checks.d.cts +294 -0
  1447. package/node_modules/zod/v4/core/checks.d.ts +294 -0
  1448. package/node_modules/zod/v4/core/checks.js +516 -0
  1449. package/node_modules/zod/v4/core/compile.cjs +1908 -0
  1450. package/node_modules/zod/v4/core/compile.d.cts +65 -0
  1451. package/node_modules/zod/v4/core/compile.d.ts +65 -0
  1452. package/node_modules/zod/v4/core/compile.js +1858 -0
  1453. package/node_modules/zod/v4/core/core.cjs +167 -0
  1454. package/node_modules/zod/v4/core/core.d.cts +82 -0
  1455. package/node_modules/zod/v4/core/core.d.ts +82 -0
  1456. package/node_modules/zod/v4/core/core.js +141 -0
  1457. package/node_modules/zod/v4/core/doc.cjs +61 -0
  1458. package/node_modules/zod/v4/core/doc.d.cts +16 -0
  1459. package/node_modules/zod/v4/core/doc.d.ts +16 -0
  1460. package/node_modules/zod/v4/core/doc.js +38 -0
  1461. package/node_modules/zod/v4/core/errors.cjs +317 -0
  1462. package/node_modules/zod/v4/core/errors.d.cts +225 -0
  1463. package/node_modules/zod/v4/core/errors.d.ts +225 -0
  1464. package/node_modules/zod/v4/core/errors.js +267 -0
  1465. package/node_modules/zod/v4/core/index.cjs +70 -0
  1466. package/node_modules/zod/v4/core/index.d.cts +19 -0
  1467. package/node_modules/zod/v4/core/index.d.ts +19 -0
  1468. package/node_modules/zod/v4/core/index.js +19 -0
  1469. package/node_modules/zod/v4/core/json-schema-generator.cjs +122 -0
  1470. package/node_modules/zod/v4/core/json-schema-generator.d.cts +65 -0
  1471. package/node_modules/zod/v4/core/json-schema-generator.d.ts +65 -0
  1472. package/node_modules/zod/v4/core/json-schema-generator.js +99 -0
  1473. package/node_modules/zod/v4/core/json-schema-processors.cjs +929 -0
  1474. package/node_modules/zod/v4/core/json-schema-processors.d.cts +65 -0
  1475. package/node_modules/zod/v4/core/json-schema-processors.d.ts +65 -0
  1476. package/node_modules/zod/v4/core/json-schema-processors.js +843 -0
  1477. package/node_modules/zod/v4/core/json-schema.cjs +21 -0
  1478. package/node_modules/zod/v4/core/json-schema.d.cts +89 -0
  1479. package/node_modules/zod/v4/core/json-schema.d.ts +89 -0
  1480. package/node_modules/zod/v4/core/json-schema.js +1 -0
  1481. package/node_modules/zod/v4/core/memoizer.cjs +360 -0
  1482. package/node_modules/zod/v4/core/memoizer.d.cts +15 -0
  1483. package/node_modules/zod/v4/core/memoizer.d.ts +15 -0
  1484. package/node_modules/zod/v4/core/memoizer.js +311 -0
  1485. package/node_modules/zod/v4/core/package.json +7 -0
  1486. package/node_modules/zod/v4/core/parse.cjs +233 -0
  1487. package/node_modules/zod/v4/core/parse.d.cts +52 -0
  1488. package/node_modules/zod/v4/core/parse.d.ts +52 -0
  1489. package/node_modules/zod/v4/core/parse.js +175 -0
  1490. package/node_modules/zod/v4/core/regexes.cjs +209 -0
  1491. package/node_modules/zod/v4/core/regexes.d.cts +90 -0
  1492. package/node_modules/zod/v4/core/regexes.d.ts +90 -0
  1493. package/node_modules/zod/v4/core/regexes.js +156 -0
  1494. package/node_modules/zod/v4/core/registries.cjs +75 -0
  1495. package/node_modules/zod/v4/core/registries.d.cts +35 -0
  1496. package/node_modules/zod/v4/core/registries.d.ts +35 -0
  1497. package/node_modules/zod/v4/core/registries.js +51 -0
  1498. package/node_modules/zod/v4/core/schemas.cjs +2669 -0
  1499. package/node_modules/zod/v4/core/schemas.d.cts +1273 -0
  1500. package/node_modules/zod/v4/core/schemas.d.ts +1273 -0
  1501. package/node_modules/zod/v4/core/schemas.js +2606 -0
  1502. package/node_modules/zod/v4/core/standard-schema.cjs +21 -0
  1503. package/node_modules/zod/v4/core/standard-schema.d.cts +126 -0
  1504. package/node_modules/zod/v4/core/standard-schema.d.ts +126 -0
  1505. package/node_modules/zod/v4/core/standard-schema.js +1 -0
  1506. package/node_modules/zod/v4/core/to-json-schema.cjs +681 -0
  1507. package/node_modules/zod/v4/core/to-json-schema.d.cts +154 -0
  1508. package/node_modules/zod/v4/core/to-json-schema.d.ts +154 -0
  1509. package/node_modules/zod/v4/core/to-json-schema.js +651 -0
  1510. package/node_modules/zod/v4/core/util.cjs +949 -0
  1511. package/node_modules/zod/v4/core/util.d.cts +278 -0
  1512. package/node_modules/zod/v4/core/util.d.ts +278 -0
  1513. package/node_modules/zod/v4/core/util.js +859 -0
  1514. package/node_modules/zod/v4/core/versions.cjs +27 -0
  1515. package/node_modules/zod/v4/core/versions.d.cts +5 -0
  1516. package/node_modules/zod/v4/core/versions.d.ts +5 -0
  1517. package/node_modules/zod/v4/core/versions.js +5 -0
  1518. package/node_modules/zod/v4/core/visit.cjs +214 -0
  1519. package/node_modules/zod/v4/core/visit.d.cts +30 -0
  1520. package/node_modules/zod/v4/core/visit.d.ts +30 -0
  1521. package/node_modules/zod/v4/core/visit.js +169 -0
  1522. package/node_modules/zod/v4/index.cjs +51 -0
  1523. package/node_modules/zod/v4/index.d.cts +3 -0
  1524. package/node_modules/zod/v4/index.d.ts +3 -0
  1525. package/node_modules/zod/v4/index.js +4 -0
  1526. package/node_modules/zod/v4/locales/ar.cjs +138 -0
  1527. package/node_modules/zod/v4/locales/ar.d.cts +5 -0
  1528. package/node_modules/zod/v4/locales/ar.d.ts +4 -0
  1529. package/node_modules/zod/v4/locales/ar.js +111 -0
  1530. package/node_modules/zod/v4/locales/az.cjs +137 -0
  1531. package/node_modules/zod/v4/locales/az.d.cts +5 -0
  1532. package/node_modules/zod/v4/locales/az.d.ts +4 -0
  1533. package/node_modules/zod/v4/locales/az.js +110 -0
  1534. package/node_modules/zod/v4/locales/be.cjs +195 -0
  1535. package/node_modules/zod/v4/locales/be.d.cts +5 -0
  1536. package/node_modules/zod/v4/locales/be.d.ts +4 -0
  1537. package/node_modules/zod/v4/locales/be.js +168 -0
  1538. package/node_modules/zod/v4/locales/bg.cjs +152 -0
  1539. package/node_modules/zod/v4/locales/bg.d.cts +5 -0
  1540. package/node_modules/zod/v4/locales/bg.d.ts +4 -0
  1541. package/node_modules/zod/v4/locales/bg.js +125 -0
  1542. package/node_modules/zod/v4/locales/bn.cjs +140 -0
  1543. package/node_modules/zod/v4/locales/bn.d.cts +5 -0
  1544. package/node_modules/zod/v4/locales/bn.d.ts +4 -0
  1545. package/node_modules/zod/v4/locales/bn.js +113 -0
  1546. package/node_modules/zod/v4/locales/ca.cjs +139 -0
  1547. package/node_modules/zod/v4/locales/ca.d.cts +5 -0
  1548. package/node_modules/zod/v4/locales/ca.d.ts +4 -0
  1549. package/node_modules/zod/v4/locales/ca.js +112 -0
  1550. package/node_modules/zod/v4/locales/ckb.cjs +160 -0
  1551. package/node_modules/zod/v4/locales/ckb.d.cts +5 -0
  1552. package/node_modules/zod/v4/locales/ckb.d.ts +4 -0
  1553. package/node_modules/zod/v4/locales/ckb.js +133 -0
  1554. package/node_modules/zod/v4/locales/cs.cjs +143 -0
  1555. package/node_modules/zod/v4/locales/cs.d.cts +5 -0
  1556. package/node_modules/zod/v4/locales/cs.d.ts +4 -0
  1557. package/node_modules/zod/v4/locales/cs.js +116 -0
  1558. package/node_modules/zod/v4/locales/da.cjs +147 -0
  1559. package/node_modules/zod/v4/locales/da.d.cts +5 -0
  1560. package/node_modules/zod/v4/locales/da.d.ts +4 -0
  1561. package/node_modules/zod/v4/locales/da.js +120 -0
  1562. package/node_modules/zod/v4/locales/de.cjs +140 -0
  1563. package/node_modules/zod/v4/locales/de.d.cts +5 -0
  1564. package/node_modules/zod/v4/locales/de.d.ts +4 -0
  1565. package/node_modules/zod/v4/locales/de.js +113 -0
  1566. package/node_modules/zod/v4/locales/el.cjs +139 -0
  1567. package/node_modules/zod/v4/locales/el.d.cts +5 -0
  1568. package/node_modules/zod/v4/locales/el.d.ts +4 -0
  1569. package/node_modules/zod/v4/locales/el.js +112 -0
  1570. package/node_modules/zod/v4/locales/en.cjs +152 -0
  1571. package/node_modules/zod/v4/locales/en.d.cts +5 -0
  1572. package/node_modules/zod/v4/locales/en.d.ts +4 -0
  1573. package/node_modules/zod/v4/locales/en.js +125 -0
  1574. package/node_modules/zod/v4/locales/eo.cjs +141 -0
  1575. package/node_modules/zod/v4/locales/eo.d.cts +5 -0
  1576. package/node_modules/zod/v4/locales/eo.d.ts +4 -0
  1577. package/node_modules/zod/v4/locales/eo.js +114 -0
  1578. package/node_modules/zod/v4/locales/es.cjs +163 -0
  1579. package/node_modules/zod/v4/locales/es.d.cts +5 -0
  1580. package/node_modules/zod/v4/locales/es.d.ts +4 -0
  1581. package/node_modules/zod/v4/locales/es.js +136 -0
  1582. package/node_modules/zod/v4/locales/fa.cjs +146 -0
  1583. package/node_modules/zod/v4/locales/fa.d.cts +5 -0
  1584. package/node_modules/zod/v4/locales/fa.d.ts +4 -0
  1585. package/node_modules/zod/v4/locales/fa.js +119 -0
  1586. package/node_modules/zod/v4/locales/fi.cjs +144 -0
  1587. package/node_modules/zod/v4/locales/fi.d.cts +5 -0
  1588. package/node_modules/zod/v4/locales/fi.d.ts +4 -0
  1589. package/node_modules/zod/v4/locales/fi.js +117 -0
  1590. package/node_modules/zod/v4/locales/fr-CA.cjs +139 -0
  1591. package/node_modules/zod/v4/locales/fr-CA.d.cts +5 -0
  1592. package/node_modules/zod/v4/locales/fr-CA.d.ts +4 -0
  1593. package/node_modules/zod/v4/locales/fr-CA.js +112 -0
  1594. package/node_modules/zod/v4/locales/fr.cjs +156 -0
  1595. package/node_modules/zod/v4/locales/fr.d.cts +5 -0
  1596. package/node_modules/zod/v4/locales/fr.d.ts +4 -0
  1597. package/node_modules/zod/v4/locales/fr.js +129 -0
  1598. package/node_modules/zod/v4/locales/gu.cjs +140 -0
  1599. package/node_modules/zod/v4/locales/gu.d.cts +5 -0
  1600. package/node_modules/zod/v4/locales/gu.d.ts +4 -0
  1601. package/node_modules/zod/v4/locales/gu.js +113 -0
  1602. package/node_modules/zod/v4/locales/he.cjs +248 -0
  1603. package/node_modules/zod/v4/locales/he.d.cts +5 -0
  1604. package/node_modules/zod/v4/locales/he.d.ts +4 -0
  1605. package/node_modules/zod/v4/locales/he.js +221 -0
  1606. package/node_modules/zod/v4/locales/hi.cjs +138 -0
  1607. package/node_modules/zod/v4/locales/hi.d.cts +5 -0
  1608. package/node_modules/zod/v4/locales/hi.d.ts +4 -0
  1609. package/node_modules/zod/v4/locales/hi.js +111 -0
  1610. package/node_modules/zod/v4/locales/hr.cjs +153 -0
  1611. package/node_modules/zod/v4/locales/hr.d.cts +5 -0
  1612. package/node_modules/zod/v4/locales/hr.d.ts +4 -0
  1613. package/node_modules/zod/v4/locales/hr.js +126 -0
  1614. package/node_modules/zod/v4/locales/hu.cjs +140 -0
  1615. package/node_modules/zod/v4/locales/hu.d.cts +5 -0
  1616. package/node_modules/zod/v4/locales/hu.d.ts +4 -0
  1617. package/node_modules/zod/v4/locales/hu.js +113 -0
  1618. package/node_modules/zod/v4/locales/hy.cjs +185 -0
  1619. package/node_modules/zod/v4/locales/hy.d.cts +5 -0
  1620. package/node_modules/zod/v4/locales/hy.d.ts +4 -0
  1621. package/node_modules/zod/v4/locales/hy.js +158 -0
  1622. package/node_modules/zod/v4/locales/id.cjs +138 -0
  1623. package/node_modules/zod/v4/locales/id.d.cts +5 -0
  1624. package/node_modules/zod/v4/locales/id.d.ts +4 -0
  1625. package/node_modules/zod/v4/locales/id.js +111 -0
  1626. package/node_modules/zod/v4/locales/index.cjs +152 -0
  1627. package/node_modules/zod/v4/locales/index.d.cts +63 -0
  1628. package/node_modules/zod/v4/locales/index.d.ts +63 -0
  1629. package/node_modules/zod/v4/locales/index.js +63 -0
  1630. package/node_modules/zod/v4/locales/is.cjs +141 -0
  1631. package/node_modules/zod/v4/locales/is.d.cts +5 -0
  1632. package/node_modules/zod/v4/locales/is.d.ts +4 -0
  1633. package/node_modules/zod/v4/locales/is.js +114 -0
  1634. package/node_modules/zod/v4/locales/it.cjs +140 -0
  1635. package/node_modules/zod/v4/locales/it.d.cts +5 -0
  1636. package/node_modules/zod/v4/locales/it.d.ts +4 -0
  1637. package/node_modules/zod/v4/locales/it.js +113 -0
  1638. package/node_modules/zod/v4/locales/ja.cjs +139 -0
  1639. package/node_modules/zod/v4/locales/ja.d.cts +5 -0
  1640. package/node_modules/zod/v4/locales/ja.d.ts +4 -0
  1641. package/node_modules/zod/v4/locales/ja.js +112 -0
  1642. package/node_modules/zod/v4/locales/ka.cjs +144 -0
  1643. package/node_modules/zod/v4/locales/ka.d.cts +5 -0
  1644. package/node_modules/zod/v4/locales/ka.d.ts +4 -0
  1645. package/node_modules/zod/v4/locales/ka.js +117 -0
  1646. package/node_modules/zod/v4/locales/kh.cjs +12 -0
  1647. package/node_modules/zod/v4/locales/kh.d.cts +5 -0
  1648. package/node_modules/zod/v4/locales/kh.d.ts +5 -0
  1649. package/node_modules/zod/v4/locales/kh.js +5 -0
  1650. package/node_modules/zod/v4/locales/km.cjs +142 -0
  1651. package/node_modules/zod/v4/locales/km.d.cts +5 -0
  1652. package/node_modules/zod/v4/locales/km.d.ts +4 -0
  1653. package/node_modules/zod/v4/locales/km.js +115 -0
  1654. package/node_modules/zod/v4/locales/kn.cjs +143 -0
  1655. package/node_modules/zod/v4/locales/kn.d.cts +5 -0
  1656. package/node_modules/zod/v4/locales/kn.d.ts +4 -0
  1657. package/node_modules/zod/v4/locales/kn.js +116 -0
  1658. package/node_modules/zod/v4/locales/ko.cjs +143 -0
  1659. package/node_modules/zod/v4/locales/ko.d.cts +5 -0
  1660. package/node_modules/zod/v4/locales/ko.d.ts +4 -0
  1661. package/node_modules/zod/v4/locales/ko.js +116 -0
  1662. package/node_modules/zod/v4/locales/lt.cjs +234 -0
  1663. package/node_modules/zod/v4/locales/lt.d.cts +5 -0
  1664. package/node_modules/zod/v4/locales/lt.d.ts +4 -0
  1665. package/node_modules/zod/v4/locales/lt.js +207 -0
  1666. package/node_modules/zod/v4/locales/mk.cjs +141 -0
  1667. package/node_modules/zod/v4/locales/mk.d.cts +5 -0
  1668. package/node_modules/zod/v4/locales/mk.d.ts +4 -0
  1669. package/node_modules/zod/v4/locales/mk.js +114 -0
  1670. package/node_modules/zod/v4/locales/ms.cjs +139 -0
  1671. package/node_modules/zod/v4/locales/ms.d.cts +5 -0
  1672. package/node_modules/zod/v4/locales/ms.d.ts +4 -0
  1673. package/node_modules/zod/v4/locales/ms.js +112 -0
  1674. package/node_modules/zod/v4/locales/ne.cjs +138 -0
  1675. package/node_modules/zod/v4/locales/ne.d.cts +5 -0
  1676. package/node_modules/zod/v4/locales/ne.d.ts +4 -0
  1677. package/node_modules/zod/v4/locales/ne.js +111 -0
  1678. package/node_modules/zod/v4/locales/nl.cjs +142 -0
  1679. package/node_modules/zod/v4/locales/nl.d.cts +5 -0
  1680. package/node_modules/zod/v4/locales/nl.d.ts +4 -0
  1681. package/node_modules/zod/v4/locales/nl.js +115 -0
  1682. package/node_modules/zod/v4/locales/nn.cjs +140 -0
  1683. package/node_modules/zod/v4/locales/nn.d.cts +5 -0
  1684. package/node_modules/zod/v4/locales/nn.d.ts +4 -0
  1685. package/node_modules/zod/v4/locales/nn.js +113 -0
  1686. package/node_modules/zod/v4/locales/no.cjs +140 -0
  1687. package/node_modules/zod/v4/locales/no.d.cts +5 -0
  1688. package/node_modules/zod/v4/locales/no.d.ts +4 -0
  1689. package/node_modules/zod/v4/locales/no.js +113 -0
  1690. package/node_modules/zod/v4/locales/ota.cjs +141 -0
  1691. package/node_modules/zod/v4/locales/ota.d.cts +5 -0
  1692. package/node_modules/zod/v4/locales/ota.d.ts +4 -0
  1693. package/node_modules/zod/v4/locales/ota.js +114 -0
  1694. package/node_modules/zod/v4/locales/package.json +7 -0
  1695. package/node_modules/zod/v4/locales/pl.cjs +141 -0
  1696. package/node_modules/zod/v4/locales/pl.d.cts +5 -0
  1697. package/node_modules/zod/v4/locales/pl.d.ts +4 -0
  1698. package/node_modules/zod/v4/locales/pl.js +114 -0
  1699. package/node_modules/zod/v4/locales/ps.cjs +146 -0
  1700. package/node_modules/zod/v4/locales/ps.d.cts +5 -0
  1701. package/node_modules/zod/v4/locales/ps.d.ts +4 -0
  1702. package/node_modules/zod/v4/locales/ps.js +119 -0
  1703. package/node_modules/zod/v4/locales/pt-BR.cjs +170 -0
  1704. package/node_modules/zod/v4/locales/pt-BR.d.cts +5 -0
  1705. package/node_modules/zod/v4/locales/pt-BR.d.ts +4 -0
  1706. package/node_modules/zod/v4/locales/pt-BR.js +143 -0
  1707. package/node_modules/zod/v4/locales/pt.cjs +169 -0
  1708. package/node_modules/zod/v4/locales/pt.d.cts +5 -0
  1709. package/node_modules/zod/v4/locales/pt.d.ts +4 -0
  1710. package/node_modules/zod/v4/locales/pt.js +142 -0
  1711. package/node_modules/zod/v4/locales/ro.cjs +149 -0
  1712. package/node_modules/zod/v4/locales/ro.d.cts +5 -0
  1713. package/node_modules/zod/v4/locales/ro.d.ts +4 -0
  1714. package/node_modules/zod/v4/locales/ro.js +122 -0
  1715. package/node_modules/zod/v4/locales/ru.cjs +195 -0
  1716. package/node_modules/zod/v4/locales/ru.d.cts +5 -0
  1717. package/node_modules/zod/v4/locales/ru.d.ts +4 -0
  1718. package/node_modules/zod/v4/locales/ru.js +168 -0
  1719. package/node_modules/zod/v4/locales/sk.cjs +143 -0
  1720. package/node_modules/zod/v4/locales/sk.d.cts +5 -0
  1721. package/node_modules/zod/v4/locales/sk.d.ts +4 -0
  1722. package/node_modules/zod/v4/locales/sk.js +116 -0
  1723. package/node_modules/zod/v4/locales/sl.cjs +141 -0
  1724. package/node_modules/zod/v4/locales/sl.d.cts +5 -0
  1725. package/node_modules/zod/v4/locales/sl.d.ts +4 -0
  1726. package/node_modules/zod/v4/locales/sl.js +114 -0
  1727. package/node_modules/zod/v4/locales/sv.cjs +142 -0
  1728. package/node_modules/zod/v4/locales/sv.d.cts +5 -0
  1729. package/node_modules/zod/v4/locales/sv.d.ts +4 -0
  1730. package/node_modules/zod/v4/locales/sv.js +115 -0
  1731. package/node_modules/zod/v4/locales/ta.cjs +142 -0
  1732. package/node_modules/zod/v4/locales/ta.d.cts +5 -0
  1733. package/node_modules/zod/v4/locales/ta.d.ts +4 -0
  1734. package/node_modules/zod/v4/locales/ta.js +115 -0
  1735. package/node_modules/zod/v4/locales/tg.cjs +144 -0
  1736. package/node_modules/zod/v4/locales/tg.d.cts +5 -0
  1737. package/node_modules/zod/v4/locales/tg.d.ts +4 -0
  1738. package/node_modules/zod/v4/locales/tg.js +117 -0
  1739. package/node_modules/zod/v4/locales/th.cjs +142 -0
  1740. package/node_modules/zod/v4/locales/th.d.cts +5 -0
  1741. package/node_modules/zod/v4/locales/th.d.ts +4 -0
  1742. package/node_modules/zod/v4/locales/th.js +115 -0
  1743. package/node_modules/zod/v4/locales/tk.cjs +134 -0
  1744. package/node_modules/zod/v4/locales/tk.d.cts +5 -0
  1745. package/node_modules/zod/v4/locales/tk.d.ts +4 -0
  1746. package/node_modules/zod/v4/locales/tk.js +107 -0
  1747. package/node_modules/zod/v4/locales/tr.cjs +137 -0
  1748. package/node_modules/zod/v4/locales/tr.d.cts +5 -0
  1749. package/node_modules/zod/v4/locales/tr.d.ts +4 -0
  1750. package/node_modules/zod/v4/locales/tr.js +110 -0
  1751. package/node_modules/zod/v4/locales/ua.cjs +12 -0
  1752. package/node_modules/zod/v4/locales/ua.d.cts +5 -0
  1753. package/node_modules/zod/v4/locales/ua.d.ts +5 -0
  1754. package/node_modules/zod/v4/locales/ua.js +5 -0
  1755. package/node_modules/zod/v4/locales/uk.cjs +140 -0
  1756. package/node_modules/zod/v4/locales/uk.d.cts +5 -0
  1757. package/node_modules/zod/v4/locales/uk.d.ts +4 -0
  1758. package/node_modules/zod/v4/locales/uk.js +113 -0
  1759. package/node_modules/zod/v4/locales/ur.cjs +142 -0
  1760. package/node_modules/zod/v4/locales/ur.d.cts +5 -0
  1761. package/node_modules/zod/v4/locales/ur.d.ts +4 -0
  1762. package/node_modules/zod/v4/locales/ur.js +115 -0
  1763. package/node_modules/zod/v4/locales/uz.cjs +140 -0
  1764. package/node_modules/zod/v4/locales/uz.d.cts +5 -0
  1765. package/node_modules/zod/v4/locales/uz.d.ts +4 -0
  1766. package/node_modules/zod/v4/locales/uz.js +113 -0
  1767. package/node_modules/zod/v4/locales/vi.cjs +140 -0
  1768. package/node_modules/zod/v4/locales/vi.d.cts +5 -0
  1769. package/node_modules/zod/v4/locales/vi.d.ts +4 -0
  1770. package/node_modules/zod/v4/locales/vi.js +113 -0
  1771. package/node_modules/zod/v4/locales/yo.cjs +139 -0
  1772. package/node_modules/zod/v4/locales/yo.d.cts +5 -0
  1773. package/node_modules/zod/v4/locales/yo.d.ts +4 -0
  1774. package/node_modules/zod/v4/locales/yo.js +112 -0
  1775. package/node_modules/zod/v4/locales/zh-CN.cjs +141 -0
  1776. package/node_modules/zod/v4/locales/zh-CN.d.cts +5 -0
  1777. package/node_modules/zod/v4/locales/zh-CN.d.ts +4 -0
  1778. package/node_modules/zod/v4/locales/zh-CN.js +114 -0
  1779. package/node_modules/zod/v4/locales/zh-TW.cjs +139 -0
  1780. package/node_modules/zod/v4/locales/zh-TW.d.cts +5 -0
  1781. package/node_modules/zod/v4/locales/zh-TW.d.ts +4 -0
  1782. package/node_modules/zod/v4/locales/zh-TW.js +112 -0
  1783. package/node_modules/zod/v4/mini/checks.cjs +54 -0
  1784. package/node_modules/zod/v4/mini/checks.d.cts +1 -0
  1785. package/node_modules/zod/v4/mini/checks.d.ts +1 -0
  1786. package/node_modules/zod/v4/mini/checks.js +1 -0
  1787. package/node_modules/zod/v4/mini/coerce.cjs +71 -0
  1788. package/node_modules/zod/v4/mini/coerce.d.cts +7 -0
  1789. package/node_modules/zod/v4/mini/coerce.d.ts +7 -0
  1790. package/node_modules/zod/v4/mini/coerce.js +22 -0
  1791. package/node_modules/zod/v4/mini/deep-partial.cjs +58 -0
  1792. package/node_modules/zod/v4/mini/deep-partial.d.cts +14 -0
  1793. package/node_modules/zod/v4/mini/deep-partial.d.ts +14 -0
  1794. package/node_modules/zod/v4/mini/deep-partial.js +13 -0
  1795. package/node_modules/zod/v4/mini/external.cjs +95 -0
  1796. package/node_modules/zod/v4/mini/external.d.cts +16 -0
  1797. package/node_modules/zod/v4/mini/external.d.ts +16 -0
  1798. package/node_modules/zod/v4/mini/external.js +16 -0
  1799. package/node_modules/zod/v4/mini/in-out.cjs +82 -0
  1800. package/node_modules/zod/v4/mini/in-out.d.cts +8 -0
  1801. package/node_modules/zod/v4/mini/in-out.d.ts +8 -0
  1802. package/node_modules/zod/v4/mini/in-out.js +36 -0
  1803. package/node_modules/zod/v4/mini/index.cjs +51 -0
  1804. package/node_modules/zod/v4/mini/index.d.cts +3 -0
  1805. package/node_modules/zod/v4/mini/index.d.ts +3 -0
  1806. package/node_modules/zod/v4/mini/index.js +3 -0
  1807. package/node_modules/zod/v4/mini/iso.cjs +83 -0
  1808. package/node_modules/zod/v4/mini/iso.d.cts +22 -0
  1809. package/node_modules/zod/v4/mini/iso.d.ts +22 -0
  1810. package/node_modules/zod/v4/mini/iso.js +34 -0
  1811. package/node_modules/zod/v4/mini/package.json +7 -0
  1812. package/node_modules/zod/v4/mini/parse.cjs +37 -0
  1813. package/node_modules/zod/v4/mini/parse.d.cts +1 -0
  1814. package/node_modules/zod/v4/mini/parse.d.ts +1 -0
  1815. package/node_modules/zod/v4/mini/parse.js +1 -0
  1816. package/node_modules/zod/v4/mini/schemas.cjs +1147 -0
  1817. package/node_modules/zod/v4/mini/schemas.d.cts +480 -0
  1818. package/node_modules/zod/v4/mini/schemas.d.ts +480 -0
  1819. package/node_modules/zod/v4/mini/schemas.js +1002 -0
  1820. package/node_modules/zod/v4/package.json +7 -0
  1821. package/node_modules/zod/v4-mini/index.cjs +51 -0
  1822. package/node_modules/zod/v4-mini/index.d.cts +3 -0
  1823. package/node_modules/zod/v4-mini/index.d.ts +3 -0
  1824. package/node_modules/zod/v4-mini/index.js +3 -0
  1825. package/node_modules/zod/v4-mini/package.json +7 -0
  1826. package/package.json +50 -0
@@ -0,0 +1,1842 @@
1
+ import { execFile as execFileCallback, spawn } from "node:child_process";
2
+ import { symlinkSync } from "node:fs";
3
+ import { chmod, lstat, mkdir, mkdtemp, readFile, readdir, readlink, rename, rm, writeFile } from "node:fs/promises";
4
+ import net from "node:net";
5
+ import os from "node:os";
6
+ import path from "node:path";
7
+ import { promisify } from "node:util";
8
+ import { afterAll, afterEach, describe, expect, it } from "vitest";
9
+ import { getProcessSessionRemoteSource, startAdapterExecutionTargetProcessSessionBridge, } from "./execution-target.js";
10
+ import { createCommandManagedSandboxCallbackBridgeQueueClient } from "./sandbox-callback-bridge.js";
11
+ import { runChildProcess } from "./server-utils.js";
12
+ const execFile = promisify(execFileCallback);
13
+ // Regression coverage for the stdin file race (parent PAP-4037): the host sends
14
+ // each ACP message as a file in the sandbox stdin directory, and a poller in
15
+ // the sandbox reads the file and writes the data to the child. Two defects lost
16
+ // a message. The host write was not atomic, so the poller could read an empty
17
+ // or partial `.json` file. The poller deleted the file before it validated the
18
+ // content, so an empty read was lost and a partial read stopped the loop.
19
+ describe("stdin file race (parent PAP-4037)", () => {
20
+ const cleanupDirs = [];
21
+ afterEach(async () => {
22
+ while (cleanupDirs.length > 0) {
23
+ const dir = cleanupDirs.pop();
24
+ if (dir)
25
+ await rm(dir, { recursive: true, force: true }).catch(() => undefined);
26
+ }
27
+ });
28
+ // Run the real emitted poller wrapper as a node process. The streamed variant
29
+ // writes one JSON frame per line to its stdout, so the test reads the frames
30
+ // directly. The child command is `cat`, so every byte the poller writes to
31
+ // the child stdin comes back as a `data` frame.
32
+ async function startPollerWrapper(options) {
33
+ const sessionDir = await mkdtemp(path.join(os.tmpdir(), "paperclip-stdin-poll-"));
34
+ cleanupDirs.push(sessionDir);
35
+ const stdinDir = path.join(sessionDir, "stdin");
36
+ await mkdir(stdinDir, { recursive: true });
37
+ const wrapperPath = path.join(sessionDir, "wrapper.mjs");
38
+ await writeFile(wrapperPath, getProcessSessionRemoteSource({ outputToStdout: true }), "utf8");
39
+ const config = { command: "cat", args: [], cwd: sessionDir, env: {} };
40
+ const commandPayload = Buffer.from(JSON.stringify(config), "utf8").toString("base64");
41
+ const env = {
42
+ ...process.env,
43
+ PAPERCLIP_PROCESS_SESSION_DIR: sessionDir,
44
+ PAPERCLIP_PROCESS_SESSION_COMMAND_B64: commandPayload,
45
+ };
46
+ if (options?.maxRetries != null) {
47
+ env.PAPERCLIP_PROCESS_SESSION_STDIN_MAX_RETRIES = String(options.maxRetries);
48
+ }
49
+ const child = spawn(process.execPath, [wrapperPath], {
50
+ cwd: sessionDir,
51
+ env,
52
+ stdio: ["ignore", "pipe", "pipe"],
53
+ });
54
+ const frames = [];
55
+ let stdoutBuffer = "";
56
+ child.stdout.on("data", (chunk) => {
57
+ stdoutBuffer += chunk.toString("utf8");
58
+ const lines = stdoutBuffer.split("\n");
59
+ stdoutBuffer = lines.pop() || "";
60
+ for (const line of lines) {
61
+ if (!line.trim())
62
+ continue;
63
+ frames.push(JSON.parse(line));
64
+ }
65
+ });
66
+ const exited = new Promise((resolve) => child.on("close", () => resolve()));
67
+ return {
68
+ sessionDir,
69
+ stdinDir,
70
+ frames,
71
+ // Write a complete stdin file with an atomic rename, so the test never
72
+ // creates its own partial-write race.
73
+ writeFileAtomic: async (name, content) => {
74
+ const finalPath = path.join(stdinDir, name);
75
+ const tempPath = `${finalPath}.writing`;
76
+ await writeFile(tempPath, content, "utf8");
77
+ await rename(tempPath, finalPath);
78
+ },
79
+ // Write a `.json` file directly, so a reader can observe it before the
80
+ // content lands. This simulates the non-atomic-write window.
81
+ writeFileRaw: async (name, content) => {
82
+ await writeFile(path.join(stdinDir, name), content, "utf8");
83
+ },
84
+ exited,
85
+ kill: () => child.kill("SIGKILL"),
86
+ };
87
+ }
88
+ function stdinMessage(text) {
89
+ return `${JSON.stringify({ type: "stdin", data: Buffer.from(text, "utf8").toString("base64") })}\n`;
90
+ }
91
+ const stdinEndMessage = `${JSON.stringify({ type: "stdinEnd" })}\n`;
92
+ // Concatenate every stdout `data` frame and decode it back to text.
93
+ function collectDelivered(frames) {
94
+ return frames
95
+ .filter((frame) => frame.type === "data" && frame.stream === "stdout" && typeof frame.data === "string")
96
+ .map((frame) => Buffer.from(frame.data, "base64").toString("utf8"))
97
+ .join("");
98
+ }
99
+ function delay(ms) {
100
+ return new Promise((resolve) => setTimeout(resolve, ms));
101
+ }
102
+ async function waitFor(check, timeoutMs = 4_000) {
103
+ const deadline = Date.now() + timeoutMs;
104
+ while (Date.now() < deadline) {
105
+ if (check())
106
+ return;
107
+ await delay(20);
108
+ }
109
+ throw new Error("Timed out waiting for condition.");
110
+ }
111
+ // ---- Poller tests -----------------------------------------------------
112
+ it("delivers a stdin file that appears empty first and then gets content", async () => {
113
+ const poller = await startPollerWrapper();
114
+ // The file appears empty first (the non-atomic-write window). The poller
115
+ // must keep it and retry, not delete it and lose the message.
116
+ await poller.writeFileRaw("000000000001.json", "");
117
+ await delay(200);
118
+ // The poller keeps the empty file for a later retry. A poller that deletes
119
+ // before it validates would drop the file here and lose the message.
120
+ const afterEmpty = await readdir(poller.stdinDir);
121
+ expect(afterEmpty).toContain("000000000001.json");
122
+ // The content lands in the same file. The poller must deliver it on a later
123
+ // cycle, because it kept the file across the empty read.
124
+ await poller.writeFileAtomic("000000000001.json", stdinMessage("late-payload"));
125
+ await waitFor(() => collectDelivered(poller.frames).includes("late-payload"));
126
+ await poller.writeFileAtomic("000000000002.json", stdinEndMessage);
127
+ await poller.exited;
128
+ expect(collectDelivered(poller.frames)).toBe("late-payload");
129
+ expect(poller.frames.some((frame) => frame.type === "exit")).toBe(true);
130
+ });
131
+ it("keeps polling after a malformed file and still delivers a later valid file", async () => {
132
+ const poller = await startPollerWrapper({ maxRetries: 3 });
133
+ // A malformed file sorts before the valid file. The poller keeps the send
134
+ // order: it holds the later file until it drops the malformed file after the
135
+ // retry limit, then it delivers the later valid file. So one bad file blocks
136
+ // the loop only until the retry limit, not forever.
137
+ await poller.writeFileRaw("000000000001.json", "{ this is not valid json");
138
+ await poller.writeFileAtomic("000000000002.json", stdinMessage("valid-after-bad"));
139
+ await waitFor(() => collectDelivered(poller.frames).includes("valid-after-bad"));
140
+ await poller.writeFileAtomic("000000000003.json", stdinEndMessage);
141
+ await poller.exited;
142
+ expect(collectDelivered(poller.frames)).toBe("valid-after-bad");
143
+ expect(poller.frames.some((frame) => frame.type === "exit")).toBe(true);
144
+ });
145
+ it("does not close the stream on a later stdinEnd while an earlier file awaits retry", async () => {
146
+ const poller = await startPollerWrapper();
147
+ // An earlier stdin file is momentarily unreadable (the non-atomic-write
148
+ // window). A later stdinEnd file is already complete. The poller must keep
149
+ // the send order: it must not read the stdinEnd ahead of the earlier file
150
+ // and close the stream. It must hold the stream open until the earlier file
151
+ // is readable.
152
+ await poller.writeFileRaw("000000000001.json", "");
153
+ await poller.writeFileAtomic("000000000002.json", stdinEndMessage);
154
+ // Give the poller time to scan. The stream stays open, so the child does not
155
+ // exit and no exit frame appears yet.
156
+ await delay(300);
157
+ expect(poller.frames.some((frame) => frame.type === "exit")).toBe(false);
158
+ // The earlier file's content lands. The poller delivers it, then reads the
159
+ // stdinEnd and closes the stream.
160
+ await poller.writeFileAtomic("000000000001.json", stdinMessage("early-payload"));
161
+ await waitFor(() => collectDelivered(poller.frames).includes("early-payload"));
162
+ await poller.exited;
163
+ expect(collectDelivered(poller.frames)).toBe("early-payload");
164
+ expect(poller.frames.some((frame) => frame.type === "exit")).toBe(true);
165
+ });
166
+ it("drops a permanently malformed file after the retry limit and writes an error event", async () => {
167
+ const poller = await startPollerWrapper({ maxRetries: 3 });
168
+ // This file never becomes valid. After the retry limit the poller drops it
169
+ // and writes an error event, so the lost message fails loudly.
170
+ await poller.writeFileRaw("000000000001.json", "{ permanently broken");
171
+ await waitFor(() => poller.frames.some((frame) => frame.type === "error" && typeof frame.message === "string" && frame.message.includes("Dropped unreadable stdin file")));
172
+ // The loop still works after the drop: a later valid file is delivered.
173
+ await poller.writeFileAtomic("000000000002.json", stdinMessage("still-alive"));
174
+ await waitFor(() => collectDelivered(poller.frames).includes("still-alive"));
175
+ await poller.writeFileAtomic("000000000003.json", stdinEndMessage);
176
+ await poller.exited;
177
+ expect(collectDelivered(poller.frames)).toBe("still-alive");
178
+ expect(poller.frames.some((frame) => frame.type === "exit")).toBe(true);
179
+ });
180
+ it("holds a later stdin file until the missing earlier file appears", async () => {
181
+ const poller = await startPollerWrapper();
182
+ // File 2 is complete, but file 1 has not appeared yet (a host reordering).
183
+ // The poller must not deliver file 2 ahead of the missing file 1. It holds
184
+ // the send order and waits for the earlier file.
185
+ await poller.writeFileAtomic("000000000002.json", stdinMessage("second-payload"));
186
+ await delay(300);
187
+ // File 2 is still on disk and nothing was delivered: the poller holds it.
188
+ const afterHold = await readdir(poller.stdinDir);
189
+ expect(afterHold).toContain("000000000002.json");
190
+ expect(collectDelivered(poller.frames)).toBe("");
191
+ // File 1 arrives. The poller now delivers file 1 then file 2, in send order.
192
+ await poller.writeFileAtomic("000000000001.json", stdinMessage("first-payload"));
193
+ await waitFor(() => collectDelivered(poller.frames).includes("second-payload"));
194
+ expect(collectDelivered(poller.frames)).toBe("first-payloadsecond-payload");
195
+ await poller.writeFileAtomic("000000000003.json", stdinEndMessage);
196
+ await poller.exited;
197
+ expect(poller.frames.some((frame) => frame.type === "exit")).toBe(true);
198
+ });
199
+ it("fails loud and advances past a missing stdin file after the retry limit", async () => {
200
+ const poller = await startPollerWrapper({ maxRetries: 3 });
201
+ // File 1 never appears. File 2 is complete. After the retry limit the poller
202
+ // writes a loud error event and advances past the gap, then delivers file 2.
203
+ // So a permanent reordering fails loud, never silently.
204
+ await poller.writeFileAtomic("000000000002.json", stdinMessage("after-gap"));
205
+ await waitFor(() => poller.frames.some((frame) => frame.type === "error" &&
206
+ typeof frame.message === "string" &&
207
+ frame.message.includes("Advanced past missing stdin files")));
208
+ await waitFor(() => collectDelivered(poller.frames).includes("after-gap"));
209
+ await poller.writeFileAtomic("000000000003.json", stdinEndMessage);
210
+ await poller.exited;
211
+ expect(collectDelivered(poller.frames)).toBe("after-gap");
212
+ expect(poller.frames.some((frame) => frame.type === "exit")).toBe(true);
213
+ });
214
+ // ---- Host serialization test (drives the real bridge) -----------------
215
+ // A runner that runs each bridge shell script as a real child process, so the
216
+ // test drives the whole legacy-poll bridge: the socket handler, the command-
217
+ // managed `writeTextFile` script, the nohup wrapper, and the output poll.
218
+ function createLocalSandboxRunner(onExecute) {
219
+ let counter = 0;
220
+ return {
221
+ execute: async (input) => {
222
+ counter += 1;
223
+ const script = input.args?.[1] ?? "";
224
+ if (onExecute)
225
+ await onExecute(script);
226
+ const command = input.command === "bash" ? "/bin/bash" : input.command === "sh" ? "/bin/sh" : input.command;
227
+ return runChildProcess(`stdin-order-run-${counter}`, command, input.args ?? [], {
228
+ cwd: input.cwd ?? process.cwd(),
229
+ env: input.env ?? {},
230
+ stdin: input.stdin,
231
+ timeoutSec: Math.max(1, Math.ceil((input.timeoutMs ?? 30_000) / 1000)),
232
+ graceSec: 5,
233
+ onLog: input.onLog ?? (async () => { }),
234
+ });
235
+ },
236
+ };
237
+ }
238
+ it("serializes host stdin writes so a slow earlier write still lands first", async () => {
239
+ const rootDir = await mkdtemp(path.join(os.tmpdir(), "paperclip-stdin-host-order-"));
240
+ cleanupDirs.push(rootDir);
241
+ // The child echoes every stdin byte to stdout, so the wrapper reports the
242
+ // exact bytes and order the child received on its stdin.
243
+ const childPath = path.join(rootDir, "echo-child.mjs");
244
+ await writeFile(childPath, "process.stdin.on('data', (c) => process.stdout.write(c));\n", "utf8");
245
+ // Record the send-order-relevant event: the completion of each stdin file's
246
+ // finalize (atomic rename). Delay the finalize of the FIRST file, so its
247
+ // write resolves slower than the second. Without serialization the second
248
+ // rename would land first; the per-session chain must keep the send order.
249
+ const finalizeOrder = [];
250
+ const runner = createLocalSandboxRunner(async (script) => {
251
+ const finalizeMatch = /base64 -d[\s\S]*mv '[^']*\.decoded' '([^']+\.json)'/.exec(script);
252
+ if (finalizeMatch) {
253
+ const remotePath = finalizeMatch[1];
254
+ if (remotePath.endsWith("000000000001.json"))
255
+ await delay(300);
256
+ finalizeOrder.push(path.posix.basename(remotePath));
257
+ }
258
+ });
259
+ const target = {
260
+ kind: "remote",
261
+ transport: "sandbox",
262
+ providerKey: "local-test",
263
+ remoteCwd: rootDir,
264
+ timeoutMs: 30_000,
265
+ runner,
266
+ };
267
+ const bridge = await startAdapterExecutionTargetProcessSessionBridge({
268
+ runId: "run-stdin-host-order",
269
+ target,
270
+ runtimeRootDir: path.posix.join(rootDir, ".paperclip-runtime", "acpx"),
271
+ adapterKey: "acpx",
272
+ command: process.execPath,
273
+ args: [childPath],
274
+ cwd: rootDir,
275
+ env: {},
276
+ timeoutSec: 5,
277
+ onLog: async () => { },
278
+ });
279
+ expect(bridge).not.toBeNull();
280
+ let peer = null;
281
+ try {
282
+ const proxySource = await readFile(bridge.agentCommand, "utf8");
283
+ const port = Number(/port: (\d+)/.exec(proxySource)?.[1] ?? Number.NaN);
284
+ const tokenLiteral = /const token = (".*?");/.exec(proxySource)?.[1];
285
+ expect(Number.isFinite(port)).toBe(true);
286
+ const token = JSON.parse(tokenLiteral);
287
+ const peerSocket = net.createConnection({ host: "127.0.0.1", port });
288
+ peer = peerSocket;
289
+ peerSocket.setEncoding("utf8");
290
+ peerSocket.on("error", () => undefined);
291
+ const delivered = [];
292
+ let peerBuffer = "";
293
+ peerSocket.on("data", (chunk) => {
294
+ peerBuffer += chunk;
295
+ const lines = peerBuffer.split("\n");
296
+ peerBuffer = lines.pop() || "";
297
+ for (const line of lines) {
298
+ if (!line.trim())
299
+ continue;
300
+ const frame = JSON.parse(line);
301
+ if (frame.type === "data" && frame.stream === "stdout" && typeof frame.data === "string") {
302
+ delivered.push(Buffer.from(frame.data, "base64").toString("utf8"));
303
+ }
304
+ }
305
+ });
306
+ await new Promise((resolve, reject) => {
307
+ peerSocket.once("connect", () => resolve());
308
+ peerSocket.once("error", reject);
309
+ });
310
+ // Send two stdin messages back to back. The first authenticates and writes
311
+ // file 1; the second writes file 2. Both are scheduled before file 1's
312
+ // delayed finalize resolves, so an un-chained handler would race them.
313
+ const head = `${JSON.stringify({ token, type: "stdin", data: Buffer.from("HEAD_ONE_", "utf8").toString("base64") })}\n`;
314
+ const tail = `${JSON.stringify({ token, type: "stdin", data: Buffer.from("TAIL_TWO", "utf8").toString("base64") })}\n`;
315
+ peerSocket.write(head);
316
+ peerSocket.write(tail);
317
+ // The two finalize renames complete in send order, not in the order the
318
+ // delayed and fast writes would otherwise finish.
319
+ await waitFor(() => finalizeOrder.length >= 2, 8_000);
320
+ expect(finalizeOrder.slice(0, 2)).toEqual(["000000000001.json", "000000000002.json"]);
321
+ // End to end: the child receives the two payloads intact and in send
322
+ // order, so the prompt is byte-identical on the child stdin.
323
+ await waitFor(() => delivered.join("").includes("TAIL_TWO"), 8_000);
324
+ expect(delivered.join("")).toBe("HEAD_ONE_TAIL_TWO");
325
+ }
326
+ finally {
327
+ peer?.destroy();
328
+ await bridge?.stop();
329
+ }
330
+ });
331
+ it("holds stdinEnd on stop until an earlier pending stdin write lands first", async () => {
332
+ const rootDir = await mkdtemp(path.join(os.tmpdir(), "paperclip-stdin-stop-order-"));
333
+ cleanupDirs.push(rootDir);
334
+ const childPath = path.join(rootDir, "echo-child.mjs");
335
+ await writeFile(childPath, "process.stdin.on('data', (c) => process.stdout.write(c));\n", "utf8");
336
+ // Record each stdin file finalize (atomic rename). `finalizeStarted` marks
337
+ // the start; `finalizeOrder` marks the completion. Delay the FIRST chunk's
338
+ // finalize, so its write is still pending when `stop()` runs. `stop()` must
339
+ // chain the `stdinEnd` write after the pending chunk, so file 2 (stdinEnd)
340
+ // never finishes its rename before file 1.
341
+ const finalizeStarted = [];
342
+ const finalizeOrder = [];
343
+ const runner = createLocalSandboxRunner(async (script) => {
344
+ const finalizeMatch = /base64 -d[\s\S]*mv '[^']*\.decoded' '([^']+\.json)'/.exec(script);
345
+ if (finalizeMatch) {
346
+ const name = path.posix.basename(finalizeMatch[1]);
347
+ finalizeStarted.push(name);
348
+ if (name === "000000000001.json")
349
+ await delay(300);
350
+ finalizeOrder.push(name);
351
+ }
352
+ });
353
+ const target = {
354
+ kind: "remote",
355
+ transport: "sandbox",
356
+ providerKey: "local-test",
357
+ remoteCwd: rootDir,
358
+ timeoutMs: 30_000,
359
+ runner,
360
+ };
361
+ const bridge = await startAdapterExecutionTargetProcessSessionBridge({
362
+ runId: "run-stdin-stop-order",
363
+ target,
364
+ runtimeRootDir: path.posix.join(rootDir, ".paperclip-runtime", "acpx"),
365
+ adapterKey: "acpx",
366
+ command: process.execPath,
367
+ args: [childPath],
368
+ cwd: rootDir,
369
+ env: {},
370
+ timeoutSec: 5,
371
+ onLog: async () => { },
372
+ });
373
+ expect(bridge).not.toBeNull();
374
+ let peer = null;
375
+ let stopped = false;
376
+ try {
377
+ const proxySource = await readFile(bridge.agentCommand, "utf8");
378
+ const port = Number(/port: (\d+)/.exec(proxySource)?.[1] ?? Number.NaN);
379
+ const tokenLiteral = /const token = (".*?");/.exec(proxySource)?.[1];
380
+ expect(Number.isFinite(port)).toBe(true);
381
+ const token = JSON.parse(tokenLiteral);
382
+ const peerSocket = net.createConnection({ host: "127.0.0.1", port });
383
+ peer = peerSocket;
384
+ peerSocket.setEncoding("utf8");
385
+ peerSocket.on("error", () => undefined);
386
+ peerSocket.on("data", () => undefined);
387
+ await new Promise((resolve, reject) => {
388
+ peerSocket.once("connect", () => resolve());
389
+ peerSocket.once("error", reject);
390
+ });
391
+ // Send one stdin message. It authenticates and writes file 1, whose
392
+ // finalize the runner delays. Wait until that finalize has started, so the
393
+ // write is in flight when `stop()` runs.
394
+ const head = `${JSON.stringify({ token, type: "stdin", data: Buffer.from("HEAD_ONE_", "utf8").toString("base64") })}\n`;
395
+ peerSocket.write(head);
396
+ await waitFor(() => finalizeStarted.includes("000000000001.json"), 8_000);
397
+ // Stop the bridge while file 1's write is still pending. `stop()` awaits
398
+ // the chained `stdinEnd` write, then chains a `shutdown` write after it,
399
+ // so all three finalizes are complete when it returns, in send order.
400
+ await bridge.stop();
401
+ stopped = true;
402
+ expect(finalizeOrder).toEqual(["000000000001.json", "000000000002.json", "000000000003.json"]);
403
+ }
404
+ finally {
405
+ peer?.destroy();
406
+ if (!stopped)
407
+ await bridge?.stop();
408
+ }
409
+ });
410
+ // ---- Host atomic-write tests ------------------------------------------
411
+ // A runner that executes each bridge shell script on the local filesystem,
412
+ // so the test exercises the real command-managed `writeTextFile` script.
413
+ function createLocalShellRunner(scripts) {
414
+ return {
415
+ execute: async (input) => {
416
+ const args = input.args ?? [];
417
+ if ((input.command === "sh" || input.command === "bash") && args[0] === "-c" && typeof args[1] === "string") {
418
+ scripts.push(args[1]);
419
+ }
420
+ const command = input.command === "sh" ? "/bin/sh" : input.command === "bash" ? "/bin/bash" : input.command;
421
+ try {
422
+ const result = await execFile(command, args, {
423
+ cwd: input.cwd,
424
+ env: { ...process.env, ...input.env },
425
+ maxBuffer: 32 * 1024 * 1024,
426
+ });
427
+ return {
428
+ exitCode: 0,
429
+ signal: null,
430
+ timedOut: false,
431
+ stdout: result.stdout,
432
+ stderr: result.stderr,
433
+ pid: null,
434
+ startedAt: null,
435
+ };
436
+ }
437
+ catch (error) {
438
+ const err = error;
439
+ return {
440
+ exitCode: typeof err.code === "number" ? err.code : null,
441
+ signal: null,
442
+ timedOut: false,
443
+ stdout: err.stdout ?? "",
444
+ stderr: err.stderr ?? "",
445
+ pid: null,
446
+ startedAt: null,
447
+ };
448
+ }
449
+ },
450
+ };
451
+ }
452
+ it("finalizes the command-managed host write with an atomic rename onto the .json path", async () => {
453
+ const remoteRoot = await mkdtemp(path.join(os.tmpdir(), "paperclip-stdin-host-cmd-"));
454
+ cleanupDirs.push(remoteRoot);
455
+ const stdinDir = path.join(remoteRoot, "stdin");
456
+ await mkdir(stdinDir, { recursive: true });
457
+ const scripts = [];
458
+ const client = createCommandManagedSandboxCallbackBridgeQueueClient({
459
+ runner: createLocalShellRunner(scripts),
460
+ remoteCwd: remoteRoot,
461
+ timeoutMs: 30_000,
462
+ });
463
+ const jsonPath = path.join(stdinDir, "000000000001.json");
464
+ const body = `${JSON.stringify({ type: "stdin", data: Buffer.from("host-payload", "utf8").toString("base64") })}\n`;
465
+ await client.writeTextFile(jsonPath, body);
466
+ // The final file holds the complete body.
467
+ expect(await readFile(jsonPath, "utf8")).toBe(body);
468
+ // No temporary upload file remains next to the final file.
469
+ const entries = await readdir(stdinDir);
470
+ expect(entries).toEqual(["000000000001.json"]);
471
+ // The finalize script renames a non-`.json` temporary file onto the final
472
+ // path. It never redirects the decode output straight into the `.json`
473
+ // file, so a reader never sees an empty or partial `.json` file.
474
+ const finalizeScript = scripts.find((script) => script.includes("base64 -d"));
475
+ expect(finalizeScript).toBeDefined();
476
+ expect(finalizeScript).toContain(`mv `);
477
+ expect(finalizeScript).not.toContain(`> '${jsonPath}'`);
478
+ expect(finalizeScript).toContain(`> '${jsonPath}.paperclip-upload.decoded'`);
479
+ });
480
+ it("never exposes a partial .json file under a concurrent reader (command-managed host write)", async () => {
481
+ const remoteRoot = await mkdtemp(path.join(os.tmpdir(), "paperclip-stdin-host-race-"));
482
+ cleanupDirs.push(remoteRoot);
483
+ const stdinDir = path.join(remoteRoot, "stdin");
484
+ await mkdir(stdinDir, { recursive: true });
485
+ const client = createCommandManagedSandboxCallbackBridgeQueueClient({
486
+ runner: createLocalShellRunner([]),
487
+ remoteCwd: remoteRoot,
488
+ timeoutMs: 30_000,
489
+ });
490
+ const jsonPath = path.join(stdinDir, "000000000001.json");
491
+ // A large body needs many decode bytes, so the write window is wide.
492
+ const bigText = "x".repeat(64 * 1024);
493
+ const body = `${JSON.stringify({ type: "stdin", data: Buffer.from(bigText, "utf8").toString("base64") })}\n`;
494
+ let stop = false;
495
+ const readerErrors = [];
496
+ let observedComplete = 0;
497
+ const reader = (async () => {
498
+ while (!stop) {
499
+ const raw = await readFile(jsonPath, "utf8").catch(() => null);
500
+ if (raw) {
501
+ try {
502
+ JSON.parse(raw);
503
+ observedComplete += 1;
504
+ }
505
+ catch (error) {
506
+ readerErrors.push(error instanceof Error ? error.message : String(error));
507
+ }
508
+ }
509
+ }
510
+ })();
511
+ for (let round = 0; round < 6; round += 1) {
512
+ await client.remove(jsonPath);
513
+ await client.writeTextFile(jsonPath, body);
514
+ }
515
+ stop = true;
516
+ await reader;
517
+ // Every read of the final file parsed as complete JSON. The reader never
518
+ // saw an empty or partial `.json` file.
519
+ expect(readerErrors).toEqual([]);
520
+ expect(observedComplete).toBeGreaterThan(0);
521
+ });
522
+ });
523
+ // Coverage for deterministic wrapper shutdown (parent PAP-5307): a bridge
524
+ // stop must leave no remote wrapper process and no direct child process
525
+ // alive, the host must send no operating-system signal, and the host must
526
+ // store no process identifier. These tests drive the real emitted wrapper as
527
+ // a node process and, where noted, the real bridge through a local runner.
528
+ describe("deterministic remote process-session wrapper shutdown (PAP-5316)", () => {
529
+ const cleanupDirs = [];
530
+ afterEach(async () => {
531
+ while (cleanupDirs.length > 0) {
532
+ const dir = cleanupDirs.pop();
533
+ if (dir)
534
+ await rm(dir, { recursive: true, force: true }).catch(() => undefined);
535
+ }
536
+ });
537
+ function delay(ms) {
538
+ return new Promise((resolve) => setTimeout(resolve, ms));
539
+ }
540
+ async function waitFor(check, timeoutMs = 8_000) {
541
+ const deadline = Date.now() + timeoutMs;
542
+ while (Date.now() < deadline) {
543
+ if (await check())
544
+ return;
545
+ await delay(20);
546
+ }
547
+ throw new Error("Timed out waiting for condition.");
548
+ }
549
+ function isPidAlive(pid) {
550
+ try {
551
+ process.kill(pid, 0);
552
+ return true;
553
+ }
554
+ catch {
555
+ return false;
556
+ }
557
+ }
558
+ // A read-only, test-only liveness probe over the real OS process table. It
559
+ // never signals anything; it only greps `ps` output to tell the test
560
+ // whether a specific test-authored script (identified by its own temp file
561
+ // path) is still running. Production host code never does this — it never
562
+ // matches or signals a process by name or command line.
563
+ async function findLivePidsByArgvSubstring(substring) {
564
+ try {
565
+ const { stdout } = await execFile("ps", ["-eo", "pid=,args="]);
566
+ const pids = [];
567
+ for (const line of stdout.split("\n")) {
568
+ const trimmed = line.trim();
569
+ if (!trimmed)
570
+ continue;
571
+ const match = /^(\d+)\s+(.*)$/.exec(trimmed);
572
+ if (match && match[2].includes(substring)) {
573
+ const pid = Number.parseInt(match[1], 10);
574
+ if (Number.isFinite(pid))
575
+ pids.push(pid);
576
+ }
577
+ }
578
+ return pids;
579
+ }
580
+ catch {
581
+ return [];
582
+ }
583
+ }
584
+ // A test-only preload module for the wrapper's node process (PAP-5338).
585
+ // This sandbox's filesystems all report a real, working birthtime, so a
586
+ // test cannot reach the two known "no usable creation time" fallbacks by
587
+ // using a real filesystem alone. This preload patches fs.promises.lstat
588
+ // inside the wrapper's own process, for one directory the test names
589
+ // through an env var, so the wrapper observes the exact Stats shape each
590
+ // fallback produces. It never runs unless a test opts in, and it never
591
+ // touches this test file's own process.
592
+ // Kept outside cleanupDirs (which afterEach drains after every single test):
593
+ // this preload file is created once and reused by every test in this
594
+ // describe block, so an early test's cleanup must not delete it out from
595
+ // under a later test.
596
+ let fakeBirthtimePreloadDir = null;
597
+ afterAll(async () => {
598
+ if (fakeBirthtimePreloadDir)
599
+ await rm(fakeBirthtimePreloadDir, { recursive: true, force: true }).catch(() => undefined);
600
+ });
601
+ let fakeBirthtimePreloadPath = null;
602
+ async function getFakeBirthtimePreloadPath() {
603
+ if (!fakeBirthtimePreloadPath) {
604
+ fakeBirthtimePreloadPath = (async () => {
605
+ const dir = await mkdtemp(path.join(os.tmpdir(), "paperclip-birthtime-preload-"));
606
+ fakeBirthtimePreloadDir = dir;
607
+ const preloadPath = path.join(dir, "fake-birthtime-preload.cjs");
608
+ await writeFile(preloadPath, [
609
+ `const fs = require("fs");`,
610
+ `const path = require("path");`,
611
+ `const target = process.env.PAPERCLIP_TEST_FAKE_BIRTHTIME_TARGET;`,
612
+ `const mode = process.env.PAPERCLIP_TEST_FAKE_BIRTHTIME_MODE;`,
613
+ `const sessionDir = process.env.PAPERCLIP_PROCESS_SESSION_DIR;`,
614
+ `if (target && mode && sessionDir) {`,
615
+ ` const resolvedTarget = path.resolve(target === "stdinDir" ? path.join(sessionDir, "stdin") : sessionDir);`,
616
+ ` const originalLstat = fs.promises.lstat.bind(fs.promises);`,
617
+ ` fs.promises.lstat = async (candidatePath, opts) => {`,
618
+ ` const stats = await originalLstat(candidatePath, opts);`,
619
+ ` if (path.resolve(String(candidatePath)) === resolvedTarget) {`,
620
+ ` const fakeValue = mode === "zero" ? 0 : stats.ctimeMs;`,
621
+ ` Object.defineProperty(stats, "birthtimeMs", { value: fakeValue, configurable: true });`,
622
+ ` }`,
623
+ ` return stats;`,
624
+ ` };`,
625
+ `}`,
626
+ ].join("\n"), "utf8");
627
+ return preloadPath;
628
+ })();
629
+ }
630
+ return fakeBirthtimePreloadPath;
631
+ }
632
+ // A test-only preload for PAP-5355: it deterministically simulates a
633
+ // same-sandbox peer that wins the gap between the wrapper's final identity
634
+ // check and its removal call. nextProbeFileName() is deterministic (pid +
635
+ // call sequence), so this preload can compute the exact probe path the
636
+ // wrapper itself will check next. It patches fs.promises.lstat inside the
637
+ // wrapper's own process: the first time that call targets the expected
638
+ // probe path, it replaces the path with a peer-owned entry before the real
639
+ // lstat runs, so the wrapper observes the swapped entry's identity, not its
640
+ // own. This is the worst case for the wrapper (the swap always lands
641
+ // before the wrapper's very last look at the path), so a wrapper that
642
+ // still leaves the peer's entry untouched under this preload proves the
643
+ // fix for every less-adversarial timing too. It never runs unless a test
644
+ // opts in, and it never touches this test file's own process.
645
+ let probeSwapPreloadDir = null;
646
+ afterAll(async () => {
647
+ if (probeSwapPreloadDir)
648
+ await rm(probeSwapPreloadDir, { recursive: true, force: true }).catch(() => undefined);
649
+ });
650
+ let probeSwapPreloadPath = null;
651
+ async function getProbeSwapPreloadPath() {
652
+ if (!probeSwapPreloadPath) {
653
+ probeSwapPreloadPath = (async () => {
654
+ const dir = await mkdtemp(path.join(os.tmpdir(), "paperclip-probe-swap-preload-"));
655
+ probeSwapPreloadDir = dir;
656
+ const preloadPath = path.join(dir, "probe-swap-preload.cjs");
657
+ await writeFile(preloadPath, [
658
+ `const fs = require("fs");`,
659
+ `const path = require("path");`,
660
+ `const mode = process.env.PAPERCLIP_TEST_PROBE_SWAP_MODE;`,
661
+ `const seq = process.env.PAPERCLIP_TEST_PROBE_SWAP_SEQ;`,
662
+ `const symlinkTarget = process.env.PAPERCLIP_TEST_PROBE_SWAP_SYMLINK_TARGET;`,
663
+ `if (mode && seq) {`,
664
+ ` const expectedName = ".paperclip-birthtime-probe-" + process.pid + "-" + seq;`,
665
+ ` let swapped = false;`,
666
+ ` const originalLstat = fs.promises.lstat.bind(fs.promises);`,
667
+ ` fs.promises.lstat = async (candidatePath, opts) => {`,
668
+ ` if (!swapped && path.basename(String(candidatePath)) === expectedName) {`,
669
+ ` swapped = true;`,
670
+ ` try { fs.unlinkSync(candidatePath); } catch {}`,
671
+ ` if (mode === "file") fs.writeFileSync(candidatePath, "peer-owned-content");`,
672
+ ` else if (mode === "dir") fs.mkdirSync(candidatePath);`,
673
+ ` else if (mode === "symlink") fs.symlinkSync(symlinkTarget, candidatePath);`,
674
+ ` }`,
675
+ ` return originalLstat(candidatePath, opts);`,
676
+ ` };`,
677
+ `}`,
678
+ ].join("\n"), "utf8");
679
+ return preloadPath;
680
+ })();
681
+ }
682
+ return probeSwapPreloadPath;
683
+ }
684
+ // A test-only preload for PAP-5374: it simulates fstat() failing on the
685
+ // wrapper's own just-opened probe file descriptor, the one signal the real
686
+ // filesystem in this sandbox never produces on demand. nextProbeFileName()
687
+ // is deterministic (pid + call sequence), so this preload knows which
688
+ // fs.promises.open() call is the wrapper's probe write and patches only the
689
+ // FileHandle that call returns, leaving every other open() untouched. It
690
+ // never runs unless a test opts in, and it never touches this test file's
691
+ // own process.
692
+ let fstatFailurePreloadDir = null;
693
+ afterAll(async () => {
694
+ if (fstatFailurePreloadDir)
695
+ await rm(fstatFailurePreloadDir, { recursive: true, force: true }).catch(() => undefined);
696
+ });
697
+ let fstatFailurePreloadPath = null;
698
+ async function getFstatFailurePreloadPath() {
699
+ if (!fstatFailurePreloadPath) {
700
+ fstatFailurePreloadPath = (async () => {
701
+ const dir = await mkdtemp(path.join(os.tmpdir(), "paperclip-fstat-failure-preload-"));
702
+ fstatFailurePreloadDir = dir;
703
+ const preloadPath = path.join(dir, "fstat-failure-preload.cjs");
704
+ await writeFile(preloadPath, [
705
+ `const fs = require("fs");`,
706
+ `const path = require("path");`,
707
+ `const seq = process.env.PAPERCLIP_TEST_FSTAT_FAILURE_SEQ;`,
708
+ `if (seq) {`,
709
+ ` const expectedName = ".paperclip-birthtime-probe-" + process.pid + "-" + seq;`,
710
+ ` const originalOpen = fs.promises.open.bind(fs.promises);`,
711
+ ` fs.promises.open = async (targetPath, flags, mode) => {`,
712
+ ` const handle = await originalOpen(targetPath, flags, mode);`,
713
+ ` if (path.basename(String(targetPath)) === expectedName) {`,
714
+ ` handle.stat = async () => {`,
715
+ ` throw new Error("EIO: simulated fstat failure for test");`,
716
+ ` };`,
717
+ ` }`,
718
+ ` return handle;`,
719
+ ` };`,
720
+ `}`,
721
+ ].join("\n"), "utf8");
722
+ return preloadPath;
723
+ })();
724
+ }
725
+ return fstatFailurePreloadPath;
726
+ }
727
+ // Run the real emitted wrapper (either variant) as a node process, with no
728
+ // sandbox and no bridge in front of it. The test owns the wrapper's node
729
+ // ChildProcess handle directly, so it can observe the wrapper's own exit
730
+ // without storing or signaling any process identifier itself.
731
+ async function startWrapperProcess(options) {
732
+ const sessionDir = await mkdtemp(path.join(options?.parentDir ?? os.tmpdir(), "paperclip-wrapper-lifecycle-"));
733
+ cleanupDirs.push(sessionDir);
734
+ const stdinDir = path.join(sessionDir, "stdin");
735
+ const eventsDir = path.join(sessionDir, "events");
736
+ await mkdir(stdinDir, { recursive: true });
737
+ if (options?.outputToStdout !== true)
738
+ await mkdir(eventsDir, { recursive: true });
739
+ const wrapperPath = path.join(sessionDir, "wrapper.mjs");
740
+ await writeFile(wrapperPath, getProcessSessionRemoteSource({ outputToStdout: options?.outputToStdout === true }), "utf8");
741
+ const config = { command: options?.command ?? "cat", args: options?.args ?? [], cwd: sessionDir, env: {} };
742
+ const commandPayload = Buffer.from(JSON.stringify(config), "utf8").toString("base64");
743
+ const env = {
744
+ ...process.env,
745
+ PAPERCLIP_PROCESS_SESSION_DIR: sessionDir,
746
+ PAPERCLIP_PROCESS_SESSION_COMMAND_B64: commandPayload,
747
+ };
748
+ if (options?.maxRetries != null)
749
+ env.PAPERCLIP_PROCESS_SESSION_STDIN_MAX_RETRIES = String(options.maxRetries);
750
+ if (options?.terminateGraceMs != null)
751
+ env.PAPERCLIP_PROCESS_SESSION_TERMINATE_GRACE_MS = String(options.terminateGraceMs);
752
+ const execArgv = [];
753
+ if (options?.fakeBirthtime) {
754
+ env.PAPERCLIP_TEST_FAKE_BIRTHTIME_TARGET = options.fakeBirthtime.target;
755
+ env.PAPERCLIP_TEST_FAKE_BIRTHTIME_MODE = options.fakeBirthtime.mode;
756
+ execArgv.push("--require", await getFakeBirthtimePreloadPath());
757
+ }
758
+ if (options?.probeSwap) {
759
+ env.PAPERCLIP_TEST_PROBE_SWAP_SEQ = String(options.probeSwap.seq);
760
+ env.PAPERCLIP_TEST_PROBE_SWAP_MODE = options.probeSwap.mode;
761
+ if (options.probeSwap.symlinkTarget)
762
+ env.PAPERCLIP_TEST_PROBE_SWAP_SYMLINK_TARGET = options.probeSwap.symlinkTarget;
763
+ execArgv.push("--require", await getProbeSwapPreloadPath());
764
+ }
765
+ if (options?.fstatFailure) {
766
+ env.PAPERCLIP_TEST_FSTAT_FAILURE_SEQ = String(options.fstatFailure.seq);
767
+ execArgv.push("--require", await getFstatFailurePreloadPath());
768
+ }
769
+ const child = spawn(process.execPath, [...execArgv, wrapperPath], {
770
+ cwd: sessionDir,
771
+ env,
772
+ stdio: ["ignore", "pipe", "pipe"],
773
+ });
774
+ const frames = [];
775
+ let stdoutBuffer = "";
776
+ child.stdout.on("data", (chunk) => {
777
+ stdoutBuffer += chunk.toString("utf8");
778
+ const lines = stdoutBuffer.split("\n");
779
+ stdoutBuffer = lines.pop() || "";
780
+ for (const line of lines) {
781
+ if (!line.trim())
782
+ continue;
783
+ try {
784
+ frames.push(JSON.parse(line));
785
+ }
786
+ catch {
787
+ // A partial line at a chunk boundary; ignore.
788
+ }
789
+ }
790
+ });
791
+ let stderrText = "";
792
+ child.stderr.on("data", (chunk) => {
793
+ stderrText += chunk.toString("utf8");
794
+ });
795
+ let exitCode = null;
796
+ let exitSignal = null;
797
+ const exited = new Promise((resolve) => {
798
+ child.on("close", (code, signal) => {
799
+ exitCode = code;
800
+ exitSignal = signal;
801
+ resolve();
802
+ });
803
+ });
804
+ async function readEventFiles() {
805
+ const names = (await readdir(eventsDir).catch(() => [])).filter((name) => name.endsWith(".json")).sort();
806
+ const out = [];
807
+ for (const name of names) {
808
+ const body = await readFile(path.join(eventsDir, name), "utf8").catch(() => "");
809
+ if (!body.trim())
810
+ continue;
811
+ try {
812
+ out.push(JSON.parse(body));
813
+ }
814
+ catch {
815
+ // Not fully written yet; the test polls again.
816
+ }
817
+ }
818
+ return out;
819
+ }
820
+ return {
821
+ pid: child.pid,
822
+ sessionDir,
823
+ stdinDir,
824
+ eventsDir,
825
+ wrapperPath,
826
+ frames,
827
+ stderrText: () => stderrText,
828
+ exited,
829
+ exitInfo: () => ({ code: exitCode, signal: exitSignal }),
830
+ readEventFiles,
831
+ };
832
+ }
833
+ // A runner that runs each bridge shell script as a real child process
834
+ // (matches the harness in the stdin-race describe block above), so a test
835
+ // drives the whole legacy-poll bridge for real: the socket handler, the
836
+ // command-managed `writeTextFile`/`remove` scripts, the nohup wrapper
837
+ // launch, and the output poll.
838
+ function createLocalSandboxRunner(onExecute) {
839
+ let counter = 0;
840
+ return {
841
+ execute: async (input) => {
842
+ counter += 1;
843
+ const script = input.args?.[1] ?? "";
844
+ if (onExecute)
845
+ await onExecute(script);
846
+ const command = input.command === "bash" ? "/bin/bash" : input.command === "sh" ? "/bin/sh" : input.command;
847
+ return runChildProcess(`wrapper-lifecycle-run-${counter}`, command, input.args ?? [], {
848
+ cwd: input.cwd ?? process.cwd(),
849
+ env: input.env ?? {},
850
+ stdin: input.stdin,
851
+ timeoutSec: Math.max(1, Math.ceil((input.timeoutMs ?? 30_000) / 1000)),
852
+ graceSec: 5,
853
+ onLog: input.onLog ?? (async () => { }),
854
+ });
855
+ },
856
+ };
857
+ }
858
+ function trackedChildSource(pidFile) {
859
+ return [
860
+ `import { writeFileSync } from "node:fs";`,
861
+ `writeFileSync(${JSON.stringify(pidFile)}, String(process.pid));`,
862
+ `process.stdin.resume();`,
863
+ ].join("\n");
864
+ }
865
+ // T2's child ignores SIGTERM, so `terminate()` must escalate to SIGKILL
866
+ // after its grace period. Ignoring end-of-file on stdin alone would not
867
+ // prove that: a plain `cat`-like child already dies from the default
868
+ // SIGTERM disposition.
869
+ function stubbornChildSource(pidFile) {
870
+ return [
871
+ `import { writeFileSync } from "node:fs";`,
872
+ `writeFileSync(${JSON.stringify(pidFile)}, String(process.pid));`,
873
+ `process.stdin.resume();`,
874
+ `process.on("SIGTERM", () => {});`,
875
+ `setInterval(() => {}, 1000);`,
876
+ ].join("\n");
877
+ }
878
+ async function startTrackedBridgeSession(input) {
879
+ const pidFile = path.join(input.rootDir, `${input.runId}.pid`);
880
+ const childPath = path.join(input.rootDir, `${input.runId}-child.mjs`);
881
+ await writeFile(childPath, input.childSource, "utf8");
882
+ const target = {
883
+ kind: "remote",
884
+ transport: "sandbox",
885
+ providerKey: "local-test",
886
+ remoteCwd: input.rootDir,
887
+ timeoutMs: 30_000,
888
+ runner: input.runner,
889
+ };
890
+ const bridge = await startAdapterExecutionTargetProcessSessionBridge({
891
+ runId: input.runId,
892
+ target,
893
+ runtimeRootDir: path.posix.join(input.rootDir, ".paperclip-runtime", "acpx"),
894
+ adapterKey: "acpx",
895
+ command: process.execPath,
896
+ args: [childPath],
897
+ cwd: input.rootDir,
898
+ env: {},
899
+ timeoutSec: 5,
900
+ onLog: async () => { },
901
+ });
902
+ expect(bridge).not.toBeNull();
903
+ await waitFor(async () => (await readFile(pidFile, "utf8").catch(() => "")).trim().length > 0, 8_000);
904
+ const pid = Number.parseInt((await readFile(pidFile, "utf8")).trim(), 10);
905
+ return { bridge: bridge, pid };
906
+ }
907
+ it("T1 exits within a bounded time when its session directory disappears with no message ever sent", async () => {
908
+ const wrapper = await startWrapperProcess({ outputToStdout: false, terminateGraceMs: 200 });
909
+ // Let the poll loop run a few cycles before the directory disappears.
910
+ await delay(150);
911
+ await rm(wrapper.sessionDir, { recursive: true, force: true });
912
+ await Promise.race([
913
+ wrapper.exited,
914
+ delay(4_000).then(() => {
915
+ throw new Error("The wrapper did not exit after its session directory disappeared.");
916
+ }),
917
+ ]);
918
+ });
919
+ it("T2 leaves neither the wrapper nor a stubborn child alive after stop()", async () => {
920
+ const rootDir = await mkdtemp(path.join(os.tmpdir(), "paperclip-stubborn-child-"));
921
+ cleanupDirs.push(rootDir);
922
+ const runner = createLocalSandboxRunner();
923
+ const session = await startTrackedBridgeSession({
924
+ rootDir,
925
+ runId: "stubborn",
926
+ childSource: stubbornChildSource(path.join(rootDir, "stubborn.pid")),
927
+ runner,
928
+ });
929
+ // The emitted wrapper script's own path is unique to this test (it lives
930
+ // under this test's fresh temp root), so a `ps` grep on it identifies
931
+ // only this test's wrapper process, not a sibling test's.
932
+ const wrapperScriptSubstring = path.posix.join(rootDir, ".paperclip-runtime", "acpx", "process-sessions");
933
+ try {
934
+ expect(isPidAlive(session.pid)).toBe(true);
935
+ await waitFor(async () => (await findLivePidsByArgvSubstring(wrapperScriptSubstring)).length > 0, 4_000);
936
+ await session.bridge.stop();
937
+ // The child ignores SIGTERM, so `terminate()` needs its own grace
938
+ // period (default 3s) before it escalates to SIGKILL.
939
+ await waitFor(() => !isPidAlive(session.pid), 8_000);
940
+ expect(isPidAlive(session.pid)).toBe(false);
941
+ await waitFor(async () => (await findLivePidsByArgvSubstring(wrapperScriptSubstring)).length === 0, 4_000);
942
+ }
943
+ finally {
944
+ await session.bridge.stop().catch(() => undefined);
945
+ }
946
+ }, 15_000);
947
+ it("T3 exits on its own when the child exits first and no stdinEnd is ever sent", async () => {
948
+ const wrapper = await startWrapperProcess({
949
+ outputToStdout: false,
950
+ command: process.execPath,
951
+ args: ["-e", "process.exit(0)"],
952
+ });
953
+ await Promise.race([
954
+ wrapper.exited,
955
+ delay(4_000).then(() => {
956
+ throw new Error("The wrapper did not exit on its own after its child exited.");
957
+ }),
958
+ ]);
959
+ const events = await wrapper.readEventFiles();
960
+ expect(events.some((event) => event.type === "exit")).toBe(true);
961
+ });
962
+ it("T4 stopping one session leaves a sibling session's wrapper and child alive", async () => {
963
+ const rootDir = await mkdtemp(path.join(os.tmpdir(), "paperclip-session-isolation-"));
964
+ cleanupDirs.push(rootDir);
965
+ const runner = createLocalSandboxRunner();
966
+ const sessionA = await startTrackedBridgeSession({
967
+ rootDir,
968
+ runId: "session-a",
969
+ childSource: trackedChildSource(path.join(rootDir, "session-a.pid")),
970
+ runner,
971
+ });
972
+ const sessionB = await startTrackedBridgeSession({
973
+ rootDir,
974
+ runId: "session-b",
975
+ childSource: trackedChildSource(path.join(rootDir, "session-b.pid")),
976
+ runner,
977
+ });
978
+ try {
979
+ expect(isPidAlive(sessionA.pid)).toBe(true);
980
+ expect(isPidAlive(sessionB.pid)).toBe(true);
981
+ await sessionA.bridge.stop();
982
+ await waitFor(() => !isPidAlive(sessionA.pid), 8_000);
983
+ expect(isPidAlive(sessionA.pid)).toBe(false);
984
+ // Session B never received a stdinEnd or a shutdown message.
985
+ expect(isPidAlive(sessionB.pid)).toBe(true);
986
+ }
987
+ finally {
988
+ await sessionA.bridge.stop().catch(() => undefined);
989
+ await sessionB.bridge.stop().catch(() => undefined);
990
+ }
991
+ }, 15_000);
992
+ it("T5 still writes both control messages, finishes fast, and warns never after a forged exit event the live poll reads early", async () => {
993
+ const rootDir = await mkdtemp(path.join(os.tmpdir(), "paperclip-forged-exit-"));
994
+ cleanupDirs.push(rootDir);
995
+ const childPath = path.join(rootDir, "quiet-child.mjs");
996
+ await writeFile(childPath, "process.stdin.resume();\n", "utf8");
997
+ const scripts = [];
998
+ const runner = createLocalSandboxRunner(async (script) => {
999
+ scripts.push(script);
1000
+ });
1001
+ const target = {
1002
+ kind: "remote",
1003
+ transport: "sandbox",
1004
+ providerKey: "local-test",
1005
+ remoteCwd: rootDir,
1006
+ timeoutMs: 30_000,
1007
+ runner,
1008
+ };
1009
+ let warnedCount = 0;
1010
+ const bridge = await startAdapterExecutionTargetProcessSessionBridge({
1011
+ runId: "run-forged-exit",
1012
+ target,
1013
+ runtimeRootDir: path.posix.join(rootDir, ".paperclip-runtime", "acpx"),
1014
+ adapterKey: "acpx",
1015
+ command: process.execPath,
1016
+ args: [childPath],
1017
+ cwd: rootDir,
1018
+ env: {},
1019
+ timeoutSec: 5,
1020
+ onLog: async (stream, chunk) => {
1021
+ if (stream === "stderr" && chunk.includes("did not acknowledge shutdown"))
1022
+ warnedCount += 1;
1023
+ },
1024
+ });
1025
+ expect(bridge).not.toBeNull();
1026
+ const mkdirScript = scripts.find((script) => script.startsWith("mkdir -p"));
1027
+ const dirsMatch = /mkdir -p '([^']+)' '([^']+)'/.exec(mkdirScript ?? "");
1028
+ expect(dirsMatch).not.toBeNull();
1029
+ const eventsDir = dirsMatch[2];
1030
+ // Forge an exit event from outside the wrapper, before any real shutdown.
1031
+ await mkdir(eventsDir, { recursive: true });
1032
+ await writeFile(path.join(eventsDir, "999999999999.json"), `${JSON.stringify({ type: "exit", code: 0 })}\n`, "utf8");
1033
+ // Give the live 100 ms host poll time to read the forged file well
1034
+ // before stop() runs. This closes the gap T5 used to leave open: a
1035
+ // forged event `stop()` observes only through its own bounded reader
1036
+ // (not through the live poll, which sets `stopping` on its own and
1037
+ // stops re-arming) must not shorten the wait either.
1038
+ await delay(600);
1039
+ scripts.length = 0;
1040
+ const start = Date.now();
1041
+ await bridge.stop();
1042
+ const elapsedMs = Date.now() - start;
1043
+ const finalizeWrites = scripts.filter((script) => script.includes("base64 -d") && script.includes(".paperclip-upload.decoded"));
1044
+ // stdinEnd, then shutdown: both control messages still land.
1045
+ expect(finalizeWrites.length).toBeGreaterThanOrEqual(2);
1046
+ const removeScript = scripts.find((script) => script.trim().startsWith("rm -rf"));
1047
+ expect(removeScript).toBeDefined();
1048
+ // The child never exits on its own, so the wrapper's own genuine
1049
+ // shutdownAck -- not the forged exit event -- is the only thing that can
1050
+ // finish this fast with no warning. T14 (below) proves the forged event
1051
+ // alone gives no such shortcut when no genuine acknowledgement ever
1052
+ // follows it.
1053
+ expect(elapsedMs).toBeLessThan(1_000);
1054
+ expect(warnedCount).toBe(0);
1055
+ }, 10_000);
1056
+ it("T14 a forged exit event alone does not shorten the wait when the wrapper never truly runs", async () => {
1057
+ const rootDir = await mkdtemp(path.join(os.tmpdir(), "paperclip-forged-only-"));
1058
+ cleanupDirs.push(rootDir);
1059
+ const childPath = path.join(rootDir, "quiet-child.mjs");
1060
+ await writeFile(childPath, "process.stdin.resume();\n", "utf8");
1061
+ const scripts = [];
1062
+ let counter = 0;
1063
+ // Run every script for real except the wrapper launch itself, so the
1064
+ // wrapper never starts. The forged file below is then the only event
1065
+ // that will ever exist under the session's events directory.
1066
+ const runner = {
1067
+ execute: async (input) => {
1068
+ const script = input.args?.[1] ?? "";
1069
+ scripts.push(script);
1070
+ if (script.includes("nohup node")) {
1071
+ return { exitCode: 0, signal: null, timedOut: false, stdout: "", stderr: "", pid: null, startedAt: null };
1072
+ }
1073
+ counter += 1;
1074
+ const command = input.command === "bash" ? "/bin/bash" : input.command === "sh" ? "/bin/sh" : input.command;
1075
+ return runChildProcess(`forged-only-run-${counter}`, command, input.args ?? [], {
1076
+ cwd: input.cwd ?? process.cwd(),
1077
+ env: input.env ?? {},
1078
+ stdin: input.stdin,
1079
+ timeoutSec: Math.max(1, Math.ceil((input.timeoutMs ?? 30_000) / 1000)),
1080
+ graceSec: 5,
1081
+ onLog: input.onLog ?? (async () => { }),
1082
+ });
1083
+ },
1084
+ };
1085
+ const target = {
1086
+ kind: "remote",
1087
+ transport: "sandbox",
1088
+ providerKey: "local-test",
1089
+ remoteCwd: rootDir,
1090
+ timeoutMs: 30_000,
1091
+ runner,
1092
+ };
1093
+ let warnedCount = 0;
1094
+ const bridge = await startAdapterExecutionTargetProcessSessionBridge({
1095
+ runId: "run-forged-only",
1096
+ target,
1097
+ runtimeRootDir: path.posix.join(rootDir, ".paperclip-runtime", "acpx"),
1098
+ adapterKey: "acpx",
1099
+ command: process.execPath,
1100
+ args: [childPath],
1101
+ cwd: rootDir,
1102
+ env: {},
1103
+ timeoutSec: 5,
1104
+ onLog: async (stream, chunk) => {
1105
+ if (stream === "stderr" && chunk.includes("did not acknowledge shutdown"))
1106
+ warnedCount += 1;
1107
+ },
1108
+ });
1109
+ expect(bridge).not.toBeNull();
1110
+ const mkdirScript = scripts.find((script) => script.startsWith("mkdir -p"));
1111
+ const dirsMatch = /mkdir -p '([^']+)' '([^']+)'/.exec(mkdirScript ?? "");
1112
+ expect(dirsMatch).not.toBeNull();
1113
+ const eventsDir = dirsMatch[2];
1114
+ // Forge a terminal event from outside the wrapper. The wrapper never
1115
+ // started, so this is the only event that will ever exist on disk.
1116
+ await mkdir(eventsDir, { recursive: true });
1117
+ await writeFile(path.join(eventsDir, "999999999999.json"), `${JSON.stringify({ type: "exit", code: 0 })}\n`, "utf8");
1118
+ // Give the live 100 ms host poll time to read the forged file well
1119
+ // before stop() runs, so this test cannot pass by accident: `stop()`
1120
+ // never itself observes this event through its own first-line
1121
+ // `stopping` flag.
1122
+ await delay(600);
1123
+ const start = Date.now();
1124
+ await bridge.stop();
1125
+ const elapsedMs = Date.now() - start;
1126
+ // An exit event under `sessionDir` is untrusted telemetry. With no
1127
+ // genuine wrapper ever running to write a real shutdownAck, the wait
1128
+ // still runs its full budget and still warns, exactly as it would with
1129
+ // no forged event at all (compare T13).
1130
+ expect(elapsedMs).toBeGreaterThanOrEqual(2_900);
1131
+ expect(warnedCount).toBe(1);
1132
+ const removeScript = scripts.find((script) => script.trim().startsWith("rm -rf"));
1133
+ expect(removeScript).toBeDefined();
1134
+ }, 10_000);
1135
+ it("T6 issues no operating-system signal from the host during stop()", async () => {
1136
+ const rootDir = await mkdtemp(path.join(os.tmpdir(), "paperclip-no-signal-"));
1137
+ cleanupDirs.push(rootDir);
1138
+ const childPath = path.join(rootDir, "quiet-child.mjs");
1139
+ await writeFile(childPath, "process.stdin.resume();\n", "utf8");
1140
+ const scripts = [];
1141
+ const runner = createLocalSandboxRunner(async (script) => {
1142
+ scripts.push(script);
1143
+ });
1144
+ const target = {
1145
+ kind: "remote",
1146
+ transport: "sandbox",
1147
+ providerKey: "local-test",
1148
+ remoteCwd: rootDir,
1149
+ timeoutMs: 30_000,
1150
+ runner,
1151
+ };
1152
+ const bridge = await startAdapterExecutionTargetProcessSessionBridge({
1153
+ runId: "run-no-signal",
1154
+ target,
1155
+ runtimeRootDir: path.posix.join(rootDir, ".paperclip-runtime", "acpx"),
1156
+ adapterKey: "acpx",
1157
+ command: process.execPath,
1158
+ args: [childPath],
1159
+ cwd: rootDir,
1160
+ env: {},
1161
+ timeoutSec: 5,
1162
+ onLog: async () => { },
1163
+ });
1164
+ expect(bridge).not.toBeNull();
1165
+ scripts.length = 0;
1166
+ await bridge.stop();
1167
+ // stop() only ever writes files and removes a directory. None of the
1168
+ // scripts it runs names a signal or a kill command.
1169
+ const signalLike = scripts.filter((script) => /\bkill\b|SIGTERM|SIGKILL/i.test(script));
1170
+ expect(signalLike).toEqual([]);
1171
+ });
1172
+ it("T8 running terminate() a second time, after the child already exited, is a safe no-op", async () => {
1173
+ const wrapper = await startWrapperProcess({
1174
+ outputToStdout: false,
1175
+ command: process.execPath,
1176
+ args: ["-e", "process.exit(0)"],
1177
+ });
1178
+ await Promise.race([
1179
+ wrapper.exited,
1180
+ delay(4_000).then(() => {
1181
+ throw new Error("The wrapper did not exit after its child exited on its own.");
1182
+ }),
1183
+ ]);
1184
+ // The wrapper's own child-close handler already ran terminate() once (the
1185
+ // child was already gone, so its child.kill() call no-opped). The
1186
+ // wrapper did not throw and did not hang.
1187
+ expect(wrapper.stderrText()).toBe("");
1188
+ expect(wrapper.exitInfo().code).toBe(0);
1189
+ const events = await wrapper.readEventFiles();
1190
+ expect(events.filter((event) => event.type === "exit").length).toBe(1);
1191
+ // No stray signal-triggered event (e.g. a second exit from a SIGKILL)
1192
+ // ever landed.
1193
+ expect(events.filter((event) => event.type === "error").length).toBe(0);
1194
+ });
1195
+ it("T9 exits with an error event when sessionDir is a symbolic link", async () => {
1196
+ const targetDir = await mkdtemp(path.join(os.tmpdir(), "paperclip-symlink-target-"));
1197
+ cleanupDirs.push(targetDir);
1198
+ const linkDir = `${targetDir}-link`;
1199
+ const { symlink } = await import("node:fs/promises");
1200
+ await symlink(targetDir, linkDir, "dir");
1201
+ cleanupDirs.push(linkDir);
1202
+ const wrapperPath = path.join(targetDir, "wrapper.mjs");
1203
+ await writeFile(wrapperPath, getProcessSessionRemoteSource({ outputToStdout: true }), "utf8");
1204
+ const config = { command: "cat", args: [], cwd: targetDir, env: {} };
1205
+ const commandPayload = Buffer.from(JSON.stringify(config), "utf8").toString("base64");
1206
+ const child = spawn(process.execPath, [wrapperPath], {
1207
+ cwd: targetDir,
1208
+ env: {
1209
+ ...process.env,
1210
+ PAPERCLIP_PROCESS_SESSION_DIR: linkDir,
1211
+ PAPERCLIP_PROCESS_SESSION_COMMAND_B64: commandPayload,
1212
+ },
1213
+ stdio: ["ignore", "pipe", "pipe"],
1214
+ });
1215
+ const frames = [];
1216
+ let stdoutBuffer = "";
1217
+ child.stdout.on("data", (chunk) => {
1218
+ stdoutBuffer += chunk.toString("utf8");
1219
+ const lines = stdoutBuffer.split("\n");
1220
+ stdoutBuffer = lines.pop() || "";
1221
+ for (const line of lines) {
1222
+ if (!line.trim())
1223
+ continue;
1224
+ frames.push(JSON.parse(line));
1225
+ }
1226
+ });
1227
+ const exited = new Promise((resolve) => child.on("close", () => resolve()));
1228
+ await Promise.race([
1229
+ exited,
1230
+ delay(4_000).then(() => {
1231
+ throw new Error("The wrapper did not exit after sessionDir was a symbolic link.");
1232
+ }),
1233
+ ]);
1234
+ expect(frames.some((frame) => frame.type === "error" && typeof frame.message === "string" && frame.message.includes("symbolic link"))).toBe(true);
1235
+ });
1236
+ it("T10 the emitted wrapper strips its own session env vars from the child", async () => {
1237
+ const wrapper = await startWrapperProcess({
1238
+ outputToStdout: true,
1239
+ command: process.execPath,
1240
+ args: [
1241
+ "-e",
1242
+ "process.stdout.write(JSON.stringify(Object.keys(process.env).filter((k) => k.startsWith('PAPERCLIP_PROCESS_SESSION'))));process.exit(0)",
1243
+ ],
1244
+ });
1245
+ await waitFor(() => wrapper.frames.some((frame) => frame.type === "exit"), 4_000);
1246
+ const text = wrapper.frames
1247
+ .filter((frame) => frame.type === "data" && frame.stream === "stdout" && typeof frame.data === "string")
1248
+ .map((frame) => Buffer.from(frame.data, "base64").toString("utf8"))
1249
+ .join("");
1250
+ const leakedKeys = JSON.parse(text || "[]");
1251
+ expect(leakedKeys).toEqual([]);
1252
+ });
1253
+ it("T11 each wrapper source has exactly one spawn call site and every kill call is child.kill()", () => {
1254
+ for (const outputToStdout of [true, false]) {
1255
+ const src = getProcessSessionRemoteSource({ outputToStdout });
1256
+ // Strip `//` line comments first, so prose that happens to mention
1257
+ // "spawn(" or "kill(" (e.g. explaining `ChildProcess#kill()`) is never
1258
+ // mistaken for a call site. This checks the code, not the comments.
1259
+ const code = src
1260
+ .split("\n")
1261
+ .map((line) => line.replace(/\/\/.*$/, ""))
1262
+ .join("\n");
1263
+ const spawnCallSites = code.match(/\bspawn\(/g) ?? [];
1264
+ expect(spawnCallSites.length).toBe(1);
1265
+ const killCallSites = [...code.matchAll(/[A-Za-z0-9_.$]*kill\(/g)].map((match) => match[0]);
1266
+ expect(killCallSites.length).toBeGreaterThan(0);
1267
+ for (const site of killCallSites) {
1268
+ expect(site).toBe("child.kill(");
1269
+ }
1270
+ // Regression coverage for PAP-5336: the shared tail must carry the
1271
+ // session-identity latch, not the old counter it replaced. A counter
1272
+ // that a successful `readdir` reset to zero let an attacker who
1273
+ // recreated a deleted control directory keep the wrapper alive
1274
+ // forever. Both wrapper variants append the same shared tail, so this
1275
+ // check runs once per variant and fails if a future edit lands the
1276
+ // latch in only one of them.
1277
+ expect(src).not.toContain("missingSessionDirStreak");
1278
+ const identityLatchDeclarations = code.match(/\blet identityLost = false;/g) ?? [];
1279
+ expect(identityLatchDeclarations.length).toBe(1);
1280
+ const identityCaptureCallSites = code.match(/\bcaptureSessionIdentity\(\)/g) ?? [];
1281
+ expect(identityCaptureCallSites.length).toBeGreaterThan(0);
1282
+ const identityVerifyCallSites = code.match(/\bverifySessionIdentity\(\)/g) ?? [];
1283
+ expect(identityVerifyCallSites.length).toBeGreaterThan(0);
1284
+ // The capture must run before the first poll cycle: its call site must
1285
+ // precede the `pollStdin()` call site in the emitted source.
1286
+ expect(code.indexOf("await captureSessionIdentity();")).toBeGreaterThan(0);
1287
+ expect(code.indexOf("await captureSessionIdentity();")).toBeLessThan(code.indexOf("void pollStdin()"));
1288
+ }
1289
+ });
1290
+ // Regression coverage for PAP-5323: the host used to burn the full
1291
+ // shutdown budget and log a false warning on every normal run, because
1292
+ // the file-poll loop stopped re-arming right after it delivered the
1293
+ // `exit` event and so never read the `shutdownAck` file that followed it.
1294
+ it("T12 stop() finishes well inside the shutdown budget and logs no warning after a normal child exit", async () => {
1295
+ const rootDir = await mkdtemp(path.join(os.tmpdir(), "paperclip-normal-exit-"));
1296
+ cleanupDirs.push(rootDir);
1297
+ const childPath = path.join(rootDir, "quick-exit-child.mjs");
1298
+ await writeFile(childPath, "process.exit(0);\n", "utf8");
1299
+ const runner = createLocalSandboxRunner();
1300
+ const target = {
1301
+ kind: "remote",
1302
+ transport: "sandbox",
1303
+ providerKey: "local-test",
1304
+ remoteCwd: rootDir,
1305
+ timeoutMs: 30_000,
1306
+ runner,
1307
+ };
1308
+ let warnedCount = 0;
1309
+ const bridge = await startAdapterExecutionTargetProcessSessionBridge({
1310
+ runId: "run-normal-exit",
1311
+ target,
1312
+ runtimeRootDir: path.posix.join(rootDir, ".paperclip-runtime", "acpx"),
1313
+ adapterKey: "acpx",
1314
+ command: process.execPath,
1315
+ args: [childPath],
1316
+ cwd: rootDir,
1317
+ env: {},
1318
+ timeoutSec: 5,
1319
+ onLog: async (stream, chunk) => {
1320
+ if (stream === "stderr" && chunk.includes("did not acknowledge shutdown"))
1321
+ warnedCount += 1;
1322
+ },
1323
+ });
1324
+ expect(bridge).not.toBeNull();
1325
+ // Let the child exit and the wrapper write its own `exit` event before
1326
+ // stop() runs, so this matches a normal run-completion teardown.
1327
+ await delay(500);
1328
+ const start = Date.now();
1329
+ await bridge.stop();
1330
+ const elapsedMs = Date.now() - start;
1331
+ expect(elapsedMs).toBeLessThan(1_000);
1332
+ expect(warnedCount).toBe(0);
1333
+ }, 10_000);
1334
+ // Regression coverage for PAP-5323: a genuinely stuck wrapper, one that
1335
+ // never writes any event, must still warn after the budget and still
1336
+ // remove `sessionDir`. The fix must not turn the bounded wait into an
1337
+ // unconditional skip.
1338
+ it("T13 warns and still removes sessionDir when the wrapper never acknowledges and never exits", async () => {
1339
+ const rootDir = await mkdtemp(path.join(os.tmpdir(), "paperclip-never-acks-"));
1340
+ cleanupDirs.push(rootDir);
1341
+ const childPath = path.join(rootDir, "quiet-child.mjs");
1342
+ await writeFile(childPath, "process.stdin.resume();\n", "utf8");
1343
+ const scripts = [];
1344
+ let counter = 0;
1345
+ // Run every script for real except the wrapper launch itself, so the
1346
+ // wrapper never starts and the events directory stays empty on every
1347
+ // poll. `stop()` can then never observe a real `shutdownAck` or a real
1348
+ // terminal `exit`/`error` event.
1349
+ const runner = {
1350
+ execute: async (input) => {
1351
+ const script = input.args?.[1] ?? "";
1352
+ scripts.push(script);
1353
+ if (script.includes("nohup node")) {
1354
+ return { exitCode: 0, signal: null, timedOut: false, stdout: "", stderr: "", pid: null, startedAt: null };
1355
+ }
1356
+ counter += 1;
1357
+ const command = input.command === "bash" ? "/bin/bash" : input.command === "sh" ? "/bin/sh" : input.command;
1358
+ return runChildProcess(`never-acks-run-${counter}`, command, input.args ?? [], {
1359
+ cwd: input.cwd ?? process.cwd(),
1360
+ env: input.env ?? {},
1361
+ stdin: input.stdin,
1362
+ timeoutSec: Math.max(1, Math.ceil((input.timeoutMs ?? 30_000) / 1000)),
1363
+ graceSec: 5,
1364
+ onLog: input.onLog ?? (async () => { }),
1365
+ });
1366
+ },
1367
+ };
1368
+ const target = {
1369
+ kind: "remote",
1370
+ transport: "sandbox",
1371
+ providerKey: "local-test",
1372
+ remoteCwd: rootDir,
1373
+ timeoutMs: 30_000,
1374
+ runner,
1375
+ };
1376
+ let warnedCount = 0;
1377
+ const bridge = await startAdapterExecutionTargetProcessSessionBridge({
1378
+ runId: "run-never-acks",
1379
+ target,
1380
+ runtimeRootDir: path.posix.join(rootDir, ".paperclip-runtime", "acpx"),
1381
+ adapterKey: "acpx",
1382
+ command: process.execPath,
1383
+ args: [childPath],
1384
+ cwd: rootDir,
1385
+ env: {},
1386
+ timeoutSec: 5,
1387
+ onLog: async (stream, chunk) => {
1388
+ if (stream === "stderr" && chunk.includes("did not acknowledge shutdown"))
1389
+ warnedCount += 1;
1390
+ },
1391
+ });
1392
+ expect(bridge).not.toBeNull();
1393
+ const start = Date.now();
1394
+ await bridge.stop();
1395
+ const elapsedMs = Date.now() - start;
1396
+ // The full shutdown budget elapsed, because nothing ever proved the
1397
+ // wrapper stopped.
1398
+ expect(elapsedMs).toBeGreaterThanOrEqual(2_900);
1399
+ expect(warnedCount).toBe(1);
1400
+ const removeScript = scripts.find((script) => script.trim().startsWith("rm -rf"));
1401
+ expect(removeScript).toBeDefined();
1402
+ }, 10_000);
1403
+ // Regression coverage for PAP-5336: the finding this test reproduces is a
1404
+ // sandbox control-plane integrity failure, not a timing quirk. During
1405
+ // `stop()`, a sandbox peer with access to the session directory can (1)
1406
+ // delete the real `shutdown` control file before the wrapper ever reads
1407
+ // it, (2) forge a `shutdownAck` event so the host's wait ends early, and
1408
+ // (3) recreate `sessionDir/stdin` right after the host removes
1409
+ // `sessionDir`. On the parent commit, a successful `readdir` on the
1410
+ // recreated directory reset the wrapper's only terminal counter to zero,
1411
+ // so the wrapper (and its child) polled forever.
1412
+ //
1413
+ // The fix replaces the counter with an identity captured at startup: the
1414
+ // device number, the inode number, and the inode's own creation time. All
1415
+ // three matter for this test to be a real regression check, not a check
1416
+ // that passes by luck. Recreating a directory at the same path right after
1417
+ // removal, with nothing else on the filesystem in between, can reissue the
1418
+ // exact same device and inode numbers on common filesystems (this test's
1419
+ // recreate step does exactly that): a device/inode-only identity would
1420
+ // then wrongly read as unchanged. The creation time does not have this
1421
+ // gap, because it is set fresh on every inode allocation even when the
1422
+ // allocator reissues an old inode number.
1423
+ it("T15 latches on a lost session identity: a recreated control directory cannot keep the wrapper or its child alive", async () => {
1424
+ const rootDir = await mkdtemp(path.join(os.tmpdir(), "paperclip-lost-identity-"));
1425
+ cleanupDirs.push(rootDir);
1426
+ const pidFile = path.join(rootDir, "t15-child.pid");
1427
+ const childPath = path.join(rootDir, "t15-child.mjs");
1428
+ await writeFile(childPath, trackedChildSource(pidFile), "utf8");
1429
+ let sessionDir = "";
1430
+ let stdinDir = "";
1431
+ let eventsDir = "";
1432
+ let shutdownFileDeleted = false;
1433
+ let shutdownAckForged = false;
1434
+ let stdinDirRecreated = false;
1435
+ const scripts = [];
1436
+ let counter = 0;
1437
+ const syntheticSuccess = {
1438
+ exitCode: 0,
1439
+ signal: null,
1440
+ timedOut: false,
1441
+ stdout: "",
1442
+ stderr: "",
1443
+ pid: null,
1444
+ startedAt: null,
1445
+ };
1446
+ // Run every script for real on the local filesystem (matching T2/T4/T5's
1447
+ // harness), so a real wrapper process and a real child process come up,
1448
+ // with two exceptions that make the attack deterministic instead of a
1449
+ // race against the wrapper's own 50 ms poll:
1450
+ //
1451
+ // 1. With no stdin data ever sent, the host's shutdown control message
1452
+ // always targets stdin file 000000000002.json (file 1 is stdinEnd).
1453
+ // Never let that write's script pipeline actually run: this is
1454
+ // equivalent to an attacker who deletes the file before the wrapper
1455
+ // ever reads it, but with no window in which the wrapper could win a
1456
+ // race and read it first.
1457
+ // 2. Perform the sessionDir removal and the sessionDir/stdin,
1458
+ // sessionDir/events recreation as direct filesystem calls in this
1459
+ // same async step, instead of spawning a real `rm -rf` subprocess.
1460
+ // That removes an external process's scheduling latency from the
1461
+ // window the wrapper's next poll cycle has to observe the recreated
1462
+ // directory.
1463
+ const runner = {
1464
+ execute: async (input) => {
1465
+ counter += 1;
1466
+ const script = input.args?.[1] ?? "";
1467
+ scripts.push(script);
1468
+ const shutdownFilePath = stdinDir ? path.posix.join(stdinDir, "000000000002.json") : null;
1469
+ if (shutdownFilePath && script.includes(shutdownFilePath)) {
1470
+ if (!shutdownFileDeleted) {
1471
+ shutdownFileDeleted = true;
1472
+ await writeFile(path.join(eventsDir, "999999999999.json"), `${JSON.stringify({ type: "shutdownAck" })}\n`, "utf8").catch(() => undefined);
1473
+ shutdownAckForged = true;
1474
+ }
1475
+ return syntheticSuccess;
1476
+ }
1477
+ // Match the removal of sessionDir itself, not the host's own
1478
+ // per-file event cleanup (which also runs `rm -rf` on a path that
1479
+ // has sessionDir as a substring).
1480
+ if (!stdinDirRecreated && sessionDir && script.trim() === `rm -rf '${sessionDir}'`) {
1481
+ stdinDirRecreated = true;
1482
+ await rm(sessionDir, { recursive: true, force: true }).catch(() => undefined);
1483
+ await mkdir(stdinDir, { recursive: true }).catch(() => undefined);
1484
+ await mkdir(eventsDir, { recursive: true }).catch(() => undefined);
1485
+ return syntheticSuccess;
1486
+ }
1487
+ const command = input.command === "bash" ? "/bin/bash" : input.command === "sh" ? "/bin/sh" : input.command;
1488
+ return runChildProcess(`lost-identity-run-${counter}`, command, input.args ?? [], {
1489
+ cwd: input.cwd ?? process.cwd(),
1490
+ env: input.env ?? {},
1491
+ stdin: input.stdin,
1492
+ timeoutSec: Math.max(1, Math.ceil((input.timeoutMs ?? 30_000) / 1000)),
1493
+ graceSec: 5,
1494
+ onLog: input.onLog ?? (async () => { }),
1495
+ });
1496
+ },
1497
+ };
1498
+ const target = {
1499
+ kind: "remote",
1500
+ transport: "sandbox",
1501
+ providerKey: "local-test",
1502
+ remoteCwd: rootDir,
1503
+ timeoutMs: 30_000,
1504
+ runner,
1505
+ };
1506
+ const bridge = await startAdapterExecutionTargetProcessSessionBridge({
1507
+ runId: "run-lost-identity",
1508
+ target,
1509
+ runtimeRootDir: path.posix.join(rootDir, ".paperclip-runtime", "acpx"),
1510
+ adapterKey: "acpx",
1511
+ command: process.execPath,
1512
+ args: [childPath],
1513
+ cwd: rootDir,
1514
+ env: {},
1515
+ timeoutSec: 5,
1516
+ onLog: async () => { },
1517
+ });
1518
+ expect(bridge).not.toBeNull();
1519
+ const mkdirScript = scripts.find((script) => script.startsWith("mkdir -p"));
1520
+ const dirsMatch = /mkdir -p '([^']+)' '([^']+)'/.exec(mkdirScript ?? "");
1521
+ expect(dirsMatch).not.toBeNull();
1522
+ stdinDir = dirsMatch[1];
1523
+ eventsDir = dirsMatch[2];
1524
+ sessionDir = path.posix.dirname(stdinDir);
1525
+ await waitFor(async () => (await readFile(pidFile, "utf8").catch(() => "")).trim().length > 0, 8_000);
1526
+ const pid = Number.parseInt((await readFile(pidFile, "utf8")).trim(), 10);
1527
+ expect(isPidAlive(pid)).toBe(true);
1528
+ const wrapperScriptSubstring = path.posix.join(rootDir, ".paperclip-runtime", "acpx", "process-sessions");
1529
+ await waitFor(async () => (await findLivePidsByArgvSubstring(wrapperScriptSubstring)).length > 0, 4_000);
1530
+ await bridge.stop();
1531
+ // Both the attacker's forged shutdownAck and its directory recreation
1532
+ // ran; this is the full chain the finding describes, not a partial one.
1533
+ expect(shutdownFileDeleted).toBe(true);
1534
+ expect(shutdownAckForged).toBe(true);
1535
+ expect(stdinDirRecreated).toBe(true);
1536
+ // The wrapper process and its child process both exit within a bounded
1537
+ // time, even though the wrapper never read a real shutdown message and
1538
+ // the host's wait ended early on a forged hint. Only the wrapper's own
1539
+ // identity latch can explain this: it observes the recreated directory
1540
+ // carries a different identity than the one captured at startup.
1541
+ await waitFor(() => !isPidAlive(pid), 8_000);
1542
+ expect(isPidAlive(pid)).toBe(false);
1543
+ await waitFor(async () => (await findLivePidsByArgvSubstring(wrapperScriptSubstring)).length === 0, 8_000);
1544
+ }, 15_000);
1545
+ // ---- PAP-5338: reject a change-time creation-time substitute, and every
1546
+ // lstat error during verification -------------------------------------
1547
+ async function waitForTrackedChildPid(pidFile) {
1548
+ await waitFor(async () => (await readFile(pidFile, "utf8").catch(() => "")).trim().length > 0, 8_000);
1549
+ return Number.parseInt((await readFile(pidFile, "utf8")).trim(), 10);
1550
+ }
1551
+ async function expectWrapperAndTrackedChildToDie(wrapper, pid) {
1552
+ await waitFor(() => !isPidAlive(pid), 8_000);
1553
+ expect(isPidAlive(pid)).toBe(false);
1554
+ await Promise.race([
1555
+ wrapper.exited,
1556
+ delay(8_000).then(() => {
1557
+ throw new Error("The wrapper process did not exit.");
1558
+ }),
1559
+ ]);
1560
+ }
1561
+ // A capture failure latches and calls terminate() before the poll loop
1562
+ // ever starts, often within a few milliseconds of the child's own spawn()
1563
+ // call returning. A freshly spawned Node.js child needs real wall-clock
1564
+ // time just to boot before it can run its own code, so it can lose the
1565
+ // race to write a pid file before terminate()'s SIGTERM reaches it. The
1566
+ // change-time fallback test below therefore proves death through the OS
1567
+ // process table by the child's own script path (the same technique T15
1568
+ // above uses for the wrapper itself), which needs no cooperation from code
1569
+ // inside the child.
1570
+ async function expectNoLiveProcessByArgvSubstring(substring) {
1571
+ await waitFor(async () => (await findLivePidsByArgvSubstring(substring)).length === 0, 8_000);
1572
+ expect(await findLivePidsByArgvSubstring(substring)).toEqual([]);
1573
+ }
1574
+ it("T16 accepts a zero creation time when the filesystem does not report birth time", async () => {
1575
+ const rootDir = await mkdtemp(path.join(os.tmpdir(), "paperclip-birthtime-zero-"));
1576
+ cleanupDirs.push(rootDir);
1577
+ const pidFile = path.join(rootDir, "t16-child.pid");
1578
+ const childPath = path.join(rootDir, "t16-child.mjs");
1579
+ await writeFile(childPath, trackedChildSource(pidFile), "utf8");
1580
+ const wrapper = await startWrapperProcess({
1581
+ outputToStdout: false,
1582
+ command: process.execPath,
1583
+ args: [childPath],
1584
+ fakeBirthtime: { target: "sessionDir", mode: "zero" },
1585
+ });
1586
+ const pid = await waitForTrackedChildPid(pidFile);
1587
+ expect(isPidAlive(pid)).toBe(true);
1588
+ await writeFile(path.join(wrapper.stdinDir, "000000000001.json"), `${JSON.stringify({ type: "stdinEnd" })}\n`, "utf8");
1589
+ await Promise.race([
1590
+ wrapper.exited,
1591
+ delay(8_000).then(() => {
1592
+ throw new Error("The wrapper process did not exit.");
1593
+ }),
1594
+ ]);
1595
+ expect(wrapper.exitInfo().code).toBe(0);
1596
+ expect(wrapper.stderrText()).not.toMatch(/not usable/);
1597
+ }, 15_000);
1598
+ it("T17 fails closed at capture when the reported creation time follows the change time, so a change-time copy never passes as a real creation time", async () => {
1599
+ const rootDir = await mkdtemp(path.join(os.tmpdir(), "paperclip-birthtime-followctime-"));
1600
+ cleanupDirs.push(rootDir);
1601
+ const pidFile = path.join(rootDir, "t17-child.pid");
1602
+ const childPath = path.join(rootDir, "t17-child.mjs");
1603
+ await writeFile(childPath, trackedChildSource(pidFile), "utf8");
1604
+ const wrapper = await startWrapperProcess({
1605
+ outputToStdout: false,
1606
+ command: process.execPath,
1607
+ args: [childPath],
1608
+ fakeBirthtime: { target: "stdinDir", mode: "followCtime" },
1609
+ });
1610
+ await Promise.race([
1611
+ wrapper.exited,
1612
+ delay(8_000).then(() => {
1613
+ throw new Error("The wrapper process did not exit.");
1614
+ }),
1615
+ ]);
1616
+ await expectNoLiveProcessByArgvSubstring(childPath);
1617
+ expect(wrapper.stderrText()).toMatch(/changed after a probe write/);
1618
+ }, 15_000);
1619
+ it("T18 latches on an EACCES lstat failure on sessionDir during verification, not only on a removed directory", async () => {
1620
+ // sessionDir lives inside a parent this test owns, never the shared OS
1621
+ // temp directory: the test denies traversal on that parent, and doing
1622
+ // that to the shared OS temp directory would break every other process
1623
+ // on the host that also uses it.
1624
+ const parentDir = await mkdtemp(path.join(os.tmpdir(), "paperclip-eacces-sessiondir-"));
1625
+ cleanupDirs.push(parentDir);
1626
+ const pidFile = path.join(parentDir, "t18-child.pid");
1627
+ const childPath = path.join(parentDir, "t18-child.mjs");
1628
+ await writeFile(childPath, trackedChildSource(pidFile), "utf8");
1629
+ const wrapper = await startWrapperProcess({
1630
+ outputToStdout: false,
1631
+ command: process.execPath,
1632
+ args: [childPath],
1633
+ parentDir,
1634
+ terminateGraceMs: 200,
1635
+ });
1636
+ const pid = await waitForTrackedChildPid(pidFile);
1637
+ // Let capture succeed and the poll loop run a clean cycle first, so the
1638
+ // termination below proves the verify-time latch, not the capture-time
1639
+ // one.
1640
+ await delay(150);
1641
+ await chmod(parentDir, 0o000);
1642
+ try {
1643
+ await expectWrapperAndTrackedChildToDie(wrapper, pid);
1644
+ }
1645
+ finally {
1646
+ // Restore permission so the shared cleanup can remove this directory.
1647
+ await chmod(parentDir, 0o700).catch(() => undefined);
1648
+ }
1649
+ expect(wrapper.stderrText()).toMatch(/Latching on a lost process session identity/);
1650
+ }, 15_000);
1651
+ it("T19 latches on an EACCES lstat failure on stdinDir during verification, even though sessionDir itself still stats cleanly", async () => {
1652
+ const wrapperOptions = { outputToStdout: false, terminateGraceMs: 200 };
1653
+ const rootDir = await mkdtemp(path.join(os.tmpdir(), "paperclip-eacces-stdindir-"));
1654
+ cleanupDirs.push(rootDir);
1655
+ const pidFile = path.join(rootDir, "t19-child.pid");
1656
+ const childPath = path.join(rootDir, "t19-child.mjs");
1657
+ await writeFile(childPath, trackedChildSource(pidFile), "utf8");
1658
+ const wrapper = await startWrapperProcess({ ...wrapperOptions, command: process.execPath, args: [childPath] });
1659
+ const pid = await waitForTrackedChildPid(pidFile);
1660
+ await delay(150);
1661
+ // Deny traversal into sessionDir itself: lstat(stdinDir) fails EACCES
1662
+ // while lstat(sessionDir) still succeeds, since a directory's own mode
1663
+ // never gates lstat of the directory itself, only lookups inside it.
1664
+ await chmod(wrapper.sessionDir, 0o000);
1665
+ try {
1666
+ await expectWrapperAndTrackedChildToDie(wrapper, pid);
1667
+ }
1668
+ finally {
1669
+ await chmod(wrapper.sessionDir, 0o700).catch(() => undefined);
1670
+ }
1671
+ expect(wrapper.stderrText()).toMatch(/Latching on a lost process session identity/);
1672
+ }, 15_000);
1673
+ it("T20 refuses to write through a probe path a sandbox peer pre-created as a symbolic link, and leaves that link and its target untouched", async () => {
1674
+ const rootDir = await mkdtemp(path.join(os.tmpdir(), "paperclip-probe-symlink-race-"));
1675
+ cleanupDirs.push(rootDir);
1676
+ const pidFile = path.join(rootDir, "t20-child.pid");
1677
+ const childPath = path.join(rootDir, "t20-child.mjs");
1678
+ await writeFile(childPath, trackedChildSource(pidFile), "utf8");
1679
+ const sessionDir = await mkdtemp(path.join(os.tmpdir(), "paperclip-probe-symlink-session-"));
1680
+ cleanupDirs.push(sessionDir);
1681
+ const stdinDir = path.join(sessionDir, "stdin");
1682
+ await mkdir(stdinDir, { recursive: true });
1683
+ const wrapperPath = path.join(sessionDir, "wrapper.mjs");
1684
+ await writeFile(wrapperPath, getProcessSessionRemoteSource({ outputToStdout: true }), "utf8");
1685
+ const config = { command: process.execPath, args: [childPath], cwd: sessionDir, env: {} };
1686
+ const commandPayload = Buffer.from(JSON.stringify(config), "utf8").toString("base64");
1687
+ // A file this test owns, standing in for a file a sandbox peer already
1688
+ // controls. The wrapper's probe write must never reach it.
1689
+ const probeLinkTarget = path.join(rootDir, "t20-probe-target.txt");
1690
+ const knownContent = "t20-untouched-content";
1691
+ await writeFile(probeLinkTarget, knownContent, "utf8");
1692
+ const child = spawn(process.execPath, [wrapperPath], {
1693
+ cwd: sessionDir,
1694
+ env: {
1695
+ ...process.env,
1696
+ PAPERCLIP_PROCESS_SESSION_DIR: sessionDir,
1697
+ PAPERCLIP_PROCESS_SESSION_COMMAND_B64: commandPayload,
1698
+ },
1699
+ stdio: ["ignore", "pipe", "pipe"],
1700
+ });
1701
+ // Wins the race to the probe path against the wrapper's own probe write.
1702
+ // nextProbeFileName() is deterministic: it names
1703
+ // ".paperclip-birthtime-probe-<pid>-1" on the wrapper's first probe call,
1704
+ // which always targets sessionDir. child.pid is available synchronously
1705
+ // right after spawn() returns, well before the freshly spawned process
1706
+ // has loaded Node or parsed its own script, so this synchronous
1707
+ // symlinkSync call lands first. This is the same advantage a real
1708
+ // sandbox peer racing to pre-create the path would have, so it gives the
1709
+ // strongest proof: the real wrapper process, under the real race, must
1710
+ // still refuse to follow the link.
1711
+ const probePath = path.join(sessionDir, `.paperclip-birthtime-probe-${child.pid}-1`);
1712
+ symlinkSync(probeLinkTarget, probePath);
1713
+ let stderrText = "";
1714
+ child.stderr.on("data", (chunk) => {
1715
+ stderrText += chunk.toString("utf8");
1716
+ });
1717
+ const exited = new Promise((resolve) => child.on("close", () => resolve()));
1718
+ await Promise.race([
1719
+ exited,
1720
+ delay(8_000).then(() => {
1721
+ throw new Error("The wrapper process did not exit.");
1722
+ }),
1723
+ ]);
1724
+ await expectNoLiveProcessByArgvSubstring(childPath);
1725
+ expect(stderrText).toMatch(/could not be created exclusively/);
1726
+ expect((await lstat(probePath)).isSymbolicLink()).toBe(true);
1727
+ expect(await readFile(probeLinkTarget, "utf8")).toBe(knownContent);
1728
+ }, 15_000);
1729
+ // ---- PAP-5355: identity-aware cleanup after a same-sandbox peer replaces
1730
+ // the probe file this wrapper just created, in the gap between this
1731
+ // wrapper's last identity check and its removal call. The probeSwap
1732
+ // preload (see getProbeSwapPreloadPath above) simulates the worst-case
1733
+ // timing for that gap deterministically, instead of racing real wall-clock
1734
+ // time: it swaps the path the instant the wrapper itself looks at it for
1735
+ // the last time before deciding whether to remove it.
1736
+ it("T21 still removes its own probe file normally when no peer ever replaces it", async () => {
1737
+ const rootDir = await mkdtemp(path.join(os.tmpdir(), "paperclip-probe-no-swap-"));
1738
+ cleanupDirs.push(rootDir);
1739
+ const pidFile = path.join(rootDir, "t21-child.pid");
1740
+ const childPath = path.join(rootDir, "t21-child.mjs");
1741
+ await writeFile(childPath, trackedChildSource(pidFile), "utf8");
1742
+ const wrapper = await startWrapperProcess({
1743
+ outputToStdout: false,
1744
+ command: process.execPath,
1745
+ args: [childPath],
1746
+ });
1747
+ await waitForTrackedChildPid(pidFile);
1748
+ const probePath = path.join(wrapper.sessionDir, `.paperclip-birthtime-probe-${wrapper.pid}-1`);
1749
+ await waitFor(async () => !(await lstat(probePath).then(() => true).catch(() => false)), 4_000);
1750
+ await expect(lstat(probePath)).rejects.toThrow();
1751
+ }, 15_000);
1752
+ it("T22 leaves a peer's replacement file untouched instead of deleting it", async () => {
1753
+ const rootDir = await mkdtemp(path.join(os.tmpdir(), "paperclip-probe-swap-file-"));
1754
+ cleanupDirs.push(rootDir);
1755
+ const pidFile = path.join(rootDir, "t22-child.pid");
1756
+ const childPath = path.join(rootDir, "t22-child.mjs");
1757
+ await writeFile(childPath, trackedChildSource(pidFile), "utf8");
1758
+ const wrapper = await startWrapperProcess({
1759
+ outputToStdout: false,
1760
+ command: process.execPath,
1761
+ args: [childPath],
1762
+ probeSwap: { seq: 1, mode: "file" },
1763
+ });
1764
+ await waitForTrackedChildPid(pidFile);
1765
+ const probePath = path.join(wrapper.sessionDir, `.paperclip-birthtime-probe-${wrapper.pid}-1`);
1766
+ await waitFor(async () => (await readFile(probePath, "utf8").catch(() => null)) === "peer-owned-content", 4_000);
1767
+ // The wrapper's own cleanup call already ran (the preload only swaps the
1768
+ // path the moment the wrapper itself checks it). This delay proves that
1769
+ // run settled and nothing removes the peer's file afterward.
1770
+ await delay(200);
1771
+ expect(await readFile(probePath, "utf8")).toBe("peer-owned-content");
1772
+ }, 15_000);
1773
+ it("T23 leaves a peer's replacement directory untouched instead of deleting it", async () => {
1774
+ const rootDir = await mkdtemp(path.join(os.tmpdir(), "paperclip-probe-swap-dir-"));
1775
+ cleanupDirs.push(rootDir);
1776
+ const pidFile = path.join(rootDir, "t23-child.pid");
1777
+ const childPath = path.join(rootDir, "t23-child.mjs");
1778
+ await writeFile(childPath, trackedChildSource(pidFile), "utf8");
1779
+ const wrapper = await startWrapperProcess({
1780
+ outputToStdout: false,
1781
+ command: process.execPath,
1782
+ args: [childPath],
1783
+ probeSwap: { seq: 1, mode: "dir" },
1784
+ });
1785
+ await waitForTrackedChildPid(pidFile);
1786
+ const probePath = path.join(wrapper.sessionDir, `.paperclip-birthtime-probe-${wrapper.pid}-1`);
1787
+ await waitFor(async () => await lstat(probePath).then((stats) => stats.isDirectory()).catch(() => false), 4_000);
1788
+ await delay(200);
1789
+ expect((await lstat(probePath)).isDirectory()).toBe(true);
1790
+ }, 15_000);
1791
+ it("T24 leaves a peer's replacement symbolic link and its target untouched instead of deleting or following it", async () => {
1792
+ const rootDir = await mkdtemp(path.join(os.tmpdir(), "paperclip-probe-swap-symlink-"));
1793
+ cleanupDirs.push(rootDir);
1794
+ const pidFile = path.join(rootDir, "t24-child.pid");
1795
+ const childPath = path.join(rootDir, "t24-child.mjs");
1796
+ await writeFile(childPath, trackedChildSource(pidFile), "utf8");
1797
+ const linkTarget = path.join(rootDir, "t24-probe-target.txt");
1798
+ const knownContent = "t24-untouched-content";
1799
+ await writeFile(linkTarget, knownContent, "utf8");
1800
+ const wrapper = await startWrapperProcess({
1801
+ outputToStdout: false,
1802
+ command: process.execPath,
1803
+ args: [childPath],
1804
+ probeSwap: { seq: 1, mode: "symlink", symlinkTarget: linkTarget },
1805
+ });
1806
+ await waitForTrackedChildPid(pidFile);
1807
+ const probePath = path.join(wrapper.sessionDir, `.paperclip-birthtime-probe-${wrapper.pid}-1`);
1808
+ await waitFor(async () => await lstat(probePath).then((stats) => stats.isSymbolicLink()).catch(() => false), 4_000);
1809
+ await delay(200);
1810
+ expect((await lstat(probePath)).isSymbolicLink()).toBe(true);
1811
+ expect(await readlink(probePath)).toBe(linkTarget);
1812
+ expect(await readFile(linkTarget, "utf8")).toBe(knownContent);
1813
+ }, 15_000);
1814
+ it("T25 fails closed at capture when its own probe file's identity cannot be read, so no orphan wrapper or child ever starts polling", async () => {
1815
+ const rootDir = await mkdtemp(path.join(os.tmpdir(), "paperclip-probe-fstat-failure-"));
1816
+ cleanupDirs.push(rootDir);
1817
+ const pidFile = path.join(rootDir, "t25-child.pid");
1818
+ const childPath = path.join(rootDir, "t25-child.mjs");
1819
+ await writeFile(childPath, trackedChildSource(pidFile), "utf8");
1820
+ const wrapper = await startWrapperProcess({
1821
+ outputToStdout: false,
1822
+ command: process.execPath,
1823
+ args: [childPath],
1824
+ fstatFailure: { seq: 1 },
1825
+ });
1826
+ await Promise.race([
1827
+ wrapper.exited,
1828
+ delay(8_000).then(() => {
1829
+ throw new Error("The wrapper process did not exit.");
1830
+ }),
1831
+ ]);
1832
+ expect(wrapper.stderrText()).toMatch(/its own probe file's identity could not be read/);
1833
+ await expectNoLiveProcessByArgvSubstring(childPath);
1834
+ // With no verified identity for the probe file, the wrapper must not
1835
+ // remove it by path alone: it leaves the file exactly as it created it,
1836
+ // rather than risking removal of a different entry a peer may have put
1837
+ // at the same path.
1838
+ const probePath = path.join(wrapper.sessionDir, `.paperclip-birthtime-probe-${wrapper.pid}-1`);
1839
+ expect((await lstat(probePath)).isFile()).toBe(true);
1840
+ }, 15_000);
1841
+ });
1842
+ //# sourceMappingURL=execution-target-stdin-race.test.js.map