@tickernelz/wardmote-adapter-utils 0.0.0-stage → 2026.1108.1

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 (2039) hide show
  1. package/README.md +49 -2
  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 +720 -0
  9. package/dist/acpx-engine/composed-run-characterization.test.js.map +1 -0
  10. package/dist/acpx-engine/constants.d.ts +10 -0
  11. package/dist/acpx-engine/constants.d.ts.map +1 -0
  12. package/dist/acpx-engine/constants.js +25 -0
  13. package/dist/acpx-engine/constants.js.map +1 -0
  14. package/dist/acpx-engine/ephemeral-session-environment.d.ts +4 -0
  15. package/dist/acpx-engine/ephemeral-session-environment.d.ts.map +1 -0
  16. package/dist/acpx-engine/ephemeral-session-environment.js +29 -0
  17. package/dist/acpx-engine/ephemeral-session-environment.js.map +1 -0
  18. package/dist/acpx-engine/ephemeral-session-environment.test.d.ts +2 -0
  19. package/dist/acpx-engine/ephemeral-session-environment.test.d.ts.map +1 -0
  20. package/dist/acpx-engine/ephemeral-session-environment.test.js +177 -0
  21. package/dist/acpx-engine/ephemeral-session-environment.test.js.map +1 -0
  22. package/dist/acpx-engine/execute-identity.test.d.ts +2 -0
  23. package/dist/acpx-engine/execute-identity.test.d.ts.map +1 -0
  24. package/dist/acpx-engine/execute-identity.test.js +218 -0
  25. package/dist/acpx-engine/execute-identity.test.js.map +1 -0
  26. package/dist/acpx-engine/execute.d.ts +322 -0
  27. package/dist/acpx-engine/execute.d.ts.map +1 -0
  28. package/dist/acpx-engine/execute.js +4671 -0
  29. package/dist/acpx-engine/execute.js.map +1 -0
  30. package/dist/acpx-engine/execute.test.d.ts +2 -0
  31. package/dist/acpx-engine/execute.test.d.ts.map +1 -0
  32. package/dist/acpx-engine/execute.test.js +7282 -0
  33. package/dist/acpx-engine/execute.test.js.map +1 -0
  34. package/dist/acpx-engine/filesystem-protocol.test.d.ts +2 -0
  35. package/dist/acpx-engine/filesystem-protocol.test.d.ts.map +1 -0
  36. package/dist/acpx-engine/filesystem-protocol.test.js +99 -0
  37. package/dist/acpx-engine/filesystem-protocol.test.js.map +1 -0
  38. package/dist/acpx-engine/index.d.ts +6 -0
  39. package/dist/acpx-engine/index.d.ts.map +1 -0
  40. package/dist/acpx-engine/index.js +6 -0
  41. package/dist/acpx-engine/index.js.map +1 -0
  42. package/dist/acpx-engine/local-process-control.d.ts +5 -0
  43. package/dist/acpx-engine/local-process-control.d.ts.map +1 -0
  44. package/dist/acpx-engine/local-process-control.js +39 -0
  45. package/dist/acpx-engine/local-process-control.js.map +1 -0
  46. package/dist/acpx-engine/local-process-control.test.d.ts +2 -0
  47. package/dist/acpx-engine/local-process-control.test.d.ts.map +1 -0
  48. package/dist/acpx-engine/local-process-control.test.js +38 -0
  49. package/dist/acpx-engine/local-process-control.test.js.map +1 -0
  50. package/dist/acpx-engine/operator-stop.test.d.ts +2 -0
  51. package/dist/acpx-engine/operator-stop.test.d.ts.map +1 -0
  52. package/dist/acpx-engine/operator-stop.test.js +107 -0
  53. package/dist/acpx-engine/operator-stop.test.js.map +1 -0
  54. package/dist/acpx-engine/read-only-permissions.test.d.ts +2 -0
  55. package/dist/acpx-engine/read-only-permissions.test.d.ts.map +1 -0
  56. package/dist/acpx-engine/read-only-permissions.test.js +33 -0
  57. package/dist/acpx-engine/read-only-permissions.test.js.map +1 -0
  58. package/dist/acpx-engine/remote-spawn-smoke.test.d.ts +2 -0
  59. package/dist/acpx-engine/remote-spawn-smoke.test.d.ts.map +1 -0
  60. package/dist/acpx-engine/remote-spawn-smoke.test.js +151 -0
  61. package/dist/acpx-engine/remote-spawn-smoke.test.js.map +1 -0
  62. package/dist/acpx-engine/run-contracts.d.ts +415 -0
  63. package/dist/acpx-engine/run-contracts.d.ts.map +1 -0
  64. package/dist/acpx-engine/run-contracts.js +20 -0
  65. package/dist/acpx-engine/run-contracts.js.map +1 -0
  66. package/dist/acpx-engine/run-contracts.test.d.ts +2 -0
  67. package/dist/acpx-engine/run-contracts.test.d.ts.map +1 -0
  68. package/dist/acpx-engine/run-contracts.test.js +57 -0
  69. package/dist/acpx-engine/run-contracts.test.js.map +1 -0
  70. package/dist/acpx-engine/run-coordinator.d.ts +57 -0
  71. package/dist/acpx-engine/run-coordinator.d.ts.map +1 -0
  72. package/dist/acpx-engine/run-coordinator.js +63 -0
  73. package/dist/acpx-engine/run-coordinator.js.map +1 -0
  74. package/dist/acpx-engine/run-coordinator.test.d.ts +2 -0
  75. package/dist/acpx-engine/run-coordinator.test.d.ts.map +1 -0
  76. package/dist/acpx-engine/run-coordinator.test.js +160 -0
  77. package/dist/acpx-engine/run-coordinator.test.js.map +1 -0
  78. package/dist/acpx-engine/run-fault-matrix.test.d.ts +2 -0
  79. package/dist/acpx-engine/run-fault-matrix.test.d.ts.map +1 -0
  80. package/dist/acpx-engine/run-fault-matrix.test.js +829 -0
  81. package/dist/acpx-engine/run-fault-matrix.test.js.map +1 -0
  82. package/dist/acpx-engine/run-resource-ledger.d.ts +30 -0
  83. package/dist/acpx-engine/run-resource-ledger.d.ts.map +1 -0
  84. package/dist/acpx-engine/run-resource-ledger.js +148 -0
  85. package/dist/acpx-engine/run-resource-ledger.js.map +1 -0
  86. package/dist/acpx-engine/run-resource-ledger.test.d.ts +2 -0
  87. package/dist/acpx-engine/run-resource-ledger.test.d.ts.map +1 -0
  88. package/dist/acpx-engine/run-resource-ledger.test.js +154 -0
  89. package/dist/acpx-engine/run-resource-ledger.test.js.map +1 -0
  90. package/dist/acpx-engine/run-site-host.d.ts +73 -0
  91. package/dist/acpx-engine/run-site-host.d.ts.map +1 -0
  92. package/dist/acpx-engine/run-site-host.js +65 -0
  93. package/dist/acpx-engine/run-site-host.js.map +1 -0
  94. package/dist/acpx-engine/run-site-host.test.d.ts +2 -0
  95. package/dist/acpx-engine/run-site-host.test.d.ts.map +1 -0
  96. package/dist/acpx-engine/run-site-host.test.js +98 -0
  97. package/dist/acpx-engine/run-site-host.test.js.map +1 -0
  98. package/dist/acpx-engine/run-site-sandbox.d.ts +142 -0
  99. package/dist/acpx-engine/run-site-sandbox.d.ts.map +1 -0
  100. package/dist/acpx-engine/run-site-sandbox.js +278 -0
  101. package/dist/acpx-engine/run-site-sandbox.js.map +1 -0
  102. package/dist/acpx-engine/run-site-sandbox.test.d.ts +2 -0
  103. package/dist/acpx-engine/run-site-sandbox.test.d.ts.map +1 -0
  104. package/dist/acpx-engine/run-site-sandbox.test.js +275 -0
  105. package/dist/acpx-engine/run-site-sandbox.test.js.map +1 -0
  106. package/dist/acpx-engine/session-codec.d.ts +3 -0
  107. package/dist/acpx-engine/session-codec.d.ts.map +1 -0
  108. package/dist/acpx-engine/session-codec.js +50 -0
  109. package/dist/acpx-engine/session-codec.js.map +1 -0
  110. package/dist/acpx-engine/session-reuse-store.d.ts +62 -0
  111. package/dist/acpx-engine/session-reuse-store.d.ts.map +1 -0
  112. package/dist/acpx-engine/session-reuse-store.js +134 -0
  113. package/dist/acpx-engine/session-reuse-store.js.map +1 -0
  114. package/dist/acpx-engine/session-reuse-store.test.d.ts +2 -0
  115. package/dist/acpx-engine/session-reuse-store.test.d.ts.map +1 -0
  116. package/dist/acpx-engine/session-reuse-store.test.js +134 -0
  117. package/dist/acpx-engine/session-reuse-store.test.js.map +1 -0
  118. package/dist/acpx-engine/settlement-characterization.test.d.ts +2 -0
  119. package/dist/acpx-engine/settlement-characterization.test.d.ts.map +1 -0
  120. package/dist/acpx-engine/settlement-characterization.test.js +966 -0
  121. package/dist/acpx-engine/settlement-characterization.test.js.map +1 -0
  122. package/dist/acpx-engine/settlement-sequence.d.ts +77 -0
  123. package/dist/acpx-engine/settlement-sequence.d.ts.map +1 -0
  124. package/dist/acpx-engine/settlement-sequence.js +119 -0
  125. package/dist/acpx-engine/settlement-sequence.js.map +1 -0
  126. package/dist/acpx-engine/settlement-sequence.test.d.ts +2 -0
  127. package/dist/acpx-engine/settlement-sequence.test.d.ts.map +1 -0
  128. package/dist/acpx-engine/settlement-sequence.test.js +272 -0
  129. package/dist/acpx-engine/settlement-sequence.test.js.map +1 -0
  130. package/dist/acpx-engine/spawn-smoke.test.d.ts +2 -0
  131. package/dist/acpx-engine/spawn-smoke.test.d.ts.map +1 -0
  132. package/dist/acpx-engine/spawn-smoke.test.js +193 -0
  133. package/dist/acpx-engine/spawn-smoke.test.js.map +1 -0
  134. package/dist/acpx-engine/startup-cancellation.d.ts +9 -0
  135. package/dist/acpx-engine/startup-cancellation.d.ts.map +1 -0
  136. package/dist/acpx-engine/startup-cancellation.js +97 -0
  137. package/dist/acpx-engine/startup-cancellation.js.map +1 -0
  138. package/dist/acpx-engine/startup-cancellation.test.d.ts +2 -0
  139. package/dist/acpx-engine/startup-cancellation.test.d.ts.map +1 -0
  140. package/dist/acpx-engine/startup-cancellation.test.js +115 -0
  141. package/dist/acpx-engine/startup-cancellation.test.js.map +1 -0
  142. package/dist/acpx-engine/startup-characterization.test.d.ts +2 -0
  143. package/dist/acpx-engine/startup-characterization.test.d.ts.map +1 -0
  144. package/dist/acpx-engine/startup-characterization.test.js +742 -0
  145. package/dist/acpx-engine/startup-characterization.test.js.map +1 -0
  146. package/dist/acpx-engine/startup-timing.d.ts +419 -0
  147. package/dist/acpx-engine/startup-timing.d.ts.map +1 -0
  148. package/dist/acpx-engine/startup-timing.js +616 -0
  149. package/dist/acpx-engine/startup-timing.js.map +1 -0
  150. package/dist/acpx-engine/startup-timing.test.d.ts +2 -0
  151. package/dist/acpx-engine/startup-timing.test.d.ts.map +1 -0
  152. package/dist/acpx-engine/startup-timing.test.js +619 -0
  153. package/dist/acpx-engine/startup-timing.test.js.map +1 -0
  154. package/dist/acpx-engine/terminal-session-failure.d.ts +18 -0
  155. package/dist/acpx-engine/terminal-session-failure.d.ts.map +1 -0
  156. package/dist/acpx-engine/terminal-session-failure.js +106 -0
  157. package/dist/acpx-engine/terminal-session-failure.js.map +1 -0
  158. package/dist/acpx-engine/terminal-session-failure.test.d.ts +2 -0
  159. package/dist/acpx-engine/terminal-session-failure.test.d.ts.map +1 -0
  160. package/dist/acpx-engine/terminal-session-failure.test.js +139 -0
  161. package/dist/acpx-engine/terminal-session-failure.test.js.map +1 -0
  162. package/dist/acpx-engine/turn-characterization.test.d.ts +2 -0
  163. package/dist/acpx-engine/turn-characterization.test.d.ts.map +1 -0
  164. package/dist/acpx-engine/turn-characterization.test.js +567 -0
  165. package/dist/acpx-engine/turn-characterization.test.js.map +1 -0
  166. package/dist/acpx-engine/turn-sequence.d.ts +54 -0
  167. package/dist/acpx-engine/turn-sequence.d.ts.map +1 -0
  168. package/dist/acpx-engine/turn-sequence.js +75 -0
  169. package/dist/acpx-engine/turn-sequence.js.map +1 -0
  170. package/dist/acpx-engine/turn-sequence.test.d.ts +2 -0
  171. package/dist/acpx-engine/turn-sequence.test.d.ts.map +1 -0
  172. package/dist/acpx-engine/turn-sequence.test.js +177 -0
  173. package/dist/acpx-engine/turn-sequence.test.js.map +1 -0
  174. package/dist/acpx-engine/ui.d.ts +3 -0
  175. package/dist/acpx-engine/ui.d.ts.map +1 -0
  176. package/dist/acpx-engine/ui.js +162 -0
  177. package/dist/acpx-engine/ui.js.map +1 -0
  178. package/dist/adapter-steer-registry.d.ts +24 -0
  179. package/dist/adapter-steer-registry.d.ts.map +1 -0
  180. package/dist/adapter-steer-registry.js +65 -0
  181. package/dist/adapter-steer-registry.js.map +1 -0
  182. package/dist/adapter-steer-registry.test.d.ts +2 -0
  183. package/dist/adapter-steer-registry.test.d.ts.map +1 -0
  184. package/dist/adapter-steer-registry.test.js +121 -0
  185. package/dist/adapter-steer-registry.test.js.map +1 -0
  186. package/dist/agent-todo.d.ts +2 -0
  187. package/dist/agent-todo.d.ts.map +1 -0
  188. package/dist/agent-todo.js +2 -0
  189. package/dist/agent-todo.js.map +1 -0
  190. package/dist/billing.d.ts +9 -0
  191. package/dist/billing.d.ts.map +1 -0
  192. package/dist/billing.js +39 -0
  193. package/dist/billing.js.map +1 -0
  194. package/dist/billing.test.d.ts +2 -0
  195. package/dist/billing.test.d.ts.map +1 -0
  196. package/dist/billing.test.js +30 -0
  197. package/dist/billing.test.js.map +1 -0
  198. package/dist/bridge-transport-contract.d.ts +43 -0
  199. package/dist/bridge-transport-contract.d.ts.map +1 -0
  200. package/dist/bridge-transport-contract.js +33 -0
  201. package/dist/bridge-transport-contract.js.map +1 -0
  202. package/dist/chat-file-delivery.d.ts +10 -0
  203. package/dist/chat-file-delivery.d.ts.map +1 -0
  204. package/dist/chat-file-delivery.js +39 -0
  205. package/dist/chat-file-delivery.js.map +1 -0
  206. package/dist/chat-file-delivery.test.d.ts +2 -0
  207. package/dist/chat-file-delivery.test.d.ts.map +1 -0
  208. package/dist/chat-file-delivery.test.js +92 -0
  209. package/dist/chat-file-delivery.test.js.map +1 -0
  210. package/dist/command-managed-runtime.d.ts +165 -0
  211. package/dist/command-managed-runtime.d.ts.map +1 -0
  212. package/dist/command-managed-runtime.js +460 -0
  213. package/dist/command-managed-runtime.js.map +1 -0
  214. package/dist/command-managed-runtime.test.d.ts +2 -0
  215. package/dist/command-managed-runtime.test.d.ts.map +1 -0
  216. package/dist/command-managed-runtime.test.js +908 -0
  217. package/dist/command-managed-runtime.test.js.map +1 -0
  218. package/dist/command-redaction.d.ts +17 -0
  219. package/dist/command-redaction.d.ts.map +1 -0
  220. package/dist/command-redaction.js +107 -0
  221. package/dist/command-redaction.js.map +1 -0
  222. package/dist/command-redaction.test.d.ts +2 -0
  223. package/dist/command-redaction.test.d.ts.map +1 -0
  224. package/dist/command-redaction.test.js +99 -0
  225. package/dist/command-redaction.test.js.map +1 -0
  226. package/dist/connection-failure.d.ts +23 -0
  227. package/dist/connection-failure.d.ts.map +1 -0
  228. package/dist/connection-failure.js +36 -0
  229. package/dist/connection-failure.js.map +1 -0
  230. package/dist/connection-failure.test.d.ts +2 -0
  231. package/dist/connection-failure.test.d.ts.map +1 -0
  232. package/dist/connection-failure.test.js +85 -0
  233. package/dist/connection-failure.test.js.map +1 -0
  234. package/dist/directory-merge-lock.test.d.ts +2 -0
  235. package/dist/directory-merge-lock.test.d.ts.map +1 -0
  236. package/dist/directory-merge-lock.test.js +168 -0
  237. package/dist/directory-merge-lock.test.js.map +1 -0
  238. package/dist/duplex-frame-codec.d.ts +124 -0
  239. package/dist/duplex-frame-codec.d.ts.map +1 -0
  240. package/dist/duplex-frame-codec.js +134 -0
  241. package/dist/duplex-frame-codec.js.map +1 -0
  242. package/dist/duplex-frame-codec.test.d.ts +2 -0
  243. package/dist/duplex-frame-codec.test.d.ts.map +1 -0
  244. package/dist/duplex-frame-codec.test.js +172 -0
  245. package/dist/duplex-frame-codec.test.js.map +1 -0
  246. package/dist/duplex-observability.d.ts +220 -0
  247. package/dist/duplex-observability.d.ts.map +1 -0
  248. package/dist/duplex-observability.js +248 -0
  249. package/dist/duplex-observability.js.map +1 -0
  250. package/dist/duplex-observability.test.d.ts +2 -0
  251. package/dist/duplex-observability.test.d.ts.map +1 -0
  252. package/dist/duplex-observability.test.js +55 -0
  253. package/dist/duplex-observability.test.js.map +1 -0
  254. package/dist/env-aliases-run.test.d.ts +2 -0
  255. package/dist/env-aliases-run.test.d.ts.map +1 -0
  256. package/dist/env-aliases-run.test.js +49 -0
  257. package/dist/env-aliases-run.test.js.map +1 -0
  258. package/dist/env-bindings.d.ts +17 -0
  259. package/dist/env-bindings.d.ts.map +1 -0
  260. package/dist/env-bindings.js +98 -0
  261. package/dist/env-bindings.js.map +1 -0
  262. package/dist/env-bindings.test.d.ts +2 -0
  263. package/dist/env-bindings.test.d.ts.map +1 -0
  264. package/dist/env-bindings.test.js +66 -0
  265. package/dist/env-bindings.test.js.map +1 -0
  266. package/dist/exclude-patterns.d.ts +4 -0
  267. package/dist/exclude-patterns.d.ts.map +1 -0
  268. package/dist/exclude-patterns.js +26 -0
  269. package/dist/exclude-patterns.js.map +1 -0
  270. package/dist/execution-phase.d.ts +10 -0
  271. package/dist/execution-phase.d.ts.map +1 -0
  272. package/dist/execution-phase.js +27 -0
  273. package/dist/execution-phase.js.map +1 -0
  274. package/dist/execution-phase.test.d.ts +2 -0
  275. package/dist/execution-phase.test.d.ts.map +1 -0
  276. package/dist/execution-phase.test.js +26 -0
  277. package/dist/execution-phase.test.js.map +1 -0
  278. package/dist/execution-target-sandbox.test.d.ts +2 -0
  279. package/dist/execution-target-sandbox.test.d.ts.map +1 -0
  280. package/dist/execution-target-sandbox.test.js +6792 -0
  281. package/dist/execution-target-sandbox.test.js.map +1 -0
  282. package/dist/execution-target-stdin-race.test.d.ts +2 -0
  283. package/dist/execution-target-stdin-race.test.d.ts.map +1 -0
  284. package/dist/execution-target-stdin-race.test.js +2085 -0
  285. package/dist/execution-target-stdin-race.test.js.map +1 -0
  286. package/dist/execution-target.d.ts +553 -0
  287. package/dist/execution-target.d.ts.map +1 -0
  288. package/dist/execution-target.js +3973 -0
  289. package/dist/execution-target.js.map +1 -0
  290. package/dist/execution-target.test.d.ts +2 -0
  291. package/dist/execution-target.test.d.ts.map +1 -0
  292. package/dist/execution-target.test.js +346 -0
  293. package/dist/execution-target.test.js.map +1 -0
  294. package/dist/git-workspace-sync.d.ts +203 -0
  295. package/dist/git-workspace-sync.d.ts.map +1 -0
  296. package/dist/git-workspace-sync.js +938 -0
  297. package/dist/git-workspace-sync.js.map +1 -0
  298. package/dist/git-workspace-sync.test.d.ts +2 -0
  299. package/dist/git-workspace-sync.test.d.ts.map +1 -0
  300. package/dist/git-workspace-sync.test.js +1183 -0
  301. package/dist/git-workspace-sync.test.js.map +1 -0
  302. package/dist/github-launcher-environment.test.d.ts +2 -0
  303. package/dist/github-launcher-environment.test.d.ts.map +1 -0
  304. package/dist/github-launcher-environment.test.js +322 -0
  305. package/dist/github-launcher-environment.test.js.map +1 -0
  306. package/dist/github-launcher.d.ts +8 -0
  307. package/dist/github-launcher.d.ts.map +1 -0
  308. package/dist/github-launcher.js +142 -0
  309. package/dist/github-launcher.js.map +1 -0
  310. package/dist/github-launcher.test.d.ts +2 -0
  311. package/dist/github-launcher.test.d.ts.map +1 -0
  312. package/dist/github-launcher.test.js +199 -0
  313. package/dist/github-launcher.test.js.map +1 -0
  314. package/dist/http2-bridge-server.d.ts +465 -0
  315. package/dist/http2-bridge-server.d.ts.map +1 -0
  316. package/dist/http2-bridge-server.js +1087 -0
  317. package/dist/http2-bridge-server.js.map +1 -0
  318. package/dist/http2-bridge-server.test.d.ts +2 -0
  319. package/dist/http2-bridge-server.test.d.ts.map +1 -0
  320. package/dist/http2-bridge-server.test.js +2129 -0
  321. package/dist/http2-bridge-server.test.js.map +1 -0
  322. package/dist/index.d.ts +22 -0
  323. package/dist/index.d.ts.map +1 -0
  324. package/dist/index.js +13 -0
  325. package/dist/index.js.map +1 -0
  326. package/dist/live-stdin-channel.d.ts +11 -0
  327. package/dist/live-stdin-channel.d.ts.map +1 -0
  328. package/dist/live-stdin-channel.js +56 -0
  329. package/dist/live-stdin-channel.js.map +1 -0
  330. package/dist/live-stdin-reachability.test.d.ts +2 -0
  331. package/dist/live-stdin-reachability.test.d.ts.map +1 -0
  332. package/dist/live-stdin-reachability.test.js +25 -0
  333. package/dist/live-stdin-reachability.test.js.map +1 -0
  334. package/dist/local-process-sandbox.d.ts +41 -0
  335. package/dist/local-process-sandbox.d.ts.map +1 -0
  336. package/dist/local-process-sandbox.js +432 -0
  337. package/dist/local-process-sandbox.js.map +1 -0
  338. package/dist/local-process-sandbox.test.d.ts +2 -0
  339. package/dist/local-process-sandbox.test.d.ts.map +1 -0
  340. package/dist/local-process-sandbox.test.js +399 -0
  341. package/dist/local-process-sandbox.test.js.map +1 -0
  342. package/dist/log-redaction.d.ts +9 -0
  343. package/dist/log-redaction.d.ts.map +1 -0
  344. package/dist/log-redaction.js +88 -0
  345. package/dist/log-redaction.js.map +1 -0
  346. package/dist/login-capability.d.ts +88 -0
  347. package/dist/login-capability.d.ts.map +1 -0
  348. package/dist/login-capability.js +78 -0
  349. package/dist/login-capability.js.map +1 -0
  350. package/dist/login-capability.test.d.ts +2 -0
  351. package/dist/login-capability.test.d.ts.map +1 -0
  352. package/dist/login-capability.test.js +78 -0
  353. package/dist/login-capability.test.js.map +1 -0
  354. package/dist/login-pty-transport.d.ts +80 -0
  355. package/dist/login-pty-transport.d.ts.map +1 -0
  356. package/dist/login-pty-transport.js +75 -0
  357. package/dist/login-pty-transport.js.map +1 -0
  358. package/dist/login-pty-transport.test.d.ts +2 -0
  359. package/dist/login-pty-transport.test.d.ts.map +1 -0
  360. package/dist/login-pty-transport.test.js +185 -0
  361. package/dist/login-pty-transport.test.js.map +1 -0
  362. package/dist/login-runner-lifecycle.d.ts +70 -0
  363. package/dist/login-runner-lifecycle.d.ts.map +1 -0
  364. package/dist/login-runner-lifecycle.js +52 -0
  365. package/dist/login-runner-lifecycle.js.map +1 -0
  366. package/dist/login-runner-lifecycle.test.d.ts +2 -0
  367. package/dist/login-runner-lifecycle.test.d.ts.map +1 -0
  368. package/dist/login-runner-lifecycle.test.js +122 -0
  369. package/dist/login-runner-lifecycle.test.js.map +1 -0
  370. package/dist/mcp-isolation.integration.test.d.ts +2 -0
  371. package/dist/mcp-isolation.integration.test.d.ts.map +1 -0
  372. package/dist/mcp-isolation.integration.test.js +202 -0
  373. package/dist/mcp-isolation.integration.test.js.map +1 -0
  374. package/dist/paperclip-mcp-mount.d.ts +36 -0
  375. package/dist/paperclip-mcp-mount.d.ts.map +1 -0
  376. package/dist/paperclip-mcp-mount.js +101 -0
  377. package/dist/paperclip-mcp-mount.js.map +1 -0
  378. package/dist/paperclip-mcp.d.ts +53 -0
  379. package/dist/paperclip-mcp.d.ts.map +1 -0
  380. package/dist/paperclip-mcp.js +149 -0
  381. package/dist/paperclip-mcp.js.map +1 -0
  382. package/dist/paperclip-mcp.test.d.ts +2 -0
  383. package/dist/paperclip-mcp.test.d.ts.map +1 -0
  384. package/dist/paperclip-mcp.test.js +133 -0
  385. package/dist/paperclip-mcp.test.js.map +1 -0
  386. package/dist/paperclip-runner-permissions.d.ts +148 -0
  387. package/dist/paperclip-runner-permissions.d.ts.map +1 -0
  388. package/dist/paperclip-runner-permissions.js +184 -0
  389. package/dist/paperclip-runner-permissions.js.map +1 -0
  390. package/dist/paperclip-runner-permissions.test.d.ts +2 -0
  391. package/dist/paperclip-runner-permissions.test.d.ts.map +1 -0
  392. package/dist/paperclip-runner-permissions.test.js +80 -0
  393. package/dist/paperclip-runner-permissions.test.js.map +1 -0
  394. package/dist/prompt-sections.test.d.ts +2 -0
  395. package/dist/prompt-sections.test.d.ts.map +1 -0
  396. package/dist/prompt-sections.test.js +53 -0
  397. package/dist/prompt-sections.test.js.map +1 -0
  398. package/dist/provider-models/claude.d.ts +10 -0
  399. package/dist/provider-models/claude.d.ts.map +1 -0
  400. package/dist/provider-models/claude.js +49 -0
  401. package/dist/provider-models/claude.js.map +1 -0
  402. package/dist/provider-models/codex.d.ts +23 -0
  403. package/dist/provider-models/codex.d.ts.map +1 -0
  404. package/dist/provider-models/codex.js +160 -0
  405. package/dist/provider-models/codex.js.map +1 -0
  406. package/dist/provider-models/gemini.d.ts +6 -0
  407. package/dist/provider-models/gemini.d.ts.map +1 -0
  408. package/dist/provider-models/gemini.js +17 -0
  409. package/dist/provider-models/gemini.js.map +1 -0
  410. package/dist/provider-models/grok.d.ts +7 -0
  411. package/dist/provider-models/grok.d.ts.map +1 -0
  412. package/dist/provider-models/grok.js +13 -0
  413. package/dist/provider-models/grok.js.map +1 -0
  414. package/dist/provider-models/opencode.d.ts +8 -0
  415. package/dist/provider-models/opencode.d.ts.map +1 -0
  416. package/dist/provider-models/opencode.js +71 -0
  417. package/dist/provider-models/opencode.js.map +1 -0
  418. package/dist/provider-stopped-boundary.d.ts +7 -0
  419. package/dist/provider-stopped-boundary.d.ts.map +1 -0
  420. package/dist/provider-stopped-boundary.js +22 -0
  421. package/dist/provider-stopped-boundary.js.map +1 -0
  422. package/dist/provider-stopped-boundary.test.d.ts +2 -0
  423. package/dist/provider-stopped-boundary.test.d.ts.map +1 -0
  424. package/dist/provider-stopped-boundary.test.js +76 -0
  425. package/dist/provider-stopped-boundary.test.js.map +1 -0
  426. package/dist/published-exports.test.d.ts +2 -0
  427. package/dist/published-exports.test.d.ts.map +1 -0
  428. package/dist/published-exports.test.js +17 -0
  429. package/dist/published-exports.test.js.map +1 -0
  430. package/dist/remote-execution-env.d.ts +2 -0
  431. package/dist/remote-execution-env.d.ts.map +1 -0
  432. package/dist/remote-execution-env.js +46 -0
  433. package/dist/remote-execution-env.js.map +1 -0
  434. package/dist/remote-managed-runtime.d.ts +47 -0
  435. package/dist/remote-managed-runtime.d.ts.map +1 -0
  436. package/dist/remote-managed-runtime.js +201 -0
  437. package/dist/remote-managed-runtime.js.map +1 -0
  438. package/dist/remote-managed-runtime.test.d.ts +2 -0
  439. package/dist/remote-managed-runtime.test.d.ts.map +1 -0
  440. package/dist/remote-managed-runtime.test.js +319 -0
  441. package/dist/remote-managed-runtime.test.js.map +1 -0
  442. package/dist/run-oom-score.d.ts +16 -0
  443. package/dist/run-oom-score.d.ts.map +1 -0
  444. package/dist/run-oom-score.js +29 -0
  445. package/dist/run-oom-score.js.map +1 -0
  446. package/dist/run-oom-score.test.d.ts +2 -0
  447. package/dist/run-oom-score.test.d.ts.map +1 -0
  448. package/dist/run-oom-score.test.js +78 -0
  449. package/dist/run-oom-score.test.js.map +1 -0
  450. package/dist/runner-connectivity.d.ts +61 -0
  451. package/dist/runner-connectivity.d.ts.map +1 -0
  452. package/dist/runner-connectivity.js +81 -0
  453. package/dist/runner-connectivity.js.map +1 -0
  454. package/dist/runner-connectivity.test.d.ts +2 -0
  455. package/dist/runner-connectivity.test.d.ts.map +1 -0
  456. package/dist/runner-connectivity.test.js +183 -0
  457. package/dist/runner-connectivity.test.js.map +1 -0
  458. package/dist/runtime-progress.d.ts +48 -0
  459. package/dist/runtime-progress.d.ts.map +1 -0
  460. package/dist/runtime-progress.js +99 -0
  461. package/dist/runtime-progress.js.map +1 -0
  462. package/dist/runtime-progress.test.d.ts +2 -0
  463. package/dist/runtime-progress.test.d.ts.map +1 -0
  464. package/dist/runtime-progress.test.js +240 -0
  465. package/dist/runtime-progress.test.js.map +1 -0
  466. package/dist/sandbox-callback-bridge-body.d.ts +12 -0
  467. package/dist/sandbox-callback-bridge-body.d.ts.map +1 -0
  468. package/dist/sandbox-callback-bridge-body.js +39 -0
  469. package/dist/sandbox-callback-bridge-body.js.map +1 -0
  470. package/dist/sandbox-callback-bridge-body.test.d.ts +2 -0
  471. package/dist/sandbox-callback-bridge-body.test.d.ts.map +1 -0
  472. package/dist/sandbox-callback-bridge-body.test.js +31 -0
  473. package/dist/sandbox-callback-bridge-body.test.js.map +1 -0
  474. package/dist/sandbox-callback-bridge.d.ts +270 -0
  475. package/dist/sandbox-callback-bridge.d.ts.map +1 -0
  476. package/dist/sandbox-callback-bridge.js +2382 -0
  477. package/dist/sandbox-callback-bridge.js.map +1 -0
  478. package/dist/sandbox-callback-bridge.test.d.ts +2 -0
  479. package/dist/sandbox-callback-bridge.test.d.ts.map +1 -0
  480. package/dist/sandbox-callback-bridge.test.js +3453 -0
  481. package/dist/sandbox-callback-bridge.test.js.map +1 -0
  482. package/dist/sandbox-file-sync.test.d.ts +2 -0
  483. package/dist/sandbox-file-sync.test.d.ts.map +1 -0
  484. package/dist/sandbox-file-sync.test.js +419 -0
  485. package/dist/sandbox-file-sync.test.js.map +1 -0
  486. package/dist/sandbox-install-command.d.ts +2 -0
  487. package/dist/sandbox-install-command.d.ts.map +1 -0
  488. package/dist/sandbox-install-command.js +47 -0
  489. package/dist/sandbox-install-command.js.map +1 -0
  490. package/dist/sandbox-install-command.test.d.ts +2 -0
  491. package/dist/sandbox-install-command.test.d.ts.map +1 -0
  492. package/dist/sandbox-install-command.test.js +22 -0
  493. package/dist/sandbox-install-command.test.js.map +1 -0
  494. package/dist/sandbox-managed-runtime.d.ts +423 -0
  495. package/dist/sandbox-managed-runtime.d.ts.map +1 -0
  496. package/dist/sandbox-managed-runtime.js +1425 -0
  497. package/dist/sandbox-managed-runtime.js.map +1 -0
  498. package/dist/sandbox-managed-runtime.test.d.ts +2 -0
  499. package/dist/sandbox-managed-runtime.test.d.ts.map +1 -0
  500. package/dist/sandbox-managed-runtime.test.js +4044 -0
  501. package/dist/sandbox-managed-runtime.test.js.map +1 -0
  502. package/dist/sandbox-run-log-stream.d.ts +44 -0
  503. package/dist/sandbox-run-log-stream.d.ts.map +1 -0
  504. package/dist/sandbox-run-log-stream.js +203 -0
  505. package/dist/sandbox-run-log-stream.js.map +1 -0
  506. package/dist/sandbox-shell.d.ts +3 -0
  507. package/dist/sandbox-shell.d.ts.map +1 -0
  508. package/dist/sandbox-shell.js +7 -0
  509. package/dist/sandbox-shell.js.map +1 -0
  510. package/dist/server-utils-env.test.d.ts +2 -0
  511. package/dist/server-utils-env.test.d.ts.map +1 -0
  512. package/dist/server-utils-env.test.js +23 -0
  513. package/dist/server-utils-env.test.js.map +1 -0
  514. package/dist/server-utils.d.ts +676 -0
  515. package/dist/server-utils.d.ts.map +1 -0
  516. package/dist/server-utils.js +3450 -0
  517. package/dist/server-utils.js.map +1 -0
  518. package/dist/server-utils.test.d.ts +2 -0
  519. package/dist/server-utils.test.d.ts.map +1 -0
  520. package/dist/server-utils.test.js +3367 -0
  521. package/dist/server-utils.test.js.map +1 -0
  522. package/dist/session-compaction.d.ts +25 -0
  523. package/dist/session-compaction.d.ts.map +1 -0
  524. package/dist/session-compaction.js +115 -0
  525. package/dist/session-compaction.js.map +1 -0
  526. package/dist/skill-library-manifest.d.ts +6 -0
  527. package/dist/skill-library-manifest.d.ts.map +1 -0
  528. package/dist/skill-library-manifest.js +53 -0
  529. package/dist/skill-library-manifest.js.map +1 -0
  530. package/dist/skill-library-manifest.test.d.ts +2 -0
  531. package/dist/skill-library-manifest.test.d.ts.map +1 -0
  532. package/dist/skill-library-manifest.test.js +84 -0
  533. package/dist/skill-library-manifest.test.js.map +1 -0
  534. package/dist/skills-staging-follow-symlinks.test.d.ts +2 -0
  535. package/dist/skills-staging-follow-symlinks.test.d.ts.map +1 -0
  536. package/dist/skills-staging-follow-symlinks.test.js +97 -0
  537. package/dist/skills-staging-follow-symlinks.test.js.map +1 -0
  538. package/dist/ssh-fixture.test.d.ts +2 -0
  539. package/dist/ssh-fixture.test.d.ts.map +1 -0
  540. package/dist/ssh-fixture.test.js +1026 -0
  541. package/dist/ssh-fixture.test.js.map +1 -0
  542. package/dist/ssh.d.ts +131 -0
  543. package/dist/ssh.d.ts.map +1 -0
  544. package/dist/ssh.js +1785 -0
  545. package/dist/ssh.js.map +1 -0
  546. package/dist/sync-operation-schedule.d.ts +17 -0
  547. package/dist/sync-operation-schedule.d.ts.map +1 -0
  548. package/dist/sync-operation-schedule.js +66 -0
  549. package/dist/sync-operation-schedule.js.map +1 -0
  550. package/dist/sync-operation-schedule.test.d.ts +2 -0
  551. package/dist/sync-operation-schedule.test.d.ts.map +1 -0
  552. package/dist/sync-operation-schedule.test.js +130 -0
  553. package/dist/sync-operation-schedule.test.js.map +1 -0
  554. package/dist/test-fixtures/prompt-context.d.ts +54 -0
  555. package/dist/test-fixtures/prompt-context.d.ts.map +1 -0
  556. package/dist/test-fixtures/prompt-context.js +55 -0
  557. package/dist/test-fixtures/prompt-context.js.map +1 -0
  558. package/dist/test-support/mcp-isolation-harness.d.ts +23 -0
  559. package/dist/test-support/mcp-isolation-harness.d.ts.map +1 -0
  560. package/dist/test-support/mcp-isolation-harness.js +67 -0
  561. package/dist/test-support/mcp-isolation-harness.js.map +1 -0
  562. package/dist/tool-profile.d.ts +5 -0
  563. package/dist/tool-profile.d.ts.map +1 -0
  564. package/dist/tool-profile.js +5 -0
  565. package/dist/tool-profile.js.map +1 -0
  566. package/dist/types.d.ts +867 -0
  567. package/dist/types.d.ts.map +1 -0
  568. package/dist/types.js +5 -0
  569. package/dist/types.js.map +1 -0
  570. package/dist/usage-checkpoint.d.ts +11 -0
  571. package/dist/usage-checkpoint.d.ts.map +1 -0
  572. package/dist/usage-checkpoint.js +165 -0
  573. package/dist/usage-checkpoint.js.map +1 -0
  574. package/dist/usage-checkpoint.test.d.ts +2 -0
  575. package/dist/usage-checkpoint.test.d.ts.map +1 -0
  576. package/dist/usage-checkpoint.test.js +131 -0
  577. package/dist/usage-checkpoint.test.js.map +1 -0
  578. package/dist/workspace-git-stream.d.ts +19 -0
  579. package/dist/workspace-git-stream.d.ts.map +1 -0
  580. package/dist/workspace-git-stream.js +99 -0
  581. package/dist/workspace-git-stream.js.map +1 -0
  582. package/dist/workspace-git-stream.test.d.ts +2 -0
  583. package/dist/workspace-git-stream.test.d.ts.map +1 -0
  584. package/dist/workspace-git-stream.test.js +71 -0
  585. package/dist/workspace-git-stream.test.js.map +1 -0
  586. package/dist/workspace-manifest.d.ts +61 -0
  587. package/dist/workspace-manifest.d.ts.map +1 -0
  588. package/dist/workspace-manifest.js +257 -0
  589. package/dist/workspace-manifest.js.map +1 -0
  590. package/dist/workspace-manifest.test.d.ts +2 -0
  591. package/dist/workspace-manifest.test.d.ts.map +1 -0
  592. package/dist/workspace-manifest.test.js +160 -0
  593. package/dist/workspace-manifest.test.js.map +1 -0
  594. package/dist/workspace-restore-diagnostics.d.ts +41 -0
  595. package/dist/workspace-restore-diagnostics.d.ts.map +1 -0
  596. package/dist/workspace-restore-diagnostics.js +265 -0
  597. package/dist/workspace-restore-diagnostics.js.map +1 -0
  598. package/dist/workspace-restore-diagnostics.test.d.ts +2 -0
  599. package/dist/workspace-restore-diagnostics.test.d.ts.map +1 -0
  600. package/dist/workspace-restore-diagnostics.test.js +288 -0
  601. package/dist/workspace-restore-diagnostics.test.js.map +1 -0
  602. package/dist/workspace-restore-merge.d.ts +118 -0
  603. package/dist/workspace-restore-merge.d.ts.map +1 -0
  604. package/dist/workspace-restore-merge.js +664 -0
  605. package/dist/workspace-restore-merge.js.map +1 -0
  606. package/dist/workspace-restore-merge.test.d.ts +2 -0
  607. package/dist/workspace-restore-merge.test.d.ts.map +1 -0
  608. package/dist/workspace-restore-merge.test.js +687 -0
  609. package/dist/workspace-restore-merge.test.js.map +1 -0
  610. package/dist/workspace-restore-result.d.ts +6 -0
  611. package/dist/workspace-restore-result.d.ts.map +1 -0
  612. package/dist/workspace-restore-result.js +72 -0
  613. package/dist/workspace-restore-result.js.map +1 -0
  614. package/dist/workspace-restore-result.test.d.ts +2 -0
  615. package/dist/workspace-restore-result.test.d.ts.map +1 -0
  616. package/dist/workspace-restore-result.test.js +74 -0
  617. package/dist/workspace-restore-result.test.js.map +1 -0
  618. package/dist/workspace-restore-teardown.d.ts +29 -0
  619. package/dist/workspace-restore-teardown.d.ts.map +1 -0
  620. package/dist/workspace-restore-teardown.js +36 -0
  621. package/dist/workspace-restore-teardown.js.map +1 -0
  622. package/dist/workspace-restore-teardown.test.d.ts +2 -0
  623. package/dist/workspace-restore-teardown.test.d.ts.map +1 -0
  624. package/dist/workspace-restore-teardown.test.js +95 -0
  625. package/dist/workspace-restore-teardown.test.js.map +1 -0
  626. package/node_modules/@agentclientprotocol/sdk/LICENSE +191 -0
  627. package/node_modules/@agentclientprotocol/sdk/README.md +77 -0
  628. package/node_modules/@agentclientprotocol/sdk/dist/acp.d.ts +1637 -0
  629. package/node_modules/@agentclientprotocol/sdk/dist/acp.js +1729 -0
  630. package/node_modules/@agentclientprotocol/sdk/dist/acp.js.map +1 -0
  631. package/node_modules/@agentclientprotocol/sdk/dist/acp.test.d.ts +1 -0
  632. package/node_modules/@agentclientprotocol/sdk/dist/acp.test.js +5093 -0
  633. package/node_modules/@agentclientprotocol/sdk/dist/acp.test.js.map +1 -0
  634. package/node_modules/@agentclientprotocol/sdk/dist/connection.d.ts +277 -0
  635. package/node_modules/@agentclientprotocol/sdk/dist/connection.js +898 -0
  636. package/node_modules/@agentclientprotocol/sdk/dist/connection.js.map +1 -0
  637. package/node_modules/@agentclientprotocol/sdk/dist/connection.test.d.ts +1 -0
  638. package/node_modules/@agentclientprotocol/sdk/dist/connection.test.js +666 -0
  639. package/node_modules/@agentclientprotocol/sdk/dist/connection.test.js.map +1 -0
  640. package/node_modules/@agentclientprotocol/sdk/dist/cookie-store.d.ts +26 -0
  641. package/node_modules/@agentclientprotocol/sdk/dist/cookie-store.js +96 -0
  642. package/node_modules/@agentclientprotocol/sdk/dist/cookie-store.js.map +1 -0
  643. package/node_modules/@agentclientprotocol/sdk/dist/cookie-store.test.d.ts +1 -0
  644. package/node_modules/@agentclientprotocol/sdk/dist/cookie-store.test.js +77 -0
  645. package/node_modules/@agentclientprotocol/sdk/dist/cookie-store.test.js.map +1 -0
  646. package/node_modules/@agentclientprotocol/sdk/dist/examples/agent.d.ts +2 -0
  647. package/node_modules/@agentclientprotocol/sdk/dist/examples/agent.js +232 -0
  648. package/node_modules/@agentclientprotocol/sdk/dist/examples/agent.js.map +1 -0
  649. package/node_modules/@agentclientprotocol/sdk/dist/examples/client.d.ts +2 -0
  650. package/node_modules/@agentclientprotocol/sdk/dist/examples/client.js +132 -0
  651. package/node_modules/@agentclientprotocol/sdk/dist/examples/client.js.map +1 -0
  652. package/node_modules/@agentclientprotocol/sdk/dist/examples/dual-version-agent.d.ts +9 -0
  653. package/node_modules/@agentclientprotocol/sdk/dist/examples/dual-version-agent.js +229 -0
  654. package/node_modules/@agentclientprotocol/sdk/dist/examples/dual-version-agent.js.map +1 -0
  655. package/node_modules/@agentclientprotocol/sdk/dist/examples/http-client.d.ts +2 -0
  656. package/node_modules/@agentclientprotocol/sdk/dist/examples/http-client.js +86 -0
  657. package/node_modules/@agentclientprotocol/sdk/dist/examples/http-client.js.map +1 -0
  658. package/node_modules/@agentclientprotocol/sdk/dist/examples/http-server.d.ts +2 -0
  659. package/node_modules/@agentclientprotocol/sdk/dist/examples/http-server.js +117 -0
  660. package/node_modules/@agentclientprotocol/sdk/dist/examples/http-server.js.map +1 -0
  661. package/node_modules/@agentclientprotocol/sdk/dist/examples/ws-client.d.ts +2 -0
  662. package/node_modules/@agentclientprotocol/sdk/dist/examples/ws-client.js +88 -0
  663. package/node_modules/@agentclientprotocol/sdk/dist/examples/ws-client.js.map +1 -0
  664. package/node_modules/@agentclientprotocol/sdk/dist/http-stream.d.ts +35 -0
  665. package/node_modules/@agentclientprotocol/sdk/dist/http-stream.js +473 -0
  666. package/node_modules/@agentclientprotocol/sdk/dist/http-stream.js.map +1 -0
  667. package/node_modules/@agentclientprotocol/sdk/dist/http-stream.test.d.ts +1 -0
  668. package/node_modules/@agentclientprotocol/sdk/dist/http-stream.test.js +1380 -0
  669. package/node_modules/@agentclientprotocol/sdk/dist/http-stream.test.js.map +1 -0
  670. package/node_modules/@agentclientprotocol/sdk/dist/jsonrpc.d.ts +604 -0
  671. package/node_modules/@agentclientprotocol/sdk/dist/jsonrpc.js +1082 -0
  672. package/node_modules/@agentclientprotocol/sdk/dist/jsonrpc.js.map +1 -0
  673. package/node_modules/@agentclientprotocol/sdk/dist/jsonrpc.test.d.ts +1 -0
  674. package/node_modules/@agentclientprotocol/sdk/dist/jsonrpc.test.js +917 -0
  675. package/node_modules/@agentclientprotocol/sdk/dist/jsonrpc.test.js.map +1 -0
  676. package/node_modules/@agentclientprotocol/sdk/dist/line-buffer.d.ts +24 -0
  677. package/node_modules/@agentclientprotocol/sdk/dist/line-buffer.js +71 -0
  678. package/node_modules/@agentclientprotocol/sdk/dist/line-buffer.js.map +1 -0
  679. package/node_modules/@agentclientprotocol/sdk/dist/line-buffer.test.d.ts +1 -0
  680. package/node_modules/@agentclientprotocol/sdk/dist/line-buffer.test.js +45 -0
  681. package/node_modules/@agentclientprotocol/sdk/dist/line-buffer.test.js.map +1 -0
  682. package/node_modules/@agentclientprotocol/sdk/dist/nes/acp.d.ts +563 -0
  683. package/node_modules/@agentclientprotocol/sdk/dist/nes/acp.js +106 -0
  684. package/node_modules/@agentclientprotocol/sdk/dist/nes/acp.js.map +1 -0
  685. package/node_modules/@agentclientprotocol/sdk/dist/nes/schema/types.gen.d.ts +1261 -0
  686. package/node_modules/@agentclientprotocol/sdk/dist/nes/schema/types.gen.js +4 -0
  687. package/node_modules/@agentclientprotocol/sdk/dist/nes/schema/types.gen.js.map +1 -0
  688. package/node_modules/@agentclientprotocol/sdk/dist/nes/schema/zod.gen.d.ts +962 -0
  689. package/node_modules/@agentclientprotocol/sdk/dist/nes/schema/zod.gen.js +526 -0
  690. package/node_modules/@agentclientprotocol/sdk/dist/nes/schema/zod.gen.js.map +1 -0
  691. package/node_modules/@agentclientprotocol/sdk/dist/node-adapter.d.ts +17 -0
  692. package/node_modules/@agentclientprotocol/sdk/dist/node-adapter.js +457 -0
  693. package/node_modules/@agentclientprotocol/sdk/dist/node-adapter.js.map +1 -0
  694. package/node_modules/@agentclientprotocol/sdk/dist/node-adapter.test.d.ts +1 -0
  695. package/node_modules/@agentclientprotocol/sdk/dist/node-adapter.test.js +586 -0
  696. package/node_modules/@agentclientprotocol/sdk/dist/node-adapter.test.js.map +1 -0
  697. package/node_modules/@agentclientprotocol/sdk/dist/protocol-router.d.ts +43 -0
  698. package/node_modules/@agentclientprotocol/sdk/dist/protocol-router.js +467 -0
  699. package/node_modules/@agentclientprotocol/sdk/dist/protocol-router.js.map +1 -0
  700. package/node_modules/@agentclientprotocol/sdk/dist/protocol-router.test.d.ts +1 -0
  701. package/node_modules/@agentclientprotocol/sdk/dist/protocol-router.test.js +592 -0
  702. package/node_modules/@agentclientprotocol/sdk/dist/protocol-router.test.js.map +1 -0
  703. package/node_modules/@agentclientprotocol/sdk/dist/protocol.d.ts +11 -0
  704. package/node_modules/@agentclientprotocol/sdk/dist/protocol.js +60 -0
  705. package/node_modules/@agentclientprotocol/sdk/dist/protocol.js.map +1 -0
  706. package/node_modules/@agentclientprotocol/sdk/dist/protocol.test.d.ts +1 -0
  707. package/node_modules/@agentclientprotocol/sdk/dist/protocol.test.js +72 -0
  708. package/node_modules/@agentclientprotocol/sdk/dist/protocol.test.js.map +1 -0
  709. package/node_modules/@agentclientprotocol/sdk/dist/schema/guards.gen.d.ts +305 -0
  710. package/node_modules/@agentclientprotocol/sdk/dist/schema/guards.gen.js +355 -0
  711. package/node_modules/@agentclientprotocol/sdk/dist/schema/guards.gen.js.map +1 -0
  712. package/node_modules/@agentclientprotocol/sdk/dist/schema/index.d.ts +39 -0
  713. package/node_modules/@agentclientprotocol/sdk/dist/schema/index.js +40 -0
  714. package/node_modules/@agentclientprotocol/sdk/dist/schema/index.js.map +1 -0
  715. package/node_modules/@agentclientprotocol/sdk/dist/schema/types.gen.d.ts +5438 -0
  716. package/node_modules/@agentclientprotocol/sdk/dist/schema/types.gen.js +3 -0
  717. package/node_modules/@agentclientprotocol/sdk/dist/schema/types.gen.js.map +1 -0
  718. package/node_modules/@agentclientprotocol/sdk/dist/schema/zod.gen.d.ts +15955 -0
  719. package/node_modules/@agentclientprotocol/sdk/dist/schema/zod.gen.js +2827 -0
  720. package/node_modules/@agentclientprotocol/sdk/dist/schema/zod.gen.js.map +1 -0
  721. package/node_modules/@agentclientprotocol/sdk/dist/schema-deserialize.d.ts +31 -0
  722. package/node_modules/@agentclientprotocol/sdk/dist/schema-deserialize.js +117 -0
  723. package/node_modules/@agentclientprotocol/sdk/dist/schema-deserialize.js.map +1 -0
  724. package/node_modules/@agentclientprotocol/sdk/dist/schema-deserialize.test.d.ts +1 -0
  725. package/node_modules/@agentclientprotocol/sdk/dist/schema-deserialize.test.js +93 -0
  726. package/node_modules/@agentclientprotocol/sdk/dist/schema-deserialize.test.js.map +1 -0
  727. package/node_modules/@agentclientprotocol/sdk/dist/server-permission.test.d.ts +1 -0
  728. package/node_modules/@agentclientprotocol/sdk/dist/server-permission.test.js +261 -0
  729. package/node_modules/@agentclientprotocol/sdk/dist/server-permission.test.js.map +1 -0
  730. package/node_modules/@agentclientprotocol/sdk/dist/server-session-sse.test.d.ts +1 -0
  731. package/node_modules/@agentclientprotocol/sdk/dist/server-session-sse.test.js +536 -0
  732. package/node_modules/@agentclientprotocol/sdk/dist/server-session-sse.test.js.map +1 -0
  733. package/node_modules/@agentclientprotocol/sdk/dist/server-sse.d.ts +7 -0
  734. package/node_modules/@agentclientprotocol/sdk/dist/server-sse.js +136 -0
  735. package/node_modules/@agentclientprotocol/sdk/dist/server-sse.js.map +1 -0
  736. package/node_modules/@agentclientprotocol/sdk/dist/server-sse.test.d.ts +1 -0
  737. package/node_modules/@agentclientprotocol/sdk/dist/server-sse.test.js +106 -0
  738. package/node_modules/@agentclientprotocol/sdk/dist/server-sse.test.js.map +1 -0
  739. package/node_modules/@agentclientprotocol/sdk/dist/server-websocket-upgrade.test.d.ts +1 -0
  740. package/node_modules/@agentclientprotocol/sdk/dist/server-websocket-upgrade.test.js +1310 -0
  741. package/node_modules/@agentclientprotocol/sdk/dist/server-websocket-upgrade.test.js.map +1 -0
  742. package/node_modules/@agentclientprotocol/sdk/dist/server.d.ts +82 -0
  743. package/node_modules/@agentclientprotocol/sdk/dist/server.js +414 -0
  744. package/node_modules/@agentclientprotocol/sdk/dist/server.js.map +1 -0
  745. package/node_modules/@agentclientprotocol/sdk/dist/server.test.d.ts +1 -0
  746. package/node_modules/@agentclientprotocol/sdk/dist/server.test.js +1646 -0
  747. package/node_modules/@agentclientprotocol/sdk/dist/server.test.js.map +1 -0
  748. package/node_modules/@agentclientprotocol/sdk/dist/sse.d.ts +6 -0
  749. package/node_modules/@agentclientprotocol/sdk/dist/sse.js +114 -0
  750. package/node_modules/@agentclientprotocol/sdk/dist/sse.js.map +1 -0
  751. package/node_modules/@agentclientprotocol/sdk/dist/sse.test.d.ts +1 -0
  752. package/node_modules/@agentclientprotocol/sdk/dist/sse.test.js +126 -0
  753. package/node_modules/@agentclientprotocol/sdk/dist/sse.test.js.map +1 -0
  754. package/node_modules/@agentclientprotocol/sdk/dist/stream-limits.d.ts +15 -0
  755. package/node_modules/@agentclientprotocol/sdk/dist/stream-limits.js +58 -0
  756. package/node_modules/@agentclientprotocol/sdk/dist/stream-limits.js.map +1 -0
  757. package/node_modules/@agentclientprotocol/sdk/dist/stream.d.ts +38 -0
  758. package/node_modules/@agentclientprotocol/sdk/dist/stream.js +119 -0
  759. package/node_modules/@agentclientprotocol/sdk/dist/stream.js.map +1 -0
  760. package/node_modules/@agentclientprotocol/sdk/dist/stream.test.d.ts +1 -0
  761. package/node_modules/@agentclientprotocol/sdk/dist/stream.test.js +195 -0
  762. package/node_modules/@agentclientprotocol/sdk/dist/stream.test.js.map +1 -0
  763. package/node_modules/@agentclientprotocol/sdk/dist/test-support/streams.d.ts +8 -0
  764. package/node_modules/@agentclientprotocol/sdk/dist/test-support/streams.js +51 -0
  765. package/node_modules/@agentclientprotocol/sdk/dist/test-support/streams.js.map +1 -0
  766. package/node_modules/@agentclientprotocol/sdk/dist/test-support/test-agent.d.ts +24 -0
  767. package/node_modules/@agentclientprotocol/sdk/dist/test-support/test-agent.js +163 -0
  768. package/node_modules/@agentclientprotocol/sdk/dist/test-support/test-agent.js.map +1 -0
  769. package/node_modules/@agentclientprotocol/sdk/dist/test-support/test-http-server.d.ts +9 -0
  770. package/node_modules/@agentclientprotocol/sdk/dist/test-support/test-http-server.js +74 -0
  771. package/node_modules/@agentclientprotocol/sdk/dist/test-support/test-http-server.js.map +1 -0
  772. package/node_modules/@agentclientprotocol/sdk/dist/test-support/until.d.ts +5 -0
  773. package/node_modules/@agentclientprotocol/sdk/dist/test-support/until.js +14 -0
  774. package/node_modules/@agentclientprotocol/sdk/dist/test-support/until.js.map +1 -0
  775. package/node_modules/@agentclientprotocol/sdk/dist/v2/acp.d.ts +961 -0
  776. package/node_modules/@agentclientprotocol/sdk/dist/v2/acp.js +1451 -0
  777. package/node_modules/@agentclientprotocol/sdk/dist/v2/acp.js.map +1 -0
  778. package/node_modules/@agentclientprotocol/sdk/dist/v2/acp.test.d.ts +1 -0
  779. package/node_modules/@agentclientprotocol/sdk/dist/v2/acp.test.js +1423 -0
  780. package/node_modules/@agentclientprotocol/sdk/dist/v2/acp.test.js.map +1 -0
  781. package/node_modules/@agentclientprotocol/sdk/dist/v2/schema/guards.gen.d.ts +1084 -0
  782. package/node_modules/@agentclientprotocol/sdk/dist/v2/schema/guards.gen.js +1157 -0
  783. package/node_modules/@agentclientprotocol/sdk/dist/v2/schema/guards.gen.js.map +1 -0
  784. package/node_modules/@agentclientprotocol/sdk/dist/v2/schema/index.d.ts +30 -0
  785. package/node_modules/@agentclientprotocol/sdk/dist/v2/schema/index.js +31 -0
  786. package/node_modules/@agentclientprotocol/sdk/dist/v2/schema/index.js.map +1 -0
  787. package/node_modules/@agentclientprotocol/sdk/dist/v2/schema/types.gen.d.ts +5672 -0
  788. package/node_modules/@agentclientprotocol/sdk/dist/v2/schema/types.gen.js +3 -0
  789. package/node_modules/@agentclientprotocol/sdk/dist/v2/schema/types.gen.js.map +1 -0
  790. package/node_modules/@agentclientprotocol/sdk/dist/v2/schema/zod.gen.d.ts +37653 -0
  791. package/node_modules/@agentclientprotocol/sdk/dist/v2/schema/zod.gen.js +2952 -0
  792. package/node_modules/@agentclientprotocol/sdk/dist/v2/schema/zod.gen.js.map +1 -0
  793. package/node_modules/@agentclientprotocol/sdk/dist/ws-server.d.ts +14 -0
  794. package/node_modules/@agentclientprotocol/sdk/dist/ws-server.js +485 -0
  795. package/node_modules/@agentclientprotocol/sdk/dist/ws-server.js.map +1 -0
  796. package/node_modules/@agentclientprotocol/sdk/dist/ws-stream.d.ts +54 -0
  797. package/node_modules/@agentclientprotocol/sdk/dist/ws-stream.js +253 -0
  798. package/node_modules/@agentclientprotocol/sdk/dist/ws-stream.js.map +1 -0
  799. package/node_modules/@agentclientprotocol/sdk/dist/ws-stream.test.d.ts +1 -0
  800. package/node_modules/@agentclientprotocol/sdk/dist/ws-stream.test.js +836 -0
  801. package/node_modules/@agentclientprotocol/sdk/dist/ws-stream.test.js.map +1 -0
  802. package/node_modules/@agentclientprotocol/sdk/dist/ws-utils.d.ts +19 -0
  803. package/node_modules/@agentclientprotocol/sdk/dist/ws-utils.js +78 -0
  804. package/node_modules/@agentclientprotocol/sdk/dist/ws-utils.js.map +1 -0
  805. package/node_modules/@agentclientprotocol/sdk/dist/ws-utils.test.d.ts +1 -0
  806. package/node_modules/@agentclientprotocol/sdk/dist/ws-utils.test.js +42 -0
  807. package/node_modules/@agentclientprotocol/sdk/dist/ws-utils.test.js.map +1 -0
  808. package/node_modules/@agentclientprotocol/sdk/package.json +110 -0
  809. package/node_modules/@agentclientprotocol/sdk/schema/schema.json +7852 -0
  810. package/node_modules/@agentclientprotocol/sdk/schema/v2/schema.unstable.json +8814 -0
  811. package/node_modules/@clack/core/LICENSE +9 -0
  812. package/node_modules/@clack/core/README.md +22 -0
  813. package/node_modules/@clack/core/dist/index.d.mts +503 -0
  814. package/node_modules/@clack/core/dist/index.mjs +1003 -0
  815. package/node_modules/@clack/core/package.json +63 -0
  816. package/node_modules/@clack/prompts/LICENSE +9 -0
  817. package/node_modules/@clack/prompts/README.md +396 -0
  818. package/node_modules/@clack/prompts/dist/index.d.mts +949 -0
  819. package/node_modules/@clack/prompts/dist/index.mjs +1423 -0
  820. package/node_modules/@clack/prompts/package.json +67 -0
  821. package/node_modules/acpx/LICENSE +21 -0
  822. package/node_modules/acpx/README.md +424 -0
  823. package/node_modules/acpx/dist/cli-CxsS1XQp.js +197 -0
  824. package/node_modules/acpx/dist/cli-CxsS1XQp.js.map +1 -0
  825. package/node_modules/acpx/dist/cli.d.ts +14 -0
  826. package/node_modules/acpx/dist/cli.d.ts.map +1 -0
  827. package/node_modules/acpx/dist/cli.js +2683 -0
  828. package/node_modules/acpx/dist/cli.js.map +1 -0
  829. package/node_modules/acpx/dist/client-DwNyFauq.d.ts +192 -0
  830. package/node_modules/acpx/dist/client-DwNyFauq.d.ts.map +1 -0
  831. package/node_modules/acpx/dist/flags-Bjq_XQ4-.js +260 -0
  832. package/node_modules/acpx/dist/flags-Bjq_XQ4-.js.map +1 -0
  833. package/node_modules/acpx/dist/flows-Db_LZKu9.js +1920 -0
  834. package/node_modules/acpx/dist/flows-Db_LZKu9.js.map +1 -0
  835. package/node_modules/acpx/dist/flows.d.ts +318 -0
  836. package/node_modules/acpx/dist/flows.d.ts.map +1 -0
  837. package/node_modules/acpx/dist/flows.js +2 -0
  838. package/node_modules/acpx/dist/live-checkpoint-ClPCSdrW.js +6214 -0
  839. package/node_modules/acpx/dist/live-checkpoint-ClPCSdrW.js.map +1 -0
  840. package/node_modules/acpx/dist/output-CjdF5rHk.js +4593 -0
  841. package/node_modules/acpx/dist/output-CjdF5rHk.js.map +1 -0
  842. package/node_modules/acpx/dist/runtime.d.ts +472 -0
  843. package/node_modules/acpx/dist/runtime.d.ts.map +1 -0
  844. package/node_modules/acpx/dist/runtime.js +1711 -0
  845. package/node_modules/acpx/dist/runtime.js.map +1 -0
  846. package/node_modules/acpx/dist/session-options-jkYbBxGE.d.ts +278 -0
  847. package/node_modules/acpx/dist/session-options-jkYbBxGE.d.ts.map +1 -0
  848. package/node_modules/acpx/package.json +129 -0
  849. package/node_modules/acpx/skills/acpx/SKILL.md +617 -0
  850. package/node_modules/b4a/LICENSE +201 -0
  851. package/node_modules/b4a/README.md +153 -0
  852. package/node_modules/b4a/browser.js +546 -0
  853. package/node_modules/b4a/index.d.ts +144 -0
  854. package/node_modules/b4a/index.js +193 -0
  855. package/node_modules/b4a/lib/ascii.js +31 -0
  856. package/node_modules/b4a/lib/base64.js +64 -0
  857. package/node_modules/b4a/lib/hex.js +51 -0
  858. package/node_modules/b4a/lib/latin1.js +31 -0
  859. package/node_modules/b4a/lib/utf16le.js +40 -0
  860. package/node_modules/b4a/lib/utf8.js +144 -0
  861. package/node_modules/b4a/package.json +54 -0
  862. package/node_modules/b4a/react-native.js +5 -0
  863. package/node_modules/b4a/runtime.d.ts +14 -0
  864. package/node_modules/bare-buffer/CMakeLists.txt +30 -0
  865. package/node_modules/bare-buffer/LICENSE +201 -0
  866. package/node_modules/bare-buffer/README.md +26 -0
  867. package/node_modules/bare-buffer/binding.c +2041 -0
  868. package/node_modules/bare-buffer/binding.js +1 -0
  869. package/node_modules/bare-buffer/global.d.ts +21 -0
  870. package/node_modules/bare-buffer/global.js +6 -0
  871. package/node_modules/bare-buffer/index.d.ts +769 -0
  872. package/node_modules/bare-buffer/index.js +1339 -0
  873. package/node_modules/bare-buffer/lib/ascii.js +36 -0
  874. package/node_modules/bare-buffer/lib/base64.js +25 -0
  875. package/node_modules/bare-buffer/lib/base64url.js +25 -0
  876. package/node_modules/bare-buffer/lib/checked.js +23 -0
  877. package/node_modules/bare-buffer/lib/constants.d.ts +7 -0
  878. package/node_modules/bare-buffer/lib/constants.js +3 -0
  879. package/node_modules/bare-buffer/lib/hex.js +20 -0
  880. package/node_modules/bare-buffer/lib/latin1.js +14 -0
  881. package/node_modules/bare-buffer/lib/utf16le.js +20 -0
  882. package/node_modules/bare-buffer/lib/utf8.js +18 -0
  883. package/node_modules/bare-buffer/package.json +59 -0
  884. package/node_modules/bare-buffer/prebuilds/android-arm/bare-buffer.bare +0 -0
  885. package/node_modules/bare-buffer/prebuilds/android-arm64/bare-buffer.bare +0 -0
  886. package/node_modules/bare-buffer/prebuilds/android-ia32/bare-buffer.bare +0 -0
  887. package/node_modules/bare-buffer/prebuilds/android-x64/bare-buffer.bare +0 -0
  888. package/node_modules/bare-buffer/prebuilds/darwin-arm64/bare-buffer.bare +0 -0
  889. package/node_modules/bare-buffer/prebuilds/darwin-x64/bare-buffer.bare +0 -0
  890. package/node_modules/bare-buffer/prebuilds/ios-arm64/bare-buffer.bare +0 -0
  891. package/node_modules/bare-buffer/prebuilds/ios-arm64-simulator/bare-buffer.bare +0 -0
  892. package/node_modules/bare-buffer/prebuilds/ios-x64-simulator/bare-buffer.bare +0 -0
  893. package/node_modules/bare-buffer/prebuilds/linux-arm64/bare-buffer.bare +0 -0
  894. package/node_modules/bare-buffer/prebuilds/linux-x64/bare-buffer.bare +0 -0
  895. package/node_modules/bare-buffer/prebuilds/win32-arm64/bare-buffer.bare +0 -0
  896. package/node_modules/bare-buffer/prebuilds/win32-x64/bare-buffer.bare +0 -0
  897. package/node_modules/bare-events/LICENSE +201 -0
  898. package/node_modules/bare-events/README.md +25 -0
  899. package/node_modules/bare-events/global.d.ts +15 -0
  900. package/node_modules/bare-events/global.js +5 -0
  901. package/node_modules/bare-events/index.d.ts +89 -0
  902. package/node_modules/bare-events/index.js +397 -0
  903. package/node_modules/bare-events/lib/errors.js +23 -0
  904. package/node_modules/bare-events/package.json +63 -0
  905. package/node_modules/bare-events/web.d.ts +79 -0
  906. package/node_modules/bare-events/web.js +417 -0
  907. package/node_modules/bare-fs/CMakeLists.txt +13 -0
  908. package/node_modules/bare-fs/LICENSE +201 -0
  909. package/node_modules/bare-fs/README.md +33 -0
  910. package/node_modules/bare-fs/binding.c +2942 -0
  911. package/node_modules/bare-fs/binding.js +1 -0
  912. package/node_modules/bare-fs/index.d.ts +1504 -0
  913. package/node_modules/bare-fs/index.js +2888 -0
  914. package/node_modules/bare-fs/lib/constants.d.ts +50 -0
  915. package/node_modules/bare-fs/lib/constants.js +49 -0
  916. package/node_modules/bare-fs/lib/errors.d.ts +13 -0
  917. package/node_modules/bare-fs/lib/errors.js +55 -0
  918. package/node_modules/bare-fs/package.json +75 -0
  919. package/node_modules/bare-fs/prebuilds/android-arm/bare-fs.bare +0 -0
  920. package/node_modules/bare-fs/prebuilds/android-arm64/bare-fs.bare +0 -0
  921. package/node_modules/bare-fs/prebuilds/android-ia32/bare-fs.bare +0 -0
  922. package/node_modules/bare-fs/prebuilds/android-x64/bare-fs.bare +0 -0
  923. package/node_modules/bare-fs/prebuilds/darwin-arm64/bare-fs.bare +0 -0
  924. package/node_modules/bare-fs/prebuilds/darwin-x64/bare-fs.bare +0 -0
  925. package/node_modules/bare-fs/prebuilds/ios-arm64/bare-fs.bare +0 -0
  926. package/node_modules/bare-fs/prebuilds/ios-arm64-simulator/bare-fs.bare +0 -0
  927. package/node_modules/bare-fs/prebuilds/ios-x64-simulator/bare-fs.bare +0 -0
  928. package/node_modules/bare-fs/prebuilds/linux-arm64/bare-fs.bare +0 -0
  929. package/node_modules/bare-fs/prebuilds/linux-x64/bare-fs.bare +0 -0
  930. package/node_modules/bare-fs/prebuilds/win32-arm64/bare-fs.bare +0 -0
  931. package/node_modules/bare-fs/prebuilds/win32-x64/bare-fs.bare +0 -0
  932. package/node_modules/bare-fs/promises.d.ts +480 -0
  933. package/node_modules/bare-fs/promises.js +119 -0
  934. package/node_modules/bare-path/CMakeLists.txt +13 -0
  935. package/node_modules/bare-path/LICENSE +201 -0
  936. package/node_modules/bare-path/NOTICE +28 -0
  937. package/node_modules/bare-path/README.md +19 -0
  938. package/node_modules/bare-path/binding.c +106 -0
  939. package/node_modules/bare-path/binding.js +1 -0
  940. package/node_modules/bare-path/index.d.ts +27 -0
  941. package/node_modules/bare-path/index.js +9 -0
  942. package/node_modules/bare-path/lib/constants.js +11 -0
  943. package/node_modules/bare-path/lib/posix.js +263 -0
  944. package/node_modules/bare-path/lib/shared.js +81 -0
  945. package/node_modules/bare-path/lib/win32.js +564 -0
  946. package/node_modules/bare-path/package.json +47 -0
  947. package/node_modules/bare-path/prebuilds/android-arm/bare-path.bare +0 -0
  948. package/node_modules/bare-path/prebuilds/android-arm64/bare-path.bare +0 -0
  949. package/node_modules/bare-path/prebuilds/android-ia32/bare-path.bare +0 -0
  950. package/node_modules/bare-path/prebuilds/android-x64/bare-path.bare +0 -0
  951. package/node_modules/bare-path/prebuilds/darwin-arm64/bare-path.bare +0 -0
  952. package/node_modules/bare-path/prebuilds/darwin-x64/bare-path.bare +0 -0
  953. package/node_modules/bare-path/prebuilds/ios-arm64/bare-path.bare +0 -0
  954. package/node_modules/bare-path/prebuilds/ios-arm64-simulator/bare-path.bare +0 -0
  955. package/node_modules/bare-path/prebuilds/ios-x64-simulator/bare-path.bare +0 -0
  956. package/node_modules/bare-path/prebuilds/linux-arm64/bare-path.bare +0 -0
  957. package/node_modules/bare-path/prebuilds/linux-x64/bare-path.bare +0 -0
  958. package/node_modules/bare-path/prebuilds/win32-arm64/bare-path.bare +0 -0
  959. package/node_modules/bare-path/prebuilds/win32-x64/bare-path.bare +0 -0
  960. package/node_modules/bare-stream/LICENSE +201 -0
  961. package/node_modules/bare-stream/README.md +354 -0
  962. package/node_modules/bare-stream/global.d.ts +31 -0
  963. package/node_modules/bare-stream/global.js +15 -0
  964. package/node_modules/bare-stream/index.d.ts +235 -0
  965. package/node_modules/bare-stream/index.js +493 -0
  966. package/node_modules/bare-stream/package.json +75 -0
  967. package/node_modules/bare-stream/promises.js +3 -0
  968. package/node_modules/bare-stream/web.d.ts +152 -0
  969. package/node_modules/bare-stream/web.js +607 -0
  970. package/node_modules/bare-url/CMakeLists.txt +36 -0
  971. package/node_modules/bare-url/LICENSE +201 -0
  972. package/node_modules/bare-url/README.md +37 -0
  973. package/node_modules/bare-url/binding.c +422 -0
  974. package/node_modules/bare-url/binding.js +1 -0
  975. package/node_modules/bare-url/global.d.ts +24 -0
  976. package/node_modules/bare-url/global.js +2 -0
  977. package/node_modules/bare-url/index.d.ts +99 -0
  978. package/node_modules/bare-url/index.js +700 -0
  979. package/node_modules/bare-url/lib/errors.d.ts +10 -0
  980. package/node_modules/bare-url/lib/errors.js +37 -0
  981. package/node_modules/bare-url/lib/url-search-params.d.ts +66 -0
  982. package/node_modules/bare-url/lib/url-search-params.js +291 -0
  983. package/node_modules/bare-url/package.json +55 -0
  984. package/node_modules/bare-url/prebuilds/android-arm/bare-url.bare +0 -0
  985. package/node_modules/bare-url/prebuilds/android-arm64/bare-url.bare +0 -0
  986. package/node_modules/bare-url/prebuilds/android-ia32/bare-url.bare +0 -0
  987. package/node_modules/bare-url/prebuilds/android-x64/bare-url.bare +0 -0
  988. package/node_modules/bare-url/prebuilds/darwin-arm64/bare-url.bare +0 -0
  989. package/node_modules/bare-url/prebuilds/darwin-x64/bare-url.bare +0 -0
  990. package/node_modules/bare-url/prebuilds/ios-arm64/bare-url.bare +0 -0
  991. package/node_modules/bare-url/prebuilds/ios-arm64-simulator/bare-url.bare +0 -0
  992. package/node_modules/bare-url/prebuilds/ios-x64-simulator/bare-url.bare +0 -0
  993. package/node_modules/bare-url/prebuilds/linux-arm64/bare-url.bare +0 -0
  994. package/node_modules/bare-url/prebuilds/linux-x64/bare-url.bare +0 -0
  995. package/node_modules/bare-url/prebuilds/win32-arm64/bare-url.bare +0 -0
  996. package/node_modules/bare-url/prebuilds/win32-x64/bare-url.bare +0 -0
  997. package/node_modules/commander/LICENSE +22 -0
  998. package/node_modules/commander/Readme.md +1146 -0
  999. package/node_modules/commander/index.js +21 -0
  1000. package/node_modules/commander/lib/argument.js +147 -0
  1001. package/node_modules/commander/lib/command.js +2803 -0
  1002. package/node_modules/commander/lib/error.js +36 -0
  1003. package/node_modules/commander/lib/help.js +735 -0
  1004. package/node_modules/commander/lib/option.js +377 -0
  1005. package/node_modules/commander/lib/suggestSimilar.js +99 -0
  1006. package/node_modules/commander/package-support.json +19 -0
  1007. package/node_modules/commander/package.json +65 -0
  1008. package/node_modules/commander/typings/index.d.ts +1116 -0
  1009. package/node_modules/esbuild/LICENSE.md +21 -0
  1010. package/node_modules/esbuild/README.md +3 -0
  1011. package/node_modules/esbuild/bin/esbuild +223 -0
  1012. package/node_modules/esbuild/install.js +300 -0
  1013. package/node_modules/esbuild/lib/main.d.ts +720 -0
  1014. package/node_modules/esbuild/lib/main.js +2536 -0
  1015. package/node_modules/esbuild/package.json +74 -0
  1016. package/node_modules/events-universal/LICENSE +201 -0
  1017. package/node_modules/events-universal/README.md +17 -0
  1018. package/node_modules/events-universal/bare.js +1 -0
  1019. package/node_modules/events-universal/default.js +1 -0
  1020. package/node_modules/events-universal/index.js +1 -0
  1021. package/node_modules/events-universal/package.json +39 -0
  1022. package/node_modules/events-universal/react-native.js +1 -0
  1023. package/node_modules/fast-fifo/LICENSE +21 -0
  1024. package/node_modules/fast-fifo/README.md +78 -0
  1025. package/node_modules/fast-fifo/fixed-size.js +39 -0
  1026. package/node_modules/fast-fifo/index.js +48 -0
  1027. package/node_modules/fast-fifo/package.json +28 -0
  1028. package/node_modules/fast-string-truncated-width/dist/index.d.ts +4 -0
  1029. package/node_modules/fast-string-truncated-width/dist/index.js +111 -0
  1030. package/node_modules/fast-string-truncated-width/dist/types.d.ts +19 -0
  1031. package/node_modules/fast-string-truncated-width/dist/types.js +2 -0
  1032. package/node_modules/fast-string-truncated-width/dist/utils.d.ts +4 -0
  1033. package/node_modules/fast-string-truncated-width/dist/utils.js +20 -0
  1034. package/node_modules/fast-string-truncated-width/license +21 -0
  1035. package/node_modules/fast-string-truncated-width/package.json +35 -0
  1036. package/node_modules/fast-string-truncated-width/readme.md +59 -0
  1037. package/node_modules/fast-string-width/dist/index.d.ts +4 -0
  1038. package/node_modules/fast-string-width/dist/index.js +14 -0
  1039. package/node_modules/fast-string-width/license +21 -0
  1040. package/node_modules/fast-string-width/package.json +34 -0
  1041. package/node_modules/fast-string-width/readme.md +42 -0
  1042. package/node_modules/fast-wrap-ansi/LICENSE +23 -0
  1043. package/node_modules/fast-wrap-ansi/README.md +26 -0
  1044. package/node_modules/fast-wrap-ansi/lib/main.d.ts +6 -0
  1045. package/node_modules/fast-wrap-ansi/lib/main.js +218 -0
  1046. package/node_modules/fast-wrap-ansi/package.json +51 -0
  1047. package/node_modules/sisteransi/license +21 -0
  1048. package/node_modules/sisteransi/package.json +34 -0
  1049. package/node_modules/sisteransi/readme.md +113 -0
  1050. package/node_modules/sisteransi/src/index.js +58 -0
  1051. package/node_modules/sisteransi/src/sisteransi.d.ts +35 -0
  1052. package/node_modules/skillflag/LICENSE +21 -0
  1053. package/node_modules/skillflag/README.md +44 -0
  1054. package/node_modules/skillflag/dist/bin/skill-install.d.ts +3 -0
  1055. package/node_modules/skillflag/dist/bin/skill-install.d.ts.map +1 -0
  1056. package/node_modules/skillflag/dist/bin/skill-install.js +6 -0
  1057. package/node_modules/skillflag/dist/bin/skill-install.js.map +1 -0
  1058. package/node_modules/skillflag/dist/bin/skillflag.d.ts +3 -0
  1059. package/node_modules/skillflag/dist/bin/skillflag.d.ts.map +1 -0
  1060. package/node_modules/skillflag/dist/bin/skillflag.js +25 -0
  1061. package/node_modules/skillflag/dist/bin/skillflag.js.map +1 -0
  1062. package/node_modules/skillflag/dist/core/digest.d.ts +2 -0
  1063. package/node_modules/skillflag/dist/core/digest.d.ts.map +1 -0
  1064. package/node_modules/skillflag/dist/core/digest.js +15 -0
  1065. package/node_modules/skillflag/dist/core/digest.js.map +1 -0
  1066. package/node_modules/skillflag/dist/core/errors.d.ts +6 -0
  1067. package/node_modules/skillflag/dist/core/errors.d.ts.map +1 -0
  1068. package/node_modules/skillflag/dist/core/errors.js +13 -0
  1069. package/node_modules/skillflag/dist/core/errors.js.map +1 -0
  1070. package/node_modules/skillflag/dist/core/export.d.ts +2 -0
  1071. package/node_modules/skillflag/dist/core/export.d.ts.map +1 -0
  1072. package/node_modules/skillflag/dist/core/export.js +28 -0
  1073. package/node_modules/skillflag/dist/core/export.js.map +1 -0
  1074. package/node_modules/skillflag/dist/core/list.d.ts +21 -0
  1075. package/node_modules/skillflag/dist/core/list.d.ts.map +1 -0
  1076. package/node_modules/skillflag/dist/core/list.js +71 -0
  1077. package/node_modules/skillflag/dist/core/list.js.map +1 -0
  1078. package/node_modules/skillflag/dist/core/paths.d.ts +15 -0
  1079. package/node_modules/skillflag/dist/core/paths.d.ts.map +1 -0
  1080. package/node_modules/skillflag/dist/core/paths.js +149 -0
  1081. package/node_modules/skillflag/dist/core/paths.js.map +1 -0
  1082. package/node_modules/skillflag/dist/core/show.d.ts +2 -0
  1083. package/node_modules/skillflag/dist/core/show.d.ts.map +1 -0
  1084. package/node_modules/skillflag/dist/core/show.js +8 -0
  1085. package/node_modules/skillflag/dist/core/show.js.map +1 -0
  1086. package/node_modules/skillflag/dist/core/skillflag.d.ts +3 -0
  1087. package/node_modules/skillflag/dist/core/skillflag.d.ts.map +1 -0
  1088. package/node_modules/skillflag/dist/core/skillflag.js +2 -0
  1089. package/node_modules/skillflag/dist/core/skillflag.js.map +1 -0
  1090. package/node_modules/skillflag/dist/core/tar.d.ts +16 -0
  1091. package/node_modules/skillflag/dist/core/tar.d.ts.map +1 -0
  1092. package/node_modules/skillflag/dist/core/tar.js +140 -0
  1093. package/node_modules/skillflag/dist/core/tar.js.map +1 -0
  1094. package/node_modules/skillflag/dist/index.d.ts +5 -0
  1095. package/node_modules/skillflag/dist/index.d.ts.map +1 -0
  1096. package/node_modules/skillflag/dist/index.js +3 -0
  1097. package/node_modules/skillflag/dist/index.js.map +1 -0
  1098. package/node_modules/skillflag/dist/install/cli.d.ts +57 -0
  1099. package/node_modules/skillflag/dist/install/cli.d.ts.map +1 -0
  1100. package/node_modules/skillflag/dist/install/cli.js +653 -0
  1101. package/node_modules/skillflag/dist/install/cli.js.map +1 -0
  1102. package/node_modules/skillflag/dist/install/copy.d.ts +2 -0
  1103. package/node_modules/skillflag/dist/install/copy.d.ts.map +1 -0
  1104. package/node_modules/skillflag/dist/install/copy.js +19 -0
  1105. package/node_modules/skillflag/dist/install/copy.js.map +1 -0
  1106. package/node_modules/skillflag/dist/install/errors.d.ts +6 -0
  1107. package/node_modules/skillflag/dist/install/errors.d.ts.map +1 -0
  1108. package/node_modules/skillflag/dist/install/errors.js +13 -0
  1109. package/node_modules/skillflag/dist/install/errors.js.map +1 -0
  1110. package/node_modules/skillflag/dist/install/extract.d.ts +3 -0
  1111. package/node_modules/skillflag/dist/install/extract.d.ts.map +1 -0
  1112. package/node_modules/skillflag/dist/install/extract.js +76 -0
  1113. package/node_modules/skillflag/dist/install/extract.js.map +1 -0
  1114. package/node_modules/skillflag/dist/install/install.d.ts +21 -0
  1115. package/node_modules/skillflag/dist/install/install.d.ts.map +1 -0
  1116. package/node_modules/skillflag/dist/install/install.js +35 -0
  1117. package/node_modules/skillflag/dist/install/install.js.map +1 -0
  1118. package/node_modules/skillflag/dist/install/resolve.d.ts +12 -0
  1119. package/node_modules/skillflag/dist/install/resolve.d.ts.map +1 -0
  1120. package/node_modules/skillflag/dist/install/resolve.js +119 -0
  1121. package/node_modules/skillflag/dist/install/resolve.js.map +1 -0
  1122. package/node_modules/skillflag/dist/install/validate.d.ts +7 -0
  1123. package/node_modules/skillflag/dist/install/validate.d.ts.map +1 -0
  1124. package/node_modules/skillflag/dist/install/validate.js +28 -0
  1125. package/node_modules/skillflag/dist/install/validate.js.map +1 -0
  1126. package/node_modules/skillflag/dist/shared/frontmatter.d.ts +2 -0
  1127. package/node_modules/skillflag/dist/shared/frontmatter.d.ts.map +1 -0
  1128. package/node_modules/skillflag/dist/shared/frontmatter.js +28 -0
  1129. package/node_modules/skillflag/dist/shared/frontmatter.js.map +1 -0
  1130. package/node_modules/skillflag/dist/skillflag.d.ts +29 -0
  1131. package/node_modules/skillflag/dist/skillflag.d.ts.map +1 -0
  1132. package/node_modules/skillflag/dist/skillflag.js +230 -0
  1133. package/node_modules/skillflag/dist/skillflag.js.map +1 -0
  1134. package/node_modules/skillflag/dist/utils/collections.d.ts +3 -0
  1135. package/node_modules/skillflag/dist/utils/collections.d.ts.map +1 -0
  1136. package/node_modules/skillflag/dist/utils/collections.js +18 -0
  1137. package/node_modules/skillflag/dist/utils/collections.js.map +1 -0
  1138. package/node_modules/skillflag/package.json +78 -0
  1139. package/node_modules/skillflag/skills/skillflag/SKILL.md +144 -0
  1140. package/node_modules/streamx/LICENSE +21 -0
  1141. package/node_modules/streamx/README.md +550 -0
  1142. package/node_modules/streamx/index.d.ts +198 -0
  1143. package/node_modules/streamx/index.js +1314 -0
  1144. package/node_modules/streamx/lib/errors.d.ts +13 -0
  1145. package/node_modules/streamx/lib/errors.js +47 -0
  1146. package/node_modules/streamx/package.json +51 -0
  1147. package/node_modules/streamx/runtime.d.ts +55 -0
  1148. package/node_modules/tar-stream/LICENSE +21 -0
  1149. package/node_modules/tar-stream/README.md +183 -0
  1150. package/node_modules/tar-stream/constants.js +14 -0
  1151. package/node_modules/tar-stream/extract.js +418 -0
  1152. package/node_modules/tar-stream/headers.js +322 -0
  1153. package/node_modules/tar-stream/index.d.ts +60 -0
  1154. package/node_modules/tar-stream/index.js +2 -0
  1155. package/node_modules/tar-stream/pack.js +287 -0
  1156. package/node_modules/tar-stream/package.json +50 -0
  1157. package/node_modules/teex/LICENSE +21 -0
  1158. package/node_modules/teex/README.md +31 -0
  1159. package/node_modules/teex/example.js +16 -0
  1160. package/node_modules/teex/index.js +52 -0
  1161. package/node_modules/teex/package.json +26 -0
  1162. package/node_modules/teex/test.js +68 -0
  1163. package/node_modules/text-decoder/LICENSE +201 -0
  1164. package/node_modules/text-decoder/README.md +36 -0
  1165. package/node_modules/text-decoder/index.js +64 -0
  1166. package/node_modules/text-decoder/lib/pass-through-decoder.js +19 -0
  1167. package/node_modules/text-decoder/lib/utf8-decoder.js +185 -0
  1168. package/node_modules/text-decoder/package.json +39 -0
  1169. package/node_modules/tsx/LICENSE +21 -0
  1170. package/node_modules/tsx/README.md +32 -0
  1171. package/node_modules/tsx/dist/cjs/api/index.cjs +2 -0
  1172. package/node_modules/tsx/dist/cjs/api/index.d.cts +35 -0
  1173. package/node_modules/tsx/dist/cjs/api/index.d.mts +35 -0
  1174. package/node_modules/tsx/dist/cjs/api/index.mjs +2 -0
  1175. package/node_modules/tsx/dist/cjs/index.cjs +1 -0
  1176. package/node_modules/tsx/dist/cli.mjs +55 -0
  1177. package/node_modules/tsx/dist/client-XItNFmsq.cjs +1 -0
  1178. package/node_modules/tsx/dist/esm/api/index.cjs +2 -0
  1179. package/node_modules/tsx/dist/esm/api/index.d.cts +37 -0
  1180. package/node_modules/tsx/dist/esm/api/index.d.mts +37 -0
  1181. package/node_modules/tsx/dist/esm/api/index.mjs +2 -0
  1182. package/node_modules/tsx/dist/esm/index.mjs +2 -0
  1183. package/node_modules/tsx/dist/index-Bqjv9TxC.mjs +1 -0
  1184. package/node_modules/tsx/dist/index-DE3OBZuV.mjs +14 -0
  1185. package/node_modules/tsx/dist/lexer-CGfpMDSb.cjs +3 -0
  1186. package/node_modules/tsx/dist/lexer-CanA6ArK.mjs +3 -0
  1187. package/node_modules/tsx/dist/loader.mjs +2 -0
  1188. package/node_modules/tsx/dist/package-Dj0mHsMt.mjs +1 -0
  1189. package/node_modules/tsx/dist/patch-repl.cjs +1 -0
  1190. package/node_modules/tsx/dist/preflight.cjs +1 -0
  1191. package/node_modules/tsx/dist/register-B1c7OH6V.cjs +23 -0
  1192. package/node_modules/tsx/dist/register-nyXW-TH3.mjs +2 -0
  1193. package/node_modules/tsx/dist/repl.mjs +4 -0
  1194. package/node_modules/tsx/dist/require-CBjy4Foe.mjs +10 -0
  1195. package/node_modules/tsx/dist/require-CVaYn9z3.cjs +1 -0
  1196. package/node_modules/tsx/dist/suppress-warnings.cjs +1 -0
  1197. package/node_modules/tsx/dist/temporary-directory-Du7LpLp9.mjs +1 -0
  1198. package/node_modules/tsx/package.json +70 -0
  1199. package/node_modules/zod/LICENSE +21 -0
  1200. package/node_modules/zod/README.md +218 -0
  1201. package/node_modules/zod/compile.cjs +96 -0
  1202. package/node_modules/zod/compile.d.cts +1 -0
  1203. package/node_modules/zod/compile.d.ts +1 -0
  1204. package/node_modules/zod/compile.js +52 -0
  1205. package/node_modules/zod/index.cjs +52 -0
  1206. package/node_modules/zod/index.d.cts +3 -0
  1207. package/node_modules/zod/index.d.ts +3 -0
  1208. package/node_modules/zod/index.js +7 -0
  1209. package/node_modules/zod/locales/index.cjs +36 -0
  1210. package/node_modules/zod/locales/index.d.cts +1 -0
  1211. package/node_modules/zod/locales/index.d.ts +1 -0
  1212. package/node_modules/zod/locales/index.js +1 -0
  1213. package/node_modules/zod/locales/package.json +7 -0
  1214. package/node_modules/zod/mini/index.cjs +51 -0
  1215. package/node_modules/zod/mini/index.d.cts +3 -0
  1216. package/node_modules/zod/mini/index.d.ts +3 -0
  1217. package/node_modules/zod/mini/index.js +3 -0
  1218. package/node_modules/zod/mini/package.json +7 -0
  1219. package/node_modules/zod/package.json +147 -0
  1220. package/node_modules/zod/src/compile.ts +56 -0
  1221. package/node_modules/zod/src/index.ts +7 -0
  1222. package/node_modules/zod/src/locales/index.ts +1 -0
  1223. package/node_modules/zod/src/mini/index.ts +3 -0
  1224. package/node_modules/zod/src/v3/ZodError.ts +340 -0
  1225. package/node_modules/zod/src/v3/benchmarks/datetime.ts +58 -0
  1226. package/node_modules/zod/src/v3/benchmarks/discriminatedUnion.ts +80 -0
  1227. package/node_modules/zod/src/v3/benchmarks/index.ts +59 -0
  1228. package/node_modules/zod/src/v3/benchmarks/ipv4.ts +57 -0
  1229. package/node_modules/zod/src/v3/benchmarks/object.ts +69 -0
  1230. package/node_modules/zod/src/v3/benchmarks/primitives.ts +162 -0
  1231. package/node_modules/zod/src/v3/benchmarks/realworld.ts +63 -0
  1232. package/node_modules/zod/src/v3/benchmarks/string.ts +55 -0
  1233. package/node_modules/zod/src/v3/benchmarks/union.ts +80 -0
  1234. package/node_modules/zod/src/v3/errors.ts +13 -0
  1235. package/node_modules/zod/src/v3/external.ts +6 -0
  1236. package/node_modules/zod/src/v3/helpers/enumUtil.ts +17 -0
  1237. package/node_modules/zod/src/v3/helpers/errorUtil.ts +8 -0
  1238. package/node_modules/zod/src/v3/helpers/parseUtil.ts +176 -0
  1239. package/node_modules/zod/src/v3/helpers/partialUtil.ts +34 -0
  1240. package/node_modules/zod/src/v3/helpers/typeAliases.ts +2 -0
  1241. package/node_modules/zod/src/v3/helpers/util.ts +224 -0
  1242. package/node_modules/zod/src/v3/index.ts +4 -0
  1243. package/node_modules/zod/src/v3/locales/en.ts +124 -0
  1244. package/node_modules/zod/src/v3/standard-schema.ts +113 -0
  1245. package/node_modules/zod/src/v3/tests/Mocker.ts +54 -0
  1246. package/node_modules/zod/src/v3/tests/all-errors.test.ts +157 -0
  1247. package/node_modules/zod/src/v3/tests/anyunknown.test.ts +28 -0
  1248. package/node_modules/zod/src/v3/tests/array.test.ts +71 -0
  1249. package/node_modules/zod/src/v3/tests/async-parsing.test.ts +388 -0
  1250. package/node_modules/zod/src/v3/tests/async-refinements.test.ts +46 -0
  1251. package/node_modules/zod/src/v3/tests/base.test.ts +29 -0
  1252. package/node_modules/zod/src/v3/tests/bigint.test.ts +55 -0
  1253. package/node_modules/zod/src/v3/tests/branded.test.ts +53 -0
  1254. package/node_modules/zod/src/v3/tests/catch.test.ts +220 -0
  1255. package/node_modules/zod/src/v3/tests/coerce.test.ts +133 -0
  1256. package/node_modules/zod/src/v3/tests/complex.test.ts +70 -0
  1257. package/node_modules/zod/src/v3/tests/custom.test.ts +31 -0
  1258. package/node_modules/zod/src/v3/tests/date.test.ts +32 -0
  1259. package/node_modules/zod/src/v3/tests/deepmasking.test.ts +186 -0
  1260. package/node_modules/zod/src/v3/tests/default.test.ts +112 -0
  1261. package/node_modules/zod/src/v3/tests/description.test.ts +33 -0
  1262. package/node_modules/zod/src/v3/tests/discriminated-unions.test.ts +315 -0
  1263. package/node_modules/zod/src/v3/tests/enum.test.ts +80 -0
  1264. package/node_modules/zod/src/v3/tests/error.test.ts +586 -0
  1265. package/node_modules/zod/src/v3/tests/firstparty.test.ts +87 -0
  1266. package/node_modules/zod/src/v3/tests/firstpartyschematypes.test.ts +21 -0
  1267. package/node_modules/zod/src/v3/tests/function.test.ts +261 -0
  1268. package/node_modules/zod/src/v3/tests/generics.test.ts +48 -0
  1269. package/node_modules/zod/src/v3/tests/instanceof.test.ts +37 -0
  1270. package/node_modules/zod/src/v3/tests/intersection.test.ts +128 -0
  1271. package/node_modules/zod/src/v3/tests/language-server.source.ts +76 -0
  1272. package/node_modules/zod/src/v3/tests/language-server.test.ts +206 -0
  1273. package/node_modules/zod/src/v3/tests/literal.test.ts +36 -0
  1274. package/node_modules/zod/src/v3/tests/map.test.ts +110 -0
  1275. package/node_modules/zod/src/v3/tests/masking.test.ts +4 -0
  1276. package/node_modules/zod/src/v3/tests/mocker.test.ts +19 -0
  1277. package/node_modules/zod/src/v3/tests/nan.test.ts +24 -0
  1278. package/node_modules/zod/src/v3/tests/nativeEnum.test.ts +87 -0
  1279. package/node_modules/zod/src/v3/tests/nullable.test.ts +42 -0
  1280. package/node_modules/zod/src/v3/tests/number.test.ts +176 -0
  1281. package/node_modules/zod/src/v3/tests/object-augmentation.test.ts +29 -0
  1282. package/node_modules/zod/src/v3/tests/object-in-es5-env.test.ts +29 -0
  1283. package/node_modules/zod/src/v3/tests/object.test.ts +431 -0
  1284. package/node_modules/zod/src/v3/tests/optional.test.ts +42 -0
  1285. package/node_modules/zod/src/v3/tests/parseUtil.test.ts +23 -0
  1286. package/node_modules/zod/src/v3/tests/parser.test.ts +41 -0
  1287. package/node_modules/zod/src/v3/tests/partials.test.ts +243 -0
  1288. package/node_modules/zod/src/v3/tests/pickomit.test.ts +111 -0
  1289. package/node_modules/zod/src/v3/tests/pipeline.test.ts +29 -0
  1290. package/node_modules/zod/src/v3/tests/preprocess.test.ts +186 -0
  1291. package/node_modules/zod/src/v3/tests/primitive.test.ts +440 -0
  1292. package/node_modules/zod/src/v3/tests/promise.test.ts +90 -0
  1293. package/node_modules/zod/src/v3/tests/readonly.test.ts +114 -0
  1294. package/node_modules/zod/src/v3/tests/record.test.ts +171 -0
  1295. package/node_modules/zod/src/v3/tests/recursive.test.ts +197 -0
  1296. package/node_modules/zod/src/v3/tests/refine.test.ts +313 -0
  1297. package/node_modules/zod/src/v3/tests/safeparse.test.ts +27 -0
  1298. package/node_modules/zod/src/v3/tests/set.test.ts +142 -0
  1299. package/node_modules/zod/src/v3/tests/standard-schema.test.ts +83 -0
  1300. package/node_modules/zod/src/v3/tests/string.test.ts +922 -0
  1301. package/node_modules/zod/src/v3/tests/transformer.test.ts +233 -0
  1302. package/node_modules/zod/src/v3/tests/tuple.test.ts +90 -0
  1303. package/node_modules/zod/src/v3/tests/unions.test.ts +57 -0
  1304. package/node_modules/zod/src/v3/tests/validations.test.ts +133 -0
  1305. package/node_modules/zod/src/v3/tests/void.test.ts +15 -0
  1306. package/node_modules/zod/src/v3/types.ts +5138 -0
  1307. package/node_modules/zod/src/v4/classic/checks.ts +33 -0
  1308. package/node_modules/zod/src/v4/classic/coerce.ts +27 -0
  1309. package/node_modules/zod/src/v4/classic/compat.ts +78 -0
  1310. package/node_modules/zod/src/v4/classic/deep-partial.ts +76 -0
  1311. package/node_modules/zod/src/v4/classic/errors.ts +97 -0
  1312. package/node_modules/zod/src/v4/classic/external.ts +57 -0
  1313. package/node_modules/zod/src/v4/classic/from-json-schema.ts +944 -0
  1314. package/node_modules/zod/src/v4/classic/in-out.ts +45 -0
  1315. package/node_modules/zod/src/v4/classic/index.ts +5 -0
  1316. package/node_modules/zod/src/v4/classic/iso.ts +20 -0
  1317. package/node_modules/zod/src/v4/classic/parse.ts +88 -0
  1318. package/node_modules/zod/src/v4/classic/schemas.ts +2937 -0
  1319. package/node_modules/zod/src/v4/classic/tests/anyunknown.test.ts +26 -0
  1320. package/node_modules/zod/src/v4/classic/tests/apply.test.ts +86 -0
  1321. package/node_modules/zod/src/v4/classic/tests/array.test.ts +291 -0
  1322. package/node_modules/zod/src/v4/classic/tests/assignability.test.ts +402 -0
  1323. package/node_modules/zod/src/v4/classic/tests/async-parsing.test.ts +381 -0
  1324. package/node_modules/zod/src/v4/classic/tests/async-refinements.test.ts +68 -0
  1325. package/node_modules/zod/src/v4/classic/tests/base.test.ts +7 -0
  1326. package/node_modules/zod/src/v4/classic/tests/bigint.test.ts +89 -0
  1327. package/node_modules/zod/src/v4/classic/tests/brand.test.ts +106 -0
  1328. package/node_modules/zod/src/v4/classic/tests/catch.test.ts +604 -0
  1329. package/node_modules/zod/src/v4/classic/tests/coalesce.test.ts +20 -0
  1330. package/node_modules/zod/src/v4/classic/tests/codec-examples.test.ts +572 -0
  1331. package/node_modules/zod/src/v4/classic/tests/codec.test.ts +704 -0
  1332. package/node_modules/zod/src/v4/classic/tests/coerce.test.ts +160 -0
  1333. package/node_modules/zod/src/v4/classic/tests/continuability.test.ts +374 -0
  1334. package/node_modules/zod/src/v4/classic/tests/credit-card.test.ts +76 -0
  1335. package/node_modules/zod/src/v4/classic/tests/custom.test.ts +40 -0
  1336. package/node_modules/zod/src/v4/classic/tests/cyclic-data.test.ts +985 -0
  1337. package/node_modules/zod/src/v4/classic/tests/date.test.ts +92 -0
  1338. package/node_modules/zod/src/v4/classic/tests/datetime.test.ts +316 -0
  1339. package/node_modules/zod/src/v4/classic/tests/deep-partial.test.ts +380 -0
  1340. package/node_modules/zod/src/v4/classic/tests/default-locale.test.ts +32 -0
  1341. package/node_modules/zod/src/v4/classic/tests/default.test.ts +455 -0
  1342. package/node_modules/zod/src/v4/classic/tests/describe-meta-checks.test.ts +27 -0
  1343. package/node_modules/zod/src/v4/classic/tests/description.test.ts +32 -0
  1344. package/node_modules/zod/src/v4/classic/tests/detached-methods.test.ts +221 -0
  1345. package/node_modules/zod/src/v4/classic/tests/discriminated-unions.test.ts +942 -0
  1346. package/node_modules/zod/src/v4/classic/tests/enum.test.ts +305 -0
  1347. package/node_modules/zod/src/v4/classic/tests/error-utils.test.ts +917 -0
  1348. package/node_modules/zod/src/v4/classic/tests/error.test.ts +1108 -0
  1349. package/node_modules/zod/src/v4/classic/tests/file.test.ts +96 -0
  1350. package/node_modules/zod/src/v4/classic/tests/firstparty.test.ts +179 -0
  1351. package/node_modules/zod/src/v4/classic/tests/fix-json-issue.test.ts +26 -0
  1352. package/node_modules/zod/src/v4/classic/tests/from-json-schema.test.ts +1467 -0
  1353. package/node_modules/zod/src/v4/classic/tests/function.test.ts +391 -0
  1354. package/node_modules/zod/src/v4/classic/tests/generics.test.ts +72 -0
  1355. package/node_modules/zod/src/v4/classic/tests/global-config.test.ts +32 -0
  1356. package/node_modules/zod/src/v4/classic/tests/hash.test.ts +67 -0
  1357. package/node_modules/zod/src/v4/classic/tests/iban.test.ts +81 -0
  1358. package/node_modules/zod/src/v4/classic/tests/in-out.test.ts +159 -0
  1359. package/node_modules/zod/src/v4/classic/tests/index.test.ts +958 -0
  1360. package/node_modules/zod/src/v4/classic/tests/instance-footprint.test.ts +319 -0
  1361. package/node_modules/zod/src/v4/classic/tests/instanceof.test.ts +127 -0
  1362. package/node_modules/zod/src/v4/classic/tests/intersection.test.ts +334 -0
  1363. package/node_modules/zod/src/v4/classic/tests/issue-schema.test.ts +215 -0
  1364. package/node_modules/zod/src/v4/classic/tests/jitless-allows-eval.test.ts +39 -0
  1365. package/node_modules/zod/src/v4/classic/tests/json.test.ts +109 -0
  1366. package/node_modules/zod/src/v4/classic/tests/lazy.test.ts +262 -0
  1367. package/node_modules/zod/src/v4/classic/tests/literal.test.ts +128 -0
  1368. package/node_modules/zod/src/v4/classic/tests/locales_ka.test.ts +29 -0
  1369. package/node_modules/zod/src/v4/classic/tests/locales_ro.test.ts +24 -0
  1370. package/node_modules/zod/src/v4/classic/tests/map.test.ts +349 -0
  1371. package/node_modules/zod/src/v4/classic/tests/nan.test.ts +21 -0
  1372. package/node_modules/zod/src/v4/classic/tests/nested-refine.test.ts +168 -0
  1373. package/node_modules/zod/src/v4/classic/tests/nonoptional.test.ts +101 -0
  1374. package/node_modules/zod/src/v4/classic/tests/nullable.test.ts +22 -0
  1375. package/node_modules/zod/src/v4/classic/tests/number.test.ts +401 -0
  1376. package/node_modules/zod/src/v4/classic/tests/object.test.ts +1006 -0
  1377. package/node_modules/zod/src/v4/classic/tests/optin-ladder.test.ts +235 -0
  1378. package/node_modules/zod/src/v4/classic/tests/optional.test.ts +366 -0
  1379. package/node_modules/zod/src/v4/classic/tests/partial.test.ts +497 -0
  1380. package/node_modules/zod/src/v4/classic/tests/pickomit.test.ts +211 -0
  1381. package/node_modules/zod/src/v4/classic/tests/pipe.test.ts +101 -0
  1382. package/node_modules/zod/src/v4/classic/tests/prefault.test.ts +144 -0
  1383. package/node_modules/zod/src/v4/classic/tests/preprocess-types.test.ts +44 -0
  1384. package/node_modules/zod/src/v4/classic/tests/preprocess.test.ts +351 -0
  1385. package/node_modules/zod/src/v4/classic/tests/primitive.test.ts +175 -0
  1386. package/node_modules/zod/src/v4/classic/tests/promise.test.ts +81 -0
  1387. package/node_modules/zod/src/v4/classic/tests/properties.test.ts +141 -0
  1388. package/node_modules/zod/src/v4/classic/tests/prototypes.test.ts +23 -0
  1389. package/node_modules/zod/src/v4/classic/tests/readonly.test.ts +184 -0
  1390. package/node_modules/zod/src/v4/classic/tests/record.test.ts +885 -0
  1391. package/node_modules/zod/src/v4/classic/tests/recursive-types.test.ts +707 -0
  1392. package/node_modules/zod/src/v4/classic/tests/redos.test.ts +68 -0
  1393. package/node_modules/zod/src/v4/classic/tests/refine.test.ts +693 -0
  1394. package/node_modules/zod/src/v4/classic/tests/registries.test.ts +243 -0
  1395. package/node_modules/zod/src/v4/classic/tests/set.test.ts +196 -0
  1396. package/node_modules/zod/src/v4/classic/tests/standard-schema.test.ts +153 -0
  1397. package/node_modules/zod/src/v4/classic/tests/string-formats.test.ts +125 -0
  1398. package/node_modules/zod/src/v4/classic/tests/string.test.ts +1440 -0
  1399. package/node_modules/zod/src/v4/classic/tests/stringbool.test.ts +124 -0
  1400. package/node_modules/zod/src/v4/classic/tests/template-literal.test.ts +812 -0
  1401. package/node_modules/zod/src/v4/classic/tests/to-json-schema-methods.test.ts +438 -0
  1402. package/node_modules/zod/src/v4/classic/tests/to-json-schema.test.ts +4733 -0
  1403. package/node_modules/zod/src/v4/classic/tests/transform.test.ts +378 -0
  1404. package/node_modules/zod/src/v4/classic/tests/tuple.test.ts +511 -0
  1405. package/node_modules/zod/src/v4/classic/tests/union.test.ts +310 -0
  1406. package/node_modules/zod/src/v4/classic/tests/url.test.ts +13 -0
  1407. package/node_modules/zod/src/v4/classic/tests/validate.test.ts +645 -0
  1408. package/node_modules/zod/src/v4/classic/tests/validations.test.ts +283 -0
  1409. package/node_modules/zod/src/v4/classic/tests/void.test.ts +12 -0
  1410. package/node_modules/zod/src/v4/core/api.ts +1875 -0
  1411. package/node_modules/zod/src/v4/core/checks.ts +1266 -0
  1412. package/node_modules/zod/src/v4/core/compile.ts +2322 -0
  1413. package/node_modules/zod/src/v4/core/core.ts +230 -0
  1414. package/node_modules/zod/src/v4/core/doc.ts +52 -0
  1415. package/node_modules/zod/src/v4/core/errors.ts +543 -0
  1416. package/node_modules/zod/src/v4/core/index.ts +19 -0
  1417. package/node_modules/zod/src/v4/core/json-schema-generator.ts +131 -0
  1418. package/node_modules/zod/src/v4/core/json-schema-processors.ts +934 -0
  1419. package/node_modules/zod/src/v4/core/json-schema.ts +148 -0
  1420. package/node_modules/zod/src/v4/core/memoizer.ts +331 -0
  1421. package/node_modules/zod/src/v4/core/parse.ts +309 -0
  1422. package/node_modules/zod/src/v4/core/regexes.ts +217 -0
  1423. package/node_modules/zod/src/v4/core/registries.ts +105 -0
  1424. package/node_modules/zod/src/v4/core/schemas.ts +5226 -0
  1425. package/node_modules/zod/src/v4/core/standard-schema.ts +159 -0
  1426. package/node_modules/zod/src/v4/core/tests/cached.test.ts +54 -0
  1427. package/node_modules/zod/src/v4/core/tests/compile-differential.test.ts +1004 -0
  1428. package/node_modules/zod/src/v4/core/tests/compile-generative.test.ts +445 -0
  1429. package/node_modules/zod/src/v4/core/tests/compile-global.test.ts +89 -0
  1430. package/node_modules/zod/src/v4/core/tests/compile-off-by-default.test.ts +26 -0
  1431. package/node_modules/zod/src/v4/core/tests/compile-stats.test.ts +34 -0
  1432. package/node_modules/zod/src/v4/core/tests/compile.test.ts +2036 -0
  1433. package/node_modules/zod/src/v4/core/tests/email-regex.test.ts +140 -0
  1434. package/node_modules/zod/src/v4/core/tests/extend.test.ts +59 -0
  1435. package/node_modules/zod/src/v4/core/tests/index.test.ts +46 -0
  1436. package/node_modules/zod/src/v4/core/tests/locales/be.test.ts +124 -0
  1437. package/node_modules/zod/src/v4/core/tests/locales/el.test.ts +214 -0
  1438. package/node_modules/zod/src/v4/core/tests/locales/en.test.ts +22 -0
  1439. package/node_modules/zod/src/v4/core/tests/locales/es.test.ts +180 -0
  1440. package/node_modules/zod/src/v4/core/tests/locales/fr.test.ts +72 -0
  1441. package/node_modules/zod/src/v4/core/tests/locales/he.test.ts +379 -0
  1442. package/node_modules/zod/src/v4/core/tests/locales/hr.test.ts +163 -0
  1443. package/node_modules/zod/src/v4/core/tests/locales/nl.test.ts +46 -0
  1444. package/node_modules/zod/src/v4/core/tests/locales/parity.test.ts +42 -0
  1445. package/node_modules/zod/src/v4/core/tests/locales/ru.test.ts +128 -0
  1446. package/node_modules/zod/src/v4/core/tests/locales/tg.test.ts +85 -0
  1447. package/node_modules/zod/src/v4/core/tests/locales/tk.test.ts +69 -0
  1448. package/node_modules/zod/src/v4/core/tests/locales/tr.test.ts +69 -0
  1449. package/node_modules/zod/src/v4/core/tests/locales/uz.test.ts +105 -0
  1450. package/node_modules/zod/src/v4/core/tests/polyfill-collision.test.ts +46 -0
  1451. package/node_modules/zod/src/v4/core/tests/record-constructor.test.ts +125 -0
  1452. package/node_modules/zod/src/v4/core/tests/recursive-tuples.test.ts +45 -0
  1453. package/node_modules/zod/src/v4/core/tests/treeshake.test.ts +51 -0
  1454. package/node_modules/zod/src/v4/core/tests/url-no-canparse.test.ts +133 -0
  1455. package/node_modules/zod/src/v4/core/to-json-schema.ts +857 -0
  1456. package/node_modules/zod/src/v4/core/util.ts +1293 -0
  1457. package/node_modules/zod/src/v4/core/versions.ts +5 -0
  1458. package/node_modules/zod/src/v4/core/visit.ts +193 -0
  1459. package/node_modules/zod/src/v4/core/zsf.ts +323 -0
  1460. package/node_modules/zod/src/v4/index.ts +4 -0
  1461. package/node_modules/zod/src/v4/locales/ar.ts +120 -0
  1462. package/node_modules/zod/src/v4/locales/az.ts +116 -0
  1463. package/node_modules/zod/src/v4/locales/be.ts +188 -0
  1464. package/node_modules/zod/src/v4/locales/bg.ts +133 -0
  1465. package/node_modules/zod/src/v4/locales/bn.ts +123 -0
  1466. package/node_modules/zod/src/v4/locales/ca.ts +121 -0
  1467. package/node_modules/zod/src/v4/locales/ckb.ts +140 -0
  1468. package/node_modules/zod/src/v4/locales/cs.ts +123 -0
  1469. package/node_modules/zod/src/v4/locales/da.ts +128 -0
  1470. package/node_modules/zod/src/v4/locales/de.ts +121 -0
  1471. package/node_modules/zod/src/v4/locales/el.ts +124 -0
  1472. package/node_modules/zod/src/v4/locales/en.ts +136 -0
  1473. package/node_modules/zod/src/v4/locales/eo.ts +123 -0
  1474. package/node_modules/zod/src/v4/locales/es.ts +145 -0
  1475. package/node_modules/zod/src/v4/locales/fa.ts +131 -0
  1476. package/node_modules/zod/src/v4/locales/fi.ts +126 -0
  1477. package/node_modules/zod/src/v4/locales/fr-CA.ts +121 -0
  1478. package/node_modules/zod/src/v4/locales/fr.ts +139 -0
  1479. package/node_modules/zod/src/v4/locales/gu.ts +123 -0
  1480. package/node_modules/zod/src/v4/locales/he.ts +253 -0
  1481. package/node_modules/zod/src/v4/locales/hi.ts +126 -0
  1482. package/node_modules/zod/src/v4/locales/hr.ts +135 -0
  1483. package/node_modules/zod/src/v4/locales/hu.ts +122 -0
  1484. package/node_modules/zod/src/v4/locales/hy.ts +175 -0
  1485. package/node_modules/zod/src/v4/locales/id.ts +120 -0
  1486. package/node_modules/zod/src/v4/locales/index.ts +63 -0
  1487. package/node_modules/zod/src/v4/locales/is.ts +124 -0
  1488. package/node_modules/zod/src/v4/locales/it.ts +121 -0
  1489. package/node_modules/zod/src/v4/locales/ja.ts +119 -0
  1490. package/node_modules/zod/src/v4/locales/ka.ts +128 -0
  1491. package/node_modules/zod/src/v4/locales/kh.ts +7 -0
  1492. package/node_modules/zod/src/v4/locales/km.ts +124 -0
  1493. package/node_modules/zod/src/v4/locales/kn.ts +126 -0
  1494. package/node_modules/zod/src/v4/locales/ko.ts +126 -0
  1495. package/node_modules/zod/src/v4/locales/lt.ts +243 -0
  1496. package/node_modules/zod/src/v4/locales/mk.ts +123 -0
  1497. package/node_modules/zod/src/v4/locales/ms.ts +120 -0
  1498. package/node_modules/zod/src/v4/locales/ne.ts +128 -0
  1499. package/node_modules/zod/src/v4/locales/nl.ts +126 -0
  1500. package/node_modules/zod/src/v4/locales/nn.ts +121 -0
  1501. package/node_modules/zod/src/v4/locales/no.ts +121 -0
  1502. package/node_modules/zod/src/v4/locales/ota.ts +122 -0
  1503. package/node_modules/zod/src/v4/locales/pl.ts +123 -0
  1504. package/node_modules/zod/src/v4/locales/ps.ts +131 -0
  1505. package/node_modules/zod/src/v4/locales/pt-BR.ts +161 -0
  1506. package/node_modules/zod/src/v4/locales/pt.ts +159 -0
  1507. package/node_modules/zod/src/v4/locales/ro.ts +132 -0
  1508. package/node_modules/zod/src/v4/locales/ru.ts +188 -0
  1509. package/node_modules/zod/src/v4/locales/sk.ts +123 -0
  1510. package/node_modules/zod/src/v4/locales/sl.ts +123 -0
  1511. package/node_modules/zod/src/v4/locales/sv.ts +124 -0
  1512. package/node_modules/zod/src/v4/locales/ta.ts +123 -0
  1513. package/node_modules/zod/src/v4/locales/tg.ts +135 -0
  1514. package/node_modules/zod/src/v4/locales/th.ts +124 -0
  1515. package/node_modules/zod/src/v4/locales/tk.ts +113 -0
  1516. package/node_modules/zod/src/v4/locales/tr.ts +116 -0
  1517. package/node_modules/zod/src/v4/locales/ua.ts +7 -0
  1518. package/node_modules/zod/src/v4/locales/uk.ts +122 -0
  1519. package/node_modules/zod/src/v4/locales/ur.ts +124 -0
  1520. package/node_modules/zod/src/v4/locales/uz.ts +120 -0
  1521. package/node_modules/zod/src/v4/locales/vi.ts +122 -0
  1522. package/node_modules/zod/src/v4/locales/yo.ts +129 -0
  1523. package/node_modules/zod/src/v4/locales/zh-CN.ts +121 -0
  1524. package/node_modules/zod/src/v4/locales/zh-TW.ts +120 -0
  1525. package/node_modules/zod/src/v4/mini/checks.ts +33 -0
  1526. package/node_modules/zod/src/v4/mini/coerce.ts +27 -0
  1527. package/node_modules/zod/src/v4/mini/deep-partial.ts +73 -0
  1528. package/node_modules/zod/src/v4/mini/external.ts +52 -0
  1529. package/node_modules/zod/src/v4/mini/in-out.ts +45 -0
  1530. package/node_modules/zod/src/v4/mini/index.ts +3 -0
  1531. package/node_modules/zod/src/v4/mini/iso.ts +66 -0
  1532. package/node_modules/zod/src/v4/mini/parse.ts +16 -0
  1533. package/node_modules/zod/src/v4/mini/schemas.ts +2051 -0
  1534. package/node_modules/zod/src/v4/mini/tests/apply.test.ts +57 -0
  1535. package/node_modules/zod/src/v4/mini/tests/assignability.test.ts +190 -0
  1536. package/node_modules/zod/src/v4/mini/tests/brand.test.ts +94 -0
  1537. package/node_modules/zod/src/v4/mini/tests/checks.test.ts +158 -0
  1538. package/node_modules/zod/src/v4/mini/tests/codec.test.ts +582 -0
  1539. package/node_modules/zod/src/v4/mini/tests/computed.test.ts +30 -0
  1540. package/node_modules/zod/src/v4/mini/tests/cyclic-data.test.ts +84 -0
  1541. package/node_modules/zod/src/v4/mini/tests/deep-partial.test.ts +54 -0
  1542. package/node_modules/zod/src/v4/mini/tests/error.test.ts +41 -0
  1543. package/node_modules/zod/src/v4/mini/tests/functions.test.ts +14 -0
  1544. package/node_modules/zod/src/v4/mini/tests/index.test.ts +1146 -0
  1545. package/node_modules/zod/src/v4/mini/tests/number.test.ts +109 -0
  1546. package/node_modules/zod/src/v4/mini/tests/object.test.ts +292 -0
  1547. package/node_modules/zod/src/v4/mini/tests/prototypes.test.ts +43 -0
  1548. package/node_modules/zod/src/v4/mini/tests/recursive-types.test.ts +341 -0
  1549. package/node_modules/zod/src/v4/mini/tests/standard-schema.test.ts +50 -0
  1550. package/node_modules/zod/src/v4/mini/tests/string.test.ts +396 -0
  1551. package/node_modules/zod/src/v4-mini/index.ts +3 -0
  1552. package/node_modules/zod/v3/ZodError.cjs +167 -0
  1553. package/node_modules/zod/v3/ZodError.d.cts +164 -0
  1554. package/node_modules/zod/v3/ZodError.d.ts +164 -0
  1555. package/node_modules/zod/v3/ZodError.js +143 -0
  1556. package/node_modules/zod/v3/errors.cjs +36 -0
  1557. package/node_modules/zod/v3/errors.d.cts +5 -0
  1558. package/node_modules/zod/v3/errors.d.ts +5 -0
  1559. package/node_modules/zod/v3/errors.js +9 -0
  1560. package/node_modules/zod/v3/external.cjs +41 -0
  1561. package/node_modules/zod/v3/external.d.cts +6 -0
  1562. package/node_modules/zod/v3/external.d.ts +6 -0
  1563. package/node_modules/zod/v3/external.js +6 -0
  1564. package/node_modules/zod/v3/helpers/enumUtil.cjs +21 -0
  1565. package/node_modules/zod/v3/helpers/enumUtil.d.cts +8 -0
  1566. package/node_modules/zod/v3/helpers/enumUtil.d.ts +8 -0
  1567. package/node_modules/zod/v3/helpers/enumUtil.js +1 -0
  1568. package/node_modules/zod/v3/helpers/errorUtil.cjs +28 -0
  1569. package/node_modules/zod/v3/helpers/errorUtil.d.cts +9 -0
  1570. package/node_modules/zod/v3/helpers/errorUtil.d.ts +9 -0
  1571. package/node_modules/zod/v3/helpers/errorUtil.js +6 -0
  1572. package/node_modules/zod/v3/helpers/parseUtil.cjs +143 -0
  1573. package/node_modules/zod/v3/helpers/parseUtil.d.cts +78 -0
  1574. package/node_modules/zod/v3/helpers/parseUtil.d.ts +78 -0
  1575. package/node_modules/zod/v3/helpers/parseUtil.js +109 -0
  1576. package/node_modules/zod/v3/helpers/partialUtil.cjs +21 -0
  1577. package/node_modules/zod/v3/helpers/partialUtil.d.cts +8 -0
  1578. package/node_modules/zod/v3/helpers/partialUtil.d.ts +8 -0
  1579. package/node_modules/zod/v3/helpers/partialUtil.js +1 -0
  1580. package/node_modules/zod/v3/helpers/typeAliases.cjs +21 -0
  1581. package/node_modules/zod/v3/helpers/typeAliases.d.cts +2 -0
  1582. package/node_modules/zod/v3/helpers/typeAliases.d.ts +2 -0
  1583. package/node_modules/zod/v3/helpers/typeAliases.js +1 -0
  1584. package/node_modules/zod/v3/helpers/util.cjs +156 -0
  1585. package/node_modules/zod/v3/helpers/util.d.cts +85 -0
  1586. package/node_modules/zod/v3/helpers/util.d.ts +85 -0
  1587. package/node_modules/zod/v3/helpers/util.js +133 -0
  1588. package/node_modules/zod/v3/index.cjs +52 -0
  1589. package/node_modules/zod/v3/index.d.cts +4 -0
  1590. package/node_modules/zod/v3/index.d.ts +4 -0
  1591. package/node_modules/zod/v3/index.js +4 -0
  1592. package/node_modules/zod/v3/locales/en.cjs +112 -0
  1593. package/node_modules/zod/v3/locales/en.d.cts +3 -0
  1594. package/node_modules/zod/v3/locales/en.d.ts +3 -0
  1595. package/node_modules/zod/v3/locales/en.js +109 -0
  1596. package/node_modules/zod/v3/package.json +7 -0
  1597. package/node_modules/zod/v3/standard-schema.cjs +21 -0
  1598. package/node_modules/zod/v3/standard-schema.d.cts +102 -0
  1599. package/node_modules/zod/v3/standard-schema.d.ts +102 -0
  1600. package/node_modules/zod/v3/standard-schema.js +1 -0
  1601. package/node_modules/zod/v3/types.cjs +3798 -0
  1602. package/node_modules/zod/v3/types.d.cts +1034 -0
  1603. package/node_modules/zod/v3/types.d.ts +1034 -0
  1604. package/node_modules/zod/v3/types.js +3697 -0
  1605. package/node_modules/zod/v4/classic/checks.cjs +53 -0
  1606. package/node_modules/zod/v4/classic/checks.d.cts +1 -0
  1607. package/node_modules/zod/v4/classic/checks.d.ts +1 -0
  1608. package/node_modules/zod/v4/classic/checks.js +1 -0
  1609. package/node_modules/zod/v4/classic/coerce.cjs +66 -0
  1610. package/node_modules/zod/v4/classic/coerce.d.cts +17 -0
  1611. package/node_modules/zod/v4/classic/coerce.d.ts +17 -0
  1612. package/node_modules/zod/v4/classic/coerce.js +17 -0
  1613. package/node_modules/zod/v4/classic/compat.cjs +80 -0
  1614. package/node_modules/zod/v4/classic/compat.d.cts +48 -0
  1615. package/node_modules/zod/v4/classic/compat.d.ts +48 -0
  1616. package/node_modules/zod/v4/classic/compat.js +31 -0
  1617. package/node_modules/zod/v4/classic/deep-partial.cjs +58 -0
  1618. package/node_modules/zod/v4/classic/deep-partial.d.cts +14 -0
  1619. package/node_modules/zod/v4/classic/deep-partial.d.ts +14 -0
  1620. package/node_modules/zod/v4/classic/deep-partial.js +13 -0
  1621. package/node_modules/zod/v4/classic/errors.cjs +102 -0
  1622. package/node_modules/zod/v4/classic/errors.d.cts +29 -0
  1623. package/node_modules/zod/v4/classic/errors.d.ts +29 -0
  1624. package/node_modules/zod/v4/classic/errors.js +57 -0
  1625. package/node_modules/zod/v4/classic/external.cjs +97 -0
  1626. package/node_modules/zod/v4/classic/external.d.cts +19 -0
  1627. package/node_modules/zod/v4/classic/external.d.ts +19 -0
  1628. package/node_modules/zod/v4/classic/external.js +17 -0
  1629. package/node_modules/zod/v4/classic/from-json-schema.cjs +926 -0
  1630. package/node_modules/zod/v4/classic/from-json-schema.d.cts +12 -0
  1631. package/node_modules/zod/v4/classic/from-json-schema.d.ts +12 -0
  1632. package/node_modules/zod/v4/classic/from-json-schema.js +881 -0
  1633. package/node_modules/zod/v4/classic/in-out.cjs +82 -0
  1634. package/node_modules/zod/v4/classic/in-out.d.cts +8 -0
  1635. package/node_modules/zod/v4/classic/in-out.d.ts +8 -0
  1636. package/node_modules/zod/v4/classic/in-out.js +36 -0
  1637. package/node_modules/zod/v4/classic/index.cjs +52 -0
  1638. package/node_modules/zod/v4/classic/index.d.cts +3 -0
  1639. package/node_modules/zod/v4/classic/index.d.ts +3 -0
  1640. package/node_modules/zod/v4/classic/index.js +4 -0
  1641. package/node_modules/zod/v4/classic/iso.cjs +68 -0
  1642. package/node_modules/zod/v4/classic/iso.d.cts +7 -0
  1643. package/node_modules/zod/v4/classic/iso.d.ts +7 -0
  1644. package/node_modules/zod/v4/classic/iso.js +15 -0
  1645. package/node_modules/zod/v4/classic/package.json +7 -0
  1646. package/node_modules/zod/v4/classic/parse.cjs +63 -0
  1647. package/node_modules/zod/v4/classic/parse.d.cts +44 -0
  1648. package/node_modules/zod/v4/classic/parse.d.ts +44 -0
  1649. package/node_modules/zod/v4/classic/parse.js +16 -0
  1650. package/node_modules/zod/v4/classic/schemas.cjs +1676 -0
  1651. package/node_modules/zod/v4/classic/schemas.d.cts +816 -0
  1652. package/node_modules/zod/v4/classic/schemas.d.ts +816 -0
  1653. package/node_modules/zod/v4/classic/schemas.js +1535 -0
  1654. package/node_modules/zod/v4/core/api.cjs +1269 -0
  1655. package/node_modules/zod/v4/core/api.d.cts +335 -0
  1656. package/node_modules/zod/v4/core/api.d.ts +335 -0
  1657. package/node_modules/zod/v4/core/api.js +1107 -0
  1658. package/node_modules/zod/v4/core/checks.cjs +561 -0
  1659. package/node_modules/zod/v4/core/checks.d.cts +294 -0
  1660. package/node_modules/zod/v4/core/checks.d.ts +294 -0
  1661. package/node_modules/zod/v4/core/checks.js +516 -0
  1662. package/node_modules/zod/v4/core/compile.cjs +1916 -0
  1663. package/node_modules/zod/v4/core/compile.d.cts +65 -0
  1664. package/node_modules/zod/v4/core/compile.d.ts +65 -0
  1665. package/node_modules/zod/v4/core/compile.js +1866 -0
  1666. package/node_modules/zod/v4/core/core.cjs +167 -0
  1667. package/node_modules/zod/v4/core/core.d.cts +82 -0
  1668. package/node_modules/zod/v4/core/core.d.ts +82 -0
  1669. package/node_modules/zod/v4/core/core.js +141 -0
  1670. package/node_modules/zod/v4/core/doc.cjs +61 -0
  1671. package/node_modules/zod/v4/core/doc.d.cts +16 -0
  1672. package/node_modules/zod/v4/core/doc.d.ts +16 -0
  1673. package/node_modules/zod/v4/core/doc.js +38 -0
  1674. package/node_modules/zod/v4/core/errors.cjs +317 -0
  1675. package/node_modules/zod/v4/core/errors.d.cts +225 -0
  1676. package/node_modules/zod/v4/core/errors.d.ts +225 -0
  1677. package/node_modules/zod/v4/core/errors.js +267 -0
  1678. package/node_modules/zod/v4/core/index.cjs +70 -0
  1679. package/node_modules/zod/v4/core/index.d.cts +19 -0
  1680. package/node_modules/zod/v4/core/index.d.ts +19 -0
  1681. package/node_modules/zod/v4/core/index.js +19 -0
  1682. package/node_modules/zod/v4/core/json-schema-generator.cjs +122 -0
  1683. package/node_modules/zod/v4/core/json-schema-generator.d.cts +65 -0
  1684. package/node_modules/zod/v4/core/json-schema-generator.d.ts +65 -0
  1685. package/node_modules/zod/v4/core/json-schema-generator.js +99 -0
  1686. package/node_modules/zod/v4/core/json-schema-processors.cjs +929 -0
  1687. package/node_modules/zod/v4/core/json-schema-processors.d.cts +65 -0
  1688. package/node_modules/zod/v4/core/json-schema-processors.d.ts +65 -0
  1689. package/node_modules/zod/v4/core/json-schema-processors.js +843 -0
  1690. package/node_modules/zod/v4/core/json-schema.cjs +21 -0
  1691. package/node_modules/zod/v4/core/json-schema.d.cts +89 -0
  1692. package/node_modules/zod/v4/core/json-schema.d.ts +89 -0
  1693. package/node_modules/zod/v4/core/json-schema.js +1 -0
  1694. package/node_modules/zod/v4/core/memoizer.cjs +360 -0
  1695. package/node_modules/zod/v4/core/memoizer.d.cts +15 -0
  1696. package/node_modules/zod/v4/core/memoizer.d.ts +15 -0
  1697. package/node_modules/zod/v4/core/memoizer.js +311 -0
  1698. package/node_modules/zod/v4/core/package.json +7 -0
  1699. package/node_modules/zod/v4/core/parse.cjs +233 -0
  1700. package/node_modules/zod/v4/core/parse.d.cts +52 -0
  1701. package/node_modules/zod/v4/core/parse.d.ts +52 -0
  1702. package/node_modules/zod/v4/core/parse.js +175 -0
  1703. package/node_modules/zod/v4/core/regexes.cjs +209 -0
  1704. package/node_modules/zod/v4/core/regexes.d.cts +90 -0
  1705. package/node_modules/zod/v4/core/regexes.d.ts +90 -0
  1706. package/node_modules/zod/v4/core/regexes.js +156 -0
  1707. package/node_modules/zod/v4/core/registries.cjs +75 -0
  1708. package/node_modules/zod/v4/core/registries.d.cts +35 -0
  1709. package/node_modules/zod/v4/core/registries.d.ts +35 -0
  1710. package/node_modules/zod/v4/core/registries.js +51 -0
  1711. package/node_modules/zod/v4/core/schemas.cjs +2699 -0
  1712. package/node_modules/zod/v4/core/schemas.d.cts +1275 -0
  1713. package/node_modules/zod/v4/core/schemas.d.ts +1275 -0
  1714. package/node_modules/zod/v4/core/schemas.js +2636 -0
  1715. package/node_modules/zod/v4/core/standard-schema.cjs +21 -0
  1716. package/node_modules/zod/v4/core/standard-schema.d.cts +126 -0
  1717. package/node_modules/zod/v4/core/standard-schema.d.ts +126 -0
  1718. package/node_modules/zod/v4/core/standard-schema.js +1 -0
  1719. package/node_modules/zod/v4/core/to-json-schema.cjs +681 -0
  1720. package/node_modules/zod/v4/core/to-json-schema.d.cts +154 -0
  1721. package/node_modules/zod/v4/core/to-json-schema.d.ts +154 -0
  1722. package/node_modules/zod/v4/core/to-json-schema.js +651 -0
  1723. package/node_modules/zod/v4/core/util.cjs +964 -0
  1724. package/node_modules/zod/v4/core/util.d.cts +280 -0
  1725. package/node_modules/zod/v4/core/util.d.ts +280 -0
  1726. package/node_modules/zod/v4/core/util.js +873 -0
  1727. package/node_modules/zod/v4/core/versions.cjs +27 -0
  1728. package/node_modules/zod/v4/core/versions.d.cts +5 -0
  1729. package/node_modules/zod/v4/core/versions.d.ts +5 -0
  1730. package/node_modules/zod/v4/core/versions.js +5 -0
  1731. package/node_modules/zod/v4/core/visit.cjs +214 -0
  1732. package/node_modules/zod/v4/core/visit.d.cts +30 -0
  1733. package/node_modules/zod/v4/core/visit.d.ts +30 -0
  1734. package/node_modules/zod/v4/core/visit.js +169 -0
  1735. package/node_modules/zod/v4/index.cjs +51 -0
  1736. package/node_modules/zod/v4/index.d.cts +3 -0
  1737. package/node_modules/zod/v4/index.d.ts +3 -0
  1738. package/node_modules/zod/v4/index.js +4 -0
  1739. package/node_modules/zod/v4/locales/ar.cjs +138 -0
  1740. package/node_modules/zod/v4/locales/ar.d.cts +5 -0
  1741. package/node_modules/zod/v4/locales/ar.d.ts +4 -0
  1742. package/node_modules/zod/v4/locales/ar.js +111 -0
  1743. package/node_modules/zod/v4/locales/az.cjs +137 -0
  1744. package/node_modules/zod/v4/locales/az.d.cts +5 -0
  1745. package/node_modules/zod/v4/locales/az.d.ts +4 -0
  1746. package/node_modules/zod/v4/locales/az.js +110 -0
  1747. package/node_modules/zod/v4/locales/be.cjs +195 -0
  1748. package/node_modules/zod/v4/locales/be.d.cts +5 -0
  1749. package/node_modules/zod/v4/locales/be.d.ts +4 -0
  1750. package/node_modules/zod/v4/locales/be.js +168 -0
  1751. package/node_modules/zod/v4/locales/bg.cjs +152 -0
  1752. package/node_modules/zod/v4/locales/bg.d.cts +5 -0
  1753. package/node_modules/zod/v4/locales/bg.d.ts +4 -0
  1754. package/node_modules/zod/v4/locales/bg.js +125 -0
  1755. package/node_modules/zod/v4/locales/bn.cjs +140 -0
  1756. package/node_modules/zod/v4/locales/bn.d.cts +5 -0
  1757. package/node_modules/zod/v4/locales/bn.d.ts +4 -0
  1758. package/node_modules/zod/v4/locales/bn.js +113 -0
  1759. package/node_modules/zod/v4/locales/ca.cjs +139 -0
  1760. package/node_modules/zod/v4/locales/ca.d.cts +5 -0
  1761. package/node_modules/zod/v4/locales/ca.d.ts +4 -0
  1762. package/node_modules/zod/v4/locales/ca.js +112 -0
  1763. package/node_modules/zod/v4/locales/ckb.cjs +160 -0
  1764. package/node_modules/zod/v4/locales/ckb.d.cts +5 -0
  1765. package/node_modules/zod/v4/locales/ckb.d.ts +4 -0
  1766. package/node_modules/zod/v4/locales/ckb.js +133 -0
  1767. package/node_modules/zod/v4/locales/cs.cjs +143 -0
  1768. package/node_modules/zod/v4/locales/cs.d.cts +5 -0
  1769. package/node_modules/zod/v4/locales/cs.d.ts +4 -0
  1770. package/node_modules/zod/v4/locales/cs.js +116 -0
  1771. package/node_modules/zod/v4/locales/da.cjs +147 -0
  1772. package/node_modules/zod/v4/locales/da.d.cts +5 -0
  1773. package/node_modules/zod/v4/locales/da.d.ts +4 -0
  1774. package/node_modules/zod/v4/locales/da.js +120 -0
  1775. package/node_modules/zod/v4/locales/de.cjs +140 -0
  1776. package/node_modules/zod/v4/locales/de.d.cts +5 -0
  1777. package/node_modules/zod/v4/locales/de.d.ts +4 -0
  1778. package/node_modules/zod/v4/locales/de.js +113 -0
  1779. package/node_modules/zod/v4/locales/el.cjs +139 -0
  1780. package/node_modules/zod/v4/locales/el.d.cts +5 -0
  1781. package/node_modules/zod/v4/locales/el.d.ts +4 -0
  1782. package/node_modules/zod/v4/locales/el.js +112 -0
  1783. package/node_modules/zod/v4/locales/en.cjs +152 -0
  1784. package/node_modules/zod/v4/locales/en.d.cts +5 -0
  1785. package/node_modules/zod/v4/locales/en.d.ts +4 -0
  1786. package/node_modules/zod/v4/locales/en.js +125 -0
  1787. package/node_modules/zod/v4/locales/eo.cjs +141 -0
  1788. package/node_modules/zod/v4/locales/eo.d.cts +5 -0
  1789. package/node_modules/zod/v4/locales/eo.d.ts +4 -0
  1790. package/node_modules/zod/v4/locales/eo.js +114 -0
  1791. package/node_modules/zod/v4/locales/es.cjs +163 -0
  1792. package/node_modules/zod/v4/locales/es.d.cts +5 -0
  1793. package/node_modules/zod/v4/locales/es.d.ts +4 -0
  1794. package/node_modules/zod/v4/locales/es.js +136 -0
  1795. package/node_modules/zod/v4/locales/fa.cjs +146 -0
  1796. package/node_modules/zod/v4/locales/fa.d.cts +5 -0
  1797. package/node_modules/zod/v4/locales/fa.d.ts +4 -0
  1798. package/node_modules/zod/v4/locales/fa.js +119 -0
  1799. package/node_modules/zod/v4/locales/fi.cjs +144 -0
  1800. package/node_modules/zod/v4/locales/fi.d.cts +5 -0
  1801. package/node_modules/zod/v4/locales/fi.d.ts +4 -0
  1802. package/node_modules/zod/v4/locales/fi.js +117 -0
  1803. package/node_modules/zod/v4/locales/fr-CA.cjs +139 -0
  1804. package/node_modules/zod/v4/locales/fr-CA.d.cts +5 -0
  1805. package/node_modules/zod/v4/locales/fr-CA.d.ts +4 -0
  1806. package/node_modules/zod/v4/locales/fr-CA.js +112 -0
  1807. package/node_modules/zod/v4/locales/fr.cjs +156 -0
  1808. package/node_modules/zod/v4/locales/fr.d.cts +5 -0
  1809. package/node_modules/zod/v4/locales/fr.d.ts +4 -0
  1810. package/node_modules/zod/v4/locales/fr.js +129 -0
  1811. package/node_modules/zod/v4/locales/gu.cjs +140 -0
  1812. package/node_modules/zod/v4/locales/gu.d.cts +5 -0
  1813. package/node_modules/zod/v4/locales/gu.d.ts +4 -0
  1814. package/node_modules/zod/v4/locales/gu.js +113 -0
  1815. package/node_modules/zod/v4/locales/he.cjs +248 -0
  1816. package/node_modules/zod/v4/locales/he.d.cts +5 -0
  1817. package/node_modules/zod/v4/locales/he.d.ts +4 -0
  1818. package/node_modules/zod/v4/locales/he.js +221 -0
  1819. package/node_modules/zod/v4/locales/hi.cjs +138 -0
  1820. package/node_modules/zod/v4/locales/hi.d.cts +5 -0
  1821. package/node_modules/zod/v4/locales/hi.d.ts +4 -0
  1822. package/node_modules/zod/v4/locales/hi.js +111 -0
  1823. package/node_modules/zod/v4/locales/hr.cjs +153 -0
  1824. package/node_modules/zod/v4/locales/hr.d.cts +5 -0
  1825. package/node_modules/zod/v4/locales/hr.d.ts +4 -0
  1826. package/node_modules/zod/v4/locales/hr.js +126 -0
  1827. package/node_modules/zod/v4/locales/hu.cjs +140 -0
  1828. package/node_modules/zod/v4/locales/hu.d.cts +5 -0
  1829. package/node_modules/zod/v4/locales/hu.d.ts +4 -0
  1830. package/node_modules/zod/v4/locales/hu.js +113 -0
  1831. package/node_modules/zod/v4/locales/hy.cjs +185 -0
  1832. package/node_modules/zod/v4/locales/hy.d.cts +5 -0
  1833. package/node_modules/zod/v4/locales/hy.d.ts +4 -0
  1834. package/node_modules/zod/v4/locales/hy.js +158 -0
  1835. package/node_modules/zod/v4/locales/id.cjs +138 -0
  1836. package/node_modules/zod/v4/locales/id.d.cts +5 -0
  1837. package/node_modules/zod/v4/locales/id.d.ts +4 -0
  1838. package/node_modules/zod/v4/locales/id.js +111 -0
  1839. package/node_modules/zod/v4/locales/index.cjs +152 -0
  1840. package/node_modules/zod/v4/locales/index.d.cts +63 -0
  1841. package/node_modules/zod/v4/locales/index.d.ts +63 -0
  1842. package/node_modules/zod/v4/locales/index.js +63 -0
  1843. package/node_modules/zod/v4/locales/is.cjs +141 -0
  1844. package/node_modules/zod/v4/locales/is.d.cts +5 -0
  1845. package/node_modules/zod/v4/locales/is.d.ts +4 -0
  1846. package/node_modules/zod/v4/locales/is.js +114 -0
  1847. package/node_modules/zod/v4/locales/it.cjs +140 -0
  1848. package/node_modules/zod/v4/locales/it.d.cts +5 -0
  1849. package/node_modules/zod/v4/locales/it.d.ts +4 -0
  1850. package/node_modules/zod/v4/locales/it.js +113 -0
  1851. package/node_modules/zod/v4/locales/ja.cjs +139 -0
  1852. package/node_modules/zod/v4/locales/ja.d.cts +5 -0
  1853. package/node_modules/zod/v4/locales/ja.d.ts +4 -0
  1854. package/node_modules/zod/v4/locales/ja.js +112 -0
  1855. package/node_modules/zod/v4/locales/ka.cjs +144 -0
  1856. package/node_modules/zod/v4/locales/ka.d.cts +5 -0
  1857. package/node_modules/zod/v4/locales/ka.d.ts +4 -0
  1858. package/node_modules/zod/v4/locales/ka.js +117 -0
  1859. package/node_modules/zod/v4/locales/kh.cjs +12 -0
  1860. package/node_modules/zod/v4/locales/kh.d.cts +5 -0
  1861. package/node_modules/zod/v4/locales/kh.d.ts +5 -0
  1862. package/node_modules/zod/v4/locales/kh.js +5 -0
  1863. package/node_modules/zod/v4/locales/km.cjs +142 -0
  1864. package/node_modules/zod/v4/locales/km.d.cts +5 -0
  1865. package/node_modules/zod/v4/locales/km.d.ts +4 -0
  1866. package/node_modules/zod/v4/locales/km.js +115 -0
  1867. package/node_modules/zod/v4/locales/kn.cjs +143 -0
  1868. package/node_modules/zod/v4/locales/kn.d.cts +5 -0
  1869. package/node_modules/zod/v4/locales/kn.d.ts +4 -0
  1870. package/node_modules/zod/v4/locales/kn.js +116 -0
  1871. package/node_modules/zod/v4/locales/ko.cjs +143 -0
  1872. package/node_modules/zod/v4/locales/ko.d.cts +5 -0
  1873. package/node_modules/zod/v4/locales/ko.d.ts +4 -0
  1874. package/node_modules/zod/v4/locales/ko.js +116 -0
  1875. package/node_modules/zod/v4/locales/lt.cjs +234 -0
  1876. package/node_modules/zod/v4/locales/lt.d.cts +5 -0
  1877. package/node_modules/zod/v4/locales/lt.d.ts +4 -0
  1878. package/node_modules/zod/v4/locales/lt.js +207 -0
  1879. package/node_modules/zod/v4/locales/mk.cjs +141 -0
  1880. package/node_modules/zod/v4/locales/mk.d.cts +5 -0
  1881. package/node_modules/zod/v4/locales/mk.d.ts +4 -0
  1882. package/node_modules/zod/v4/locales/mk.js +114 -0
  1883. package/node_modules/zod/v4/locales/ms.cjs +139 -0
  1884. package/node_modules/zod/v4/locales/ms.d.cts +5 -0
  1885. package/node_modules/zod/v4/locales/ms.d.ts +4 -0
  1886. package/node_modules/zod/v4/locales/ms.js +112 -0
  1887. package/node_modules/zod/v4/locales/ne.cjs +138 -0
  1888. package/node_modules/zod/v4/locales/ne.d.cts +5 -0
  1889. package/node_modules/zod/v4/locales/ne.d.ts +4 -0
  1890. package/node_modules/zod/v4/locales/ne.js +111 -0
  1891. package/node_modules/zod/v4/locales/nl.cjs +142 -0
  1892. package/node_modules/zod/v4/locales/nl.d.cts +5 -0
  1893. package/node_modules/zod/v4/locales/nl.d.ts +4 -0
  1894. package/node_modules/zod/v4/locales/nl.js +115 -0
  1895. package/node_modules/zod/v4/locales/nn.cjs +140 -0
  1896. package/node_modules/zod/v4/locales/nn.d.cts +5 -0
  1897. package/node_modules/zod/v4/locales/nn.d.ts +4 -0
  1898. package/node_modules/zod/v4/locales/nn.js +113 -0
  1899. package/node_modules/zod/v4/locales/no.cjs +140 -0
  1900. package/node_modules/zod/v4/locales/no.d.cts +5 -0
  1901. package/node_modules/zod/v4/locales/no.d.ts +4 -0
  1902. package/node_modules/zod/v4/locales/no.js +113 -0
  1903. package/node_modules/zod/v4/locales/ota.cjs +141 -0
  1904. package/node_modules/zod/v4/locales/ota.d.cts +5 -0
  1905. package/node_modules/zod/v4/locales/ota.d.ts +4 -0
  1906. package/node_modules/zod/v4/locales/ota.js +114 -0
  1907. package/node_modules/zod/v4/locales/package.json +7 -0
  1908. package/node_modules/zod/v4/locales/pl.cjs +141 -0
  1909. package/node_modules/zod/v4/locales/pl.d.cts +5 -0
  1910. package/node_modules/zod/v4/locales/pl.d.ts +4 -0
  1911. package/node_modules/zod/v4/locales/pl.js +114 -0
  1912. package/node_modules/zod/v4/locales/ps.cjs +146 -0
  1913. package/node_modules/zod/v4/locales/ps.d.cts +5 -0
  1914. package/node_modules/zod/v4/locales/ps.d.ts +4 -0
  1915. package/node_modules/zod/v4/locales/ps.js +119 -0
  1916. package/node_modules/zod/v4/locales/pt-BR.cjs +170 -0
  1917. package/node_modules/zod/v4/locales/pt-BR.d.cts +5 -0
  1918. package/node_modules/zod/v4/locales/pt-BR.d.ts +4 -0
  1919. package/node_modules/zod/v4/locales/pt-BR.js +143 -0
  1920. package/node_modules/zod/v4/locales/pt.cjs +169 -0
  1921. package/node_modules/zod/v4/locales/pt.d.cts +5 -0
  1922. package/node_modules/zod/v4/locales/pt.d.ts +4 -0
  1923. package/node_modules/zod/v4/locales/pt.js +142 -0
  1924. package/node_modules/zod/v4/locales/ro.cjs +149 -0
  1925. package/node_modules/zod/v4/locales/ro.d.cts +5 -0
  1926. package/node_modules/zod/v4/locales/ro.d.ts +4 -0
  1927. package/node_modules/zod/v4/locales/ro.js +122 -0
  1928. package/node_modules/zod/v4/locales/ru.cjs +195 -0
  1929. package/node_modules/zod/v4/locales/ru.d.cts +5 -0
  1930. package/node_modules/zod/v4/locales/ru.d.ts +4 -0
  1931. package/node_modules/zod/v4/locales/ru.js +168 -0
  1932. package/node_modules/zod/v4/locales/sk.cjs +143 -0
  1933. package/node_modules/zod/v4/locales/sk.d.cts +5 -0
  1934. package/node_modules/zod/v4/locales/sk.d.ts +4 -0
  1935. package/node_modules/zod/v4/locales/sk.js +116 -0
  1936. package/node_modules/zod/v4/locales/sl.cjs +141 -0
  1937. package/node_modules/zod/v4/locales/sl.d.cts +5 -0
  1938. package/node_modules/zod/v4/locales/sl.d.ts +4 -0
  1939. package/node_modules/zod/v4/locales/sl.js +114 -0
  1940. package/node_modules/zod/v4/locales/sv.cjs +142 -0
  1941. package/node_modules/zod/v4/locales/sv.d.cts +5 -0
  1942. package/node_modules/zod/v4/locales/sv.d.ts +4 -0
  1943. package/node_modules/zod/v4/locales/sv.js +115 -0
  1944. package/node_modules/zod/v4/locales/ta.cjs +142 -0
  1945. package/node_modules/zod/v4/locales/ta.d.cts +5 -0
  1946. package/node_modules/zod/v4/locales/ta.d.ts +4 -0
  1947. package/node_modules/zod/v4/locales/ta.js +115 -0
  1948. package/node_modules/zod/v4/locales/tg.cjs +144 -0
  1949. package/node_modules/zod/v4/locales/tg.d.cts +5 -0
  1950. package/node_modules/zod/v4/locales/tg.d.ts +4 -0
  1951. package/node_modules/zod/v4/locales/tg.js +117 -0
  1952. package/node_modules/zod/v4/locales/th.cjs +142 -0
  1953. package/node_modules/zod/v4/locales/th.d.cts +5 -0
  1954. package/node_modules/zod/v4/locales/th.d.ts +4 -0
  1955. package/node_modules/zod/v4/locales/th.js +115 -0
  1956. package/node_modules/zod/v4/locales/tk.cjs +134 -0
  1957. package/node_modules/zod/v4/locales/tk.d.cts +5 -0
  1958. package/node_modules/zod/v4/locales/tk.d.ts +4 -0
  1959. package/node_modules/zod/v4/locales/tk.js +107 -0
  1960. package/node_modules/zod/v4/locales/tr.cjs +137 -0
  1961. package/node_modules/zod/v4/locales/tr.d.cts +5 -0
  1962. package/node_modules/zod/v4/locales/tr.d.ts +4 -0
  1963. package/node_modules/zod/v4/locales/tr.js +110 -0
  1964. package/node_modules/zod/v4/locales/ua.cjs +12 -0
  1965. package/node_modules/zod/v4/locales/ua.d.cts +5 -0
  1966. package/node_modules/zod/v4/locales/ua.d.ts +5 -0
  1967. package/node_modules/zod/v4/locales/ua.js +5 -0
  1968. package/node_modules/zod/v4/locales/uk.cjs +140 -0
  1969. package/node_modules/zod/v4/locales/uk.d.cts +5 -0
  1970. package/node_modules/zod/v4/locales/uk.d.ts +4 -0
  1971. package/node_modules/zod/v4/locales/uk.js +113 -0
  1972. package/node_modules/zod/v4/locales/ur.cjs +142 -0
  1973. package/node_modules/zod/v4/locales/ur.d.cts +5 -0
  1974. package/node_modules/zod/v4/locales/ur.d.ts +4 -0
  1975. package/node_modules/zod/v4/locales/ur.js +115 -0
  1976. package/node_modules/zod/v4/locales/uz.cjs +140 -0
  1977. package/node_modules/zod/v4/locales/uz.d.cts +5 -0
  1978. package/node_modules/zod/v4/locales/uz.d.ts +4 -0
  1979. package/node_modules/zod/v4/locales/uz.js +113 -0
  1980. package/node_modules/zod/v4/locales/vi.cjs +140 -0
  1981. package/node_modules/zod/v4/locales/vi.d.cts +5 -0
  1982. package/node_modules/zod/v4/locales/vi.d.ts +4 -0
  1983. package/node_modules/zod/v4/locales/vi.js +113 -0
  1984. package/node_modules/zod/v4/locales/yo.cjs +139 -0
  1985. package/node_modules/zod/v4/locales/yo.d.cts +5 -0
  1986. package/node_modules/zod/v4/locales/yo.d.ts +4 -0
  1987. package/node_modules/zod/v4/locales/yo.js +112 -0
  1988. package/node_modules/zod/v4/locales/zh-CN.cjs +141 -0
  1989. package/node_modules/zod/v4/locales/zh-CN.d.cts +5 -0
  1990. package/node_modules/zod/v4/locales/zh-CN.d.ts +4 -0
  1991. package/node_modules/zod/v4/locales/zh-CN.js +114 -0
  1992. package/node_modules/zod/v4/locales/zh-TW.cjs +139 -0
  1993. package/node_modules/zod/v4/locales/zh-TW.d.cts +5 -0
  1994. package/node_modules/zod/v4/locales/zh-TW.d.ts +4 -0
  1995. package/node_modules/zod/v4/locales/zh-TW.js +112 -0
  1996. package/node_modules/zod/v4/mini/checks.cjs +54 -0
  1997. package/node_modules/zod/v4/mini/checks.d.cts +1 -0
  1998. package/node_modules/zod/v4/mini/checks.d.ts +1 -0
  1999. package/node_modules/zod/v4/mini/checks.js +1 -0
  2000. package/node_modules/zod/v4/mini/coerce.cjs +71 -0
  2001. package/node_modules/zod/v4/mini/coerce.d.cts +7 -0
  2002. package/node_modules/zod/v4/mini/coerce.d.ts +7 -0
  2003. package/node_modules/zod/v4/mini/coerce.js +22 -0
  2004. package/node_modules/zod/v4/mini/deep-partial.cjs +58 -0
  2005. package/node_modules/zod/v4/mini/deep-partial.d.cts +14 -0
  2006. package/node_modules/zod/v4/mini/deep-partial.d.ts +14 -0
  2007. package/node_modules/zod/v4/mini/deep-partial.js +13 -0
  2008. package/node_modules/zod/v4/mini/external.cjs +95 -0
  2009. package/node_modules/zod/v4/mini/external.d.cts +16 -0
  2010. package/node_modules/zod/v4/mini/external.d.ts +16 -0
  2011. package/node_modules/zod/v4/mini/external.js +16 -0
  2012. package/node_modules/zod/v4/mini/in-out.cjs +82 -0
  2013. package/node_modules/zod/v4/mini/in-out.d.cts +8 -0
  2014. package/node_modules/zod/v4/mini/in-out.d.ts +8 -0
  2015. package/node_modules/zod/v4/mini/in-out.js +36 -0
  2016. package/node_modules/zod/v4/mini/index.cjs +51 -0
  2017. package/node_modules/zod/v4/mini/index.d.cts +3 -0
  2018. package/node_modules/zod/v4/mini/index.d.ts +3 -0
  2019. package/node_modules/zod/v4/mini/index.js +3 -0
  2020. package/node_modules/zod/v4/mini/iso.cjs +83 -0
  2021. package/node_modules/zod/v4/mini/iso.d.cts +22 -0
  2022. package/node_modules/zod/v4/mini/iso.d.ts +22 -0
  2023. package/node_modules/zod/v4/mini/iso.js +34 -0
  2024. package/node_modules/zod/v4/mini/package.json +7 -0
  2025. package/node_modules/zod/v4/mini/parse.cjs +37 -0
  2026. package/node_modules/zod/v4/mini/parse.d.cts +1 -0
  2027. package/node_modules/zod/v4/mini/parse.d.ts +1 -0
  2028. package/node_modules/zod/v4/mini/parse.js +1 -0
  2029. package/node_modules/zod/v4/mini/schemas.cjs +1147 -0
  2030. package/node_modules/zod/v4/mini/schemas.d.cts +480 -0
  2031. package/node_modules/zod/v4/mini/schemas.d.ts +480 -0
  2032. package/node_modules/zod/v4/mini/schemas.js +1002 -0
  2033. package/node_modules/zod/v4/package.json +7 -0
  2034. package/node_modules/zod/v4-mini/index.cjs +51 -0
  2035. package/node_modules/zod/v4-mini/index.d.cts +3 -0
  2036. package/node_modules/zod/v4-mini/index.d.ts +3 -0
  2037. package/node_modules/zod/v4-mini/index.js +3 -0
  2038. package/node_modules/zod/v4-mini/package.json +7 -0
  2039. package/package.json +76 -4
@@ -0,0 +1,2382 @@
1
+ import { createHash, randomBytes, randomUUID, timingSafeEqual } from "node:crypto";
2
+ import { promises as fs } from "node:fs";
3
+ import http2 from "node:http2";
4
+ import os from "node:os";
5
+ import path from "node:path";
6
+ import { decodeSandboxBridgeBody, encodeSandboxBridgeBody, sandboxBridgeBodyCodecSource, sandboxBridgeEnvelopeLimit, } from "./sandbox-callback-bridge-body.js";
7
+ import { runWithoutActiveStep, runWithRuntimeParent, } from "./acpx-engine/startup-timing.js";
8
+ import { preferredShellForSandbox, shellCommandArgs } from "./sandbox-shell.js";
9
+ const DEFAULT_BRIDGE_TOKEN_BYTES = 24;
10
+ const DEFAULT_BRIDGE_POLL_INTERVAL_MS = 100;
11
+ const DEFAULT_BRIDGE_RESPONSE_TIMEOUT_MS = 30_000;
12
+ const MAX_BRIDGE_CONTROL_COMMAND_TIMEOUT_MS = 30_000;
13
+ const DEFAULT_BRIDGE_STOP_TIMEOUT_MS = 2_000;
14
+ const DEFAULT_BRIDGE_MAX_QUEUE_DEPTH = 64;
15
+ // A `BridgeBodyReservation` owner (`http2-bridge-server.ts`) now bounds the
16
+ // process-wide total of live request and response body bytes at
17
+ // `HTTP2_BRIDGE_MAX_PROCESS_BODY_BYTES` (1 GiB), so this per-body limit can
18
+ // rise to the same ceiling `MAX_ATTACHMENT_BYTES`
19
+ // (`server/src/attachment-types.ts`) already accepts, with no unbounded
20
+ // growth in process memory.
21
+ //
22
+ // The attachment upload route carries its file inside a multipart body, so a
23
+ // file at the exact `MAX_ATTACHMENT_BYTES` ceiling needs more than
24
+ // `MAX_ATTACHMENT_BYTES` raw bytes to cross the bridge: the multipart
25
+ // boundary line, each part's `Content-Disposition` and `Content-Type`
26
+ // headers, and the small JSON metadata field this route also accepts all add
27
+ // bytes on top of the file content the server measures. This headroom
28
+ // covers that framing with a wide margin, so a valid maximum-size attachment
29
+ // never fails at the bridge before the server ever sees it.
30
+ const BRIDGE_MULTIPART_FRAMING_HEADROOM_BYTES = 64 * 1024;
31
+ const DEFAULT_BRIDGE_MAX_BODY_BYTES = 10 * 1024 * 1024 + BRIDGE_MULTIPART_FRAMING_HEADROOM_BYTES;
32
+ // Per-iteration timeout for one poll-loop client call. A healthy control-plane
33
+ // round trip finishes in well under one second, so 10s is far above a normal
34
+ // iteration and never false-fires on a slow-but-live call. It is also well
35
+ // under the in-sandbox 30s response deadline
36
+ // (PAPERCLIP_BRIDGE_RESPONSE_TIMEOUT_MS), so the host loop fails fast and writes
37
+ // 503 responses before the in-sandbox client gives up. A silently unresponsive
38
+ // sandbox channel makes a client call hang with no reject; this timeout turns
39
+ // that hang into a caught error, so the poll loop can back off and retry while
40
+ // the watchdog below decides when to fail the queued requests.
41
+ const DEFAULT_BRIDGE_ITERATION_TIMEOUT_MS = 10_000;
42
+ // Watchdog backstop for a hang that the per-iteration timeout does not catch
43
+ // (for example many slow-but-under-timeout calls, or a stall outside the awaited
44
+ // calls). It is larger than one iteration timeout, so a single slow iteration
45
+ // never trips it, and it stays under the in-sandbox 30s response deadline.
46
+ const DEFAULT_BRIDGE_WATCHDOG_TIMEOUT_MS = 20_000;
47
+ // Grace period the recovery path gives an aborted in-flight handler to finalize
48
+ // its own response. The recovery path aborts the handler, then waits this long.
49
+ // A cooperating handler threads the abort signal into its work, rejects, and
50
+ // writes its own response inside the grace, so its accurate result wins. A
51
+ // handler that ignores the signal and never settles does not write inside the
52
+ // grace; the recovery path then writes a non-retryable 504 backstop, so the
53
+ // request never strands with no response. The grace is well under the in-sandbox
54
+ // 30s response deadline, so the backstop lands before the in-sandbox client
55
+ // gives up.
56
+ const DEFAULT_BRIDGE_ABORTED_HANDLER_GRACE_MS = 5_000;
57
+ // The recovery path retries the 504 backstop write this many times before it
58
+ // gives up. A single transient write failure, or one that exceeds the iteration
59
+ // timeout, then does not strand the caller with no terminal response.
60
+ const MAX_BACKSTOP_WRITE_ATTEMPTS = 3;
61
+ // The delay between two 504 backstop write attempts. It is short, so all retries
62
+ // finish well under the in-sandbox 30s response deadline.
63
+ const BACKSTOP_WRITE_RETRY_MS = 50;
64
+ // Backoff cap between poll-loop retries after a transient iteration failure.
65
+ // The cap keeps a recovering loop probing often enough to resume before the
66
+ // in-sandbox 30s response deadline strands queued callers, while the
67
+ // exponential ramp below it keeps a hard-down channel from burning an exec
68
+ // call every poll interval.
69
+ const MAX_TRANSIENT_ITERATION_BACKOFF_MS = 5_000;
70
+ const REMOTE_WRITE_BASE64_CHUNK_SIZE = 32 * 1024;
71
+ export const SANDBOX_CALLBACK_BRIDGE_ENTRYPOINT = "paperclip-bridge-server.mjs";
72
+ const SANDBOX_EXEC_CHANNEL_ENV = "PAPERCLIP_SANDBOX_EXEC_CHANNEL";
73
+ const SANDBOX_EXEC_CHANNEL_BRIDGE = "bridge";
74
+ // The bridge modes the generated gateway supports. The file mode polls a
75
+ // request/response queue on disk. The http2 mode runs one Node HTTP/2 client
76
+ // session directly on stdin/stdout, after it sends the one READY line the
77
+ // host readiness gate expects. The generated `.mjs` selects the mode from
78
+ // `PAPERCLIP_API_BRIDGE_MODE`. The generated gateway rejects every other
79
+ // value with a fixed startup error, including the retired duplex transport.
80
+ // HTTP/2 is the preferred transport. `queue_v1` is the soft-deprecated fallback.
81
+ const SANDBOX_CALLBACK_BRIDGE_FILE_MODE = "queue_v1";
82
+ /** The active non-file transport mode. */
83
+ export const SANDBOX_CALLBACK_BRIDGE_HTTP2_MODE = "http2_v1";
84
+ /** Span name that wraps one Paperclip-API callback request — read the request,
85
+ * write the response, and remove the request file. */
86
+ const CALLBACK_BRIDGE_RELAY_REQUEST_SPAN = "sandbox.callbackBridge.relayRequest";
87
+ /** Span name for a failed or hung bridge worker. The worker runs a throwing
88
+ * function under this span through `input.runtimeSpan`, so the failure lands in
89
+ * the run trace. The run and the orchestrator then see the hang, not only
90
+ * stdout. */
91
+ const CALLBACK_BRIDGE_WORKER_FAILED_SPAN = "sandbox.callbackBridge.workerFailed";
92
+ export const DEFAULT_SANDBOX_CALLBACK_BRIDGE_MAX_BODY_BYTES = DEFAULT_BRIDGE_MAX_BODY_BYTES;
93
+ // Routes the in-sandbox heartbeat skill is documented to call. The server
94
+ // still enforces actor-level permissions on top of this allowlist; the list
95
+ // exists to bound the surface area a compromised CLI could reach via the
96
+ // reverse bridge. Keep this in sync with the Paperclip skill in
97
+ // `skills/paperclip/SKILL.md` and `references/api-reference.md`.
98
+ export const DEFAULT_SANDBOX_CALLBACK_BRIDGE_ROUTE_ALLOWLIST = [
99
+ // Runtime capability authentication is independently checked by the controller.
100
+ { method: "POST", path: /^\/runtime-tools\/github\/credentials$/ },
101
+ // Identity, inbox, agent self-management
102
+ { method: "GET", path: /^\/api\/agents\/me$/ },
103
+ { method: "POST", path: /^\/api\/companies\/[^/]+\/agent-commentary$/ },
104
+ { method: "GET", path: /^\/api\/agents\/me\/inbox-lite$/ },
105
+ { method: "GET", path: /^\/api\/agents\/me\/inbox\/mine$/ },
106
+ { method: "GET", path: /^\/api\/agents\/[^/]+$/ },
107
+ { method: "GET", path: /^\/api\/agents\/[^/]+\/skills$/ },
108
+ { method: "POST", path: /^\/api\/agents\/[^/]+\/skills\/sync$/ },
109
+ { method: "PATCH", path: /^\/api\/agents\/[^/]+\/instructions-path$/ },
110
+ // Read-only schema discovery for validated control-plane requests.
111
+ { method: "GET", path: /^\/api\/openapi\.json$/ },
112
+ // Company-level reads used to discover work and context
113
+ { method: "GET", path: /^\/api\/companies\/[^/]+$/ },
114
+ { method: "GET", path: /^\/api\/companies\/[^/]+\/dashboard$/ },
115
+ { method: "GET", path: /^\/api\/companies\/[^/]+\/agents$/ },
116
+ { method: "GET", path: /^\/api\/companies\/[^/]+\/issues$/ },
117
+ { method: "GET", path: /^\/api\/companies\/[^/]+\/projects$/ },
118
+ { method: "GET", path: /^\/api\/companies\/[^/]+\/goals$/ },
119
+ { method: "GET", path: /^\/api\/companies\/[^/]+\/org$/ },
120
+ { method: "GET", path: /^\/api\/companies\/[^/]+\/approvals$/ },
121
+ { method: "GET", path: /^\/api\/companies\/[^/]+\/routines$/ },
122
+ { method: "GET", path: /^\/api\/companies\/[^/]+\/skills$/ },
123
+ { method: "GET", path: /^\/api\/projects\/[^/]+$/ },
124
+ { method: "GET", path: /^\/api\/goals\/[^/]+$/ },
125
+ // Task-bound email actions. Company, inbox ownership, task/run authority,
126
+ // and action policies are enforced by the controller; mailbox setup stays denied.
127
+ { method: "GET", path: /^\/api\/companies\/[^/]+\/email\/inboxes$/ },
128
+ { method: "GET", path: /^\/api\/companies\/[^/]+\/email\/tasks\/[^/]+$/ },
129
+ { method: "GET", path: /^\/api\/companies\/[^/]+\/email\/deliveries\/[^/]+$/ },
130
+ { method: "POST", path: /^\/api\/companies\/[^/]+\/email\/send$/ },
131
+ // Issue lifecycle: read context, checkout, update, comment, document, release
132
+ { method: "GET", path: /^\/api\/issues\/[^/]+$/ },
133
+ { method: "GET", path: /^\/api\/issues\/[^/]+\/heartbeat-context$/ },
134
+ { method: "GET", path: /^\/api\/issues\/[^/]+\/comments(?:\/[^/]+)?$/ },
135
+ { method: "POST", path: /^\/api\/issues\/[^/]+\/comments$/ },
136
+ { method: "GET", path: /^\/api\/issues\/[^/]+\/documents(?:\/[^/]+)?$/ },
137
+ { method: "GET", path: /^\/api\/issues\/[^/]+\/documents\/[^/]+\/revisions$/ },
138
+ { method: "PUT", path: /^\/api\/issues\/[^/]+\/documents\/[^/]+$/ },
139
+ { method: "POST", path: /^\/api\/issues\/[^/]+\/checkout$/ },
140
+ { method: "POST", path: /^\/api\/issues\/[^/]+\/release$/ },
141
+ { method: "PATCH", path: /^\/api\/issues\/[^/]+$/ },
142
+ { method: "GET", path: /^\/api\/issues\/[^/]+\/approvals$/ },
143
+ // Files: the queue encodes binary bodies; HTTP/2 carries the same bytes directly.
144
+ { method: "GET", path: /^\/api\/issues\/[^/]+\/attachments$/ },
145
+ { method: "POST", path: /^\/api\/companies\/[^/]+\/issues\/[^/]+\/attachments$/ },
146
+ { method: "GET", path: /^\/api\/attachments\/[^/]+\/content$/ },
147
+ // Work products: publish branch/commit/artifact metadata for completed work.
148
+ { method: "GET", path: /^\/api\/issues\/[^/]+\/work-products$/ },
149
+ { method: "POST", path: /^\/api\/issues\/[^/]+\/work-products$/ },
150
+ { method: "PATCH", path: /^\/api\/work-products\/[^/]+$/ },
151
+ // Issue-thread interactions (create, resolve, verdict, and withdraw)
152
+ { method: "GET", path: /^\/api\/issues\/[^/]+\/interactions(?:\/[^/]+)?$/ },
153
+ { method: "POST", path: /^\/api\/issues\/[^/]+\/interactions$/ },
154
+ { method: "POST", path: /^\/api\/issues\/[^/]+\/interactions\/[^/]+\/(?:accept|reject|respond|verdicts|withdraw)$/ },
155
+ // Subtasks / delegation
156
+ { method: "POST", path: /^\/api\/companies\/[^/]+\/issues$/ },
157
+ // Hiring (paperclip-create-agent skill): adapter/icon discovery, comparing
158
+ // existing agent configs, submitting the hire request, and linking the
159
+ // resulting approval to its source issue. Direct agent creation
160
+ // (POST /api/companies/:id/agents) stays denied — hires must go through the
161
+ // approval-gated agent-hires endpoint, which the server still permission-checks.
162
+ { method: "GET", path: /^\/llms\/agent-configuration\.txt$/ },
163
+ { method: "GET", path: /^\/llms\/agent-configuration\/[^/]+\.txt$/ },
164
+ { method: "GET", path: /^\/llms\/agent-icons\.txt$/ },
165
+ { method: "GET", path: /^\/api\/companies\/[^/]+\/agent-configurations$/ },
166
+ { method: "POST", path: /^\/api\/companies\/[^/]+\/agent-hires$/ },
167
+ { method: "POST", path: /^\/api\/issues\/[^/]+\/approvals$/ },
168
+ // Approvals (request, read, comment)
169
+ { method: "GET", path: /^\/api\/approvals\/[^/]+$/ },
170
+ { method: "GET", path: /^\/api\/approvals\/[^/]+\/issues$/ },
171
+ { method: "GET", path: /^\/api\/approvals\/[^/]+\/comments$/ },
172
+ { method: "POST", path: /^\/api\/approvals\/[^/]+\/comments$/ },
173
+ { method: "POST", path: /^\/api\/companies\/[^/]+\/approvals$/ },
174
+ // Execution workspaces and runtime services (start/stop/restart dev servers)
175
+ { method: "GET", path: /^\/api\/execution-workspaces\/[^/]+$/ },
176
+ { method: "POST", path: /^\/api\/execution-workspaces\/[^/]+\/runtime-services\/(?:start|stop|restart)$/ },
177
+ // Routines (agents manage their own routines and triggers)
178
+ { method: "GET", path: /^\/api\/routines\/[^/]+$/ },
179
+ { method: "GET", path: /^\/api\/routines\/[^/]+\/runs$/ },
180
+ { method: "POST", path: /^\/api\/companies\/[^/]+\/routines$/ },
181
+ { method: "PATCH", path: /^\/api\/routines\/[^/]+$/ },
182
+ { method: "POST", path: /^\/api\/routines\/[^/]+\/run$/ },
183
+ { method: "POST", path: /^\/api\/routines\/[^/]+\/triggers$/ },
184
+ { method: "PATCH", path: /^\/api\/routine-triggers\/[^/]+$/ },
185
+ { method: "DELETE", path: /^\/api\/routine-triggers\/[^/]+$/ },
186
+ ];
187
+ // Keep the public alias for callers selecting the HTTP/2 transport.
188
+ export const HTTP2_SANDBOX_CALLBACK_BRIDGE_ROUTE_ALLOWLIST = DEFAULT_SANDBOX_CALLBACK_BRIDGE_ROUTE_ALLOWLIST;
189
+ export const DEFAULT_SANDBOX_CALLBACK_BRIDGE_HEADER_ALLOWLIST = [
190
+ "accept",
191
+ "content-type",
192
+ "if-match",
193
+ "if-none-match",
194
+ "x-paperclip-github-capability",
195
+ ];
196
+ function shellQuote(value) {
197
+ return `'${value.replace(/'/g, `'"'"'`)}'`;
198
+ }
199
+ function normalizeMethod(value) {
200
+ return typeof value === "string" && value.trim().length > 0 ? value.trim().toUpperCase() : "GET";
201
+ }
202
+ function normalizeTimeoutMs(value, fallback) {
203
+ return typeof value === "number" && Number.isFinite(value) && value > 0 ? Math.trunc(value) : fallback;
204
+ }
205
+ /**
206
+ * Race a promise against a timeout. On timeout the returned promise rejects with
207
+ * a clear error. The helper clears the timer on every settle path, so it leaks
208
+ * no `setTimeout`. The wrapped promise is not cancelable; when it never settles,
209
+ * it keeps running in the background, but the caller already moved on through
210
+ * the reject.
211
+ */
212
+ function withTimeout(promise, timeoutMs, label) {
213
+ let timer;
214
+ const timeout = new Promise((_resolve, reject) => {
215
+ timer = setTimeout(() => {
216
+ reject(new Error(`${label} timed out after ${timeoutMs}ms.`));
217
+ }, timeoutMs);
218
+ });
219
+ return Promise.race([promise, timeout]).finally(() => {
220
+ if (timer !== undefined) {
221
+ clearTimeout(timer);
222
+ }
223
+ });
224
+ }
225
+ function toBuffer(bytes) {
226
+ if (Buffer.isBuffer(bytes))
227
+ return bytes;
228
+ if (bytes instanceof ArrayBuffer)
229
+ return Buffer.from(bytes);
230
+ return Buffer.from(bytes.buffer, bytes.byteOffset, bytes.byteLength);
231
+ }
232
+ function buildRunnerFailureMessage(action, result) {
233
+ const stderr = result.stderr.trim();
234
+ const stdout = result.stdout.trim();
235
+ const detail = stderr || stdout;
236
+ if (result.timedOut) {
237
+ return `${action} timed out${detail ? `: ${detail}` : ""}`;
238
+ }
239
+ return `${action} failed with exit code ${result.exitCode ?? "null"}${detail ? `: ${detail}` : ""}`;
240
+ }
241
+ export function runSandboxBridgeControlCommand(runner, input) {
242
+ // These short file/control operations must not inherit an hours-long agent
243
+ // lifetime. Enforce the deadline on the host too: a provider may never settle
244
+ // its promise even when it receives timeoutMs. This does not prove the remote
245
+ // operation stopped; callers must not replay an uncertain write on timeout.
246
+ const controlTimeoutMs = Math.min(normalizeTimeoutMs(input.timeoutMs, MAX_BRIDGE_CONTROL_COMMAND_TIMEOUT_MS), MAX_BRIDGE_CONTROL_COMMAND_TIMEOUT_MS);
247
+ return withTimeout(runner.execute({ ...input, timeoutMs: controlTimeoutMs }), controlTimeoutMs, "Sandbox bridge control command");
248
+ }
249
+ async function runShell(runner, cwd, script, timeoutMs, shellCommand = "sh", stdin) {
250
+ return await runSandboxBridgeControlCommand(runner, {
251
+ command: shellCommand,
252
+ args: shellCommandArgs(script),
253
+ cwd,
254
+ env: {
255
+ [SANDBOX_EXEC_CHANNEL_ENV]: SANDBOX_EXEC_CHANNEL_BRIDGE,
256
+ },
257
+ timeoutMs,
258
+ stdin,
259
+ // Every command that rides this helper is bridge control-plane plumbing:
260
+ // input delivery, output read, callback relay, and queue/setup bookkeeping.
261
+ // It must run concurrently with the agent, so force it off the persistent
262
+ // session. In streamed mode the agent holds that single serialized session
263
+ // for the whole run; a control write on the same session queues behind the
264
+ // agent command that never returns — a permanent deadlock.
265
+ bypassSession: true,
266
+ });
267
+ }
268
+ function requireSuccessfulResult(action, result) {
269
+ if (!result.timedOut && result.exitCode === 0)
270
+ return result;
271
+ throw new Error(buildRunnerFailureMessage(action, result));
272
+ }
273
+ function base64Chunks(body) {
274
+ const out = [];
275
+ for (let offset = 0; offset < body.length; offset += REMOTE_WRITE_BASE64_CHUNK_SIZE) {
276
+ out.push(body.slice(offset, offset + REMOTE_WRITE_BASE64_CHUNK_SIZE));
277
+ }
278
+ return out;
279
+ }
280
+ async function pathExists(filePath) {
281
+ return await fs.stat(filePath).then(() => true).catch(() => false);
282
+ }
283
+ function buildRemotePidLockAcquireScript(lockDirExpr, timeoutMessage) {
284
+ return [
285
+ "attempts=0",
286
+ `while ! mkdir ${lockDirExpr} 2>/dev/null; do`,
287
+ " holder_pid=\"\"",
288
+ ` if [ -s ${lockDirExpr}/pid ]; then`,
289
+ ` holder_pid="$(cat ${lockDirExpr}/pid 2>/dev/null || true)"`,
290
+ " fi",
291
+ " if [ -n \"$holder_pid\" ] && ! kill -0 \"$holder_pid\" 2>/dev/null; then",
292
+ ` rm -rf ${lockDirExpr}`,
293
+ " continue",
294
+ " fi",
295
+ " attempts=$((attempts + 1))",
296
+ " if [ \"$attempts\" -ge 600 ]; then",
297
+ ` echo ${shellQuote(timeoutMessage)} >&2`,
298
+ " exit 1",
299
+ " fi",
300
+ " sleep 0.05",
301
+ "done",
302
+ `printf '%s\\n' "$$" > ${lockDirExpr}/pid`,
303
+ ];
304
+ }
305
+ function buildRemotePidLockCleanupScript(lockDirExpr, cleanupLines) {
306
+ return [
307
+ "cleanup() {",
308
+ ...cleanupLines.map((line) => ` ${line}`),
309
+ ` rm -rf ${lockDirExpr}`,
310
+ "}",
311
+ "trap cleanup EXIT INT TERM",
312
+ ];
313
+ }
314
+ export function createSandboxCallbackBridgeToken(bytes = DEFAULT_BRIDGE_TOKEN_BYTES) {
315
+ return randomBytes(bytes).toString("base64url");
316
+ }
317
+ export function authorizeSandboxCallbackBridgeRequestWithRoutes(request, routes = DEFAULT_SANDBOX_CALLBACK_BRIDGE_ROUTE_ALLOWLIST) {
318
+ const method = normalizeMethod(request.method);
319
+ return routes.some((route) => route.method === method && route.path.test(request.path))
320
+ ? null
321
+ : `Route not allowed: ${method} ${request.path}`;
322
+ }
323
+ export function sanitizeSandboxCallbackBridgeHeaders(headers, allowlist = DEFAULT_SANDBOX_CALLBACK_BRIDGE_HEADER_ALLOWLIST) {
324
+ const allowed = new Set(allowlist.map((header) => header.toLowerCase()));
325
+ return Object.fromEntries(Object.entries(headers).filter(([key]) => allowed.has(key.toLowerCase())));
326
+ }
327
+ export function sandboxCallbackBridgeDirectories(rootDir) {
328
+ return {
329
+ rootDir,
330
+ requestsDir: path.posix.join(rootDir, "requests"),
331
+ responsesDir: path.posix.join(rootDir, "responses"),
332
+ logsDir: path.posix.join(rootDir, "logs"),
333
+ readyFile: path.posix.join(rootDir, "ready.json"),
334
+ pidFile: path.posix.join(rootDir, "server.pid"),
335
+ logFile: path.posix.join(rootDir, "logs", "bridge.log"),
336
+ };
337
+ }
338
+ export function buildSandboxCallbackBridgeEnv(input) {
339
+ return {
340
+ PAPERCLIP_API_BRIDGE_MODE: SANDBOX_CALLBACK_BRIDGE_FILE_MODE,
341
+ PAPERCLIP_BRIDGE_QUEUE_DIR: input.queueDir,
342
+ PAPERCLIP_BRIDGE_TOKEN: input.bridgeToken,
343
+ PAPERCLIP_BRIDGE_HOST: input.host?.trim() || "127.0.0.1",
344
+ PAPERCLIP_BRIDGE_PORT: String(input.port && input.port > 0 ? Math.trunc(input.port) : 0),
345
+ PAPERCLIP_BRIDGE_POLL_INTERVAL_MS: String(normalizeTimeoutMs(input.pollIntervalMs, DEFAULT_BRIDGE_POLL_INTERVAL_MS)),
346
+ PAPERCLIP_BRIDGE_RESPONSE_TIMEOUT_MS: String(normalizeTimeoutMs(input.responseTimeoutMs, DEFAULT_BRIDGE_RESPONSE_TIMEOUT_MS)),
347
+ PAPERCLIP_BRIDGE_MAX_QUEUE_DEPTH: String(normalizeTimeoutMs(input.maxQueueDepth, DEFAULT_BRIDGE_MAX_QUEUE_DEPTH)),
348
+ PAPERCLIP_BRIDGE_MAX_BODY_BYTES: String(normalizeTimeoutMs(input.maxBodyBytes, DEFAULT_BRIDGE_MAX_BODY_BYTES)),
349
+ };
350
+ }
351
+ export async function createSandboxCallbackBridgeAsset() {
352
+ const localDir = await fs.mkdtemp(path.join(os.tmpdir(), "paperclip-bridge-asset-"));
353
+ const entrypoint = path.join(localDir, SANDBOX_CALLBACK_BRIDGE_ENTRYPOINT);
354
+ await fs.writeFile(entrypoint, getSandboxCallbackBridgeServerSource(), "utf8");
355
+ return {
356
+ localDir,
357
+ entrypoint,
358
+ cleanup: async () => {
359
+ await fs.rm(localDir, { recursive: true, force: true }).catch(() => undefined);
360
+ },
361
+ };
362
+ }
363
+ export function createFileSystemSandboxCallbackBridgeQueueClient() {
364
+ return {
365
+ makeDir: async (remotePath) => {
366
+ await fs.mkdir(remotePath, { recursive: true });
367
+ },
368
+ makeDirs: async (remotePaths) => {
369
+ for (const remotePath of remotePaths) {
370
+ await fs.mkdir(remotePath, { recursive: true });
371
+ }
372
+ },
373
+ listJsonFiles: async (remotePath) => {
374
+ const entries = await fs.readdir(remotePath, { withFileTypes: true }).catch(() => []);
375
+ return entries
376
+ .filter((entry) => entry.isFile() && entry.name.endsWith(".json"))
377
+ .map((entry) => entry.name)
378
+ .sort((left, right) => left.localeCompare(right));
379
+ },
380
+ fileSize: async (remotePath) => (await fs.stat(remotePath)).size,
381
+ readTextFile: async (remotePath, maxBytes) => {
382
+ if (maxBytes === undefined)
383
+ return fs.readFile(remotePath, "utf8");
384
+ const file = await fs.open(remotePath, "r");
385
+ try {
386
+ const stat = await file.stat();
387
+ if (stat.size > maxBytes)
388
+ throw new Error("Bridge envelope exceeded the configured size limit.");
389
+ const bytes = Buffer.alloc(Math.min(stat.size, maxBytes) + 1);
390
+ let length = 0;
391
+ while (length < bytes.length) {
392
+ const read = await file.read(bytes, length, bytes.length - length, length);
393
+ if (!read.bytesRead)
394
+ break;
395
+ length += read.bytesRead;
396
+ }
397
+ if (length > stat.size)
398
+ throw new Error("Bridge envelope changed while reading.");
399
+ return bytes.subarray(0, length).toString("utf8");
400
+ }
401
+ finally {
402
+ await file.close();
403
+ }
404
+ },
405
+ writeTextFile: async (remotePath, body) => {
406
+ await fs.mkdir(path.posix.dirname(remotePath), { recursive: true });
407
+ // Write to a temporary path that does NOT end in `.json`, then rename it
408
+ // onto the final `.json` path. A direct `writeFile` truncates the final
409
+ // path first, so a `.json`-only reader (the stdin poller) can see an
410
+ // empty or partial file. The atomic rename never exposes partial content.
411
+ const tempPath = `${remotePath}.paperclip-upload.decoded`;
412
+ await fs.writeFile(tempPath, body, "utf8");
413
+ await fs.rename(tempPath, remotePath);
414
+ },
415
+ writeResponseFile: async (responsePath, body, options = {}) => {
416
+ const responseDir = path.posix.dirname(responsePath);
417
+ const tempPath = `${responsePath}.tmp`;
418
+ const lockDir = `${responsePath}.paperclip-write.lock`;
419
+ const lockPidFile = `${lockDir}/pid`;
420
+ if (options.requestPath) {
421
+ const requestExists = await pathExists(options.requestPath);
422
+ if (!requestExists) {
423
+ return { wrote: false };
424
+ }
425
+ }
426
+ await fs.mkdir(responseDir, { recursive: true });
427
+ // PID-liveness mkdir-mutex: mirrors the shell-based bridge mutex so a
428
+ // crashed holder (SIGKILL / OOM) doesn't deadlock subsequent writers
429
+ // for the full timeout window.
430
+ let attempts = 0;
431
+ while (true) {
432
+ try {
433
+ await fs.mkdir(lockDir);
434
+ await fs.writeFile(lockPidFile, `${process.pid}\n`, "utf8");
435
+ break;
436
+ }
437
+ catch (error) {
438
+ const code = error?.code;
439
+ if (code !== "EEXIST") {
440
+ throw error;
441
+ }
442
+ let holderPid = null;
443
+ try {
444
+ const raw = await fs.readFile(lockPidFile, "utf8");
445
+ const parsed = Number.parseInt(raw.trim(), 10);
446
+ if (Number.isFinite(parsed) && parsed > 0)
447
+ holderPid = parsed;
448
+ }
449
+ catch {
450
+ // pid file missing or unreadable — treat as stale lock
451
+ }
452
+ let holderAlive = false;
453
+ if (holderPid !== null) {
454
+ try {
455
+ process.kill(holderPid, 0);
456
+ holderAlive = true;
457
+ }
458
+ catch {
459
+ holderAlive = false;
460
+ }
461
+ }
462
+ if (!holderAlive) {
463
+ await fs.rm(lockDir, { recursive: true, force: true }).catch(() => undefined);
464
+ continue;
465
+ }
466
+ attempts += 1;
467
+ if (attempts >= 600) {
468
+ throw new Error("Timed out acquiring sandbox callback bridge response lock.");
469
+ }
470
+ await new Promise((resolve) => setTimeout(resolve, 50));
471
+ }
472
+ }
473
+ try {
474
+ if (options.requestPath) {
475
+ const requestExists = await pathExists(options.requestPath);
476
+ if (!requestExists) {
477
+ return { wrote: false };
478
+ }
479
+ }
480
+ const responseExists = await pathExists(responsePath);
481
+ if (responseExists) {
482
+ return { wrote: false };
483
+ }
484
+ await fs.writeFile(tempPath, body, "utf8");
485
+ await fs.rename(tempPath, responsePath);
486
+ return { wrote: true };
487
+ }
488
+ finally {
489
+ await fs.rm(tempPath, { force: true }).catch(() => undefined);
490
+ await fs.rm(lockDir, { recursive: true, force: true }).catch(() => undefined);
491
+ }
492
+ },
493
+ rename: async (fromPath, toPath) => {
494
+ await fs.mkdir(path.posix.dirname(toPath), { recursive: true });
495
+ await fs.rename(fromPath, toPath);
496
+ },
497
+ remove: async (remotePath) => {
498
+ await fs.rm(remotePath, { recursive: true, force: true }).catch(() => undefined);
499
+ },
500
+ };
501
+ }
502
+ export function createCommandManagedSandboxCallbackBridgeQueueClient(input) {
503
+ const timeoutMs = normalizeTimeoutMs(input.timeoutMs, DEFAULT_BRIDGE_RESPONSE_TIMEOUT_MS);
504
+ const shellCommand = preferredShellForSandbox(input.shellCommand);
505
+ const runChecked = async (action, script) => requireSuccessfulResult(action, await runShell(input.runner, input.remoteCwd, script, timeoutMs, shellCommand));
506
+ return {
507
+ makeDir: async (remotePath) => {
508
+ await runChecked(`mkdir ${remotePath}`, `mkdir -p ${shellQuote(remotePath)}`);
509
+ },
510
+ makeDirs: async (remotePaths) => {
511
+ if (remotePaths.length === 0) {
512
+ return;
513
+ }
514
+ const quoted = remotePaths.map((remotePath) => shellQuote(remotePath));
515
+ await runChecked(`mkdir ${remotePaths.join(" ")}`, `mkdir -p ${quoted.join(" ")}`);
516
+ },
517
+ listJsonFiles: async (remotePath) => {
518
+ const result = await runShell(input.runner, input.remoteCwd, [
519
+ `if [ -d ${shellQuote(remotePath)} ]; then`,
520
+ ` for file in ${shellQuote(remotePath)}/*.json; do`,
521
+ ` [ -f "$file" ] || continue`,
522
+ " basename \"$file\"",
523
+ " done",
524
+ "fi",
525
+ ].join("\n"), timeoutMs, shellCommand);
526
+ requireSuccessfulResult(`list ${remotePath}`, result);
527
+ return result.stdout
528
+ .split(/\r?\n/)
529
+ .map((line) => line.trim())
530
+ .filter((line) => line.length > 0)
531
+ .sort((left, right) => left.localeCompare(right));
532
+ },
533
+ fileSize: async (remotePath) => {
534
+ const result = await runChecked(`size ${remotePath}`, `wc -c < ${shellQuote(remotePath)}`);
535
+ return Number(result.stdout.trim());
536
+ },
537
+ readTextFile: async (remotePath, maxBytes) => {
538
+ const command = maxBytes === undefined
539
+ ? `base64 < ${shellQuote(remotePath)}`
540
+ : `head -c ${Math.trunc(maxBytes) + 1} ${shellQuote(remotePath)} | base64`;
541
+ const result = await runChecked(`read ${remotePath}`, command);
542
+ const bytes = Buffer.from(result.stdout.replace(/\s+/g, ""), "base64");
543
+ if (maxBytes !== undefined && bytes.length > maxBytes)
544
+ throw new Error("Bridge envelope exceeded the configured size limit.");
545
+ return bytes.toString("utf8");
546
+ },
547
+ writeTextFile: async (remotePath, body) => {
548
+ const remoteDir = path.posix.dirname(remotePath);
549
+ // Two temporary paths that do NOT end in `.json`, so a `.json`-only
550
+ // reader (the stdin poller) never lists them. The base64 upload lands in
551
+ // `tempPath`. The decode result lands in `decodedPath`. An atomic rename
552
+ // then moves the complete decoded content onto the final `.json` path.
553
+ // A direct `> remotePath` redirect truncates the final path before the
554
+ // decode writes it, so a reader can see an empty or partial file.
555
+ // A failed provider response does not prove the remote command stopped.
556
+ // Keep concurrent or retried uploads from truncating each other's bytes.
557
+ const uploadPath = `${remotePath}.${randomUUID()}.paperclip-upload`;
558
+ const tempPath = `${uploadPath}.b64`;
559
+ const decodedPath = `${uploadPath}.decoded`;
560
+ try {
561
+ await runChecked(`prepare upload ${remotePath}`, `mkdir -p ${shellQuote(remoteDir)} && rm -f ${shellQuote(tempPath)} ${shellQuote(decodedPath)} && : > ${shellQuote(tempPath)}`);
562
+ const base64Body = toBuffer(Buffer.from(body, "utf8")).toString("base64");
563
+ for (const chunk of base64Chunks(base64Body)) {
564
+ await runChecked(`append upload chunk ${remotePath}`, `printf '%s' ${shellQuote(chunk)} >> ${shellQuote(tempPath)}`);
565
+ }
566
+ await runChecked(`finalize upload ${remotePath}`, `base64 -d < ${shellQuote(tempPath)} > ${shellQuote(decodedPath)} && mv ${shellQuote(decodedPath)} ${shellQuote(remotePath)} && rm -f ${shellQuote(tempPath)}`);
567
+ }
568
+ catch (error) {
569
+ // Abandon only this attempt's intermediates, never the published file
570
+ // or another attempt. A late finalize may fail or finish publishing;
571
+ // either is safe for a sequence-aware caller. Preserve the original
572
+ // failure even when the provider is still unavailable for cleanup.
573
+ // Cleanup must not put another provider timeout on the retry/shutdown
574
+ // path. Its unique paths stay safe to remove after this call returns.
575
+ void runChecked(`clean failed upload ${remotePath}`, `rm -f ${shellQuote(tempPath)} ${shellQuote(decodedPath)}`).catch(() => undefined);
576
+ throw error;
577
+ }
578
+ },
579
+ writeResponseFile: async (responsePath, body, options = {}) => {
580
+ const responseDir = path.posix.dirname(responsePath);
581
+ const tempPath = `${responsePath}.tmp`;
582
+ const lockDir = `${responsePath}.paperclip-write.lock`;
583
+ const requestPath = options.requestPath?.trim() || "";
584
+ const result = await runShell(input.runner, input.remoteCwd, [
585
+ "set -eu",
586
+ `response_dir=${shellQuote(responseDir)}`,
587
+ `response_path=${shellQuote(responsePath)}`,
588
+ `temp_path=${shellQuote(tempPath)}`,
589
+ `lock_dir=${shellQuote(lockDir)}`,
590
+ `request_path=${shellQuote(requestPath)}`,
591
+ "mkdir -p \"$response_dir\"",
592
+ ...buildRemotePidLockAcquireScript("\"$lock_dir\"", "Timed out acquiring sandbox callback bridge response lock."),
593
+ ...buildRemotePidLockCleanupScript("\"$lock_dir\"", [
594
+ "rm -f \"$temp_path\"",
595
+ ]),
596
+ "if [ -n \"$request_path\" ] && [ ! -f \"$request_path\" ]; then",
597
+ " printf '{\"wrote\":false}\\n'",
598
+ " exit 0",
599
+ "fi",
600
+ "if [ -f \"$response_path\" ]; then",
601
+ " printf '{\"wrote\":false}\\n'",
602
+ " exit 0",
603
+ "fi",
604
+ "cat > \"$temp_path\"",
605
+ "mv \"$temp_path\" \"$response_path\"",
606
+ "printf '{\"wrote\":true}\\n'",
607
+ ].join("\n"), timeoutMs, shellCommand, body);
608
+ requireSuccessfulResult(`write bridge response ${responsePath}`, result);
609
+ try {
610
+ return {
611
+ wrote: JSON.parse(result.stdout.trim())?.wrote === true,
612
+ };
613
+ }
614
+ catch (error) {
615
+ throw new Error(`Sandbox callback bridge response write wrote invalid result JSON: ${error instanceof Error ? error.message : String(error)}`);
616
+ }
617
+ },
618
+ rename: async (fromPath, toPath) => {
619
+ await runChecked(`rename ${fromPath}`, `mkdir -p ${shellQuote(path.posix.dirname(toPath))} && mv ${shellQuote(fromPath)} ${shellQuote(toPath)}`);
620
+ },
621
+ remove: async (remotePath) => {
622
+ await runChecked(`remove ${remotePath}`, `rm -rf ${shellQuote(remotePath)}`);
623
+ },
624
+ };
625
+ }
626
+ async function writeBridgeResponse(client, requestPath, responsePath, response, options = {}) {
627
+ const body = `${JSON.stringify(response)}\n`;
628
+ if (client.writeResponseFile) {
629
+ await client.writeResponseFile(responsePath, body, options.requireRequestPath === false ? {} : { requestPath });
630
+ return;
631
+ }
632
+ const tempPath = `${responsePath}.tmp`;
633
+ await client.writeTextFile(tempPath, body);
634
+ await client.rename(tempPath, responsePath);
635
+ }
636
+ export async function startSandboxCallbackBridgeWorker(input) {
637
+ const pollIntervalMs = normalizeTimeoutMs(input.pollIntervalMs, DEFAULT_BRIDGE_POLL_INTERVAL_MS);
638
+ const iterationTimeoutMs = normalizeTimeoutMs(input.iterationTimeoutMs, DEFAULT_BRIDGE_ITERATION_TIMEOUT_MS);
639
+ const watchdogTimeoutMs = normalizeTimeoutMs(input.watchdogTimeoutMs, DEFAULT_BRIDGE_WATCHDOG_TIMEOUT_MS);
640
+ const abortedHandlerGraceMs = normalizeTimeoutMs(input.abortedHandlerGraceMs, DEFAULT_BRIDGE_ABORTED_HANDLER_GRACE_MS);
641
+ const maxBodyBytes = normalizeTimeoutMs(input.maxBodyBytes, DEFAULT_BRIDGE_MAX_BODY_BYTES);
642
+ const maxEnvelopeBytes = sandboxBridgeEnvelopeLimit(maxBodyBytes);
643
+ // Load lazily to avoid the HTTP/2 module's constants depending on this module
644
+ // during initialization. Both transports share the host process memory ceiling.
645
+ const { createBridgeBodyReservation } = await import("./http2-bridge-server.js");
646
+ const directories = sandboxCallbackBridgeDirectories(input.queueDir);
647
+ const queueDirectories = [
648
+ directories.rootDir,
649
+ directories.requestsDir,
650
+ directories.responsesDir,
651
+ directories.logsDir,
652
+ ];
653
+ if (input.client.makeDirs) {
654
+ await input.client.makeDirs(queueDirectories);
655
+ }
656
+ else {
657
+ // Backward-compatible fallback for a queue client that omits the batched
658
+ // makeDirs method. Create each queue directory with a single makeDir.
659
+ for (const directory of queueDirectories) {
660
+ await input.client.makeDir(directory);
661
+ }
662
+ }
663
+ let stopping = false;
664
+ let inFlight = 0;
665
+ let settled = false;
666
+ let stopDeadline = Number.POSITIVE_INFINITY;
667
+ let settleResolve = null;
668
+ const settledPromise = new Promise((resolve) => {
669
+ settleResolve = resolve;
670
+ });
671
+ const authorizeRequest = input.authorizeRequest ??
672
+ ((request) => authorizeSandboxCallbackBridgeRequestWithRoutes(request));
673
+ const buildWorkerFailureMessage = (error) => `Sandbox callback bridge worker failed: ${error instanceof Error ? error.message : String(error)}`;
674
+ const inFlightRequestGuards = new Map();
675
+ const processRequestFile = async (fileName) => {
676
+ // Skip a request that already has an active attempt. The guard map holds only
677
+ // in-flight attempts; the attempt's finally removes its guard when it ends. A
678
+ // file that still has a guard is in flight, or it waits for its aborted-handler
679
+ // 504 backstop. A second attempt would register a new guard and re-run the host
680
+ // mutation, so the mutation could apply twice.
681
+ if (inFlightRequestGuards.has(fileName)) {
682
+ return;
683
+ }
684
+ const requestPath = path.posix.join(directories.requestsDir, fileName);
685
+ const responsePath = path.posix.join(directories.responsesDir, fileName);
686
+ const guard = {
687
+ claim: "unclaimed",
688
+ controller: new AbortController(),
689
+ finalized: false,
690
+ };
691
+ inFlightRequestGuards.set(fileName, guard);
692
+ const reservation = createBridgeBodyReservation();
693
+ const envelopeReadReservation = createBridgeBodyReservation();
694
+ // Claim the request for the handler. Return `false` when the recovery path
695
+ // already claimed it; the caller must then not run the mutation and must not
696
+ // write a response, because the recovery path writes a 503 and the caller
697
+ // may retry.
698
+ const claimForHandler = () => {
699
+ if (guard.claim === "abandon") {
700
+ return false;
701
+ }
702
+ guard.claim = "handler";
703
+ return true;
704
+ };
705
+ // Finalize the request exactly once. Claim it for the handler first. When the
706
+ // recovery path already won the claim, skip both the write and the remove.
707
+ // The `finalized` fence stops a double write when the backstop timer already
708
+ // wrote a 504 for a handler the recovery path aborted. The handler wins when
709
+ // it settles inside the grace; the backstop wins when the handler never
710
+ // settles.
711
+ const finalize = async (response) => {
712
+ if (!claimForHandler()) {
713
+ return;
714
+ }
715
+ if (guard.finalized) {
716
+ return;
717
+ }
718
+ guard.finalized = true;
719
+ // This finalize now owns delivery for the request, so drop a pending
720
+ // backstop timer. The handler settled inside the grace, so the backstop no
721
+ // longer needs to wait; `finalize` delivers the terminal response itself,
722
+ // inline, and never leaves the request file for a detached timer that the
723
+ // busy poll loop could starve.
724
+ if (guard.backstopTimer !== undefined) {
725
+ clearTimeout(guard.backstopTimer);
726
+ guard.backstopTimer = undefined;
727
+ }
728
+ // Write the handler response, bounded by the per-iteration timeout so a
729
+ // hung sandbox channel never strands the caller until its own generic
730
+ // deadline. Retry a transient write failure, exactly like the 504 backstop
731
+ // write.
732
+ let lastWriteError = "Sandbox callback bridge could not write the handler response.";
733
+ for (let attempt = 1; attempt <= MAX_BACKSTOP_WRITE_ATTEMPTS; attempt += 1) {
734
+ try {
735
+ await withTimeout(writeBridgeResponse(input.client, requestPath, responsePath, response), iterationTimeoutMs, `Sandbox callback bridge write response for ${response.id}`);
736
+ await input.client.remove(requestPath).catch(() => undefined);
737
+ return;
738
+ }
739
+ catch (error) {
740
+ lastWriteError = error instanceof Error ? error.message : String(error);
741
+ console.warn(`[paperclip] sandbox callback bridge failed to write response for ${response.id} (attempt ${attempt}/${MAX_BACKSTOP_WRITE_ATTEMPTS}): ${lastWriteError}`);
742
+ if (attempt < MAX_BACKSTOP_WRITE_ATTEMPTS) {
743
+ await new Promise((resolve) => setTimeout(resolve, BACKSTOP_WRITE_RETRY_MS));
744
+ }
745
+ }
746
+ }
747
+ // Every handler-response write failed. Deliver a non-retryable 504 backstop
748
+ // inline, so the caller gets a terminal response instead of a retryable 503
749
+ // that repeats a possibly-committed mutation, or a strand until its own
750
+ // deadline. Roll the `finalized` fence back so `writeAbortedHandlerBackstop`
751
+ // can proceed; it re-fences, retries the 504 write, and removes the request
752
+ // file. Await it, so the request file does not linger for the poll loop
753
+ // while the loop still runs.
754
+ guard.finalized = false;
755
+ await writeAbortedHandlerBackstop(fileName, guard, lastWriteError);
756
+ };
757
+ try {
758
+ // Bound the read and its encoded/parsed copies before allocating. Built-in
759
+ // clients stat first so a high configured file limit does not reserve that
760
+ // whole limit for a tiny request. Older clients use the conservative cap.
761
+ const envelopeBytes = input.client.fileSize
762
+ ? await input.client.fileSize(requestPath).catch(() => maxEnvelopeBytes)
763
+ : maxEnvelopeBytes;
764
+ if (envelopeBytes > maxEnvelopeBytes) {
765
+ await finalize({
766
+ id: fileName.replace(/\.json$/i, ""), status: 413,
767
+ headers: { "content-type": "application/json" },
768
+ body: JSON.stringify({ error: "Bridge request envelope exceeded the configured size limit." }),
769
+ completedAt: new Date().toISOString(),
770
+ });
771
+ return;
772
+ }
773
+ const readLimit = Number.isSafeInteger(envelopeBytes) && envelopeBytes >= 0
774
+ ? Math.min(envelopeBytes, maxEnvelopeBytes) : maxEnvelopeBytes;
775
+ if (!envelopeReadReservation.reserve(6 * readLimit)) {
776
+ await finalize({ id: fileName.replace(/\.json$/i, ""), status: 503,
777
+ headers: { "content-type": "application/json" },
778
+ body: JSON.stringify({ error: "Bridge host body capacity is busy. Retry later." }),
779
+ completedAt: new Date().toISOString() });
780
+ return;
781
+ }
782
+ let raw;
783
+ try {
784
+ raw = await input.client.readTextFile(requestPath, readLimit);
785
+ }
786
+ catch (error) {
787
+ // The gateway deletes a request file when its caller stops waiting
788
+ // (client-side timeout cleanup). A read that fails because the file is
789
+ // gone is that benign race, not a channel fault: confirm the file
790
+ // vanished and skip quietly instead of escalating into a recovery
791
+ // pass. A file that is still listed rethrows, so a real read fault
792
+ // keeps its existing handling.
793
+ const remaining = await input.client.listJsonFiles(directories.requestsDir).catch(() => null);
794
+ if (remaining !== null && !remaining.includes(fileName)) {
795
+ return;
796
+ }
797
+ throw error;
798
+ }
799
+ let request;
800
+ try {
801
+ if (Buffer.byteLength(raw) > maxEnvelopeBytes)
802
+ throw new Error("Bridge envelope too large");
803
+ request = JSON.parse(raw);
804
+ decodeSandboxBridgeBody(request, maxBodyBytes);
805
+ }
806
+ catch {
807
+ const requestId = fileName.replace(/\.json$/i, "") || randomUUID();
808
+ await finalize({
809
+ id: requestId,
810
+ status: 400,
811
+ headers: { "content-type": "application/json" },
812
+ body: JSON.stringify({ error: "Invalid bridge request payload." }),
813
+ completedAt: new Date().toISOString(),
814
+ });
815
+ return;
816
+ }
817
+ // Keep only the actual request allocation reserved while forwarding;
818
+ // an abandoned small request must not retain a maximum-sized reservation.
819
+ envelopeReadReservation.release();
820
+ if (!reservation.reserve(4 * Buffer.byteLength(raw) + 2 * Buffer.byteLength(request.body))) {
821
+ await finalize({ id: request.id, status: 503,
822
+ headers: { "content-type": "application/json" },
823
+ body: JSON.stringify({ error: "Bridge host body capacity is busy. Retry later." }),
824
+ completedAt: new Date().toISOString() });
825
+ return;
826
+ }
827
+ const denialReason = await authorizeRequest(request);
828
+ if (denialReason) {
829
+ await finalize({
830
+ id: request.id,
831
+ status: 403,
832
+ headers: { "content-type": "application/json" },
833
+ body: JSON.stringify({ error: denialReason }),
834
+ completedAt: new Date().toISOString(),
835
+ });
836
+ return;
837
+ }
838
+ // Claim the request for the handler before the host operation starts. When
839
+ // the recovery path already claimed it, it writes a 503 and the caller may
840
+ // retry, so do not run the mutation; the retry then applies it once. When
841
+ // the handler claims first, the recovery path leaves the request alone and
842
+ // the handler writes the real response.
843
+ if (!claimForHandler()) {
844
+ return;
845
+ }
846
+ // Build the response, then finalize once. The handler already holds the
847
+ // claim, so `finalize` writes the real response.
848
+ let response;
849
+ let handlerReturned = false;
850
+ try {
851
+ const { bodyEncoding, ...forwardRequest } = request;
852
+ const result = await input.handleRequest({ ...forwardRequest,
853
+ body: bodyEncoding === "base64" ? decodeSandboxBridgeBody(request, maxBodyBytes) : request.body,
854
+ }, { signal: guard.controller.signal, reservation });
855
+ handlerReturned = true;
856
+ const responseBytes = Buffer.byteLength(result.body ?? "");
857
+ if (responseBytes > maxBodyBytes)
858
+ throw new Error("Bridge response body exceeded the configured size limit.");
859
+ if (!reservation.reserve(4 * sandboxBridgeEnvelopeLimit(responseBytes))) {
860
+ throw new Error("Bridge host response body capacity is busy.");
861
+ }
862
+ const responseBody = encodeSandboxBridgeBody(result.body ?? "", maxBodyBytes);
863
+ response = {
864
+ id: request.id,
865
+ status: result.status,
866
+ headers: result.headers ?? {},
867
+ ...responseBody,
868
+ completedAt: new Date().toISOString(),
869
+ };
870
+ }
871
+ catch (error) {
872
+ console.warn(`[paperclip] sandbox callback bridge handler failed for ${request.id}: ${error instanceof Error ? error.message : String(error)}`);
873
+ // Tell a worker abort apart from a normal handler failure. The recovery
874
+ // path aborts `guard.controller` when the per-iteration timeout or the
875
+ // watchdog fires. The abort reaches this catch only after the handler
876
+ // claimed the request and started the host operation. The bridge cannot
877
+ // cancel a host operation that is in flight, so the mutation may have
878
+ // committed. A 502 (or 503) is a retryable status: the caller retries it
879
+ // and applies the mutation twice. So return a non-retryable 504 and mark
880
+ // the outcome indeterminate. The caller must not retry a 504 from the
881
+ // bridge, unlike the retry-safe 503 that the recovery path writes only
882
+ // before the host operation starts.
883
+ if (guard.controller.signal.aborted || (handlerReturned && !["GET", "HEAD", "OPTIONS", "TRACE"].includes(request.method))) {
884
+ response = {
885
+ id: request.id,
886
+ status: 504,
887
+ headers: {
888
+ "content-type": "application/json",
889
+ "x-paperclip-bridge-outcome": "indeterminate",
890
+ },
891
+ body: JSON.stringify({
892
+ error: error instanceof Error ? error.message : String(error),
893
+ outcome: "indeterminate",
894
+ retryable: false,
895
+ }),
896
+ completedAt: new Date().toISOString(),
897
+ };
898
+ }
899
+ else {
900
+ response = {
901
+ id: request.id,
902
+ status: 502,
903
+ headers: { "content-type": "application/json" },
904
+ body: JSON.stringify({
905
+ error: error instanceof Error ? error.message : String(error),
906
+ }),
907
+ completedAt: new Date().toISOString(),
908
+ };
909
+ }
910
+ }
911
+ await finalize(response);
912
+ }
913
+ finally {
914
+ envelopeReadReservation.release();
915
+ reservation.release();
916
+ // Drop the guard only when it still points to this attempt. A retry can
917
+ // register a new attempt under the same file name; that new guard must
918
+ // stay in the map. Keep the guard when a backstop is still pending: a
919
+ // failed terminal write re-arms the backstop and keeps the request file,
920
+ // so the guard must stay in the map. The poll loop then skips the file and
921
+ // does not re-run a possibly-committed mutation before the backstop writes
922
+ // its 504.
923
+ if (guard.backstopTimer === undefined && inFlightRequestGuards.get(fileName) === guard) {
924
+ inFlightRequestGuards.delete(fileName);
925
+ }
926
+ }
927
+ };
928
+ // Write the non-retryable 504 backstop for an aborted handler that did not
929
+ // finalize inside the grace. The `finalized` fence makes this a no-op when the
930
+ // handler already wrote its own response. The request file name is the request
931
+ // id plus `.json`, so derive the id from it without another client read that
932
+ // could hang on the same dead channel.
933
+ const writeAbortedHandlerBackstop = async (fileName, guard, message) => {
934
+ guard.backstopTimer = undefined;
935
+ if (guard.finalized) {
936
+ return;
937
+ }
938
+ guard.finalized = true;
939
+ const requestPath = path.posix.join(directories.requestsDir, fileName);
940
+ const responsePath = path.posix.join(directories.responsesDir, fileName);
941
+ const requestId = fileName.replace(/\.json$/i, "") || randomUUID();
942
+ for (let attempt = 1; attempt <= MAX_BACKSTOP_WRITE_ATTEMPTS; attempt += 1) {
943
+ try {
944
+ await withTimeout(writeBridgeResponse(input.client, requestPath, responsePath, {
945
+ id: requestId,
946
+ status: 504,
947
+ headers: {
948
+ "content-type": "application/json",
949
+ "x-paperclip-bridge-outcome": "indeterminate",
950
+ },
951
+ body: JSON.stringify({ error: message, outcome: "indeterminate", retryable: false }),
952
+ completedAt: new Date().toISOString(),
953
+ }, {
954
+ requireRequestPath: false,
955
+ }), iterationTimeoutMs, `Sandbox callback bridge write 504 backstop for ${requestId}`);
956
+ // The 504 backstop reached the caller. Remove the request file, so the
957
+ // poll loop does not list it again and re-run the mutation.
958
+ await input.client.remove(requestPath).catch(() => undefined);
959
+ return;
960
+ }
961
+ catch (error) {
962
+ console.warn(`[paperclip] sandbox callback bridge failed to write 504 backstop for ${requestId} (attempt ${attempt}/${MAX_BACKSTOP_WRITE_ATTEMPTS}): ${error instanceof Error ? error.message : String(error)}`);
963
+ if (attempt < MAX_BACKSTOP_WRITE_ATTEMPTS) {
964
+ await new Promise((resolve) => setTimeout(resolve, BACKSTOP_WRITE_RETRY_MS));
965
+ }
966
+ }
967
+ }
968
+ // Every backstop write failed. Keep the request file and clear the fence, so a
969
+ // late handler can still finalize its own 504. The guard stays in the map, so
970
+ // the poll loop skips the file and does not re-run the mutation. A removed
971
+ // file plus a set fence would strand the caller until its own deadline and
972
+ // give it a generic 502 instead of the terminal 504.
973
+ //
974
+ // Re-arm the backstop directly. A stuck handler never settles, so its
975
+ // `processRequestFile` never runs the `finally` that drops the guard. The
976
+ // poll loop then skips the file on each iteration, so every iteration
977
+ // succeeds and the watchdog never trips again. No later recovery pass runs,
978
+ // so a re-arm here is the only path that retries the 504 write. Clear the
979
+ // fence before the re-arm, because `scheduleAbortedHandlerBackstop` bails on
980
+ // a set fence. The re-arm only re-writes the 504 response; it never re-runs
981
+ // the mutation, so a retry cannot apply the mutation twice.
982
+ guard.finalized = false;
983
+ scheduleAbortedHandlerBackstop(fileName, guard, message);
984
+ };
985
+ // Arm the backstop timer for a handler the recovery path just aborted. It is
986
+ // idempotent: a second recovery pass (the watchdog and the loop catch both run
987
+ // `failPendingRequests`) does not re-arm a live timer or one that already
988
+ // finalized.
989
+ const scheduleAbortedHandlerBackstop = (fileName, guard, message) => {
990
+ if (guard.finalized || guard.backstopTimer !== undefined) {
991
+ return;
992
+ }
993
+ guard.backstopTimer = setTimeout(() => {
994
+ void writeAbortedHandlerBackstop(fileName, guard, message);
995
+ }, abortedHandlerGraceMs);
996
+ if (typeof guard.backstopTimer.unref === "function") {
997
+ guard.backstopTimer.unref();
998
+ }
999
+ };
1000
+ // Abort every queued request with a 503. The `abandonInFlight` option controls
1001
+ // the completion fence for a request a `processRequestFile` attempt still owns.
1002
+ // The timeout and watchdog recovery pass `true`: the loop already gave up on
1003
+ // the request. When the handler did not yet start the host operation, claim the
1004
+ // request so a later handler claim bails, then write the 503. When the handler
1005
+ // already started, skip the 503; the recovery cannot cancel an in-flight host
1006
+ // operation, and a 503 there would make the caller retry and apply the mutation
1007
+ // twice. The stop drain passes `false` (the default): a request the loop
1008
+ // already picked up keeps its normal completion, so a late handler result still
1009
+ // wins over the drain 503, exactly like the earlier stop behavior.
1010
+ const failPendingRequests = async (message, options = {}) => {
1011
+ if (options.abandonInFlight) {
1012
+ // Abort every in-flight handler first, then arm its 504 backstop. The loop
1013
+ // already gave up on the request. A handler that threads the signal into
1014
+ // its work stops, rejects, and finalizes with its own error response inside
1015
+ // the grace, so the request does not strand. A handler that ignores the
1016
+ // signal and never settles does not finalize inside the grace; the backstop
1017
+ // timer then writes a non-retryable 504, so the request still never
1018
+ // strands. This reads the guard map directly, so it runs even when the
1019
+ // request listing below fails on the same dead channel. It never writes a
1020
+ // 503 for a handler-owned request: the recovery cannot cancel a committed
1021
+ // host mutation, so a retryable status there could apply the mutation twice.
1022
+ for (const [fileName, guard] of inFlightRequestGuards.entries()) {
1023
+ if (guard.claim === "handler") {
1024
+ guard.controller.abort(new Error(message));
1025
+ scheduleAbortedHandlerBackstop(fileName, guard, message);
1026
+ }
1027
+ }
1028
+ }
1029
+ // Wrap each client call in the per-iteration timeout. When the sandbox
1030
+ // channel is unresponsive, a client call hangs with no reject. The timeout
1031
+ // keeps this recovery path fail-fast, so it never re-hangs on the same dead
1032
+ // channel that triggered the recovery.
1033
+ const fileNames = await withTimeout(input.client.listJsonFiles(directories.requestsDir), iterationTimeoutMs, "Sandbox callback bridge list pending requests").catch(() => []);
1034
+ for (const fileName of fileNames) {
1035
+ const guard = inFlightRequestGuards.get(fileName);
1036
+ if (guard && guard.claim === "handler" && (options.abandonInFlight || guard.controller.signal.aborted)) {
1037
+ // The handler already started this request's host operation, or it already
1038
+ // finalized the request. The timeout and watchdog cannot cancel a host
1039
+ // operation that is in flight. A competing 503 here makes the caller retry
1040
+ // while the original mutation still completes, so the mutation applies
1041
+ // twice. Leave the request for the handler to finalize, or for the 504
1042
+ // backstop to finalize when the handler never settles. The recovery path
1043
+ // reaches this skip through `abandonInFlight`. The stop drain reaches it
1044
+ // only when the recovery path already aborted the handler, so a request
1045
+ // whose 504 backstop write failed and kept its file never gets a competing
1046
+ // 503 on stop. A normal in-flight handler at a graceful stop is not
1047
+ // aborted, so it still gets the stop drain 503.
1048
+ continue;
1049
+ }
1050
+ if (options.abandonInFlight && guard) {
1051
+ // The handler did not start the host operation yet. Claim the request, so
1052
+ // the handler bails at its host-operation claim instead of running the
1053
+ // mutation. A retry after the 503 then applies the mutation once.
1054
+ guard.claim = "abandon";
1055
+ }
1056
+ const requestPath = path.posix.join(directories.requestsDir, fileName);
1057
+ const responsePath = path.posix.join(directories.responsesDir, fileName);
1058
+ const requestId = fileName.replace(/\.json$/i, "") || randomUUID();
1059
+ let responseId = requestId;
1060
+ try {
1061
+ const raw = await withTimeout(input.client.readTextFile(requestPath), iterationTimeoutMs, `Sandbox callback bridge read pending request ${requestId}`);
1062
+ const parsed = JSON.parse(raw);
1063
+ if (typeof parsed.id === "string" && parsed.id.length > 0) {
1064
+ responseId = parsed.id;
1065
+ }
1066
+ }
1067
+ catch (error) {
1068
+ // The read or the parse failed, most likely on the same dead channel that
1069
+ // triggered this recovery. Keep the request file, so a later recovery pass
1070
+ // can still read it and deliver a terminal 503. A remove here drops the
1071
+ // request and strands the caller until its own deadline.
1072
+ console.warn(`[paperclip] sandbox callback bridge could not read pending request ${requestId}: ${error instanceof Error ? error.message : String(error)}`);
1073
+ continue;
1074
+ }
1075
+ // Write the 503 first, then remove the request file only after the write
1076
+ // lands. Retry a transient failure, bounded by the per-iteration timeout,
1077
+ // exactly like the finalize and 504 backstop writes. When every attempt
1078
+ // fails, keep the request file. A later recovery pass, or the caller retry,
1079
+ // then still finds the queued request and delivers a terminal 503, instead
1080
+ // of a silent drop that strands the caller until its own deadline. The
1081
+ // request is unclaimed or abandoned, so its host mutation never ran; a later
1082
+ // 503 stays exactly-once.
1083
+ let wrote503 = false;
1084
+ let lastWriteError = "Sandbox callback bridge could not write the recovery 503.";
1085
+ for (let attempt = 1; attempt <= MAX_BACKSTOP_WRITE_ATTEMPTS; attempt += 1) {
1086
+ try {
1087
+ await withTimeout(writeBridgeResponse(input.client, requestPath, responsePath, {
1088
+ id: responseId,
1089
+ status: 503,
1090
+ headers: { "content-type": "application/json" },
1091
+ body: JSON.stringify({ error: message }),
1092
+ completedAt: new Date().toISOString(),
1093
+ }, {
1094
+ requireRequestPath: false,
1095
+ }), iterationTimeoutMs, `Sandbox callback bridge write 503 for ${requestId}`);
1096
+ wrote503 = true;
1097
+ break;
1098
+ }
1099
+ catch (error) {
1100
+ lastWriteError = error instanceof Error ? error.message : String(error);
1101
+ console.warn(`[paperclip] sandbox callback bridge failed to write recovery 503 for ${requestId} (attempt ${attempt}/${MAX_BACKSTOP_WRITE_ATTEMPTS}): ${lastWriteError}`);
1102
+ if (attempt < MAX_BACKSTOP_WRITE_ATTEMPTS) {
1103
+ await new Promise((resolve) => setTimeout(resolve, BACKSTOP_WRITE_RETRY_MS));
1104
+ }
1105
+ }
1106
+ }
1107
+ if (wrote503) {
1108
+ // The 503 landed. Remove the request file, so the poll loop does not
1109
+ // re-process it.
1110
+ await input.client.remove(requestPath).catch(() => undefined);
1111
+ }
1112
+ else {
1113
+ // Every 503 write failed. Keep the request file for a later recovery pass.
1114
+ console.warn(`[paperclip] sandbox callback bridge kept queued request ${requestId} after every recovery 503 write failed: ${lastWriteError}`);
1115
+ }
1116
+ }
1117
+ };
1118
+ // Surface a bridge-worker failure through the run trace, not only stdout. A
1119
+ // failed span under `input.runtimeSpan` records the error against the live run
1120
+ // span, so the run and the orchestrator see the hang. When no `runtimeSpan`
1121
+ // runner is wired (no injected tracer), the helper still writes a warn line,
1122
+ // so the failure is never silent.
1123
+ const surfaceRunError = async (error) => {
1124
+ if (input.runtimeSpan) {
1125
+ try {
1126
+ await input.runtimeSpan(CALLBACK_BRIDGE_WORKER_FAILED_SPAN, async () => {
1127
+ throw error;
1128
+ });
1129
+ }
1130
+ catch {
1131
+ // `runtimeSpan` re-throws after it records the failed span. The error is
1132
+ // now on the trace; swallow it here so the worker recovery continues.
1133
+ }
1134
+ }
1135
+ console.warn(`[paperclip] ${error.message}`);
1136
+ };
1137
+ // The timestamp of the last successful loop iteration. The watchdog compares
1138
+ // it to the current time. The idle branch and every processed request update
1139
+ // it, so steady progress keeps the watchdog re-armed.
1140
+ let lastSuccessfulIterationAt = Date.now();
1141
+ let watchdogTrippedAt = null;
1142
+ let watchdogTripInFlight = false;
1143
+ // Check often enough to fire soon after the threshold, but not so often that
1144
+ // the check adds load. One fifth of the threshold, with a 10ms floor.
1145
+ const watchdogCheckIntervalMs = Math.max(10, Math.floor(watchdogTimeoutMs / 5));
1146
+ const handleWatchdogTrip = async (idleMs) => {
1147
+ const message = `Sandbox callback bridge made no successful poll iteration for ${idleMs}ms; the sandbox connection is unresponsive.`;
1148
+ await surfaceRunError(new Error(message));
1149
+ try {
1150
+ await failPendingRequests(message, { abandonInFlight: true });
1151
+ }
1152
+ catch (error) {
1153
+ console.warn(`[paperclip] sandbox callback bridge watchdog failed to abort queued requests: ${error instanceof Error ? error.message : String(error)}`);
1154
+ }
1155
+ };
1156
+ // Start the long-lived poll loop outside the measured startup-step store.
1157
+ // The `makeDir` calls above are startup work and must keep the active
1158
+ // `bridge.paperclip` step. The loop runs run-time execs for the whole run,
1159
+ // so each loop `sandbox.exec` span must not parent to the ended step or copy
1160
+ // its `criticalPath` flag. `runWithoutActiveStep` empties the store for the
1161
+ // loop only; Node keeps the empty store on every later poll continuation.
1162
+ const loop = runWithoutActiveStep(() => (async () => {
1163
+ // The watchdog runs on its own timer, so it fires even while the loop is
1164
+ // stuck on an awaited client call. It is the backstop for a hang the
1165
+ // per-iteration timeout does not catch. `unref` keeps it from holding the
1166
+ // process open. The loop `finally` clears it on every exit.
1167
+ const watchdogTimer = setInterval(() => {
1168
+ if (settled || stopping)
1169
+ return;
1170
+ const idleMs = Date.now() - lastSuccessfulIterationAt;
1171
+ if (idleMs < watchdogTimeoutMs)
1172
+ return;
1173
+ // Fire once per hang period. Re-arm only after the loop advances
1174
+ // `lastSuccessfulIterationAt` past the last trip (a new successful
1175
+ // iteration), so a persistent hang never fires the watchdog repeatedly.
1176
+ if (watchdogTrippedAt !== null && watchdogTrippedAt >= lastSuccessfulIterationAt)
1177
+ return;
1178
+ if (watchdogTripInFlight)
1179
+ return;
1180
+ watchdogTrippedAt = Date.now();
1181
+ watchdogTripInFlight = true;
1182
+ void handleWatchdogTrip(idleMs).finally(() => {
1183
+ watchdogTripInFlight = false;
1184
+ });
1185
+ }, watchdogCheckIntervalMs);
1186
+ if (typeof watchdogTimer.unref === "function") {
1187
+ watchdogTimer.unref();
1188
+ }
1189
+ try {
1190
+ // Consecutive transient poll failures. A single failed list call — one
1191
+ // reset or slow sandbox exec — must not end the relay for the rest of the
1192
+ // run: the in-sandbox gateway keeps queueing requests, so a dead loop
1193
+ // strands every later API call from the agent (its status writes then look
1194
+ // like connection failures and the issue loses its disposition). Back off
1195
+ // and retry the poll instead. The watchdog stays the escalation path for a
1196
+ // sustained outage — it fires after `watchdogTimeoutMs` without a
1197
+ // successful iteration and fails the queued requests fast, while this loop
1198
+ // keeps probing for recovery.
1199
+ let consecutivePollFailures = 0;
1200
+ while (true) {
1201
+ let fileNames;
1202
+ try {
1203
+ fileNames = await withTimeout(input.client.listJsonFiles(directories.requestsDir), iterationTimeoutMs, "Sandbox callback bridge list requests");
1204
+ consecutivePollFailures = 0;
1205
+ }
1206
+ catch (error) {
1207
+ if (stopping) {
1208
+ break;
1209
+ }
1210
+ consecutivePollFailures += 1;
1211
+ const message = `${buildWorkerFailureMessage(error)} (transient poll failure ${consecutivePollFailures}; retrying)`;
1212
+ if (consecutivePollFailures === 1) {
1213
+ // Put the first failure of a streak on the run trace; later repeats
1214
+ // only warn, so a flapping channel does not spam failed spans.
1215
+ await surfaceRunError(new Error(message));
1216
+ }
1217
+ else {
1218
+ console.warn(`[paperclip] ${message}`);
1219
+ }
1220
+ const backoffMs = Math.min(pollIntervalMs * 2 ** consecutivePollFailures, MAX_TRANSIENT_ITERATION_BACKOFF_MS);
1221
+ await new Promise((resolve) => setTimeout(resolve, backoffMs));
1222
+ continue;
1223
+ }
1224
+ // A file whose attempt is still in flight (or waiting on its 504
1225
+ // backstop) is not actionable: `processRequestFile` would skip it via
1226
+ // the guard map. Treat an all-guarded listing like an empty one and
1227
+ // sleep a poll interval. Re-listing immediately would spin the loop —
1228
+ // an exec storm against a real sandbox channel, and with an in-memory
1229
+ // client a pure-microtask loop that starves every timer in the process
1230
+ // (including the guard's own backstop and abort timers).
1231
+ const actionableFileNames = fileNames.filter((fileName) => !inFlightRequestGuards.has(fileName));
1232
+ if (actionableFileNames.length === 0) {
1233
+ lastSuccessfulIterationAt = Date.now();
1234
+ if (stopping) {
1235
+ break;
1236
+ }
1237
+ await new Promise((resolve) => setTimeout(resolve, pollIntervalMs));
1238
+ continue;
1239
+ }
1240
+ for (const fileName of actionableFileNames) {
1241
+ if (stopping && Date.now() >= stopDeadline)
1242
+ break;
1243
+ inFlight += 1;
1244
+ try {
1245
+ // A request is run-time work, not startup work. Wrap it in a
1246
+ // `sandbox.callbackBridge.relayRequest` span, so its read, write, and
1247
+ // remove execs group under one named span that parents to the live
1248
+ // run span. The span runner reads the run parent per request: the
1249
+ // live parent switches to `agent.turn` during the turn and back to
1250
+ // `task.run` after it. Without a runner, the request runs under the
1251
+ // run parent with no wrapper span, exactly like the earlier behavior.
1252
+ // The per-iteration timeout wraps the whole request, so a hung
1253
+ // request rejects and the catch below runs the recovery pass.
1254
+ await withTimeout(input.runtimeSpan
1255
+ ? input.runtimeSpan(CALLBACK_BRIDGE_RELAY_REQUEST_SPAN, () => processRequestFile(fileName))
1256
+ : runWithRuntimeParent(input.getRuntimeParentContext?.(), () => processRequestFile(fileName)), iterationTimeoutMs, `Sandbox callback bridge process request ${fileName}`);
1257
+ lastSuccessfulIterationAt = Date.now();
1258
+ }
1259
+ catch (error) {
1260
+ // A single request attempt failed or hung. Run the same recovery
1261
+ // pass the loop previously died on — abort the in-flight handler
1262
+ // (its 504 backstop keeps the caller from stranding) and 503 the
1263
+ // unclaimed queued requests — but keep the loop alive afterward. A
1264
+ // caller that sees the retry-safe 503 re-queues, and the recovered
1265
+ // loop serves the retry; the old terminal catch left every later
1266
+ // request to strand instead.
1267
+ const message = buildWorkerFailureMessage(error);
1268
+ await surfaceRunError(new Error(message));
1269
+ try {
1270
+ await failPendingRequests(message, { abandonInFlight: true });
1271
+ }
1272
+ catch (failPendingError) {
1273
+ console.warn(`[paperclip] sandbox callback bridge failed to abort queued requests after a request failure: ${failPendingError instanceof Error ? failPendingError.message : String(failPendingError)}`);
1274
+ }
1275
+ }
1276
+ finally {
1277
+ inFlight -= 1;
1278
+ }
1279
+ }
1280
+ lastSuccessfulIterationAt = Date.now();
1281
+ if (stopping && Date.now() >= stopDeadline) {
1282
+ break;
1283
+ }
1284
+ }
1285
+ }
1286
+ catch (error) {
1287
+ const message = buildWorkerFailureMessage(error);
1288
+ await surfaceRunError(new Error(message));
1289
+ try {
1290
+ await failPendingRequests(message, { abandonInFlight: true });
1291
+ }
1292
+ catch (failPendingError) {
1293
+ console.warn(`[paperclip] sandbox callback bridge failed to abort queued requests after worker failure: ${failPendingError instanceof Error ? failPendingError.message : String(failPendingError)}`);
1294
+ }
1295
+ }
1296
+ finally {
1297
+ clearInterval(watchdogTimer);
1298
+ settled = true;
1299
+ if (settleResolve) {
1300
+ settleResolve();
1301
+ }
1302
+ }
1303
+ })());
1304
+ void loop;
1305
+ return {
1306
+ stop: async (options = {}) => {
1307
+ stopping = true;
1308
+ const drainMs = normalizeTimeoutMs(options.drainTimeoutMs, DEFAULT_BRIDGE_STOP_TIMEOUT_MS);
1309
+ stopDeadline = Date.now() + drainMs;
1310
+ if (!settled) {
1311
+ await Promise.race([
1312
+ settledPromise,
1313
+ new Promise((resolve) => setTimeout(resolve, drainMs)),
1314
+ ]);
1315
+ }
1316
+ await failPendingRequests("Bridge worker stopped before request could be handled.");
1317
+ },
1318
+ };
1319
+ }
1320
+ /**
1321
+ * Content-hash-skip write of a Paperclip-authored text file into the sandbox, in
1322
+ * a SINGLE remote exec. The body's sha256 is computed on the host; the one shell
1323
+ * round-trip skips the write entirely when the remote file already hashes to the
1324
+ * same value (warm start — 0 write execs), otherwise it uploads (base64 over
1325
+ * stdin), verifies the decoded bytes, and atomically renames into place. A
1326
+ * PID-liveness lock serializes concurrent writers to the same path and the
1327
+ * verify step guards against a torn upload.
1328
+ *
1329
+ * Fail loudly: a non-zero remote exit (surfaced by `requireSuccessfulResult`) or
1330
+ * malformed result JSON throws rather than silently re-uploading and masking a
1331
+ * failed check. The only intentional degradation is when the remote has neither
1332
+ * `sha256sum` nor `shasum` — then the skip cannot be proven and we conservatively
1333
+ * re-upload (and the post-upload verify is best-effort, as noted inline).
1334
+ */
1335
+ export async function syncRemoteTextFileWithHashSkip(input) {
1336
+ const timeoutMs = normalizeTimeoutMs(input.timeoutMs, DEFAULT_BRIDGE_RESPONSE_TIMEOUT_MS);
1337
+ const shellCommand = preferredShellForSandbox(input.shellCommand);
1338
+ const remotePartial = `${input.remotePath}.partial`;
1339
+ const remoteUploadPath = `${input.remotePath}.paperclip-upload.b64`;
1340
+ const base64Body = toBuffer(Buffer.from(input.body, "utf8")).toString("base64");
1341
+ const sha256 = createHash("sha256").update(input.body, "utf8").digest("hex");
1342
+ const syncResult = await runShell(input.runner, input.remoteCwd, [
1343
+ "set -eu",
1344
+ `remote_dir=${shellQuote(input.remoteDir)}`,
1345
+ `remote_path=${shellQuote(input.remotePath)}`,
1346
+ `remote_partial=${shellQuote(remotePartial)}`,
1347
+ `remote_upload=${shellQuote(remoteUploadPath)}`,
1348
+ `lock_dir=${shellQuote(input.lockDir)}`,
1349
+ `expected_sha=${shellQuote(sha256)}`,
1350
+ "hash_file() {",
1351
+ " if command -v sha256sum >/dev/null 2>&1; then",
1352
+ " sha256sum \"$1\" | awk '{print $1}'",
1353
+ " return 0",
1354
+ " fi",
1355
+ " if command -v shasum >/dev/null 2>&1; then",
1356
+ " shasum -a 256 \"$1\" | awk '{print $1}'",
1357
+ " return 0",
1358
+ " fi",
1359
+ " return 127",
1360
+ "}",
1361
+ "mkdir -p \"$remote_dir\"",
1362
+ ...buildRemotePidLockAcquireScript("\"$lock_dir\"", `Timed out acquiring ${input.label} upload lock.`),
1363
+ ...buildRemotePidLockCleanupScript("\"$lock_dir\"", [
1364
+ "rm -f \"$remote_upload\" \"$remote_partial\"",
1365
+ ]),
1366
+ "current_sha=\"\"",
1367
+ "if [ -f \"$remote_path\" ]; then",
1368
+ " current_sha=\"$(hash_file \"$remote_path\" 2>/dev/null)\" || current_sha=\"\"",
1369
+ "fi",
1370
+ "if [ -n \"$current_sha\" ] && [ \"$current_sha\" = \"$expected_sha\" ]; then",
1371
+ " printf '{\"uploaded\":false}\\n'",
1372
+ " exit 0",
1373
+ "fi",
1374
+ "rm -f \"$remote_upload\" \"$remote_partial\"",
1375
+ "cat > \"$remote_upload\"",
1376
+ "base64 -d < \"$remote_upload\" > \"$remote_partial\"",
1377
+ // Verify upload integrity. If neither sha256sum nor shasum is on PATH
1378
+ // (minimal Alpine/scratch images), surface the missing-tool error
1379
+ // instead of a misleading "sha mismatch" — the verify step is then
1380
+ // best-effort and we trust base64-decode + atomic rename below.
1381
+ "if partial_sha=\"$(hash_file \"$remote_partial\" 2>/dev/null)\"; then",
1382
+ " if [ \"$partial_sha\" != \"$expected_sha\" ]; then",
1383
+ ` echo ${shellQuote(`${input.label} upload sha mismatch.`)} >&2`,
1384
+ " exit 1",
1385
+ " fi",
1386
+ "else",
1387
+ ` echo ${shellQuote(`${input.label} sha verify skipped: no sha256sum/shasum on remote.`)} >&2`,
1388
+ "fi",
1389
+ "mv \"$remote_partial\" \"$remote_path\"",
1390
+ "printf '{\"uploaded\":true}\\n'",
1391
+ ].join("\n"), timeoutMs, shellCommand, base64Body);
1392
+ requireSuccessfulResult(input.action, syncResult);
1393
+ let uploaded = false;
1394
+ try {
1395
+ uploaded = JSON.parse(syncResult.stdout.trim())?.uploaded === true;
1396
+ }
1397
+ catch (error) {
1398
+ throw new Error(`${input.label} sync wrote invalid result JSON: ${error instanceof Error ? error.message : String(error)}`);
1399
+ }
1400
+ return { uploaded, sha256 };
1401
+ }
1402
+ export async function syncSandboxCallbackBridgeEntrypoint(input) {
1403
+ const remoteEntrypoint = path.posix.join(input.assetRemoteDir, SANDBOX_CALLBACK_BRIDGE_ENTRYPOINT);
1404
+ const entrypointSource = await fs.readFile(input.bridgeAsset.entrypoint, "utf8");
1405
+ const { uploaded, sha256 } = await syncRemoteTextFileWithHashSkip({
1406
+ runner: input.runner,
1407
+ remoteCwd: input.remoteCwd,
1408
+ remoteDir: input.assetRemoteDir,
1409
+ remotePath: remoteEntrypoint,
1410
+ body: entrypointSource,
1411
+ label: "Sandbox callback bridge entrypoint",
1412
+ action: "sync sandbox callback bridge entrypoint",
1413
+ lockDir: path.posix.join(input.assetRemoteDir, ".paperclip-bridge-upload.lock"),
1414
+ timeoutMs: input.timeoutMs,
1415
+ shellCommand: input.shellCommand,
1416
+ });
1417
+ return {
1418
+ remoteEntrypoint,
1419
+ sha256,
1420
+ uploaded,
1421
+ };
1422
+ }
1423
+ export async function startSandboxCallbackBridgeServer(input) {
1424
+ const timeoutMs = normalizeTimeoutMs(input.timeoutMs, DEFAULT_BRIDGE_RESPONSE_TIMEOUT_MS);
1425
+ const shellCommand = preferredShellForSandbox(input.shellCommand);
1426
+ const directories = sandboxCallbackBridgeDirectories(input.queueDir);
1427
+ let remoteEntrypoint = path.posix.join(input.assetRemoteDir, SANDBOX_CALLBACK_BRIDGE_ENTRYPOINT);
1428
+ if (input.bridgeAsset) {
1429
+ const assetSync = await syncSandboxCallbackBridgeEntrypoint({
1430
+ runner: input.runner,
1431
+ remoteCwd: input.remoteCwd,
1432
+ assetRemoteDir: input.assetRemoteDir,
1433
+ bridgeAsset: input.bridgeAsset,
1434
+ timeoutMs,
1435
+ shellCommand,
1436
+ });
1437
+ remoteEntrypoint = assetSync.remoteEntrypoint;
1438
+ }
1439
+ const env = buildSandboxCallbackBridgeEnv({
1440
+ queueDir: input.queueDir,
1441
+ bridgeToken: input.bridgeToken,
1442
+ host: input.host,
1443
+ port: input.port,
1444
+ pollIntervalMs: input.pollIntervalMs,
1445
+ responseTimeoutMs: input.responseTimeoutMs,
1446
+ maxQueueDepth: input.maxQueueDepth,
1447
+ maxBodyBytes: input.maxBodyBytes,
1448
+ });
1449
+ const nodeCommand = input.nodeCommand?.trim() || "node";
1450
+ const startResult = await runSandboxBridgeControlCommand(input.runner, {
1451
+ command: shellCommand,
1452
+ args: shellCommandArgs([
1453
+ `mkdir -p ${shellQuote(directories.requestsDir)} ${shellQuote(directories.responsesDir)} ${shellQuote(directories.logsDir)}`,
1454
+ `rm -f ${shellQuote(directories.readyFile)} ${shellQuote(directories.pidFile)}`,
1455
+ `nohup ${shellQuote(nodeCommand)} ${shellQuote(remoteEntrypoint)} ` +
1456
+ `>> ${shellQuote(directories.logFile)} 2>&1 < /dev/null &`,
1457
+ "pid=$!",
1458
+ `printf '%s\\n' \"$pid\" > ${shellQuote(directories.pidFile)}`,
1459
+ "printf '{\"pid\":%s}\\n' \"$pid\"",
1460
+ ].join("\n")),
1461
+ cwd: input.remoteCwd,
1462
+ env: {
1463
+ [SANDBOX_EXEC_CHANNEL_ENV]: SANDBOX_EXEC_CHANNEL_BRIDGE,
1464
+ ...env,
1465
+ },
1466
+ timeoutMs,
1467
+ });
1468
+ requireSuccessfulResult("start sandbox callback bridge", startResult);
1469
+ const readyResult = await runShell(input.runner, input.remoteCwd, [
1470
+ "i=0",
1471
+ `while [ \"$i\" -lt 200 ]; do`,
1472
+ ` if [ -s ${shellQuote(directories.readyFile)} ]; then`,
1473
+ ` cat ${shellQuote(directories.readyFile)}`,
1474
+ " exit 0",
1475
+ " fi",
1476
+ ` if [ -s ${shellQuote(directories.logFile)} ] && ! kill -0 \"$(cat ${shellQuote(directories.pidFile)} 2>/dev/null)\" 2>/dev/null; then`,
1477
+ ` cat ${shellQuote(directories.logFile)} >&2`,
1478
+ " exit 1",
1479
+ " fi",
1480
+ " i=$((i + 1))",
1481
+ " sleep 0.05",
1482
+ "done",
1483
+ `echo "Timed out waiting for bridge readiness." >&2`,
1484
+ `if [ -s ${shellQuote(directories.logFile)} ]; then cat ${shellQuote(directories.logFile)} >&2; fi`,
1485
+ "exit 1",
1486
+ ].join("\n"), timeoutMs, shellCommand);
1487
+ requireSuccessfulResult("wait for sandbox callback bridge readiness", readyResult);
1488
+ let readyData;
1489
+ try {
1490
+ readyData = JSON.parse(readyResult.stdout.trim());
1491
+ }
1492
+ catch (error) {
1493
+ throw new Error(`Sandbox callback bridge wrote invalid readiness JSON: ${error instanceof Error ? error.message : String(error)}`);
1494
+ }
1495
+ const host = typeof readyData.host === "string" && readyData.host.trim().length > 0
1496
+ ? readyData.host.trim()
1497
+ : "127.0.0.1";
1498
+ const port = typeof readyData.port === "number" && Number.isFinite(readyData.port) ? readyData.port : 0;
1499
+ if (!port) {
1500
+ throw new Error("Sandbox callback bridge did not report a listening port.");
1501
+ }
1502
+ const baseUrl = typeof readyData.baseUrl === "string" && readyData.baseUrl.trim().length > 0
1503
+ ? readyData.baseUrl.trim()
1504
+ : `http://${host}:${port}`;
1505
+ return {
1506
+ baseUrl,
1507
+ host,
1508
+ port,
1509
+ pid: typeof readyData.pid === "number" && Number.isFinite(readyData.pid) ? readyData.pid : 0,
1510
+ directories,
1511
+ stop: async () => {
1512
+ const stopResult = await runSandboxBridgeControlCommand(input.runner, {
1513
+ command: shellCommand,
1514
+ args: shellCommandArgs([
1515
+ `if [ -s ${shellQuote(directories.pidFile)} ]; then`,
1516
+ ` pid="$(cat ${shellQuote(directories.pidFile)})"`,
1517
+ " kill \"$pid\" 2>/dev/null || true",
1518
+ " i=0",
1519
+ " while kill -0 \"$pid\" 2>/dev/null && [ \"$i\" -lt 40 ]; do",
1520
+ " i=$((i + 1))",
1521
+ " sleep 0.05",
1522
+ " done",
1523
+ "fi",
1524
+ `rm -f ${shellQuote(directories.pidFile)} ${shellQuote(directories.readyFile)}`,
1525
+ ].join("\n")),
1526
+ cwd: input.remoteCwd,
1527
+ env: {
1528
+ [SANDBOX_EXEC_CHANNEL_ENV]: SANDBOX_EXEC_CHANNEL_BRIDGE,
1529
+ },
1530
+ timeoutMs,
1531
+ });
1532
+ if (stopResult.timedOut) {
1533
+ throw new Error(buildRunnerFailureMessage("stop sandbox callback bridge", stopResult));
1534
+ }
1535
+ },
1536
+ };
1537
+ }
1538
+ // ---------------------------------------------------------------------------
1539
+ // Sandbox HTTP/2 client gateway
1540
+ //
1541
+ // This gateway turns each local loopback request into one HTTP/2 stream to
1542
+ // the host server in `http2-bridge-server.ts`. It sits beside the file-mode
1543
+ // gateway above; it changes neither of them. The generated in-sandbox
1544
+ // entrypoint and the transport-selection path already select it.
1545
+ // ---------------------------------------------------------------------------
1546
+ /**
1547
+ * Constant-time bridge-token compare. Both this sandbox gateway and the host
1548
+ * server in `http2-bridge-server.ts` import this one helper, so the gateway
1549
+ * check and the independent host check (accepted security fix 4) apply the
1550
+ * exact same comparison rule. A length mismatch returns `false` without a
1551
+ * `timingSafeEqual` call, because `timingSafeEqual` throws on unequal buffer
1552
+ * lengths; both operands are bridge tokens of near-fixed length, so this one
1553
+ * length branch leaks no useful timing signal.
1554
+ */
1555
+ export function compareBridgeTokensConstantTime(expected, received) {
1556
+ const expectedBytes = Buffer.from(expected, "utf8");
1557
+ const receivedBytes = Buffer.from(typeof received === "string" ? received : "", "utf8");
1558
+ if (expectedBytes.length !== receivedBytes.length)
1559
+ return false;
1560
+ return timingSafeEqual(expectedBytes, receivedBytes);
1561
+ }
1562
+ const SANDBOX_HTTP2_GATEWAY_DEFAULT_AUTHORITY = "bridge.internal";
1563
+ function forwardOneHttp2Request(session, request) {
1564
+ return new Promise((resolve, reject) => {
1565
+ const query = request.query.trim();
1566
+ const pathWithQuery = query.length === 0 ? request.path : `${request.path}${query.startsWith("?") ? query : `?${query}`}`;
1567
+ const requestHeaders = {
1568
+ ":method": request.method,
1569
+ ":path": pathWithQuery,
1570
+ authorization: `Bearer ${request.bridgeToken}`,
1571
+ ...request.headers,
1572
+ };
1573
+ let stream;
1574
+ try {
1575
+ stream = session.request(requestHeaders, { endStream: request.body.length === 0 });
1576
+ }
1577
+ catch (error) {
1578
+ reject(error instanceof Error ? error : new Error(String(error)));
1579
+ return;
1580
+ }
1581
+ const chunks = [];
1582
+ let responseHeaders = {};
1583
+ let status = 502;
1584
+ let settled = false;
1585
+ const settle = (run) => {
1586
+ if (settled)
1587
+ return;
1588
+ settled = true;
1589
+ run();
1590
+ };
1591
+ stream.on("response", (headers) => {
1592
+ const rawStatus = headers[":status"];
1593
+ status = typeof rawStatus === "number" ? rawStatus : Number(rawStatus) || 502;
1594
+ responseHeaders = {};
1595
+ for (const [key, value] of Object.entries(headers)) {
1596
+ if (key.startsWith(":") || value == null)
1597
+ continue;
1598
+ responseHeaders[key] = Array.isArray(value) ? value.join(", ") : String(value);
1599
+ }
1600
+ });
1601
+ stream.on("data", (chunk) => chunks.push(chunk));
1602
+ stream.once("end", () => settle(() => resolve({ status, headers: responseHeaders, body: Buffer.concat(chunks) })));
1603
+ stream.once("error", (error) => settle(() => reject(error instanceof Error ? error : new Error(String(error)))));
1604
+ stream.once("aborted", () => settle(() => reject(new Error("Bridge HTTP/2 stream aborted."))));
1605
+ if (request.body.length > 0) {
1606
+ stream.end(request.body);
1607
+ }
1608
+ else if (!stream.writableEnded) {
1609
+ stream.end();
1610
+ }
1611
+ });
1612
+ }
1613
+ /**
1614
+ * Create the sandbox HTTP/2 client gateway. It opens one HTTP/2 client
1615
+ * session on the transport `createConnection` returns, and forwards each
1616
+ * local request the caller hands it (already checked against the bridge
1617
+ * token — see {@link SandboxHttp2BridgeGatewayRequest.receivedToken}) as one
1618
+ * HTTP/2 stream. It keeps the header allowlist on the sandbox side, exactly
1619
+ * as the file-mode gateway does.
1620
+ */
1621
+ export function createSandboxHttp2BridgeGateway(options) {
1622
+ const authority = options.authority?.trim() || SANDBOX_HTTP2_GATEWAY_DEFAULT_AUTHORITY;
1623
+ const headerAllowlist = options.headerAllowlist ?? DEFAULT_SANDBOX_CALLBACK_BRIDGE_HEADER_ALLOWLIST;
1624
+ const session = http2.connect(`http://${authority}`, {
1625
+ createConnection: options.createConnection,
1626
+ });
1627
+ // A session-level fault fails every in-flight `forwardRequest` call through
1628
+ // that stream's own `error`/`aborted` handler. This listener only stops
1629
+ // Node from raising an unhandled `error` event for the session itself.
1630
+ session.on("error", () => undefined);
1631
+ session.on("goaway", (errorCode, lastStreamId) => {
1632
+ options.onGoaway?.({ lastStreamId, errorCode });
1633
+ });
1634
+ return {
1635
+ forwardRequest(request) {
1636
+ // The gateway check (accepted security fix 4 keeps this as well as the
1637
+ // independent host-side check): a request whose token does not match
1638
+ // the per-run bridge token never opens a stream.
1639
+ if (!compareBridgeTokensConstantTime(options.bridgeToken, request.receivedToken)) {
1640
+ return Promise.reject(new Error("Invalid bridge token."));
1641
+ }
1642
+ return forwardOneHttp2Request(session, {
1643
+ bridgeToken: options.bridgeToken,
1644
+ method: request.method,
1645
+ path: request.path,
1646
+ query: request.query,
1647
+ headers: sanitizeSandboxCallbackBridgeHeaders(request.headers, headerAllowlist),
1648
+ body: request.body,
1649
+ });
1650
+ },
1651
+ close() {
1652
+ return new Promise((resolve) => {
1653
+ if (session.closed || session.destroyed) {
1654
+ resolve();
1655
+ return;
1656
+ }
1657
+ session.close(() => resolve());
1658
+ });
1659
+ },
1660
+ };
1661
+ }
1662
+ /**
1663
+ * The zero-dependency codec the generated duplex gateway embeds. It is a plain
1664
+ * JavaScript copy of the encode side of the host codec in `duplex-frame-codec.ts`.
1665
+ * The generated gateway never decodes: it writes exactly one READY line, then
1666
+ * hands stdout to its transport. So this copy carries only the frame version and
1667
+ * the encode function, not a decoder. It uses only the `Buffer` and `JSON`
1668
+ * globals, so the generated `.mjs` needs no workspace import. It carries no
1669
+ * template literal and no `${` sequence, so it embeds inside the gateway
1670
+ * template literal with no escape.
1671
+ *
1672
+ * A shared fixture file (`duplex-frame-vectors.json`) proves the host encode side
1673
+ * stays wire compatible with this copy. {@link getSandboxDuplexGatewayCodecSource}
1674
+ * returns this exact source so a test can run the READY encode vector against it.
1675
+ */
1676
+ const DUPLEX_GATEWAY_CODEC_SOURCE = `const DUPLEX_FRAME_VERSION = 2;
1677
+
1678
+ function encodeDuplexFrame(frame) {
1679
+ return JSON.stringify(frame) + "\\n";
1680
+ }`;
1681
+ /**
1682
+ * Return the exact zero-dependency codec source the generated duplex gateway
1683
+ * embeds. A test wraps this source and calls `encodeDuplexFrame` to prove the
1684
+ * embedded copy encodes the READY frame the same way the host encode side does.
1685
+ * The source declares `encodeDuplexFrame` and `DUPLEX_FRAME_VERSION`, but exports
1686
+ * neither; a caller wraps it to read those names.
1687
+ */
1688
+ export function getSandboxDuplexGatewayCodecSource() {
1689
+ return DUPLEX_GATEWAY_CODEC_SOURCE;
1690
+ }
1691
+ /**
1692
+ * Zero-dependency source for the gateway's own aggregate body-byte ledger.
1693
+ * `readBodyBytes` in the generated gateway reserves against one instance of
1694
+ * this ledger before it retains a chunk and before it concatenates the final
1695
+ * buffer, so a burst of concurrent requests cannot grow the gateway
1696
+ * process's own memory without limit. This ledger is separate from, and
1697
+ * independent of, the ceiling `http2-bridge-server.ts` enforces on the host
1698
+ * side of the bridge connection: each side bounds only the memory in its own
1699
+ * process. It uses no global beyond plain JavaScript, so it embeds inside the
1700
+ * gateway template literal with no escape. A test wraps this source directly
1701
+ * to exercise `reserve`/`release`, the same way
1702
+ * {@link getSandboxDuplexGatewayCodecSource} lets a test exercise the codec.
1703
+ */
1704
+ const BRIDGE_PROCESS_BODY_LEDGER_SOURCE = `function createBridgeProcessBodyLedger(maxBytes) {
1705
+ let reservedBytes = 0;
1706
+ return {
1707
+ reserve(byteCount) {
1708
+ if (reservedBytes + byteCount > maxBytes) {
1709
+ return false;
1710
+ }
1711
+ reservedBytes += byteCount;
1712
+ return true;
1713
+ },
1714
+ release(byteCount) {
1715
+ reservedBytes -= byteCount;
1716
+ },
1717
+ get reservedBytes() {
1718
+ return reservedBytes;
1719
+ },
1720
+ };
1721
+ }`;
1722
+ /**
1723
+ * Return the exact zero-dependency ledger source the generated gateway
1724
+ * embeds. A test wraps this source and calls `createBridgeProcessBodyLedger`
1725
+ * to prove the embedded copy reserves and releases bytes correctly, with no
1726
+ * spawned process involved.
1727
+ */
1728
+ export function getSandboxBridgeProcessBodyLedgerSource() {
1729
+ return BRIDGE_PROCESS_BODY_LEDGER_SOURCE;
1730
+ }
1731
+ export function getSandboxCallbackBridgeServerSource() {
1732
+ return `import { randomUUID, timingSafeEqual } from "node:crypto";
1733
+ import { createServer } from "node:http";
1734
+ import { promises as fs } from "node:fs";
1735
+ import path from "node:path";
1736
+ import http2 from "node:http2";
1737
+ import { Duplex } from "node:stream";
1738
+
1739
+ const bridgeMode = process.env.PAPERCLIP_API_BRIDGE_MODE || "${SANDBOX_CALLBACK_BRIDGE_FILE_MODE}";
1740
+ const queueDir = process.env.PAPERCLIP_BRIDGE_QUEUE_DIR;
1741
+ const bridgeToken = process.env.PAPERCLIP_BRIDGE_TOKEN;
1742
+ const host = process.env.PAPERCLIP_BRIDGE_HOST || "127.0.0.1";
1743
+ const port = Number(process.env.PAPERCLIP_BRIDGE_PORT || "0");
1744
+ // The host assigns the loopback port and passes it through the launch
1745
+ // environment. The gateway binds exactly this port; it never selects a
1746
+ // different one. The host also passes one random per-open nonce here. The
1747
+ // gateway echoes it in the READY frame so the host correlates READY with this
1748
+ // channel open. The nonce is a liveness signal, not authentication.
1749
+ const bridgeNonce = process.env.PAPERCLIP_BRIDGE_NONCE || "";
1750
+ const pollIntervalMs = Number(process.env.PAPERCLIP_BRIDGE_POLL_INTERVAL_MS || "100");
1751
+ const responseTimeoutMs = Number(
1752
+ process.env.PAPERCLIP_BRIDGE_RESPONSE_TIMEOUT_MS || "${DEFAULT_BRIDGE_RESPONSE_TIMEOUT_MS}",
1753
+ );
1754
+ const maxQueueDepth = Number(process.env.PAPERCLIP_BRIDGE_MAX_QUEUE_DEPTH || "${DEFAULT_BRIDGE_MAX_QUEUE_DEPTH}");
1755
+ const maxBodyBytes = Number(process.env.PAPERCLIP_BRIDGE_MAX_BODY_BYTES || "${DEFAULT_BRIDGE_MAX_BODY_BYTES}");
1756
+ // The header allowlist. Both the file gateway and the http2 gateway strip an
1757
+ // inbound request to these headers before they forward it. One copy serves both
1758
+ // modes. The route allowlist stays on the host: both modes forward a request to
1759
+ // the host, and the host enforces the same route allowlist for each.
1760
+ const allowedHeaders = new Set(${JSON.stringify([...DEFAULT_SANDBOX_CALLBACK_BRIDGE_HEADER_ALLOWLIST])});
1761
+
1762
+ if (!bridgeToken) {
1763
+ throw new Error("PAPERCLIP_BRIDGE_TOKEN is required.");
1764
+ }
1765
+ // Closed allowlist for the bridge mode. The generated gateway supports exactly
1766
+ // two transports: http2 and the file-mode queue. Every other value, including
1767
+ // the retired duplex transport, fails startup at once instead of falling
1768
+ // through to a mode that never ran. This check runs before the queue-directory
1769
+ // check below, so an unsupported mode never reaches a state where a missing
1770
+ // queue directory masks the real problem.
1771
+ if (
1772
+ bridgeMode !== "${SANDBOX_CALLBACK_BRIDGE_HTTP2_MODE}" &&
1773
+ bridgeMode !== "${SANDBOX_CALLBACK_BRIDGE_FILE_MODE}"
1774
+ ) {
1775
+ throw new Error("Unsupported PAPERCLIP_API_BRIDGE_MODE: " + bridgeMode);
1776
+ }
1777
+ if (bridgeMode !== "${SANDBOX_CALLBACK_BRIDGE_HTTP2_MODE}" && !queueDir) {
1778
+ throw new Error("PAPERCLIP_BRIDGE_QUEUE_DIR and PAPERCLIP_BRIDGE_TOKEN are required.");
1779
+ }
1780
+
1781
+ // A crashed gateway is a dead loopback port for the rest of the run: nothing
1782
+ // inside the sandbox respawns this process, and every later agent API call
1783
+ // then fails at the connection level. Once the gateway is ready, log an
1784
+ // uncaught fault to stderr (the host redirects it into logs/bridge.log) and
1785
+ // keep serving — the relay holds no state a fault can corrupt beyond the one
1786
+ // request it interrupted. Before readiness the same fault means the gateway
1787
+ // can never become usable (a failed bind, a failed readiness write), so exit
1788
+ // instead: surviving there only leaves an un-ready zombie behind while the
1789
+ // host waits out its readiness poll.
1790
+ let gatewayReady = false;
1791
+ process.on("uncaughtException", (error) => {
1792
+ process.stderr.write(
1793
+ "[paperclip-bridge] uncaught exception: " + (error && error.stack ? error.stack : String(error)) + "\\n",
1794
+ );
1795
+ if (!gatewayReady) {
1796
+ process.exit(1);
1797
+ }
1798
+ });
1799
+ process.on("unhandledRejection", (reason) => {
1800
+ const detail = reason && typeof reason === "object" && "stack" in reason ? reason.stack : String(reason);
1801
+ process.stderr.write("[paperclip-bridge] unhandled rejection: " + detail + "\\n");
1802
+ if (!gatewayReady) {
1803
+ process.exit(1);
1804
+ }
1805
+ });
1806
+
1807
+ // The embedded zero-dependency frame codec. The duplex gateway uses it; the file
1808
+ // gateway ignores it.
1809
+ ${DUPLEX_GATEWAY_CODEC_SOURCE}
1810
+
1811
+ // The embedded zero-dependency process body-byte ledger. Both gateway modes
1812
+ // use it: readBodyBytes reserves against it, and each mode's request
1813
+ // handler releases what it reserved once the body is no longer needed.
1814
+ ${BRIDGE_PROCESS_BODY_LEDGER_SOURCE}
1815
+ ${sandboxBridgeBodyCodecSource()}
1816
+
1817
+ // HTTP/2's multiplier matches HTTP2_BRIDGE_MAX_CONCURRENT_STREAMS (4) in
1818
+ // http2-bridge-server.ts, doubled because readBodyBytes reserves a body's
1819
+ // bytes twice: once for the retained chunk array, once for the concatenated
1820
+ // copy, since both are live buffers at once. This gives the gateway process
1821
+ // its own aggregate ceiling on live request-body bytes, so a burst of
1822
+ // concurrent requests cannot grow this process's memory without limit, even
1823
+ // though every individual body already passes the maxBodyBytes check below.
1824
+ // This ceiling is independent of, and separate from, the ceiling the host
1825
+ // enforces on its own side of the bridge connection. Queue mode also counts
1826
+ // JSON/base64 envelopes; its aggregate ceiling never exceeds 1 GiB.
1827
+ const maxProcessBodyBytes = bridgeMode === "${SANDBOX_CALLBACK_BRIDGE_FILE_MODE}"
1828
+ ? Math.min(1024 * 1024 * 1024, 4 * (4 * sandboxBridgeEnvelopeLimit(maxBodyBytes) + 4 * maxBodyBytes))
1829
+ : maxBodyBytes * 8;
1830
+ const processBodyLedger = createBridgeProcessBodyLedger(maxProcessBodyBytes);
1831
+
1832
+ // A denied process-ledger reservation answers 503: the sandbox client should
1833
+ // retry once other in-flight bodies finish and release their bytes, the same
1834
+ // retry contract the host side gives for its own capacity denial.
1835
+ class BridgeProcessCapacityError extends Error {
1836
+ constructor() {
1837
+ super("The bridge gateway process reached its reserved body byte ceiling. Retry later.");
1838
+ }
1839
+ }
1840
+
1841
+ function sleep(ms) {
1842
+ return new Promise((resolve) => setTimeout(resolve, ms));
1843
+ }
1844
+
1845
+ function normalizeHeaders(headers) {
1846
+ const out = {};
1847
+ for (const [key, value] of Object.entries(headers)) {
1848
+ if (value == null) continue;
1849
+ const normalizedKey = key.toLowerCase();
1850
+ if (!allowedHeaders.has(normalizedKey)) {
1851
+ continue;
1852
+ }
1853
+ out[normalizedKey] = Array.isArray(value) ? value.join(", ") : String(value);
1854
+ }
1855
+ return out;
1856
+ }
1857
+
1858
+ // Reserves each chunk's bytes against the process ledger before the chunk
1859
+ // joins the retained array, and reserves the concatenated buffer's own byte
1860
+ // count before Buffer.concat allocates it, mirroring the order
1861
+ // readHttp2StreamBody enforces on the host side. Returns the body buffer
1862
+ // together with a release function: the caller must call release exactly
1863
+ // once, after the body is no longer needed, so its reserved bytes return to
1864
+ // the ledger on completion, on an error the caller raises later, on a client
1865
+ // abort, and on a timeout — every path funnels through the caller's own
1866
+ // finally block. A read that fails here (the size limit, or a denied
1867
+ // process reservation) releases its own partial reservation immediately, so
1868
+ // no caller-side release call is needed for that path.
1869
+ async function readBodyBytes(req) {
1870
+ const chunks = [];
1871
+ let totalBytes = 0;
1872
+ let reservedBytes = 0;
1873
+ try {
1874
+ for await (const chunk of req) {
1875
+ const nextChunk = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);
1876
+ totalBytes += nextChunk.byteLength;
1877
+ if (totalBytes > maxBodyBytes) {
1878
+ throw new Error("Bridge request body exceeded the configured size limit.");
1879
+ }
1880
+ if (!processBodyLedger.reserve(nextChunk.byteLength)) {
1881
+ throw new BridgeProcessCapacityError();
1882
+ }
1883
+ reservedBytes += nextChunk.byteLength;
1884
+ chunks.push(nextChunk);
1885
+ }
1886
+ if (!processBodyLedger.reserve(totalBytes)) {
1887
+ throw new BridgeProcessCapacityError();
1888
+ }
1889
+ reservedBytes += totalBytes;
1890
+ const body = Buffer.concat(chunks);
1891
+ return { body, release: () => processBodyLedger.release(reservedBytes) };
1892
+ } catch (error) {
1893
+ processBodyLedger.release(reservedBytes);
1894
+ throw error;
1895
+ }
1896
+ }
1897
+
1898
+ function tokensMatch(received) {
1899
+ const expected = Buffer.from(bridgeToken, "utf8");
1900
+ const actual = Buffer.from(typeof received === "string" ? received : "", "utf8");
1901
+ if (expected.length !== actual.length) return false;
1902
+ return timingSafeEqual(expected, actual);
1903
+ }
1904
+
1905
+ function writeJsonResponse(res, status, body) {
1906
+ res.statusCode = status;
1907
+ res.setHeader("content-type", "application/json");
1908
+ res.end(JSON.stringify(body));
1909
+ }
1910
+
1911
+ async function runFileGateway() {
1912
+ const requestsDir = path.posix.join(queueDir, "requests");
1913
+ const responsesDir = path.posix.join(queueDir, "responses");
1914
+ const logsDir = path.posix.join(queueDir, "logs");
1915
+ const readyFile = path.posix.join(queueDir, "ready.json");
1916
+
1917
+ async function queueDepth() {
1918
+ const entries = await fs.readdir(requestsDir, { withFileTypes: true }).catch(() => []);
1919
+ return entries.filter((entry) => entry.isFile() && entry.name.endsWith(".json")).length;
1920
+ }
1921
+
1922
+ // Delete request files older than the response deadline. Every live caller
1923
+ // cleans its own request file when it times out, so a file this old is an
1924
+ // orphan: its writer was killed mid-wait, or a previous gateway process died
1925
+ // and left its queue behind. Orphans otherwise count toward the queue-depth
1926
+ // cap forever and wedge the gateway at a permanent 503.
1927
+ async function sweepStaleRequests() {
1928
+ const staleBefore = Date.now() - responseTimeoutMs - 2000;
1929
+ const entries = await fs.readdir(requestsDir, { withFileTypes: true }).catch(() => []);
1930
+ for (const entry of entries) {
1931
+ if (!entry.isFile() || !entry.name.endsWith(".json")) continue;
1932
+ const filePath = path.posix.join(requestsDir, entry.name);
1933
+ const stats = await fs.stat(filePath).catch(() => null);
1934
+ if (stats && stats.mtimeMs < staleBefore) {
1935
+ await fs.rm(filePath, { force: true }).catch(() => undefined);
1936
+ }
1937
+ }
1938
+ }
1939
+
1940
+ async function waitForResponse(requestId, reserveResponse) {
1941
+ const responsePath = path.posix.join(responsesDir, \`\${requestId}.json\`);
1942
+ const deadline = Date.now() + responseTimeoutMs;
1943
+ while (Date.now() < deadline) {
1944
+ const handle = await fs.open(responsePath, "r").catch(error => {
1945
+ if (error.code === "ENOENT") return null;
1946
+ throw error;
1947
+ });
1948
+ if (handle) {
1949
+ try {
1950
+ const stat = await handle.stat();
1951
+ if (stat.size > sandboxBridgeEnvelopeLimit(maxBodyBytes)) throw new Error("Bridge response envelope exceeded the configured size limit.");
1952
+ reserveResponse(6 * stat.size + 1);
1953
+ const bytes = Buffer.alloc(stat.size + 1);
1954
+ let length = 0;
1955
+ while (length < bytes.length) {
1956
+ const read = await handle.read(bytes, length, bytes.length - length, length);
1957
+ if (!read.bytesRead) break;
1958
+ length += read.bytesRead;
1959
+ }
1960
+ if (length !== stat.size) throw new Error("Bridge response envelope changed while reading.");
1961
+ return JSON.parse(bytes.subarray(0, length).toString("utf8"));
1962
+ } finally {
1963
+ await handle.close();
1964
+ await fs.rm(responsePath, { force: true }).catch(() => undefined);
1965
+ }
1966
+ }
1967
+ await sleep(pollIntervalMs);
1968
+ }
1969
+ throw new Error("Timed out waiting for host bridge response.");
1970
+ }
1971
+
1972
+ const server = createServer(async (req, res) => {
1973
+ // readBodyBytes reserves the body's bytes against the process ledger and
1974
+ // hands back a release function; this holds it so the finally below
1975
+ // releases those bytes exactly once no matter how this handler ends —
1976
+ // its normal completion, a thrown error, a client abort, or a deadline
1977
+ // timeout all reach the same finally.
1978
+ let releaseBodyReservation = null;
1979
+ let envelopeReservation = 0;
1980
+ let dispatched = false;
1981
+ try {
1982
+ const auth = req.headers.authorization || "";
1983
+ const receivedToken = auth.startsWith("Bearer ") ? auth.slice("Bearer ".length) : "";
1984
+ if (!tokensMatch(receivedToken)) {
1985
+ writeJsonResponse(res, 401, { error: "Invalid bridge token." });
1986
+ return;
1987
+ }
1988
+
1989
+ if (await queueDepth() >= maxQueueDepth) {
1990
+ // Reclaim orphaned request files before rejecting; only a queue that
1991
+ // is genuinely full of live requests gets the 503.
1992
+ await sweepStaleRequests();
1993
+ if (await queueDepth() >= maxQueueDepth) {
1994
+ writeJsonResponse(res, 503, { error: "Bridge request queue is full." });
1995
+ return;
1996
+ }
1997
+ }
1998
+
1999
+ const url = new URL(req.url || "/", "http://127.0.0.1");
2000
+ const contentType = typeof req.headers["content-type"] === "string" ? req.headers["content-type"] : "";
2001
+ const multipartAttachment = req.method === "POST"
2002
+ && /^\\/api\\/companies\\/[^/]+\\/issues\\/[^/]+\\/attachments$/.test(url.pathname)
2003
+ && /^multipart\\/form-data(?:;|$)/i.test(contentType);
2004
+ if (req.method && req.method !== "GET" && req.method !== "HEAD" && !/json/i.test(contentType) && !multipartAttachment) {
2005
+ writeJsonResponse(res, 415, { error: "Bridge only accepts JSON request bodies." });
2006
+ return;
2007
+ }
2008
+ const requestId = randomUUID();
2009
+ // Reserve encoded envelopes and response decoding separately from the
2010
+ // incoming byte buffers. Capacity rejection precedes dispatch, hence 503.
2011
+ const { body: requestBody, release } = await readBodyBytes(req);
2012
+ releaseBodyReservation = release;
2013
+ const reserveBytes = 4 * sandboxBridgeEnvelopeLimit(requestBody.length);
2014
+ if (!processBodyLedger.reserve(reserveBytes)) throw new BridgeProcessCapacityError();
2015
+ envelopeReservation = reserveBytes;
2016
+ const payload = {
2017
+ id: requestId,
2018
+ method: req.method || "GET",
2019
+ path: url.pathname,
2020
+ query: url.search,
2021
+ headers: normalizeHeaders(req.headers),
2022
+ ...encodeSandboxBridgeBody(multipartAttachment ? requestBody : requestBody.toString("utf8"), maxBodyBytes),
2023
+ createdAt: new Date().toISOString(),
2024
+ };
2025
+ const requestPath = path.posix.join(requestsDir, \`\${requestId}.json\`);
2026
+ const tempPath = \`\${requestPath}.tmp\`;
2027
+ await fs.writeFile(tempPath, \`\${JSON.stringify(payload)}\\n\`, "utf8");
2028
+ dispatched = true;
2029
+ await fs.rename(tempPath, requestPath);
2030
+
2031
+ let response;
2032
+ try {
2033
+ response = await waitForResponse(requestId, bytes => {
2034
+ if (!processBodyLedger.reserve(bytes)) throw new BridgeProcessCapacityError();
2035
+ envelopeReservation += bytes;
2036
+ });
2037
+ } catch (error) {
2038
+ // The host never delivered a response inside the deadline. Remove this
2039
+ // request's file so it cannot pile up toward the queue-depth cap. The
2040
+ // host's normal response write is guarded on the request file, so the
2041
+ // removal also tells the host that no caller waits anymore. Without
2042
+ // this cleanup a stalled host wedges the gateway at the cap and every
2043
+ // later request gets an immediate 503 until run end.
2044
+ await fs.rm(requestPath, { force: true }).catch(() => undefined);
2045
+ throw error;
2046
+ }
2047
+ const responseHeaders = response.headers || {};
2048
+ // The host marks a possibly-committed mutation with an indeterminate outcome.
2049
+ // The host cannot cancel a host operation that is in flight, so the mutation
2050
+ // may have committed before the worker aborted the handler. A 5xx status is
2051
+ // retryable by convention, so a caller that retries 5xx would apply the
2052
+ // mutation twice. Map the indeterminate outcome to a non-retryable 409, so a
2053
+ // standard retry policy does not repeat the request. The outcome header and
2054
+ // body stay, so a caller that reads them still sees the indeterminate result.
2055
+ const bridgeOutcome = responseHeaders["x-paperclip-bridge-outcome"];
2056
+ if (bridgeOutcome === "indeterminate") {
2057
+ res.statusCode = 409;
2058
+ } else {
2059
+ res.statusCode = typeof response.status === "number" ? response.status : 200;
2060
+ }
2061
+ for (const [key, value] of Object.entries(responseHeaders)) {
2062
+ if (typeof value !== "string" || key.toLowerCase() === "content-length") continue;
2063
+ res.setHeader(key, value);
2064
+ }
2065
+ res.end(decodeSandboxBridgeBody(response, maxBodyBytes));
2066
+ } catch (error) {
2067
+ // Capacity rejection before dispatch is retryable. After a mutation was
2068
+ // dispatched, a missing or corrupt receipt cannot prove that it failed.
2069
+ const uncertainWrite = dispatched && !["GET", "HEAD", "OPTIONS", "TRACE"].includes(req.method || "GET");
2070
+ const status = uncertainWrite ? 409 : error instanceof BridgeProcessCapacityError ? 503 : 502;
2071
+ if (uncertainWrite) res.setHeader("x-paperclip-bridge-outcome", "indeterminate");
2072
+ writeJsonResponse(res, status, {
2073
+ error: error instanceof Error ? error.message : String(error),
2074
+ ...(uncertainWrite ? { outcome: "indeterminate", retryable: false } : {}),
2075
+ });
2076
+ } finally {
2077
+ releaseBodyReservation?.();
2078
+ processBodyLedger.release(envelopeReservation);
2079
+ }
2080
+ });
2081
+
2082
+ async function shutdown() {
2083
+ server.close(() => {
2084
+ process.exit(0);
2085
+ });
2086
+ }
2087
+
2088
+ process.on("SIGINT", () => void shutdown());
2089
+ process.on("SIGTERM", () => void shutdown());
2090
+
2091
+ await fs.mkdir(requestsDir, { recursive: true });
2092
+ await fs.mkdir(responsesDir, { recursive: true });
2093
+ await fs.mkdir(logsDir, { recursive: true });
2094
+
2095
+ // Newer Node runtimes do not reliably surface a failed bind through
2096
+ // uncaughtException here: with nothing else keeping the event loop alive,
2097
+ // the process can drain and exit 0 before the error event is delivered
2098
+ // (observed on Node 24/25; Node 22 delivered it). Attach an explicit error
2099
+ // listener and pin the loop with a keepalive until the bind settles, so a
2100
+ // startup failure exits 1 with the fault on stderr on every runtime.
2101
+ const bindKeepalive = setInterval(() => {}, 1000);
2102
+ server.once("error", (error) => {
2103
+ clearInterval(bindKeepalive);
2104
+ process.stderr.write(
2105
+ "[paperclip-bridge] server error: " + (error && error.stack ? error.stack : String(error)) + "\\n",
2106
+ );
2107
+ if (!gatewayReady) {
2108
+ process.exit(1);
2109
+ }
2110
+ });
2111
+ server.listen(port, host, async () => {
2112
+ clearInterval(bindKeepalive);
2113
+ const address = server.address();
2114
+ if (!address || typeof address === "string") {
2115
+ throw new Error("Bridge server did not expose a TCP address.");
2116
+ }
2117
+ const ready = {
2118
+ pid: process.pid,
2119
+ host,
2120
+ port: address.port,
2121
+ baseUrl: \`http://\${host}:\${address.port}\`,
2122
+ startedAt: new Date().toISOString(),
2123
+ };
2124
+ const tempReadyFile = \`\${readyFile}.tmp\`;
2125
+ await fs.writeFile(tempReadyFile, JSON.stringify(ready), "utf8");
2126
+ await fs.rename(tempReadyFile, readyFile);
2127
+ // The readiness file is on disk, so the host will adopt this process.
2128
+ // From here on an uncaught fault must not kill the listener.
2129
+ gatewayReady = true;
2130
+ });
2131
+ }
2132
+
2133
+ // ---------------------------------------------------------------------------
2134
+ // http2_v1: run one Node HTTP/2 client session directly on stdin/stdout.
2135
+ //
2136
+ // This gateway writes exactly one frame-codec line before it hands stdin and
2137
+ // stdout to the HTTP/2 client: the READY line, so the host readiness gate
2138
+ // accepts the same handshake it already accepts for every mode. After that
2139
+ // one write, only the HTTP/2 client touches stdout: this function calls
2140
+ // writeFrame no more, and it starts no heartbeat timer, so no non-HTTP/2
2141
+ // writer can put a byte on stdout between the READY line and the client
2142
+ // connection preface.
2143
+ // ---------------------------------------------------------------------------
2144
+
2145
+ function createStdioDuplex() {
2146
+ const duplex = new Duplex({
2147
+ read() {
2148
+ // process.stdin pushes bytes through the "data" listener below; there
2149
+ // is nothing to pull on demand here.
2150
+ },
2151
+ write(chunk, _encoding, callback) {
2152
+ const flushed = process.stdout.write(chunk);
2153
+ if (flushed) {
2154
+ callback();
2155
+ } else {
2156
+ process.stdout.once("drain", () => callback());
2157
+ }
2158
+ },
2159
+ });
2160
+ process.stdin.on("data", (chunk) => {
2161
+ duplex.push(chunk);
2162
+ });
2163
+ process.stdin.on("end", () => {
2164
+ duplex.push(null);
2165
+ });
2166
+ process.stdin.on("error", (error) => {
2167
+ duplex.destroy(error instanceof Error ? error : new Error(String(error)));
2168
+ });
2169
+ return duplex;
2170
+ }
2171
+
2172
+ function runHttp2Gateway() {
2173
+ function diag(message) {
2174
+ // Diagnostics go to stderr only, the same as every other mode.
2175
+ process.stderr.write("[paperclip-bridge] " + message + "\\n");
2176
+ }
2177
+ function writeFrame(frame) {
2178
+ process.stdout.write(encodeDuplexFrame(frame));
2179
+ }
2180
+
2181
+ const authority = "bridge.internal";
2182
+ let session = null;
2183
+ let unavailable = false;
2184
+
2185
+ function openSession() {
2186
+ if (session) return session;
2187
+ const stdio = createStdioDuplex();
2188
+ session = http2.connect("http://" + authority, {
2189
+ createConnection: () => stdio,
2190
+ });
2191
+ session.on("error", () => {
2192
+ unavailable = true;
2193
+ });
2194
+ session.on("close", () => {
2195
+ unavailable = true;
2196
+ });
2197
+ session.on("goaway", (errorCode, lastStreamId) => {
2198
+ diag("host sent GOAWAY (errorCode=" + errorCode + ", lastStreamId=" + lastStreamId + ")");
2199
+ });
2200
+ return session;
2201
+ }
2202
+
2203
+ function forwardOverHttp2(request) {
2204
+ return new Promise((resolve, reject) => {
2205
+ const activeSession = openSession();
2206
+ const query = request.query || "";
2207
+ const pathWithQuery =
2208
+ query.length === 0 ? request.path : request.path + (query.charAt(0) === "?" ? query : "?" + query);
2209
+ const outboundHeaders = Object.assign(
2210
+ {
2211
+ ":method": request.method,
2212
+ ":path": pathWithQuery,
2213
+ authorization: "Bearer " + bridgeToken,
2214
+ },
2215
+ request.headers,
2216
+ );
2217
+ let stream;
2218
+ try {
2219
+ stream = activeSession.request(outboundHeaders, { endStream: request.body.length === 0 });
2220
+ } catch (error) {
2221
+ reject(error instanceof Error ? error : new Error(String(error)));
2222
+ return;
2223
+ }
2224
+ const chunks = [];
2225
+ let status = 502;
2226
+ let responseHeaders = {};
2227
+ let settled = false;
2228
+ const settle = (run) => {
2229
+ if (settled) return;
2230
+ settled = true;
2231
+ run();
2232
+ };
2233
+ stream.on("response", (headers) => {
2234
+ const raw = headers[":status"];
2235
+ status = typeof raw === "number" ? raw : Number(raw) || 502;
2236
+ responseHeaders = {};
2237
+ for (const [key, value] of Object.entries(headers)) {
2238
+ if (key.charAt(0) === ":" || value == null) continue;
2239
+ responseHeaders[key] = Array.isArray(value) ? value.join(", ") : String(value);
2240
+ }
2241
+ });
2242
+ stream.on("data", (chunk) => chunks.push(chunk));
2243
+ stream.once("end", () =>
2244
+ settle(() => resolve({ status: status, headers: responseHeaders, body: Buffer.concat(chunks) })),
2245
+ );
2246
+ stream.once("error", (error) =>
2247
+ settle(() => reject(error instanceof Error ? error : new Error(String(error)))),
2248
+ );
2249
+ stream.once("aborted", () => settle(() => reject(new Error("Bridge HTTP/2 stream aborted."))));
2250
+ if (request.body.length > 0) {
2251
+ stream.end(request.body);
2252
+ } else if (!stream.writableEnded) {
2253
+ stream.end();
2254
+ }
2255
+ });
2256
+ }
2257
+
2258
+ const server = createServer(async (req, res) => {
2259
+ // readBodyBytes reserves the body's bytes against the process ledger
2260
+ // and hands back a release function; this holds it so the finally
2261
+ // below releases those bytes exactly once no matter how this handler
2262
+ // ends — its normal completion, a thrown error, a client abort, or a
2263
+ // deadline timeout all reach the same finally.
2264
+ let releaseBodyReservation = null;
2265
+ try {
2266
+ const auth = req.headers.authorization || "";
2267
+ const receivedToken = auth.startsWith("Bearer ") ? auth.slice("Bearer ".length) : "";
2268
+ if (!tokensMatch(receivedToken)) {
2269
+ writeJsonResponse(res, 401, { error: "Invalid bridge token." });
2270
+ return;
2271
+ }
2272
+ if (unavailable) {
2273
+ writeJsonResponse(res, 503, { error: "bridge_unavailable" });
2274
+ return;
2275
+ }
2276
+ const url = new URL(req.url || "/", "http://127.0.0.1");
2277
+ const { body: requestBodyBuffer, release } = await readBodyBytes(req);
2278
+ releaseBodyReservation = release;
2279
+ let response;
2280
+ try {
2281
+ response = await forwardOverHttp2({
2282
+ method: req.method || "GET",
2283
+ path: url.pathname,
2284
+ query: url.search,
2285
+ headers: normalizeHeaders(req.headers),
2286
+ body: requestBodyBuffer,
2287
+ });
2288
+ } catch (error) {
2289
+ writeJsonResponse(res, 502, { error: error instanceof Error ? error.message : String(error) });
2290
+ return;
2291
+ }
2292
+ // The host marks a possibly-committed mutation with an indeterminate outcome.
2293
+ // The host cannot cancel a host operation that is in flight, so the mutation
2294
+ // may have committed before the worker aborted the handler. A 5xx status is
2295
+ // retryable by convention, so a caller that retries 5xx would apply the
2296
+ // mutation twice. Map the indeterminate outcome to a non-retryable 409, so a
2297
+ // standard retry policy does not repeat the request. The outcome header and
2298
+ // body stay, so a caller that reads them still sees the indeterminate result.
2299
+ const bridgeOutcome = (response.headers || {})["x-paperclip-bridge-outcome"];
2300
+ if (bridgeOutcome === "indeterminate") {
2301
+ res.statusCode = 409;
2302
+ } else {
2303
+ res.statusCode = typeof response.status === "number" ? response.status : 200;
2304
+ }
2305
+ for (const [key, value] of Object.entries(response.headers || {})) {
2306
+ if (typeof value !== "string" || key.toLowerCase() === "content-length") continue;
2307
+ res.setHeader(key, value);
2308
+ }
2309
+ res.end(response.body);
2310
+ } catch (error) {
2311
+ // A denied process-ledger reservation is retryable: the caller should
2312
+ // try again once other in-flight bodies release their bytes. Every
2313
+ // other body-read or handling fault stays a generic 502.
2314
+ const status = error instanceof BridgeProcessCapacityError ? 503 : 502;
2315
+ writeJsonResponse(res, status, { error: error instanceof Error ? error.message : String(error) });
2316
+ } finally {
2317
+ releaseBodyReservation?.();
2318
+ }
2319
+ });
2320
+
2321
+ process.on("SIGINT", () => {
2322
+ try {
2323
+ server.close();
2324
+ } catch (error) {
2325
+ diag("server close error: " + (error && error.message ? error.message : String(error)));
2326
+ }
2327
+ process.exit(0);
2328
+ });
2329
+ process.on("SIGTERM", () => {
2330
+ try {
2331
+ server.close();
2332
+ } catch (error) {
2333
+ diag("server close error: " + (error && error.message ? error.message : String(error)));
2334
+ }
2335
+ process.exit(0);
2336
+ });
2337
+
2338
+ // Bind-or-exit, the same rule every mode applies: the host assigns a
2339
+ // positive loopback port, and the gateway binds exactly that port or exits
2340
+ // nonzero. It never selects a different port.
2341
+ if (!Number.isInteger(port) || port <= 0) {
2342
+ diag("http2 gateway requires a positive assigned PAPERCLIP_BRIDGE_PORT; got " + String(port));
2343
+ process.exit(1);
2344
+ }
2345
+ server.on("error", (error) => {
2346
+ diag(
2347
+ "http2 gateway could not bind port " +
2348
+ String(port) +
2349
+ ": " +
2350
+ (error && error.message ? error.message : String(error)),
2351
+ );
2352
+ process.exit(1);
2353
+ });
2354
+ server.listen(port, host, () => {
2355
+ const address = server.address();
2356
+ if (!address || typeof address === "string") {
2357
+ diag("http2 gateway did not expose a TCP address");
2358
+ process.exit(1);
2359
+ return;
2360
+ }
2361
+ // Send the one frame-codec line on this path: the READY line the host
2362
+ // readiness gate expects. Open the HTTP/2 client session on the very next
2363
+ // statement, so the client connection preface is the next byte the host
2364
+ // sees after READY, with no other writer in between.
2365
+ writeFrame({ version: DUPLEX_FRAME_VERSION, type: "ready", nonce: bridgeNonce });
2366
+ gatewayReady = true;
2367
+ openSession();
2368
+ });
2369
+ }
2370
+
2371
+ // The startup check above already rejected every value except http2 and
2372
+ // queue, so this dispatch names both modes explicitly and never falls
2373
+ // through to the queue gateway for an unsupported mode.
2374
+ if (bridgeMode === "${SANDBOX_CALLBACK_BRIDGE_HTTP2_MODE}") {
2375
+ runHttp2Gateway();
2376
+ } else if (bridgeMode === "${SANDBOX_CALLBACK_BRIDGE_FILE_MODE}") {
2377
+ await runFileGateway();
2378
+ } else {
2379
+ throw new Error("Unsupported PAPERCLIP_API_BRIDGE_MODE: " + bridgeMode);
2380
+ }`;
2381
+ }
2382
+ //# sourceMappingURL=sandbox-callback-bridge.js.map