@gpustack/loopwright 0.0.0-stage → 0.0.2

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 (477) hide show
  1. package/LICENSE +191 -0
  2. package/README.md +356 -2
  3. package/bin/loopwright.js +3 -0
  4. package/node_modules/@loopwright/agent-pi/dist/adapter-v2.d.ts +9 -0
  5. package/node_modules/@loopwright/agent-pi/dist/adapter-v2.js +122 -0
  6. package/node_modules/@loopwright/agent-pi/dist/adapter.d.ts +30 -0
  7. package/node_modules/@loopwright/agent-pi/dist/adapter.js +340 -0
  8. package/node_modules/@loopwright/agent-pi/dist/admission.d.ts +25 -0
  9. package/node_modules/@loopwright/agent-pi/dist/admission.js +65 -0
  10. package/node_modules/@loopwright/agent-pi/dist/artifacts.d.ts +15 -0
  11. package/node_modules/@loopwright/agent-pi/dist/artifacts.js +76 -0
  12. package/node_modules/@loopwright/agent-pi/dist/boundary.d.ts +18 -0
  13. package/node_modules/@loopwright/agent-pi/dist/boundary.js +113 -0
  14. package/node_modules/@loopwright/agent-pi/dist/broker-channel.d.ts +4 -0
  15. package/node_modules/@loopwright/agent-pi/dist/broker-channel.js +121 -0
  16. package/node_modules/@loopwright/agent-pi/dist/candidate.d.ts +96 -0
  17. package/node_modules/@loopwright/agent-pi/dist/candidate.js +1712 -0
  18. package/node_modules/@loopwright/agent-pi/dist/capture.d.ts +39 -0
  19. package/node_modules/@loopwright/agent-pi/dist/capture.js +146 -0
  20. package/node_modules/@loopwright/agent-pi/dist/cas.d.ts +51 -0
  21. package/node_modules/@loopwright/agent-pi/dist/cas.js +836 -0
  22. package/node_modules/@loopwright/agent-pi/dist/catalog-api.d.ts +3 -0
  23. package/node_modules/@loopwright/agent-pi/dist/catalog-api.js +2 -0
  24. package/node_modules/@loopwright/agent-pi/dist/catalog.d.ts +39 -0
  25. package/node_modules/@loopwright/agent-pi/dist/catalog.js +280 -0
  26. package/node_modules/@loopwright/agent-pi/dist/circuit-breaker-limits.d.ts +9 -0
  27. package/node_modules/@loopwright/agent-pi/dist/circuit-breaker-limits.js +12 -0
  28. package/node_modules/@loopwright/agent-pi/dist/containers.d.ts +29 -0
  29. package/node_modules/@loopwright/agent-pi/dist/containers.js +160 -0
  30. package/node_modules/@loopwright/agent-pi/dist/context.d.ts +56 -0
  31. package/node_modules/@loopwright/agent-pi/dist/context.js +351 -0
  32. package/node_modules/@loopwright/agent-pi/dist/daemon.d.ts +8 -0
  33. package/node_modules/@loopwright/agent-pi/dist/daemon.js +52 -0
  34. package/node_modules/@loopwright/agent-pi/dist/deadline.d.ts +6 -0
  35. package/node_modules/@loopwright/agent-pi/dist/deadline.js +18 -0
  36. package/node_modules/@loopwright/agent-pi/dist/decode-capture.d.ts +39 -0
  37. package/node_modules/@loopwright/agent-pi/dist/decode-capture.js +287 -0
  38. package/node_modules/@loopwright/agent-pi/dist/descriptor.d.ts +12 -0
  39. package/node_modules/@loopwright/agent-pi/dist/descriptor.js +17 -0
  40. package/node_modules/@loopwright/agent-pi/dist/docker-absence.d.ts +2 -0
  41. package/node_modules/@loopwright/agent-pi/dist/docker-absence.js +9 -0
  42. package/node_modules/@loopwright/agent-pi/dist/errors.d.ts +7 -0
  43. package/node_modules/@loopwright/agent-pi/dist/errors.js +19 -0
  44. package/node_modules/@loopwright/agent-pi/dist/event-sequence.d.ts +6 -0
  45. package/node_modules/@loopwright/agent-pi/dist/event-sequence.js +64 -0
  46. package/node_modules/@loopwright/agent-pi/dist/events.d.ts +19 -0
  47. package/node_modules/@loopwright/agent-pi/dist/events.js +132 -0
  48. package/node_modules/@loopwright/agent-pi/dist/execution-guard.d.ts +9 -0
  49. package/node_modules/@loopwright/agent-pi/dist/execution-guard.js +25 -0
  50. package/node_modules/@loopwright/agent-pi/dist/execution-lease.d.ts +24 -0
  51. package/node_modules/@loopwright/agent-pi/dist/execution-lease.js +316 -0
  52. package/node_modules/@loopwright/agent-pi/dist/execution.d.ts +32 -0
  53. package/node_modules/@loopwright/agent-pi/dist/execution.js +476 -0
  54. package/node_modules/@loopwright/agent-pi/dist/external-mcp.d.ts +87 -0
  55. package/node_modules/@loopwright/agent-pi/dist/external-mcp.js +526 -0
  56. package/node_modules/@loopwright/agent-pi/dist/factory-bootstrap.d.ts +15 -0
  57. package/node_modules/@loopwright/agent-pi/dist/factory-bootstrap.js +74 -0
  58. package/node_modules/@loopwright/agent-pi/dist/host-session.d.ts +51 -0
  59. package/node_modules/@loopwright/agent-pi/dist/host-session.js +2083 -0
  60. package/node_modules/@loopwright/agent-pi/dist/http-mcp.d.ts +32 -0
  61. package/node_modules/@loopwright/agent-pi/dist/http-mcp.js +353 -0
  62. package/node_modules/@loopwright/agent-pi/dist/index.d.ts +7 -0
  63. package/node_modules/@loopwright/agent-pi/dist/index.js +4 -0
  64. package/node_modules/@loopwright/agent-pi/dist/lifecycle.d.ts +13 -0
  65. package/node_modules/@loopwright/agent-pi/dist/lifecycle.js +11 -0
  66. package/node_modules/@loopwright/agent-pi/dist/mcp-process.d.ts +35 -0
  67. package/node_modules/@loopwright/agent-pi/dist/mcp-process.js +92 -0
  68. package/node_modules/@loopwright/agent-pi/dist/mcp-transport.d.ts +25 -0
  69. package/node_modules/@loopwright/agent-pi/dist/mcp-transport.js +63 -0
  70. package/node_modules/@loopwright/agent-pi/dist/mcp.d.ts +23 -0
  71. package/node_modules/@loopwright/agent-pi/dist/mcp.js +212 -0
  72. package/node_modules/@loopwright/agent-pi/dist/operation.d.ts +5 -0
  73. package/node_modules/@loopwright/agent-pi/dist/operation.js +28 -0
  74. package/node_modules/@loopwright/agent-pi/dist/policy-v2.d.ts +10 -0
  75. package/node_modules/@loopwright/agent-pi/dist/policy-v2.js +64 -0
  76. package/node_modules/@loopwright/agent-pi/dist/policy.d.ts +13 -0
  77. package/node_modules/@loopwright/agent-pi/dist/policy.js +260 -0
  78. package/node_modules/@loopwright/agent-pi/dist/preflight.d.ts +60 -0
  79. package/node_modules/@loopwright/agent-pi/dist/preflight.js +700 -0
  80. package/node_modules/@loopwright/agent-pi/dist/progress-summary.d.ts +1 -0
  81. package/node_modules/@loopwright/agent-pi/dist/progress-summary.js +119 -0
  82. package/node_modules/@loopwright/agent-pi/dist/protocol.d.ts +17 -0
  83. package/node_modules/@loopwright/agent-pi/dist/protocol.js +131 -0
  84. package/node_modules/@loopwright/agent-pi/dist/provider.d.ts +62 -0
  85. package/node_modules/@loopwright/agent-pi/dist/provider.js +217 -0
  86. package/node_modules/@loopwright/agent-pi/dist/receipt.d.ts +3 -0
  87. package/node_modules/@loopwright/agent-pi/dist/receipt.js +64 -0
  88. package/node_modules/@loopwright/agent-pi/dist/recovery.d.ts +6 -0
  89. package/node_modules/@loopwright/agent-pi/dist/recovery.js +188 -0
  90. package/node_modules/@loopwright/agent-pi/dist/resources.d.ts +13 -0
  91. package/node_modules/@loopwright/agent-pi/dist/resources.js +81 -0
  92. package/node_modules/@loopwright/agent-pi/dist/response.d.ts +20 -0
  93. package/node_modules/@loopwright/agent-pi/dist/response.js +259 -0
  94. package/node_modules/@loopwright/agent-pi/dist/runtime-profile.d.ts +6 -0
  95. package/node_modules/@loopwright/agent-pi/dist/runtime-profile.js +37 -0
  96. package/node_modules/@loopwright/agent-pi/dist/sdk-worker.d.ts +14 -0
  97. package/node_modules/@loopwright/agent-pi/dist/sdk-worker.js +633 -0
  98. package/node_modules/@loopwright/agent-pi/dist/sender.d.ts +46 -0
  99. package/node_modules/@loopwright/agent-pi/dist/sender.js +553 -0
  100. package/node_modules/@loopwright/agent-pi/dist/session-host.d.ts +21 -0
  101. package/node_modules/@loopwright/agent-pi/dist/session-host.js +315 -0
  102. package/node_modules/@loopwright/agent-pi/dist/snapshot-transfer.d.ts +14 -0
  103. package/node_modules/@loopwright/agent-pi/dist/snapshot-transfer.js +102 -0
  104. package/node_modules/@loopwright/agent-pi/dist/snapshot.d.ts +19 -0
  105. package/node_modules/@loopwright/agent-pi/dist/snapshot.js +121 -0
  106. package/node_modules/@loopwright/agent-pi/dist/tool-process.d.ts +32 -0
  107. package/node_modules/@loopwright/agent-pi/dist/tool-process.js +85 -0
  108. package/node_modules/@loopwright/agent-pi/dist/tool-worker.d.ts +2 -0
  109. package/node_modules/@loopwright/agent-pi/dist/tool-worker.js +105 -0
  110. package/node_modules/@loopwright/agent-pi/dist/tools.d.ts +36 -0
  111. package/node_modules/@loopwright/agent-pi/dist/tools.js +128 -0
  112. package/node_modules/@loopwright/agent-pi/dist/types-v2.d.ts +71 -0
  113. package/node_modules/@loopwright/agent-pi/dist/types-v2.js +1 -0
  114. package/node_modules/@loopwright/agent-pi/dist/types.d.ts +314 -0
  115. package/node_modules/@loopwright/agent-pi/dist/types.js +1 -0
  116. package/node_modules/@loopwright/agent-pi/dist/usage.d.ts +18 -0
  117. package/node_modules/@loopwright/agent-pi/dist/usage.js +314 -0
  118. package/node_modules/@loopwright/agent-pi/dist/workspace-mcp.d.ts +27 -0
  119. package/node_modules/@loopwright/agent-pi/dist/workspace-mcp.js +142 -0
  120. package/node_modules/@loopwright/agent-pi/package.json +24 -0
  121. package/node_modules/@loopwright/agent-pi/runtime/Dockerfile +8 -0
  122. package/node_modules/@loopwright/agent-pi/runtime/seccomp.json +1 -0
  123. package/node_modules/@loopwright/cli/dist/arguments.d.ts +19 -0
  124. package/node_modules/@loopwright/cli/dist/arguments.js +358 -0
  125. package/node_modules/@loopwright/cli/dist/closure.d.ts +93 -0
  126. package/node_modules/@loopwright/cli/dist/closure.js +230 -0
  127. package/node_modules/@loopwright/cli/dist/draft.d.ts +9 -0
  128. package/node_modules/@loopwright/cli/dist/draft.js +106 -0
  129. package/node_modules/@loopwright/cli/dist/failure-matrix.d.ts +9 -0
  130. package/node_modules/@loopwright/cli/dist/failure-matrix.js +701 -0
  131. package/node_modules/@loopwright/cli/dist/index.d.ts +6 -0
  132. package/node_modules/@loopwright/cli/dist/index.js +5 -0
  133. package/node_modules/@loopwright/cli/dist/main.d.ts +22 -0
  134. package/node_modules/@loopwright/cli/dist/main.js +1855 -0
  135. package/node_modules/@loopwright/cli/package.json +16 -0
  136. package/node_modules/@loopwright/controller/dist/acceptance.d.ts +43 -0
  137. package/node_modules/@loopwright/controller/dist/acceptance.js +446 -0
  138. package/node_modules/@loopwright/controller/dist/benchmark-gate.d.ts +273 -0
  139. package/node_modules/@loopwright/controller/dist/benchmark-gate.js +3147 -0
  140. package/node_modules/@loopwright/controller/dist/budget-observations.d.ts +25 -0
  141. package/node_modules/@loopwright/controller/dist/budget-observations.js +139 -0
  142. package/node_modules/@loopwright/controller/dist/bundle.d.ts +26 -0
  143. package/node_modules/@loopwright/controller/dist/bundle.js +64 -0
  144. package/node_modules/@loopwright/controller/dist/capture.d.ts +89 -0
  145. package/node_modules/@loopwright/controller/dist/capture.js +587 -0
  146. package/node_modules/@loopwright/controller/dist/compile.d.ts +3 -0
  147. package/node_modules/@loopwright/controller/dist/compile.js +402 -0
  148. package/node_modules/@loopwright/controller/dist/config.d.ts +22 -0
  149. package/node_modules/@loopwright/controller/dist/config.js +255 -0
  150. package/node_modules/@loopwright/controller/dist/controller.d.ts +177 -0
  151. package/node_modules/@loopwright/controller/dist/controller.js +2135 -0
  152. package/node_modules/@loopwright/controller/dist/credentials.d.ts +29 -0
  153. package/node_modules/@loopwright/controller/dist/credentials.js +189 -0
  154. package/node_modules/@loopwright/controller/dist/deadlines.d.ts +18 -0
  155. package/node_modules/@loopwright/controller/dist/deadlines.js +71 -0
  156. package/node_modules/@loopwright/controller/dist/errors.d.ts +27 -0
  157. package/node_modules/@loopwright/controller/dist/errors.js +41 -0
  158. package/node_modules/@loopwright/controller/dist/events.d.ts +52 -0
  159. package/node_modules/@loopwright/controller/dist/events.js +228 -0
  160. package/node_modules/@loopwright/controller/dist/files.d.ts +51 -0
  161. package/node_modules/@loopwright/controller/dist/files.js +386 -0
  162. package/node_modules/@loopwright/controller/dist/finalize.d.ts +25 -0
  163. package/node_modules/@loopwright/controller/dist/finalize.js +32 -0
  164. package/node_modules/@loopwright/controller/dist/gate.d.ts +84 -0
  165. package/node_modules/@loopwright/controller/dist/gate.js +640 -0
  166. package/node_modules/@loopwright/controller/dist/git-objects.d.ts +11 -0
  167. package/node_modules/@loopwright/controller/dist/git-objects.js +59 -0
  168. package/node_modules/@loopwright/controller/dist/git-reader.d.ts +17 -0
  169. package/node_modules/@loopwright/controller/dist/git-reader.js +40 -0
  170. package/node_modules/@loopwright/controller/dist/handlers.d.ts +6 -0
  171. package/node_modules/@loopwright/controller/dist/handlers.js +45 -0
  172. package/node_modules/@loopwright/controller/dist/handoff.d.ts +71 -0
  173. package/node_modules/@loopwright/controller/dist/handoff.js +554 -0
  174. package/node_modules/@loopwright/controller/dist/index.d.ts +41 -0
  175. package/node_modules/@loopwright/controller/dist/index.js +21 -0
  176. package/node_modules/@loopwright/controller/dist/inspect.d.ts +30 -0
  177. package/node_modules/@loopwright/controller/dist/inspect.js +372 -0
  178. package/node_modules/@loopwright/controller/dist/interpolation.d.ts +9 -0
  179. package/node_modules/@loopwright/controller/dist/interpolation.js +79 -0
  180. package/node_modules/@loopwright/controller/dist/ownership.d.ts +41 -0
  181. package/node_modules/@loopwright/controller/dist/ownership.js +666 -0
  182. package/node_modules/@loopwright/controller/dist/parser.d.ts +5 -0
  183. package/node_modules/@loopwright/controller/dist/parser.js +200 -0
  184. package/node_modules/@loopwright/controller/dist/progress.d.ts +41 -0
  185. package/node_modules/@loopwright/controller/dist/progress.js +904 -0
  186. package/node_modules/@loopwright/controller/dist/publication.d.ts +60 -0
  187. package/node_modules/@loopwright/controller/dist/publication.js +329 -0
  188. package/node_modules/@loopwright/controller/dist/reconcile.d.ts +26 -0
  189. package/node_modules/@loopwright/controller/dist/reconcile.js +1378 -0
  190. package/node_modules/@loopwright/controller/dist/recovery.d.ts +10 -0
  191. package/node_modules/@loopwright/controller/dist/recovery.js +315 -0
  192. package/node_modules/@loopwright/controller/dist/refusal-record.d.ts +43 -0
  193. package/node_modules/@loopwright/controller/dist/refusal-record.js +150 -0
  194. package/node_modules/@loopwright/controller/dist/registry.d.ts +6 -0
  195. package/node_modules/@loopwright/controller/dist/registry.js +374 -0
  196. package/node_modules/@loopwright/controller/dist/repair.d.ts +31 -0
  197. package/node_modules/@loopwright/controller/dist/repair.js +102 -0
  198. package/node_modules/@loopwright/controller/dist/report.d.ts +64 -0
  199. package/node_modules/@loopwright/controller/dist/report.js +596 -0
  200. package/node_modules/@loopwright/controller/dist/retained.d.ts +284 -0
  201. package/node_modules/@loopwright/controller/dist/retained.js +193 -0
  202. package/node_modules/@loopwright/controller/dist/rules.d.ts +31 -0
  203. package/node_modules/@loopwright/controller/dist/rules.js +110 -0
  204. package/node_modules/@loopwright/controller/dist/run-eval.d.ts +115 -0
  205. package/node_modules/@loopwright/controller/dist/run-eval.js +959 -0
  206. package/node_modules/@loopwright/controller/dist/scheduler.d.ts +10 -0
  207. package/node_modules/@loopwright/controller/dist/scheduler.js +41 -0
  208. package/node_modules/@loopwright/controller/dist/schema.d.ts +17 -0
  209. package/node_modules/@loopwright/controller/dist/schema.js +78 -0
  210. package/node_modules/@loopwright/controller/dist/source.d.ts +69 -0
  211. package/node_modules/@loopwright/controller/dist/source.js +872 -0
  212. package/node_modules/@loopwright/controller/dist/step.d.ts +38 -0
  213. package/node_modules/@loopwright/controller/dist/step.js +1776 -0
  214. package/node_modules/@loopwright/controller/dist/storage.d.ts +90 -0
  215. package/node_modules/@loopwright/controller/dist/storage.js +1345 -0
  216. package/node_modules/@loopwright/controller/dist/submission.d.ts +51 -0
  217. package/node_modules/@loopwright/controller/dist/submission.js +292 -0
  218. package/node_modules/@loopwright/controller/dist/types.d.ts +585 -0
  219. package/node_modules/@loopwright/controller/dist/types.js +9 -0
  220. package/node_modules/@loopwright/controller/dist/verification.d.ts +124 -0
  221. package/node_modules/@loopwright/controller/dist/verification.js +1308 -0
  222. package/node_modules/@loopwright/controller/dist/verifier-protocol.d.ts +105 -0
  223. package/node_modules/@loopwright/controller/dist/verifier-protocol.js +1312 -0
  224. package/node_modules/@loopwright/controller/dist/verifier-worker.d.ts +1 -0
  225. package/node_modules/@loopwright/controller/dist/verifier-worker.js +33 -0
  226. package/node_modules/@loopwright/controller/package.json +12 -0
  227. package/node_modules/@loopwright/core/dist/acceptance.d.ts +108 -0
  228. package/node_modules/@loopwright/core/dist/acceptance.js +327 -0
  229. package/node_modules/@loopwright/core/dist/artifacts.d.ts +63 -0
  230. package/node_modules/@loopwright/core/dist/artifacts.js +356 -0
  231. package/node_modules/@loopwright/core/dist/boundary.d.ts +21 -0
  232. package/node_modules/@loopwright/core/dist/boundary.js +484 -0
  233. package/node_modules/@loopwright/core/dist/contracts.d.ts +287 -0
  234. package/node_modules/@loopwright/core/dist/contracts.js +694 -0
  235. package/node_modules/@loopwright/core/dist/diagnostics.d.ts +21 -0
  236. package/node_modules/@loopwright/core/dist/diagnostics.js +51 -0
  237. package/node_modules/@loopwright/core/dist/evidence.d.ts +92 -0
  238. package/node_modules/@loopwright/core/dist/evidence.js +85 -0
  239. package/node_modules/@loopwright/core/dist/graph.d.ts +8 -0
  240. package/node_modules/@loopwright/core/dist/graph.js +44 -0
  241. package/node_modules/@loopwright/core/dist/identity.d.ts +162 -0
  242. package/node_modules/@loopwright/core/dist/identity.js +80 -0
  243. package/node_modules/@loopwright/core/dist/index.d.ts +30 -0
  244. package/node_modules/@loopwright/core/dist/index.js +39 -0
  245. package/node_modules/@loopwright/core/dist/limits.d.ts +99 -0
  246. package/node_modules/@loopwright/core/dist/limits.js +59 -0
  247. package/node_modules/@loopwright/core/dist/results.d.ts +161 -0
  248. package/node_modules/@loopwright/core/dist/results.js +98 -0
  249. package/node_modules/@loopwright/core/dist/scope.d.ts +13 -0
  250. package/node_modules/@loopwright/core/dist/scope.js +154 -0
  251. package/node_modules/@loopwright/core/dist/scrubber.d.ts +13 -0
  252. package/node_modules/@loopwright/core/dist/scrubber.js +63 -0
  253. package/node_modules/@loopwright/core/dist/usage.d.ts +68 -0
  254. package/node_modules/@loopwright/core/dist/usage.js +56 -0
  255. package/node_modules/@loopwright/core/package.json +12 -0
  256. package/node_modules/@loopwright/decisions/dist/benchmark.d.ts +23 -0
  257. package/node_modules/@loopwright/decisions/dist/benchmark.js +337 -0
  258. package/node_modules/@loopwright/decisions/dist/client.d.ts +74 -0
  259. package/node_modules/@loopwright/decisions/dist/client.js +292 -0
  260. package/node_modules/@loopwright/decisions/dist/index.d.ts +15 -0
  261. package/node_modules/@loopwright/decisions/dist/index.js +8 -0
  262. package/node_modules/@loopwright/decisions/dist/nodes.d.ts +63 -0
  263. package/node_modules/@loopwright/decisions/dist/nodes.js +282 -0
  264. package/node_modules/@loopwright/decisions/dist/primitives.d.ts +36 -0
  265. package/node_modules/@loopwright/decisions/dist/primitives.js +300 -0
  266. package/node_modules/@loopwright/decisions/dist/redaction.d.ts +23 -0
  267. package/node_modules/@loopwright/decisions/dist/redaction.js +146 -0
  268. package/node_modules/@loopwright/decisions/dist/router.d.ts +55 -0
  269. package/node_modules/@loopwright/decisions/dist/router.js +248 -0
  270. package/node_modules/@loopwright/decisions/dist/schema.d.ts +25 -0
  271. package/node_modules/@loopwright/decisions/dist/schema.js +536 -0
  272. package/node_modules/@loopwright/decisions/dist/types.d.ts +394 -0
  273. package/node_modules/@loopwright/decisions/dist/types.js +80 -0
  274. package/node_modules/@loopwright/decisions/package.json +12 -0
  275. package/node_modules/@loopwright/github-app/dist/action.d.ts +90 -0
  276. package/node_modules/@loopwright/github-app/dist/action.js +2429 -0
  277. package/node_modules/@loopwright/github-app/dist/config.d.ts +23 -0
  278. package/node_modules/@loopwright/github-app/dist/config.js +297 -0
  279. package/node_modules/@loopwright/github-app/dist/digests.d.ts +1 -0
  280. package/node_modules/@loopwright/github-app/dist/digests.js +1 -0
  281. package/node_modules/@loopwright/github-app/dist/index.d.ts +14 -0
  282. package/node_modules/@loopwright/github-app/dist/index.js +13 -0
  283. package/node_modules/@loopwright/github-app/dist/models-config.d.ts +1 -0
  284. package/node_modules/@loopwright/github-app/dist/models-config.js +1 -0
  285. package/node_modules/@loopwright/github-app/dist/output-format.d.ts +1 -0
  286. package/node_modules/@loopwright/github-app/dist/output-format.js +1 -0
  287. package/node_modules/@loopwright/github-app/dist/preflight.d.ts +1 -0
  288. package/node_modules/@loopwright/github-app/dist/preflight.js +1 -0
  289. package/node_modules/@loopwright/github-app/dist/publisher.d.ts +58 -0
  290. package/node_modules/@loopwright/github-app/dist/publisher.js +1368 -0
  291. package/node_modules/@loopwright/github-app/dist/qualification.d.ts +1 -0
  292. package/node_modules/@loopwright/github-app/dist/qualification.js +1 -0
  293. package/node_modules/@loopwright/github-app/dist/sandbox.d.ts +1 -0
  294. package/node_modules/@loopwright/github-app/dist/sandbox.js +1 -0
  295. package/node_modules/@loopwright/github-app/dist/schema.d.ts +1 -0
  296. package/node_modules/@loopwright/github-app/dist/schema.js +1 -0
  297. package/node_modules/@loopwright/github-app/dist/service.d.ts +52 -0
  298. package/node_modules/@loopwright/github-app/dist/service.js +1658 -0
  299. package/node_modules/@loopwright/github-app/dist/suite-pr-lookup.d.ts +90 -0
  300. package/node_modules/@loopwright/github-app/dist/suite-pr-lookup.js +392 -0
  301. package/node_modules/@loopwright/github-app/dist/taskpack.d.ts +1 -0
  302. package/node_modules/@loopwright/github-app/dist/taskpack.js +1 -0
  303. package/node_modules/@loopwright/github-app/dist/tenant-queue.d.ts +44 -0
  304. package/node_modules/@loopwright/github-app/dist/tenant-queue.js +423 -0
  305. package/node_modules/@loopwright/github-app/dist/token-broker.d.ts +50 -0
  306. package/node_modules/@loopwright/github-app/dist/token-broker.js +262 -0
  307. package/node_modules/@loopwright/github-app/dist/turnkey-memory.d.ts +35 -0
  308. package/node_modules/@loopwright/github-app/dist/turnkey-memory.js +1654 -0
  309. package/node_modules/@loopwright/github-app/dist/turnkey.d.ts +16 -0
  310. package/node_modules/@loopwright/github-app/dist/turnkey.js +34 -0
  311. package/node_modules/@loopwright/github-app/dist/types.d.ts +220 -0
  312. package/node_modules/@loopwright/github-app/dist/types.js +14 -0
  313. package/node_modules/@loopwright/github-app/dist/upstreams.d.ts +13 -0
  314. package/node_modules/@loopwright/github-app/dist/upstreams.js +65 -0
  315. package/node_modules/@loopwright/github-app/dist/webhook.d.ts +34 -0
  316. package/node_modules/@loopwright/github-app/dist/webhook.js +241 -0
  317. package/node_modules/@loopwright/github-app/dist/yaml.d.ts +1 -0
  318. package/node_modules/@loopwright/github-app/dist/yaml.js +1 -0
  319. package/node_modules/@loopwright/github-app/package.json +12 -0
  320. package/node_modules/@loopwright/hardware-runner/dist/config.d.ts +48 -0
  321. package/node_modules/@loopwright/hardware-runner/dist/config.js +719 -0
  322. package/node_modules/@loopwright/hardware-runner/dist/evaluator.d.ts +230 -0
  323. package/node_modules/@loopwright/hardware-runner/dist/evaluator.js +3178 -0
  324. package/node_modules/@loopwright/hardware-runner/dist/index.d.ts +13 -0
  325. package/node_modules/@loopwright/hardware-runner/dist/index.js +9 -0
  326. package/node_modules/@loopwright/hardware-runner/dist/provenance.d.ts +128 -0
  327. package/node_modules/@loopwright/hardware-runner/dist/provenance.js +1500 -0
  328. package/node_modules/@loopwright/hardware-runner/dist/queue.d.ts +81 -0
  329. package/node_modules/@loopwright/hardware-runner/dist/queue.js +1081 -0
  330. package/node_modules/@loopwright/hardware-runner/dist/relay-server.d.ts +13 -0
  331. package/node_modules/@loopwright/hardware-runner/dist/relay-server.js +2997 -0
  332. package/node_modules/@loopwright/hardware-runner/dist/types.d.ts +239 -0
  333. package/node_modules/@loopwright/hardware-runner/dist/types.js +12 -0
  334. package/node_modules/@loopwright/hardware-runner/dist/worker.d.ts +49 -0
  335. package/node_modules/@loopwright/hardware-runner/dist/worker.js +1646 -0
  336. package/node_modules/@loopwright/hardware-runner/package.json +12 -0
  337. package/node_modules/@loopwright/memory/dist/cas.d.ts +21 -0
  338. package/node_modules/@loopwright/memory/dist/cas.js +510 -0
  339. package/node_modules/@loopwright/memory/dist/compaction.d.ts +18 -0
  340. package/node_modules/@loopwright/memory/dist/compaction.js +110 -0
  341. package/node_modules/@loopwright/memory/dist/finalizer.d.ts +23 -0
  342. package/node_modules/@loopwright/memory/dist/finalizer.js +538 -0
  343. package/node_modules/@loopwright/memory/dist/index.d.ts +9 -0
  344. package/node_modules/@loopwright/memory/dist/index.js +8 -0
  345. package/node_modules/@loopwright/memory/dist/schema.d.ts +36 -0
  346. package/node_modules/@loopwright/memory/dist/schema.js +510 -0
  347. package/node_modules/@loopwright/memory/dist/selector.d.ts +7 -0
  348. package/node_modules/@loopwright/memory/dist/selector.js +157 -0
  349. package/node_modules/@loopwright/memory/dist/store.d.ts +51 -0
  350. package/node_modules/@loopwright/memory/dist/store.js +554 -0
  351. package/node_modules/@loopwright/memory/dist/types.d.ts +442 -0
  352. package/node_modules/@loopwright/memory/dist/types.js +8 -0
  353. package/node_modules/@loopwright/memory/dist/verifier.d.ts +5 -0
  354. package/node_modules/@loopwright/memory/dist/verifier.js +328 -0
  355. package/node_modules/@loopwright/memory/package.json +12 -0
  356. package/node_modules/@loopwright/state/dist/admission.d.ts +321 -0
  357. package/node_modules/@loopwright/state/dist/admission.js +199 -0
  358. package/node_modules/@loopwright/state/dist/boundary.d.ts +53 -0
  359. package/node_modules/@loopwright/state/dist/boundary.js +194 -0
  360. package/node_modules/@loopwright/state/dist/checkpoint.d.ts +16 -0
  361. package/node_modules/@loopwright/state/dist/checkpoint.js +84 -0
  362. package/node_modules/@loopwright/state/dist/clock.d.ts +8 -0
  363. package/node_modules/@loopwright/state/dist/clock.js +27 -0
  364. package/node_modules/@loopwright/state/dist/connection.d.ts +55 -0
  365. package/node_modules/@loopwright/state/dist/connection.js +391 -0
  366. package/node_modules/@loopwright/state/dist/errors.d.ts +13 -0
  367. package/node_modules/@loopwright/state/dist/errors.js +34 -0
  368. package/node_modules/@loopwright/state/dist/index.d.ts +3 -0
  369. package/node_modules/@loopwright/state/dist/index.js +1 -0
  370. package/node_modules/@loopwright/state/dist/journal.d.ts +119 -0
  371. package/node_modules/@loopwright/state/dist/journal.js +72 -0
  372. package/node_modules/@loopwright/state/dist/model.d.ts +40 -0
  373. package/node_modules/@loopwright/state/dist/model.js +58 -0
  374. package/node_modules/@loopwright/state/dist/ownership.d.ts +14 -0
  375. package/node_modules/@loopwright/state/dist/ownership.js +45 -0
  376. package/node_modules/@loopwright/state/dist/pages.d.ts +11 -0
  377. package/node_modules/@loopwright/state/dist/pages.js +41 -0
  378. package/node_modules/@loopwright/state/dist/receipts.d.ts +33 -0
  379. package/node_modules/@loopwright/state/dist/receipts.js +97 -0
  380. package/node_modules/@loopwright/state/dist/schema.d.ts +28 -0
  381. package/node_modules/@loopwright/state/dist/schema.js +41 -0
  382. package/node_modules/@loopwright/state/dist/settlement.d.ts +10 -0
  383. package/node_modules/@loopwright/state/dist/settlement.js +129 -0
  384. package/node_modules/@loopwright/state/dist/store.d.ts +52 -0
  385. package/node_modules/@loopwright/state/dist/store.js +100 -0
  386. package/node_modules/@loopwright/state/dist/types.d.ts +315 -0
  387. package/node_modules/@loopwright/state/dist/types.js +1 -0
  388. package/node_modules/@loopwright/state/package.json +12 -0
  389. package/node_modules/@loopwright/taskpack/dist/baseline-align.d.ts +195 -0
  390. package/node_modules/@loopwright/taskpack/dist/baseline-align.js +1847 -0
  391. package/node_modules/@loopwright/taskpack/dist/digests.d.ts +61 -0
  392. package/node_modules/@loopwright/taskpack/dist/digests.js +715 -0
  393. package/node_modules/@loopwright/taskpack/dist/index.d.ts +18 -0
  394. package/node_modules/@loopwright/taskpack/dist/index.js +17 -0
  395. package/node_modules/@loopwright/taskpack/dist/models-config.d.ts +112 -0
  396. package/node_modules/@loopwright/taskpack/dist/models-config.js +1026 -0
  397. package/node_modules/@loopwright/taskpack/dist/output-format.d.ts +28 -0
  398. package/node_modules/@loopwright/taskpack/dist/output-format.js +157 -0
  399. package/node_modules/@loopwright/taskpack/dist/preflight.d.ts +130 -0
  400. package/node_modules/@loopwright/taskpack/dist/preflight.js +1497 -0
  401. package/node_modules/@loopwright/taskpack/dist/qualification.d.ts +23 -0
  402. package/node_modules/@loopwright/taskpack/dist/qualification.js +120 -0
  403. package/node_modules/@loopwright/taskpack/dist/sandbox.d.ts +121 -0
  404. package/node_modules/@loopwright/taskpack/dist/sandbox.js +2605 -0
  405. package/node_modules/@loopwright/taskpack/dist/schema.d.ts +197 -0
  406. package/node_modules/@loopwright/taskpack/dist/schema.js +4189 -0
  407. package/node_modules/@loopwright/taskpack/dist/scrubber.d.ts +47 -0
  408. package/node_modules/@loopwright/taskpack/dist/scrubber.js +283 -0
  409. package/node_modules/@loopwright/taskpack/dist/suite.d.ts +124 -0
  410. package/node_modules/@loopwright/taskpack/dist/suite.js +3256 -0
  411. package/node_modules/@loopwright/taskpack/dist/taskpack.d.ts +154 -0
  412. package/node_modules/@loopwright/taskpack/dist/taskpack.js +3634 -0
  413. package/node_modules/@loopwright/taskpack/dist/turnkey-memory.d.ts +122 -0
  414. package/node_modules/@loopwright/taskpack/dist/turnkey-memory.js +483 -0
  415. package/node_modules/@loopwright/taskpack/dist/turnkey.d.ts +437 -0
  416. package/node_modules/@loopwright/taskpack/dist/turnkey.js +7313 -0
  417. package/node_modules/@loopwright/taskpack/dist/types.d.ts +1274 -0
  418. package/node_modules/@loopwright/taskpack/dist/types.js +99 -0
  419. package/node_modules/@loopwright/taskpack/dist/upstreams.d.ts +261 -0
  420. package/node_modules/@loopwright/taskpack/dist/upstreams.js +2242 -0
  421. package/node_modules/@loopwright/taskpack/dist/yaml.d.ts +18 -0
  422. package/node_modules/@loopwright/taskpack/dist/yaml.js +167 -0
  423. package/node_modules/@loopwright/taskpack/package.json +12 -0
  424. package/node_modules/@loopwright/taskpack-runner/dist/compile-taskpack.d.ts +137 -0
  425. package/node_modules/@loopwright/taskpack-runner/dist/compile-taskpack.js +474 -0
  426. package/node_modules/@loopwright/taskpack-runner/dist/corpus.d.ts +8 -0
  427. package/node_modules/@loopwright/taskpack-runner/dist/corpus.js +129 -0
  428. package/node_modules/@loopwright/taskpack-runner/dist/index.d.ts +13 -0
  429. package/node_modules/@loopwright/taskpack-runner/dist/index.js +7 -0
  430. package/node_modules/@loopwright/taskpack-runner/dist/intake.d.ts +149 -0
  431. package/node_modules/@loopwright/taskpack-runner/dist/intake.js +135 -0
  432. package/node_modules/@loopwright/taskpack-runner/dist/parity.d.ts +130 -0
  433. package/node_modules/@loopwright/taskpack-runner/dist/parity.js +927 -0
  434. package/node_modules/@loopwright/taskpack-runner/dist/python-bridge.d.ts +68 -0
  435. package/node_modules/@loopwright/taskpack-runner/dist/python-bridge.js +517 -0
  436. package/node_modules/@loopwright/taskpack-runner/dist/service.d.ts +149 -0
  437. package/node_modules/@loopwright/taskpack-runner/dist/service.js +1796 -0
  438. package/node_modules/@loopwright/taskpack-runner/dist/types.d.ts +29 -0
  439. package/node_modules/@loopwright/taskpack-runner/dist/types.js +11 -0
  440. package/node_modules/@loopwright/taskpack-runner/package.json +12 -0
  441. package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/README.md +77 -0
  442. package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/docs/support-records.md +57 -0
  443. package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/docs/supported-runners.md +98 -0
  444. package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/manifest.json +205 -0
  445. package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/pack/expand_matrix.sh +273 -0
  446. package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/pack/matrix.yaml +280 -0
  447. package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/pack/resolve_dockerfile.sh +24 -0
  448. package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/pyproject.toml +46 -0
  449. package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/runtime_runner/runner.py.json +5270 -0
  450. package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/tests/auto_sync/fixtures/discovery/legacy-support.md +86 -0
  451. package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/tests/auto_sync/fixtures/github/service.py +401 -0
  452. package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/tests/auto_sync/fixtures/proposals/analysis.json +95 -0
  453. package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/tests/auto_sync/fixtures/proposals/ready.json +109 -0
  454. package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/tests/auto_sync/test_assemble.py +263 -0
  455. package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/tests/auto_sync/test_check_draft.py +333 -0
  456. package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/tests/auto_sync/test_checks.py +1099 -0
  457. package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/tests/auto_sync/test_discovery.py +817 -0
  458. package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/tests/auto_sync/test_proposal.py +658 -0
  459. package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/tests/auto_sync/test_publish.py +987 -0
  460. package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/tests/auto_sync/test_summary.py +107 -0
  461. package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/tools/auto_sync/agent.py +610 -0
  462. package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/tools/auto_sync/assemble.py +84 -0
  463. package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/tools/auto_sync/check_draft.py +94 -0
  464. package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/tools/auto_sync/checks.py +1002 -0
  465. package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/tools/auto_sync/discovery.py +789 -0
  466. package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/tools/auto_sync/model.py +557 -0
  467. package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/tools/auto_sync/progress.py +174 -0
  468. package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/tools/auto_sync/prompts/analysis.md +40 -0
  469. package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/tools/auto_sync/prompts/proposal.md +65 -0
  470. package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/tools/auto_sync/prompts/repair.md +17 -0
  471. package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/tools/auto_sync/proposal.py +903 -0
  472. package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/tools/auto_sync/publish.py +997 -0
  473. package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/tools/auto_sync/summary.py +131 -0
  474. package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/tools/auto_sync/tool-versions.json +133 -0
  475. package/node_modules/package-lock.json +3021 -0
  476. package/package-lock.json +3021 -0
  477. package/package.json +52 -4
@@ -0,0 +1,68 @@
1
+ export declare const MAX_STREAM_BYTES = 1048576;
2
+ export declare const DEFAULT_TIMEOUT_MS = 60000;
3
+ export declare const FROZEN_SUITE_TIMEOUT_MS = 300000;
4
+ export declare const DEFAULT_PATH_ALLOWLIST = "/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin";
5
+ export declare const FROZEN_MODULES: readonly ["tools.auto_sync.discovery", "tools.auto_sync.proposal", "tools.auto_sync.assemble", "tools.auto_sync.check_draft", "tools.auto_sync.checks", "tools.auto_sync.publish", "tools.auto_sync.summary", "tools.auto_sync.agent", "tools.auto_sync.model", "tools.auto_sync.progress"];
6
+ export declare const SITE_GUARD_CODE = "import ipaddress\nimport socket\nimport sys\nimport _socket\n\n_original_connect = socket.socket.connect\n_original_connect_ex = socket.socket.connect_ex\n\n\ndef _is_loopback_host(host):\n if isinstance(host, (bytes, bytearray)):\n try:\n host = bytes(host).decode(\"utf-8\", \"strict\")\n except Exception:\n return False\n if not isinstance(host, str):\n return False\n normalized = host.strip(\"[]\").lower()\n if normalized == \"localhost\":\n return True\n try:\n return ipaddress.ip_address(normalized.split(\"%\")[0]).is_loopback\n except ValueError:\n return False\n\n\ndef _check_address(address, event=\"socket.connect\"):\n if isinstance(address, tuple) and len(address) >= 1:\n if not _is_loopback_host(address[0]):\n raise PermissionError(77, \"non-loopback %s blocked by the contained runner bridge: %r\" % (event, address[0]))\n elif address is not None:\n raise PermissionError(77, \"non-inet %s blocked by the contained runner bridge: %r\" % (event, address))\n\n\ndef _guard(event, args):\n if event in (\"socket.connect\", \"socket.sendto\", \"socket.sendmsg\"):\n address = args[1] if len(args) > 1 else None\n _check_address(address, event)\n elif event in (\"socket.getaddrinfo\", \"socket.gethostbyname\", \"socket.gethostbyname_ex\", \"socket.gethostbyaddr\"):\n host = args[0] if len(args) > 0 else None\n if not _is_loopback_host(host):\n raise PermissionError(77, \"non-loopback dns lookup blocked by the contained runner bridge: %r\" % (host,))\n\n\nsys.addaudithook(_guard)\n\n\ndef _loopback_only_connect(self, address, *args, **kwargs):\n _check_address(address, \"socket.connect\")\n return _original_connect(self, address, *args, **kwargs)\n\n\ndef _loopback_only_connect_ex(self, address, *args, **kwargs):\n _check_address(address, \"socket.connect_ex\")\n return _original_connect_ex(self, address, *args, **kwargs)\n\n\ndef _loopback_only_getfqdn(name=\"\"):\n candidate = name.strip() if isinstance(name, str) else name\n if candidate in (\"\", \"0.0.0.0\", \"::\") or _is_loopback_host(candidate):\n return \"localhost\"\n raise PermissionError(77, \"non-loopback dns lookup blocked by the contained runner bridge: %r\" % (name,))\n\n\nsocket.socket.connect = _loopback_only_connect\nsocket.socket.connect_ex = _loopback_only_connect_ex\nsocket.getfqdn = _loopback_only_getfqdn\n";
7
+ export interface PythonSandboxOptions {
8
+ readonly enabled: boolean;
9
+ readonly writablePaths?: readonly string[] | undefined;
10
+ readonly protectedPaths?: readonly string[] | undefined;
11
+ readonly networkMode?: 'none' | 'loopback-only' | undefined;
12
+ }
13
+ export interface PythonBridgeOptions {
14
+ readonly pythonExecutable?: string;
15
+ readonly pathAllowlist?: string;
16
+ readonly defaultTimeoutMs?: number;
17
+ readonly sandbox?: PythonSandboxOptions | undefined;
18
+ }
19
+ export interface PythonRunOptions {
20
+ readonly timeoutMs?: number;
21
+ readonly cwd?: string;
22
+ readonly stdin?: string;
23
+ readonly maxOutputBytes?: number;
24
+ readonly sandbox?: PythonSandboxOptions | undefined;
25
+ }
26
+ export interface PythonRunResult {
27
+ readonly stdout: string;
28
+ readonly stderr: string;
29
+ readonly exitCode: number;
30
+ readonly durationMs: number;
31
+ readonly timedOut: boolean;
32
+ }
33
+ export interface PythonPreflight {
34
+ readonly pythonExecutable: string;
35
+ readonly version: string;
36
+ readonly modules: readonly string[];
37
+ }
38
+ export interface FrozenUnitCheckResult {
39
+ readonly runner: 'pytest' | 'self-checks';
40
+ readonly passed: boolean;
41
+ readonly exitCode: number;
42
+ readonly summary: string;
43
+ }
44
+ export declare function buildPythonSeatbeltProfile(scratchDir: string, cwd: string | undefined, sandbox: PythonSandboxOptions, homeDirectory?: string): string;
45
+ /**
46
+ * Contained runner for frozen Python helpers: sanitized environment (private HOME, pinned git settings,
47
+ * allowlisted PATH), a sitecustomize socket guard that permits loopback only, bounded streams, and hard timeouts.
48
+ */
49
+ export declare class PythonBridge {
50
+ #private;
51
+ constructor(options?: PythonBridgeOptions);
52
+ /** Run one Python snippet under the contained environment; non-zero exits are results, not bridge faults. */
53
+ run(code: string, options?: PythonRunOptions): Promise<PythonRunResult>;
54
+ /** Spawn a resident helper (e.g. the loopback GitHub service double) under the same contained environment. */
55
+ residentSpawn(argv: readonly string[], options?: {
56
+ readonly cwd?: string;
57
+ readonly stdin?: string;
58
+ }): Promise<import('node:child_process').ChildProcess>;
59
+ /** Verify interpreter presence, version floor, and site-package prerequisites before any domain helper runs. */
60
+ preflight(): Promise<PythonPreflight>;
61
+ /** Execute the vendored frozen unit checks: full pytest when available, module self-checks on stock Python otherwise. */
62
+ runFrozenUnitChecks(options?: {
63
+ readonly corpusRoot?: string;
64
+ readonly timeoutMs?: number;
65
+ }): Promise<FrozenUnitCheckResult>;
66
+ /** Remove the private scratch tree; every later invocation refuses with PYTHON_UNAVAILABLE. */
67
+ dispose(): Promise<void>;
68
+ }
@@ -0,0 +1,517 @@
1
+ import { spawn } from 'node:child_process';
2
+ import { existsSync, realpathSync } from 'node:fs';
3
+ import { chmod, mkdir, mkdtemp, rm, writeFile } from 'node:fs/promises';
4
+ import { homedir, tmpdir } from 'node:os';
5
+ import { dirname, isAbsolute, join, resolve, sep } from 'node:path';
6
+ import { defaultCorpusRoot, verifyFrozenCorpus } from './corpus.js';
7
+ import { RunnerTaskpackError } from './types.js';
8
+ export const MAX_STREAM_BYTES = 1048576;
9
+ export const DEFAULT_TIMEOUT_MS = 60000;
10
+ export const FROZEN_SUITE_TIMEOUT_MS = 300000;
11
+ export const DEFAULT_PATH_ALLOWLIST = '/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin';
12
+ export const FROZEN_MODULES = [
13
+ 'tools.auto_sync.discovery', 'tools.auto_sync.proposal', 'tools.auto_sync.assemble', 'tools.auto_sync.check_draft',
14
+ 'tools.auto_sync.checks', 'tools.auto_sync.publish', 'tools.auto_sync.summary', 'tools.auto_sync.agent',
15
+ 'tools.auto_sync.model', 'tools.auto_sync.progress',
16
+ ];
17
+ export const SITE_GUARD_CODE = `import ipaddress
18
+ import socket
19
+ import sys
20
+ import _socket
21
+
22
+ _original_connect = socket.socket.connect
23
+ _original_connect_ex = socket.socket.connect_ex
24
+
25
+
26
+ def _is_loopback_host(host):
27
+ if isinstance(host, (bytes, bytearray)):
28
+ try:
29
+ host = bytes(host).decode("utf-8", "strict")
30
+ except Exception:
31
+ return False
32
+ if not isinstance(host, str):
33
+ return False
34
+ normalized = host.strip("[]").lower()
35
+ if normalized == "localhost":
36
+ return True
37
+ try:
38
+ return ipaddress.ip_address(normalized.split("%")[0]).is_loopback
39
+ except ValueError:
40
+ return False
41
+
42
+
43
+ def _check_address(address, event="socket.connect"):
44
+ if isinstance(address, tuple) and len(address) >= 1:
45
+ if not _is_loopback_host(address[0]):
46
+ raise PermissionError(77, "non-loopback %s blocked by the contained runner bridge: %r" % (event, address[0]))
47
+ elif address is not None:
48
+ raise PermissionError(77, "non-inet %s blocked by the contained runner bridge: %r" % (event, address))
49
+
50
+
51
+ def _guard(event, args):
52
+ if event in ("socket.connect", "socket.sendto", "socket.sendmsg"):
53
+ address = args[1] if len(args) > 1 else None
54
+ _check_address(address, event)
55
+ elif event in ("socket.getaddrinfo", "socket.gethostbyname", "socket.gethostbyname_ex", "socket.gethostbyaddr"):
56
+ host = args[0] if len(args) > 0 else None
57
+ if not _is_loopback_host(host):
58
+ raise PermissionError(77, "non-loopback dns lookup blocked by the contained runner bridge: %r" % (host,))
59
+
60
+
61
+ sys.addaudithook(_guard)
62
+
63
+
64
+ def _loopback_only_connect(self, address, *args, **kwargs):
65
+ _check_address(address, "socket.connect")
66
+ return _original_connect(self, address, *args, **kwargs)
67
+
68
+
69
+ def _loopback_only_connect_ex(self, address, *args, **kwargs):
70
+ _check_address(address, "socket.connect_ex")
71
+ return _original_connect_ex(self, address, *args, **kwargs)
72
+
73
+
74
+ def _loopback_only_getfqdn(name=""):
75
+ candidate = name.strip() if isinstance(name, str) else name
76
+ if candidate in ("", "0.0.0.0", "::") or _is_loopback_host(candidate):
77
+ return "localhost"
78
+ raise PermissionError(77, "non-loopback dns lookup blocked by the contained runner bridge: %r" % (name,))
79
+
80
+
81
+ socket.socket.connect = _loopback_only_connect
82
+ socket.socket.connect_ex = _loopback_only_connect_ex
83
+ socket.getfqdn = _loopback_only_getfqdn
84
+ `;
85
+ function pythonUnavailable(detail, cause) {
86
+ return new RunnerTaskpackError('PYTHON_UNAVAILABLE', `python interpreter prerequisite failed: ${detail}${cause instanceof Error ? ` (${cause.message})` : ''}`);
87
+ }
88
+ const PRELUDE_CODE = `import importlib.util, json, platform
89
+ print(json.dumps({"version": platform.python_version(), "modules": [name for name in ("packaging", "yaml", "requests") if importlib.util.find_spec(name) is not None]}))`;
90
+ const PYTEST_PROBE_CODE = `import importlib.util, json
91
+ print(json.dumps({"pytest": importlib.util.find_spec("pytest") is not None, "xdist": importlib.util.find_spec("xdist") is not None}))`;
92
+ const SELF_CHECK_CODE = `import importlib, json, sys
93
+ config = json.loads(sys.stdin.read())
94
+ sys.path.insert(0, config["vendorRoot"])
95
+ imported, failed = [], []
96
+ for name in config["modules"]:
97
+ try:
98
+ importlib.import_module(name)
99
+ imported.append(name)
100
+ except Exception as error:
101
+ failed.append({"module": name, "error": "%s: %s" % (type(error).__name__, error)})
102
+ print(json.dumps({"imported": imported, "failed": failed}))`;
103
+ function minorVersionAtLeast(version, major, minor) {
104
+ const parts = version.split('.').map(part => Number.parseInt(part, 10));
105
+ if (!Number.isInteger(parts[0]) || !Number.isInteger(parts[1]))
106
+ return false;
107
+ return parts[0] > major || (parts[0] === major && parts[1] >= minor);
108
+ }
109
+ const AUTO_CANDIDATES = ['python3', 'python3.11', 'python3.12', 'python3.10', 'python3.13'];
110
+ const SEATBELT_EXECUTABLE = '/usr/bin/sandbox-exec';
111
+ const BUILTIN_PROTECTED_SUBPATHS = ['.git', '.loopwright'];
112
+ const DEFAULT_DENIED_HOME_SUBPATHS = [
113
+ '.ssh', '.aws', '.gnupg', '.config/gh', '.config/gcloud',
114
+ '.kube', '.docker', '.netrc', '.npmrc', '.pypirc',
115
+ ];
116
+ function isSameOrRunnerSubpath(candidate, root) {
117
+ if (root === '/')
118
+ return true;
119
+ return candidate === root || candidate.startsWith(`${root}${sep}`);
120
+ }
121
+ function canonicalizeRunnerPath(rawPath, baseDir) {
122
+ const target = isAbsolute(rawPath) ? resolve(rawPath) : resolve(baseDir, rawPath);
123
+ if (/[\0\r\n"\\]/.test(target)) {
124
+ throw new RunnerTaskpackError('PYTHON_BOUNDARY', 'sandbox path contains forbidden characters');
125
+ }
126
+ const suffix = [];
127
+ let cursor = target;
128
+ while (true) {
129
+ if (existsSync(cursor)) {
130
+ try {
131
+ const real = realpathSync(cursor);
132
+ return suffix.length === 0 ? real : join(real, ...suffix.reverse());
133
+ }
134
+ catch {
135
+ // continue walking up on broken symlink
136
+ }
137
+ }
138
+ const parent = dirname(cursor);
139
+ if (parent === cursor)
140
+ return target;
141
+ suffix.push(cursor.slice(parent === '/' ? 1 : parent.length + 1));
142
+ cursor = parent;
143
+ }
144
+ }
145
+ export function buildPythonSeatbeltProfile(scratchDir, cwd, sandbox, homeDirectory = homedir()) {
146
+ const canonicalScratch = canonicalizeRunnerPath(scratchDir, scratchDir);
147
+ const baseDir = cwd !== undefined ? canonicalizeRunnerPath(cwd, canonicalScratch) : canonicalScratch;
148
+ const deniedReadSet = new Set();
149
+ if (typeof homeDirectory === 'string' && homeDirectory.length > 0 && isAbsolute(homeDirectory)) {
150
+ const canonicalHome = canonicalizeRunnerPath(homeDirectory, canonicalScratch);
151
+ if (!isSameOrRunnerSubpath(canonicalHome, canonicalScratch) && !isSameOrRunnerSubpath(canonicalHome, baseDir)) {
152
+ for (const subpath of DEFAULT_DENIED_HOME_SUBPATHS) {
153
+ const deniedCandidate = canonicalizeRunnerPath(join(canonicalHome, subpath), canonicalHome);
154
+ if (!isSameOrRunnerSubpath(canonicalScratch, deniedCandidate) && !isSameOrRunnerSubpath(baseDir, deniedCandidate)) {
155
+ deniedReadSet.add(deniedCandidate);
156
+ }
157
+ }
158
+ }
159
+ }
160
+ const writableSet = new Set([canonicalScratch]);
161
+ for (const entry of sandbox.writablePaths ?? []) {
162
+ writableSet.add(canonicalizeRunnerPath(entry, baseDir));
163
+ }
164
+ const protectedSet = new Set();
165
+ if (cwd !== undefined) {
166
+ for (const rel of BUILTIN_PROTECTED_SUBPATHS) {
167
+ protectedSet.add(canonicalizeRunnerPath(rel, baseDir));
168
+ }
169
+ }
170
+ for (const entry of sandbox.protectedPaths ?? []) {
171
+ protectedSet.add(canonicalizeRunnerPath(entry, baseDir));
172
+ }
173
+ const lines = [
174
+ '(version 1)',
175
+ '(allow default)',
176
+ ];
177
+ if (deniedReadSet.size > 0) {
178
+ lines.push('(deny file-read*');
179
+ for (const deniedPath of [...deniedReadSet].sort()) {
180
+ lines.push(` (subpath "${deniedPath}")`);
181
+ }
182
+ lines.push(')');
183
+ }
184
+ lines.push('(deny file-write*)', '(allow file-write*', ' (literal "/dev/null")', ' (literal "/dev/zero")', ' (literal "/dev/dtracehelper")');
185
+ for (const writablePath of [...writableSet].sort()) {
186
+ lines.push(` (subpath "${writablePath}")`);
187
+ }
188
+ lines.push(')');
189
+ if (protectedSet.size > 0) {
190
+ lines.push('(deny file-write*');
191
+ for (const protectedPath of [...protectedSet].sort()) {
192
+ lines.push(` (subpath "${protectedPath}")`);
193
+ }
194
+ lines.push(')');
195
+ }
196
+ const netMode = sandbox.networkMode ?? 'loopback-only';
197
+ if (netMode === 'none') {
198
+ lines.push('(deny network*)');
199
+ }
200
+ else {
201
+ lines.push('(deny network*)');
202
+ lines.push('(allow network-outbound (remote ip "localhost:*"))');
203
+ lines.push('(allow network-inbound (local ip "localhost:*"))');
204
+ lines.push('(allow network-bind (local ip "localhost:*"))');
205
+ }
206
+ return `${lines.join('\n')}\n`;
207
+ }
208
+ /**
209
+ * Contained runner for frozen Python helpers: sanitized environment (private HOME, pinned git settings,
210
+ * allowlisted PATH), a sitecustomize socket guard that permits loopback only, bounded streams, and hard timeouts.
211
+ */
212
+ export class PythonBridge {
213
+ #configuredExecutable;
214
+ #pathAllowlist;
215
+ #defaultTimeoutMs;
216
+ #defaultSandbox;
217
+ #interpreter = null;
218
+ #scratch = null;
219
+ #disposed = false;
220
+ constructor(options = {}) {
221
+ const configured = options.pythonExecutable ?? process.env.RUNNER_TASKPACK_PYTHON ?? null;
222
+ if (configured !== null && configured.includes('/') && !configured.startsWith('/'))
223
+ throw pythonUnavailable('configured pythonExecutable must be an absolute path or a bare PATH name');
224
+ this.#configuredExecutable = configured;
225
+ this.#pathAllowlist = options.pathAllowlist ?? DEFAULT_PATH_ALLOWLIST;
226
+ this.#defaultTimeoutMs = options.defaultTimeoutMs ?? DEFAULT_TIMEOUT_MS;
227
+ this.#defaultSandbox = options.sandbox;
228
+ }
229
+ /** Private per-bridge scratch tree holding the socket guard and serving as HOME. */
230
+ #scratchDirectory() {
231
+ if (this.#disposed)
232
+ throw pythonUnavailable('bridge has been disposed');
233
+ this.#scratch ??= (async () => {
234
+ const root = await mkdtemp(join(await (await import('node:fs/promises')).realpath(tmpdir()), 'taskpack-python-'));
235
+ await chmod(root, 0o700);
236
+ const guard = join(root, 'siteguard');
237
+ await mkdir(guard, { mode: 0o700 });
238
+ await writeFile(join(guard, 'sitecustomize.py'), SITE_GUARD_CODE, { mode: 0o600 });
239
+ return root;
240
+ })();
241
+ return this.#scratch;
242
+ }
243
+ async #environment() {
244
+ const scratch = await this.#scratchDirectory();
245
+ return {
246
+ HOME: scratch,
247
+ PATH: this.#pathAllowlist,
248
+ GIT_CONFIG_NOSYSTEM: '1',
249
+ GIT_CONFIG_GLOBAL: '/dev/null',
250
+ GIT_TERMINAL_PROMPT: '0',
251
+ GIT_ASKPASS: '/usr/bin/false',
252
+ PYTHONDONTWRITEBYTECODE: '1',
253
+ PYTHONPATH: join(scratch, 'siteguard'),
254
+ };
255
+ }
256
+ /** Resolve a bare interpreter name to validated executable files across the parent PATH and allowlist. */
257
+ async #resolveCandidates(name) {
258
+ if (name.startsWith('/'))
259
+ return (await this.#validatedExecutable(name)) ? [name] : [];
260
+ const seen = new Set();
261
+ const matches = [];
262
+ const directories = `${process.env.PATH ?? ''}:${this.#pathAllowlist}`.split(':').filter(part => part.length > 0);
263
+ for (const directory of directories) {
264
+ const candidate = join(directory, name);
265
+ if (seen.has(candidate))
266
+ continue;
267
+ seen.add(candidate);
268
+ if (await this.#validatedExecutable(candidate))
269
+ matches.push(candidate);
270
+ }
271
+ return matches;
272
+ }
273
+ /** A candidate must be a regular executable file after resolving symlinks; anything else is skipped. */
274
+ async #validatedExecutable(candidate) {
275
+ const fs = await import('node:fs/promises');
276
+ try {
277
+ const real = await fs.realpath(candidate);
278
+ const stats = await fs.stat(real);
279
+ return stats.isFile() && (stats.mode & 0o111) !== 0;
280
+ }
281
+ catch {
282
+ return false;
283
+ }
284
+ }
285
+ /** Pick and memoize the interpreter: explicit configuration is authoritative, otherwise scan candidates by preflight. */
286
+ #resolvedInterpreter() {
287
+ if (this.#disposed)
288
+ throw pythonUnavailable('bridge has been disposed');
289
+ this.#interpreter ??= (async () => {
290
+ const candidates = this.#configuredExecutable !== null ? [this.#configuredExecutable] : AUTO_CANDIDATES;
291
+ const failures = [];
292
+ const probed = new Set();
293
+ for (const candidate of candidates) {
294
+ const executables = await this.#resolveCandidates(candidate);
295
+ if (executables.length === 0) {
296
+ failures.push(`${candidate}: not found`);
297
+ continue;
298
+ }
299
+ for (const executable of executables) {
300
+ if (probed.has(executable))
301
+ continue;
302
+ probed.add(executable);
303
+ try {
304
+ const outcome = await this.#contained(executable, ['-B', '-c', PRELUDE_CODE], { timeoutMs: Math.min(this.#defaultTimeoutMs, 30000) });
305
+ if (outcome.timedOut) {
306
+ failures.push(`${executable}: probe timed out`);
307
+ continue;
308
+ }
309
+ if (outcome.exitCode !== 0) {
310
+ failures.push(`${executable}: probe exited ${outcome.exitCode}`);
311
+ continue;
312
+ }
313
+ let probe;
314
+ try {
315
+ probe = JSON.parse(outcome.stdout);
316
+ }
317
+ catch {
318
+ failures.push(`${executable}: unreadable probe output`);
319
+ continue;
320
+ }
321
+ if (typeof probe.version !== 'string' || !minorVersionAtLeast(probe.version, 3, 10)) {
322
+ failures.push(`${executable}: python >= 3.10 required, found ${String(probe.version)}`);
323
+ continue;
324
+ }
325
+ if (!Array.isArray(probe.modules)) {
326
+ failures.push(`${executable}: probe omitted module inventory`);
327
+ continue;
328
+ }
329
+ const modules = [];
330
+ for (const required of ['packaging', 'yaml', 'requests']) {
331
+ if (!probe.modules.includes(required)) {
332
+ failures.push(`${executable}: required site package ${required} is missing`);
333
+ break;
334
+ }
335
+ modules.push(required);
336
+ }
337
+ if (modules.length < 3)
338
+ continue;
339
+ return { executable, version: probe.version, modules };
340
+ }
341
+ catch (error) {
342
+ if (error instanceof RunnerTaskpackError && (error.code === 'PYTHON_BOUNDARY' || error.code === 'PYTHON_TIMEOUT')) {
343
+ failures.push(`${executable}: ${error.message}`);
344
+ continue;
345
+ }
346
+ throw error;
347
+ }
348
+ }
349
+ }
350
+ throw pythonUnavailable(`no candidate interpreter satisfies python >= 3.10 with packaging, yaml, and requests (${failures.join('; ')})`);
351
+ })();
352
+ return this.#interpreter;
353
+ }
354
+ /** One contained child; non-zero exits are normal results, infrastructure faults throw typed errors. */
355
+ async #contained(executable, argv, options) {
356
+ if (options.stdin !== undefined && Buffer.byteLength(options.stdin, 'utf8') > (options.maxOutputBytes ?? MAX_STREAM_BYTES)) {
357
+ throw new RunnerTaskpackError('PYTHON_BOUNDARY', 'python helper stdin exceeded the bounded stream size');
358
+ }
359
+ const environment = await this.#environment();
360
+ const scratch = await this.#scratchDirectory();
361
+ const activeSandbox = options.sandbox ?? this.#defaultSandbox;
362
+ const useSeatbelt = activeSandbox?.enabled === true && process.platform === 'darwin' && existsSync(SEATBELT_EXECUTABLE);
363
+ const spawnExec = useSeatbelt ? SEATBELT_EXECUTABLE : executable;
364
+ const spawnArgv = useSeatbelt
365
+ ? ['-p', buildPythonSeatbeltProfile(scratch, options.cwd, activeSandbox), '--', executable, ...argv]
366
+ : [...argv];
367
+ const timeoutMs = options.timeoutMs ?? this.#defaultTimeoutMs;
368
+ const maximum = options.maxOutputBytes ?? MAX_STREAM_BYTES;
369
+ const started = performance.now();
370
+ return await new Promise((resolve, reject) => {
371
+ const child = spawn(spawnExec, spawnArgv, { env: environment, cwd: options.cwd, stdio: ['pipe', 'pipe', 'pipe'], detached: true });
372
+ const killGroup = (signal) => {
373
+ try {
374
+ if (child.pid !== undefined)
375
+ process.kill(-child.pid, signal);
376
+ }
377
+ catch {
378
+ child.kill(signal);
379
+ }
380
+ };
381
+ const chunks = { stdout: [], stderr: [] };
382
+ const sizes = { stdout: 0, stderr: 0 };
383
+ let settled = false, timedOut = false, bounded = false;
384
+ const timer = setTimeout(() => {
385
+ timedOut = true;
386
+ killGroup('SIGTERM');
387
+ setTimeout(() => { if (!settled)
388
+ killGroup('SIGKILL'); }, 250);
389
+ }, timeoutMs);
390
+ const finish = (failure) => {
391
+ if (settled)
392
+ return;
393
+ settled = true;
394
+ clearTimeout(timer);
395
+ if (failure !== undefined)
396
+ return reject(failure);
397
+ const decode = (parts) => Buffer.concat(parts).toString('utf8');
398
+ resolve({
399
+ stdout: decode(chunks.stdout), stderr: decode(chunks.stderr),
400
+ exitCode: child.exitCode ?? -1, durationMs: Math.ceil(performance.now() - started), timedOut,
401
+ });
402
+ };
403
+ child.on('error', error => {
404
+ const failure = error;
405
+ if (failure.code === 'ENOENT' || failure.code === 'EACCES')
406
+ finish(pythonUnavailable(`interpreter ${executable} is not executable`, error));
407
+ else
408
+ finish(new RunnerTaskpackError('PYTHON_BOUNDARY', `python helper failed to start: ${failure.message}`));
409
+ });
410
+ const collect = (channel, chunk) => {
411
+ sizes[channel] += chunk.byteLength;
412
+ if (sizes[channel] > maximum) {
413
+ if (!bounded) {
414
+ bounded = true;
415
+ killGroup('SIGTERM');
416
+ setTimeout(() => { if (!settled)
417
+ killGroup('SIGKILL'); }, 250);
418
+ finish(new RunnerTaskpackError('PYTHON_BOUNDARY', 'python helper output exceeded the bounded stream size'));
419
+ }
420
+ return;
421
+ }
422
+ chunks[channel].push(chunk);
423
+ };
424
+ child.stdout.on('data', chunk => collect('stdout', chunk));
425
+ child.stderr.on('data', chunk => collect('stderr', chunk));
426
+ if (options.stdin !== undefined)
427
+ child.stdin.end(options.stdin);
428
+ else
429
+ child.stdin.end();
430
+ child.on('close', () => {
431
+ if (timedOut)
432
+ return finish(new RunnerTaskpackError('PYTHON_TIMEOUT', `python helper exceeded its ${timeoutMs}ms budget`));
433
+ if (bounded)
434
+ return;
435
+ finish();
436
+ });
437
+ });
438
+ }
439
+ /** Run one Python snippet under the contained environment; non-zero exits are results, not bridge faults. */
440
+ async run(code, options = {}) {
441
+ const { executable } = await this.#resolvedInterpreter();
442
+ return await this.#contained(executable, ['-B', '-c', code], options);
443
+ }
444
+ /** Spawn a resident helper (e.g. the loopback GitHub service double) under the same contained environment. */
445
+ async residentSpawn(argv, options = {}) {
446
+ if (this.#disposed)
447
+ throw pythonUnavailable('bridge has been disposed');
448
+ const { executable } = await this.#resolvedInterpreter();
449
+ const child = spawn(executable, ['-B', ...argv], { env: await this.#environment(), cwd: options.cwd, stdio: ['pipe', 'pipe', 'pipe'], detached: true });
450
+ if (options.stdin !== undefined)
451
+ child.stdin.end(options.stdin);
452
+ else
453
+ child.stdin.end();
454
+ return child;
455
+ }
456
+ /** Verify interpreter presence, version floor, and site-package prerequisites before any domain helper runs. */
457
+ async preflight() {
458
+ const resolved = await this.#resolvedInterpreter();
459
+ return { pythonExecutable: resolved.executable, version: resolved.version, modules: resolved.modules };
460
+ }
461
+ /** Execute the vendored frozen unit checks: full pytest when available, module self-checks on stock Python otherwise. */
462
+ async runFrozenUnitChecks(options = {}) {
463
+ const resolved = options.corpusRoot ?? defaultCorpusRoot();
464
+ if (resolved === null)
465
+ throw new RunnerTaskpackError('CORPUS_UNAVAILABLE', 'vendored frozen corpus directory is absent');
466
+ const verification = await verifyFrozenCorpus(resolved);
467
+ const root = verification.root;
468
+ const probe = await this.run(PYTEST_PROBE_CODE, { timeoutMs: Math.min(this.#defaultTimeoutMs, 30000) });
469
+ let hasPytest = false;
470
+ let hasXdist = false;
471
+ if (probe.exitCode === 0) {
472
+ try {
473
+ const parsed = JSON.parse(probe.stdout);
474
+ hasPytest = parsed.pytest === true;
475
+ hasXdist = parsed.xdist === true;
476
+ }
477
+ catch {
478
+ hasPytest = false;
479
+ }
480
+ }
481
+ if (hasPytest) {
482
+ const { executable } = await this.#resolvedInterpreter();
483
+ const xdistArgs = hasXdist ? ['-n', 'auto'] : [];
484
+ const outcome = await this.#contained(executable, ['-B', '-m', 'pytest', join(root, 'tests', 'auto_sync'), '-q', '-p', 'no:cacheprovider', '--color', 'no', ...xdistArgs], { cwd: root, timeoutMs: options.timeoutMs ?? FROZEN_SUITE_TIMEOUT_MS });
485
+ return { runner: 'pytest', passed: !outcome.timedOut && outcome.exitCode === 0, exitCode: outcome.timedOut ? -1 : outcome.exitCode, summary: (outcome.stdout.trim().split('\n').at(-1) ?? outcome.stderr.trim().split('\n').at(-1) ?? '').slice(0, 256) };
486
+ }
487
+ const { executable } = await this.#resolvedInterpreter();
488
+ const outcome = await this.#contained(executable, ['-B', '-c', SELF_CHECK_CODE], {
489
+ timeoutMs: options.timeoutMs ?? this.#defaultTimeoutMs,
490
+ stdin: JSON.stringify({ vendorRoot: root, modules: FROZEN_MODULES }),
491
+ });
492
+ if (outcome.timedOut)
493
+ throw new RunnerTaskpackError('PYTHON_TIMEOUT', `frozen self-check exceeded its ${options.timeoutMs ?? this.#defaultTimeoutMs}ms budget`);
494
+ if (outcome.exitCode !== 0)
495
+ return { runner: 'self-checks', passed: false, exitCode: outcome.exitCode, summary: outcome.stderr.slice(0, 256) };
496
+ let report;
497
+ try {
498
+ report = JSON.parse(outcome.stdout);
499
+ }
500
+ catch {
501
+ return { runner: 'self-checks', passed: false, exitCode: outcome.exitCode, summary: 'self-check produced unreadable output' };
502
+ }
503
+ const imported = Array.isArray(report.imported) ? report.imported.length : 0;
504
+ const failed = Array.isArray(report.failed) ? report.failed : [];
505
+ const detail = JSON.stringify(failed).slice(0, 256);
506
+ return { runner: 'self-checks', passed: imported === FROZEN_MODULES.length && failed.length === 0, exitCode: outcome.exitCode, summary: failed.length === 0 ? `imported ${imported}/${FROZEN_MODULES.length} frozen modules` : detail };
507
+ }
508
+ /** Remove the private scratch tree; every later invocation refuses with PYTHON_UNAVAILABLE. */
509
+ async dispose() {
510
+ this.#disposed = true;
511
+ if (this.#scratch === null)
512
+ return;
513
+ const scratch = await this.#scratch;
514
+ this.#scratch = null;
515
+ await rm(scratch, { recursive: true, force: true });
516
+ }
517
+ }