@jinn-network/client 0.1.6 → 0.1.7-canary.0a586ca9

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 (434) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/README.md +67 -1
  3. package/deployments/deployment-jinn-mvi-l1-sepolia-fast.json +23 -4
  4. package/deployments/deployment-jinn-mvi-l1-sepolia.json +23 -4
  5. package/deployments/deployment-jinn-mvi-l2-baseSepolia.json +5 -4
  6. package/dist/adapters/mech/adapter.d.ts +57 -2
  7. package/dist/adapters/mech/adapter.js +366 -63
  8. package/dist/adapters/mech/adapter.js.map +1 -1
  9. package/dist/adapters/mech/contracts.d.ts +17 -4
  10. package/dist/adapters/mech/contracts.js +19 -4
  11. package/dist/adapters/mech/contracts.js.map +1 -1
  12. package/dist/adapters/mech/safe-revert.d.ts +20 -0
  13. package/dist/adapters/mech/safe-revert.js +12 -4
  14. package/dist/adapters/mech/safe-revert.js.map +1 -1
  15. package/dist/adapters/mech/safe.d.ts +6 -2
  16. package/dist/adapters/mech/safe.js +32 -11
  17. package/dist/adapters/mech/safe.js.map +1 -1
  18. package/dist/adapters/mech/types.d.ts +6 -1
  19. package/dist/adapters/mech/types.js.map +1 -1
  20. package/dist/adapters/mech/verdict-code.d.ts +1 -0
  21. package/dist/adapters/mech/verdict-code.js +18 -0
  22. package/dist/adapters/mech/verdict-code.js.map +1 -1
  23. package/dist/agent/operator-claude.js +8 -0
  24. package/dist/agent/operator-claude.js.map +1 -1
  25. package/dist/api/activity-events-endpoint.d.ts +14 -0
  26. package/dist/api/activity-events-endpoint.js +59 -0
  27. package/dist/api/activity-events-endpoint.js.map +1 -0
  28. package/dist/api/admin-endpoint.d.ts +15 -3
  29. package/dist/api/admin-endpoint.js +24 -2
  30. package/dist/api/admin-endpoint.js.map +1 -1
  31. package/dist/api/bootstrap-endpoint.d.ts +1 -2
  32. package/dist/api/bootstrap-endpoint.js +85 -18
  33. package/dist/api/bootstrap-endpoint.js.map +1 -1
  34. package/dist/api/codex-doctor-endpoint.d.ts +90 -0
  35. package/dist/api/codex-doctor-endpoint.js +296 -0
  36. package/dist/api/codex-doctor-endpoint.js.map +1 -0
  37. package/dist/api/discovery-endpoint.d.ts +1 -0
  38. package/dist/api/discovery-endpoint.js +26 -0
  39. package/dist/api/discovery-endpoint.js.map +1 -1
  40. package/dist/api/fleet-build.d.ts +1 -0
  41. package/dist/api/fleet-build.js +2 -1
  42. package/dist/api/fleet-build.js.map +1 -1
  43. package/dist/api/gather-status.d.ts +37 -0
  44. package/dist/api/gather-status.js +572 -19
  45. package/dist/api/gather-status.js.map +1 -1
  46. package/dist/api/hermes-doctor-endpoint.d.ts +128 -3
  47. package/dist/api/hermes-doctor-endpoint.js +265 -22
  48. package/dist/api/hermes-doctor-endpoint.js.map +1 -1
  49. package/dist/api/launcher-status.d.ts +24 -17
  50. package/dist/api/launcher-status.js +13 -11
  51. package/dist/api/launcher-status.js.map +1 -1
  52. package/dist/api/launcher-tasks.d.ts +1 -1
  53. package/dist/api/launcher-tasks.js +12 -8
  54. package/dist/api/launcher-tasks.js.map +1 -1
  55. package/dist/api/operator-artifacts-endpoint.js +73 -6
  56. package/dist/api/operator-artifacts-endpoint.js.map +1 -1
  57. package/dist/api/portfolio-v0-build.d.ts +10 -0
  58. package/dist/api/portfolio-v0-build.js +24 -5
  59. package/dist/api/portfolio-v0-build.js.map +1 -1
  60. package/dist/api/prediction-v1-build.d.ts +10 -0
  61. package/dist/api/prediction-v1-build.js +7 -1
  62. package/dist/api/prediction-v1-build.js.map +1 -1
  63. package/dist/api/server.d.ts +31 -1
  64. package/dist/api/server.js +95 -2
  65. package/dist/api/server.js.map +1 -1
  66. package/dist/api/setup-endpoints.d.ts +7 -0
  67. package/dist/api/setup-endpoints.js +67 -135
  68. package/dist/api/setup-endpoints.js.map +1 -1
  69. package/dist/api/setup-retry-endpoint.d.ts +19 -0
  70. package/dist/api/setup-retry-endpoint.js +32 -0
  71. package/dist/api/setup-retry-endpoint.js.map +1 -0
  72. package/dist/api/solvernets-endpoints.d.ts +8 -0
  73. package/dist/api/solvernets-endpoints.js +100 -105
  74. package/dist/api/solvernets-endpoints.js.map +1 -1
  75. package/dist/api/status-build.d.ts +167 -2
  76. package/dist/api/status-build.js +118 -27
  77. package/dist/api/status-build.js.map +1 -1
  78. package/dist/api/status-harness-rollup.d.ts +35 -0
  79. package/dist/api/status-harness-rollup.js +45 -0
  80. package/dist/api/status-harness-rollup.js.map +1 -0
  81. package/dist/api/task-run-routing.d.ts +7 -0
  82. package/dist/api/task-run-routing.js +12 -0
  83. package/dist/api/task-run-routing.js.map +1 -0
  84. package/dist/api/task-runs-build.d.ts +21 -0
  85. package/dist/api/task-runs-build.js +14 -1
  86. package/dist/api/task-runs-build.js.map +1 -1
  87. package/dist/build-info.json +4 -4
  88. package/dist/build-meta.json +1 -1
  89. package/dist/captures/live-publisher.js +24 -4
  90. package/dist/captures/live-publisher.js.map +1 -1
  91. package/dist/captures/publish.d.ts +1 -1
  92. package/dist/chain-read-errors.d.ts +22 -0
  93. package/dist/chain-read-errors.js +41 -1
  94. package/dist/chain-read-errors.js.map +1 -1
  95. package/dist/cli/commands/auth.js +1 -1
  96. package/dist/cli/commands/auth.js.map +1 -1
  97. package/dist/cli/commands/codedigest-revert-check.d.ts +33 -0
  98. package/dist/cli/commands/codedigest-revert-check.js +249 -0
  99. package/dist/cli/commands/codedigest-revert-check.js.map +1 -0
  100. package/dist/cli/commands/create.js +3 -2
  101. package/dist/cli/commands/create.js.map +1 -1
  102. package/dist/cli/commands/doctor.d.ts +2 -0
  103. package/dist/cli/commands/doctor.js +2 -0
  104. package/dist/cli/commands/doctor.js.map +1 -1
  105. package/dist/cli/commands/rewards.js +11 -7
  106. package/dist/cli/commands/rewards.js.map +1 -1
  107. package/dist/cli/commands/solver-nets.d.ts +1 -0
  108. package/dist/cli/commands/solver-nets.js +179 -16
  109. package/dist/cli/commands/solver-nets.js.map +1 -1
  110. package/dist/cli/commands/solver-plugins-block.d.ts +33 -0
  111. package/dist/cli/commands/solver-plugins-block.js +118 -0
  112. package/dist/cli/commands/solver-plugins-block.js.map +1 -0
  113. package/dist/cli/commands/solver-plugins-feedback.d.ts +72 -0
  114. package/dist/cli/commands/solver-plugins-feedback.js +262 -0
  115. package/dist/cli/commands/solver-plugins-feedback.js.map +1 -0
  116. package/dist/cli/commands/solver-plugins-read.d.ts +54 -0
  117. package/dist/cli/commands/solver-plugins-read.js +259 -0
  118. package/dist/cli/commands/solver-plugins-read.js.map +1 -0
  119. package/dist/cli/commands/solver-plugins.d.ts +35 -0
  120. package/dist/cli/commands/solver-plugins.js +399 -2
  121. package/dist/cli/commands/solver-plugins.js.map +1 -1
  122. package/dist/cli/commands/status.js +1 -1
  123. package/dist/cli/commands/status.js.map +1 -1
  124. package/dist/cli/commands/tasks.js +101 -11
  125. package/dist/cli/commands/tasks.js.map +1 -1
  126. package/dist/cli/commands/update.d.ts +10 -0
  127. package/dist/cli/commands/update.js +36 -0
  128. package/dist/cli/commands/update.js.map +1 -1
  129. package/dist/cli/index.js +2 -0
  130. package/dist/cli/index.js.map +1 -1
  131. package/dist/cli/introspection-context.js +5 -0
  132. package/dist/cli/introspection-context.js.map +1 -1
  133. package/dist/cli/task-native-readiness.d.ts +10 -1
  134. package/dist/cli/task-native-readiness.js +30 -6
  135. package/dist/cli/task-native-readiness.js.map +1 -1
  136. package/dist/config.d.ts +287 -235
  137. package/dist/config.js +318 -114
  138. package/dist/config.js.map +1 -1
  139. package/dist/daemon/checkpoint-loop.d.ts +48 -0
  140. package/dist/daemon/checkpoint-loop.js +76 -0
  141. package/dist/daemon/checkpoint-loop.js.map +1 -0
  142. package/dist/daemon/creator.d.ts +1 -1
  143. package/dist/daemon/creator.js +20 -3
  144. package/dist/daemon/creator.js.map +1 -1
  145. package/dist/daemon/daemon.d.ts +22 -0
  146. package/dist/daemon/daemon.js +174 -31
  147. package/dist/daemon/daemon.js.map +1 -1
  148. package/dist/daemon/eviction-loop.d.ts +40 -0
  149. package/dist/daemon/eviction-loop.js +67 -0
  150. package/dist/daemon/eviction-loop.js.map +1 -0
  151. package/dist/daemon/gate-logger.d.ts +9 -0
  152. package/dist/daemon/gate-logger.js +2 -0
  153. package/dist/daemon/gate-logger.js.map +1 -0
  154. package/dist/daemon/jinn-claim-loop-wiring.d.ts +33 -0
  155. package/dist/daemon/jinn-claim-loop-wiring.js +40 -0
  156. package/dist/daemon/jinn-claim-loop-wiring.js.map +1 -0
  157. package/dist/daemon/jinn-claim-loop.d.ts +24 -17
  158. package/dist/daemon/jinn-claim-loop.js +77 -23
  159. package/dist/daemon/jinn-claim-loop.js.map +1 -1
  160. package/dist/daemon/readiness-gate.d.ts +1 -4
  161. package/dist/daemon/readiness-gate.js.map +1 -1
  162. package/dist/daemon/skip-log-dedup.d.ts +69 -0
  163. package/dist/daemon/skip-log-dedup.js +106 -0
  164. package/dist/daemon/skip-log-dedup.js.map +1 -0
  165. package/dist/daemon/spend-cap-gate.d.ts +40 -0
  166. package/dist/daemon/spend-cap-gate.js +46 -0
  167. package/dist/daemon/spend-cap-gate.js.map +1 -0
  168. package/dist/dashboard/assets/index-BNs_ewI6.js +345 -0
  169. package/dist/dashboard/assets/index-C4huIsUW.css +32 -0
  170. package/dist/dashboard/index.html +2 -2
  171. package/dist/discovery/factory.d.ts +17 -5
  172. package/dist/discovery/factory.js +46 -18
  173. package/dist/discovery/factory.js.map +1 -1
  174. package/dist/discovery/http.js +469 -3
  175. package/dist/discovery/http.js.map +1 -1
  176. package/dist/discovery/onchain.d.ts +5 -0
  177. package/dist/discovery/onchain.js +448 -18
  178. package/dist/discovery/onchain.js.map +1 -1
  179. package/dist/discovery/types.d.ts +174 -1
  180. package/dist/discovery/types.js +8 -10
  181. package/dist/discovery/types.js.map +1 -1
  182. package/dist/discovery/with-fallback.d.ts +7 -0
  183. package/dist/discovery/with-fallback.js +37 -0
  184. package/dist/discovery/with-fallback.js.map +1 -1
  185. package/dist/earning/bootstrap.d.ts +100 -4
  186. package/dist/earning/bootstrap.js +239 -76
  187. package/dist/earning/bootstrap.js.map +1 -1
  188. package/dist/earning/contracts.d.ts +14 -0
  189. package/dist/earning/contracts.js +17 -5
  190. package/dist/earning/contracts.js.map +1 -1
  191. package/dist/earning/funding-plan.js +27 -18
  192. package/dist/earning/funding-plan.js.map +1 -1
  193. package/dist/earning/jinn-rewards.d.ts +46 -0
  194. package/dist/earning/jinn-rewards.js +32 -0
  195. package/dist/earning/jinn-rewards.js.map +1 -1
  196. package/dist/earning/safe-adapter.d.ts +2 -0
  197. package/dist/earning/safe-adapter.js +37 -11
  198. package/dist/earning/safe-adapter.js.map +1 -1
  199. package/dist/earning/store.d.ts +8 -0
  200. package/dist/earning/store.js.map +1 -1
  201. package/dist/earning/testnet-setup-migration.d.ts +12 -0
  202. package/dist/earning/testnet-setup-migration.js +27 -1
  203. package/dist/earning/testnet-setup-migration.js.map +1 -1
  204. package/dist/earning/types.d.ts +21 -6
  205. package/dist/earning/viem-clients.d.ts +11 -4
  206. package/dist/earning/viem-clients.js +14 -5
  207. package/dist/earning/viem-clients.js.map +1 -1
  208. package/dist/erc8004/identity.d.ts +19 -3
  209. package/dist/erc8004/identity.js +21 -6
  210. package/dist/erc8004/identity.js.map +1 -1
  211. package/dist/erc8004/index.d.ts +1 -1
  212. package/dist/erc8004/index.js.map +1 -1
  213. package/dist/erc8004/reputation.d.ts +8 -0
  214. package/dist/erc8004/reputation.js +22 -3
  215. package/dist/erc8004/reputation.js.map +1 -1
  216. package/dist/events/types.d.ts +2 -2
  217. package/dist/harnesses/cost-estimates.d.ts +124 -0
  218. package/dist/harnesses/cost-estimates.js +265 -0
  219. package/dist/harnesses/cost-estimates.js.map +1 -0
  220. package/dist/harnesses/engine/engine.d.ts +78 -0
  221. package/dist/harnesses/engine/engine.js +153 -11
  222. package/dist/harnesses/engine/engine.js.map +1 -1
  223. package/dist/harnesses/engine/persistence.d.ts +51 -1
  224. package/dist/harnesses/engine/persistence.js +118 -5
  225. package/dist/harnesses/engine/persistence.js.map +1 -1
  226. package/dist/harnesses/engine/work-dir-reaper.d.ts +65 -0
  227. package/dist/harnesses/engine/work-dir-reaper.js +100 -0
  228. package/dist/harnesses/engine/work-dir-reaper.js.map +1 -0
  229. package/dist/harnesses/impls/hermes-agent/adapter.js +40 -0
  230. package/dist/harnesses/impls/hermes-agent/adapter.js.map +1 -1
  231. package/dist/harnesses/impls/hermes-agent/bootstrap.d.ts +20 -0
  232. package/dist/harnesses/impls/hermes-agent/bootstrap.js +44 -8
  233. package/dist/harnesses/impls/hermes-agent/bootstrap.js.map +1 -1
  234. package/dist/harnesses/impls/hermes-agent/config-builder.d.ts +1 -1
  235. package/dist/harnesses/impls/hermes-agent/config-builder.js +4 -2
  236. package/dist/harnesses/impls/hermes-agent/config-builder.js.map +1 -1
  237. package/dist/harnesses/impls/hermes-agent/harness.d.ts +59 -1
  238. package/dist/harnesses/impls/hermes-agent/harness.js +104 -0
  239. package/dist/harnesses/impls/hermes-agent/harness.js.map +1 -1
  240. package/dist/harnesses/impls/hermes-agent/prompt.d.ts +6 -6
  241. package/dist/harnesses/impls/hermes-agent/prompt.js +6 -6
  242. package/dist/harnesses/impls/index.d.ts +7 -0
  243. package/dist/harnesses/impls/index.js +16 -1
  244. package/dist/harnesses/impls/index.js.map +1 -1
  245. package/dist/harnesses/impls/learner/adapters/codex-code.d.ts +9 -0
  246. package/dist/harnesses/impls/learner/adapters/codex-code.js +30 -8
  247. package/dist/harnesses/impls/learner/adapters/codex-code.js.map +1 -1
  248. package/dist/harnesses/impls/learner/harness.d.ts +47 -4
  249. package/dist/harnesses/impls/learner/harness.js +105 -2
  250. package/dist/harnesses/impls/learner/harness.js.map +1 -1
  251. package/dist/harnesses/impls/learner/harvest.d.ts +1 -1
  252. package/dist/harnesses/impls/learner/harvest.js +23 -5
  253. package/dist/harnesses/impls/learner/harvest.js.map +1 -1
  254. package/dist/harnesses/impls/learner/plugin-path.d.ts +0 -13
  255. package/dist/harnesses/impls/learner/plugin-path.js +35 -15
  256. package/dist/harnesses/impls/learner/plugin-path.js.map +1 -1
  257. package/dist/harnesses/impls/learner/restoration-patch.d.ts +2 -2
  258. package/dist/harnesses/impls/learner/restoration-patch.js +25 -6
  259. package/dist/harnesses/impls/learner/restoration-patch.js.map +1 -1
  260. package/dist/harnesses/impls/learner/types.d.ts +11 -0
  261. package/dist/harnesses/impls/stub.d.ts +58 -0
  262. package/dist/harnesses/impls/stub.js +89 -0
  263. package/dist/harnesses/impls/stub.js.map +1 -0
  264. package/dist/harnesses/impls/swe-rebench-v2-evaluator/eval-runner.d.ts +69 -50
  265. package/dist/harnesses/impls/swe-rebench-v2-evaluator/eval-runner.js +199 -94
  266. package/dist/harnesses/impls/swe-rebench-v2-evaluator/eval-runner.js.map +1 -1
  267. package/dist/harnesses/impls/swe-rebench-v2-evaluator/harness.d.ts +12 -1
  268. package/dist/harnesses/impls/swe-rebench-v2-evaluator/harness.js +121 -7
  269. package/dist/harnesses/impls/swe-rebench-v2-evaluator/harness.js.map +1 -1
  270. package/dist/harnesses/impls/swe-rebench-v2-evaluator/hf-fetcher.d.ts +88 -4
  271. package/dist/harnesses/impls/swe-rebench-v2-evaluator/hf-fetcher.js +143 -22
  272. package/dist/harnesses/impls/swe-rebench-v2-evaluator/hf-fetcher.js.map +1 -1
  273. package/dist/harnesses/impls/swe-rebench-v2-evaluator/index.d.ts +6 -0
  274. package/dist/harnesses/impls/swe-rebench-v2-evaluator/index.js +1 -1
  275. package/dist/harnesses/impls/swe-rebench-v2-evaluator/index.js.map +1 -1
  276. package/dist/harnesses/readiness-registry.d.ts +7 -0
  277. package/dist/harnesses/readiness-registry.js +18 -1
  278. package/dist/harnesses/readiness-registry.js.map +1 -1
  279. package/dist/learner/revert-decision.d.ts +59 -0
  280. package/dist/learner/revert-decision.js +53 -0
  281. package/dist/learner/revert-decision.js.map +1 -0
  282. package/dist/learner/revert-stats.d.ts +24 -0
  283. package/dist/learner/revert-stats.js +44 -0
  284. package/dist/learner/revert-stats.js.map +1 -0
  285. package/dist/main.js +470 -142
  286. package/dist/main.js.map +1 -1
  287. package/dist/mcp/get-codedigest-reward.d.ts +13 -0
  288. package/dist/mcp/get-codedigest-reward.js +23 -0
  289. package/dist/mcp/get-codedigest-reward.js.map +1 -0
  290. package/dist/mcp/server.js +23 -0
  291. package/dist/mcp/server.js.map +1 -1
  292. package/dist/observability/emit-event.d.ts +3 -2
  293. package/dist/observability/emit-event.js +22 -1
  294. package/dist/observability/emit-event.js.map +1 -1
  295. package/dist/operator-errors.d.ts +7 -0
  296. package/dist/operator-errors.js +13 -1
  297. package/dist/operator-errors.js.map +1 -1
  298. package/dist/plugins/learner/.claude-plugin/plugin.json +9 -0
  299. package/dist/plugins/learner/.codex-plugin/plugin.json +39 -0
  300. package/dist/plugins/learner/AGENTS.md +40 -0
  301. package/dist/plugins/learner/CLAUDE.md +33 -0
  302. package/dist/plugins/learner/README.md +59 -0
  303. package/dist/plugins/learner/hooks/hooks.json +16 -0
  304. package/dist/plugins/learner/hooks/session-start +38 -0
  305. package/dist/plugins/learner/skills/learn/SKILL.md +412 -0
  306. package/dist/plugins/learner/skills/learn/analyst-prompt.md +68 -0
  307. package/dist/plugins/learner/skills/learn/consolidator-prompt.md +111 -0
  308. package/dist/plugins/learner/skills/learn/explorer-prompt.md +53 -0
  309. package/dist/plugins/learner/skills/learn/planner-prompt.md +87 -0
  310. package/dist/plugins/learner/skills/learn/promoter-prompt.md +184 -0
  311. package/dist/plugins/learner/skills/learn/step-worker-prompt.md +47 -0
  312. package/dist/plugins/learner/skills/learn/strategist-prompt.md +85 -0
  313. package/dist/preflight/pidfile-liveness.d.ts +44 -0
  314. package/dist/preflight/pidfile-liveness.js +103 -0
  315. package/dist/preflight/pidfile-liveness.js.map +1 -0
  316. package/dist/preflight/rpc-network.d.ts +40 -0
  317. package/dist/preflight/rpc-network.js +67 -1
  318. package/dist/preflight/rpc-network.js.map +1 -1
  319. package/dist/restart-daemon.d.ts +90 -0
  320. package/dist/restart-daemon.js +95 -0
  321. package/dist/restart-daemon.js.map +1 -0
  322. package/dist/rpc/transport.d.ts +109 -0
  323. package/dist/rpc/transport.js +220 -0
  324. package/dist/rpc/transport.js.map +1 -0
  325. package/dist/scripts/donation-consumption-acceptance.js +7 -28
  326. package/dist/scripts/donation-consumption-acceptance.js.map +1 -1
  327. package/dist/scripts/swe-rebench-v2-pytest-missing.json +16 -0
  328. package/dist/setup/halt-mode.d.ts +14 -0
  329. package/dist/setup/halt-mode.js +17 -0
  330. package/dist/setup/halt-mode.js.map +1 -0
  331. package/dist/solver-nets/prediction-operator-ux.d.ts +1 -2
  332. package/dist/solver-nets/prediction-operator-ux.js +90 -47
  333. package/dist/solver-nets/prediction-operator-ux.js.map +1 -1
  334. package/dist/solver-nets/registry.d.ts +20 -1
  335. package/dist/solver-nets/registry.js +38 -25
  336. package/dist/solver-nets/registry.js.map +1 -1
  337. package/dist/solver-types/_swe-rebench-v2-pool-cache.d.ts +58 -0
  338. package/dist/solver-types/_swe-rebench-v2-pool-cache.js +87 -0
  339. package/dist/solver-types/_swe-rebench-v2-pool-cache.js.map +1 -0
  340. package/dist/solver-types/_swe-rebench-v2-pool.d.ts +9 -2
  341. package/dist/solver-types/_swe-rebench-v2-pool.js +15 -20
  342. package/dist/solver-types/_swe-rebench-v2-pool.js.map +1 -1
  343. package/dist/solver-types/_swe-rebench-v2-state.d.ts +15 -0
  344. package/dist/solver-types/_swe-rebench-v2-state.js +19 -0
  345. package/dist/solver-types/_swe-rebench-v2-state.js.map +1 -1
  346. package/dist/solver-types/_swe-rebench-v2-substrate.d.ts +1 -0
  347. package/dist/solver-types/_swe-rebench-v2-substrate.js +10 -0
  348. package/dist/solver-types/_swe-rebench-v2-substrate.js.map +1 -1
  349. package/dist/solver-types/_swe-rebench-v2-validated-pool.d.ts +145 -2
  350. package/dist/solver-types/_swe-rebench-v2-validated-pool.js +482 -44
  351. package/dist/solver-types/_swe-rebench-v2-validated-pool.js.map +1 -1
  352. package/dist/solver-types/swe-rebench-v2-auto.d.ts +38 -14
  353. package/dist/solver-types/swe-rebench-v2-auto.js +87 -28
  354. package/dist/solver-types/swe-rebench-v2-auto.js.map +1 -1
  355. package/dist/solver-types/swe-rebench-v2.d.ts +19 -2
  356. package/dist/solver-types/swe-rebench-v2.js +351 -96
  357. package/dist/solver-types/swe-rebench-v2.js.map +1 -1
  358. package/dist/solvernets/daemon-init.d.ts +10 -2
  359. package/dist/solvernets/daemon-init.js +22 -2
  360. package/dist/solvernets/daemon-init.js.map +1 -1
  361. package/dist/solvernets/launched-record-dispatcher.d.ts +4 -0
  362. package/dist/solvernets/launched-record-dispatcher.js +41 -7
  363. package/dist/solvernets/launched-record-dispatcher.js.map +1 -1
  364. package/dist/solvernets/registry-client-erc8004.js +11 -0
  365. package/dist/solvernets/registry-client-erc8004.js.map +1 -1
  366. package/dist/solvernets/store.d.ts +7 -2
  367. package/dist/solvernets/store.js +1 -0
  368. package/dist/solvernets/store.js.map +1 -1
  369. package/dist/spend/cost-surface-status.d.ts +10 -0
  370. package/dist/spend/cost-surface-status.js +22 -0
  371. package/dist/spend/cost-surface-status.js.map +1 -0
  372. package/dist/spend/credential.d.ts +8 -0
  373. package/dist/spend/credential.js +30 -0
  374. package/dist/spend/credential.js.map +1 -0
  375. package/dist/spend/daemon-config.d.ts +13 -0
  376. package/dist/spend/daemon-config.js +24 -0
  377. package/dist/spend/daemon-config.js.map +1 -0
  378. package/dist/spend/pricing.d.ts +16 -0
  379. package/dist/spend/pricing.js +26 -0
  380. package/dist/spend/pricing.js.map +1 -0
  381. package/dist/spend/record.d.ts +13 -0
  382. package/dist/spend/record.js +30 -0
  383. package/dist/spend/record.js.map +1 -0
  384. package/dist/spend/usage.d.ts +27 -0
  385. package/dist/spend/usage.js +113 -0
  386. package/dist/spend/usage.js.map +1 -0
  387. package/dist/store/store.d.ts +61 -0
  388. package/dist/store/store.js +302 -7
  389. package/dist/store/store.js.map +1 -1
  390. package/dist/tasks/sources.d.ts +18 -1
  391. package/dist/tasks/sources.js +33 -5
  392. package/dist/tasks/sources.js.map +1 -1
  393. package/dist/trajectory/transcript-parsers/codex-session.d.ts +12 -6
  394. package/dist/trajectory/transcript-parsers/codex-session.js +114 -13
  395. package/dist/trajectory/transcript-parsers/codex-session.js.map +1 -1
  396. package/dist/trajectory/transcript-parsers/types.d.ts +8 -8
  397. package/dist/trajectory/transcript-session-dirs.d.ts +18 -0
  398. package/dist/trajectory/transcript-session-dirs.js +85 -0
  399. package/dist/trajectory/transcript-session-dirs.js.map +1 -0
  400. package/dist/trajectory/transcript-watcher.d.ts +20 -1
  401. package/dist/trajectory/transcript-watcher.js +98 -32
  402. package/dist/trajectory/transcript-watcher.js.map +1 -1
  403. package/dist/tx-retry.d.ts +166 -19
  404. package/dist/tx-retry.js +310 -32
  405. package/dist/tx-retry.js.map +1 -1
  406. package/dist/types/payloads/portfolio-v0.d.ts +3 -3
  407. package/dist/types/payloads/prediction-apy-v0.d.ts +8 -8
  408. package/dist/types/payloads/prediction-v0.d.ts +17 -17
  409. package/dist/types/task-document.d.ts +392 -0
  410. package/dist/types/task-document.js +10 -0
  411. package/dist/types/task-document.js.map +1 -1
  412. package/dist/types/task.d.ts +28 -0
  413. package/dist/util/extract-tx-hash.d.ts +14 -0
  414. package/dist/util/extract-tx-hash.js +19 -0
  415. package/dist/util/extract-tx-hash.js.map +1 -0
  416. package/dist/vendor/@jinn-network/sdk/dist/contracts.js +1 -1
  417. package/dist/vendor/@jinn-network/sdk/dist/solvernets/manifest-schema.d.ts +3 -0
  418. package/dist/vendor/@jinn-network/sdk/dist/solvernets/manifest-schema.js +1 -0
  419. package/package.json +37 -13
  420. package/plugins/learner/skills/learn/consolidator-prompt.md +18 -1
  421. package/plugins/learner/skills/learn/promoter-prompt.md +72 -1
  422. package/plugins/swe-rebench-v2-diffmin/README.md +10 -9
  423. package/plugins/swe-rebench-v2-diffmin/jinn.plugin.json +1 -1
  424. package/plugins/swe-rebench-v2-diffmin/skills/diffmin/SKILL.md +15 -10
  425. package/plugins/swe-rebench-v2-diffmin/skills/test-map/SKILL.md +10 -12
  426. package/plugins/swe-rebench-v2-runtime/.claude-plugin/plugin.json +1 -1
  427. package/plugins/swe-rebench-v2-runtime/.codex-plugin/plugin.json +3 -3
  428. package/plugins/swe-rebench-v2-runtime/README.md +6 -6
  429. package/plugins/swe-rebench-v2-runtime/jinn.plugin.json +2 -3
  430. package/plugins/swe-rebench-v2-runtime/skills/task/SKILL.md +69 -0
  431. package/dist/dashboard/assets/index-DOlzFN8a.css +0 -32
  432. package/dist/dashboard/assets/index-NkZ7CTAT.js +0 -140
  433. package/plugins/swe-rebench-v2-runtime/skills/orient/SKILL.md +0 -29
  434. package/plugins/swe-rebench-v2-runtime/skills/plan/SKILL.md +0 -53
@@ -20,10 +20,10 @@
20
20
  * Refs: jinn-mono-uy6v.9.
21
21
  */
22
22
  import { readFile, writeFile, mkdir, stat, rename, unlink } from 'node:fs/promises';
23
- import { randomBytes } from 'node:crypto';
24
- import { spawn } from 'node:child_process';
23
+ import { createHash, randomBytes } from 'node:crypto';
25
24
  import { resolve as resolvePath, dirname, join } from 'node:path';
26
- import { computeRowHash, resolveImageDigest, resolveUpstreamEvalCommit } from './_swe-rebench-v2-substrate.js';
25
+ import { computeRowHash, defaultCommandRunner, resolveImageDigest, resolveUpstreamEvalCommit, } from './_swe-rebench-v2-substrate.js';
26
+ import { canonicalJson } from '../harnesses/engine/canonical-json.js';
27
27
  // In-process mutex map: serialises concurrent record() calls against the
28
28
  // same file. Entries are never removed; bounded by the number of distinct
29
29
  // validated-pool.json paths used in this process (typically 1).
@@ -55,9 +55,56 @@ function withWriteLock(file, fn) {
55
55
  * `upstreamEvalCommit`) and extended ungradeable classifier
56
56
  * (venv collision, missing pytest, dependency warnings, conftest
57
57
  * import/setup failures) — jinn-mono-fufn.
58
+ * '4' — adds the buildTestCommands pytest-install guard (#493): for
59
+ * parse_log_pytest rows whose install_config.install does not
60
+ * already mention pytest, prepend a best-effort install line so
61
+ * the `ungradeable:pytest_missing` bucket (the highest-yield
62
+ * capacity blocker on the Stage-1 histogram) becomes scorable.
63
+ * The v3→v4 transition is a *targeted* migration, not a wholesale
64
+ * invalidation: only `ungradeable:pytest_missing` entries can flip
65
+ * under the install guard, so they alone are dropped (re-validated);
66
+ * every other verdict (scorable, gold-patch-not-resolved,
67
+ * transient/error/other ungradeable) is carried forward verbatim
68
+ * (see {@link loadOrMigrateFile}).
58
69
  */
59
- export const EVAL_SEMANTICS_VERSION = '3';
70
+ export const EVAL_SEMANTICS_VERSION = '4';
60
71
  const SCHEMA_VERSION = 'swe-rebench-v2-validated-pool.v1';
72
+ export const SWE_REBENCH_V2_VETTED_POOL_ARTIFACT_TYPE = 'swe-rebench-v2-vetted-pool.v1';
73
+ export const SOLVERNET_ARTIFACT_REF_SCHEMA_VERSION = 'solvernet.artifact-ref.v1';
74
+ export const VETTED_POOL_REF_ELIGIBILITY_KEY = 'vettedPoolRef';
75
+ const PUBLICATION_SCHEMA_VERSION = 'swe-rebench-v2-vetted-pool-publication.v1';
76
+ const PUBLICATION_FILE = 'vetted-pool-artifact-publication.json';
77
+ /**
78
+ * Cap on consecutive transient passes before an instance flips to the
79
+ * terminal `error:HF-429-permanent-after-5-passes` reason. Issue #578: the
80
+ * AC says "the failure is still recorded for visibility, but the validation
81
+ * pipeline distinguishes transient from permanent so the next run reprocesses
82
+ * these instances"; this is the convergence boundary that keeps a
83
+ * permanently-broken split from churning forever.
84
+ */
85
+ export const MAX_TRANSIENT_PASSES = 5;
86
+ const PERMANENT_HF_429_REASON = `error:HF-429-permanent-after-${MAX_TRANSIENT_PASSES}-passes`;
87
+ /**
88
+ * The operator-environment subset of `EvalCouldNotGradeError` reasons that are
89
+ * worth a bounded retry rather than being cached terminal (issue #811). These
90
+ * may differ on a later pass — Docker comes back, a stale `.venv` is cleaned,
91
+ * the host's missing venv is provisioned. `image_arch_mismatch` is fixed
92
+ * per-machine, but the bounded retry caps the waste: it converges to the
93
+ * terminal `ungradeable:` reason after {@link MAX_TRANSIENT_PASSES}, so there
94
+ * is no infinite loop.
95
+ *
96
+ * Every OTHER `EvalCouldNotGradeError` reason (pytest_missing,
97
+ * install_build_failed, conftest_import_error, requests_dep_mismatch,
98
+ * eval_setup_error, …) is a real per-instance problem where a blind retry
99
+ * won't help; those stay `ungradeable:` terminal. `pytest_missing` in
100
+ * particular needs the #493 code fix, not a retry.
101
+ */
102
+ export const TRANSIENT_INFRA_REASONS = new Set([
103
+ 'docker_unavailable',
104
+ 'venv_collision',
105
+ 'venv_missing',
106
+ 'image_arch_mismatch',
107
+ ]);
61
108
  function freshFile(evalSemanticsVersion) {
62
109
  return { schemaVersion: SCHEMA_VERSION, evalSemanticsVersion, updatedAt: new Date().toISOString(), entries: {} };
63
110
  }
@@ -67,6 +114,206 @@ function isValidFile(raw, evalSemanticsVersion) {
67
114
  raw.evalSemanticsVersion === evalSemanticsVersion &&
68
115
  typeof raw.entries === 'object' && raw.entries !== null);
69
116
  }
117
+ /** Structurally a `ValidatedPoolFile` at *any* semantics version (schema + entries shape). */
118
+ function hasValidShape(raw) {
119
+ return (typeof raw === 'object' && raw !== null &&
120
+ raw.schemaVersion === SCHEMA_VERSION &&
121
+ typeof raw.evalSemanticsVersion === 'string' &&
122
+ typeof raw.entries === 'object' && raw.entries !== null);
123
+ }
124
+ /**
125
+ * Explicit, version-keyed carry-forward migrations. A migration maps the source
126
+ * version's entries onto the target version's entries; only verdict classes that
127
+ * the target's grading change could flip are dropped (so the validate loop
128
+ * re-processes them), everything else is carried forward verbatim.
129
+ *
130
+ * Why: the only thing the v4 buildTestCommands pytest-install guard can alter is a
131
+ * `parse_log_pytest` instance whose install lacked pytest — i.e. exactly the
132
+ * `ungradeable:pytest_missing` bucket. Every other verdict (scorable
133
+ * `gold-patch-resolves`, `gold-patch-not-resolved`, transient/error/other
134
+ * ungradeable) ran the test runner or is install-independent, so its verdict
135
+ * cannot change under v4 and is carried forward unchanged. A future v4→vN bump
136
+ * must add its own entry here choosing which verdicts it can flip — this is NOT a
137
+ * general "carry forward everything except pytest_missing" rule.
138
+ */
139
+ const MIGRATIONS = {
140
+ // from version '3' → to version '4'
141
+ '3': {
142
+ '4': (entries) => Object.fromEntries(Object.entries(entries).filter(([, e]) => e.reason !== 'ungradeable:pytest_missing')),
143
+ },
144
+ };
145
+ /**
146
+ * Load `raw` for `targetVersion`, applying a defined migration where one exists.
147
+ * Pure — callers persist the result via their own write path.
148
+ *
149
+ * - already valid at `targetVersion` → returned as-is.
150
+ * - structurally valid at a prior version with a defined migration → migrated
151
+ * file (carried-forward entries keep their original `checkedAt`/verdict).
152
+ * - otherwise (unknown/unmapped version, wrong schema, garbage) → `freshFile`.
153
+ */
154
+ function loadOrMigrateFile(raw, targetVersion) {
155
+ if (isValidFile(raw, targetVersion))
156
+ return raw;
157
+ if (hasValidShape(raw)) {
158
+ const migrate = MIGRATIONS[raw.evalSemanticsVersion]?.[targetVersion];
159
+ if (migrate) {
160
+ return {
161
+ schemaVersion: SCHEMA_VERSION,
162
+ evalSemanticsVersion: targetVersion,
163
+ updatedAt: new Date().toISOString(),
164
+ entries: migrate(raw.entries),
165
+ };
166
+ }
167
+ }
168
+ return freshFile(targetVersion);
169
+ }
170
+ function publicationPath(stateDir) {
171
+ return resolvePath(join(stateDir, PUBLICATION_FILE));
172
+ }
173
+ async function writeJsonAtomic(file, value) {
174
+ await mkdir(dirname(file), { recursive: true });
175
+ const tmp = `${file}.${randomBytes(6).toString('hex')}.tmp`;
176
+ await writeFile(tmp, JSON.stringify(value, null, 2));
177
+ try {
178
+ await rename(tmp, file); // POSIX rename is atomic
179
+ }
180
+ catch (err) {
181
+ // Best-effort tempfile cleanup — don't mask the original error.
182
+ await unlink(tmp).catch(() => undefined);
183
+ throw err;
184
+ }
185
+ }
186
+ function isObject(raw) {
187
+ return typeof raw === 'object' && raw !== null;
188
+ }
189
+ function isSha256(value) {
190
+ return typeof value === 'string' && /^sha256:[0-9a-f]{64}$/u.test(value);
191
+ }
192
+ function parseVettedPoolArtifactEntry(raw) {
193
+ if (!isObject(raw))
194
+ return null;
195
+ if (typeof raw['instance_id'] !== 'string' || raw['instance_id'].length === 0)
196
+ return null;
197
+ if (raw['scorable'] !== true)
198
+ return null;
199
+ if (typeof raw['reason'] !== 'string')
200
+ return null;
201
+ if (typeof raw['checkedAt'] !== 'string')
202
+ return null;
203
+ const entry = {
204
+ instance_id: raw['instance_id'],
205
+ scorable: true,
206
+ reason: raw['reason'],
207
+ checkedAt: raw['checkedAt'],
208
+ ...(typeof raw['rowHash'] === 'string' ? { rowHash: raw['rowHash'] } : {}),
209
+ ...(typeof raw['imageName'] === 'string' ? { imageName: raw['imageName'] } : {}),
210
+ ...(typeof raw['imageDigest'] === 'string' ? { imageDigest: raw['imageDigest'] } : {}),
211
+ ...(typeof raw['upstreamEvalCommit'] === 'string' ? { upstreamEvalCommit: raw['upstreamEvalCommit'] } : {}),
212
+ };
213
+ return entry;
214
+ }
215
+ export function parseVettedPoolArtifact(raw) {
216
+ if (!isObject(raw))
217
+ throw new Error('vetted pool artifact must be an object');
218
+ if (raw['schemaVersion'] !== SWE_REBENCH_V2_VETTED_POOL_ARTIFACT_TYPE) {
219
+ throw new Error(`vetted pool artifact schemaVersion must be ${SWE_REBENCH_V2_VETTED_POOL_ARTIFACT_TYPE}`);
220
+ }
221
+ if (typeof raw['evalSemanticsVersion'] !== 'string') {
222
+ throw new Error('vetted pool artifact evalSemanticsVersion must be a string');
223
+ }
224
+ if (typeof raw['generatedAt'] !== 'string') {
225
+ throw new Error('vetted pool artifact generatedAt must be a string');
226
+ }
227
+ if (!Array.isArray(raw['entries'])) {
228
+ throw new Error('vetted pool artifact entries must be an array');
229
+ }
230
+ const entries = raw['entries'].map(parseVettedPoolArtifactEntry);
231
+ if (entries.some((e) => e === null)) {
232
+ throw new Error('vetted pool artifact contains an invalid or unscorable entry');
233
+ }
234
+ return {
235
+ schemaVersion: SWE_REBENCH_V2_VETTED_POOL_ARTIFACT_TYPE,
236
+ evalSemanticsVersion: raw['evalSemanticsVersion'],
237
+ generatedAt: raw['generatedAt'],
238
+ entries: entries.sort((a, b) => a.instance_id.localeCompare(b.instance_id)),
239
+ };
240
+ }
241
+ function normalizeVettedPoolArtifact(artifact) {
242
+ return {
243
+ schemaVersion: SWE_REBENCH_V2_VETTED_POOL_ARTIFACT_TYPE,
244
+ evalSemanticsVersion: artifact.evalSemanticsVersion,
245
+ generatedAt: artifact.generatedAt,
246
+ entries: [...artifact.entries]
247
+ .map((entry) => ({ ...entry, scorable: true }))
248
+ .sort((a, b) => a.instance_id.localeCompare(b.instance_id)),
249
+ };
250
+ }
251
+ export function hashVettedPoolArtifact(artifact) {
252
+ const canonical = canonicalJson(normalizeVettedPoolArtifact(artifact));
253
+ return `sha256:${createHash('sha256').update(canonical).digest('hex')}`;
254
+ }
255
+ export function loadVettedPoolArtifactScorableEntries(raw) {
256
+ const artifact = parseVettedPoolArtifact(raw);
257
+ const byId = new Map();
258
+ for (const entry of artifact.entries) {
259
+ byId.set(entry.instance_id, entry);
260
+ }
261
+ return { ids: new Set(byId.keys()), byId };
262
+ }
263
+ export function createVettedPoolArtifactRef(args) {
264
+ return {
265
+ schemaVersion: SOLVERNET_ARTIFACT_REF_SCHEMA_VERSION,
266
+ manifestCid: args.manifestCid,
267
+ artifactType: SWE_REBENCH_V2_VETTED_POOL_ARTIFACT_TYPE,
268
+ artifactCid: args.artifactCid,
269
+ artifactHash: args.artifactHash,
270
+ evalSemanticsVersion: args.evalSemanticsVersion,
271
+ publishedAt: args.publishedAt,
272
+ };
273
+ }
274
+ export function sweRebenchV2VettedPoolArtifactMetadataKey(manifestCid) {
275
+ return `solvernet-artifact:${manifestCid}:swe-rebench-v2-vetted-pool`;
276
+ }
277
+ export function parseVettedPoolArtifactRef(raw) {
278
+ if (!isObject(raw))
279
+ throw new Error('vetted pool artifact ref must be an object');
280
+ if (raw['schemaVersion'] !== SOLVERNET_ARTIFACT_REF_SCHEMA_VERSION) {
281
+ throw new Error(`vetted pool artifact ref schemaVersion must be ${SOLVERNET_ARTIFACT_REF_SCHEMA_VERSION}`);
282
+ }
283
+ if (raw['artifactType'] !== SWE_REBENCH_V2_VETTED_POOL_ARTIFACT_TYPE) {
284
+ throw new Error(`vetted pool artifact ref artifactType must be ${SWE_REBENCH_V2_VETTED_POOL_ARTIFACT_TYPE}`);
285
+ }
286
+ if (typeof raw['manifestCid'] !== 'string' || raw['manifestCid'].length === 0) {
287
+ throw new Error('vetted pool artifact ref manifestCid must be a string');
288
+ }
289
+ if (typeof raw['artifactCid'] !== 'string' || raw['artifactCid'].length === 0) {
290
+ throw new Error('vetted pool artifact ref artifactCid must be a string');
291
+ }
292
+ if (!isSha256(raw['artifactHash'])) {
293
+ throw new Error('vetted pool artifact ref artifactHash must be sha256:<64 hex>');
294
+ }
295
+ if (typeof raw['evalSemanticsVersion'] !== 'string') {
296
+ throw new Error('vetted pool artifact ref evalSemanticsVersion must be a string');
297
+ }
298
+ if (typeof raw['publishedAt'] !== 'string') {
299
+ throw new Error('vetted pool artifact ref publishedAt must be a string');
300
+ }
301
+ return {
302
+ schemaVersion: SOLVERNET_ARTIFACT_REF_SCHEMA_VERSION,
303
+ manifestCid: raw['manifestCid'],
304
+ artifactType: SWE_REBENCH_V2_VETTED_POOL_ARTIFACT_TYPE,
305
+ artifactCid: raw['artifactCid'],
306
+ artifactHash: raw['artifactHash'],
307
+ evalSemanticsVersion: raw['evalSemanticsVersion'],
308
+ publishedAt: raw['publishedAt'],
309
+ };
310
+ }
311
+ export function vettedPoolArtifactRefFromEligibility(eligibility) {
312
+ const raw = eligibility?.[VETTED_POOL_REF_ELIGIBILITY_KEY];
313
+ if (raw === undefined)
314
+ return null;
315
+ return parseVettedPoolArtifactRef(raw);
316
+ }
70
317
  export class ValidatedPoolStore {
71
318
  file;
72
319
  cache = null;
@@ -89,21 +336,11 @@ export class ValidatedPoolStore {
89
336
  if (this.cache && this.cache.evalSemanticsVersion === evalSemanticsVersion)
90
337
  return this.cache;
91
338
  const raw = await this.readRaw();
92
- this.cache = isValidFile(raw, evalSemanticsVersion) ? raw : freshFile(evalSemanticsVersion);
339
+ this.cache = loadOrMigrateFile(raw, evalSemanticsVersion);
93
340
  return this.cache;
94
341
  }
95
342
  async writeAtomic(file) {
96
- await mkdir(dirname(this.file), { recursive: true });
97
- const tmp = `${this.file}.${randomBytes(6).toString('hex')}.tmp`;
98
- await writeFile(tmp, JSON.stringify(file, null, 2));
99
- try {
100
- await rename(tmp, this.file); // POSIX rename is atomic
101
- }
102
- catch (err) {
103
- // Best-effort tempfile cleanup — don't mask the original error.
104
- await unlink(tmp).catch(() => undefined);
105
- throw err;
106
- }
343
+ await writeJsonAtomic(this.file, file);
107
344
  }
108
345
  /** The set of instance ids known scorable for `evalSemanticsVersion`, or
109
346
  * `null` if there is no validation data for this semantics version (the
@@ -116,12 +353,25 @@ export class ValidatedPoolStore {
116
353
  return cached.ids;
117
354
  }
118
355
  const raw = await this.readRaw();
119
- const ids = isValidFile(raw, evalSemanticsVersion)
120
- ? new Set(Object.entries(raw.entries).filter(([, e]) => e.scorable).map(([id]) => id))
356
+ // No data on disk (or wrong schema/unmapped version) stays `null` — the
357
+ // generator's no-validation-data floor. A migratable prior version yields
358
+ // the carried-forward scorable set, never `null`.
359
+ const ids = (isValidFile(raw, evalSemanticsVersion) || (hasValidShape(raw) && MIGRATIONS[raw.evalSemanticsVersion]?.[evalSemanticsVersion]))
360
+ ? new Set(Object.entries(loadOrMigrateFile(raw, evalSemanticsVersion).entries).filter(([, e]) => e.scorable).map(([id]) => id))
121
361
  : null;
122
362
  this.scorableIdsCache = { mtimeMs, semanticsVersion: evalSemanticsVersion, ids };
123
363
  return ids;
124
364
  }
365
+ async getScorableEntries(evalSemanticsVersion) {
366
+ const raw = await this.readRaw();
367
+ if (!isValidFile(raw, evalSemanticsVersion) && !(hasValidShape(raw) && MIGRATIONS[raw.evalSemanticsVersion]?.[evalSemanticsVersion]))
368
+ return null;
369
+ const file = loadOrMigrateFile(raw, evalSemanticsVersion);
370
+ return {
371
+ updatedAt: file.updatedAt,
372
+ entries: Object.fromEntries(Object.entries(file.entries).filter(([, entry]) => entry.scorable)),
373
+ };
374
+ }
125
375
  /** The entry for `instanceId`, or `null` if not validated for this semantics version. */
126
376
  async getEntry(instanceId, evalSemanticsVersion) {
127
377
  const f = await this.loadForWrite(evalSemanticsVersion);
@@ -134,7 +384,7 @@ export class ValidatedPoolStore {
134
384
  this.cache = null;
135
385
  this.scorableIdsCache = null;
136
386
  const raw = await this.readRaw();
137
- const file = isValidFile(raw, evalSemanticsVersion) ? raw : freshFile(evalSemanticsVersion);
387
+ const file = loadOrMigrateFile(raw, evalSemanticsVersion);
138
388
  file.entries[instanceId] = entry;
139
389
  file.updatedAt = new Date().toISOString();
140
390
  await this.writeAtomic(file);
@@ -142,6 +392,124 @@ export class ValidatedPoolStore {
142
392
  });
143
393
  }
144
394
  }
395
+ /**
396
+ * Collapse a stored `reason` string into a histogram bucket. Diagnostic
397
+ * detail (`(f2p X, p2p_broke Y)`, the verbatim HF 429 message) is kept on
398
+ * the entry for debugging, but the bucket name is what matters for the
399
+ * #493 reason-histogram CLI. Unknown reasons pass through unchanged.
400
+ */
401
+ export function normalizeReason(reason) {
402
+ if (reason.startsWith('gold-patch-not-resolved'))
403
+ return 'gold-patch-not-resolved';
404
+ if (reason.startsWith('transient:HF-429:'))
405
+ return 'transient:HF-429';
406
+ // Pre-#578 legacy: 429s recorded as `error:HF datasets-server returned 429 for ...`.
407
+ if (/^error:HF datasets-server returned 429\b/.test(reason))
408
+ return 'error:HF-429';
409
+ return reason;
410
+ }
411
+ /**
412
+ * Read-only summary of a `validated-pool.json` file. Counts entries by
413
+ * normalised reason (see {@link normalizeReason}) and returns the buckets
414
+ * sorted descending by count, with ties broken alphabetically by reason.
415
+ */
416
+ export function summarizeValidatedPool(file) {
417
+ if (!isObject(file) || !isObject(file['entries'])) {
418
+ throw new Error('summarizeValidatedPool: file must include an `entries` object');
419
+ }
420
+ let scorable = 0;
421
+ let unscorable = 0;
422
+ const counts = new Map();
423
+ for (const entry of Object.values(file['entries'])) {
424
+ if (!isObject(entry))
425
+ continue;
426
+ const raw = typeof entry['reason'] === 'string' ? entry['reason'] : 'unknown';
427
+ const reason = normalizeReason(raw);
428
+ counts.set(reason, (counts.get(reason) ?? 0) + 1);
429
+ if (entry['scorable'] === true)
430
+ scorable += 1;
431
+ else
432
+ unscorable += 1;
433
+ }
434
+ const byReason = [...counts.entries()]
435
+ .map(([reason, count]) => ({ reason, count }))
436
+ .sort((a, b) => (b.count - a.count) || a.reason.localeCompare(b.reason));
437
+ return { totalEntries: scorable + unscorable, scorable, unscorable, byReason };
438
+ }
439
+ export async function exportScorableVettedPoolArtifact(store, evalSemanticsVersion, opts = {}) {
440
+ const scorable = await store.getScorableEntries(evalSemanticsVersion);
441
+ if (!scorable)
442
+ return null;
443
+ const entries = Object.entries(scorable.entries)
444
+ .map(([instance_id, entry]) => ({
445
+ instance_id,
446
+ scorable: true,
447
+ reason: entry.reason,
448
+ checkedAt: entry.checkedAt,
449
+ ...(entry.rowHash ? { rowHash: entry.rowHash } : {}),
450
+ ...(entry.imageName ? { imageName: entry.imageName } : {}),
451
+ ...(entry.imageDigest ? { imageDigest: entry.imageDigest } : {}),
452
+ ...(entry.upstreamEvalCommit ? { upstreamEvalCommit: entry.upstreamEvalCommit } : {}),
453
+ }))
454
+ .sort((a, b) => a.instance_id.localeCompare(b.instance_id));
455
+ return {
456
+ schemaVersion: SWE_REBENCH_V2_VETTED_POOL_ARTIFACT_TYPE,
457
+ evalSemanticsVersion,
458
+ generatedAt: opts.generatedAt ?? scorable.updatedAt,
459
+ entries,
460
+ };
461
+ }
462
+ function parsePublication(raw) {
463
+ if (!isObject(raw) || raw['schemaVersion'] !== PUBLICATION_SCHEMA_VERSION) {
464
+ throw new Error(`vetted pool publication schemaVersion must be ${PUBLICATION_SCHEMA_VERSION}`);
465
+ }
466
+ if (typeof raw['updatedAt'] !== 'string') {
467
+ throw new Error('vetted pool publication updatedAt must be a string');
468
+ }
469
+ const ref = parseVettedPoolArtifactRef(raw['ref']);
470
+ const artifact = parseVettedPoolArtifact(raw['artifact']);
471
+ const actualHash = hashVettedPoolArtifact(artifact);
472
+ if (actualHash !== ref.artifactHash) {
473
+ throw new Error(`vetted pool publication hash mismatch: ref=${ref.artifactHash} artifact=${actualHash}`);
474
+ }
475
+ return {
476
+ schemaVersion: PUBLICATION_SCHEMA_VERSION,
477
+ updatedAt: raw['updatedAt'],
478
+ ref,
479
+ artifact,
480
+ };
481
+ }
482
+ export async function readVettedPoolArtifactPublication(args) {
483
+ let raw;
484
+ try {
485
+ raw = JSON.parse(await readFile(publicationPath(args.stateDir), 'utf8'));
486
+ }
487
+ catch {
488
+ return null;
489
+ }
490
+ const publication = parsePublication(raw);
491
+ if (args.manifestCid !== undefined && publication.ref.manifestCid !== args.manifestCid)
492
+ return null;
493
+ if (args.evalSemanticsVersion !== undefined && publication.ref.evalSemanticsVersion !== args.evalSemanticsVersion)
494
+ return null;
495
+ return publication;
496
+ }
497
+ export async function writeVettedPoolArtifactPublication(args) {
498
+ const artifact = parseVettedPoolArtifact(args.artifact);
499
+ const ref = parseVettedPoolArtifactRef(args.ref);
500
+ const artifactHash = hashVettedPoolArtifact(artifact);
501
+ if (artifactHash !== ref.artifactHash) {
502
+ throw new Error(`vetted pool publication hash mismatch: ref=${ref.artifactHash} artifact=${artifactHash}`);
503
+ }
504
+ const publication = {
505
+ schemaVersion: PUBLICATION_SCHEMA_VERSION,
506
+ updatedAt: args.updatedAt ?? new Date().toISOString(),
507
+ ref,
508
+ artifact,
509
+ };
510
+ await writeJsonAtomic(publicationPath(args.stateDir), publication);
511
+ return publication;
512
+ }
145
513
  /**
146
514
  * Restrict the generator's posting pool.
147
515
  *
@@ -182,15 +550,6 @@ function looksPython(patch) {
182
550
  // Match `--- a/<p>` / `+++ b/<p>` / `diff --git a/<p>` ending in .py
183
551
  return /(?:^|\n)(?:---|\+\+\+|diff --git) [ab]\/\S+\.py(?:\s|$)/.test(patch);
184
552
  }
185
- const defaultCommandRunner = (bin, args, opts) => new Promise((resolve, reject) => {
186
- const child = spawn(bin, args, { ...(opts ?? {}), stdio: ['ignore', 'pipe', 'pipe'] });
187
- let stdout = '';
188
- let stderr = '';
189
- child.stdout?.on('data', (d) => { stdout += d.toString(); });
190
- child.stderr?.on('data', (d) => { stderr += d.toString(); });
191
- child.on('error', reject);
192
- child.on('close', (code) => resolve({ exitCode: code ?? 1, stdout, stderr }));
193
- });
194
553
  function nameOf(err) {
195
554
  return typeof err === 'object' && err !== null && typeof err.name === 'string'
196
555
  ? err.name : '';
@@ -199,6 +558,28 @@ function reasonOf(err) {
199
558
  return typeof err === 'object' && err !== null && typeof err.reason === 'string'
200
559
  ? err.reason : 'unknown';
201
560
  }
561
+ /**
562
+ * Build a bounded-transient `ValidatedPoolEntry`. Shared by the HF-429 branch
563
+ * and the operator-environment infra branch (issue #811): both record a
564
+ * `transient:` reason that the next non-force pass re-processes, bumping
565
+ * `transientRetryCount` until it reaches {@link MAX_TRANSIENT_PASSES}, at which
566
+ * point the reason converges to a permanent terminal so a permanently-broken
567
+ * instance stops churning.
568
+ */
569
+ function buildBoundedTransientEntry(args) {
570
+ const next = args.priorCount + 1;
571
+ const reason = next >= MAX_TRANSIENT_PASSES ? args.permanentReason : args.transientReason;
572
+ return {
573
+ scorable: false,
574
+ reason,
575
+ checkedAt: args.checkedAt,
576
+ transientRetryCount: next,
577
+ lastTransientAt: args.checkedAt,
578
+ ...(args.rowHash ? { rowHash: args.rowHash } : {}),
579
+ ...(args.imageName ? { imageName: args.imageName } : {}),
580
+ ...(args.upstreamEvalCommit ? { upstreamEvalCommit: args.upstreamEvalCommit } : {}),
581
+ };
582
+ }
202
583
  /**
203
584
  * Validate pool instances by running their gold patch through the eval harness.
204
585
  * Idempotent: instances already recorded for `semanticsVersion` are skipped
@@ -222,8 +603,19 @@ export async function validatePoolInstances(pool, deps, opts = {}) {
222
603
  summary.skipped += 1;
223
604
  continue;
224
605
  }
225
- if (!opts.force && (await deps.store.getEntry(task.instance_id, deps.semanticsVersion))) {
226
- continue; // already validated for this semantics version
606
+ if (!opts.force) {
607
+ const priorEntry = await deps.store.getEntry(task.instance_id, deps.semanticsVersion);
608
+ if (priorEntry !== null) {
609
+ // Transient entries below the convergence boundary are intentionally
610
+ // re-processed on the next pass (issue #578 AC2 — "the next run
611
+ // reprocesses these instances"). Everything else (terminal) is
612
+ // skipped under the existing idempotence guard.
613
+ const isTransient = priorEntry.reason.startsWith('transient:');
614
+ const count = priorEntry.transientRetryCount ?? 0;
615
+ if (!(isTransient && count < MAX_TRANSIENT_PASSES)) {
616
+ continue; // already validated (terminal) for this semantics version
617
+ }
618
+ }
227
619
  }
228
620
  if (!task.patch || !task.test_patch) {
229
621
  await deps.store.record(task.instance_id, { scorable: false, reason: 'missing-gold-patch', checkedAt: new Date().toISOString() }, deps.semanticsVersion);
@@ -268,9 +660,10 @@ export async function validatePoolInstances(pool, deps, opts = {}) {
268
660
  pass_to_pass: row.PASS_TO_PASS,
269
661
  });
270
662
  const checkedAt = new Date().toISOString();
271
- // Resolve digest AFTER the eval ran — that's when the image is guaranteed
272
- // to be present locally with its RepoDigests populated.
273
- const imageDigest = await resolveImageDigest(row.image_name, runner);
663
+ // Prefer the digest captured by a real runner before per-round pruning.
664
+ // Test runners that do not carry it still use the legacy post-eval
665
+ // Docker inspect fallback.
666
+ const imageDigest = res.imageDigest ?? await resolveImageDigest(row.image_name, runner);
274
667
  const substrate = {
275
668
  checkedAt,
276
669
  rowHash,
@@ -290,17 +683,62 @@ export async function validatePoolInstances(pool, deps, opts = {}) {
290
683
  }
291
684
  }
292
685
  catch (err) {
293
- const reason = nameOf(err) === 'EvalCouldNotGradeError'
294
- ? `ungradeable:${reasonOf(err)}`
295
- : `error:${(err instanceof Error ? err.message : String(err)).slice(0, 200)}`;
296
- entry = {
297
- scorable: false,
298
- reason,
299
- checkedAt: new Date().toISOString(),
300
- ...(rowHash ? { rowHash } : {}),
301
- ...(row ? { imageName: row.image_name } : {}),
302
- ...(upstreamEvalCommit ? { upstreamEvalCommit } : {}),
303
- };
686
+ const httpStatus = typeof err?.httpStatus === 'number'
687
+ ? err.httpStatus
688
+ : undefined;
689
+ const checkedAt = new Date().toISOString();
690
+ const evalInfraReason = nameOf(err) === 'EvalCouldNotGradeError' ? reasonOf(err) : null;
691
+ if (httpStatus === 429) {
692
+ // Transient HF rate-limit: classify so the next pass re-processes
693
+ // (issue #578). Re-read the prior entry inside the catch so the
694
+ // count reflects the persisted state, not a stale in-memory copy.
695
+ const priorEntry = await deps.store.getEntry(task.instance_id, deps.semanticsVersion);
696
+ const msg = (err instanceof Error ? err.message : String(err)).slice(0, 200);
697
+ entry = buildBoundedTransientEntry({
698
+ priorCount: priorEntry?.transientRetryCount ?? 0,
699
+ transientReason: `transient:HF-429:${msg}`,
700
+ permanentReason: PERMANENT_HF_429_REASON,
701
+ checkedAt,
702
+ rowHash,
703
+ imageName: row?.image_name,
704
+ upstreamEvalCommit,
705
+ });
706
+ }
707
+ else if (evalInfraReason !== null && TRANSIENT_INFRA_REASONS.has(evalInfraReason)) {
708
+ // Operator-environment infra failure that may differ on a retry
709
+ // (issue #811). Route through the same bounded-transient path as
710
+ // HF-429 instead of caching it terminal. Re-read the prior entry so
711
+ // the count reflects persisted state. After MAX_TRANSIENT_PASSES it
712
+ // converges to the terminal `ungradeable:<reason>` — the same resting
713
+ // state today's code reaches immediately, just after bounded retries.
714
+ //
715
+ // Histogram: the transient reason is `transient:<infra_reason>` with no
716
+ // message suffix, so it is already a clean self-describing bucket and
717
+ // needs no normalize rule (unlike `transient:HF-429:<msg>`).
718
+ const priorEntry = await deps.store.getEntry(task.instance_id, deps.semanticsVersion);
719
+ entry = buildBoundedTransientEntry({
720
+ priorCount: priorEntry?.transientRetryCount ?? 0,
721
+ transientReason: `transient:${evalInfraReason}`,
722
+ permanentReason: `ungradeable:${evalInfraReason}`,
723
+ checkedAt,
724
+ rowHash,
725
+ imageName: row?.image_name,
726
+ upstreamEvalCommit,
727
+ });
728
+ }
729
+ else {
730
+ const reason = evalInfraReason !== null
731
+ ? `ungradeable:${evalInfraReason}`
732
+ : `error:${(err instanceof Error ? err.message : String(err)).slice(0, 200)}`;
733
+ entry = {
734
+ scorable: false,
735
+ reason,
736
+ checkedAt,
737
+ ...(rowHash ? { rowHash } : {}),
738
+ ...(row ? { imageName: row.image_name } : {}),
739
+ ...(upstreamEvalCommit ? { upstreamEvalCommit } : {}),
740
+ };
741
+ }
304
742
  }
305
743
  await deps.store.record(task.instance_id, entry, deps.semanticsVersion);
306
744
  summary.checked += 1;