deadbyte-mcp 0.8.7

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 (1390) hide show
  1. package/DEADBYTE-MCP-R27-FINAL/R27-ADMIN-CLOSURE.json +22 -0
  2. package/DEADBYTE-MCP-R27-FINAL/R27-CLEANUP-FINAL-RECEIPT.json +24 -0
  3. package/DEADBYTE-MCP-R27-FINAL/R27-FINAL-CLOSURE.json +188 -0
  4. package/DEADBYTE-MCP-R27-FINAL/R27-SLOT-UPDATE-RECEIPT.json +109 -0
  5. package/DEADBYTE-MCP.cmd +4 -0
  6. package/MANIFEST.SHA256 +1389 -0
  7. package/README.txt +260 -0
  8. package/bin/WORKER-REGISTRY.txt +12 -0
  9. package/bin/appcontainer-stage.exe +0 -0
  10. package/bin/appcontainer-stage.obj +0 -0
  11. package/bin/bootstrap-advapi32.exe +0 -0
  12. package/bin/bootstrap-advapi32.obj +0 -0
  13. package/bin/bootstrap-exitcode.exe +0 -0
  14. package/bin/bootstrap-exitcode.obj +0 -0
  15. package/bin/bootstrap-kernel32.exe +0 -0
  16. package/bin/bootstrap-kernel32.obj +0 -0
  17. package/bin/child-control-probe.exe +0 -0
  18. package/bin/child-control-probe.obj +0 -0
  19. package/bin/child-control-stage.exe +0 -0
  20. package/bin/child-control-stage.obj +0 -0
  21. package/bin/contained-reverse-worker.exe +0 -0
  22. package/bin/contained-reverse-worker.obj +0 -0
  23. package/bin/contained-transform-worker.exe +0 -0
  24. package/bin/contained-transform-worker.obj +0 -0
  25. package/bin/containment-probe.exe +0 -0
  26. package/bin/containment-probe.obj +0 -0
  27. package/bin/deadbyte-contain.exe +0 -0
  28. package/bin/deadbyte-contain.obj +0 -0
  29. package/bin/deadbyte-exec.exe +0 -0
  30. package/bin/deadbyte-exec.obj +0 -0
  31. package/bin/deadbyte-process-host.exe +0 -0
  32. package/bin/deadbyte-process-host.obj +0 -0
  33. package/bin/deadbyte-tunnel-host.exe +0 -0
  34. package/bin/deadbyte-tunnel-host.obj +0 -0
  35. package/conpty-input-observer.obj +0 -0
  36. package/controller/DEADBYTE-MCP.cmd +5 -0
  37. package/controller/README.TXT +127 -0
  38. package/controller/deadbyte-controller.config.psd1.example +60 -0
  39. package/controller/deadbyte-controller.ps1 +1090 -0
  40. package/controller/deadbyte-host-policy.json.example +33 -0
  41. package/controller/deadbyte-process-policy.json +47 -0
  42. package/docs/ARCHITECTURE.md +168 -0
  43. package/docs/AUTHORITY.md +56 -0
  44. package/docs/CHILD-CONTROL.md +31 -0
  45. package/docs/CONSTRUCTION-LADDER.md +84 -0
  46. package/docs/CONTAINMENT.md +92 -0
  47. package/docs/EXECUTION.md +330 -0
  48. package/docs/NETWORK.md +64 -0
  49. package/docs/R221-STRICT-OUTPUT-CONTRACT.md +24 -0
  50. package/docs/REFERENCES.txt +117 -0
  51. package/docs/TRUST.md +46 -0
  52. package/docs/V070-HARDENING.md +48 -0
  53. package/docs/V071-HOST-PLANE.md +113 -0
  54. package/docs/V073-TUNNEL-STDIO-COMPAT.md +37 -0
  55. package/docs/V080-AGENT-RUNTIME.md +101 -0
  56. package/docs/V080-R23-CODING-AGENT.md +50 -0
  57. package/docs/V080-R24-AUTONOMOUS-PRODUCTION.md +74 -0
  58. package/docs/V081-R25-MANUS-CONTROL-SEMANTICS.md +145 -0
  59. package/docs/V082-R26-RUNTIME-SELF-UPDATE.md +86 -0
  60. package/docs/V083-R27-IMMUTABLE-RELEASE-SLOTS.md +55 -0
  61. package/docs/V084-R28-PERSISTENT-NAMED-TUNNEL.md +57 -0
  62. package/docs/V085-R29-MACHINE-IDENTITY.md +99 -0
  63. package/docs/superpowers/plans/2026-09-14-r30-process-plane.md +178 -0
  64. package/docs/superpowers/plans/2026-09-14-r31-process-prerequisite.md +132 -0
  65. package/docs/superpowers/plans/2026-09-15-r33-audit-chain-npx.md +132 -0
  66. package/docs/superpowers/specs/2026-09-14-r30-r33-machine-control-design.md +214 -0
  67. package/docs/superpowers/specs/2026-09-14-r31-r33-final-baseline-successor-design.md +133 -0
  68. package/docs/superpowers/specs/2026-09-15-r33-audit-chain-npx-design.md +145 -0
  69. package/mcp-server.mjs +1 -0
  70. package/miniconpty.obj +0 -0
  71. package/native/appcontainer-stage.cpp +353 -0
  72. package/native/bootstrap-advapi32.cpp +70 -0
  73. package/native/bootstrap-exitcode.cpp +6 -0
  74. package/native/bootstrap-kernel32.cpp +47 -0
  75. package/native/child-control-probe.cpp +67 -0
  76. package/native/child-control-stage.cpp +347 -0
  77. package/native/contained-network-proof.h +118 -0
  78. package/native/contained-reverse-worker.cpp +299 -0
  79. package/native/contained-transform-worker.cpp +312 -0
  80. package/native/containment-probe.cpp +269 -0
  81. package/native/deadbyte-contain.cpp +625 -0
  82. package/native/deadbyte-exec.cpp +966 -0
  83. package/native/deadbyte-process-host.cpp +340 -0
  84. package/native/deadbyte-tunnel-host.cpp +109 -0
  85. package/node_modules/@modelcontextprotocol/client/LICENSE +216 -0
  86. package/node_modules/@modelcontextprotocol/client/README.md +26 -0
  87. package/node_modules/@modelcontextprotocol/client/dist/ajvProvider-1b6pVpkg.cjs +7531 -0
  88. package/node_modules/@modelcontextprotocol/client/dist/ajvProvider-1b6pVpkg.cjs.map +1 -0
  89. package/node_modules/@modelcontextprotocol/client/dist/ajvProvider-97rDpkRx.mjs +7514 -0
  90. package/node_modules/@modelcontextprotocol/client/dist/ajvProvider-97rDpkRx.mjs.map +1 -0
  91. package/node_modules/@modelcontextprotocol/client/dist/ajvProvider-FOQRM7up.d.cts +1071 -0
  92. package/node_modules/@modelcontextprotocol/client/dist/ajvProvider-FOQRM7up.d.cts.map +1 -0
  93. package/node_modules/@modelcontextprotocol/client/dist/ajvProvider-INpkxUi1.d.mts +1071 -0
  94. package/node_modules/@modelcontextprotocol/client/dist/ajvProvider-INpkxUi1.d.mts.map +1 -0
  95. package/node_modules/@modelcontextprotocol/client/dist/cfWorkerProvider-B3ZJEoRM.d.mts +74 -0
  96. package/node_modules/@modelcontextprotocol/client/dist/cfWorkerProvider-B3ZJEoRM.d.mts.map +1 -0
  97. package/node_modules/@modelcontextprotocol/client/dist/cfWorkerProvider-B3dvjU3F.cjs +986 -0
  98. package/node_modules/@modelcontextprotocol/client/dist/cfWorkerProvider-B3dvjU3F.cjs.map +1 -0
  99. package/node_modules/@modelcontextprotocol/client/dist/cfWorkerProvider-BylNJ1R5.mjs +981 -0
  100. package/node_modules/@modelcontextprotocol/client/dist/cfWorkerProvider-BylNJ1R5.mjs.map +1 -0
  101. package/node_modules/@modelcontextprotocol/client/dist/cfWorkerProvider-doTkZbTr.d.cts +74 -0
  102. package/node_modules/@modelcontextprotocol/client/dist/cfWorkerProvider-doTkZbTr.d.cts.map +1 -0
  103. package/node_modules/@modelcontextprotocol/client/dist/chunk-Bnu9O96Y.cjs +60 -0
  104. package/node_modules/@modelcontextprotocol/client/dist/chunk-Br0eD_fh.mjs +42 -0
  105. package/node_modules/@modelcontextprotocol/client/dist/dialects-BGO_ZrYF.cjs +46 -0
  106. package/node_modules/@modelcontextprotocol/client/dist/dialects-BGO_ZrYF.cjs.map +1 -0
  107. package/node_modules/@modelcontextprotocol/client/dist/dialects-BOhdv1Fc.mjs +34 -0
  108. package/node_modules/@modelcontextprotocol/client/dist/dialects-BOhdv1Fc.mjs.map +1 -0
  109. package/node_modules/@modelcontextprotocol/client/dist/index-CHhhk6PQ.d.cts +2526 -0
  110. package/node_modules/@modelcontextprotocol/client/dist/index-CHhhk6PQ.d.cts.map +1 -0
  111. package/node_modules/@modelcontextprotocol/client/dist/index-D4xIIEF6.d.mts +2523 -0
  112. package/node_modules/@modelcontextprotocol/client/dist/index-D4xIIEF6.d.mts.map +1 -0
  113. package/node_modules/@modelcontextprotocol/client/dist/index.cjs +5690 -0
  114. package/node_modules/@modelcontextprotocol/client/dist/index.cjs.map +1 -0
  115. package/node_modules/@modelcontextprotocol/client/dist/index.d.cts +3252 -0
  116. package/node_modules/@modelcontextprotocol/client/dist/index.d.cts.map +1 -0
  117. package/node_modules/@modelcontextprotocol/client/dist/index.d.mts +3252 -0
  118. package/node_modules/@modelcontextprotocol/client/dist/index.d.mts.map +1 -0
  119. package/node_modules/@modelcontextprotocol/client/dist/index.mjs +5481 -0
  120. package/node_modules/@modelcontextprotocol/client/dist/index.mjs.map +1 -0
  121. package/node_modules/@modelcontextprotocol/client/dist/shimsBrowser.cjs +14 -0
  122. package/node_modules/@modelcontextprotocol/client/dist/shimsBrowser.cjs.map +1 -0
  123. package/node_modules/@modelcontextprotocol/client/dist/shimsBrowser.d.cts +13 -0
  124. package/node_modules/@modelcontextprotocol/client/dist/shimsBrowser.d.cts.map +1 -0
  125. package/node_modules/@modelcontextprotocol/client/dist/shimsBrowser.d.mts +13 -0
  126. package/node_modules/@modelcontextprotocol/client/dist/shimsBrowser.d.mts.map +1 -0
  127. package/node_modules/@modelcontextprotocol/client/dist/shimsBrowser.mjs +13 -0
  128. package/node_modules/@modelcontextprotocol/client/dist/shimsBrowser.mjs.map +1 -0
  129. package/node_modules/@modelcontextprotocol/client/dist/shimsNode.cjs +14 -0
  130. package/node_modules/@modelcontextprotocol/client/dist/shimsNode.cjs.map +1 -0
  131. package/node_modules/@modelcontextprotocol/client/dist/shimsNode.d.cts +13 -0
  132. package/node_modules/@modelcontextprotocol/client/dist/shimsNode.d.cts.map +1 -0
  133. package/node_modules/@modelcontextprotocol/client/dist/shimsNode.d.mts +13 -0
  134. package/node_modules/@modelcontextprotocol/client/dist/shimsNode.d.mts.map +1 -0
  135. package/node_modules/@modelcontextprotocol/client/dist/shimsNode.mjs +13 -0
  136. package/node_modules/@modelcontextprotocol/client/dist/shimsNode.mjs.map +1 -0
  137. package/node_modules/@modelcontextprotocol/client/dist/shimsWorkerd.cjs +21 -0
  138. package/node_modules/@modelcontextprotocol/client/dist/shimsWorkerd.cjs.map +1 -0
  139. package/node_modules/@modelcontextprotocol/client/dist/shimsWorkerd.d.cts +13 -0
  140. package/node_modules/@modelcontextprotocol/client/dist/shimsWorkerd.d.cts.map +1 -0
  141. package/node_modules/@modelcontextprotocol/client/dist/shimsWorkerd.d.mts +13 -0
  142. package/node_modules/@modelcontextprotocol/client/dist/shimsWorkerd.d.mts.map +1 -0
  143. package/node_modules/@modelcontextprotocol/client/dist/shimsWorkerd.mjs +20 -0
  144. package/node_modules/@modelcontextprotocol/client/dist/shimsWorkerd.mjs.map +1 -0
  145. package/node_modules/@modelcontextprotocol/client/dist/src-D_zzAWoS.mjs +7063 -0
  146. package/node_modules/@modelcontextprotocol/client/dist/src-D_zzAWoS.mjs.map +1 -0
  147. package/node_modules/@modelcontextprotocol/client/dist/src-NAgB4Mp8.cjs +7431 -0
  148. package/node_modules/@modelcontextprotocol/client/dist/src-NAgB4Mp8.cjs.map +1 -0
  149. package/node_modules/@modelcontextprotocol/client/dist/stdio.cjs +217 -0
  150. package/node_modules/@modelcontextprotocol/client/dist/stdio.cjs.map +1 -0
  151. package/node_modules/@modelcontextprotocol/client/dist/stdio.d.cts +96 -0
  152. package/node_modules/@modelcontextprotocol/client/dist/stdio.d.cts.map +1 -0
  153. package/node_modules/@modelcontextprotocol/client/dist/stdio.d.mts +96 -0
  154. package/node_modules/@modelcontextprotocol/client/dist/stdio.d.mts.map +1 -0
  155. package/node_modules/@modelcontextprotocol/client/dist/stdio.mjs +212 -0
  156. package/node_modules/@modelcontextprotocol/client/dist/stdio.mjs.map +1 -0
  157. package/node_modules/@modelcontextprotocol/client/dist/types-DsbMXNFL.d.cts +1099 -0
  158. package/node_modules/@modelcontextprotocol/client/dist/types-DsbMXNFL.d.cts.map +1 -0
  159. package/node_modules/@modelcontextprotocol/client/dist/types-mS0yxCL0.d.mts +1099 -0
  160. package/node_modules/@modelcontextprotocol/client/dist/types-mS0yxCL0.d.mts.map +1 -0
  161. package/node_modules/@modelcontextprotocol/client/dist/validators/ajv.cjs +5 -0
  162. package/node_modules/@modelcontextprotocol/client/dist/validators/ajv.d.cts +2 -0
  163. package/node_modules/@modelcontextprotocol/client/dist/validators/ajv.d.mts +2 -0
  164. package/node_modules/@modelcontextprotocol/client/dist/validators/ajv.mjs +3 -0
  165. package/node_modules/@modelcontextprotocol/client/dist/validators/cfWorker.cjs +3 -0
  166. package/node_modules/@modelcontextprotocol/client/dist/validators/cfWorker.d.cts +2 -0
  167. package/node_modules/@modelcontextprotocol/client/dist/validators/cfWorker.d.mts +2 -0
  168. package/node_modules/@modelcontextprotocol/client/dist/validators/cfWorker.mjs +3 -0
  169. package/node_modules/@modelcontextprotocol/client/package.json +166 -0
  170. package/node_modules/@modelcontextprotocol/core/LICENSE +216 -0
  171. package/node_modules/@modelcontextprotocol/core/README.md +40 -0
  172. package/node_modules/@modelcontextprotocol/core/dist/auth-BWdKR39I.d.mts +8501 -0
  173. package/node_modules/@modelcontextprotocol/core/dist/auth-BWdKR39I.d.mts.map +1 -0
  174. package/node_modules/@modelcontextprotocol/core/dist/auth-CUe6YdwF.mjs +1678 -0
  175. package/node_modules/@modelcontextprotocol/core/dist/auth-CUe6YdwF.mjs.map +1 -0
  176. package/node_modules/@modelcontextprotocol/core/dist/auth-CfDMXiII.cjs +2899 -0
  177. package/node_modules/@modelcontextprotocol/core/dist/auth-CfDMXiII.cjs.map +1 -0
  178. package/node_modules/@modelcontextprotocol/core/dist/auth-hYtaIUZm.d.cts +8501 -0
  179. package/node_modules/@modelcontextprotocol/core/dist/auth-hYtaIUZm.d.cts.map +1 -0
  180. package/node_modules/@modelcontextprotocol/core/dist/index.cjs +175 -0
  181. package/node_modules/@modelcontextprotocol/core/dist/index.d.cts +2 -0
  182. package/node_modules/@modelcontextprotocol/core/dist/index.d.mts +2 -0
  183. package/node_modules/@modelcontextprotocol/core/dist/index.mjs +3 -0
  184. package/node_modules/@modelcontextprotocol/core/dist/internal.cjs +201 -0
  185. package/node_modules/@modelcontextprotocol/core/dist/internal.d.cts +99 -0
  186. package/node_modules/@modelcontextprotocol/core/dist/internal.d.cts.map +1 -0
  187. package/node_modules/@modelcontextprotocol/core/dist/internal.d.mts +99 -0
  188. package/node_modules/@modelcontextprotocol/core/dist/internal.d.mts.map +1 -0
  189. package/node_modules/@modelcontextprotocol/core/dist/internal.mjs +3 -0
  190. package/node_modules/@modelcontextprotocol/core/package.json +85 -0
  191. package/node_modules/@modelcontextprotocol/server/LICENSE +216 -0
  192. package/node_modules/@modelcontextprotocol/server/README.md +30 -0
  193. package/node_modules/@modelcontextprotocol/server/dist/ajvProvider-CEoC__sr.mjs +7514 -0
  194. package/node_modules/@modelcontextprotocol/server/dist/ajvProvider-CEoC__sr.mjs.map +1 -0
  195. package/node_modules/@modelcontextprotocol/server/dist/ajvProvider-CgI-5L6O.d.mts +1071 -0
  196. package/node_modules/@modelcontextprotocol/server/dist/ajvProvider-CgI-5L6O.d.mts.map +1 -0
  197. package/node_modules/@modelcontextprotocol/server/dist/ajvProvider-FOQRM7up.d.cts +1071 -0
  198. package/node_modules/@modelcontextprotocol/server/dist/ajvProvider-FOQRM7up.d.cts.map +1 -0
  199. package/node_modules/@modelcontextprotocol/server/dist/ajvProvider-ZaoO9afR.cjs +7531 -0
  200. package/node_modules/@modelcontextprotocol/server/dist/ajvProvider-ZaoO9afR.cjs.map +1 -0
  201. package/node_modules/@modelcontextprotocol/server/dist/cfWorkerProvider-BwbPzsdI.cjs +986 -0
  202. package/node_modules/@modelcontextprotocol/server/dist/cfWorkerProvider-BwbPzsdI.cjs.map +1 -0
  203. package/node_modules/@modelcontextprotocol/server/dist/cfWorkerProvider-C03CSigr.d.mts +74 -0
  204. package/node_modules/@modelcontextprotocol/server/dist/cfWorkerProvider-C03CSigr.d.mts.map +1 -0
  205. package/node_modules/@modelcontextprotocol/server/dist/cfWorkerProvider-doTkZbTr.d.cts +74 -0
  206. package/node_modules/@modelcontextprotocol/server/dist/cfWorkerProvider-doTkZbTr.d.cts.map +1 -0
  207. package/node_modules/@modelcontextprotocol/server/dist/cfWorkerProvider-p3WaZPqB.mjs +981 -0
  208. package/node_modules/@modelcontextprotocol/server/dist/cfWorkerProvider-p3WaZPqB.mjs.map +1 -0
  209. package/node_modules/@modelcontextprotocol/server/dist/chunk-Bnu9O96Y.cjs +60 -0
  210. package/node_modules/@modelcontextprotocol/server/dist/chunk-Br0eD_fh.mjs +42 -0
  211. package/node_modules/@modelcontextprotocol/server/dist/createMcpHandler-CLhGwQTn.d.mts +4043 -0
  212. package/node_modules/@modelcontextprotocol/server/dist/createMcpHandler-CLhGwQTn.d.mts.map +1 -0
  213. package/node_modules/@modelcontextprotocol/server/dist/createMcpHandler-dBHMsxwf.d.cts +4045 -0
  214. package/node_modules/@modelcontextprotocol/server/dist/createMcpHandler-dBHMsxwf.d.cts.map +1 -0
  215. package/node_modules/@modelcontextprotocol/server/dist/dialects-D8eXzoGv.cjs +46 -0
  216. package/node_modules/@modelcontextprotocol/server/dist/dialects-D8eXzoGv.cjs.map +1 -0
  217. package/node_modules/@modelcontextprotocol/server/dist/dialects-DoSzNhcb.mjs +34 -0
  218. package/node_modules/@modelcontextprotocol/server/dist/dialects-DoSzNhcb.mjs.map +1 -0
  219. package/node_modules/@modelcontextprotocol/server/dist/index.cjs +2055 -0
  220. package/node_modules/@modelcontextprotocol/server/dist/index.cjs.map +1 -0
  221. package/node_modules/@modelcontextprotocol/server/dist/index.d.cts +739 -0
  222. package/node_modules/@modelcontextprotocol/server/dist/index.d.cts.map +1 -0
  223. package/node_modules/@modelcontextprotocol/server/dist/index.d.mts +739 -0
  224. package/node_modules/@modelcontextprotocol/server/dist/index.d.mts.map +1 -0
  225. package/node_modules/@modelcontextprotocol/server/dist/index.mjs +1870 -0
  226. package/node_modules/@modelcontextprotocol/server/dist/index.mjs.map +1 -0
  227. package/node_modules/@modelcontextprotocol/server/dist/mcp-D7GmuPnv.cjs +2022 -0
  228. package/node_modules/@modelcontextprotocol/server/dist/mcp-D7GmuPnv.cjs.map +1 -0
  229. package/node_modules/@modelcontextprotocol/server/dist/mcp-DXXb3Vv3.mjs +1931 -0
  230. package/node_modules/@modelcontextprotocol/server/dist/mcp-DXXb3Vv3.mjs.map +1 -0
  231. package/node_modules/@modelcontextprotocol/server/dist/shimsBrowser.cjs +23 -0
  232. package/node_modules/@modelcontextprotocol/server/dist/shimsBrowser.cjs.map +1 -0
  233. package/node_modules/@modelcontextprotocol/server/dist/shimsBrowser.d.cts +11 -0
  234. package/node_modules/@modelcontextprotocol/server/dist/shimsBrowser.d.cts.map +1 -0
  235. package/node_modules/@modelcontextprotocol/server/dist/shimsBrowser.d.mts +11 -0
  236. package/node_modules/@modelcontextprotocol/server/dist/shimsBrowser.d.mts.map +1 -0
  237. package/node_modules/@modelcontextprotocol/server/dist/shimsBrowser.mjs +22 -0
  238. package/node_modules/@modelcontextprotocol/server/dist/shimsBrowser.mjs.map +1 -0
  239. package/node_modules/@modelcontextprotocol/server/dist/shimsNode.cjs +12 -0
  240. package/node_modules/@modelcontextprotocol/server/dist/shimsNode.d.cts +3 -0
  241. package/node_modules/@modelcontextprotocol/server/dist/shimsNode.d.mts +3 -0
  242. package/node_modules/@modelcontextprotocol/server/dist/shimsNode.mjs +4 -0
  243. package/node_modules/@modelcontextprotocol/server/dist/shimsWorkerd.cjs +30 -0
  244. package/node_modules/@modelcontextprotocol/server/dist/shimsWorkerd.cjs.map +1 -0
  245. package/node_modules/@modelcontextprotocol/server/dist/shimsWorkerd.d.cts +10 -0
  246. package/node_modules/@modelcontextprotocol/server/dist/shimsWorkerd.d.cts.map +1 -0
  247. package/node_modules/@modelcontextprotocol/server/dist/shimsWorkerd.d.mts +10 -0
  248. package/node_modules/@modelcontextprotocol/server/dist/shimsWorkerd.d.mts.map +1 -0
  249. package/node_modules/@modelcontextprotocol/server/dist/shimsWorkerd.mjs +29 -0
  250. package/node_modules/@modelcontextprotocol/server/dist/shimsWorkerd.mjs.map +1 -0
  251. package/node_modules/@modelcontextprotocol/server/dist/src-CX2iR2pK.mjs +7606 -0
  252. package/node_modules/@modelcontextprotocol/server/dist/src-CX2iR2pK.mjs.map +1 -0
  253. package/node_modules/@modelcontextprotocol/server/dist/src-STyD_Vvf.cjs +8104 -0
  254. package/node_modules/@modelcontextprotocol/server/dist/src-STyD_Vvf.cjs.map +1 -0
  255. package/node_modules/@modelcontextprotocol/server/dist/stdio.cjs +564 -0
  256. package/node_modules/@modelcontextprotocol/server/dist/stdio.cjs.map +1 -0
  257. package/node_modules/@modelcontextprotocol/server/dist/stdio.d.cts +107 -0
  258. package/node_modules/@modelcontextprotocol/server/dist/stdio.d.cts.map +1 -0
  259. package/node_modules/@modelcontextprotocol/server/dist/stdio.d.mts +107 -0
  260. package/node_modules/@modelcontextprotocol/server/dist/stdio.d.mts.map +1 -0
  261. package/node_modules/@modelcontextprotocol/server/dist/stdio.mjs +562 -0
  262. package/node_modules/@modelcontextprotocol/server/dist/stdio.mjs.map +1 -0
  263. package/node_modules/@modelcontextprotocol/server/dist/types-DUs7mGBv.d.mts +1099 -0
  264. package/node_modules/@modelcontextprotocol/server/dist/types-DUs7mGBv.d.mts.map +1 -0
  265. package/node_modules/@modelcontextprotocol/server/dist/types-DsbMXNFL.d.cts +1099 -0
  266. package/node_modules/@modelcontextprotocol/server/dist/types-DsbMXNFL.d.cts.map +1 -0
  267. package/node_modules/@modelcontextprotocol/server/dist/validators/ajv.cjs +5 -0
  268. package/node_modules/@modelcontextprotocol/server/dist/validators/ajv.d.cts +2 -0
  269. package/node_modules/@modelcontextprotocol/server/dist/validators/ajv.d.mts +2 -0
  270. package/node_modules/@modelcontextprotocol/server/dist/validators/ajv.mjs +3 -0
  271. package/node_modules/@modelcontextprotocol/server/dist/validators/cfWorker.cjs +3 -0
  272. package/node_modules/@modelcontextprotocol/server/dist/validators/cfWorker.d.cts +2 -0
  273. package/node_modules/@modelcontextprotocol/server/dist/validators/cfWorker.d.mts +2 -0
  274. package/node_modules/@modelcontextprotocol/server/dist/validators/cfWorker.mjs +3 -0
  275. package/node_modules/@modelcontextprotocol/server/package.json +160 -0
  276. package/node_modules/cross-spawn/LICENSE +21 -0
  277. package/node_modules/cross-spawn/README.md +89 -0
  278. package/node_modules/cross-spawn/index.js +39 -0
  279. package/node_modules/cross-spawn/lib/enoent.js +59 -0
  280. package/node_modules/cross-spawn/lib/parse.js +91 -0
  281. package/node_modules/cross-spawn/lib/util/escape.js +47 -0
  282. package/node_modules/cross-spawn/lib/util/readShebang.js +23 -0
  283. package/node_modules/cross-spawn/lib/util/resolveCommand.js +52 -0
  284. package/node_modules/cross-spawn/package.json +73 -0
  285. package/node_modules/eventsource/LICENSE +22 -0
  286. package/node_modules/eventsource/README.md +167 -0
  287. package/node_modules/eventsource/dist/index.cjs +273 -0
  288. package/node_modules/eventsource/dist/index.cjs.map +1 -0
  289. package/node_modules/eventsource/dist/index.d.cts +332 -0
  290. package/node_modules/eventsource/dist/index.d.ts +332 -0
  291. package/node_modules/eventsource/dist/index.js +273 -0
  292. package/node_modules/eventsource/dist/index.js.map +1 -0
  293. package/node_modules/eventsource/package.json +130 -0
  294. package/node_modules/eventsource/src/EventSource.ts +596 -0
  295. package/node_modules/eventsource/src/errors.ts +141 -0
  296. package/node_modules/eventsource/src/index.ts +3 -0
  297. package/node_modules/eventsource/src/types.ts +152 -0
  298. package/node_modules/eventsource-parser/LICENSE +21 -0
  299. package/node_modules/eventsource-parser/README.md +157 -0
  300. package/node_modules/eventsource-parser/dist/index.cjs +177 -0
  301. package/node_modules/eventsource-parser/dist/index.cjs.map +1 -0
  302. package/node_modules/eventsource-parser/dist/index.d.cts +169 -0
  303. package/node_modules/eventsource-parser/dist/index.d.ts +169 -0
  304. package/node_modules/eventsource-parser/dist/index.js +177 -0
  305. package/node_modules/eventsource-parser/dist/index.js.map +1 -0
  306. package/node_modules/eventsource-parser/dist/stream.cjs +29 -0
  307. package/node_modules/eventsource-parser/dist/stream.cjs.map +1 -0
  308. package/node_modules/eventsource-parser/dist/stream.d.cts +134 -0
  309. package/node_modules/eventsource-parser/dist/stream.d.ts +134 -0
  310. package/node_modules/eventsource-parser/dist/stream.js +30 -0
  311. package/node_modules/eventsource-parser/dist/stream.js.map +1 -0
  312. package/node_modules/eventsource-parser/package.json +92 -0
  313. package/node_modules/eventsource-parser/src/errors.ts +44 -0
  314. package/node_modules/eventsource-parser/src/index.ts +8 -0
  315. package/node_modules/eventsource-parser/src/parse.ts +439 -0
  316. package/node_modules/eventsource-parser/src/stream.ts +107 -0
  317. package/node_modules/eventsource-parser/src/types.ts +122 -0
  318. package/node_modules/eventsource-parser/stream.js +2 -0
  319. package/node_modules/isexe/.npmignore +2 -0
  320. package/node_modules/isexe/LICENSE +15 -0
  321. package/node_modules/isexe/README.md +51 -0
  322. package/node_modules/isexe/index.js +57 -0
  323. package/node_modules/isexe/mode.js +41 -0
  324. package/node_modules/isexe/package.json +31 -0
  325. package/node_modules/isexe/test/basic.js +221 -0
  326. package/node_modules/isexe/windows.js +42 -0
  327. package/node_modules/jose/LICENSE.md +21 -0
  328. package/node_modules/jose/README.md +150 -0
  329. package/node_modules/jose/dist/types/index.d.ts +56 -0
  330. package/node_modules/jose/dist/types/jwe/compact/decrypt.d.ts +37 -0
  331. package/node_modules/jose/dist/types/jwe/compact/encrypt.d.ts +54 -0
  332. package/node_modules/jose/dist/types/jwe/flattened/decrypt.d.ts +37 -0
  333. package/node_modules/jose/dist/types/jwe/flattened/encrypt.d.ts +72 -0
  334. package/node_modules/jose/dist/types/jwe/general/decrypt.d.ts +43 -0
  335. package/node_modules/jose/dist/types/jwe/general/encrypt.d.ts +74 -0
  336. package/node_modules/jose/dist/types/jwk/embedded.d.ts +13 -0
  337. package/node_modules/jose/dist/types/jwk/thumbprint.d.ts +17 -0
  338. package/node_modules/jose/dist/types/jwks/local.d.ts +20 -0
  339. package/node_modules/jose/dist/types/jwks/remote.d.ts +106 -0
  340. package/node_modules/jose/dist/types/jws/compact/sign.d.ts +25 -0
  341. package/node_modules/jose/dist/types/jws/compact/verify.d.ts +37 -0
  342. package/node_modules/jose/dist/types/jws/flattened/sign.d.ts +31 -0
  343. package/node_modules/jose/dist/types/jws/flattened/verify.d.ts +37 -0
  344. package/node_modules/jose/dist/types/jws/general/sign.d.ts +52 -0
  345. package/node_modules/jose/dist/types/jws/general/verify.d.ts +44 -0
  346. package/node_modules/jose/dist/types/jwt/decrypt.d.ts +41 -0
  347. package/node_modules/jose/dist/types/jwt/encrypt.d.ts +62 -0
  348. package/node_modules/jose/dist/types/jwt/sign.d.ts +26 -0
  349. package/node_modules/jose/dist/types/jwt/unsecured.d.ts +28 -0
  350. package/node_modules/jose/dist/types/jwt/verify.d.ts +38 -0
  351. package/node_modules/jose/dist/types/key/export.d.ts +19 -0
  352. package/node_modules/jose/dist/types/key/generate_key_pair.d.ts +40 -0
  353. package/node_modules/jose/dist/types/key/generate_secret.d.ts +37 -0
  354. package/node_modules/jose/dist/types/key/import.d.ts +73 -0
  355. package/node_modules/jose/dist/types/types.d.ts +871 -0
  356. package/node_modules/jose/dist/types/util/base64url.d.ts +16 -0
  357. package/node_modules/jose/dist/types/util/decode_jwt.d.ts +10 -0
  358. package/node_modules/jose/dist/types/util/decode_protected_header.d.ts +9 -0
  359. package/node_modules/jose/dist/types/util/errors.d.ts +220 -0
  360. package/node_modules/jose/dist/webapi/index.js +32 -0
  361. package/node_modules/jose/dist/webapi/jwe/compact/decrypt.js +9 -0
  362. package/node_modules/jose/dist/webapi/jwe/compact/encrypt.js +49 -0
  363. package/node_modules/jose/dist/webapi/jwe/flattened/decrypt.js +15 -0
  364. package/node_modules/jose/dist/webapi/jwe/flattened/encrypt.js +65 -0
  365. package/node_modules/jose/dist/webapi/jwe/general/decrypt.js +51 -0
  366. package/node_modules/jose/dist/webapi/jwe/general/encrypt.js +177 -0
  367. package/node_modules/jose/dist/webapi/jwk/embedded.js +33 -0
  368. package/node_modules/jose/dist/webapi/jwk/thumbprint.js +74 -0
  369. package/node_modules/jose/dist/webapi/jwks/local.js +70 -0
  370. package/node_modules/jose/dist/webapi/jwks/remote.js +149 -0
  371. package/node_modules/jose/dist/webapi/jws/compact/sign.js +22 -0
  372. package/node_modules/jose/dist/webapi/jws/compact/verify.js +9 -0
  373. package/node_modules/jose/dist/webapi/jws/flattened/sign.js +32 -0
  374. package/node_modules/jose/dist/webapi/jws/flattened/verify.js +25 -0
  375. package/node_modules/jose/dist/webapi/jws/general/sign.js +76 -0
  376. package/node_modules/jose/dist/webapi/jws/general/verify.js +74 -0
  377. package/node_modules/jose/dist/webapi/jwt/decrypt.js +21 -0
  378. package/node_modules/jose/dist/webapi/jwt/encrypt.js +72 -0
  379. package/node_modules/jose/dist/webapi/jwt/sign.js +18 -0
  380. package/node_modules/jose/dist/webapi/jwt/unsecured.js +43 -0
  381. package/node_modules/jose/dist/webapi/jwt/verify.js +15 -0
  382. package/node_modules/jose/dist/webapi/key/export.js +44 -0
  383. package/node_modules/jose/dist/webapi/key/generate_key_pair.js +52 -0
  384. package/node_modules/jose/dist/webapi/key/generate_secret.js +41 -0
  385. package/node_modules/jose/dist/webapi/key/import.js +61 -0
  386. package/node_modules/jose/dist/webapi/lib/asn1.js +179 -0
  387. package/node_modules/jose/dist/webapi/lib/base64.js +22 -0
  388. package/node_modules/jose/dist/webapi/lib/buffer_utils.js +44 -0
  389. package/node_modules/jose/dist/webapi/lib/content_encryption.js +134 -0
  390. package/node_modules/jose/dist/webapi/lib/crypto_key.js +28 -0
  391. package/node_modules/jose/dist/webapi/lib/deflate.js +52 -0
  392. package/node_modules/jose/dist/webapi/lib/helpers.js +42 -0
  393. package/node_modules/jose/dist/webapi/lib/invalid_key_input.js +26 -0
  394. package/node_modules/jose/dist/webapi/lib/is_key_like.js +17 -0
  395. package/node_modules/jose/dist/webapi/lib/jwe_algorithms.js +107 -0
  396. package/node_modules/jose/dist/webapi/lib/jwe_decrypt.js +243 -0
  397. package/node_modules/jose/dist/webapi/lib/jwe_encrypt.js +142 -0
  398. package/node_modules/jose/dist/webapi/lib/jwk_metadata.js +20 -0
  399. package/node_modules/jose/dist/webapi/lib/jwk_to_key.js +17 -0
  400. package/node_modules/jose/dist/webapi/lib/jws_algorithms.js +73 -0
  401. package/node_modules/jose/dist/webapi/lib/jws_sign.js +85 -0
  402. package/node_modules/jose/dist/webapi/lib/jws_verify.js +139 -0
  403. package/node_modules/jose/dist/webapi/lib/jwt_claims_set.js +232 -0
  404. package/node_modules/jose/dist/webapi/lib/key.js +147 -0
  405. package/node_modules/jose/dist/webapi/lib/key_algorithm.js +10 -0
  406. package/node_modules/jose/dist/webapi/lib/key_descriptor.js +7 -0
  407. package/node_modules/jose/dist/webapi/lib/key_management.js +262 -0
  408. package/node_modules/jose/dist/webapi/lib/key_options.js +6 -0
  409. package/node_modules/jose/dist/webapi/lib/options.js +74 -0
  410. package/node_modules/jose/dist/webapi/lib/signing.js +26 -0
  411. package/node_modules/jose/dist/webapi/lib/type_checks.js +33 -0
  412. package/node_modules/jose/dist/webapi/util/base64url.js +39 -0
  413. package/node_modules/jose/dist/webapi/util/decode_jwt.js +32 -0
  414. package/node_modules/jose/dist/webapi/util/decode_protected_header.js +24 -0
  415. package/node_modules/jose/dist/webapi/util/errors.js +99 -0
  416. package/node_modules/jose/package.json +198 -0
  417. package/node_modules/path-key/index.d.ts +40 -0
  418. package/node_modules/path-key/index.js +16 -0
  419. package/node_modules/path-key/license +9 -0
  420. package/node_modules/path-key/package.json +39 -0
  421. package/node_modules/path-key/readme.md +61 -0
  422. package/node_modules/pkce-challenge/CHANGELOG.md +114 -0
  423. package/node_modules/pkce-challenge/LICENSE +21 -0
  424. package/node_modules/pkce-challenge/README.md +55 -0
  425. package/node_modules/pkce-challenge/dist/index.browser.d.ts +19 -0
  426. package/node_modules/pkce-challenge/dist/index.browser.js +75 -0
  427. package/node_modules/pkce-challenge/dist/index.node.cjs +83 -0
  428. package/node_modules/pkce-challenge/dist/index.node.d.cts +19 -0
  429. package/node_modules/pkce-challenge/dist/index.node.d.ts +19 -0
  430. package/node_modules/pkce-challenge/dist/index.node.js +78 -0
  431. package/node_modules/pkce-challenge/package.json +59 -0
  432. package/node_modules/shebang-command/index.js +19 -0
  433. package/node_modules/shebang-command/license +9 -0
  434. package/node_modules/shebang-command/package.json +34 -0
  435. package/node_modules/shebang-command/readme.md +34 -0
  436. package/node_modules/shebang-regex/index.d.ts +22 -0
  437. package/node_modules/shebang-regex/index.js +2 -0
  438. package/node_modules/shebang-regex/license +9 -0
  439. package/node_modules/shebang-regex/package.json +35 -0
  440. package/node_modules/shebang-regex/readme.md +33 -0
  441. package/node_modules/which/LICENSE +15 -0
  442. package/node_modules/which/README.md +54 -0
  443. package/node_modules/which/bin/node-which +52 -0
  444. package/node_modules/which/package.json +43 -0
  445. package/node_modules/which/which.js +125 -0
  446. package/node_modules/zod/LICENSE +21 -0
  447. package/node_modules/zod/README.md +191 -0
  448. package/node_modules/zod/index.cjs +33 -0
  449. package/node_modules/zod/index.d.cts +4 -0
  450. package/node_modules/zod/index.d.ts +4 -0
  451. package/node_modules/zod/index.js +4 -0
  452. package/node_modules/zod/locales/index.cjs +17 -0
  453. package/node_modules/zod/locales/index.d.cts +1 -0
  454. package/node_modules/zod/locales/index.d.ts +1 -0
  455. package/node_modules/zod/locales/index.js +1 -0
  456. package/node_modules/zod/locales/package.json +7 -0
  457. package/node_modules/zod/mini/index.cjs +32 -0
  458. package/node_modules/zod/mini/index.d.cts +3 -0
  459. package/node_modules/zod/mini/index.d.ts +3 -0
  460. package/node_modules/zod/mini/index.js +3 -0
  461. package/node_modules/zod/mini/package.json +7 -0
  462. package/node_modules/zod/package.json +135 -0
  463. package/node_modules/zod/src/index.ts +4 -0
  464. package/node_modules/zod/src/locales/index.ts +1 -0
  465. package/node_modules/zod/src/mini/index.ts +3 -0
  466. package/node_modules/zod/src/v3/ZodError.ts +330 -0
  467. package/node_modules/zod/src/v3/benchmarks/datetime.ts +58 -0
  468. package/node_modules/zod/src/v3/benchmarks/discriminatedUnion.ts +80 -0
  469. package/node_modules/zod/src/v3/benchmarks/index.ts +59 -0
  470. package/node_modules/zod/src/v3/benchmarks/ipv4.ts +57 -0
  471. package/node_modules/zod/src/v3/benchmarks/object.ts +69 -0
  472. package/node_modules/zod/src/v3/benchmarks/primitives.ts +162 -0
  473. package/node_modules/zod/src/v3/benchmarks/realworld.ts +63 -0
  474. package/node_modules/zod/src/v3/benchmarks/string.ts +55 -0
  475. package/node_modules/zod/src/v3/benchmarks/union.ts +80 -0
  476. package/node_modules/zod/src/v3/errors.ts +13 -0
  477. package/node_modules/zod/src/v3/external.ts +6 -0
  478. package/node_modules/zod/src/v3/helpers/enumUtil.ts +17 -0
  479. package/node_modules/zod/src/v3/helpers/errorUtil.ts +8 -0
  480. package/node_modules/zod/src/v3/helpers/parseUtil.ts +176 -0
  481. package/node_modules/zod/src/v3/helpers/partialUtil.ts +34 -0
  482. package/node_modules/zod/src/v3/helpers/typeAliases.ts +2 -0
  483. package/node_modules/zod/src/v3/helpers/util.ts +224 -0
  484. package/node_modules/zod/src/v3/index.ts +4 -0
  485. package/node_modules/zod/src/v3/locales/en.ts +124 -0
  486. package/node_modules/zod/src/v3/standard-schema.ts +113 -0
  487. package/node_modules/zod/src/v3/tests/Mocker.ts +54 -0
  488. package/node_modules/zod/src/v3/tests/all-errors.test.ts +157 -0
  489. package/node_modules/zod/src/v3/tests/anyunknown.test.ts +28 -0
  490. package/node_modules/zod/src/v3/tests/array.test.ts +71 -0
  491. package/node_modules/zod/src/v3/tests/async-parsing.test.ts +388 -0
  492. package/node_modules/zod/src/v3/tests/async-refinements.test.ts +46 -0
  493. package/node_modules/zod/src/v3/tests/base.test.ts +29 -0
  494. package/node_modules/zod/src/v3/tests/bigint.test.ts +55 -0
  495. package/node_modules/zod/src/v3/tests/branded.test.ts +53 -0
  496. package/node_modules/zod/src/v3/tests/catch.test.ts +220 -0
  497. package/node_modules/zod/src/v3/tests/coerce.test.ts +133 -0
  498. package/node_modules/zod/src/v3/tests/complex.test.ts +70 -0
  499. package/node_modules/zod/src/v3/tests/custom.test.ts +31 -0
  500. package/node_modules/zod/src/v3/tests/date.test.ts +32 -0
  501. package/node_modules/zod/src/v3/tests/deepmasking.test.ts +186 -0
  502. package/node_modules/zod/src/v3/tests/default.test.ts +112 -0
  503. package/node_modules/zod/src/v3/tests/description.test.ts +33 -0
  504. package/node_modules/zod/src/v3/tests/discriminated-unions.test.ts +315 -0
  505. package/node_modules/zod/src/v3/tests/enum.test.ts +80 -0
  506. package/node_modules/zod/src/v3/tests/error.test.ts +551 -0
  507. package/node_modules/zod/src/v3/tests/firstparty.test.ts +87 -0
  508. package/node_modules/zod/src/v3/tests/firstpartyschematypes.test.ts +21 -0
  509. package/node_modules/zod/src/v3/tests/function.test.ts +261 -0
  510. package/node_modules/zod/src/v3/tests/generics.test.ts +48 -0
  511. package/node_modules/zod/src/v3/tests/instanceof.test.ts +37 -0
  512. package/node_modules/zod/src/v3/tests/intersection.test.ts +110 -0
  513. package/node_modules/zod/src/v3/tests/language-server.source.ts +76 -0
  514. package/node_modules/zod/src/v3/tests/language-server.test.ts +207 -0
  515. package/node_modules/zod/src/v3/tests/literal.test.ts +36 -0
  516. package/node_modules/zod/src/v3/tests/map.test.ts +110 -0
  517. package/node_modules/zod/src/v3/tests/masking.test.ts +4 -0
  518. package/node_modules/zod/src/v3/tests/mocker.test.ts +19 -0
  519. package/node_modules/zod/src/v3/tests/nan.test.ts +24 -0
  520. package/node_modules/zod/src/v3/tests/nativeEnum.test.ts +87 -0
  521. package/node_modules/zod/src/v3/tests/nullable.test.ts +42 -0
  522. package/node_modules/zod/src/v3/tests/number.test.ts +176 -0
  523. package/node_modules/zod/src/v3/tests/object-augmentation.test.ts +29 -0
  524. package/node_modules/zod/src/v3/tests/object-in-es5-env.test.ts +29 -0
  525. package/node_modules/zod/src/v3/tests/object.test.ts +434 -0
  526. package/node_modules/zod/src/v3/tests/optional.test.ts +42 -0
  527. package/node_modules/zod/src/v3/tests/parseUtil.test.ts +23 -0
  528. package/node_modules/zod/src/v3/tests/parser.test.ts +41 -0
  529. package/node_modules/zod/src/v3/tests/partials.test.ts +243 -0
  530. package/node_modules/zod/src/v3/tests/pickomit.test.ts +111 -0
  531. package/node_modules/zod/src/v3/tests/pipeline.test.ts +29 -0
  532. package/node_modules/zod/src/v3/tests/preprocess.test.ts +186 -0
  533. package/node_modules/zod/src/v3/tests/primitive.test.ts +440 -0
  534. package/node_modules/zod/src/v3/tests/promise.test.ts +90 -0
  535. package/node_modules/zod/src/v3/tests/readonly.test.ts +194 -0
  536. package/node_modules/zod/src/v3/tests/record.test.ts +171 -0
  537. package/node_modules/zod/src/v3/tests/recursive.test.ts +197 -0
  538. package/node_modules/zod/src/v3/tests/refine.test.ts +313 -0
  539. package/node_modules/zod/src/v3/tests/safeparse.test.ts +27 -0
  540. package/node_modules/zod/src/v3/tests/set.test.ts +142 -0
  541. package/node_modules/zod/src/v3/tests/standard-schema.test.ts +83 -0
  542. package/node_modules/zod/src/v3/tests/string.test.ts +916 -0
  543. package/node_modules/zod/src/v3/tests/transformer.test.ts +233 -0
  544. package/node_modules/zod/src/v3/tests/tuple.test.ts +90 -0
  545. package/node_modules/zod/src/v3/tests/unions.test.ts +57 -0
  546. package/node_modules/zod/src/v3/tests/validations.test.ts +133 -0
  547. package/node_modules/zod/src/v3/tests/void.test.ts +15 -0
  548. package/node_modules/zod/src/v3/types.ts +5138 -0
  549. package/node_modules/zod/src/v4/classic/checks.ts +32 -0
  550. package/node_modules/zod/src/v4/classic/coerce.ts +27 -0
  551. package/node_modules/zod/src/v4/classic/compat.ts +70 -0
  552. package/node_modules/zod/src/v4/classic/errors.ts +82 -0
  553. package/node_modules/zod/src/v4/classic/external.ts +52 -0
  554. package/node_modules/zod/src/v4/classic/from-json-schema.ts +659 -0
  555. package/node_modules/zod/src/v4/classic/index.ts +5 -0
  556. package/node_modules/zod/src/v4/classic/iso.ts +90 -0
  557. package/node_modules/zod/src/v4/classic/parse.ts +82 -0
  558. package/node_modules/zod/src/v4/classic/schemas.ts +2672 -0
  559. package/node_modules/zod/src/v4/classic/tests/anyunknown.test.ts +26 -0
  560. package/node_modules/zod/src/v4/classic/tests/apply.test.ts +59 -0
  561. package/node_modules/zod/src/v4/classic/tests/array.test.ts +264 -0
  562. package/node_modules/zod/src/v4/classic/tests/assignability.test.ts +216 -0
  563. package/node_modules/zod/src/v4/classic/tests/async-parsing.test.ts +381 -0
  564. package/node_modules/zod/src/v4/classic/tests/async-refinements.test.ts +68 -0
  565. package/node_modules/zod/src/v4/classic/tests/base.test.ts +7 -0
  566. package/node_modules/zod/src/v4/classic/tests/bigint.test.ts +54 -0
  567. package/node_modules/zod/src/v4/classic/tests/brand.test.ts +106 -0
  568. package/node_modules/zod/src/v4/classic/tests/catch.test.ts +326 -0
  569. package/node_modules/zod/src/v4/classic/tests/coalesce.test.ts +20 -0
  570. package/node_modules/zod/src/v4/classic/tests/codec-examples.test.ts +573 -0
  571. package/node_modules/zod/src/v4/classic/tests/codec.test.ts +703 -0
  572. package/node_modules/zod/src/v4/classic/tests/coerce.test.ts +160 -0
  573. package/node_modules/zod/src/v4/classic/tests/continuability.test.ts +374 -0
  574. package/node_modules/zod/src/v4/classic/tests/custom.test.ts +40 -0
  575. package/node_modules/zod/src/v4/classic/tests/date.test.ts +62 -0
  576. package/node_modules/zod/src/v4/classic/tests/datetime.test.ts +302 -0
  577. package/node_modules/zod/src/v4/classic/tests/default.test.ts +409 -0
  578. package/node_modules/zod/src/v4/classic/tests/describe-meta-checks.test.ts +27 -0
  579. package/node_modules/zod/src/v4/classic/tests/description.test.ts +32 -0
  580. package/node_modules/zod/src/v4/classic/tests/detached-methods.test.ts +197 -0
  581. package/node_modules/zod/src/v4/classic/tests/discriminated-unions.test.ts +694 -0
  582. package/node_modules/zod/src/v4/classic/tests/enum.test.ts +285 -0
  583. package/node_modules/zod/src/v4/classic/tests/error-utils.test.ts +807 -0
  584. package/node_modules/zod/src/v4/classic/tests/error.test.ts +711 -0
  585. package/node_modules/zod/src/v4/classic/tests/file.test.ts +96 -0
  586. package/node_modules/zod/src/v4/classic/tests/firstparty.test.ts +179 -0
  587. package/node_modules/zod/src/v4/classic/tests/fix-json-issue.test.ts +26 -0
  588. package/node_modules/zod/src/v4/classic/tests/from-json-schema.test.ts +895 -0
  589. package/node_modules/zod/src/v4/classic/tests/function.test.ts +360 -0
  590. package/node_modules/zod/src/v4/classic/tests/generics.test.ts +72 -0
  591. package/node_modules/zod/src/v4/classic/tests/global-config.test.ts +39 -0
  592. package/node_modules/zod/src/v4/classic/tests/hash.test.ts +68 -0
  593. package/node_modules/zod/src/v4/classic/tests/index.test.ts +939 -0
  594. package/node_modules/zod/src/v4/classic/tests/instanceof.test.ts +60 -0
  595. package/node_modules/zod/src/v4/classic/tests/intersection.test.ts +198 -0
  596. package/node_modules/zod/src/v4/classic/tests/jitless-allows-eval.test.ts +46 -0
  597. package/node_modules/zod/src/v4/classic/tests/json.test.ts +109 -0
  598. package/node_modules/zod/src/v4/classic/tests/lazy.test.ts +227 -0
  599. package/node_modules/zod/src/v4/classic/tests/literal.test.ts +117 -0
  600. package/node_modules/zod/src/v4/classic/tests/locales_ka.test.ts +29 -0
  601. package/node_modules/zod/src/v4/classic/tests/locales_ro.test.ts +24 -0
  602. package/node_modules/zod/src/v4/classic/tests/map.test.ts +330 -0
  603. package/node_modules/zod/src/v4/classic/tests/nan.test.ts +21 -0
  604. package/node_modules/zod/src/v4/classic/tests/nested-refine.test.ts +168 -0
  605. package/node_modules/zod/src/v4/classic/tests/nonoptional.test.ts +101 -0
  606. package/node_modules/zod/src/v4/classic/tests/nullable.test.ts +22 -0
  607. package/node_modules/zod/src/v4/classic/tests/number.test.ts +325 -0
  608. package/node_modules/zod/src/v4/classic/tests/object.test.ts +717 -0
  609. package/node_modules/zod/src/v4/classic/tests/optional.test.ts +333 -0
  610. package/node_modules/zod/src/v4/classic/tests/partial.test.ts +450 -0
  611. package/node_modules/zod/src/v4/classic/tests/pickomit.test.ts +211 -0
  612. package/node_modules/zod/src/v4/classic/tests/pipe.test.ts +101 -0
  613. package/node_modules/zod/src/v4/classic/tests/prefault.test.ts +74 -0
  614. package/node_modules/zod/src/v4/classic/tests/preprocess-types.test.ts +26 -0
  615. package/node_modules/zod/src/v4/classic/tests/preprocess.test.ts +351 -0
  616. package/node_modules/zod/src/v4/classic/tests/primitive.test.ts +175 -0
  617. package/node_modules/zod/src/v4/classic/tests/promise.test.ts +81 -0
  618. package/node_modules/zod/src/v4/classic/tests/prototypes.test.ts +23 -0
  619. package/node_modules/zod/src/v4/classic/tests/readonly.test.ts +252 -0
  620. package/node_modules/zod/src/v4/classic/tests/record.test.ts +717 -0
  621. package/node_modules/zod/src/v4/classic/tests/recursive-types.test.ts +631 -0
  622. package/node_modules/zod/src/v4/classic/tests/refine.test.ts +633 -0
  623. package/node_modules/zod/src/v4/classic/tests/registries.test.ts +243 -0
  624. package/node_modules/zod/src/v4/classic/tests/set.test.ts +181 -0
  625. package/node_modules/zod/src/v4/classic/tests/standard-schema.test.ts +134 -0
  626. package/node_modules/zod/src/v4/classic/tests/string-formats.test.ts +125 -0
  627. package/node_modules/zod/src/v4/classic/tests/string.test.ts +1224 -0
  628. package/node_modules/zod/src/v4/classic/tests/stringbool.test.ts +106 -0
  629. package/node_modules/zod/src/v4/classic/tests/template-literal.test.ts +771 -0
  630. package/node_modules/zod/src/v4/classic/tests/to-json-schema-methods.test.ts +438 -0
  631. package/node_modules/zod/src/v4/classic/tests/to-json-schema.test.ts +3125 -0
  632. package/node_modules/zod/src/v4/classic/tests/transform.test.ts +378 -0
  633. package/node_modules/zod/src/v4/classic/tests/tuple.test.ts +496 -0
  634. package/node_modules/zod/src/v4/classic/tests/union.test.ts +273 -0
  635. package/node_modules/zod/src/v4/classic/tests/url.test.ts +13 -0
  636. package/node_modules/zod/src/v4/classic/tests/validations.test.ts +283 -0
  637. package/node_modules/zod/src/v4/classic/tests/void.test.ts +12 -0
  638. package/node_modules/zod/src/v4/core/api.ts +1823 -0
  639. package/node_modules/zod/src/v4/core/checks.ts +1293 -0
  640. package/node_modules/zod/src/v4/core/config.ts +15 -0
  641. package/node_modules/zod/src/v4/core/core.ts +153 -0
  642. package/node_modules/zod/src/v4/core/doc.ts +44 -0
  643. package/node_modules/zod/src/v4/core/errors.ts +455 -0
  644. package/node_modules/zod/src/v4/core/index.ts +16 -0
  645. package/node_modules/zod/src/v4/core/json-schema-generator.ts +126 -0
  646. package/node_modules/zod/src/v4/core/json-schema-processors.ts +666 -0
  647. package/node_modules/zod/src/v4/core/json-schema.ts +147 -0
  648. package/node_modules/zod/src/v4/core/parse.ts +195 -0
  649. package/node_modules/zod/src/v4/core/regexes.ts +190 -0
  650. package/node_modules/zod/src/v4/core/registries.ts +105 -0
  651. package/node_modules/zod/src/v4/core/schemas.ts +4730 -0
  652. package/node_modules/zod/src/v4/core/standard-schema.ts +159 -0
  653. package/node_modules/zod/src/v4/core/tests/extend.test.ts +59 -0
  654. package/node_modules/zod/src/v4/core/tests/index.test.ts +46 -0
  655. package/node_modules/zod/src/v4/core/tests/locales/be.test.ts +124 -0
  656. package/node_modules/zod/src/v4/core/tests/locales/el.test.ts +215 -0
  657. package/node_modules/zod/src/v4/core/tests/locales/en.test.ts +22 -0
  658. package/node_modules/zod/src/v4/core/tests/locales/es.test.ts +181 -0
  659. package/node_modules/zod/src/v4/core/tests/locales/fr.test.ts +72 -0
  660. package/node_modules/zod/src/v4/core/tests/locales/he.test.ts +379 -0
  661. package/node_modules/zod/src/v4/core/tests/locales/hr.test.ts +163 -0
  662. package/node_modules/zod/src/v4/core/tests/locales/nl.test.ts +46 -0
  663. package/node_modules/zod/src/v4/core/tests/locales/ru.test.ts +128 -0
  664. package/node_modules/zod/src/v4/core/tests/locales/tr.test.ts +69 -0
  665. package/node_modules/zod/src/v4/core/tests/locales/uz.test.ts +105 -0
  666. package/node_modules/zod/src/v4/core/tests/record-constructor.test.ts +125 -0
  667. package/node_modules/zod/src/v4/core/tests/recursive-tuples.test.ts +45 -0
  668. package/node_modules/zod/src/v4/core/to-json-schema.ts +622 -0
  669. package/node_modules/zod/src/v4/core/util.ts +983 -0
  670. package/node_modules/zod/src/v4/core/versions.ts +5 -0
  671. package/node_modules/zod/src/v4/core/zsf.ts +323 -0
  672. package/node_modules/zod/src/v4/index.ts +4 -0
  673. package/node_modules/zod/src/v4/locales/ar.ts +115 -0
  674. package/node_modules/zod/src/v4/locales/az.ts +111 -0
  675. package/node_modules/zod/src/v4/locales/be.ts +176 -0
  676. package/node_modules/zod/src/v4/locales/bg.ts +128 -0
  677. package/node_modules/zod/src/v4/locales/ca.ts +116 -0
  678. package/node_modules/zod/src/v4/locales/cs.ts +118 -0
  679. package/node_modules/zod/src/v4/locales/da.ts +123 -0
  680. package/node_modules/zod/src/v4/locales/de.ts +116 -0
  681. package/node_modules/zod/src/v4/locales/el.ts +121 -0
  682. package/node_modules/zod/src/v4/locales/en.ts +123 -0
  683. package/node_modules/zod/src/v4/locales/eo.ts +118 -0
  684. package/node_modules/zod/src/v4/locales/es.ts +141 -0
  685. package/node_modules/zod/src/v4/locales/fa.ts +126 -0
  686. package/node_modules/zod/src/v4/locales/fi.ts +121 -0
  687. package/node_modules/zod/src/v4/locales/fr-CA.ts +116 -0
  688. package/node_modules/zod/src/v4/locales/fr.ts +132 -0
  689. package/node_modules/zod/src/v4/locales/he.ts +246 -0
  690. package/node_modules/zod/src/v4/locales/hr.ts +131 -0
  691. package/node_modules/zod/src/v4/locales/hu.ts +117 -0
  692. package/node_modules/zod/src/v4/locales/hy.ts +164 -0
  693. package/node_modules/zod/src/v4/locales/id.ts +115 -0
  694. package/node_modules/zod/src/v4/locales/index.ts +52 -0
  695. package/node_modules/zod/src/v4/locales/is.ts +119 -0
  696. package/node_modules/zod/src/v4/locales/it.ts +116 -0
  697. package/node_modules/zod/src/v4/locales/ja.ts +114 -0
  698. package/node_modules/zod/src/v4/locales/ka.ts +123 -0
  699. package/node_modules/zod/src/v4/locales/kh.ts +7 -0
  700. package/node_modules/zod/src/v4/locales/km.ts +119 -0
  701. package/node_modules/zod/src/v4/locales/ko.ts +121 -0
  702. package/node_modules/zod/src/v4/locales/lt.ts +239 -0
  703. package/node_modules/zod/src/v4/locales/mk.ts +118 -0
  704. package/node_modules/zod/src/v4/locales/ms.ts +115 -0
  705. package/node_modules/zod/src/v4/locales/nl.ts +121 -0
  706. package/node_modules/zod/src/v4/locales/no.ts +116 -0
  707. package/node_modules/zod/src/v4/locales/ota.ts +117 -0
  708. package/node_modules/zod/src/v4/locales/pl.ts +118 -0
  709. package/node_modules/zod/src/v4/locales/ps.ts +126 -0
  710. package/node_modules/zod/src/v4/locales/pt.ts +116 -0
  711. package/node_modules/zod/src/v4/locales/ro.ts +129 -0
  712. package/node_modules/zod/src/v4/locales/ru.ts +176 -0
  713. package/node_modules/zod/src/v4/locales/sl.ts +118 -0
  714. package/node_modules/zod/src/v4/locales/sv.ts +119 -0
  715. package/node_modules/zod/src/v4/locales/ta.ts +118 -0
  716. package/node_modules/zod/src/v4/locales/th.ts +119 -0
  717. package/node_modules/zod/src/v4/locales/tr.ts +111 -0
  718. package/node_modules/zod/src/v4/locales/ua.ts +7 -0
  719. package/node_modules/zod/src/v4/locales/uk.ts +117 -0
  720. package/node_modules/zod/src/v4/locales/ur.ts +119 -0
  721. package/node_modules/zod/src/v4/locales/uz.ts +117 -0
  722. package/node_modules/zod/src/v4/locales/vi.ts +117 -0
  723. package/node_modules/zod/src/v4/locales/yo.ts +124 -0
  724. package/node_modules/zod/src/v4/locales/zh-CN.ts +116 -0
  725. package/node_modules/zod/src/v4/locales/zh-TW.ts +115 -0
  726. package/node_modules/zod/src/v4/mini/checks.ts +32 -0
  727. package/node_modules/zod/src/v4/mini/coerce.ts +27 -0
  728. package/node_modules/zod/src/v4/mini/external.ts +41 -0
  729. package/node_modules/zod/src/v4/mini/index.ts +3 -0
  730. package/node_modules/zod/src/v4/mini/iso.ts +66 -0
  731. package/node_modules/zod/src/v4/mini/parse.ts +14 -0
  732. package/node_modules/zod/src/v4/mini/schemas.ts +1947 -0
  733. package/node_modules/zod/src/v4/mini/tests/apply.test.ts +24 -0
  734. package/node_modules/zod/src/v4/mini/tests/assignability.test.ts +129 -0
  735. package/node_modules/zod/src/v4/mini/tests/brand.test.ts +94 -0
  736. package/node_modules/zod/src/v4/mini/tests/checks.test.ts +144 -0
  737. package/node_modules/zod/src/v4/mini/tests/codec.test.ts +548 -0
  738. package/node_modules/zod/src/v4/mini/tests/computed.test.ts +36 -0
  739. package/node_modules/zod/src/v4/mini/tests/error.test.ts +22 -0
  740. package/node_modules/zod/src/v4/mini/tests/functions.test.ts +5 -0
  741. package/node_modules/zod/src/v4/mini/tests/index.test.ts +993 -0
  742. package/node_modules/zod/src/v4/mini/tests/number.test.ts +95 -0
  743. package/node_modules/zod/src/v4/mini/tests/object.test.ts +227 -0
  744. package/node_modules/zod/src/v4/mini/tests/prototypes.test.ts +43 -0
  745. package/node_modules/zod/src/v4/mini/tests/recursive-types.test.ts +325 -0
  746. package/node_modules/zod/src/v4/mini/tests/standard-schema.test.ts +50 -0
  747. package/node_modules/zod/src/v4/mini/tests/string.test.ts +352 -0
  748. package/node_modules/zod/src/v4-mini/index.ts +3 -0
  749. package/node_modules/zod/v3/ZodError.cjs +138 -0
  750. package/node_modules/zod/v3/ZodError.d.cts +164 -0
  751. package/node_modules/zod/v3/ZodError.d.ts +164 -0
  752. package/node_modules/zod/v3/ZodError.js +133 -0
  753. package/node_modules/zod/v3/errors.cjs +17 -0
  754. package/node_modules/zod/v3/errors.d.cts +5 -0
  755. package/node_modules/zod/v3/errors.d.ts +5 -0
  756. package/node_modules/zod/v3/errors.js +9 -0
  757. package/node_modules/zod/v3/external.cjs +22 -0
  758. package/node_modules/zod/v3/external.d.cts +6 -0
  759. package/node_modules/zod/v3/external.d.ts +6 -0
  760. package/node_modules/zod/v3/external.js +6 -0
  761. package/node_modules/zod/v3/helpers/enumUtil.cjs +2 -0
  762. package/node_modules/zod/v3/helpers/enumUtil.d.cts +8 -0
  763. package/node_modules/zod/v3/helpers/enumUtil.d.ts +8 -0
  764. package/node_modules/zod/v3/helpers/enumUtil.js +1 -0
  765. package/node_modules/zod/v3/helpers/errorUtil.cjs +9 -0
  766. package/node_modules/zod/v3/helpers/errorUtil.d.cts +9 -0
  767. package/node_modules/zod/v3/helpers/errorUtil.d.ts +9 -0
  768. package/node_modules/zod/v3/helpers/errorUtil.js +6 -0
  769. package/node_modules/zod/v3/helpers/parseUtil.cjs +124 -0
  770. package/node_modules/zod/v3/helpers/parseUtil.d.cts +78 -0
  771. package/node_modules/zod/v3/helpers/parseUtil.d.ts +78 -0
  772. package/node_modules/zod/v3/helpers/parseUtil.js +109 -0
  773. package/node_modules/zod/v3/helpers/partialUtil.cjs +2 -0
  774. package/node_modules/zod/v3/helpers/partialUtil.d.cts +8 -0
  775. package/node_modules/zod/v3/helpers/partialUtil.d.ts +8 -0
  776. package/node_modules/zod/v3/helpers/partialUtil.js +1 -0
  777. package/node_modules/zod/v3/helpers/typeAliases.cjs +2 -0
  778. package/node_modules/zod/v3/helpers/typeAliases.d.cts +2 -0
  779. package/node_modules/zod/v3/helpers/typeAliases.d.ts +2 -0
  780. package/node_modules/zod/v3/helpers/typeAliases.js +1 -0
  781. package/node_modules/zod/v3/helpers/util.cjs +137 -0
  782. package/node_modules/zod/v3/helpers/util.d.cts +85 -0
  783. package/node_modules/zod/v3/helpers/util.d.ts +85 -0
  784. package/node_modules/zod/v3/helpers/util.js +133 -0
  785. package/node_modules/zod/v3/index.cjs +33 -0
  786. package/node_modules/zod/v3/index.d.cts +4 -0
  787. package/node_modules/zod/v3/index.d.ts +4 -0
  788. package/node_modules/zod/v3/index.js +4 -0
  789. package/node_modules/zod/v3/locales/en.cjs +112 -0
  790. package/node_modules/zod/v3/locales/en.d.cts +3 -0
  791. package/node_modules/zod/v3/locales/en.d.ts +3 -0
  792. package/node_modules/zod/v3/locales/en.js +109 -0
  793. package/node_modules/zod/v3/package.json +7 -0
  794. package/node_modules/zod/v3/standard-schema.cjs +2 -0
  795. package/node_modules/zod/v3/standard-schema.d.cts +102 -0
  796. package/node_modules/zod/v3/standard-schema.d.ts +102 -0
  797. package/node_modules/zod/v3/standard-schema.js +1 -0
  798. package/node_modules/zod/v3/types.cjs +3777 -0
  799. package/node_modules/zod/v3/types.d.cts +1034 -0
  800. package/node_modules/zod/v3/types.d.ts +1034 -0
  801. package/node_modules/zod/v3/types.js +3695 -0
  802. package/node_modules/zod/v4/classic/checks.cjs +33 -0
  803. package/node_modules/zod/v4/classic/checks.d.cts +1 -0
  804. package/node_modules/zod/v4/classic/checks.d.ts +1 -0
  805. package/node_modules/zod/v4/classic/checks.js +1 -0
  806. package/node_modules/zod/v4/classic/coerce.cjs +47 -0
  807. package/node_modules/zod/v4/classic/coerce.d.cts +17 -0
  808. package/node_modules/zod/v4/classic/coerce.d.ts +17 -0
  809. package/node_modules/zod/v4/classic/coerce.js +17 -0
  810. package/node_modules/zod/v4/classic/compat.cjs +61 -0
  811. package/node_modules/zod/v4/classic/compat.d.cts +50 -0
  812. package/node_modules/zod/v4/classic/compat.d.ts +50 -0
  813. package/node_modules/zod/v4/classic/compat.js +31 -0
  814. package/node_modules/zod/v4/classic/errors.cjs +74 -0
  815. package/node_modules/zod/v4/classic/errors.d.cts +30 -0
  816. package/node_modules/zod/v4/classic/errors.d.ts +30 -0
  817. package/node_modules/zod/v4/classic/errors.js +48 -0
  818. package/node_modules/zod/v4/classic/external.cjs +73 -0
  819. package/node_modules/zod/v4/classic/external.d.cts +16 -0
  820. package/node_modules/zod/v4/classic/external.d.ts +16 -0
  821. package/node_modules/zod/v4/classic/external.js +20 -0
  822. package/node_modules/zod/v4/classic/from-json-schema.cjs +625 -0
  823. package/node_modules/zod/v4/classic/from-json-schema.d.cts +12 -0
  824. package/node_modules/zod/v4/classic/from-json-schema.d.ts +12 -0
  825. package/node_modules/zod/v4/classic/from-json-schema.js +599 -0
  826. package/node_modules/zod/v4/classic/index.cjs +33 -0
  827. package/node_modules/zod/v4/classic/index.d.cts +4 -0
  828. package/node_modules/zod/v4/classic/index.d.ts +4 -0
  829. package/node_modules/zod/v4/classic/index.js +4 -0
  830. package/node_modules/zod/v4/classic/iso.cjs +60 -0
  831. package/node_modules/zod/v4/classic/iso.d.cts +22 -0
  832. package/node_modules/zod/v4/classic/iso.d.ts +22 -0
  833. package/node_modules/zod/v4/classic/iso.js +30 -0
  834. package/node_modules/zod/v4/classic/package.json +7 -0
  835. package/node_modules/zod/v4/classic/parse.cjs +41 -0
  836. package/node_modules/zod/v4/classic/parse.d.cts +31 -0
  837. package/node_modules/zod/v4/classic/parse.d.ts +31 -0
  838. package/node_modules/zod/v4/classic/parse.js +15 -0
  839. package/node_modules/zod/v4/classic/schemas.cjs +1511 -0
  840. package/node_modules/zod/v4/classic/schemas.d.cts +767 -0
  841. package/node_modules/zod/v4/classic/schemas.d.ts +767 -0
  842. package/node_modules/zod/v4/classic/schemas.js +1395 -0
  843. package/node_modules/zod/v4/core/api.cjs +1227 -0
  844. package/node_modules/zod/v4/core/api.d.cts +325 -0
  845. package/node_modules/zod/v4/core/api.d.ts +325 -0
  846. package/node_modules/zod/v4/core/api.js +1087 -0
  847. package/node_modules/zod/v4/core/checks.cjs +601 -0
  848. package/node_modules/zod/v4/core/checks.d.cts +278 -0
  849. package/node_modules/zod/v4/core/checks.d.ts +278 -0
  850. package/node_modules/zod/v4/core/checks.js +575 -0
  851. package/node_modules/zod/v4/core/core.cjs +85 -0
  852. package/node_modules/zod/v4/core/core.d.cts +70 -0
  853. package/node_modules/zod/v4/core/core.d.ts +70 -0
  854. package/node_modules/zod/v4/core/core.js +78 -0
  855. package/node_modules/zod/v4/core/doc.cjs +39 -0
  856. package/node_modules/zod/v4/core/doc.d.cts +14 -0
  857. package/node_modules/zod/v4/core/doc.d.ts +14 -0
  858. package/node_modules/zod/v4/core/doc.js +35 -0
  859. package/node_modules/zod/v4/core/errors.cjs +216 -0
  860. package/node_modules/zod/v4/core/errors.d.cts +221 -0
  861. package/node_modules/zod/v4/core/errors.d.ts +221 -0
  862. package/node_modules/zod/v4/core/errors.js +185 -0
  863. package/node_modules/zod/v4/core/index.cjs +47 -0
  864. package/node_modules/zod/v4/core/index.d.cts +16 -0
  865. package/node_modules/zod/v4/core/index.d.ts +16 -0
  866. package/node_modules/zod/v4/core/index.js +16 -0
  867. package/node_modules/zod/v4/core/json-schema-generator.cjs +99 -0
  868. package/node_modules/zod/v4/core/json-schema-generator.d.cts +65 -0
  869. package/node_modules/zod/v4/core/json-schema-generator.d.ts +65 -0
  870. package/node_modules/zod/v4/core/json-schema-generator.js +95 -0
  871. package/node_modules/zod/v4/core/json-schema-processors.cjs +644 -0
  872. package/node_modules/zod/v4/core/json-schema-processors.d.cts +49 -0
  873. package/node_modules/zod/v4/core/json-schema-processors.d.ts +49 -0
  874. package/node_modules/zod/v4/core/json-schema-processors.js +601 -0
  875. package/node_modules/zod/v4/core/json-schema.cjs +2 -0
  876. package/node_modules/zod/v4/core/json-schema.d.cts +88 -0
  877. package/node_modules/zod/v4/core/json-schema.d.ts +88 -0
  878. package/node_modules/zod/v4/core/json-schema.js +1 -0
  879. package/node_modules/zod/v4/core/package.json +7 -0
  880. package/node_modules/zod/v4/core/parse.cjs +131 -0
  881. package/node_modules/zod/v4/core/parse.d.cts +49 -0
  882. package/node_modules/zod/v4/core/parse.d.ts +49 -0
  883. package/node_modules/zod/v4/core/parse.js +93 -0
  884. package/node_modules/zod/v4/core/regexes.cjs +172 -0
  885. package/node_modules/zod/v4/core/regexes.d.cts +85 -0
  886. package/node_modules/zod/v4/core/regexes.d.ts +85 -0
  887. package/node_modules/zod/v4/core/regexes.js +139 -0
  888. package/node_modules/zod/v4/core/registries.cjs +56 -0
  889. package/node_modules/zod/v4/core/registries.d.cts +35 -0
  890. package/node_modules/zod/v4/core/registries.d.ts +35 -0
  891. package/node_modules/zod/v4/core/registries.js +51 -0
  892. package/node_modules/zod/v4/core/schemas.cjs +2270 -0
  893. package/node_modules/zod/v4/core/schemas.d.cts +1184 -0
  894. package/node_modules/zod/v4/core/schemas.d.ts +1184 -0
  895. package/node_modules/zod/v4/core/schemas.js +2239 -0
  896. package/node_modules/zod/v4/core/standard-schema.cjs +2 -0
  897. package/node_modules/zod/v4/core/standard-schema.d.cts +126 -0
  898. package/node_modules/zod/v4/core/standard-schema.d.ts +126 -0
  899. package/node_modules/zod/v4/core/standard-schema.js +1 -0
  900. package/node_modules/zod/v4/core/to-json-schema.cjs +457 -0
  901. package/node_modules/zod/v4/core/to-json-schema.d.cts +114 -0
  902. package/node_modules/zod/v4/core/to-json-schema.d.ts +114 -0
  903. package/node_modules/zod/v4/core/to-json-schema.js +448 -0
  904. package/node_modules/zod/v4/core/util.cjs +734 -0
  905. package/node_modules/zod/v4/core/util.d.cts +200 -0
  906. package/node_modules/zod/v4/core/util.d.ts +200 -0
  907. package/node_modules/zod/v4/core/util.js +674 -0
  908. package/node_modules/zod/v4/core/versions.cjs +8 -0
  909. package/node_modules/zod/v4/core/versions.d.cts +5 -0
  910. package/node_modules/zod/v4/core/versions.d.ts +5 -0
  911. package/node_modules/zod/v4/core/versions.js +5 -0
  912. package/node_modules/zod/v4/index.cjs +22 -0
  913. package/node_modules/zod/v4/index.d.cts +3 -0
  914. package/node_modules/zod/v4/index.d.ts +3 -0
  915. package/node_modules/zod/v4/index.js +3 -0
  916. package/node_modules/zod/v4/locales/ar.cjs +133 -0
  917. package/node_modules/zod/v4/locales/ar.d.cts +5 -0
  918. package/node_modules/zod/v4/locales/ar.d.ts +4 -0
  919. package/node_modules/zod/v4/locales/ar.js +106 -0
  920. package/node_modules/zod/v4/locales/az.cjs +132 -0
  921. package/node_modules/zod/v4/locales/az.d.cts +5 -0
  922. package/node_modules/zod/v4/locales/az.d.ts +4 -0
  923. package/node_modules/zod/v4/locales/az.js +105 -0
  924. package/node_modules/zod/v4/locales/be.cjs +183 -0
  925. package/node_modules/zod/v4/locales/be.d.cts +5 -0
  926. package/node_modules/zod/v4/locales/be.d.ts +4 -0
  927. package/node_modules/zod/v4/locales/be.js +156 -0
  928. package/node_modules/zod/v4/locales/bg.cjs +147 -0
  929. package/node_modules/zod/v4/locales/bg.d.cts +5 -0
  930. package/node_modules/zod/v4/locales/bg.d.ts +4 -0
  931. package/node_modules/zod/v4/locales/bg.js +120 -0
  932. package/node_modules/zod/v4/locales/ca.cjs +134 -0
  933. package/node_modules/zod/v4/locales/ca.d.cts +5 -0
  934. package/node_modules/zod/v4/locales/ca.d.ts +4 -0
  935. package/node_modules/zod/v4/locales/ca.js +107 -0
  936. package/node_modules/zod/v4/locales/cs.cjs +138 -0
  937. package/node_modules/zod/v4/locales/cs.d.cts +5 -0
  938. package/node_modules/zod/v4/locales/cs.d.ts +4 -0
  939. package/node_modules/zod/v4/locales/cs.js +111 -0
  940. package/node_modules/zod/v4/locales/da.cjs +142 -0
  941. package/node_modules/zod/v4/locales/da.d.cts +5 -0
  942. package/node_modules/zod/v4/locales/da.d.ts +4 -0
  943. package/node_modules/zod/v4/locales/da.js +115 -0
  944. package/node_modules/zod/v4/locales/de.cjs +135 -0
  945. package/node_modules/zod/v4/locales/de.d.cts +5 -0
  946. package/node_modules/zod/v4/locales/de.d.ts +4 -0
  947. package/node_modules/zod/v4/locales/de.js +108 -0
  948. package/node_modules/zod/v4/locales/el.cjs +136 -0
  949. package/node_modules/zod/v4/locales/el.d.cts +5 -0
  950. package/node_modules/zod/v4/locales/el.d.ts +4 -0
  951. package/node_modules/zod/v4/locales/el.js +109 -0
  952. package/node_modules/zod/v4/locales/en.cjs +140 -0
  953. package/node_modules/zod/v4/locales/en.d.cts +5 -0
  954. package/node_modules/zod/v4/locales/en.d.ts +4 -0
  955. package/node_modules/zod/v4/locales/en.js +113 -0
  956. package/node_modules/zod/v4/locales/eo.cjs +136 -0
  957. package/node_modules/zod/v4/locales/eo.d.cts +5 -0
  958. package/node_modules/zod/v4/locales/eo.d.ts +4 -0
  959. package/node_modules/zod/v4/locales/eo.js +109 -0
  960. package/node_modules/zod/v4/locales/es.cjs +159 -0
  961. package/node_modules/zod/v4/locales/es.d.cts +5 -0
  962. package/node_modules/zod/v4/locales/es.d.ts +4 -0
  963. package/node_modules/zod/v4/locales/es.js +132 -0
  964. package/node_modules/zod/v4/locales/fa.cjs +141 -0
  965. package/node_modules/zod/v4/locales/fa.d.cts +5 -0
  966. package/node_modules/zod/v4/locales/fa.d.ts +4 -0
  967. package/node_modules/zod/v4/locales/fa.js +114 -0
  968. package/node_modules/zod/v4/locales/fi.cjs +139 -0
  969. package/node_modules/zod/v4/locales/fi.d.cts +5 -0
  970. package/node_modules/zod/v4/locales/fi.d.ts +4 -0
  971. package/node_modules/zod/v4/locales/fi.js +112 -0
  972. package/node_modules/zod/v4/locales/fr-CA.cjs +134 -0
  973. package/node_modules/zod/v4/locales/fr-CA.d.cts +5 -0
  974. package/node_modules/zod/v4/locales/fr-CA.d.ts +4 -0
  975. package/node_modules/zod/v4/locales/fr-CA.js +107 -0
  976. package/node_modules/zod/v4/locales/fr.cjs +152 -0
  977. package/node_modules/zod/v4/locales/fr.d.cts +5 -0
  978. package/node_modules/zod/v4/locales/fr.d.ts +4 -0
  979. package/node_modules/zod/v4/locales/fr.js +125 -0
  980. package/node_modules/zod/v4/locales/he.cjs +241 -0
  981. package/node_modules/zod/v4/locales/he.d.cts +5 -0
  982. package/node_modules/zod/v4/locales/he.d.ts +4 -0
  983. package/node_modules/zod/v4/locales/he.js +214 -0
  984. package/node_modules/zod/v4/locales/hr.cjs +149 -0
  985. package/node_modules/zod/v4/locales/hr.d.cts +5 -0
  986. package/node_modules/zod/v4/locales/hr.d.ts +4 -0
  987. package/node_modules/zod/v4/locales/hr.js +122 -0
  988. package/node_modules/zod/v4/locales/hu.cjs +135 -0
  989. package/node_modules/zod/v4/locales/hu.d.cts +5 -0
  990. package/node_modules/zod/v4/locales/hu.d.ts +4 -0
  991. package/node_modules/zod/v4/locales/hu.js +108 -0
  992. package/node_modules/zod/v4/locales/hy.cjs +174 -0
  993. package/node_modules/zod/v4/locales/hy.d.cts +5 -0
  994. package/node_modules/zod/v4/locales/hy.d.ts +4 -0
  995. package/node_modules/zod/v4/locales/hy.js +147 -0
  996. package/node_modules/zod/v4/locales/id.cjs +133 -0
  997. package/node_modules/zod/v4/locales/id.d.cts +5 -0
  998. package/node_modules/zod/v4/locales/id.d.ts +4 -0
  999. package/node_modules/zod/v4/locales/id.js +106 -0
  1000. package/node_modules/zod/v4/locales/index.cjs +111 -0
  1001. package/node_modules/zod/v4/locales/index.d.cts +52 -0
  1002. package/node_modules/zod/v4/locales/index.d.ts +52 -0
  1003. package/node_modules/zod/v4/locales/index.js +52 -0
  1004. package/node_modules/zod/v4/locales/is.cjs +136 -0
  1005. package/node_modules/zod/v4/locales/is.d.cts +5 -0
  1006. package/node_modules/zod/v4/locales/is.d.ts +4 -0
  1007. package/node_modules/zod/v4/locales/is.js +109 -0
  1008. package/node_modules/zod/v4/locales/it.cjs +135 -0
  1009. package/node_modules/zod/v4/locales/it.d.cts +5 -0
  1010. package/node_modules/zod/v4/locales/it.d.ts +4 -0
  1011. package/node_modules/zod/v4/locales/it.js +108 -0
  1012. package/node_modules/zod/v4/locales/ja.cjs +134 -0
  1013. package/node_modules/zod/v4/locales/ja.d.cts +5 -0
  1014. package/node_modules/zod/v4/locales/ja.d.ts +4 -0
  1015. package/node_modules/zod/v4/locales/ja.js +107 -0
  1016. package/node_modules/zod/v4/locales/ka.cjs +139 -0
  1017. package/node_modules/zod/v4/locales/ka.d.cts +5 -0
  1018. package/node_modules/zod/v4/locales/ka.d.ts +4 -0
  1019. package/node_modules/zod/v4/locales/ka.js +112 -0
  1020. package/node_modules/zod/v4/locales/kh.cjs +12 -0
  1021. package/node_modules/zod/v4/locales/kh.d.cts +5 -0
  1022. package/node_modules/zod/v4/locales/kh.d.ts +5 -0
  1023. package/node_modules/zod/v4/locales/kh.js +5 -0
  1024. package/node_modules/zod/v4/locales/km.cjs +137 -0
  1025. package/node_modules/zod/v4/locales/km.d.cts +5 -0
  1026. package/node_modules/zod/v4/locales/km.d.ts +4 -0
  1027. package/node_modules/zod/v4/locales/km.js +110 -0
  1028. package/node_modules/zod/v4/locales/ko.cjs +138 -0
  1029. package/node_modules/zod/v4/locales/ko.d.cts +5 -0
  1030. package/node_modules/zod/v4/locales/ko.d.ts +4 -0
  1031. package/node_modules/zod/v4/locales/ko.js +111 -0
  1032. package/node_modules/zod/v4/locales/lt.cjs +230 -0
  1033. package/node_modules/zod/v4/locales/lt.d.cts +5 -0
  1034. package/node_modules/zod/v4/locales/lt.d.ts +4 -0
  1035. package/node_modules/zod/v4/locales/lt.js +203 -0
  1036. package/node_modules/zod/v4/locales/mk.cjs +136 -0
  1037. package/node_modules/zod/v4/locales/mk.d.cts +5 -0
  1038. package/node_modules/zod/v4/locales/mk.d.ts +4 -0
  1039. package/node_modules/zod/v4/locales/mk.js +109 -0
  1040. package/node_modules/zod/v4/locales/ms.cjs +134 -0
  1041. package/node_modules/zod/v4/locales/ms.d.cts +5 -0
  1042. package/node_modules/zod/v4/locales/ms.d.ts +4 -0
  1043. package/node_modules/zod/v4/locales/ms.js +107 -0
  1044. package/node_modules/zod/v4/locales/nl.cjs +137 -0
  1045. package/node_modules/zod/v4/locales/nl.d.cts +5 -0
  1046. package/node_modules/zod/v4/locales/nl.d.ts +4 -0
  1047. package/node_modules/zod/v4/locales/nl.js +110 -0
  1048. package/node_modules/zod/v4/locales/no.cjs +135 -0
  1049. package/node_modules/zod/v4/locales/no.d.cts +5 -0
  1050. package/node_modules/zod/v4/locales/no.d.ts +4 -0
  1051. package/node_modules/zod/v4/locales/no.js +108 -0
  1052. package/node_modules/zod/v4/locales/ota.cjs +136 -0
  1053. package/node_modules/zod/v4/locales/ota.d.cts +5 -0
  1054. package/node_modules/zod/v4/locales/ota.d.ts +4 -0
  1055. package/node_modules/zod/v4/locales/ota.js +109 -0
  1056. package/node_modules/zod/v4/locales/package.json +7 -0
  1057. package/node_modules/zod/v4/locales/pl.cjs +136 -0
  1058. package/node_modules/zod/v4/locales/pl.d.cts +5 -0
  1059. package/node_modules/zod/v4/locales/pl.d.ts +4 -0
  1060. package/node_modules/zod/v4/locales/pl.js +109 -0
  1061. package/node_modules/zod/v4/locales/ps.cjs +141 -0
  1062. package/node_modules/zod/v4/locales/ps.d.cts +5 -0
  1063. package/node_modules/zod/v4/locales/ps.d.ts +4 -0
  1064. package/node_modules/zod/v4/locales/ps.js +114 -0
  1065. package/node_modules/zod/v4/locales/pt.cjs +135 -0
  1066. package/node_modules/zod/v4/locales/pt.d.cts +5 -0
  1067. package/node_modules/zod/v4/locales/pt.d.ts +4 -0
  1068. package/node_modules/zod/v4/locales/pt.js +108 -0
  1069. package/node_modules/zod/v4/locales/ro.cjs +146 -0
  1070. package/node_modules/zod/v4/locales/ro.d.cts +5 -0
  1071. package/node_modules/zod/v4/locales/ro.d.ts +4 -0
  1072. package/node_modules/zod/v4/locales/ro.js +119 -0
  1073. package/node_modules/zod/v4/locales/ru.cjs +183 -0
  1074. package/node_modules/zod/v4/locales/ru.d.cts +5 -0
  1075. package/node_modules/zod/v4/locales/ru.d.ts +4 -0
  1076. package/node_modules/zod/v4/locales/ru.js +156 -0
  1077. package/node_modules/zod/v4/locales/sl.cjs +136 -0
  1078. package/node_modules/zod/v4/locales/sl.d.cts +5 -0
  1079. package/node_modules/zod/v4/locales/sl.d.ts +4 -0
  1080. package/node_modules/zod/v4/locales/sl.js +109 -0
  1081. package/node_modules/zod/v4/locales/sv.cjs +137 -0
  1082. package/node_modules/zod/v4/locales/sv.d.cts +5 -0
  1083. package/node_modules/zod/v4/locales/sv.d.ts +4 -0
  1084. package/node_modules/zod/v4/locales/sv.js +110 -0
  1085. package/node_modules/zod/v4/locales/ta.cjs +137 -0
  1086. package/node_modules/zod/v4/locales/ta.d.cts +5 -0
  1087. package/node_modules/zod/v4/locales/ta.d.ts +4 -0
  1088. package/node_modules/zod/v4/locales/ta.js +110 -0
  1089. package/node_modules/zod/v4/locales/th.cjs +137 -0
  1090. package/node_modules/zod/v4/locales/th.d.cts +5 -0
  1091. package/node_modules/zod/v4/locales/th.d.ts +4 -0
  1092. package/node_modules/zod/v4/locales/th.js +110 -0
  1093. package/node_modules/zod/v4/locales/tr.cjs +132 -0
  1094. package/node_modules/zod/v4/locales/tr.d.cts +5 -0
  1095. package/node_modules/zod/v4/locales/tr.d.ts +4 -0
  1096. package/node_modules/zod/v4/locales/tr.js +105 -0
  1097. package/node_modules/zod/v4/locales/ua.cjs +12 -0
  1098. package/node_modules/zod/v4/locales/ua.d.cts +5 -0
  1099. package/node_modules/zod/v4/locales/ua.d.ts +5 -0
  1100. package/node_modules/zod/v4/locales/ua.js +5 -0
  1101. package/node_modules/zod/v4/locales/uk.cjs +135 -0
  1102. package/node_modules/zod/v4/locales/uk.d.cts +5 -0
  1103. package/node_modules/zod/v4/locales/uk.d.ts +4 -0
  1104. package/node_modules/zod/v4/locales/uk.js +108 -0
  1105. package/node_modules/zod/v4/locales/ur.cjs +137 -0
  1106. package/node_modules/zod/v4/locales/ur.d.cts +5 -0
  1107. package/node_modules/zod/v4/locales/ur.d.ts +4 -0
  1108. package/node_modules/zod/v4/locales/ur.js +110 -0
  1109. package/node_modules/zod/v4/locales/uz.cjs +137 -0
  1110. package/node_modules/zod/v4/locales/uz.d.cts +5 -0
  1111. package/node_modules/zod/v4/locales/uz.d.ts +4 -0
  1112. package/node_modules/zod/v4/locales/uz.js +110 -0
  1113. package/node_modules/zod/v4/locales/vi.cjs +135 -0
  1114. package/node_modules/zod/v4/locales/vi.d.cts +5 -0
  1115. package/node_modules/zod/v4/locales/vi.d.ts +4 -0
  1116. package/node_modules/zod/v4/locales/vi.js +108 -0
  1117. package/node_modules/zod/v4/locales/yo.cjs +134 -0
  1118. package/node_modules/zod/v4/locales/yo.d.cts +5 -0
  1119. package/node_modules/zod/v4/locales/yo.d.ts +4 -0
  1120. package/node_modules/zod/v4/locales/yo.js +107 -0
  1121. package/node_modules/zod/v4/locales/zh-CN.cjs +136 -0
  1122. package/node_modules/zod/v4/locales/zh-CN.d.cts +5 -0
  1123. package/node_modules/zod/v4/locales/zh-CN.d.ts +4 -0
  1124. package/node_modules/zod/v4/locales/zh-CN.js +109 -0
  1125. package/node_modules/zod/v4/locales/zh-TW.cjs +134 -0
  1126. package/node_modules/zod/v4/locales/zh-TW.d.cts +5 -0
  1127. package/node_modules/zod/v4/locales/zh-TW.d.ts +4 -0
  1128. package/node_modules/zod/v4/locales/zh-TW.js +107 -0
  1129. package/node_modules/zod/v4/mini/checks.cjs +34 -0
  1130. package/node_modules/zod/v4/mini/checks.d.cts +1 -0
  1131. package/node_modules/zod/v4/mini/checks.d.ts +1 -0
  1132. package/node_modules/zod/v4/mini/checks.js +1 -0
  1133. package/node_modules/zod/v4/mini/coerce.cjs +52 -0
  1134. package/node_modules/zod/v4/mini/coerce.d.cts +7 -0
  1135. package/node_modules/zod/v4/mini/coerce.d.ts +7 -0
  1136. package/node_modules/zod/v4/mini/coerce.js +22 -0
  1137. package/node_modules/zod/v4/mini/external.cjs +63 -0
  1138. package/node_modules/zod/v4/mini/external.d.cts +13 -0
  1139. package/node_modules/zod/v4/mini/external.d.ts +13 -0
  1140. package/node_modules/zod/v4/mini/external.js +14 -0
  1141. package/node_modules/zod/v4/mini/index.cjs +32 -0
  1142. package/node_modules/zod/v4/mini/index.d.cts +3 -0
  1143. package/node_modules/zod/v4/mini/index.d.ts +3 -0
  1144. package/node_modules/zod/v4/mini/index.js +3 -0
  1145. package/node_modules/zod/v4/mini/iso.cjs +64 -0
  1146. package/node_modules/zod/v4/mini/iso.d.cts +22 -0
  1147. package/node_modules/zod/v4/mini/iso.d.ts +22 -0
  1148. package/node_modules/zod/v4/mini/iso.js +34 -0
  1149. package/node_modules/zod/v4/mini/package.json +7 -0
  1150. package/node_modules/zod/v4/mini/parse.cjs +16 -0
  1151. package/node_modules/zod/v4/mini/parse.d.cts +1 -0
  1152. package/node_modules/zod/v4/mini/parse.d.ts +1 -0
  1153. package/node_modules/zod/v4/mini/parse.js +1 -0
  1154. package/node_modules/zod/v4/mini/schemas.cjs +1083 -0
  1155. package/node_modules/zod/v4/mini/schemas.d.cts +445 -0
  1156. package/node_modules/zod/v4/mini/schemas.d.ts +445 -0
  1157. package/node_modules/zod/v4/mini/schemas.js +961 -0
  1158. package/node_modules/zod/v4/package.json +7 -0
  1159. package/node_modules/zod/v4-mini/index.cjs +32 -0
  1160. package/node_modules/zod/v4-mini/index.d.cts +3 -0
  1161. package/node_modules/zod/v4-mini/index.d.ts +3 -0
  1162. package/node_modules/zod/v4-mini/index.js +3 -0
  1163. package/node_modules/zod/v4-mini/package.json +7 -0
  1164. package/package.json +68 -0
  1165. package/proof/CONTAINMENT-BUILD.txt +163 -0
  1166. package/proof/MCP-SMOKE-STATUS.txt +9 -0
  1167. package/proof/NODE-SYNTAX.txt +4 -0
  1168. package/proof/PROOF.txt +6 -0
  1169. package/proof/SECRET-SCAN.txt +4 -0
  1170. package/proof/SOURCE-GATES.txt +16 -0
  1171. package/proof/STATUS.txt +11 -0
  1172. package/proof/TARGET-V0313-CONTAINMENT-PASS.sha256 +1 -0
  1173. package/proof/TARGET-V0313-CONTAINMENT-PASS.txt +215 -0
  1174. package/proof/TARGET-V040-CONTAINED-IPC-FAIL.sha256 +1 -0
  1175. package/proof/TARGET-V040-CONTAINED-IPC-FAIL.txt +299 -0
  1176. package/proof/TARGET-V041-CONTAINED-CREATEPROCESS-203.sha256 +1 -0
  1177. package/proof/TARGET-V041-CONTAINED-CREATEPROCESS-203.txt +311 -0
  1178. package/proof/TARGET-V042-CONTAINED-CREATEPROCESS-203.sha256 +1 -0
  1179. package/proof/TARGET-V042-CONTAINED-CREATEPROCESS-203.txt +313 -0
  1180. package/proof/TARGET-V043-CONTAINED-CREATEPROCESS-203.sha256 +1 -0
  1181. package/proof/TARGET-V043-CONTAINED-CREATEPROCESS-203.txt +308 -0
  1182. package/proof/TARGET-V044-CONTAINED-PASS.sha256 +1 -0
  1183. package/proof/TARGET-V044-CONTAINED-PASS.txt +432 -0
  1184. package/proof/TARGET-V045-DUAL-OPERATION-PASS.sha256 +1 -0
  1185. package/proof/TARGET-V045-DUAL-OPERATION-PASS.txt +481 -0
  1186. package/proof/TARGET-V046-FIXED-EXECUTABLE-REGISTRY-PASS.sha256 +1 -0
  1187. package/proof/TARGET-V046-FIXED-EXECUTABLE-REGISTRY-PASS.txt +610 -0
  1188. package/proof/TARGET-V047-RUNTIME-MANIFEST-PASS.sha256 +1 -0
  1189. package/proof/TARGET-V047-RUNTIME-MANIFEST-PASS.txt +642 -0
  1190. package/proof/TARGET-V050-BATCH-GATE-PASS.sha256 +1 -0
  1191. package/proof/TARGET-V050-BATCH-GATE-PASS.txt +713 -0
  1192. package/proof/TESTS.txt +686 -0
  1193. package/proof/TRUST-EPHEMERAL.txt +4 -0
  1194. package/proof/V03-FREEZE.txt +27 -0
  1195. package/proof/V041-IPC-HOTFIX.txt +16 -0
  1196. package/proof/V042-ENV-HOTFIX.txt +15 -0
  1197. package/proof/V043-DRIVE-CWD-HOTFIX.txt +14 -0
  1198. package/proof/V044-LOCALAPPDATA-HOTFIX.txt +18 -0
  1199. package/proof/V045-OPERATION-REGISTRY.txt +7 -0
  1200. package/proof/V046-WORKER-REGISTRY.txt +12 -0
  1201. package/proof/V047-WORKER-MANIFEST.txt +18 -0
  1202. package/proof/V050-BATCH-TRUST-CLOSURE.txt +21 -0
  1203. package/proof/V060-ACTIVE-NETWORK-AUTHORITY.txt +29 -0
  1204. package/proof/V070-NODE-SYNTAX.txt +36 -0
  1205. package/proof/V070-NODE-TESTS.txt +752 -0
  1206. package/proof/V070-PACK-DRY-RUN.txt +126 -0
  1207. package/proof/V070-SOURCE-GATE.txt +30 -0
  1208. package/proof/V070-STATIC-SCAN.txt +4 -0
  1209. package/proof/V070-WINDOWS-GATE-PENDING.txt +25 -0
  1210. package/proof/V071-NODE-SYNTAX.txt +1 -0
  1211. package/proof/V071-NODE-TESTS.txt +796 -0
  1212. package/proof/V071-PACK-DRY-RUN.json +656 -0
  1213. package/proof/V071-SOURCE-GATE.txt +16 -0
  1214. package/proof/V071-WINDOWS-GATE-PENDING.txt +24 -0
  1215. package/proof/V073-NODE-SYNTAX.txt +4 -0
  1216. package/proof/V073-SOURCE-GATE.txt +21 -0
  1217. package/proof/V073-STATIC-SCAN.txt +10 -0
  1218. package/proof/V073-WINDOWS-GATE-PENDING.txt +5 -0
  1219. package/proof/VERIFY.txt +7 -0
  1220. package/proof/WINDOWS-CONTAINED-STATUS.txt +5 -0
  1221. package/proof/WINDOWS-CONTAINMENT-STATUS.txt +3 -0
  1222. package/scripts/autonomous-benchmark.mjs +12 -0
  1223. package/scripts/autonomous-build.ps1 +20 -0
  1224. package/scripts/autonomous-tests.ps1 +9 -0
  1225. package/scripts/build-containment.ps1 +279 -0
  1226. package/scripts/coding-live-smoke.mjs +5 -0
  1227. package/scripts/deferred-slot-operation.mjs +84 -0
  1228. package/scripts/final-closure-verify.mjs +159 -0
  1229. package/scripts/final-closure.mjs +106 -0
  1230. package/scripts/gate-windows.ps1 +42 -0
  1231. package/scripts/init-host-policy.ps1 +121 -0
  1232. package/scripts/refresh-process-policy.mjs +68 -0
  1233. package/scripts/release-manifest.mjs +187 -0
  1234. package/scripts/release-parity.mjs +190 -0
  1235. package/scripts/runtime-self-update.mjs +15 -0
  1236. package/scripts/windows-gate-evidence.mjs +52 -0
  1237. package/src/agent-mcp-tools.mjs +158 -0
  1238. package/src/agent-runtime.mjs +874 -0
  1239. package/src/audit-context.mjs +73 -0
  1240. package/src/audit-verify.mjs +93 -0
  1241. package/src/authority-smoke.mjs +117 -0
  1242. package/src/autonomous-mcp-tools.mjs +118 -0
  1243. package/src/autonomous-output-contracts.mjs +125 -0
  1244. package/src/autonomous-planner-contracts.mjs +73 -0
  1245. package/src/autonomous-planner.mjs +290 -0
  1246. package/src/autonomous-policy.mjs +146 -0
  1247. package/src/autonomous-runtime.mjs +993 -0
  1248. package/src/autonomous-supervisor.mjs +86 -0
  1249. package/src/canonical-json.mjs +17 -0
  1250. package/src/coding-mcp-tools.mjs +143 -0
  1251. package/src/coding-output-contracts.mjs +189 -0
  1252. package/src/coding-plane.mjs +657 -0
  1253. package/src/coding-search.mjs +55 -0
  1254. package/src/coding-task-runtime.mjs +725 -0
  1255. package/src/contained-cli.mjs +30 -0
  1256. package/src/contained-executor.mjs +276 -0
  1257. package/src/contained-result.mjs +149 -0
  1258. package/src/contained-smoke.mjs +101 -0
  1259. package/src/containment-bootstrap.mjs +94 -0
  1260. package/src/containment-child-control.mjs +109 -0
  1261. package/src/containment-construction.mjs +107 -0
  1262. package/src/containment-result.mjs +87 -0
  1263. package/src/containment-smoke.mjs +71 -0
  1264. package/src/deadbyte-cli.mjs +55 -0
  1265. package/src/executor.mjs +158 -0
  1266. package/src/hash.mjs +17 -0
  1267. package/src/host-plane.mjs +423 -0
  1268. package/src/ingress-mode.mjs +22 -0
  1269. package/src/invocation.mjs +34 -0
  1270. package/src/machine-fs-mcp-tools.mjs +80 -0
  1271. package/src/machine-fs-output-contracts.mjs +67 -0
  1272. package/src/machine-fs-smoke-client.mjs +134 -0
  1273. package/src/machine-fs.mjs +475 -0
  1274. package/src/machine-identity.mjs +275 -0
  1275. package/src/machine-mcp-tools.mjs +43 -0
  1276. package/src/machine-output-contracts.mjs +58 -0
  1277. package/src/mcp-contained-smoke-client.mjs +139 -0
  1278. package/src/mcp-host-smoke-client.mjs +136 -0
  1279. package/src/mcp-server.mjs +419 -0
  1280. package/src/mcp-smoke-client.mjs +136 -0
  1281. package/src/native-diff.mjs +403 -0
  1282. package/src/observation-mcp-tools.mjs +44 -0
  1283. package/src/observation-output-contracts.mjs +50 -0
  1284. package/src/observation-runtime.mjs +257 -0
  1285. package/src/observation-smoke-client.mjs +97 -0
  1286. package/src/operation-policy.mjs +19 -0
  1287. package/src/output-contracts.mjs +252 -0
  1288. package/src/path-policy.mjs +91 -0
  1289. package/src/process-mcp-tools.mjs +72 -0
  1290. package/src/process-output-contracts.mjs +79 -0
  1291. package/src/process-policy.mjs +150 -0
  1292. package/src/process-runtime.mjs +297 -0
  1293. package/src/process-smoke-client.mjs +124 -0
  1294. package/src/proof-cli.mjs +23 -0
  1295. package/src/proof-worker.mjs +11 -0
  1296. package/src/receipt.mjs +111 -0
  1297. package/src/release-generation.mjs +233 -0
  1298. package/src/release-slot.mjs +293 -0
  1299. package/src/remote-mcp-autonomous-smoke-client.mjs +138 -0
  1300. package/src/remote-mcp-coding-smoke-client.mjs +111 -0
  1301. package/src/remote-mcp-host-smoke-client.mjs +84 -0
  1302. package/src/remote-mcp-machine-smoke-client.mjs +66 -0
  1303. package/src/remote-mcp-r24-disarmed-smoke-client.mjs +38 -0
  1304. package/src/remote-mcp-r33-parity-client.mjs +177 -0
  1305. package/src/remote-mcp-smoke-client.mjs +162 -0
  1306. package/src/request-identity.mjs +63 -0
  1307. package/src/runtime-identity.mjs +33 -0
  1308. package/src/runtime-update.mjs +961 -0
  1309. package/src/text-policy.mjs +9 -0
  1310. package/src/tool-audit.mjs +261 -0
  1311. package/src/trust-init.mjs +21 -0
  1312. package/src/trust.mjs +82 -0
  1313. package/src/tunnel-stdio-compat-smoke.mjs +142 -0
  1314. package/src/tunnel-stdio-compat.mjs +126 -0
  1315. package/src/verifier-cli.mjs +13 -0
  1316. package/src/verifier.mjs +333 -0
  1317. package/src/version.mjs +6 -0
  1318. package/src/worker-registry.mjs +108 -0
  1319. package/test/DEADBYTE-MCP-WRITE-PROBE.txt +5 -0
  1320. package/test/agent-crash-child.mjs +25 -0
  1321. package/test/agent-crash-worker.mjs +19 -0
  1322. package/test/agent-runtime-adversarial.test.mjs +228 -0
  1323. package/test/agent-runtime-crash.test.mjs +76 -0
  1324. package/test/agent-runtime.test.mjs +124 -0
  1325. package/test/agent-task-receipt.test.mjs +73 -0
  1326. package/test/audit-context.test.mjs +50 -0
  1327. package/test/audit-server-integration.test.mjs +30 -0
  1328. package/test/audit-verify.test.mjs +32 -0
  1329. package/test/autonomous-adversarial.test.mjs +329 -0
  1330. package/test/autonomous-live-fixture.test.mjs +10 -0
  1331. package/test/autonomous-loop.test.mjs +188 -0
  1332. package/test/autonomous-output-contract.test.mjs +24 -0
  1333. package/test/autonomous-runtime.test.mjs +93 -0
  1334. package/test/autonomous-supervisor-integration.test.mjs +106 -0
  1335. package/test/cli-entrypoint.test.mjs +34 -0
  1336. package/test/coding-crash.test.mjs +74 -0
  1337. package/test/coding-observation.test.mjs +62 -0
  1338. package/test/coding-plane-adversarial.test.mjs +130 -0
  1339. package/test/coding-plane.test.mjs +93 -0
  1340. package/test/coding-runtime.test.mjs +165 -0
  1341. package/test/contained.test.mjs +931 -0
  1342. package/test/containment.test.mjs +557 -0
  1343. package/test/controller-r21.test.mjs +28 -0
  1344. package/test/controller-r211.test.mjs +21 -0
  1345. package/test/controller-r212.test.mjs +31 -0
  1346. package/test/controller-r24-dns.test.mjs +14 -0
  1347. package/test/controller-r24.test.mjs +32 -0
  1348. package/test/controller-r27.test.mjs +56 -0
  1349. package/test/controller-r29.test.mjs +25 -0
  1350. package/test/controller-r30.test.mjs +30 -0
  1351. package/test/controller.test.mjs +165 -0
  1352. package/test/core.test.mjs +305 -0
  1353. package/test/deferred-slot-operation-behavior.test.mjs +29 -0
  1354. package/test/deferred-slot-operation.test.mjs +18 -0
  1355. package/test/helpers/coding-crash-child.mjs +22 -0
  1356. package/test/host-plane.test.mjs +129 -0
  1357. package/test/machine-fs-mcp-tools.test.mjs +46 -0
  1358. package/test/machine-fs-runtime.test.mjs +105 -0
  1359. package/test/machine-identity.test.mjs +131 -0
  1360. package/test/machine-mcp-integration.test.mjs +88 -0
  1361. package/test/machine-mcp-tools.test.mjs +77 -0
  1362. package/test/mcp-contained-smoke-isolation.test.mjs +14 -0
  1363. package/test/named-tunnel-host.test.mjs +27 -0
  1364. package/test/native-diff.test.mjs +102 -0
  1365. package/test/observation-integration.test.mjs +56 -0
  1366. package/test/observation-mcp-tools.test.mjs +40 -0
  1367. package/test/observation-runtime.test.mjs +123 -0
  1368. package/test/output-schema.test.mjs +86 -0
  1369. package/test/package-boundary.test.mjs +38 -0
  1370. package/test/process-mcp-tools.test.mjs +71 -0
  1371. package/test/process-native.test.mjs +78 -0
  1372. package/test/process-policy-refresh.test.mjs +64 -0
  1373. package/test/process-policy.test.mjs +118 -0
  1374. package/test/process-release-gate.test.mjs +41 -0
  1375. package/test/process-runtime.test.mjs +184 -0
  1376. package/test/process-supervision.test.mjs +24 -0
  1377. package/test/r33-closeout-regression.test.mjs +109 -0
  1378. package/test/r33-finalization.test.mjs +67 -0
  1379. package/test/release-generation.test.mjs +116 -0
  1380. package/test/release-manifest-windows.test.mjs +89 -0
  1381. package/test/release-slot.test.mjs +122 -0
  1382. package/test/release-smoke-isolation.test.mjs +22 -0
  1383. package/test/release-version.test.mjs +35 -0
  1384. package/test/remote-r24-catalog.test.mjs +75 -0
  1385. package/test/runtime-self-update.test.mjs +280 -0
  1386. package/test/standing-grants.test.mjs +77 -0
  1387. package/test/tool-audit.test.mjs +134 -0
  1388. package/test/tunnel-stdio-compat.test.mjs +163 -0
  1389. package/workspaces/autonomous-live/fixture.txt +1 -0
  1390. package/workspaces/demo/input.txt +1 -0
@@ -0,0 +1,993 @@
1
+ import { createHash, randomBytes, sign as cryptoSign, verify as cryptoVerify } from 'node:crypto';
2
+ import { access, mkdir, open, readFile, readdir, rm, writeFile } from 'node:fs/promises';
3
+ import path from 'node:path';
4
+ import { canonicalJson } from './canonical-json.mjs';
5
+ import { loadPrivateSigningKey, loadPublicVerifyKey } from './trust.mjs';
6
+ import { assertAutonomousArmed, autonomousSessionStatus } from './autonomous-policy.mjs';
7
+ import { buildPlannerPrompt, parsePlannerDecision, requestProviderDecision } from './autonomous-planner.mjs';
8
+ import { verifyObservationReceiptFile } from './observation-runtime.mjs';
9
+
10
+ export const AUTONOMOUS_GOAL_SCHEMA = 'deadbyte.autonomous-goal.v1';
11
+ export const AUTONOMOUS_EVENT_SCHEMA = 'deadbyte.autonomous-event.v1';
12
+ export const AUTONOMOUS_RECEIPT_SCHEMA = 'deadbyte.autonomous-release-receipt.v1';
13
+ const CANCEL_SCHEMA = 'deadbyte.autonomous-cancel.v1';
14
+ const GOAL_ID_RE = /^[0-9a-f]{64}$/;
15
+ const ID_RE = /^[A-Za-z0-9._-]{1,64}$/;
16
+ const SHA256_RE = /^[0-9a-f]{64}$/;
17
+ const ZERO_HASH = '0'.repeat(64);
18
+ const EVENT_FILE_RE = /^(\d{6})\.json$/;
19
+ const GOAL_DOMAIN = Buffer.from('DEADBYTE-AUTONOMOUS-GOAL-V1\0');
20
+ const EVENT_DOMAIN = Buffer.from('DEADBYTE-AUTONOMOUS-EVENT-V1\0');
21
+ const CANCEL_DOMAIN = Buffer.from('DEADBYTE-AUTONOMOUS-CANCEL-V1\0');
22
+ const RECEIPT_DOMAIN = Buffer.from('DEADBYTE-AUTONOMOUS-RELEASE-RECEIPT-V1\0');
23
+ const sha256Bytes = bytes => createHash('sha256').update(bytes).digest('hex');
24
+ const sha256Object = value => sha256Bytes(Buffer.from(canonicalJson(value), 'utf8'));
25
+ const exists = file => access(file).then(() => true, () => false);
26
+ function truncated(error, max = 2048) { const s = error instanceof Error ? error.message : String(error); return s.length <= max ? s : `${s.slice(0,max)}…`; }
27
+ function signEnvelope(signingKey, domain, body) {
28
+ const bytes = Buffer.from(canonicalJson(body), 'utf8');
29
+ const signature = cryptoSign(null, Buffer.concat([domain, bytes]), signingKey.privateKey);
30
+ return { ...body, attestation:{ algorithm:'ed25519', key_id:signingKey.keyId, signature_base64:signature.toString('base64') } };
31
+ }
32
+ function verifyEnvelope(verifyKey, domain, envelope, label) {
33
+ const { attestation, ...body } = envelope ?? {};
34
+ if (attestation?.algorithm !== 'ed25519' || attestation?.key_id !== verifyKey.keyId || typeof attestation?.signature_base64 !== 'string') {
35
+ throw new Error(`${label} signature metadata mismatch`);
36
+ }
37
+ const signature = Buffer.from(attestation.signature_base64, 'base64');
38
+ if (signature.length !== 64 || signature.toString('base64') !== attestation.signature_base64) throw new Error(`${label} signature encoding mismatch`);
39
+ const bytes = Buffer.from(canonicalJson(body), 'utf8');
40
+ if (!cryptoVerify(null, Buffer.concat([domain, bytes]), verifyKey.publicKey, signature)) throw new Error(`${label} signature verification failed`);
41
+ return body;
42
+ }
43
+ function goalIdFor(policySha, submissionId) {
44
+ return sha256Object({ schema:'deadbyte.autonomous-submission.v1', policy_sha256:policySha, submission_id:submissionId });
45
+ }
46
+ function goalContext(policy, goalId) {
47
+ if (!GOAL_ID_RE.test(goalId ?? '')) throw new Error('invalid autonomous goal_id');
48
+ const dir = path.join(policy.evidence_dir, 'goals', goalId);
49
+ return { dir, goalPath:path.join(dir,'goal.json'), eventsDir:path.join(dir,'events'),
50
+ lockPath:path.join(dir,'run.lock.json'), cancelPath:path.join(dir,'cancel.request.json'),
51
+ receiptPath:path.join(dir,'release-receipt.json') };
52
+ }
53
+ function eventName(seq) { return `${String(seq).padStart(6,'0')}.json`; }
54
+ async function loadGoal(ctx, policy, verifyKeyPath) {
55
+ let parsed;
56
+ try { parsed = JSON.parse(await readFile(ctx.goalPath,'utf8')); }
57
+ catch (error) { throw new Error(`autonomous goal unavailable: ${error?.code ?? truncated(error)}`); }
58
+ const verifyKey = await loadPublicVerifyKey(verifyKeyPath);
59
+ const body = verifyEnvelope(verifyKey, GOAL_DOMAIN, parsed, 'autonomous goal');
60
+ const { goal_id:goalId, goal_sha256:claimed, ...identity } = body;
61
+ if (body.schema !== AUTONOMOUS_GOAL_SCHEMA || goalId !== path.basename(ctx.dir) ||
62
+ body.policy_sha256 !== policy.policy_sha256 || !SHA256_RE.test(claimed ?? '') || sha256Object(identity) !== claimed) {
63
+ throw new Error('autonomous goal identity/hash mismatch');
64
+ }
65
+ return parsed;
66
+ }
67
+ async function readEvents(ctx, verifyKeyPath) {
68
+ let names;
69
+ try { names = (await readdir(ctx.eventsDir)).filter(name => EVENT_FILE_RE.test(name)).sort(); }
70
+ catch (error) { throw new Error(`autonomous event directory unavailable: ${error?.code ?? truncated(error)}`); }
71
+ const verifyKey = await loadPublicVerifyKey(verifyKeyPath);
72
+ const events = []; let previous = ZERO_HASH;
73
+ for (let i = 0; i < names.length; i += 1) {
74
+ const expected = eventName(i + 1);
75
+ if (names[i] !== expected) throw new Error(`autonomous event gap at ${expected}`);
76
+ const event = JSON.parse(await readFile(path.join(ctx.eventsDir,names[i]),'utf8'));
77
+ const signed = verifyEnvelope(verifyKey, EVENT_DOMAIN, event, 'autonomous event');
78
+ const { event_sha256:claimed, ...body } = signed;
79
+ if (body.schema !== AUTONOMOUS_EVENT_SCHEMA || body.seq !== i + 1 || body.goal_id !== path.basename(ctx.dir) ||
80
+ body.prev_sha256 !== previous || !SHA256_RE.test(claimed ?? '') || sha256Object(body) !== claimed) {
81
+ throw new Error(`autonomous event ${expected} hash-chain mismatch`);
82
+ }
83
+ events.push(event); previous = claimed;
84
+ }
85
+ return events;
86
+ }
87
+ async function appendEvent(ctx, events, signingKeyPath, type, payload = {}) {
88
+ const body = { schema:AUTONOMOUS_EVENT_SCHEMA, seq:events.length + 1, goal_id:path.basename(ctx.dir),
89
+ created_at_utc:new Date().toISOString(), prev_sha256:events.at(-1)?.event_sha256 ?? ZERO_HASH, type, payload };
90
+ const signingKey = await loadPrivateSigningKey(signingKeyPath);
91
+ const event = signEnvelope(signingKey, EVENT_DOMAIN, { ...body, event_sha256:sha256Object(body) });
92
+ await writeFile(path.join(ctx.eventsDir,eventName(event.seq)), `${canonicalJson(event)}\n`, { flag:'wx' });
93
+ events.push(event); return event;
94
+ }
95
+ function deriveState(goal, events) {
96
+ let state = 'pending'; let reason = null; let mutationEpoch = 0; let plannerRound = 0; let mutationCount = 0;
97
+ const contexts = new Map(); const observations = []; const diffs = []; const decisions = [];
98
+ const plannerRejections = []; let activePlan = null;
99
+ const completedDecisions = new Set(); const plannerResponses = new Set(); let pendingRequest = null;
100
+ for (const event of events) {
101
+ const p = event.payload ?? {};
102
+ if (event.type === 'goal_run_started' && !['succeeded','cancelled'].includes(state)) state = 'running';
103
+ if (event.type === 'planner_requested') pendingRequest = { ...p, event_sha256:event.event_sha256 };
104
+ if (event.type === 'planner_decision') {
105
+ plannerRound = Math.max(plannerRound, Number(p.planner_round ?? plannerRound + 1));
106
+ decisions.push({ ...p, event_sha256:event.event_sha256 });
107
+ if (p.decision?.plan) activePlan = p.decision.plan;
108
+ if (p.request_id) plannerResponses.add(p.request_id);
109
+ if (pendingRequest?.request_id === p.request_id) pendingRequest = null;
110
+ }
111
+ if (event.type === 'planner_rejected') {
112
+ plannerRejections.push({ ...p, event_sha256:event.event_sha256 });
113
+ if (pendingRequest?.request_id === p.request_id) pendingRequest = null;
114
+ }
115
+ if (event.type === 'decision_completed' && p.decision_event_sha256) completedDecisions.add(p.decision_event_sha256);
116
+ if (event.type === 'inspect_completed') for (const item of p.contexts ?? []) contexts.set(item.path, item);
117
+ if (event.type === 'profile_completed') observations.push({ ...p, event_sha256:event.event_sha256 });
118
+ if (event.type === 'delegated_action_completed') {
119
+ const binding = { ...p, event_sha256:event.event_sha256 };
120
+ observations.push(binding);
121
+ }
122
+ if (event.type === 'native_diff_committed') {
123
+ mutationEpoch = Number(p.mutation_epoch ?? mutationEpoch + 1); mutationCount += Number(p.mutation_count ?? 1);
124
+ diffs.push({ ...p, event_sha256:event.event_sha256 });
125
+ }
126
+ if (event.type === 'goal_paused') { state = 'paused'; reason = p.reason ?? 'paused'; }
127
+ if (event.type === 'goal_resumed') { state = 'running'; reason = null; }
128
+ if (event.type === 'goal_cancelled') { state = 'cancelled'; reason = p.reason ?? 'cancelled'; }
129
+ if (event.type === 'release_completed') { state = 'succeeded'; reason = null; }
130
+ }
131
+ const pendingDecision = [...decisions].reverse().find(item => !completedDecisions.has(item.event_sha256)) ?? null;
132
+ if (pendingRequest?.request_id && plannerResponses.has(pendingRequest.request_id)) pendingRequest = null;
133
+ return {
134
+ state, reason, planner_round:plannerRound, mutation_epoch:mutationEpoch, mutation_count:mutationCount,
135
+ contexts:[...contexts.values()], observations, diffs, decisions, planner_rejections:plannerRejections,
136
+ active_plan:activePlan, pending_request:pendingRequest, pending_decision:pendingDecision,
137
+ journal_head_sha256:events.at(-1)?.event_sha256 ?? ZERO_HASH,
138
+ created_at_utc:events[0]?.created_at_utc ?? null,
139
+ elapsed_ms:events[0]?.created_at_utc ? Math.max(0, Date.now() - Date.parse(events[0].created_at_utc)) : 0
140
+ };
141
+ }
142
+ async function processExists(pid) { if (!Number.isInteger(pid) || pid <= 0) return false; try { process.kill(pid,0); return true; } catch { return false; } }
143
+ async function acquireLock(ctx) {
144
+ for (let pass = 0; pass < 2; pass += 1) {
145
+ let handle;
146
+ try {
147
+ handle = await open(ctx.lockPath,'wx',0o600);
148
+ await handle.writeFile(`${canonicalJson({ schema:'deadbyte.autonomous-lock.v1', goal_id:path.basename(ctx.dir), pid:process.pid, created_at_utc:new Date().toISOString() })}\n`);
149
+ await handle.close(); return;
150
+ } catch (error) {
151
+ if (handle) await handle.close().catch(() => {});
152
+ if (error?.code !== 'EEXIST') throw error;
153
+ let existing; try { existing = JSON.parse(await readFile(ctx.lockPath,'utf8')); } catch { throw new Error('autonomous lock malformed'); }
154
+ if (await processExists(existing?.pid)) throw new Error(`autonomous goal busy under pid ${existing.pid}`);
155
+ await rm(ctx.lockPath,{force:true});
156
+ }
157
+ }
158
+ throw new Error('autonomous lock acquisition failed');
159
+ }
160
+ async function releaseLock(ctx) { await rm(ctx.lockPath,{force:true}); }
161
+ async function readCancel(ctx, verifyKeyPath) {
162
+ if (!await exists(ctx.cancelPath)) return null;
163
+ const parsed = JSON.parse(await readFile(ctx.cancelPath,'utf8'));
164
+ const verifyKey = await loadPublicVerifyKey(verifyKeyPath);
165
+ const body = verifyEnvelope(verifyKey, CANCEL_DOMAIN, parsed, 'autonomous cancel');
166
+ if (body.schema !== CANCEL_SCHEMA || body.goal_id !== path.basename(ctx.dir) || typeof body.reason !== 'string') throw new Error('autonomous cancel identity invalid');
167
+ return body;
168
+ }
169
+ async function consumeCancel(ctx, events, signingKeyPath, verifyKeyPath) {
170
+ const request = await readCancel(ctx,verifyKeyPath); if (!request) return false;
171
+ await appendEvent(ctx,events,signingKeyPath,'goal_cancelled',{ reason:request.reason, requested_at_utc:request.requested_at_utc });
172
+ await rm(ctx.cancelPath,{force:true}).catch(() => {}); return true;
173
+ }
174
+ function profileReceiptId(goalId, actionKey, profileId) {
175
+ return sha256Object({ schema:'deadbyte.autonomous-profile-receipt-id.v1', goal_id:goalId, action_key:actionKey, profile_id:profileId }).slice(0,24);
176
+ }
177
+ function profileRequestSha(codingRuntime, profile) {
178
+ const base = { root_id:profile.root_id, command_id:profile.command_id, script_path:profile.script_path,
179
+ script_sha256:profile.script_sha256, args:profile.args, cwd:profile.cwd, timeout_ms:profile.timeout_ms };
180
+ return profile.kind === 'command'
181
+ ? codingRuntime.requestSha('coding_command_run', base)
182
+ : codingRuntime.requestSha('coding_benchmark_run', { ...base, warmups:profile.warmups, iterations:profile.iterations,
183
+ baseline_median_ms:profile.baseline_median_ms, max_regression_pct:profile.max_regression_pct });
184
+ }
185
+ function profileOutcome(profile, checked) {
186
+ if (!checked?.ok) return { valid:false, reason:checked?.reason ?? 'profile receipt invalid' };
187
+ const receipt = checked.receipt;
188
+ const expectedOp = profile.kind === 'command' ? 'coding_command_run' : 'coding_benchmark_run';
189
+ if (receipt.operation !== expectedOp || receipt.root_id !== profile.root_id || receipt.command_id !== profile.command_id ||
190
+ receipt.script_sha256 !== profile.script_sha256) return { valid:false, reason:'profile receipt identity mismatch' };
191
+ const passed = profile.kind === 'command'
192
+ ? !receipt.timed_out && receipt.exit_code === profile.expect_exit_code
193
+ : receipt.verdict === 'pass';
194
+ return { valid:true, passed, payload:{ profile_kind:profile.kind, receipt_id:receipt.receipt_id,
195
+ receipt_sha256:receipt.receipt_sha256, request_sha256:receipt.request_sha256,
196
+ ...(profile.kind === 'command' ? { exit_code:receipt.exit_code, timed_out:receipt.timed_out, elapsed_ms:receipt.elapsed_ms } :
197
+ { median_ms:receipt.median_ms, p95_ms:receipt.p95_ms, regression_pct:receipt.regression_pct, verdict:receipt.verdict }) } };
198
+ }
199
+ async function executeProfile({ ctx, events, goalId, actionKey, profileId, epoch, policy, codingRuntime, signingKeyPath }) {
200
+ const profile = policy.profiles[profileId];
201
+ if (!profile) throw new Error(`autonomous profile '${profileId}' not found`);
202
+ const prior = [...events].reverse().find(event => event.type === 'profile_completed' && event.payload?.action_key === actionKey && event.payload?.profile_id === profileId);
203
+ if (prior) return { status:prior.payload.passed ? 'passed' : 'failed', observation:prior.payload, existing:true };
204
+ const receiptId = profileReceiptId(goalId, actionKey, profileId);
205
+ const requestSha256 = profileRequestSha(codingRuntime, profile);
206
+ const started = [...events].reverse().find(event => event.type === 'profile_started' && event.payload?.action_key === actionKey && event.payload?.profile_id === profileId);
207
+ if (started) {
208
+ const checked = await codingRuntime.verifyReceiptDetailed(receiptId);
209
+ if (!checked.ok) {
210
+ await appendEvent(ctx,events,signingKeyPath,'goal_paused',{ reason:'interrupted_profile_without_receipt', profile_id:profileId, action_key:actionKey });
211
+ return { status:'paused', observation:null, existing:false };
212
+ }
213
+ if (checked.request_sha256 !== requestSha256) throw new Error(`profile '${profileId}' recovered receipt request mismatch`);
214
+ const outcome = profileOutcome(profile,checked); if (!outcome.valid) throw new Error(outcome.reason);
215
+ const payload = { action_key:actionKey, profile_id:profileId, mutation_epoch:epoch, passed:outcome.passed,
216
+ recovered:true, required_for_release:profile.required_for_release, run_after_mutation:profile.run_after_mutation, ...outcome.payload };
217
+ await appendEvent(ctx,events,signingKeyPath,'profile_completed',payload);
218
+ return { status:outcome.passed ? 'passed' : 'failed', observation:payload, existing:false };
219
+ }
220
+ await appendEvent(ctx,events,signingKeyPath,'profile_started',{ action_key:actionKey, profile_id:profileId,
221
+ mutation_epoch:epoch, receipt_id:receiptId, request_sha256:requestSha256 });
222
+ let result;
223
+ try {
224
+ result = profile.kind === 'command'
225
+ ? await codingRuntime.commandRun({ rootId:profile.root_id, commandId:profile.command_id, scriptPath:profile.script_path,
226
+ scriptSha256:profile.script_sha256, args:profile.args, cwd:profile.cwd, timeoutMs:profile.timeout_ms,
227
+ receiptId, requestSha256 })
228
+ : await codingRuntime.benchmarkRun({ rootId:profile.root_id, commandId:profile.command_id, scriptPath:profile.script_path,
229
+ scriptSha256:profile.script_sha256, args:profile.args, cwd:profile.cwd, timeoutMs:profile.timeout_ms,
230
+ warmups:profile.warmups, iterations:profile.iterations, baselineMedianMs:profile.baseline_median_ms,
231
+ maxRegressionPct:profile.max_regression_pct, receiptId, requestSha256 });
232
+ } catch (error) {
233
+ const checked = await codingRuntime.verifyReceiptDetailed(receiptId);
234
+ if (!checked.ok) {
235
+ await appendEvent(ctx,events,signingKeyPath,'goal_paused',{ reason:'profile_execution_without_receipt', profile_id:profileId,
236
+ action_key:actionKey, detail:truncated(error) });
237
+ return { status:'paused', observation:null, existing:false };
238
+ }
239
+ result = null;
240
+ }
241
+ const checked = await codingRuntime.verifyReceiptDetailed(receiptId);
242
+ if (!checked.ok || checked.request_sha256 !== requestSha256 || (result && result.receipt_sha256 !== checked.receipt_sha256)) {
243
+ throw new Error(`profile '${profileId}' post-execution receipt verification failed`);
244
+ }
245
+ const outcome = profileOutcome(profile,checked); if (!outcome.valid) throw new Error(outcome.reason);
246
+ const payload = { action_key:actionKey, profile_id:profileId, mutation_epoch:epoch, passed:outcome.passed,
247
+ recovered:result === null, required_for_release:profile.required_for_release,
248
+ run_after_mutation:profile.run_after_mutation,
249
+ stdout_excerpt:typeof result?.stdout === 'string' ? result.stdout.slice(-65536) : '',
250
+ stderr_excerpt:typeof result?.stderr === 'string' ? result.stderr.slice(-65536) : '', ...outcome.payload };
251
+ await appendEvent(ctx,events,signingKeyPath,'profile_completed',payload);
252
+ return { status:outcome.passed ? 'passed' : 'failed', observation:payload, existing:false };
253
+ }
254
+
255
+ function latestProfileObservation(state, profileId, epoch) {
256
+ return [...state.observations].reverse().find(item => item.profile_id === profileId && item.mutation_epoch === epoch) ?? null;
257
+ }
258
+ function releaseReadiness(policy, state) {
259
+ const required = Object.entries(policy.profiles).filter(([,profile]) => profile.required_for_release);
260
+ const results = required.map(([profileId]) => {
261
+ const observation = latestProfileObservation(state,profileId,state.mutation_epoch);
262
+ return { profile_id:profileId, passed:observation?.passed === true,
263
+ receipt_id:observation?.receipt_id ?? null, receipt_sha256:observation?.receipt_sha256 ?? null,
264
+ request_sha256:observation?.request_sha256 ?? null };
265
+ });
266
+ return { ready:results.every(item => item.passed), mutation_epoch:state.mutation_epoch, required_profiles:results };
267
+ }
268
+ function normalizeGoal(policy, { submissionId, rootId, title = '', goal, acceptance = '', maxIterations = null }) {
269
+ if (!ID_RE.test(submissionId ?? '')) throw new Error('autonomous submission_id invalid');
270
+ if (!policy.root_ids.includes(rootId)) throw new Error(`autonomous root '${rootId}' is not allowed`);
271
+ if (typeof title !== 'string' || title.length > 160) throw new Error('autonomous title must be <=160 characters');
272
+ if (typeof goal !== 'string' || goal.length < 1 || goal.length > 8192) throw new Error('autonomous goal must be 1-8192 characters');
273
+ if (typeof acceptance !== 'string' || acceptance.length > 4096) throw new Error('autonomous acceptance must be <=4096 characters');
274
+ const iterations = maxIterations ?? policy.limits.max_iterations;
275
+ if (!Number.isInteger(iterations) || iterations < 1 || iterations > policy.limits.max_iterations) throw new Error('autonomous max_iterations exceeds policy');
276
+ const body = { schema:AUTONOMOUS_GOAL_SCHEMA, policy_sha256:policy.policy_sha256,
277
+ coding_policy_sha256:policy.coding_policy_sha256, submission_id:submissionId, root_id:rootId,
278
+ title, goal, acceptance, max_iterations:iterations };
279
+ return Object.freeze({ ...body, goal_sha256:sha256Object(body) });
280
+ }
281
+
282
+ async function plannerView(goal, state, codingRuntime) {
283
+ const tree = await codingRuntime.tree({ rootId:goal.root_id, path:'.', maxDepth:4, maxEntries:600 });
284
+ return { mutation_epoch:state.mutation_epoch, planner_round:state.planner_round, tree:tree.entries,
285
+ contexts:state.contexts.slice(-16), observations:state.observations.slice(-24), active_plan:state.active_plan,
286
+ recent_decisions:state.decisions.slice(-8).map(item => ({ planner_round:item.planner_round,
287
+ action:item.decision?.action, summary:item.decision?.summary })) };
288
+ }
289
+ function requestIdFor(goalId, plannerRound, journalHead) {
290
+ return sha256Object({ schema:'deadbyte.autonomous-planner-request.v1', goal_id:goalId, planner_round:plannerRound, journal_head_sha256:journalHead });
291
+ }
292
+ async function requestPlanner(ctx, goal, events, state, policy, codingRuntime, signingKeyPath) {
293
+ if (state.pending_request) return state.pending_request;
294
+ const round = state.planner_round + 1;
295
+ if (round > goal.max_iterations) {
296
+ await appendEvent(ctx,events,signingKeyPath,'goal_paused',{ reason:'iteration_limit', max_iterations:goal.max_iterations });
297
+ return null;
298
+ }
299
+ if (policy.limits.max_wall_ms !== null && state.elapsed_ms > policy.limits.max_wall_ms) {
300
+ await appendEvent(ctx,events,signingKeyPath,'goal_paused',{ reason:'wall_time_limit', max_wall_ms:policy.limits.max_wall_ms });
301
+ return null;
302
+ }
303
+ const view = await plannerView(goal,state,codingRuntime);
304
+ let prompt = buildPlannerPrompt({ goal:{ title:goal.title, goal:goal.goal, acceptance:goal.acceptance }, policy, view });
305
+ const repair = [...(state.planner_rejections ?? [])].reverse().find(item => item.planner_round === round) ?? null;
306
+ if (repair) {
307
+ const repairState = canonicalJson({ request_id:repair.request_id, response_sha256:repair.response_sha256,
308
+ reason:repair.reason, attempt:repair.attempt });
309
+ prompt += `
310
+ PREVIOUS_RESPONSE_REJECTED=${repairState}
311
+ Repair only the decision contract. Return one corrected strict JSON decision; do not repeat Markdown or prose.`;
312
+ }
313
+ const requestId = requestIdFor(goal.goal_id,round,state.journal_head_sha256);
314
+ const payload = { request_id:requestId, planner_round:round, mutation_epoch:state.mutation_epoch,
315
+ prompt, prompt_sha256:sha256Bytes(Buffer.from(prompt,'utf8')), backend:policy.planner.backend,
316
+ ...(repair ? { repair_of_request_id:repair.request_id, rejection_event_sha256:repair.event_sha256 } : {}) };
317
+ await appendEvent(ctx,events,signingKeyPath,'planner_requested',payload);
318
+ return payload;
319
+ }
320
+ function completedPlanPrefix(plan) {
321
+ if (!plan?.steps) return 0;
322
+ let count = 0;
323
+ for (const step of plan.steps) { if (step.status !== 'completed') break; count += 1; }
324
+ return count;
325
+ }
326
+ function validatePlanTransition(previous, next) {
327
+ if (!next || !previous) return;
328
+ if (next.title !== previous.title) throw new Error('planner plan title is immutable after creation');
329
+ const locked = completedPlanPrefix(previous);
330
+ if (next.steps.length < locked) throw new Error('planner plan cannot remove completed prefix');
331
+ for (let i = 0; i < locked; i += 1) {
332
+ if (canonicalJson(next.steps[i]) !== canonicalJson(previous.steps[i])) {
333
+ throw new Error(`planner plan completed step '${previous.steps[i].step_id}' is immutable`);
334
+ }
335
+ }
336
+ }
337
+ function planIsComplete(plan) {
338
+ return Boolean(plan?.steps?.length) && plan.steps.every(step => step.status === 'completed');
339
+ }
340
+ async function acceptPlannerDecision({ ctx, events, goal, state, policy, codingRuntime, signingKeyPath, plannerResponse }) {
341
+ let currentState = state;
342
+ let pending = currentState.pending_request ?? await requestPlanner(ctx,goal,events,currentState,policy,codingRuntime,signingKeyPath);
343
+ if (!pending) return null;
344
+ let suppliedResponse = plannerResponse;
345
+ while (pending) {
346
+ let response;
347
+ if (policy.planner.backend === 'openai_compatible') {
348
+ response = await requestProviderDecision(policy,pending.prompt);
349
+ } else {
350
+ if (!suppliedResponse) return { needs_planner:true, request:pending };
351
+ if (suppliedResponse.request_id !== pending.request_id) throw new Error('planner response request_id mismatch');
352
+ if (typeof suppliedResponse.raw_text !== 'string') throw new Error('planner response raw_text missing');
353
+ response = { backend:'client_sampling',
354
+ model:typeof suppliedResponse.model === 'string' ? suppliedResponse.model.slice(0,128) : 'client-model',
355
+ raw_text:suppliedResponse.raw_text };
356
+ suppliedResponse = null;
357
+ }
358
+ let decision;
359
+ try {
360
+ decision = parsePlannerDecision(response.raw_text,policy);
361
+ validatePlanTransition(currentState.active_plan,decision.plan);
362
+ } catch (error) {
363
+ const reason = truncated(error,512);
364
+ const attempt = 1 + events.filter(event => event.type === 'planner_rejected' &&
365
+ event.payload?.planner_round === pending.planner_round).length;
366
+ const rejected = await appendEvent(ctx,events,signingKeyPath,'planner_rejected',{
367
+ request_id:pending.request_id, planner_round:pending.planner_round, mutation_epoch:pending.mutation_epoch,
368
+ backend:response.backend, model:response.model ?? 'unknown',
369
+ response_sha256:sha256Bytes(Buffer.from(response.raw_text,'utf8')), reason, attempt
370
+ });
371
+ if (attempt >= 3) {
372
+ await appendEvent(ctx,events,signingKeyPath,'goal_paused',{
373
+ reason:'planner_contract_repeated_failure', planner_round:pending.planner_round,
374
+ last_rejection_event_sha256:rejected.event_sha256
375
+ });
376
+ return { needs_planner:false, rejected:true, paused:true };
377
+ }
378
+ currentState = deriveState(goal,events);
379
+ pending = await requestPlanner(ctx,goal,events,currentState,policy,codingRuntime,signingKeyPath);
380
+ if (!pending) return null;
381
+ if (policy.planner.backend === 'client_sampling') return { needs_planner:true, request:pending };
382
+ continue;
383
+ }
384
+ const event = await appendEvent(ctx,events,signingKeyPath,'planner_decision',{
385
+ request_id:pending.request_id, planner_round:pending.planner_round, mutation_epoch:pending.mutation_epoch,
386
+ backend:response.backend, model:response.model ?? 'unknown', response_sha256:sha256Bytes(Buffer.from(response.raw_text,'utf8')),
387
+ decision
388
+ });
389
+ return { needs_planner:false, event, decision };
390
+ }
391
+ return null;
392
+ }
393
+ function repeatedDecisionCount(state, decision) {
394
+ const key = canonicalJson(decision);
395
+ let count = 0;
396
+ for (const item of [...state.decisions].reverse()) {
397
+ if (canonicalJson(item.decision) !== key) break;
398
+ count += 1;
399
+ }
400
+ return count;
401
+ }
402
+ async function executeInspect({ ctx, events, goal, decisionEvent, decision, codingRuntime, signingKeyPath }) {
403
+ const contexts = [];
404
+ for (const item of decision.reads) {
405
+ const read = await codingRuntime.fileRead({ rootId:goal.root_id, relativePath:item.path, encoding:'utf8' });
406
+ const bytes = Buffer.byteLength(read.content,'utf8');
407
+ if (bytes > item.max_bytes) throw new Error(`planner inspect '${item.path}' exceeds requested max_bytes`);
408
+ contexts.push({ path:item.path, sha256:read.sha256, bytes:read.bytes, content:read.content });
409
+ }
410
+ await appendEvent(ctx,events,signingKeyPath,'inspect_completed',{
411
+ decision_event_sha256:decisionEvent.event_sha256, contexts
412
+ });
413
+ return { status:'completed', contexts };
414
+ }
415
+
416
+ const DELEGATED_MUTATIONS = new Set(['process_start','process_action','process_terminate','observation_search_cancel']);
417
+ function assertDelegatedIdentity(events, operation) {
418
+ if (['observation_search_status','observation_search_page','observation_search_cancel'].includes(operation.kind)) {
419
+ const owned = events.some(event => event.type === 'delegated_action_completed' &&
420
+ event.payload?.operation?.kind === 'observation_search_start' && event.payload?.result?.search_id === operation.search_id);
421
+ if (!owned) throw new Error(`delegated search identity '${operation.search_id}' is stale or belongs to another goal`);
422
+ }
423
+ if (['process_read','process_status','process_action','process_terminate'].includes(operation.kind)) {
424
+ const owned = events.some(event => event.type === 'delegated_action_completed' &&
425
+ event.payload?.operation?.kind === 'process_start' && event.payload?.result?.session_id === operation.session_id);
426
+ if (!owned) throw new Error(`delegated process session '${operation.session_id}' is stale or belongs to another goal`);
427
+ }
428
+ }
429
+ async function invokeDelegatedOperation(goal, operation, runtimes) {
430
+ const { machineFsRuntime, observationRuntime, processRuntime } = runtimes;
431
+ switch (operation.kind) {
432
+ case 'machine_stat':
433
+ if (!machineFsRuntime) throw new Error('machine filesystem runtime unavailable');
434
+ return machineFsRuntime.stat({ rootId:goal.root_id, relativePath:operation.path, hash:operation.hash });
435
+ case 'machine_list':
436
+ if (!machineFsRuntime) throw new Error('machine filesystem runtime unavailable');
437
+ return machineFsRuntime.list({ rootId:goal.root_id, relativePath:operation.path, cursor:operation.cursor,
438
+ limit:operation.limit, hashFiles:operation.hash_files });
439
+ case 'machine_read':
440
+ if (!machineFsRuntime) throw new Error('machine filesystem runtime unavailable');
441
+ return machineFsRuntime.read({ rootId:goal.root_id, relativePath:operation.path, offset:operation.offset,
442
+ maxBytes:operation.max_bytes, hashFile:operation.hash });
443
+ case 'observation_search_start':
444
+ if (!observationRuntime) throw new Error('observation runtime unavailable');
445
+ return observationRuntime.searchStart({ rootId:goal.root_id, relativePath:operation.path, pattern:operation.pattern,
446
+ caseSensitive:operation.case_sensitive, maxResults:operation.max_results, maxFiles:operation.max_files,
447
+ maxBytes:operation.max_bytes, maxFileBytes:operation.max_file_bytes });
448
+ case 'observation_search_status':
449
+ if (!observationRuntime) throw new Error('observation runtime unavailable');
450
+ return observationRuntime.searchStatus({ searchId:operation.search_id });
451
+ case 'observation_search_page':
452
+ if (!observationRuntime) throw new Error('observation runtime unavailable');
453
+ return observationRuntime.searchPage({ searchId:operation.search_id, cursor:operation.cursor, limit:operation.limit });
454
+ case 'observation_search_cancel':
455
+ if (!observationRuntime) throw new Error('observation runtime unavailable');
456
+ return observationRuntime.searchCancel({ searchId:operation.search_id });
457
+ case 'observation_process_list':
458
+ if (!observationRuntime) throw new Error('observation runtime unavailable');
459
+ return observationRuntime.processList({ includeExternal:operation.include_external, cursor:operation.cursor, limit:operation.limit });
460
+ case 'observation_system_status':
461
+ if (!observationRuntime) throw new Error('observation runtime unavailable');
462
+ return observationRuntime.systemStatus();
463
+ case 'process_start':
464
+ if (!processRuntime) throw new Error('process runtime unavailable');
465
+ return processRuntime.start({ profileId:operation.profile_id, rootId:goal.root_id, cwd:operation.cwd, args:[] });
466
+ case 'process_read':
467
+ if (!processRuntime) throw new Error('process runtime unavailable');
468
+ return processRuntime.read({ sessionId:operation.session_id, offset:operation.offset, maxBytes:operation.max_bytes });
469
+ case 'process_status':
470
+ if (!processRuntime) throw new Error('process runtime unavailable');
471
+ return processRuntime.status({ sessionId:operation.session_id });
472
+ case 'process_list':
473
+ if (!processRuntime) throw new Error('process runtime unavailable');
474
+ return processRuntime.list();
475
+ case 'process_action':
476
+ if (!processRuntime) throw new Error('process runtime unavailable');
477
+ return processRuntime.action({ sessionId:operation.session_id, actionId:operation.action_id });
478
+ case 'process_terminate':
479
+ if (!processRuntime) throw new Error('process runtime unavailable');
480
+ return processRuntime.terminate({ sessionId:operation.session_id });
481
+ default: throw new Error(`unsupported delegated operation '${String(operation.kind)}'`);
482
+ }
483
+ }
484
+ async function verifyDelegatedEvidence(operation, result, runtimes, verifyKeyPath) {
485
+ if (operation.kind.startsWith('observation_') && result?.receipt_id) {
486
+ const checked = await verifyObservationReceiptFile({ policy:runtimes.observationRuntime.policy, verifyKeyPath,
487
+ receiptId:result.receipt_id });
488
+ if (!checked.ok || checked.receipt_sha256 !== result.receipt_sha256 || checked.request_sha256 !== result.request_sha256) {
489
+ throw new Error('delegated observation receipt mismatch');
490
+ }
491
+ return { kind:'observation_receipt', receipt_id:result.receipt_id, receipt_sha256:checked.receipt_sha256,
492
+ request_sha256:checked.request_sha256, result_head_sha256:checked.result_head_sha256 };
493
+ }
494
+ if (operation.kind.startsWith('process_') && operation.kind !== 'process_list') {
495
+ const sessionId = operation.session_id ?? result?.session_id ?? result?.session?.session_id;
496
+ if (sessionId && ['process_start','process_action','process_terminate'].includes(operation.kind)) {
497
+ const checked = await runtimes.processRuntime.verifyEventJournal({ sessionId });
498
+ if (!checked.ok) throw new Error('delegated process journal verification failed');
499
+ return { kind:'process_journal', session_id:sessionId, event_count:checked.event_count,
500
+ journal_head_sha256:checked.head_sha256 };
501
+ }
502
+ }
503
+ return { kind:'runtime_result', result_sha256:sha256Object(result) };
504
+ }
505
+ async function executeDelegate({ ctx, events, goal, decisionEvent, decision, policy, runtimes, assertRunAuthority,
506
+ signingKeyPath, verifyKeyPath }) {
507
+ const actionKey = `delegate-${decisionEvent.event_sha256}`;
508
+ const prior = [...events].reverse().find(event => event.type === 'delegated_action_completed' && event.payload?.action_key === actionKey);
509
+ if (prior) return { status:'completed', result:prior.payload.result, existing:true };
510
+ const started = [...events].reverse().find(event => event.type === 'delegated_action_started' && event.payload?.action_key === actionKey);
511
+ if (started) {
512
+ await appendEvent(ctx,events,signingKeyPath,'goal_paused',{ reason:'interrupted_delegated_action', action_key:actionKey,
513
+ operation_kind:decision.operation.kind });
514
+ return { status:'paused' };
515
+ }
516
+ await appendEvent(ctx,events,signingKeyPath,'delegated_action_started',{ action_key:actionKey,
517
+ decision_event_sha256:decisionEvent.event_sha256, operation:decision.operation });
518
+ try {
519
+ assertDelegatedIdentity(events,decision.operation);
520
+ if (DELEGATED_MUTATIONS.has(decision.operation.kind)) await assertRunAuthority(goal.root_id);
521
+ const result = await invokeDelegatedOperation(goal,decision.operation,runtimes);
522
+ if (Buffer.byteLength(canonicalJson(result),'utf8') > policy.limits.max_context_bytes) {
523
+ throw new Error('delegated result exceeds autonomous context bound');
524
+ }
525
+ const evidence = await verifyDelegatedEvidence(decision.operation,result,runtimes,verifyKeyPath);
526
+ await appendEvent(ctx,events,signingKeyPath,'delegated_action_completed',{ action_key:actionKey,
527
+ decision_event_sha256:decisionEvent.event_sha256, operation:decision.operation, result, evidence });
528
+ return { status:'completed', result, evidence };
529
+ } catch (error) {
530
+ await appendEvent(ctx,events,signingKeyPath,'goal_paused',{ reason:'delegated_action_failed', action_key:actionKey,
531
+ operation_kind:decision.operation.kind, detail:truncated(error) });
532
+ return { status:'paused', reason:'delegated_action_failed' };
533
+ }
534
+ }
535
+
536
+ async function runMutationProfiles({ ctx, events, goal, epoch, actionKey, policy, codingRuntime, signingKeyPath }) {
537
+ const profileIds = Object.entries(policy.profiles)
538
+ .filter(([,profile]) => profile.run_after_mutation)
539
+ .map(([id]) => id);
540
+ const results = [];
541
+ for (const profileId of profileIds) {
542
+ const result = await executeProfile({ ctx,events,goalId:goal.goal_id,actionKey:`${actionKey}:${profileId}`,
543
+ profileId,epoch,policy,codingRuntime,signingKeyPath });
544
+ results.push({ profile_id:profileId, status:result.status, observation:result.observation });
545
+ if (result.status === 'paused') break;
546
+ }
547
+ return results;
548
+ }
549
+ async function executePatch({ ctx, events, goal, state, decisionEvent, decision, nativeDiffRuntime,
550
+ policy, codingRuntime, signingKeyPath }) {
551
+ if (state.mutation_count + decision.operations.length > policy.limits.max_mutations) {
552
+ await appendEvent(ctx,events,signingKeyPath,'goal_paused',{
553
+ reason:'mutation_limit', max_mutations:policy.limits.max_mutations
554
+ });
555
+ return { status:'paused' };
556
+ }
557
+ const applicationScope = sha256Object({ schema:'deadbyte.autonomous-native-diff-scope.v1',
558
+ goal_id:goal.goal_id, decision_event_sha256:decisionEvent.event_sha256 });
559
+ const preview = await nativeDiffRuntime.preview({ rootId:goal.root_id,
560
+ operations:decision.operations, title:decision.summary, applicationScope });
561
+ const applied = await nativeDiffRuntime.apply({ diffId:preview.diff_id });
562
+ const verified = await nativeDiffRuntime.verify({ diffId:preview.diff_id });
563
+ if (!verified.ok || verified.current_state_matches !== true) {
564
+ throw new Error(`autonomous native diff verification failed: ${verified.reason ?? 'state mismatch'}`);
565
+ }
566
+ const epoch = state.mutation_epoch + 1;
567
+ await appendEvent(ctx,events,signingKeyPath,'native_diff_committed',{
568
+ decision_event_sha256:decisionEvent.event_sha256, diff_id:preview.diff_id,
569
+ diff_receipt_sha256:verified.receipt_sha256, mutation_epoch:epoch,
570
+ mutation_count:decision.operations.length, operation_count:preview.operation_count,
571
+ paths:preview.paths, coding_receipts_verified:verified.coding_receipts_verified
572
+ });
573
+ const profiles = await runMutationProfiles({ ctx,events,goal,epoch,
574
+ actionKey:`mutation-${epoch}`,policy,codingRuntime,signingKeyPath });
575
+ return { status:profiles.some(item => item.status === 'paused') ? 'paused' : 'completed',
576
+ diff_id:preview.diff_id, mutation_epoch:epoch, profiles };
577
+ }
578
+ async function runRequiredReleaseProfiles({ ctx, events, goal, state, policy, codingRuntime, signingKeyPath }) {
579
+ const requiredIds = Object.entries(policy.profiles)
580
+ .filter(([,profile]) => profile.required_for_release)
581
+ .map(([id]) => id);
582
+ const results = [];
583
+ for (const profileId of requiredIds) {
584
+ const existing = latestProfileObservation(deriveState(goal,events),profileId,state.mutation_epoch);
585
+ if (existing?.passed === true) {
586
+ results.push({ profile_id:profileId, status:'passed', observation:existing, existing:true });
587
+ continue;
588
+ }
589
+ const result = await executeProfile({ ctx,events,goalId:goal.goal_id,
590
+ actionKey:`release-${state.mutation_epoch}:${profileId}`, profileId,
591
+ epoch:state.mutation_epoch,policy,codingRuntime,signingKeyPath });
592
+ results.push({ profile_id:profileId, ...result });
593
+ if (result.status === 'paused') break;
594
+ }
595
+ return results;
596
+ }
597
+
598
+ async function collectNativeHead(state, nativeDiffRuntime, codingRuntime) {
599
+ const diffBindings = []; const head = new Map();
600
+ for (const item of state.diffs) {
601
+ const checked = await nativeDiffRuntime.verify({ diffId:item.diff_id });
602
+ if (!checked.ok || !Array.isArray(checked.final_states)) throw new Error(`release diff '${item.diff_id}' verification failed`);
603
+ diffBindings.push({ diff_id:item.diff_id, receipt_sha256:checked.receipt_sha256,
604
+ coding_receipts_verified:checked.coding_receipts_verified });
605
+ for (const finalState of checked.final_states) {
606
+ head.set(`${checked.root_id}\0${finalState.path}`, { root_id:checked.root_id,
607
+ path:finalState.path, exists:finalState.exists, sha256:finalState.sha256 });
608
+ }
609
+ }
610
+ const finalSourceStates = [...head.values()].sort((a,b) => `${a.root_id}/${a.path}`.localeCompare(`${b.root_id}/${b.path}`));
611
+ for (const expected of finalSourceStates) {
612
+ const current = await codingRuntime.fileState({ rootId:expected.root_id, relativePath:expected.path });
613
+ if (current.exists !== expected.exists || current.sha256 !== expected.sha256) {
614
+ throw new Error(`release native HEAD mismatch '${expected.path}'`);
615
+ }
616
+ }
617
+ return { diffBindings, finalSourceStates };
618
+ }
619
+
620
+ async function createReleaseReceipt({ ctx, events, goal, state, policy, nativeDiffRuntime,
621
+ codingRuntime, signingKeyPath }) {
622
+ const readiness = releaseReadiness(policy,state);
623
+ if (!readiness.ready) throw new Error('release receipt requires all required profiles passing at current mutation epoch');
624
+ const { diffBindings, finalSourceStates } = await collectNativeHead(state,nativeDiffRuntime,codingRuntime);
625
+ const body = {
626
+ schema:AUTONOMOUS_RECEIPT_SCHEMA, goal_id:goal.goal_id, goal_sha256:goal.goal_sha256,
627
+ policy_sha256:policy.policy_sha256, coding_policy_sha256:policy.coding_policy_sha256,
628
+ mutation_epoch:state.mutation_epoch, mutation_count:state.mutation_count,
629
+ planner_round:state.planner_round, event_head_sha256:state.journal_head_sha256,
630
+ required_profiles:readiness.required_profiles, native_diffs:diffBindings,
631
+ delegated_evidence:state.observations.filter(item => item.operation && item.evidence).map(item => ({ action_key:item.action_key,
632
+ decision_event_sha256:item.decision_event_sha256, operation:item.operation, evidence:item.evidence,
633
+ event_sha256:item.event_sha256 })),
634
+ final_source_states:finalSourceStates, completed_at_utc:new Date().toISOString()
635
+ };
636
+ const receiptSha = sha256Object(body);
637
+ const signingKey = await loadPrivateSigningKey(signingKeyPath);
638
+ const receipt = signEnvelope(signingKey, RECEIPT_DOMAIN, { ...body, receipt_sha256:receiptSha });
639
+ await writeFile(ctx.receiptPath, `${canonicalJson(receipt)}\n`, { flag:'wx' });
640
+ await appendEvent(ctx,events,signingKeyPath,'release_completed',{
641
+ receipt_sha256:receiptSha, mutation_epoch:state.mutation_epoch,
642
+ event_head_sha256:state.journal_head_sha256
643
+ });
644
+ return receipt;
645
+ }
646
+
647
+ async function verifyReleaseReceipt({ ctx, goal, events, policy, verifyKeyPath, nativeDiffRuntime, codingRuntime }) {
648
+ if (!await exists(ctx.receiptPath)) return { ok:false, reason:'release receipt missing' };
649
+ let receipt;
650
+ try { receipt = JSON.parse(await readFile(ctx.receiptPath,'utf8')); }
651
+ catch { return { ok:false, reason:'release receipt unreadable' }; }
652
+ const verifyKey = await loadPublicVerifyKey(verifyKeyPath);
653
+ let signed;
654
+ try { signed = verifyEnvelope(verifyKey,RECEIPT_DOMAIN,receipt,'autonomous release receipt'); }
655
+ catch (error) { return { ok:false, reason:truncated(error) }; }
656
+ const { receipt_sha256:claimed, ...body } = signed;
657
+ if (body.schema !== AUTONOMOUS_RECEIPT_SCHEMA || body.goal_id !== goal.goal_id ||
658
+ body.goal_sha256 !== goal.goal_sha256 || body.policy_sha256 !== policy.policy_sha256 ||
659
+ body.coding_policy_sha256 !== policy.coding_policy_sha256 || !SHA256_RE.test(claimed ?? '') ||
660
+ sha256Object(body) !== claimed) return { ok:false, reason:'release receipt identity/hash mismatch' };
661
+ const completion = events.at(-1);
662
+ if (completion?.type !== 'release_completed' || completion.prev_sha256 !== body.event_head_sha256 ||
663
+ completion.payload?.receipt_sha256 !== claimed || completion.payload?.event_head_sha256 !== body.event_head_sha256) {
664
+ return { ok:false, reason:'release receipt/event binding mismatch' };
665
+ }
666
+ const preCompletionState = deriveState(goal,events.slice(0,-1));
667
+ if (preCompletionState.mutation_epoch !== body.mutation_epoch ||
668
+ preCompletionState.mutation_count !== body.mutation_count ||
669
+ preCompletionState.planner_round !== body.planner_round) {
670
+ return { ok:false, reason:'release receipt state binding mismatch' };
671
+ }
672
+ const readiness = releaseReadiness(policy,preCompletionState);
673
+ if (!readiness.ready || canonicalJson(readiness.required_profiles) !== canonicalJson(body.required_profiles)) {
674
+ return { ok:false, reason:'release profile evidence mismatch' };
675
+ }
676
+ let nativeHead;
677
+ try { nativeHead = await collectNativeHead(preCompletionState,nativeDiffRuntime,codingRuntime); }
678
+ catch (error) { return { ok:false, reason:truncated(error) }; }
679
+ if (canonicalJson(nativeHead.diffBindings) !== canonicalJson(body.native_diffs ?? [])) {
680
+ return { ok:false, reason:'release native diff binding mismatch' };
681
+ }
682
+ if (canonicalJson(nativeHead.finalSourceStates) !== canonicalJson(body.final_source_states ?? [])) {
683
+ return { ok:false, reason:'release native HEAD binding mismatch' };
684
+ }
685
+ const delegatedEvidence = preCompletionState.observations.filter(item => item.operation && item.evidence).map(item => ({ action_key:item.action_key,
686
+ decision_event_sha256:item.decision_event_sha256, operation:item.operation, evidence:item.evidence,
687
+ event_sha256:item.event_sha256 }));
688
+ if (canonicalJson(delegatedEvidence) !== canonicalJson(body.delegated_evidence ?? [])) {
689
+ return { ok:false, reason:'release delegated evidence binding mismatch' };
690
+ }
691
+ const diffsVerified = nativeHead.diffBindings.length;
692
+ return { ok:true, goal_id:goal.goal_id, receipt_sha256:claimed, signature_valid:true,
693
+ mutation_epoch:body.mutation_epoch, mutation_count:body.mutation_count,
694
+ planner_round:body.planner_round, required_profiles_verified:body.required_profiles.length,
695
+ native_diffs_verified:diffsVerified, delegated_actions_verified:delegatedEvidence.length,
696
+ journal_head_sha256:completion.event_sha256 };
697
+ }
698
+
699
+ async function executeDecision({ ctx, events, goal, state, decisionEvent, policy, codingRuntime,
700
+ nativeDiffRuntime, machineFsRuntime, observationRuntime, processRuntime, assertRunAuthority,
701
+ signingKeyPath, verifyKeyPath }) {
702
+ const decision = decisionEvent.decision;
703
+ if (repeatedDecisionCount(state,decision) >= 3) {
704
+ await appendEvent(ctx,events,signingKeyPath,'goal_paused',{ reason:'no_progress_repeated_decision' });
705
+ return { status:'paused' };
706
+ }
707
+ let outcome;
708
+ const activePlan = state.active_plan;
709
+ if (decision.action === 'finish' && activePlan && !planIsComplete(activePlan)) {
710
+ await appendEvent(ctx,events,signingKeyPath,'plan_guard_blocked',{
711
+ decision_event_sha256:decisionEvent.event_sha256, action:decision.action,
712
+ reason:'plan_incomplete_blocks_finish', plan_title:activePlan.title
713
+ });
714
+ outcome = { status:'blocked', reason:'plan_incomplete_blocks_finish' };
715
+ } else if (['inspect','patch','delegate','run_profile'].includes(decision.action) && planIsComplete(activePlan)) {
716
+ await appendEvent(ctx,events,signingKeyPath,'plan_guard_blocked',{
717
+ decision_event_sha256:decisionEvent.event_sha256, action:decision.action,
718
+ reason:'plan_complete_requires_finish', plan_title:activePlan.title
719
+ });
720
+ outcome = { status:'blocked', reason:'plan_complete_requires_finish' };
721
+ } else if (decision.action === 'inspect') {
722
+ outcome = await executeInspect({ ctx,events,goal,decisionEvent,decision,codingRuntime,signingKeyPath });
723
+ } else if (decision.action === 'patch') {
724
+ await assertRunAuthority(goal.root_id);
725
+ outcome = await executePatch({ ctx,events,goal,state,decisionEvent,decision,nativeDiffRuntime,
726
+ policy,codingRuntime,signingKeyPath });
727
+ } else if (decision.action === 'delegate') {
728
+ outcome = await executeDelegate({ ctx,events,goal,decisionEvent,decision,policy,
729
+ runtimes:{ machineFsRuntime,observationRuntime,processRuntime },assertRunAuthority,signingKeyPath,verifyKeyPath });
730
+ } else if (decision.action === 'run_profile') {
731
+ await assertRunAuthority(goal.root_id);
732
+ outcome = await executeProfile({ ctx,events,goalId:goal.goal_id,
733
+ actionKey:`planner-${decisionEvent.event_sha256}`, profileId:decision.profile_id,
734
+ epoch:state.mutation_epoch,policy,codingRuntime,signingKeyPath });
735
+ } else if (decision.action === 'pause') {
736
+ await appendEvent(ctx,events,signingKeyPath,'goal_paused',{
737
+ reason:decision.reason, planner_summary:decision.summary
738
+ });
739
+ outcome = { status:'paused', reason:decision.reason };
740
+ } else if (decision.action === 'finish') {
741
+ await appendEvent(ctx,events,signingKeyPath,'finish_requested',{
742
+ decision_event_sha256:decisionEvent.event_sha256, mutation_epoch:state.mutation_epoch,
743
+ planner_summary:decision.summary
744
+ });
745
+ outcome = { status:'finish_requested' };
746
+ } else {
747
+ throw new Error(`unsupported autonomous decision '${String(decision.action)}'`);
748
+ }
749
+ await appendEvent(ctx,events,signingKeyPath,'decision_completed',{
750
+ decision_event_sha256:decisionEvent.event_sha256, action:decision.action,
751
+ outcome_status:outcome.status ?? 'completed'
752
+ });
753
+ return outcome;
754
+ }
755
+
756
+ function terminalState(state) {
757
+ return ['succeeded','cancelled'].includes(state.state);
758
+ }
759
+ function pauseState(state) { return state.state === 'paused'; }
760
+
761
+ export function createAutonomousRuntime({ policy, codingRuntime, nativeDiffRuntime, machineFsRuntime = null,
762
+ observationRuntime = null, processRuntime = null, signingKeyPath, verifyKeyPath }) {
763
+ if (!policy || !codingRuntime || !nativeDiffRuntime) throw new Error('autonomous runtime requires policy/coding/native-diff runtimes');
764
+ if (!signingKeyPath || !verifyKeyPath) throw new Error('autonomous runtime requires trust keys');
765
+ async function sessionStatus() {
766
+ const autonomous = await autonomousSessionStatus(policy);
767
+ const coding = await codingRuntime.sessionStatus();
768
+ return { status:'ok', configured:true, armed:autonomous.armed && coding.armed,
769
+ autonomous_armed:autonomous.armed, autonomous_reason:autonomous.reason,
770
+ autonomous_expires_at_utc:autonomous.expires_at_utc,
771
+ coding_armed:coding.armed, coding_reason:coding.reason,
772
+ root_ids:policy.root_ids, planner_backend:policy.planner.backend,
773
+ profile_ids:Object.keys(policy.profiles), policy_sha256:policy.policy_sha256,
774
+ coding_policy_sha256:policy.coding_policy_sha256 };
775
+ }
776
+
777
+ async function assertRunAuthority(rootId) {
778
+ const autonomous = await assertAutonomousArmed(policy,rootId);
779
+ const coding = await codingRuntime.sessionStatus();
780
+ if (!coding.armed) throw new Error(`coding plane is disarmed: ${coding.reason}`);
781
+ if (!coding.root_ids.includes(rootId)) throw new Error(`coding root '${rootId}' is outside active lease`);
782
+ return { autonomous, coding };
783
+ }
784
+
785
+ async function submit({ submissionId, rootId, title = '', goal, acceptance = '', maxIterations = null }) {
786
+ await assertRunAuthority(rootId);
787
+ const normalized = normalizeGoal(policy,{ submissionId,rootId,title,goal,acceptance,maxIterations });
788
+ const goalId = goalIdFor(policy.policy_sha256,submissionId);
789
+ const ctx = goalContext(policy,goalId);
790
+ if (await exists(ctx.dir)) {
791
+ const existing = await loadGoal(ctx,policy,verifyKeyPath);
792
+ if (existing.goal_sha256 !== normalized.goal_sha256) throw new Error('autonomous submission_id already exists with different goal');
793
+ const journal = await readEvents(ctx,verifyKeyPath);
794
+ return { status:'existing', goal_id:goalId, goal_sha256:existing.goal_sha256,
795
+ state:deriveState(existing,journal).state };
796
+ }
797
+ await mkdir(path.dirname(ctx.dir),{recursive:true});
798
+ await mkdir(ctx.dir,{recursive:false}); await mkdir(ctx.eventsDir);
799
+ const signingKey = await loadPrivateSigningKey(signingKeyPath);
800
+ const envelope = signEnvelope(signingKey,GOAL_DOMAIN,{ ...normalized, goal_id:goalId });
801
+ await writeFile(ctx.goalPath,`${canonicalJson(envelope)}\n`,{flag:'wx'});
802
+ const journal = [];
803
+ await appendEvent(ctx,journal,signingKeyPath,'goal_created',{
804
+ submission_id:submissionId, root_id:rootId, title, goal_sha256:normalized.goal_sha256,
805
+ max_iterations:normalized.max_iterations
806
+ });
807
+ return { status:'accepted', goal_id:goalId, goal_sha256:normalized.goal_sha256, state:'pending' };
808
+ }
809
+
810
+ async function status({ goalId }) {
811
+ const ctx = goalContext(policy,goalId);
812
+ const goal = await loadGoal(ctx,policy,verifyKeyPath);
813
+ const journal = await readEvents(ctx,verifyKeyPath);
814
+ const derived = deriveState(goal,journal);
815
+ return { status:'ok', goal_id:goalId, goal_sha256:goal.goal_sha256,
816
+ title:goal.title, root_id:goal.root_id, journal_verified:true, ...derived };
817
+ }
818
+
819
+ async function events({ goalId, fromSeq = 1, limit = 100 }) {
820
+ if (!Number.isInteger(fromSeq) || fromSeq < 1) throw new Error('autonomous from_seq must be >=1');
821
+ if (!Number.isInteger(limit) || limit < 1 || limit > 200) throw new Error('autonomous event limit must be in [1,200]');
822
+ const ctx = goalContext(policy,goalId); await loadGoal(ctx,policy,verifyKeyPath);
823
+ const journal = await readEvents(ctx,verifyKeyPath);
824
+ return { status:'ok', goal_id:goalId, journal_verified:true,
825
+ journal_head_sha256:journal.at(-1)?.event_sha256 ?? ZERO_HASH,
826
+ events:journal.slice(fromSeq-1,fromSeq-1+limit) };
827
+ }
828
+ async function cancel({ goalId, reason = 'operator_request' }) {
829
+ if (typeof reason !== 'string' || reason.length < 1 || reason.length > 256) throw new Error('autonomous cancel reason invalid');
830
+ const ctx = goalContext(policy,goalId);
831
+ const goal = await loadGoal(ctx,policy,verifyKeyPath);
832
+ const current = deriveState(goal,await readEvents(ctx,verifyKeyPath));
833
+ if (terminalState(current)) return { status:'terminal', goal_id:goalId, state:current.state };
834
+ const signingKey = await loadPrivateSigningKey(signingKeyPath);
835
+ const envelope = signEnvelope(signingKey,CANCEL_DOMAIN,{
836
+ schema:CANCEL_SCHEMA, goal_id:goalId, requested_at_utc:new Date().toISOString(), reason
837
+ });
838
+ try {
839
+ await writeFile(ctx.cancelPath,`${canonicalJson(envelope)}\n`,{flag:'wx'});
840
+ return { status:'requested', goal_id:goalId, state:current.state };
841
+ } catch (error) {
842
+ if (error?.code !== 'EEXIST') throw error;
843
+ return { status:'existing', goal_id:goalId, state:current.state };
844
+ }
845
+ }
846
+ async function approve({ goalId, decision = 'approve' }) {
847
+ if (!['approve','reject'].includes(decision)) throw new Error('autonomous approval decision invalid');
848
+ const ctx = goalContext(policy,goalId);
849
+ await acquireLock(ctx);
850
+ try {
851
+ const goal = await loadGoal(ctx,policy,verifyKeyPath);
852
+ const journal = await readEvents(ctx,verifyKeyPath);
853
+ const current = deriveState(goal,journal);
854
+ if (terminalState(current)) return { status:'terminal', goal_id:goalId, state:current.state };
855
+ if (!pauseState(current)) throw new Error('autonomous goal is not paused');
856
+ if (decision === 'reject') {
857
+ await appendEvent(ctx,journal,signingKeyPath,'goal_cancelled',{ reason:'resume_rejected' });
858
+ return { status:'rejected', goal_id:goalId, state:'cancelled' };
859
+ }
860
+ await appendEvent(ctx,journal,signingKeyPath,'goal_resumed',{
861
+ previous_reason:current.reason, approved_at_utc:new Date().toISOString()
862
+ });
863
+ return { status:'approved', goal_id:goalId, state:'running' };
864
+ } finally {
865
+ await releaseLock(ctx);
866
+ }
867
+ }
868
+ async function releaseGateLocked(ctx, goal, journal) {
869
+ let state = deriveState(goal,journal);
870
+ const finish = [...journal].reverse().find(event =>
871
+ event.type === 'finish_requested' && event.payload?.mutation_epoch === state.mutation_epoch);
872
+ if (!finish) return { status:'blocked', goal_id:goal.goal_id, ready:false,
873
+ reason:'finish_not_requested', mutation_epoch:state.mutation_epoch };
874
+ const actionKey = `release-gate-${state.mutation_epoch}-${finish.event_sha256}`;
875
+ if (!journal.some(event => event.type === 'release_gate_started' && event.payload?.action_key === actionKey)) {
876
+ await appendEvent(ctx,journal,signingKeyPath,'release_gate_started',{
877
+ action_key:actionKey, mutation_epoch:state.mutation_epoch
878
+ });
879
+ }
880
+ state = deriveState(goal,journal);
881
+ const profiles = await runRequiredReleaseProfiles({ ctx,events:journal,goal,state,
882
+ policy,codingRuntime,signingKeyPath });
883
+ if (profiles.some(item => item.status === 'paused')) {
884
+ return { status:'paused', goal_id:goal.goal_id, ready:false,
885
+ reason:'release_profile_interrupted', mutation_epoch:state.mutation_epoch };
886
+ }
887
+ state = deriveState(goal,journal);
888
+ const readiness = releaseReadiness(policy,state);
889
+ if (!readiness.ready) {
890
+ await appendEvent(ctx,journal,signingKeyPath,'release_gate_failed',{
891
+ action_key:actionKey, mutation_epoch:state.mutation_epoch,
892
+ required_profiles:readiness.required_profiles
893
+ });
894
+ return { status:'failed', goal_id:goal.goal_id, ready:false,
895
+ mutation_epoch:state.mutation_epoch, required_profiles:readiness.required_profiles };
896
+ }
897
+ if (!await exists(ctx.receiptPath)) {
898
+ await createReleaseReceipt({ ctx,events:journal,goal,state,policy,nativeDiffRuntime,codingRuntime,signingKeyPath });
899
+ }
900
+ const checked = await verifyReleaseReceipt({ ctx,goal,events:journal,policy,
901
+ verifyKeyPath,nativeDiffRuntime,codingRuntime });
902
+ if (!checked.ok) throw new Error(`autonomous release receipt verification failed: ${checked.reason}`);
903
+ return { status:'passed', goal_id:goal.goal_id, ready:true,
904
+ mutation_epoch:checked.mutation_epoch, receipt_sha256:checked.receipt_sha256,
905
+ required_profiles_verified:checked.required_profiles_verified,
906
+ native_diffs_verified:checked.native_diffs_verified };
907
+ }
908
+
909
+ async function releaseGate({ goalId }) {
910
+ const ctx = goalContext(policy,goalId);
911
+ const goal = await loadGoal(ctx,policy,verifyKeyPath);
912
+ await assertRunAuthority(goal.root_id);
913
+ await acquireLock(ctx);
914
+ try {
915
+ const journal = await readEvents(ctx,verifyKeyPath);
916
+ const state = deriveState(goal,journal);
917
+ if (state.state === 'succeeded') {
918
+ const checked = await verifyReleaseReceipt({ctx,goal,events:journal,policy,verifyKeyPath,nativeDiffRuntime,codingRuntime});
919
+ return checked.ok ? { status:'existing', goal_id:goalId, ready:true, receipt_sha256:checked.receipt_sha256 } :
920
+ { status:'failed', goal_id:goalId, ready:false, reason:checked.reason };
921
+ }
922
+ if (state.state === 'cancelled') return { status:'blocked', goal_id:goalId, ready:false, reason:'goal_cancelled' };
923
+ return await releaseGateLocked(ctx,goal,journal);
924
+ } finally { await releaseLock(ctx); }
925
+ }
926
+ async function run({ goalId, maxCycles = 8, plannerResponse = null }) {
927
+ if (!Number.isInteger(maxCycles) || maxCycles < 1 || maxCycles > 32) throw new Error('autonomous max_cycles must be in [1,32]');
928
+ const ctx = goalContext(policy,goalId);
929
+ const goal = await loadGoal(ctx,policy,verifyKeyPath);
930
+ await assertRunAuthority(goal.root_id);
931
+ await acquireLock(ctx);
932
+ try {
933
+ const journal = await readEvents(ctx,verifyKeyPath);
934
+ let state = deriveState(goal,journal);
935
+ if (terminalState(state)) return { status:'terminal', goal_id:goalId, ...state };
936
+ if (pauseState(state)) return { status:'paused', goal_id:goalId, ...state };
937
+ if (await consumeCancel(ctx,journal,signingKeyPath,verifyKeyPath)) {
938
+ state = deriveState(goal,journal); return { status:'cancelled', goal_id:goalId, ...state };
939
+ }
940
+ await appendEvent(ctx,journal,signingKeyPath,'goal_run_started',{ max_cycles:maxCycles });
941
+ let cycles = 0; let suppliedResponse = plannerResponse;
942
+ while (cycles < maxCycles) {
943
+ state = deriveState(goal,journal);
944
+ if (terminalState(state) || pauseState(state)) return { status:state.state, goal_id:goalId, ...state };
945
+ if (await consumeCancel(ctx,journal,signingKeyPath,verifyKeyPath)) {
946
+ state = deriveState(goal,journal); return { status:'cancelled', goal_id:goalId, ...state };
947
+ }
948
+ if (state.pending_decision) {
949
+ const outcome = await executeDecision({ ctx,events:journal,goal,state,
950
+ decisionEvent:state.pending_decision,policy,codingRuntime,nativeDiffRuntime,machineFsRuntime,
951
+ observationRuntime,processRuntime,assertRunAuthority,signingKeyPath,verifyKeyPath });
952
+ cycles += 1; state = deriveState(goal,journal);
953
+ if (outcome.status === 'paused' || pauseState(state)) return { status:'paused', goal_id:goalId, ...state };
954
+ if (outcome.status === 'finish_requested') {
955
+ const gate = await releaseGateLocked(ctx,goal,journal);
956
+ state = deriveState(goal,journal);
957
+ if (gate.status === 'passed') return { status:'completed', goal_id:goalId, release:gate, ...state };
958
+ if (gate.status === 'paused') return { status:'paused', goal_id:goalId, release:gate, ...state };
959
+ }
960
+ continue;
961
+ }
962
+ const accepted = await acceptPlannerDecision({ ctx,events:journal,goal,state,policy,codingRuntime,
963
+ signingKeyPath,plannerResponse:suppliedResponse });
964
+ suppliedResponse = null;
965
+ if (accepted?.needs_planner) {
966
+ state = deriveState(goal,journal);
967
+ return { status:'input_required', goal_id:goalId,
968
+ planner_request:{ request_id:accepted.request.request_id,
969
+ planner_round:accepted.request.planner_round,
970
+ mutation_epoch:accepted.request.mutation_epoch,
971
+ prompt:accepted.request.prompt,
972
+ prompt_sha256:accepted.request.prompt_sha256 }, ...state };
973
+ }
974
+ state = deriveState(goal,journal);
975
+ if (pauseState(state)) return { status:'paused', goal_id:goalId, ...state };
976
+ }
977
+ state = deriveState(goal,journal);
978
+ return { status:'yielded', goal_id:goalId, cycles, ...state };
979
+ } finally { await releaseLock(ctx); }
980
+ }
981
+
982
+ async function verify({ goalId }) {
983
+ const ctx = goalContext(policy,goalId);
984
+ const goal = await loadGoal(ctx,policy,verifyKeyPath);
985
+ const journal = await readEvents(ctx,verifyKeyPath);
986
+ const state = deriveState(goal,journal);
987
+ if (state.state !== 'succeeded') return { ok:false, reason:`autonomous goal state is ${state.state}` };
988
+ return verifyReleaseReceipt({ ctx,goal,events:journal,policy,verifyKeyPath,nativeDiffRuntime,codingRuntime });
989
+ }
990
+
991
+ return Object.freeze({ policy, sessionStatus, submit, run, status, events, cancel, approve,
992
+ releaseGate, verify });
993
+ }