self-bench 0.3.6 → 0.3.8

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 (1126) hide show
  1. package/.dockerignore +11 -1
  2. package/Dockerfile +9 -9
  3. package/Dockerfile.sandbox +5 -4
  4. package/README.md +27 -12
  5. package/bun.lock +462 -95
  6. package/compose.yaml +64 -20
  7. package/dist/agent-feed.d.ts +8 -0
  8. package/dist/agent-feed.d.ts.map +1 -0
  9. package/dist/agent-feed.js +56 -0
  10. package/dist/agent-feed.js.map +1 -0
  11. package/dist/api/http.d.ts +18 -0
  12. package/dist/api/http.d.ts.map +1 -0
  13. package/dist/api/http.js +111 -0
  14. package/dist/api/http.js.map +1 -0
  15. package/dist/api/run-request.d.ts +37 -0
  16. package/dist/api/run-request.d.ts.map +1 -0
  17. package/dist/api/run-request.js +59 -0
  18. package/dist/api/run-request.js.map +1 -0
  19. package/dist/api/status.d.ts +4 -0
  20. package/dist/api/status.d.ts.map +1 -0
  21. package/dist/api/status.js +36 -0
  22. package/dist/api/status.js.map +1 -0
  23. package/dist/api/viewer-routes.d.ts +9 -0
  24. package/dist/api/viewer-routes.d.ts.map +1 -0
  25. package/dist/api/viewer-routes.js +98 -0
  26. package/dist/api/viewer-routes.js.map +1 -0
  27. package/dist/api-main.js +5 -1
  28. package/dist/api-main.js.map +1 -1
  29. package/dist/api.d.ts +7 -25
  30. package/dist/api.d.ts.map +1 -1
  31. package/dist/api.js +80 -148
  32. package/dist/api.js.map +1 -1
  33. package/dist/archive.d.ts +14 -0
  34. package/dist/archive.d.ts.map +1 -0
  35. package/dist/archive.js +114 -0
  36. package/dist/archive.js.map +1 -0
  37. package/dist/artifacts/common.d.ts +15 -0
  38. package/dist/artifacts/common.d.ts.map +1 -0
  39. package/dist/artifacts/common.js +58 -0
  40. package/dist/artifacts/common.js.map +1 -0
  41. package/dist/artifacts/gcs.d.ts +18 -0
  42. package/dist/artifacts/gcs.d.ts.map +1 -0
  43. package/dist/artifacts/gcs.js +178 -0
  44. package/dist/artifacts/gcs.js.map +1 -0
  45. package/dist/artifacts/local.d.ts +17 -0
  46. package/dist/artifacts/local.d.ts.map +1 -0
  47. package/dist/artifacts/local.js +205 -0
  48. package/dist/artifacts/local.js.map +1 -0
  49. package/dist/artifacts/types.d.ts +18 -0
  50. package/dist/artifacts/types.d.ts.map +1 -0
  51. package/dist/artifacts/types.js +2 -0
  52. package/dist/artifacts/types.js.map +1 -0
  53. package/dist/artifacts.d.ts +5 -28
  54. package/dist/artifacts.d.ts.map +1 -1
  55. package/dist/artifacts.js +5 -302
  56. package/dist/artifacts.js.map +1 -1
  57. package/dist/audit.d.ts.map +1 -1
  58. package/dist/audit.js +8 -2
  59. package/dist/audit.js.map +1 -1
  60. package/dist/auth/api-key-routes.d.ts +17 -0
  61. package/dist/auth/api-key-routes.d.ts.map +1 -0
  62. package/dist/auth/api-key-routes.js +57 -0
  63. package/dist/auth/api-key-routes.js.map +1 -0
  64. package/dist/auth/api-keys.d.ts +47 -0
  65. package/dist/auth/api-keys.d.ts.map +1 -0
  66. package/dist/auth/api-keys.js +102 -0
  67. package/dist/auth/api-keys.js.map +1 -0
  68. package/dist/auth/config.d.ts +17 -0
  69. package/dist/auth/config.d.ts.map +1 -0
  70. package/dist/auth/config.js +38 -0
  71. package/dist/auth/config.js.map +1 -0
  72. package/dist/auth/cookies.d.ts +12 -0
  73. package/dist/auth/cookies.d.ts.map +1 -0
  74. package/dist/auth/cookies.js +45 -0
  75. package/dist/auth/cookies.js.map +1 -0
  76. package/dist/auth/crypto.d.ts +19 -0
  77. package/dist/auth/crypto.d.ts.map +1 -0
  78. package/dist/auth/crypto.js +48 -0
  79. package/dist/auth/crypto.js.map +1 -0
  80. package/dist/auth/github.d.ts +37 -0
  81. package/dist/auth/github.d.ts.map +1 -0
  82. package/dist/auth/github.js +127 -0
  83. package/dist/auth/github.js.map +1 -0
  84. package/dist/auth/routes.d.ts +41 -0
  85. package/dist/auth/routes.d.ts.map +1 -0
  86. package/dist/auth/routes.js +153 -0
  87. package/dist/auth/routes.js.map +1 -0
  88. package/dist/auth/session-expired.d.ts +4 -0
  89. package/dist/auth/session-expired.d.ts.map +1 -0
  90. package/dist/auth/session-expired.js +17 -0
  91. package/dist/auth/session-expired.js.map +1 -0
  92. package/dist/auth/session.d.ts +23 -0
  93. package/dist/auth/session.d.ts.map +1 -0
  94. package/dist/auth/session.js +56 -0
  95. package/dist/auth/session.js.map +1 -0
  96. package/dist/auth/users.d.ts +49 -0
  97. package/dist/auth/users.d.ts.map +1 -0
  98. package/dist/auth/users.js +125 -0
  99. package/dist/auth/users.js.map +1 -0
  100. package/dist/build-metadata.js +1 -1
  101. package/dist/cli/api-client.d.ts +8 -0
  102. package/dist/cli/api-client.d.ts.map +1 -0
  103. package/dist/cli/api-client.js +71 -0
  104. package/dist/cli/api-client.js.map +1 -0
  105. package/dist/cli/associate.d.ts +2 -0
  106. package/dist/cli/associate.d.ts.map +1 -0
  107. package/dist/cli/associate.js +51 -0
  108. package/dist/cli/associate.js.map +1 -0
  109. package/dist/cli/help.d.ts +2 -0
  110. package/dist/cli/help.d.ts.map +1 -0
  111. package/dist/cli/help.js +52 -0
  112. package/dist/cli/help.js.map +1 -0
  113. package/dist/cli/main.d.ts +2 -0
  114. package/dist/cli/main.d.ts.map +1 -0
  115. package/dist/cli/main.js +55 -0
  116. package/dist/cli/main.js.map +1 -0
  117. package/dist/cli/replay.d.ts +3 -0
  118. package/dist/cli/replay.d.ts.map +1 -0
  119. package/dist/cli/replay.js +59 -0
  120. package/dist/cli/replay.js.map +1 -0
  121. package/dist/cli/repository.d.ts +6 -0
  122. package/dist/cli/repository.d.ts.map +1 -0
  123. package/dist/cli/repository.js +36 -0
  124. package/dist/cli/repository.js.map +1 -0
  125. package/dist/cli/run.d.ts +2 -0
  126. package/dist/cli/run.d.ts.map +1 -0
  127. package/dist/cli/run.js +93 -0
  128. package/dist/cli/run.js.map +1 -0
  129. package/dist/cli/stack-environment.d.ts +26 -0
  130. package/dist/cli/stack-environment.d.ts.map +1 -0
  131. package/dist/cli/stack-environment.js +86 -0
  132. package/dist/cli/stack-environment.js.map +1 -0
  133. package/dist/cli/stack.d.ts +6 -0
  134. package/dist/cli/stack.d.ts.map +1 -0
  135. package/dist/cli/stack.js +131 -0
  136. package/dist/cli/stack.js.map +1 -0
  137. package/dist/cli/values.d.ts +8 -0
  138. package/dist/cli/values.d.ts.map +1 -0
  139. package/dist/cli/values.js +30 -0
  140. package/dist/cli/values.js.map +1 -0
  141. package/dist/cli/view.d.ts +2 -0
  142. package/dist/cli/view.d.ts.map +1 -0
  143. package/dist/cli/view.js +40 -0
  144. package/dist/cli/view.js.map +1 -0
  145. package/dist/cli.js +2 -429
  146. package/dist/cli.js.map +1 -1
  147. package/dist/config.d.ts +16 -2
  148. package/dist/config.d.ts.map +1 -1
  149. package/dist/config.js +60 -22
  150. package/dist/config.js.map +1 -1
  151. package/dist/contracts/common.d.ts +22 -0
  152. package/dist/contracts/common.d.ts.map +1 -0
  153. package/dist/contracts/common.js +29 -0
  154. package/dist/contracts/common.js.map +1 -0
  155. package/dist/contracts/results.d.ts +66 -0
  156. package/dist/contracts/results.d.ts.map +1 -0
  157. package/dist/contracts/results.js +2 -0
  158. package/dist/contracts/results.js.map +1 -0
  159. package/dist/contracts/run.d.ts +145 -0
  160. package/dist/contracts/run.d.ts.map +1 -0
  161. package/dist/contracts/run.js +74 -0
  162. package/dist/contracts/run.js.map +1 -0
  163. package/dist/contracts/task.d.ts +232 -0
  164. package/dist/contracts/task.d.ts.map +1 -0
  165. package/dist/contracts/task.js +198 -0
  166. package/dist/contracts/task.js.map +1 -0
  167. package/dist/contracts/verify.d.ts +331 -0
  168. package/dist/contracts/verify.d.ts.map +1 -0
  169. package/dist/contracts/verify.js +84 -0
  170. package/dist/contracts/verify.js.map +1 -0
  171. package/dist/contracts.d.ts +5 -243
  172. package/dist/contracts.d.ts.map +1 -1
  173. package/dist/contracts.js +5 -128
  174. package/dist/contracts.js.map +1 -1
  175. package/dist/db/client.d.ts +12 -0
  176. package/dist/db/client.d.ts.map +1 -0
  177. package/dist/db/client.js +16 -0
  178. package/dist/db/client.js.map +1 -0
  179. package/dist/db/schema.d.ts +1256 -0
  180. package/dist/db/schema.d.ts.map +1 -0
  181. package/dist/db/schema.js +128 -0
  182. package/dist/db/schema.js.map +1 -0
  183. package/dist/environment.d.ts +9 -0
  184. package/dist/environment.d.ts.map +1 -0
  185. package/dist/environment.js +101 -0
  186. package/dist/environment.js.map +1 -0
  187. package/dist/evaluation/account.d.ts +30 -0
  188. package/dist/evaluation/account.d.ts.map +1 -0
  189. package/dist/evaluation/account.js +34 -0
  190. package/dist/evaluation/account.js.map +1 -0
  191. package/dist/evaluation/activities.d.ts +9 -0
  192. package/dist/evaluation/activities.d.ts.map +1 -0
  193. package/dist/evaluation/activities.js +40 -0
  194. package/dist/evaluation/activities.js.map +1 -0
  195. package/dist/evaluation/catalog-pricing.d.ts +3 -0
  196. package/dist/evaluation/catalog-pricing.d.ts.map +1 -0
  197. package/dist/evaluation/catalog-pricing.js +37 -0
  198. package/dist/evaluation/catalog-pricing.js.map +1 -0
  199. package/dist/evaluation/catalog.d.ts +17 -0
  200. package/dist/evaluation/catalog.d.ts.map +1 -0
  201. package/dist/evaluation/catalog.js +126 -0
  202. package/dist/evaluation/catalog.js.map +1 -0
  203. package/dist/evaluation/codex-login-process.d.ts +12 -0
  204. package/dist/evaluation/codex-login-process.d.ts.map +1 -0
  205. package/dist/evaluation/codex-login-process.js +121 -0
  206. package/dist/evaluation/codex-login-process.js.map +1 -0
  207. package/dist/evaluation/codex-login-routes.d.ts +5 -0
  208. package/dist/evaluation/codex-login-routes.d.ts.map +1 -0
  209. package/dist/evaluation/codex-login-routes.js +55 -0
  210. package/dist/evaluation/codex-login-routes.js.map +1 -0
  211. package/dist/evaluation/codex-login.d.ts +42 -0
  212. package/dist/evaluation/codex-login.d.ts.map +1 -0
  213. package/dist/evaluation/codex-login.js +143 -0
  214. package/dist/evaluation/codex-login.js.map +1 -0
  215. package/dist/evaluation/comparisons.d.ts +65 -0
  216. package/dist/evaluation/comparisons.d.ts.map +1 -0
  217. package/dist/evaluation/comparisons.js +161 -0
  218. package/dist/evaluation/comparisons.js.map +1 -0
  219. package/dist/evaluation/config.d.ts +43 -0
  220. package/dist/evaluation/config.d.ts.map +1 -0
  221. package/dist/evaluation/config.js +116 -0
  222. package/dist/evaluation/config.js.map +1 -0
  223. package/dist/evaluation/cost.d.ts +3 -0
  224. package/dist/evaluation/cost.d.ts.map +1 -0
  225. package/dist/evaluation/cost.js +95 -0
  226. package/dist/evaluation/cost.js.map +1 -0
  227. package/dist/evaluation/credential-execution.d.ts +10 -0
  228. package/dist/evaluation/credential-execution.d.ts.map +1 -0
  229. package/dist/evaluation/credential-execution.js +65 -0
  230. package/dist/evaluation/credential-execution.js.map +1 -0
  231. package/dist/evaluation/credentials.d.ts +40 -0
  232. package/dist/evaluation/credentials.d.ts.map +1 -0
  233. package/dist/evaluation/credentials.js +146 -0
  234. package/dist/evaluation/credentials.js.map +1 -0
  235. package/dist/evaluation/encrypted-records.d.ts +15 -0
  236. package/dist/evaluation/encrypted-records.d.ts.map +1 -0
  237. package/dist/evaluation/encrypted-records.js +57 -0
  238. package/dist/evaluation/encrypted-records.js.map +1 -0
  239. package/dist/evaluation/gateway-execution.d.ts +18 -0
  240. package/dist/evaluation/gateway-execution.d.ts.map +1 -0
  241. package/dist/evaluation/gateway-execution.js +38 -0
  242. package/dist/evaluation/gateway-execution.js.map +1 -0
  243. package/dist/evaluation/harbor-cost.d.ts +3 -0
  244. package/dist/evaluation/harbor-cost.d.ts.map +1 -0
  245. package/dist/evaluation/harbor-cost.js +39 -0
  246. package/dist/evaluation/harbor-cost.js.map +1 -0
  247. package/dist/evaluation/harbor_e2b.py +20 -0
  248. package/dist/evaluation/harbor_gateway.py +22 -0
  249. package/dist/evaluation/harnesses.d.ts +8 -0
  250. package/dist/evaluation/harnesses.d.ts.map +1 -0
  251. package/dist/evaluation/harnesses.js +10 -0
  252. package/dist/evaluation/harnesses.js.map +1 -0
  253. package/dist/evaluation/model-options.d.ts +9 -0
  254. package/dist/evaluation/model-options.d.ts.map +1 -0
  255. package/dist/evaluation/model-options.js +81 -0
  256. package/dist/evaluation/model-options.js.map +1 -0
  257. package/dist/evaluation/org-credential-routes.d.ts +5 -0
  258. package/dist/evaluation/org-credential-routes.d.ts.map +1 -0
  259. package/dist/evaluation/org-credential-routes.js +56 -0
  260. package/dist/evaluation/org-credential-routes.js.map +1 -0
  261. package/dist/evaluation/org-records.d.ts +4 -0
  262. package/dist/evaluation/org-records.d.ts.map +1 -0
  263. package/dist/evaluation/org-records.js +14 -0
  264. package/dist/evaluation/org-records.js.map +1 -0
  265. package/dist/evaluation/output.d.ts +9 -0
  266. package/dist/evaluation/output.d.ts.map +1 -0
  267. package/dist/evaluation/output.js +171 -0
  268. package/dist/evaluation/output.js.map +1 -0
  269. package/dist/evaluation/platform-routes.d.ts +5 -0
  270. package/dist/evaluation/platform-routes.d.ts.map +1 -0
  271. package/dist/evaluation/platform-routes.js +123 -0
  272. package/dist/evaluation/platform-routes.js.map +1 -0
  273. package/dist/evaluation/profile-routes.d.ts +16 -0
  274. package/dist/evaluation/profile-routes.d.ts.map +1 -0
  275. package/dist/evaluation/profile-routes.js +47 -0
  276. package/dist/evaluation/profile-routes.js.map +1 -0
  277. package/dist/evaluation/profiles.d.ts +48 -0
  278. package/dist/evaluation/profiles.d.ts.map +1 -0
  279. package/dist/evaluation/profiles.js +134 -0
  280. package/dist/evaluation/profiles.js.map +1 -0
  281. package/dist/evaluation/providers.d.ts +11 -0
  282. package/dist/evaluation/providers.d.ts.map +1 -0
  283. package/dist/evaluation/providers.js +30 -0
  284. package/dist/evaluation/providers.js.map +1 -0
  285. package/dist/evaluation/routes.d.ts +23 -0
  286. package/dist/evaluation/routes.d.ts.map +1 -0
  287. package/dist/evaluation/routes.js +212 -0
  288. package/dist/evaluation/routes.js.map +1 -0
  289. package/dist/evaluation/runner.d.ts +16 -0
  290. package/dist/evaluation/runner.d.ts.map +1 -0
  291. package/dist/evaluation/runner.js +241 -0
  292. package/dist/evaluation/runner.js.map +1 -0
  293. package/dist/evaluation/store.d.ts +8 -0
  294. package/dist/evaluation/store.d.ts.map +1 -0
  295. package/dist/evaluation/store.js +60 -0
  296. package/dist/evaluation/store.js.map +1 -0
  297. package/dist/evaluation/types.d.ts +98 -0
  298. package/dist/evaluation/types.d.ts.map +1 -0
  299. package/dist/evaluation/types.js +2 -0
  300. package/dist/evaluation/types.js.map +1 -0
  301. package/dist/evaluation/worker-main.d.ts +2 -0
  302. package/dist/evaluation/worker-main.d.ts.map +1 -0
  303. package/dist/evaluation/worker-main.js +26 -0
  304. package/dist/evaluation/worker-main.js.map +1 -0
  305. package/dist/evaluation/worker-records.d.ts +5 -0
  306. package/dist/evaluation/worker-records.d.ts.map +1 -0
  307. package/dist/evaluation/worker-records.js +11 -0
  308. package/dist/evaluation/worker-records.js.map +1 -0
  309. package/dist/evaluation/workflow.d.ts +3 -0
  310. package/dist/evaluation/workflow.d.ts.map +1 -0
  311. package/dist/evaluation/workflow.js +20 -0
  312. package/dist/evaluation/workflow.js.map +1 -0
  313. package/dist/execution-environment.d.ts +3 -0
  314. package/dist/execution-environment.d.ts.map +1 -0
  315. package/dist/execution-environment.js +9 -0
  316. package/dist/execution-environment.js.map +1 -0
  317. package/dist/extension-authoring.bundle.js +347 -0
  318. package/dist/extension-verifier.bundle.js +73 -0
  319. package/dist/extensions/authoring.d.ts.map +1 -1
  320. package/dist/extensions/authoring.js +70 -59
  321. package/dist/extensions/authoring.js.map +1 -1
  322. package/dist/extensions/shared/deliverable.d.ts +33 -0
  323. package/dist/extensions/shared/deliverable.d.ts.map +1 -0
  324. package/dist/extensions/shared/deliverable.js +123 -0
  325. package/dist/extensions/shared/deliverable.js.map +1 -0
  326. package/dist/extensions/shared/mailbox.d.ts +33 -0
  327. package/dist/extensions/shared/mailbox.d.ts.map +1 -0
  328. package/dist/extensions/shared/mailbox.js +102 -0
  329. package/dist/extensions/shared/mailbox.js.map +1 -0
  330. package/dist/extensions/shared/schemas.d.ts +90 -0
  331. package/dist/extensions/shared/schemas.d.ts.map +1 -0
  332. package/dist/extensions/shared/schemas.js +71 -0
  333. package/dist/extensions/shared/schemas.js.map +1 -0
  334. package/dist/extensions/shared/static-check.d.ts +38 -0
  335. package/dist/extensions/shared/static-check.d.ts.map +1 -0
  336. package/dist/extensions/shared/static-check.js +52 -0
  337. package/dist/extensions/shared/static-check.js.map +1 -0
  338. package/dist/extensions/verifier.d.ts +4 -0
  339. package/dist/extensions/verifier.d.ts.map +1 -0
  340. package/dist/extensions/verifier.js +70 -0
  341. package/dist/extensions/verifier.js.map +1 -0
  342. package/dist/github.d.ts +1 -1
  343. package/dist/github.d.ts.map +1 -1
  344. package/dist/github.js +3 -3
  345. package/dist/github.js.map +1 -1
  346. package/dist/harbor-environment.d.ts +13 -1
  347. package/dist/harbor-environment.d.ts.map +1 -1
  348. package/dist/harbor-environment.js +37 -4
  349. package/dist/harbor-environment.js.map +1 -1
  350. package/dist/harbor-results.d.ts +2 -0
  351. package/dist/harbor-results.d.ts.map +1 -1
  352. package/dist/harbor-results.js +2 -0
  353. package/dist/harbor-results.js.map +1 -1
  354. package/dist/harbor-task/compiler.d.ts +10 -0
  355. package/dist/harbor-task/compiler.d.ts.map +1 -0
  356. package/dist/harbor-task/compiler.js +174 -0
  357. package/dist/harbor-task/compiler.js.map +1 -0
  358. package/dist/harbor-task/constants.d.ts +3 -0
  359. package/dist/harbor-task/constants.d.ts.map +1 -0
  360. package/dist/harbor-task/constants.js +3 -0
  361. package/dist/harbor-task/constants.js.map +1 -0
  362. package/dist/harbor-task/dependencies.d.ts +3 -0
  363. package/dist/harbor-task/dependencies.d.ts.map +1 -0
  364. package/dist/harbor-task/dependencies.js +20 -0
  365. package/dist/harbor-task/dependencies.js.map +1 -0
  366. package/dist/harbor-task/paths.d.ts +6 -0
  367. package/dist/harbor-task/paths.d.ts.map +1 -0
  368. package/dist/harbor-task/paths.js +37 -0
  369. package/dist/harbor-task/paths.js.map +1 -0
  370. package/dist/harbor-task/render.d.ts +11 -0
  371. package/dist/harbor-task/render.d.ts.map +1 -0
  372. package/dist/harbor-task/render.js +194 -0
  373. package/dist/harbor-task/render.js.map +1 -0
  374. package/dist/harbor-task/runtime/command.sh +26 -0
  375. package/dist/harbor-task/runtime/junit.py +69 -0
  376. package/dist/harbor-task/runtime-assets.d.ts +2 -0
  377. package/dist/harbor-task/runtime-assets.d.ts.map +1 -0
  378. package/dist/harbor-task/runtime-assets.js +8 -0
  379. package/dist/harbor-task/runtime-assets.js.map +1 -0
  380. package/dist/harbor-task/test-patch.d.ts +4 -0
  381. package/dist/harbor-task/test-patch.d.ts.map +1 -0
  382. package/dist/harbor-task/test-patch.js +15 -0
  383. package/dist/harbor-task/test-patch.js.map +1 -0
  384. package/dist/harbor-task/verifier.d.ts +4 -0
  385. package/dist/harbor-task/verifier.d.ts.map +1 -0
  386. package/dist/harbor-task/verifier.js +105 -0
  387. package/dist/harbor-task/verifier.js.map +1 -0
  388. package/dist/harbor-task.d.ts +3 -11
  389. package/dist/harbor-task.d.ts.map +1 -1
  390. package/dist/harbor-task.js +2 -463
  391. package/dist/harbor-task.js.map +1 -1
  392. package/dist/log-excerpt.d.ts +15 -0
  393. package/dist/log-excerpt.d.ts.map +1 -0
  394. package/dist/log-excerpt.js +104 -0
  395. package/dist/log-excerpt.js.map +1 -0
  396. package/dist/patch-check.d.ts +26 -0
  397. package/dist/patch-check.d.ts.map +1 -0
  398. package/dist/patch-check.js +137 -0
  399. package/dist/patch-check.js.map +1 -0
  400. package/dist/pi-event-feed.d.ts +16 -0
  401. package/dist/pi-event-feed.d.ts.map +1 -0
  402. package/dist/pi-event-feed.js +86 -0
  403. package/dist/pi-event-feed.js.map +1 -0
  404. package/dist/pi-session.d.ts +32 -0
  405. package/dist/pi-session.d.ts.map +1 -0
  406. package/dist/pi-session.js +175 -0
  407. package/dist/pi-session.js.map +1 -0
  408. package/dist/process.d.ts +5 -0
  409. package/dist/process.d.ts.map +1 -1
  410. package/dist/process.js +31 -9
  411. package/dist/process.js.map +1 -1
  412. package/dist/provenance/github.d.ts +4 -0
  413. package/dist/provenance/github.d.ts.map +1 -0
  414. package/dist/provenance/github.js +65 -0
  415. package/dist/provenance/github.js.map +1 -0
  416. package/dist/provenance/local.d.ts +4 -0
  417. package/dist/provenance/local.d.ts.map +1 -0
  418. package/dist/provenance/local.js +82 -0
  419. package/dist/provenance/local.js.map +1 -0
  420. package/dist/provenance/redact.d.ts +2 -0
  421. package/dist/provenance/redact.d.ts.map +1 -0
  422. package/dist/provenance/redact.js +28 -0
  423. package/dist/provenance/redact.js.map +1 -0
  424. package/dist/provenance/selection.d.ts +4 -0
  425. package/dist/provenance/selection.d.ts.map +1 -0
  426. package/dist/provenance/selection.js +29 -0
  427. package/dist/provenance/selection.js.map +1 -0
  428. package/dist/provenance/session.d.ts +3 -0
  429. package/dist/provenance/session.d.ts.map +1 -0
  430. package/dist/provenance/session.js +214 -0
  431. package/dist/provenance/session.js.map +1 -0
  432. package/dist/provenance/shared.d.ts +7 -0
  433. package/dist/provenance/shared.d.ts.map +1 -0
  434. package/dist/provenance/shared.js +10 -0
  435. package/dist/provenance/shared.js.map +1 -0
  436. package/dist/provenance/types.d.ts +34 -0
  437. package/dist/provenance/types.d.ts.map +1 -0
  438. package/dist/provenance/types.js +22 -0
  439. package/dist/provenance/types.js.map +1 -0
  440. package/dist/provenance-associations/apply.d.ts +3 -0
  441. package/dist/provenance-associations/apply.d.ts.map +1 -0
  442. package/dist/provenance-associations/apply.js +66 -0
  443. package/dist/provenance-associations/apply.js.map +1 -0
  444. package/dist/provenance-associations/shared.d.ts +45 -0
  445. package/dist/provenance-associations/shared.d.ts.map +1 -0
  446. package/dist/provenance-associations/shared.js +42 -0
  447. package/dist/provenance-associations/shared.js.map +1 -0
  448. package/dist/provenance-associations.d.ts +3 -30
  449. package/dist/provenance-associations.d.ts.map +1 -1
  450. package/dist/provenance-associations.js +4 -103
  451. package/dist/provenance-associations.js.map +1 -1
  452. package/dist/provenance.d.ts +7 -41
  453. package/dist/provenance.d.ts.map +1 -1
  454. package/dist/provenance.js +6 -432
  455. package/dist/provenance.js.map +1 -1
  456. package/dist/providers.d.ts +25 -2
  457. package/dist/providers.d.ts.map +1 -1
  458. package/dist/providers.js +23 -2
  459. package/dist/providers.js.map +1 -1
  460. package/dist/repair.d.ts +1 -6
  461. package/dist/repair.d.ts.map +1 -1
  462. package/dist/repair.js +17 -27
  463. package/dist/repair.js.map +1 -1
  464. package/dist/review/assets/index-BHHztQ9x.js +1679 -0
  465. package/dist/review/assets/index-KQ1eFQ0t.css +1 -0
  466. package/dist/review/index.html +11 -8
  467. package/dist/runtime/command.sh +26 -0
  468. package/dist/runtime/junit.py +69 -0
  469. package/dist/sandbox/contracts.d.ts +36 -1
  470. package/dist/sandbox/contracts.d.ts.map +1 -1
  471. package/dist/sandbox/contracts.js +3 -0
  472. package/dist/sandbox/contracts.js.map +1 -1
  473. package/dist/sandbox/index.d.ts +1 -1
  474. package/dist/sandbox/index.d.ts.map +1 -1
  475. package/dist/sandbox/index.js +13 -2
  476. package/dist/sandbox/index.js.map +1 -1
  477. package/dist/sandbox/live.d.ts +18 -0
  478. package/dist/sandbox/live.d.ts.map +1 -0
  479. package/dist/sandbox/live.js +55 -0
  480. package/dist/sandbox/live.js.map +1 -0
  481. package/dist/sandbox/output-retry.d.ts +16 -0
  482. package/dist/sandbox/output-retry.d.ts.map +1 -0
  483. package/dist/sandbox/output-retry.js +36 -0
  484. package/dist/sandbox/output-retry.js.map +1 -0
  485. package/dist/sandbox/programs/author.js +16 -6
  486. package/dist/sandbox/programs/author.js.map +1 -1
  487. package/dist/sandbox/programs/check.d.ts +3 -0
  488. package/dist/sandbox/programs/check.d.ts.map +1 -0
  489. package/dist/sandbox/programs/check.js +76 -0
  490. package/dist/sandbox/programs/check.js.map +1 -0
  491. package/dist/sandbox/programs/prepare-task.d.ts +12 -0
  492. package/dist/sandbox/programs/prepare-task.d.ts.map +1 -0
  493. package/dist/sandbox/programs/{prepare-repair.js → prepare-task.js} +11 -9
  494. package/dist/sandbox/programs/prepare-task.js.map +1 -0
  495. package/dist/sandbox/programs/verifier.d.ts +3 -0
  496. package/dist/sandbox/programs/verifier.d.ts.map +1 -0
  497. package/dist/sandbox/programs/verifier.js +9 -0
  498. package/dist/sandbox/programs/verifier.js.map +1 -0
  499. package/dist/sandbox/providers/docker/executor.d.ts +4 -1
  500. package/dist/sandbox/providers/docker/executor.d.ts.map +1 -1
  501. package/dist/sandbox/providers/docker/executor.js +75 -25
  502. package/dist/sandbox/providers/docker/executor.js.map +1 -1
  503. package/dist/sandbox/providers/e2b/bytes.d.ts +3 -0
  504. package/dist/sandbox/providers/e2b/bytes.d.ts.map +1 -0
  505. package/dist/sandbox/providers/e2b/bytes.js +8 -0
  506. package/dist/sandbox/providers/e2b/bytes.js.map +1 -0
  507. package/dist/sandbox/providers/e2b/cleanup.d.ts +8 -0
  508. package/dist/sandbox/providers/e2b/cleanup.d.ts.map +1 -0
  509. package/dist/sandbox/providers/e2b/cleanup.js +124 -0
  510. package/dist/sandbox/providers/e2b/cleanup.js.map +1 -0
  511. package/dist/sandbox/providers/e2b/command.d.ts +23 -0
  512. package/dist/sandbox/providers/e2b/command.d.ts.map +1 -0
  513. package/dist/sandbox/providers/e2b/command.js +160 -0
  514. package/dist/sandbox/providers/e2b/command.js.map +1 -0
  515. package/dist/sandbox/providers/e2b/config.d.ts +13 -0
  516. package/dist/sandbox/providers/e2b/config.d.ts.map +1 -0
  517. package/dist/sandbox/providers/e2b/config.js +2 -0
  518. package/dist/sandbox/providers/e2b/config.js.map +1 -0
  519. package/dist/sandbox/providers/e2b/executor.d.ts +15 -0
  520. package/dist/sandbox/providers/e2b/executor.d.ts.map +1 -0
  521. package/dist/sandbox/providers/e2b/executor.js +207 -0
  522. package/dist/sandbox/providers/e2b/executor.js.map +1 -0
  523. package/dist/sandbox/providers/e2b/lifecycle.d.ts +8 -0
  524. package/dist/sandbox/providers/e2b/lifecycle.d.ts.map +1 -0
  525. package/dist/sandbox/providers/e2b/lifecycle.js +37 -0
  526. package/dist/sandbox/providers/e2b/lifecycle.js.map +1 -0
  527. package/dist/sandbox/providers/e2b/outcome.d.ts +11 -0
  528. package/dist/sandbox/providers/e2b/outcome.d.ts.map +1 -0
  529. package/dist/sandbox/providers/e2b/outcome.js +72 -0
  530. package/dist/sandbox/providers/e2b/outcome.js.map +1 -0
  531. package/dist/sandbox/providers/e2b/stage-files.d.ts +10 -0
  532. package/dist/sandbox/providers/e2b/stage-files.d.ts.map +1 -0
  533. package/dist/sandbox/providers/e2b/stage-files.js +45 -0
  534. package/dist/sandbox/providers/e2b/stage-files.js.map +1 -0
  535. package/dist/sandbox/providers/e2b/startup.d.ts +10 -0
  536. package/dist/sandbox/providers/e2b/startup.d.ts.map +1 -0
  537. package/dist/sandbox/providers/e2b/startup.js +26 -0
  538. package/dist/sandbox/providers/e2b/startup.js.map +1 -0
  539. package/dist/sandbox/providers/e2b/types.d.ts +9 -0
  540. package/dist/sandbox/providers/e2b/types.d.ts.map +1 -0
  541. package/dist/sandbox/providers/e2b/types.js +2 -0
  542. package/dist/sandbox/providers/e2b/types.js.map +1 -0
  543. package/dist/sandbox/providers/e2b/validation.d.ts +14 -0
  544. package/dist/sandbox/providers/e2b/validation.d.ts.map +1 -0
  545. package/dist/sandbox/providers/e2b/validation.js +60 -0
  546. package/dist/sandbox/providers/e2b/validation.js.map +1 -0
  547. package/dist/{modal-auth.d.ts → sandbox/providers/modal/auth.d.ts} +1 -1
  548. package/dist/sandbox/providers/modal/auth.d.ts.map +1 -0
  549. package/dist/{modal-auth.js → sandbox/providers/modal/auth.js} +1 -1
  550. package/dist/sandbox/providers/modal/auth.js.map +1 -0
  551. package/dist/sandbox/providers/modal/executor.d.ts +4 -1
  552. package/dist/sandbox/providers/modal/executor.d.ts.map +1 -1
  553. package/dist/sandbox/providers/modal/executor.js +33 -9
  554. package/dist/sandbox/providers/modal/executor.js.map +1 -1
  555. package/dist/sandbox/providers/modal/live.d.ts +7 -0
  556. package/dist/sandbox/providers/modal/live.d.ts.map +1 -0
  557. package/dist/sandbox/providers/modal/live.js +50 -0
  558. package/dist/sandbox/providers/modal/live.js.map +1 -0
  559. package/dist/sandbox/providers/vercel/command.d.ts +6 -0
  560. package/dist/sandbox/providers/vercel/command.d.ts.map +1 -1
  561. package/dist/sandbox/providers/vercel/command.js +44 -11
  562. package/dist/sandbox/providers/vercel/command.js.map +1 -1
  563. package/dist/sandbox/providers/vercel/executor.d.ts +6 -7
  564. package/dist/sandbox/providers/vercel/executor.d.ts.map +1 -1
  565. package/dist/sandbox/providers/vercel/executor.js +21 -187
  566. package/dist/sandbox/providers/vercel/executor.js.map +1 -1
  567. package/dist/sandbox/providers/vercel/lifecycle.d.ts +13 -0
  568. package/dist/sandbox/providers/vercel/lifecycle.d.ts.map +1 -0
  569. package/dist/sandbox/providers/vercel/lifecycle.js +140 -0
  570. package/dist/sandbox/providers/vercel/lifecycle.js.map +1 -0
  571. package/dist/sandbox/providers/vercel/validation.d.ts +11 -0
  572. package/dist/sandbox/providers/vercel/validation.d.ts.map +1 -0
  573. package/dist/sandbox/providers/vercel/validation.js +30 -0
  574. package/dist/sandbox/providers/vercel/validation.js.map +1 -0
  575. package/dist/sandbox/remote-files.d.ts +11 -0
  576. package/dist/sandbox/remote-files.d.ts.map +1 -0
  577. package/dist/sandbox/remote-files.js +41 -0
  578. package/dist/sandbox/remote-files.js.map +1 -0
  579. package/dist/sandbox/request-validation.d.ts +5 -0
  580. package/dist/sandbox/request-validation.d.ts.map +1 -0
  581. package/dist/sandbox/request-validation.js +43 -0
  582. package/dist/sandbox/request-validation.js.map +1 -0
  583. package/dist/sandbox/supervisor.d.ts +42 -0
  584. package/dist/sandbox/supervisor.d.ts.map +1 -0
  585. package/dist/sandbox/supervisor.js +126 -0
  586. package/dist/sandbox/supervisor.js.map +1 -0
  587. package/dist/sandbox/timeout.d.ts +6 -1
  588. package/dist/sandbox/timeout.d.ts.map +1 -1
  589. package/dist/sandbox/timeout.js +12 -0
  590. package/dist/sandbox/timeout.js.map +1 -1
  591. package/dist/sandbox-author.bundle.js +47 -14879
  592. package/dist/{sandbox-validation-repair.bundle.js → sandbox-check.bundle.js} +7261 -1893
  593. package/dist/sandbox-verifier.bundle.js +307 -0
  594. package/dist/setup/e2b/build.d.ts +24 -0
  595. package/dist/setup/e2b/build.d.ts.map +1 -0
  596. package/dist/setup/e2b/build.js +46 -0
  597. package/dist/setup/e2b/build.js.map +1 -0
  598. package/dist/setup/e2b/cli.d.ts +2 -0
  599. package/dist/setup/e2b/cli.d.ts.map +1 -0
  600. package/dist/setup/e2b/cli.js +51 -0
  601. package/dist/setup/e2b/cli.js.map +1 -0
  602. package/dist/setup/e2b/index.d.ts +5 -0
  603. package/dist/setup/e2b/index.d.ts.map +1 -0
  604. package/dist/setup/e2b/index.js +4 -0
  605. package/dist/setup/e2b/index.js.map +1 -0
  606. package/dist/setup/e2b/template.d.ts +4 -0
  607. package/dist/setup/e2b/template.d.ts.map +1 -0
  608. package/dist/setup/e2b/template.js +53 -0
  609. package/dist/setup/e2b/template.js.map +1 -0
  610. package/dist/setup/vercel/cli-helpers.d.ts +22 -0
  611. package/dist/setup/vercel/cli-helpers.d.ts.map +1 -0
  612. package/dist/setup/vercel/cli-helpers.js +87 -0
  613. package/dist/setup/vercel/cli-helpers.js.map +1 -0
  614. package/dist/setup/vercel/cli-runner.d.ts +14 -0
  615. package/dist/setup/vercel/cli-runner.d.ts.map +1 -0
  616. package/dist/setup/vercel/cli-runner.js +24 -0
  617. package/dist/setup/vercel/cli-runner.js.map +1 -0
  618. package/dist/setup/vercel/cli-types.d.ts +24 -0
  619. package/dist/setup/vercel/cli-types.d.ts.map +1 -0
  620. package/dist/setup/vercel/cli-types.js +18 -0
  621. package/dist/setup/vercel/cli-types.js.map +1 -0
  622. package/dist/setup/vercel/cli.d.ts +5 -31
  623. package/dist/setup/vercel/cli.d.ts.map +1 -1
  624. package/dist/setup/vercel/cli.js +15 -125
  625. package/dist/setup/vercel/cli.js.map +1 -1
  626. package/dist/setup/vercel/profile-files.d.ts +6 -0
  627. package/dist/setup/vercel/profile-files.d.ts.map +1 -0
  628. package/dist/setup/vercel/profile-files.js +100 -0
  629. package/dist/setup/vercel/profile-files.js.map +1 -0
  630. package/dist/setup/vercel/profile-schema.d.ts +48 -0
  631. package/dist/setup/vercel/profile-schema.d.ts.map +1 -0
  632. package/dist/setup/vercel/profile-schema.js +39 -0
  633. package/dist/setup/vercel/profile-schema.js.map +1 -0
  634. package/dist/setup/vercel/profile.d.ts +3 -19
  635. package/dist/setup/vercel/profile.d.ts.map +1 -1
  636. package/dist/setup/vercel/profile.js +4 -130
  637. package/dist/setup/vercel/profile.js.map +1 -1
  638. package/dist/setup/vercel/selection.d.ts +18 -0
  639. package/dist/setup/vercel/selection.d.ts.map +1 -0
  640. package/dist/setup/vercel/selection.js +113 -0
  641. package/dist/setup/vercel/selection.js.map +1 -0
  642. package/dist/setup/vercel/setup-types.d.ts +34 -0
  643. package/dist/setup/vercel/setup-types.d.ts.map +1 -0
  644. package/dist/setup/vercel/setup-types.js +2 -0
  645. package/dist/setup/vercel/setup-types.js.map +1 -0
  646. package/dist/setup/vercel/setup.d.ts +3 -28
  647. package/dist/setup/vercel/setup.d.ts.map +1 -1
  648. package/dist/setup/vercel/setup.js +3 -111
  649. package/dist/setup/vercel/setup.js.map +1 -1
  650. package/dist/site/batch-activity.d.ts +5 -0
  651. package/dist/site/batch-activity.d.ts.map +1 -0
  652. package/dist/site/batch-activity.js +31 -0
  653. package/dist/site/batch-activity.js.map +1 -0
  654. package/dist/site/batch-progress.d.ts +16 -0
  655. package/dist/site/batch-progress.d.ts.map +1 -0
  656. package/dist/site/batch-progress.js +52 -0
  657. package/dist/site/batch-progress.js.map +1 -0
  658. package/dist/site/batch-routes.d.ts +30 -0
  659. package/dist/site/batch-routes.d.ts.map +1 -0
  660. package/dist/site/batch-routes.js +117 -0
  661. package/dist/site/batch-routes.js.map +1 -0
  662. package/dist/site/batch-start.d.ts +60 -0
  663. package/dist/site/batch-start.d.ts.map +1 -0
  664. package/dist/site/batch-start.js +39 -0
  665. package/dist/site/batch-start.js.map +1 -0
  666. package/dist/site/connected-repos.d.ts +25 -0
  667. package/dist/site/connected-repos.d.ts.map +1 -0
  668. package/dist/site/connected-repos.js +109 -0
  669. package/dist/site/connected-repos.js.map +1 -0
  670. package/dist/site/evaluation-start.d.ts +4 -0
  671. package/dist/site/evaluation-start.d.ts.map +1 -0
  672. package/dist/site/evaluation-start.js +19 -0
  673. package/dist/site/evaluation-start.js.map +1 -0
  674. package/dist/site/generation-config.d.ts +4 -0
  675. package/dist/site/generation-config.d.ts.map +1 -0
  676. package/dist/site/generation-config.js +16 -0
  677. package/dist/site/generation-config.js.map +1 -0
  678. package/dist/site/generation-credentials.d.ts +6 -0
  679. package/dist/site/generation-credentials.d.ts.map +1 -0
  680. package/dist/site/generation-credentials.js +101 -0
  681. package/dist/site/generation-credentials.js.map +1 -0
  682. package/dist/site/generation-run.d.ts +6 -0
  683. package/dist/site/generation-run.d.ts.map +1 -0
  684. package/dist/site/generation-run.js +22 -0
  685. package/dist/site/generation-run.js.map +1 -0
  686. package/dist/site/generation-settings.d.ts +80 -0
  687. package/dist/site/generation-settings.d.ts.map +1 -0
  688. package/dist/site/generation-settings.js +84 -0
  689. package/dist/site/generation-settings.js.map +1 -0
  690. package/dist/site/generation-subscription.d.ts +3 -0
  691. package/dist/site/generation-subscription.d.ts.map +1 -0
  692. package/dist/site/generation-subscription.js +38 -0
  693. package/dist/site/generation-subscription.js.map +1 -0
  694. package/dist/site/github-repos.d.ts +35 -0
  695. package/dist/site/github-repos.d.ts.map +1 -0
  696. package/dist/site/github-repos.js +121 -0
  697. package/dist/site/github-repos.js.map +1 -0
  698. package/dist/site/pr-candidate.d.ts +26 -0
  699. package/dist/site/pr-candidate.d.ts.map +1 -0
  700. package/dist/site/pr-candidate.js +101 -0
  701. package/dist/site/pr-candidate.js.map +1 -0
  702. package/dist/site/pr-list.d.ts +13 -0
  703. package/dist/site/pr-list.d.ts.map +1 -0
  704. package/dist/site/pr-list.js +24 -0
  705. package/dist/site/pr-list.js.map +1 -0
  706. package/dist/site/pr-routes.d.ts +26 -0
  707. package/dist/site/pr-routes.d.ts.map +1 -0
  708. package/dist/site/pr-routes.js +139 -0
  709. package/dist/site/pr-routes.js.map +1 -0
  710. package/dist/site/repo-store.d.ts +40 -0
  711. package/dist/site/repo-store.d.ts.map +1 -0
  712. package/dist/site/repo-store.js +74 -0
  713. package/dist/site/repo-store.js.map +1 -0
  714. package/dist/site/run-store.d.ts +17 -0
  715. package/dist/site/run-store.d.ts.map +1 -0
  716. package/dist/site/run-store.js +42 -0
  717. package/dist/site/run-store.js.map +1 -0
  718. package/dist/site/runtime.d.ts +27 -0
  719. package/dist/site/runtime.d.ts.map +1 -0
  720. package/dist/site/runtime.js +97 -0
  721. package/dist/site/runtime.js.map +1 -0
  722. package/dist/site/task-deletion.d.ts +7 -0
  723. package/dist/site/task-deletion.d.ts.map +1 -0
  724. package/dist/site/task-deletion.js +29 -0
  725. package/dist/site/task-deletion.js.map +1 -0
  726. package/dist/site/task-start-reservation.d.ts +4 -0
  727. package/dist/site/task-start-reservation.d.ts.map +1 -0
  728. package/dist/site/task-start-reservation.js +18 -0
  729. package/dist/site/task-start-reservation.js.map +1 -0
  730. package/dist/site/task-start.d.ts +33 -0
  731. package/dist/site/task-start.d.ts.map +1 -0
  732. package/dist/site/task-start.js +50 -0
  733. package/dist/site/task-start.js.map +1 -0
  734. package/dist/site/task-status.d.ts +36 -0
  735. package/dist/site/task-status.d.ts.map +1 -0
  736. package/dist/site/task-status.js +113 -0
  737. package/dist/site/task-status.js.map +1 -0
  738. package/dist/site/task-store.d.ts +78 -0
  739. package/dist/site/task-store.d.ts.map +1 -0
  740. package/dist/site/task-store.js +186 -0
  741. package/dist/site/task-store.js.map +1 -0
  742. package/dist/site/task-sync.d.ts +30 -0
  743. package/dist/site/task-sync.d.ts.map +1 -0
  744. package/dist/site/task-sync.js +121 -0
  745. package/dist/site/task-sync.js.map +1 -0
  746. package/dist/site/tasks.d.ts +47 -0
  747. package/dist/site/tasks.d.ts.map +1 -0
  748. package/dist/site/tasks.js +164 -0
  749. package/dist/site/tasks.js.map +1 -0
  750. package/dist/site/temporal-status.d.ts +8 -0
  751. package/dist/site/temporal-status.d.ts.map +1 -0
  752. package/dist/site/temporal-status.js +41 -0
  753. package/dist/site/temporal-status.js.map +1 -0
  754. package/dist/site/tenant.d.ts +4 -0
  755. package/dist/site/tenant.d.ts.map +1 -0
  756. package/dist/site/tenant.js +6 -0
  757. package/dist/site/tenant.js.map +1 -0
  758. package/dist/static-check.d.ts +38 -0
  759. package/dist/static-check.d.ts.map +1 -0
  760. package/dist/static-check.js +131 -0
  761. package/dist/static-check.js.map +1 -0
  762. package/dist/submission-hash.d.ts +18 -0
  763. package/dist/submission-hash.d.ts.map +1 -0
  764. package/dist/submission-hash.js +16 -0
  765. package/dist/submission-hash.js.map +1 -0
  766. package/dist/subscription-auth.d.ts +0 -7
  767. package/dist/subscription-auth.d.ts.map +1 -1
  768. package/dist/subscription-auth.js +3 -23
  769. package/dist/subscription-auth.js.map +1 -1
  770. package/dist/temporal/activities/agent-feed.d.ts +5 -0
  771. package/dist/temporal/activities/agent-feed.d.ts.map +1 -0
  772. package/dist/temporal/activities/agent-feed.js +41 -0
  773. package/dist/temporal/activities/agent-feed.js.map +1 -0
  774. package/dist/temporal/activities/agent-scripts.d.ts +16 -0
  775. package/dist/temporal/activities/agent-scripts.d.ts.map +1 -0
  776. package/dist/temporal/activities/agent-scripts.js +162 -0
  777. package/dist/temporal/activities/agent-scripts.js.map +1 -0
  778. package/dist/temporal/activities/authoring-round.d.ts +13 -0
  779. package/dist/temporal/activities/authoring-round.d.ts.map +1 -0
  780. package/dist/temporal/activities/authoring-round.js +160 -0
  781. package/dist/temporal/activities/authoring-round.js.map +1 -0
  782. package/dist/temporal/activities/constants.d.ts +5 -0
  783. package/dist/temporal/activities/constants.d.ts.map +1 -0
  784. package/dist/temporal/activities/constants.js +5 -0
  785. package/dist/temporal/activities/constants.js.map +1 -0
  786. package/dist/temporal/activities/discovery.d.ts +17 -0
  787. package/dist/temporal/activities/discovery.d.ts.map +1 -0
  788. package/dist/temporal/activities/discovery.js +153 -0
  789. package/dist/temporal/activities/discovery.js.map +1 -0
  790. package/dist/temporal/activities/drafts.d.ts +15 -0
  791. package/dist/temporal/activities/drafts.d.ts.map +1 -0
  792. package/dist/temporal/activities/drafts.js +51 -0
  793. package/dist/temporal/activities/drafts.js.map +1 -0
  794. package/dist/temporal/activities/excluded-source-prs.d.ts +9 -0
  795. package/dist/temporal/activities/excluded-source-prs.d.ts.map +1 -0
  796. package/dist/temporal/activities/excluded-source-prs.js +132 -0
  797. package/dist/temporal/activities/excluded-source-prs.js.map +1 -0
  798. package/dist/temporal/activities/export.d.ts +38 -0
  799. package/dist/temporal/activities/export.d.ts.map +1 -0
  800. package/dist/temporal/activities/export.js +79 -0
  801. package/dist/temporal/activities/export.js.map +1 -0
  802. package/dist/temporal/activities/factory.d.ts +5 -0
  803. package/dist/temporal/activities/factory.d.ts.map +1 -0
  804. package/dist/temporal/activities/factory.js +26 -0
  805. package/dist/temporal/activities/factory.js.map +1 -0
  806. package/dist/temporal/activities/gate-logs.d.ts +20 -0
  807. package/dist/temporal/activities/gate-logs.d.ts.map +1 -0
  808. package/dist/temporal/activities/gate-logs.js +62 -0
  809. package/dist/temporal/activities/gate-logs.js.map +1 -0
  810. package/dist/temporal/activities/generation-runtime.d.ts +6 -0
  811. package/dist/temporal/activities/generation-runtime.d.ts.map +1 -0
  812. package/dist/temporal/activities/generation-runtime.js +56 -0
  813. package/dist/temporal/activities/generation-runtime.js.map +1 -0
  814. package/dist/temporal/activities/harbor.d.ts +11 -0
  815. package/dist/temporal/activities/harbor.d.ts.map +1 -0
  816. package/dist/temporal/activities/harbor.js +112 -0
  817. package/dist/temporal/activities/harbor.js.map +1 -0
  818. package/dist/temporal/activities/modal-build-log.d.ts +12 -0
  819. package/dist/temporal/activities/modal-build-log.d.ts.map +1 -0
  820. package/dist/temporal/activities/modal-build-log.js +57 -0
  821. package/dist/temporal/activities/modal-build-log.js.map +1 -0
  822. package/dist/temporal/activities/prompts-authoring.d.ts +6 -0
  823. package/dist/temporal/activities/prompts-authoring.d.ts.map +1 -0
  824. package/dist/temporal/activities/prompts-authoring.js +87 -0
  825. package/dist/temporal/activities/prompts-authoring.js.map +1 -0
  826. package/dist/temporal/activities/prompts-verifier.d.ts +17 -0
  827. package/dist/temporal/activities/prompts-verifier.d.ts.map +1 -0
  828. package/dist/temporal/activities/prompts-verifier.js +66 -0
  829. package/dist/temporal/activities/prompts-verifier.js.map +1 -0
  830. package/dist/temporal/activities/provenance.d.ts +4 -0
  831. package/dist/temporal/activities/provenance.d.ts.map +1 -0
  832. package/dist/temporal/activities/provenance.js +18 -0
  833. package/dist/temporal/activities/provenance.js.map +1 -0
  834. package/dist/temporal/activities/replay.d.ts +20 -0
  835. package/dist/temporal/activities/replay.d.ts.map +1 -0
  836. package/dist/temporal/activities/replay.js +135 -0
  837. package/dist/temporal/activities/replay.js.map +1 -0
  838. package/dist/temporal/activities/round-outcome.d.ts +63 -0
  839. package/dist/temporal/activities/round-outcome.d.ts.map +1 -0
  840. package/dist/temporal/activities/round-outcome.js +127 -0
  841. package/dist/temporal/activities/round-outcome.js.map +1 -0
  842. package/dist/temporal/activities/runtime.d.ts +38 -0
  843. package/dist/temporal/activities/runtime.d.ts.map +1 -0
  844. package/dist/temporal/activities/runtime.js +146 -0
  845. package/dist/temporal/activities/runtime.js.map +1 -0
  846. package/dist/temporal/activities/session-verify.d.ts +45 -0
  847. package/dist/temporal/activities/session-verify.d.ts.map +1 -0
  848. package/dist/temporal/activities/session-verify.js +91 -0
  849. package/dist/temporal/activities/session-verify.js.map +1 -0
  850. package/dist/temporal/activities/submissions.d.ts +9 -0
  851. package/dist/temporal/activities/submissions.d.ts.map +1 -0
  852. package/dist/temporal/activities/submissions.js +28 -0
  853. package/dist/temporal/activities/submissions.js.map +1 -0
  854. package/dist/temporal/activities/task-compiler.d.ts +21 -0
  855. package/dist/temporal/activities/task-compiler.d.ts.map +1 -0
  856. package/dist/temporal/activities/task-compiler.js +63 -0
  857. package/dist/temporal/activities/task-compiler.js.map +1 -0
  858. package/dist/temporal/activities/types.d.ts +57 -0
  859. package/dist/temporal/activities/types.d.ts.map +1 -0
  860. package/dist/temporal/activities/types.js +2 -0
  861. package/dist/temporal/activities/types.js.map +1 -0
  862. package/dist/temporal/activities/verifier-material.d.ts +18 -0
  863. package/dist/temporal/activities/verifier-material.d.ts.map +1 -0
  864. package/dist/temporal/activities/verifier-material.js +49 -0
  865. package/dist/temporal/activities/verifier-material.js.map +1 -0
  866. package/dist/temporal/activities/verifier-outcome.d.ts +19 -0
  867. package/dist/temporal/activities/verifier-outcome.d.ts.map +1 -0
  868. package/dist/temporal/activities/verifier-outcome.js +70 -0
  869. package/dist/temporal/activities/verifier-outcome.js.map +1 -0
  870. package/dist/temporal/activities/verifier-round.d.ts +8 -0
  871. package/dist/temporal/activities/verifier-round.d.ts.map +1 -0
  872. package/dist/temporal/activities/verifier-round.js +110 -0
  873. package/dist/temporal/activities/verifier-round.js.map +1 -0
  874. package/dist/temporal/activities/verify-harbor.d.ts +15 -0
  875. package/dist/temporal/activities/verify-harbor.d.ts.map +1 -0
  876. package/dist/temporal/activities/verify-harbor.js +193 -0
  877. package/dist/temporal/activities/verify-harbor.js.map +1 -0
  878. package/dist/temporal/activities/verify.d.ts +11 -0
  879. package/dist/temporal/activities/verify.d.ts.map +1 -0
  880. package/dist/temporal/activities/verify.js +151 -0
  881. package/dist/temporal/activities/verify.js.map +1 -0
  882. package/dist/temporal/activities.d.ts +3 -51
  883. package/dist/temporal/activities.d.ts.map +1 -1
  884. package/dist/temporal/activities.js +2 -886
  885. package/dist/temporal/activities.js.map +1 -1
  886. package/dist/temporal/connection.d.ts.map +1 -1
  887. package/dist/temporal/connection.js +3 -2
  888. package/dist/temporal/connection.js.map +1 -1
  889. package/dist/temporal/worker-main.js +19 -3
  890. package/dist/temporal/worker-main.js.map +1 -1
  891. package/dist/temporal/workflow/activity-proxies.d.ts +3 -0
  892. package/dist/temporal/workflow/activity-proxies.d.ts.map +1 -0
  893. package/dist/temporal/workflow/activity-proxies.js +45 -0
  894. package/dist/temporal/workflow/activity-proxies.js.map +1 -0
  895. package/dist/temporal/workflow/authoring-stage.d.ts +5 -0
  896. package/dist/temporal/workflow/authoring-stage.d.ts.map +1 -0
  897. package/dist/temporal/workflow/authoring-stage.js +64 -0
  898. package/dist/temporal/workflow/authoring-stage.js.map +1 -0
  899. package/dist/temporal/workflow/candidate-tracker.d.ts +28 -0
  900. package/dist/temporal/workflow/candidate-tracker.d.ts.map +1 -0
  901. package/dist/temporal/workflow/candidate-tracker.js +85 -0
  902. package/dist/temporal/workflow/candidate-tracker.js.map +1 -0
  903. package/dist/temporal/workflow/candidate.d.ts +6 -0
  904. package/dist/temporal/workflow/candidate.d.ts.map +1 -0
  905. package/dist/temporal/workflow/candidate.js +54 -0
  906. package/dist/temporal/workflow/candidate.js.map +1 -0
  907. package/dist/temporal/workflow/discovery.d.ts +19 -0
  908. package/dist/temporal/workflow/discovery.d.ts.map +1 -0
  909. package/dist/temporal/workflow/discovery.js +137 -0
  910. package/dist/temporal/workflow/discovery.js.map +1 -0
  911. package/dist/temporal/workflow/failures.d.ts +5 -0
  912. package/dist/temporal/workflow/failures.d.ts.map +1 -0
  913. package/dist/temporal/workflow/failures.js +28 -0
  914. package/dist/temporal/workflow/failures.js.map +1 -0
  915. package/dist/temporal/workflow/run.d.ts +5 -0
  916. package/dist/temporal/workflow/run.d.ts.map +1 -0
  917. package/dist/temporal/workflow/run.js +154 -0
  918. package/dist/temporal/workflow/run.js.map +1 -0
  919. package/dist/temporal/workflow/stage.d.ts +26 -0
  920. package/dist/temporal/workflow/stage.d.ts.map +1 -0
  921. package/dist/temporal/workflow/stage.js +16 -0
  922. package/dist/temporal/workflow/stage.js.map +1 -0
  923. package/dist/temporal/workflow/verification-stage.d.ts +11 -0
  924. package/dist/temporal/workflow/verification-stage.d.ts.map +1 -0
  925. package/dist/temporal/workflow/verification-stage.js +20 -0
  926. package/dist/temporal/workflow/verification-stage.js.map +1 -0
  927. package/dist/temporal/workflow.d.ts +12 -4
  928. package/dist/temporal/workflow.d.ts.map +1 -1
  929. package/dist/temporal/workflow.js +38 -445
  930. package/dist/temporal/workflow.js.map +1 -1
  931. package/dist/verifier-fix.d.ts +20 -0
  932. package/dist/verifier-fix.d.ts.map +1 -0
  933. package/dist/verifier-fix.js +62 -0
  934. package/dist/verifier-fix.js.map +1 -0
  935. package/dist/verify-report.d.ts +9 -0
  936. package/dist/verify-report.d.ts.map +1 -0
  937. package/dist/verify-report.js +135 -0
  938. package/dist/verify-report.js.map +1 -0
  939. package/dist/viewer/archived-keys.d.ts +9 -0
  940. package/dist/viewer/archived-keys.d.ts.map +1 -0
  941. package/dist/viewer/archived-keys.js +36 -0
  942. package/dist/viewer/archived-keys.js.map +1 -0
  943. package/dist/viewer/archived.d.ts +20 -0
  944. package/dist/viewer/archived.d.ts.map +1 -0
  945. package/dist/viewer/archived.js +238 -0
  946. package/dist/viewer/archived.js.map +1 -0
  947. package/dist/viewer/artifacts.d.ts +8 -0
  948. package/dist/viewer/artifacts.d.ts.map +1 -0
  949. package/dist/viewer/artifacts.js +96 -0
  950. package/dist/viewer/artifacts.js.map +1 -0
  951. package/dist/viewer/bundle.d.ts +9 -0
  952. package/dist/viewer/bundle.d.ts.map +1 -0
  953. package/dist/viewer/bundle.js +79 -0
  954. package/dist/viewer/bundle.js.map +1 -0
  955. package/dist/viewer/candidates.d.ts +9 -0
  956. package/dist/viewer/candidates.d.ts.map +1 -0
  957. package/dist/viewer/candidates.js +137 -0
  958. package/dist/viewer/candidates.js.map +1 -0
  959. package/dist/viewer/local-server.d.ts +11 -0
  960. package/dist/viewer/local-server.d.ts.map +1 -0
  961. package/dist/viewer/local-server.js +64 -0
  962. package/dist/viewer/local-server.js.map +1 -0
  963. package/dist/viewer/task-files.d.ts +10 -0
  964. package/dist/viewer/task-files.d.ts.map +1 -0
  965. package/dist/viewer/task-files.js +120 -0
  966. package/dist/viewer/task-files.js.map +1 -0
  967. package/dist/viewer/types.d.ts +78 -0
  968. package/dist/viewer/types.d.ts.map +1 -0
  969. package/dist/viewer/types.js +36 -0
  970. package/dist/viewer/types.js.map +1 -0
  971. package/docs/api.md +168 -0
  972. package/docs/evaluations.md +42 -15
  973. package/docs/operations.md +254 -26
  974. package/docs/solver-evaluations.md +63 -0
  975. package/docs/task-construction.md +21 -11
  976. package/drizzle/0000_glossy_johnny_blaze.sql +97 -0
  977. package/drizzle/0001_evaluation_records.sql +5 -0
  978. package/drizzle/0002_task_deletion.sql +1 -0
  979. package/drizzle/0003_drop_repo_runs.sql +3 -0
  980. package/drizzle/0004_preserve_batch_runs.sql +8 -0
  981. package/drizzle/0005_api_keys.sql +15 -0
  982. package/drizzle/meta/0000_snapshot.json +776 -0
  983. package/drizzle/meta/0001_snapshot.json +807 -0
  984. package/drizzle/meta/0002_snapshot.json +813 -0
  985. package/drizzle/meta/0003_snapshot.json +726 -0
  986. package/drizzle/meta/0004_snapshot.json +813 -0
  987. package/drizzle/meta/0005_snapshot.json +919 -0
  988. package/drizzle/meta/_journal.json +48 -0
  989. package/package.json +39 -25
  990. package/src/extensions/authoring.ts +83 -72
  991. package/src/extensions/shared/deliverable.ts +153 -0
  992. package/src/extensions/shared/mailbox.ts +128 -0
  993. package/src/extensions/shared/schemas.ts +101 -0
  994. package/src/extensions/shared/static-check.ts +103 -0
  995. package/src/extensions/verifier.ts +88 -0
  996. package/src/skills/selfbench/SKILL.md +71 -13
  997. package/biome.json +0 -24
  998. package/dist/agent-smoke-main.d.ts +0 -3
  999. package/dist/agent-smoke-main.d.ts.map +0 -1
  1000. package/dist/agent-smoke-main.js +0 -55
  1001. package/dist/agent-smoke-main.js.map +0 -1
  1002. package/dist/agent-smoke.d.ts +0 -18
  1003. package/dist/agent-smoke.d.ts.map +0 -1
  1004. package/dist/agent-smoke.js +0 -103
  1005. package/dist/agent-smoke.js.map +0 -1
  1006. package/dist/codex-review.d.ts +0 -41
  1007. package/dist/codex-review.d.ts.map +0 -1
  1008. package/dist/codex-review.js +0 -193
  1009. package/dist/codex-review.js.map +0 -1
  1010. package/dist/eval-main.d.ts +0 -3
  1011. package/dist/eval-main.d.ts.map +0 -1
  1012. package/dist/eval-main.js +0 -81
  1013. package/dist/eval-main.js.map +0 -1
  1014. package/dist/evaluate.d.ts +0 -25
  1015. package/dist/evaluate.d.ts.map +0 -1
  1016. package/dist/evaluate.js +0 -214
  1017. package/dist/evaluate.js.map +0 -1
  1018. package/dist/modal-auth.d.ts.map +0 -1
  1019. package/dist/modal-auth.js.map +0 -1
  1020. package/dist/reaudit-main.d.ts +0 -3
  1021. package/dist/reaudit-main.d.ts.map +0 -1
  1022. package/dist/reaudit-main.js +0 -158
  1023. package/dist/reaudit-main.js.map +0 -1
  1024. package/dist/repair-main.d.ts +0 -3
  1025. package/dist/repair-main.d.ts.map +0 -1
  1026. package/dist/repair-main.js +0 -171
  1027. package/dist/repair-main.js.map +0 -1
  1028. package/dist/review/assets/index-CZ3G759O.js +0 -1568
  1029. package/dist/review/assets/index-DgSLzX8l.css +0 -1
  1030. package/dist/sandbox/programs/prepare-repair.d.ts +0 -7
  1031. package/dist/sandbox/programs/prepare-repair.d.ts.map +0 -1
  1032. package/dist/sandbox/programs/prepare-repair.js.map +0 -1
  1033. package/dist/sandbox/programs/repair.d.ts +0 -3
  1034. package/dist/sandbox/programs/repair.d.ts.map +0 -1
  1035. package/dist/sandbox/programs/repair.js +0 -100
  1036. package/dist/sandbox/programs/repair.js.map +0 -1
  1037. package/dist/sandbox/programs/review.d.ts +0 -2
  1038. package/dist/sandbox/programs/review.d.ts.map +0 -1
  1039. package/dist/sandbox/programs/review.js +0 -18
  1040. package/dist/sandbox/programs/review.js.map +0 -1
  1041. package/dist/sandbox/programs/validation-repair.d.ts +0 -3
  1042. package/dist/sandbox/programs/validation-repair.d.ts.map +0 -1
  1043. package/dist/sandbox/programs/validation-repair.js +0 -115
  1044. package/dist/sandbox/programs/validation-repair.js.map +0 -1
  1045. package/dist/sandbox-repair.bundle.js +0 -323
  1046. package/dist/sandbox-review.bundle.js +0 -14462
  1047. package/dist/validate-main.d.ts +0 -3
  1048. package/dist/validate-main.d.ts.map +0 -1
  1049. package/dist/validate-main.js +0 -143
  1050. package/dist/validate-main.js.map +0 -1
  1051. package/dist/validation-repair.d.ts +0 -10
  1052. package/dist/validation-repair.d.ts.map +0 -1
  1053. package/dist/validation-repair.js +0 -72
  1054. package/dist/validation-repair.js.map +0 -1
  1055. package/review/index.html +0 -14
  1056. package/review/src/App.tsx +0 -338
  1057. package/review/src/export-loader.test.ts +0 -57
  1058. package/review/src/export-loader.ts +0 -151
  1059. package/review/src/main.tsx +0 -15
  1060. package/review/src/styles.css +0 -162
  1061. package/review/src/types.ts +0 -47
  1062. package/review/tsconfig.json +0 -16
  1063. package/review/vite.config.ts +0 -20
  1064. package/scripts/build-sandbox-programs.ts +0 -22
  1065. package/scripts/verify-package.ts +0 -102
  1066. package/scripts/write-build-metadata.ts +0 -27
  1067. package/src/agent-smoke-main.ts +0 -64
  1068. package/src/agent-smoke.ts +0 -138
  1069. package/src/api-main.ts +0 -12
  1070. package/src/api.ts +0 -291
  1071. package/src/artifacts.ts +0 -357
  1072. package/src/audit.ts +0 -106
  1073. package/src/build-metadata.ts +0 -3
  1074. package/src/cli.ts +0 -504
  1075. package/src/codex-review.ts +0 -229
  1076. package/src/config.ts +0 -239
  1077. package/src/contracts.ts +0 -233
  1078. package/src/coupling.ts +0 -259
  1079. package/src/eval-main.ts +0 -93
  1080. package/src/evaluate.ts +0 -300
  1081. package/src/github.ts +0 -26
  1082. package/src/harbor-environment.ts +0 -17
  1083. package/src/harbor-results.ts +0 -144
  1084. package/src/harbor-task.ts +0 -533
  1085. package/src/hash.ts +0 -5
  1086. package/src/modal-auth.ts +0 -11
  1087. package/src/parallel.ts +0 -24
  1088. package/src/process.ts +0 -167
  1089. package/src/project-paths.ts +0 -15
  1090. package/src/provenance-associations.ts +0 -311
  1091. package/src/provenance.ts +0 -561
  1092. package/src/providers.ts +0 -22
  1093. package/src/reaudit-main.ts +0 -198
  1094. package/src/repair-main.ts +0 -209
  1095. package/src/repair.ts +0 -55
  1096. package/src/run-wait.ts +0 -40
  1097. package/src/sandbox/contracts.ts +0 -52
  1098. package/src/sandbox/index.ts +0 -23
  1099. package/src/sandbox/programs/author.ts +0 -19
  1100. package/src/sandbox/programs/prepare-repair.ts +0 -44
  1101. package/src/sandbox/programs/repair.ts +0 -132
  1102. package/src/sandbox/programs/review.ts +0 -19
  1103. package/src/sandbox/programs/validation-repair.ts +0 -153
  1104. package/src/sandbox/providers/docker/executor.ts +0 -115
  1105. package/src/sandbox/providers/modal/executor.ts +0 -217
  1106. package/src/sandbox/providers/vercel/command.ts +0 -127
  1107. package/src/sandbox/providers/vercel/executor.ts +0 -448
  1108. package/src/sandbox/providers/vercel/fetch.ts +0 -45
  1109. package/src/sandbox/timeout.ts +0 -56
  1110. package/src/setup/vercel/cli.ts +0 -403
  1111. package/src/setup/vercel/index.ts +0 -3
  1112. package/src/setup/vercel/probe.ts +0 -232
  1113. package/src/setup/vercel/profile.ts +0 -322
  1114. package/src/setup/vercel/runtime-image.ts +0 -204
  1115. package/src/setup/vercel/setup.ts +0 -419
  1116. package/src/subscription-auth.ts +0 -80
  1117. package/src/temporal/activities.ts +0 -1348
  1118. package/src/temporal/connection.ts +0 -23
  1119. package/src/temporal/worker-main.ts +0 -28
  1120. package/src/temporal/workflow.ts +0 -568
  1121. package/src/terminal-prompts.ts +0 -197
  1122. package/src/terminal-reporter.ts +0 -126
  1123. package/src/validate-main.ts +0 -177
  1124. package/src/validation-repair.ts +0 -94
  1125. package/tsconfig.build.json +0 -13
  1126. package/tsconfig.json +0 -21
@@ -1,1348 +0,0 @@
1
- import { mkdir, mkdtemp, readFile, rm, writeFile } from "node:fs/promises";
2
- import { tmpdir } from "node:os";
3
- import { join } from "node:path";
4
- import { CancelledFailure, Context } from "@temporalio/activity";
5
- import { ApplicationFailure } from "@temporalio/common";
6
- import { z } from "zod";
7
- import { type ArtifactStore, createArtifactStore } from "../artifacts.js";
8
- import { auditTaskDefinition } from "../audit.js";
9
- import {
10
- COUPLING_REVIEW_MODEL,
11
- couplingReviewInput,
12
- couplingReviewSchema,
13
- } from "../codex-review.js";
14
- import type { SelfBenchConfig, SelfBenchWorkerConfig } from "../config.js";
15
- import {
16
- type ArtifactRef,
17
- type AuditResult,
18
- type AuthoredTask,
19
- type AuthorOutcome,
20
- type Candidate,
21
- candidateSchema,
22
- type Difficulty,
23
- type DiscoveryResult,
24
- type ReviewResult,
25
- type RunRequest,
26
- taskDefinitionSchema,
27
- type ValidationResult,
28
- } from "../contracts.js";
29
- import {
30
- buildCouplingEvidence,
31
- discoverContractArtifacts,
32
- resolveCouplingReview,
33
- scanBaseContractArtifacts,
34
- } from "../coupling.js";
35
- import { assertPullRequestBelongsToRepository } from "../github.js";
36
- import { harborChildEnvironment } from "../harbor-environment.js";
37
- import {
38
- type HarborJobResult,
39
- harborInfrastructureError,
40
- readHarborJobResult,
41
- } from "../harbor-results.js";
42
- import { refreshHarborTask } from "../harbor-task.js";
43
- import { sha256 } from "../hash.js";
44
- import { runCommand } from "../process.js";
45
- import { projectRoot } from "../project-paths.js";
46
- import {
47
- assertProvenanceMatchesPullRequest,
48
- collectGitHubPullRequestProvenance,
49
- combineRunProvenance,
50
- type ProvenanceMessage,
51
- provenanceMessageSchema,
52
- } from "../provenance.js";
53
- import {
54
- createSandboxExecutor,
55
- SandboxExecutionError,
56
- type SandboxExecutor,
57
- type SandboxResult,
58
- type SandboxRunOptions,
59
- } from "../sandbox/index.js";
60
- import { githubToken, loadCodexModelAuth, loadPiModelAuth } from "../subscription-auth.js";
61
-
62
- const HARBOR_INFRASTRUCTURE_FAILURE_TYPE = "HarborInfrastructureFailure";
63
- const DISCOVERY_TIMEOUT_MS = 45 * 60 * 1000;
64
- const AGENT_INACTIVITY_TIMEOUT_MS = 8 * 60 * 1000;
65
- const AUTHORING_TIMEOUT_MS = 2 * 60 * 60 * 1000;
66
- const REVIEW_INACTIVITY_TIMEOUT_MS = 5 * 60 * 1000;
67
-
68
- const discoveryPlanSchema = z.object({
69
- candidates: z.array(
70
- z.object({
71
- candidateId: z.string().regex(/^[A-Za-z0-9][A-Za-z0-9._-]*$/),
72
- difficulty: z.enum(["easy", "medium", "hard"]),
73
- sourcePr: z.number().int().positive(),
74
- sourceUrl: z.string().url(),
75
- baseCommit: z.string().regex(/^[0-9a-f]{40}$/i),
76
- completedCommit: z.string().regex(/^[0-9a-f]{40}$/i),
77
- provenance: z.object({
78
- sourceType: z.enum(["pi", "claude-code", "codex", "generic", "github-pull-request"]),
79
- sessionId: z.string().min(1),
80
- messageIndex: z.number().int().nonnegative(),
81
- }),
82
- }),
83
- ),
84
- });
85
-
86
- export interface AuthorCandidateInput {
87
- readonly run: RunRequest;
88
- readonly candidate: Candidate;
89
- }
90
-
91
- export interface DiscoveryShardInput {
92
- readonly run: RunRequest;
93
- readonly wave: number;
94
- readonly shardIndex: number;
95
- readonly shardCount: number;
96
- readonly targetCounts: Readonly<Record<Difficulty, number>>;
97
- readonly excludedSourcePrs: readonly number[];
98
- }
99
-
100
- export interface TaskStageInput {
101
- readonly run: RunRequest;
102
- readonly task: AuthoredTask;
103
- }
104
-
105
- export interface RepairTaskInput extends TaskStageInput {
106
- readonly review: ArtifactRef;
107
- }
108
-
109
- export interface ValidationRepairTaskInput extends TaskStageInput {
110
- readonly validation: ValidationResult;
111
- }
112
-
113
- export interface ExportInput {
114
- readonly run: RunRequest;
115
- readonly tasks: readonly AuthoredTask[];
116
- }
117
-
118
- export interface SelfBenchActivities {
119
- collectRunProvenance(run: RunRequest): Promise<ArtifactRef>;
120
- discoverCandidateShard(input: DiscoveryShardInput): Promise<DiscoveryResult>;
121
- authorCandidate(input: AuthorCandidateInput): Promise<AuthorOutcome>;
122
- validateTask(input: TaskStageInput): Promise<ValidationResult>;
123
- repairValidationTask(input: ValidationRepairTaskInput): Promise<AuthorOutcome>;
124
- reviewTask(input: TaskStageInput): Promise<ReviewResult>;
125
- repairTask(input: RepairTaskInput): Promise<AuthorOutcome>;
126
- auditTask(input: TaskStageInput): Promise<AuditResult>;
127
- buildExport(input: ExportInput): Promise<ArtifactRef>;
128
- }
129
-
130
- export function createActivities(config: SelfBenchWorkerConfig): SelfBenchActivities {
131
- const store = createArtifactStore(config.artifact);
132
- const sandbox = createSandboxExecutor(config.execution);
133
- return {
134
- collectRunProvenance: (run) => collectRunProvenance(store, run),
135
- discoverCandidateShard: (input) => discoverCandidateShard(store, sandbox, input),
136
- authorCandidate: (input) => authorCandidate(store, sandbox, input),
137
- validateTask: (input) => validateTask(store, config.harborEnvironment, input),
138
- repairValidationTask: (input) => repairValidationTask(store, sandbox, input),
139
- reviewTask: (input) => reviewTask(store, sandbox, input),
140
- repairTask: (input) => repairTask(store, sandbox, input),
141
- auditTask: (input) => auditTask(store, input),
142
- buildExport: (input) => buildExport(store, input),
143
- };
144
- }
145
-
146
- async function collectRunProvenance(store: ArtifactStore, run: RunRequest): Promise<ArtifactRef> {
147
- return await withActivityHeartbeats(
148
- "collecting merged GitHub pull requests",
149
- async ({ signal }) => {
150
- const [localBytes, token] = await Promise.all([store.get(run.provenance), githubToken()]);
151
- const local = parseProvenance(localBytes);
152
- const github = await collectGitHubPullRequestProvenance(run.repository.url, token, signal);
153
- const messages = combineRunProvenance(run.repository.url, local, github);
154
- if (messages.length === 0) {
155
- throw ApplicationFailure.nonRetryable(
156
- "no sanitized local-session or GitHub pull-request provenance was found",
157
- "NoProvenance",
158
- );
159
- }
160
- return await store.put(
161
- `runs/${run.runId}/input/combined-provenance-attempt-${Context.current().info.attempt}.jsonl`,
162
- Buffer.from(`${messages.map((message) => JSON.stringify(message)).join("\n")}\n`),
163
- "application/x-ndjson",
164
- );
165
- },
166
- );
167
- }
168
-
169
- async function discoverCandidateShard(
170
- store: ArtifactStore,
171
- sandbox: SandboxExecutor,
172
- input: DiscoveryShardInput,
173
- ): Promise<DiscoveryResult> {
174
- const { run } = input;
175
- if (
176
- !Number.isInteger(input.wave) ||
177
- input.wave < 0 ||
178
- !Number.isInteger(input.shardIndex) ||
179
- !Number.isInteger(input.shardCount) ||
180
- Object.values(input.targetCounts).some((count) => !Number.isInteger(count) || count < 0) ||
181
- Object.values(input.targetCounts).every((count) => count === 0) ||
182
- input.shardIndex < 0 ||
183
- input.shardIndex >= input.shardCount
184
- ) {
185
- throw ApplicationFailure.nonRetryable(
186
- `invalid discovery shard ${input.shardIndex}/${input.shardCount}`,
187
- "InvalidDiscoveryShard",
188
- );
189
- }
190
- Context.current().heartbeat(
191
- `loading provenance for discovery wave ${input.wave} shard ${input.shardIndex}`,
192
- );
193
- const provenanceBytes = await store.get(run.provenance);
194
- const provenance = parseProvenance(provenanceBytes);
195
- const shard = provenance.filter(
196
- (_message, index) => index % input.shardCount === input.shardIndex,
197
- );
198
- const shardBytes = Buffer.from(`${shard.map((message) => JSON.stringify(message)).join("\n")}\n`);
199
- const shardPrefix = `runs/${run.runId}/discovery/wave-${input.wave}/shard-${input.shardIndex}`;
200
- const attemptPrefix = `${shardPrefix}/attempt-${Context.current().info.attempt}`;
201
- const checkpointKey = `${shardPrefix}/plan.json`;
202
- let planBytes = await store.getByKey(checkpointKey);
203
- let logs: ArtifactRef;
204
- if (planBytes) {
205
- logs = await store.put(
206
- `${attemptPrefix}/checkpoint.log`,
207
- Buffer.from("reused validated discovery shard checkpoint\n"),
208
- "text/plain",
209
- );
210
- } else {
211
- const [extension, piAuth, ghToken] = await Promise.all([
212
- readAsset("src/extensions/discovery.ts"),
213
- loadPiModelAuth(),
214
- githubToken(),
215
- ]);
216
- Context.current().heartbeat(
217
- `starting discovery wave ${input.wave} shard ${input.shardIndex} over ${shard.length} messages`,
218
- );
219
- const result = await runSandboxWithFailureLog(store, `${attemptPrefix}/modal.log`, () =>
220
- withActivityHeartbeats(
221
- `running discovery wave ${input.wave} shard ${input.shardIndex}`,
222
- (options) =>
223
- sandbox.run(
224
- {
225
- runId: run.runId,
226
- stage: `discover-${input.wave}-${input.shardIndex}`,
227
- timeoutMs: DISCOVERY_TIMEOUT_MS,
228
- inactivityTimeoutMs: AGENT_INACTIVITY_TIMEOUT_MS,
229
- files: [
230
- { path: "/work/discovery.ts", contents: extension },
231
- {
232
- path: "/work/excluded-source-prs.json",
233
- contents: JSON.stringify(input.excludedSourcePrs),
234
- },
235
- { path: "/work/provenance.jsonl", contents: shardBytes },
236
- { path: "/work/prompt.txt", contents: discoveryShardPrompt(input, shard.length) },
237
- ],
238
- outputPaths: ["/work/discovery.json"],
239
- secrets: {
240
- ...(piAuth.apiKey ? { OPENAI_API_KEY: piAuth.apiKey } : {}),
241
- ...(piAuth.authJson ? { SELFBENCH_PI_AUTH_JSON: piAuth.authJson } : {}),
242
- ...(ghToken ? { GH_TOKEN: ghToken } : {}),
243
- },
244
- environment: {
245
- SOURCE_REPO_URL: run.repository.url,
246
- SOURCE_COMMIT: run.repository.commit,
247
- AUTHOR_MODEL: run.authoring.model,
248
- SELFBENCH_DISCOVERY_EXCLUSIONS: "/work/excluded-source-prs.json",
249
- SELFBENCH_DISCOVERY_OUTPUT: "/work/discovery.json",
250
- },
251
- command: ["bash", "-lc", modalAgentScript("discovery.ts", "submit_discovery")],
252
- },
253
- options,
254
- ),
255
- ),
256
- );
257
- planBytes = result.outputs["/work/discovery.json"];
258
- logs = await store.put(
259
- `${attemptPrefix}/modal.log`,
260
- Buffer.from(`${result.stdout}\n${result.stderr}`),
261
- "text/plain",
262
- );
263
- if (result.exitCode !== 0 || !planBytes) {
264
- throw new Error(`discovery shard failed in ${result.sandboxId}; log: ${logs.uri}`);
265
- }
266
- parseDiscoveryPlan(planBytes, input.targetCounts, input.excludedSourcePrs, run.repository.url);
267
- await store.put(checkpointKey, planBytes, "application/json");
268
- }
269
- return await materializeDiscovery(
270
- store,
271
- run,
272
- shard,
273
- provenance,
274
- planBytes,
275
- logs,
276
- input.targetCounts,
277
- input.excludedSourcePrs,
278
- `${attemptPrefix}/report.json`,
279
- `w${input.wave}s${input.shardIndex}`,
280
- );
281
- }
282
-
283
- async function materializeDiscovery(
284
- store: ArtifactStore,
285
- run: RunRequest,
286
- provenance: readonly ProvenanceMessage[],
287
- allProvenance: readonly ProvenanceMessage[],
288
- planBytes: Uint8Array,
289
- logs: ArtifactRef,
290
- maxCandidates: Readonly<Record<Difficulty, number>>,
291
- excludedSourcePrs: readonly number[],
292
- reportKey: string,
293
- candidatePrefix: string,
294
- ): Promise<DiscoveryResult> {
295
- const plan = parseDiscoveryPlan(planBytes, maxCandidates, excludedSourcePrs, run.repository.url);
296
-
297
- const candidates: Candidate[] = [];
298
- for (const raw of plan.candidates) {
299
- const message = selectCandidateProvenance(provenance, allProvenance, raw);
300
- const staged = Buffer.from(
301
- `${JSON.stringify({ source: message, messages: [{ role: "user", content: message.content }] })}\n`,
302
- );
303
- const candidateId = `${candidatePrefix}-${raw.candidateId}`;
304
- const provenanceRef = await store.put(
305
- `runs/${run.runId}/provenance/${candidateId}.json`,
306
- staged,
307
- "application/json",
308
- );
309
- candidates.push(
310
- candidateSchema.parse({
311
- ...raw,
312
- candidateId,
313
- request: message.content,
314
- provenance: provenanceRef,
315
- }),
316
- );
317
- }
318
- const report = await store.put(
319
- reportKey,
320
- Buffer.from(`${JSON.stringify({ candidates, logs }, null, 2)}\n`),
321
- "application/json",
322
- );
323
- return { candidates, report };
324
- }
325
-
326
- export function selectCandidateProvenance(
327
- available: readonly ProvenanceMessage[],
328
- allProvenance: readonly ProvenanceMessage[],
329
- candidate: {
330
- readonly candidateId: string;
331
- readonly sourcePr: number;
332
- readonly sourceUrl: string;
333
- readonly provenance: {
334
- readonly sourceType: ProvenanceMessage["sourceType"];
335
- readonly sessionId: string;
336
- readonly messageIndex: number;
337
- };
338
- },
339
- ): ProvenanceMessage {
340
- const message = available.find(
341
- (item) =>
342
- item.sourceType === candidate.provenance.sourceType &&
343
- item.sessionId === candidate.provenance.sessionId &&
344
- item.messageIndex === candidate.provenance.messageIndex,
345
- );
346
- if (!message) {
347
- throw new Error(`candidate ${candidate.candidateId} references unknown provenance`);
348
- }
349
- assertProvenanceMatchesPullRequest(
350
- message,
351
- candidate.sourcePr,
352
- candidate.sourceUrl,
353
- allProvenance,
354
- );
355
- return message;
356
- }
357
-
358
- function parseDiscoveryPlan(
359
- planBytes: Uint8Array,
360
- maxCandidates: Readonly<Record<Difficulty, number>>,
361
- excludedSourcePrs: readonly number[],
362
- repositoryUrl: string,
363
- ) {
364
- const plan = discoveryPlanSchema.parse(JSON.parse(Buffer.from(planBytes).toString("utf8")));
365
- for (const difficulty of ["easy", "medium", "hard"] as const) {
366
- const actual = plan.candidates.filter(
367
- (candidate) => candidate.difficulty === difficulty,
368
- ).length;
369
- if (actual > maxCandidates[difficulty]) {
370
- throw new Error(
371
- `discovery produced ${actual} ${difficulty} candidates; expected at most ${maxCandidates[difficulty]}`,
372
- );
373
- }
374
- }
375
- const candidateIds = new Set<string>();
376
- const sourcePrs = new Set<number>();
377
- const excluded = new Set(excludedSourcePrs);
378
- for (const candidate of plan.candidates) {
379
- assertPullRequestBelongsToRepository(repositoryUrl, candidate.sourceUrl, candidate.sourcePr);
380
- if (candidateIds.has(candidate.candidateId)) {
381
- throw new Error(`discovery repeated candidate ID ${candidate.candidateId}`);
382
- }
383
- if (sourcePrs.has(candidate.sourcePr)) {
384
- throw new Error(`discovery repeated pull request ${candidate.sourcePr}`);
385
- }
386
- if (excluded.has(candidate.sourcePr)) {
387
- throw new Error(`discovery returned excluded pull request ${candidate.sourcePr}`);
388
- }
389
- candidateIds.add(candidate.candidateId);
390
- sourcePrs.add(candidate.sourcePr);
391
- }
392
- return plan;
393
- }
394
-
395
- async function authorCandidate(
396
- store: ArtifactStore,
397
- sandbox: SandboxExecutor,
398
- input: AuthorCandidateInput,
399
- ): Promise<AuthorOutcome> {
400
- const { run, candidate } = input;
401
- Context.current().heartbeat(`authoring ${candidate.candidateId}`);
402
- const checkpointPrefix = `runs/${run.runId}/authoring/${candidate.candidateId}`;
403
- const [definitionCheckpoint, bundleCheckpoint] = await Promise.all([
404
- store.getByKey(`${checkpointPrefix}/definition.json`),
405
- store.getByKey(`${checkpointPrefix}/harbor-task.tar.gz`),
406
- ]);
407
- if (definitionCheckpoint || bundleCheckpoint) {
408
- if (!definitionCheckpoint || !bundleCheckpoint) {
409
- throw new Error(`incomplete authoring checkpoint for ${candidate.candidateId}`);
410
- }
411
- return await materializeAuthoredTask(
412
- store,
413
- run,
414
- candidate,
415
- definitionCheckpoint,
416
- bundleCheckpoint,
417
- );
418
- }
419
- const [provenance, extension, skill, compiler, piAuth, ghToken] = await Promise.all([
420
- store.get(candidate.provenance),
421
- readAsset("src/extensions/authoring.ts"),
422
- readAsset("src/skills/selfbench/SKILL.md"),
423
- readAsset("dist/sandbox-author.bundle.js"),
424
- loadPiModelAuth(),
425
- githubToken(),
426
- ]);
427
- const prompt = authoringPrompt(run, candidate);
428
- const attemptLogKey = `runs/${run.runId}/authoring/${candidate.candidateId}/attempt-${Context.current().info.attempt}/modal.log`;
429
- const result = await runSandboxWithFailureLog(store, attemptLogKey, () =>
430
- withActivityHeartbeats(`running author sandbox for ${candidate.candidateId}`, (options) =>
431
- sandbox.run(
432
- {
433
- runId: run.runId,
434
- stage: `author-${candidate.candidateId}`,
435
- timeoutMs: AUTHORING_TIMEOUT_MS,
436
- inactivityTimeoutMs: AGENT_INACTIVITY_TIMEOUT_MS,
437
- files: [
438
- { path: "/work/authoring.ts", contents: extension },
439
- { path: "/work/selfbench-skill/SKILL.md", contents: skill },
440
- { path: "/work/sandbox-author.js", contents: compiler },
441
- { path: "/work/provenance.json", contents: provenance },
442
- { path: "/work/prompt.txt", contents: prompt },
443
- ],
444
- outputPaths: ["/work/task.tar.gz", "/work/definition.json"],
445
- secrets: {
446
- ...(piAuth.apiKey ? { OPENAI_API_KEY: piAuth.apiKey } : {}),
447
- ...(piAuth.authJson ? { SELFBENCH_PI_AUTH_JSON: piAuth.authJson } : {}),
448
- ...(ghToken ? { GH_TOKEN: ghToken } : {}),
449
- },
450
- environment: {
451
- SOURCE_REPO_URL: run.repository.url,
452
- SOURCE_COMMIT: run.repository.commit,
453
- AUTHOR_MODEL: run.authoring.model,
454
- SELFBENCH_TASK_OUTPUT: "/work/tasks",
455
- },
456
- command: ["bash", "-lc", authoringScript()],
457
- },
458
- options,
459
- ),
460
- ),
461
- );
462
- const log = await store.put(
463
- attemptLogKey,
464
- Buffer.from(`${result.stdout}\n${result.stderr}`),
465
- "text/plain",
466
- );
467
- const bundle = result.outputs["/work/task.tar.gz"];
468
- const definitionBytes = result.outputs["/work/definition.json"];
469
- if (result.exitCode !== 0 || !bundle || !definitionBytes) {
470
- return {
471
- kind: "rejected",
472
- candidateId: candidate.candidateId,
473
- reason: `authoring did not produce a valid ${candidate.difficulty} task; log: ${log.uri}`,
474
- };
475
- }
476
- return await materializeAuthoredTask(store, run, candidate, definitionBytes, bundle);
477
- }
478
-
479
- async function materializeAuthoredTask(
480
- store: ArtifactStore,
481
- run: RunRequest,
482
- candidate: Candidate,
483
- definitionBytes: Uint8Array,
484
- bundle: Uint8Array,
485
- ): Promise<AuthorOutcome> {
486
- const definition = taskDefinitionSchema.parse(
487
- JSON.parse(Buffer.from(definitionBytes).toString("utf8")),
488
- );
489
- if (
490
- definition.sourcePr !== candidate.sourcePr ||
491
- definition.baseCommit !== candidate.baseCommit ||
492
- definition.difficulty !== candidate.difficulty
493
- ) {
494
- return {
495
- kind: "rejected",
496
- candidateId: candidate.candidateId,
497
- reason: "authored task does not match its assigned PR, base commit, and difficulty",
498
- };
499
- }
500
- const [definitionRef, bundleRef] = await Promise.all([
501
- store.put(
502
- `runs/${run.runId}/authoring/${candidate.candidateId}/definition.json`,
503
- definitionBytes,
504
- "application/json",
505
- ),
506
- store.put(
507
- `runs/${run.runId}/authoring/${candidate.candidateId}/harbor-task.tar.gz`,
508
- bundle,
509
- "application/gzip",
510
- ),
511
- ]);
512
- return {
513
- kind: "authored",
514
- task: {
515
- candidateId: candidate.candidateId,
516
- taskId: definition.taskId,
517
- definition: definitionRef,
518
- bundle: bundleRef,
519
- },
520
- };
521
- }
522
-
523
- async function validateTask(
524
- store: ArtifactStore,
525
- harborEnvironment: SelfBenchConfig["harborEnvironment"],
526
- input: TaskStageInput,
527
- ): Promise<ValidationResult> {
528
- const attemptPrefix = `runs/${input.run.runId}/validation/${input.task.taskId}/${input.task.bundle.sha256.slice(0, 12)}/attempt-${Context.current().info.attempt}`;
529
- return await withTaskBundle(store, input.task, async (taskDirectory, root) => {
530
- Context.current().heartbeat(`running Harbor nop for ${input.task.taskId}`);
531
- const nop = await withActivityHeartbeats(
532
- `running Harbor nop for ${input.task.taskId}`,
533
- (options) =>
534
- runHarborGate(
535
- taskDirectory,
536
- join(root, "jobs"),
537
- "nop",
538
- input.task.taskId,
539
- harborEnvironment,
540
- options.signal,
541
- ),
542
- );
543
- Context.current().heartbeat(`running Harbor oracle for ${input.task.taskId}`);
544
- const oracle = await withActivityHeartbeats(
545
- `running Harbor oracle for ${input.task.taskId}`,
546
- (options) =>
547
- runHarborGate(
548
- taskDirectory,
549
- join(root, "jobs"),
550
- "oracle",
551
- input.task.taskId,
552
- harborEnvironment,
553
- options.signal,
554
- ),
555
- );
556
- const nopChecks = rewards(nop.trial);
557
- const oracleChecks = rewards(oracle.trial);
558
- const nopPassed =
559
- !exception(nop.trial) &&
560
- numberValue(nopChecks.fail_to_pass) === 0 &&
561
- numberValue(nopChecks.pass_to_pass) >= 1 &&
562
- numberValue(nopChecks.setup_completed) >= 1;
563
- const oraclePassed =
564
- !exception(oracle.trial) &&
565
- numberValue(oracleChecks.patch_applied) >= 1 &&
566
- numberValue(oracleChecks.fail_to_pass) >= 1 &&
567
- numberValue(oracleChecks.pass_to_pass) >= 1 &&
568
- numberValue(oracleChecks.deterministic) >= 1 &&
569
- numberValue(oracleChecks.setup_completed) >= 1;
570
- const nopOutput = verifierOutput(nop);
571
- const oracleOutput = verifierOutput(oracle);
572
- const [nopRef, oracleRef, nopOutputRef, oracleOutputRef] = await Promise.all([
573
- store.put(
574
- `${attemptPrefix}/nop.json`,
575
- Buffer.from(`${JSON.stringify({ job: nop.job, trial: nop.trial }, null, 2)}\n`),
576
- "application/json",
577
- ),
578
- store.put(
579
- `${attemptPrefix}/oracle.json`,
580
- Buffer.from(`${JSON.stringify({ job: oracle.job, trial: oracle.trial }, null, 2)}\n`),
581
- "application/json",
582
- ),
583
- nopOutput
584
- ? store.put(`${attemptPrefix}/nop-verifier.log`, Buffer.from(nopOutput), "text/plain")
585
- : undefined,
586
- oracleOutput
587
- ? store.put(`${attemptPrefix}/oracle-verifier.log`, Buffer.from(oracleOutput), "text/plain")
588
- : undefined,
589
- ]);
590
- return {
591
- taskId: input.task.taskId,
592
- accepted: nopPassed && oraclePassed,
593
- nop: {
594
- passed: nopPassed,
595
- result: nopRef,
596
- ...(nopOutputRef ? { output: nopOutputRef } : {}),
597
- },
598
- oracle: {
599
- passed: oraclePassed,
600
- result: oracleRef,
601
- ...(oracleOutputRef ? { output: oracleOutputRef } : {}),
602
- },
603
- ...(!nopPassed || !oraclePassed
604
- ? {
605
- reason: harborGateFailureReason(
606
- nopPassed,
607
- nopChecks,
608
- oraclePassed,
609
- oracleChecks,
610
- nopOutput,
611
- oracleOutput,
612
- ),
613
- }
614
- : {}),
615
- };
616
- });
617
- }
618
-
619
- async function repairValidationTask(
620
- store: ArtifactStore,
621
- sandbox: SandboxExecutor,
622
- input: ValidationRepairTaskInput,
623
- ): Promise<AuthorOutcome> {
624
- Context.current().heartbeat(`repairing validation harness for ${input.task.taskId}`);
625
- const checkpointPrefix = `runs/${input.run.runId}/validation-repairs/${input.task.taskId}/${input.task.bundle.sha256.slice(0, 12)}`;
626
- const [definitionCheckpoint, bundleCheckpoint] = await Promise.all([
627
- store.getByKey(`${checkpointPrefix}/definition.json`),
628
- store.getByKey(`${checkpointPrefix}/harbor-task.tar.gz`),
629
- ]);
630
- if (definitionCheckpoint || bundleCheckpoint) {
631
- if (!definitionCheckpoint || !bundleCheckpoint) {
632
- throw new Error(`incomplete validation repair checkpoint for ${input.task.taskId}`);
633
- }
634
- const definition = taskDefinitionSchema.parse(
635
- JSON.parse(Buffer.from(definitionCheckpoint).toString("utf8")),
636
- );
637
- return {
638
- kind: "authored",
639
- task: {
640
- ...input.task,
641
- taskId: definition.taskId,
642
- definition: await store.put(
643
- `${checkpointPrefix}/definition.json`,
644
- definitionCheckpoint,
645
- "application/json",
646
- ),
647
- bundle: await store.put(
648
- `${checkpointPrefix}/harbor-task.tar.gz`,
649
- bundleCheckpoint,
650
- "application/gzip",
651
- ),
652
- },
653
- };
654
- }
655
-
656
- const attemptPrefix = `${checkpointPrefix}/attempt-${Context.current().info.attempt}`;
657
- const [bundle, definition, repairer, authJson] = await Promise.all([
658
- store.get(input.task.bundle),
659
- store.get(input.task.definition),
660
- readAsset("dist/sandbox-validation-repair.bundle.js"),
661
- loadPiModelAuth(),
662
- ]); // Full verifier logs remain durable artifacts. The validation reason already carries bounded
663
- // tails for failed gates, which keeps the repair prompt within the model context window.
664
- const diagnostics = Buffer.from(input.validation.reason ?? "validation failed without a reason");
665
- const result = await withActivityHeartbeats(
666
- `running validation repair sandbox for ${input.task.taskId}`,
667
- (options) =>
668
- sandbox.run(
669
- {
670
- runId: input.run.runId,
671
- stage: `validation-repair-${input.task.taskId}`,
672
- timeoutMs: 2 * 60 * 60 * 1000,
673
- inactivityTimeoutMs: AGENT_INACTIVITY_TIMEOUT_MS,
674
- files: [
675
- { path: "/work/task.tar.gz", contents: bundle },
676
- { path: "/work/original-definition.json", contents: definition },
677
- { path: "/work/validation-diagnostics.txt", contents: diagnostics },
678
- { path: "/work/sandbox-validation-repair.js", contents: repairer },
679
- ],
680
- outputPaths: [
681
- "/work/repaired-definition.json",
682
- "/work/repaired-test.patch",
683
- "/work/repair-report.json",
684
- ],
685
- secrets: {
686
- ...(authJson.apiKey ? { OPENAI_API_KEY: authJson.apiKey } : {}),
687
- ...(authJson.authJson ? { SELFBENCH_PI_AUTH_JSON: authJson.authJson } : {}),
688
- },
689
- environment: { SELFBENCH_REPAIR_MODEL: input.run.authoring.model },
690
- command: [
691
- "node",
692
- "/work/sandbox-validation-repair.js",
693
- "/work/task.tar.gz",
694
- "/work/original-definition.json",
695
- "/work/validation-diagnostics.txt",
696
- "/work/repaired-definition.json",
697
- "/work/repaired-test.patch",
698
- "/work/repair-report.json",
699
- ],
700
- },
701
- options,
702
- ),
703
- );
704
- const repairedDefinition = result.outputs["/work/repaired-definition.json"];
705
- const repairedTestPatch = result.outputs["/work/repaired-test.patch"];
706
- const repairReport = result.outputs["/work/repair-report.json"];
707
- const logs = await store.put(
708
- `${attemptPrefix}/sandbox.log`,
709
- Buffer.from(`${result.stdout}\n${result.stderr}`),
710
- "text/plain",
711
- );
712
- if (result.exitCode !== 0 || !repairedDefinition || !repairedTestPatch || !repairReport) {
713
- return {
714
- kind: "rejected",
715
- candidateId: input.task.candidateId,
716
- reason: `validation repair failed in ${result.sandboxId}; log: ${logs.uri}`,
717
- };
718
- }
719
- const parsedDefinition = taskDefinitionSchema.parse(
720
- JSON.parse(Buffer.from(repairedDefinition).toString("utf8")),
721
- );
722
- const repairedBundle = await withTaskBundle(store, input.task, async (taskDirectory, root) => {
723
- await writeFile(join(taskDirectory, "tests/test.patch"), repairedTestPatch);
724
- await refreshHarborTask(taskDirectory, parsedDefinition);
725
- const output = join(root, "repaired-task.tar.gz");
726
- await runCommand("tar", ["-czf", output, "-C", root, "harbor-task"]);
727
- return await readFile(output);
728
- });
729
- await store.put(`${attemptPrefix}/report.json`, repairReport, "application/json");
730
- const [definitionRef, bundleRef] = await Promise.all([
731
- store.put(`${checkpointPrefix}/definition.json`, repairedDefinition, "application/json"),
732
- store.put(`${checkpointPrefix}/harbor-task.tar.gz`, repairedBundle, "application/gzip"),
733
- ]);
734
- return {
735
- kind: "authored",
736
- task: { ...input.task, definition: definitionRef, bundle: bundleRef },
737
- };
738
- }
739
-
740
- async function reviewTask(
741
- store: ArtifactStore,
742
- sandbox: SandboxExecutor,
743
- input: TaskStageInput,
744
- ): Promise<ReviewResult> {
745
- const reportKey = `runs/${input.run.runId}/reviews/${input.task.taskId}/${input.task.bundle.sha256.slice(0, 12)}/attempt-${Context.current().info.attempt}.json`;
746
- return await withTaskBundle(store, input.task, async (taskDirectory, root) => {
747
- Context.current().heartbeat(`reviewing ${input.task.taskId}`);
748
- const [definitionBytes, testPatch, goldPatch] = await Promise.all([
749
- store.get(input.task.definition),
750
- readFile(join(taskDirectory, "tests/test.patch")),
751
- readFile(join(taskDirectory, "solution/gold.patch")),
752
- ]);
753
- const definition = taskDefinitionSchema.parse(
754
- JSON.parse(Buffer.from(definitionBytes).toString("utf8")),
755
- );
756
- const testPatchText = testPatch.toString("utf8");
757
- const goldPatchText = goldPatch.toString("utf8");
758
- const baseDirectory = join(root, "review-base");
759
- await mkdir(baseDirectory);
760
- await runCommand("tar", [
761
- "-xzf",
762
- join(taskDirectory, "environment/repo.tar.gz"),
763
- "-C",
764
- baseDirectory,
765
- ]);
766
- const candidates = discoverContractArtifacts(testPatchText);
767
- const baseArtifacts = await scanBaseContractArtifacts(baseDirectory, root, candidates);
768
- const couplingEvidence = buildCouplingEvidence({
769
- prompt: definition.prompt,
770
- testPatch: testPatchText,
771
- goldPatch: goldPatchText,
772
- baseArtifacts,
773
- });
774
- const [reviewer, authJson] = await Promise.all([
775
- readAsset("dist/sandbox-review.bundle.js"),
776
- loadPiModelAuth(),
777
- ]);
778
- const result = await withActivityHeartbeats(
779
- `running sandboxed coupling review for ${input.task.taskId}`,
780
- (options) =>
781
- sandbox.run(
782
- {
783
- runId: input.run.runId,
784
- stage: `review-${input.task.taskId}`,
785
- timeoutMs: 15 * 60 * 1000,
786
- inactivityTimeoutMs: REVIEW_INACTIVITY_TIMEOUT_MS,
787
- files: [
788
- { path: "/work/sandbox-review.js", contents: reviewer },
789
- {
790
- path: "/work/review-input.md",
791
- contents: couplingReviewInput(
792
- definition.prompt,
793
- testPatchText,
794
- goldPatchText,
795
- couplingEvidence,
796
- ),
797
- },
798
- ],
799
- outputPaths: ["/work/review.json"],
800
- secrets: {
801
- ...(authJson.apiKey ? { OPENAI_API_KEY: authJson.apiKey } : {}),
802
- ...(authJson.authJson ? { SELFBENCH_PI_AUTH_JSON: authJson.authJson } : {}),
803
- },
804
- environment: { SELFBENCH_REVIEW_OUTPUT: "/work/review.json" },
805
- command: ["node", "/work/sandbox-review.js"],
806
- },
807
- options,
808
- ),
809
- );
810
- const output = result.outputs["/work/review.json"];
811
- if (result.exitCode !== 0 || !output) {
812
- throw new Error(
813
- `sandboxed coupling review failed in ${result.sandboxId}: ${result.stderr.trim() || result.stdout.trim()}`,
814
- );
815
- }
816
- const review = couplingReviewSchema.parse(JSON.parse(Buffer.from(output).toString("utf8")));
817
- const resolution = resolveCouplingReview(couplingEvidence, review);
818
- const report = await store.put(
819
- reportKey,
820
- Buffer.from(
821
- `${JSON.stringify(
822
- {
823
- ...review,
824
- verdict: resolution.verdict,
825
- reason: resolution.reason,
826
- reviewer: COUPLING_REVIEW_MODEL,
827
- sandboxId: result.sandboxId,
828
- couplingEvidence,
829
- },
830
- null,
831
- 2,
832
- )}\n`,
833
- ),
834
- "application/json",
835
- );
836
- return {
837
- taskId: input.task.taskId,
838
- accepted: resolution.verdict === "clean",
839
- report,
840
- ...(resolution.verdict !== "clean" ? { reason: resolution.reason } : {}),
841
- };
842
- });
843
- }
844
-
845
- async function repairTask(
846
- store: ArtifactStore,
847
- sandbox: SandboxExecutor,
848
- input: RepairTaskInput,
849
- ): Promise<AuthorOutcome> {
850
- Context.current().heartbeat(`repairing held-out tests for ${input.task.taskId}`);
851
- const checkpointPrefix = `runs/${input.run.runId}/repairs/${input.task.taskId}`;
852
- const attemptPrefix = `${checkpointPrefix}/attempt-${Context.current().info.attempt}`;
853
- const checkpoint = await store.getByKey(`${checkpointPrefix}/harbor-task.tar.gz`);
854
- if (checkpoint) {
855
- return {
856
- kind: "authored",
857
- task: {
858
- ...input.task,
859
- bundle: await store.put(
860
- `${checkpointPrefix}/harbor-task.tar.gz`,
861
- checkpoint,
862
- "application/gzip",
863
- ),
864
- },
865
- };
866
- }
867
- const [bundle, review, repairer, authJson] = await Promise.all([
868
- store.get(input.task.bundle),
869
- store.get(input.review),
870
- readAsset("dist/sandbox-repair.bundle.js"),
871
- loadCodexModelAuth(),
872
- ]);
873
- const result = await withActivityHeartbeats(
874
- `running test repair sandbox for ${input.task.taskId}`,
875
- (options) =>
876
- sandbox.run(
877
- {
878
- runId: input.run.runId,
879
- stage: `repair-${input.task.taskId}`,
880
- timeoutMs: 2 * 60 * 60 * 1000,
881
- inactivityTimeoutMs: AGENT_INACTIVITY_TIMEOUT_MS,
882
- files: [
883
- { path: "/work/task.tar.gz", contents: bundle },
884
- { path: "/work/review.json", contents: review },
885
- { path: "/work/sandbox-repair.js", contents: repairer },
886
- ],
887
- outputPaths: ["/work/repaired-task.tar.gz", "/work/repair-report.json"],
888
- secrets: {
889
- ...(authJson.apiKey ? { OPENAI_API_KEY: authJson.apiKey } : {}),
890
- ...(authJson.authJson ? { SELFBENCH_CODEX_AUTH_JSON: authJson.authJson } : {}),
891
- },
892
- environment: { SELFBENCH_REPAIR_MODEL: input.run.authoring.model },
893
- command: [
894
- "node",
895
- "/work/sandbox-repair.js",
896
- "/work/task.tar.gz",
897
- "/work/review.json",
898
- "/work/repaired-task.tar.gz",
899
- "/work/repair-report.json",
900
- ],
901
- },
902
- options,
903
- ),
904
- );
905
- const repairedBundle = result.outputs["/work/repaired-task.tar.gz"];
906
- const repairReport = result.outputs["/work/repair-report.json"];
907
- const logs = await store.put(
908
- `${attemptPrefix}/sandbox.log`,
909
- Buffer.from(`${result.stdout}\n${result.stderr}`),
910
- "text/plain",
911
- );
912
- if (result.exitCode !== 0 || !repairedBundle || !repairReport) {
913
- return {
914
- kind: "rejected",
915
- candidateId: input.task.candidateId,
916
- reason: `test repair failed in ${result.sandboxId}; log: ${logs.uri}`,
917
- };
918
- }
919
- await store.put(`${attemptPrefix}/report.json`, repairReport, "application/json");
920
- const repairedRef = await store.put(
921
- `${checkpointPrefix}/harbor-task.tar.gz`,
922
- repairedBundle,
923
- "application/gzip",
924
- );
925
- return { kind: "authored", task: { ...input.task, bundle: repairedRef } };
926
- }
927
-
928
- async function auditTask(store: ArtifactStore, input: TaskStageInput): Promise<AuditResult> {
929
- return await withTaskBundle(store, input.task, async (taskDirectory) => {
930
- const [definitionBytes, goldPatch, testPatch] = await Promise.all([
931
- store.get(input.task.definition),
932
- readFile(join(taskDirectory, "solution/gold.patch"), "utf8"),
933
- readFile(join(taskDirectory, "tests/test.patch"), "utf8"),
934
- ]);
935
- const definition = taskDefinitionSchema.parse(
936
- JSON.parse(Buffer.from(definitionBytes).toString("utf8")),
937
- );
938
- const audit = auditTaskDefinition(definition, goldPatch, testPatch);
939
- const report = await store.put(
940
- `runs/${input.run.runId}/audits/${input.task.taskId}/${input.task.bundle.sha256.slice(0, 12)}.json`,
941
- Buffer.from(`${JSON.stringify(audit, null, 2)}\n`),
942
- "application/json",
943
- );
944
- return {
945
- taskId: input.task.taskId,
946
- accepted: audit.accepted,
947
- report,
948
- ...(audit.accepted ? {} : { reason: audit.blockers.join("; ") }),
949
- };
950
- });
951
- }
952
-
953
- async function buildExport(store: ArtifactStore, input: ExportInput): Promise<ArtifactRef> {
954
- return await withTemporaryDirectory("selfbench-export-", async (root) => {
955
- const tasksRoot = join(root, "tasks");
956
- await mkdir(tasksRoot, { recursive: true });
957
- const manifestTasks: { taskId: string; sha256: string }[] = [];
958
- for (const task of input.tasks) {
959
- const bundle = await store.get(task.bundle);
960
- const path = join(tasksRoot, `${task.taskId}.tar.gz`);
961
- const expanded = join(root, `expanded-${task.taskId}`);
962
- const sourceArchive = join(expanded, "source.tar.gz");
963
- await mkdir(expanded, { recursive: true });
964
- await writeFile(sourceArchive, bundle);
965
- await runCommand("tar", ["-xzf", sourceArchive, "-C", expanded]);
966
- const definition = taskDefinitionSchema.parse(
967
- JSON.parse(Buffer.from(await store.get(task.definition)).toString("utf8")),
968
- );
969
- await refreshHarborTask(join(expanded, "harbor-task"), definition);
970
- await runCommand("tar", ["-czf", path, "-C", expanded, "harbor-task"]);
971
- manifestTasks.push({ taskId: task.taskId, sha256: sha256(await readFile(path)) });
972
- }
973
- await writeFile(
974
- join(root, "manifest.json"),
975
- `${JSON.stringify(
976
- {
977
- schemaVersion: 1,
978
- runId: input.run.runId,
979
- candidateCounts: input.run.candidateCounts,
980
- repository: input.run.repository,
981
- version: input.run.version,
982
- acceptedCount: manifestTasks.length,
983
- tasks: manifestTasks,
984
- },
985
- null,
986
- 2,
987
- )}\n`,
988
- );
989
- const archive = join(root, "export.tar.gz");
990
- await runCommand("tar", ["-czf", archive, "-C", root, "manifest.json", "tasks"]);
991
- return await store.putFile(
992
- `runs/${input.run.runId}/export/attempt-${Context.current().info.attempt}/selfbench-${input.run.runId}.tar.gz`,
993
- archive,
994
- "application/gzip",
995
- );
996
- });
997
- }
998
-
999
- function discoveryShardPrompt(input: DiscoveryShardInput, provenanceCount: number): string {
1000
- return `Discover and rank SelfBench candidates from this assigned provenance shard. Return at most easy=${input.targetCounts.easy}, medium=${input.targetCounts.medium}, hard=${input.targetCounts.hard}. Before selecting a pull request, query its number against /work/excluded-source-prs.json with jq; do not print or read the full exclusion list into context. The submit_discovery tool also removes any already-considered pull requests as a final safeguard.
1001
-
1002
- Assign each candidate exactly one difficulty using the separable implementation core, excluding tests, generated code, formatting churn, and unrelated cleanup:
1003
- - easy: at least 20 changed implementation lines across at least 1 implementation file, with at least 1 viable fail-to-pass test;
1004
- - medium: at least 50 changed implementation lines across at least 2 implementation files, with at least 1 fail-to-pass and 1 pass-to-pass test;
1005
- - hard: at least 100 changed implementation lines across at least 3 implementation files, with at least 1 fail-to-pass and 2 pass-to-pass tests.
1006
- Choose the highest tier whose thresholds the candidate honestly meets. Every tier also requires focused public behavior, separable held-out tests, deterministic setup, and an authentic pre-implementation request. Prefer stable public APIs, commands, persistence boundaries, or extension seams.
1007
-
1008
- Every candidate must be a pull request from SOURCE_REPO_URL. Repository names or pull requests mentioned inside provenance messages are context only; never follow them into another repository. sourceUrl must be the canonical GitHub pull-request URL for SOURCE_REPO_URL and sourcePr must match its number.
1009
-
1010
- The sanitized corpus at /work/provenance.jsonl contains ${provenanceCount} human requests. Local Pi, Claude Code, and Codex requests are preferred when they clearly correspond to the same change. A local record with sourcePr and sourceUrl has an explicit user-supplied association and may be used only for that PR. Records with sourceType github-pull-request contain the non-bot PR author's exact title and optional body and are valid fallback provenance; they too may be used only for their own sourcePr and sourceUrl. Select provenance only by an exact sourceType, sessionId, and messageIndex present in the corpus. Never invent or reconstruct request text from implementation or tests. Inspect merged PR metadata and diffs with gh and git. Resolve the exact base and completed 40-character commits. Do not modify the repository.
1011
-
1012
- Return fewer candidates when the shard does not contain enough valid requests; an empty candidate list is valid. Call submit_discovery exactly once. Do not return prose after the tool call.`;
1013
- }
1014
-
1015
- function authoringPrompt(run: RunRequest, candidate: Candidate): string {
1016
- const tierRequirements = {
1017
- easy: "at least 20 changed implementation lines across at least 1 implementation file, at least 1 fail-to-pass test, and no pass-to-pass minimum",
1018
- medium:
1019
- "at least 50 changed implementation lines across at least 2 implementation files, at least 1 fail-to-pass test, and at least 1 pass-to-pass test",
1020
- hard: "at least 100 changed implementation lines across at least 3 implementation files, at least 1 fail-to-pass test, and at least 2 pass-to-pass tests",
1021
- } as const;
1022
- return `Author exactly one ${candidate.difficulty} SelfBench task for this assigned candidate:
1023
-
1024
- ${JSON.stringify(
1025
- {
1026
- sourcePr: candidate.sourcePr,
1027
- sourceUrl: candidate.sourceUrl,
1028
- baseCommit: candidate.baseCommit,
1029
- completedCommit: candidate.completedCommit,
1030
- request: candidate.request,
1031
- },
1032
- null,
1033
- 2,
1034
- )}
1035
-
1036
- Use only this candidate. Do not discover alternatives and do not run Harbor. Read /work/provenance.json only to verify the supplied authentic request. Inspect the base and completed commits. Split the completed change into a non-test gold patch and a held-out test patch. The task must meet ${candidate.difficulty} mode: ${tierRequirements[candidate.difficulty]}.
1037
-
1038
- Held-out tests must verify public behavior through an existing API, command, persistence boundary, or extension seam. When the request is about an endpoint/provider contract, exercise that boundary instead of manually composing internal translators, context/option builders, or model factories. Do not import gold-specific private helpers/modules or assert exact internal SQL, query counts, schema/index names, object identity, telemetry layout, error wording, endpoint/response shapes, or UI copy/order unless the authentic request explicitly makes that artifact public. Assert requested semantic values rather than larger retained/raw payloads that happen to contain them, and preserve valid adjacent input content unless the request says to discard it. Cover every material behavior in the prompt, including central authorization, error, and UI states. A different correct implementation with different helpers, file boundaries, API presentation, and UI composition must be able to pass; reject the candidate when no stable public seam exists.
1039
-
1040
- Call submit_task exactly once. Its definition must use schemaVersion 1 and difficulty "${candidate.difficulty}". testCommand must contain the literal {tests} exactly once as an unquoted shell argument list, and every selected test path must be supplied only through that placeholder—never quote the whole placeholder, assign it to one scalar, or hard-code a fail-to-pass or pass-to-pass path elsewhere in the command. Use one repository-native test mode and bundler per command rather than chaining equivalent suites or bypassing repository wrappers with a generic runner. The prompt must not mention the PR, commits, patches, test names, or implementation. Use repository-native frozen setup commands with the package manager version declared by the repository and only required toolchains. setupCommand must fully prepare the pinned checkout to run testCommand, including any repository build, test-fixture generation, native compiler, or browser/runtime installation required after dependency installation; inspect the repository's CI and test scripts rather than assuming install-only setup is sufficient. For Playwright tests, install the required browser and OS dependencies during setup (for example, pnpm exec playwright install --with-deps chromium); the compiler exposes a shared PLAYWRIGHT_BROWSERS_PATH to the verifier user.
1041
-
1042
- Before submission, preflight the exact split locally against the pinned base and completed states: the base plus held-out test patch must make failToPass fail while passToPass succeeds, and the completed implementation plus the same held-out patch must make both selections succeed twice. If setup or focused tests cannot be run within the authoring sandbox, reject the candidate instead of guessing a testCommand. Default resources are 4 CPU, 8192 MB memory, 20480 MB storage; default timeouts are 900 setup, 2400 agent, 900 tests. Do not return prose after the tool call.
1043
-
1044
- Pinned SelfBench version: ${run.version.selfbenchCommit}.`;
1045
- }
1046
-
1047
- function modalAgentScript(extension: string, tool: string): string {
1048
- return `${sandboxBootstrap()}
1049
- clone_source
1050
- cd /work/repo
1051
- run_with_heartbeat pi --print --mode json --no-session --no-approve --no-skills --no-prompt-templates --no-context-files --no-extensions \\
1052
- --extension /work/${extension} --provider "$(model_provider)" --model "$AUTHOR_MODEL" --thinking high \\
1053
- --tools read,bash,grep,find,ls,${tool} "$(cat /work/prompt.txt)"`;
1054
- }
1055
-
1056
- function authoringScript(): string {
1057
- return `${sandboxBootstrap()}
1058
- clone_source
1059
- mkdir -p /work/tasks
1060
- cd /work/repo
1061
- run_with_heartbeat pi --print --mode json --no-session --no-approve --no-prompt-templates --no-context-files --no-extensions \\
1062
- --skill /work/selfbench-skill --extension /work/authoring.ts \\
1063
- --provider "$(model_provider)" --model "$AUTHOR_MODEL" --thinking high \\
1064
- --tools read,bash,grep,find,ls,submit_task "$(cat /work/prompt.txt)"
1065
- node /work/sandbox-author.js /work/tasks /work/repo /work/harbor-task
1066
- cp /work/tasks/*/definition.json /work/definition.json
1067
- tar -czf /work/task.tar.gz -C /work harbor-task`;
1068
- }
1069
-
1070
- function sandboxBootstrap(): string {
1071
- return `set -euo pipefail
1072
- mkdir -p "$HOME/.pi/agent"
1073
- if [ -n "\${SELFBENCH_PI_AUTH_JSON:-}" ]; then
1074
- printf '%s' "$SELFBENCH_PI_AUTH_JSON" > "$HOME/.pi/agent/auth.json"
1075
- chmod 600 "$HOME/.pi/agent/auth.json"
1076
- fi
1077
- printf '%s\n' '{"transport":"auto"}' > "$HOME/.pi/agent/settings.json"
1078
- chmod 600 "$HOME/.pi/agent/settings.json"
1079
- model_provider() { [ -n "\${OPENAI_API_KEY:-}" ] && printf openai || printf openai-codex; }
1080
- run_with_heartbeat() {
1081
- "$@" 2>&1 &
1082
- local command_pid=$!
1083
- (
1084
- while sleep 60; do
1085
- printf '[selfbench] agent process %s still running at %s\n' "$command_pid" "$(date -u +%Y-%m-%dT%H:%M:%SZ)" >&2
1086
- done
1087
- ) &
1088
- local heartbeat_pid=$!
1089
- trap 'kill "$command_pid" "$heartbeat_pid" 2>/dev/null || true' TERM INT
1090
- set +e
1091
- wait "$command_pid"
1092
- local command_status=$?
1093
- set -e
1094
- kill "$heartbeat_pid" 2>/dev/null || true
1095
- wait "$heartbeat_pid" 2>/dev/null || true
1096
- trap - TERM INT
1097
- return "$command_status"
1098
- }
1099
- cleanup() { rm -f "$HOME/.pi/agent/auth.json" "$HOME/.pi/agent/settings.json" "$HOME/.git-credentials"; }
1100
- trap cleanup EXIT
1101
- clone_source() {
1102
- if [ -n "\${GH_TOKEN:-}" ]; then
1103
- git config --global credential.helper store
1104
- printf 'https://x-access-token:%s@github.com\n' "$GH_TOKEN" > "$HOME/.git-credentials"
1105
- chmod 600 "$HOME/.git-credentials"
1106
- fi
1107
- git clone --no-checkout --filter=blob:none "$SOURCE_REPO_URL" /work/repo
1108
- git -C /work/repo fetch origin "$SOURCE_COMMIT"
1109
- git -C /work/repo checkout --detach "$SOURCE_COMMIT"
1110
- }`;
1111
- }
1112
-
1113
- async function runHarborGate(
1114
- taskDirectory: string,
1115
- jobsDirectory: string,
1116
- agent: "nop" | "oracle",
1117
- taskId: string,
1118
- environment: SelfBenchConfig["harborEnvironment"],
1119
- signal: AbortSignal,
1120
- ): Promise<HarborJobResult> {
1121
- const jobName = `${taskId}-${agent}-${crypto.randomUUID().slice(0, 8)}`;
1122
- const result = await runCommand(
1123
- "harbor",
1124
- [
1125
- "run",
1126
- "--path",
1127
- taskDirectory,
1128
- "--agent",
1129
- agent,
1130
- "--env",
1131
- environment,
1132
- "--job-name",
1133
- jobName,
1134
- "--jobs-dir",
1135
- jobsDirectory,
1136
- "--delete",
1137
- "--yes",
1138
- "--quiet",
1139
- ],
1140
- {
1141
- allowFailure: true,
1142
- env: harborChildEnvironment(),
1143
- timeoutMs: 3 * 60 * 60 * 1000,
1144
- signal,
1145
- },
1146
- );
1147
- if (result.exitCode !== 0) {
1148
- throw ApplicationFailure.create({
1149
- message: harborCommandFailureMessage(agent, taskId, result.exitCode, result.stderr),
1150
- type: HARBOR_INFRASTRUCTURE_FAILURE_TYPE,
1151
- });
1152
- }
1153
- const parsed = await readHarborJobResult(jobsDirectory, jobName);
1154
- const infrastructureError = harborInfrastructureError(parsed.trial);
1155
- if (infrastructureError) {
1156
- throw ApplicationFailure.create({
1157
- message: `Harbor ${agent} infrastructure failure for ${taskId}: ${infrastructureError}`,
1158
- type: HARBOR_INFRASTRUCTURE_FAILURE_TYPE,
1159
- });
1160
- }
1161
- return parsed;
1162
- }
1163
-
1164
- function harborCommandFailureMessage(
1165
- agent: "nop" | "oracle",
1166
- taskId: string,
1167
- exitCode: number,
1168
- stderr: string,
1169
- ): string {
1170
- const detail = stderr.trim().split("\n").at(-1);
1171
- return `Harbor ${agent} exited ${exitCode} for ${taskId}${detail ? `: ${detail}` : ""}`;
1172
- }
1173
-
1174
- function harborGateFailureReason(
1175
- nopPassed: boolean,
1176
- nopChecks: Record<string, unknown>,
1177
- oraclePassed: boolean,
1178
- oracleChecks: Record<string, unknown>,
1179
- nopOutput?: string,
1180
- oracleOutput?: string,
1181
- ): string {
1182
- const formatChecks = (checks: Record<string, unknown>): string =>
1183
- [
1184
- "patch_applied",
1185
- "fail_to_pass",
1186
- "pass_to_pass",
1187
- "deterministic",
1188
- "setup_completed",
1189
- "fail_to_pass_exit_code",
1190
- "fail_to_pass_repeat_exit_code",
1191
- "pass_to_pass_exit_code",
1192
- ]
1193
- .map((key) => `${key}=${String(checks[key] ?? "missing")}`)
1194
- .join(", ");
1195
- const diagnostics = [
1196
- ...(!nopPassed && nopOutput ? [`nop verifier tail:\n${boundedTail(nopOutput)}`] : []),
1197
- ...(!oraclePassed && oracleOutput
1198
- ? [`oracle verifier tail:\n${boundedTail(oracleOutput)}`]
1199
- : []),
1200
- ];
1201
- return `Harbor gates failed: nop=${nopPassed} (${formatChecks(nopChecks)}); oracle=${oraclePassed} (${formatChecks(oracleChecks)})${diagnostics.length > 0 ? `\n${diagnostics.join("\n")}` : ""}`;
1202
- }
1203
-
1204
- function verifierOutput(
1205
- result: Awaited<ReturnType<typeof readHarborJobResult>>,
1206
- ): string | undefined {
1207
- const combined = result.verifier?.combined;
1208
- const stderr = result.verifier?.stderr;
1209
- if (combined && stderr) {
1210
- return `${combined.trimEnd()}\n\n--- verifier stderr ---\n${stderr}`;
1211
- }
1212
- return stderr ?? combined;
1213
- }
1214
-
1215
- function boundedTail(value: string, maxBytes = 8_000): string {
1216
- const buffer = Buffer.from(value);
1217
- return buffer.length <= maxBytes
1218
- ? value.trimEnd()
1219
- : `[truncated ${buffer.length - maxBytes} bytes]\n${buffer.subarray(-maxBytes).toString("utf8").trimEnd()}`;
1220
- }
1221
-
1222
- async function runSandboxWithFailureLog(
1223
- store: ArtifactStore,
1224
- logKey: string,
1225
- action: () => Promise<SandboxResult>,
1226
- ): Promise<SandboxResult> {
1227
- try {
1228
- return await action();
1229
- } catch (error) {
1230
- if (!(error instanceof SandboxExecutionError)) {
1231
- throw error;
1232
- }
1233
- const log = await store.put(
1234
- logKey,
1235
- Buffer.from(`${error.result.stdout}\n${error.result.stderr}`),
1236
- "text/plain",
1237
- );
1238
- throw new Error(`${error.message}; partial log: ${log.uri}`, { cause: error });
1239
- }
1240
- }
1241
-
1242
- async function withActivityHeartbeats<T>(
1243
- detail: string,
1244
- action: (options: SandboxRunOptions & { readonly signal: AbortSignal }) => Promise<T>,
1245
- ): Promise<T> {
1246
- const context = Context.current();
1247
- let outputBytes = 0;
1248
- let lastOutputAt: string | undefined;
1249
- const heartbeatDetail = (): {
1250
- detail: string;
1251
- outputBytes: number;
1252
- lastOutputAt?: string;
1253
- } => ({
1254
- detail,
1255
- outputBytes,
1256
- ...(lastOutputAt ? { lastOutputAt } : {}),
1257
- });
1258
- context.heartbeat(heartbeatDetail());
1259
- const heartbeat = setInterval(() => context.heartbeat(heartbeatDetail()), 60_000);
1260
- heartbeat.unref();
1261
- try {
1262
- try {
1263
- const result = await action({
1264
- signal: context.cancellationSignal,
1265
- onProgress: (progress) => {
1266
- outputBytes += progress.bytes;
1267
- lastOutputAt = new Date().toISOString();
1268
- },
1269
- });
1270
- if (context.cancellationSignal.aborted) {
1271
- throw new CancelledFailure("activity cancellation requested");
1272
- }
1273
- return result;
1274
- } catch (error) {
1275
- if (context.cancellationSignal.aborted && !(error instanceof CancelledFailure)) {
1276
- throw new CancelledFailure("activity cancellation requested");
1277
- }
1278
- throw error;
1279
- }
1280
- } finally {
1281
- clearInterval(heartbeat);
1282
- }
1283
- }
1284
-
1285
- async function withTaskBundle<T>(
1286
- store: ArtifactStore,
1287
- task: AuthoredTask,
1288
- action: (taskDirectory: string, root: string) => Promise<T>,
1289
- ): Promise<T> {
1290
- return await withTemporaryDirectory(`selfbench-${task.taskId}-`, async (root) => {
1291
- const archive = join(root, "task.tar.gz");
1292
- await writeFile(archive, await store.get(task.bundle));
1293
- await runCommand("tar", ["-xzf", archive, "-C", root]);
1294
- const taskDirectory = join(root, "harbor-task");
1295
- const definition = taskDefinitionSchema.parse(
1296
- JSON.parse(Buffer.from(await store.get(task.definition)).toString("utf8")),
1297
- );
1298
- await refreshHarborTask(taskDirectory, definition);
1299
- return await action(taskDirectory, root);
1300
- });
1301
- }
1302
-
1303
- async function withTemporaryDirectory<T>(
1304
- prefix: string,
1305
- action: (root: string) => Promise<T>,
1306
- ): Promise<T> {
1307
- const root = await mkdtemp(join(tmpdir(), prefix));
1308
- try {
1309
- return await action(root);
1310
- } finally {
1311
- await rm(root, { recursive: true, force: true });
1312
- }
1313
- }
1314
-
1315
- function parseProvenance(value: Uint8Array): ProvenanceMessage[] {
1316
- return Buffer.from(value)
1317
- .toString("utf8")
1318
- .split("\n")
1319
- .filter((line) => line.trim())
1320
- .map((line) => provenanceMessageSchema.parse(JSON.parse(line)));
1321
- }
1322
-
1323
- function readAsset(relativePath: string): Promise<Buffer> {
1324
- return readFile(join(projectRoot(import.meta.url), relativePath));
1325
- }
1326
-
1327
- function rewards(trial: unknown): Record<string, unknown> {
1328
- if (
1329
- !isRecord(trial) ||
1330
- !isRecord(trial.verifier_result) ||
1331
- !isRecord(trial.verifier_result.rewards)
1332
- ) {
1333
- return {};
1334
- }
1335
- return trial.verifier_result.rewards;
1336
- }
1337
-
1338
- function exception(trial: unknown): unknown {
1339
- return isRecord(trial) ? trial.exception_info : undefined;
1340
- }
1341
-
1342
- function numberValue(value: unknown): number {
1343
- return typeof value === "number" ? value : 0;
1344
- }
1345
-
1346
- function isRecord(value: unknown): value is Record<string, unknown> {
1347
- return typeof value === "object" && value !== null && !Array.isArray(value);
1348
- }