@microvac/adapter-utils 0.0.0-stage → 0.1.0-rc.15

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 (3029) hide show
  1. package/README.md +69 -2
  2. package/dist/acpx-engine/accounting-model.d.ts +7 -0
  3. package/dist/acpx-engine/accounting-model.d.ts.map +1 -0
  4. package/dist/acpx-engine/accounting-model.js +12 -0
  5. package/dist/acpx-engine/accounting-model.js.map +1 -0
  6. package/dist/acpx-engine/accounting-model.test.d.ts +2 -0
  7. package/dist/acpx-engine/accounting-model.test.d.ts.map +1 -0
  8. package/dist/acpx-engine/accounting-model.test.js +28 -0
  9. package/dist/acpx-engine/accounting-model.test.js.map +1 -0
  10. package/dist/acpx-engine/cli.d.ts +2 -0
  11. package/dist/acpx-engine/cli.d.ts.map +1 -0
  12. package/dist/acpx-engine/cli.js +128 -0
  13. package/dist/acpx-engine/cli.js.map +1 -0
  14. package/dist/acpx-engine/constants.d.ts +28 -0
  15. package/dist/acpx-engine/constants.d.ts.map +1 -0
  16. package/dist/acpx-engine/constants.js +74 -0
  17. package/dist/acpx-engine/constants.js.map +1 -0
  18. package/dist/acpx-engine/ephemeral-session-environment.d.ts +4 -0
  19. package/dist/acpx-engine/ephemeral-session-environment.d.ts.map +1 -0
  20. package/dist/acpx-engine/ephemeral-session-environment.js +45 -0
  21. package/dist/acpx-engine/ephemeral-session-environment.js.map +1 -0
  22. package/dist/acpx-engine/ephemeral-session-environment.test.d.ts +2 -0
  23. package/dist/acpx-engine/ephemeral-session-environment.test.d.ts.map +1 -0
  24. package/dist/acpx-engine/ephemeral-session-environment.test.js +219 -0
  25. package/dist/acpx-engine/ephemeral-session-environment.test.js.map +1 -0
  26. package/dist/acpx-engine/execute-identity.test.d.ts +2 -0
  27. package/dist/acpx-engine/execute-identity.test.d.ts.map +1 -0
  28. package/dist/acpx-engine/execute-identity.test.js +218 -0
  29. package/dist/acpx-engine/execute-identity.test.js.map +1 -0
  30. package/dist/acpx-engine/execute.d.ts +366 -0
  31. package/dist/acpx-engine/execute.d.ts.map +1 -0
  32. package/dist/acpx-engine/execute.js +5021 -0
  33. package/dist/acpx-engine/execute.js.map +1 -0
  34. package/dist/acpx-engine/execute.test.d.ts +2 -0
  35. package/dist/acpx-engine/execute.test.d.ts.map +1 -0
  36. package/dist/acpx-engine/execute.test.js +8269 -0
  37. package/dist/acpx-engine/execute.test.js.map +1 -0
  38. package/dist/acpx-engine/filesystem-protocol.test.d.ts +2 -0
  39. package/dist/acpx-engine/filesystem-protocol.test.d.ts.map +1 -0
  40. package/dist/acpx-engine/filesystem-protocol.test.js +96 -0
  41. package/dist/acpx-engine/filesystem-protocol.test.js.map +1 -0
  42. package/dist/acpx-engine/index.d.ts +6 -0
  43. package/dist/acpx-engine/index.d.ts.map +1 -0
  44. package/dist/acpx-engine/index.js +6 -0
  45. package/dist/acpx-engine/index.js.map +1 -0
  46. package/dist/acpx-engine/local-process-control.d.ts +5 -0
  47. package/dist/acpx-engine/local-process-control.d.ts.map +1 -0
  48. package/dist/acpx-engine/local-process-control.js +39 -0
  49. package/dist/acpx-engine/local-process-control.js.map +1 -0
  50. package/dist/acpx-engine/local-process-control.test.d.ts +2 -0
  51. package/dist/acpx-engine/local-process-control.test.d.ts.map +1 -0
  52. package/dist/acpx-engine/local-process-control.test.js +38 -0
  53. package/dist/acpx-engine/local-process-control.test.js.map +1 -0
  54. package/dist/acpx-engine/operator-stop.test.d.ts +2 -0
  55. package/dist/acpx-engine/operator-stop.test.d.ts.map +1 -0
  56. package/dist/acpx-engine/operator-stop.test.js +107 -0
  57. package/dist/acpx-engine/operator-stop.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 +152 -0
  61. package/dist/acpx-engine/remote-spawn-smoke.test.js.map +1 -0
  62. package/dist/acpx-engine/run-contracts.d.ts +414 -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 +877 -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 +78 -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 +155 -0
  99. package/dist/acpx-engine/run-site-sandbox.d.ts.map +1 -0
  100. package/dist/acpx-engine/run-site-sandbox.js +285 -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 +307 -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-sequence.d.ts +77 -0
  119. package/dist/acpx-engine/settlement-sequence.d.ts.map +1 -0
  120. package/dist/acpx-engine/settlement-sequence.js +119 -0
  121. package/dist/acpx-engine/settlement-sequence.js.map +1 -0
  122. package/dist/acpx-engine/settlement-sequence.test.d.ts +2 -0
  123. package/dist/acpx-engine/settlement-sequence.test.d.ts.map +1 -0
  124. package/dist/acpx-engine/settlement-sequence.test.js +272 -0
  125. package/dist/acpx-engine/settlement-sequence.test.js.map +1 -0
  126. package/dist/acpx-engine/spawn-smoke.test.d.ts +2 -0
  127. package/dist/acpx-engine/spawn-smoke.test.d.ts.map +1 -0
  128. package/dist/acpx-engine/spawn-smoke.test.js +193 -0
  129. package/dist/acpx-engine/spawn-smoke.test.js.map +1 -0
  130. package/dist/acpx-engine/startup-cancellation.d.ts +9 -0
  131. package/dist/acpx-engine/startup-cancellation.d.ts.map +1 -0
  132. package/dist/acpx-engine/startup-cancellation.js +97 -0
  133. package/dist/acpx-engine/startup-cancellation.js.map +1 -0
  134. package/dist/acpx-engine/startup-cancellation.test.d.ts +2 -0
  135. package/dist/acpx-engine/startup-cancellation.test.d.ts.map +1 -0
  136. package/dist/acpx-engine/startup-cancellation.test.js +115 -0
  137. package/dist/acpx-engine/startup-cancellation.test.js.map +1 -0
  138. package/dist/acpx-engine/startup-timing.d.ts +433 -0
  139. package/dist/acpx-engine/startup-timing.d.ts.map +1 -0
  140. package/dist/acpx-engine/startup-timing.js +631 -0
  141. package/dist/acpx-engine/startup-timing.js.map +1 -0
  142. package/dist/acpx-engine/startup-timing.test.d.ts +2 -0
  143. package/dist/acpx-engine/startup-timing.test.d.ts.map +1 -0
  144. package/dist/acpx-engine/startup-timing.test.js +619 -0
  145. package/dist/acpx-engine/startup-timing.test.js.map +1 -0
  146. package/dist/acpx-engine/stock-runtime-options.d.ts +37 -0
  147. package/dist/acpx-engine/stock-runtime-options.d.ts.map +1 -0
  148. package/dist/acpx-engine/stock-runtime-options.js +101 -0
  149. package/dist/acpx-engine/stock-runtime-options.js.map +1 -0
  150. package/dist/acpx-engine/stock-runtime-options.test.d.ts +2 -0
  151. package/dist/acpx-engine/stock-runtime-options.test.d.ts.map +1 -0
  152. package/dist/acpx-engine/stock-runtime-options.test.js +91 -0
  153. package/dist/acpx-engine/stock-runtime-options.test.js.map +1 -0
  154. package/dist/acpx-engine/terminal-session-failure.d.ts +48 -0
  155. package/dist/acpx-engine/terminal-session-failure.d.ts.map +1 -0
  156. package/dist/acpx-engine/terminal-session-failure.js +123 -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 +150 -0
  161. package/dist/acpx-engine/terminal-session-failure.test.js.map +1 -0
  162. package/dist/acpx-engine/turn-sequence.d.ts +54 -0
  163. package/dist/acpx-engine/turn-sequence.d.ts.map +1 -0
  164. package/dist/acpx-engine/turn-sequence.js +75 -0
  165. package/dist/acpx-engine/turn-sequence.js.map +1 -0
  166. package/dist/acpx-engine/turn-sequence.test.d.ts +2 -0
  167. package/dist/acpx-engine/turn-sequence.test.d.ts.map +1 -0
  168. package/dist/acpx-engine/turn-sequence.test.js +177 -0
  169. package/dist/acpx-engine/turn-sequence.test.js.map +1 -0
  170. package/dist/acpx-engine/ui.d.ts +3 -0
  171. package/dist/acpx-engine/ui.d.ts.map +1 -0
  172. package/dist/acpx-engine/ui.js +162 -0
  173. package/dist/acpx-engine/ui.js.map +1 -0
  174. package/dist/agent-observability.d.ts +25 -0
  175. package/dist/agent-observability.d.ts.map +1 -0
  176. package/dist/agent-observability.js +92 -0
  177. package/dist/agent-observability.js.map +1 -0
  178. package/dist/agent-observability.test.d.ts +2 -0
  179. package/dist/agent-observability.test.d.ts.map +1 -0
  180. package/dist/agent-observability.test.js +127 -0
  181. package/dist/agent-observability.test.js.map +1 -0
  182. package/dist/api-billing-type.d.ts +5 -0
  183. package/dist/api-billing-type.d.ts.map +1 -0
  184. package/dist/api-billing-type.js +16 -0
  185. package/dist/api-billing-type.js.map +1 -0
  186. package/dist/api-billing-type.test.d.ts +2 -0
  187. package/dist/api-billing-type.test.d.ts.map +1 -0
  188. package/dist/api-billing-type.test.js +20 -0
  189. package/dist/api-billing-type.test.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/codex-observability-home.d.ts +7 -0
  211. package/dist/codex-observability-home.d.ts.map +1 -0
  212. package/dist/codex-observability-home.js +75 -0
  213. package/dist/codex-observability-home.js.map +1 -0
  214. package/dist/codex-observability-profile.d.ts +16 -0
  215. package/dist/codex-observability-profile.d.ts.map +1 -0
  216. package/dist/codex-observability-profile.js +51 -0
  217. package/dist/codex-observability-profile.js.map +1 -0
  218. package/dist/codex-shell-environment.d.ts +6 -0
  219. package/dist/codex-shell-environment.d.ts.map +1 -0
  220. package/dist/codex-shell-environment.js +32 -0
  221. package/dist/codex-shell-environment.js.map +1 -0
  222. package/dist/codex-shell-environment.test.d.ts +2 -0
  223. package/dist/codex-shell-environment.test.d.ts.map +1 -0
  224. package/dist/codex-shell-environment.test.js +49 -0
  225. package/dist/codex-shell-environment.test.js.map +1 -0
  226. package/dist/command-managed-runtime.d.ts +178 -0
  227. package/dist/command-managed-runtime.d.ts.map +1 -0
  228. package/dist/command-managed-runtime.js +486 -0
  229. package/dist/command-managed-runtime.js.map +1 -0
  230. package/dist/command-managed-runtime.test.d.ts +2 -0
  231. package/dist/command-managed-runtime.test.d.ts.map +1 -0
  232. package/dist/command-managed-runtime.test.js +900 -0
  233. package/dist/command-managed-runtime.test.js.map +1 -0
  234. package/dist/command-redaction.d.ts +32 -0
  235. package/dist/command-redaction.d.ts.map +1 -0
  236. package/dist/command-redaction.js +280 -0
  237. package/dist/command-redaction.js.map +1 -0
  238. package/dist/command-redaction.test.d.ts +2 -0
  239. package/dist/command-redaction.test.d.ts.map +1 -0
  240. package/dist/command-redaction.test.js +297 -0
  241. package/dist/command-redaction.test.js.map +1 -0
  242. package/dist/connection-failure.d.ts +33 -0
  243. package/dist/connection-failure.d.ts.map +1 -0
  244. package/dist/connection-failure.js +43 -0
  245. package/dist/connection-failure.js.map +1 -0
  246. package/dist/connection-failure.test.d.ts +2 -0
  247. package/dist/connection-failure.test.d.ts.map +1 -0
  248. package/dist/connection-failure.test.js +94 -0
  249. package/dist/connection-failure.test.js.map +1 -0
  250. package/dist/directory-merge-lock-diagnostics.d.ts +24 -0
  251. package/dist/directory-merge-lock-diagnostics.d.ts.map +1 -0
  252. package/dist/directory-merge-lock-diagnostics.js +54 -0
  253. package/dist/directory-merge-lock-diagnostics.js.map +1 -0
  254. package/dist/directory-merge-lock-diagnostics.test.d.ts +2 -0
  255. package/dist/directory-merge-lock-diagnostics.test.d.ts.map +1 -0
  256. package/dist/directory-merge-lock-diagnostics.test.js +44 -0
  257. package/dist/directory-merge-lock-diagnostics.test.js.map +1 -0
  258. package/dist/directory-merge-lock.test.d.ts +2 -0
  259. package/dist/directory-merge-lock.test.d.ts.map +1 -0
  260. package/dist/directory-merge-lock.test.js +168 -0
  261. package/dist/directory-merge-lock.test.js.map +1 -0
  262. package/dist/duplex-frame-codec.d.ts +124 -0
  263. package/dist/duplex-frame-codec.d.ts.map +1 -0
  264. package/dist/duplex-frame-codec.js +134 -0
  265. package/dist/duplex-frame-codec.js.map +1 -0
  266. package/dist/duplex-frame-codec.test.d.ts +2 -0
  267. package/dist/duplex-frame-codec.test.d.ts.map +1 -0
  268. package/dist/duplex-frame-codec.test.js +172 -0
  269. package/dist/duplex-frame-codec.test.js.map +1 -0
  270. package/dist/duplex-observability.d.ts +220 -0
  271. package/dist/duplex-observability.d.ts.map +1 -0
  272. package/dist/duplex-observability.js +248 -0
  273. package/dist/duplex-observability.js.map +1 -0
  274. package/dist/duplex-observability.test.d.ts +2 -0
  275. package/dist/duplex-observability.test.d.ts.map +1 -0
  276. package/dist/duplex-observability.test.js +55 -0
  277. package/dist/duplex-observability.test.js.map +1 -0
  278. package/dist/env-bindings.d.ts +17 -0
  279. package/dist/env-bindings.d.ts.map +1 -0
  280. package/dist/env-bindings.js +98 -0
  281. package/dist/env-bindings.js.map +1 -0
  282. package/dist/env-bindings.test.d.ts +2 -0
  283. package/dist/env-bindings.test.d.ts.map +1 -0
  284. package/dist/env-bindings.test.js +66 -0
  285. package/dist/env-bindings.test.js.map +1 -0
  286. package/dist/exclude-patterns.d.ts +13 -0
  287. package/dist/exclude-patterns.d.ts.map +1 -0
  288. package/dist/exclude-patterns.js +37 -0
  289. package/dist/exclude-patterns.js.map +1 -0
  290. package/dist/execution-phase.d.ts +10 -0
  291. package/dist/execution-phase.d.ts.map +1 -0
  292. package/dist/execution-phase.js +27 -0
  293. package/dist/execution-phase.js.map +1 -0
  294. package/dist/execution-phase.test.d.ts +2 -0
  295. package/dist/execution-phase.test.d.ts.map +1 -0
  296. package/dist/execution-phase.test.js +26 -0
  297. package/dist/execution-phase.test.js.map +1 -0
  298. package/dist/execution-target-sandbox.test.d.ts +2 -0
  299. package/dist/execution-target-sandbox.test.d.ts.map +1 -0
  300. package/dist/execution-target-sandbox.test.js +5599 -0
  301. package/dist/execution-target-sandbox.test.js.map +1 -0
  302. package/dist/execution-target-stdin-race.test.d.ts +2 -0
  303. package/dist/execution-target-stdin-race.test.d.ts.map +1 -0
  304. package/dist/execution-target-stdin-race.test.js +2166 -0
  305. package/dist/execution-target-stdin-race.test.js.map +1 -0
  306. package/dist/execution-target.d.ts +604 -0
  307. package/dist/execution-target.d.ts.map +1 -0
  308. package/dist/execution-target.js +4018 -0
  309. package/dist/execution-target.js.map +1 -0
  310. package/dist/execution-target.test.d.ts +2 -0
  311. package/dist/execution-target.test.d.ts.map +1 -0
  312. package/dist/execution-target.test.js +404 -0
  313. package/dist/execution-target.test.js.map +1 -0
  314. package/dist/git-shallow-import-budget.test.d.ts +2 -0
  315. package/dist/git-shallow-import-budget.test.d.ts.map +1 -0
  316. package/dist/git-shallow-import-budget.test.js +72 -0
  317. package/dist/git-shallow-import-budget.test.js.map +1 -0
  318. package/dist/git-workspace-sync.d.ts +224 -0
  319. package/dist/git-workspace-sync.d.ts.map +1 -0
  320. package/dist/git-workspace-sync.js +1081 -0
  321. package/dist/git-workspace-sync.js.map +1 -0
  322. package/dist/git-workspace-sync.test.d.ts +2 -0
  323. package/dist/git-workspace-sync.test.d.ts.map +1 -0
  324. package/dist/git-workspace-sync.test.js +1262 -0
  325. package/dist/git-workspace-sync.test.js.map +1 -0
  326. package/dist/github-launcher-environment.test.d.ts +2 -0
  327. package/dist/github-launcher-environment.test.d.ts.map +1 -0
  328. package/dist/github-launcher-environment.test.js +557 -0
  329. package/dist/github-launcher-environment.test.js.map +1 -0
  330. package/dist/github-launcher.d.ts +12 -0
  331. package/dist/github-launcher.d.ts.map +1 -0
  332. package/dist/github-launcher.js +240 -0
  333. package/dist/github-launcher.js.map +1 -0
  334. package/dist/github-launcher.test.d.ts +2 -0
  335. package/dist/github-launcher.test.d.ts.map +1 -0
  336. package/dist/github-launcher.test.js +608 -0
  337. package/dist/github-launcher.test.js.map +1 -0
  338. package/dist/http2-bridge-server.d.ts +464 -0
  339. package/dist/http2-bridge-server.d.ts.map +1 -0
  340. package/dist/http2-bridge-server.js +1086 -0
  341. package/dist/http2-bridge-server.js.map +1 -0
  342. package/dist/http2-bridge-server.test.d.ts +2 -0
  343. package/dist/http2-bridge-server.test.d.ts.map +1 -0
  344. package/dist/http2-bridge-server.test.js +2183 -0
  345. package/dist/http2-bridge-server.test.js.map +1 -0
  346. package/dist/index.d.ts +20 -0
  347. package/dist/index.d.ts.map +1 -0
  348. package/dist/index.js +12 -0
  349. package/dist/index.js.map +1 -0
  350. package/dist/local-process-sandbox.d.ts +41 -0
  351. package/dist/local-process-sandbox.d.ts.map +1 -0
  352. package/dist/local-process-sandbox.js +432 -0
  353. package/dist/local-process-sandbox.js.map +1 -0
  354. package/dist/local-process-sandbox.test.d.ts +2 -0
  355. package/dist/local-process-sandbox.test.d.ts.map +1 -0
  356. package/dist/local-process-sandbox.test.js +399 -0
  357. package/dist/local-process-sandbox.test.js.map +1 -0
  358. package/dist/log-redaction.d.ts +9 -0
  359. package/dist/log-redaction.d.ts.map +1 -0
  360. package/dist/log-redaction.js +88 -0
  361. package/dist/log-redaction.js.map +1 -0
  362. package/dist/login-capability.d.ts +88 -0
  363. package/dist/login-capability.d.ts.map +1 -0
  364. package/dist/login-capability.js +78 -0
  365. package/dist/login-capability.js.map +1 -0
  366. package/dist/login-capability.test.d.ts +2 -0
  367. package/dist/login-capability.test.d.ts.map +1 -0
  368. package/dist/login-capability.test.js +78 -0
  369. package/dist/login-capability.test.js.map +1 -0
  370. package/dist/login-pty-transport.d.ts +80 -0
  371. package/dist/login-pty-transport.d.ts.map +1 -0
  372. package/dist/login-pty-transport.js +75 -0
  373. package/dist/login-pty-transport.js.map +1 -0
  374. package/dist/login-pty-transport.test.d.ts +2 -0
  375. package/dist/login-pty-transport.test.d.ts.map +1 -0
  376. package/dist/login-pty-transport.test.js +185 -0
  377. package/dist/login-pty-transport.test.js.map +1 -0
  378. package/dist/login-runner-lifecycle.d.ts +70 -0
  379. package/dist/login-runner-lifecycle.d.ts.map +1 -0
  380. package/dist/login-runner-lifecycle.js +52 -0
  381. package/dist/login-runner-lifecycle.js.map +1 -0
  382. package/dist/login-runner-lifecycle.test.d.ts +2 -0
  383. package/dist/login-runner-lifecycle.test.d.ts.map +1 -0
  384. package/dist/login-runner-lifecycle.test.js +122 -0
  385. package/dist/login-runner-lifecycle.test.js.map +1 -0
  386. package/dist/managed-ai-runtime-env.d.ts +4 -0
  387. package/dist/managed-ai-runtime-env.d.ts.map +1 -0
  388. package/dist/managed-ai-runtime-env.js +47 -0
  389. package/dist/managed-ai-runtime-env.js.map +1 -0
  390. package/dist/managed-clone-staging.test.d.ts +2 -0
  391. package/dist/managed-clone-staging.test.d.ts.map +1 -0
  392. package/dist/managed-clone-staging.test.js +167 -0
  393. package/dist/managed-clone-staging.test.js.map +1 -0
  394. package/dist/mcp-isolation.integration.test.d.ts +2 -0
  395. package/dist/mcp-isolation.integration.test.d.ts.map +1 -0
  396. package/dist/mcp-isolation.integration.test.js +202 -0
  397. package/dist/mcp-isolation.integration.test.js.map +1 -0
  398. package/dist/model-facing-history.d.ts +10 -0
  399. package/dist/model-facing-history.d.ts.map +1 -0
  400. package/dist/model-facing-history.js +44 -0
  401. package/dist/model-facing-history.js.map +1 -0
  402. package/dist/model-facing-history.test.d.ts +2 -0
  403. package/dist/model-facing-history.test.d.ts.map +1 -0
  404. package/dist/model-facing-history.test.js +27 -0
  405. package/dist/model-facing-history.test.js.map +1 -0
  406. package/dist/openrouter-attribution.d.ts +2 -0
  407. package/dist/openrouter-attribution.d.ts.map +1 -0
  408. package/dist/openrouter-attribution.js +2 -0
  409. package/dist/openrouter-attribution.js.map +1 -0
  410. package/dist/paperclip-runner-lifecycle-default.test.d.ts +2 -0
  411. package/dist/paperclip-runner-lifecycle-default.test.d.ts.map +1 -0
  412. package/dist/paperclip-runner-lifecycle-default.test.js +30 -0
  413. package/dist/paperclip-runner-lifecycle-default.test.js.map +1 -0
  414. package/dist/paperclip-runner-permissions.d.ts +182 -0
  415. package/dist/paperclip-runner-permissions.d.ts.map +1 -0
  416. package/dist/paperclip-runner-permissions.js +205 -0
  417. package/dist/paperclip-runner-permissions.js.map +1 -0
  418. package/dist/paperclip-runner-permissions.test.d.ts +2 -0
  419. package/dist/paperclip-runner-permissions.test.d.ts.map +1 -0
  420. package/dist/paperclip-runner-permissions.test.js +104 -0
  421. package/dist/paperclip-runner-permissions.test.js.map +1 -0
  422. package/dist/prompt-sections.test.d.ts +2 -0
  423. package/dist/prompt-sections.test.d.ts.map +1 -0
  424. package/dist/prompt-sections.test.js +53 -0
  425. package/dist/prompt-sections.test.js.map +1 -0
  426. package/dist/provider-stopped-boundary.d.ts +7 -0
  427. package/dist/provider-stopped-boundary.d.ts.map +1 -0
  428. package/dist/provider-stopped-boundary.js +22 -0
  429. package/dist/provider-stopped-boundary.js.map +1 -0
  430. package/dist/provider-stopped-boundary.test.d.ts +2 -0
  431. package/dist/provider-stopped-boundary.test.d.ts.map +1 -0
  432. package/dist/provider-stopped-boundary.test.js +76 -0
  433. package/dist/provider-stopped-boundary.test.js.map +1 -0
  434. package/dist/published-exports.test.d.ts +2 -0
  435. package/dist/published-exports.test.d.ts.map +1 -0
  436. package/dist/published-exports.test.js +17 -0
  437. package/dist/published-exports.test.js.map +1 -0
  438. package/dist/remote-execution-env.d.ts +3 -0
  439. package/dist/remote-execution-env.d.ts.map +1 -0
  440. package/dist/remote-execution-env.js +56 -0
  441. package/dist/remote-execution-env.js.map +1 -0
  442. package/dist/remote-managed-runtime.d.ts +52 -0
  443. package/dist/remote-managed-runtime.d.ts.map +1 -0
  444. package/dist/remote-managed-runtime.js +265 -0
  445. package/dist/remote-managed-runtime.js.map +1 -0
  446. package/dist/remote-managed-runtime.test.d.ts +2 -0
  447. package/dist/remote-managed-runtime.test.d.ts.map +1 -0
  448. package/dist/remote-managed-runtime.test.js +425 -0
  449. package/dist/remote-managed-runtime.test.js.map +1 -0
  450. package/dist/remote-pid-lock.d.ts +3 -0
  451. package/dist/remote-pid-lock.d.ts.map +1 -0
  452. package/dist/remote-pid-lock.js +35 -0
  453. package/dist/remote-pid-lock.js.map +1 -0
  454. package/dist/remote-text-file-sync.d.ts +41 -0
  455. package/dist/remote-text-file-sync.d.ts.map +1 -0
  456. package/dist/remote-text-file-sync.js +103 -0
  457. package/dist/remote-text-file-sync.js.map +1 -0
  458. package/dist/runner-connectivity.d.ts +61 -0
  459. package/dist/runner-connectivity.d.ts.map +1 -0
  460. package/dist/runner-connectivity.js +81 -0
  461. package/dist/runner-connectivity.js.map +1 -0
  462. package/dist/runner-connectivity.test.d.ts +2 -0
  463. package/dist/runner-connectivity.test.d.ts.map +1 -0
  464. package/dist/runner-connectivity.test.js +183 -0
  465. package/dist/runner-connectivity.test.js.map +1 -0
  466. package/dist/runtime-progress.d.ts +48 -0
  467. package/dist/runtime-progress.d.ts.map +1 -0
  468. package/dist/runtime-progress.js +99 -0
  469. package/dist/runtime-progress.js.map +1 -0
  470. package/dist/runtime-progress.test.d.ts +2 -0
  471. package/dist/runtime-progress.test.d.ts.map +1 -0
  472. package/dist/runtime-progress.test.js +240 -0
  473. package/dist/runtime-progress.test.js.map +1 -0
  474. package/dist/sandbox-callback-bridge-body.d.ts +12 -0
  475. package/dist/sandbox-callback-bridge-body.d.ts.map +1 -0
  476. package/dist/sandbox-callback-bridge-body.js +39 -0
  477. package/dist/sandbox-callback-bridge-body.js.map +1 -0
  478. package/dist/sandbox-callback-bridge-body.test.d.ts +2 -0
  479. package/dist/sandbox-callback-bridge-body.test.d.ts.map +1 -0
  480. package/dist/sandbox-callback-bridge-body.test.js +31 -0
  481. package/dist/sandbox-callback-bridge-body.test.js.map +1 -0
  482. package/dist/sandbox-callback-bridge.d.ts +249 -0
  483. package/dist/sandbox-callback-bridge.d.ts.map +1 -0
  484. package/dist/sandbox-callback-bridge.js +2309 -0
  485. package/dist/sandbox-callback-bridge.js.map +1 -0
  486. package/dist/sandbox-callback-bridge.test.d.ts +2 -0
  487. package/dist/sandbox-callback-bridge.test.d.ts.map +1 -0
  488. package/dist/sandbox-callback-bridge.test.js +3434 -0
  489. package/dist/sandbox-callback-bridge.test.js.map +1 -0
  490. package/dist/sandbox-callback-context-routes.test.d.ts +2 -0
  491. package/dist/sandbox-callback-context-routes.test.d.ts.map +1 -0
  492. package/dist/sandbox-callback-context-routes.test.js +40 -0
  493. package/dist/sandbox-callback-context-routes.test.js.map +1 -0
  494. package/dist/sandbox-file-sync.test.d.ts +2 -0
  495. package/dist/sandbox-file-sync.test.d.ts.map +1 -0
  496. package/dist/sandbox-file-sync.test.js +419 -0
  497. package/dist/sandbox-file-sync.test.js.map +1 -0
  498. package/dist/sandbox-install-command.d.ts +2 -0
  499. package/dist/sandbox-install-command.d.ts.map +1 -0
  500. package/dist/sandbox-install-command.js +47 -0
  501. package/dist/sandbox-install-command.js.map +1 -0
  502. package/dist/sandbox-install-command.test.d.ts +2 -0
  503. package/dist/sandbox-install-command.test.d.ts.map +1 -0
  504. package/dist/sandbox-install-command.test.js +22 -0
  505. package/dist/sandbox-install-command.test.js.map +1 -0
  506. package/dist/sandbox-managed-deletions.test.d.ts +2 -0
  507. package/dist/sandbox-managed-deletions.test.d.ts.map +1 -0
  508. package/dist/sandbox-managed-deletions.test.js +85 -0
  509. package/dist/sandbox-managed-deletions.test.js.map +1 -0
  510. package/dist/sandbox-managed-runtime.d.ts +465 -0
  511. package/dist/sandbox-managed-runtime.d.ts.map +1 -0
  512. package/dist/sandbox-managed-runtime.js +1801 -0
  513. package/dist/sandbox-managed-runtime.js.map +1 -0
  514. package/dist/sandbox-managed-runtime.test.d.ts +2 -0
  515. package/dist/sandbox-managed-runtime.test.d.ts.map +1 -0
  516. package/dist/sandbox-managed-runtime.test.js +3824 -0
  517. package/dist/sandbox-managed-runtime.test.js.map +1 -0
  518. package/dist/sandbox-managed-seed.test.d.ts +2 -0
  519. package/dist/sandbox-managed-seed.test.d.ts.map +1 -0
  520. package/dist/sandbox-managed-seed.test.js +223 -0
  521. package/dist/sandbox-managed-seed.test.js.map +1 -0
  522. package/dist/sandbox-run-log-stream.d.ts +44 -0
  523. package/dist/sandbox-run-log-stream.d.ts.map +1 -0
  524. package/dist/sandbox-run-log-stream.js +203 -0
  525. package/dist/sandbox-run-log-stream.js.map +1 -0
  526. package/dist/sandbox-shell.d.ts +3 -0
  527. package/dist/sandbox-shell.d.ts.map +1 -0
  528. package/dist/sandbox-shell.js +7 -0
  529. package/dist/sandbox-shell.js.map +1 -0
  530. package/dist/server-utils-env.test.d.ts +2 -0
  531. package/dist/server-utils-env.test.d.ts.map +1 -0
  532. package/dist/server-utils-env.test.js +15 -0
  533. package/dist/server-utils-env.test.js.map +1 -0
  534. package/dist/server-utils.d.ts +691 -0
  535. package/dist/server-utils.d.ts.map +1 -0
  536. package/dist/server-utils.js +3479 -0
  537. package/dist/server-utils.js.map +1 -0
  538. package/dist/server-utils.test.d.ts +2 -0
  539. package/dist/server-utils.test.d.ts.map +1 -0
  540. package/dist/server-utils.test.js +3571 -0
  541. package/dist/server-utils.test.js.map +1 -0
  542. package/dist/session-compaction.d.ts +25 -0
  543. package/dist/session-compaction.d.ts.map +1 -0
  544. package/dist/session-compaction.js +166 -0
  545. package/dist/session-compaction.js.map +1 -0
  546. package/dist/sigv4-presigned-url.d.ts +7 -0
  547. package/dist/sigv4-presigned-url.d.ts.map +1 -0
  548. package/dist/sigv4-presigned-url.js +119 -0
  549. package/dist/sigv4-presigned-url.js.map +1 -0
  550. package/dist/skill-library-manifest.d.ts +6 -0
  551. package/dist/skill-library-manifest.d.ts.map +1 -0
  552. package/dist/skill-library-manifest.js +53 -0
  553. package/dist/skill-library-manifest.js.map +1 -0
  554. package/dist/skill-library-manifest.test.d.ts +2 -0
  555. package/dist/skill-library-manifest.test.d.ts.map +1 -0
  556. package/dist/skill-library-manifest.test.js +84 -0
  557. package/dist/skill-library-manifest.test.js.map +1 -0
  558. package/dist/skills-staging-follow-symlinks.test.d.ts +2 -0
  559. package/dist/skills-staging-follow-symlinks.test.d.ts.map +1 -0
  560. package/dist/skills-staging-follow-symlinks.test.js +126 -0
  561. package/dist/skills-staging-follow-symlinks.test.js.map +1 -0
  562. package/dist/ssh-auth.test.d.ts +2 -0
  563. package/dist/ssh-auth.test.d.ts.map +1 -0
  564. package/dist/ssh-auth.test.js +20 -0
  565. package/dist/ssh-auth.test.js.map +1 -0
  566. package/dist/ssh-command-managed.test.d.ts +2 -0
  567. package/dist/ssh-command-managed.test.d.ts.map +1 -0
  568. package/dist/ssh-command-managed.test.js +136 -0
  569. package/dist/ssh-command-managed.test.js.map +1 -0
  570. package/dist/ssh-conversation-state.d.ts +22 -0
  571. package/dist/ssh-conversation-state.d.ts.map +1 -0
  572. package/dist/ssh-conversation-state.js +36 -0
  573. package/dist/ssh-conversation-state.js.map +1 -0
  574. package/dist/ssh-export-stream.test.d.ts +2 -0
  575. package/dist/ssh-export-stream.test.d.ts.map +1 -0
  576. package/dist/ssh-export-stream.test.js +104 -0
  577. package/dist/ssh-export-stream.test.js.map +1 -0
  578. package/dist/ssh-export.test.d.ts +2 -0
  579. package/dist/ssh-export.test.d.ts.map +1 -0
  580. package/dist/ssh-export.test.js +102 -0
  581. package/dist/ssh-export.test.js.map +1 -0
  582. package/dist/ssh-fixture.test.d.ts +2 -0
  583. package/dist/ssh-fixture.test.d.ts.map +1 -0
  584. package/dist/ssh-fixture.test.js +1107 -0
  585. package/dist/ssh-fixture.test.js.map +1 -0
  586. package/dist/ssh-tailscale.test.d.ts +2 -0
  587. package/dist/ssh-tailscale.test.d.ts.map +1 -0
  588. package/dist/ssh-tailscale.test.js +58 -0
  589. package/dist/ssh-tailscale.test.js.map +1 -0
  590. package/dist/ssh.d.ts +138 -0
  591. package/dist/ssh.d.ts.map +1 -0
  592. package/dist/ssh.js +1868 -0
  593. package/dist/ssh.js.map +1 -0
  594. package/dist/startup-reuse.d.ts +38 -0
  595. package/dist/startup-reuse.d.ts.map +1 -0
  596. package/dist/startup-reuse.js +90 -0
  597. package/dist/startup-reuse.js.map +1 -0
  598. package/dist/startup-reuse.test.d.ts +2 -0
  599. package/dist/startup-reuse.test.d.ts.map +1 -0
  600. package/dist/startup-reuse.test.js +71 -0
  601. package/dist/startup-reuse.test.js.map +1 -0
  602. package/dist/sync-operation-schedule.d.ts +17 -0
  603. package/dist/sync-operation-schedule.d.ts.map +1 -0
  604. package/dist/sync-operation-schedule.js +66 -0
  605. package/dist/sync-operation-schedule.js.map +1 -0
  606. package/dist/sync-operation-schedule.test.d.ts +2 -0
  607. package/dist/sync-operation-schedule.test.d.ts.map +1 -0
  608. package/dist/sync-operation-schedule.test.js +130 -0
  609. package/dist/sync-operation-schedule.test.js.map +1 -0
  610. package/dist/test-fixtures/follow-up-after-swarm-wake.d.ts +45 -0
  611. package/dist/test-fixtures/follow-up-after-swarm-wake.d.ts.map +1 -0
  612. package/dist/test-fixtures/follow-up-after-swarm-wake.js +80 -0
  613. package/dist/test-fixtures/follow-up-after-swarm-wake.js.map +1 -0
  614. package/dist/test-fixtures/prompt-context.d.ts +54 -0
  615. package/dist/test-fixtures/prompt-context.d.ts.map +1 -0
  616. package/dist/test-fixtures/prompt-context.js +55 -0
  617. package/dist/test-fixtures/prompt-context.js.map +1 -0
  618. package/dist/test-support/mcp-isolation-harness.d.ts +23 -0
  619. package/dist/test-support/mcp-isolation-harness.d.ts.map +1 -0
  620. package/dist/test-support/mcp-isolation-harness.js +67 -0
  621. package/dist/test-support/mcp-isolation-harness.js.map +1 -0
  622. package/dist/types.d.ts +910 -0
  623. package/dist/types.d.ts.map +1 -0
  624. package/dist/types.js +5 -0
  625. package/dist/types.js.map +1 -0
  626. package/dist/usage-checkpoint.d.ts +11 -0
  627. package/dist/usage-checkpoint.d.ts.map +1 -0
  628. package/dist/usage-checkpoint.js +165 -0
  629. package/dist/usage-checkpoint.js.map +1 -0
  630. package/dist/usage-checkpoint.test.d.ts +2 -0
  631. package/dist/usage-checkpoint.test.d.ts.map +1 -0
  632. package/dist/usage-checkpoint.test.js +131 -0
  633. package/dist/usage-checkpoint.test.js.map +1 -0
  634. package/dist/workspace-checkpoint-capture.test.d.ts +2 -0
  635. package/dist/workspace-checkpoint-capture.test.d.ts.map +1 -0
  636. package/dist/workspace-checkpoint-capture.test.js +232 -0
  637. package/dist/workspace-checkpoint-capture.test.js.map +1 -0
  638. package/dist/workspace-checkpoint.d.ts +16 -0
  639. package/dist/workspace-checkpoint.d.ts.map +1 -0
  640. package/dist/workspace-checkpoint.js +236 -0
  641. package/dist/workspace-checkpoint.js.map +1 -0
  642. package/dist/workspace-checkpoint.test.d.ts +2 -0
  643. package/dist/workspace-checkpoint.test.d.ts.map +1 -0
  644. package/dist/workspace-checkpoint.test.js +588 -0
  645. package/dist/workspace-checkpoint.test.js.map +1 -0
  646. package/dist/workspace-git-stream.d.ts +19 -0
  647. package/dist/workspace-git-stream.d.ts.map +1 -0
  648. package/dist/workspace-git-stream.js +99 -0
  649. package/dist/workspace-git-stream.js.map +1 -0
  650. package/dist/workspace-git-stream.test.d.ts +2 -0
  651. package/dist/workspace-git-stream.test.d.ts.map +1 -0
  652. package/dist/workspace-git-stream.test.js +71 -0
  653. package/dist/workspace-git-stream.test.js.map +1 -0
  654. package/dist/workspace-manifest.d.ts +61 -0
  655. package/dist/workspace-manifest.d.ts.map +1 -0
  656. package/dist/workspace-manifest.js +257 -0
  657. package/dist/workspace-manifest.js.map +1 -0
  658. package/dist/workspace-manifest.test.d.ts +2 -0
  659. package/dist/workspace-manifest.test.d.ts.map +1 -0
  660. package/dist/workspace-manifest.test.js +160 -0
  661. package/dist/workspace-manifest.test.js.map +1 -0
  662. package/dist/workspace-restore-diagnostics.d.ts +41 -0
  663. package/dist/workspace-restore-diagnostics.d.ts.map +1 -0
  664. package/dist/workspace-restore-diagnostics.js +265 -0
  665. package/dist/workspace-restore-diagnostics.js.map +1 -0
  666. package/dist/workspace-restore-diagnostics.test.d.ts +2 -0
  667. package/dist/workspace-restore-diagnostics.test.d.ts.map +1 -0
  668. package/dist/workspace-restore-diagnostics.test.js +294 -0
  669. package/dist/workspace-restore-diagnostics.test.js.map +1 -0
  670. package/dist/workspace-restore-merge.d.ts +126 -0
  671. package/dist/workspace-restore-merge.d.ts.map +1 -0
  672. package/dist/workspace-restore-merge.js +768 -0
  673. package/dist/workspace-restore-merge.js.map +1 -0
  674. package/dist/workspace-restore-merge.test.d.ts +2 -0
  675. package/dist/workspace-restore-merge.test.d.ts.map +1 -0
  676. package/dist/workspace-restore-merge.test.js +805 -0
  677. package/dist/workspace-restore-merge.test.js.map +1 -0
  678. package/dist/workspace-restore-result.d.ts +6 -0
  679. package/dist/workspace-restore-result.d.ts.map +1 -0
  680. package/dist/workspace-restore-result.js +72 -0
  681. package/dist/workspace-restore-result.js.map +1 -0
  682. package/dist/workspace-restore-result.test.d.ts +2 -0
  683. package/dist/workspace-restore-result.test.d.ts.map +1 -0
  684. package/dist/workspace-restore-result.test.js +74 -0
  685. package/dist/workspace-restore-result.test.js.map +1 -0
  686. package/dist/workspace-restore-teardown.d.ts +29 -0
  687. package/dist/workspace-restore-teardown.d.ts.map +1 -0
  688. package/dist/workspace-restore-teardown.js +36 -0
  689. package/dist/workspace-restore-teardown.js.map +1 -0
  690. package/dist/workspace-restore-teardown.test.d.ts +2 -0
  691. package/dist/workspace-restore-teardown.test.d.ts.map +1 -0
  692. package/dist/workspace-restore-teardown.test.js +104 -0
  693. package/dist/workspace-restore-teardown.test.js.map +1 -0
  694. package/dist/workspace-restore-unchanged.test.d.ts +2 -0
  695. package/dist/workspace-restore-unchanged.test.d.ts.map +1 -0
  696. package/dist/workspace-restore-unchanged.test.js +143 -0
  697. package/dist/workspace-restore-unchanged.test.js.map +1 -0
  698. package/dist/workspace-seed-cache.d.ts +41 -0
  699. package/dist/workspace-seed-cache.d.ts.map +1 -0
  700. package/dist/workspace-seed-cache.js +354 -0
  701. package/dist/workspace-seed-cache.js.map +1 -0
  702. package/dist/workspace-seed-cache.test.d.ts +2 -0
  703. package/dist/workspace-seed-cache.test.d.ts.map +1 -0
  704. package/dist/workspace-seed-cache.test.js +522 -0
  705. package/dist/workspace-seed-cache.test.js.map +1 -0
  706. package/dist/workspace-seed-reuse.test.d.ts +2 -0
  707. package/dist/workspace-seed-reuse.test.d.ts.map +1 -0
  708. package/dist/workspace-seed-reuse.test.js +274 -0
  709. package/dist/workspace-seed-reuse.test.js.map +1 -0
  710. package/dist/workspace-snapshot-concurrency.test.d.ts +2 -0
  711. package/dist/workspace-snapshot-concurrency.test.d.ts.map +1 -0
  712. package/dist/workspace-snapshot-concurrency.test.js +165 -0
  713. package/dist/workspace-snapshot-concurrency.test.js.map +1 -0
  714. package/dist/workspace-snapshot-thread-limit.test.d.ts +2 -0
  715. package/dist/workspace-snapshot-thread-limit.test.d.ts.map +1 -0
  716. package/dist/workspace-snapshot-thread-limit.test.js +84 -0
  717. package/dist/workspace-snapshot-thread-limit.test.js.map +1 -0
  718. package/dist/workspace-snapshot-thread-worker.d.ts +2 -0
  719. package/dist/workspace-snapshot-thread-worker.d.ts.map +1 -0
  720. package/dist/workspace-snapshot-thread-worker.js +28 -0
  721. package/dist/workspace-snapshot-thread-worker.js.map +1 -0
  722. package/dist/workspace-snapshot-thread.d.ts +27 -0
  723. package/dist/workspace-snapshot-thread.d.ts.map +1 -0
  724. package/dist/workspace-snapshot-thread.js +77 -0
  725. package/dist/workspace-snapshot-thread.js.map +1 -0
  726. package/dist/workspace-snapshot-thread.test.d.ts +2 -0
  727. package/dist/workspace-snapshot-thread.test.d.ts.map +1 -0
  728. package/dist/workspace-snapshot-thread.test.js +140 -0
  729. package/dist/workspace-snapshot-thread.test.js.map +1 -0
  730. package/node_modules/@agentclientprotocol/sdk/LICENSE +191 -0
  731. package/node_modules/@agentclientprotocol/sdk/README.md +77 -0
  732. package/node_modules/@agentclientprotocol/sdk/dist/acp.d.ts +1637 -0
  733. package/node_modules/@agentclientprotocol/sdk/dist/acp.js +1729 -0
  734. package/node_modules/@agentclientprotocol/sdk/dist/acp.js.map +1 -0
  735. package/node_modules/@agentclientprotocol/sdk/dist/acp.test.d.ts +1 -0
  736. package/node_modules/@agentclientprotocol/sdk/dist/acp.test.js +5093 -0
  737. package/node_modules/@agentclientprotocol/sdk/dist/acp.test.js.map +1 -0
  738. package/node_modules/@agentclientprotocol/sdk/dist/connection.d.ts +277 -0
  739. package/node_modules/@agentclientprotocol/sdk/dist/connection.js +898 -0
  740. package/node_modules/@agentclientprotocol/sdk/dist/connection.js.map +1 -0
  741. package/node_modules/@agentclientprotocol/sdk/dist/connection.test.d.ts +1 -0
  742. package/node_modules/@agentclientprotocol/sdk/dist/connection.test.js +666 -0
  743. package/node_modules/@agentclientprotocol/sdk/dist/connection.test.js.map +1 -0
  744. package/node_modules/@agentclientprotocol/sdk/dist/cookie-store.d.ts +26 -0
  745. package/node_modules/@agentclientprotocol/sdk/dist/cookie-store.js +96 -0
  746. package/node_modules/@agentclientprotocol/sdk/dist/cookie-store.js.map +1 -0
  747. package/node_modules/@agentclientprotocol/sdk/dist/cookie-store.test.d.ts +1 -0
  748. package/node_modules/@agentclientprotocol/sdk/dist/cookie-store.test.js +77 -0
  749. package/node_modules/@agentclientprotocol/sdk/dist/cookie-store.test.js.map +1 -0
  750. package/node_modules/@agentclientprotocol/sdk/dist/examples/agent.d.ts +2 -0
  751. package/node_modules/@agentclientprotocol/sdk/dist/examples/agent.js +232 -0
  752. package/node_modules/@agentclientprotocol/sdk/dist/examples/agent.js.map +1 -0
  753. package/node_modules/@agentclientprotocol/sdk/dist/examples/client.d.ts +2 -0
  754. package/node_modules/@agentclientprotocol/sdk/dist/examples/client.js +132 -0
  755. package/node_modules/@agentclientprotocol/sdk/dist/examples/client.js.map +1 -0
  756. package/node_modules/@agentclientprotocol/sdk/dist/examples/dual-version-agent.d.ts +9 -0
  757. package/node_modules/@agentclientprotocol/sdk/dist/examples/dual-version-agent.js +229 -0
  758. package/node_modules/@agentclientprotocol/sdk/dist/examples/dual-version-agent.js.map +1 -0
  759. package/node_modules/@agentclientprotocol/sdk/dist/examples/http-client.d.ts +2 -0
  760. package/node_modules/@agentclientprotocol/sdk/dist/examples/http-client.js +86 -0
  761. package/node_modules/@agentclientprotocol/sdk/dist/examples/http-client.js.map +1 -0
  762. package/node_modules/@agentclientprotocol/sdk/dist/examples/http-server.d.ts +2 -0
  763. package/node_modules/@agentclientprotocol/sdk/dist/examples/http-server.js +117 -0
  764. package/node_modules/@agentclientprotocol/sdk/dist/examples/http-server.js.map +1 -0
  765. package/node_modules/@agentclientprotocol/sdk/dist/examples/ws-client.d.ts +2 -0
  766. package/node_modules/@agentclientprotocol/sdk/dist/examples/ws-client.js +88 -0
  767. package/node_modules/@agentclientprotocol/sdk/dist/examples/ws-client.js.map +1 -0
  768. package/node_modules/@agentclientprotocol/sdk/dist/http-stream.d.ts +35 -0
  769. package/node_modules/@agentclientprotocol/sdk/dist/http-stream.js +473 -0
  770. package/node_modules/@agentclientprotocol/sdk/dist/http-stream.js.map +1 -0
  771. package/node_modules/@agentclientprotocol/sdk/dist/http-stream.test.d.ts +1 -0
  772. package/node_modules/@agentclientprotocol/sdk/dist/http-stream.test.js +1380 -0
  773. package/node_modules/@agentclientprotocol/sdk/dist/http-stream.test.js.map +1 -0
  774. package/node_modules/@agentclientprotocol/sdk/dist/jsonrpc.d.ts +604 -0
  775. package/node_modules/@agentclientprotocol/sdk/dist/jsonrpc.js +1082 -0
  776. package/node_modules/@agentclientprotocol/sdk/dist/jsonrpc.js.map +1 -0
  777. package/node_modules/@agentclientprotocol/sdk/dist/jsonrpc.test.d.ts +1 -0
  778. package/node_modules/@agentclientprotocol/sdk/dist/jsonrpc.test.js +917 -0
  779. package/node_modules/@agentclientprotocol/sdk/dist/jsonrpc.test.js.map +1 -0
  780. package/node_modules/@agentclientprotocol/sdk/dist/line-buffer.d.ts +24 -0
  781. package/node_modules/@agentclientprotocol/sdk/dist/line-buffer.js +71 -0
  782. package/node_modules/@agentclientprotocol/sdk/dist/line-buffer.js.map +1 -0
  783. package/node_modules/@agentclientprotocol/sdk/dist/line-buffer.test.d.ts +1 -0
  784. package/node_modules/@agentclientprotocol/sdk/dist/line-buffer.test.js +45 -0
  785. package/node_modules/@agentclientprotocol/sdk/dist/line-buffer.test.js.map +1 -0
  786. package/node_modules/@agentclientprotocol/sdk/dist/nes/acp.d.ts +563 -0
  787. package/node_modules/@agentclientprotocol/sdk/dist/nes/acp.js +106 -0
  788. package/node_modules/@agentclientprotocol/sdk/dist/nes/acp.js.map +1 -0
  789. package/node_modules/@agentclientprotocol/sdk/dist/nes/schema/types.gen.d.ts +1261 -0
  790. package/node_modules/@agentclientprotocol/sdk/dist/nes/schema/types.gen.js +4 -0
  791. package/node_modules/@agentclientprotocol/sdk/dist/nes/schema/types.gen.js.map +1 -0
  792. package/node_modules/@agentclientprotocol/sdk/dist/nes/schema/zod.gen.d.ts +962 -0
  793. package/node_modules/@agentclientprotocol/sdk/dist/nes/schema/zod.gen.js +526 -0
  794. package/node_modules/@agentclientprotocol/sdk/dist/nes/schema/zod.gen.js.map +1 -0
  795. package/node_modules/@agentclientprotocol/sdk/dist/node-adapter.d.ts +17 -0
  796. package/node_modules/@agentclientprotocol/sdk/dist/node-adapter.js +457 -0
  797. package/node_modules/@agentclientprotocol/sdk/dist/node-adapter.js.map +1 -0
  798. package/node_modules/@agentclientprotocol/sdk/dist/node-adapter.test.d.ts +1 -0
  799. package/node_modules/@agentclientprotocol/sdk/dist/node-adapter.test.js +586 -0
  800. package/node_modules/@agentclientprotocol/sdk/dist/node-adapter.test.js.map +1 -0
  801. package/node_modules/@agentclientprotocol/sdk/dist/protocol-router.d.ts +43 -0
  802. package/node_modules/@agentclientprotocol/sdk/dist/protocol-router.js +467 -0
  803. package/node_modules/@agentclientprotocol/sdk/dist/protocol-router.js.map +1 -0
  804. package/node_modules/@agentclientprotocol/sdk/dist/protocol-router.test.d.ts +1 -0
  805. package/node_modules/@agentclientprotocol/sdk/dist/protocol-router.test.js +592 -0
  806. package/node_modules/@agentclientprotocol/sdk/dist/protocol-router.test.js.map +1 -0
  807. package/node_modules/@agentclientprotocol/sdk/dist/protocol.d.ts +11 -0
  808. package/node_modules/@agentclientprotocol/sdk/dist/protocol.js +60 -0
  809. package/node_modules/@agentclientprotocol/sdk/dist/protocol.js.map +1 -0
  810. package/node_modules/@agentclientprotocol/sdk/dist/protocol.test.d.ts +1 -0
  811. package/node_modules/@agentclientprotocol/sdk/dist/protocol.test.js +72 -0
  812. package/node_modules/@agentclientprotocol/sdk/dist/protocol.test.js.map +1 -0
  813. package/node_modules/@agentclientprotocol/sdk/dist/schema/guards.gen.d.ts +305 -0
  814. package/node_modules/@agentclientprotocol/sdk/dist/schema/guards.gen.js +355 -0
  815. package/node_modules/@agentclientprotocol/sdk/dist/schema/guards.gen.js.map +1 -0
  816. package/node_modules/@agentclientprotocol/sdk/dist/schema/index.d.ts +39 -0
  817. package/node_modules/@agentclientprotocol/sdk/dist/schema/index.js +40 -0
  818. package/node_modules/@agentclientprotocol/sdk/dist/schema/index.js.map +1 -0
  819. package/node_modules/@agentclientprotocol/sdk/dist/schema/types.gen.d.ts +5438 -0
  820. package/node_modules/@agentclientprotocol/sdk/dist/schema/types.gen.js +3 -0
  821. package/node_modules/@agentclientprotocol/sdk/dist/schema/types.gen.js.map +1 -0
  822. package/node_modules/@agentclientprotocol/sdk/dist/schema/zod.gen.d.ts +15955 -0
  823. package/node_modules/@agentclientprotocol/sdk/dist/schema/zod.gen.js +2827 -0
  824. package/node_modules/@agentclientprotocol/sdk/dist/schema/zod.gen.js.map +1 -0
  825. package/node_modules/@agentclientprotocol/sdk/dist/schema-deserialize.d.ts +31 -0
  826. package/node_modules/@agentclientprotocol/sdk/dist/schema-deserialize.js +117 -0
  827. package/node_modules/@agentclientprotocol/sdk/dist/schema-deserialize.js.map +1 -0
  828. package/node_modules/@agentclientprotocol/sdk/dist/schema-deserialize.test.d.ts +1 -0
  829. package/node_modules/@agentclientprotocol/sdk/dist/schema-deserialize.test.js +93 -0
  830. package/node_modules/@agentclientprotocol/sdk/dist/schema-deserialize.test.js.map +1 -0
  831. package/node_modules/@agentclientprotocol/sdk/dist/server-permission.test.d.ts +1 -0
  832. package/node_modules/@agentclientprotocol/sdk/dist/server-permission.test.js +261 -0
  833. package/node_modules/@agentclientprotocol/sdk/dist/server-permission.test.js.map +1 -0
  834. package/node_modules/@agentclientprotocol/sdk/dist/server-session-sse.test.d.ts +1 -0
  835. package/node_modules/@agentclientprotocol/sdk/dist/server-session-sse.test.js +536 -0
  836. package/node_modules/@agentclientprotocol/sdk/dist/server-session-sse.test.js.map +1 -0
  837. package/node_modules/@agentclientprotocol/sdk/dist/server-sse.d.ts +7 -0
  838. package/node_modules/@agentclientprotocol/sdk/dist/server-sse.js +136 -0
  839. package/node_modules/@agentclientprotocol/sdk/dist/server-sse.js.map +1 -0
  840. package/node_modules/@agentclientprotocol/sdk/dist/server-sse.test.d.ts +1 -0
  841. package/node_modules/@agentclientprotocol/sdk/dist/server-sse.test.js +106 -0
  842. package/node_modules/@agentclientprotocol/sdk/dist/server-sse.test.js.map +1 -0
  843. package/node_modules/@agentclientprotocol/sdk/dist/server-websocket-upgrade.test.d.ts +1 -0
  844. package/node_modules/@agentclientprotocol/sdk/dist/server-websocket-upgrade.test.js +1310 -0
  845. package/node_modules/@agentclientprotocol/sdk/dist/server-websocket-upgrade.test.js.map +1 -0
  846. package/node_modules/@agentclientprotocol/sdk/dist/server.d.ts +82 -0
  847. package/node_modules/@agentclientprotocol/sdk/dist/server.js +414 -0
  848. package/node_modules/@agentclientprotocol/sdk/dist/server.js.map +1 -0
  849. package/node_modules/@agentclientprotocol/sdk/dist/server.test.d.ts +1 -0
  850. package/node_modules/@agentclientprotocol/sdk/dist/server.test.js +1646 -0
  851. package/node_modules/@agentclientprotocol/sdk/dist/server.test.js.map +1 -0
  852. package/node_modules/@agentclientprotocol/sdk/dist/sse.d.ts +6 -0
  853. package/node_modules/@agentclientprotocol/sdk/dist/sse.js +114 -0
  854. package/node_modules/@agentclientprotocol/sdk/dist/sse.js.map +1 -0
  855. package/node_modules/@agentclientprotocol/sdk/dist/sse.test.d.ts +1 -0
  856. package/node_modules/@agentclientprotocol/sdk/dist/sse.test.js +126 -0
  857. package/node_modules/@agentclientprotocol/sdk/dist/sse.test.js.map +1 -0
  858. package/node_modules/@agentclientprotocol/sdk/dist/stream-limits.d.ts +15 -0
  859. package/node_modules/@agentclientprotocol/sdk/dist/stream-limits.js +58 -0
  860. package/node_modules/@agentclientprotocol/sdk/dist/stream-limits.js.map +1 -0
  861. package/node_modules/@agentclientprotocol/sdk/dist/stream.d.ts +38 -0
  862. package/node_modules/@agentclientprotocol/sdk/dist/stream.js +119 -0
  863. package/node_modules/@agentclientprotocol/sdk/dist/stream.js.map +1 -0
  864. package/node_modules/@agentclientprotocol/sdk/dist/stream.test.d.ts +1 -0
  865. package/node_modules/@agentclientprotocol/sdk/dist/stream.test.js +195 -0
  866. package/node_modules/@agentclientprotocol/sdk/dist/stream.test.js.map +1 -0
  867. package/node_modules/@agentclientprotocol/sdk/dist/test-support/streams.d.ts +8 -0
  868. package/node_modules/@agentclientprotocol/sdk/dist/test-support/streams.js +51 -0
  869. package/node_modules/@agentclientprotocol/sdk/dist/test-support/streams.js.map +1 -0
  870. package/node_modules/@agentclientprotocol/sdk/dist/test-support/test-agent.d.ts +24 -0
  871. package/node_modules/@agentclientprotocol/sdk/dist/test-support/test-agent.js +163 -0
  872. package/node_modules/@agentclientprotocol/sdk/dist/test-support/test-agent.js.map +1 -0
  873. package/node_modules/@agentclientprotocol/sdk/dist/test-support/test-http-server.d.ts +9 -0
  874. package/node_modules/@agentclientprotocol/sdk/dist/test-support/test-http-server.js +74 -0
  875. package/node_modules/@agentclientprotocol/sdk/dist/test-support/test-http-server.js.map +1 -0
  876. package/node_modules/@agentclientprotocol/sdk/dist/test-support/until.d.ts +5 -0
  877. package/node_modules/@agentclientprotocol/sdk/dist/test-support/until.js +14 -0
  878. package/node_modules/@agentclientprotocol/sdk/dist/test-support/until.js.map +1 -0
  879. package/node_modules/@agentclientprotocol/sdk/dist/v2/acp.d.ts +961 -0
  880. package/node_modules/@agentclientprotocol/sdk/dist/v2/acp.js +1451 -0
  881. package/node_modules/@agentclientprotocol/sdk/dist/v2/acp.js.map +1 -0
  882. package/node_modules/@agentclientprotocol/sdk/dist/v2/acp.test.d.ts +1 -0
  883. package/node_modules/@agentclientprotocol/sdk/dist/v2/acp.test.js +1423 -0
  884. package/node_modules/@agentclientprotocol/sdk/dist/v2/acp.test.js.map +1 -0
  885. package/node_modules/@agentclientprotocol/sdk/dist/v2/schema/guards.gen.d.ts +1084 -0
  886. package/node_modules/@agentclientprotocol/sdk/dist/v2/schema/guards.gen.js +1157 -0
  887. package/node_modules/@agentclientprotocol/sdk/dist/v2/schema/guards.gen.js.map +1 -0
  888. package/node_modules/@agentclientprotocol/sdk/dist/v2/schema/index.d.ts +30 -0
  889. package/node_modules/@agentclientprotocol/sdk/dist/v2/schema/index.js +31 -0
  890. package/node_modules/@agentclientprotocol/sdk/dist/v2/schema/index.js.map +1 -0
  891. package/node_modules/@agentclientprotocol/sdk/dist/v2/schema/types.gen.d.ts +5672 -0
  892. package/node_modules/@agentclientprotocol/sdk/dist/v2/schema/types.gen.js +3 -0
  893. package/node_modules/@agentclientprotocol/sdk/dist/v2/schema/types.gen.js.map +1 -0
  894. package/node_modules/@agentclientprotocol/sdk/dist/v2/schema/zod.gen.d.ts +37653 -0
  895. package/node_modules/@agentclientprotocol/sdk/dist/v2/schema/zod.gen.js +2952 -0
  896. package/node_modules/@agentclientprotocol/sdk/dist/v2/schema/zod.gen.js.map +1 -0
  897. package/node_modules/@agentclientprotocol/sdk/dist/ws-server.d.ts +14 -0
  898. package/node_modules/@agentclientprotocol/sdk/dist/ws-server.js +485 -0
  899. package/node_modules/@agentclientprotocol/sdk/dist/ws-server.js.map +1 -0
  900. package/node_modules/@agentclientprotocol/sdk/dist/ws-stream.d.ts +54 -0
  901. package/node_modules/@agentclientprotocol/sdk/dist/ws-stream.js +253 -0
  902. package/node_modules/@agentclientprotocol/sdk/dist/ws-stream.js.map +1 -0
  903. package/node_modules/@agentclientprotocol/sdk/dist/ws-stream.test.d.ts +1 -0
  904. package/node_modules/@agentclientprotocol/sdk/dist/ws-stream.test.js +836 -0
  905. package/node_modules/@agentclientprotocol/sdk/dist/ws-stream.test.js.map +1 -0
  906. package/node_modules/@agentclientprotocol/sdk/dist/ws-utils.d.ts +19 -0
  907. package/node_modules/@agentclientprotocol/sdk/dist/ws-utils.js +78 -0
  908. package/node_modules/@agentclientprotocol/sdk/dist/ws-utils.js.map +1 -0
  909. package/node_modules/@agentclientprotocol/sdk/dist/ws-utils.test.d.ts +1 -0
  910. package/node_modules/@agentclientprotocol/sdk/dist/ws-utils.test.js +42 -0
  911. package/node_modules/@agentclientprotocol/sdk/dist/ws-utils.test.js.map +1 -0
  912. package/node_modules/@agentclientprotocol/sdk/package.json +110 -0
  913. package/node_modules/@agentclientprotocol/sdk/schema/schema.json +7852 -0
  914. package/node_modules/@agentclientprotocol/sdk/schema/v2/schema.unstable.json +8814 -0
  915. package/node_modules/@clack/core/LICENSE +9 -0
  916. package/node_modules/@clack/core/README.md +22 -0
  917. package/node_modules/@clack/core/dist/index.d.mts +505 -0
  918. package/node_modules/@clack/core/dist/index.mjs +1006 -0
  919. package/node_modules/@clack/core/package.json +64 -0
  920. package/node_modules/@clack/prompts/LICENSE +9 -0
  921. package/node_modules/@clack/prompts/README.md +396 -0
  922. package/node_modules/@clack/prompts/dist/index.d.mts +950 -0
  923. package/node_modules/@clack/prompts/dist/index.mjs +1448 -0
  924. package/node_modules/@clack/prompts/package.json +67 -0
  925. package/node_modules/@openclaw/fs-safe/CHANGELOG.md +1772 -0
  926. package/node_modules/@openclaw/fs-safe/LICENSE +22 -0
  927. package/node_modules/@openclaw/fs-safe/README.md +383 -0
  928. package/node_modules/@openclaw/fs-safe/SECURITY.md +45 -0
  929. package/node_modules/@openclaw/fs-safe/dist/absolute-path.d.ts +32 -0
  930. package/node_modules/@openclaw/fs-safe/dist/absolute-path.js +307 -0
  931. package/node_modules/@openclaw/fs-safe/dist/advanced.d.ts +45 -0
  932. package/node_modules/@openclaw/fs-safe/dist/advanced.js +43 -0
  933. package/node_modules/@openclaw/fs-safe/dist/archive-crc32.d.ts +1 -0
  934. package/node_modules/@openclaw/fs-safe/dist/archive-crc32.js +19 -0
  935. package/node_modules/@openclaw/fs-safe/dist/archive-deadline.d.ts +11 -0
  936. package/node_modules/@openclaw/fs-safe/dist/archive-deadline.js +101 -0
  937. package/node_modules/@openclaw/fs-safe/dist/archive-durability.d.ts +23 -0
  938. package/node_modules/@openclaw/fs-safe/dist/archive-durability.js +180 -0
  939. package/node_modules/@openclaw/fs-safe/dist/archive-entry.d.ts +13 -0
  940. package/node_modules/@openclaw/fs-safe/dist/archive-entry.js +89 -0
  941. package/node_modules/@openclaw/fs-safe/dist/archive-errors.d.ts +12 -0
  942. package/node_modules/@openclaw/fs-safe/dist/archive-errors.js +23 -0
  943. package/node_modules/@openclaw/fs-safe/dist/archive-gzip-tail.d.ts +20 -0
  944. package/node_modules/@openclaw/fs-safe/dist/archive-gzip-tail.js +99 -0
  945. package/node_modules/@openclaw/fs-safe/dist/archive-input.d.ts +18 -0
  946. package/node_modules/@openclaw/fs-safe/dist/archive-input.js +100 -0
  947. package/node_modules/@openclaw/fs-safe/dist/archive-kind.d.ts +7 -0
  948. package/node_modules/@openclaw/fs-safe/dist/archive-kind.js +71 -0
  949. package/node_modules/@openclaw/fs-safe/dist/archive-limits.d.ts +56 -0
  950. package/node_modules/@openclaw/fs-safe/dist/archive-limits.js +131 -0
  951. package/node_modules/@openclaw/fs-safe/dist/archive-merge.d.ts +22 -0
  952. package/node_modules/@openclaw/fs-safe/dist/archive-merge.js +307 -0
  953. package/node_modules/@openclaw/fs-safe/dist/archive-parser-errors.d.ts +1 -0
  954. package/node_modules/@openclaw/fs-safe/dist/archive-parser-errors.js +12 -0
  955. package/node_modules/@openclaw/fs-safe/dist/archive-parser.wasm +0 -0
  956. package/node_modules/@openclaw/fs-safe/dist/archive-plan.d.ts +85 -0
  957. package/node_modules/@openclaw/fs-safe/dist/archive-plan.js +119 -0
  958. package/node_modules/@openclaw/fs-safe/dist/archive-read.d.ts +5 -0
  959. package/node_modules/@openclaw/fs-safe/dist/archive-read.js +241 -0
  960. package/node_modules/@openclaw/fs-safe/dist/archive-staging.d.ts +32 -0
  961. package/node_modules/@openclaw/fs-safe/dist/archive-staging.js +291 -0
  962. package/node_modules/@openclaw/fs-safe/dist/archive-tar-stream.d.ts +27 -0
  963. package/node_modules/@openclaw/fs-safe/dist/archive-tar-stream.js +127 -0
  964. package/node_modules/@openclaw/fs-safe/dist/archive-tar-wasm.d.ts +29 -0
  965. package/node_modules/@openclaw/fs-safe/dist/archive-tar-wasm.js +203 -0
  966. package/node_modules/@openclaw/fs-safe/dist/archive-zip-admission.d.ts +7 -0
  967. package/node_modules/@openclaw/fs-safe/dist/archive-zip-admission.js +96 -0
  968. package/node_modules/@openclaw/fs-safe/dist/archive-zip-count.d.ts +1 -0
  969. package/node_modules/@openclaw/fs-safe/dist/archive-zip-count.js +160 -0
  970. package/node_modules/@openclaw/fs-safe/dist/archive-zip-directory.d.ts +21 -0
  971. package/node_modules/@openclaw/fs-safe/dist/archive-zip-directory.js +267 -0
  972. package/node_modules/@openclaw/fs-safe/dist/archive-zip-entry.d.ts +24 -0
  973. package/node_modules/@openclaw/fs-safe/dist/archive-zip-entry.js +10 -0
  974. package/node_modules/@openclaw/fs-safe/dist/archive-zip-integrity.d.ts +4 -0
  975. package/node_modules/@openclaw/fs-safe/dist/archive-zip-integrity.js +30 -0
  976. package/node_modules/@openclaw/fs-safe/dist/archive-zip-loader.d.ts +12 -0
  977. package/node_modules/@openclaw/fs-safe/dist/archive-zip-loader.js +152 -0
  978. package/node_modules/@openclaw/fs-safe/dist/archive-zip-manifest.d.ts +4 -0
  979. package/node_modules/@openclaw/fs-safe/dist/archive-zip-manifest.js +24 -0
  980. package/node_modules/@openclaw/fs-safe/dist/archive-zip-names.d.ts +17 -0
  981. package/node_modules/@openclaw/fs-safe/dist/archive-zip-names.js +149 -0
  982. package/node_modules/@openclaw/fs-safe/dist/archive-zip-preflight.d.ts +4 -0
  983. package/node_modules/@openclaw/fs-safe/dist/archive-zip-preflight.js +21 -0
  984. package/node_modules/@openclaw/fs-safe/dist/archive.d.ts +20 -0
  985. package/node_modules/@openclaw/fs-safe/dist/archive.js +329 -0
  986. package/node_modules/@openclaw/fs-safe/dist/async-lock.d.ts +1 -0
  987. package/node_modules/@openclaw/fs-safe/dist/async-lock.js +17 -0
  988. package/node_modules/@openclaw/fs-safe/dist/atomic-io.d.ts +52 -0
  989. package/node_modules/@openclaw/fs-safe/dist/atomic-io.js +248 -0
  990. package/node_modules/@openclaw/fs-safe/dist/atomic.d.ts +7 -0
  991. package/node_modules/@openclaw/fs-safe/dist/atomic.js +4 -0
  992. package/node_modules/@openclaw/fs-safe/dist/bounded-read-stream.d.ts +2 -0
  993. package/node_modules/@openclaw/fs-safe/dist/bounded-read-stream.js +15 -0
  994. package/node_modules/@openclaw/fs-safe/dist/bounded-read.d.ts +26 -0
  995. package/node_modules/@openclaw/fs-safe/dist/bounded-read.js +161 -0
  996. package/node_modules/@openclaw/fs-safe/dist/byte-budget.d.ts +3 -0
  997. package/node_modules/@openclaw/fs-safe/dist/byte-budget.js +9 -0
  998. package/node_modules/@openclaw/fs-safe/dist/byte-view.d.ts +2 -0
  999. package/node_modules/@openclaw/fs-safe/dist/byte-view.js +13 -0
  1000. package/node_modules/@openclaw/fs-safe/dist/clone-metadata.d.ts +21 -0
  1001. package/node_modules/@openclaw/fs-safe/dist/clone-metadata.js +37 -0
  1002. package/node_modules/@openclaw/fs-safe/dist/config.d.ts +8 -0
  1003. package/node_modules/@openclaw/fs-safe/dist/config.js +7 -0
  1004. package/node_modules/@openclaw/fs-safe/dist/containment.d.ts +1 -0
  1005. package/node_modules/@openclaw/fs-safe/dist/containment.js +1 -0
  1006. package/node_modules/@openclaw/fs-safe/dist/copy-file-input.d.ts +23 -0
  1007. package/node_modules/@openclaw/fs-safe/dist/copy-file-input.js +74 -0
  1008. package/node_modules/@openclaw/fs-safe/dist/copy-link.d.ts +26 -0
  1009. package/node_modules/@openclaw/fs-safe/dist/copy-link.js +170 -0
  1010. package/node_modules/@openclaw/fs-safe/dist/copy-metadata.d.ts +9 -0
  1011. package/node_modules/@openclaw/fs-safe/dist/copy-metadata.js +39 -0
  1012. package/node_modules/@openclaw/fs-safe/dist/copy-path-admission.d.ts +17 -0
  1013. package/node_modules/@openclaw/fs-safe/dist/copy-path-admission.js +126 -0
  1014. package/node_modules/@openclaw/fs-safe/dist/copy-policy.d.ts +2 -0
  1015. package/node_modules/@openclaw/fs-safe/dist/copy-policy.js +8 -0
  1016. package/node_modules/@openclaw/fs-safe/dist/copy-publication.d.ts +18 -0
  1017. package/node_modules/@openclaw/fs-safe/dist/copy-publication.js +29 -0
  1018. package/node_modules/@openclaw/fs-safe/dist/copy-root-file-sync.d.ts +36 -0
  1019. package/node_modules/@openclaw/fs-safe/dist/copy-root-file-sync.js +204 -0
  1020. package/node_modules/@openclaw/fs-safe/dist/copy-tree-portable.d.ts +8 -0
  1021. package/node_modules/@openclaw/fs-safe/dist/copy-tree-portable.js +244 -0
  1022. package/node_modules/@openclaw/fs-safe/dist/copy.d.ts +15 -0
  1023. package/node_modules/@openclaw/fs-safe/dist/copy.js +143 -0
  1024. package/node_modules/@openclaw/fs-safe/dist/create-owned-file.d.ts +7 -0
  1025. package/node_modules/@openclaw/fs-safe/dist/create-owned-file.js +16 -0
  1026. package/node_modules/@openclaw/fs-safe/dist/create.d.ts +18 -0
  1027. package/node_modules/@openclaw/fs-safe/dist/create.js +398 -0
  1028. package/node_modules/@openclaw/fs-safe/dist/creation-boundary.d.ts +60 -0
  1029. package/node_modules/@openclaw/fs-safe/dist/creation-boundary.js +374 -0
  1030. package/node_modules/@openclaw/fs-safe/dist/darwin-acl.d.ts +12 -0
  1031. package/node_modules/@openclaw/fs-safe/dist/darwin-acl.js +29 -0
  1032. package/node_modules/@openclaw/fs-safe/dist/deny-mutation-match.d.ts +2 -0
  1033. package/node_modules/@openclaw/fs-safe/dist/deny-mutation-match.js +71 -0
  1034. package/node_modules/@openclaw/fs-safe/dist/deny-mutations.d.ts +11 -0
  1035. package/node_modules/@openclaw/fs-safe/dist/deny-mutations.js +96 -0
  1036. package/node_modules/@openclaw/fs-safe/dist/device-path.d.ts +14 -0
  1037. package/node_modules/@openclaw/fs-safe/dist/device-path.js +139 -0
  1038. package/node_modules/@openclaw/fs-safe/dist/directory-durability.d.ts +46 -0
  1039. package/node_modules/@openclaw/fs-safe/dist/directory-durability.js +286 -0
  1040. package/node_modules/@openclaw/fs-safe/dist/directory-entry-path.d.ts +2 -0
  1041. package/node_modules/@openclaw/fs-safe/dist/directory-entry-path.js +21 -0
  1042. package/node_modules/@openclaw/fs-safe/dist/directory-guard.d.ts +65 -0
  1043. package/node_modules/@openclaw/fs-safe/dist/directory-guard.js +197 -0
  1044. package/node_modules/@openclaw/fs-safe/dist/directory-mode-node.d.ts +47 -0
  1045. package/node_modules/@openclaw/fs-safe/dist/directory-mode-node.js +323 -0
  1046. package/node_modules/@openclaw/fs-safe/dist/directory-mode-options.d.ts +3 -0
  1047. package/node_modules/@openclaw/fs-safe/dist/directory-mode-options.js +6 -0
  1048. package/node_modules/@openclaw/fs-safe/dist/directory-receipt.d.ts +23 -0
  1049. package/node_modules/@openclaw/fs-safe/dist/directory-receipt.js +126 -0
  1050. package/node_modules/@openclaw/fs-safe/dist/durability.d.ts +5 -0
  1051. package/node_modules/@openclaw/fs-safe/dist/durability.js +3 -0
  1052. package/node_modules/@openclaw/fs-safe/dist/effective-uid.d.ts +1 -0
  1053. package/node_modules/@openclaw/fs-safe/dist/effective-uid.js +22 -0
  1054. package/node_modules/@openclaw/fs-safe/dist/entry-publication-types.d.ts +55 -0
  1055. package/node_modules/@openclaw/fs-safe/dist/entry-publication-types.js +1 -0
  1056. package/node_modules/@openclaw/fs-safe/dist/entry-publication.d.ts +8 -0
  1057. package/node_modules/@openclaw/fs-safe/dist/entry-publication.js +264 -0
  1058. package/node_modules/@openclaw/fs-safe/dist/error-detail.d.ts +2 -0
  1059. package/node_modules/@openclaw/fs-safe/dist/error-detail.js +13 -0
  1060. package/node_modules/@openclaw/fs-safe/dist/errors.d.ts +17 -0
  1061. package/node_modules/@openclaw/fs-safe/dist/errors.js +33 -0
  1062. package/node_modules/@openclaw/fs-safe/dist/exact-identity.d.ts +17 -0
  1063. package/node_modules/@openclaw/fs-safe/dist/exact-identity.js +29 -0
  1064. package/node_modules/@openclaw/fs-safe/dist/exclusive-create.d.ts +3 -0
  1065. package/node_modules/@openclaw/fs-safe/dist/exclusive-create.js +22 -0
  1066. package/node_modules/@openclaw/fs-safe/dist/file-cleanup.d.ts +14 -0
  1067. package/node_modules/@openclaw/fs-safe/dist/file-cleanup.js +78 -0
  1068. package/node_modules/@openclaw/fs-safe/dist/file-contents.d.ts +5 -0
  1069. package/node_modules/@openclaw/fs-safe/dist/file-contents.js +40 -0
  1070. package/node_modules/@openclaw/fs-safe/dist/file-handle-transfer.d.ts +15 -0
  1071. package/node_modules/@openclaw/fs-safe/dist/file-handle-transfer.js +192 -0
  1072. package/node_modules/@openclaw/fs-safe/dist/file-hash.d.ts +16 -0
  1073. package/node_modules/@openclaw/fs-safe/dist/file-hash.js +298 -0
  1074. package/node_modules/@openclaw/fs-safe/dist/file-identity.d.ts +13 -0
  1075. package/node_modules/@openclaw/fs-safe/dist/file-identity.js +75 -0
  1076. package/node_modules/@openclaw/fs-safe/dist/file-lock-sync-acquisition.d.ts +22 -0
  1077. package/node_modules/@openclaw/fs-safe/dist/file-lock-sync-acquisition.js +98 -0
  1078. package/node_modules/@openclaw/fs-safe/dist/file-lock-sync-admission.d.ts +16 -0
  1079. package/node_modules/@openclaw/fs-safe/dist/file-lock-sync-admission.js +47 -0
  1080. package/node_modules/@openclaw/fs-safe/dist/file-lock-sync-root-acquire.d.ts +6 -0
  1081. package/node_modules/@openclaw/fs-safe/dist/file-lock-sync-root-acquire.js +349 -0
  1082. package/node_modules/@openclaw/fs-safe/dist/file-lock-sync-root-held.d.ts +25 -0
  1083. package/node_modules/@openclaw/fs-safe/dist/file-lock-sync-root-held.js +392 -0
  1084. package/node_modules/@openclaw/fs-safe/dist/file-lock-sync-root-io.d.ts +40 -0
  1085. package/node_modules/@openclaw/fs-safe/dist/file-lock-sync-root-io.js +209 -0
  1086. package/node_modules/@openclaw/fs-safe/dist/file-lock-sync-root-mutation.d.ts +16 -0
  1087. package/node_modules/@openclaw/fs-safe/dist/file-lock-sync-root-mutation.js +284 -0
  1088. package/node_modules/@openclaw/fs-safe/dist/file-lock-sync-root-options.d.ts +11 -0
  1089. package/node_modules/@openclaw/fs-safe/dist/file-lock-sync-root-options.js +58 -0
  1090. package/node_modules/@openclaw/fs-safe/dist/file-lock-sync-root-registration.d.ts +1 -0
  1091. package/node_modules/@openclaw/fs-safe/dist/file-lock-sync-root-registration.js +90 -0
  1092. package/node_modules/@openclaw/fs-safe/dist/file-lock-sync-root.d.ts +34 -0
  1093. package/node_modules/@openclaw/fs-safe/dist/file-lock-sync-root.js +286 -0
  1094. package/node_modules/@openclaw/fs-safe/dist/file-lock-sync-stale-admission.d.ts +19 -0
  1095. package/node_modules/@openclaw/fs-safe/dist/file-lock-sync-stale-admission.js +198 -0
  1096. package/node_modules/@openclaw/fs-safe/dist/file-lock-sync.d.ts +17 -0
  1097. package/node_modules/@openclaw/fs-safe/dist/file-lock-sync.js +356 -0
  1098. package/node_modules/@openclaw/fs-safe/dist/file-lock.d.ts +24 -0
  1099. package/node_modules/@openclaw/fs-safe/dist/file-lock.js +67 -0
  1100. package/node_modules/@openclaw/fs-safe/dist/file-observation.d.ts +8 -0
  1101. package/node_modules/@openclaw/fs-safe/dist/file-observation.js +22 -0
  1102. package/node_modules/@openclaw/fs-safe/dist/file-open-error.d.ts +2 -0
  1103. package/node_modules/@openclaw/fs-safe/dist/file-open-error.js +14 -0
  1104. package/node_modules/@openclaw/fs-safe/dist/file-store-boundary.d.ts +34 -0
  1105. package/node_modules/@openclaw/fs-safe/dist/file-store-boundary.js +202 -0
  1106. package/node_modules/@openclaw/fs-safe/dist/file-store-prune.d.ts +11 -0
  1107. package/node_modules/@openclaw/fs-safe/dist/file-store-prune.js +116 -0
  1108. package/node_modules/@openclaw/fs-safe/dist/file-store-sync-directory.d.ts +15 -0
  1109. package/node_modules/@openclaw/fs-safe/dist/file-store-sync-directory.js +345 -0
  1110. package/node_modules/@openclaw/fs-safe/dist/file-store-sync-write.d.ts +9 -0
  1111. package/node_modules/@openclaw/fs-safe/dist/file-store-sync-write.js +132 -0
  1112. package/node_modules/@openclaw/fs-safe/dist/file-store.d.ts +63 -0
  1113. package/node_modules/@openclaw/fs-safe/dist/file-store.js +359 -0
  1114. package/node_modules/@openclaw/fs-safe/dist/file-sync.d.ts +5 -0
  1115. package/node_modules/@openclaw/fs-safe/dist/file-sync.js +24 -0
  1116. package/node_modules/@openclaw/fs-safe/dist/file-write-lease.d.ts +9 -0
  1117. package/node_modules/@openclaw/fs-safe/dist/file-write-lease.js +42 -0
  1118. package/node_modules/@openclaw/fs-safe/dist/filename.d.ts +8 -0
  1119. package/node_modules/@openclaw/fs-safe/dist/filename.js +138 -0
  1120. package/node_modules/@openclaw/fs-safe/dist/fs.d.ts +4 -0
  1121. package/node_modules/@openclaw/fs-safe/dist/fs.js +22 -0
  1122. package/node_modules/@openclaw/fs-safe/dist/guarded-mkdir.d.ts +27 -0
  1123. package/node_modules/@openclaw/fs-safe/dist/guarded-mkdir.js +285 -0
  1124. package/node_modules/@openclaw/fs-safe/dist/guarded-mutation.d.ts +32 -0
  1125. package/node_modules/@openclaw/fs-safe/dist/guarded-mutation.js +81 -0
  1126. package/node_modules/@openclaw/fs-safe/dist/guest-dispatch-python.d.ts +1 -0
  1127. package/node_modules/@openclaw/fs-safe/dist/guest-dispatch-python.js +68 -0
  1128. package/node_modules/@openclaw/fs-safe/dist/guest-native-python.d.ts +3 -0
  1129. package/node_modules/@openclaw/fs-safe/dist/guest-native-python.js +178 -0
  1130. package/node_modules/@openclaw/fs-safe/dist/guest.d.ts +8 -0
  1131. package/node_modules/@openclaw/fs-safe/dist/guest.js +427 -0
  1132. package/node_modules/@openclaw/fs-safe/dist/hardlink-fallback.d.ts +1 -0
  1133. package/node_modules/@openclaw/fs-safe/dist/hardlink-fallback.js +5 -0
  1134. package/node_modules/@openclaw/fs-safe/dist/home-dir.d.ts +11 -0
  1135. package/node_modules/@openclaw/fs-safe/dist/home-dir.js +149 -0
  1136. package/node_modules/@openclaw/fs-safe/dist/index.d.ts +10 -0
  1137. package/node_modules/@openclaw/fs-safe/dist/index.js +6 -0
  1138. package/node_modules/@openclaw/fs-safe/dist/install-path.d.ts +25 -0
  1139. package/node_modules/@openclaw/fs-safe/dist/install-path.js +136 -0
  1140. package/node_modules/@openclaw/fs-safe/dist/json-document-store.d.ts +32 -0
  1141. package/node_modules/@openclaw/fs-safe/dist/json-document-store.js +105 -0
  1142. package/node_modules/@openclaw/fs-safe/dist/json-durable-queue-directory.d.ts +14 -0
  1143. package/node_modules/@openclaw/fs-safe/dist/json-durable-queue-directory.js +150 -0
  1144. package/node_modules/@openclaw/fs-safe/dist/json-durable-queue-ownership.d.ts +19 -0
  1145. package/node_modules/@openclaw/fs-safe/dist/json-durable-queue-ownership.js +368 -0
  1146. package/node_modules/@openclaw/fs-safe/dist/json-durable-queue-read.d.ts +5 -0
  1147. package/node_modules/@openclaw/fs-safe/dist/json-durable-queue-read.js +65 -0
  1148. package/node_modules/@openclaw/fs-safe/dist/json-durable-queue.d.ts +44 -0
  1149. package/node_modules/@openclaw/fs-safe/dist/json-durable-queue.js +210 -0
  1150. package/node_modules/@openclaw/fs-safe/dist/json-store.d.ts +9 -0
  1151. package/node_modules/@openclaw/fs-safe/dist/json-store.js +15 -0
  1152. package/node_modules/@openclaw/fs-safe/dist/json-stringify.d.ts +1 -0
  1153. package/node_modules/@openclaw/fs-safe/dist/json-stringify.js +7 -0
  1154. package/node_modules/@openclaw/fs-safe/dist/json.d.ts +49 -0
  1155. package/node_modules/@openclaw/fs-safe/dist/json.js +305 -0
  1156. package/node_modules/@openclaw/fs-safe/dist/local-file-access.d.ts +8 -0
  1157. package/node_modules/@openclaw/fs-safe/dist/local-file-access.js +81 -0
  1158. package/node_modules/@openclaw/fs-safe/dist/local-file-descriptor.d.ts +13 -0
  1159. package/node_modules/@openclaw/fs-safe/dist/local-file-descriptor.js +101 -0
  1160. package/node_modules/@openclaw/fs-safe/dist/local-roots.d.ts +20 -0
  1161. package/node_modules/@openclaw/fs-safe/dist/local-roots.js +160 -0
  1162. package/node_modules/@openclaw/fs-safe/dist/lock-config.d.ts +9 -0
  1163. package/node_modules/@openclaw/fs-safe/dist/lock-config.js +12 -0
  1164. package/node_modules/@openclaw/fs-safe/dist/move-path-cleanup.d.ts +30 -0
  1165. package/node_modules/@openclaw/fs-safe/dist/move-path-cleanup.js +224 -0
  1166. package/node_modules/@openclaw/fs-safe/dist/move-path-stage.d.ts +7 -0
  1167. package/node_modules/@openclaw/fs-safe/dist/move-path-stage.js +56 -0
  1168. package/node_modules/@openclaw/fs-safe/dist/move-path.d.ts +20 -0
  1169. package/node_modules/@openclaw/fs-safe/dist/move-path.js +392 -0
  1170. package/node_modules/@openclaw/fs-safe/dist/mutation-authority.d.ts +9 -0
  1171. package/node_modules/@openclaw/fs-safe/dist/mutation-authority.js +49 -0
  1172. package/node_modules/@openclaw/fs-safe/dist/native-binding.d.ts +323 -0
  1173. package/node_modules/@openclaw/fs-safe/dist/native-binding.js +8 -0
  1174. package/node_modules/@openclaw/fs-safe/dist/native-config.d.ts +13 -0
  1175. package/node_modules/@openclaw/fs-safe/dist/native-config.js +59 -0
  1176. package/node_modules/@openclaw/fs-safe/dist/native-directory-observation.d.ts +16 -0
  1177. package/node_modules/@openclaw/fs-safe/dist/native-directory-observation.js +39 -0
  1178. package/node_modules/@openclaw/fs-safe/dist/native-fallback-warning.d.ts +4 -0
  1179. package/node_modules/@openclaw/fs-safe/dist/native-fallback-warning.js +35 -0
  1180. package/node_modules/@openclaw/fs-safe/dist/native-guidance.d.ts +3 -0
  1181. package/node_modules/@openclaw/fs-safe/dist/native-guidance.js +21 -0
  1182. package/node_modules/@openclaw/fs-safe/dist/native-move-fallback.d.ts +3 -0
  1183. package/node_modules/@openclaw/fs-safe/dist/native-move-fallback.js +56 -0
  1184. package/node_modules/@openclaw/fs-safe/dist/native-noreplace.d.ts +8 -0
  1185. package/node_modules/@openclaw/fs-safe/dist/native-noreplace.js +55 -0
  1186. package/node_modules/@openclaw/fs-safe/dist/native-operations.d.ts +14 -0
  1187. package/node_modules/@openclaw/fs-safe/dist/native-operations.js +111 -0
  1188. package/node_modules/@openclaw/fs-safe/dist/native-parent-admission.d.ts +76 -0
  1189. package/node_modules/@openclaw/fs-safe/dist/native-parent-admission.js +220 -0
  1190. package/node_modules/@openclaw/fs-safe/dist/native-pinned-write-windows.d.ts +6 -0
  1191. package/node_modules/@openclaw/fs-safe/dist/native-pinned-write-windows.js +290 -0
  1192. package/node_modules/@openclaw/fs-safe/dist/native-pinned-write.d.ts +7 -0
  1193. package/node_modules/@openclaw/fs-safe/dist/native-pinned-write.js +202 -0
  1194. package/node_modules/@openclaw/fs-safe/dist/native-policy-directory-observation.d.ts +11 -0
  1195. package/node_modules/@openclaw/fs-safe/dist/native-policy-directory-observation.js +62 -0
  1196. package/node_modules/@openclaw/fs-safe/dist/native-policy-parent-windows.d.ts +13 -0
  1197. package/node_modules/@openclaw/fs-safe/dist/native-policy-parent-windows.js +62 -0
  1198. package/node_modules/@openclaw/fs-safe/dist/native-policy-parent.d.ts +15 -0
  1199. package/node_modules/@openclaw/fs-safe/dist/native-policy-parent.js +421 -0
  1200. package/node_modules/@openclaw/fs-safe/dist/native-rename-outcome.d.ts +3 -0
  1201. package/node_modules/@openclaw/fs-safe/dist/native-rename-outcome.js +15 -0
  1202. package/node_modules/@openclaw/fs-safe/dist/native-staged-file-metadata.d.ts +3 -0
  1203. package/node_modules/@openclaw/fs-safe/dist/native-staged-file-metadata.js +16 -0
  1204. package/node_modules/@openclaw/fs-safe/dist/native-staged-file.d.ts +45 -0
  1205. package/node_modules/@openclaw/fs-safe/dist/native-staged-file.js +516 -0
  1206. package/node_modules/@openclaw/fs-safe/dist/native-staged-symlink.d.ts +13 -0
  1207. package/node_modules/@openclaw/fs-safe/dist/native-staged-symlink.js +285 -0
  1208. package/node_modules/@openclaw/fs-safe/dist/native-stat-identity.d.ts +3 -0
  1209. package/node_modules/@openclaw/fs-safe/dist/native-stat-identity.js +7 -0
  1210. package/node_modules/@openclaw/fs-safe/dist/native-status.d.ts +17 -0
  1211. package/node_modules/@openclaw/fs-safe/dist/native-status.js +30 -0
  1212. package/node_modules/@openclaw/fs-safe/dist/native.d.ts +40 -0
  1213. package/node_modules/@openclaw/fs-safe/dist/native.js +311 -0
  1214. package/node_modules/@openclaw/fs-safe/dist/opened-file-failure.d.ts +7 -0
  1215. package/node_modules/@openclaw/fs-safe/dist/opened-file-failure.js +48 -0
  1216. package/node_modules/@openclaw/fs-safe/dist/opened-realpath.d.ts +15 -0
  1217. package/node_modules/@openclaw/fs-safe/dist/opened-realpath.js +110 -0
  1218. package/node_modules/@openclaw/fs-safe/dist/output.d.ts +16 -0
  1219. package/node_modules/@openclaw/fs-safe/dist/output.js +145 -0
  1220. package/node_modules/@openclaw/fs-safe/dist/overwrite-file-handle.d.ts +9 -0
  1221. package/node_modules/@openclaw/fs-safe/dist/overwrite-file-handle.js +71 -0
  1222. package/node_modules/@openclaw/fs-safe/dist/owner-dacl-batch-worker.d.ts +1 -0
  1223. package/node_modules/@openclaw/fs-safe/dist/owner-dacl-batch-worker.js +54 -0
  1224. package/node_modules/@openclaw/fs-safe/dist/owner-dacl-batch.d.ts +5 -0
  1225. package/node_modules/@openclaw/fs-safe/dist/owner-dacl-batch.js +64 -0
  1226. package/node_modules/@openclaw/fs-safe/dist/owner-dacl.d.ts +34 -0
  1227. package/node_modules/@openclaw/fs-safe/dist/owner-dacl.js +40 -0
  1228. package/node_modules/@openclaw/fs-safe/dist/path-case.d.ts +6 -0
  1229. package/node_modules/@openclaw/fs-safe/dist/path-case.js +137 -0
  1230. package/node_modules/@openclaw/fs-safe/dist/path-policy.d.ts +24 -0
  1231. package/node_modules/@openclaw/fs-safe/dist/path-policy.js +49 -0
  1232. package/node_modules/@openclaw/fs-safe/dist/path-prefix.d.ts +7 -0
  1233. package/node_modules/@openclaw/fs-safe/dist/path-prefix.js +181 -0
  1234. package/node_modules/@openclaw/fs-safe/dist/path-scope-lexical.d.ts +13 -0
  1235. package/node_modules/@openclaw/fs-safe/dist/path-scope-lexical.js +40 -0
  1236. package/node_modules/@openclaw/fs-safe/dist/path-segment-route.d.ts +7 -0
  1237. package/node_modules/@openclaw/fs-safe/dist/path-segment-route.js +27 -0
  1238. package/node_modules/@openclaw/fs-safe/dist/path-suffix-aliases.d.ts +11 -0
  1239. package/node_modules/@openclaw/fs-safe/dist/path-suffix-aliases.js +394 -0
  1240. package/node_modules/@openclaw/fs-safe/dist/path.d.ts +20 -0
  1241. package/node_modules/@openclaw/fs-safe/dist/path.js +192 -0
  1242. package/node_modules/@openclaw/fs-safe/dist/permission-exec.d.ts +32 -0
  1243. package/node_modules/@openclaw/fs-safe/dist/permission-exec.js +203 -0
  1244. package/node_modules/@openclaw/fs-safe/dist/permissions-public.d.ts +6 -0
  1245. package/node_modules/@openclaw/fs-safe/dist/permissions-public.js +5 -0
  1246. package/node_modules/@openclaw/fs-safe/dist/permissions-windows.d.ts +47 -0
  1247. package/node_modules/@openclaw/fs-safe/dist/permissions-windows.js +380 -0
  1248. package/node_modules/@openclaw/fs-safe/dist/permissions.d.ts +52 -0
  1249. package/node_modules/@openclaw/fs-safe/dist/permissions.js +131 -0
  1250. package/node_modules/@openclaw/fs-safe/dist/pinned-mutation-admission.d.ts +23 -0
  1251. package/node_modules/@openclaw/fs-safe/dist/pinned-mutation-admission.js +419 -0
  1252. package/node_modules/@openclaw/fs-safe/dist/pinned-mutation-observation.d.ts +38 -0
  1253. package/node_modules/@openclaw/fs-safe/dist/pinned-mutation-observation.js +205 -0
  1254. package/node_modules/@openclaw/fs-safe/dist/pinned-mutation-shared-route.d.ts +18 -0
  1255. package/node_modules/@openclaw/fs-safe/dist/pinned-mutation-shared-route.js +70 -0
  1256. package/node_modules/@openclaw/fs-safe/dist/pinned-open.d.ts +37 -0
  1257. package/node_modules/@openclaw/fs-safe/dist/pinned-open.js +118 -0
  1258. package/node_modules/@openclaw/fs-safe/dist/pinned-operation.d.ts +1 -0
  1259. package/node_modules/@openclaw/fs-safe/dist/pinned-operation.js +22 -0
  1260. package/node_modules/@openclaw/fs-safe/dist/pinned-write-input.d.ts +5 -0
  1261. package/node_modules/@openclaw/fs-safe/dist/pinned-write-input.js +54 -0
  1262. package/node_modules/@openclaw/fs-safe/dist/pinned-write-mode.d.ts +4 -0
  1263. package/node_modules/@openclaw/fs-safe/dist/pinned-write-mode.js +31 -0
  1264. package/node_modules/@openclaw/fs-safe/dist/pinned-write-staged.d.ts +5 -0
  1265. package/node_modules/@openclaw/fs-safe/dist/pinned-write-staged.js +212 -0
  1266. package/node_modules/@openclaw/fs-safe/dist/pinned-write-types.d.ts +74 -0
  1267. package/node_modules/@openclaw/fs-safe/dist/pinned-write-types.js +1 -0
  1268. package/node_modules/@openclaw/fs-safe/dist/pinned-write.d.ts +12 -0
  1269. package/node_modules/@openclaw/fs-safe/dist/pinned-write.js +301 -0
  1270. package/node_modules/@openclaw/fs-safe/dist/pipe.d.ts +9 -0
  1271. package/node_modules/@openclaw/fs-safe/dist/pipe.js +26 -0
  1272. package/node_modules/@openclaw/fs-safe/dist/positional-read.d.ts +8 -0
  1273. package/node_modules/@openclaw/fs-safe/dist/positional-read.js +36 -0
  1274. package/node_modules/@openclaw/fs-safe/dist/prepare-directory-mode.d.ts +9 -0
  1275. package/node_modules/@openclaw/fs-safe/dist/prepare-directory-mode.js +61 -0
  1276. package/node_modules/@openclaw/fs-safe/dist/private-directory.d.ts +4 -0
  1277. package/node_modules/@openclaw/fs-safe/dist/private-directory.js +30 -0
  1278. package/node_modules/@openclaw/fs-safe/dist/private-producer-handoff-sync.d.ts +3 -0
  1279. package/node_modules/@openclaw/fs-safe/dist/private-producer-handoff-sync.js +72 -0
  1280. package/node_modules/@openclaw/fs-safe/dist/private-producer-handoff.d.ts +53 -0
  1281. package/node_modules/@openclaw/fs-safe/dist/private-producer-handoff.js +352 -0
  1282. package/node_modules/@openclaw/fs-safe/dist/private-temp-workspace.d.ts +8 -0
  1283. package/node_modules/@openclaw/fs-safe/dist/private-temp-workspace.js +370 -0
  1284. package/node_modules/@openclaw/fs-safe/dist/publication-handle.d.ts +4 -0
  1285. package/node_modules/@openclaw/fs-safe/dist/publication-handle.js +32 -0
  1286. package/node_modules/@openclaw/fs-safe/dist/publish-copy-stage.d.ts +14 -0
  1287. package/node_modules/@openclaw/fs-safe/dist/publish-copy-stage.js +152 -0
  1288. package/node_modules/@openclaw/fs-safe/dist/publish-file-failure.d.ts +35 -0
  1289. package/node_modules/@openclaw/fs-safe/dist/publish-file-failure.js +26 -0
  1290. package/node_modules/@openclaw/fs-safe/dist/publish-file.d.ts +23 -0
  1291. package/node_modules/@openclaw/fs-safe/dist/publish-file.js +371 -0
  1292. package/node_modules/@openclaw/fs-safe/dist/publish-rename-fallback.d.ts +21 -0
  1293. package/node_modules/@openclaw/fs-safe/dist/publish-rename-fallback.js +102 -0
  1294. package/node_modules/@openclaw/fs-safe/dist/read-open-flags.d.ts +7 -0
  1295. package/node_modules/@openclaw/fs-safe/dist/read-open-flags.js +13 -0
  1296. package/node_modules/@openclaw/fs-safe/dist/read-opened-file.d.ts +19 -0
  1297. package/node_modules/@openclaw/fs-safe/dist/read-opened-file.js +17 -0
  1298. package/node_modules/@openclaw/fs-safe/dist/realpath.d.ts +5 -0
  1299. package/node_modules/@openclaw/fs-safe/dist/realpath.js +102 -0
  1300. package/node_modules/@openclaw/fs-safe/dist/recursive-mkdir-path.d.ts +2 -0
  1301. package/node_modules/@openclaw/fs-safe/dist/recursive-mkdir-path.js +8 -0
  1302. package/node_modules/@openclaw/fs-safe/dist/regular-file.d.ts +41 -0
  1303. package/node_modules/@openclaw/fs-safe/dist/regular-file.js +313 -0
  1304. package/node_modules/@openclaw/fs-safe/dist/replace-directory.d.ts +6 -0
  1305. package/node_modules/@openclaw/fs-safe/dist/replace-directory.js +276 -0
  1306. package/node_modules/@openclaw/fs-safe/dist/replace-file-buffer.d.ts +3 -0
  1307. package/node_modules/@openclaw/fs-safe/dist/replace-file-buffer.js +22 -0
  1308. package/node_modules/@openclaw/fs-safe/dist/replace-file-copy-fallback.d.ts +20 -0
  1309. package/node_modules/@openclaw/fs-safe/dist/replace-file-copy-fallback.js +228 -0
  1310. package/node_modules/@openclaw/fs-safe/dist/replace-file-copy-source.d.ts +9 -0
  1311. package/node_modules/@openclaw/fs-safe/dist/replace-file-copy-source.js +60 -0
  1312. package/node_modules/@openclaw/fs-safe/dist/replace-file-descriptor.d.ts +22 -0
  1313. package/node_modules/@openclaw/fs-safe/dist/replace-file-descriptor.js +172 -0
  1314. package/node_modules/@openclaw/fs-safe/dist/replace-file-destination.d.ts +19 -0
  1315. package/node_modules/@openclaw/fs-safe/dist/replace-file-destination.js +89 -0
  1316. package/node_modules/@openclaw/fs-safe/dist/replace-file-mode.d.ts +2 -0
  1317. package/node_modules/@openclaw/fs-safe/dist/replace-file-mode.js +10 -0
  1318. package/node_modules/@openclaw/fs-safe/dist/replace-file-mutation.d.ts +26 -0
  1319. package/node_modules/@openclaw/fs-safe/dist/replace-file-mutation.js +47 -0
  1320. package/node_modules/@openclaw/fs-safe/dist/replace-file-rename-policy.d.ts +5 -0
  1321. package/node_modules/@openclaw/fs-safe/dist/replace-file-rename-policy.js +30 -0
  1322. package/node_modules/@openclaw/fs-safe/dist/replace-file-temp-owner.d.ts +32 -0
  1323. package/node_modules/@openclaw/fs-safe/dist/replace-file-temp-owner.js +229 -0
  1324. package/node_modules/@openclaw/fs-safe/dist/replace-file-types.d.ts +51 -0
  1325. package/node_modules/@openclaw/fs-safe/dist/replace-file-types.js +1 -0
  1326. package/node_modules/@openclaw/fs-safe/dist/replace-file.d.ts +6 -0
  1327. package/node_modules/@openclaw/fs-safe/dist/replace-file.js +223 -0
  1328. package/node_modules/@openclaw/fs-safe/dist/retained-directory-replacement.d.ts +26 -0
  1329. package/node_modules/@openclaw/fs-safe/dist/retained-directory-replacement.js +193 -0
  1330. package/node_modules/@openclaw/fs-safe/dist/retained-file-types.d.ts +50 -0
  1331. package/node_modules/@openclaw/fs-safe/dist/retained-file-types.js +1 -0
  1332. package/node_modules/@openclaw/fs-safe/dist/retained-file.d.ts +3 -0
  1333. package/node_modules/@openclaw/fs-safe/dist/retained-file.js +121 -0
  1334. package/node_modules/@openclaw/fs-safe/dist/root-boundary.d.ts +29 -0
  1335. package/node_modules/@openclaw/fs-safe/dist/root-boundary.js +176 -0
  1336. package/node_modules/@openclaw/fs-safe/dist/root-context.d.ts +40 -0
  1337. package/node_modules/@openclaw/fs-safe/dist/root-context.js +237 -0
  1338. package/node_modules/@openclaw/fs-safe/dist/root-copy.d.ts +18 -0
  1339. package/node_modules/@openclaw/fs-safe/dist/root-copy.js +128 -0
  1340. package/node_modules/@openclaw/fs-safe/dist/root-create-input.d.ts +30 -0
  1341. package/node_modules/@openclaw/fs-safe/dist/root-create-input.js +97 -0
  1342. package/node_modules/@openclaw/fs-safe/dist/root-create-native.d.ts +47 -0
  1343. package/node_modules/@openclaw/fs-safe/dist/root-create-native.js +586 -0
  1344. package/node_modules/@openclaw/fs-safe/dist/root-directory-creation.d.ts +12 -0
  1345. package/node_modules/@openclaw/fs-safe/dist/root-directory-creation.js +229 -0
  1346. package/node_modules/@openclaw/fs-safe/dist/root-directory-entry.d.ts +11 -0
  1347. package/node_modules/@openclaw/fs-safe/dist/root-directory-entry.js +31 -0
  1348. package/node_modules/@openclaw/fs-safe/dist/root-directory-list-types.d.ts +41 -0
  1349. package/node_modules/@openclaw/fs-safe/dist/root-directory-list-types.js +1 -0
  1350. package/node_modules/@openclaw/fs-safe/dist/root-directory-list.d.ts +21 -0
  1351. package/node_modules/@openclaw/fs-safe/dist/root-directory-list.js +462 -0
  1352. package/node_modules/@openclaw/fs-safe/dist/root-directory.d.ts +22 -0
  1353. package/node_modules/@openclaw/fs-safe/dist/root-directory.js +138 -0
  1354. package/node_modules/@openclaw/fs-safe/dist/root-entries.d.ts +10 -0
  1355. package/node_modules/@openclaw/fs-safe/dist/root-entries.js +61 -0
  1356. package/node_modules/@openclaw/fs-safe/dist/root-errors.d.ts +18 -0
  1357. package/node_modules/@openclaw/fs-safe/dist/root-errors.js +156 -0
  1358. package/node_modules/@openclaw/fs-safe/dist/root-file-final-admission.d.ts +24 -0
  1359. package/node_modules/@openclaw/fs-safe/dist/root-file-final-admission.js +98 -0
  1360. package/node_modules/@openclaw/fs-safe/dist/root-file-open-batch-sync.d.ts +8 -0
  1361. package/node_modules/@openclaw/fs-safe/dist/root-file-open-batch-sync.js +108 -0
  1362. package/node_modules/@openclaw/fs-safe/dist/root-file.d.ts +53 -0
  1363. package/node_modules/@openclaw/fs-safe/dist/root-file.js +216 -0
  1364. package/node_modules/@openclaw/fs-safe/dist/root-handle-context.d.ts +4 -0
  1365. package/node_modules/@openclaw/fs-safe/dist/root-handle-context.js +12 -0
  1366. package/node_modules/@openclaw/fs-safe/dist/root-impl.d.ts +119 -0
  1367. package/node_modules/@openclaw/fs-safe/dist/root-impl.js +1496 -0
  1368. package/node_modules/@openclaw/fs-safe/dist/root-mkdir-native.d.ts +2 -0
  1369. package/node_modules/@openclaw/fs-safe/dist/root-mkdir-native.js +258 -0
  1370. package/node_modules/@openclaw/fs-safe/dist/root-move-noreplace.d.ts +17 -0
  1371. package/node_modules/@openclaw/fs-safe/dist/root-move-noreplace.js +252 -0
  1372. package/node_modules/@openclaw/fs-safe/dist/root-native-creation-path.d.ts +32 -0
  1373. package/node_modules/@openclaw/fs-safe/dist/root-native-creation-path.js +56 -0
  1374. package/node_modules/@openclaw/fs-safe/dist/root-observed-path.d.ts +7 -0
  1375. package/node_modules/@openclaw/fs-safe/dist/root-observed-path.js +88 -0
  1376. package/node_modules/@openclaw/fs-safe/dist/root-options.d.ts +85 -0
  1377. package/node_modules/@openclaw/fs-safe/dist/root-options.js +18 -0
  1378. package/node_modules/@openclaw/fs-safe/dist/root-path-errors.d.ts +12 -0
  1379. package/node_modules/@openclaw/fs-safe/dist/root-path-errors.js +22 -0
  1380. package/node_modules/@openclaw/fs-safe/dist/root-path-existing.d.ts +16 -0
  1381. package/node_modules/@openclaw/fs-safe/dist/root-path-existing.js +188 -0
  1382. package/node_modules/@openclaw/fs-safe/dist/root-path-observation.d.ts +55 -0
  1383. package/node_modules/@openclaw/fs-safe/dist/root-path-observation.js +180 -0
  1384. package/node_modules/@openclaw/fs-safe/dist/root-path-stat.d.ts +4 -0
  1385. package/node_modules/@openclaw/fs-safe/dist/root-path-stat.js +134 -0
  1386. package/node_modules/@openclaw/fs-safe/dist/root-path.d.ts +53 -0
  1387. package/node_modules/@openclaw/fs-safe/dist/root-path.js +452 -0
  1388. package/node_modules/@openclaw/fs-safe/dist/root-paths-lexical.d.ts +12 -0
  1389. package/node_modules/@openclaw/fs-safe/dist/root-paths-lexical.js +22 -0
  1390. package/node_modules/@openclaw/fs-safe/dist/root-paths.d.ts +58 -0
  1391. package/node_modules/@openclaw/fs-safe/dist/root-paths.js +291 -0
  1392. package/node_modules/@openclaw/fs-safe/dist/root-public-types.d.ts +12 -0
  1393. package/node_modules/@openclaw/fs-safe/dist/root-public-types.js +1 -0
  1394. package/node_modules/@openclaw/fs-safe/dist/root-read-admission.d.ts +25 -0
  1395. package/node_modules/@openclaw/fs-safe/dist/root-read-admission.js +108 -0
  1396. package/node_modules/@openclaw/fs-safe/dist/root-remove-identity.d.ts +12 -0
  1397. package/node_modules/@openclaw/fs-safe/dist/root-remove-identity.js +87 -0
  1398. package/node_modules/@openclaw/fs-safe/dist/root-remove-native.d.ts +4 -0
  1399. package/node_modules/@openclaw/fs-safe/dist/root-remove-native.js +390 -0
  1400. package/node_modules/@openclaw/fs-safe/dist/root-remove-receipt.d.ts +16 -0
  1401. package/node_modules/@openclaw/fs-safe/dist/root-remove-receipt.js +37 -0
  1402. package/node_modules/@openclaw/fs-safe/dist/root-remove.d.ts +17 -0
  1403. package/node_modules/@openclaw/fs-safe/dist/root-remove.js +468 -0
  1404. package/node_modules/@openclaw/fs-safe/dist/root-symlink-policy.d.ts +13 -0
  1405. package/node_modules/@openclaw/fs-safe/dist/root-symlink-policy.js +34 -0
  1406. package/node_modules/@openclaw/fs-safe/dist/root-walk.d.ts +48 -0
  1407. package/node_modules/@openclaw/fs-safe/dist/root-walk.js +236 -0
  1408. package/node_modules/@openclaw/fs-safe/dist/root-write-admission.d.ts +65 -0
  1409. package/node_modules/@openclaw/fs-safe/dist/root-write-admission.js +302 -0
  1410. package/node_modules/@openclaw/fs-safe/dist/root-write-compatibility.d.ts +11 -0
  1411. package/node_modules/@openclaw/fs-safe/dist/root-write-compatibility.js +23 -0
  1412. package/node_modules/@openclaw/fs-safe/dist/root-write-complete-parent.d.ts +43 -0
  1413. package/node_modules/@openclaw/fs-safe/dist/root-write-complete-parent.js +180 -0
  1414. package/node_modules/@openclaw/fs-safe/dist/root-write-lock-binding.d.ts +14 -0
  1415. package/node_modules/@openclaw/fs-safe/dist/root-write-lock-binding.js +162 -0
  1416. package/node_modules/@openclaw/fs-safe/dist/root-write-mode.d.ts +7 -0
  1417. package/node_modules/@openclaw/fs-safe/dist/root-write-mode.js +72 -0
  1418. package/node_modules/@openclaw/fs-safe/dist/root-write-publication.d.ts +23 -0
  1419. package/node_modules/@openclaw/fs-safe/dist/root-write-publication.js +89 -0
  1420. package/node_modules/@openclaw/fs-safe/dist/root-write-verification.d.ts +20 -0
  1421. package/node_modules/@openclaw/fs-safe/dist/root-write-verification.js +115 -0
  1422. package/node_modules/@openclaw/fs-safe/dist/root.d.ts +2 -0
  1423. package/node_modules/@openclaw/fs-safe/dist/root.js +1 -0
  1424. package/node_modules/@openclaw/fs-safe/dist/safe-path-segment.d.ts +11 -0
  1425. package/node_modules/@openclaw/fs-safe/dist/safe-path-segment.js +76 -0
  1426. package/node_modules/@openclaw/fs-safe/dist/secret-file.d.ts +30 -0
  1427. package/node_modules/@openclaw/fs-safe/dist/secret-file.js +338 -0
  1428. package/node_modules/@openclaw/fs-safe/dist/secret-read-async.d.ts +3 -0
  1429. package/node_modules/@openclaw/fs-safe/dist/secret-read-async.js +58 -0
  1430. package/node_modules/@openclaw/fs-safe/dist/secret-read-policy.d.ts +20 -0
  1431. package/node_modules/@openclaw/fs-safe/dist/secret-read-policy.js +68 -0
  1432. package/node_modules/@openclaw/fs-safe/dist/secret.d.ts +3 -0
  1433. package/node_modules/@openclaw/fs-safe/dist/secret.js +3 -0
  1434. package/node_modules/@openclaw/fs-safe/dist/secure-file-windows.d.ts +10 -0
  1435. package/node_modules/@openclaw/fs-safe/dist/secure-file-windows.js +81 -0
  1436. package/node_modules/@openclaw/fs-safe/dist/secure-file.d.ts +33 -0
  1437. package/node_modules/@openclaw/fs-safe/dist/secure-file.js +304 -0
  1438. package/node_modules/@openclaw/fs-safe/dist/secure-temp-dir.d.ts +27 -0
  1439. package/node_modules/@openclaw/fs-safe/dist/secure-temp-dir.js +188 -0
  1440. package/node_modules/@openclaw/fs-safe/dist/secure-temp-repair.d.ts +34 -0
  1441. package/node_modules/@openclaw/fs-safe/dist/secure-temp-repair.js +110 -0
  1442. package/node_modules/@openclaw/fs-safe/dist/sibling-staged-file.d.ts +20 -0
  1443. package/node_modules/@openclaw/fs-safe/dist/sibling-staged-file.js +333 -0
  1444. package/node_modules/@openclaw/fs-safe/dist/sibling-temp.d.ts +29 -0
  1445. package/node_modules/@openclaw/fs-safe/dist/sibling-temp.js +136 -0
  1446. package/node_modules/@openclaw/fs-safe/dist/sidecar-lock-acquire.d.ts +4 -0
  1447. package/node_modules/@openclaw/fs-safe/dist/sidecar-lock-acquire.js +471 -0
  1448. package/node_modules/@openclaw/fs-safe/dist/sidecar-lock-admission-context.d.ts +18 -0
  1449. package/node_modules/@openclaw/fs-safe/dist/sidecar-lock-admission-context.js +60 -0
  1450. package/node_modules/@openclaw/fs-safe/dist/sidecar-lock-admission-parser.d.ts +41 -0
  1451. package/node_modules/@openclaw/fs-safe/dist/sidecar-lock-admission-parser.js +113 -0
  1452. package/node_modules/@openclaw/fs-safe/dist/sidecar-lock-admission.d.ts +33 -0
  1453. package/node_modules/@openclaw/fs-safe/dist/sidecar-lock-admission.js +1 -0
  1454. package/node_modules/@openclaw/fs-safe/dist/sidecar-lock-handle.d.ts +20 -0
  1455. package/node_modules/@openclaw/fs-safe/dist/sidecar-lock-handle.js +48 -0
  1456. package/node_modules/@openclaw/fs-safe/dist/sidecar-lock-policy.d.ts +15 -0
  1457. package/node_modules/@openclaw/fs-safe/dist/sidecar-lock-policy.js +112 -0
  1458. package/node_modules/@openclaw/fs-safe/dist/sidecar-lock-reclaim.d.ts +64 -0
  1459. package/node_modules/@openclaw/fs-safe/dist/sidecar-lock-reclaim.js +356 -0
  1460. package/node_modules/@openclaw/fs-safe/dist/sidecar-lock-registration.d.ts +13 -0
  1461. package/node_modules/@openclaw/fs-safe/dist/sidecar-lock-registration.js +47 -0
  1462. package/node_modules/@openclaw/fs-safe/dist/sidecar-lock-retained.d.ts +14 -0
  1463. package/node_modules/@openclaw/fs-safe/dist/sidecar-lock-retained.js +187 -0
  1464. package/node_modules/@openclaw/fs-safe/dist/sidecar-lock-root.d.ts +2 -0
  1465. package/node_modules/@openclaw/fs-safe/dist/sidecar-lock-root.js +79 -0
  1466. package/node_modules/@openclaw/fs-safe/dist/sidecar-lock-stale-admission.d.ts +34 -0
  1467. package/node_modules/@openclaw/fs-safe/dist/sidecar-lock-stale-admission.js +230 -0
  1468. package/node_modules/@openclaw/fs-safe/dist/sidecar-lock-target.d.ts +7 -0
  1469. package/node_modules/@openclaw/fs-safe/dist/sidecar-lock-target.js +62 -0
  1470. package/node_modules/@openclaw/fs-safe/dist/sidecar-lock-types.d.ts +68 -0
  1471. package/node_modules/@openclaw/fs-safe/dist/sidecar-lock-types.js +1 -0
  1472. package/node_modules/@openclaw/fs-safe/dist/sidecar-lock.d.ts +13 -0
  1473. package/node_modules/@openclaw/fs-safe/dist/sidecar-lock.js +296 -0
  1474. package/node_modules/@openclaw/fs-safe/dist/staged-directory.d.ts +40 -0
  1475. package/node_modules/@openclaw/fs-safe/dist/staged-directory.js +177 -0
  1476. package/node_modules/@openclaw/fs-safe/dist/staged-file-settlement.d.ts +17 -0
  1477. package/node_modules/@openclaw/fs-safe/dist/staged-file-settlement.js +65 -0
  1478. package/node_modules/@openclaw/fs-safe/dist/staged-file-types.d.ts +55 -0
  1479. package/node_modules/@openclaw/fs-safe/dist/staged-file-types.js +1 -0
  1480. package/node_modules/@openclaw/fs-safe/dist/staged-symlink-types.d.ts +39 -0
  1481. package/node_modules/@openclaw/fs-safe/dist/staged-symlink-types.js +1 -0
  1482. package/node_modules/@openclaw/fs-safe/dist/stat-observation.d.ts +10 -0
  1483. package/node_modules/@openclaw/fs-safe/dist/stat-observation.js +57 -0
  1484. package/node_modules/@openclaw/fs-safe/dist/store.d.ts +3 -0
  1485. package/node_modules/@openclaw/fs-safe/dist/store.js +3 -0
  1486. package/node_modules/@openclaw/fs-safe/dist/strict-file-identity.d.ts +7 -0
  1487. package/node_modules/@openclaw/fs-safe/dist/strict-file-identity.js +88 -0
  1488. package/node_modules/@openclaw/fs-safe/dist/string-coerce.d.ts +4 -0
  1489. package/node_modules/@openclaw/fs-safe/dist/string-coerce.js +16 -0
  1490. package/node_modules/@openclaw/fs-safe/dist/suppressed-error.d.ts +5 -0
  1491. package/node_modules/@openclaw/fs-safe/dist/suppressed-error.js +15 -0
  1492. package/node_modules/@openclaw/fs-safe/dist/symlink-parents.d.ts +11 -0
  1493. package/node_modules/@openclaw/fs-safe/dist/symlink-parents.js +109 -0
  1494. package/node_modules/@openclaw/fs-safe/dist/temp-cleanup.d.ts +13 -0
  1495. package/node_modules/@openclaw/fs-safe/dist/temp-cleanup.js +81 -0
  1496. package/node_modules/@openclaw/fs-safe/dist/temp-directory-diagnostics.d.ts +10 -0
  1497. package/node_modules/@openclaw/fs-safe/dist/temp-directory-diagnostics.js +29 -0
  1498. package/node_modules/@openclaw/fs-safe/dist/temp-target.d.ts +31 -0
  1499. package/node_modules/@openclaw/fs-safe/dist/temp-target.js +251 -0
  1500. package/node_modules/@openclaw/fs-safe/dist/temp-workspace-admission.d.ts +14 -0
  1501. package/node_modules/@openclaw/fs-safe/dist/temp-workspace-admission.js +387 -0
  1502. package/node_modules/@openclaw/fs-safe/dist/temp-workspace-child-admission.d.ts +23 -0
  1503. package/node_modules/@openclaw/fs-safe/dist/temp-workspace-child-admission.js +146 -0
  1504. package/node_modules/@openclaw/fs-safe/dist/temp-workspace-descriptor.d.ts +50 -0
  1505. package/node_modules/@openclaw/fs-safe/dist/temp-workspace-descriptor.js +344 -0
  1506. package/node_modules/@openclaw/fs-safe/dist/temp-workspace-owner.d.ts +25 -0
  1507. package/node_modules/@openclaw/fs-safe/dist/temp-workspace-owner.js +489 -0
  1508. package/node_modules/@openclaw/fs-safe/dist/temp-workspace-ownership.d.ts +9 -0
  1509. package/node_modules/@openclaw/fs-safe/dist/temp-workspace-ownership.js +74 -0
  1510. package/node_modules/@openclaw/fs-safe/dist/temp-workspace-types.d.ts +43 -0
  1511. package/node_modules/@openclaw/fs-safe/dist/temp-workspace-types.js +1 -0
  1512. package/node_modules/@openclaw/fs-safe/dist/temp.d.ts +3 -0
  1513. package/node_modules/@openclaw/fs-safe/dist/temp.js +2 -0
  1514. package/node_modules/@openclaw/fs-safe/dist/test-hooks.d.ts +36 -0
  1515. package/node_modules/@openclaw/fs-safe/dist/test-hooks.js +14 -0
  1516. package/node_modules/@openclaw/fs-safe/dist/text-atomic.d.ts +10 -0
  1517. package/node_modules/@openclaw/fs-safe/dist/text-atomic.js +18 -0
  1518. package/node_modules/@openclaw/fs-safe/dist/timing.d.ts +8 -0
  1519. package/node_modules/@openclaw/fs-safe/dist/timing.js +59 -0
  1520. package/node_modules/@openclaw/fs-safe/dist/trash.d.ts +4 -0
  1521. package/node_modules/@openclaw/fs-safe/dist/trash.js +249 -0
  1522. package/node_modules/@openclaw/fs-safe/dist/types.d.ts +27 -0
  1523. package/node_modules/@openclaw/fs-safe/dist/types.js +1 -0
  1524. package/node_modules/@openclaw/fs-safe/dist/unicode-path.d.ts +2 -0
  1525. package/node_modules/@openclaw/fs-safe/dist/unicode-path.js +16 -0
  1526. package/node_modules/@openclaw/fs-safe/dist/walk.d.ts +37 -0
  1527. package/node_modules/@openclaw/fs-safe/dist/walk.js +250 -0
  1528. package/node_modules/@openclaw/fs-safe/dist/watch-hints.d.ts +16 -0
  1529. package/node_modules/@openclaw/fs-safe/dist/watch-hints.js +365 -0
  1530. package/node_modules/@openclaw/fs-safe/dist/watch-io-error.d.ts +2 -0
  1531. package/node_modules/@openclaw/fs-safe/dist/watch-io-error.js +27 -0
  1532. package/node_modules/@openclaw/fs-safe/dist/watch-io-worker.d.ts +1 -0
  1533. package/node_modules/@openclaw/fs-safe/dist/watch-io-worker.js +93 -0
  1534. package/node_modules/@openclaw/fs-safe/dist/watch-io.d.ts +47 -0
  1535. package/node_modules/@openclaw/fs-safe/dist/watch-io.js +236 -0
  1536. package/node_modules/@openclaw/fs-safe/dist/watch-native.d.ts +55 -0
  1537. package/node_modules/@openclaw/fs-safe/dist/watch-native.js +93 -0
  1538. package/node_modules/@openclaw/fs-safe/dist/watch-probe.d.ts +16 -0
  1539. package/node_modules/@openclaw/fs-safe/dist/watch-probe.js +135 -0
  1540. package/node_modules/@openclaw/fs-safe/dist/watch-rescan.d.ts +6 -0
  1541. package/node_modules/@openclaw/fs-safe/dist/watch-rescan.js +167 -0
  1542. package/node_modules/@openclaw/fs-safe/dist/watch-scan.d.ts +45 -0
  1543. package/node_modules/@openclaw/fs-safe/dist/watch-scan.js +385 -0
  1544. package/node_modules/@openclaw/fs-safe/dist/watch-stream.d.ts +10 -0
  1545. package/node_modules/@openclaw/fs-safe/dist/watch-stream.js +57 -0
  1546. package/node_modules/@openclaw/fs-safe/dist/watch-types.d.ts +62 -0
  1547. package/node_modules/@openclaw/fs-safe/dist/watch-types.js +1 -0
  1548. package/node_modules/@openclaw/fs-safe/dist/watch.d.ts +5 -0
  1549. package/node_modules/@openclaw/fs-safe/dist/watch.js +667 -0
  1550. package/node_modules/@openclaw/fs-safe/dist/windows-appcontainer.d.ts +5 -0
  1551. package/node_modules/@openclaw/fs-safe/dist/windows-appcontainer.js +39 -0
  1552. package/node_modules/@openclaw/fs-safe/dist/windows-command.d.ts +1 -0
  1553. package/node_modules/@openclaw/fs-safe/dist/windows-command.js +34 -0
  1554. package/node_modules/@openclaw/fs-safe/dist/windows-owner.d.ts +26 -0
  1555. package/node_modules/@openclaw/fs-safe/dist/windows-owner.js +90 -0
  1556. package/node_modules/@openclaw/fs-safe/dist/windows-path-alias.d.ts +47 -0
  1557. package/node_modules/@openclaw/fs-safe/dist/windows-path-alias.js +140 -0
  1558. package/node_modules/@openclaw/fs-safe/dist/windows-path-syntax.d.ts +18 -0
  1559. package/node_modules/@openclaw/fs-safe/dist/windows-path-syntax.js +72 -0
  1560. package/node_modules/@openclaw/fs-safe/dist/windows-security-command.d.ts +33 -0
  1561. package/node_modules/@openclaw/fs-safe/dist/windows-security-command.js +433 -0
  1562. package/node_modules/@openclaw/fs-safe/dist/windows-security-facts.d.ts +10 -0
  1563. package/node_modules/@openclaw/fs-safe/dist/windows-security-facts.js +117 -0
  1564. package/node_modules/@openclaw/fs-safe/dist/windows-security-helper.d.ts +2 -0
  1565. package/node_modules/@openclaw/fs-safe/dist/windows-security-helper.exe +0 -0
  1566. package/node_modules/@openclaw/fs-safe/dist/windows-security-helper.js +7 -0
  1567. package/node_modules/@openclaw/fs-safe/dist/windows-test-hooks.d.ts +16 -0
  1568. package/node_modules/@openclaw/fs-safe/dist/windows-test-hooks.js +51 -0
  1569. package/node_modules/@openclaw/fs-safe/dist/write-file-handle.d.ts +13 -0
  1570. package/node_modules/@openclaw/fs-safe/dist/write-file-handle.js +49 -0
  1571. package/node_modules/@openclaw/fs-safe/dist/write-open-flags.d.ts +4 -0
  1572. package/node_modules/@openclaw/fs-safe/dist/write-open-flags.js +27 -0
  1573. package/node_modules/@openclaw/fs-safe/dist/write-queue.d.ts +1 -0
  1574. package/node_modules/@openclaw/fs-safe/dist/write-queue.js +15 -0
  1575. package/node_modules/@openclaw/fs-safe/docs/advanced.md +285 -0
  1576. package/node_modules/@openclaw/fs-safe/docs/archive.md +879 -0
  1577. package/node_modules/@openclaw/fs-safe/docs/assets/readme-banner.jpg +0 -0
  1578. package/node_modules/@openclaw/fs-safe/docs/atomic.md +635 -0
  1579. package/node_modules/@openclaw/fs-safe/docs/compiler-qualification.md +392 -0
  1580. package/node_modules/@openclaw/fs-safe/docs/config.md +204 -0
  1581. package/node_modules/@openclaw/fs-safe/docs/contributing.md +445 -0
  1582. package/node_modules/@openclaw/fs-safe/docs/copy.md +357 -0
  1583. package/node_modules/@openclaw/fs-safe/docs/creation.md +132 -0
  1584. package/node_modules/@openclaw/fs-safe/docs/directory-identity.md +85 -0
  1585. package/node_modules/@openclaw/fs-safe/docs/durability.md +500 -0
  1586. package/node_modules/@openclaw/fs-safe/docs/entries.md +109 -0
  1587. package/node_modules/@openclaw/fs-safe/docs/entry-publication.md +146 -0
  1588. package/node_modules/@openclaw/fs-safe/docs/errors.md +316 -0
  1589. package/node_modules/@openclaw/fs-safe/docs/file-contents.md +68 -0
  1590. package/node_modules/@openclaw/fs-safe/docs/file-store.md +404 -0
  1591. package/node_modules/@openclaw/fs-safe/docs/filename.md +110 -0
  1592. package/node_modules/@openclaw/fs-safe/docs/guest.md +171 -0
  1593. package/node_modules/@openclaw/fs-safe/docs/in-place-write.md +112 -0
  1594. package/node_modules/@openclaw/fs-safe/docs/index.md +58 -0
  1595. package/node_modules/@openclaw/fs-safe/docs/install-path.md +216 -0
  1596. package/node_modules/@openclaw/fs-safe/docs/install.md +251 -0
  1597. package/node_modules/@openclaw/fs-safe/docs/json-store.md +245 -0
  1598. package/node_modules/@openclaw/fs-safe/docs/json.md +229 -0
  1599. package/node_modules/@openclaw/fs-safe/docs/local-roots.md +149 -0
  1600. package/node_modules/@openclaw/fs-safe/docs/migrating-to-0.5.md +207 -0
  1601. package/node_modules/@openclaw/fs-safe/docs/migrating-to-0.6.md +48 -0
  1602. package/node_modules/@openclaw/fs-safe/docs/native-helper.md +209 -0
  1603. package/node_modules/@openclaw/fs-safe/docs/native.md +657 -0
  1604. package/node_modules/@openclaw/fs-safe/docs/output.md +195 -0
  1605. package/node_modules/@openclaw/fs-safe/docs/path-case.md +64 -0
  1606. package/node_modules/@openclaw/fs-safe/docs/path-prefix.md +84 -0
  1607. package/node_modules/@openclaw/fs-safe/docs/path-scope.md +163 -0
  1608. package/node_modules/@openclaw/fs-safe/docs/path-suffix-aliases.md +204 -0
  1609. package/node_modules/@openclaw/fs-safe/docs/path.md +222 -0
  1610. package/node_modules/@openclaw/fs-safe/docs/permissions.md +428 -0
  1611. package/node_modules/@openclaw/fs-safe/docs/pipe.md +81 -0
  1612. package/node_modules/@openclaw/fs-safe/docs/platform-capabilities.md +63 -0
  1613. package/node_modules/@openclaw/fs-safe/docs/positional-read.md +63 -0
  1614. package/node_modules/@openclaw/fs-safe/docs/public-api.md +201 -0
  1615. package/node_modules/@openclaw/fs-safe/docs/queue-link-free-design.md +237 -0
  1616. package/node_modules/@openclaw/fs-safe/docs/quickstart.md +174 -0
  1617. package/node_modules/@openclaw/fs-safe/docs/reading.md +256 -0
  1618. package/node_modules/@openclaw/fs-safe/docs/regular-file.md +195 -0
  1619. package/node_modules/@openclaw/fs-safe/docs/retained-file.md +115 -0
  1620. package/node_modules/@openclaw/fs-safe/docs/root.md +413 -0
  1621. package/node_modules/@openclaw/fs-safe/docs/secret-file.md +322 -0
  1622. package/node_modules/@openclaw/fs-safe/docs/secure-file.md +112 -0
  1623. package/node_modules/@openclaw/fs-safe/docs/security-model.md +428 -0
  1624. package/node_modules/@openclaw/fs-safe/docs/sidecar-lock.md +659 -0
  1625. package/node_modules/@openclaw/fs-safe/docs/staged-file.md +219 -0
  1626. package/node_modules/@openclaw/fs-safe/docs/staged-symlink.md +124 -0
  1627. package/node_modules/@openclaw/fs-safe/docs/store.md +144 -0
  1628. package/node_modules/@openclaw/fs-safe/docs/temp.md +810 -0
  1629. package/node_modules/@openclaw/fs-safe/docs/testing.md +444 -0
  1630. package/node_modules/@openclaw/fs-safe/docs/timing.md +123 -0
  1631. package/node_modules/@openclaw/fs-safe/docs/types.md +178 -0
  1632. package/node_modules/@openclaw/fs-safe/docs/walk.md +314 -0
  1633. package/node_modules/@openclaw/fs-safe/docs/watch.md +394 -0
  1634. package/node_modules/@openclaw/fs-safe/docs/writing.md +959 -0
  1635. package/node_modules/@openclaw/fs-safe/package.json +219 -0
  1636. package/node_modules/@openclaw/fs-safe-linux-x64-gnu/fs-safe-native.node +0 -0
  1637. package/node_modules/@openclaw/fs-safe-linux-x64-gnu/package.json +32 -0
  1638. package/node_modules/acpx/LICENSE +21 -0
  1639. package/node_modules/acpx/README.md +142 -0
  1640. package/node_modules/acpx/dist/agent-registry-CxpAF3nI.js +844 -0
  1641. package/node_modules/acpx/dist/agent-registry-CxpAF3nI.js.map +1 -0
  1642. package/node_modules/acpx/dist/agent-registry.d.ts +69 -0
  1643. package/node_modules/acpx/dist/agent-registry.d.ts.map +1 -0
  1644. package/node_modules/acpx/dist/agent-registry.js +1 -0
  1645. package/node_modules/acpx/dist/cli-DeYZhjw6.js +187 -0
  1646. package/node_modules/acpx/dist/cli-DeYZhjw6.js.map +1 -0
  1647. package/node_modules/acpx/dist/cli.d.ts +9 -0
  1648. package/node_modules/acpx/dist/cli.d.ts.map +1 -0
  1649. package/node_modules/acpx/dist/cli.js +2573 -0
  1650. package/node_modules/acpx/dist/cli.js.map +1 -0
  1651. package/node_modules/acpx/dist/client-BqZW_W14.d.ts +217 -0
  1652. package/node_modules/acpx/dist/client-BqZW_W14.d.ts.map +1 -0
  1653. package/node_modules/acpx/dist/flows-Bxlp6H8u.js +2541 -0
  1654. package/node_modules/acpx/dist/flows-Bxlp6H8u.js.map +1 -0
  1655. package/node_modules/acpx/dist/flows.d.ts +344 -0
  1656. package/node_modules/acpx/dist/flows.d.ts.map +1 -0
  1657. package/node_modules/acpx/dist/flows.js +1 -0
  1658. package/node_modules/acpx/dist/invocation-options-8lEkbe7g.js +349 -0
  1659. package/node_modules/acpx/dist/invocation-options-8lEkbe7g.js.map +1 -0
  1660. package/node_modules/acpx/dist/ipc-CQUNQ8QQ.js +5304 -0
  1661. package/node_modules/acpx/dist/ipc-CQUNQ8QQ.js.map +1 -0
  1662. package/node_modules/acpx/dist/output-C_T39Ap1.js +1055 -0
  1663. package/node_modules/acpx/dist/output-C_T39Ap1.js.map +1 -0
  1664. package/node_modules/acpx/dist/queue-owner-runtime-ucHvXJ33.js +8387 -0
  1665. package/node_modules/acpx/dist/queue-owner-runtime-ucHvXJ33.js.map +1 -0
  1666. package/node_modules/acpx/dist/runtime.d.ts +899 -0
  1667. package/node_modules/acpx/dist/runtime.d.ts.map +1 -0
  1668. package/node_modules/acpx/dist/runtime.js +2896 -0
  1669. package/node_modules/acpx/dist/runtime.js.map +1 -0
  1670. package/node_modules/acpx/dist/session-options-D9KL7-d8.d.ts +371 -0
  1671. package/node_modules/acpx/dist/session-options-D9KL7-d8.d.ts.map +1 -0
  1672. package/node_modules/acpx/dist/session-watch-D0YvKsnQ.js +75 -0
  1673. package/node_modules/acpx/dist/session-watch-D0YvKsnQ.js.map +1 -0
  1674. package/node_modules/acpx/dist/watch-CXy2A5VY.js +84 -0
  1675. package/node_modules/acpx/dist/watch-CXy2A5VY.js.map +1 -0
  1676. package/node_modules/acpx/package.json +131 -0
  1677. package/node_modules/acpx/skills/acpx/SKILL.md +722 -0
  1678. package/node_modules/b4a/LICENSE +201 -0
  1679. package/node_modules/b4a/README.md +153 -0
  1680. package/node_modules/b4a/browser.js +546 -0
  1681. package/node_modules/b4a/index.d.ts +144 -0
  1682. package/node_modules/b4a/index.js +193 -0
  1683. package/node_modules/b4a/lib/ascii.js +31 -0
  1684. package/node_modules/b4a/lib/base64.js +64 -0
  1685. package/node_modules/b4a/lib/hex.js +51 -0
  1686. package/node_modules/b4a/lib/latin1.js +31 -0
  1687. package/node_modules/b4a/lib/utf16le.js +40 -0
  1688. package/node_modules/b4a/lib/utf8.js +144 -0
  1689. package/node_modules/b4a/package.json +54 -0
  1690. package/node_modules/b4a/react-native.js +5 -0
  1691. package/node_modules/b4a/runtime.d.ts +14 -0
  1692. package/node_modules/bare-buffer/CMakeLists.txt +20 -0
  1693. package/node_modules/bare-buffer/LICENSE +201 -0
  1694. package/node_modules/bare-buffer/README.md +30 -0
  1695. package/node_modules/bare-buffer/binding.c +2041 -0
  1696. package/node_modules/bare-buffer/binding.js +1 -0
  1697. package/node_modules/bare-buffer/global.d.ts +21 -0
  1698. package/node_modules/bare-buffer/global.js +6 -0
  1699. package/node_modules/bare-buffer/index.d.ts +769 -0
  1700. package/node_modules/bare-buffer/index.js +1339 -0
  1701. package/node_modules/bare-buffer/lib/ascii.js +36 -0
  1702. package/node_modules/bare-buffer/lib/base64.js +25 -0
  1703. package/node_modules/bare-buffer/lib/base64url.js +25 -0
  1704. package/node_modules/bare-buffer/lib/checked.js +23 -0
  1705. package/node_modules/bare-buffer/lib/constants.d.ts +7 -0
  1706. package/node_modules/bare-buffer/lib/constants.js +3 -0
  1707. package/node_modules/bare-buffer/lib/hex.js +20 -0
  1708. package/node_modules/bare-buffer/lib/latin1.js +14 -0
  1709. package/node_modules/bare-buffer/lib/utf16le.js +20 -0
  1710. package/node_modules/bare-buffer/lib/utf8.js +18 -0
  1711. package/node_modules/bare-buffer/package.json +59 -0
  1712. package/node_modules/bare-buffer/prebuilds/android-arm/bare-buffer.bare +0 -0
  1713. package/node_modules/bare-buffer/prebuilds/android-arm64/bare-buffer.bare +0 -0
  1714. package/node_modules/bare-buffer/prebuilds/android-ia32/bare-buffer.bare +0 -0
  1715. package/node_modules/bare-buffer/prebuilds/android-x64/bare-buffer.bare +0 -0
  1716. package/node_modules/bare-buffer/prebuilds/darwin-arm64/bare-buffer.bare +0 -0
  1717. package/node_modules/bare-buffer/prebuilds/darwin-x64/bare-buffer.bare +0 -0
  1718. package/node_modules/bare-buffer/prebuilds/ios-arm64/bare-buffer.bare +0 -0
  1719. package/node_modules/bare-buffer/prebuilds/ios-arm64-simulator/bare-buffer.bare +0 -0
  1720. package/node_modules/bare-buffer/prebuilds/ios-x64-simulator/bare-buffer.bare +0 -0
  1721. package/node_modules/bare-buffer/prebuilds/linux-arm64/bare-buffer.bare +0 -0
  1722. package/node_modules/bare-buffer/prebuilds/linux-x64/bare-buffer.bare +0 -0
  1723. package/node_modules/bare-buffer/prebuilds/win32-arm64/bare-buffer.bare +0 -0
  1724. package/node_modules/bare-buffer/prebuilds/win32-x64/bare-buffer.bare +0 -0
  1725. package/node_modules/bare-events/LICENSE +201 -0
  1726. package/node_modules/bare-events/README.md +29 -0
  1727. package/node_modules/bare-events/global.d.ts +15 -0
  1728. package/node_modules/bare-events/global.js +5 -0
  1729. package/node_modules/bare-events/index.d.ts +246 -0
  1730. package/node_modules/bare-events/index.js +423 -0
  1731. package/node_modules/bare-events/lib/errors.js +23 -0
  1732. package/node_modules/bare-events/package.json +63 -0
  1733. package/node_modules/bare-events/web.d.ts +108 -0
  1734. package/node_modules/bare-events/web.js +417 -0
  1735. package/node_modules/bare-fs/CMakeLists.txt +13 -0
  1736. package/node_modules/bare-fs/LICENSE +201 -0
  1737. package/node_modules/bare-fs/README.md +33 -0
  1738. package/node_modules/bare-fs/binding.c +3055 -0
  1739. package/node_modules/bare-fs/binding.js +1 -0
  1740. package/node_modules/bare-fs/index.d.ts +1504 -0
  1741. package/node_modules/bare-fs/index.js +2902 -0
  1742. package/node_modules/bare-fs/lib/constants.d.ts +50 -0
  1743. package/node_modules/bare-fs/lib/constants.js +49 -0
  1744. package/node_modules/bare-fs/lib/errors.d.ts +13 -0
  1745. package/node_modules/bare-fs/lib/errors.js +55 -0
  1746. package/node_modules/bare-fs/lib/queue.js +29 -0
  1747. package/node_modules/bare-fs/package.json +74 -0
  1748. package/node_modules/bare-fs/prebuilds/android-arm/bare-fs.bare +0 -0
  1749. package/node_modules/bare-fs/prebuilds/android-arm64/bare-fs.bare +0 -0
  1750. package/node_modules/bare-fs/prebuilds/android-ia32/bare-fs.bare +0 -0
  1751. package/node_modules/bare-fs/prebuilds/android-x64/bare-fs.bare +0 -0
  1752. package/node_modules/bare-fs/prebuilds/darwin-arm64/bare-fs.bare +0 -0
  1753. package/node_modules/bare-fs/prebuilds/darwin-x64/bare-fs.bare +0 -0
  1754. package/node_modules/bare-fs/prebuilds/ios-arm64/bare-fs.bare +0 -0
  1755. package/node_modules/bare-fs/prebuilds/ios-arm64-simulator/bare-fs.bare +0 -0
  1756. package/node_modules/bare-fs/prebuilds/ios-x64-simulator/bare-fs.bare +0 -0
  1757. package/node_modules/bare-fs/prebuilds/linux-arm64/bare-fs.bare +0 -0
  1758. package/node_modules/bare-fs/prebuilds/linux-x64/bare-fs.bare +0 -0
  1759. package/node_modules/bare-fs/prebuilds/win32-arm64/bare-fs.bare +0 -0
  1760. package/node_modules/bare-fs/prebuilds/win32-x64/bare-fs.bare +0 -0
  1761. package/node_modules/bare-fs/promises.d.ts +480 -0
  1762. package/node_modules/bare-fs/promises.js +119 -0
  1763. package/node_modules/bare-path/CMakeLists.txt +13 -0
  1764. package/node_modules/bare-path/LICENSE +201 -0
  1765. package/node_modules/bare-path/NOTICE +28 -0
  1766. package/node_modules/bare-path/README.md +27 -0
  1767. package/node_modules/bare-path/binding.c +127 -0
  1768. package/node_modules/bare-path/binding.js +1 -0
  1769. package/node_modules/bare-path/index.d.ts +91 -0
  1770. package/node_modules/bare-path/index.js +9 -0
  1771. package/node_modules/bare-path/lib/constants.js +11 -0
  1772. package/node_modules/bare-path/lib/posix.js +263 -0
  1773. package/node_modules/bare-path/lib/shared.js +81 -0
  1774. package/node_modules/bare-path/lib/win32.js +564 -0
  1775. package/node_modules/bare-path/package.json +47 -0
  1776. package/node_modules/bare-path/prebuilds/android-arm/bare-path.bare +0 -0
  1777. package/node_modules/bare-path/prebuilds/android-arm64/bare-path.bare +0 -0
  1778. package/node_modules/bare-path/prebuilds/android-ia32/bare-path.bare +0 -0
  1779. package/node_modules/bare-path/prebuilds/android-x64/bare-path.bare +0 -0
  1780. package/node_modules/bare-path/prebuilds/darwin-arm64/bare-path.bare +0 -0
  1781. package/node_modules/bare-path/prebuilds/darwin-x64/bare-path.bare +0 -0
  1782. package/node_modules/bare-path/prebuilds/ios-arm64/bare-path.bare +0 -0
  1783. package/node_modules/bare-path/prebuilds/ios-arm64-simulator/bare-path.bare +0 -0
  1784. package/node_modules/bare-path/prebuilds/ios-x64-simulator/bare-path.bare +0 -0
  1785. package/node_modules/bare-path/prebuilds/linux-arm64/bare-path.bare +0 -0
  1786. package/node_modules/bare-path/prebuilds/linux-x64/bare-path.bare +0 -0
  1787. package/node_modules/bare-path/prebuilds/win32-arm64/bare-path.bare +0 -0
  1788. package/node_modules/bare-path/prebuilds/win32-x64/bare-path.bare +0 -0
  1789. package/node_modules/bare-stream/LICENSE +201 -0
  1790. package/node_modules/bare-stream/README.md +354 -0
  1791. package/node_modules/bare-stream/global.d.ts +31 -0
  1792. package/node_modules/bare-stream/global.js +15 -0
  1793. package/node_modules/bare-stream/index.d.ts +235 -0
  1794. package/node_modules/bare-stream/index.js +493 -0
  1795. package/node_modules/bare-stream/package.json +75 -0
  1796. package/node_modules/bare-stream/promises.js +3 -0
  1797. package/node_modules/bare-stream/web.d.ts +152 -0
  1798. package/node_modules/bare-stream/web.js +607 -0
  1799. package/node_modules/bare-url/CMakeLists.txt +36 -0
  1800. package/node_modules/bare-url/LICENSE +201 -0
  1801. package/node_modules/bare-url/README.md +37 -0
  1802. package/node_modules/bare-url/binding.c +465 -0
  1803. package/node_modules/bare-url/binding.js +1 -0
  1804. package/node_modules/bare-url/global.d.ts +24 -0
  1805. package/node_modules/bare-url/global.js +2 -0
  1806. package/node_modules/bare-url/index.d.ts +115 -0
  1807. package/node_modules/bare-url/index.js +734 -0
  1808. package/node_modules/bare-url/lib/errors.d.ts +10 -0
  1809. package/node_modules/bare-url/lib/errors.js +37 -0
  1810. package/node_modules/bare-url/lib/url-search-params.d.ts +66 -0
  1811. package/node_modules/bare-url/lib/url-search-params.js +291 -0
  1812. package/node_modules/bare-url/package.json +55 -0
  1813. package/node_modules/bare-url/prebuilds/android-arm/bare-url.bare +0 -0
  1814. package/node_modules/bare-url/prebuilds/android-arm64/bare-url.bare +0 -0
  1815. package/node_modules/bare-url/prebuilds/android-ia32/bare-url.bare +0 -0
  1816. package/node_modules/bare-url/prebuilds/android-x64/bare-url.bare +0 -0
  1817. package/node_modules/bare-url/prebuilds/darwin-arm64/bare-url.bare +0 -0
  1818. package/node_modules/bare-url/prebuilds/darwin-x64/bare-url.bare +0 -0
  1819. package/node_modules/bare-url/prebuilds/ios-arm64/bare-url.bare +0 -0
  1820. package/node_modules/bare-url/prebuilds/ios-arm64-simulator/bare-url.bare +0 -0
  1821. package/node_modules/bare-url/prebuilds/ios-x64-simulator/bare-url.bare +0 -0
  1822. package/node_modules/bare-url/prebuilds/linux-arm64/bare-url.bare +0 -0
  1823. package/node_modules/bare-url/prebuilds/linux-x64/bare-url.bare +0 -0
  1824. package/node_modules/bare-url/prebuilds/win32-arm64/bare-url.bare +0 -0
  1825. package/node_modules/bare-url/prebuilds/win32-x64/bare-url.bare +0 -0
  1826. package/node_modules/commander/LICENSE +22 -0
  1827. package/node_modules/commander/Readme.md +1146 -0
  1828. package/node_modules/commander/index.js +21 -0
  1829. package/node_modules/commander/lib/argument.js +147 -0
  1830. package/node_modules/commander/lib/command.js +2803 -0
  1831. package/node_modules/commander/lib/error.js +36 -0
  1832. package/node_modules/commander/lib/help.js +735 -0
  1833. package/node_modules/commander/lib/option.js +377 -0
  1834. package/node_modules/commander/lib/suggestSimilar.js +99 -0
  1835. package/node_modules/commander/package-support.json +19 -0
  1836. package/node_modules/commander/package.json +65 -0
  1837. package/node_modules/commander/typings/index.d.ts +1116 -0
  1838. package/node_modules/core-util-is/LICENSE +19 -0
  1839. package/node_modules/core-util-is/README.md +3 -0
  1840. package/node_modules/core-util-is/lib/util.js +107 -0
  1841. package/node_modules/core-util-is/package.json +38 -0
  1842. package/node_modules/esbuild/LICENSE.md +21 -0
  1843. package/node_modules/esbuild/README.md +3 -0
  1844. package/node_modules/esbuild/bin/esbuild +223 -0
  1845. package/node_modules/esbuild/install.js +300 -0
  1846. package/node_modules/esbuild/lib/main.d.ts +720 -0
  1847. package/node_modules/esbuild/lib/main.js +2536 -0
  1848. package/node_modules/esbuild/package.json +74 -0
  1849. package/node_modules/events-universal/LICENSE +201 -0
  1850. package/node_modules/events-universal/README.md +17 -0
  1851. package/node_modules/events-universal/bare.js +1 -0
  1852. package/node_modules/events-universal/default.js +1 -0
  1853. package/node_modules/events-universal/index.js +1 -0
  1854. package/node_modules/events-universal/package.json +39 -0
  1855. package/node_modules/events-universal/react-native.js +1 -0
  1856. package/node_modules/fast-fifo/LICENSE +21 -0
  1857. package/node_modules/fast-fifo/README.md +78 -0
  1858. package/node_modules/fast-fifo/fixed-size.js +39 -0
  1859. package/node_modules/fast-fifo/index.js +48 -0
  1860. package/node_modules/fast-fifo/package.json +28 -0
  1861. package/node_modules/fast-string-truncated-width/dist/index.d.ts +4 -0
  1862. package/node_modules/fast-string-truncated-width/dist/index.js +111 -0
  1863. package/node_modules/fast-string-truncated-width/dist/types.d.ts +19 -0
  1864. package/node_modules/fast-string-truncated-width/dist/types.js +2 -0
  1865. package/node_modules/fast-string-truncated-width/dist/utils.d.ts +4 -0
  1866. package/node_modules/fast-string-truncated-width/dist/utils.js +20 -0
  1867. package/node_modules/fast-string-truncated-width/license +21 -0
  1868. package/node_modules/fast-string-truncated-width/package.json +35 -0
  1869. package/node_modules/fast-string-truncated-width/readme.md +59 -0
  1870. package/node_modules/fast-string-width/dist/index.d.ts +4 -0
  1871. package/node_modules/fast-string-width/dist/index.js +14 -0
  1872. package/node_modules/fast-string-width/license +21 -0
  1873. package/node_modules/fast-string-width/package.json +34 -0
  1874. package/node_modules/fast-string-width/readme.md +42 -0
  1875. package/node_modules/fast-wrap-ansi/LICENSE +23 -0
  1876. package/node_modules/fast-wrap-ansi/README.md +26 -0
  1877. package/node_modules/fast-wrap-ansi/lib/main.d.ts +6 -0
  1878. package/node_modules/fast-wrap-ansi/lib/main.js +218 -0
  1879. package/node_modules/fast-wrap-ansi/package.json +51 -0
  1880. package/node_modules/immediate/LICENSE.txt +20 -0
  1881. package/node_modules/immediate/README.md +93 -0
  1882. package/node_modules/immediate/dist/immediate.js +75 -0
  1883. package/node_modules/immediate/dist/immediate.min.js +1 -0
  1884. package/node_modules/immediate/lib/browser.js +69 -0
  1885. package/node_modules/immediate/lib/index.js +73 -0
  1886. package/node_modules/immediate/package.json +42 -0
  1887. package/node_modules/inherits/LICENSE +16 -0
  1888. package/node_modules/inherits/README.md +42 -0
  1889. package/node_modules/inherits/inherits.js +9 -0
  1890. package/node_modules/inherits/inherits_browser.js +27 -0
  1891. package/node_modules/inherits/package.json +29 -0
  1892. package/node_modules/isarray/.npmignore +1 -0
  1893. package/node_modules/isarray/.travis.yml +4 -0
  1894. package/node_modules/isarray/Makefile +6 -0
  1895. package/node_modules/isarray/README.md +60 -0
  1896. package/node_modules/isarray/component.json +19 -0
  1897. package/node_modules/isarray/index.js +5 -0
  1898. package/node_modules/isarray/package.json +45 -0
  1899. package/node_modules/isarray/test.js +20 -0
  1900. package/node_modules/jszip/.codeclimate.yml +16 -0
  1901. package/node_modules/jszip/.editorconfig +8 -0
  1902. package/node_modules/jszip/.eslintrc.js +43 -0
  1903. package/node_modules/jszip/.github/FUNDING.yml +1 -0
  1904. package/node_modules/jszip/.github/actions/setup/action.yml +23 -0
  1905. package/node_modules/jszip/.github/workflows/benchmark.yml +38 -0
  1906. package/node_modules/jszip/.github/workflows/main.yml +55 -0
  1907. package/node_modules/jszip/CHANGES.md +210 -0
  1908. package/node_modules/jszip/LICENSE.markdown +651 -0
  1909. package/node_modules/jszip/README.markdown +33 -0
  1910. package/node_modules/jszip/dist/jszip.js +11586 -0
  1911. package/node_modules/jszip/dist/jszip.min.js +13 -0
  1912. package/node_modules/jszip/index.d.ts +344 -0
  1913. package/node_modules/jszip/lib/base64.js +106 -0
  1914. package/node_modules/jszip/lib/compressedObject.js +74 -0
  1915. package/node_modules/jszip/lib/compressions.js +14 -0
  1916. package/node_modules/jszip/lib/crc32.js +77 -0
  1917. package/node_modules/jszip/lib/defaults.js +11 -0
  1918. package/node_modules/jszip/lib/external.js +18 -0
  1919. package/node_modules/jszip/lib/flate.js +85 -0
  1920. package/node_modules/jszip/lib/generate/ZipFileWorker.js +539 -0
  1921. package/node_modules/jszip/lib/generate/index.js +57 -0
  1922. package/node_modules/jszip/lib/index.js +55 -0
  1923. package/node_modules/jszip/lib/license_header.js +11 -0
  1924. package/node_modules/jszip/lib/load.js +88 -0
  1925. package/node_modules/jszip/lib/nodejs/NodejsStreamInputAdapter.js +74 -0
  1926. package/node_modules/jszip/lib/nodejs/NodejsStreamOutputAdapter.js +42 -0
  1927. package/node_modules/jszip/lib/nodejsUtils.js +57 -0
  1928. package/node_modules/jszip/lib/object.js +384 -0
  1929. package/node_modules/jszip/lib/readable-stream-browser.js +10 -0
  1930. package/node_modules/jszip/lib/reader/ArrayReader.js +57 -0
  1931. package/node_modules/jszip/lib/reader/DataReader.js +116 -0
  1932. package/node_modules/jszip/lib/reader/NodeBufferReader.js +19 -0
  1933. package/node_modules/jszip/lib/reader/StringReader.js +38 -0
  1934. package/node_modules/jszip/lib/reader/Uint8ArrayReader.js +22 -0
  1935. package/node_modules/jszip/lib/reader/readerFor.js +28 -0
  1936. package/node_modules/jszip/lib/signature.js +7 -0
  1937. package/node_modules/jszip/lib/stream/ConvertWorker.js +26 -0
  1938. package/node_modules/jszip/lib/stream/Crc32Probe.js +24 -0
  1939. package/node_modules/jszip/lib/stream/DataLengthProbe.js +29 -0
  1940. package/node_modules/jszip/lib/stream/DataWorker.js +116 -0
  1941. package/node_modules/jszip/lib/stream/GenericWorker.js +263 -0
  1942. package/node_modules/jszip/lib/stream/StreamHelper.js +214 -0
  1943. package/node_modules/jszip/lib/support.js +38 -0
  1944. package/node_modules/jszip/lib/utf8.js +275 -0
  1945. package/node_modules/jszip/lib/utils.js +510 -0
  1946. package/node_modules/jszip/lib/zipEntries.js +261 -0
  1947. package/node_modules/jszip/lib/zipEntry.js +293 -0
  1948. package/node_modules/jszip/lib/zipObject.js +133 -0
  1949. package/node_modules/jszip/package.json +67 -0
  1950. package/node_modules/jszip/sponsors.md +21 -0
  1951. package/node_modules/jszip/tsconfig.json +101 -0
  1952. package/node_modules/jszip/vendor/FileSaver.js +247 -0
  1953. package/node_modules/lie/README.md +62 -0
  1954. package/node_modules/lie/dist/lie.js +350 -0
  1955. package/node_modules/lie/dist/lie.min.js +1 -0
  1956. package/node_modules/lie/dist/lie.polyfill.js +358 -0
  1957. package/node_modules/lie/dist/lie.polyfill.min.js +1 -0
  1958. package/node_modules/lie/lib/browser.js +273 -0
  1959. package/node_modules/lie/lib/index.js +298 -0
  1960. package/node_modules/lie/license.md +7 -0
  1961. package/node_modules/lie/lie.d.ts +244 -0
  1962. package/node_modules/lie/package.json +69 -0
  1963. package/node_modules/lie/polyfill.js +4 -0
  1964. package/node_modules/pako/LICENSE +21 -0
  1965. package/node_modules/pako/README.md +191 -0
  1966. package/node_modules/pako/dist/pako.js +6818 -0
  1967. package/node_modules/pako/dist/pako.min.js +1 -0
  1968. package/node_modules/pako/dist/pako_deflate.js +3997 -0
  1969. package/node_modules/pako/dist/pako_deflate.min.js +1 -0
  1970. package/node_modules/pako/dist/pako_inflate.js +3300 -0
  1971. package/node_modules/pako/dist/pako_inflate.min.js +1 -0
  1972. package/node_modules/pako/index.js +14 -0
  1973. package/node_modules/pako/lib/deflate.js +400 -0
  1974. package/node_modules/pako/lib/inflate.js +423 -0
  1975. package/node_modules/pako/lib/utils/common.js +105 -0
  1976. package/node_modules/pako/lib/utils/strings.js +187 -0
  1977. package/node_modules/pako/lib/zlib/README +59 -0
  1978. package/node_modules/pako/lib/zlib/adler32.js +51 -0
  1979. package/node_modules/pako/lib/zlib/constants.js +68 -0
  1980. package/node_modules/pako/lib/zlib/crc32.js +59 -0
  1981. package/node_modules/pako/lib/zlib/deflate.js +1874 -0
  1982. package/node_modules/pako/lib/zlib/gzheader.js +58 -0
  1983. package/node_modules/pako/lib/zlib/inffast.js +345 -0
  1984. package/node_modules/pako/lib/zlib/inflate.js +1556 -0
  1985. package/node_modules/pako/lib/zlib/inftrees.js +343 -0
  1986. package/node_modules/pako/lib/zlib/messages.js +32 -0
  1987. package/node_modules/pako/lib/zlib/trees.js +1222 -0
  1988. package/node_modules/pako/lib/zlib/zstream.js +47 -0
  1989. package/node_modules/pako/package.json +44 -0
  1990. package/node_modules/process-nextick-args/index.js +45 -0
  1991. package/node_modules/process-nextick-args/license.md +19 -0
  1992. package/node_modules/process-nextick-args/package.json +25 -0
  1993. package/node_modules/process-nextick-args/readme.md +18 -0
  1994. package/node_modules/readable-stream/.travis.yml +34 -0
  1995. package/node_modules/readable-stream/CONTRIBUTING.md +38 -0
  1996. package/node_modules/readable-stream/GOVERNANCE.md +136 -0
  1997. package/node_modules/readable-stream/LICENSE +47 -0
  1998. package/node_modules/readable-stream/README.md +58 -0
  1999. package/node_modules/readable-stream/doc/wg-meetings/2015-01-30.md +60 -0
  2000. package/node_modules/readable-stream/duplex-browser.js +1 -0
  2001. package/node_modules/readable-stream/duplex.js +1 -0
  2002. package/node_modules/readable-stream/lib/_stream_duplex.js +131 -0
  2003. package/node_modules/readable-stream/lib/_stream_passthrough.js +47 -0
  2004. package/node_modules/readable-stream/lib/_stream_readable.js +1019 -0
  2005. package/node_modules/readable-stream/lib/_stream_transform.js +214 -0
  2006. package/node_modules/readable-stream/lib/_stream_writable.js +685 -0
  2007. package/node_modules/readable-stream/lib/internal/streams/BufferList.js +78 -0
  2008. package/node_modules/readable-stream/lib/internal/streams/destroy.js +84 -0
  2009. package/node_modules/readable-stream/lib/internal/streams/stream-browser.js +1 -0
  2010. package/node_modules/readable-stream/lib/internal/streams/stream.js +1 -0
  2011. package/node_modules/readable-stream/package.json +52 -0
  2012. package/node_modules/readable-stream/passthrough.js +1 -0
  2013. package/node_modules/readable-stream/readable-browser.js +7 -0
  2014. package/node_modules/readable-stream/readable.js +19 -0
  2015. package/node_modules/readable-stream/transform.js +1 -0
  2016. package/node_modules/readable-stream/writable-browser.js +1 -0
  2017. package/node_modules/readable-stream/writable.js +8 -0
  2018. package/node_modules/safe-buffer/LICENSE +21 -0
  2019. package/node_modules/safe-buffer/README.md +584 -0
  2020. package/node_modules/safe-buffer/index.d.ts +187 -0
  2021. package/node_modules/safe-buffer/index.js +62 -0
  2022. package/node_modules/safe-buffer/package.json +37 -0
  2023. package/node_modules/setimmediate/LICENSE.txt +20 -0
  2024. package/node_modules/setimmediate/package.json +30 -0
  2025. package/node_modules/setimmediate/setImmediate.js +186 -0
  2026. package/node_modules/sisteransi/dist/index.d.ts +33 -0
  2027. package/node_modules/sisteransi/dist/index.js +57 -0
  2028. package/node_modules/sisteransi/license +21 -0
  2029. package/node_modules/sisteransi/package.json +45 -0
  2030. package/node_modules/sisteransi/readme.md +126 -0
  2031. package/node_modules/skillflag/LICENSE +21 -0
  2032. package/node_modules/skillflag/README.md +44 -0
  2033. package/node_modules/skillflag/dist/bin/skill-install.d.ts +3 -0
  2034. package/node_modules/skillflag/dist/bin/skill-install.d.ts.map +1 -0
  2035. package/node_modules/skillflag/dist/bin/skill-install.js +6 -0
  2036. package/node_modules/skillflag/dist/bin/skill-install.js.map +1 -0
  2037. package/node_modules/skillflag/dist/bin/skillflag.d.ts +3 -0
  2038. package/node_modules/skillflag/dist/bin/skillflag.d.ts.map +1 -0
  2039. package/node_modules/skillflag/dist/bin/skillflag.js +25 -0
  2040. package/node_modules/skillflag/dist/bin/skillflag.js.map +1 -0
  2041. package/node_modules/skillflag/dist/core/digest.d.ts +2 -0
  2042. package/node_modules/skillflag/dist/core/digest.d.ts.map +1 -0
  2043. package/node_modules/skillflag/dist/core/digest.js +15 -0
  2044. package/node_modules/skillflag/dist/core/digest.js.map +1 -0
  2045. package/node_modules/skillflag/dist/core/errors.d.ts +6 -0
  2046. package/node_modules/skillflag/dist/core/errors.d.ts.map +1 -0
  2047. package/node_modules/skillflag/dist/core/errors.js +13 -0
  2048. package/node_modules/skillflag/dist/core/errors.js.map +1 -0
  2049. package/node_modules/skillflag/dist/core/export.d.ts +2 -0
  2050. package/node_modules/skillflag/dist/core/export.d.ts.map +1 -0
  2051. package/node_modules/skillflag/dist/core/export.js +28 -0
  2052. package/node_modules/skillflag/dist/core/export.js.map +1 -0
  2053. package/node_modules/skillflag/dist/core/list.d.ts +21 -0
  2054. package/node_modules/skillflag/dist/core/list.d.ts.map +1 -0
  2055. package/node_modules/skillflag/dist/core/list.js +71 -0
  2056. package/node_modules/skillflag/dist/core/list.js.map +1 -0
  2057. package/node_modules/skillflag/dist/core/paths.d.ts +15 -0
  2058. package/node_modules/skillflag/dist/core/paths.d.ts.map +1 -0
  2059. package/node_modules/skillflag/dist/core/paths.js +149 -0
  2060. package/node_modules/skillflag/dist/core/paths.js.map +1 -0
  2061. package/node_modules/skillflag/dist/core/show.d.ts +2 -0
  2062. package/node_modules/skillflag/dist/core/show.d.ts.map +1 -0
  2063. package/node_modules/skillflag/dist/core/show.js +8 -0
  2064. package/node_modules/skillflag/dist/core/show.js.map +1 -0
  2065. package/node_modules/skillflag/dist/core/skillflag.d.ts +3 -0
  2066. package/node_modules/skillflag/dist/core/skillflag.d.ts.map +1 -0
  2067. package/node_modules/skillflag/dist/core/skillflag.js +2 -0
  2068. package/node_modules/skillflag/dist/core/skillflag.js.map +1 -0
  2069. package/node_modules/skillflag/dist/core/tar.d.ts +16 -0
  2070. package/node_modules/skillflag/dist/core/tar.d.ts.map +1 -0
  2071. package/node_modules/skillflag/dist/core/tar.js +140 -0
  2072. package/node_modules/skillflag/dist/core/tar.js.map +1 -0
  2073. package/node_modules/skillflag/dist/index.d.ts +5 -0
  2074. package/node_modules/skillflag/dist/index.d.ts.map +1 -0
  2075. package/node_modules/skillflag/dist/index.js +3 -0
  2076. package/node_modules/skillflag/dist/index.js.map +1 -0
  2077. package/node_modules/skillflag/dist/install/cli.d.ts +57 -0
  2078. package/node_modules/skillflag/dist/install/cli.d.ts.map +1 -0
  2079. package/node_modules/skillflag/dist/install/cli.js +653 -0
  2080. package/node_modules/skillflag/dist/install/cli.js.map +1 -0
  2081. package/node_modules/skillflag/dist/install/copy.d.ts +2 -0
  2082. package/node_modules/skillflag/dist/install/copy.d.ts.map +1 -0
  2083. package/node_modules/skillflag/dist/install/copy.js +19 -0
  2084. package/node_modules/skillflag/dist/install/copy.js.map +1 -0
  2085. package/node_modules/skillflag/dist/install/errors.d.ts +6 -0
  2086. package/node_modules/skillflag/dist/install/errors.d.ts.map +1 -0
  2087. package/node_modules/skillflag/dist/install/errors.js +13 -0
  2088. package/node_modules/skillflag/dist/install/errors.js.map +1 -0
  2089. package/node_modules/skillflag/dist/install/extract.d.ts +3 -0
  2090. package/node_modules/skillflag/dist/install/extract.d.ts.map +1 -0
  2091. package/node_modules/skillflag/dist/install/extract.js +76 -0
  2092. package/node_modules/skillflag/dist/install/extract.js.map +1 -0
  2093. package/node_modules/skillflag/dist/install/install.d.ts +21 -0
  2094. package/node_modules/skillflag/dist/install/install.d.ts.map +1 -0
  2095. package/node_modules/skillflag/dist/install/install.js +35 -0
  2096. package/node_modules/skillflag/dist/install/install.js.map +1 -0
  2097. package/node_modules/skillflag/dist/install/resolve.d.ts +12 -0
  2098. package/node_modules/skillflag/dist/install/resolve.d.ts.map +1 -0
  2099. package/node_modules/skillflag/dist/install/resolve.js +119 -0
  2100. package/node_modules/skillflag/dist/install/resolve.js.map +1 -0
  2101. package/node_modules/skillflag/dist/install/validate.d.ts +7 -0
  2102. package/node_modules/skillflag/dist/install/validate.d.ts.map +1 -0
  2103. package/node_modules/skillflag/dist/install/validate.js +28 -0
  2104. package/node_modules/skillflag/dist/install/validate.js.map +1 -0
  2105. package/node_modules/skillflag/dist/shared/frontmatter.d.ts +2 -0
  2106. package/node_modules/skillflag/dist/shared/frontmatter.d.ts.map +1 -0
  2107. package/node_modules/skillflag/dist/shared/frontmatter.js +28 -0
  2108. package/node_modules/skillflag/dist/shared/frontmatter.js.map +1 -0
  2109. package/node_modules/skillflag/dist/skillflag.d.ts +29 -0
  2110. package/node_modules/skillflag/dist/skillflag.d.ts.map +1 -0
  2111. package/node_modules/skillflag/dist/skillflag.js +230 -0
  2112. package/node_modules/skillflag/dist/skillflag.js.map +1 -0
  2113. package/node_modules/skillflag/dist/utils/collections.d.ts +3 -0
  2114. package/node_modules/skillflag/dist/utils/collections.d.ts.map +1 -0
  2115. package/node_modules/skillflag/dist/utils/collections.js +18 -0
  2116. package/node_modules/skillflag/dist/utils/collections.js.map +1 -0
  2117. package/node_modules/skillflag/package.json +78 -0
  2118. package/node_modules/skillflag/skills/skillflag/SKILL.md +144 -0
  2119. package/node_modules/streamx/LICENSE +21 -0
  2120. package/node_modules/streamx/README.md +550 -0
  2121. package/node_modules/streamx/index.d.ts +198 -0
  2122. package/node_modules/streamx/index.js +1314 -0
  2123. package/node_modules/streamx/lib/errors.d.ts +13 -0
  2124. package/node_modules/streamx/lib/errors.js +47 -0
  2125. package/node_modules/streamx/package.json +51 -0
  2126. package/node_modules/streamx/runtime.d.ts +55 -0
  2127. package/node_modules/string_decoder/.travis.yml +50 -0
  2128. package/node_modules/string_decoder/LICENSE +48 -0
  2129. package/node_modules/string_decoder/README.md +47 -0
  2130. package/node_modules/string_decoder/lib/string_decoder.js +296 -0
  2131. package/node_modules/string_decoder/package.json +31 -0
  2132. package/node_modules/tar-stream/LICENSE +21 -0
  2133. package/node_modules/tar-stream/README.md +183 -0
  2134. package/node_modules/tar-stream/constants.js +14 -0
  2135. package/node_modules/tar-stream/extract.js +439 -0
  2136. package/node_modules/tar-stream/headers.js +322 -0
  2137. package/node_modules/tar-stream/index.d.ts +60 -0
  2138. package/node_modules/tar-stream/index.js +2 -0
  2139. package/node_modules/tar-stream/pack.js +287 -0
  2140. package/node_modules/tar-stream/package.json +50 -0
  2141. package/node_modules/teex/LICENSE +21 -0
  2142. package/node_modules/teex/README.md +31 -0
  2143. package/node_modules/teex/example.js +16 -0
  2144. package/node_modules/teex/index.js +52 -0
  2145. package/node_modules/teex/package.json +26 -0
  2146. package/node_modules/teex/test.js +68 -0
  2147. package/node_modules/text-decoder/LICENSE +201 -0
  2148. package/node_modules/text-decoder/README.md +36 -0
  2149. package/node_modules/text-decoder/index.js +64 -0
  2150. package/node_modules/text-decoder/lib/pass-through-decoder.js +19 -0
  2151. package/node_modules/text-decoder/lib/utf8-decoder.js +185 -0
  2152. package/node_modules/text-decoder/package.json +39 -0
  2153. package/node_modules/tsx/LICENSE +21 -0
  2154. package/node_modules/tsx/README.md +32 -0
  2155. package/node_modules/tsx/dist/cjs/api/index.cjs +2 -0
  2156. package/node_modules/tsx/dist/cjs/api/index.d.cts +35 -0
  2157. package/node_modules/tsx/dist/cjs/api/index.d.mts +35 -0
  2158. package/node_modules/tsx/dist/cjs/api/index.mjs +2 -0
  2159. package/node_modules/tsx/dist/cjs/index.cjs +1 -0
  2160. package/node_modules/tsx/dist/cli.mjs +55 -0
  2161. package/node_modules/tsx/dist/client-XItNFmsq.cjs +1 -0
  2162. package/node_modules/tsx/dist/esm/api/index.cjs +2 -0
  2163. package/node_modules/tsx/dist/esm/api/index.d.cts +37 -0
  2164. package/node_modules/tsx/dist/esm/api/index.d.mts +37 -0
  2165. package/node_modules/tsx/dist/esm/api/index.mjs +2 -0
  2166. package/node_modules/tsx/dist/esm/index.mjs +2 -0
  2167. package/node_modules/tsx/dist/index-Bqjv9TxC.mjs +1 -0
  2168. package/node_modules/tsx/dist/index-DE3OBZuV.mjs +14 -0
  2169. package/node_modules/tsx/dist/lexer-CGfpMDSb.cjs +3 -0
  2170. package/node_modules/tsx/dist/lexer-CanA6ArK.mjs +3 -0
  2171. package/node_modules/tsx/dist/loader.mjs +2 -0
  2172. package/node_modules/tsx/dist/package-Dj0mHsMt.mjs +1 -0
  2173. package/node_modules/tsx/dist/patch-repl.cjs +1 -0
  2174. package/node_modules/tsx/dist/preflight.cjs +1 -0
  2175. package/node_modules/tsx/dist/register-B1c7OH6V.cjs +23 -0
  2176. package/node_modules/tsx/dist/register-nyXW-TH3.mjs +2 -0
  2177. package/node_modules/tsx/dist/repl.mjs +4 -0
  2178. package/node_modules/tsx/dist/require-CBjy4Foe.mjs +10 -0
  2179. package/node_modules/tsx/dist/require-CVaYn9z3.cjs +1 -0
  2180. package/node_modules/tsx/dist/suppress-warnings.cjs +1 -0
  2181. package/node_modules/tsx/dist/temporary-directory-Du7LpLp9.mjs +1 -0
  2182. package/node_modules/tsx/package.json +70 -0
  2183. package/node_modules/util-deprecate/History.md +16 -0
  2184. package/node_modules/util-deprecate/LICENSE +24 -0
  2185. package/node_modules/util-deprecate/README.md +53 -0
  2186. package/node_modules/util-deprecate/browser.js +67 -0
  2187. package/node_modules/util-deprecate/node.js +6 -0
  2188. package/node_modules/util-deprecate/package.json +27 -0
  2189. package/node_modules/zod/LICENSE +21 -0
  2190. package/node_modules/zod/README.md +218 -0
  2191. package/node_modules/zod/compile.cjs +96 -0
  2192. package/node_modules/zod/compile.d.cts +1 -0
  2193. package/node_modules/zod/compile.d.ts +1 -0
  2194. package/node_modules/zod/compile.js +52 -0
  2195. package/node_modules/zod/index.cjs +52 -0
  2196. package/node_modules/zod/index.d.cts +3 -0
  2197. package/node_modules/zod/index.d.ts +3 -0
  2198. package/node_modules/zod/index.js +7 -0
  2199. package/node_modules/zod/locales/index.cjs +36 -0
  2200. package/node_modules/zod/locales/index.d.cts +1 -0
  2201. package/node_modules/zod/locales/index.d.ts +1 -0
  2202. package/node_modules/zod/locales/index.js +1 -0
  2203. package/node_modules/zod/locales/package.json +7 -0
  2204. package/node_modules/zod/mini/index.cjs +51 -0
  2205. package/node_modules/zod/mini/index.d.cts +3 -0
  2206. package/node_modules/zod/mini/index.d.ts +3 -0
  2207. package/node_modules/zod/mini/index.js +3 -0
  2208. package/node_modules/zod/mini/package.json +7 -0
  2209. package/node_modules/zod/package.json +147 -0
  2210. package/node_modules/zod/src/compile.ts +56 -0
  2211. package/node_modules/zod/src/index.ts +7 -0
  2212. package/node_modules/zod/src/locales/index.ts +1 -0
  2213. package/node_modules/zod/src/mini/index.ts +3 -0
  2214. package/node_modules/zod/src/v3/ZodError.ts +340 -0
  2215. package/node_modules/zod/src/v3/benchmarks/datetime.ts +58 -0
  2216. package/node_modules/zod/src/v3/benchmarks/discriminatedUnion.ts +80 -0
  2217. package/node_modules/zod/src/v3/benchmarks/index.ts +59 -0
  2218. package/node_modules/zod/src/v3/benchmarks/ipv4.ts +57 -0
  2219. package/node_modules/zod/src/v3/benchmarks/object.ts +69 -0
  2220. package/node_modules/zod/src/v3/benchmarks/primitives.ts +162 -0
  2221. package/node_modules/zod/src/v3/benchmarks/realworld.ts +63 -0
  2222. package/node_modules/zod/src/v3/benchmarks/string.ts +55 -0
  2223. package/node_modules/zod/src/v3/benchmarks/union.ts +80 -0
  2224. package/node_modules/zod/src/v3/errors.ts +13 -0
  2225. package/node_modules/zod/src/v3/external.ts +6 -0
  2226. package/node_modules/zod/src/v3/helpers/enumUtil.ts +17 -0
  2227. package/node_modules/zod/src/v3/helpers/errorUtil.ts +8 -0
  2228. package/node_modules/zod/src/v3/helpers/parseUtil.ts +176 -0
  2229. package/node_modules/zod/src/v3/helpers/partialUtil.ts +34 -0
  2230. package/node_modules/zod/src/v3/helpers/typeAliases.ts +2 -0
  2231. package/node_modules/zod/src/v3/helpers/util.ts +224 -0
  2232. package/node_modules/zod/src/v3/index.ts +4 -0
  2233. package/node_modules/zod/src/v3/locales/en.ts +124 -0
  2234. package/node_modules/zod/src/v3/standard-schema.ts +113 -0
  2235. package/node_modules/zod/src/v3/tests/Mocker.ts +54 -0
  2236. package/node_modules/zod/src/v3/tests/all-errors.test.ts +157 -0
  2237. package/node_modules/zod/src/v3/tests/anyunknown.test.ts +28 -0
  2238. package/node_modules/zod/src/v3/tests/array.test.ts +71 -0
  2239. package/node_modules/zod/src/v3/tests/async-parsing.test.ts +388 -0
  2240. package/node_modules/zod/src/v3/tests/async-refinements.test.ts +46 -0
  2241. package/node_modules/zod/src/v3/tests/base.test.ts +29 -0
  2242. package/node_modules/zod/src/v3/tests/bigint.test.ts +55 -0
  2243. package/node_modules/zod/src/v3/tests/branded.test.ts +53 -0
  2244. package/node_modules/zod/src/v3/tests/catch.test.ts +220 -0
  2245. package/node_modules/zod/src/v3/tests/coerce.test.ts +133 -0
  2246. package/node_modules/zod/src/v3/tests/complex.test.ts +70 -0
  2247. package/node_modules/zod/src/v3/tests/custom.test.ts +31 -0
  2248. package/node_modules/zod/src/v3/tests/date.test.ts +32 -0
  2249. package/node_modules/zod/src/v3/tests/deepmasking.test.ts +186 -0
  2250. package/node_modules/zod/src/v3/tests/default.test.ts +112 -0
  2251. package/node_modules/zod/src/v3/tests/description.test.ts +33 -0
  2252. package/node_modules/zod/src/v3/tests/discriminated-unions.test.ts +315 -0
  2253. package/node_modules/zod/src/v3/tests/enum.test.ts +80 -0
  2254. package/node_modules/zod/src/v3/tests/error.test.ts +586 -0
  2255. package/node_modules/zod/src/v3/tests/firstparty.test.ts +87 -0
  2256. package/node_modules/zod/src/v3/tests/firstpartyschematypes.test.ts +21 -0
  2257. package/node_modules/zod/src/v3/tests/function.test.ts +261 -0
  2258. package/node_modules/zod/src/v3/tests/generics.test.ts +48 -0
  2259. package/node_modules/zod/src/v3/tests/instanceof.test.ts +37 -0
  2260. package/node_modules/zod/src/v3/tests/intersection.test.ts +128 -0
  2261. package/node_modules/zod/src/v3/tests/language-server.source.ts +76 -0
  2262. package/node_modules/zod/src/v3/tests/language-server.test.ts +206 -0
  2263. package/node_modules/zod/src/v3/tests/literal.test.ts +36 -0
  2264. package/node_modules/zod/src/v3/tests/map.test.ts +110 -0
  2265. package/node_modules/zod/src/v3/tests/masking.test.ts +4 -0
  2266. package/node_modules/zod/src/v3/tests/mocker.test.ts +19 -0
  2267. package/node_modules/zod/src/v3/tests/nan.test.ts +24 -0
  2268. package/node_modules/zod/src/v3/tests/nativeEnum.test.ts +87 -0
  2269. package/node_modules/zod/src/v3/tests/nullable.test.ts +42 -0
  2270. package/node_modules/zod/src/v3/tests/number.test.ts +176 -0
  2271. package/node_modules/zod/src/v3/tests/object-augmentation.test.ts +29 -0
  2272. package/node_modules/zod/src/v3/tests/object-in-es5-env.test.ts +29 -0
  2273. package/node_modules/zod/src/v3/tests/object.test.ts +431 -0
  2274. package/node_modules/zod/src/v3/tests/optional.test.ts +42 -0
  2275. package/node_modules/zod/src/v3/tests/parseUtil.test.ts +23 -0
  2276. package/node_modules/zod/src/v3/tests/parser.test.ts +41 -0
  2277. package/node_modules/zod/src/v3/tests/partials.test.ts +243 -0
  2278. package/node_modules/zod/src/v3/tests/pickomit.test.ts +111 -0
  2279. package/node_modules/zod/src/v3/tests/pipeline.test.ts +29 -0
  2280. package/node_modules/zod/src/v3/tests/preprocess.test.ts +186 -0
  2281. package/node_modules/zod/src/v3/tests/primitive.test.ts +440 -0
  2282. package/node_modules/zod/src/v3/tests/promise.test.ts +90 -0
  2283. package/node_modules/zod/src/v3/tests/readonly.test.ts +114 -0
  2284. package/node_modules/zod/src/v3/tests/record.test.ts +171 -0
  2285. package/node_modules/zod/src/v3/tests/recursive.test.ts +197 -0
  2286. package/node_modules/zod/src/v3/tests/refine.test.ts +313 -0
  2287. package/node_modules/zod/src/v3/tests/safeparse.test.ts +27 -0
  2288. package/node_modules/zod/src/v3/tests/set.test.ts +142 -0
  2289. package/node_modules/zod/src/v3/tests/standard-schema.test.ts +83 -0
  2290. package/node_modules/zod/src/v3/tests/string.test.ts +922 -0
  2291. package/node_modules/zod/src/v3/tests/transformer.test.ts +233 -0
  2292. package/node_modules/zod/src/v3/tests/tuple.test.ts +90 -0
  2293. package/node_modules/zod/src/v3/tests/unions.test.ts +57 -0
  2294. package/node_modules/zod/src/v3/tests/validations.test.ts +133 -0
  2295. package/node_modules/zod/src/v3/tests/void.test.ts +15 -0
  2296. package/node_modules/zod/src/v3/types.ts +5138 -0
  2297. package/node_modules/zod/src/v4/classic/checks.ts +33 -0
  2298. package/node_modules/zod/src/v4/classic/coerce.ts +27 -0
  2299. package/node_modules/zod/src/v4/classic/compat.ts +78 -0
  2300. package/node_modules/zod/src/v4/classic/deep-partial.ts +76 -0
  2301. package/node_modules/zod/src/v4/classic/errors.ts +97 -0
  2302. package/node_modules/zod/src/v4/classic/external.ts +57 -0
  2303. package/node_modules/zod/src/v4/classic/from-json-schema.ts +944 -0
  2304. package/node_modules/zod/src/v4/classic/in-out.ts +45 -0
  2305. package/node_modules/zod/src/v4/classic/index.ts +5 -0
  2306. package/node_modules/zod/src/v4/classic/iso.ts +20 -0
  2307. package/node_modules/zod/src/v4/classic/parse.ts +88 -0
  2308. package/node_modules/zod/src/v4/classic/schemas.ts +2937 -0
  2309. package/node_modules/zod/src/v4/classic/tests/anyunknown.test.ts +26 -0
  2310. package/node_modules/zod/src/v4/classic/tests/apply.test.ts +86 -0
  2311. package/node_modules/zod/src/v4/classic/tests/array.test.ts +291 -0
  2312. package/node_modules/zod/src/v4/classic/tests/assignability.test.ts +402 -0
  2313. package/node_modules/zod/src/v4/classic/tests/async-parsing.test.ts +381 -0
  2314. package/node_modules/zod/src/v4/classic/tests/async-refinements.test.ts +68 -0
  2315. package/node_modules/zod/src/v4/classic/tests/base.test.ts +7 -0
  2316. package/node_modules/zod/src/v4/classic/tests/bigint.test.ts +89 -0
  2317. package/node_modules/zod/src/v4/classic/tests/brand.test.ts +106 -0
  2318. package/node_modules/zod/src/v4/classic/tests/catch.test.ts +604 -0
  2319. package/node_modules/zod/src/v4/classic/tests/coalesce.test.ts +20 -0
  2320. package/node_modules/zod/src/v4/classic/tests/codec-examples.test.ts +572 -0
  2321. package/node_modules/zod/src/v4/classic/tests/codec.test.ts +704 -0
  2322. package/node_modules/zod/src/v4/classic/tests/coerce.test.ts +160 -0
  2323. package/node_modules/zod/src/v4/classic/tests/continuability.test.ts +374 -0
  2324. package/node_modules/zod/src/v4/classic/tests/credit-card.test.ts +76 -0
  2325. package/node_modules/zod/src/v4/classic/tests/custom.test.ts +40 -0
  2326. package/node_modules/zod/src/v4/classic/tests/cyclic-data.test.ts +985 -0
  2327. package/node_modules/zod/src/v4/classic/tests/date.test.ts +92 -0
  2328. package/node_modules/zod/src/v4/classic/tests/datetime.test.ts +316 -0
  2329. package/node_modules/zod/src/v4/classic/tests/deep-partial.test.ts +380 -0
  2330. package/node_modules/zod/src/v4/classic/tests/default-locale.test.ts +32 -0
  2331. package/node_modules/zod/src/v4/classic/tests/default.test.ts +455 -0
  2332. package/node_modules/zod/src/v4/classic/tests/describe-meta-checks.test.ts +27 -0
  2333. package/node_modules/zod/src/v4/classic/tests/description.test.ts +32 -0
  2334. package/node_modules/zod/src/v4/classic/tests/detached-methods.test.ts +221 -0
  2335. package/node_modules/zod/src/v4/classic/tests/discriminated-unions.test.ts +942 -0
  2336. package/node_modules/zod/src/v4/classic/tests/enum.test.ts +305 -0
  2337. package/node_modules/zod/src/v4/classic/tests/error-utils.test.ts +917 -0
  2338. package/node_modules/zod/src/v4/classic/tests/error.test.ts +1108 -0
  2339. package/node_modules/zod/src/v4/classic/tests/file.test.ts +96 -0
  2340. package/node_modules/zod/src/v4/classic/tests/firstparty.test.ts +179 -0
  2341. package/node_modules/zod/src/v4/classic/tests/fix-json-issue.test.ts +26 -0
  2342. package/node_modules/zod/src/v4/classic/tests/from-json-schema.test.ts +1467 -0
  2343. package/node_modules/zod/src/v4/classic/tests/function.test.ts +391 -0
  2344. package/node_modules/zod/src/v4/classic/tests/generics.test.ts +72 -0
  2345. package/node_modules/zod/src/v4/classic/tests/global-config.test.ts +32 -0
  2346. package/node_modules/zod/src/v4/classic/tests/hash.test.ts +67 -0
  2347. package/node_modules/zod/src/v4/classic/tests/iban.test.ts +81 -0
  2348. package/node_modules/zod/src/v4/classic/tests/in-out.test.ts +159 -0
  2349. package/node_modules/zod/src/v4/classic/tests/index.test.ts +958 -0
  2350. package/node_modules/zod/src/v4/classic/tests/instance-footprint.test.ts +319 -0
  2351. package/node_modules/zod/src/v4/classic/tests/instanceof.test.ts +127 -0
  2352. package/node_modules/zod/src/v4/classic/tests/intersection.test.ts +334 -0
  2353. package/node_modules/zod/src/v4/classic/tests/issue-schema.test.ts +215 -0
  2354. package/node_modules/zod/src/v4/classic/tests/jitless-allows-eval.test.ts +39 -0
  2355. package/node_modules/zod/src/v4/classic/tests/json.test.ts +109 -0
  2356. package/node_modules/zod/src/v4/classic/tests/lazy.test.ts +262 -0
  2357. package/node_modules/zod/src/v4/classic/tests/literal.test.ts +128 -0
  2358. package/node_modules/zod/src/v4/classic/tests/locales_ka.test.ts +29 -0
  2359. package/node_modules/zod/src/v4/classic/tests/locales_ro.test.ts +24 -0
  2360. package/node_modules/zod/src/v4/classic/tests/map.test.ts +349 -0
  2361. package/node_modules/zod/src/v4/classic/tests/nan.test.ts +21 -0
  2362. package/node_modules/zod/src/v4/classic/tests/nested-refine.test.ts +168 -0
  2363. package/node_modules/zod/src/v4/classic/tests/nonoptional.test.ts +101 -0
  2364. package/node_modules/zod/src/v4/classic/tests/nullable.test.ts +22 -0
  2365. package/node_modules/zod/src/v4/classic/tests/number.test.ts +401 -0
  2366. package/node_modules/zod/src/v4/classic/tests/object.test.ts +1006 -0
  2367. package/node_modules/zod/src/v4/classic/tests/optin-ladder.test.ts +235 -0
  2368. package/node_modules/zod/src/v4/classic/tests/optional.test.ts +366 -0
  2369. package/node_modules/zod/src/v4/classic/tests/partial.test.ts +497 -0
  2370. package/node_modules/zod/src/v4/classic/tests/pickomit.test.ts +211 -0
  2371. package/node_modules/zod/src/v4/classic/tests/pipe.test.ts +101 -0
  2372. package/node_modules/zod/src/v4/classic/tests/prefault.test.ts +144 -0
  2373. package/node_modules/zod/src/v4/classic/tests/preprocess-types.test.ts +44 -0
  2374. package/node_modules/zod/src/v4/classic/tests/preprocess.test.ts +351 -0
  2375. package/node_modules/zod/src/v4/classic/tests/primitive.test.ts +175 -0
  2376. package/node_modules/zod/src/v4/classic/tests/promise.test.ts +81 -0
  2377. package/node_modules/zod/src/v4/classic/tests/properties.test.ts +141 -0
  2378. package/node_modules/zod/src/v4/classic/tests/prototypes.test.ts +23 -0
  2379. package/node_modules/zod/src/v4/classic/tests/readonly.test.ts +184 -0
  2380. package/node_modules/zod/src/v4/classic/tests/record.test.ts +885 -0
  2381. package/node_modules/zod/src/v4/classic/tests/recursive-types.test.ts +707 -0
  2382. package/node_modules/zod/src/v4/classic/tests/redos.test.ts +68 -0
  2383. package/node_modules/zod/src/v4/classic/tests/refine.test.ts +693 -0
  2384. package/node_modules/zod/src/v4/classic/tests/registries.test.ts +243 -0
  2385. package/node_modules/zod/src/v4/classic/tests/set.test.ts +196 -0
  2386. package/node_modules/zod/src/v4/classic/tests/standard-schema.test.ts +153 -0
  2387. package/node_modules/zod/src/v4/classic/tests/string-formats.test.ts +125 -0
  2388. package/node_modules/zod/src/v4/classic/tests/string.test.ts +1440 -0
  2389. package/node_modules/zod/src/v4/classic/tests/stringbool.test.ts +124 -0
  2390. package/node_modules/zod/src/v4/classic/tests/template-literal.test.ts +812 -0
  2391. package/node_modules/zod/src/v4/classic/tests/to-json-schema-methods.test.ts +438 -0
  2392. package/node_modules/zod/src/v4/classic/tests/to-json-schema.test.ts +4733 -0
  2393. package/node_modules/zod/src/v4/classic/tests/transform.test.ts +378 -0
  2394. package/node_modules/zod/src/v4/classic/tests/tuple.test.ts +511 -0
  2395. package/node_modules/zod/src/v4/classic/tests/union.test.ts +310 -0
  2396. package/node_modules/zod/src/v4/classic/tests/url.test.ts +13 -0
  2397. package/node_modules/zod/src/v4/classic/tests/validate.test.ts +645 -0
  2398. package/node_modules/zod/src/v4/classic/tests/validations.test.ts +283 -0
  2399. package/node_modules/zod/src/v4/classic/tests/void.test.ts +12 -0
  2400. package/node_modules/zod/src/v4/core/api.ts +1875 -0
  2401. package/node_modules/zod/src/v4/core/checks.ts +1266 -0
  2402. package/node_modules/zod/src/v4/core/compile.ts +2322 -0
  2403. package/node_modules/zod/src/v4/core/core.ts +230 -0
  2404. package/node_modules/zod/src/v4/core/doc.ts +52 -0
  2405. package/node_modules/zod/src/v4/core/errors.ts +543 -0
  2406. package/node_modules/zod/src/v4/core/index.ts +19 -0
  2407. package/node_modules/zod/src/v4/core/json-schema-generator.ts +131 -0
  2408. package/node_modules/zod/src/v4/core/json-schema-processors.ts +934 -0
  2409. package/node_modules/zod/src/v4/core/json-schema.ts +148 -0
  2410. package/node_modules/zod/src/v4/core/memoizer.ts +331 -0
  2411. package/node_modules/zod/src/v4/core/parse.ts +309 -0
  2412. package/node_modules/zod/src/v4/core/regexes.ts +217 -0
  2413. package/node_modules/zod/src/v4/core/registries.ts +105 -0
  2414. package/node_modules/zod/src/v4/core/schemas.ts +5226 -0
  2415. package/node_modules/zod/src/v4/core/standard-schema.ts +159 -0
  2416. package/node_modules/zod/src/v4/core/tests/cached.test.ts +54 -0
  2417. package/node_modules/zod/src/v4/core/tests/compile-differential.test.ts +1004 -0
  2418. package/node_modules/zod/src/v4/core/tests/compile-generative.test.ts +445 -0
  2419. package/node_modules/zod/src/v4/core/tests/compile-global.test.ts +89 -0
  2420. package/node_modules/zod/src/v4/core/tests/compile-off-by-default.test.ts +26 -0
  2421. package/node_modules/zod/src/v4/core/tests/compile-stats.test.ts +34 -0
  2422. package/node_modules/zod/src/v4/core/tests/compile.test.ts +2036 -0
  2423. package/node_modules/zod/src/v4/core/tests/email-regex.test.ts +140 -0
  2424. package/node_modules/zod/src/v4/core/tests/extend.test.ts +59 -0
  2425. package/node_modules/zod/src/v4/core/tests/index.test.ts +46 -0
  2426. package/node_modules/zod/src/v4/core/tests/locales/be.test.ts +124 -0
  2427. package/node_modules/zod/src/v4/core/tests/locales/el.test.ts +214 -0
  2428. package/node_modules/zod/src/v4/core/tests/locales/en.test.ts +22 -0
  2429. package/node_modules/zod/src/v4/core/tests/locales/es.test.ts +180 -0
  2430. package/node_modules/zod/src/v4/core/tests/locales/fr.test.ts +72 -0
  2431. package/node_modules/zod/src/v4/core/tests/locales/he.test.ts +379 -0
  2432. package/node_modules/zod/src/v4/core/tests/locales/hr.test.ts +163 -0
  2433. package/node_modules/zod/src/v4/core/tests/locales/nl.test.ts +46 -0
  2434. package/node_modules/zod/src/v4/core/tests/locales/parity.test.ts +42 -0
  2435. package/node_modules/zod/src/v4/core/tests/locales/ru.test.ts +128 -0
  2436. package/node_modules/zod/src/v4/core/tests/locales/tg.test.ts +85 -0
  2437. package/node_modules/zod/src/v4/core/tests/locales/tk.test.ts +69 -0
  2438. package/node_modules/zod/src/v4/core/tests/locales/tr.test.ts +69 -0
  2439. package/node_modules/zod/src/v4/core/tests/locales/uz.test.ts +105 -0
  2440. package/node_modules/zod/src/v4/core/tests/polyfill-collision.test.ts +46 -0
  2441. package/node_modules/zod/src/v4/core/tests/record-constructor.test.ts +125 -0
  2442. package/node_modules/zod/src/v4/core/tests/recursive-tuples.test.ts +45 -0
  2443. package/node_modules/zod/src/v4/core/tests/treeshake.test.ts +51 -0
  2444. package/node_modules/zod/src/v4/core/tests/url-no-canparse.test.ts +133 -0
  2445. package/node_modules/zod/src/v4/core/to-json-schema.ts +857 -0
  2446. package/node_modules/zod/src/v4/core/util.ts +1293 -0
  2447. package/node_modules/zod/src/v4/core/versions.ts +5 -0
  2448. package/node_modules/zod/src/v4/core/visit.ts +193 -0
  2449. package/node_modules/zod/src/v4/core/zsf.ts +323 -0
  2450. package/node_modules/zod/src/v4/index.ts +4 -0
  2451. package/node_modules/zod/src/v4/locales/ar.ts +120 -0
  2452. package/node_modules/zod/src/v4/locales/az.ts +116 -0
  2453. package/node_modules/zod/src/v4/locales/be.ts +188 -0
  2454. package/node_modules/zod/src/v4/locales/bg.ts +133 -0
  2455. package/node_modules/zod/src/v4/locales/bn.ts +123 -0
  2456. package/node_modules/zod/src/v4/locales/ca.ts +121 -0
  2457. package/node_modules/zod/src/v4/locales/ckb.ts +140 -0
  2458. package/node_modules/zod/src/v4/locales/cs.ts +123 -0
  2459. package/node_modules/zod/src/v4/locales/da.ts +128 -0
  2460. package/node_modules/zod/src/v4/locales/de.ts +121 -0
  2461. package/node_modules/zod/src/v4/locales/el.ts +124 -0
  2462. package/node_modules/zod/src/v4/locales/en.ts +136 -0
  2463. package/node_modules/zod/src/v4/locales/eo.ts +123 -0
  2464. package/node_modules/zod/src/v4/locales/es.ts +145 -0
  2465. package/node_modules/zod/src/v4/locales/fa.ts +131 -0
  2466. package/node_modules/zod/src/v4/locales/fi.ts +126 -0
  2467. package/node_modules/zod/src/v4/locales/fr-CA.ts +121 -0
  2468. package/node_modules/zod/src/v4/locales/fr.ts +139 -0
  2469. package/node_modules/zod/src/v4/locales/gu.ts +123 -0
  2470. package/node_modules/zod/src/v4/locales/he.ts +253 -0
  2471. package/node_modules/zod/src/v4/locales/hi.ts +126 -0
  2472. package/node_modules/zod/src/v4/locales/hr.ts +135 -0
  2473. package/node_modules/zod/src/v4/locales/hu.ts +122 -0
  2474. package/node_modules/zod/src/v4/locales/hy.ts +175 -0
  2475. package/node_modules/zod/src/v4/locales/id.ts +120 -0
  2476. package/node_modules/zod/src/v4/locales/index.ts +63 -0
  2477. package/node_modules/zod/src/v4/locales/is.ts +124 -0
  2478. package/node_modules/zod/src/v4/locales/it.ts +121 -0
  2479. package/node_modules/zod/src/v4/locales/ja.ts +119 -0
  2480. package/node_modules/zod/src/v4/locales/ka.ts +128 -0
  2481. package/node_modules/zod/src/v4/locales/kh.ts +7 -0
  2482. package/node_modules/zod/src/v4/locales/km.ts +124 -0
  2483. package/node_modules/zod/src/v4/locales/kn.ts +126 -0
  2484. package/node_modules/zod/src/v4/locales/ko.ts +126 -0
  2485. package/node_modules/zod/src/v4/locales/lt.ts +243 -0
  2486. package/node_modules/zod/src/v4/locales/mk.ts +123 -0
  2487. package/node_modules/zod/src/v4/locales/ms.ts +120 -0
  2488. package/node_modules/zod/src/v4/locales/ne.ts +128 -0
  2489. package/node_modules/zod/src/v4/locales/nl.ts +126 -0
  2490. package/node_modules/zod/src/v4/locales/nn.ts +121 -0
  2491. package/node_modules/zod/src/v4/locales/no.ts +121 -0
  2492. package/node_modules/zod/src/v4/locales/ota.ts +122 -0
  2493. package/node_modules/zod/src/v4/locales/pl.ts +123 -0
  2494. package/node_modules/zod/src/v4/locales/ps.ts +131 -0
  2495. package/node_modules/zod/src/v4/locales/pt-BR.ts +161 -0
  2496. package/node_modules/zod/src/v4/locales/pt.ts +159 -0
  2497. package/node_modules/zod/src/v4/locales/ro.ts +132 -0
  2498. package/node_modules/zod/src/v4/locales/ru.ts +188 -0
  2499. package/node_modules/zod/src/v4/locales/sk.ts +123 -0
  2500. package/node_modules/zod/src/v4/locales/sl.ts +123 -0
  2501. package/node_modules/zod/src/v4/locales/sv.ts +124 -0
  2502. package/node_modules/zod/src/v4/locales/ta.ts +123 -0
  2503. package/node_modules/zod/src/v4/locales/tg.ts +135 -0
  2504. package/node_modules/zod/src/v4/locales/th.ts +124 -0
  2505. package/node_modules/zod/src/v4/locales/tk.ts +113 -0
  2506. package/node_modules/zod/src/v4/locales/tr.ts +116 -0
  2507. package/node_modules/zod/src/v4/locales/ua.ts +7 -0
  2508. package/node_modules/zod/src/v4/locales/uk.ts +122 -0
  2509. package/node_modules/zod/src/v4/locales/ur.ts +124 -0
  2510. package/node_modules/zod/src/v4/locales/uz.ts +120 -0
  2511. package/node_modules/zod/src/v4/locales/vi.ts +122 -0
  2512. package/node_modules/zod/src/v4/locales/yo.ts +129 -0
  2513. package/node_modules/zod/src/v4/locales/zh-CN.ts +121 -0
  2514. package/node_modules/zod/src/v4/locales/zh-TW.ts +120 -0
  2515. package/node_modules/zod/src/v4/mini/checks.ts +33 -0
  2516. package/node_modules/zod/src/v4/mini/coerce.ts +27 -0
  2517. package/node_modules/zod/src/v4/mini/deep-partial.ts +73 -0
  2518. package/node_modules/zod/src/v4/mini/external.ts +52 -0
  2519. package/node_modules/zod/src/v4/mini/in-out.ts +45 -0
  2520. package/node_modules/zod/src/v4/mini/index.ts +3 -0
  2521. package/node_modules/zod/src/v4/mini/iso.ts +66 -0
  2522. package/node_modules/zod/src/v4/mini/parse.ts +16 -0
  2523. package/node_modules/zod/src/v4/mini/schemas.ts +2051 -0
  2524. package/node_modules/zod/src/v4/mini/tests/apply.test.ts +57 -0
  2525. package/node_modules/zod/src/v4/mini/tests/assignability.test.ts +190 -0
  2526. package/node_modules/zod/src/v4/mini/tests/brand.test.ts +94 -0
  2527. package/node_modules/zod/src/v4/mini/tests/checks.test.ts +158 -0
  2528. package/node_modules/zod/src/v4/mini/tests/codec.test.ts +582 -0
  2529. package/node_modules/zod/src/v4/mini/tests/computed.test.ts +30 -0
  2530. package/node_modules/zod/src/v4/mini/tests/cyclic-data.test.ts +84 -0
  2531. package/node_modules/zod/src/v4/mini/tests/deep-partial.test.ts +54 -0
  2532. package/node_modules/zod/src/v4/mini/tests/error.test.ts +41 -0
  2533. package/node_modules/zod/src/v4/mini/tests/functions.test.ts +14 -0
  2534. package/node_modules/zod/src/v4/mini/tests/index.test.ts +1146 -0
  2535. package/node_modules/zod/src/v4/mini/tests/number.test.ts +109 -0
  2536. package/node_modules/zod/src/v4/mini/tests/object.test.ts +292 -0
  2537. package/node_modules/zod/src/v4/mini/tests/prototypes.test.ts +43 -0
  2538. package/node_modules/zod/src/v4/mini/tests/recursive-types.test.ts +341 -0
  2539. package/node_modules/zod/src/v4/mini/tests/standard-schema.test.ts +50 -0
  2540. package/node_modules/zod/src/v4/mini/tests/string.test.ts +396 -0
  2541. package/node_modules/zod/src/v4-mini/index.ts +3 -0
  2542. package/node_modules/zod/v3/ZodError.cjs +167 -0
  2543. package/node_modules/zod/v3/ZodError.d.cts +164 -0
  2544. package/node_modules/zod/v3/ZodError.d.ts +164 -0
  2545. package/node_modules/zod/v3/ZodError.js +143 -0
  2546. package/node_modules/zod/v3/errors.cjs +36 -0
  2547. package/node_modules/zod/v3/errors.d.cts +5 -0
  2548. package/node_modules/zod/v3/errors.d.ts +5 -0
  2549. package/node_modules/zod/v3/errors.js +9 -0
  2550. package/node_modules/zod/v3/external.cjs +41 -0
  2551. package/node_modules/zod/v3/external.d.cts +6 -0
  2552. package/node_modules/zod/v3/external.d.ts +6 -0
  2553. package/node_modules/zod/v3/external.js +6 -0
  2554. package/node_modules/zod/v3/helpers/enumUtil.cjs +21 -0
  2555. package/node_modules/zod/v3/helpers/enumUtil.d.cts +8 -0
  2556. package/node_modules/zod/v3/helpers/enumUtil.d.ts +8 -0
  2557. package/node_modules/zod/v3/helpers/enumUtil.js +1 -0
  2558. package/node_modules/zod/v3/helpers/errorUtil.cjs +28 -0
  2559. package/node_modules/zod/v3/helpers/errorUtil.d.cts +9 -0
  2560. package/node_modules/zod/v3/helpers/errorUtil.d.ts +9 -0
  2561. package/node_modules/zod/v3/helpers/errorUtil.js +6 -0
  2562. package/node_modules/zod/v3/helpers/parseUtil.cjs +143 -0
  2563. package/node_modules/zod/v3/helpers/parseUtil.d.cts +78 -0
  2564. package/node_modules/zod/v3/helpers/parseUtil.d.ts +78 -0
  2565. package/node_modules/zod/v3/helpers/parseUtil.js +109 -0
  2566. package/node_modules/zod/v3/helpers/partialUtil.cjs +21 -0
  2567. package/node_modules/zod/v3/helpers/partialUtil.d.cts +8 -0
  2568. package/node_modules/zod/v3/helpers/partialUtil.d.ts +8 -0
  2569. package/node_modules/zod/v3/helpers/partialUtil.js +1 -0
  2570. package/node_modules/zod/v3/helpers/typeAliases.cjs +21 -0
  2571. package/node_modules/zod/v3/helpers/typeAliases.d.cts +2 -0
  2572. package/node_modules/zod/v3/helpers/typeAliases.d.ts +2 -0
  2573. package/node_modules/zod/v3/helpers/typeAliases.js +1 -0
  2574. package/node_modules/zod/v3/helpers/util.cjs +156 -0
  2575. package/node_modules/zod/v3/helpers/util.d.cts +85 -0
  2576. package/node_modules/zod/v3/helpers/util.d.ts +85 -0
  2577. package/node_modules/zod/v3/helpers/util.js +133 -0
  2578. package/node_modules/zod/v3/index.cjs +52 -0
  2579. package/node_modules/zod/v3/index.d.cts +4 -0
  2580. package/node_modules/zod/v3/index.d.ts +4 -0
  2581. package/node_modules/zod/v3/index.js +4 -0
  2582. package/node_modules/zod/v3/locales/en.cjs +112 -0
  2583. package/node_modules/zod/v3/locales/en.d.cts +3 -0
  2584. package/node_modules/zod/v3/locales/en.d.ts +3 -0
  2585. package/node_modules/zod/v3/locales/en.js +109 -0
  2586. package/node_modules/zod/v3/package.json +7 -0
  2587. package/node_modules/zod/v3/standard-schema.cjs +21 -0
  2588. package/node_modules/zod/v3/standard-schema.d.cts +102 -0
  2589. package/node_modules/zod/v3/standard-schema.d.ts +102 -0
  2590. package/node_modules/zod/v3/standard-schema.js +1 -0
  2591. package/node_modules/zod/v3/types.cjs +3798 -0
  2592. package/node_modules/zod/v3/types.d.cts +1034 -0
  2593. package/node_modules/zod/v3/types.d.ts +1034 -0
  2594. package/node_modules/zod/v3/types.js +3697 -0
  2595. package/node_modules/zod/v4/classic/checks.cjs +53 -0
  2596. package/node_modules/zod/v4/classic/checks.d.cts +1 -0
  2597. package/node_modules/zod/v4/classic/checks.d.ts +1 -0
  2598. package/node_modules/zod/v4/classic/checks.js +1 -0
  2599. package/node_modules/zod/v4/classic/coerce.cjs +66 -0
  2600. package/node_modules/zod/v4/classic/coerce.d.cts +17 -0
  2601. package/node_modules/zod/v4/classic/coerce.d.ts +17 -0
  2602. package/node_modules/zod/v4/classic/coerce.js +17 -0
  2603. package/node_modules/zod/v4/classic/compat.cjs +80 -0
  2604. package/node_modules/zod/v4/classic/compat.d.cts +48 -0
  2605. package/node_modules/zod/v4/classic/compat.d.ts +48 -0
  2606. package/node_modules/zod/v4/classic/compat.js +31 -0
  2607. package/node_modules/zod/v4/classic/deep-partial.cjs +58 -0
  2608. package/node_modules/zod/v4/classic/deep-partial.d.cts +14 -0
  2609. package/node_modules/zod/v4/classic/deep-partial.d.ts +14 -0
  2610. package/node_modules/zod/v4/classic/deep-partial.js +13 -0
  2611. package/node_modules/zod/v4/classic/errors.cjs +102 -0
  2612. package/node_modules/zod/v4/classic/errors.d.cts +29 -0
  2613. package/node_modules/zod/v4/classic/errors.d.ts +29 -0
  2614. package/node_modules/zod/v4/classic/errors.js +57 -0
  2615. package/node_modules/zod/v4/classic/external.cjs +97 -0
  2616. package/node_modules/zod/v4/classic/external.d.cts +19 -0
  2617. package/node_modules/zod/v4/classic/external.d.ts +19 -0
  2618. package/node_modules/zod/v4/classic/external.js +17 -0
  2619. package/node_modules/zod/v4/classic/from-json-schema.cjs +926 -0
  2620. package/node_modules/zod/v4/classic/from-json-schema.d.cts +12 -0
  2621. package/node_modules/zod/v4/classic/from-json-schema.d.ts +12 -0
  2622. package/node_modules/zod/v4/classic/from-json-schema.js +881 -0
  2623. package/node_modules/zod/v4/classic/in-out.cjs +82 -0
  2624. package/node_modules/zod/v4/classic/in-out.d.cts +8 -0
  2625. package/node_modules/zod/v4/classic/in-out.d.ts +8 -0
  2626. package/node_modules/zod/v4/classic/in-out.js +36 -0
  2627. package/node_modules/zod/v4/classic/index.cjs +52 -0
  2628. package/node_modules/zod/v4/classic/index.d.cts +3 -0
  2629. package/node_modules/zod/v4/classic/index.d.ts +3 -0
  2630. package/node_modules/zod/v4/classic/index.js +4 -0
  2631. package/node_modules/zod/v4/classic/iso.cjs +68 -0
  2632. package/node_modules/zod/v4/classic/iso.d.cts +7 -0
  2633. package/node_modules/zod/v4/classic/iso.d.ts +7 -0
  2634. package/node_modules/zod/v4/classic/iso.js +15 -0
  2635. package/node_modules/zod/v4/classic/package.json +7 -0
  2636. package/node_modules/zod/v4/classic/parse.cjs +63 -0
  2637. package/node_modules/zod/v4/classic/parse.d.cts +44 -0
  2638. package/node_modules/zod/v4/classic/parse.d.ts +44 -0
  2639. package/node_modules/zod/v4/classic/parse.js +16 -0
  2640. package/node_modules/zod/v4/classic/schemas.cjs +1676 -0
  2641. package/node_modules/zod/v4/classic/schemas.d.cts +816 -0
  2642. package/node_modules/zod/v4/classic/schemas.d.ts +816 -0
  2643. package/node_modules/zod/v4/classic/schemas.js +1535 -0
  2644. package/node_modules/zod/v4/core/api.cjs +1269 -0
  2645. package/node_modules/zod/v4/core/api.d.cts +335 -0
  2646. package/node_modules/zod/v4/core/api.d.ts +335 -0
  2647. package/node_modules/zod/v4/core/api.js +1107 -0
  2648. package/node_modules/zod/v4/core/checks.cjs +561 -0
  2649. package/node_modules/zod/v4/core/checks.d.cts +294 -0
  2650. package/node_modules/zod/v4/core/checks.d.ts +294 -0
  2651. package/node_modules/zod/v4/core/checks.js +516 -0
  2652. package/node_modules/zod/v4/core/compile.cjs +1916 -0
  2653. package/node_modules/zod/v4/core/compile.d.cts +65 -0
  2654. package/node_modules/zod/v4/core/compile.d.ts +65 -0
  2655. package/node_modules/zod/v4/core/compile.js +1866 -0
  2656. package/node_modules/zod/v4/core/core.cjs +167 -0
  2657. package/node_modules/zod/v4/core/core.d.cts +82 -0
  2658. package/node_modules/zod/v4/core/core.d.ts +82 -0
  2659. package/node_modules/zod/v4/core/core.js +141 -0
  2660. package/node_modules/zod/v4/core/doc.cjs +61 -0
  2661. package/node_modules/zod/v4/core/doc.d.cts +16 -0
  2662. package/node_modules/zod/v4/core/doc.d.ts +16 -0
  2663. package/node_modules/zod/v4/core/doc.js +38 -0
  2664. package/node_modules/zod/v4/core/errors.cjs +317 -0
  2665. package/node_modules/zod/v4/core/errors.d.cts +225 -0
  2666. package/node_modules/zod/v4/core/errors.d.ts +225 -0
  2667. package/node_modules/zod/v4/core/errors.js +267 -0
  2668. package/node_modules/zod/v4/core/index.cjs +70 -0
  2669. package/node_modules/zod/v4/core/index.d.cts +19 -0
  2670. package/node_modules/zod/v4/core/index.d.ts +19 -0
  2671. package/node_modules/zod/v4/core/index.js +19 -0
  2672. package/node_modules/zod/v4/core/json-schema-generator.cjs +122 -0
  2673. package/node_modules/zod/v4/core/json-schema-generator.d.cts +65 -0
  2674. package/node_modules/zod/v4/core/json-schema-generator.d.ts +65 -0
  2675. package/node_modules/zod/v4/core/json-schema-generator.js +99 -0
  2676. package/node_modules/zod/v4/core/json-schema-processors.cjs +929 -0
  2677. package/node_modules/zod/v4/core/json-schema-processors.d.cts +65 -0
  2678. package/node_modules/zod/v4/core/json-schema-processors.d.ts +65 -0
  2679. package/node_modules/zod/v4/core/json-schema-processors.js +843 -0
  2680. package/node_modules/zod/v4/core/json-schema.cjs +21 -0
  2681. package/node_modules/zod/v4/core/json-schema.d.cts +89 -0
  2682. package/node_modules/zod/v4/core/json-schema.d.ts +89 -0
  2683. package/node_modules/zod/v4/core/json-schema.js +1 -0
  2684. package/node_modules/zod/v4/core/memoizer.cjs +360 -0
  2685. package/node_modules/zod/v4/core/memoizer.d.cts +15 -0
  2686. package/node_modules/zod/v4/core/memoizer.d.ts +15 -0
  2687. package/node_modules/zod/v4/core/memoizer.js +311 -0
  2688. package/node_modules/zod/v4/core/package.json +7 -0
  2689. package/node_modules/zod/v4/core/parse.cjs +233 -0
  2690. package/node_modules/zod/v4/core/parse.d.cts +52 -0
  2691. package/node_modules/zod/v4/core/parse.d.ts +52 -0
  2692. package/node_modules/zod/v4/core/parse.js +175 -0
  2693. package/node_modules/zod/v4/core/regexes.cjs +209 -0
  2694. package/node_modules/zod/v4/core/regexes.d.cts +90 -0
  2695. package/node_modules/zod/v4/core/regexes.d.ts +90 -0
  2696. package/node_modules/zod/v4/core/regexes.js +156 -0
  2697. package/node_modules/zod/v4/core/registries.cjs +75 -0
  2698. package/node_modules/zod/v4/core/registries.d.cts +35 -0
  2699. package/node_modules/zod/v4/core/registries.d.ts +35 -0
  2700. package/node_modules/zod/v4/core/registries.js +51 -0
  2701. package/node_modules/zod/v4/core/schemas.cjs +2699 -0
  2702. package/node_modules/zod/v4/core/schemas.d.cts +1275 -0
  2703. package/node_modules/zod/v4/core/schemas.d.ts +1275 -0
  2704. package/node_modules/zod/v4/core/schemas.js +2636 -0
  2705. package/node_modules/zod/v4/core/standard-schema.cjs +21 -0
  2706. package/node_modules/zod/v4/core/standard-schema.d.cts +126 -0
  2707. package/node_modules/zod/v4/core/standard-schema.d.ts +126 -0
  2708. package/node_modules/zod/v4/core/standard-schema.js +1 -0
  2709. package/node_modules/zod/v4/core/to-json-schema.cjs +681 -0
  2710. package/node_modules/zod/v4/core/to-json-schema.d.cts +154 -0
  2711. package/node_modules/zod/v4/core/to-json-schema.d.ts +154 -0
  2712. package/node_modules/zod/v4/core/to-json-schema.js +651 -0
  2713. package/node_modules/zod/v4/core/util.cjs +964 -0
  2714. package/node_modules/zod/v4/core/util.d.cts +280 -0
  2715. package/node_modules/zod/v4/core/util.d.ts +280 -0
  2716. package/node_modules/zod/v4/core/util.js +873 -0
  2717. package/node_modules/zod/v4/core/versions.cjs +27 -0
  2718. package/node_modules/zod/v4/core/versions.d.cts +5 -0
  2719. package/node_modules/zod/v4/core/versions.d.ts +5 -0
  2720. package/node_modules/zod/v4/core/versions.js +5 -0
  2721. package/node_modules/zod/v4/core/visit.cjs +214 -0
  2722. package/node_modules/zod/v4/core/visit.d.cts +30 -0
  2723. package/node_modules/zod/v4/core/visit.d.ts +30 -0
  2724. package/node_modules/zod/v4/core/visit.js +169 -0
  2725. package/node_modules/zod/v4/index.cjs +51 -0
  2726. package/node_modules/zod/v4/index.d.cts +3 -0
  2727. package/node_modules/zod/v4/index.d.ts +3 -0
  2728. package/node_modules/zod/v4/index.js +4 -0
  2729. package/node_modules/zod/v4/locales/ar.cjs +138 -0
  2730. package/node_modules/zod/v4/locales/ar.d.cts +5 -0
  2731. package/node_modules/zod/v4/locales/ar.d.ts +4 -0
  2732. package/node_modules/zod/v4/locales/ar.js +111 -0
  2733. package/node_modules/zod/v4/locales/az.cjs +137 -0
  2734. package/node_modules/zod/v4/locales/az.d.cts +5 -0
  2735. package/node_modules/zod/v4/locales/az.d.ts +4 -0
  2736. package/node_modules/zod/v4/locales/az.js +110 -0
  2737. package/node_modules/zod/v4/locales/be.cjs +195 -0
  2738. package/node_modules/zod/v4/locales/be.d.cts +5 -0
  2739. package/node_modules/zod/v4/locales/be.d.ts +4 -0
  2740. package/node_modules/zod/v4/locales/be.js +168 -0
  2741. package/node_modules/zod/v4/locales/bg.cjs +152 -0
  2742. package/node_modules/zod/v4/locales/bg.d.cts +5 -0
  2743. package/node_modules/zod/v4/locales/bg.d.ts +4 -0
  2744. package/node_modules/zod/v4/locales/bg.js +125 -0
  2745. package/node_modules/zod/v4/locales/bn.cjs +140 -0
  2746. package/node_modules/zod/v4/locales/bn.d.cts +5 -0
  2747. package/node_modules/zod/v4/locales/bn.d.ts +4 -0
  2748. package/node_modules/zod/v4/locales/bn.js +113 -0
  2749. package/node_modules/zod/v4/locales/ca.cjs +139 -0
  2750. package/node_modules/zod/v4/locales/ca.d.cts +5 -0
  2751. package/node_modules/zod/v4/locales/ca.d.ts +4 -0
  2752. package/node_modules/zod/v4/locales/ca.js +112 -0
  2753. package/node_modules/zod/v4/locales/ckb.cjs +160 -0
  2754. package/node_modules/zod/v4/locales/ckb.d.cts +5 -0
  2755. package/node_modules/zod/v4/locales/ckb.d.ts +4 -0
  2756. package/node_modules/zod/v4/locales/ckb.js +133 -0
  2757. package/node_modules/zod/v4/locales/cs.cjs +143 -0
  2758. package/node_modules/zod/v4/locales/cs.d.cts +5 -0
  2759. package/node_modules/zod/v4/locales/cs.d.ts +4 -0
  2760. package/node_modules/zod/v4/locales/cs.js +116 -0
  2761. package/node_modules/zod/v4/locales/da.cjs +147 -0
  2762. package/node_modules/zod/v4/locales/da.d.cts +5 -0
  2763. package/node_modules/zod/v4/locales/da.d.ts +4 -0
  2764. package/node_modules/zod/v4/locales/da.js +120 -0
  2765. package/node_modules/zod/v4/locales/de.cjs +140 -0
  2766. package/node_modules/zod/v4/locales/de.d.cts +5 -0
  2767. package/node_modules/zod/v4/locales/de.d.ts +4 -0
  2768. package/node_modules/zod/v4/locales/de.js +113 -0
  2769. package/node_modules/zod/v4/locales/el.cjs +139 -0
  2770. package/node_modules/zod/v4/locales/el.d.cts +5 -0
  2771. package/node_modules/zod/v4/locales/el.d.ts +4 -0
  2772. package/node_modules/zod/v4/locales/el.js +112 -0
  2773. package/node_modules/zod/v4/locales/en.cjs +152 -0
  2774. package/node_modules/zod/v4/locales/en.d.cts +5 -0
  2775. package/node_modules/zod/v4/locales/en.d.ts +4 -0
  2776. package/node_modules/zod/v4/locales/en.js +125 -0
  2777. package/node_modules/zod/v4/locales/eo.cjs +141 -0
  2778. package/node_modules/zod/v4/locales/eo.d.cts +5 -0
  2779. package/node_modules/zod/v4/locales/eo.d.ts +4 -0
  2780. package/node_modules/zod/v4/locales/eo.js +114 -0
  2781. package/node_modules/zod/v4/locales/es.cjs +163 -0
  2782. package/node_modules/zod/v4/locales/es.d.cts +5 -0
  2783. package/node_modules/zod/v4/locales/es.d.ts +4 -0
  2784. package/node_modules/zod/v4/locales/es.js +136 -0
  2785. package/node_modules/zod/v4/locales/fa.cjs +146 -0
  2786. package/node_modules/zod/v4/locales/fa.d.cts +5 -0
  2787. package/node_modules/zod/v4/locales/fa.d.ts +4 -0
  2788. package/node_modules/zod/v4/locales/fa.js +119 -0
  2789. package/node_modules/zod/v4/locales/fi.cjs +144 -0
  2790. package/node_modules/zod/v4/locales/fi.d.cts +5 -0
  2791. package/node_modules/zod/v4/locales/fi.d.ts +4 -0
  2792. package/node_modules/zod/v4/locales/fi.js +117 -0
  2793. package/node_modules/zod/v4/locales/fr-CA.cjs +139 -0
  2794. package/node_modules/zod/v4/locales/fr-CA.d.cts +5 -0
  2795. package/node_modules/zod/v4/locales/fr-CA.d.ts +4 -0
  2796. package/node_modules/zod/v4/locales/fr-CA.js +112 -0
  2797. package/node_modules/zod/v4/locales/fr.cjs +156 -0
  2798. package/node_modules/zod/v4/locales/fr.d.cts +5 -0
  2799. package/node_modules/zod/v4/locales/fr.d.ts +4 -0
  2800. package/node_modules/zod/v4/locales/fr.js +129 -0
  2801. package/node_modules/zod/v4/locales/gu.cjs +140 -0
  2802. package/node_modules/zod/v4/locales/gu.d.cts +5 -0
  2803. package/node_modules/zod/v4/locales/gu.d.ts +4 -0
  2804. package/node_modules/zod/v4/locales/gu.js +113 -0
  2805. package/node_modules/zod/v4/locales/he.cjs +248 -0
  2806. package/node_modules/zod/v4/locales/he.d.cts +5 -0
  2807. package/node_modules/zod/v4/locales/he.d.ts +4 -0
  2808. package/node_modules/zod/v4/locales/he.js +221 -0
  2809. package/node_modules/zod/v4/locales/hi.cjs +138 -0
  2810. package/node_modules/zod/v4/locales/hi.d.cts +5 -0
  2811. package/node_modules/zod/v4/locales/hi.d.ts +4 -0
  2812. package/node_modules/zod/v4/locales/hi.js +111 -0
  2813. package/node_modules/zod/v4/locales/hr.cjs +153 -0
  2814. package/node_modules/zod/v4/locales/hr.d.cts +5 -0
  2815. package/node_modules/zod/v4/locales/hr.d.ts +4 -0
  2816. package/node_modules/zod/v4/locales/hr.js +126 -0
  2817. package/node_modules/zod/v4/locales/hu.cjs +140 -0
  2818. package/node_modules/zod/v4/locales/hu.d.cts +5 -0
  2819. package/node_modules/zod/v4/locales/hu.d.ts +4 -0
  2820. package/node_modules/zod/v4/locales/hu.js +113 -0
  2821. package/node_modules/zod/v4/locales/hy.cjs +185 -0
  2822. package/node_modules/zod/v4/locales/hy.d.cts +5 -0
  2823. package/node_modules/zod/v4/locales/hy.d.ts +4 -0
  2824. package/node_modules/zod/v4/locales/hy.js +158 -0
  2825. package/node_modules/zod/v4/locales/id.cjs +138 -0
  2826. package/node_modules/zod/v4/locales/id.d.cts +5 -0
  2827. package/node_modules/zod/v4/locales/id.d.ts +4 -0
  2828. package/node_modules/zod/v4/locales/id.js +111 -0
  2829. package/node_modules/zod/v4/locales/index.cjs +152 -0
  2830. package/node_modules/zod/v4/locales/index.d.cts +63 -0
  2831. package/node_modules/zod/v4/locales/index.d.ts +63 -0
  2832. package/node_modules/zod/v4/locales/index.js +63 -0
  2833. package/node_modules/zod/v4/locales/is.cjs +141 -0
  2834. package/node_modules/zod/v4/locales/is.d.cts +5 -0
  2835. package/node_modules/zod/v4/locales/is.d.ts +4 -0
  2836. package/node_modules/zod/v4/locales/is.js +114 -0
  2837. package/node_modules/zod/v4/locales/it.cjs +140 -0
  2838. package/node_modules/zod/v4/locales/it.d.cts +5 -0
  2839. package/node_modules/zod/v4/locales/it.d.ts +4 -0
  2840. package/node_modules/zod/v4/locales/it.js +113 -0
  2841. package/node_modules/zod/v4/locales/ja.cjs +139 -0
  2842. package/node_modules/zod/v4/locales/ja.d.cts +5 -0
  2843. package/node_modules/zod/v4/locales/ja.d.ts +4 -0
  2844. package/node_modules/zod/v4/locales/ja.js +112 -0
  2845. package/node_modules/zod/v4/locales/ka.cjs +144 -0
  2846. package/node_modules/zod/v4/locales/ka.d.cts +5 -0
  2847. package/node_modules/zod/v4/locales/ka.d.ts +4 -0
  2848. package/node_modules/zod/v4/locales/ka.js +117 -0
  2849. package/node_modules/zod/v4/locales/kh.cjs +12 -0
  2850. package/node_modules/zod/v4/locales/kh.d.cts +5 -0
  2851. package/node_modules/zod/v4/locales/kh.d.ts +5 -0
  2852. package/node_modules/zod/v4/locales/kh.js +5 -0
  2853. package/node_modules/zod/v4/locales/km.cjs +142 -0
  2854. package/node_modules/zod/v4/locales/km.d.cts +5 -0
  2855. package/node_modules/zod/v4/locales/km.d.ts +4 -0
  2856. package/node_modules/zod/v4/locales/km.js +115 -0
  2857. package/node_modules/zod/v4/locales/kn.cjs +143 -0
  2858. package/node_modules/zod/v4/locales/kn.d.cts +5 -0
  2859. package/node_modules/zod/v4/locales/kn.d.ts +4 -0
  2860. package/node_modules/zod/v4/locales/kn.js +116 -0
  2861. package/node_modules/zod/v4/locales/ko.cjs +143 -0
  2862. package/node_modules/zod/v4/locales/ko.d.cts +5 -0
  2863. package/node_modules/zod/v4/locales/ko.d.ts +4 -0
  2864. package/node_modules/zod/v4/locales/ko.js +116 -0
  2865. package/node_modules/zod/v4/locales/lt.cjs +234 -0
  2866. package/node_modules/zod/v4/locales/lt.d.cts +5 -0
  2867. package/node_modules/zod/v4/locales/lt.d.ts +4 -0
  2868. package/node_modules/zod/v4/locales/lt.js +207 -0
  2869. package/node_modules/zod/v4/locales/mk.cjs +141 -0
  2870. package/node_modules/zod/v4/locales/mk.d.cts +5 -0
  2871. package/node_modules/zod/v4/locales/mk.d.ts +4 -0
  2872. package/node_modules/zod/v4/locales/mk.js +114 -0
  2873. package/node_modules/zod/v4/locales/ms.cjs +139 -0
  2874. package/node_modules/zod/v4/locales/ms.d.cts +5 -0
  2875. package/node_modules/zod/v4/locales/ms.d.ts +4 -0
  2876. package/node_modules/zod/v4/locales/ms.js +112 -0
  2877. package/node_modules/zod/v4/locales/ne.cjs +138 -0
  2878. package/node_modules/zod/v4/locales/ne.d.cts +5 -0
  2879. package/node_modules/zod/v4/locales/ne.d.ts +4 -0
  2880. package/node_modules/zod/v4/locales/ne.js +111 -0
  2881. package/node_modules/zod/v4/locales/nl.cjs +142 -0
  2882. package/node_modules/zod/v4/locales/nl.d.cts +5 -0
  2883. package/node_modules/zod/v4/locales/nl.d.ts +4 -0
  2884. package/node_modules/zod/v4/locales/nl.js +115 -0
  2885. package/node_modules/zod/v4/locales/nn.cjs +140 -0
  2886. package/node_modules/zod/v4/locales/nn.d.cts +5 -0
  2887. package/node_modules/zod/v4/locales/nn.d.ts +4 -0
  2888. package/node_modules/zod/v4/locales/nn.js +113 -0
  2889. package/node_modules/zod/v4/locales/no.cjs +140 -0
  2890. package/node_modules/zod/v4/locales/no.d.cts +5 -0
  2891. package/node_modules/zod/v4/locales/no.d.ts +4 -0
  2892. package/node_modules/zod/v4/locales/no.js +113 -0
  2893. package/node_modules/zod/v4/locales/ota.cjs +141 -0
  2894. package/node_modules/zod/v4/locales/ota.d.cts +5 -0
  2895. package/node_modules/zod/v4/locales/ota.d.ts +4 -0
  2896. package/node_modules/zod/v4/locales/ota.js +114 -0
  2897. package/node_modules/zod/v4/locales/package.json +7 -0
  2898. package/node_modules/zod/v4/locales/pl.cjs +141 -0
  2899. package/node_modules/zod/v4/locales/pl.d.cts +5 -0
  2900. package/node_modules/zod/v4/locales/pl.d.ts +4 -0
  2901. package/node_modules/zod/v4/locales/pl.js +114 -0
  2902. package/node_modules/zod/v4/locales/ps.cjs +146 -0
  2903. package/node_modules/zod/v4/locales/ps.d.cts +5 -0
  2904. package/node_modules/zod/v4/locales/ps.d.ts +4 -0
  2905. package/node_modules/zod/v4/locales/ps.js +119 -0
  2906. package/node_modules/zod/v4/locales/pt-BR.cjs +170 -0
  2907. package/node_modules/zod/v4/locales/pt-BR.d.cts +5 -0
  2908. package/node_modules/zod/v4/locales/pt-BR.d.ts +4 -0
  2909. package/node_modules/zod/v4/locales/pt-BR.js +143 -0
  2910. package/node_modules/zod/v4/locales/pt.cjs +169 -0
  2911. package/node_modules/zod/v4/locales/pt.d.cts +5 -0
  2912. package/node_modules/zod/v4/locales/pt.d.ts +4 -0
  2913. package/node_modules/zod/v4/locales/pt.js +142 -0
  2914. package/node_modules/zod/v4/locales/ro.cjs +149 -0
  2915. package/node_modules/zod/v4/locales/ro.d.cts +5 -0
  2916. package/node_modules/zod/v4/locales/ro.d.ts +4 -0
  2917. package/node_modules/zod/v4/locales/ro.js +122 -0
  2918. package/node_modules/zod/v4/locales/ru.cjs +195 -0
  2919. package/node_modules/zod/v4/locales/ru.d.cts +5 -0
  2920. package/node_modules/zod/v4/locales/ru.d.ts +4 -0
  2921. package/node_modules/zod/v4/locales/ru.js +168 -0
  2922. package/node_modules/zod/v4/locales/sk.cjs +143 -0
  2923. package/node_modules/zod/v4/locales/sk.d.cts +5 -0
  2924. package/node_modules/zod/v4/locales/sk.d.ts +4 -0
  2925. package/node_modules/zod/v4/locales/sk.js +116 -0
  2926. package/node_modules/zod/v4/locales/sl.cjs +141 -0
  2927. package/node_modules/zod/v4/locales/sl.d.cts +5 -0
  2928. package/node_modules/zod/v4/locales/sl.d.ts +4 -0
  2929. package/node_modules/zod/v4/locales/sl.js +114 -0
  2930. package/node_modules/zod/v4/locales/sv.cjs +142 -0
  2931. package/node_modules/zod/v4/locales/sv.d.cts +5 -0
  2932. package/node_modules/zod/v4/locales/sv.d.ts +4 -0
  2933. package/node_modules/zod/v4/locales/sv.js +115 -0
  2934. package/node_modules/zod/v4/locales/ta.cjs +142 -0
  2935. package/node_modules/zod/v4/locales/ta.d.cts +5 -0
  2936. package/node_modules/zod/v4/locales/ta.d.ts +4 -0
  2937. package/node_modules/zod/v4/locales/ta.js +115 -0
  2938. package/node_modules/zod/v4/locales/tg.cjs +144 -0
  2939. package/node_modules/zod/v4/locales/tg.d.cts +5 -0
  2940. package/node_modules/zod/v4/locales/tg.d.ts +4 -0
  2941. package/node_modules/zod/v4/locales/tg.js +117 -0
  2942. package/node_modules/zod/v4/locales/th.cjs +142 -0
  2943. package/node_modules/zod/v4/locales/th.d.cts +5 -0
  2944. package/node_modules/zod/v4/locales/th.d.ts +4 -0
  2945. package/node_modules/zod/v4/locales/th.js +115 -0
  2946. package/node_modules/zod/v4/locales/tk.cjs +134 -0
  2947. package/node_modules/zod/v4/locales/tk.d.cts +5 -0
  2948. package/node_modules/zod/v4/locales/tk.d.ts +4 -0
  2949. package/node_modules/zod/v4/locales/tk.js +107 -0
  2950. package/node_modules/zod/v4/locales/tr.cjs +137 -0
  2951. package/node_modules/zod/v4/locales/tr.d.cts +5 -0
  2952. package/node_modules/zod/v4/locales/tr.d.ts +4 -0
  2953. package/node_modules/zod/v4/locales/tr.js +110 -0
  2954. package/node_modules/zod/v4/locales/ua.cjs +12 -0
  2955. package/node_modules/zod/v4/locales/ua.d.cts +5 -0
  2956. package/node_modules/zod/v4/locales/ua.d.ts +5 -0
  2957. package/node_modules/zod/v4/locales/ua.js +5 -0
  2958. package/node_modules/zod/v4/locales/uk.cjs +140 -0
  2959. package/node_modules/zod/v4/locales/uk.d.cts +5 -0
  2960. package/node_modules/zod/v4/locales/uk.d.ts +4 -0
  2961. package/node_modules/zod/v4/locales/uk.js +113 -0
  2962. package/node_modules/zod/v4/locales/ur.cjs +142 -0
  2963. package/node_modules/zod/v4/locales/ur.d.cts +5 -0
  2964. package/node_modules/zod/v4/locales/ur.d.ts +4 -0
  2965. package/node_modules/zod/v4/locales/ur.js +115 -0
  2966. package/node_modules/zod/v4/locales/uz.cjs +140 -0
  2967. package/node_modules/zod/v4/locales/uz.d.cts +5 -0
  2968. package/node_modules/zod/v4/locales/uz.d.ts +4 -0
  2969. package/node_modules/zod/v4/locales/uz.js +113 -0
  2970. package/node_modules/zod/v4/locales/vi.cjs +140 -0
  2971. package/node_modules/zod/v4/locales/vi.d.cts +5 -0
  2972. package/node_modules/zod/v4/locales/vi.d.ts +4 -0
  2973. package/node_modules/zod/v4/locales/vi.js +113 -0
  2974. package/node_modules/zod/v4/locales/yo.cjs +139 -0
  2975. package/node_modules/zod/v4/locales/yo.d.cts +5 -0
  2976. package/node_modules/zod/v4/locales/yo.d.ts +4 -0
  2977. package/node_modules/zod/v4/locales/yo.js +112 -0
  2978. package/node_modules/zod/v4/locales/zh-CN.cjs +141 -0
  2979. package/node_modules/zod/v4/locales/zh-CN.d.cts +5 -0
  2980. package/node_modules/zod/v4/locales/zh-CN.d.ts +4 -0
  2981. package/node_modules/zod/v4/locales/zh-CN.js +114 -0
  2982. package/node_modules/zod/v4/locales/zh-TW.cjs +139 -0
  2983. package/node_modules/zod/v4/locales/zh-TW.d.cts +5 -0
  2984. package/node_modules/zod/v4/locales/zh-TW.d.ts +4 -0
  2985. package/node_modules/zod/v4/locales/zh-TW.js +112 -0
  2986. package/node_modules/zod/v4/mini/checks.cjs +54 -0
  2987. package/node_modules/zod/v4/mini/checks.d.cts +1 -0
  2988. package/node_modules/zod/v4/mini/checks.d.ts +1 -0
  2989. package/node_modules/zod/v4/mini/checks.js +1 -0
  2990. package/node_modules/zod/v4/mini/coerce.cjs +71 -0
  2991. package/node_modules/zod/v4/mini/coerce.d.cts +7 -0
  2992. package/node_modules/zod/v4/mini/coerce.d.ts +7 -0
  2993. package/node_modules/zod/v4/mini/coerce.js +22 -0
  2994. package/node_modules/zod/v4/mini/deep-partial.cjs +58 -0
  2995. package/node_modules/zod/v4/mini/deep-partial.d.cts +14 -0
  2996. package/node_modules/zod/v4/mini/deep-partial.d.ts +14 -0
  2997. package/node_modules/zod/v4/mini/deep-partial.js +13 -0
  2998. package/node_modules/zod/v4/mini/external.cjs +95 -0
  2999. package/node_modules/zod/v4/mini/external.d.cts +16 -0
  3000. package/node_modules/zod/v4/mini/external.d.ts +16 -0
  3001. package/node_modules/zod/v4/mini/external.js +16 -0
  3002. package/node_modules/zod/v4/mini/in-out.cjs +82 -0
  3003. package/node_modules/zod/v4/mini/in-out.d.cts +8 -0
  3004. package/node_modules/zod/v4/mini/in-out.d.ts +8 -0
  3005. package/node_modules/zod/v4/mini/in-out.js +36 -0
  3006. package/node_modules/zod/v4/mini/index.cjs +51 -0
  3007. package/node_modules/zod/v4/mini/index.d.cts +3 -0
  3008. package/node_modules/zod/v4/mini/index.d.ts +3 -0
  3009. package/node_modules/zod/v4/mini/index.js +3 -0
  3010. package/node_modules/zod/v4/mini/iso.cjs +83 -0
  3011. package/node_modules/zod/v4/mini/iso.d.cts +22 -0
  3012. package/node_modules/zod/v4/mini/iso.d.ts +22 -0
  3013. package/node_modules/zod/v4/mini/iso.js +34 -0
  3014. package/node_modules/zod/v4/mini/package.json +7 -0
  3015. package/node_modules/zod/v4/mini/parse.cjs +37 -0
  3016. package/node_modules/zod/v4/mini/parse.d.cts +1 -0
  3017. package/node_modules/zod/v4/mini/parse.d.ts +1 -0
  3018. package/node_modules/zod/v4/mini/parse.js +1 -0
  3019. package/node_modules/zod/v4/mini/schemas.cjs +1147 -0
  3020. package/node_modules/zod/v4/mini/schemas.d.cts +480 -0
  3021. package/node_modules/zod/v4/mini/schemas.d.ts +480 -0
  3022. package/node_modules/zod/v4/mini/schemas.js +1002 -0
  3023. package/node_modules/zod/v4/package.json +7 -0
  3024. package/node_modules/zod/v4-mini/index.cjs +51 -0
  3025. package/node_modules/zod/v4-mini/index.d.cts +3 -0
  3026. package/node_modules/zod/v4-mini/index.d.ts +3 -0
  3027. package/node_modules/zod/v4-mini/index.js +3 -0
  3028. package/node_modules/zod/v4-mini/package.json +7 -0
  3029. package/package.json +73 -4
@@ -0,0 +1,4018 @@
1
+ import fs from "node:fs/promises";
2
+ import { execFile } from "node:child_process";
3
+ import { promisify } from "node:util";
4
+ import net from "node:net";
5
+ import os from "node:os";
6
+ import path from "node:path";
7
+ import { randomBytes, randomUUID } from "node:crypto";
8
+ import { githubLauncherSource } from "./github-launcher.js";
9
+ import { ACP_PROCESS_TERMINAL_SIGNALS } from "./acpx-engine/constants.js";
10
+ import { prepareCommandManagedRuntime, } from "./command-managed-runtime.js";
11
+ import { buildRemoteExecutionSessionIdentity, prepareRemoteManagedRuntime, remoteExecutionSessionMatches, } from "./remote-managed-runtime.js";
12
+ export { resolveReferencedSourceIgnore } from "./sandbox-managed-runtime.js";
13
+ import { createCommandManagedSandboxCallbackBridgeQueueClient, createSandboxCallbackBridgeAsset, createSandboxCallbackBridgeToken, DEFAULT_SANDBOX_CALLBACK_BRIDGE_MAX_BODY_BYTES, HTTP2_SANDBOX_CALLBACK_BRIDGE_ROUTE_ALLOWLIST, runSandboxBridgeControlCommand, SANDBOX_CALLBACK_BRIDGE_HTTP2_MODE, sandboxCallbackBridgeDirectories, startSandboxCallbackBridgeServer, startSandboxCallbackBridgeWorker, syncRemoteTextFileWithHashSkip, syncRemoteTextFilesWithHashSkip, syncSandboxCallbackBridgeEntrypoint, } from "./sandbox-callback-bridge.js";
14
+ import { createHttp2BridgeServer, BridgeProcessCapacityError, } from "./http2-bridge-server.js";
15
+ import { createSandboxRunLogTailFactory, } from "./sandbox-run-log-stream.js";
16
+ import { DEFAULT_DUPLEX_BROKER_BUDGETS, DUPLEX_CHANNEL_LOST_ERROR_CODE, isSafeBridgeMethod, } from "./bridge-transport-contract.js";
17
+ import { decodeDuplexLine, DEFAULT_MAX_DUPLEX_FRAME_BYTES } from "./duplex-frame-codec.js";
18
+ import { createDuplexObservability, mapHttp2EventToDuplexLossReason, } from "./duplex-observability.js";
19
+ import { createSshCommandManagedRuntimeRunner, parseSshRemoteExecutionSpec, runSshCommand, shellQuote } from "./ssh.js";
20
+ import { ensureAbsoluteDirectory, ensureCommandResolvable, resolveCommandForLogs, runChildProcess, } from "./server-utils.js";
21
+ import { sanitizeRemoteExecutionEnv } from "./remote-execution-env.js";
22
+ import { preferredShellForSandbox, shellCommandArgs } from "./sandbox-shell.js";
23
+ import { runWithRuntimeParent, } from "./acpx-engine/startup-timing.js";
24
+ export function postedIssueCommentLogMarker(method, requestPath, status, body) {
25
+ if (method !== "POST" || !/^\/api\/issues\/[^/]+\/comments$/.test(requestPath) || status < 200 || status >= 300) {
26
+ return null;
27
+ }
28
+ const bodyText = typeof body === "string" ? body : body.toString("utf8");
29
+ try {
30
+ const parsed = JSON.parse(bodyText);
31
+ return typeof parsed.id === "string" && parsed.id.length > 0 ? `comment id: ${parsed.id}\n` : null;
32
+ }
33
+ catch {
34
+ return null;
35
+ }
36
+ }
37
+ export { sanitizeRemoteExecutionEnv } from "./remote-execution-env.js";
38
+ export { managedRemoteHomeEnvironment } from "./remote-execution-env.js";
39
+ // Four-hour wall-clock backstop for sandbox-backed adapter runs. Keep this
40
+ // execution limit independent of the earlier informational silence warnings
41
+ // and the short deadlines for bridge control operations.
42
+ export const DEFAULT_REMOTE_SANDBOX_ADAPTER_TIMEOUT_SEC = 14_400;
43
+ function parseObject(value) {
44
+ return value && typeof value === "object" && !Array.isArray(value)
45
+ ? value
46
+ : {};
47
+ }
48
+ function readString(value) {
49
+ return typeof value === "string" && value.trim().length > 0 ? value.trim() : null;
50
+ }
51
+ // Read a serialized effective-capability snapshot back into a full record. A
52
+ // missing or non-boolean field reads as `false`, so a round-tripped target
53
+ // never grants a capability that the snapshot did not carry. Returns null when
54
+ // there is no object to read.
55
+ function parseEffectiveExecutionCapabilities(value) {
56
+ const parsed = parseObject(value);
57
+ if (Object.keys(parsed).length === 0)
58
+ return null;
59
+ return {
60
+ reusableLeases: parsed.reusableLeases === true,
61
+ nativeSyncIn: parsed.nativeSyncIn === true,
62
+ nativeSyncOut: parsed.nativeSyncOut === true,
63
+ persistentProcessSessions: parsed.persistentProcessSessions === true,
64
+ independentControlCommands: parsed.independentControlCommands === true,
65
+ incrementalSessionOutput: parsed.incrementalSessionOutput === true,
66
+ concurrentSyncOperations: parsed.concurrentSyncOperations === true,
67
+ duplexCommandStream: parsed.duplexCommandStream === true,
68
+ runnerWebSocketIngress: parsed.runnerWebSocketIngress === true,
69
+ };
70
+ }
71
+ function readStringMeta(parsed, key) {
72
+ return readString(parsed[key]);
73
+ }
74
+ function resolveHostForUrl(rawHost) {
75
+ const host = rawHost.trim();
76
+ // Preserve the wildcard bind's address family: a server bound to 0.0.0.0
77
+ // accepts IPv4, so target the IPv4 loopback (and [::1] for ::) instead of
78
+ // "localhost", which the resolver may map to the other family.
79
+ if (host === "0.0.0.0")
80
+ return "127.0.0.1";
81
+ if (host === "::")
82
+ return "[::1]";
83
+ if (!host)
84
+ return "localhost";
85
+ if (host.includes(":") && !host.startsWith("[") && !host.endsWith("]"))
86
+ return `[${host}]`;
87
+ return host;
88
+ }
89
+ function resolveDefaultPaperclipApiUrl() {
90
+ const runtimeHost = resolveHostForUrl(process.env.PAPERCLIP_LISTEN_HOST ?? process.env.HOST ?? "localhost");
91
+ // 3100 matches the default Paperclip dev server port when the runtime does not provide one.
92
+ const runtimePort = process.env.PAPERCLIP_LISTEN_PORT ?? process.env.PORT ?? "3100";
93
+ return `http://${runtimeHost}:${runtimePort}`;
94
+ }
95
+ function isBridgeDebugEnabled(env) {
96
+ const value = env.PAPERCLIP_BRIDGE_DEBUG?.trim().toLowerCase();
97
+ return value === "1" || value === "true" || value === "yes";
98
+ }
99
+ function isAdapterExecutionTargetInstance(value) {
100
+ const parsed = parseObject(value);
101
+ if (parsed.kind === "local")
102
+ return true;
103
+ if (parsed.kind !== "remote")
104
+ return false;
105
+ if (parsed.transport === "ssh")
106
+ return parseSshRemoteExecutionSpec(parseObject(parsed.spec)) !== null;
107
+ if (parsed.transport !== "sandbox")
108
+ return false;
109
+ return readStringMeta(parsed, "remoteCwd") !== null;
110
+ }
111
+ export function adapterExecutionTargetToRemoteSpec(target) {
112
+ return target?.kind === "remote" && target.transport === "ssh" ? target.spec : null;
113
+ }
114
+ export function adapterExecutionTargetIsRemote(target) {
115
+ return target?.kind === "remote";
116
+ }
117
+ export function adapterExecutionTargetUsesManagedHome(target, managedAiConnection = false) {
118
+ return target?.kind === "remote" && (target.transport === "sandbox" || (managedAiConnection && target.spec.useHostAuth === false));
119
+ }
120
+ /**
121
+ * Read the per-run duplex bridge kill switch off a target. Only a sandbox
122
+ * target with `enableSandboxDuplexBridge` set to `true` returns `true`. Every
123
+ * other target and every other value returns `false`, so the caller fails
124
+ * closed to the file bridge.
125
+ */
126
+ export function adapterExecutionTargetEnablesSandboxDuplexBridge(target) {
127
+ return (target?.kind === "remote" &&
128
+ target.transport === "sandbox" &&
129
+ target.enableSandboxDuplexBridge === true);
130
+ }
131
+ /**
132
+ * Read the injected duplex observability recorder off a target. Only a
133
+ * sandbox target with a recorder attached returns it. Every other target
134
+ * returns null, so the bridge falls back to the safe no-op recorder.
135
+ */
136
+ export function adapterExecutionTargetDuplexObservabilityRecorder(target) {
137
+ return target?.kind === "remote" && target.transport === "sandbox"
138
+ ? target.duplexObservabilityRecorder ?? null
139
+ : null;
140
+ }
141
+ export function adapterExecutionTargetRemoteCwd(target, localCwd) {
142
+ return target?.kind === "remote" ? target.remoteCwd : localCwd;
143
+ }
144
+ export function overrideAdapterExecutionTargetRemoteCwd(target, remoteCwd) {
145
+ const nextRemoteCwd = remoteCwd?.trim();
146
+ if (!target || target.kind !== "remote" || !nextRemoteCwd) {
147
+ return target;
148
+ }
149
+ if (target.remoteCwd === nextRemoteCwd) {
150
+ return target;
151
+ }
152
+ if (target.transport === "ssh") {
153
+ return {
154
+ ...target,
155
+ remoteCwd: nextRemoteCwd,
156
+ spec: {
157
+ ...target.spec,
158
+ remoteCwd: nextRemoteCwd,
159
+ },
160
+ };
161
+ }
162
+ return {
163
+ ...target,
164
+ remoteCwd: nextRemoteCwd,
165
+ };
166
+ }
167
+ export function resolveAdapterExecutionTargetCwd(target, configuredCwd, localFallbackCwd) {
168
+ if (typeof configuredCwd === "string" && configuredCwd.trim().length > 0) {
169
+ return configuredCwd;
170
+ }
171
+ return adapterExecutionTargetRemoteCwd(target, localFallbackCwd);
172
+ }
173
+ export function adapterExecutionTargetUsesPaperclipBridge(target) {
174
+ return target?.kind === "remote";
175
+ }
176
+ export function describeAdapterExecutionTarget(target) {
177
+ if (!target || target.kind === "local")
178
+ return "local environment";
179
+ if (target.transport === "ssh") {
180
+ return `SSH environment ${target.spec.username}@${target.spec.host}:${target.spec.port}`;
181
+ }
182
+ return `sandbox environment${target.providerKey ? ` (${target.providerKey})` : ""}`;
183
+ }
184
+ export function resolveAdapterExecutionTargetTimeout(target, configuredTimeoutSec) {
185
+ if (typeof configuredTimeoutSec === "number" && Number.isFinite(configuredTimeoutSec)) {
186
+ // Preserve fractional (sub-second) configured values instead of flooring:
187
+ // adapters historically honored e.g. timeoutSec=0.5, and flooring would
188
+ // silently turn it into "no timeout".
189
+ if (configuredTimeoutSec > 0) {
190
+ return { timeoutSec: configuredTimeoutSec, source: "configured" };
191
+ }
192
+ // A negative timeoutSec is the explicit "no adapter wall-clock timeout"
193
+ // opt-out, honored even on sandbox targets. Zero cannot carry that
194
+ // meaning: the adapter config UI persists the schema default of 0 for
195
+ // untouched fields, so timeoutSec=0 in stored config does not signal
196
+ // operator intent and falls through to target defaults below.
197
+ if (configuredTimeoutSec < 0) {
198
+ return { timeoutSec: 0, source: "configured" };
199
+ }
200
+ }
201
+ // Local and SSH adapters preserve the historical "0 means no adapter
202
+ // timeout" behavior. Sandbox-backed runs execute through provider RPCs
203
+ // that usually apply their own shorter command defaults, so request an
204
+ // explicit longer timeout for full adapter runs when the adapter leaves
205
+ // timeoutSec unset.
206
+ if (target?.kind === "remote" && target.transport === "sandbox") {
207
+ return { timeoutSec: DEFAULT_REMOTE_SANDBOX_ADAPTER_TIMEOUT_SEC, source: "sandbox_default" };
208
+ }
209
+ return { timeoutSec: 0, source: "unlimited" };
210
+ }
211
+ export function resolveAdapterExecutionTargetTimeoutSec(target, configuredTimeoutSec) {
212
+ return resolveAdapterExecutionTargetTimeout(target, configuredTimeoutSec).timeoutSec;
213
+ }
214
+ function describeAdapterExecutionTimeoutSource(source) {
215
+ switch (source) {
216
+ case "configured":
217
+ return "configured via adapterConfig.timeoutSec";
218
+ case "sandbox_default":
219
+ return "sandbox default";
220
+ case "unlimited":
221
+ return "no adapter wall-clock timeout";
222
+ }
223
+ }
224
+ /**
225
+ * Self-describing error message for when the adapter wall-clock execution
226
+ * timeout kills a run. Names the timer that fired and the knob that controls
227
+ * it so run failures never surface as a bare "Timed out".
228
+ */
229
+ export function formatAdapterExecutionTimeoutErrorMessage(resolution) {
230
+ return (`Run exceeded the adapter execution timeout ` +
231
+ `(timeoutSec=${resolution.timeoutSec}, ${describeAdapterExecutionTimeoutSource(resolution.source)}). ` +
232
+ `Set adapterConfig.timeoutSec to raise it.`);
233
+ }
234
+ /**
235
+ * One-line start-of-run statement of the effective wall-clock timeout and its
236
+ * source. Callers prefix with `[paperclip] ` and append a newline.
237
+ */
238
+ export function formatAdapterExecutionTimeoutStartLogLine(resolution) {
239
+ if (resolution.timeoutSec <= 0) {
240
+ if (resolution.source === "configured") {
241
+ return ("Adapter execution timeout: none " +
242
+ "(explicitly disabled via adapterConfig.timeoutSec; set it to a positive value to add one).");
243
+ }
244
+ return ("Adapter execution timeout: none " +
245
+ "(no adapter wall-clock timeout for this target; set adapterConfig.timeoutSec to add one).");
246
+ }
247
+ return (`Adapter execution timeout: timeoutSec=${resolution.timeoutSec} ` +
248
+ `(${describeAdapterExecutionTimeoutSource(resolution.source)}; set adapterConfig.timeoutSec to override).`);
249
+ }
250
+ function requireSandboxRunner(target) {
251
+ if (target.runner)
252
+ return target.runner;
253
+ throw new Error("Sandbox execution target is missing its provider runtime runner. Sandbox commands must execute through the environment runtime.");
254
+ }
255
+ function preferredSandboxShell(target) {
256
+ return preferredShellForSandbox(target.shellCommand);
257
+ }
258
+ // The Secure Shell command runner's own output buffer. This value used to
259
+ // derive from the bridge body limit (`DEFAULT_SANDBOX_CALLBACK_BRIDGE_MAX_BODY_BYTES
260
+ // * 4`), so a bridge limit rise silently grew it too. It now stands on its
261
+ // own local constant, independent of the bridge body limit, so a later
262
+ // bridge limit change never resizes this buffer as a side effect.
263
+ const SSH_COMMAND_MAX_BUFFER_BYTES = 1024 * 1024;
264
+ function adapterExecutionTargetCommandRunner(target) {
265
+ if (target.transport === "ssh") {
266
+ return createSshCommandManagedRuntimeRunner({
267
+ spec: target.spec,
268
+ defaultCwd: target.remoteCwd,
269
+ maxBufferBytes: SSH_COMMAND_MAX_BUFFER_BYTES,
270
+ });
271
+ }
272
+ return requireSandboxRunner(target);
273
+ }
274
+ function adapterExecutionTargetShellCommand(target) {
275
+ return target.transport === "ssh" ? "sh" : preferredSandboxShell(target);
276
+ }
277
+ function adapterExecutionTargetTimeoutMs(target) {
278
+ return target.transport === "sandbox" ? target.timeoutMs : undefined;
279
+ }
280
+ export async function ensureAdapterExecutionTargetCommandResolvable(command, target, cwd, env, options = {}) {
281
+ if (target?.kind === "remote" && target.transport === "sandbox") {
282
+ await ensureSandboxCommandResolvable(command, target, sanitizeRemoteExecutionEnv(Object.fromEntries(Object.entries(env).filter((entry) => typeof entry[1] === "string"))), options.installCommand?.trim() || null, options.timeoutSec);
283
+ return;
284
+ }
285
+ await ensureCommandResolvable(command, cwd, env, {
286
+ remoteExecution: adapterExecutionTargetToRemoteSpec(target),
287
+ });
288
+ }
289
+ function executionTargetCheckUnavailable(message, cause) {
290
+ return Object.assign(new Error(message, { cause }), { code: "adapter_execution_target_unavailable" });
291
+ }
292
+ /** Preserve target failures before an adapter translates them into a failed check. */
293
+ export function isAdapterExecutionTargetUnavailableError(error) {
294
+ return typeof error === "object" && error !== null && "code" in error
295
+ && error.code === "adapter_execution_target_unavailable";
296
+ }
297
+ async function runRemoteExecutionTargetCheck(target, description, check) {
298
+ let result;
299
+ try {
300
+ result = await check();
301
+ }
302
+ catch (error) {
303
+ throw executionTargetCheckUnavailable(`Could not complete ${description}`, error);
304
+ }
305
+ if (result.timedOut || result.signal || result.exitCode === null
306
+ || (target.kind === "remote" && target.transport === "ssh" && result.exitCode === 255)) {
307
+ throw executionTargetCheckUnavailable(`${result.timedOut ? "Timed out" : "Could not complete"} ${description}`);
308
+ }
309
+ return result;
310
+ }
311
+ async function probeSandboxCommandResolvable(command, target, env) {
312
+ const runner = requireSandboxRunner(target);
313
+ const probeScript = `command -v ${shellQuote(command)}`;
314
+ const result = await runRemoteExecutionTargetCheck(target, `checking command "${command}" on sandbox target.`, () => runner.execute({
315
+ command: "sh",
316
+ args: ["-c", probeScript],
317
+ cwd: target.remoteCwd,
318
+ env,
319
+ timeoutMs: target.timeoutMs ?? 15_000,
320
+ }));
321
+ return {
322
+ resolved: result.exitCode === 0,
323
+ stderr: result.stderr.trim(),
324
+ };
325
+ }
326
+ async function ensureSandboxCommandResolvable(command, target, env, installCommand, timeoutSec) {
327
+ // Probe whether the binary is resolvable inside the sandbox. We previously
328
+ // short-circuited this for sandbox targets, which let the caller report a
329
+ // success message even when the CLI was missing from the image. Now we run
330
+ // a real `command -v` through the same runner the hello probe will use, so
331
+ // the first step honestly reflects whether the binary is on PATH. The
332
+ // sandbox provider is responsible for sourcing login profiles (e2b mirrors
333
+ // SSH's buildSshSpawnTarget) so this and the hello probe agree on PATH.
334
+ let probe = await probeSandboxCommandResolvable(command, target, env);
335
+ if (probe.resolved)
336
+ return;
337
+ // If the caller supplied an install command, attempt the install once via
338
+ // the sandbox runner (which the sandbox provider wraps in a login shell)
339
+ // and re-probe before reporting failure. This lets fresh sandbox leases
340
+ // bring up the CLI before the resolvability gate, mirroring the test path.
341
+ let installFailureDetail = null;
342
+ let installUnavailable = null;
343
+ if (installCommand) {
344
+ const runner = requireSandboxRunner(target);
345
+ const installTimeoutMs = typeof timeoutSec === "number" && Number.isFinite(timeoutSec) && timeoutSec > 0
346
+ ? Math.floor(timeoutSec * 1000)
347
+ : target.timeoutMs ?? 300_000;
348
+ try {
349
+ const installResult = await runner.execute({
350
+ command: "sh",
351
+ args: shellCommandArgs(installCommand),
352
+ cwd: target.remoteCwd,
353
+ env,
354
+ timeoutMs: installTimeoutMs,
355
+ });
356
+ if (installResult.timedOut) {
357
+ installFailureDetail = `install command timed out: ${installCommand}`;
358
+ installUnavailable = executionTargetCheckUnavailable("The runtime installation timed out.");
359
+ }
360
+ else if (installResult.signal || installResult.exitCode === null) {
361
+ installUnavailable = executionTargetCheckUnavailable("The runtime installation did not complete.");
362
+ }
363
+ else if ((installResult.exitCode ?? 0) !== 0) {
364
+ const tail = (text) => text.split(/\r?\n/).filter((line) => line.trim().length > 0).slice(-2).join(" | ").slice(0, 240);
365
+ const reason = tail(installResult.stderr || installResult.stdout) || `exit ${installResult.exitCode ?? "?"}`;
366
+ installFailureDetail = `install command exited ${installResult.exitCode ?? "?"}: ${reason}`;
367
+ }
368
+ }
369
+ catch (err) {
370
+ installFailureDetail = `install command threw: ${err instanceof Error ? err.message : String(err)}`;
371
+ installUnavailable = executionTargetCheckUnavailable("The runtime installation was unavailable.", err);
372
+ }
373
+ probe = await probeSandboxCommandResolvable(command, target, env);
374
+ if (probe.resolved)
375
+ return;
376
+ if (installUnavailable)
377
+ throw installUnavailable;
378
+ }
379
+ const probeStderr = probe.stderr.length > 0 ? ` probe stderr: ${probe.stderr}` : "";
380
+ const installDetail = installFailureDetail ? `; ${installFailureDetail}` : "";
381
+ throw new Error(`Command "${command}" is not installed or not on PATH in the sandbox environment${installDetail}.${probeStderr}`);
382
+ }
383
+ export async function resolveAdapterExecutionTargetCommandForLogs(command, target, cwd, env) {
384
+ if (target?.kind === "remote" && target.transport === "sandbox") {
385
+ return `sandbox://${target.providerKey ?? "provider"}/${target.leaseId ?? "lease"}/${target.remoteCwd} :: ${command}`;
386
+ }
387
+ return await resolveCommandForLogs(command, cwd, env, {
388
+ remoteExecution: adapterExecutionTargetToRemoteSpec(target),
389
+ });
390
+ }
391
+ // Apply the run-disposition seam to one clean process result. Only a clean
392
+ // completion is success-eligible: a timed-out, signalled, or non-zero-exit
393
+ // result is already a failure, so the seam leaves it unchanged. This is the same
394
+ // success-eligibility rule the ACP lane applies. For a success-eligible result
395
+ // the seam settles the disposition in one atomic broker step: it reads the
396
+ // disposition and marks the host-observed orderly completion together, so a
397
+ // gateway exit after the clean completion cannot latch a false mid-run loss. A
398
+ // duplex control channel that died before the clean completion fails the run
399
+ // closed: the seam sets a non-zero exit code, the typed `duplex_channel_lost`
400
+ // error code, and a stderr note that names only the typed loss reason.
401
+ function applyRunDispositionSeam(result, settleRunDisposition) {
402
+ const successEligible = result.exitCode === 0 && !result.timedOut && result.signal === null;
403
+ if (!successEligible || !settleRunDisposition)
404
+ return result;
405
+ const disposition = settleRunDisposition();
406
+ if (!disposition.failed)
407
+ return result;
408
+ const lossReason = disposition.lossReason ?? "other";
409
+ const note = `[paperclip] The sandbox duplex control channel was lost (${lossReason}) before the run completed.\n`;
410
+ const separator = result.stderr.length > 0 && !result.stderr.endsWith("\n") ? "\n" : "";
411
+ return {
412
+ ...result,
413
+ exitCode: 1,
414
+ errorCode: DUPLEX_CHANNEL_LOST_ERROR_CODE,
415
+ stderr: `${result.stderr}${separator}${note}`,
416
+ };
417
+ }
418
+ export async function runAdapterExecutionTargetProcess(runId, target, command, args, options) {
419
+ if (target?.kind === "remote" && target.transport === "sandbox") {
420
+ const runner = requireSandboxRunner(target);
421
+ const env = sanitizeRemoteExecutionEnv(options.env);
422
+ await options.onRuntimeProgress?.({
423
+ phase: "adapter_startup",
424
+ message: "Starting adapter in environment",
425
+ });
426
+ const runLogTail = options.runLogTail?.create() ?? null;
427
+ let execCommand = command;
428
+ let execArgs = args;
429
+ if (runLogTail) {
430
+ ({ command: execCommand, args: execArgs } = runLogTail.wrapCommand(command, args));
431
+ runLogTail.start(options.onLog);
432
+ }
433
+ try {
434
+ const result = await runner.execute({
435
+ command: execCommand,
436
+ args: execArgs,
437
+ cwd: target.remoteCwd,
438
+ env,
439
+ stdin: options.stdin,
440
+ timeoutMs: options.timeoutSec > 0 ? options.timeoutSec * 1000 : target.timeoutMs ?? undefined,
441
+ ...(options.useSession !== undefined ? { useSession: options.useSession } : {}),
442
+ ...(options.useSession === true ? { commandTimeoutMs: Math.max(0, options.timeoutSec) * 1000 } : {}),
443
+ // The tail loop already streams incremental chunks; suppress the
444
+ // runner's end-of-run batched onLog to avoid duplicate log bytes.
445
+ onLog: runLogTail ? undefined : options.onLog,
446
+ onSpawn: options.onSpawn
447
+ ? async (meta) => options.onSpawn?.({ ...meta, processGroupId: null })
448
+ : undefined,
449
+ });
450
+ // Settle the duplex run disposition synchronously at the clean-completion
451
+ // boundary, before the run-log tail finishes. The atomic settle marks the
452
+ // host-observed orderly completion in one broker step, so a gateway exit
453
+ // after the clean process completion cannot latch a false mid-run loss. A
454
+ // control channel that died before this clean completion still fails the
455
+ // run closed.
456
+ if (!result.timedOut && typeof result.exitCode === "number" && Number.isInteger(result.exitCode) && result.exitCode >= 0)
457
+ options.onProcessStopped?.();
458
+ const settled = applyRunDispositionSeam(result, options.settleRunDisposition);
459
+ if (runLogTail) {
460
+ await runLogTail.finish({ stdout: result.stdout, stderr: result.stderr });
461
+ }
462
+ return settled;
463
+ }
464
+ catch (error) {
465
+ if (runLogTail) {
466
+ await runLogTail.abort();
467
+ }
468
+ throw error;
469
+ }
470
+ }
471
+ const env = target?.kind === "remote" && target.transport === "ssh"
472
+ ? sanitizeRemoteExecutionEnv(options.env)
473
+ : options.env;
474
+ const result = await runChildProcess(runId, command, args, {
475
+ cwd: options.cwd,
476
+ env,
477
+ stdin: options.stdin,
478
+ timeoutSec: options.timeoutSec,
479
+ graceSec: options.graceSec,
480
+ onLog: options.onLog,
481
+ onSpawn: options.onSpawn,
482
+ terminalResultCleanup: options.terminalResultCleanup,
483
+ localProcessSandbox: target?.kind === "local" || !target ? options.localProcessSandbox : null,
484
+ remoteExecution: adapterExecutionTargetToRemoteSpec(target),
485
+ });
486
+ // Closing an SSH client on timeout/disconnect does not prove the remote
487
+ // provider exited. SSH status 255 is transport failure, never a stop receipt.
488
+ if (!target || target.kind === "local" ||
489
+ (!result.timedOut && !result.signal && result.exitCode !== null && result.exitCode >= 0 && result.exitCode < 255)) {
490
+ options.onProcessStopped?.();
491
+ }
492
+ return result;
493
+ }
494
+ export async function runAdapterExecutionTargetShellCommand(runId, target, command, options) {
495
+ const onLog = options.onLog ?? (async () => { });
496
+ if (target?.kind === "remote") {
497
+ const startedAt = new Date().toISOString();
498
+ const env = sanitizeRemoteExecutionEnv(options.env);
499
+ if (target.transport === "ssh") {
500
+ try {
501
+ // Pass the raw command — `runSshCommand` owns profile sourcing and
502
+ // the outer shell wrapper. Wrapping again here would nest a second
503
+ // shell after the explicit `env KEY=VAL` overrides, re-sourcing
504
+ // login profiles AFTER the override and silently undoing any
505
+ // identity var (NVM_DIR / PATH / etc.) that a profile re-exports.
506
+ const result = await runSshCommand(target.spec, command, {
507
+ env,
508
+ timeoutMs: (options.timeoutSec ?? 15) * 1000,
509
+ });
510
+ if (result.stdout)
511
+ await onLog("stdout", result.stdout);
512
+ if (result.stderr)
513
+ await onLog("stderr", result.stderr);
514
+ return {
515
+ exitCode: 0,
516
+ signal: null,
517
+ timedOut: false,
518
+ stdout: result.stdout,
519
+ stderr: result.stderr,
520
+ pid: null,
521
+ startedAt,
522
+ };
523
+ }
524
+ catch (error) {
525
+ const timedOutError = error;
526
+ const stdout = timedOutError.stdout ?? "";
527
+ const stderr = timedOutError.stderr ?? "";
528
+ const timedOut = timedOutError.killed === true || timedOutError.code === "ETIMEDOUT";
529
+ if (!timedOut && typeof timedOutError.code === "number") {
530
+ if (stdout)
531
+ await onLog("stdout", stdout);
532
+ if (stderr)
533
+ await onLog("stderr", stderr);
534
+ return {
535
+ exitCode: timedOutError.code,
536
+ signal: timedOutError.signal ?? null,
537
+ timedOut: false,
538
+ stdout,
539
+ stderr,
540
+ pid: null,
541
+ startedAt,
542
+ };
543
+ }
544
+ if (!timedOut) {
545
+ throw error;
546
+ }
547
+ if (stdout)
548
+ await onLog("stdout", stdout);
549
+ if (stderr)
550
+ await onLog("stderr", stderr);
551
+ return {
552
+ exitCode: null,
553
+ signal: timedOutError.signal ?? null,
554
+ timedOut: true,
555
+ stdout,
556
+ stderr,
557
+ pid: null,
558
+ startedAt,
559
+ };
560
+ }
561
+ }
562
+ const shellCommand = preferredSandboxShell(target);
563
+ return await requireSandboxRunner(target).execute({
564
+ command: shellCommand,
565
+ args: shellCommandArgs(command),
566
+ cwd: target.remoteCwd,
567
+ env,
568
+ timeoutMs: (options.timeoutSec ?? 15) * 1000,
569
+ onLog,
570
+ });
571
+ }
572
+ return await runAdapterExecutionTargetProcess(runId, target, "sh", ["-lc", command], {
573
+ cwd: options.cwd,
574
+ env: options.env,
575
+ timeoutSec: options.timeoutSec ?? 15,
576
+ graceSec: options.graceSec ?? 5,
577
+ onLog,
578
+ });
579
+ }
580
+ // Best-effort run of an adapter-supplied install command on a sandbox target
581
+ // before the resolvability + hello probe. Returns null for non-sandbox
582
+ // targets so callers can no-op. Returns a structured check otherwise — never
583
+ // throws — so the rest of the test still runs and reports the post-install
584
+ // state honestly. Caller pushes the check into its result array; the test
585
+ // report shows whether install was attempted and what came back.
586
+ export async function maybeRunSandboxInstallCommand(input) {
587
+ const { target, adapterKey, installCommand } = input;
588
+ if (!target || target.kind !== "remote" || target.transport !== "sandbox") {
589
+ return null;
590
+ }
591
+ const trimmed = installCommand.trim();
592
+ if (trimmed.length === 0)
593
+ return null;
594
+ const code = `${adapterKey}_install_command_run`;
595
+ // Skip install when the binary is already on PATH. Avoids running
596
+ // network-dependent installers (e.g. `curl ... | bash`) on every test
597
+ // probe when the CLI is preinstalled on the lease/template.
598
+ const detectCommand = input.detectCommand?.trim();
599
+ if (detectCommand) {
600
+ try {
601
+ const probe = await runAdapterExecutionTargetShellCommand(input.runId, target, `command -v ${shellQuote(detectCommand)} >/dev/null 2>&1`, {
602
+ cwd: target.remoteCwd,
603
+ env: input.env ?? {},
604
+ timeoutSec: 30,
605
+ graceSec: 5,
606
+ });
607
+ if (!probe.timedOut && probe.exitCode === 0) {
608
+ return {
609
+ code,
610
+ level: "info",
611
+ message: `${detectCommand} already on PATH; skipped install.`,
612
+ };
613
+ }
614
+ }
615
+ catch {
616
+ // Fall through to actually running the install — failure to probe
617
+ // is not a reason to skip the install gate.
618
+ }
619
+ }
620
+ let result;
621
+ try {
622
+ result = await runAdapterExecutionTargetShellCommand(input.runId, target, trimmed, {
623
+ cwd: target.remoteCwd,
624
+ env: input.env ?? {},
625
+ timeoutSec: input.timeoutSec ?? 240,
626
+ graceSec: 10,
627
+ });
628
+ }
629
+ catch (err) {
630
+ return {
631
+ code,
632
+ level: "warn",
633
+ message: "Install command threw before completion.",
634
+ detail: err instanceof Error ? err.message : String(err),
635
+ };
636
+ }
637
+ const tail = (text) => text.split(/\r?\n/).filter((line) => line.trim().length > 0).slice(-3).join(" | ").slice(0, 480);
638
+ if (result.timedOut) {
639
+ return {
640
+ code,
641
+ level: "warn",
642
+ message: `Install command timed out: ${trimmed}`,
643
+ detail: tail(result.stderr || result.stdout),
644
+ };
645
+ }
646
+ if ((result.exitCode ?? 1) === 0) {
647
+ return {
648
+ code,
649
+ level: "info",
650
+ message: `Install command ran: ${trimmed}`,
651
+ ...(tail(result.stdout) ? { detail: tail(result.stdout) } : {}),
652
+ };
653
+ }
654
+ return {
655
+ code,
656
+ level: "warn",
657
+ message: `Install command exited ${result.exitCode}: ${trimmed}`,
658
+ detail: tail(result.stderr || result.stdout),
659
+ };
660
+ }
661
+ export async function readAdapterExecutionTargetHomeDir(runId, target, options) {
662
+ const result = await runAdapterExecutionTargetShellCommand(runId, target, 'printf %s "$HOME"', options);
663
+ const homeDir = result.stdout.trim();
664
+ return homeDir.length > 0 ? homeDir : null;
665
+ }
666
+ export async function ensureAdapterExecutionTargetRuntimeCommandInstalled(input) {
667
+ const installCommand = input.installCommand?.trim();
668
+ if (!installCommand || input.target?.kind !== "remote" || input.target.transport !== "sandbox") {
669
+ return;
670
+ }
671
+ const detectCommand = input.detectCommand?.trim();
672
+ if (detectCommand) {
673
+ const probe = await runAdapterExecutionTargetShellCommand(input.runId, input.target, `command -v ${shellQuote(detectCommand)} >/dev/null 2>&1`, {
674
+ cwd: input.cwd,
675
+ env: input.env,
676
+ timeoutSec: input.timeoutSec,
677
+ graceSec: input.graceSec,
678
+ });
679
+ if (!probe.timedOut && probe.exitCode === 0) {
680
+ return;
681
+ }
682
+ }
683
+ const result = await runAdapterExecutionTargetShellCommand(input.runId, input.target, installCommand, {
684
+ cwd: input.cwd,
685
+ env: input.env,
686
+ timeoutSec: input.timeoutSec,
687
+ graceSec: input.graceSec,
688
+ onLog: input.onLog,
689
+ });
690
+ // A failed or timed-out install is not necessarily fatal: the CLI may already
691
+ // be on PATH from a previous lease's install, the template image, or another
692
+ // path entry. Re-run the detect probe (when one is configured) so a transient
693
+ // install failure does not abort the agent run when the binary is reachable.
694
+ const installFailed = result.timedOut || (result.exitCode ?? 0) !== 0;
695
+ if (!installFailed) {
696
+ return;
697
+ }
698
+ if (detectCommand) {
699
+ const recheck = await runAdapterExecutionTargetShellCommand(input.runId, input.target, `command -v ${shellQuote(detectCommand)} >/dev/null 2>&1`, {
700
+ cwd: input.cwd,
701
+ env: input.env,
702
+ timeoutSec: input.timeoutSec,
703
+ graceSec: input.graceSec,
704
+ });
705
+ if (!recheck.timedOut && recheck.exitCode === 0) {
706
+ if (input.onLog) {
707
+ const reason = result.timedOut ? "timed out" : `exited ${result.exitCode ?? "?"}`;
708
+ await input.onLog("stderr", `[paperclip] Install command ${reason} (${installCommand}) but ${detectCommand} is on PATH; continuing.\n`);
709
+ }
710
+ return;
711
+ }
712
+ }
713
+ if (result.timedOut) {
714
+ throw new Error(`Timed out while installing the adapter runtime command via: ${installCommand}`);
715
+ }
716
+ throw new Error(`Failed to install the adapter runtime command via: ${installCommand}`);
717
+ }
718
+ export async function ensureAdapterExecutionTargetFile(runId, target, filePath, options) {
719
+ await runAdapterExecutionTargetShellCommand(runId, target, `mkdir -p ${shellQuote(path.posix.dirname(filePath))} && : > ${shellQuote(filePath)}`, options);
720
+ }
721
+ export async function ensureAdapterExecutionTargetLocalWorkspace(target, cwd) {
722
+ if (target?.kind === "remote" && target.workspaceRealization?.mode === "in_place")
723
+ return;
724
+ await ensureAbsoluteDirectory(cwd, { createIfMissing: true });
725
+ }
726
+ /**
727
+ * Ensure a working directory exists (and is a directory) on the execution target.
728
+ *
729
+ * For local targets this delegates to the local `ensureAbsoluteDirectory` helper
730
+ * (Node fs). For remote (SSH/sandbox) targets it shells out and runs
731
+ * `mkdir -p` (when allowed) followed by a `[ -d ]` check so the result reflects
732
+ * the directory state inside the environment, not on the Paperclip host.
733
+ *
734
+ * Throws an Error with a human-readable message on failure. Temporary target
735
+ * failures carry a typed code so adapters can retain them as retryable checks.
736
+ */
737
+ export async function ensureAdapterExecutionTargetDirectory(runId, target, cwd, options) {
738
+ const createIfMissing = options.createIfMissing ?? false;
739
+ if (!target || target.kind === "local") {
740
+ const { ensureAbsoluteDirectory } = await import("./server-utils.js");
741
+ await ensureAbsoluteDirectory(cwd, { createIfMissing });
742
+ return;
743
+ }
744
+ // Remote (SSH or sandbox): both expect POSIX absolute paths inside the env.
745
+ if (!cwd.startsWith("/")) {
746
+ throw new Error(`Working directory must be an absolute POSIX path on the remote target: "${cwd}"`);
747
+ }
748
+ const quoted = shellQuote(cwd);
749
+ const script = createIfMissing
750
+ ? `mkdir -p ${quoted} && [ -d ${quoted} ]`
751
+ : `[ -d ${quoted} ]`;
752
+ const result = await runRemoteExecutionTargetCheck(target, `checking working directory on remote target: "${cwd}"`, () => runAdapterExecutionTargetShellCommand(runId, target, script, {
753
+ cwd: target.remoteCwd,
754
+ env: options.env,
755
+ timeoutSec: options.timeoutSec ?? 15,
756
+ graceSec: options.graceSec ?? 5,
757
+ onLog: options.onLog,
758
+ }));
759
+ if ((result.exitCode ?? 1) !== 0) {
760
+ const detail = (result.stderr || result.stdout || "").trim();
761
+ if (createIfMissing) {
762
+ throw new Error(`Could not create working directory "${cwd}" on remote target${detail ? `: ${detail}` : "."}`);
763
+ }
764
+ throw new Error(`Working directory does not exist on remote target: "${cwd}"${detail ? ` (${detail})` : ""}`);
765
+ }
766
+ }
767
+ export function adapterExecutionTargetSessionIdentity(target) {
768
+ if (!target || target.kind === "local")
769
+ return null;
770
+ if (target.transport === "ssh")
771
+ return buildRemoteExecutionSessionIdentity(target.spec);
772
+ return {
773
+ transport: "sandbox",
774
+ providerKey: target.providerKey ?? null,
775
+ environmentId: target.environmentId ?? null,
776
+ leaseId: target.leaseId ?? null,
777
+ remoteCwd: target.remoteCwd,
778
+ };
779
+ }
780
+ export function normalizeAdapterExecutionTargetSessionIdentity(value) {
781
+ const saved = parseObject(value);
782
+ if (saved.transport === "ssh") {
783
+ if (!readStringMeta(saved, "host") || !readStringMeta(saved, "username") || !readStringMeta(saved, "remoteCwd")
784
+ || typeof saved.port !== "number" || !Number.isInteger(saved.port) || saved.port < 1 || saved.port > 65535
785
+ || (saved.useHostAuth !== undefined && typeof saved.useHostAuth !== "boolean"))
786
+ return null;
787
+ const fields = Object.fromEntries(Object.entries(saved).filter(([key, entry]) => typeof entry === "string"
788
+ || (key === "port" && typeof entry === "number") || (key === "useHostAuth" && typeof entry === "boolean")));
789
+ return buildRemoteExecutionSessionIdentity(fields);
790
+ }
791
+ if (saved.transport === "sandbox" && readStringMeta(saved, "remoteCwd")) {
792
+ return adapterExecutionTargetSessionIdentity({ kind: "remote", transport: "sandbox", remoteCwd: readStringMeta(saved, "remoteCwd"),
793
+ providerKey: readStringMeta(saved, "providerKey"), environmentId: readStringMeta(saved, "environmentId"), leaseId: readStringMeta(saved, "leaseId") });
794
+ }
795
+ return null;
796
+ }
797
+ export function adapterExecutionTargetSessionMatches(saved, target) {
798
+ if (!target || target.kind === "local") {
799
+ return Object.keys(parseObject(saved)).length === 0;
800
+ }
801
+ if (target.transport === "ssh")
802
+ return remoteExecutionSessionMatches(saved, target.spec);
803
+ const current = adapterExecutionTargetSessionIdentity(target);
804
+ const parsedSaved = parseObject(saved);
805
+ return (readStringMeta(parsedSaved, "transport") === current?.transport &&
806
+ readStringMeta(parsedSaved, "providerKey") === current?.providerKey &&
807
+ readStringMeta(parsedSaved, "environmentId") === current?.environmentId &&
808
+ readStringMeta(parsedSaved, "leaseId") === current?.leaseId &&
809
+ readStringMeta(parsedSaved, "remoteCwd") === current?.remoteCwd);
810
+ }
811
+ export function parseAdapterExecutionTarget(value) {
812
+ const parsed = parseObject(value);
813
+ const kind = readStringMeta(parsed, "kind");
814
+ if (kind === "local") {
815
+ return {
816
+ kind: "local",
817
+ environmentId: readStringMeta(parsed, "environmentId"),
818
+ leaseId: readStringMeta(parsed, "leaseId"),
819
+ };
820
+ }
821
+ if (kind === "remote" && readStringMeta(parsed, "transport") === "ssh") {
822
+ const spec = parseSshRemoteExecutionSpec(parseObject(parsed.spec));
823
+ if (!spec)
824
+ return null;
825
+ return {
826
+ kind: "remote",
827
+ transport: "ssh",
828
+ environmentId: readStringMeta(parsed, "environmentId"),
829
+ leaseId: readStringMeta(parsed, "leaseId"),
830
+ remoteCwd: spec.remoteCwd,
831
+ spec,
832
+ };
833
+ }
834
+ if (kind === "remote" && readStringMeta(parsed, "transport") === "sandbox") {
835
+ const remoteCwd = readStringMeta(parsed, "remoteCwd");
836
+ if (!remoteCwd)
837
+ return null;
838
+ const effectiveCapabilities = parseEffectiveExecutionCapabilities(parsed.effectiveCapabilities);
839
+ return {
840
+ kind: "remote",
841
+ transport: "sandbox",
842
+ providerKey: readStringMeta(parsed, "providerKey"),
843
+ environmentId: readStringMeta(parsed, "environmentId"),
844
+ leaseId: readStringMeta(parsed, "leaseId"),
845
+ remoteCwd,
846
+ timeoutMs: typeof parsed.timeoutMs === "number" ? parsed.timeoutMs : null,
847
+ streamRunLogs: typeof parsed.streamRunLogs === "boolean" ? parsed.streamRunLogs : null,
848
+ // Fail closed: only the literal `true` reads as a grant. An absent field
849
+ // or any other value parses as no grant, so a round-trip never invents one.
850
+ enableSandboxDuplexBridge: parsed.enableSandboxDuplexBridge === true,
851
+ ...(effectiveCapabilities ? { effectiveCapabilities } : {}),
852
+ };
853
+ }
854
+ return null;
855
+ }
856
+ export function adapterExecutionTargetFromRemoteExecution(remoteExecution, metadata = {}) {
857
+ const parsed = parseObject(remoteExecution);
858
+ const ssh = parseSshRemoteExecutionSpec(parsed);
859
+ if (ssh) {
860
+ return {
861
+ kind: "remote",
862
+ transport: "ssh",
863
+ environmentId: metadata.environmentId ?? null,
864
+ leaseId: metadata.leaseId ?? null,
865
+ remoteCwd: ssh.remoteCwd,
866
+ spec: ssh,
867
+ };
868
+ }
869
+ return null;
870
+ }
871
+ export function readAdapterExecutionTarget(input) {
872
+ if (isAdapterExecutionTargetInstance(input.executionTarget)) {
873
+ return input.executionTarget;
874
+ }
875
+ return (parseAdapterExecutionTarget(input.executionTarget) ??
876
+ adapterExecutionTargetFromRemoteExecution(input.legacyRemoteExecution));
877
+ }
878
+ export async function prepareAdapterExecutionTargetRuntime(input) {
879
+ const target = input.target ?? { kind: "local" };
880
+ if (target.kind === "local") {
881
+ return {
882
+ target,
883
+ workspaceRemoteDir: null,
884
+ runtimeRootDir: null,
885
+ assetDirs: {},
886
+ additionalSourceDirs: {},
887
+ additionalSourceFailures: [],
888
+ workspaceSyncSnapshot: null,
889
+ restoreWorkspace: async () => { },
890
+ };
891
+ }
892
+ const syncWorkspace = input.syncWorkspace ?? target.workspaceRealization?.mode !== "in_place";
893
+ if (target.transport === "ssh") {
894
+ const prepared = await prepareRemoteManagedRuntime({
895
+ spec: target.spec,
896
+ runId: input.runId,
897
+ adapterKey: input.adapterKey,
898
+ workspaceLocalDir: input.workspaceLocalDir,
899
+ workspaceRemoteDir: input.workspaceRemoteDir,
900
+ syncWorkspace,
901
+ privateRuntime: input.privateRuntime,
902
+ retainRuntime: input.retainRuntime,
903
+ workspaceFileMode: input.workspaceFileMode,
904
+ workspaceExclude: input.workspaceExclude,
905
+ assets: input.assets,
906
+ additionalSources: input.additionalSources,
907
+ onProgress: input.onProgress,
908
+ });
909
+ return {
910
+ target,
911
+ workspaceRemoteDir: prepared.workspaceRemoteDir,
912
+ runtimeRootDir: prepared.runtimeRootDir,
913
+ assetDirs: prepared.assetDirs,
914
+ additionalSourceDirs: prepared.additionalSourceDirs,
915
+ // The SSH transport does not stage referenced projects (it is out of scope), so it never
916
+ // reports a per-project staging failure.
917
+ additionalSourceFailures: [],
918
+ workspaceSyncSnapshot: null,
919
+ disposeRuntime: prepared.disposeRuntime,
920
+ restoreWorkspace: prepared.restoreWorkspace,
921
+ };
922
+ }
923
+ const prepared = await prepareCommandManagedRuntime({
924
+ runner: requireSandboxRunner(target),
925
+ spec: {
926
+ providerKey: target.providerKey,
927
+ shellCommand: target.shellCommand,
928
+ leaseId: target.leaseId,
929
+ remoteCwd: target.remoteCwd,
930
+ timeoutMs: input.timeoutSec && input.timeoutSec > 0
931
+ ? input.timeoutSec * 1000
932
+ : target.timeoutMs,
933
+ },
934
+ adapterKey: input.adapterKey,
935
+ workspaceLocalDir: input.workspaceLocalDir,
936
+ workspaceRemoteDir: input.workspaceRemoteDir,
937
+ runtimeRootDir: input.runtimeRootDir,
938
+ syncWorkspace,
939
+ workspaceInboundMode: input.workspaceInboundMode,
940
+ workspaceSnapshotIsolation: input.workspaceSnapshotIsolation,
941
+ workspaceGitIndexRefresh: input.workspaceGitIndexRefresh,
942
+ workspaceDurableSeed: input.workspaceDurableSeed,
943
+ workspaceCheckpoint: input.workspaceCheckpoint,
944
+ onWorkspaceCheckpoint: input.onWorkspaceCheckpoint,
945
+ workspaceSeedCacheDirectory: input.workspaceSeedCacheDirectory,
946
+ workspaceSeedCacheCompanyDirectory: input.workspaceSeedCacheCompanyDirectory,
947
+ workspaceSeedCacheScope: input.workspaceSeedCacheScope,
948
+ workspaceBaseline: input.workspaceBaseline,
949
+ workspaceGitSnapshot: input.workspaceGitSnapshot,
950
+ workspaceRepositories: input.workspaceRepositories,
951
+ workspaceExclude: input.workspaceExclude,
952
+ workspaceFileMode: input.workspaceFileMode,
953
+ preserveAbsentOnRestore: input.preserveAbsentOnRestore,
954
+ assets: input.assets,
955
+ additionalSources: input.additionalSources,
956
+ installCommand: input.installCommand,
957
+ detectCommand: input.detectCommand,
958
+ onProgress: input.onProgress,
959
+ onRuntimeProgress: input.onRuntimeProgress,
960
+ runtimeSpan: input.runtimeSpan,
961
+ workspaceRestoreRetryDelaysMs: input.workspaceRestoreRetryDelaysMs,
962
+ });
963
+ return {
964
+ target,
965
+ workspaceRemoteDir: prepared.workspaceRemoteDir,
966
+ runtimeRootDir: prepared.runtimeRootDir,
967
+ assetDirs: prepared.assetDirs,
968
+ additionalSourceDirs: prepared.additionalSourceDirs,
969
+ additionalSourceFailures: prepared.additionalSourceFailures,
970
+ workspaceSyncSnapshot: prepared.workspaceSyncSnapshot,
971
+ cleanupWorkspaceSnapshot: prepared.cleanupWorkspaceSnapshot,
972
+ restoreWorkspace: prepared.restoreWorkspace,
973
+ };
974
+ }
975
+ export function runtimeAssetDir(prepared, key, fallbackRemoteCwd) {
976
+ return prepared.assetDirs[key] ?? path.posix.join(fallbackRemoteCwd, ".paperclip-runtime", key);
977
+ }
978
+ /** Keep sandbox housekeeping within the producer-owned Runner runtime. */
979
+ export function githubOperationLauncherDirectory(input) {
980
+ // Only controller-generated run IDs may name a removable directory.
981
+ if (!/^[a-zA-Z0-9_-]+$/.test(input.runId))
982
+ throw new Error("Invalid GitHub launcher run ID");
983
+ return input.target?.kind === "remote"
984
+ ? path.posix.join(input.target.remoteCwd, ".paperclip-runtime", ...(input.target.transport === "sandbox" ? ["paperclip-runner"] : []), "github", input.runId)
985
+ : path.join(os.tmpdir(), "paperclip-github-runtime", input.runId);
986
+ }
987
+ /** Call only after execution settles, before releasing its remote environment lease. */
988
+ export async function cleanupGitHubOperationLaunchers(input) {
989
+ const directory = githubOperationLauncherDirectory(input);
990
+ if (input.target?.kind === "remote") {
991
+ const result = await adapterExecutionTargetCommandRunner(input.target).execute({
992
+ command: "sh", args: ["-c", `rm -rf -- ${shellQuote(directory)}`],
993
+ cwd: input.target.remoteCwd, timeoutMs: 5_000,
994
+ });
995
+ if (result.exitCode !== 0)
996
+ throw new Error("Could not clean managed GitHub launchers");
997
+ }
998
+ else {
999
+ await fs.rm(directory, { recursive: true, force: true });
1000
+ }
1001
+ }
1002
+ async function githubOperationLauncherBasePath(target, env) {
1003
+ if (!target)
1004
+ return env.PATH || process.env.PATH || "/usr/bin:/bin";
1005
+ const configuredPath = sanitizeRemoteExecutionEnv(env).PATH;
1006
+ if (configuredPath !== undefined)
1007
+ return configuredPath;
1008
+ // The provider owns login/profile setup. Query its effective PATH before
1009
+ // staging BASH_ENV, rather than substituting the controller's toolchain or
1010
+ // a minimal PATH that hides legacy NVM/user-local agent installations.
1011
+ const result = await adapterExecutionTargetCommandRunner(target).execute({
1012
+ command: "sh",
1013
+ args: ["-c", "printf '\\000%s\\000' \"$PATH\""],
1014
+ cwd: target.remoteCwd,
1015
+ timeoutMs: 15_000,
1016
+ });
1017
+ // Frame the value so login banners cannot become executable search paths.
1018
+ const remotePath = result.stdout.match(/\0([^\0]+)\0/)?.[1];
1019
+ if (result.timedOut || result.exitCode !== 0 || !remotePath) {
1020
+ throw new Error("Could not resolve remote PATH for managed GitHub launchers");
1021
+ }
1022
+ return remotePath;
1023
+ }
1024
+ export const EXECUTION_TARGET_GIT_CONTEXT_UNAVAILABLE_CODE = "execution_target_git_context_unavailable";
1025
+ function gitContextUnavailable(reason) {
1026
+ return Object.assign(new Error(`Could not read execution-target Git context: ${reason}`), { code: EXECUTION_TARGET_GIT_CONTEXT_UNAVAILABLE_CODE });
1027
+ }
1028
+ function gitContextProbeFailureReason(result) {
1029
+ if (result.timedOut)
1030
+ return "the probe timed out";
1031
+ if (typeof result.signal === "string" && /^SIG[A-Z0-9]{1,12}$/.test(result.signal))
1032
+ return `the probe was stopped by ${result.signal}`;
1033
+ if (Number.isSafeInteger(result.exitCode))
1034
+ return `the probe exited with code ${result.exitCode}`;
1035
+ return "the probe reported no exit status";
1036
+ }
1037
+ /** Read only execution-target Git context; never import the controller's credentials into SSH. */
1038
+ export async function prepareGitHubExecutionEnvironment(input) {
1039
+ const script = String.raw `
1040
+ const fs = require('node:fs');
1041
+ const path = require('node:path');
1042
+ const cp = require('node:child_process');
1043
+ const env = {};
1044
+ env.PAPERCLIP_RUNNER_NETWORK_ROOTS = JSON.stringify(['/etc/resolv.conf','/etc/hosts','/etc/nsswitch.conf','/etc/ssl/certs','/etc/ssl/cert.pem'].flatMap(p => { try { return [fs.realpathSync(p)]; } catch { return []; } }));
1045
+ if (process.argv[1] === 'host') {
1046
+ for (const [key, value] of Object.entries(process.env)) {
1047
+ if (/^(GH_TOKEN|GITHUB_TOKEN|GH_ENTERPRISE_TOKEN|GITHUB_ENTERPRISE_TOKEN|PAPERCLIP_GIT_TOKEN|GH_CONFIG_DIR|GIT_CONFIG_(GLOBAL|SYSTEM|NOSYSTEM|COUNT|KEY_\d+|VALUE_\d+)|GIT_(AUTHOR|COMMITTER)_(NAME|EMAIL)|GIT_ASKPASS|SSH_ASKPASS|SSH_AUTH_SOCK|GIT_SSH_COMMAND|GIT_SSH)$/.test(key)) env[key] = value;
1048
+ }
1049
+ env.PAPERCLIP_GITHUB_HOST_HOME = process.env.HOME || '';
1050
+ env.GH_CONFIG_DIR ||= path.join(process.env.XDG_CONFIG_HOME || path.join(process.env.HOME || '', '.config'), 'gh');
1051
+ }
1052
+ try {
1053
+ const top = cp.execFileSync('git', ['rev-parse', '--show-toplevel'], {encoding:'utf8',stdio:['ignore','pipe','ignore']}).trim();
1054
+ if (fs.realpathSync(top) === fs.realpathSync(process.cwd())) {
1055
+ env.PAPERCLIP_GIT_METADATA_ROOTS = JSON.stringify(cp.execFileSync('git', ['rev-parse','--path-format=absolute','--git-common-dir','--git-dir'], {encoding:'utf8',stdio:['ignore','pipe','ignore']}).trim().split('\n').map(p => fs.realpathSync(p)));
1056
+ }
1057
+ } catch {}
1058
+ process.stdout.write("\0" + JSON.stringify(env) + "\0");
1059
+ `;
1060
+ const args = ["-e", script, input.hostCredentials ? "host" : "managed"];
1061
+ const remote = input.target?.kind === "remote" ? input.target : null;
1062
+ let discovered;
1063
+ if (remote?.transport === "sandbox" && remote.runnerTask) {
1064
+ if (input.hostCredentials)
1065
+ throw new Error("Task-only Runner environments cannot import host GitHub credentials");
1066
+ discovered = {};
1067
+ }
1068
+ else if (remote) {
1069
+ // A legacy SSH host may run a standalone agent binary without Node. Use
1070
+ // only the shell and Git, and emit bounded, NUL-framed environment records.
1071
+ const probe = String.raw `
1072
+ printf '\0PAPERCLIP_GIT_CONTEXT_V1\0'
1073
+ if [ "$1" = host ]; then
1074
+ for key in GH_TOKEN GITHUB_TOKEN GH_ENTERPRISE_TOKEN GITHUB_ENTERPRISE_TOKEN PAPERCLIP_GIT_TOKEN GH_CONFIG_DIR GIT_CONFIG_GLOBAL GIT_CONFIG_SYSTEM GIT_CONFIG_NOSYSTEM GIT_CONFIG_COUNT GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL GIT_COMMITTER_NAME GIT_COMMITTER_EMAIL GIT_ASKPASS SSH_ASKPASS SSH_AUTH_SOCK GIT_SSH_COMMAND GIT_SSH; do
1075
+ eval 'value=${"$"}{'"$key"'-}'
1076
+ [ -z "$value" ] || printf '%s\0%s\0' "$key" "$value"
1077
+ done
1078
+ index=0
1079
+ while [ "$index" -lt 32 ]; do
1080
+ for prefix in GIT_CONFIG_KEY_ GIT_CONFIG_VALUE_; do
1081
+ key="$prefix$index"
1082
+ eval 'value=${"$"}{'"$key"'-}'
1083
+ [ -z "$value" ] || printf '%s\0%s\0' "$key" "$value"
1084
+ done
1085
+ index=$((index + 1))
1086
+ done
1087
+ printf 'PAPERCLIP_GITHUB_HOST_HOME\0%s\0' "$HOME"
1088
+ printf 'GH_CONFIG_DIR\0%s\0' "${"$"}{GH_CONFIG_DIR:-${"$"}{XDG_CONFIG_HOME:-$HOME/.config}/gh}"
1089
+ fi
1090
+ for file in /etc/resolv.conf /etc/hosts /etc/nsswitch.conf /etc/ssl/certs /etc/ssl/cert.pem; do
1091
+ index=0
1092
+ while [ -L "$file" ] && [ "$index" -lt 40 ]; do
1093
+ target=$(readlink "$file") || break
1094
+ case "$target" in /*) file="$target" ;; *) file="$(dirname "$file")/$target" ;; esac
1095
+ index=$((index + 1))
1096
+ done
1097
+ if [ -e "$file" ]; then
1098
+ parent=$(cd "$(dirname "$file")" && pwd -P) || continue
1099
+ printf 'PAPERCLIP_RUNNER_NETWORK_ROOT\0%s\0' "$parent/$(basename "$file")"
1100
+ fi
1101
+ done
1102
+ cwd=$(pwd -P)
1103
+ top=$(git rev-parse --show-toplevel 2>/dev/null) || top=
1104
+ if [ -n "$top" ] && [ "$(cd "$top" && pwd -P)" = "$cwd" ]; then
1105
+ for kind in --git-common-dir --git-dir; do
1106
+ root=$(git rev-parse --path-format=absolute "$kind" 2>/dev/null) || continue
1107
+ root=$(cd "$root" && pwd -P) || continue
1108
+ printf 'PAPERCLIP_GIT_METADATA_ROOT\0%s\0' "$root"
1109
+ done
1110
+ fi
1111
+ printf '\0PAPERCLIP_GIT_CONTEXT_END\0'
1112
+ `;
1113
+ const result = await adapterExecutionTargetCommandRunner(remote).execute({
1114
+ command: "sh", args: ["-c", probe, "paperclip-git-context", input.hostCredentials ? "host" : "managed"],
1115
+ // The caller's cwd belongs to the controller. Copied sandbox/SSH
1116
+ // workspaces can live at a different path on the execution target.
1117
+ cwd: remote.remoteCwd, timeoutMs: 15_000,
1118
+ });
1119
+ if (result.exitCode !== 0)
1120
+ throw gitContextUnavailable(gitContextProbeFailureReason(result));
1121
+ const payload = result.stdout.split("\0PAPERCLIP_GIT_CONTEXT_V1\0")[1]?.split("\0PAPERCLIP_GIT_CONTEXT_END\0")[0];
1122
+ if (payload === undefined)
1123
+ throw gitContextUnavailable("the probe output was incomplete");
1124
+ discovered = {};
1125
+ const records = payload.split("\0");
1126
+ const roots = [];
1127
+ const networkRoots = [];
1128
+ for (let index = 0; index + 1 < records.length; index += 2) {
1129
+ const key = records[index];
1130
+ const value = records[index + 1];
1131
+ if (key === "PAPERCLIP_GIT_METADATA_ROOT")
1132
+ roots.push(value);
1133
+ else if (key === "PAPERCLIP_RUNNER_NETWORK_ROOT")
1134
+ networkRoots.push(value);
1135
+ else
1136
+ discovered[key] = value;
1137
+ }
1138
+ discovered.PAPERCLIP_GIT_METADATA_ROOTS = JSON.stringify([...new Set(roots)]);
1139
+ discovered.PAPERCLIP_RUNNER_NETWORK_ROOTS = JSON.stringify([...new Set(networkRoots)]);
1140
+ }
1141
+ else {
1142
+ const result = await promisify(execFile)(process.execPath, args, { cwd: input.cwd, timeout: 15_000, maxBuffer: 1024 * 1024 });
1143
+ try {
1144
+ discovered = JSON.parse(result.stdout.split("\0")[1] ?? "");
1145
+ }
1146
+ catch {
1147
+ throw gitContextUnavailable("the probe output was not valid");
1148
+ }
1149
+ }
1150
+ // Controller-derived roots and mode must not be replaced by agent bindings.
1151
+ return { ...discovered, ...input.env,
1152
+ ...(input.hostCredentials ? { PAPERCLIP_GITHUB_HOST_HOME: discovered.PAPERCLIP_GITHUB_HOST_HOME } : {}),
1153
+ PAPERCLIP_GIT_METADATA_ROOTS: discovered.PAPERCLIP_GIT_METADATA_ROOTS ?? "[]",
1154
+ PAPERCLIP_RUNNER_NETWORK_ROOTS: discovered.PAPERCLIP_RUNNER_NETWORK_ROOTS ?? "[]",
1155
+ PAPERCLIP_GITHUB_AUTH_MODE: input.hostCredentials ? "host" : "managed",
1156
+ PAPERCLIP_RUNNER_NETWORK_ACCESS: input.networkAccess ? "enabled" : "disabled",
1157
+ };
1158
+ }
1159
+ /** Stage token-free launchers next to the execution, not in shared global Git config. */
1160
+ export async function prepareGitHubOperationLaunchers(input) {
1161
+ const remote = input.target?.kind === "remote" ? input.target : null;
1162
+ const directory = githubOperationLauncherDirectory(input);
1163
+ const configDirectory = path.posix.join(directory, "gh-config");
1164
+ const basePath = await githubOperationLauncherBasePath(remote, input.env);
1165
+ const managedPath = basePath ? `${directory}:${basePath}` : directory;
1166
+ // Login shells may reorder PATH through /etc/profile or path_helper. Restore
1167
+ // the managed launchers after startup without loading a host user's profile.
1168
+ // Empty merge overrides clear host identity before launch, but Git treats
1169
+ // them as an explicit empty author. Remove them once the shell has inherited
1170
+ // its final environment; preserve nonempty per-operation identity values.
1171
+ const clearEmptyGitIdentity = ["GIT_AUTHOR_NAME", "GIT_AUTHOR_EMAIL", "GIT_COMMITTER_NAME", "GIT_COMMITTER_EMAIL"]
1172
+ .map((key) => `if [ -z "\${${key}-}" ]; then unset ${key}; fi\n`)
1173
+ .join("");
1174
+ const profile = `export PATH=${shellQuote(managedPath)}\n${clearEmptyGitIdentity}`;
1175
+ const files = Object.fromEntries([
1176
+ // Remote launchers live beneath the checkout. Pin their own package scope
1177
+ // so an enclosing project's "type": "module" cannot reinterpret require().
1178
+ ["package.json", '{"type":"commonjs"}\n'],
1179
+ ...["git", "gh"].map((name) => [name, githubLauncherSource({ brokerFile: input.broker !== undefined, anonymous: input.anonymous })]),
1180
+ ...[".zshenv", ".zprofile", ".zshrc", ".bash_profile", ".bashrc", ".profile"].map((name) => [name, profile]),
1181
+ ...(input.broker ? [["broker.json", `${JSON.stringify({ url: input.broker.url, token: input.broker.token })}\n`]] : []),
1182
+ ]);
1183
+ if (remote) {
1184
+ const runner = adapterExecutionTargetCommandRunner(remote);
1185
+ await syncRemoteTextFilesWithHashSkip({
1186
+ runner, remoteCwd: remote.remoteCwd,
1187
+ files: Object.entries(files).map(([program, body]) => ({
1188
+ remoteDir: directory, remotePath: path.posix.join(directory, program), body,
1189
+ label: "GitHub operation launcher", action: "stage GitHub operation launcher",
1190
+ lockDir: path.posix.join(directory, `.${program}.lock`),
1191
+ executable: program === "git" || program === "gh",
1192
+ private: program === "broker.json",
1193
+ })),
1194
+ ensureDirectories: [configDirectory], action: "stage GitHub operation launchers",
1195
+ timeoutMs: 15_000, shellCommand: adapterExecutionTargetShellCommand(remote),
1196
+ });
1197
+ }
1198
+ else {
1199
+ await fs.mkdir(directory, { recursive: true, mode: 0o700 });
1200
+ await fs.mkdir(configDirectory, { recursive: true, mode: 0o700 });
1201
+ for (const [program, body] of Object.entries(files)) {
1202
+ const partial = path.join(directory, `.${program}.${randomUUID()}.partial`);
1203
+ await fs.writeFile(partial, body, { mode: program === "broker.json" ? 0o600 : 0o700 });
1204
+ await fs.rename(partial, path.join(directory, program));
1205
+ }
1206
+ }
1207
+ return { ...input.env, PATH: managedPath, ZDOTDIR: directory, BASH_ENV: `${directory}/.bashrc`,
1208
+ GH_CONFIG_DIR: configDirectory, PAPERCLIP_GITHUB_LAUNCHER_DIR: directory };
1209
+ }
1210
+ function buildBridgeResponseHeaders(response) {
1211
+ const out = {};
1212
+ // Keep `x-paperclip-bridge-outcome` in this list. The host marks a
1213
+ // possibly-committed mutation with the `indeterminate` outcome. The in-sandbox
1214
+ // server reads that header to map the 504 to a terminal 409. If the forward
1215
+ // drops the header, the server keeps the retryable 504 and a caller that
1216
+ // retries 5xx can repeat a mutation that already committed.
1217
+ for (const key of ["content-type", "etag", "last-modified", "x-paperclip-bridge-outcome"]) {
1218
+ const value = response.headers.get(key);
1219
+ if (value && value.trim().length > 0)
1220
+ out[key] = value.trim();
1221
+ }
1222
+ return out;
1223
+ }
1224
+ function buildBridgeForwardUrl(baseUrl, request) {
1225
+ const url = new URL(request.path, baseUrl);
1226
+ const query = request.query.trim();
1227
+ url.search = query.startsWith("?") ? query.slice(1) : query;
1228
+ return url;
1229
+ }
1230
+ function bridgeResponseBodyLimitError(maxBodyBytes) {
1231
+ return new Error(`Bridge response body exceeded the configured size limit of ${maxBodyBytes} bytes.`);
1232
+ }
1233
+ /**
1234
+ * Read the forward response body into a `Buffer`, with no text decoding. The
1235
+ * per-request `maxBodyBytes` limit rejects a body larger than the configured
1236
+ * per-request ceiling.
1237
+ *
1238
+ * When the caller passes a `reservation`, this reserves each chunk's bytes
1239
+ * against it immediately after `reader.read()` yields the chunk, and before
1240
+ * `Buffer.from(value)` copies it — the allocation happens inside that
1241
+ * expression, so reserving only before the later `chunks.push` would let the
1242
+ * copy happen first. It also reserves the concatenated buffer's own byte
1243
+ * count before `Buffer.concat` allocates it: the chunk array and the
1244
+ * concatenated buffer are two separate live copies. A denied reservation
1245
+ * cancels the reader and throws {@link BridgeProcessCapacityError}, copying
1246
+ * no further chunk. This function never releases the reservation; the
1247
+ * stream owner that created it does, once the whole forward call settles.
1248
+ *
1249
+ * With no `reservation`, this function enforces only the one request's own
1250
+ * ceiling, exactly as it did before this parameter existed — the queue
1251
+ * transport calls it with no reservation, and its behavior must not change.
1252
+ */
1253
+ async function readBridgeForwardResponseBody(response, maxBodyBytes, reservation) {
1254
+ const rawContentLength = response.headers.get("content-length");
1255
+ if (rawContentLength) {
1256
+ const contentLength = Number.parseInt(rawContentLength, 10);
1257
+ if (Number.isFinite(contentLength) && contentLength > maxBodyBytes) {
1258
+ throw bridgeResponseBodyLimitError(maxBodyBytes);
1259
+ }
1260
+ }
1261
+ if (!response.body) {
1262
+ return Buffer.alloc(0);
1263
+ }
1264
+ const reader = response.body.getReader();
1265
+ const chunks = [];
1266
+ let totalBytes = 0;
1267
+ while (true) {
1268
+ const { done, value } = await reader.read();
1269
+ if (done)
1270
+ break;
1271
+ if (!value)
1272
+ continue;
1273
+ const chunkBytes = value.byteLength;
1274
+ totalBytes += chunkBytes;
1275
+ if (totalBytes > maxBodyBytes) {
1276
+ await reader.cancel().catch(() => undefined);
1277
+ throw bridgeResponseBodyLimitError(maxBodyBytes);
1278
+ }
1279
+ if (reservation && !reservation.reserve(chunkBytes)) {
1280
+ await reader.cancel().catch(() => undefined);
1281
+ throw new BridgeProcessCapacityError();
1282
+ }
1283
+ chunks.push(Buffer.from(value));
1284
+ }
1285
+ if (reservation && !reservation.reserve(totalBytes)) {
1286
+ await reader.cancel().catch(() => undefined);
1287
+ throw new BridgeProcessCapacityError();
1288
+ }
1289
+ return Buffer.concat(chunks, totalBytes);
1290
+ }
1291
+ const PROCESS_SESSION_PROXY_SCRIPT = "paperclip-process-session-proxy.mjs";
1292
+ const PROCESS_SESSION_REMOTE_SCRIPT = "paperclip-process-session-remote.mjs";
1293
+ // The streamed variant writes its output frames to stdout, so it rides a
1294
+ // separate remote path. A sandbox can hold both scripts without the content
1295
+ // hash-skip gate thrashing when a run switches output mode.
1296
+ const PROCESS_SESSION_REMOTE_STREAM_SCRIPT = "paperclip-process-session-remote-stream.mjs";
1297
+ const PROCESS_SESSION_AUTH_TIMEOUT_MS = 5_000;
1298
+ // The bounded budget `stop()` waits for the wrapper's `shutdownAck` event
1299
+ // before it removes `sessionDir` unconditionally. The wrapper writes the
1300
+ // acknowledgement right after it arms its own kill timer, well before its
1301
+ // child actually exits, so this budget only needs to cover message delivery,
1302
+ // not the child's full shutdown.
1303
+ const DEFAULT_PROCESS_SESSION_SHUTDOWN_WAIT_MS = 3_000;
1304
+ function jsonLine(value) {
1305
+ return `${JSON.stringify(value)}\n`;
1306
+ }
1307
+ function splitJsonLines(buffer) {
1308
+ const parts = buffer.split(/\n/);
1309
+ return { lines: parts.slice(0, -1), rest: parts.at(-1) ?? "" };
1310
+ }
1311
+ async function writeProcessSessionProxyScript(dir, port, token) {
1312
+ await fs.mkdir(dir, { recursive: true });
1313
+ const proxyPath = path.join(dir, PROCESS_SESSION_PROXY_SCRIPT);
1314
+ await fs.writeFile(proxyPath, getProcessSessionProxySource({ port, token }), { mode: 0o700 });
1315
+ return proxyPath;
1316
+ }
1317
+ // Content-hash-skip the process-session remote script write, mirroring the
1318
+ // sandbox callback bridge entrypoint sha256 gate. The script is a static
1319
+ // Paperclip-authored `.mjs` that only changes when the build changes, so on a
1320
+ // warm start (same sandbox, script already present) the single sha-gate exec
1321
+ // skips the ~3-exec base64 upload entirely. `syncRemoteTextFileWithHashSkip`
1322
+ // fails loud on a check error rather than silently re-uploading.
1323
+ async function syncProcessSessionRemoteScript(input) {
1324
+ const { uploaded } = await syncRemoteTextFileWithHashSkip({
1325
+ runner: input.runner,
1326
+ remoteCwd: input.remoteCwd,
1327
+ remoteDir: input.remoteScriptDir,
1328
+ remotePath: input.remoteScriptPath,
1329
+ body: getProcessSessionRemoteSource({ outputToStdout: input.outputToStdout === true }),
1330
+ label: "Process session remote script",
1331
+ action: "sync process session remote script",
1332
+ lockDir: path.posix.join(input.remoteScriptDir, ".paperclip-process-session-script.lock"),
1333
+ timeoutMs: input.timeoutMs,
1334
+ shellCommand: input.shellCommand,
1335
+ });
1336
+ return { uploaded };
1337
+ }
1338
+ async function readRemoteJsonFiles(input) {
1339
+ const names = await input.client.listJsonFiles(input.dir);
1340
+ const out = [];
1341
+ for (const name of names) {
1342
+ const filePath = path.posix.join(input.dir, name);
1343
+ const body = await input.client.readTextFile(filePath);
1344
+ await input.client.remove(filePath).catch(() => undefined);
1345
+ out.push({ name, body });
1346
+ }
1347
+ return out;
1348
+ }
1349
+ async function waitForLocalServerListen(server) {
1350
+ await new Promise((resolve, reject) => {
1351
+ server.once("error", reject);
1352
+ server.listen(0, "127.0.0.1", () => {
1353
+ server.off("error", reject);
1354
+ resolve();
1355
+ });
1356
+ });
1357
+ const address = server.address();
1358
+ if (!address || typeof address === "string") {
1359
+ throw new Error("Process session bridge did not expose a TCP port.");
1360
+ }
1361
+ return address.port;
1362
+ }
1363
+ /** Span name that wraps the socket handler's one `writeTextFile` exec — one
1364
+ * outbound ACP message to the agent. */
1365
+ const AGENT_SESSION_SEND_INPUT_SPAN = "sandbox.agentSession.sendInput";
1366
+ /** Span name that wraps one 100 ms poll tick — `list`, then `read`+`remove` per
1367
+ * file found (`1 + 2n` execs). */
1368
+ const AGENT_SESSION_POLL_OUTPUT_SPAN = "sandbox.agentSession.pollOutput";
1369
+ export async function startAdapterExecutionTargetProcessSessionBridge(input) {
1370
+ if (!input.target || input.target.kind !== "remote") {
1371
+ return null;
1372
+ }
1373
+ const target = input.target;
1374
+ const onLog = input.onLog ?? (async () => { });
1375
+ // Failure diagnostics are best effort: stalled or failed run-log persistence
1376
+ // must not prevent sending shutdown or removing the bridge's session files.
1377
+ const logFailureWithoutWaiting = (message) => {
1378
+ void Promise.resolve().then(() => onLog("stderr", message)).catch(() => undefined);
1379
+ };
1380
+ const runner = adapterExecutionTargetCommandRunner(target);
1381
+ // Run one unit of run-time work under its named wrapper span when a span
1382
+ // runner is injected. Without a runner, run the work under the current run
1383
+ // parent, so the inner `sandbox.exec` spans parent to the live run span,
1384
+ // exactly like the earlier behavior.
1385
+ const runRuntimeWork = (name, work) => input.runtimeSpan
1386
+ ? input.runtimeSpan(name, work)
1387
+ : runWithRuntimeParent(input.getRuntimeParentContext?.(), work);
1388
+ const shellCommand = adapterExecutionTargetShellCommand(target);
1389
+ const timeoutMs = typeof input.timeoutSec === "number" && Number.isFinite(input.timeoutSec) && input.timeoutSec > 0
1390
+ ? Math.trunc(input.timeoutSec * 1000)
1391
+ : adapterExecutionTargetTimeoutMs(target) ?? undefined;
1392
+ const bridgeRuntimeDir = path.posix.join(input.runtimeRootDir?.trim() || path.posix.join(target.remoteCwd, ".paperclip-runtime", input.adapterKey), "process-sessions");
1393
+ const sessionId = randomUUID();
1394
+ const sessionDir = path.posix.join(bridgeRuntimeDir, sessionId);
1395
+ const stdinDir = path.posix.join(sessionDir, "stdin");
1396
+ const eventsDir = path.posix.join(sessionDir, "events");
1397
+ // The streamed wrapper writes its frames to stdout and rides a separate remote
1398
+ // path, so a warm sandbox can hold both wrapper scripts without the content
1399
+ // hash-skip gate thrashing when a run switches output mode.
1400
+ const streamOutput = input.streamOutputViaSession === true;
1401
+ const remoteScriptPath = path.posix.join(bridgeRuntimeDir, streamOutput ? PROCESS_SESSION_REMOTE_STREAM_SCRIPT : PROCESS_SESSION_REMOTE_SCRIPT);
1402
+ const client = createCommandManagedSandboxCallbackBridgeQueueClient({
1403
+ runner,
1404
+ remoteCwd: target.remoteCwd,
1405
+ timeoutMs,
1406
+ shellCommand,
1407
+ });
1408
+ // The launch exec below re-creates stdinDir and eventsDir with one `mkdir -p`,
1409
+ // and the remote script also creates them on start. No reader touches the two
1410
+ // directories before the launch exec runs, so upfront makeDir execs are redundant.
1411
+ await syncProcessSessionRemoteScript({
1412
+ runner,
1413
+ remoteCwd: target.remoteCwd,
1414
+ remoteScriptDir: bridgeRuntimeDir,
1415
+ remoteScriptPath,
1416
+ timeoutMs,
1417
+ shellCommand,
1418
+ outputToStdout: streamOutput,
1419
+ });
1420
+ // Resolve the launch env AFTER the env-independent setup above, so a caller
1421
+ // can defer it until an upstream dependency (e.g. the paperclip bridge's env)
1422
+ // is ready without blocking the dir/script setup.
1423
+ const launchEnv = typeof input.env === "function" ? await input.env() : input.env;
1424
+ const commandPayload = Buffer.from(JSON.stringify({
1425
+ command: input.command,
1426
+ args: input.args,
1427
+ cwd: input.cwd || target.remoteCwd,
1428
+ // The ACP engine has already projected this launch env from explicit
1429
+ // adapter/runtime inputs and registered contributions. Compare against an
1430
+ // empty inherited baseline so an explicit identity value (notably PATH)
1431
+ // is not reclassified as ambient merely because it equals the host value.
1432
+ env: sanitizeRemoteExecutionEnv(launchEnv, {}),
1433
+ }), "utf8").toString("base64");
1434
+ // Base64 plus JSON escaping can push an otherwise valid child environment
1435
+ // past Linux's per-argument/per-variable exec limit. Keep small launches on
1436
+ // the existing path; upload larger envelopes in bounded chunks instead.
1437
+ const commandEnv = {};
1438
+ if (commandPayload.length <= 64 * 1024) {
1439
+ commandEnv.PAPERCLIP_PROCESS_SESSION_COMMAND_B64 = commandPayload;
1440
+ }
1441
+ else {
1442
+ const payloadPath = path.posix.join(sessionDir, "command.b64");
1443
+ const runPayloadSetup = async (script) => {
1444
+ const result = await runSandboxBridgeControlCommand(runner, {
1445
+ command: shellCommand,
1446
+ args: shellCommandArgs(script),
1447
+ cwd: target.remoteCwd,
1448
+ timeoutMs,
1449
+ bypassSession: true,
1450
+ });
1451
+ if (result.timedOut || result.exitCode !== 0) {
1452
+ throw new Error("Failed to stage sandbox process session command payload.");
1453
+ }
1454
+ };
1455
+ try {
1456
+ // The envelope can contain credentials. Its upload intermediates stay
1457
+ // inside a private session directory, and the wrapper deletes it before
1458
+ // spawning the child. Teardown removes it if the wrapper cannot start.
1459
+ await runPayloadSetup(`umask 077 && mkdir -m 700 ${shellQuote(sessionDir)}`);
1460
+ await client.writeTextFile(payloadPath, commandPayload);
1461
+ await runPayloadSetup(`chmod 600 ${shellQuote(payloadPath)}`);
1462
+ }
1463
+ catch (error) {
1464
+ await client.remove(sessionDir).catch(() => undefined);
1465
+ throw error;
1466
+ }
1467
+ }
1468
+ // Legacy poll path: background the wrapper with `nohup` and read its output
1469
+ // event files with the host poll below. The streamed path launches the wrapper
1470
+ // as one foreground session command further down instead, so skip this.
1471
+ if (!streamOutput) {
1472
+ await onLog("stdout", `[paperclip] Starting ACP process session bridge in ${describeAdapterExecutionTarget(target)}.\n`);
1473
+ const startResult = await runSandboxBridgeControlCommand(runner, {
1474
+ command: shellCommand,
1475
+ args: shellCommandArgs([
1476
+ `mkdir -p ${shellQuote(stdinDir)} ${shellQuote(eventsDir)}`,
1477
+ // I3: no numeric process identifier anywhere. Background the
1478
+ // wrapper and let it go; do not capture `$!`.
1479
+ `PAPERCLIP_PROCESS_SESSION_DIR=${shellQuote(sessionDir)} ` +
1480
+ Object.entries(commandEnv).map(([key, value]) => `${key}=${shellQuote(value)} `).join("") +
1481
+ `nohup node ${shellQuote(remoteScriptPath)} >/dev/null 2>&1 < /dev/null &`,
1482
+ ].join("\n")),
1483
+ cwd: target.remoteCwd,
1484
+ env: {
1485
+ PAPERCLIP_SANDBOX_EXEC_CHANNEL: "bridge",
1486
+ },
1487
+ timeoutMs,
1488
+ // The wrapper launch is bridge plumbing. Keep it off the persistent
1489
+ // session so it never queues behind an in-run session command.
1490
+ bypassSession: true,
1491
+ }).catch(async (error) => {
1492
+ await client.remove(sessionDir).catch(() => undefined);
1493
+ throw error;
1494
+ });
1495
+ if (startResult.timedOut || (startResult.exitCode ?? 1) !== 0) {
1496
+ await client.remove(sessionDir).catch(() => undefined);
1497
+ throw new Error(`Failed to start sandbox ACP process session bridge: ${startResult.stderr || startResult.stdout}`);
1498
+ }
1499
+ }
1500
+ let socket = null;
1501
+ let stopping = false;
1502
+ // Resolves when `stop()` tears the bridge down. The streamed `sandbox.agentProcess`
1503
+ // span races its work against this, so the span ends at teardown at the latest
1504
+ // even when the remote process lingers, and never outlives the run root span.
1505
+ let signalStopped = () => { };
1506
+ const stopped = new Promise((resolve) => {
1507
+ signalStopped = resolve;
1508
+ });
1509
+ let stdinSeq = 0;
1510
+ // One promise chain per session that serializes the stdin file writes. Each
1511
+ // write is multi-exec on the command-managed client: prepare, append per 32
1512
+ // KiB, then an atomic rename. The chain makes the rename for file N finish
1513
+ // before the write for file N+1 starts, so the files land in send order.
1514
+ // Without it the writes overlap. A small later chunk can then rename ahead of
1515
+ // a big earlier chunk, so the wrapper reads the stdin bytes out of order and
1516
+ // corrupts a large prompt on the stdin path.
1517
+ let stdinWriteChain = Promise.resolve();
1518
+ let stdinDeliveryFailed = false;
1519
+ const writeStdinFile = async (filePath, body) => {
1520
+ // Retry the same sequence, never the ACP request or the tool itself. Each
1521
+ // upload uses private temporary paths, and the wrapper drops sequences it
1522
+ // already consumed when a provider loses the final rename's response.
1523
+ for (let attempt = 1;; attempt += 1) {
1524
+ try {
1525
+ await client.writeTextFile(filePath, body);
1526
+ return;
1527
+ }
1528
+ catch (error) {
1529
+ // Plugin RPC preserves provider messages but not HTTP error classes.
1530
+ // Match the Daytona SDK and Cloudflare bridge's gateway diagnostics
1531
+ // exactly; shell failures and auth errors must still fail immediately.
1532
+ const gatewayFailure = error instanceof Error && (/^Request failed with status code (502|503|504)$/.test(error.message) ||
1533
+ /^Cloudflare sandbox bridge request failed with HTTP (502|503|504)\.$/.test(error.message));
1534
+ if (!gatewayFailure || attempt >= 3)
1535
+ throw error;
1536
+ await new Promise((resolve) => setTimeout(resolve, attempt * 250));
1537
+ }
1538
+ }
1539
+ };
1540
+ let pollTimer = null;
1541
+ let terminalEvidence = null;
1542
+ const recordTerminalEvidence = (source, event) => {
1543
+ if (terminalEvidence)
1544
+ return;
1545
+ // Remote frames are untrusted. Keep the retained diagnostic bounded and
1546
+ // independent of messages, commands, paths, payloads, and provider errors.
1547
+ const outcome = event.type === "exit" ? "exit" : "error";
1548
+ const code = typeof event.code === "number" && Number.isInteger(event.code)
1549
+ && event.code >= 0 && event.code <= 255 ? event.code : "unknown";
1550
+ const signal = ACP_PROCESS_TERMINAL_SIGNALS.find((name) => name === event.signal) ?? "unknown";
1551
+ terminalEvidence = { source, outcome, exitCode: code, signal };
1552
+ logFailureWithoutWaiting(`[paperclip] ACP process session terminal: source=${source} outcome=${outcome} exitCode=${code} signal=${signal}.\n`);
1553
+ };
1554
+ const pendingRemoteEvents = [];
1555
+ const token = createSandboxCallbackBridgeToken(18);
1556
+ const proxyDir = await fs.mkdtemp(path.join(os.tmpdir(), "paperclip-process-session-proxy-"));
1557
+ // `stop()` waits on this promise, bounded, for the wrapper's `shutdownAck`
1558
+ // event. `deliverRemoteEvent` resolves it below and never forwards the
1559
+ // event further: it is a host-internal control ack, not part of the ACP
1560
+ // output stream. An event under `sessionDir` is untrusted telemetry: an
1561
+ // `exit` or `error` event is never treated as proof of shutdown, because
1562
+ // any process running under the sandbox can write one. Only `shutdownAck`
1563
+ // counts, and `stop()` also gives itself a dedicated reader for it below,
1564
+ // so a late `shutdownAck` still lands even after the long-lived poll has
1565
+ // stopped re-arming.
1566
+ let signalShutdownAcknowledged = () => { };
1567
+ const shutdownAcknowledged = new Promise((resolve) => {
1568
+ signalShutdownAcknowledged = resolve;
1569
+ });
1570
+ const writeRemoteEventToSocket = (event) => {
1571
+ if (!socket)
1572
+ return false;
1573
+ // `stopping` can already be set by a terminal frame buffered before auth.
1574
+ // Use the socket's outbound state instead: once end() has been called,
1575
+ // another write would destroy it and truncate the frame still draining.
1576
+ // This also covers input-delivery failure, which ends the socket directly.
1577
+ if (socket.writableEnded || socket.destroyed)
1578
+ return true;
1579
+ socket.write(jsonLine(event));
1580
+ if (event.type === "exit" || event.type === "error") {
1581
+ stopping = true;
1582
+ // Flush the terminal frame and all earlier output before closing. An
1583
+ // immediate destroy can discard the cause and leave only connection_close.
1584
+ socket.end();
1585
+ }
1586
+ return true;
1587
+ };
1588
+ const deliverRemoteEvent = (event, source = "remote_event") => {
1589
+ if (event.type === "shutdownAck") {
1590
+ signalShutdownAcknowledged();
1591
+ return;
1592
+ }
1593
+ if (event.type === "exit" || event.type === "error")
1594
+ recordTerminalEvidence(source, event);
1595
+ if (socket) {
1596
+ writeRemoteEventToSocket(event);
1597
+ return;
1598
+ }
1599
+ pendingRemoteEvents.push(event);
1600
+ if (event.type === "exit" || event.type === "error") {
1601
+ stopping = true;
1602
+ }
1603
+ };
1604
+ const flushPendingRemoteEvents = () => {
1605
+ if (!socket)
1606
+ return;
1607
+ while (pendingRemoteEvents.length > 0 && socket) {
1608
+ const event = pendingRemoteEvents.shift();
1609
+ if (event)
1610
+ writeRemoteEventToSocket(event);
1611
+ }
1612
+ };
1613
+ const liveSockets = new Set();
1614
+ // Register the per-connection socket handlers with no run parent context.
1615
+ // A stdin write from a socket handler is a run-time exec, not startup work.
1616
+ // The connection can open under `task.run` and receive stdin later, during an
1617
+ // `agent.turn`. So the handler must read the current-run parent at send time,
1618
+ // not at connect time. A connect-time read captures the parent that was live
1619
+ // when the socket opened, and every later exec span parents to that stale
1620
+ // parent. The `data` handler below reads the getter per message instead.
1621
+ const server = net.createServer((nextSocket) => {
1622
+ liveSockets.add(nextSocket);
1623
+ nextSocket.setEncoding("utf8");
1624
+ nextSocket.on("error", () => undefined);
1625
+ let connectionBuffer = "";
1626
+ let authenticated = false;
1627
+ // Connections own the session (and receive buffered process output) only
1628
+ // after presenting the bridge token; idle unauthenticated peers are dropped.
1629
+ const authTimer = setTimeout(() => {
1630
+ if (!authenticated)
1631
+ nextSocket.destroy();
1632
+ }, PROCESS_SESSION_AUTH_TIMEOUT_MS);
1633
+ authTimer.unref?.();
1634
+ nextSocket.on("close", () => {
1635
+ clearTimeout(authTimer);
1636
+ liveSockets.delete(nextSocket);
1637
+ if (authenticated && !stopping)
1638
+ recordTerminalEvidence("proxy_close", { type: "error" });
1639
+ });
1640
+ nextSocket.on("data", (chunk) => {
1641
+ connectionBuffer += chunk;
1642
+ const split = splitJsonLines(connectionBuffer);
1643
+ connectionBuffer = split.rest;
1644
+ for (const line of split.lines) {
1645
+ if (!line.trim())
1646
+ continue;
1647
+ let message;
1648
+ try {
1649
+ message = JSON.parse(line);
1650
+ }
1651
+ catch {
1652
+ nextSocket.destroy();
1653
+ return;
1654
+ }
1655
+ if (message.token !== token) {
1656
+ nextSocket.destroy();
1657
+ return;
1658
+ }
1659
+ if (!authenticated) {
1660
+ if (socket) {
1661
+ nextSocket.destroy();
1662
+ return;
1663
+ }
1664
+ authenticated = true;
1665
+ clearTimeout(authTimer);
1666
+ socket = nextSocket;
1667
+ flushPendingRemoteEvents();
1668
+ }
1669
+ // Wrap one outbound ACP message to the agent in a
1670
+ // `sandbox.agentSession.sendInput` span, so its one `writeTextFile` exec
1671
+ // groups under one named span. The span runner reads the current-run
1672
+ // parent at send time: the live parent switches to `agent.turn` during
1673
+ // the turn and back to `task.run` after it. A message that is neither
1674
+ // `stdin` nor `stdinEnd` writes nothing, so it opens no span.
1675
+ const stdinPayload = message.type === "stdin" && typeof message.data === "string"
1676
+ ? { type: "stdin", data: message.data }
1677
+ : message.type === "stdinEnd"
1678
+ ? { type: "stdinEnd" }
1679
+ : null;
1680
+ if (stdinPayload) {
1681
+ stdinSeq += 1;
1682
+ const name = `${String(stdinSeq).padStart(12, "0")}.json`;
1683
+ const filePath = path.posix.join(stdinDir, name);
1684
+ // Chain this write after the previous one, so the atomic rename for
1685
+ // file N finishes before the write for file N+1 starts. Keep the
1686
+ // per-message `sandbox.agentSession.sendInput` span inside the chain.
1687
+ stdinWriteChain = stdinWriteChain.then(async () => {
1688
+ if (stdinDeliveryFailed)
1689
+ return;
1690
+ try {
1691
+ await runRuntimeWork(AGENT_SESSION_SEND_INPUT_SPAN, () => writeStdinFile(filePath, jsonLine(stdinPayload)));
1692
+ }
1693
+ catch {
1694
+ stdinDeliveryFailed = true;
1695
+ stopping = true;
1696
+ recordTerminalEvidence("input_delivery", { type: "error" });
1697
+ const message = "ACP process session input delivery failed.";
1698
+ // Flush the diagnostic before closing; destroy() can discard it
1699
+ // and leave only ACP's generic connection_close error. Do not
1700
+ // expose provider error text, which may contain a command payload.
1701
+ // A remote terminal frame may already be draining while this
1702
+ // accepted stdin write fails. end(data) would write after end
1703
+ // and discard that first failure just like socket.write(data).
1704
+ if (!nextSocket.writableEnded && !nextSocket.destroyed) {
1705
+ nextSocket.end(jsonLine({ type: "error", message }));
1706
+ }
1707
+ // stop() awaits this input chain before sending shutdown. Run-log
1708
+ // persistence must not hold teardown open when it stalls or fails.
1709
+ logFailureWithoutWaiting(`[paperclip] ${message}\n`);
1710
+ }
1711
+ });
1712
+ }
1713
+ }
1714
+ });
1715
+ });
1716
+ const poll = async () => {
1717
+ if (stopping)
1718
+ return;
1719
+ try {
1720
+ // Read every file this tick fetched before this loop decides whether to
1721
+ // keep polling. A `shutdownAck` can land in the same batch right after
1722
+ // an `exit` event; deliver it too, so this tick never drops an
1723
+ // already-fetched (and already-removed-from-disk) event.
1724
+ const events = await readRemoteJsonFiles({ client, dir: eventsDir });
1725
+ for (const event of events) {
1726
+ const parsed = JSON.parse(event.body);
1727
+ deliverRemoteEvent(parsed);
1728
+ }
1729
+ }
1730
+ catch (error) {
1731
+ const message = error instanceof Error ? error.message : String(error);
1732
+ // A stuck log sink must not strand the adapter waiting for this failure.
1733
+ deliverRemoteEvent({ type: "error", message }, "output_poll");
1734
+ return;
1735
+ }
1736
+ finally {
1737
+ if (!stopping) {
1738
+ schedulePoll();
1739
+ }
1740
+ }
1741
+ };
1742
+ // Schedule the long-lived poll timer. Wrap each 100 ms poll tick in a
1743
+ // `sandbox.agentSession.pollOutput` span, so the tick's `list` plus per-file
1744
+ // `read`/`remove` execs group under one named span. The poll loop reads remote
1745
+ // event files with run-time execs, not startup work, so the wrapper span and
1746
+ // its child execs parent to the live run span, not to the ended bridge step.
1747
+ // The span runner reads the run parent per tick, because the re-arm timer that
1748
+ // the poll body schedules opens a new tick span: the live parent switches to
1749
+ // `agent.turn` during the turn and back to `task.run` after it.
1750
+ const schedulePoll = () => {
1751
+ pollTimer = setTimeout(() => void runRuntimeWork(AGENT_SESSION_POLL_OUTPUT_SPAN, poll), 100);
1752
+ pollTimer.unref?.();
1753
+ };
1754
+ const port = await waitForLocalServerListen(server);
1755
+ const agentCommand = await writeProcessSessionProxyScript(proxyDir, port, token);
1756
+ if (streamOutput) {
1757
+ // Streamed output path. Run the wrapper as one long-lived session command;
1758
+ // its stdout carries newline-delimited JSON frames that reach the host
1759
+ // through the provider session log stream. Deliver each frame exactly once
1760
+ // by its monotonic `seq`, so a frame that arrives both live and in the final
1761
+ // result is not repeated. There is no host output-file poll here.
1762
+ let streamBuffer = "";
1763
+ let lastSeq = 0;
1764
+ let sawTerminal = false;
1765
+ const deliverFrame = (frame) => {
1766
+ if (typeof frame.seq === "number") {
1767
+ if (frame.seq <= lastSeq)
1768
+ return;
1769
+ lastSeq = frame.seq;
1770
+ }
1771
+ if (frame.type === "exit" || frame.type === "error")
1772
+ sawTerminal = true;
1773
+ deliverRemoteEvent(frame);
1774
+ };
1775
+ const parseFrameLine = (line) => {
1776
+ if (!line.trim())
1777
+ return;
1778
+ let frame;
1779
+ try {
1780
+ frame = JSON.parse(line);
1781
+ }
1782
+ catch {
1783
+ return;
1784
+ }
1785
+ deliverFrame(frame);
1786
+ };
1787
+ // Live delivery: buffer partial lines across stream chunks, deliver each
1788
+ // complete frame line as it arrives.
1789
+ const ingestStreamChunk = (text) => {
1790
+ streamBuffer += text;
1791
+ const split = splitJsonLines(streamBuffer);
1792
+ streamBuffer = split.rest;
1793
+ for (const line of split.lines)
1794
+ parseFrameLine(line);
1795
+ };
1796
+ // Terminal delivery (the defined fallback to the poll): the resolved result
1797
+ // carries the full wrapper stdout even when the live stream degraded to the
1798
+ // provider session-log poll. The text is complete and self-contained, so
1799
+ // re-parse it on its own; the `seq` guard drops every frame the live stream
1800
+ // already delivered. Drop any partial live line — its complete form is in the
1801
+ // full text.
1802
+ const ingestFinalText = (text) => {
1803
+ streamBuffer = "";
1804
+ for (const line of text.split(/\n/))
1805
+ parseFrameLine(line);
1806
+ };
1807
+ await onLog("stdout", `[paperclip] Starting streamed ACP process session bridge in ${describeAdapterExecutionTarget(target)}.\n`);
1808
+ // Fire the long-lived command; do NOT await it here. `useSession` forces the
1809
+ // persistent session so the provider streams the wrapper stdout back through
1810
+ // `onLog`. On resolve, the terminal re-parse fills any frames the live stream
1811
+ // missed; on reject, deliver one error frame so the local proxy fails loud.
1812
+ //
1813
+ // Wrap the launch in a `sandbox.agentProcess` span. `runRuntimeWork` parents
1814
+ // it to the LIVE RUN root (`task.run` at launch time — no turn has started
1815
+ // yet), not to the ephemeral `bridge.process-session` bring-up step, and it
1816
+ // stays open for the whole process lifetime. The inner `sandbox.exec` nests
1817
+ // under it. Without the wrapper the raw exec's span inherits the ~2.28s
1818
+ // bring-up step as its parent and then dangles ~50s past it, overlapping
1819
+ // `agent.turn` — a child outliving its parent. As a run-scoped span it reads
1820
+ // instead as a resource that OVERLAPS the sibling `agent.turn`, which is the
1821
+ // correct shape (the persistent process hosts the turn; it is not a child of
1822
+ // it, and on multi-turn runs one process spans several turns). `runRuntimeWork`
1823
+ // is voided, not awaited, so bring-up never blocks on the long-lived command,
1824
+ // and it defaults to a no-op parent when no span runner is injected.
1825
+ //
1826
+ // The span is bounded to the bridge lifecycle: it ends when the command
1827
+ // settles OR when `stop()` runs, whichever comes first. `stop()` runs during
1828
+ // run teardown, before the caller ends the `task.run` root span, so the span
1829
+ // never outlives the run root even if the remote process lingers past
1830
+ // teardown (`execute` has no cancel, so a lingering process cannot be forced
1831
+ // to resolve). The command promise keeps running after the span ends so its
1832
+ // frame handlers still deliver; they no-op once `stopping` is set.
1833
+ void runRuntimeWork("sandbox.agentProcess", async () => {
1834
+ const commandSettled = (async () => {
1835
+ try {
1836
+ const result = await runner.execute({
1837
+ command: shellCommand,
1838
+ args: shellCommandArgs(`node ${shellQuote(remoteScriptPath)}`),
1839
+ cwd: target.remoteCwd,
1840
+ env: {
1841
+ PAPERCLIP_PROCESS_SESSION_DIR: sessionDir,
1842
+ ...commandEnv,
1843
+ PAPERCLIP_SANDBOX_EXEC_CHANNEL: "bridge",
1844
+ },
1845
+ timeoutMs,
1846
+ useSession: true,
1847
+ onLog: async (stream, chunk) => {
1848
+ if (stream === "stdout")
1849
+ ingestStreamChunk(chunk);
1850
+ },
1851
+ });
1852
+ ingestFinalText(result.stdout);
1853
+ if (!sawTerminal && !stopping) {
1854
+ // A shell can fail before the wrapper emits any frames. Preserve
1855
+ // that launch diagnostic instead of reporting only its exit code.
1856
+ if (result.stderr)
1857
+ await onLog("stderr", result.stderr);
1858
+ deliverRemoteEvent({
1859
+ type: "exit",
1860
+ code: typeof result.exitCode === "number" ? result.exitCode : null,
1861
+ signal: result.signal,
1862
+ }, "output_stream");
1863
+ }
1864
+ }
1865
+ catch (error) {
1866
+ if (!stopping) {
1867
+ deliverRemoteEvent({
1868
+ type: "error",
1869
+ message: error instanceof Error ? error.message : String(error),
1870
+ }, "output_stream");
1871
+ }
1872
+ }
1873
+ })();
1874
+ await Promise.race([commandSettled, stopped]);
1875
+ });
1876
+ }
1877
+ else {
1878
+ schedulePoll();
1879
+ }
1880
+ // `stop()` cannot rely on the long-lived poll above to observe a late
1881
+ // `shutdownAck`: that poll stops re-arming as soon as it forwards a
1882
+ // terminal `exit`/`error` event, and `stop()` itself sets `stopping` on
1883
+ // its own first line. A normal completion's `shutdownAck` file, written a
1884
+ // moment after `exit`, can then land on disk after nobody reads the events
1885
+ // directory any more. Give `stop()` its own bounded reader that looks only
1886
+ // for `shutdownAck` and ignores every other event type, so the wait below
1887
+ // shortens on the wrapper's own proof of shutdown -- never on an `exit` or
1888
+ // `error` event, which any process running under `sessionDir` can forge.
1889
+ let stopReadingForShutdownAck = false;
1890
+ const readShutdownAckUntil = (deadlineEpochMs) => {
1891
+ if (stopReadingForShutdownAck)
1892
+ return;
1893
+ void (async () => {
1894
+ try {
1895
+ const events = await readRemoteJsonFiles({ client, dir: eventsDir });
1896
+ if (stopReadingForShutdownAck)
1897
+ return;
1898
+ for (const event of events) {
1899
+ try {
1900
+ const parsed = JSON.parse(event.body);
1901
+ if (parsed.type === "shutdownAck") {
1902
+ signalShutdownAcknowledged();
1903
+ return;
1904
+ }
1905
+ }
1906
+ catch {
1907
+ // Not readable JSON yet. It is not a `shutdownAck`; ignore it.
1908
+ }
1909
+ }
1910
+ }
1911
+ catch {
1912
+ // Best-effort: a read failure here is not proof of anything.
1913
+ }
1914
+ if (!stopReadingForShutdownAck && Date.now() < deadlineEpochMs) {
1915
+ const timer = setTimeout(() => readShutdownAckUntil(deadlineEpochMs), 100);
1916
+ timer.unref?.();
1917
+ }
1918
+ })();
1919
+ };
1920
+ return {
1921
+ agentCommand,
1922
+ readTerminalEvidence: () => terminalEvidence,
1923
+ stop: async () => {
1924
+ stopping = true;
1925
+ // End the `sandbox.agentProcess` span now, before the caller ends the run
1926
+ // root span, even if the remote command has not resolved yet.
1927
+ signalStopped();
1928
+ if (pollTimer)
1929
+ clearTimeout(pollTimer);
1930
+ for (const liveSocket of liveSockets)
1931
+ liveSocket.destroy();
1932
+ await new Promise((resolve) => server.close(() => resolve())).catch(() => undefined);
1933
+ // Wait for every accepted stdin write before `stdinEnd`. The socket handler
1934
+ // fires each chunk write un-awaited through `stdinWriteChain`, so an earlier
1935
+ // chunk can still be pending here. Chain the `stdinEnd` write onto the same
1936
+ // per-session chain, so its file rename never finishes before an earlier
1937
+ // chunk. `stdinSeq` is stable now, because the sockets are destroyed and the
1938
+ // server is closed, so no new message can increment it.
1939
+ const stdinEndPath = path.posix.join(stdinDir, `${String(stdinSeq + 1).padStart(12, "0")}.json`);
1940
+ const stdinEndWrite = stdinWriteChain.then(() => client.writeTextFile(stdinEndPath, jsonLine({ type: "stdinEnd" })));
1941
+ stdinWriteChain = stdinEndWrite.then(() => undefined, () => undefined);
1942
+ await stdinEndWrite.catch(() => undefined);
1943
+ // The `shutdown` control message tells the wrapper to terminate itself
1944
+ // and its own child (I3: no operating-system signal and no process
1945
+ // identifier cross this boundary — only a file-queue message does).
1946
+ // Chain it onto the same per-session write order as `stdinEnd`, so its
1947
+ // file never lands before the earlier one.
1948
+ const shutdownPath = path.posix.join(stdinDir, `${String(stdinSeq + 2).padStart(12, "0")}.json`);
1949
+ const shutdownWrite = stdinWriteChain.then(() => client.writeTextFile(shutdownPath, jsonLine({ type: "shutdown" })));
1950
+ stdinWriteChain = shutdownWrite.then(() => undefined, () => undefined);
1951
+ await shutdownWrite.catch(() => undefined);
1952
+ // Wait a bounded budget for a hint that the wrapper stopped: only the
1953
+ // `shutdownAck` event counts; an `exit` or `error` event is untrusted
1954
+ // telemetry from inside the sandbox and never shortens this wait or
1955
+ // suppresses the warning below. `shutdownAck` itself is ALSO an
1956
+ // untrusted hint, not proof: any process that shares the sandbox can
1957
+ // write the same event under this session's event directory. It can
1958
+ // only shorten this wait and suppress the warning below; it never
1959
+ // gates, shortens, or replaces the unconditional removal further down.
1960
+ // What actually makes the wrapper's own termination deterministic is
1961
+ // the wrapper-side session-identity latch, not this event.
1962
+ let acknowledgedInTime = false;
1963
+ readShutdownAckUntil(Date.now() + DEFAULT_PROCESS_SESSION_SHUTDOWN_WAIT_MS);
1964
+ await Promise.race([
1965
+ shutdownAcknowledged.then(() => {
1966
+ acknowledgedInTime = true;
1967
+ }),
1968
+ new Promise((resolve) => {
1969
+ const budgetTimer = setTimeout(resolve, DEFAULT_PROCESS_SESSION_SHUTDOWN_WAIT_MS);
1970
+ budgetTimer.unref?.();
1971
+ }),
1972
+ ]);
1973
+ stopReadingForShutdownAck = true;
1974
+ if (!acknowledgedInTime) {
1975
+ logFailureWithoutWaiting(`[paperclip] ACP process session wrapper did not acknowledge shutdown within ${DEFAULT_PROCESS_SESSION_SHUTDOWN_WAIT_MS}ms; removing the session directory anyway.\n`);
1976
+ }
1977
+ // Unconditional: this removal runs whether or not the wrapper
1978
+ // acknowledged, and whether or not any event (real or forged) arrived
1979
+ // under `sessionDir`. `stop()` runs during run teardown and must stay
1980
+ // non-fatal, so every step above is best-effort and this step never
1981
+ // throws.
1982
+ await client.remove(sessionDir).catch(() => undefined);
1983
+ await fs.rm(proxyDir, { recursive: true, force: true }).catch(() => undefined);
1984
+ },
1985
+ };
1986
+ }
1987
+ function getProcessSessionProxySource(input) {
1988
+ return `#!/usr/bin/env node
1989
+ import net from "node:net";
1990
+
1991
+ const socket = net.createConnection({ host: "127.0.0.1", port: ${input.port} });
1992
+ const token = ${JSON.stringify(input.token)};
1993
+ let buffer = "";
1994
+ let exiting = false;
1995
+
1996
+ function send(message) {
1997
+ if (exiting) return;
1998
+ socket.write(JSON.stringify({ token, ...message }) + "\\n");
1999
+ }
2000
+
2001
+ function finish(code) {
2002
+ if (exiting) return;
2003
+ exiting = true;
2004
+ process.exitCode = code;
2005
+ // ACP keeps stdin open while waiting for a reply. Release that handle when
2006
+ // the remote process stops, but let pending stdout/stderr writes drain.
2007
+ process.stdin.destroy();
2008
+ socket.end();
2009
+ }
2010
+
2011
+ socket.on("connect", () => send({ type: "hello" }));
2012
+ process.stdin.on("data", (chunk) => send({ type: "stdin", data: Buffer.from(chunk).toString("base64") }));
2013
+ process.stdin.on("end", () => send({ type: "stdinEnd" }));
2014
+ process.stdin.resume();
2015
+
2016
+ socket.setEncoding("utf8");
2017
+ socket.on("data", (chunk) => {
2018
+ buffer += chunk;
2019
+ const parts = buffer.split(/\\n/);
2020
+ buffer = parts.pop() || "";
2021
+ for (const line of parts) {
2022
+ if (!line.trim()) continue;
2023
+ const message = JSON.parse(line);
2024
+ if (message.type === "data") {
2025
+ const out = Buffer.from(message.data || "", "base64");
2026
+ (message.stream === "stderr" ? process.stderr : process.stdout).write(out);
2027
+ } else if (message.type === "error") {
2028
+ process.stderr.write(String(message.message || "Process session bridge failed.") + "\\n");
2029
+ finish(1);
2030
+ } else if (message.type === "exit") {
2031
+ finish(typeof message.code === "number" ? message.code : 1);
2032
+ }
2033
+ }
2034
+ });
2035
+ socket.on("close", () => {
2036
+ if (!exiting) process.exit(1);
2037
+ });
2038
+ `;
2039
+ }
2040
+ export function getProcessSessionRemoteSource(input) {
2041
+ return input?.outputToStdout === true
2042
+ ? getProcessSessionRemoteStreamSource()
2043
+ : getProcessSessionRemoteEventFileSource();
2044
+ }
2045
+ // The shared stdin drain. Both wrappers read newline-delimited stdin messages
2046
+ // from the stdin file queue and write them to the child, then end the child
2047
+ // stdin on `stdinEnd`. A write to a closed child stdin only emits an `error`
2048
+ // event, so the wrapper installs a no-op handler at the call site.
2049
+ const PROCESS_SESSION_STDIN_POLL_TAIL = `child.stdin.on("error", () => {});
2050
+
2051
+ // A stdin file can appear before the host finishes the write. An empty read is
2052
+ // the non-atomic-write window; a partial read makes JSON.parse throw. The
2053
+ // poller must not delete a file before it validates the content. So read and
2054
+ // parse each file first, and delete it only after a successful parse. The files
2055
+ // sort in send order. If an earlier file is not readable yet, stop the cycle and
2056
+ // keep the order: a later file (for example stdinEnd) must not run ahead of it.
2057
+ // Retry the earlier file on a later cycle. After the retry limit, drop the file
2058
+ // and write an error event, so a lost message fails loud, and let later files
2059
+ // run.
2060
+ const stdinMaxParseRetries = (() => {
2061
+ const raw = Number.parseInt(process.env.PAPERCLIP_PROCESS_SESSION_STDIN_MAX_RETRIES || "", 10);
2062
+ return Number.isFinite(raw) && raw > 0 ? raw : 100;
2063
+ })();
2064
+ const stdinParseRetries = new Map();
2065
+ // Track the next expected sequence number. The host writes the stdin files in
2066
+ // send order and pads the number to 12 digits, starting at 1. The files sort in
2067
+ // send order. When the smallest present number is greater than expected, an
2068
+ // earlier file has not appeared yet: a missing file, not an unreadable one. Hold
2069
+ // the send order and wait for it, bounded by the same retry budget as the
2070
+ // unreadable-file path. This turns a reordering into a loud error, never silent
2071
+ // corruption.
2072
+ let stdinExpectedSeq = 1;
2073
+ let stdinGapRetries = 0;
2074
+
2075
+ // The bounded grace period between the SIGTERM and the SIGKILL a terminate()
2076
+ // call sends. A test can override it through the environment, so a stubborn
2077
+ // child does not force a slow test.
2078
+ const terminateGraceMs = (() => {
2079
+ const raw = Number.parseInt(process.env.PAPERCLIP_PROCESS_SESSION_TERMINATE_GRACE_MS || "", 10);
2080
+ return Number.isFinite(raw) && raw > 0 ? raw : 3000;
2081
+ })();
2082
+
2083
+ // I2: terminate() is the only function in this wrapper that calls
2084
+ // child.kill(). No child event handler and no sibling callback calls it.
2085
+ // terminate() is idempotent: a second call, or a first call after the child
2086
+ // already exited on its own, does nothing beyond what already ran.
2087
+ async function terminate() {
2088
+ if (terminated) return;
2089
+ terminated = true;
2090
+ shuttingDown = true;
2091
+ stdinClosed = true;
2092
+ child.stdin.end();
2093
+ // A \`false\` return means the child's process handle is already gone (the
2094
+ // child exited before this call ran). ChildProcess#kill() is handle-scoped:
2095
+ // once Node clears the handle at reap, the method call above sends no
2096
+ // signal and never falls back to a stored process identifier (I3). Treat
2097
+ // \`false\` as a no-op and do not retry through a numeric identifier.
2098
+ const sentTerm = child.kill("SIGTERM");
2099
+ if (sentTerm) {
2100
+ killTimer = setTimeout(() => {
2101
+ // Escalate on the same handle only (I2): the grace period expired, so
2102
+ // send SIGKILL through the same child handle, never a numeric
2103
+ // identifier and never a process-group signal.
2104
+ child.kill("SIGKILL");
2105
+ }, terminateGraceMs);
2106
+ killTimer.unref?.();
2107
+ }
2108
+ // This event is an untrusted latency hint, not proof. Any process that can
2109
+ // reach this session's event directory can write the same event type. It
2110
+ // can only shorten the host's shutdown wait and suppress the host's
2111
+ // timeout warning; it is never evidence that this wrapper's lifecycle
2112
+ // completed, and the host's cleanup never depends on it. The identity
2113
+ // latch below is what makes this wrapper's own termination deterministic.
2114
+ await writeEvent({ type: "shutdownAck" });
2115
+ }
2116
+
2117
+ // A sandbox peer can delete sessionDir and stdinDir, then recreate a
2118
+ // directory at the same pathname. A pathname does not prove identity: any
2119
+ // process that shares the sandbox can write it. So this wrapper captures the
2120
+ // OS-level identity of both paths once at startup, before the first poll
2121
+ // cycle, and checks it on every later cycle.
2122
+ //
2123
+ // The identity is the device number, the inode number, AND the inode's own
2124
+ // creation time. The device/inode pair alone is not enough: a filesystem can
2125
+ // reissue the exact inode number a just-removed directory held to the very
2126
+ // next directory created at the same path, with no attacker action needed
2127
+ // beyond the recreate the finding already describes. The creation time does
2128
+ // not have this gap: it is set fresh on every inode allocation, even when the
2129
+ // allocator reissues an old inode number, so a recreated directory always
2130
+ // carries a different creation time. The creation time alone is not enough
2131
+ // either, on a filesystem or kernel too old to report it, so this wrapper
2132
+ // keeps the device/inode pair as a second signal rather than relying on
2133
+ // either alone. Ordinary use of stdinDir (the host writing and this wrapper
2134
+ // deleting individual stdin files) changes that directory's OWN change time,
2135
+ // but never its creation time, so the creation time is safe to latch on
2136
+ // without producing a false positive on every stdin message.
2137
+ //
2138
+ // A filesystem or kernel that cannot report a real creation time does not
2139
+ // always report a value of zero. Node fails in one of two ways, and both are
2140
+ // grounded, not assumed: on Linux, when the statx() call finds no creation
2141
+ // time support, the kernel leaves the field unset and Node reports 0. On a
2142
+ // platform whose stat() call has no creation-time field at all, Node copies
2143
+ // the change time into the creation time instead. A 0 value fails open (any
2144
+ // recreated directory then matches on birthtimeMs alone), and a change-time
2145
+ // copy fails closed but far too often (it would move on every stdin file
2146
+ // this wrapper deletes). captureSessionIdentity() below proves the value is
2147
+ // usable before it trusts it, and fails closed on both known fallbacks.
2148
+ let sessionDirIdentity = null;
2149
+ let stdinDirIdentity = null;
2150
+ // The latch. Once set, it never clears. This replaces a counter that a
2151
+ // successful read reset to zero: an attacker who recreated the directory
2152
+ // before the counter reached its threshold kept the wrapper polling forever.
2153
+ // A latch has no threshold to race and no reset path.
2154
+ let identityLost = false;
2155
+
2156
+ async function statPathIdentity(candidatePath) {
2157
+ const stats = await fs.lstat(candidatePath);
2158
+ if (stats.isSymbolicLink()) {
2159
+ const error = new Error("Refusing a symbolic link on a process session control path.");
2160
+ error.code = "EPAPERCLIP_SYMLINK";
2161
+ throw error;
2162
+ }
2163
+ if (!stats.isDirectory()) {
2164
+ const error = new Error("A process session control path is not a directory.");
2165
+ error.code = "ENOTDIR";
2166
+ throw error;
2167
+ }
2168
+ return { dev: stats.dev, ino: stats.ino, birthtimeMs: stats.birthtimeMs };
2169
+ }
2170
+
2171
+ function sameIdentity(left, right) {
2172
+ return left.dev === right.dev && left.ino === right.ino && left.birthtimeMs === right.birthtimeMs;
2173
+ }
2174
+
2175
+ async function latchAndTerminate() {
2176
+ if (identityLost) return;
2177
+ identityLost = true;
2178
+ await terminate();
2179
+ }
2180
+
2181
+ let probeSeq = 0;
2182
+
2183
+ // A probe file name that pollStdin() can never read as a stdin message: it
2184
+ // does not end in ".json", so the ".json" filter in pollStdin() skips it if
2185
+ // a poll cycle ever lists the directory during the probe's short window.
2186
+ function nextProbeFileName() {
2187
+ probeSeq += 1;
2188
+ return ".paperclip-birthtime-probe-" + process.pid + "-" + probeSeq;
2189
+ }
2190
+
2191
+ // Proves a directory's reported birthtimeMs is a real creation time, not a
2192
+ // change-time copy. Creating and removing a file inside a directory changes
2193
+ // that directory's OWN change time but never its true creation time, so a
2194
+ // birthtimeMs that moves across the probe is a change-time copy. Returns
2195
+ // null when the value is proven real. Returns a stderr-ready reason string
2196
+ // on any failure (a detected copy, or a probe that cannot run at all, for
2197
+ // example a permission error or a pre-created probe path): either way the
2198
+ // caller must not trust the value.
2199
+ //
2200
+ // The open uses the "wx" flag: exclusive create, fail if the path exists.
2201
+ // A sandbox peer cannot pre-create the probe path as a symbolic link and
2202
+ // have this call follow it, because "wx" fails closed on an existing path
2203
+ // instead of following a link to it.
2204
+ //
2205
+ async function birthtimeSurvivesProbe(dirPath) {
2206
+ let before;
2207
+ try {
2208
+ before = (await fs.lstat(dirPath)).birthtimeMs;
2209
+ } catch {
2210
+ return "its reported creation time could not be read";
2211
+ }
2212
+ const probePath = path.posix.join(dirPath, nextProbeFileName());
2213
+ let handle;
2214
+ try {
2215
+ handle = await fs.open(probePath, "wx");
2216
+ } catch {
2217
+ return "its probe file could not be created exclusively (the path may already exist)";
2218
+ }
2219
+ // fstat on the open handle names the exact inode this call just created.
2220
+ // A path-based lstat here instead would be racy against a peer that swaps
2221
+ // the path in the gap between the create above and the stat: fstat has no
2222
+ // such gap, because a file descriptor keeps naming the inode it opened no
2223
+ // matter what a later swap does to the path.
2224
+ let ownedIdentity = null;
2225
+ try {
2226
+ const createdStats = await handle.stat();
2227
+ ownedIdentity = { dev: createdStats.dev, ino: createdStats.ino, ctimeMs: createdStats.ctimeMs };
2228
+ } catch {
2229
+ ownedIdentity = null;
2230
+ }
2231
+ if (!ownedIdentity) {
2232
+ // fstat on this call's own just-opened descriptor failed. This call then
2233
+ // has no verified identity for the probe file it created, so it must not
2234
+ // check or remove that file by path: a peer could already own the entry
2235
+ // at that path, and a path-based removal here could delete the peer's
2236
+ // entry instead of this call's own file. Fail closed right here instead
2237
+ // of falling through to the birthtime comparison below, so a failed
2238
+ // identity read can never let this probe report success.
2239
+ await handle.close().catch(() => undefined);
2240
+ return "its own probe file's identity could not be read from the open file descriptor";
2241
+ }
2242
+ // The one gap the fs API cannot close: this lstat and the removal below
2243
+ // are two separate calls, not one atomic "remove if identity still
2244
+ // matches" step. A peer that wins this narrow gap can put any entry at
2245
+ // the probe path, including a pre-existing file it renames into place,
2246
+ // and the removal call below removes whatever entry is there when it
2247
+ // runs.
2248
+ try {
2249
+ const currentStats = await fs.lstat(probePath).catch(() => null);
2250
+ const stillOwned =
2251
+ currentStats !== null &&
2252
+ currentStats.dev === ownedIdentity.dev &&
2253
+ currentStats.ino === ownedIdentity.ino &&
2254
+ currentStats.ctimeMs === ownedIdentity.ctimeMs;
2255
+ if (stillOwned) {
2256
+ await fs.rm(probePath, { force: true }).catch(() => undefined);
2257
+ }
2258
+ } finally {
2259
+ await handle.close().catch(() => undefined);
2260
+ }
2261
+ let after;
2262
+ try {
2263
+ after = (await fs.lstat(dirPath)).birthtimeMs;
2264
+ } catch {
2265
+ return "its reported creation time could not be read";
2266
+ }
2267
+ return before === after ? null : "its reported creation time changed after a probe write";
2268
+ }
2269
+
2270
+ async function refuseUnusableCreationTime(label, dirPath, reason) {
2271
+ process.stderr.write(
2272
+ "Refusing to trust the process session control path " + label + " (" + dirPath + "): " + reason +
2273
+ ". This filesystem or kernel gives no usable creation time. Terminating.\\n",
2274
+ );
2275
+ await latchAndTerminate();
2276
+ }
2277
+
2278
+ // Runs once, before the first poll cycle, and before this wrapper captures
2279
+ // the identities it later checks on every cycle. A failed capture fails
2280
+ // closed: the wrapper has no verified identity to check on later cycles, so
2281
+ // it terminates now instead of polling a control path it never verified.
2282
+ //
2283
+ // This wrapper cannot assume stats.birthtimeMs is a real creation time. Node
2284
+ // can report a change-time copy as a creation time. That value fails closed
2285
+ // far too aggressively (it would move on every stdin file this wrapper
2286
+ // deletes), so this wrapper proves the value is not a copy with a probe before
2287
+ // it trusts it, run once here, before either directory's identity is captured.
2288
+ async function captureSessionIdentity() {
2289
+ try {
2290
+ const sessionProbeFailure = await birthtimeSurvivesProbe(sessionDir);
2291
+ if (sessionProbeFailure) {
2292
+ await refuseUnusableCreationTime("sessionDir", sessionDir, sessionProbeFailure);
2293
+ return;
2294
+ }
2295
+ const stdinProbeFailure = await birthtimeSurvivesProbe(stdinDir);
2296
+ if (stdinProbeFailure) {
2297
+ await refuseUnusableCreationTime("stdinDir", stdinDir, stdinProbeFailure);
2298
+ return;
2299
+ }
2300
+ const session = await statPathIdentity(sessionDir);
2301
+ const stdin = await statPathIdentity(stdinDir);
2302
+ sessionDirIdentity = session;
2303
+ stdinDirIdentity = stdin;
2304
+ } catch (error) {
2305
+ process.stderr.write(
2306
+ "Failed to capture the process session identity: " +
2307
+ (error instanceof Error ? error.message : String(error)) + ". Terminating.\\n",
2308
+ );
2309
+ await latchAndTerminate();
2310
+ }
2311
+ }
2312
+
2313
+ // Runs on every poll cycle, before the wrapper reads stdinDir. Terminate and
2314
+ // latch on any proof the control path is no longer the one this wrapper
2315
+ // captured at startup (a missing path, a path that is no longer a directory,
2316
+ // a symbolic link, or a directory whose identity changed), AND on every
2317
+ // other lstat failure. A permission error is not transient here: a sandbox
2318
+ // peer can deny search permission on the control directory without removing
2319
+ // it, and treating that as transient would leave the wrapper and its child
2320
+ // alive forever. The error code below only picks the stderr message, so an
2321
+ // operator can still tell a removed directory from a permission error; it
2322
+ // never decides whether to latch.
2323
+ //
2324
+ // Contrast readStdinDirNames() right below, whose catch block stays narrow
2325
+ // on purpose: readdir() opens a directory descriptor, so it can fail with a
2326
+ // genuinely transient error under descriptor exhaustion, and latching there
2327
+ // would kill live sessions under load. lstat() opens no descriptor, and this
2328
+ // function already runs before every call to readStdinDirNames(), so a
2329
+ // permission error latches here before readdir() is ever reached.
2330
+ async function verifySessionIdentity() {
2331
+ if (identityLost) return false;
2332
+ try {
2333
+ const session = await statPathIdentity(sessionDir);
2334
+ const stdin = await statPathIdentity(stdinDir);
2335
+ if (!sameIdentity(session, sessionDirIdentity) || !sameIdentity(stdin, stdinDirIdentity)) {
2336
+ await latchAndTerminate();
2337
+ return false;
2338
+ }
2339
+ return true;
2340
+ } catch (error) {
2341
+ const code = error && typeof error === "object" ? error.code : undefined;
2342
+ const reason =
2343
+ code === "ENOENT"
2344
+ ? "the control path no longer exists"
2345
+ : code === "ENOTDIR"
2346
+ ? "the control path is no longer a directory"
2347
+ : code === "EPAPERCLIP_SYMLINK"
2348
+ ? "the control path is now a symbolic link"
2349
+ : "lstat failed" + (code ? " with " + code : "");
2350
+ process.stderr.write("Latching on a lost process session identity: " + reason + ". Terminating.\\n");
2351
+ await latchAndTerminate();
2352
+ return false;
2353
+ }
2354
+ }
2355
+
2356
+ // This catch block stays narrow on purpose: see the comment above
2357
+ // verifySessionIdentity() for why a permission error here is treated as
2358
+ // transient while the same error latches there.
2359
+ async function readStdinDirNames() {
2360
+ if (!(await verifySessionIdentity())) return [];
2361
+ try {
2362
+ return await fs.readdir(stdinDir);
2363
+ } catch (error) {
2364
+ const code = error && typeof error === "object" ? error.code : undefined;
2365
+ if (code === "ENOENT" || code === "ENOTDIR") {
2366
+ await latchAndTerminate();
2367
+ }
2368
+ return [];
2369
+ }
2370
+ }
2371
+
2372
+ async function pollStdin() {
2373
+ while (!shuttingDown) {
2374
+ const entries = (await readStdinDirNames()).filter((name) => name.endsWith(".json")).sort();
2375
+ for (const name of entries) {
2376
+ if (shuttingDown) break;
2377
+ const entrySeq = Number.parseInt(name, 10);
2378
+ const file = path.posix.join(stdinDir, name);
2379
+ // A successful publication can be retried after its provider response
2380
+ // was lost, even after we consumed it. Never send those bytes twice or
2381
+ // move the expected sequence backwards. This also handles late uploads.
2382
+ if (Number.isFinite(entrySeq) && entrySeq < stdinExpectedSeq) {
2383
+ await fs.rm(file, { force: true }).catch(() => undefined);
2384
+ continue;
2385
+ }
2386
+ // Hold the send order when an earlier file has not appeared. Do not consume
2387
+ // this later file: wait for the missing file on a later cycle, bounded by
2388
+ // the retry budget. After the budget, fail loud and advance past the gap,
2389
+ // so the present file can run.
2390
+ if (Number.isFinite(entrySeq) && entrySeq > stdinExpectedSeq) {
2391
+ stdinGapRetries += 1;
2392
+ if (stdinGapRetries < stdinMaxParseRetries) {
2393
+ break;
2394
+ }
2395
+ await writeEvent({
2396
+ type: "error",
2397
+ message:
2398
+ "Advanced past missing stdin files " + stdinExpectedSeq + " to " + (entrySeq - 1) +
2399
+ " after " + stdinMaxParseRetries + " retries.",
2400
+ });
2401
+ stdinGapRetries = 0;
2402
+ stdinExpectedSeq = entrySeq;
2403
+ }
2404
+ let message;
2405
+ try {
2406
+ // Hardening (I3): open with O_NOFOLLOW where the platform defines it,
2407
+ // so a control-path symbolic link swapped in after the directory
2408
+ // check fails the read instead of following it.
2409
+ const readFlag =
2410
+ typeof fsConstants.O_NOFOLLOW === "number" ? fsConstants.O_RDONLY | fsConstants.O_NOFOLLOW : "r";
2411
+ const raw = await fs.readFile(file, { encoding: "utf8", flag: readFlag });
2412
+ // An empty read means the content is not on disk yet. Treat it the same
2413
+ // as a parse failure: keep the file and retry on a later cycle.
2414
+ if (!raw) throw new Error("stdin file is empty");
2415
+ message = JSON.parse(raw);
2416
+ } catch (error) {
2417
+ const retries = (stdinParseRetries.get(name) || 0) + 1;
2418
+ if (retries >= stdinMaxParseRetries) {
2419
+ // The retry limit is reached. Drop the file and write an error event,
2420
+ // so the lost message fails loud. The file is resolved now, so let the
2421
+ // loop go on to the next entry.
2422
+ stdinParseRetries.delete(name);
2423
+ await fs.rm(file, { force: true }).catch(() => undefined);
2424
+ await writeEvent({
2425
+ type: "error",
2426
+ message:
2427
+ "Dropped unreadable stdin file after " + stdinMaxParseRetries + " retries: " + name + ": " +
2428
+ (error instanceof Error ? error.message : String(error)),
2429
+ });
2430
+ // The file is resolved (dropped). Advance the expected number and reset
2431
+ // the gap budget, then let the loop go on to the next entry.
2432
+ if (Number.isFinite(entrySeq)) stdinExpectedSeq = entrySeq + 1;
2433
+ stdinGapRetries = 0;
2434
+ continue;
2435
+ }
2436
+ // The file is not readable yet and is not past the retry limit. Keep it
2437
+ // and stop this cycle to hold the send order. A later file (for example
2438
+ // stdinEnd) must not run before this earlier file. A later cycle reads
2439
+ // from the start again.
2440
+ stdinParseRetries.set(name, retries);
2441
+ break;
2442
+ }
2443
+ // The parse succeeded, so the content is complete. Delete the file first,
2444
+ // then act on the message. A later cycle never re-reads a handled file.
2445
+ stdinParseRetries.delete(name);
2446
+ await fs.rm(file, { force: true }).catch(() => undefined);
2447
+ // The file is handled. Advance the expected number and reset the gap
2448
+ // budget, so the next expected file starts fresh.
2449
+ if (Number.isFinite(entrySeq)) stdinExpectedSeq = entrySeq + 1;
2450
+ stdinGapRetries = 0;
2451
+ if (message.type === "stdin" && typeof message.data === "string") {
2452
+ if (!stdinClosed) child.stdin.write(Buffer.from(message.data, "base64"));
2453
+ } else if (message.type === "stdinEnd") {
2454
+ stdinClosed = true;
2455
+ child.stdin.end();
2456
+ break;
2457
+ } else if (message.type === "shutdown") {
2458
+ await terminate();
2459
+ break;
2460
+ }
2461
+ }
2462
+ if (!shuttingDown) await new Promise((resolve) => setTimeout(resolve, 50));
2463
+ }
2464
+ }
2465
+
2466
+ await captureSessionIdentity();
2467
+
2468
+ void pollStdin().catch((error) => void writeEvent({ type: "error", message: error instanceof Error ? error.message : String(error) }));
2469
+ `;
2470
+ // Shared by both wrappers. Refuse a symlink and remove the private envelope
2471
+ // before creating the child; no launch payload file belongs to the agent.
2472
+ const PROCESS_SESSION_READ_COMMAND = `
2473
+ let config;
2474
+ try {
2475
+ let commandPayload = process.env.PAPERCLIP_PROCESS_SESSION_COMMAND_B64;
2476
+ if (!commandPayload) {
2477
+ const payloadPath = path.posix.join(sessionDir, "command.b64");
2478
+ const handle = await fs.open(payloadPath, fsConstants.O_RDONLY | fsConstants.O_NOFOLLOW);
2479
+ try {
2480
+ commandPayload = await handle.readFile("utf8");
2481
+ } finally {
2482
+ await handle.close();
2483
+ await fs.rm(payloadPath, { force: true });
2484
+ }
2485
+ }
2486
+ config = JSON.parse(Buffer.from(commandPayload, "base64").toString("utf8"));
2487
+ } catch {
2488
+ // No child exists yet. Emit a terminal event on both transports and attest
2489
+ // shutdown, instead of letting a detached polled wrapper fail silently.
2490
+ // Parse errors can quote credential bytes, so use a fixed diagnostic.
2491
+ await writeEvent({ type: "error", message: "Failed to read sandbox process session command payload." });
2492
+ await writeEvent({ type: "shutdownAck" });
2493
+ await new Promise((resolve) => process.stdout.write("", resolve));
2494
+ process.exit(1);
2495
+ }
2496
+ `;
2497
+ // Streamed variant: the wrapper writes each output frame as one newline-
2498
+ // delimited JSON line to its stdout. The host runs this wrapper as one
2499
+ // long-lived session command and reads the frames from the session log stream,
2500
+ // so there is no host output-file poll. Each frame carries a monotonic `seq`,
2501
+ // so the host delivers every frame exactly once whether it arrives live or in
2502
+ // the final result. The wrapper exits when the child closes, so the session
2503
+ // command settles and the session shell (the subshell wrap around it) survives.
2504
+ function getProcessSessionRemoteStreamSource() {
2505
+ return `import { spawn } from "node:child_process";
2506
+ import { promises as fs, constants as fsConstants } from "node:fs";
2507
+ import path from "node:path";
2508
+
2509
+ const sessionDir = process.env.PAPERCLIP_PROCESS_SESSION_DIR;
2510
+ if (!sessionDir) throw new Error("Missing process session bridge env.");
2511
+
2512
+ const stdinDir = path.posix.join(sessionDir, "stdin");
2513
+ let seq = 0;
2514
+ let stdinClosed = false;
2515
+ let shuttingDown = false;
2516
+ let terminated = false;
2517
+ let killTimer = null;
2518
+
2519
+ await fs.mkdir(stdinDir, { recursive: true });
2520
+
2521
+ // One newline-delimited JSON frame per event. Node keeps process.stdout writes
2522
+ // ordered, and the base64 payload holds no newline, so each frame is one line.
2523
+ function writeEvent(event) {
2524
+ seq += 1;
2525
+ process.stdout.write(JSON.stringify({ seq, ...event }) + "\\n");
2526
+ }
2527
+
2528
+ // Hardening (I3): refuse a symbolic link on a control path before this
2529
+ // wrapper reads or writes through it. A symbolic link here could let another
2530
+ // sandbox process redirect the wrapper's file I/O outside the session tree.
2531
+ async function isSymbolicLink(candidatePath) {
2532
+ try {
2533
+ const stats = await fs.lstat(candidatePath);
2534
+ return stats.isSymbolicLink();
2535
+ } catch {
2536
+ return false;
2537
+ }
2538
+ }
2539
+
2540
+ if ((await isSymbolicLink(sessionDir)) || (await isSymbolicLink(stdinDir))) {
2541
+ await writeEvent({ type: "error", message: "Refusing a symbolic link on a process session control path." });
2542
+ process.exitCode = 1;
2543
+ process.exit(1);
2544
+ }
2545
+
2546
+ ${PROCESS_SESSION_READ_COMMAND}
2547
+
2548
+ // Hardening (I3, not containment): the wrapper's own launch env carries the
2549
+ // session dir and the command payload. Scrub both keys before they reach the
2550
+ // spawned child, so the child never inherits a path to its own control files.
2551
+ const childEnv = { ...process.env, ...(config.env || {}) };
2552
+ delete childEnv.PAPERCLIP_PROCESS_SESSION_DIR;
2553
+ delete childEnv.PAPERCLIP_PROCESS_SESSION_COMMAND_B64;
2554
+
2555
+ // I1: exactly one child process per emitted wrapper. Do not add a second
2556
+ // tracked child handle.
2557
+ const child = spawn(config.command, Array.isArray(config.args) ? config.args : [], {
2558
+ cwd: config.cwd || process.cwd(),
2559
+ env: childEnv,
2560
+ stdio: ["pipe", "pipe", "pipe"],
2561
+ });
2562
+
2563
+ child.stdout.on("data", (chunk) => writeEvent({ type: "data", stream: "stdout", data: Buffer.from(chunk).toString("base64") }));
2564
+ child.stderr.on("data", (chunk) => writeEvent({ type: "data", stream: "stderr", data: Buffer.from(chunk).toString("base64") }));
2565
+ child.on("error", (error) => writeEvent({ type: "error", message: error.message }));
2566
+ // "close" (not "exit") so stdout/stderr fully drain before the exit frame.
2567
+ // Queue the exit frame first, then run terminate(), so the exit frame always
2568
+ // lands even when the child closes on its own, with no stdinEnd and no
2569
+ // shutdown message ever received. writeEvent() only queues an asynchronous
2570
+ // write. terminate()'s own synchronous work (ending the child's stdin and
2571
+ // sending SIGTERM) already runs in this same handler by the time the exit
2572
+ // frame becomes readable on disk. terminate() is idempotent and its
2573
+ // child.kill() call here is always a no-op (I2): the child's process handle
2574
+ // is already gone by the time "close" fires. An error frame carries no such
2575
+ // guarantee: child.on("error", ...) below does not call terminate(), and
2576
+ // neither does the poll loop's own error writes, so those fire while the
2577
+ // wrapper and its child are still fully alive.
2578
+ child.on("close", (code, signal) => {
2579
+ writeEvent({ type: "exit", code, signal });
2580
+ process.exitCode = typeof code === "number" ? code : 1;
2581
+ void terminate();
2582
+ });
2583
+
2584
+ ${PROCESS_SESSION_STDIN_POLL_TAIL}`;
2585
+ }
2586
+ function getProcessSessionRemoteEventFileSource() {
2587
+ return `import { spawn } from "node:child_process";
2588
+ import { promises as fs, constants as fsConstants } from "node:fs";
2589
+ import path from "node:path";
2590
+
2591
+ const sessionDir = process.env.PAPERCLIP_PROCESS_SESSION_DIR;
2592
+ if (!sessionDir) throw new Error("Missing process session bridge env.");
2593
+
2594
+ const stdinDir = path.posix.join(sessionDir, "stdin");
2595
+ const eventsDir = path.posix.join(sessionDir, "events");
2596
+ let seq = 0;
2597
+ let stdinClosed = false;
2598
+ let shuttingDown = false;
2599
+ let terminated = false;
2600
+ let killTimer = null;
2601
+
2602
+ await fs.mkdir(stdinDir, { recursive: true });
2603
+ await fs.mkdir(eventsDir, { recursive: true });
2604
+
2605
+ let writeChain = Promise.resolve();
2606
+
2607
+ function writeEvent(event) {
2608
+ seq += 1;
2609
+ const file = path.posix.join(eventsDir, String(seq).padStart(12, "0") + ".json");
2610
+ const write = writeChain.then(async () => {
2611
+ await fs.writeFile(file + ".tmp", JSON.stringify(event) + "\\n", "utf8");
2612
+ await fs.rename(file + ".tmp", file);
2613
+ });
2614
+ writeChain = write.catch(() => undefined);
2615
+ return write;
2616
+ }
2617
+
2618
+ // Hardening (I3): refuse a symbolic link on a control path before this
2619
+ // wrapper reads or writes through it. A symbolic link here could let another
2620
+ // sandbox process redirect the wrapper's file I/O outside the session tree.
2621
+ async function isSymbolicLink(candidatePath) {
2622
+ try {
2623
+ const stats = await fs.lstat(candidatePath);
2624
+ return stats.isSymbolicLink();
2625
+ } catch {
2626
+ return false;
2627
+ }
2628
+ }
2629
+
2630
+ if ((await isSymbolicLink(sessionDir)) || (await isSymbolicLink(stdinDir))) {
2631
+ await writeEvent({ type: "error", message: "Refusing a symbolic link on a process session control path." });
2632
+ process.exitCode = 1;
2633
+ process.exit(1);
2634
+ }
2635
+
2636
+ ${PROCESS_SESSION_READ_COMMAND}
2637
+
2638
+ // Hardening (I3, not containment): the wrapper's own launch env carries the
2639
+ // session dir and the command payload. Scrub both keys before they reach the
2640
+ // spawned child, so the child never inherits a path to its own control files.
2641
+ const childEnv = { ...process.env, ...(config.env || {}) };
2642
+ delete childEnv.PAPERCLIP_PROCESS_SESSION_DIR;
2643
+ delete childEnv.PAPERCLIP_PROCESS_SESSION_COMMAND_B64;
2644
+
2645
+ // I1: exactly one child process per emitted wrapper. Do not add a second
2646
+ // tracked child handle.
2647
+ const child = spawn(config.command, Array.isArray(config.args) ? config.args : [], {
2648
+ cwd: config.cwd || process.cwd(),
2649
+ env: childEnv,
2650
+ stdio: ["pipe", "pipe", "pipe"],
2651
+ });
2652
+
2653
+ child.stdout.on("data", (chunk) => void writeEvent({ type: "data", stream: "stdout", data: Buffer.from(chunk).toString("base64") }));
2654
+ child.stderr.on("data", (chunk) => void writeEvent({ type: "data", stream: "stderr", data: Buffer.from(chunk).toString("base64") }));
2655
+ child.on("error", (error) => void writeEvent({ type: "error", message: error.message }));
2656
+ // "close" (not "exit") so stdout/stderr fully drain before the exit event;
2657
+ // the write chain then guarantees the exit file lands after every data file.
2658
+ // Queue the exit event first, then run terminate(), so the poll loop ends
2659
+ // even when the child closes on its own, with no stdinEnd and no shutdown
2660
+ // message ever received. writeEvent() only queues an asynchronous write.
2661
+ // terminate()'s own synchronous work (ending the child's stdin and sending
2662
+ // SIGTERM) already runs in this same handler by the time the exit file
2663
+ // becomes readable on disk. terminate() is idempotent and its child.kill()
2664
+ // call here is always a no-op (I2): the child's process handle is already
2665
+ // gone by the time "close" fires. An error event carries no such guarantee:
2666
+ // child.on("error", ...) below does not call terminate(), and neither does
2667
+ // the poll loop's own error writes, so those fire while the wrapper and its
2668
+ // child are still fully alive.
2669
+ child.on("close", (code, signal) => {
2670
+ void writeEvent({ type: "exit", code, signal });
2671
+ process.exitCode = typeof code === "number" ? code : 1;
2672
+ void terminate();
2673
+ });
2674
+
2675
+ ${PROCESS_SESSION_STDIN_POLL_TAIL}`;
2676
+ }
2677
+ /** The default deadline for the duplex readiness handshake, in milliseconds. */
2678
+ const DEFAULT_DUPLEX_READINESS_TIMEOUT_MS = 10_000;
2679
+ /** The default bounded budget to close a partial duplex channel, in milliseconds. */
2680
+ const DEFAULT_DUPLEX_CLEANUP_BUDGET_MS = 2_000;
2681
+ /**
2682
+ * Reserve a loopback port the host assigns to the duplex gateway. The host binds
2683
+ * an ephemeral listener on `127.0.0.1`, reads the port the operating system
2684
+ * chose, then closes the listener. The number is very likely free when the
2685
+ * gateway binds it a moment later. The gateway binds exactly this port or exits
2686
+ * nonzero, so a taken port fails closed to the file bridge and never steers the
2687
+ * endpoint.
2688
+ */
2689
+ async function reserveHostAssignedLoopbackPort() {
2690
+ return new Promise((resolve, reject) => {
2691
+ const probe = net.createServer();
2692
+ probe.once("error", reject);
2693
+ probe.listen(0, "127.0.0.1", () => {
2694
+ const address = probe.address();
2695
+ if (!address || typeof address === "string") {
2696
+ probe.close(() => reject(new Error("Could not reserve a loopback port for the duplex gateway.")));
2697
+ return;
2698
+ }
2699
+ const reserved = address.port;
2700
+ probe.close(() => resolve(reserved));
2701
+ });
2702
+ });
2703
+ }
2704
+ /**
2705
+ * Build the argument vector that launches the duplex gateway in the sandbox. The
2706
+ * host passes the assigned port and the per-open nonce only through the launch
2707
+ * environment, so the argument vector sets them as environment assignments in
2708
+ * front of the node command. No addressing data comes from the channel.
2709
+ *
2710
+ * The script uses `exec env NAME=value ... command`. A POSIX shell accepts an
2711
+ * environment-assignment prefix only on a plain command, never on `exec`. The
2712
+ * form `exec NAME=value command` exits with status 127. The `env` utility carries
2713
+ * the assignments, and `exec` still replaces the shell with the gateway process,
2714
+ * so the gateway keeps the process slot and the assigned environment.
2715
+ */
2716
+ export function buildDuplexGatewayLaunchArgv(input) {
2717
+ const assignments = Object.entries(input.env)
2718
+ .map(([key, value]) => `${key}=${shellQuote(value)}`)
2719
+ .join(" ");
2720
+ const nodeCommand = input.nodeCommand?.trim() || "node";
2721
+ const script = `exec env ${assignments} ${shellQuote(nodeCommand)} ${shellQuote(input.remoteEntrypoint)}`;
2722
+ return [input.shellCommand, ...shellCommandArgs(script)];
2723
+ }
2724
+ /**
2725
+ * Map a readiness failure to the fixed fallback reason. Each readiness failure
2726
+ * maps to exactly one reason from the closed telemetry set, so the fallback
2727
+ * counter and the transport event carry only an approved value.
2728
+ */
2729
+ function duplexReadinessFallbackReason(reason) {
2730
+ switch (reason) {
2731
+ case "protocol_contamination":
2732
+ return "contaminated";
2733
+ case "nonce_mismatch":
2734
+ return "ready_nonce_mismatch";
2735
+ case "timeout":
2736
+ return "ready_timeout";
2737
+ case "channel_exit":
2738
+ return "ready_invalid";
2739
+ }
2740
+ }
2741
+ /**
2742
+ * The fixed marker the worker manager puts in a route-busy rejection. The manager
2743
+ * defines the constant; this module matches the fixed string, because the two
2744
+ * layers ship in separate packages and share no import. The marker names the
2745
+ * process-scoped route ceiling, so it carries no route, query, body, or token.
2746
+ */
2747
+ const DUPLEX_ROUTE_BUSY_ERROR_MARKER = "DUPLEX_CHANNEL_ROUTE_BUSY";
2748
+ /**
2749
+ * Report whether the caught open error is a route-busy rejection. The host maps it
2750
+ * to the `route_busy` fallback stage, so a full process-scoped route ceiling never
2751
+ * folds into a generic open failure.
2752
+ */
2753
+ function isDuplexRouteBusyError(error) {
2754
+ return error instanceof Error && error.message.includes(DUPLEX_ROUTE_BUSY_ERROR_MARKER);
2755
+ }
2756
+ /**
2757
+ * The cap on the pre-READY readiness buffer, in bytes. The gate reads untrusted
2758
+ * bytes before the READY line arrives, so it bounds the buffer. The cap is the
2759
+ * codec frame-size bound plus one line of margin, so a legitimate maximum-size
2760
+ * READY frame still fits. Past the cap with no newline, the stream cannot be a
2761
+ * valid READY frame, so the gate finishes with protocol contamination.
2762
+ */
2763
+ const DUPLEX_READINESS_BUFFER_CAP_BYTES = DEFAULT_MAX_DUPLEX_FRAME_BYTES + 4_096;
2764
+ // ---------------------------------------------------------------------------
2765
+ // http2_v1: the client connection preface scan and the run disposition latch.
2766
+ // ---------------------------------------------------------------------------
2767
+ /**
2768
+ * The HTTP/2 client connection preface: 24 octets, `PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n`
2769
+ * (RFC 9113, Section 3.4). A Node `http2.performServerHandshake` call needs a
2770
+ * `Duplex` whose readable side starts at this exact sequence; one extra
2771
+ * leading byte makes the preface invalid, and the server reports a
2772
+ * `PROTOCOL_ERROR`. The server does not skip a leading byte and does not
2773
+ * search for the sequence, so the host finds the offset itself before it
2774
+ * hands the channel to the server.
2775
+ */
2776
+ const HTTP2_CLIENT_CONNECTION_PREFACE = Buffer.from("505249202a20485454502f322e300d0a0d0a534d0d0a0d0a", "hex");
2777
+ /** The one shared empty buffer. The preface scan starts and resets its two
2778
+ * retained buffers to it. */
2779
+ const HTTP2_PREFACE_EMPTY_BUFFER = Buffer.alloc(0);
2780
+ // The count of bytes the preface scan's substring search examines, in bytes.
2781
+ // A search that always starts from the beginning of the retained buffer
2782
+ // re-examines the whole buffer on every fragment, so this count grows
2783
+ // quadratically in the number of fragments. `findPrefaceFrom` instead
2784
+ // resumes from where the prior search left off, so this count stays linear
2785
+ // in the bytes received. A test reads this count to prove the search work
2786
+ // does not regress to the quadratic shape. Production code never reads this
2787
+ // count.
2788
+ let http2PrefaceScanSearchUnits = 0;
2789
+ // The count of bytes the pre-preface scan buffer copies while it grows its
2790
+ // backing storage. A one-copy-per-fragment append copies the whole retained
2791
+ // buffer on every fragment, so this count grows quadratically in the number
2792
+ // of fragments. The doubling-growth approach copies only on a reallocation,
2793
+ // so this count stays linear in the bytes received. A test reads this count
2794
+ // to prove the growth work does not regress to the quadratic shape.
2795
+ // Production code never reads this count.
2796
+ let http2PrefaceScanBufferGrowthCopyUnits = 0;
2797
+ // The same count as `http2PrefaceScanBufferGrowthCopyUnits`, for the
2798
+ // post-preface replay buffer instead of the pre-preface scan buffer.
2799
+ let http2PrefaceReplayBufferGrowthCopyUnits = 0;
2800
+ /**
2801
+ * A byte buffer that grows its backing storage by doubling its capacity,
2802
+ * instead of copying the whole retained buffer on every appended fragment. A
2803
+ * sender that trickles input in many small fragments would otherwise force
2804
+ * one full copy of the whole retained buffer per fragment: with the buffer
2805
+ * growing toward its cap, that is quadratic work in the number of fragments.
2806
+ * Doubling the backing storage's capacity only when the current capacity
2807
+ * runs out reallocates and copies a logarithmic number of times, so the
2808
+ * total copy work stays linear in the bytes received. `countGrowthCopy`
2809
+ * receives the number of bytes each reallocation copies, so a test can add
2810
+ * these up and prove the growth work stays linear.
2811
+ */
2812
+ function createGrowableByteBuffer(countGrowthCopy) {
2813
+ let used = HTTP2_PREFACE_EMPTY_BUFFER;
2814
+ let storage = HTTP2_PREFACE_EMPTY_BUFFER;
2815
+ return {
2816
+ view: () => used,
2817
+ length: () => used.length,
2818
+ append: (chunk) => {
2819
+ const usedLength = used.length;
2820
+ const neededLength = usedLength + chunk.byteLength;
2821
+ if (neededLength > storage.length) {
2822
+ let nextCapacity = storage.length === 0 ? chunk.byteLength : storage.length * 2;
2823
+ while (nextCapacity < neededLength) {
2824
+ nextCapacity *= 2;
2825
+ }
2826
+ const grown = Buffer.allocUnsafe(nextCapacity);
2827
+ storage.copy(grown, 0, 0, usedLength);
2828
+ countGrowthCopy(usedLength);
2829
+ storage = grown;
2830
+ }
2831
+ storage.set(chunk, usedLength);
2832
+ used = storage.subarray(0, neededLength);
2833
+ },
2834
+ reset: () => {
2835
+ used = HTTP2_PREFACE_EMPTY_BUFFER;
2836
+ storage = HTTP2_PREFACE_EMPTY_BUFFER;
2837
+ },
2838
+ };
2839
+ }
2840
+ /**
2841
+ * Find the client connection preface in `buffer` at or after index `from`
2842
+ * and return its offset, or -1. This counts the real scan distance for a
2843
+ * test: from `from` up to the found preface's end, or to the end of the
2844
+ * buffer when it finds none. The count stays linear in the bytes received
2845
+ * when the caller advances `from` to just short of the buffer's end on every
2846
+ * miss, instead of always searching from the start of the buffer.
2847
+ */
2848
+ function findPrefaceFrom(buffer, from) {
2849
+ const offset = buffer.indexOf(HTTP2_CLIENT_CONNECTION_PREFACE, from);
2850
+ const scannedTo = offset === -1 ? buffer.length : offset + HTTP2_CLIENT_CONNECTION_PREFACE.length;
2851
+ http2PrefaceScanSearchUnits += Math.max(scannedTo - from, 0);
2852
+ return offset;
2853
+ }
2854
+ /**
2855
+ * Wrap the readiness gate's broker channel so its `onData` delivers no byte
2856
+ * until the client connection preface appears, then delivers every byte from
2857
+ * the preface onward.
2858
+ *
2859
+ * The wrapped channel opens its scan window only on the bytes the readiness
2860
+ * gate already retained after it accepted the READY line (constraint: the
2861
+ * scan window opens only after the gate accepts the nonce). Nothing before
2862
+ * that line ever reaches this scan, because the gate itself discards the
2863
+ * whole pre-READY buffer on acceptance. The scan buffers at most
2864
+ * {@link DUPLEX_READINESS_BUFFER_CAP_BYTES}; past that bound with no preface
2865
+ * found, it calls `onMissing` exactly one time and stops buffering, so the
2866
+ * caller can abort the open and fall back to `queue_v1`. The function holds
2867
+ * no prologue byte count: it always scans for the fixed 24-octet sequence,
2868
+ * never a length.
2869
+ *
2870
+ * The bytes that follow the found preface, before the HTTP/2 server binds a
2871
+ * downstream listener, land in `pendingAfterPreface`. This buffer holds
2872
+ * untrusted bytes on the same footing as the scan buffer, so it carries the
2873
+ * same {@link DUPLEX_READINESS_BUFFER_CAP_BYTES} cap. A chunk that would pass
2874
+ * the cap fails closed: the function drops the buffer and stops the channel.
2875
+ * The caller reads {@link replayOverflowed} after the preface settles and, on
2876
+ * `true`, treats the open the same as a missing preface.
2877
+ */
2878
+ function createHttp2PrefaceScanningChannel(channel, options) {
2879
+ // The pre-preface scan buffer. `scanBuf.append` grows its backing storage
2880
+ // by doubling, instead of copying the whole retained buffer on every
2881
+ // fragment — see {@link createGrowableByteBuffer}. `scanSearchFrom` is the
2882
+ // first index the next search must examine: `findPrefaceFrom` advances it
2883
+ // to just short of the buffer's end on every miss, so a fragmented preface
2884
+ // is found without a full rescan of the retained buffer on every fragment.
2885
+ const scanBuf = createGrowableByteBuffer((copiedBytes) => {
2886
+ http2PrefaceScanBufferGrowthCopyUnits += copiedBytes;
2887
+ });
2888
+ let scanSearchFrom = 0;
2889
+ let sawPreface = false;
2890
+ let failed = false;
2891
+ let downstream = null;
2892
+ // Bytes found after the preface before a downstream listener attaches. The
2893
+ // wrapped channel replays them on attach, the same pattern the readiness
2894
+ // gate itself uses for its own post-READY replay buffer. This also grows
2895
+ // by doubling, for the same reason as `scanBuf`: fragmented post-preface
2896
+ // input must not force a full copy of the retained buffer per fragment.
2897
+ const pendingAfterPreface = createGrowableByteBuffer((copiedBytes) => {
2898
+ http2PrefaceReplayBufferGrowthCopyUnits += copiedBytes;
2899
+ });
2900
+ let replayOverflow = false;
2901
+ // Drop the pending buffer and stop the channel. The caller reads
2902
+ // `replayOverflowed()` after the preface settles and falls back the same
2903
+ // way it does for a missing preface.
2904
+ function overflowAndStop() {
2905
+ replayOverflow = true;
2906
+ pendingAfterPreface.reset();
2907
+ channel.stop();
2908
+ }
2909
+ function deliver(chunk) {
2910
+ if (downstream) {
2911
+ downstream(chunk);
2912
+ return;
2913
+ }
2914
+ if (replayOverflow)
2915
+ return;
2916
+ if (pendingAfterPreface.length() + chunk.byteLength > options.capBytes) {
2917
+ overflowAndStop();
2918
+ return;
2919
+ }
2920
+ pendingAfterPreface.append(chunk);
2921
+ }
2922
+ channel.onData((chunk) => {
2923
+ if (failed || replayOverflow)
2924
+ return;
2925
+ if (sawPreface) {
2926
+ deliver(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
2927
+ return;
2928
+ }
2929
+ const rawChunk = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);
2930
+ // Reject the chunk on its prospective length before it grows the scan
2931
+ // buffer, the same way `deliver` bounds `pendingAfterPreface`. A single
2932
+ // oversized chunk — or a chunk that tips an already-large buffer past
2933
+ // the cap — must fail closed here, before `scanBuf.append` performs the
2934
+ // allocation. Checking the cap only after the append still bounds the
2935
+ // retained buffer, but it lets one untrusted chunk force an allocation
2936
+ // as large as the chunk itself, unbounded by `capBytes`.
2937
+ if (scanBuf.length() + rawChunk.byteLength > options.capBytes) {
2938
+ failed = true;
2939
+ scanBuf.reset();
2940
+ scanSearchFrom = 0;
2941
+ options.onMissing();
2942
+ return;
2943
+ }
2944
+ scanBuf.append(rawChunk);
2945
+ const scanBuffer = scanBuf.view();
2946
+ const offset = findPrefaceFrom(scanBuffer, scanSearchFrom);
2947
+ if (offset === -1) {
2948
+ // No match yet. Resume the next search just short of the buffer's
2949
+ // end, keeping back an overlap of one octet less than the preface
2950
+ // length, so a preface split across this fragment and the next one is
2951
+ // still found. Each byte enters that overlap window a bounded number
2952
+ // of times, so the total search work stays linear in the bytes
2953
+ // received, not quadratic in the number of fragments.
2954
+ scanSearchFrom = Math.max(0, scanBuffer.length - (HTTP2_CLIENT_CONNECTION_PREFACE.length - 1));
2955
+ return;
2956
+ }
2957
+ sawPreface = true;
2958
+ options.onFound();
2959
+ const fromPreface = Buffer.from(scanBuffer.subarray(offset));
2960
+ scanBuf.reset();
2961
+ scanSearchFrom = 0;
2962
+ deliver(fromPreface);
2963
+ });
2964
+ return {
2965
+ channel: {
2966
+ write: (data) => channel.write(data),
2967
+ onData: (listener) => {
2968
+ downstream = listener;
2969
+ if (pendingAfterPreface.length() > 0) {
2970
+ // Copy the exact retained bytes instead of handing the listener
2971
+ // the growable buffer's backing view. That backing storage can
2972
+ // run ahead of the bytes in use (the doubling growth in
2973
+ // `pendingAfterPreface.append` over-provisions it), so a raw view
2974
+ // would keep the whole over-provisioned allocation alive for as
2975
+ // long as the listener holds its reference.
2976
+ const replay = Buffer.from(pendingAfterPreface.view());
2977
+ pendingAfterPreface.reset();
2978
+ listener(replay);
2979
+ }
2980
+ },
2981
+ onExit: (listener) => channel.onExit(listener),
2982
+ stop: () => channel.stop(),
2983
+ close: () => channel.close(),
2984
+ },
2985
+ replayOverflowed: () => replayOverflow,
2986
+ /**
2987
+ * Drop the scan buffer, for a caller-side terminal path this function
2988
+ * itself never reaches — the bound readiness timeout elapsing while the
2989
+ * scan is still searching, with no preface found and no cap refusal of
2990
+ * its own. A call after the preface already matched, or after the cap
2991
+ * already failed the scan closed, is a no-op: both paths already reset
2992
+ * the scan buffer themselves.
2993
+ */
2994
+ disposeScanBuffer: () => {
2995
+ if (sawPreface || failed)
2996
+ return;
2997
+ failed = true;
2998
+ scanBuf.reset();
2999
+ scanSearchFrom = 0;
3000
+ },
3001
+ };
3002
+ }
3003
+ /**
3004
+ * Wait for {@link createHttp2PrefaceScanningChannel} to settle: either the
3005
+ * preface appears, or the scan passes the bound with no match, or the bound
3006
+ * readiness timeout elapses first. Reapplying the readiness timeout here
3007
+ * keeps one configured value for both the READY-line wait and this
3008
+ * immediately-following preface wait; the task adds no new timeout setting.
3009
+ * Returns the scanning channel alongside the settled result, so the caller
3010
+ * binds the HTTP/2 server to it only on a `found` result. On a `found`
3011
+ * result, the caller must still read `replayOverflowed()`: the post-preface
3012
+ * buffer can overflow its cap after the preface settles as `found` and
3013
+ * before the caller binds a downstream listener.
3014
+ */
3015
+ function scanForHttp2ClientPreface(channel, options) {
3016
+ let resolveSettled;
3017
+ let settledOnce = false;
3018
+ const settled = new Promise((resolve) => {
3019
+ resolveSettled = resolve;
3020
+ });
3021
+ // Reassigned to the real function once `createHttp2PrefaceScanningChannel`
3022
+ // returns, below. `settle` can only actually run after that point (the
3023
+ // timer fires later, and `onMissing`/`onFound` fire from inside the
3024
+ // channel's own `onData`, which registers after this call), so the
3025
+ // placeholder never runs for real.
3026
+ let disposeScanBuffer = () => { };
3027
+ const settle = (result) => {
3028
+ if (settledOnce)
3029
+ return;
3030
+ settledOnce = true;
3031
+ clearTimeout(timer);
3032
+ // The bound readiness timeout can elapse while the scan still searches,
3033
+ // with no preface found and no cap refusal of its own. That path holds
3034
+ // no other cleanup, so drop the scan buffer here. A `found` result, or a
3035
+ // `missing` result the scan itself already failed closed, is a no-op
3036
+ // inside `disposeScanBuffer`.
3037
+ if (result === "missing")
3038
+ disposeScanBuffer();
3039
+ resolveSettled(result);
3040
+ };
3041
+ const timer = setTimeout(() => settle("missing"), options.timeoutMs);
3042
+ timer.unref?.();
3043
+ const scan = createHttp2PrefaceScanningChannel(channel, {
3044
+ capBytes: options.capBytes,
3045
+ onFound: () => settle("found"),
3046
+ onMissing: () => settle("missing"),
3047
+ });
3048
+ disposeScanBuffer = scan.disposeScanBuffer;
3049
+ return { scanned: scan.channel, settled, replayOverflowed: scan.replayOverflowed };
3050
+ }
3051
+ /**
3052
+ * Test-only surface for {@link scanForHttp2ClientPreface}. A test drives the
3053
+ * post-preface replay cap across every terminal path without the whole
3054
+ * bridge. Production code never reads this export.
3055
+ */
3056
+ export const __http2PrefaceScanTesting = {
3057
+ scanForHttp2ClientPreface: (channel, options) => scanForHttp2ClientPreface(channel, options),
3058
+ readScanSearchUnits: () => http2PrefaceScanSearchUnits,
3059
+ resetScanSearchUnits: () => {
3060
+ http2PrefaceScanSearchUnits = 0;
3061
+ },
3062
+ readScanBufferGrowthCopyUnits: () => http2PrefaceScanBufferGrowthCopyUnits,
3063
+ resetScanBufferGrowthCopyUnits: () => {
3064
+ http2PrefaceScanBufferGrowthCopyUnits = 0;
3065
+ },
3066
+ readReplayBufferGrowthCopyUnits: () => http2PrefaceReplayBufferGrowthCopyUnits,
3067
+ resetReplayBufferGrowthCopyUnits: () => {
3068
+ http2PrefaceReplayBufferGrowthCopyUnits = 0;
3069
+ },
3070
+ };
3071
+ function createHttp2RunDispositionLatch() {
3072
+ let lossOrdered = false;
3073
+ let lossReason = null;
3074
+ let completionOrdered = false;
3075
+ let lossListener = null;
3076
+ const markOrderlyCompletion = () => {
3077
+ if (completionOrdered || lossOrdered)
3078
+ return;
3079
+ completionOrdered = true;
3080
+ };
3081
+ return {
3082
+ get disposition() {
3083
+ return { failed: lossOrdered, lossReason };
3084
+ },
3085
+ recordLoss(reason) {
3086
+ if (lossOrdered || completionOrdered)
3087
+ return false;
3088
+ lossOrdered = true;
3089
+ lossReason = reason;
3090
+ lossListener?.(reason);
3091
+ return true;
3092
+ },
3093
+ markOrderlyCompletion,
3094
+ settleRunDisposition() {
3095
+ markOrderlyCompletion();
3096
+ return { failed: lossOrdered, lossReason };
3097
+ },
3098
+ onLoss(listener) {
3099
+ lossListener = listener;
3100
+ return () => {
3101
+ if (lossListener === listener)
3102
+ lossListener = null;
3103
+ };
3104
+ },
3105
+ };
3106
+ }
3107
+ /**
3108
+ * Create the run-log directory on the sandbox before the tail starts. The file
3109
+ * bridge worker creates this directory on the file path. The duplex path starts
3110
+ * no worker, so the host creates the directory here. The tail then reads a real
3111
+ * directory from its first tick.
3112
+ *
3113
+ * This step is best effort. The broker already serves the duplex transport when
3114
+ * the host reaches it, and the tail wrap command runs its own `mkdir -p` as a
3115
+ * backstop. So a create failure must not tear down a working duplex transport;
3116
+ * the host swallows it and still builds the tail. The log line names no raw
3117
+ * error, so no raw error rides a log line here.
3118
+ */
3119
+ async function ensureSandboxRunLogDirectory(input) {
3120
+ try {
3121
+ await input.runner.execute({
3122
+ command: input.shellCommand,
3123
+ args: shellCommandArgs(`mkdir -p ${shellQuote(input.logsDir)}`),
3124
+ cwd: input.remoteCwd,
3125
+ timeoutMs: input.timeoutMs ?? undefined,
3126
+ });
3127
+ }
3128
+ catch {
3129
+ // Best effort: the tail wrap command creates the directory before it writes.
3130
+ }
3131
+ }
3132
+ /**
3133
+ * The duplex readiness gate. The gate owns the single data listener and the
3134
+ * single exit listener of the channel while the host waits for a valid READY
3135
+ * frame. It resolves the handshake, then hands the channel to the broker.
3136
+ *
3137
+ * The gate authenticates readiness with the nonce and the strict READY schema,
3138
+ * not with the line position. A PTY channel echoes the launch wrapper line before
3139
+ * it sets raw mode, so the first line is often not the READY frame. The gate skips
3140
+ * each pre-READY line that does not decode as a READY frame, then accepts the first
3141
+ * line that decodes as a READY frame with the matching nonce. A line that decodes
3142
+ * as a READY frame with a wrong nonce fails the handshake with a nonce mismatch. An
3143
+ * early exit or a timeout also fails the handshake. The gate never dispatches a
3144
+ * request; the broker does that after readiness passes.
3145
+ *
3146
+ * The skipped bytes stay in the capped buffer, so the O(1) cap and the readiness
3147
+ * timeout still bound the wait. The gate enforces the cap on every pre-READY path
3148
+ * and before it decodes a candidate line, so an over-cap prefix never reaches READY
3149
+ * acceptance. The cap check has priority over READY acceptance on every path.
3150
+ */
3151
+ // The count of the pre-READY newline-scan work, in bytes. Each search adds the
3152
+ // number of bytes it can read. A test reads this count to prove the scan work
3153
+ // stays linear in the bytes received. Production code never reads this count.
3154
+ let duplexReadinessNewlineScanUnits = 0;
3155
+ // The count of bytes `appendReadinessBytes` copies while it grows the pre-READY
3156
+ // buffer's backing storage. A one-copy-per-fragment approach copies the whole
3157
+ // retained buffer on every fragment, so this count grows quadratically in the
3158
+ // number of fragments. The doubling-growth approach copies only on a
3159
+ // reallocation, so this count stays linear in the bytes received. A test reads
3160
+ // this count to prove the growth work does not regress to the quadratic shape.
3161
+ // Production code never reads this count.
3162
+ let duplexReadinessBufferGrowthCopyUnits = 0;
3163
+ /** The newline byte. The readiness buffer is a byte buffer, not a string. */
3164
+ const READINESS_NEWLINE_BYTE = 0x0a;
3165
+ /** The opening-brace byte. The bracketed-paste retry scans for it, not a string. */
3166
+ const READINESS_OPEN_BRACE_BYTE = 0x7b;
3167
+ /** The one shared empty buffer. The gate starts and resets `buffer` to it. */
3168
+ const READINESS_EMPTY_BUFFER = Buffer.alloc(0);
3169
+ /**
3170
+ * Find the first newline in `buffer` at or after index `from` and return its
3171
+ * index, or -1. `Buffer#indexOf` reads the bytes from `from` up to the newline
3172
+ * it finds, or to the end of the buffer when it finds none. This helper counts
3173
+ * that real scan distance for a test. The count stays linear in the bytes
3174
+ * received when the caller advances `from` past each newline it consumes.
3175
+ */
3176
+ function findNewlineFrom(buffer, from) {
3177
+ const newlineIndex = buffer.indexOf(READINESS_NEWLINE_BYTE, from);
3178
+ const scanned = newlineIndex === -1 ? buffer.length - from : newlineIndex - from + 1;
3179
+ duplexReadinessNewlineScanUnits += scanned;
3180
+ return newlineIndex;
3181
+ }
3182
+ /**
3183
+ * Test-only surface for the pre-READY readiness gate. A test reads the scan
3184
+ * count to prove the newline search work stays linear in the bytes received.
3185
+ * Production code does not use this object.
3186
+ */
3187
+ export const __duplexReadinessTesting = {
3188
+ readNewlineScanUnits: () => duplexReadinessNewlineScanUnits,
3189
+ resetNewlineScanUnits: () => {
3190
+ duplexReadinessNewlineScanUnits = 0;
3191
+ },
3192
+ readBufferGrowthCopyUnits: () => duplexReadinessBufferGrowthCopyUnits,
3193
+ resetBufferGrowthCopyUnits: () => {
3194
+ duplexReadinessBufferGrowthCopyUnits = 0;
3195
+ },
3196
+ // Build one readiness gate over a supplied channel, so a test can drive the
3197
+ // readiness-replay cap lifecycle across every terminal path without the whole
3198
+ // bridge. Production code never reads this factory.
3199
+ createReadinessGate: (channel, options) => createDuplexReadinessGate(channel, options),
3200
+ };
3201
+ function createDuplexReadinessGate(channel, options) {
3202
+ let settled = false;
3203
+ let readyOk = false;
3204
+ // The gate sets this when a post-READY pre-bind chunk tips the pending replay
3205
+ // buffer past the cap. On that overflow the gate drops the pending buffer and
3206
+ // stops the channel. The caller reads it through `replayOverflowed` and selects
3207
+ // the file bridge.
3208
+ let replayOverflow = false;
3209
+ // The raw bytes the host reads before the READY frame completes. `buffer` is
3210
+ // append-only and always a zero-copy view over the used prefix of `storage`,
3211
+ // so the O(1) cap check on `buffer.length` stays valid.
3212
+ let buffer = READINESS_EMPTY_BUFFER;
3213
+ // The backing storage for `buffer`. `appendReadinessBytes` grows this by
3214
+ // doubling its capacity, instead of copying the whole retained buffer on
3215
+ // every fragment. See `appendReadinessBytes` for why this bounds the total
3216
+ // copy work.
3217
+ let storage = READINESS_EMPTY_BUFFER;
3218
+ // The start index of the current line in `buffer`. A leading blank line
3219
+ // advances this cursor past its newline without a buffer copy.
3220
+ let lineStart = 0;
3221
+ // The next index to search for a newline. The gate scans from here, so each
3222
+ // byte is read at most one time for the newline search.
3223
+ let scanFrom = 0;
3224
+ /**
3225
+ * Append `chunk` to the pre-READY buffer without copying the bytes already
3226
+ * retained. A sender that trickles the handshake in many small fragments
3227
+ * (a slow socket, a byte-at-a-time PTY echo) would otherwise force one full
3228
+ * copy of the whole retained buffer per fragment: with `buffer` growing
3229
+ * toward the {@link DUPLEX_READINESS_BUFFER_CAP_BYTES} cap, that is
3230
+ * quadratic work in the number of fragments. This instead grows `storage`
3231
+ * by doubling its capacity only when the current capacity runs out, so the
3232
+ * backing store reallocates and copies a logarithmic number of times, and
3233
+ * each append copies only the incoming chunk. The used length still reads
3234
+ * in O(1) through `buffer.length`, so every cap check and slice below stays
3235
+ * unchanged.
3236
+ */
3237
+ function appendReadinessBytes(chunk) {
3238
+ const usedLength = buffer.length;
3239
+ const neededLength = usedLength + chunk.byteLength;
3240
+ if (neededLength > storage.length) {
3241
+ let nextCapacity = storage.length === 0 ? chunk.byteLength : storage.length * 2;
3242
+ while (nextCapacity < neededLength) {
3243
+ nextCapacity *= 2;
3244
+ }
3245
+ const grown = Buffer.allocUnsafe(nextCapacity);
3246
+ storage.copy(grown, 0, 0, usedLength);
3247
+ duplexReadinessBufferGrowthCopyUnits += usedLength;
3248
+ storage = grown;
3249
+ }
3250
+ storage.set(chunk, usedLength);
3251
+ buffer = storage.subarray(0, neededLength);
3252
+ }
3253
+ // The bytes that followed the READY frame, held until the broker binds.
3254
+ let pending = READINESS_EMPTY_BUFFER;
3255
+ // The exit that arrived after READY but before the broker bound, if any.
3256
+ let pendingExit = null;
3257
+ let dataSink = null;
3258
+ let exitSink = null;
3259
+ let resolveReady;
3260
+ const ready = new Promise((resolve) => {
3261
+ resolveReady = resolve;
3262
+ });
3263
+ const timer = setTimeout(() => finish({ ok: false, reason: "timeout" }), options.timeoutMs);
3264
+ timer.unref?.();
3265
+ function finish(result) {
3266
+ if (settled)
3267
+ return;
3268
+ settled = true;
3269
+ clearTimeout(timer);
3270
+ if (result.ok)
3271
+ readyOk = true;
3272
+ resolveReady(result);
3273
+ }
3274
+ channel.onData((chunk) => {
3275
+ if (dataSink) {
3276
+ dataSink(chunk);
3277
+ return;
3278
+ }
3279
+ if (readyOk) {
3280
+ // READY already passed; hold the bytes until the broker binds. Bound this
3281
+ // buffer directly against {@link DUPLEX_READINESS_BUFFER_CAP_BYTES}, the
3282
+ // same way the preface-scan gate's own post-preface replay buffer bounds
3283
+ // itself: a worker that keeps sending bytes after READY, faster than the
3284
+ // broker can bind, cannot grow this buffer past the cap. A chunk that
3285
+ // would pass the cap fails closed: the gate drops the pending buffer,
3286
+ // stops the channel, and sets the overflow flag. The caller reads the
3287
+ // flag and selects the file bridge, because `ready` already resolved
3288
+ // before this synchronous post-READY chunk arrived.
3289
+ if (pending.length + chunk.byteLength > DUPLEX_READINESS_BUFFER_CAP_BYTES) {
3290
+ replayOverflow = true;
3291
+ pending = READINESS_EMPTY_BUFFER;
3292
+ channel.stop();
3293
+ return;
3294
+ }
3295
+ // Copy a first chunk instead of aliasing the caller's `Uint8Array`, so a
3296
+ // channel that reuses its delivered buffer across calls cannot corrupt the
3297
+ // bytes this gate holds for the broker replay.
3298
+ pending = pending.length === 0 ? Buffer.from(chunk) : Buffer.concat([pending, chunk]);
3299
+ return;
3300
+ }
3301
+ if (settled) {
3302
+ // The handshake already failed. The channel is untrusted and can keep
3303
+ // sending bytes until the host closes it. Drop them, so a failed handshake
3304
+ // never grows the buffer after the gate settles.
3305
+ return;
3306
+ }
3307
+ // Append the new bytes and continue the newline search from `scanFrom`, the
3308
+ // first index not yet examined. Each byte is read at most one time for the
3309
+ // search, and `appendReadinessBytes` copies at most the incoming chunk, so
3310
+ // the total work stays linear in the bytes received, not in the number of
3311
+ // fragments they arrive in.
3312
+ appendReadinessBytes(chunk);
3313
+ for (;;) {
3314
+ const newlineIndex = findNewlineFrom(buffer, scanFrom);
3315
+ if (newlineIndex === -1) {
3316
+ // No complete line yet. The whole buffer up to the end is now scanned.
3317
+ scanFrom = buffer.length;
3318
+ // The gate reads untrusted bytes, so bound the pre-READY buffer. Past
3319
+ // the cap with no complete READY line, the stream cannot be a valid
3320
+ // READY frame, so finish with protocol contamination. The retained
3321
+ // skipped lines count against the cap; that is acceptable and fail-closed.
3322
+ //
3323
+ // `buffer` is a byte buffer, so `buffer.length` is the exact byte count,
3324
+ // read in O(1).
3325
+ if (buffer.length > DUPLEX_READINESS_BUFFER_CAP_BYTES) {
3326
+ finish({ ok: false, reason: "protocol_contamination" });
3327
+ }
3328
+ return;
3329
+ }
3330
+ if (newlineIndex === lineStart) {
3331
+ // Skip a blank line, the same as the frame decoder. Advance the line-start
3332
+ // cursor past the newline without a buffer copy, then search the next line
3333
+ // from the position after the newline. Enforce the cap after the advance,
3334
+ // so a blank-line flood past the cap fails closed before READY acceptance.
3335
+ lineStart = newlineIndex + 1;
3336
+ scanFrom = newlineIndex + 1;
3337
+ if (lineStart > DUPLEX_READINESS_BUFFER_CAP_BYTES) {
3338
+ finish({ ok: false, reason: "protocol_contamination" });
3339
+ return;
3340
+ }
3341
+ continue;
3342
+ }
3343
+ // A complete non-blank candidate line spans `[lineStart, newlineIndex)`.
3344
+ // Enforce the cap on the line's end offset before the decode, so an over-cap
3345
+ // prefix never reaches READY acceptance on a completed line.
3346
+ if (newlineIndex + 1 > DUPLEX_READINESS_BUFFER_CAP_BYTES) {
3347
+ finish({ ok: false, reason: "protocol_contamination" });
3348
+ return;
3349
+ }
3350
+ // Slice only the single candidate line for the decode.
3351
+ const line = buffer.slice(lineStart, newlineIndex);
3352
+ let decoded = decodeDuplexLine(line);
3353
+ if (!decoded.ok) {
3354
+ // The whole line did not decode. A terminal can put bytes in front of the
3355
+ // gateway's first frame on the same line, with no newline between them: a
3356
+ // shell with bracketed paste enabled writes its disable sequence and a
3357
+ // bare carriage return (`ESC [ ? 2 0 0 4 l CR`) immediately before the
3358
+ // child's first output. So retry the decode from the first `{` in the
3359
+ // line, which is where a frame can start.
3360
+ //
3361
+ // This does not weaken the handshake. The retry still runs the same
3362
+ // strict decode over the remainder of the line, and readiness still
3363
+ // authenticates on the nonce below, so a prefix cannot forge a frame or
3364
+ // smuggle a second one — it can only be discarded.
3365
+ const braceIndex = line.indexOf(READINESS_OPEN_BRACE_BYTE);
3366
+ if (braceIndex > 0) {
3367
+ decoded = decodeDuplexLine(line.slice(braceIndex));
3368
+ }
3369
+ }
3370
+ if (decoded.ok && decoded.frame.type === "ready") {
3371
+ // A line that decodes as a READY frame authenticates by the nonce. A wrong
3372
+ // nonce fails the handshake; the matching nonce passes it.
3373
+ if (decoded.frame.nonce !== options.nonce) {
3374
+ finish({ ok: false, reason: "nonce_mismatch" });
3375
+ return;
3376
+ }
3377
+ // The bytes that follow the READY line become the replay buffer for the
3378
+ // broker.
3379
+ //
3380
+ // Copy the suffix instead of slicing it off `buffer`. `buffer` is a view
3381
+ // over `storage`, and `storage`'s capacity can run ahead of the bytes in
3382
+ // use (the doubling growth in `appendReadinessBytes` over-provisions it).
3383
+ // A slice would keep that whole over-provisioned allocation alive for as
3384
+ // long as the broker replay holds its reference. The copy is exactly
3385
+ // `suffix.length` bytes, one time, not a per-fragment cost.
3386
+ const suffix = Buffer.from(buffer.subarray(newlineIndex + 1));
3387
+ // Drop the original pre-READY buffer and its backing storage now. The
3388
+ // gate keeps only the retained suffix as `pending`. This clear also
3389
+ // covers the broker handoff and the replay disposal. Both run later and
3390
+ // read no buffer bytes.
3391
+ buffer = READINESS_EMPTY_BUFFER;
3392
+ storage = READINESS_EMPTY_BUFFER;
3393
+ pending = suffix;
3394
+ finish({ ok: true });
3395
+ return;
3396
+ }
3397
+ // The line does not decode as a READY frame. A PTY echo line or any other
3398
+ // pre-READY noise reaches here. Skip it and keep scanning; the nonce and the
3399
+ // strict schema, not the line position, authenticate readiness. Enforce the
3400
+ // cap after the advance, so a noise-line flood past the cap fails closed.
3401
+ lineStart = newlineIndex + 1;
3402
+ scanFrom = newlineIndex + 1;
3403
+ if (lineStart > DUPLEX_READINESS_BUFFER_CAP_BYTES) {
3404
+ finish({ ok: false, reason: "protocol_contamination" });
3405
+ return;
3406
+ }
3407
+ }
3408
+ });
3409
+ channel.onExit((exit) => {
3410
+ if (exitSink) {
3411
+ exitSink(exit);
3412
+ return;
3413
+ }
3414
+ if (readyOk) {
3415
+ // The channel exited after READY but before the broker bound. Hold the
3416
+ // exit so the broker still learns of the loss.
3417
+ pendingExit = exit;
3418
+ return;
3419
+ }
3420
+ finish({ ok: false, reason: "channel_exit" });
3421
+ });
3422
+ const brokerChannel = {
3423
+ write: (data) => channel.write(data),
3424
+ onData: (listener) => {
3425
+ dataSink = listener;
3426
+ if (pending.length > 0) {
3427
+ const replay = pending;
3428
+ pending = READINESS_EMPTY_BUFFER;
3429
+ listener(replay);
3430
+ return;
3431
+ }
3432
+ },
3433
+ onExit: (listener) => {
3434
+ exitSink = listener;
3435
+ if (pendingExit) {
3436
+ const exit = pendingExit;
3437
+ pendingExit = null;
3438
+ listener(exit);
3439
+ }
3440
+ },
3441
+ stop: () => channel.stop(),
3442
+ close: () => channel.close(),
3443
+ };
3444
+ return {
3445
+ ready,
3446
+ brokerChannel,
3447
+ replayOverflowed: () => replayOverflow,
3448
+ disposePendingReplay: () => {
3449
+ pending = READINESS_EMPTY_BUFFER;
3450
+ },
3451
+ retainedReadinessBufferLength: () => buffer.length,
3452
+ };
3453
+ }
3454
+ /**
3455
+ * Close a partial duplex channel inside a bounded budget, then stop the child.
3456
+ * The host runs this on any readiness failure, so a failed duplex attempt leaves
3457
+ * no live provider session before the fallback to the file bridge.
3458
+ */
3459
+ async function closeDuplexChannelWithinBudget(channel, budgetMs) {
3460
+ try {
3461
+ let timer;
3462
+ const budget = new Promise((resolve) => {
3463
+ timer = setTimeout(resolve, budgetMs);
3464
+ timer.unref?.();
3465
+ });
3466
+ await Promise.race([channel.close().catch(() => undefined), budget]);
3467
+ if (timer !== undefined)
3468
+ clearTimeout(timer);
3469
+ }
3470
+ catch {
3471
+ // Best effort: the stop below still removes the child.
3472
+ }
3473
+ finally {
3474
+ try {
3475
+ channel.stop();
3476
+ }
3477
+ catch {
3478
+ // The channel is already gone; nothing more to do.
3479
+ }
3480
+ }
3481
+ }
3482
+ export async function startAdapterExecutionTargetPaperclipBridge(input) {
3483
+ if (!adapterExecutionTargetUsesPaperclipBridge(input.target)) {
3484
+ return null;
3485
+ }
3486
+ if (!input.target || input.target.kind !== "remote") {
3487
+ return null;
3488
+ }
3489
+ const target = input.target;
3490
+ const onLog = input.onLog ?? (async () => { });
3491
+ const hostApiToken = input.hostApiToken?.trim() ?? "";
3492
+ if (hostApiToken.length === 0) {
3493
+ throw new Error("Sandbox bridge mode requires a host-side Paperclip API token.");
3494
+ }
3495
+ // The forward budget for one relayed request. It stays at the broker's default
3496
+ // forward budget (30 s) when the caller sets no option, so current behavior
3497
+ // does not change.
3498
+ const forwardTimeoutMs = input.forwardTimeoutMs ?? DEFAULT_DUPLEX_BROKER_BUDGETS.forwardTimeoutMs;
3499
+ const runtimeRootDir = input.runtimeRootDir?.trim().length
3500
+ ? input.runtimeRootDir.trim()
3501
+ : path.posix.join(target.remoteCwd, ".paperclip-runtime", input.adapterKey);
3502
+ const bridgeRuntimeDir = path.posix.join(runtimeRootDir, "paperclip-bridge");
3503
+ const queueDir = path.posix.join(bridgeRuntimeDir, "queue");
3504
+ const assetRemoteDir = path.posix.join(bridgeRuntimeDir, "server");
3505
+ const bridgeToken = createSandboxCallbackBridgeToken();
3506
+ const configuredAttachmentBytes = Number(process.env.PAPERCLIP_ATTACHMENT_MAX_BYTES);
3507
+ // A larger upload limit needs multipart headroom. A smaller attachment limit
3508
+ // remains enforced by the API and must not shrink unrelated JSON responses.
3509
+ const defaultBodyBytes = Number.isSafeInteger(configuredAttachmentBytes) && configuredAttachmentBytes > 0
3510
+ ? Math.max(DEFAULT_SANDBOX_CALLBACK_BRIDGE_MAX_BODY_BYTES, configuredAttachmentBytes + 64 * 1024)
3511
+ : DEFAULT_SANDBOX_CALLBACK_BRIDGE_MAX_BODY_BYTES;
3512
+ const maxBodyBytes = typeof input.maxBodyBytes === "number" && Number.isFinite(input.maxBodyBytes) && input.maxBodyBytes > 0
3513
+ ? Math.trunc(input.maxBodyBytes)
3514
+ : defaultBodyBytes;
3515
+ // The bridge worker runs inside the same process that serves the Paperclip
3516
+ // API, so forwarded sandbox calls must target the LOCAL listen origin. The
3517
+ // PAPERCLIP_RUNTIME_API_URL / PAPERCLIP_API_URL exports now prefer a
3518
+ // configured public base URL, which is the origin browsers and external
3519
+ // agents use; routing this in-process loopback hop through the network edge
3520
+ // breaks deployments whose public origin sits behind a session-gated proxy
3521
+ // (every forwarded agent API call is rejected at the edge). Server boot
3522
+ // exports PAPERCLIP_LISTEN_HOST / PAPERCLIP_LISTEN_PORT before any run
3523
+ // executes, and resolveDefaultPaperclipApiUrl() maps wildcard listen hosts
3524
+ // to the loopback address of the same family (0.0.0.0 -> 127.0.0.1,
3525
+ // :: -> [::1]), so the fallback is always loopback-reachable.
3526
+ // input.hostApiUrl stays available as an explicit override seam.
3527
+ const hostApiUrl = input.hostApiUrl?.trim() || resolveDefaultPaperclipApiUrl();
3528
+ const shellCommand = adapterExecutionTargetShellCommand(target);
3529
+ const runner = adapterExecutionTargetCommandRunner(target);
3530
+ const bridgeTimeoutMs = typeof input.timeoutSec === "number" && Number.isFinite(input.timeoutSec) && input.timeoutSec > 0
3531
+ ? Math.trunc(input.timeoutSec * 1000)
3532
+ : adapterExecutionTargetTimeoutMs(target);
3533
+ await onLog("stdout", `[paperclip] Starting sandbox callback bridge for ${input.adapterKey} in ${bridgeRuntimeDir}.\n`);
3534
+ const bridgeAsset = await createSandboxCallbackBridgeAsset();
3535
+ // The provider-scoped telemetry facade for the fixed duplex observability
3536
+ // surface. It maps the raw provider key through the allowlist one time, so no
3537
+ // raw plugin key reaches a span, a counter, or the event. The default recorder
3538
+ // is a no-op, so the facade is inert until the host injects a real recorder.
3539
+ const duplexProviderKey = "providerKey" in target ? target.providerKey ?? undefined : undefined;
3540
+ const duplexObservability = createDuplexObservability({
3541
+ recorder: input.duplexObservabilityRecorder ?? undefined,
3542
+ providerKey: duplexProviderKey,
3543
+ // http2_v1 is the one active non-file transport now; every non-file
3544
+ // record this facade produces stamps the `http2` transport value.
3545
+ transport: "http2",
3546
+ });
3547
+ // PAPERCLIP_BRIDGE_DEBUG opts into verbose stdout logs of every bridge proxy
3548
+ // request/response. The query string is logged verbatim, so callers who pass
3549
+ // auth tokens or other sensitive values as query parameters should be aware
3550
+ // those values appear in the host process's stdout when this flag is enabled.
3551
+ // Only intended for active debugging in trusted environments.
3552
+ const bridgeDebugEnabled = isBridgeDebugEnabled(process.env);
3553
+ // One forward of a relayed sandbox request onto the existing Paperclip API
3554
+ // path. The forward applies the real host token and the signed run id, so the
3555
+ // token replacement and the run attribution stay in one place for both the
3556
+ // file bridge and the duplex broker. The sandbox request carries only the
3557
+ // bridge token; the real agent token never leaves the host.
3558
+ const forwardBridgeRequest = async (request, signal, options) => {
3559
+ const method = request.method.trim().toUpperCase() || "GET";
3560
+ // The per-request debug log prints the method, the path, and the query. The
3561
+ // duplex path suppresses it, so no route or query rides a log line there. The
3562
+ // file path keeps the existing behavior.
3563
+ const emitDebugLog = bridgeDebugEnabled && options?.suppressDebugLog !== true;
3564
+ if (emitDebugLog) {
3565
+ await onLog("stdout", `[paperclip] Bridge proxy ${method} ${request.path}${request.query ? `?${request.query}` : ""}\n`);
3566
+ }
3567
+ const headers = new Headers();
3568
+ for (const [key, value] of Object.entries(request.headers)) {
3569
+ if (value.trim().length === 0)
3570
+ continue;
3571
+ headers.set(key, value);
3572
+ }
3573
+ headers.set("authorization", `Bearer ${hostApiToken}`);
3574
+ headers.set("x-paperclip-run-id", input.runId);
3575
+ // Abort the forward when the caller aborts the request (its per-iteration
3576
+ // timeout or watchdog fired, or the broker's forward budget ended), or after
3577
+ // the forward budget here, whichever comes first.
3578
+ const timeoutSignal = AbortSignal.timeout(forwardTimeoutMs);
3579
+ const forwardSignal = signal ? AbortSignal.any([signal, timeoutSignal]) : timeoutSignal;
3580
+ // Build the request-body init. A GET or a HEAD carries no body. The file
3581
+ // bridge passes legacy JSON as a string and binary data as a `Buffer`;
3582
+ // HTTP/2 passes raw `Buffer` bodies. Undici accepts a `Buffer` request body directly (a
3583
+ // `Buffer` is an `ArrayBufferView`), so neither shape needs a conversion.
3584
+ // The cast below only bridges a `BodyInit` typing gap: the DOM library
3585
+ // type this project's ambient `RequestInit` resolves to excludes a
3586
+ // `Buffer`, though Undici accepts one at runtime.
3587
+ const forwardInit = {
3588
+ method,
3589
+ headers,
3590
+ signal: forwardSignal,
3591
+ };
3592
+ if (method !== "GET" && method !== "HEAD" && request.body !== undefined) {
3593
+ forwardInit.body = request.body;
3594
+ }
3595
+ const response = await fetch(buildBridgeForwardUrl(hostApiUrl, request), forwardInit);
3596
+ if (emitDebugLog) {
3597
+ await onLog("stdout", `[paperclip] Bridge proxy response ${response.status} for ${method} ${request.path}${request.query ? `?${request.query}` : ""}\n`);
3598
+ }
3599
+ // The host delivered response headers, so the response-body read starts after
3600
+ // the host processed the request. A later response-body read failure (a body
3601
+ // over the size limit, or a stream read error) needs a classification by
3602
+ // method safety. A safe method (GET, HEAD, OPTIONS, TRACE) never changes host
3603
+ // state, so a retry cannot double-apply a mutation and the failure stays
3604
+ // retryable. A mutating or otherwise unsafe method may have committed on the
3605
+ // host, so a retryable status is unsafe: it makes the caller repeat the
3606
+ // request with a new request id outside the broker deduplication set, and the
3607
+ // host applies the mutation twice. For an unsafe method the code returns a
3608
+ // non-retryable 504 and marks the outcome indeterminate, exactly like an
3609
+ // aborted in-flight forward. The in-sandbox server maps the indeterminate 504
3610
+ // to a non-retryable 409 for both the file bridge and the duplex broker.
3611
+ let responseBody;
3612
+ try {
3613
+ responseBody = await readBridgeForwardResponseBody(response, maxBodyBytes, options?.reservation);
3614
+ }
3615
+ catch (error) {
3616
+ // A denied reservation is retryable capacity pressure for a safe
3617
+ // method, not a body-read fault: rethrow it before the method-safety
3618
+ // classification below runs, so it reaches the HTTP/2 bridge's own
3619
+ // capacity-denial catch (which answers the retryable 503 and settles
3620
+ // the stream) instead of this function turning it into a 502. For an
3621
+ // unsafe (mutating) method, the host has already delivered response
3622
+ // headers by this point, so it may already have committed the
3623
+ // mutation. Rethrowing there too would let the retryable 503 reach a
3624
+ // caller that repeats the request, applying the mutation twice. An
3625
+ // unsafe method's capacity denial falls through to the same
3626
+ // non-retryable indeterminate 504 any other response-body read fault
3627
+ // gets below.
3628
+ if (error instanceof BridgeProcessCapacityError && isSafeBridgeMethod(method))
3629
+ throw error;
3630
+ if (isSafeBridgeMethod(method)) {
3631
+ // The method is safe, so a retry cannot double-apply a mutation. Return a
3632
+ // retryable 502 with no indeterminate marker, so the gateway passes it
3633
+ // through as a retryable status.
3634
+ return {
3635
+ status: 502,
3636
+ headers: { "content-type": "application/json" },
3637
+ body: Buffer.from(JSON.stringify({
3638
+ error: error instanceof Error ? error.message : String(error),
3639
+ }), "utf8"),
3640
+ };
3641
+ }
3642
+ return {
3643
+ status: 504,
3644
+ headers: {
3645
+ "content-type": "application/json",
3646
+ "x-paperclip-bridge-outcome": "indeterminate",
3647
+ },
3648
+ body: Buffer.from(JSON.stringify({
3649
+ error: error instanceof Error ? error.message : String(error),
3650
+ outcome: "indeterminate",
3651
+ retryable: false,
3652
+ }), "utf8"),
3653
+ };
3654
+ }
3655
+ const commentMarker = postedIssueCommentLogMarker(method, request.path, response.status, responseBody);
3656
+ if (commentMarker)
3657
+ await onLog("stdout", commentMarker);
3658
+ return {
3659
+ status: response.status,
3660
+ headers: buildBridgeResponseHeaders(response),
3661
+ body: responseBody,
3662
+ };
3663
+ };
3664
+ // Two strict gates guard the duplex transport. Select duplex only when the
3665
+ // experimental setting is exactly `true`, the resolved capability
3666
+ // `duplexCommandStream` is exactly `true`, and the runner exposes the duplex
3667
+ // channel. Any other value of either gate selects the file bridge below.
3668
+ // HTTP/2 is the preferred transport. `queue_v1` is the soft-deprecated fallback.
3669
+ const duplexRequested = input.enableSandboxDuplexBridge === true;
3670
+ const capabilityGranted = "effectiveCapabilities" in target &&
3671
+ target.effectiveCapabilities?.duplexCommandStream === true;
3672
+ const openDuplexChannel = runner.openDuplexChannel?.bind(runner);
3673
+ // Record the pre-attempt fallback for a file-bridge selection that opens no
3674
+ // channel. `gate_off` marks the kill switch off; `capability_absent` marks the
3675
+ // capability or the runner method absent. A later channel-open failure records
3676
+ // its own fallback through the channel-open attempt below.
3677
+ if (!duplexRequested) {
3678
+ duplexObservability.recordFallback("gate_off");
3679
+ }
3680
+ else if (!capabilityGranted || typeof openDuplexChannel !== "function") {
3681
+ duplexObservability.recordFallback("capability_absent");
3682
+ }
3683
+ if (duplexRequested && capabilityGranted && typeof openDuplexChannel === "function") {
3684
+ // Begin the channel-open attempt. The block reports exactly one terminal:
3685
+ // `ready` on success, or `fallback(reason)` on an open or a readiness failure.
3686
+ const duplexChannelOpen = duplexObservability.startChannelOpen();
3687
+ const readinessTimeoutMs = typeof input.duplexReadinessTimeoutMs === "number" &&
3688
+ Number.isFinite(input.duplexReadinessTimeoutMs) &&
3689
+ input.duplexReadinessTimeoutMs > 0
3690
+ ? Math.trunc(input.duplexReadinessTimeoutMs)
3691
+ : DEFAULT_DUPLEX_READINESS_TIMEOUT_MS;
3692
+ // The host assigns the loopback port before it opens the channel. It passes
3693
+ // the port and one random per-open nonce to the gateway only through the
3694
+ // launch environment. It builds the sandbox-facing origin from its own
3695
+ // stored port. No field of any channel frame contributes to the endpoint.
3696
+ //
3697
+ // Provider-boundary rationale (a security-review condition): the Daytona SDK
3698
+ // surface the plugin uses (`sandbox.process` sessions, PTY, and exec;
3699
+ // `sandbox.fs`) exposes no listener identity that the provider control plane
3700
+ // binds to a launched process. No channel-supplied address can be attested,
3701
+ // so this design uses zero channel-supplied addressing data. The only actor
3702
+ // that can pre-bind the host-assigned loopback port before the agent starts
3703
+ // is the provider itself, which already delivers the agent launch
3704
+ // environment. The gateway bind-or-exit contract fails closed. This is an
3705
+ // accepted provider-untrusted residual, not endpoint authentication: the
3706
+ // nonce is a liveness signal, because a compromised channel can read the
3707
+ // launch environment; the endpoint stays safe because it never derives from
3708
+ // the channel.
3709
+ const assignedPort = await reserveHostAssignedLoopbackPort();
3710
+ const nonce = randomBytes(16).toString("hex");
3711
+ const sandboxOrigin = `http://127.0.0.1:${assignedPort}`;
3712
+ let channel = null;
3713
+ // The open runs two stages under one try: the entrypoint sync, then the
3714
+ // channel open. The stage names the exact open-failure outcome in the catch.
3715
+ let openStage = "entrypoint_sync";
3716
+ try {
3717
+ const assetSync = await syncSandboxCallbackBridgeEntrypoint({
3718
+ runner,
3719
+ remoteCwd: target.remoteCwd,
3720
+ assetRemoteDir,
3721
+ bridgeAsset,
3722
+ timeoutMs: bridgeTimeoutMs,
3723
+ shellCommand,
3724
+ });
3725
+ const gatewayEnv = {
3726
+ PAPERCLIP_API_BRIDGE_MODE: SANDBOX_CALLBACK_BRIDGE_HTTP2_MODE,
3727
+ PAPERCLIP_BRIDGE_TOKEN: bridgeToken,
3728
+ PAPERCLIP_BRIDGE_HOST: "127.0.0.1",
3729
+ PAPERCLIP_BRIDGE_PORT: String(assignedPort),
3730
+ PAPERCLIP_BRIDGE_NONCE: nonce,
3731
+ PAPERCLIP_BRIDGE_MAX_BODY_BYTES: String(maxBodyBytes),
3732
+ };
3733
+ const command = buildDuplexGatewayLaunchArgv({
3734
+ shellCommand,
3735
+ remoteEntrypoint: assetSync.remoteEntrypoint,
3736
+ env: gatewayEnv,
3737
+ });
3738
+ openStage = "channel_open";
3739
+ channel = await openDuplexChannel({ command });
3740
+ }
3741
+ catch (error) {
3742
+ // The channel never opened, so no request could carry the bridge token.
3743
+ // The open call is the last statement of the try, so `channel` is still
3744
+ // null here; there is nothing to close. Fall through to the file bridge
3745
+ // below. Bind and keep the caught error, so the fallback names the exact
3746
+ // open-failure stage: a full process-scoped route ceiling is `route_busy`;
3747
+ // otherwise the stage is the entrypoint sync or the channel open. The log
3748
+ // line names only the fixed stage enum, so no raw provider error rides a log
3749
+ // line on the duplex path.
3750
+ const reason = isDuplexRouteBusyError(error)
3751
+ ? "route_busy"
3752
+ : openStage === "entrypoint_sync"
3753
+ ? "entrypoint_sync_failed"
3754
+ : "channel_open_failed";
3755
+ duplexChannelOpen.fallback(reason);
3756
+ await onLog("stderr", `[paperclip] Could not open the sandbox duplex channel (${reason}). Using the file bridge.\n`);
3757
+ channel = null;
3758
+ }
3759
+ if (channel) {
3760
+ const gate = createDuplexReadinessGate(channel, {
3761
+ nonce,
3762
+ timeoutMs: readinessTimeoutMs,
3763
+ });
3764
+ const readiness = await gate.ready;
3765
+ if (!readiness.ok) {
3766
+ // Fail closed. Close the partial channel inside a bounded budget, then
3767
+ // select the file bridge. The broker never started, so no request that
3768
+ // carries the bridge token reached the channel or any endpoint. The reason
3769
+ // is a fixed enum, so it rides the log line and the fallback telemetry
3770
+ // with no raw value.
3771
+ gate.disposePendingReplay();
3772
+ await closeDuplexChannelWithinBudget(channel, DEFAULT_DUPLEX_CLEANUP_BUDGET_MS);
3773
+ duplexChannelOpen.fallback(duplexReadinessFallbackReason(readiness.reason));
3774
+ await onLog("stderr", `[paperclip] Sandbox duplex readiness failed (${readiness.reason}). Using the file bridge.\n`);
3775
+ }
3776
+ else {
3777
+ // Readiness passed. The gate retained every byte that followed the
3778
+ // accepted READY line. Scan those retained bytes for the HTTP/2
3779
+ // client connection preface — the scan window opens only now, after
3780
+ // the gate accepted the nonce — and start the HTTP/2 session at that
3781
+ // offset, inclusive. A missing preface inside the bounded readiness
3782
+ // buffer aborts the open; the run falls back to `queue_v1` exactly
3783
+ // one time (accepted security fix 6).
3784
+ const openedChannel = channel;
3785
+ const prefaceScan = scanForHttp2ClientPreface(gate.brokerChannel, {
3786
+ capBytes: DUPLEX_READINESS_BUFFER_CAP_BYTES,
3787
+ timeoutMs: readinessTimeoutMs,
3788
+ });
3789
+ const prefaceResult = await prefaceScan.settled;
3790
+ if (prefaceResult === "missing") {
3791
+ // Fail closed, the same shape as a readiness failure: close the
3792
+ // partial channel inside the cleanup budget, then select the file
3793
+ // bridge. No HTTP/2 server ever bound to this channel, so no
3794
+ // request reached it or any endpoint.
3795
+ gate.disposePendingReplay();
3796
+ await closeDuplexChannelWithinBudget(openedChannel, DEFAULT_DUPLEX_CLEANUP_BUDGET_MS);
3797
+ duplexChannelOpen.fallback("preface_missing");
3798
+ await onLog("stderr", "[paperclip] Sandbox HTTP/2 client preface did not appear inside the bounded readiness buffer (preface_missing). Using the file bridge.\n");
3799
+ }
3800
+ else {
3801
+ // The run disposition latch for the http2_v1 path, in the same
3802
+ // shape the retired duplex_v1 broker exposed. A loss ordered before
3803
+ // an orderly completion reports a failure with the typed loss
3804
+ // reason; every other state reports a success.
3805
+ const dispositionLatch = createHttp2RunDispositionLatch();
3806
+ // Set before the first await inside the forward handler, so a loss
3807
+ // that lands mid-request still classifies as `post_dispatch`.
3808
+ let anyStreamDispatched = false;
3809
+ const recordHttp2Loss = (event) => {
3810
+ const reason = mapHttp2EventToDuplexLossReason(event);
3811
+ const disposedNow = dispositionLatch.recordLoss(reason);
3812
+ if (!disposedNow && (reason === "provider_exit" || reason === "transport_closed")) {
3813
+ // A clean channel end that orders after a host-observed orderly
3814
+ // completion is a normal teardown, not a loss: the run already
3815
+ // completed. Emit no loss telemetry and no log line for it, the
3816
+ // same policy the retired duplex_v1 broker applied.
3817
+ return;
3818
+ }
3819
+ const lossClass = anyStreamDispatched ? "post_dispatch" : "pre_dispatch";
3820
+ duplexObservability.recordLoss(lossClass, reason);
3821
+ void onLog("stderr", `[paperclip] Sandbox HTTP/2 channel lost (${reason}). The run fails.\n`);
3822
+ };
3823
+ // The forward handler applies the real host token and the run id
3824
+ // through the existing `forwardBridgeRequest` — the same function
3825
+ // the file bridge uses. The route allowlist, the header allowlist,
3826
+ // and the per-request debug-log suppression already ran inside
3827
+ // `createHttp2BridgeServer`'s own stream handler before this call.
3828
+ // It records the request span with the same latency-and-outcome
3829
+ // shape the retired duplex_v1 broker recorded: `ok` for any
3830
+ // delivered host response (any status), `error` only when the
3831
+ // forward call itself throws.
3832
+ const http2ForwardRequest = async (request) => {
3833
+ anyStreamDispatched = true;
3834
+ const dispatchStartMs = Date.now();
3835
+ try {
3836
+ const result = await forwardBridgeRequest({
3837
+ method: request.method,
3838
+ path: request.pathname,
3839
+ query: request.query,
3840
+ headers: request.headers,
3841
+ body: request.body,
3842
+ }, request.signal, { suppressDebugLog: true, reservation: request.reservation });
3843
+ duplexObservability.recordRequest({ latencyMs: Date.now() - dispatchStartMs, outcome: "ok" });
3844
+ return { status: result.status, headers: result.headers, body: result.body };
3845
+ }
3846
+ catch (error) {
3847
+ duplexObservability.recordRequest({ latencyMs: Date.now() - dispatchStartMs, outcome: "error" });
3848
+ throw error;
3849
+ }
3850
+ };
3851
+ const http2Server = createHttp2BridgeServer({
3852
+ bridgeToken,
3853
+ forwardRequest: http2ForwardRequest,
3854
+ routes: HTTP2_SANDBOX_CALLBACK_BRIDGE_ROUTE_ALLOWLIST,
3855
+ // The same resolved limit the launch environment hands the
3856
+ // sandbox-side gateway (`PAPERCLIP_BRIDGE_MAX_BODY_BYTES`,
3857
+ // below), so the host check and the gateway check enforce one
3858
+ // value instead of the host silently falling back to the
3859
+ // package default.
3860
+ maxBodyBytes,
3861
+ onGoaway: () => recordHttp2Loss("session_goaway"),
3862
+ onSessionError: () => recordHttp2Loss("session_error"),
3863
+ });
3864
+ // Combine the loss hook with the forward-to-Duplex handoff inside
3865
+ // one `onExit` registration: the channel primitive holds exactly
3866
+ // one listener slot, and `bindChannel` below registers the one that
3867
+ // ends the wrapped `Duplex`.
3868
+ //
3869
+ // This object's `stop()` is also the real sandbox-side effect of
3870
+ // the post-bind read backpressure bound `bindChannel` applies
3871
+ // (`wrapDuplexChannelAsNodeDuplex` in `http2-bridge-server.ts`):
3872
+ // this raw provider channel exposes no pause, so once the bounded
3873
+ // read queue there overflows, it calls `stop()` through this exact
3874
+ // chain, down to `prefaceScan.scanned.stop()` and on to the real
3875
+ // channel, instead of letting sandbox-controlled bytes grow host
3876
+ // memory with no bound.
3877
+ const channelForHttp2Server = {
3878
+ write: (data) => prefaceScan.scanned.write(data),
3879
+ onData: (listener) => prefaceScan.scanned.onData(listener),
3880
+ onExit: (listener) => {
3881
+ prefaceScan.scanned.onExit((exit) => {
3882
+ recordHttp2Loss("channel_exit");
3883
+ listener(exit);
3884
+ });
3885
+ },
3886
+ stop: () => prefaceScan.scanned.stop(),
3887
+ close: () => prefaceScan.scanned.close(),
3888
+ };
3889
+ const boundDuplex = http2Server.bindChannel(channelForHttp2Server);
3890
+ // Also catches the `Duplex` this wrapper destroys when the bounded
3891
+ // read backpressure queue overflows post-bind, so that loss still
3892
+ // reaches `recordHttp2Loss` the same way any other write fault does.
3893
+ boundDuplex.on("error", () => recordHttp2Loss("write_error"));
3894
+ duplexChannelOpen.ready();
3895
+ await onLog("stdout", "[paperclip] Sandbox HTTP/2 transport ready; serving the host-assigned origin.\n");
3896
+ // Stream run logs on the http2 path with the same gate and the same
3897
+ // log line as the file path. The http2 path starts no file-bridge
3898
+ // worker, so create the log directory before the tail starts.
3899
+ let duplexRunLogTail = null;
3900
+ if (target.transport === "sandbox" && target.streamRunLogs !== false) {
3901
+ const duplexLogsDir = sandboxCallbackBridgeDirectories(queueDir).logsDir;
3902
+ await ensureSandboxRunLogDirectory({
3903
+ runner,
3904
+ remoteCwd: target.remoteCwd,
3905
+ logsDir: duplexLogsDir,
3906
+ shellCommand,
3907
+ timeoutMs: bridgeTimeoutMs,
3908
+ });
3909
+ duplexRunLogTail = createSandboxRunLogTailFactory({
3910
+ runner,
3911
+ remoteCwd: target.remoteCwd,
3912
+ logsDir: duplexLogsDir,
3913
+ shellCommand,
3914
+ });
3915
+ await onLog("stdout", "[paperclip] Sandbox run log streaming enabled for this run.\n");
3916
+ }
3917
+ return {
3918
+ env: {
3919
+ PAPERCLIP_API_URL: sandboxOrigin,
3920
+ PAPERCLIP_API_KEY: bridgeToken,
3921
+ PAPERCLIP_API_BRIDGE_MODE: SANDBOX_CALLBACK_BRIDGE_HTTP2_MODE,
3922
+ },
3923
+ runLogTail: duplexRunLogTail,
3924
+ readRunDisposition: () => dispositionLatch.disposition,
3925
+ // Atomically read the latch and mark the orderly completion for the
3926
+ // ACP success-eligible terminal, so no await separates the read from
3927
+ // the mark and a teardown loss cannot slip in between.
3928
+ settleRunDisposition: () => dispositionLatch.settleRunDisposition(),
3929
+ markOrderlyCompletion: () => dispositionLatch.markOrderlyCompletion(),
3930
+ onLoss: (listener) => dispositionLatch.onLoss(listener),
3931
+ stop: async () => {
3932
+ // Close the HTTP/2 server's sessions, then the channel, before
3933
+ // lease release, so no live provider session remains when the
3934
+ // caller releases the lease.
3935
+ await http2Server.close();
3936
+ await closeDuplexChannelWithinBudget(openedChannel, DEFAULT_DUPLEX_CLEANUP_BUDGET_MS);
3937
+ await bridgeAsset.cleanup();
3938
+ },
3939
+ };
3940
+ }
3941
+ }
3942
+ }
3943
+ }
3944
+ let server = null;
3945
+ let worker = null;
3946
+ try {
3947
+ const client = createCommandManagedSandboxCallbackBridgeQueueClient({
3948
+ runner,
3949
+ remoteCwd: target.remoteCwd,
3950
+ timeoutMs: bridgeTimeoutMs,
3951
+ shellCommand,
3952
+ });
3953
+ // `startSandboxCallbackBridgeWorker` keeps its awaited queue-directory
3954
+ // setup on the active `bridge.paperclip` step, and runs each request under
3955
+ // the run parent context (see `runWithRuntimeParent` inside that function).
3956
+ // So the startup `mkdir` execs stay parented to the step, and every later
3957
+ // request `sandbox.exec` span parents to the live run span.
3958
+ worker = await startSandboxCallbackBridgeWorker({
3959
+ client,
3960
+ queueDir,
3961
+ maxBodyBytes,
3962
+ getRuntimeParentContext: input.getRuntimeParentContext,
3963
+ runtimeSpan: input.runtimeSpan,
3964
+ // The worker encodes binary bodies only at the queue boundary.
3965
+ handleRequest: (request, options) => forwardBridgeRequest(request, options?.signal, {
3966
+ reservation: options?.reservation,
3967
+ }),
3968
+ });
3969
+ server = await startSandboxCallbackBridgeServer({
3970
+ runner,
3971
+ remoteCwd: target.remoteCwd,
3972
+ assetRemoteDir,
3973
+ queueDir,
3974
+ bridgeToken,
3975
+ bridgeAsset,
3976
+ timeoutMs: bridgeTimeoutMs,
3977
+ maxBodyBytes,
3978
+ shellCommand,
3979
+ });
3980
+ }
3981
+ catch (error) {
3982
+ await Promise.allSettled([
3983
+ server?.stop(),
3984
+ worker?.stop(),
3985
+ bridgeAsset.cleanup(),
3986
+ ]);
3987
+ throw error;
3988
+ }
3989
+ let runLogTail = null;
3990
+ if (target.transport === "sandbox" && target.streamRunLogs !== false) {
3991
+ runLogTail = createSandboxRunLogTailFactory({
3992
+ runner,
3993
+ remoteCwd: target.remoteCwd,
3994
+ logsDir: sandboxCallbackBridgeDirectories(queueDir).logsDir,
3995
+ shellCommand,
3996
+ });
3997
+ await onLog("stdout", "[paperclip] Sandbox run log streaming enabled for this run.\n");
3998
+ }
3999
+ return {
4000
+ env: {
4001
+ PAPERCLIP_API_URL: server.baseUrl,
4002
+ PAPERCLIP_API_KEY: bridgeToken,
4003
+ PAPERCLIP_API_BRIDGE_MODE: "queue_v1",
4004
+ PAPERCLIP_BRIDGE_QUEUE_DIR: queueDir,
4005
+ },
4006
+ runLogTail,
4007
+ stop: async () => {
4008
+ await Promise.allSettled([
4009
+ server?.stop(),
4010
+ ]);
4011
+ await Promise.allSettled([
4012
+ worker?.stop(),
4013
+ bridgeAsset.cleanup(),
4014
+ ]);
4015
+ },
4016
+ };
4017
+ }
4018
+ //# sourceMappingURL=execution-target.js.map