@jinn-network/client 0.1.5 → 0.1.6-canary.107ea271

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 (431) hide show
  1. package/CHANGELOG.md +131 -0
  2. package/dist/adapters/mech/adapter.d.ts +23 -1
  3. package/dist/adapters/mech/adapter.js +169 -33
  4. package/dist/adapters/mech/adapter.js.map +1 -1
  5. package/dist/adapters/mech/contracts.d.ts +1 -0
  6. package/dist/adapters/mech/contracts.js +1 -0
  7. package/dist/adapters/mech/contracts.js.map +1 -1
  8. package/dist/adapters/mech/ipfs-pinfile.d.ts +22 -0
  9. package/dist/adapters/mech/ipfs-pinfile.js +54 -0
  10. package/dist/adapters/mech/ipfs-pinfile.js.map +1 -0
  11. package/dist/adapters/mech/ipfs.d.ts +1 -0
  12. package/dist/adapters/mech/ipfs.js +24 -1
  13. package/dist/adapters/mech/ipfs.js.map +1 -1
  14. package/dist/adapters/mech/verdict-code.d.ts +1 -0
  15. package/dist/adapters/mech/verdict-code.js +18 -0
  16. package/dist/adapters/mech/verdict-code.js.map +1 -1
  17. package/dist/api/bootstrap-endpoint.js +63 -1
  18. package/dist/api/bootstrap-endpoint.js.map +1 -1
  19. package/dist/api/codex-doctor-endpoint.d.ts +73 -0
  20. package/dist/api/codex-doctor-endpoint.js +158 -0
  21. package/dist/api/codex-doctor-endpoint.js.map +1 -0
  22. package/dist/api/discovery-endpoint.d.ts +31 -0
  23. package/dist/api/discovery-endpoint.js +78 -0
  24. package/dist/api/discovery-endpoint.js.map +1 -0
  25. package/dist/api/fleet-build.d.ts +8 -0
  26. package/dist/api/fleet-build.js +8 -2
  27. package/dist/api/fleet-build.js.map +1 -1
  28. package/dist/api/gather-status.js +90 -4
  29. package/dist/api/gather-status.js.map +1 -1
  30. package/dist/api/harness-readiness-endpoint.d.ts +25 -0
  31. package/dist/api/harness-readiness-endpoint.js +24 -0
  32. package/dist/api/harness-readiness-endpoint.js.map +1 -0
  33. package/dist/api/hermes-doctor-endpoint.d.ts +66 -0
  34. package/dist/api/hermes-doctor-endpoint.js +75 -0
  35. package/dist/api/hermes-doctor-endpoint.js.map +1 -0
  36. package/dist/api/portfolio-v0-build.d.ts +10 -0
  37. package/dist/api/portfolio-v0-build.js +24 -5
  38. package/dist/api/portfolio-v0-build.js.map +1 -1
  39. package/dist/api/prediction-v1-build.d.ts +9 -0
  40. package/dist/api/prediction-v1-build.js +6 -1
  41. package/dist/api/prediction-v1-build.js.map +1 -1
  42. package/dist/api/server.d.ts +70 -0
  43. package/dist/api/server.js +107 -1
  44. package/dist/api/server.js.map +1 -1
  45. package/dist/api/setup-endpoints.d.ts +21 -0
  46. package/dist/api/setup-endpoints.js +101 -8
  47. package/dist/api/setup-endpoints.js.map +1 -1
  48. package/dist/api/setup-retry-endpoint.d.ts +19 -0
  49. package/dist/api/setup-retry-endpoint.js +32 -0
  50. package/dist/api/setup-retry-endpoint.js.map +1 -0
  51. package/dist/api/solvernets-endpoints.js +8 -1
  52. package/dist/api/solvernets-endpoints.js.map +1 -1
  53. package/dist/api/status-build.d.ts +14 -0
  54. package/dist/api/status-build.js +23 -18
  55. package/dist/api/status-build.js.map +1 -1
  56. package/dist/api/task-run-routing.d.ts +7 -0
  57. package/dist/api/task-run-routing.js +12 -0
  58. package/dist/api/task-run-routing.js.map +1 -0
  59. package/dist/api/task-runs-build.d.ts +20 -0
  60. package/dist/api/task-runs-build.js +4 -0
  61. package/dist/api/task-runs-build.js.map +1 -1
  62. package/dist/build-info.json +4 -4
  63. package/dist/build-meta.json +1 -1
  64. package/dist/chain-read-errors.d.ts +10 -0
  65. package/dist/chain-read-errors.js +15 -0
  66. package/dist/chain-read-errors.js.map +1 -1
  67. package/dist/cli/commands/auth.js +3 -1
  68. package/dist/cli/commands/auth.js.map +1 -1
  69. package/dist/cli/commands/create.d.ts +5 -3
  70. package/dist/cli/commands/create.js +102 -36
  71. package/dist/cli/commands/create.js.map +1 -1
  72. package/dist/cli/commands/solver-nets.d.ts +19 -0
  73. package/dist/cli/commands/solver-nets.js +164 -11
  74. package/dist/cli/commands/solver-nets.js.map +1 -1
  75. package/dist/cli/commands/solver-plugins-publish.d.ts +31 -0
  76. package/dist/cli/commands/solver-plugins-publish.js +169 -0
  77. package/dist/cli/commands/solver-plugins-publish.js.map +1 -0
  78. package/dist/cli/commands/solver-plugins-revoke.d.ts +15 -0
  79. package/dist/cli/commands/solver-plugins-revoke.js +91 -0
  80. package/dist/cli/commands/solver-plugins-revoke.js.map +1 -0
  81. package/dist/cli/commands/solver-plugins.d.ts +50 -6
  82. package/dist/cli/commands/solver-plugins.js +205 -68
  83. package/dist/cli/commands/solver-plugins.js.map +1 -1
  84. package/dist/cli/commands/update.d.ts +10 -0
  85. package/dist/cli/commands/update.js +36 -0
  86. package/dist/cli/commands/update.js.map +1 -1
  87. package/dist/config.d.ts +51 -0
  88. package/dist/config.js +49 -2
  89. package/dist/config.js.map +1 -1
  90. package/dist/conformance/checks/hash-signature.js +6 -2
  91. package/dist/conformance/checks/hash-signature.js.map +1 -1
  92. package/dist/conformance/checks/payload.js +4 -2
  93. package/dist/conformance/checks/payload.js.map +1 -1
  94. package/dist/conformance/checks/verdict.d.ts +10 -10
  95. package/dist/conformance/checks/verdict.js +16 -15
  96. package/dist/conformance/checks/verdict.js.map +1 -1
  97. package/dist/conformance/harness.d.ts +1 -1
  98. package/dist/conformance/harness.js +16 -9
  99. package/dist/conformance/harness.js.map +1 -1
  100. package/dist/conformance/types.d.ts +10 -3
  101. package/dist/conformance/types.js.map +1 -1
  102. package/dist/corpus/acquire.d.ts +1 -3
  103. package/dist/corpus/acquire.js.map +1 -1
  104. package/dist/corpus/envelope-projection.d.ts +1 -1
  105. package/dist/corpus/envelope-projection.js +14 -7
  106. package/dist/corpus/envelope-projection.js.map +1 -1
  107. package/dist/corpus/index.d.ts +2 -1
  108. package/dist/corpus/index.js.map +1 -1
  109. package/dist/corpus/prediction-brier-scoreboard-report.js +1 -1
  110. package/dist/corpus/prediction-brier-scoreboard-report.js.map +1 -1
  111. package/dist/corpus/prediction-brier-scoreboard.js +3 -1
  112. package/dist/corpus/prediction-brier-scoreboard.js.map +1 -1
  113. package/dist/corpus/types.d.ts +2 -2
  114. package/dist/daemon/daemon.d.ts +26 -1
  115. package/dist/daemon/daemon.js +63 -1
  116. package/dist/daemon/daemon.js.map +1 -1
  117. package/dist/daemon/eviction-loop.d.ts +40 -0
  118. package/dist/daemon/eviction-loop.js +67 -0
  119. package/dist/daemon/eviction-loop.js.map +1 -0
  120. package/dist/daemon/freeze-fence.js +6 -3
  121. package/dist/daemon/freeze-fence.js.map +1 -1
  122. package/dist/daemon/readiness-gate.d.ts +30 -0
  123. package/dist/daemon/readiness-gate.js +31 -0
  124. package/dist/daemon/readiness-gate.js.map +1 -0
  125. package/dist/daemon/skip-log-dedup.d.ts +69 -0
  126. package/dist/daemon/skip-log-dedup.js +106 -0
  127. package/dist/daemon/skip-log-dedup.js.map +1 -0
  128. package/dist/dashboard/assets/{index-D_NMfDfV.css → index-DE4qUnzV.css} +1 -1
  129. package/dist/dashboard/assets/index-Di7xA4eB.js +170 -0
  130. package/dist/dashboard/index.html +2 -2
  131. package/dist/discovery/http.js +121 -0
  132. package/dist/discovery/http.js.map +1 -1
  133. package/dist/discovery/onchain.d.ts +5 -0
  134. package/dist/discovery/onchain.js +292 -7
  135. package/dist/discovery/onchain.js.map +1 -1
  136. package/dist/discovery/types.d.ts +127 -1
  137. package/dist/discovery/types.js +8 -10
  138. package/dist/discovery/types.js.map +1 -1
  139. package/dist/discovery/with-fallback.js +9 -0
  140. package/dist/discovery/with-fallback.js.map +1 -1
  141. package/dist/earning/agent-wallet-binding.d.ts +20 -1
  142. package/dist/earning/agent-wallet-binding.js +54 -16
  143. package/dist/earning/agent-wallet-binding.js.map +1 -1
  144. package/dist/earning/bootstrap.d.ts +178 -0
  145. package/dist/earning/bootstrap.js +628 -57
  146. package/dist/earning/bootstrap.js.map +1 -1
  147. package/dist/earning/contracts.d.ts +12 -0
  148. package/dist/earning/contracts.js +16 -1
  149. package/dist/earning/contracts.js.map +1 -1
  150. package/dist/earning/funding-plan.js +15 -2
  151. package/dist/earning/funding-plan.js.map +1 -1
  152. package/dist/earning/jinn-rewards.d.ts +46 -0
  153. package/dist/earning/jinn-rewards.js +32 -0
  154. package/dist/earning/jinn-rewards.js.map +1 -1
  155. package/dist/earning/store.d.ts +8 -0
  156. package/dist/earning/store.js +48 -1
  157. package/dist/earning/store.js.map +1 -1
  158. package/dist/earning/testnet-setup-migration.d.ts +12 -0
  159. package/dist/earning/testnet-setup-migration.js +27 -1
  160. package/dist/earning/testnet-setup-migration.js.map +1 -1
  161. package/dist/earning/types.d.ts +45 -0
  162. package/dist/earning/types.js +37 -0
  163. package/dist/earning/types.js.map +1 -1
  164. package/dist/erc8004/abis.d.ts +64 -0
  165. package/dist/erc8004/abis.js +48 -0
  166. package/dist/erc8004/abis.js.map +1 -1
  167. package/dist/erc8004/plugin-registry.d.ts +102 -0
  168. package/dist/erc8004/plugin-registry.js +165 -0
  169. package/dist/erc8004/plugin-registry.js.map +1 -0
  170. package/dist/erc8004/reputation.d.ts +8 -0
  171. package/dist/erc8004/reputation.js +22 -3
  172. package/dist/erc8004/reputation.js.map +1 -1
  173. package/dist/events/types.d.ts +2 -2
  174. package/dist/harnesses/cost-estimates.d.ts +145 -0
  175. package/dist/harnesses/cost-estimates.js +297 -0
  176. package/dist/harnesses/cost-estimates.js.map +1 -0
  177. package/dist/harnesses/engine/engine.d.ts +40 -0
  178. package/dist/harnesses/engine/engine.js +69 -8
  179. package/dist/harnesses/engine/engine.js.map +1 -1
  180. package/dist/harnesses/engine/envelope-assembly.d.ts +2 -2
  181. package/dist/harnesses/engine/envelope-assembly.js +4 -2
  182. package/dist/harnesses/engine/envelope-assembly.js.map +1 -1
  183. package/dist/harnesses/engine/persistence.d.ts +21 -0
  184. package/dist/harnesses/engine/persistence.js +39 -0
  185. package/dist/harnesses/engine/persistence.js.map +1 -1
  186. package/dist/harnesses/engine/work-dir-reaper.d.ts +65 -0
  187. package/dist/harnesses/engine/work-dir-reaper.js +100 -0
  188. package/dist/harnesses/engine/work-dir-reaper.js.map +1 -0
  189. package/dist/harnesses/freeze.d.ts +4 -1
  190. package/dist/harnesses/freeze.js +12 -2
  191. package/dist/harnesses/freeze.js.map +1 -1
  192. package/dist/harnesses/impls/claude-mcp-prediction/index.d.ts +4 -1
  193. package/dist/harnesses/impls/claude-mcp-prediction/index.js +7 -2
  194. package/dist/harnesses/impls/claude-mcp-prediction/index.js.map +1 -1
  195. package/dist/harnesses/impls/claude-mcp-prediction-apy/index.d.ts +4 -1
  196. package/dist/harnesses/impls/claude-mcp-prediction-apy/index.js +7 -2
  197. package/dist/harnesses/impls/claude-mcp-prediction-apy/index.js.map +1 -1
  198. package/dist/harnesses/impls/evaluation-context.d.ts +15 -4
  199. package/dist/harnesses/impls/evaluation-context.js +24 -8
  200. package/dist/harnesses/impls/evaluation-context.js.map +1 -1
  201. package/dist/harnesses/impls/hermes-agent/adapter.d.ts +34 -0
  202. package/dist/harnesses/impls/hermes-agent/adapter.js +205 -0
  203. package/dist/harnesses/impls/hermes-agent/adapter.js.map +1 -0
  204. package/dist/harnesses/impls/hermes-agent/bootstrap.d.ts +18 -0
  205. package/dist/harnesses/impls/hermes-agent/bootstrap.js +231 -0
  206. package/dist/harnesses/impls/hermes-agent/bootstrap.js.map +1 -0
  207. package/dist/harnesses/impls/hermes-agent/config-builder.d.ts +49 -0
  208. package/dist/harnesses/impls/hermes-agent/config-builder.js +132 -0
  209. package/dist/harnesses/impls/hermes-agent/config-builder.js.map +1 -0
  210. package/dist/harnesses/impls/hermes-agent/harness.d.ts +58 -0
  211. package/dist/harnesses/impls/hermes-agent/harness.js +118 -0
  212. package/dist/harnesses/impls/hermes-agent/harness.js.map +1 -0
  213. package/dist/harnesses/impls/hermes-agent/index.d.ts +5 -0
  214. package/dist/harnesses/impls/hermes-agent/index.js +7 -0
  215. package/dist/harnesses/impls/hermes-agent/index.js.map +1 -0
  216. package/dist/harnesses/impls/hermes-agent/prompt.d.ts +15 -0
  217. package/dist/harnesses/impls/hermes-agent/prompt.js +37 -0
  218. package/dist/harnesses/impls/hermes-agent/prompt.js.map +1 -0
  219. package/dist/harnesses/impls/index.d.ts +13 -0
  220. package/dist/harnesses/impls/index.js +32 -4
  221. package/dist/harnesses/impls/index.js.map +1 -1
  222. package/dist/harnesses/impls/learner/adapters/claude-code.js.map +1 -0
  223. package/dist/harnesses/impls/{claude-code-learner → learner}/adapters/codex-code.js +13 -34
  224. package/dist/harnesses/impls/learner/adapters/codex-code.js.map +1 -0
  225. package/dist/harnesses/impls/learner/adapters/codex-workspace.js.map +1 -0
  226. package/dist/harnesses/impls/learner/harness.d.ts +62 -0
  227. package/dist/harnesses/impls/learner/harness.js +179 -0
  228. package/dist/harnesses/impls/learner/harness.js.map +1 -0
  229. package/dist/harnesses/impls/{claude-code-learner → learner}/harvest.js +15 -3
  230. package/dist/harnesses/impls/learner/harvest.js.map +1 -0
  231. package/dist/harnesses/impls/{claude-code-learner → learner}/index.d.ts +5 -5
  232. package/dist/harnesses/impls/{claude-code-learner → learner}/index.js +4 -4
  233. package/dist/harnesses/impls/learner/index.js.map +1 -0
  234. package/dist/harnesses/impls/{claude-code-learner → learner}/plugin-path.d.ts +4 -4
  235. package/dist/harnesses/impls/{claude-code-learner → learner}/plugin-path.js +7 -7
  236. package/dist/harnesses/impls/learner/plugin-path.js.map +1 -0
  237. package/dist/harnesses/impls/{claude-code-learner → learner}/restoration-patch.js +3 -1
  238. package/dist/harnesses/impls/learner/restoration-patch.js.map +1 -0
  239. package/dist/harnesses/impls/learner/test-utils/fake-plugin-outputs.js.map +1 -0
  240. package/dist/harnesses/impls/learner/test-utils/noop-adapter.js.map +1 -0
  241. package/dist/harnesses/impls/{claude-code-learner → learner}/types.d.ts +23 -2
  242. package/dist/harnesses/impls/learner/types.js.map +1 -0
  243. package/dist/harnesses/impls/portfolio-v0-evaluator/index.js +13 -12
  244. package/dist/harnesses/impls/portfolio-v0-evaluator/index.js.map +1 -1
  245. package/dist/harnesses/impls/prediction-apy-v0-evaluator/index.js +7 -7
  246. package/dist/harnesses/impls/prediction-apy-v0-evaluator/index.js.map +1 -1
  247. package/dist/harnesses/impls/prediction-apy-v0-evaluator/parse-submission.d.ts +3 -3
  248. package/dist/harnesses/impls/prediction-apy-v0-evaluator/parse-submission.js +7 -6
  249. package/dist/harnesses/impls/prediction-apy-v0-evaluator/parse-submission.js.map +1 -1
  250. package/dist/harnesses/impls/prediction-v0-evaluator/checks/integrity.js +1 -1
  251. package/dist/harnesses/impls/prediction-v0-evaluator/checks/integrity.js.map +1 -1
  252. package/dist/harnesses/impls/prediction-v0-evaluator/index.js +11 -10
  253. package/dist/harnesses/impls/prediction-v0-evaluator/index.js.map +1 -1
  254. package/dist/harnesses/impls/prediction-v1-evaluator/index.js +11 -10
  255. package/dist/harnesses/impls/prediction-v1-evaluator/index.js.map +1 -1
  256. package/dist/harnesses/impls/stub.d.ts +58 -0
  257. package/dist/harnesses/impls/stub.js +89 -0
  258. package/dist/harnesses/impls/stub.js.map +1 -0
  259. package/dist/harnesses/impls/swe-rebench-v2-evaluator/eval-runner.d.ts +1 -0
  260. package/dist/harnesses/impls/swe-rebench-v2-evaluator/eval-runner.js +10 -2
  261. package/dist/harnesses/impls/swe-rebench-v2-evaluator/eval-runner.js.map +1 -1
  262. package/dist/harnesses/impls/swe-rebench-v2-evaluator/harness.d.ts +24 -5
  263. package/dist/harnesses/impls/swe-rebench-v2-evaluator/harness.js +104 -4
  264. package/dist/harnesses/impls/swe-rebench-v2-evaluator/harness.js.map +1 -1
  265. package/dist/harnesses/impls/swe-rebench-v2-evaluator/hf-fetcher.d.ts +9 -0
  266. package/dist/harnesses/impls/swe-rebench-v2-evaluator/hf-fetcher.js +25 -1
  267. package/dist/harnesses/impls/swe-rebench-v2-evaluator/hf-fetcher.js.map +1 -1
  268. package/dist/harnesses/names.d.ts +1 -0
  269. package/dist/harnesses/names.js +3 -0
  270. package/dist/harnesses/names.js.map +1 -1
  271. package/dist/harnesses/readiness-registry.d.ts +48 -0
  272. package/dist/harnesses/readiness-registry.js +144 -0
  273. package/dist/harnesses/readiness-registry.js.map +1 -0
  274. package/dist/harnesses/types.d.ts +7 -0
  275. package/dist/main.d.ts +14 -0
  276. package/dist/main.js +372 -90
  277. package/dist/main.js.map +1 -1
  278. package/dist/mcp/server.js +14 -13
  279. package/dist/mcp/server.js.map +1 -1
  280. package/dist/operator-errors.d.ts +7 -0
  281. package/dist/operator-errors.js +26 -2
  282. package/dist/operator-errors.js.map +1 -1
  283. package/dist/preflight/claude-auth.d.ts +18 -0
  284. package/dist/preflight/claude-auth.js +38 -0
  285. package/dist/preflight/claude-auth.js.map +1 -1
  286. package/dist/restart-daemon.d.ts +71 -0
  287. package/dist/restart-daemon.js +82 -0
  288. package/dist/restart-daemon.js.map +1 -0
  289. package/dist/scripts/donation-consumption-acceptance.js +1 -1
  290. package/dist/scripts/donation-consumption-acceptance.js.map +1 -1
  291. package/dist/scripts/swe-rebench-v2-known-bad.json +12 -0
  292. package/dist/scripts/swe-rebench-v2-seed-pool.json +26 -0
  293. package/dist/setup/halt-mode.d.ts +14 -0
  294. package/dist/setup/halt-mode.js +17 -0
  295. package/dist/setup/halt-mode.js.map +1 -0
  296. package/dist/solver-nets/prediction-operator-ux.js +43 -3
  297. package/dist/solver-nets/prediction-operator-ux.js.map +1 -1
  298. package/dist/solver-nets/registry.d.ts +1 -0
  299. package/dist/solver-nets/registry.js +1 -1
  300. package/dist/solver-nets/registry.js.map +1 -1
  301. package/dist/solver-types/_swe-rebench-v2-substrate.d.ts +52 -0
  302. package/dist/solver-types/_swe-rebench-v2-substrate.js +76 -0
  303. package/dist/solver-types/_swe-rebench-v2-substrate.js.map +1 -0
  304. package/dist/solver-types/_swe-rebench-v2-validated-pool.d.ts +38 -12
  305. package/dist/solver-types/_swe-rebench-v2-validated-pool.js +136 -27
  306. package/dist/solver-types/_swe-rebench-v2-validated-pool.js.map +1 -1
  307. package/dist/solver-types/swe-rebench-v2-auto.d.ts +6 -0
  308. package/dist/solver-types/swe-rebench-v2-auto.js.map +1 -1
  309. package/dist/solver-types/swe-rebench-v2.d.ts +1 -0
  310. package/dist/solver-types/swe-rebench-v2.js +19 -6
  311. package/dist/solver-types/swe-rebench-v2.js.map +1 -1
  312. package/dist/solvernets/daemon-init.d.ts +10 -2
  313. package/dist/solvernets/daemon-init.js +22 -2
  314. package/dist/solvernets/daemon-init.js.map +1 -1
  315. package/dist/store/store.js +12 -4
  316. package/dist/store/store.js.map +1 -1
  317. package/dist/templates/plugins/runtime-plugin/.mcp.json.tmpl +8 -0
  318. package/dist/templates/plugins/runtime-plugin/README.md.tmpl +30 -0
  319. package/dist/templates/plugins/runtime-plugin/gitignore.tmpl +3 -0
  320. package/dist/templates/plugins/runtime-plugin/jinn.plugin.json.tmpl +21 -0
  321. package/dist/templates/plugins/runtime-plugin/mcp/server.mjs.tmpl +33 -0
  322. package/dist/templates/plugins/runtime-plugin/package.json.tmpl +15 -0
  323. package/dist/templates/plugins/runtime-plugin/test/plugin.test.ts.tmpl +35 -0
  324. package/dist/templates/plugins/runtime-plugin/tsconfig.json.tmpl +11 -0
  325. package/dist/templates/plugins/solver-type-plugin/README.md.tmpl +35 -0
  326. package/dist/templates/plugins/solver-type-plugin/gitignore.tmpl +3 -0
  327. package/dist/templates/plugins/solver-type-plugin/jinn.plugin.json.tmpl +11 -0
  328. package/dist/templates/plugins/solver-type-plugin/package.json.tmpl +15 -0
  329. package/dist/templates/plugins/solver-type-plugin/skills/example/SKILL.md.tmpl +10 -0
  330. package/dist/templates/plugins/solver-type-plugin/test/plugin.test.ts.tmpl +25 -0
  331. package/dist/templates/plugins/solver-type-plugin/tsconfig.json.tmpl +11 -0
  332. package/dist/tx-retry.d.ts +13 -0
  333. package/dist/tx-retry.js +22 -0
  334. package/dist/tx-retry.js.map +1 -1
  335. package/dist/types/envelope.d.ts +28 -21
  336. package/dist/types/envelope.js +8 -3
  337. package/dist/types/envelope.js.map +1 -1
  338. package/dist/types/payloads/index.d.ts +2 -2
  339. package/dist/types/payloads/index.js +13 -12
  340. package/dist/types/payloads/index.js.map +1 -1
  341. package/dist/types/payloads/portfolio-v0.d.ts +60 -10
  342. package/dist/types/payloads/portfolio-v0.js +16 -6
  343. package/dist/types/payloads/portfolio-v0.js.map +1 -1
  344. package/dist/types/payloads/prediction-apy-v0.d.ts +56 -14
  345. package/dist/types/payloads/prediction-apy-v0.js +16 -6
  346. package/dist/types/payloads/prediction-apy-v0.js.map +1 -1
  347. package/dist/types/payloads/prediction-v0.d.ts +53 -14
  348. package/dist/types/payloads/prediction-v0.js +16 -6
  349. package/dist/types/payloads/prediction-v0.js.map +1 -1
  350. package/dist/util/extract-tx-hash.d.ts +14 -0
  351. package/dist/util/extract-tx-hash.js +19 -0
  352. package/dist/util/extract-tx-hash.js.map +1 -0
  353. package/dist/vendor/@jinn-network/sdk/dist/payloads/prediction-v1.d.ts +45 -6
  354. package/dist/vendor/@jinn-network/sdk/dist/payloads/prediction-v1.js +16 -6
  355. package/dist/x402/handler.js +51 -20
  356. package/dist/x402/handler.js.map +1 -1
  357. package/package.json +38 -13
  358. package/plugins/swe-rebench-v2-diffmin/.claude-plugin/plugin.json +5 -0
  359. package/plugins/swe-rebench-v2-diffmin/.mcp.json +8 -0
  360. package/plugins/swe-rebench-v2-diffmin/README.md +69 -0
  361. package/plugins/swe-rebench-v2-diffmin/jinn.plugin.json +12 -0
  362. package/plugins/swe-rebench-v2-diffmin/mcp/diff-stats-server.mjs +72 -0
  363. package/plugins/swe-rebench-v2-diffmin/mcp/diff-stats.mjs +48 -0
  364. package/plugins/swe-rebench-v2-diffmin/package.json +19 -0
  365. package/plugins/swe-rebench-v2-diffmin/skills/diffmin/SKILL.md +116 -0
  366. package/plugins/swe-rebench-v2-diffmin/skills/test-map/SKILL.md +126 -0
  367. package/plugins/swe-rebench-v2-diffmin/test/diff-stats.test.ts +62 -0
  368. package/plugins/swe-rebench-v2-diffmin/test/manifest.test.ts +53 -0
  369. package/plugins/swe-rebench-v2-diffmin/tsconfig.json +12 -0
  370. package/plugins/swe-rebench-v2-runtime/README.md +13 -0
  371. package/plugins/swe-rebench-v2-runtime/skills/orient/SKILL.md +7 -3
  372. package/plugins/swe-rebench-v2-runtime/skills/plan/SKILL.md +6 -17
  373. package/templates/plugins/runtime-plugin/.mcp.json.tmpl +8 -0
  374. package/templates/plugins/runtime-plugin/README.md.tmpl +30 -0
  375. package/templates/plugins/runtime-plugin/gitignore.tmpl +3 -0
  376. package/templates/plugins/runtime-plugin/jinn.plugin.json.tmpl +21 -0
  377. package/templates/plugins/runtime-plugin/mcp/server.mjs.tmpl +33 -0
  378. package/templates/plugins/runtime-plugin/package.json.tmpl +15 -0
  379. package/templates/plugins/runtime-plugin/test/plugin.test.ts.tmpl +35 -0
  380. package/templates/plugins/runtime-plugin/tsconfig.json.tmpl +11 -0
  381. package/templates/plugins/solver-type-plugin/README.md.tmpl +35 -0
  382. package/templates/plugins/solver-type-plugin/gitignore.tmpl +3 -0
  383. package/templates/plugins/solver-type-plugin/jinn.plugin.json.tmpl +11 -0
  384. package/templates/plugins/solver-type-plugin/package.json.tmpl +15 -0
  385. package/templates/plugins/solver-type-plugin/skills/example/SKILL.md.tmpl +10 -0
  386. package/templates/plugins/solver-type-plugin/test/plugin.test.ts.tmpl +25 -0
  387. package/templates/plugins/solver-type-plugin/tsconfig.json.tmpl +11 -0
  388. package/dist/dashboard/assets/index-BjtltOGc.js +0 -76
  389. package/dist/harnesses/impls/claude-code-learner/adapters/claude-code.js.map +0 -1
  390. package/dist/harnesses/impls/claude-code-learner/adapters/codex-code.js.map +0 -1
  391. package/dist/harnesses/impls/claude-code-learner/adapters/codex-workspace.js.map +0 -1
  392. package/dist/harnesses/impls/claude-code-learner/harness.d.ts +0 -22
  393. package/dist/harnesses/impls/claude-code-learner/harness.js +0 -62
  394. package/dist/harnesses/impls/claude-code-learner/harness.js.map +0 -1
  395. package/dist/harnesses/impls/claude-code-learner/harvest.js.map +0 -1
  396. package/dist/harnesses/impls/claude-code-learner/index.js.map +0 -1
  397. package/dist/harnesses/impls/claude-code-learner/plugin-path.js.map +0 -1
  398. package/dist/harnesses/impls/claude-code-learner/restoration-patch.js.map +0 -1
  399. package/dist/harnesses/impls/claude-code-learner/test-utils/fake-plugin-outputs.js.map +0 -1
  400. package/dist/harnesses/impls/claude-code-learner/test-utils/noop-adapter.js.map +0 -1
  401. package/dist/harnesses/impls/claude-code-learner/types.js.map +0 -1
  402. package/dist/preflight/claude-required.d.ts +0 -8
  403. package/dist/preflight/claude-required.js +0 -17
  404. package/dist/preflight/claude-required.js.map +0 -1
  405. /package/dist/harnesses/impls/{claude-code-learner → learner}/adapters/claude-code.d.ts +0 -0
  406. /package/dist/harnesses/impls/{claude-code-learner → learner}/adapters/claude-code.js +0 -0
  407. /package/dist/harnesses/impls/{claude-code-learner → learner}/adapters/codex-code.d.ts +0 -0
  408. /package/dist/harnesses/impls/{claude-code-learner → learner}/adapters/codex-workspace.d.ts +0 -0
  409. /package/dist/harnesses/impls/{claude-code-learner → learner}/adapters/codex-workspace.js +0 -0
  410. /package/dist/harnesses/impls/{claude-code-learner → learner}/harvest.d.ts +0 -0
  411. /package/dist/harnesses/impls/{claude-code-learner → learner}/restoration-patch.d.ts +0 -0
  412. /package/dist/harnesses/impls/{claude-code-learner → learner}/test-utils/fake-plugin-outputs.d.ts +0 -0
  413. /package/dist/harnesses/impls/{claude-code-learner → learner}/test-utils/fake-plugin-outputs.js +0 -0
  414. /package/dist/harnesses/impls/{claude-code-learner → learner}/test-utils/noop-adapter.d.ts +0 -0
  415. /package/dist/harnesses/impls/{claude-code-learner → learner}/test-utils/noop-adapter.js +0 -0
  416. /package/dist/harnesses/impls/{claude-code-learner → learner}/types.js +0 -0
  417. /package/plugins/{claude-code-learner → learner}/.claude-plugin/plugin.json +0 -0
  418. /package/plugins/{claude-code-learner → learner}/.codex-plugin/plugin.json +0 -0
  419. /package/plugins/{claude-code-learner → learner}/AGENTS.md +0 -0
  420. /package/plugins/{claude-code-learner → learner}/CLAUDE.md +0 -0
  421. /package/plugins/{claude-code-learner → learner}/README.md +0 -0
  422. /package/plugins/{claude-code-learner → learner}/hooks/hooks.json +0 -0
  423. /package/plugins/{claude-code-learner → learner}/hooks/session-start +0 -0
  424. /package/plugins/{claude-code-learner → learner}/skills/learn/SKILL.md +0 -0
  425. /package/plugins/{claude-code-learner → learner}/skills/learn/analyst-prompt.md +0 -0
  426. /package/plugins/{claude-code-learner → learner}/skills/learn/consolidator-prompt.md +0 -0
  427. /package/plugins/{claude-code-learner → learner}/skills/learn/explorer-prompt.md +0 -0
  428. /package/plugins/{claude-code-learner → learner}/skills/learn/planner-prompt.md +0 -0
  429. /package/plugins/{claude-code-learner → learner}/skills/learn/promoter-prompt.md +0 -0
  430. /package/plugins/{claude-code-learner → learner}/skills/learn/step-worker-prompt.md +0 -0
  431. /package/plugins/{claude-code-learner → learner}/skills/learn/strategist-prompt.md +0 -0
package/CHANGELOG.md CHANGED
@@ -2,6 +2,137 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ### Embedded agent surface hidden by default (issue #326)
6
+
7
+ - **The embedded Claude agent chat surface no longer renders in the operator
8
+ app by default.** The right-rail agent panel (running mode) and the
9
+ "Ask Claude" panel (onboarding) are hidden. The 2026-05-19 v0.1.6 dogfood
10
+ found the surface isn't robust enough for first-time operators — it is the
11
+ only daemon-side surface that strictly requires Claude auth, and its
12
+ action-authority / plugin-scope shape is still in design (#177 / #178).
13
+ - **Feature flag: `JINN_ENABLE_EMBEDDED_AGENT`.** Set
14
+ `JINN_ENABLE_EMBEDDED_AGENT=1` (also accepts `true`) to re-enable the
15
+ surface for development. Default is off. When off, the daemon does not
16
+ mount the `/api/agent/ws` bridge and the SPA renders no agent panel; when
17
+ on, the dev-time path works end-to-end as before. (Issue #367: the SPA now
18
+ reads this flag through the injected `window.__JINN_FEATURES__`, the same
19
+ channel as the plug-in builder UI flag — no behaviour change for operators.)
20
+ - **Claude-Code-as-a-solver-harness is unaffected.** Operators can still pick
21
+ Claude Code as their SolverNet harness — that path is independent of the
22
+ embedded chat surface and its WebSocket bridge.
23
+
24
+ ### Operator app
25
+
26
+ - **Plug-in builder UI surfaces hidden by default (issue #327).** The `/build`
27
+ route and the Build top-tab no longer appear in the operator app. Hitting
28
+ `/build` by direct URL redirects to `/overview`. The plug-in substrate stays
29
+ fully live — `jinn solver-plugins publish` / `revoke`, the Ponder indexer,
30
+ the Discovery API endpoints, and the `client/docs/build/` tree are
31
+ unchanged, so direct-CLI builders following the docs are not blocked. The
32
+ surfaces are gated to keep the operator-app first-run UX focused; they will
33
+ be re-promoted once that UX is solid and plug-in indexing is end-to-end
34
+ populated. Set `JINN_ENABLE_PLUGIN_BUILDER_UI=1` on the daemon to re-enable
35
+ the full builder surface for development and design work — the daemon injects
36
+ the flag into the SPA via `window.__JINN_FEATURES__`.
37
+
38
+ ### SWE-rebench v2 admission
39
+
40
+ - **Admission semantics bumped from `'2'` → `'3'`.** Operators running the
41
+ public/launched generator MUST re-validate before posting resumes:
42
+
43
+ ```bash
44
+ jinn solver-nets validate-pool swe-rebench-v2 --seed-positive --known-bad
45
+ ```
46
+
47
+ Expected duration: ~1-2h (one gold-patch eval per seed instance).
48
+ Until re-validation runs, the launched generator posts no new tasks
49
+ (admission required; `jinn doctor` reports the pool as stale).
50
+ Note: the seed pool contains 20 instances from common Python repos; typical
51
+ admission rates are 25-40%, so expect 5-8 scorable entries after re-validation.
52
+ Operators can extend the seed list via PR over time.
53
+ - **Required admission mode is now the default for launched generators.**
54
+ Local/dev users running `admissionMode: 'python-floor'` keep today's
55
+ behaviour. `jinn doctor` reports pool freshness and prints the exact
56
+ re-validation command when stale.
57
+ - **Verdict-time substrate recheck** catches drift between admission and
58
+ grading. Any mismatch (rowHash, imageDigest, HF outage) skips the verdict
59
+ rather than emitting a misclassified FAIL.
60
+
61
+ ## v0.1.5 — Operator App
62
+
63
+ _Released 2026-05-13_
64
+
65
+ # v0.1.5 — "Operator App"
66
+ 2026-05-13 · Suggested bump: patch (first npm `@latest` cut that ships the app-first operator experience)
67
+
68
+ ## Highlights
69
+
70
+ - Release plumbing fixed so the cut can actually ship. `npm-publish.yml` now installs `contracts/` before the operator gate, the Docker/GHCR workflow accepts the new `v<semver>` tag format alongside legacy `client-v*`, and the CHANGELOG mirror writes through a PR (no more failed direct push to protected `main`).
71
+ - SWE-rebench v2 verdict path is structurally correct end-to-end. The eval loop no longer emits verdicts on non-gradeable evals (uy6v.8), the daemon's `verdictCode` default is `Invalid`, not `Pass` (uy6v.7), evaluator-side gating now surfaces a real verdict so the reputation feedback hook fires (uy6v.10), and the `evaluation:<cid>` MetadataSet is published on verdict delivery (n93o).
72
+ - Per-operator disks no longer fill in a couple of weeks. The SWE-rebench v2 eval-image cache is bounded by an in-process LRU (uy6v.11).
73
+ - Operator app feedback on issue 188 addressed across overview / launcher / catalog / configuration / shell, with dashboard tests refreshed.
74
+ - Daemon execution envelope now carries the executor model (`gbut`), giving downstream consumers the model that produced each Solution / Verdict.
75
+ - Discovery API no longer 404s for just-launched manifests when no subgraph is configured (#170) — important for fresh launcher records.
76
+
77
+ ## Recovery context
78
+
79
+ v0.1.4 published as a GitHub Release at `fa8da678` but the npm-publish workflow failed before publish in `release:operator-gate` because contracts dependencies were not installed in the clean Actions checkout. The fix landed as PR #187 *after* the v0.1.4 tag was created, so the v0.1.4 release commit could not retry publish. v0.1.5 cuts from current `main` (`56e84952`) which includes that fix; `@jinn-network/client@latest` becomes `0.1.5` (replacing the stale `0.1.2`). v0.1.4 remains as a Build Notes Release; no `0.1.4` npm artifact exists.
80
+
81
+ ## Changes
82
+
83
+ ### feat
84
+ - (#189) feat(uy6v.11): bound swe-rebench-v2 eval-image cache with in-process LRU — @ritsuKai2000
85
+ - (#194) feat(gbut): publish executor.model in jinn.execution.v1 envelope — @ritsuKai2000
86
+
87
+ ### fix
88
+ - (#170) fix: /v1/solvernets/registry/:cid 404s for just-launched manifests when no subgraph is configured — @ritsuKai2000
89
+ - (#183) fix(uy6v.8): SWE-rebench v2 eval loop — no verdicts on non-gradeable evals; source-only patches — @ritsuKai2000
90
+ - (#185) fix(release): unblock v0.1.4 publish — @ritsuKai2000
91
+ - (#187) fix(release): install contracts before operator gate — @ritsuKai2000
92
+ - (#190) fix(uy6v.10): emit verdict in swe-rebench-v2 gating so reputation hook fires — @ritsuKai2000
93
+ - (#193) fix(uy6v.7): daemon verdictCode default — Invalid not Pass — @ritsuKai2000
94
+ - (#197) fix(n93o): publish evaluation:<cid> MetadataSet on verdict delivery — @ritsuKai2000
95
+
96
+ ### chore
97
+ - (#208) chore(2cl.20): bump client/package.json to 0.1.5 — @ritsuKai2000
98
+
99
+ ### docs
100
+ - (#165) docs: clarify terminal unresolved verdicts — @ritsuKai2000
101
+ - (#195) docs(uy6v.6): DR — keep self-eval bypass on testnet; revert is a mainnet gate — @ritsuKai2000
102
+
103
+ ### test
104
+ - (#168) test: Real-daemon Playwright e2e: lifecycle + operator catalog + empty states + crash recovery (scenarios 2-5) — scenarios 2-4 — @ritsuKai2000
105
+ - (#207) test: align verdict code fallback expectation — @ritsuKai2000
106
+
107
+ ### other
108
+ - (#192) [codex] address operator dashboard issue 188 feedback — @ritsuKai2000
109
+
110
+ ## Closed this week
111
+
112
+ - jinn-mono-uy6v.8 (SWE-rebench v2 eval loop — verdicts on non-gradeable evals)
113
+ - jinn-mono-uy6v.6 (DR — keep self-eval bypass on testnet)
114
+ - jinn-mono-uy6v.9 (Unscorable instances in dataset — quantified)
115
+ - jinn-mono-2cl.20.1 (Discovery-stack scope mismatch before release draft)
116
+
117
+ ## Stats
118
+
119
+ - Window: v0.1.4 → HEAD (2026-05-13)
120
+ - 14 commits · 72 files changed, 4444 insertions(+), 772 deletions(-) · 15 PRs · 1 contributor
121
+
122
+ ## Known issues
123
+
124
+ - jinn-mono-uy6v.7 (Live verdict-success + JINN reward distribution): in_progress. Verdict path is now structurally correct and emitting, but live observation of JINN reward distribution to operator wallets is still gating the v1 public-testnet ship (separate from this Build Notes cut).
125
+ - jinn-mono-uy6v.10 (Reputation-feedback hook): PR #190 makes the feedback hook fire on swe-rebench v2 verdicts; live on-chain registry update observation still pending closure.
126
+ - jinn-mono-uy6v.11 (Eval-image cache): PR #189 bounded the cache via in-process LRU; long-running operator disk validation still pending closure.
127
+
128
+ <!-- jinn-release-evidence:v1
129
+ release-tag=v0.1.5
130
+ release-commit=56e849525ebdbc8efc5a99a8255cead613ef7d80
131
+ release-client-prepare=passed
132
+ donation-consumption=passed
133
+ app-first-testnet-acceptance=passed
134
+ -->
135
+
5
136
  ## v0.1.4 — Shipping Machine
6
137
 
7
138
  _Released 2026-05-12_
@@ -4,6 +4,25 @@ import type { Task, RequestId, PostedTask, TaskAnnouncement, TaskRequest, TaskRe
4
4
  import { type MechAdapterConfig } from './types.js';
5
5
  import { VerdictCode } from './verdict-code.js';
6
6
  import type { Store } from '../../store/store.js';
7
+ /**
8
+ * Floor block for the on-chain TaskCreated backlog scan, per chain.
9
+ *
10
+ * A daemon with no joined-SolverNet store cursor (fresh bootstrap) will scan
11
+ * from this block forward. Existing operators with a persisted cursor are
12
+ * unaffected — their cursor is used as long as it's already past this floor.
13
+ *
14
+ * Base Sepolia (84532): 41_510_000 lands at 2026-05-14T19:51Z, ~2h after the
15
+ * fufn validated-pool was rebuilt to `EVAL_SEMANTICS_VERSION='3'` (2026-05-14
16
+ * T17:28Z). Everything created before that rebuild is a "ghost" — admitted
17
+ * under a prior semantics regime that the current evaluators can't score —
18
+ * so a fresh operator should not waste compute claiming them.
19
+ * See gh #300 for the proper fix (symmetric solver-side admission filter and
20
+ * generalised scan-age window).
21
+ *
22
+ * Base mainnet (8453): unchanged at 25_000_000 — Phase 0 era, no v3-rebuild
23
+ * equivalent on mainnet.
24
+ */
25
+ export declare const DEFAULT_TASK_DISCOVERY_FROM_BLOCK: Record<number, bigint>;
7
26
  export declare class MechAdapter implements ExecutionAdapter {
8
27
  readonly name = "mech";
9
28
  private publicClient;
@@ -32,6 +51,9 @@ export declare class MechAdapter implements ExecutionAdapter {
32
51
  private persistPendingEvaluationSolutions;
33
52
  private rememberPendingEvaluationSolution;
34
53
  private forgetPendingEvaluationSolution;
54
+ private clearPendingDeliveryRecoveryState;
55
+ private recoveryDeliveryExpirySeconds;
56
+ private shouldSkipExpiredRecoveryDelivery;
35
57
  postTask(state: Task): Promise<PostedTask>;
36
58
  private signTaskDocument;
37
59
  private contractPolicyForTask;
@@ -55,7 +77,7 @@ export declare class MechAdapter implements ExecutionAdapter {
55
77
  }>;
56
78
  submitSolutionDelivery(requestId: RequestId, solutionDigest: Hex): Promise<void>;
57
79
  submitVerdictDelivery(requestId: RequestId, verdictDigest: Hex, verdictCode: VerdictCode): Promise<void>;
58
- private evidenceHashForDelivery;
80
+ private deliveryClaimForDelivery;
59
81
  private ensureDeliveryClaimed;
60
82
  watchForDeliveries(): AsyncIterable<DeliveredResult>;
61
83
  stop(): Promise<void>;
@@ -6,19 +6,59 @@ import { PermanentError, parseTask } from '../../types/index.js';
6
6
  import { createClients } from './safe.js';
7
7
  import { buildResultPayload, uploadToIpfs, cidToDigestHex, fetchFromIpfs, fetchSignedTaskFromIpfs, fetchSignedEnvelopeFromIpfs, } from './ipfs.js';
8
8
  import { canonicalJson } from '../../harnesses/engine/canonical-json.js';
9
- import { SignedEnvelopeSchema } from '../../types/envelope.js';
9
+ import { normalizeEnvelopeRole, SignedEnvelopeSchema } from '../../types/envelope.js';
10
10
  import { submitTask, claimTask as claimTaskOnchain, claimEvaluation as claimEvaluationOnchain, claimDelivery, getMechDeliveryRate, getTimeoutBounds, decodeTaskCreatedLogs, decodeSolutionDeliveryClaimedLogs, decodeDeliverLogs, findLatestDeliveryDataHexForRequest, getMarketplaceRequestDeliveryMech, getTaskCidDigest, callDeliverToMarketplace, canClaimTask, canClaimEvaluation, } from './contracts.js';
11
+ import { isNonRecoverableInnerRevert } from './safe-revert.js';
12
+ import { verdictCodeFromValue } from './verdict-code.js';
11
13
  import { manifestDigestForCid } from './digest.js';
12
14
  import { withRecoverableRetry } from '../../tx-retry.js';
13
15
  import { formatRpcError } from '../../rpc-error-context.js';
14
- import { RESTORATION_ENVELOPE_CID_CONTEXT_KEY, RESTORATION_TASK_CID_CONTEXT_KEY, } from '../../harnesses/impls/evaluation-context.js';
16
+ import { SOLUTION_ENVELOPE_CID_CONTEXT_KEY, SOLUTION_TASK_CID_CONTEXT_KEY, RESTORATION_TASK_CID_CONTEXT_KEY, } from '../../harnesses/impls/evaluation-context.js';
15
17
  import { signTaskV1 } from '../../tasks/signing.js';
16
18
  const ROUTER_REQUEST_CURSOR_CONFIG_KEY = 'mech_router_request_block_cursor_v1';
17
19
  const PENDING_EVALUATION_SOLUTIONS_CONFIG_KEY = 'mech_pending_evaluation_solutions_v1';
18
20
  const DEFAULT_MECH_DELIVER_BACKFILL_LOOKBACK_BLOCKS = 100000n;
21
+ /** Yield to the event loop every N evaluation opportunities so a large retry
22
+ * backlog can't starve the HTTP API mid-cycle. */
23
+ const EVALUATION_RETRY_YIELD_EVERY = 10;
24
+ /**
25
+ * Decide whether a `canClaimEvaluation` failure reason means the opportunity
26
+ * can NEVER become claimable (terminal, prune it) versus one that could still
27
+ * clear later (transient, keep retrying).
28
+ *
29
+ * A false-keep (re-checking a dead opportunity) only costs one more RPC; a
30
+ * false-prune (dropping a still-claimable opportunity) loses real work — so
31
+ * when in doubt we keep. Anything that does not resolve to a known
32
+ * non-recoverable revert name is treated as transient.
33
+ */
34
+ function isTerminalEvaluationReason(reason) {
35
+ if (!reason)
36
+ return false;
37
+ // Strip a decoded-argument suffix, e.g. `TCAttemptAlreadyFinalized(1, 0)`.
38
+ const bareName = reason.replace(/\(.*$/s, '').trim();
39
+ return isNonRecoverableInnerRevert(bareName);
40
+ }
19
41
  const DEFAULT_ROUTER_LOG_CHUNK_BLOCKS = 9999n;
20
- const DEFAULT_TASK_DISCOVERY_FROM_BLOCK = {
21
- 84532: 41153291n,
42
+ /**
43
+ * Floor block for the on-chain TaskCreated backlog scan, per chain.
44
+ *
45
+ * A daemon with no joined-SolverNet store cursor (fresh bootstrap) will scan
46
+ * from this block forward. Existing operators with a persisted cursor are
47
+ * unaffected — their cursor is used as long as it's already past this floor.
48
+ *
49
+ * Base Sepolia (84532): 41_510_000 lands at 2026-05-14T19:51Z, ~2h after the
50
+ * fufn validated-pool was rebuilt to `EVAL_SEMANTICS_VERSION='3'` (2026-05-14
51
+ * T17:28Z). Everything created before that rebuild is a "ghost" — admitted
52
+ * under a prior semantics regime that the current evaluators can't score —
53
+ * so a fresh operator should not waste compute claiming them.
54
+ * See gh #300 for the proper fix (symmetric solver-side admission filter and
55
+ * generalised scan-age window).
56
+ *
57
+ * Base mainnet (8453): unchanged at 25_000_000 — Phase 0 era, no v3-rebuild
58
+ * equivalent on mainnet.
59
+ */
60
+ export const DEFAULT_TASK_DISCOVERY_FROM_BLOCK = {
61
+ 84532: 41510000n,
22
62
  8453: 25000000n,
23
63
  };
24
64
  const DEFAULT_MECH_CLAIM_POLICY = {
@@ -218,6 +258,35 @@ export class MechAdapter {
218
258
  return;
219
259
  this.persistPendingEvaluationSolutions();
220
260
  }
261
+ clearPendingDeliveryRecoveryState(requestId) {
262
+ this.originalStates.delete(requestId);
263
+ this.pendingEvaluations.delete(requestId);
264
+ this.requestKinds.delete(requestId);
265
+ }
266
+ recoveryDeliveryExpirySeconds(requestId) {
267
+ const task = this.originalStates.get(requestId) ?? this.pendingEvaluations.get(requestId);
268
+ const claimPolicy = task?.claimPolicy ?? DEFAULT_MECH_CLAIM_POLICY;
269
+ const normalizeTsToSeconds = (value) => {
270
+ if (value == null)
271
+ return undefined;
272
+ return value > 10_000_000_000 ? Math.floor(value / 1000) : value;
273
+ };
274
+ const submissionDeadlineSeconds = normalizeTsToSeconds(claimPolicy.submissionDeadlineTs);
275
+ if (submissionDeadlineSeconds != null)
276
+ return submissionDeadlineSeconds;
277
+ const claimWindowEndSeconds = normalizeTsToSeconds(claimPolicy.claimWindowEndTs ?? task?.window?.endTs);
278
+ if (claimWindowEndSeconds == null)
279
+ return undefined;
280
+ return claimWindowEndSeconds + claimPolicy.claimLeaseTtlSeconds;
281
+ }
282
+ shouldSkipExpiredRecoveryDelivery(requestId, currentChainTimestampSeconds, recoveryExpirySeconds) {
283
+ if (currentChainTimestampSeconds <= recoveryExpirySeconds)
284
+ return false;
285
+ console.error(`[mech] skipping recovery delivery for ${requestId}: ` +
286
+ `submission deadline expired at ${new Date(recoveryExpirySeconds * 1000).toISOString()}`);
287
+ this.clearPendingDeliveryRecoveryState(requestId);
288
+ return true;
289
+ }
221
290
  async postTask(state) {
222
291
  const restorationState = {
223
292
  ...state,
@@ -251,7 +320,7 @@ export class MechAdapter {
251
320
  task: {
252
321
  ...restorationState,
253
322
  signedTask,
254
- context: { ...(restorationState.context ?? {}), [RESTORATION_TASK_CID_CONTEXT_KEY]: restorationTaskCid },
323
+ context: { ...(restorationState.context ?? {}), [SOLUTION_TASK_CID_CONTEXT_KEY]: restorationTaskCid },
255
324
  },
256
325
  taskCid: restorationTaskCid,
257
326
  onchainCreationTx: taskSubmission.txHash,
@@ -357,8 +426,8 @@ export class MechAdapter {
357
426
  context: {
358
427
  ...(params.task.context ?? {}),
359
428
  restorationResult: params.resultData,
360
- [RESTORATION_TASK_CID_CONTEXT_KEY]: params.task.context?.[RESTORATION_TASK_CID_CONTEXT_KEY] ?? params.taskCid,
361
- [RESTORATION_ENVELOPE_CID_CONTEXT_KEY]: params.restorationEnvelopeCid,
429
+ [SOLUTION_TASK_CID_CONTEXT_KEY]: params.task.context?.[SOLUTION_TASK_CID_CONTEXT_KEY] ?? params.task.context?.[RESTORATION_TASK_CID_CONTEXT_KEY] ?? params.taskCid,
430
+ [SOLUTION_ENVELOPE_CID_CONTEXT_KEY]: params.solutionEnvelopeCid,
362
431
  },
363
432
  };
364
433
  }
@@ -418,11 +487,25 @@ export class MechAdapter {
418
487
  console.error('[mech] task discovery (DiscoveryAPI) failed:', err instanceof Error ? err.message : err);
419
488
  return;
420
489
  }
490
+ const discoveryFloorBlock = this.onchainTaskDiscoveryFromBlock();
421
491
  for (const candidate of candidates) {
422
492
  if (!this.isDiscoveryTaskAllowed(candidate.taskId))
423
493
  continue;
424
494
  if (this.claimedRestorationTaskIds.has(candidate.taskId))
425
495
  continue;
496
+ // gh #300 ghost-task floor — same floor as the on-chain TaskCreated
497
+ // backlog scan, applied to the DiscoveryAPI path too. Without this,
498
+ // the Ponder indexer (or onchain floor's listClaimableTasks) returns
499
+ // pre-floor tasks that are still claimable on-chain but unscorable
500
+ // under the current admission regime, defeating the floor's
501
+ // intent. Candidates without `createdAtBlock` are passed through
502
+ // (DiscoveryAPI is allowed to omit that field; we can't filter
503
+ // without it).
504
+ if (discoveryFloorBlock != null &&
505
+ candidate.createdAtBlock != null &&
506
+ BigInt(candidate.createdAtBlock) < discoveryFloorBlock) {
507
+ continue;
508
+ }
426
509
  // Verify claimability per backend: HttpSubgraphDiscoveryAPI cannot run
427
510
  // canClaimTask (no on-chain simulation), so this check is load-bearing
428
511
  // for that path. OnchainDiscoveryAPI already filters internally; this
@@ -468,22 +551,32 @@ export class MechAdapter {
468
551
  this.forgetPendingEvaluationSolution(solution.requestId);
469
552
  return undefined;
470
553
  }
471
- const restoration = await this.restorationAnnouncementForTaskId(solution.taskId);
554
+ // Cheap claimability gate FIRST — before the restoration lookup + IPFS
555
+ // fetch. A backlog of terminal opportunities (finalized / evaluation
556
+ // deadline passed / max verdicts reached) must not pay the expensive
557
+ // restoration-announcement cost on every poll cycle. Terminal reasons are
558
+ // pruned from the working set so the loop never re-scans on-chain history;
559
+ // transient reasons are left in place to be retried next cycle.
472
560
  const claimable = await canClaimEvaluation(this.publicClient, this.config.safeAddress, this.config.routerAddress, solution.taskId, solution.attemptIndex, this.config.mechContractAddress);
473
561
  if (!claimable.ok) {
474
- console.log(`[mech] skipping evaluation opportunity ${solution.requestId} for task ${solution.taskId}/${solution.attemptIndex}: ${claimable.reason}`);
475
- this.forgetPendingEvaluationSolution(solution.requestId);
562
+ const terminal = isTerminalEvaluationReason(claimable.reason);
563
+ console.log(`[mech] skipping evaluation opportunity ${solution.requestId} for task ${solution.taskId}/${solution.attemptIndex}: ${claimable.reason}` +
564
+ (terminal ? ' (terminal — pruned)' : ' (transient — will retry)'));
565
+ if (terminal) {
566
+ this.forgetPendingEvaluationSolution(solution.requestId);
567
+ }
476
568
  return undefined;
477
569
  }
478
- const restorationEnvelopeCid = await this.deliveryEnvelopeCidForSolution(solution);
479
- const resultPayload = await fetchFromIpfs(this.config.ipfsGatewayUrl, restorationEnvelopeCid);
570
+ const restoration = await this.restorationAnnouncementForTaskId(solution.taskId);
571
+ const solutionEnvelopeCid = await this.deliveryEnvelopeCidForSolution(solution);
572
+ const resultPayload = await fetchFromIpfs(this.config.ipfsGatewayUrl, solutionEnvelopeCid);
480
573
  const resultData = resultPayload.data ?? JSON.stringify(resultPayload);
481
574
  const evaluationTask = this.buildEvaluationTask({
482
575
  task: restoration.task,
483
576
  solutionRequestId: solution.requestId,
484
577
  attemptIndex: solution.attemptIndex,
485
578
  resultData,
486
- restorationEnvelopeCid,
579
+ solutionEnvelopeCid,
487
580
  taskCid: restoration.taskCid,
488
581
  });
489
582
  const opportunityId = `evaluation:${solution.taskId}:${solution.attemptIndex}:${solution.requestId}`;
@@ -503,15 +596,21 @@ export class MechAdapter {
503
596
  return announcement;
504
597
  }
505
598
  async *retryPendingEvaluationSolutions() {
599
+ let processed = 0;
506
600
  for (const [requestId, solution] of Array.from(this.pendingEvaluationSolutions)) {
601
+ // Yield to the event loop periodically so a large backlog of pending
602
+ // evaluation solutions can't starve the HTTP API mid-cycle.
603
+ if (processed > 0 && processed % EVALUATION_RETRY_YIELD_EVERY === 0) {
604
+ await new Promise((resolve) => setImmediate(resolve));
605
+ }
606
+ processed++;
507
607
  try {
508
608
  const announcement = await this.evaluationAnnouncementForSolution(solution);
509
609
  if (announcement) {
510
610
  yield announcement;
511
611
  }
512
- else {
513
- this.forgetPendingEvaluationSolution(requestId);
514
- }
612
+ // No announcement does NOT mean "forget" — pruning is owned by
613
+ // evaluationAnnouncementForSolution, which only removes terminal cases.
515
614
  }
516
615
  catch (err) {
517
616
  console.error(`[mech] evaluation opportunity retry failed for ${requestId}:`, err);
@@ -644,9 +743,13 @@ export class MechAdapter {
644
743
  async submitVerdictDelivery(requestId, verdictDigest, verdictCode) {
645
744
  await claimDelivery(this.publicClient, this.walletClient, this.config.safeAddress, this.config.routerAddress, requestId, { variant: 'v3', kind: 'verdict', evidenceHash: verdictDigest, verdictCode }, this.config.evictionRecovery);
646
745
  }
647
- async evidenceHashForDelivery(requestId, deliveryDataHex) {
746
+ async deliveryClaimForDelivery(requestId, deliveryDataHex) {
747
+ const fallbackKind = this.requestKinds.get(requestId) ?? 'solution';
648
748
  if (this.config.routerClaimDeliveryVariant !== 'v2' && this.config.routerClaimDeliveryVariant !== 'v3') {
649
- return undefined;
749
+ return {
750
+ evidenceHash: undefined,
751
+ kind: fallbackKind,
752
+ };
650
753
  }
651
754
  const deliveryDigest = deliveryDataHex.startsWith('0x')
652
755
  ? deliveryDataHex.slice(2)
@@ -654,11 +757,6 @@ export class MechAdapter {
654
757
  const envelopeCid = `f01551220${deliveryDigest}`;
655
758
  const rawEnvelope = await fetchSignedEnvelopeFromIpfs(this.config.ipfsGatewayUrl, envelopeCid);
656
759
  const parsed = SignedEnvelopeSchema.parse(rawEnvelope);
657
- // Strip signature to recompute the hash over the unsigned body.
658
- //
659
- // Important: compute over the fetched wire object, not over the parsed
660
- // schema result. The schema normalizes some nested objects and may strip
661
- // extension metadata that was present when the envelope was signed.
662
760
  const rawSigned = rawEnvelope;
663
761
  const { signature: _rawSignature, ...unsignedBody } = rawSigned;
664
762
  const signature = parsed.signature;
@@ -667,22 +765,36 @@ export class MechAdapter {
667
765
  if (recomputed !== signature.hash) {
668
766
  throw new Error(`recomputed hash ${recomputed} !== envelope.signature.hash ${signature.hash}`);
669
767
  }
670
- return recomputed;
768
+ const role = normalizeEnvelopeRole(parsed.role);
769
+ if (role === 'capture') {
770
+ throw new Error(`unsupported delivery envelope role=capture for requestId ${requestId}`);
771
+ }
772
+ const kind = role === 'verdict' ? 'verdict' : 'solution';
773
+ const payload = rawSigned['payload'];
774
+ const rawVerdict = payload != null && typeof payload === 'object'
775
+ ? payload['verdict']
776
+ : undefined;
777
+ return {
778
+ evidenceHash: recomputed,
779
+ kind,
780
+ verdictCode: kind === 'verdict' ? verdictCodeFromValue(rawVerdict) : undefined,
781
+ };
671
782
  }
672
783
  async ensureDeliveryClaimed(requestId, deliveryDataHex) {
673
- let evidenceHash;
784
+ let claimOptions;
674
785
  try {
675
- evidenceHash = await this.evidenceHashForDelivery(requestId, deliveryDataHex);
786
+ claimOptions = await this.deliveryClaimForDelivery(requestId, deliveryDataHex);
676
787
  }
677
788
  catch (err) {
678
- console.error(`[mech] evidenceHash derivation failed for ${requestId} — skipping claim, will retry on next loop:`, err);
789
+ console.error(`[mech] delivery claim metadata derivation failed for ${requestId} — skipping claim, will retry on next loop:`, err);
679
790
  return 'retry';
680
791
  }
681
792
  try {
682
793
  await claimDelivery(this.publicClient, this.walletClient, this.config.safeAddress, this.config.routerAddress, requestId, {
683
794
  variant: this.config.routerClaimDeliveryVariant,
684
- kind: this.requestKinds.get(requestId) ?? 'solution',
685
- evidenceHash,
795
+ kind: claimOptions.kind,
796
+ evidenceHash: claimOptions.evidenceHash,
797
+ verdictCode: claimOptions.verdictCode,
686
798
  }, this.config.evictionRecovery);
687
799
  return 'claimed';
688
800
  }
@@ -711,7 +823,9 @@ export class MechAdapter {
711
823
  });
712
824
  this.deliveryBlockCursor = currentBlock;
713
825
  const decoded = decodeDeliverLogs(logs);
714
- for (const { requestId, deliveryDataHex, mechAddress } of decoded) {
826
+ const blockTimestampSecondsByNumber = new Map();
827
+ let currentBlockTimestampSeconds;
828
+ for (const { requestId, deliveryDataHex, mechAddress, blockNumber } of decoded) {
715
829
  // Two concerns, independent:
716
830
  // (a) Did this Safe DELIVER this? → claim it (counter credit goes to msg.sender)
717
831
  // The Deliver event's mechAddress is mechServiceMultisig (the Safe that owns
@@ -721,6 +835,30 @@ export class MechAdapter {
721
835
  const iCreatedRestoration = this.pendingEvaluations.has(requestId);
722
836
  if (!iDelivered && !iCreatedRestoration)
723
837
  continue;
838
+ if (iCreatedRestoration) {
839
+ const recoveryExpirySeconds = this.recoveryDeliveryExpirySeconds(requestId);
840
+ if (recoveryExpirySeconds != null) {
841
+ let deliveryTimestampSeconds;
842
+ if (blockNumber != null) {
843
+ deliveryTimestampSeconds = blockTimestampSecondsByNumber.get(blockNumber);
844
+ if (deliveryTimestampSeconds == null) {
845
+ const deliveryBlockData = await this.publicClient.getBlock({ blockNumber });
846
+ deliveryTimestampSeconds = Number(deliveryBlockData.timestamp);
847
+ blockTimestampSecondsByNumber.set(blockNumber, deliveryTimestampSeconds);
848
+ }
849
+ }
850
+ else {
851
+ if (currentBlockTimestampSeconds == null) {
852
+ const currentBlockData = await this.publicClient.getBlock({ blockNumber: currentBlock });
853
+ currentBlockTimestampSeconds = Number(currentBlockData.timestamp);
854
+ }
855
+ deliveryTimestampSeconds = currentBlockTimestampSeconds;
856
+ }
857
+ if (this.shouldSkipExpiredRecoveryDelivery(requestId, deliveryTimestampSeconds, recoveryExpirySeconds)) {
858
+ continue;
859
+ }
860
+ }
861
+ }
724
862
  // (a) Deliverer-side claim path: if this Safe delivered the request,
725
863
  // claim it first so router counters credit the deliverer.
726
864
  let deliveryClaimStatus;
@@ -756,9 +894,7 @@ export class MechAdapter {
756
894
  deliveryMechAddress: mechAddress,
757
895
  };
758
896
  // Clean up after yielding
759
- this.originalStates.delete(requestId);
760
- this.pendingEvaluations.delete(requestId);
761
- this.requestKinds.delete(requestId);
897
+ this.clearPendingDeliveryRecoveryState(requestId);
762
898
  }
763
899
  catch (err) {
764
900
  console.error(`[mech] Failed to parse delivery ${requestId}:`, err);