@jinn-network/client 0.1.2 → 0.1.3-canary.12cf8b76

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 (1266) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/CONTRIBUTING.md +8 -2
  3. package/README.md +67 -47
  4. package/deployments/deployment-jinn-mvi-l1-sepolia-fast.json +36 -0
  5. package/deployments/deployment-jinn-mvi-l1-sepolia.json +36 -0
  6. package/deployments/deployment-jinn-mvi-l2-baseSepolia.json +12 -0
  7. package/deployments/deployment-phase1b-mech-baseSepolia-fast.json +3 -3
  8. package/deployments/deployment-stolas-l2-baseSepolia-fast.json +1 -1
  9. package/deployments/deployment-task-coordinator-router-v3-baseSepolia-fast.json +38 -0
  10. package/dist/adapters/adapter.d.ts +19 -8
  11. package/dist/adapters/local/adapter.d.ts +10 -9
  12. package/dist/adapters/local/adapter.js +52 -79
  13. package/dist/adapters/local/adapter.js.map +1 -1
  14. package/dist/adapters/mech/adapter.d.ts +33 -15
  15. package/dist/adapters/mech/adapter.js +471 -353
  16. package/dist/adapters/mech/adapter.js.map +1 -1
  17. package/dist/adapters/mech/contracts.d.ts +68 -20
  18. package/dist/adapters/mech/contracts.js +338 -100
  19. package/dist/adapters/mech/contracts.js.map +1 -1
  20. package/dist/adapters/mech/ipfs.d.ts +66 -12
  21. package/dist/adapters/mech/ipfs.js +165 -30
  22. package/dist/adapters/mech/ipfs.js.map +1 -1
  23. package/dist/adapters/mech/safe-revert.d.ts +39 -0
  24. package/dist/adapters/mech/safe-revert.js +124 -0
  25. package/dist/adapters/mech/safe-revert.js.map +1 -0
  26. package/dist/adapters/mech/safe.js +48 -22
  27. package/dist/adapters/mech/safe.js.map +1 -1
  28. package/dist/adapters/mech/types.d.ts +245 -84
  29. package/dist/adapters/mech/types.js +125 -50
  30. package/dist/adapters/mech/types.js.map +1 -1
  31. package/dist/agent/agent-ws.d.ts +57 -0
  32. package/dist/agent/agent-ws.js +301 -0
  33. package/dist/agent/agent-ws.js.map +1 -0
  34. package/dist/agent/auto-mode-detect.d.ts +6 -0
  35. package/dist/agent/auto-mode-detect.js +44 -0
  36. package/dist/agent/auto-mode-detect.js.map +1 -0
  37. package/dist/agent/operator-claude.d.ts +22 -0
  38. package/dist/agent/operator-claude.js +134 -0
  39. package/dist/agent/operator-claude.js.map +1 -0
  40. package/dist/api/admin-endpoint.d.ts +12 -0
  41. package/dist/api/admin-endpoint.js +71 -0
  42. package/dist/api/admin-endpoint.js.map +1 -0
  43. package/dist/api/agent-binding-endpoint.d.ts +26 -0
  44. package/dist/api/agent-binding-endpoint.js +28 -0
  45. package/dist/api/agent-binding-endpoint.js.map +1 -0
  46. package/dist/api/bootstrap-endpoint.d.ts +24 -0
  47. package/dist/api/bootstrap-endpoint.js +103 -0
  48. package/dist/api/bootstrap-endpoint.js.map +1 -0
  49. package/dist/api/events-endpoint.d.ts +9 -0
  50. package/dist/api/events-endpoint.js +46 -0
  51. package/dist/api/events-endpoint.js.map +1 -0
  52. package/dist/api/fleet-build.d.ts +1 -1
  53. package/dist/api/fleet-build.js +17 -8
  54. package/dist/api/fleet-build.js.map +1 -1
  55. package/dist/api/gather-status.d.ts +16 -1
  56. package/dist/api/gather-status.js +163 -3
  57. package/dist/api/gather-status.js.map +1 -1
  58. package/dist/api/handshake.d.ts +17 -0
  59. package/dist/api/handshake.js +28 -0
  60. package/dist/api/handshake.js.map +1 -0
  61. package/dist/api/harness-status-endpoint.d.ts +20 -0
  62. package/dist/api/harness-status-endpoint.js +13 -0
  63. package/dist/api/harness-status-endpoint.js.map +1 -0
  64. package/dist/api/history-build.d.ts +2 -2
  65. package/dist/api/history-build.js +3 -3
  66. package/dist/api/history-build.js.map +1 -1
  67. package/dist/api/launcher-endpoints.d.ts +43 -0
  68. package/dist/api/launcher-endpoints.js +50 -0
  69. package/dist/api/launcher-endpoints.js.map +1 -0
  70. package/dist/api/launcher-status.d.ts +92 -0
  71. package/dist/api/launcher-status.js +82 -0
  72. package/dist/api/launcher-status.js.map +1 -0
  73. package/dist/api/launcher-tasks.d.ts +104 -0
  74. package/dist/api/launcher-tasks.js +83 -0
  75. package/dist/api/launcher-tasks.js.map +1 -0
  76. package/dist/api/leaderboard-api.d.ts +20 -0
  77. package/dist/api/leaderboard-api.js +18 -0
  78. package/dist/api/leaderboard-api.js.map +1 -0
  79. package/dist/api/peers.js +21 -6
  80. package/dist/api/peers.js.map +1 -1
  81. package/dist/api/portfolio-v0-build.d.ts +16 -10
  82. package/dist/api/portfolio-v0-build.js +36 -31
  83. package/dist/api/portfolio-v0-build.js.map +1 -1
  84. package/dist/api/portfolio-v0-doctor.js +1 -1
  85. package/dist/api/portfolio-v0-doctor.js.map +1 -1
  86. package/dist/api/prediction-v1-build.d.ts +65 -0
  87. package/dist/api/prediction-v1-build.js +73 -0
  88. package/dist/api/prediction-v1-build.js.map +1 -0
  89. package/dist/api/rewards-build.js +3 -8
  90. package/dist/api/rewards-build.js.map +1 -1
  91. package/dist/api/server.d.ts +97 -1
  92. package/dist/api/server.js +334 -16
  93. package/dist/api/server.js.map +1 -1
  94. package/dist/api/setup-endpoints.d.ts +62 -0
  95. package/dist/api/setup-endpoints.js +705 -0
  96. package/dist/api/setup-endpoints.js.map +1 -0
  97. package/dist/api/solvernets-catalog-build.d.ts +37 -0
  98. package/dist/api/solvernets-catalog-build.js +19 -0
  99. package/dist/api/solvernets-catalog-build.js.map +1 -0
  100. package/dist/api/solvernets-endpoint.d.ts +15 -0
  101. package/dist/api/solvernets-endpoint.js +5 -0
  102. package/dist/api/solvernets-endpoint.js.map +1 -0
  103. package/dist/api/solvernets-endpoints.d.ts +104 -0
  104. package/dist/api/solvernets-endpoints.js +1023 -0
  105. package/dist/api/solvernets-endpoints.js.map +1 -0
  106. package/dist/api/status-build.d.ts +15 -2
  107. package/dist/api/status-build.js +45 -9
  108. package/dist/api/status-build.js.map +1 -1
  109. package/dist/api/status-rollup-build.d.ts +46 -1
  110. package/dist/api/status-rollup-build.js +168 -5
  111. package/dist/api/status-rollup-build.js.map +1 -1
  112. package/dist/api/ui-token.d.ts +5 -0
  113. package/dist/api/ui-token.js +36 -0
  114. package/dist/api/ui-token.js.map +1 -0
  115. package/dist/build-info.d.ts +32 -0
  116. package/dist/build-info.js +69 -0
  117. package/dist/build-info.js.map +1 -0
  118. package/dist/build-info.json +6 -0
  119. package/dist/build-meta.json +1 -1
  120. package/dist/cli/command.d.ts +9 -0
  121. package/dist/cli/commands/auth.js +6 -3
  122. package/dist/cli/commands/auth.js.map +1 -1
  123. package/dist/cli/commands/balance.d.ts +7 -0
  124. package/dist/cli/commands/balance.js +38 -32
  125. package/dist/cli/commands/balance.js.map +1 -1
  126. package/dist/cli/commands/bootstrap.d.ts +13 -1
  127. package/dist/cli/commands/bootstrap.js +150 -133
  128. package/dist/cli/commands/bootstrap.js.map +1 -1
  129. package/dist/cli/commands/checkpoint.d.ts +85 -0
  130. package/dist/cli/commands/checkpoint.js +75 -0
  131. package/dist/cli/commands/checkpoint.js.map +1 -0
  132. package/dist/cli/commands/claim-rewards.js +14 -2
  133. package/dist/cli/commands/claim-rewards.js.map +1 -1
  134. package/dist/cli/commands/conformance.d.ts +12 -0
  135. package/dist/cli/commands/conformance.js +140 -0
  136. package/dist/cli/commands/conformance.js.map +1 -0
  137. package/dist/cli/commands/create.d.ts +22 -0
  138. package/dist/cli/commands/create.js +226 -0
  139. package/dist/cli/commands/create.js.map +1 -0
  140. package/dist/cli/commands/doctor.d.ts +49 -1
  141. package/dist/cli/commands/doctor.js +162 -134
  142. package/dist/cli/commands/doctor.js.map +1 -1
  143. package/dist/cli/commands/fleet-scale.d.ts +19 -1
  144. package/dist/cli/commands/fleet-scale.js +378 -361
  145. package/dist/cli/commands/fleet-scale.js.map +1 -1
  146. package/dist/cli/commands/fleet.d.ts +7 -0
  147. package/dist/cli/commands/fleet.js +39 -33
  148. package/dist/cli/commands/fleet.js.map +1 -1
  149. package/dist/cli/commands/fund-requirements.d.ts +14 -1
  150. package/dist/cli/commands/fund-requirements.js +182 -174
  151. package/dist/cli/commands/fund-requirements.js.map +1 -1
  152. package/dist/cli/commands/harnesses.d.ts +38 -0
  153. package/dist/cli/commands/harnesses.js +305 -0
  154. package/dist/cli/commands/harnesses.js.map +1 -0
  155. package/dist/cli/commands/history.d.ts +10 -1
  156. package/dist/cli/commands/history.js +68 -59
  157. package/dist/cli/commands/history.js.map +1 -1
  158. package/dist/cli/commands/init.js +4 -1
  159. package/dist/cli/commands/init.js.map +1 -1
  160. package/dist/cli/commands/integrations.d.ts +13 -0
  161. package/dist/cli/commands/integrations.js +1010 -0
  162. package/dist/cli/commands/integrations.js.map +1 -0
  163. package/dist/cli/commands/logs.d.ts +6 -1
  164. package/dist/cli/commands/logs.js +77 -70
  165. package/dist/cli/commands/logs.js.map +1 -1
  166. package/dist/cli/commands/migrate-agent-id.d.ts +26 -0
  167. package/dist/cli/commands/migrate-agent-id.js +164 -0
  168. package/dist/cli/commands/migrate-agent-id.js.map +1 -0
  169. package/dist/cli/commands/prediction-scoreboard.d.ts +10 -0
  170. package/dist/cli/commands/prediction-scoreboard.js +136 -0
  171. package/dist/cli/commands/prediction-scoreboard.js.map +1 -0
  172. package/dist/cli/commands/quickstart.d.ts +51 -1
  173. package/dist/cli/commands/quickstart.js +514 -296
  174. package/dist/cli/commands/quickstart.js.map +1 -1
  175. package/dist/cli/commands/rewards.d.ts +7 -0
  176. package/dist/cli/commands/rewards.js +46 -40
  177. package/dist/cli/commands/rewards.js.map +1 -1
  178. package/dist/cli/commands/run.d.ts +14 -1
  179. package/dist/cli/commands/run.js +243 -91
  180. package/dist/cli/commands/run.js.map +1 -1
  181. package/dist/cli/commands/solver-nets.js +229 -0
  182. package/dist/cli/commands/solver-nets.js.map +1 -0
  183. package/dist/cli/commands/solver-plugins.d.ts +9 -0
  184. package/dist/cli/commands/solver-plugins.js +186 -0
  185. package/dist/cli/commands/solver-plugins.js.map +1 -0
  186. package/dist/cli/commands/status.d.ts +13 -0
  187. package/dist/cli/commands/status.js +105 -34
  188. package/dist/cli/commands/status.js.map +1 -1
  189. package/dist/cli/commands/tasks.js +405 -0
  190. package/dist/cli/commands/tasks.js.map +1 -0
  191. package/dist/cli/commands/ui.d.ts +3 -0
  192. package/dist/cli/commands/ui.js +45 -0
  193. package/dist/cli/commands/ui.js.map +1 -0
  194. package/dist/cli/commands/update.d.ts +12 -0
  195. package/dist/cli/commands/update.js +321 -91
  196. package/dist/cli/commands/update.js.map +1 -1
  197. package/dist/cli/commands/version.js +3 -2
  198. package/dist/cli/commands/version.js.map +1 -1
  199. package/dist/cli/commands/withdraw.d.ts +21 -1
  200. package/dist/cli/commands/withdraw.js +175 -159
  201. package/dist/cli/commands/withdraw.js.map +1 -1
  202. package/dist/cli/deployment-digest.js +0 -5
  203. package/dist/cli/deployment-digest.js.map +1 -1
  204. package/dist/cli/execution-context.d.ts +1 -1
  205. package/dist/cli/execution-context.js +4 -4
  206. package/dist/cli/execution-context.js.map +1 -1
  207. package/dist/cli/help.js +8 -1
  208. package/dist/cli/help.js.map +1 -1
  209. package/dist/cli/index.d.ts +7 -0
  210. package/dist/cli/index.js +26 -6
  211. package/dist/cli/index.js.map +1 -1
  212. package/dist/cli/introspection-context.js +0 -1
  213. package/dist/cli/introspection-context.js.map +1 -1
  214. package/dist/cli/open-browser.d.ts +1 -0
  215. package/dist/cli/open-browser.js +18 -0
  216. package/dist/cli/open-browser.js.map +1 -0
  217. package/dist/cli/password.d.ts +3 -3
  218. package/dist/cli/password.js +6 -6
  219. package/dist/cli/password.js.map +1 -1
  220. package/dist/cli/task-native-readiness.d.ts +27 -0
  221. package/dist/cli/task-native-readiness.js +170 -0
  222. package/dist/cli/task-native-readiness.js.map +1 -0
  223. package/dist/config.d.ts +1771 -57
  224. package/dist/config.js +527 -31
  225. package/dist/config.js.map +1 -1
  226. package/dist/conformance/checks/artifacts.d.ts +37 -0
  227. package/dist/conformance/checks/artifacts.js +110 -0
  228. package/dist/conformance/checks/artifacts.js.map +1 -0
  229. package/dist/conformance/checks/envelope-schema.d.ts +17 -0
  230. package/dist/conformance/checks/envelope-schema.js +36 -0
  231. package/dist/conformance/checks/envelope-schema.js.map +1 -0
  232. package/dist/conformance/checks/hash-signature.d.ts +26 -0
  233. package/dist/conformance/checks/hash-signature.js +70 -0
  234. package/dist/conformance/checks/hash-signature.js.map +1 -0
  235. package/dist/conformance/checks/payload.d.ts +19 -0
  236. package/dist/conformance/checks/payload.js +52 -0
  237. package/dist/conformance/checks/payload.js.map +1 -0
  238. package/dist/conformance/checks/secret-scrub.d.ts +33 -0
  239. package/dist/conformance/checks/secret-scrub.js +118 -0
  240. package/dist/conformance/checks/secret-scrub.js.map +1 -0
  241. package/dist/conformance/checks/source-runtime.d.ts +43 -0
  242. package/dist/conformance/checks/source-runtime.js +68 -0
  243. package/dist/conformance/checks/source-runtime.js.map +1 -0
  244. package/dist/conformance/checks/source-static.d.ts +61 -0
  245. package/dist/conformance/checks/source-static.js +311 -0
  246. package/dist/conformance/checks/source-static.js.map +1 -0
  247. package/dist/conformance/checks/trajectory-chain.d.ts +18 -0
  248. package/dist/conformance/checks/trajectory-chain.js +51 -0
  249. package/dist/conformance/checks/trajectory-chain.js.map +1 -0
  250. package/dist/conformance/checks/trajectory-profile.d.ts +17 -0
  251. package/dist/conformance/checks/trajectory-profile.js +51 -0
  252. package/dist/conformance/checks/trajectory-profile.js.map +1 -0
  253. package/dist/conformance/checks/trajectory-schema.d.ts +20 -0
  254. package/dist/conformance/checks/trajectory-schema.js +40 -0
  255. package/dist/conformance/checks/trajectory-schema.js.map +1 -0
  256. package/dist/conformance/checks/verdict.d.ts +44 -0
  257. package/dist/conformance/checks/verdict.js +122 -0
  258. package/dist/conformance/checks/verdict.js.map +1 -0
  259. package/dist/conformance/harness.d.ts +32 -0
  260. package/dist/conformance/harness.js +227 -0
  261. package/dist/conformance/harness.js.map +1 -0
  262. package/dist/conformance/types.d.ts +88 -0
  263. package/dist/conformance/types.js +31 -0
  264. package/dist/conformance/types.js.map +1 -0
  265. package/dist/corpus/acquire.d.ts +37 -0
  266. package/dist/corpus/acquire.js +155 -0
  267. package/dist/corpus/acquire.js.map +1 -0
  268. package/dist/corpus/cache.d.ts +14 -0
  269. package/dist/corpus/cache.js +18 -0
  270. package/dist/corpus/cache.js.map +1 -0
  271. package/dist/corpus/envelope-projection.d.ts +12 -0
  272. package/dist/corpus/envelope-projection.js +110 -0
  273. package/dist/corpus/envelope-projection.js.map +1 -0
  274. package/dist/corpus/fetch.d.ts +9 -0
  275. package/dist/corpus/fetch.js +24 -0
  276. package/dist/corpus/fetch.js.map +1 -0
  277. package/dist/corpus/index.d.ts +19 -0
  278. package/dist/corpus/index.js +81 -0
  279. package/dist/corpus/index.js.map +1 -0
  280. package/dist/corpus/prediction-brier-scoreboard-report.d.ts +17 -0
  281. package/dist/corpus/prediction-brier-scoreboard-report.js +148 -0
  282. package/dist/corpus/prediction-brier-scoreboard-report.js.map +1 -0
  283. package/dist/corpus/prediction-brier-scoreboard.d.ts +56 -0
  284. package/dist/corpus/prediction-brier-scoreboard.js +269 -0
  285. package/dist/corpus/prediction-brier-scoreboard.js.map +1 -0
  286. package/dist/corpus/prediction-scoreable-verdicts.d.ts +4 -0
  287. package/dist/corpus/prediction-scoreable-verdicts.js +23 -0
  288. package/dist/corpus/prediction-scoreable-verdicts.js.map +1 -0
  289. package/dist/corpus/query.d.ts +17 -0
  290. package/dist/corpus/query.js +108 -0
  291. package/dist/corpus/query.js.map +1 -0
  292. package/dist/corpus/route-resolver.d.ts +16 -0
  293. package/dist/corpus/route-resolver.js +20 -0
  294. package/dist/corpus/route-resolver.js.map +1 -0
  295. package/dist/corpus/types.d.ts +150 -0
  296. package/dist/corpus/types.js +50 -0
  297. package/dist/corpus/types.js.map +1 -0
  298. package/dist/daemon/balance-topup-loop.js +2 -1
  299. package/dist/daemon/balance-topup-loop.js.map +1 -1
  300. package/dist/daemon/creator.d.ts +7 -7
  301. package/dist/daemon/creator.js +11 -14
  302. package/dist/daemon/creator.js.map +1 -1
  303. package/dist/daemon/daemon.d.ts +83 -31
  304. package/dist/daemon/daemon.js +206 -67
  305. package/dist/daemon/daemon.js.map +1 -1
  306. package/dist/daemon/delivery-watcher.js +50 -4
  307. package/dist/daemon/delivery-watcher.js.map +1 -1
  308. package/dist/daemon/freeze-fence.d.ts +42 -0
  309. package/dist/daemon/freeze-fence.js +71 -0
  310. package/dist/daemon/freeze-fence.js.map +1 -0
  311. package/dist/daemon/jinn-claim-loop-canonical.d.ts +207 -0
  312. package/dist/daemon/jinn-claim-loop-canonical.js +296 -0
  313. package/dist/daemon/jinn-claim-loop-canonical.js.map +1 -0
  314. package/dist/daemon/jinn-claim-loop-mock.d.ts +61 -0
  315. package/dist/daemon/jinn-claim-loop-mock.js +122 -0
  316. package/dist/daemon/jinn-claim-loop-mock.js.map +1 -0
  317. package/dist/daemon/jinn-claim-loop.d.ts +123 -0
  318. package/dist/daemon/jinn-claim-loop.js +256 -0
  319. package/dist/daemon/jinn-claim-loop.js.map +1 -0
  320. package/dist/daemon/reward-claim-loop.d.ts +2 -0
  321. package/dist/daemon/reward-claim-loop.js +32 -27
  322. package/dist/daemon/reward-claim-loop.js.map +1 -1
  323. package/dist/dashboard/assets/index-C4Vp0vkW.js +76 -0
  324. package/dist/dashboard/assets/index-a0yafmyT.css +32 -0
  325. package/dist/dashboard/index.html +18 -74
  326. package/dist/earning/agent-wallet-binding.d.ts +133 -0
  327. package/dist/earning/agent-wallet-binding.js +202 -0
  328. package/dist/earning/agent-wallet-binding.js.map +1 -0
  329. package/dist/earning/bootstrap.d.ts +88 -1
  330. package/dist/earning/bootstrap.js +409 -56
  331. package/dist/earning/bootstrap.js.map +1 -1
  332. package/dist/earning/contracts.d.ts +328 -6
  333. package/dist/earning/contracts.js +295 -14
  334. package/dist/earning/contracts.js.map +1 -1
  335. package/dist/earning/evidence-simhash.d.ts +1 -1
  336. package/dist/earning/faucet.d.ts +31 -0
  337. package/dist/earning/faucet.js +37 -0
  338. package/dist/earning/faucet.js.map +1 -1
  339. package/dist/earning/funding-plan.d.ts +89 -0
  340. package/dist/earning/funding-plan.js +202 -0
  341. package/dist/earning/funding-plan.js.map +1 -0
  342. package/dist/earning/migrate-agent-id.d.ts +129 -0
  343. package/dist/earning/migrate-agent-id.js +256 -0
  344. package/dist/earning/migrate-agent-id.js.map +1 -0
  345. package/dist/earning/orphan-sweep.d.ts +14 -0
  346. package/dist/earning/orphan-sweep.js +63 -2
  347. package/dist/earning/orphan-sweep.js.map +1 -1
  348. package/dist/earning/reconcile.d.ts +2 -0
  349. package/dist/earning/reconcile.js +30 -0
  350. package/dist/earning/reconcile.js.map +1 -1
  351. package/dist/earning/safe-adapter.js +45 -3
  352. package/dist/earning/safe-adapter.js.map +1 -1
  353. package/dist/earning/stolas-claim.d.ts +86 -6
  354. package/dist/earning/stolas-claim.js +123 -9
  355. package/dist/earning/stolas-claim.js.map +1 -1
  356. package/dist/earning/store.d.ts +47 -0
  357. package/dist/earning/store.js +113 -1
  358. package/dist/earning/store.js.map +1 -1
  359. package/dist/earning/testnet-setup-migration.d.ts +32 -0
  360. package/dist/earning/testnet-setup-migration.js +214 -0
  361. package/dist/earning/testnet-setup-migration.js.map +1 -0
  362. package/dist/earning/types.d.ts +57 -9
  363. package/dist/earning/types.js +51 -2
  364. package/dist/earning/types.js.map +1 -1
  365. package/dist/earning/viem-clients.d.ts +20 -0
  366. package/dist/earning/viem-clients.js +32 -1
  367. package/dist/earning/viem-clients.js.map +1 -1
  368. package/dist/erc8004/abis.d.ts +423 -0
  369. package/dist/erc8004/abis.js +265 -0
  370. package/dist/erc8004/abis.js.map +1 -0
  371. package/dist/erc8004/addresses.d.ts +40 -0
  372. package/dist/erc8004/addresses.js +64 -0
  373. package/dist/erc8004/addresses.js.map +1 -0
  374. package/dist/erc8004/identity.d.ts +273 -0
  375. package/dist/erc8004/identity.js +405 -0
  376. package/dist/erc8004/identity.js.map +1 -0
  377. package/dist/erc8004/index.d.ts +13 -0
  378. package/dist/erc8004/index.js +20 -0
  379. package/dist/erc8004/index.js.map +1 -0
  380. package/dist/erc8004/reputation.d.ts +349 -0
  381. package/dist/erc8004/reputation.js +464 -0
  382. package/dist/erc8004/reputation.js.map +1 -0
  383. package/dist/erc8004/subgraph.d.ts +46 -0
  384. package/dist/erc8004/subgraph.js +37 -0
  385. package/dist/erc8004/subgraph.js.map +1 -0
  386. package/dist/erc8004/validation.d.ts +145 -0
  387. package/dist/erc8004/validation.js +219 -0
  388. package/dist/erc8004/validation.js.map +1 -0
  389. package/dist/errors/persisted-bootstrap-error.d.ts +4 -0
  390. package/dist/errors/persisted-bootstrap-error.js +50 -0
  391. package/dist/errors/persisted-bootstrap-error.js.map +1 -0
  392. package/dist/events/emitter.d.ts +12 -0
  393. package/dist/events/emitter.js +23 -0
  394. package/dist/events/emitter.js.map +1 -0
  395. package/dist/events/ring-buffer.d.ts +25 -0
  396. package/dist/events/ring-buffer.js +46 -0
  397. package/dist/events/ring-buffer.js.map +1 -0
  398. package/dist/events/types.d.ts +42 -0
  399. package/dist/events/types.js +28 -0
  400. package/dist/events/types.js.map +1 -0
  401. package/dist/harnesses/capability/index.d.ts +82 -0
  402. package/dist/harnesses/capability/index.js +12 -0
  403. package/dist/harnesses/capability/index.js.map +1 -0
  404. package/dist/harnesses/capability/scoped-rpc.d.ts +12 -0
  405. package/dist/harnesses/capability/scoped-rpc.js +34 -0
  406. package/dist/harnesses/capability/scoped-rpc.js.map +1 -0
  407. package/dist/harnesses/capability/scoped-secrets.d.ts +8 -0
  408. package/dist/harnesses/capability/scoped-secrets.js +10 -0
  409. package/dist/harnesses/capability/scoped-secrets.js.map +1 -0
  410. package/dist/harnesses/capability/scoped-signer.d.ts +46 -0
  411. package/dist/harnesses/capability/scoped-signer.js +73 -0
  412. package/dist/harnesses/capability/scoped-signer.js.map +1 -0
  413. package/dist/harnesses/engine/canonical-json.d.ts +1 -0
  414. package/dist/harnesses/engine/canonical-json.js +66 -0
  415. package/dist/harnesses/engine/canonical-json.js.map +1 -0
  416. package/dist/harnesses/engine/delivery.d.ts +58 -0
  417. package/dist/harnesses/engine/delivery.js +67 -0
  418. package/dist/harnesses/engine/delivery.js.map +1 -0
  419. package/dist/harnesses/engine/engine.d.ts +516 -0
  420. package/dist/harnesses/engine/engine.js +1544 -0
  421. package/dist/harnesses/engine/engine.js.map +1 -0
  422. package/dist/harnesses/engine/envelope-assembly.d.ts +73 -0
  423. package/dist/harnesses/engine/envelope-assembly.js +60 -0
  424. package/dist/harnesses/engine/envelope-assembly.js.map +1 -0
  425. package/dist/harnesses/engine/packaging.d.ts +87 -0
  426. package/dist/harnesses/engine/packaging.js +376 -0
  427. package/dist/harnesses/engine/packaging.js.map +1 -0
  428. package/dist/harnesses/engine/persistence.d.ts +193 -0
  429. package/dist/harnesses/engine/persistence.js +421 -0
  430. package/dist/harnesses/engine/persistence.js.map +1 -0
  431. package/dist/harnesses/engine/recovery.d.ts +22 -0
  432. package/dist/harnesses/engine/recovery.js +24 -0
  433. package/dist/harnesses/engine/recovery.js.map +1 -0
  434. package/dist/harnesses/engine/registry.d.ts +55 -0
  435. package/dist/harnesses/engine/registry.js +65 -0
  436. package/dist/harnesses/engine/registry.js.map +1 -0
  437. package/dist/harnesses/engine/signing.d.ts +30 -0
  438. package/dist/harnesses/engine/signing.js +39 -0
  439. package/dist/harnesses/engine/signing.js.map +1 -0
  440. package/dist/harnesses/engine/state.d.ts +42 -0
  441. package/dist/harnesses/engine/state.js +87 -0
  442. package/dist/harnesses/engine/state.js.map +1 -0
  443. package/dist/harnesses/engine/validate-manifest.d.ts +23 -0
  444. package/dist/harnesses/engine/validate-manifest.js +49 -0
  445. package/dist/harnesses/engine/validate-manifest.js.map +1 -0
  446. package/dist/harnesses/engine/verification-stub.d.ts +18 -0
  447. package/dist/harnesses/engine/verification-stub.js +18 -0
  448. package/dist/harnesses/engine/verification-stub.js.map +1 -0
  449. package/dist/harnesses/external-impls/index.d.ts +3 -0
  450. package/dist/harnesses/external-impls/index.js +2 -0
  451. package/dist/harnesses/external-impls/index.js.map +1 -0
  452. package/dist/harnesses/external-impls/loader.d.ts +50 -0
  453. package/dist/harnesses/external-impls/loader.js +139 -0
  454. package/dist/harnesses/external-impls/loader.js.map +1 -0
  455. package/dist/harnesses/external-impls/package-hash.d.ts +26 -0
  456. package/dist/harnesses/external-impls/package-hash.js +102 -0
  457. package/dist/harnesses/external-impls/package-hash.js.map +1 -0
  458. package/dist/harnesses/external-impls/types.d.ts +42 -0
  459. package/dist/harnesses/external-impls/types.js +10 -0
  460. package/dist/harnesses/external-impls/types.js.map +1 -0
  461. package/dist/harnesses/freeze.d.ts +34 -0
  462. package/dist/harnesses/freeze.js +60 -0
  463. package/dist/harnesses/freeze.js.map +1 -0
  464. package/dist/harnesses/impls/claude-code-learner/adapters/claude-code.d.ts +57 -0
  465. package/dist/harnesses/impls/claude-code-learner/adapters/claude-code.js +235 -0
  466. package/dist/harnesses/impls/claude-code-learner/adapters/claude-code.js.map +1 -0
  467. package/dist/harnesses/impls/claude-code-learner/harness.d.ts +22 -0
  468. package/dist/harnesses/impls/claude-code-learner/harness.js +56 -0
  469. package/dist/harnesses/impls/claude-code-learner/harness.js.map +1 -0
  470. package/dist/harnesses/impls/claude-code-learner/harvest.d.ts +20 -0
  471. package/dist/harnesses/impls/claude-code-learner/harvest.js +426 -0
  472. package/dist/harnesses/impls/claude-code-learner/harvest.js.map +1 -0
  473. package/dist/harnesses/impls/claude-code-learner/index.d.ts +14 -0
  474. package/dist/harnesses/impls/claude-code-learner/index.js +13 -0
  475. package/dist/harnesses/impls/claude-code-learner/index.js.map +1 -0
  476. package/dist/harnesses/impls/claude-code-learner/plugin-path.d.ts +14 -0
  477. package/dist/harnesses/impls/claude-code-learner/plugin-path.js +30 -0
  478. package/dist/harnesses/impls/claude-code-learner/plugin-path.js.map +1 -0
  479. package/dist/harnesses/impls/claude-code-learner/test-utils/fake-plugin-outputs.d.ts +50 -0
  480. package/dist/harnesses/impls/claude-code-learner/test-utils/fake-plugin-outputs.js +192 -0
  481. package/dist/harnesses/impls/claude-code-learner/test-utils/fake-plugin-outputs.js.map +1 -0
  482. package/dist/harnesses/impls/claude-code-learner/test-utils/noop-adapter.d.ts +22 -0
  483. package/dist/harnesses/impls/claude-code-learner/test-utils/noop-adapter.js +35 -0
  484. package/dist/harnesses/impls/claude-code-learner/test-utils/noop-adapter.js.map +1 -0
  485. package/dist/harnesses/impls/claude-code-learner/types.d.ts +112 -0
  486. package/dist/harnesses/impls/claude-code-learner/types.js.map +1 -0
  487. package/dist/harnesses/impls/claude-mcp-hyperliquid/api-wallet.d.ts +64 -0
  488. package/dist/harnesses/impls/claude-mcp-hyperliquid/api-wallet.js.map +1 -0
  489. package/dist/harnesses/impls/claude-mcp-hyperliquid/index.d.ts +106 -0
  490. package/dist/harnesses/impls/claude-mcp-hyperliquid/index.js +723 -0
  491. package/dist/harnesses/impls/claude-mcp-hyperliquid/index.js.map +1 -0
  492. package/dist/harnesses/impls/claude-mcp-hyperliquid/mcp-tools.js.map +1 -0
  493. package/dist/harnesses/impls/claude-mcp-hyperliquid/safety-rails.js.map +1 -0
  494. package/dist/harnesses/impls/claude-mcp-hyperliquid/session-orchestrator.d.ts +104 -0
  495. package/dist/harnesses/impls/claude-mcp-hyperliquid/session-orchestrator.js +264 -0
  496. package/dist/harnesses/impls/claude-mcp-hyperliquid/session-orchestrator.js.map +1 -0
  497. package/dist/harnesses/impls/claude-mcp-prediction/index.d.ts +44 -0
  498. package/dist/harnesses/impls/claude-mcp-prediction/index.js +250 -0
  499. package/dist/harnesses/impls/claude-mcp-prediction/index.js.map +1 -0
  500. package/dist/harnesses/impls/claude-mcp-prediction/mcp-tools.js +135 -0
  501. package/dist/harnesses/impls/claude-mcp-prediction/mcp-tools.js.map +1 -0
  502. package/dist/harnesses/impls/claude-mcp-prediction/prompt.d.ts +8 -0
  503. package/dist/harnesses/impls/claude-mcp-prediction/prompt.js +54 -0
  504. package/dist/harnesses/impls/claude-mcp-prediction/prompt.js.map +1 -0
  505. package/dist/harnesses/impls/claude-mcp-prediction/session-orchestrator.d.ts +43 -0
  506. package/dist/harnesses/impls/claude-mcp-prediction/session-orchestrator.js +21 -0
  507. package/dist/harnesses/impls/claude-mcp-prediction/session-orchestrator.js.map +1 -0
  508. package/dist/harnesses/impls/claude-mcp-prediction/types.d.ts +84 -0
  509. package/dist/harnesses/impls/claude-mcp-prediction/types.js +6 -0
  510. package/dist/harnesses/impls/claude-mcp-prediction/types.js.map +1 -0
  511. package/dist/harnesses/impls/claude-mcp-prediction-apy/index.d.ts +36 -0
  512. package/dist/harnesses/impls/claude-mcp-prediction-apy/index.js +241 -0
  513. package/dist/harnesses/impls/claude-mcp-prediction-apy/index.js.map +1 -0
  514. package/dist/harnesses/impls/claude-mcp-prediction-apy/mcp-tools.js +136 -0
  515. package/dist/harnesses/impls/claude-mcp-prediction-apy/mcp-tools.js.map +1 -0
  516. package/dist/harnesses/impls/claude-mcp-prediction-apy/prompt.d.ts +7 -0
  517. package/dist/harnesses/impls/claude-mcp-prediction-apy/prompt.js +46 -0
  518. package/dist/harnesses/impls/claude-mcp-prediction-apy/prompt.js.map +1 -0
  519. package/dist/harnesses/impls/claude-mcp-prediction-apy/session-orchestrator.d.ts +37 -0
  520. package/dist/harnesses/impls/claude-mcp-prediction-apy/session-orchestrator.js +19 -0
  521. package/dist/harnesses/impls/claude-mcp-prediction-apy/session-orchestrator.js.map +1 -0
  522. package/dist/harnesses/impls/claude-mcp-prediction-apy/types.d.ts +64 -0
  523. package/dist/harnesses/impls/claude-mcp-prediction-apy/types.js +6 -0
  524. package/dist/harnesses/impls/claude-mcp-prediction-apy/types.js.map +1 -0
  525. package/dist/harnesses/impls/claude-mcp-shared/single-session-orchestrator.d.ts +84 -0
  526. package/dist/harnesses/impls/claude-mcp-shared/single-session-orchestrator.js +206 -0
  527. package/dist/harnesses/impls/claude-mcp-shared/single-session-orchestrator.js.map +1 -0
  528. package/dist/harnesses/impls/evaluation-context.d.ts +23 -0
  529. package/dist/harnesses/impls/evaluation-context.js +25 -0
  530. package/dist/harnesses/impls/evaluation-context.js.map +1 -0
  531. package/dist/harnesses/impls/index.d.ts +74 -0
  532. package/dist/harnesses/impls/index.js +112 -0
  533. package/dist/harnesses/impls/index.js.map +1 -0
  534. package/dist/harnesses/impls/legacy-claude/index.d.ts +66 -0
  535. package/dist/harnesses/impls/legacy-claude/index.js +168 -0
  536. package/dist/harnesses/impls/legacy-claude/index.js.map +1 -0
  537. package/dist/harnesses/impls/portfolio-v0-evaluator/canonical-metrics.d.ts +68 -0
  538. package/dist/harnesses/impls/portfolio-v0-evaluator/canonical-metrics.js +117 -0
  539. package/dist/harnesses/impls/portfolio-v0-evaluator/canonical-metrics.js.map +1 -0
  540. package/dist/harnesses/impls/portfolio-v0-evaluator/checks/availability.js.map +1 -0
  541. package/dist/harnesses/impls/portfolio-v0-evaluator/checks/consistency.d.ts +78 -0
  542. package/dist/harnesses/impls/portfolio-v0-evaluator/checks/consistency.js +274 -0
  543. package/dist/harnesses/impls/portfolio-v0-evaluator/checks/consistency.js.map +1 -0
  544. package/dist/harnesses/impls/portfolio-v0-evaluator/checks/eligibility.d.ts +23 -0
  545. package/dist/harnesses/impls/portfolio-v0-evaluator/checks/eligibility.js +49 -0
  546. package/dist/harnesses/impls/portfolio-v0-evaluator/checks/eligibility.js.map +1 -0
  547. package/dist/harnesses/impls/portfolio-v0-evaluator/checks/integrity.d.ts +25 -0
  548. package/dist/harnesses/impls/portfolio-v0-evaluator/checks/integrity.js +44 -0
  549. package/dist/harnesses/impls/portfolio-v0-evaluator/checks/integrity.js.map +1 -0
  550. package/dist/harnesses/impls/portfolio-v0-evaluator/checks/spec.d.ts +17 -0
  551. package/dist/harnesses/impls/portfolio-v0-evaluator/checks/spec.js +43 -0
  552. package/dist/harnesses/impls/portfolio-v0-evaluator/checks/spec.js.map +1 -0
  553. package/dist/harnesses/impls/portfolio-v0-evaluator/index.d.ts +44 -0
  554. package/dist/harnesses/impls/portfolio-v0-evaluator/index.js +569 -0
  555. package/dist/harnesses/impls/portfolio-v0-evaluator/index.js.map +1 -0
  556. package/dist/harnesses/impls/portfolio-v0-evaluator/score.js.map +1 -0
  557. package/dist/harnesses/impls/portfolio-v0-evaluator/types.d.ts +34 -0
  558. package/dist/harnesses/impls/portfolio-v0-evaluator/types.js.map +1 -0
  559. package/dist/harnesses/impls/prediction-apy-v0-baseline/index.d.ts +42 -0
  560. package/dist/harnesses/impls/prediction-apy-v0-baseline/index.js +114 -0
  561. package/dist/harnesses/impls/prediction-apy-v0-baseline/index.js.map +1 -0
  562. package/dist/harnesses/impls/prediction-apy-v0-baseline/strategy.js.map +1 -0
  563. package/dist/harnesses/impls/prediction-apy-v0-baseline/types.js.map +1 -0
  564. package/dist/harnesses/impls/prediction-apy-v0-evaluator/canonical-metrics.d.ts +6 -0
  565. package/dist/harnesses/impls/prediction-apy-v0-evaluator/canonical-metrics.js +11 -0
  566. package/dist/harnesses/impls/prediction-apy-v0-evaluator/canonical-metrics.js.map +1 -0
  567. package/dist/harnesses/impls/prediction-apy-v0-evaluator/index.d.ts +42 -0
  568. package/dist/harnesses/impls/prediction-apy-v0-evaluator/index.js +346 -0
  569. package/dist/harnesses/impls/prediction-apy-v0-evaluator/index.js.map +1 -0
  570. package/dist/harnesses/impls/prediction-apy-v0-evaluator/parse-submission.d.ts +16 -0
  571. package/dist/harnesses/impls/prediction-apy-v0-evaluator/parse-submission.js +22 -0
  572. package/dist/harnesses/impls/prediction-apy-v0-evaluator/parse-submission.js.map +1 -0
  573. package/dist/harnesses/impls/prediction-apy-v0-evaluator/score.js.map +1 -0
  574. package/dist/harnesses/impls/prediction-apy-v0-evaluator/types.js.map +1 -0
  575. package/dist/harnesses/impls/prediction-v0-baseline/index.d.ts +33 -0
  576. package/dist/harnesses/impls/prediction-v0-baseline/index.js +109 -0
  577. package/dist/harnesses/impls/prediction-v0-baseline/index.js.map +1 -0
  578. package/dist/harnesses/impls/prediction-v0-baseline/strategy.d.ts +8 -0
  579. package/dist/harnesses/impls/prediction-v0-baseline/strategy.js +41 -0
  580. package/dist/harnesses/impls/prediction-v0-baseline/strategy.js.map +1 -0
  581. package/dist/harnesses/impls/prediction-v0-baseline/types.d.ts +7 -0
  582. package/dist/harnesses/impls/prediction-v0-baseline/types.js.map +1 -0
  583. package/dist/harnesses/impls/prediction-v0-evaluator/canonical-metrics.d.ts +20 -0
  584. package/dist/harnesses/impls/prediction-v0-evaluator/canonical-metrics.js.map +1 -0
  585. package/dist/harnesses/impls/prediction-v0-evaluator/checks/availability.d.ts +9 -0
  586. package/dist/harnesses/impls/prediction-v0-evaluator/checks/availability.js.map +1 -0
  587. package/dist/harnesses/impls/prediction-v0-evaluator/checks/eligibility.d.ts +3 -0
  588. package/dist/harnesses/impls/prediction-v0-evaluator/checks/eligibility.js.map +1 -0
  589. package/dist/harnesses/impls/prediction-v0-evaluator/checks/integrity.d.ts +15 -0
  590. package/dist/harnesses/impls/prediction-v0-evaluator/checks/integrity.js +111 -0
  591. package/dist/harnesses/impls/prediction-v0-evaluator/checks/integrity.js.map +1 -0
  592. package/dist/harnesses/impls/prediction-v0-evaluator/checks/spec.d.ts +5 -0
  593. package/dist/harnesses/impls/prediction-v0-evaluator/checks/spec.js.map +1 -0
  594. package/dist/harnesses/impls/prediction-v0-evaluator/index.d.ts +36 -0
  595. package/dist/harnesses/impls/prediction-v0-evaluator/index.js +342 -0
  596. package/dist/harnesses/impls/prediction-v0-evaluator/index.js.map +1 -0
  597. package/dist/harnesses/impls/prediction-v0-evaluator/score.js.map +1 -0
  598. package/dist/harnesses/impls/prediction-v0-evaluator/types.js +2 -0
  599. package/dist/harnesses/impls/prediction-v0-evaluator/types.js.map +1 -0
  600. package/dist/harnesses/impls/prediction-v1-baseline/index.d.ts +31 -0
  601. package/dist/harnesses/impls/prediction-v1-baseline/index.js +79 -0
  602. package/dist/harnesses/impls/prediction-v1-baseline/index.js.map +1 -0
  603. package/dist/harnesses/impls/prediction-v1-evaluator/index.d.ts +32 -0
  604. package/dist/harnesses/impls/prediction-v1-evaluator/index.js +219 -0
  605. package/dist/harnesses/impls/prediction-v1-evaluator/index.js.map +1 -0
  606. package/dist/harnesses/impls/swe-rebench-v2-evaluator/eval-runner.d.ts +20 -0
  607. package/dist/harnesses/impls/swe-rebench-v2-evaluator/eval-runner.js +88 -0
  608. package/dist/harnesses/impls/swe-rebench-v2-evaluator/eval-runner.js.map +1 -0
  609. package/dist/harnesses/impls/swe-rebench-v2-evaluator/index.d.ts +56 -0
  610. package/dist/harnesses/impls/swe-rebench-v2-evaluator/index.js +40 -0
  611. package/dist/harnesses/impls/swe-rebench-v2-evaluator/index.js.map +1 -0
  612. package/dist/harnesses/manifest/index.d.ts +3 -0
  613. package/dist/harnesses/manifest/index.js +3 -0
  614. package/dist/harnesses/manifest/index.js.map +1 -0
  615. package/dist/harnesses/manifest/load.d.ts +7 -0
  616. package/dist/harnesses/manifest/load.js +49 -0
  617. package/dist/harnesses/manifest/load.js.map +1 -0
  618. package/dist/harnesses/manifest/types.d.ts +75 -0
  619. package/dist/harnesses/manifest/types.js +8 -0
  620. package/dist/harnesses/manifest/types.js.map +1 -0
  621. package/dist/harnesses/manifest/verify.d.ts +15 -0
  622. package/dist/harnesses/manifest/verify.js +53 -0
  623. package/dist/harnesses/manifest/verify.js.map +1 -0
  624. package/dist/harnesses/mode-state.d.ts +7 -0
  625. package/dist/harnesses/mode-state.js +43 -0
  626. package/dist/harnesses/mode-state.js.map +1 -0
  627. package/dist/harnesses/types.d.ts +274 -0
  628. package/dist/harnesses/types.js +28 -0
  629. package/dist/harnesses/types.js.map +1 -0
  630. package/dist/index.d.ts +1 -1
  631. package/dist/main.d.ts +17 -2
  632. package/dist/main.js +1257 -127
  633. package/dist/main.js.map +1 -1
  634. package/dist/mcp/acquire-artifact.d.ts +39 -0
  635. package/dist/mcp/acquire-artifact.js +163 -0
  636. package/dist/mcp/acquire-artifact.js.map +1 -0
  637. package/dist/mcp/operator-server.d.ts +21 -4
  638. package/dist/mcp/operator-server.js +505 -30
  639. package/dist/mcp/operator-server.js.map +1 -1
  640. package/dist/mcp/search-records.d.ts +92 -0
  641. package/dist/mcp/search-records.js +393 -0
  642. package/dist/mcp/search-records.js.map +1 -0
  643. package/dist/mcp/server.d.ts +4 -4
  644. package/dist/mcp/server.js +148 -61
  645. package/dist/mcp/server.js.map +1 -1
  646. package/dist/observability/emit-event.d.ts +2 -2
  647. package/dist/observability/emit-event.js +2 -2
  648. package/dist/observability/emit-event.js.map +1 -1
  649. package/dist/operator-errors.d.ts +14 -0
  650. package/dist/operator-errors.js +39 -10
  651. package/dist/operator-errors.js.map +1 -1
  652. package/dist/plugins/digest.d.ts +1 -0
  653. package/dist/plugins/digest.js +28 -0
  654. package/dist/plugins/digest.js.map +1 -0
  655. package/dist/plugins/index.d.ts +6 -0
  656. package/dist/plugins/index.js +6 -0
  657. package/dist/plugins/index.js.map +1 -0
  658. package/dist/plugins/manifest.d.ts +7 -0
  659. package/dist/plugins/manifest.js +22 -0
  660. package/dist/plugins/manifest.js.map +1 -0
  661. package/dist/plugins/registry.d.ts +9 -0
  662. package/dist/plugins/registry.js +24 -0
  663. package/dist/plugins/registry.js.map +1 -0
  664. package/dist/plugins/resolvers.d.ts +2 -0
  665. package/dist/plugins/resolvers.js +126 -0
  666. package/dist/plugins/resolvers.js.map +1 -0
  667. package/dist/plugins/types.d.ts +35 -0
  668. package/dist/plugins/types.js +2 -0
  669. package/dist/plugins/types.js.map +1 -0
  670. package/dist/plugins/validator.d.ts +3 -0
  671. package/dist/plugins/validator.js +50 -0
  672. package/dist/plugins/validator.js.map +1 -0
  673. package/dist/preflight/claude-auth.d.ts +14 -12
  674. package/dist/preflight/claude-auth.js +23 -37
  675. package/dist/preflight/claude-auth.js.map +1 -1
  676. package/dist/runner/claude.d.ts +3 -3
  677. package/dist/runner/claude.js +62 -26
  678. package/dist/runner/claude.js.map +1 -1
  679. package/dist/runner/runner.d.ts +29 -2
  680. package/dist/runner/simple.d.ts +2 -2
  681. package/dist/runner/simple.js +2 -2
  682. package/dist/runner/simple.js.map +1 -1
  683. package/dist/scripts/fix-node-pty.mjs +62 -0
  684. package/dist/setup/claude-code-install.d.ts +19 -0
  685. package/dist/setup/claude-code-install.js +51 -0
  686. package/dist/setup/claude-code-install.js.map +1 -0
  687. package/dist/setup-mode.d.ts +34 -0
  688. package/dist/setup-mode.js +49 -0
  689. package/dist/setup-mode.js.map +1 -0
  690. package/dist/solver-nets/contracts.d.ts +2 -0
  691. package/dist/solver-nets/contracts.js +2 -0
  692. package/dist/solver-nets/contracts.js.map +1 -0
  693. package/dist/solver-nets/prediction-operator-ux.d.ts +112 -0
  694. package/dist/solver-nets/prediction-operator-ux.js +456 -0
  695. package/dist/solver-nets/prediction-operator-ux.js.map +1 -0
  696. package/dist/solver-nets/registry.d.ts +50 -0
  697. package/dist/solver-nets/registry.js +150 -0
  698. package/dist/solver-nets/registry.js.map +1 -0
  699. package/dist/solver-types/_swe-rebench-v2-aggregate.d.ts +31 -0
  700. package/dist/solver-types/_swe-rebench-v2-aggregate.js +49 -0
  701. package/dist/solver-types/_swe-rebench-v2-aggregate.js.map +1 -0
  702. package/dist/solver-types/_swe-rebench-v2-escrow.d.ts +27 -0
  703. package/dist/solver-types/_swe-rebench-v2-escrow.js +26 -0
  704. package/dist/solver-types/_swe-rebench-v2-escrow.js.map +1 -0
  705. package/dist/solver-types/_swe-rebench-v2-pool.d.ts +39 -0
  706. package/dist/solver-types/_swe-rebench-v2-pool.js +66 -0
  707. package/dist/solver-types/_swe-rebench-v2-pool.js.map +1 -0
  708. package/dist/solver-types/_swe-rebench-v2-state.d.ts +24 -0
  709. package/dist/solver-types/_swe-rebench-v2-state.js +54 -0
  710. package/dist/solver-types/_swe-rebench-v2-state.js.map +1 -0
  711. package/dist/solver-types/constants.d.ts +5 -0
  712. package/dist/solver-types/constants.js +6 -0
  713. package/dist/solver-types/constants.js.map +1 -0
  714. package/dist/solver-types/index.d.ts +10 -0
  715. package/dist/solver-types/index.js +30 -0
  716. package/dist/solver-types/index.js.map +1 -0
  717. package/dist/solver-types/learner-loop-test.d.ts +2 -0
  718. package/dist/solver-types/learner-loop-test.js +39 -0
  719. package/dist/solver-types/learner-loop-test.js.map +1 -0
  720. package/dist/solver-types/portfolio-v0.d.ts +2 -0
  721. package/dist/solver-types/portfolio-v0.js +13 -0
  722. package/dist/solver-types/portfolio-v0.js.map +1 -0
  723. package/dist/solver-types/prediction-apy-v0-auto.d.ts +27 -0
  724. package/dist/solver-types/prediction-apy-v0-auto.js +109 -0
  725. package/dist/solver-types/prediction-apy-v0-auto.js.map +1 -0
  726. package/dist/solver-types/prediction-apy-v0-template.d.ts +8 -0
  727. package/dist/solver-types/prediction-apy-v0-template.js +22 -0
  728. package/dist/solver-types/prediction-apy-v0-template.js.map +1 -0
  729. package/dist/solver-types/prediction-apy-v0.d.ts +3 -0
  730. package/dist/solver-types/prediction-apy-v0.js +25 -0
  731. package/dist/solver-types/prediction-apy-v0.js.map +1 -0
  732. package/dist/solver-types/prediction-v0-auto.d.ts +69 -0
  733. package/dist/solver-types/prediction-v0-auto.js +146 -0
  734. package/dist/solver-types/prediction-v0-auto.js.map +1 -0
  735. package/dist/solver-types/prediction-v0-template.d.ts +70 -0
  736. package/dist/solver-types/prediction-v0-template.js +145 -0
  737. package/dist/solver-types/prediction-v0-template.js.map +1 -0
  738. package/dist/solver-types/prediction-v0.d.ts +13 -0
  739. package/dist/solver-types/prediction-v0.js +31 -0
  740. package/dist/solver-types/prediction-v0.js.map +1 -0
  741. package/dist/solver-types/prediction-v1-auto.d.ts +122 -0
  742. package/dist/solver-types/prediction-v1-auto.js +366 -0
  743. package/dist/solver-types/prediction-v1-auto.js.map +1 -0
  744. package/dist/solver-types/prediction-v1.d.ts +11 -0
  745. package/dist/solver-types/prediction-v1.js +27 -0
  746. package/dist/solver-types/prediction-v1.js.map +1 -0
  747. package/dist/solver-types/solver-type.d.ts +53 -0
  748. package/dist/solver-types/solver-type.js +6 -0
  749. package/dist/solver-types/solver-type.js.map +1 -0
  750. package/dist/solver-types/swe-rebench-v2-auto.d.ts +38 -0
  751. package/dist/solver-types/swe-rebench-v2-auto.js +56 -0
  752. package/dist/solver-types/swe-rebench-v2-auto.js.map +1 -0
  753. package/dist/solver-types/swe-rebench-v2.d.ts +24 -0
  754. package/dist/solver-types/swe-rebench-v2.js +146 -0
  755. package/dist/solver-types/swe-rebench-v2.js.map +1 -0
  756. package/dist/solvernets/daemon-init.d.ts +291 -0
  757. package/dist/solvernets/daemon-init.js +431 -0
  758. package/dist/solvernets/daemon-init.js.map +1 -0
  759. package/dist/solvernets/launch-state-machine.d.ts +165 -0
  760. package/dist/solvernets/launch-state-machine.js +406 -0
  761. package/dist/solvernets/launch-state-machine.js.map +1 -0
  762. package/dist/solvernets/lifecycle-transitions.d.ts +183 -0
  763. package/dist/solvernets/lifecycle-transitions.js +386 -0
  764. package/dist/solvernets/lifecycle-transitions.js.map +1 -0
  765. package/dist/solvernets/manifest.d.ts +120 -0
  766. package/dist/solvernets/manifest.js +166 -0
  767. package/dist/solvernets/manifest.js.map +1 -0
  768. package/dist/solvernets/most-recent-wins.d.ts +77 -0
  769. package/dist/solvernets/most-recent-wins.js +82 -0
  770. package/dist/solvernets/most-recent-wins.js.map +1 -0
  771. package/dist/solvernets/registry-client-erc8004.d.ts +239 -0
  772. package/dist/solvernets/registry-client-erc8004.js +382 -0
  773. package/dist/solvernets/registry-client-erc8004.js.map +1 -0
  774. package/dist/solvernets/registry-client.d.ts +121 -0
  775. package/dist/solvernets/registry-client.js +19 -0
  776. package/dist/solvernets/registry-client.js.map +1 -0
  777. package/dist/solvernets/store.d.ts +298 -0
  778. package/dist/solvernets/store.js +271 -0
  779. package/dist/solvernets/store.js.map +1 -0
  780. package/dist/store/store.d.ts +175 -21
  781. package/dist/store/store.js +711 -46
  782. package/dist/store/store.js.map +1 -1
  783. package/dist/tasks/posting-service.d.ts +25 -0
  784. package/dist/tasks/posting-service.js +149 -0
  785. package/dist/tasks/posting-service.js.map +1 -0
  786. package/dist/tasks/signing.d.ts +4 -0
  787. package/dist/tasks/signing.js +18 -0
  788. package/dist/tasks/signing.js.map +1 -0
  789. package/dist/tasks/sources.d.ts +46 -0
  790. package/dist/tasks/sources.js +45 -0
  791. package/dist/tasks/sources.js.map +1 -0
  792. package/dist/templates/harnesses/alternative-harness/README.md.tmpl +44 -0
  793. package/dist/templates/harnesses/alternative-harness/gitignore.tmpl +3 -0
  794. package/dist/templates/harnesses/alternative-harness/jinn.manifest.json.tmpl +22 -0
  795. package/dist/templates/harnesses/alternative-harness/package.json.tmpl +26 -0
  796. package/dist/templates/harnesses/alternative-harness/src/coordinator.ts.tmpl +50 -0
  797. package/dist/templates/harnesses/alternative-harness/src/harness.ts.tmpl +31 -0
  798. package/dist/templates/harnesses/alternative-harness/src/index.ts.tmpl +44 -0
  799. package/dist/templates/harnesses/alternative-harness/src/mock-harness.ts.tmpl +41 -0
  800. package/dist/templates/harnesses/alternative-harness/src/phases/debrief.ts.tmpl +28 -0
  801. package/dist/templates/harnesses/alternative-harness/src/phases/execute.ts.tmpl +33 -0
  802. package/dist/templates/harnesses/alternative-harness/src/phases/improve.ts.tmpl +31 -0
  803. package/dist/templates/harnesses/alternative-harness/src/phases/memory.ts.tmpl +31 -0
  804. package/dist/templates/harnesses/alternative-harness/src/phases/orient.ts.tmpl +21 -0
  805. package/dist/templates/harnesses/alternative-harness/src/phases/plan.ts.tmpl +25 -0
  806. package/dist/templates/harnesses/alternative-harness/src/phases/strategize.ts.tmpl +29 -0
  807. package/dist/templates/harnesses/alternative-harness/test/coordinator.test.ts.tmpl +53 -0
  808. package/dist/templates/harnesses/alternative-harness/test/unit.test.ts.tmpl +55 -0
  809. package/dist/templates/harnesses/alternative-harness/tsconfig.json.tmpl +16 -0
  810. package/dist/templates/harnesses/evaluator/README.md.tmpl +36 -0
  811. package/dist/templates/harnesses/evaluator/gitignore.tmpl +3 -0
  812. package/dist/templates/harnesses/evaluator/jinn.manifest.json.tmpl +22 -0
  813. package/dist/templates/harnesses/evaluator/package.json.tmpl +26 -0
  814. package/dist/templates/harnesses/evaluator/src/index.ts.tmpl +35 -0
  815. package/dist/templates/harnesses/evaluator/test/unit.test.ts.tmpl +49 -0
  816. package/dist/templates/harnesses/evaluator/tsconfig.json.tmpl +16 -0
  817. package/dist/templates/harnesses/forecaster/README.md.tmpl +25 -0
  818. package/dist/templates/harnesses/forecaster/gitignore.tmpl +5 -0
  819. package/dist/templates/harnesses/forecaster/jinn.manifest.json.tmpl +22 -0
  820. package/dist/templates/harnesses/forecaster/package.json.tmpl +26 -0
  821. package/dist/templates/harnesses/forecaster/src/index.ts.tmpl +33 -0
  822. package/dist/templates/harnesses/forecaster/test/unit.test.ts.tmpl +42 -0
  823. package/dist/templates/harnesses/forecaster/tsconfig.json.tmpl +16 -0
  824. package/dist/trajectory/collector.d.ts +49 -0
  825. package/dist/trajectory/collector.js +86 -0
  826. package/dist/trajectory/collector.js.map +1 -0
  827. package/dist/trajectory/emit.d.ts +27 -0
  828. package/dist/trajectory/emit.js +40 -0
  829. package/dist/trajectory/emit.js.map +1 -0
  830. package/dist/trajectory/hash-chain.d.ts +18 -0
  831. package/dist/trajectory/hash-chain.js +23 -0
  832. package/dist/trajectory/hash-chain.js.map +1 -0
  833. package/dist/trajectory/index.d.ts +22 -0
  834. package/dist/trajectory/index.js +23 -0
  835. package/dist/trajectory/index.js.map +1 -0
  836. package/dist/trajectory/schema.d.ts +14 -14
  837. package/dist/trajectory/secret-scrub.d.ts +32 -0
  838. package/dist/trajectory/secret-scrub.js +51 -0
  839. package/dist/trajectory/secret-scrub.js.map +1 -0
  840. package/dist/trajectory/span-profile.d.ts +27 -0
  841. package/dist/trajectory/span-profile.js +51 -0
  842. package/dist/trajectory/span-profile.js.map +1 -0
  843. package/dist/trajectory/wrappers/http.d.ts +37 -0
  844. package/dist/trajectory/wrappers/http.js +85 -0
  845. package/dist/trajectory/wrappers/http.js.map +1 -0
  846. package/dist/trajectory/wrappers/mcp.d.ts +17 -0
  847. package/dist/trajectory/wrappers/mcp.js +58 -0
  848. package/dist/trajectory/wrappers/mcp.js.map +1 -0
  849. package/dist/trajectory/wrappers/subprocess.d.ts +32 -0
  850. package/dist/trajectory/wrappers/subprocess.js +70 -0
  851. package/dist/trajectory/wrappers/subprocess.js.map +1 -0
  852. package/dist/tx-retry.js +34 -9
  853. package/dist/tx-retry.js.map +1 -1
  854. package/dist/types/envelope.d.ts +1659 -0
  855. package/dist/types/envelope.js +133 -0
  856. package/dist/types/envelope.js.map +1 -0
  857. package/dist/types/index.d.ts +4 -4
  858. package/dist/types/index.js +4 -4
  859. package/dist/types/index.js.map +1 -1
  860. package/dist/types/payloads/index.d.ts +12 -0
  861. package/dist/types/payloads/index.js +60 -0
  862. package/dist/types/payloads/index.js.map +1 -0
  863. package/dist/types/payloads/portfolio-v0.d.ts +481 -0
  864. package/dist/types/payloads/portfolio-v0.js +94 -0
  865. package/dist/types/payloads/portfolio-v0.js.map +1 -0
  866. package/dist/types/payloads/prediction-apy-v0.d.ts +231 -0
  867. package/dist/types/payloads/prediction-apy-v0.js +63 -0
  868. package/dist/types/payloads/prediction-apy-v0.js.map +1 -0
  869. package/dist/types/payloads/prediction-v0.d.ts +262 -0
  870. package/dist/types/payloads/prediction-v0.js +73 -0
  871. package/dist/types/payloads/prediction-v0.js.map +1 -0
  872. package/dist/types/payloads/prediction-v1.d.ts +2 -0
  873. package/dist/types/payloads/prediction-v1.js +2 -0
  874. package/dist/types/payloads/prediction-v1.js.map +1 -0
  875. package/dist/types/portfolio.d.ts +31 -698
  876. package/dist/types/portfolio.js +20 -110
  877. package/dist/types/portfolio.js.map +1 -1
  878. package/dist/types/prediction-apy.d.ts +26 -366
  879. package/dist/types/prediction-apy.js +12 -68
  880. package/dist/types/prediction-apy.js.map +1 -1
  881. package/dist/types/prediction-v1.d.ts +2 -0
  882. package/dist/types/prediction-v1.js +2 -0
  883. package/dist/types/prediction-v1.js.map +1 -0
  884. package/dist/types/prediction.d.ts +546 -382
  885. package/dist/types/prediction.js +16 -87
  886. package/dist/types/prediction.js.map +1 -1
  887. package/dist/types/task-document.d.ts +1121 -0
  888. package/dist/types/task-document.js +99 -0
  889. package/dist/types/task-document.js.map +1 -0
  890. package/dist/types/task.d.ts +805 -0
  891. package/dist/types/task.js +88 -0
  892. package/dist/types/task.js.map +1 -0
  893. package/dist/types/window.d.ts +12 -0
  894. package/dist/types/window.js +6 -0
  895. package/dist/types/window.js.map +1 -0
  896. package/dist/util/path-safety.d.ts +21 -0
  897. package/dist/util/path-safety.js +28 -0
  898. package/dist/util/path-safety.js.map +1 -0
  899. package/dist/util/redact-rpc-urls.d.ts +5 -0
  900. package/dist/util/redact-rpc-urls.js +9 -0
  901. package/dist/util/redact-rpc-urls.js.map +1 -0
  902. package/dist/vendor/@jinn-network/sdk/README.md +89 -0
  903. package/dist/vendor/@jinn-network/sdk/dist/capabilities.d.ts +52 -0
  904. package/dist/vendor/@jinn-network/sdk/dist/capabilities.js +1 -0
  905. package/dist/vendor/@jinn-network/sdk/dist/checkpoint.d.ts +120 -0
  906. package/dist/vendor/@jinn-network/sdk/dist/checkpoint.js +39 -0
  907. package/dist/vendor/@jinn-network/sdk/dist/contracts.d.ts +144 -0
  908. package/dist/vendor/@jinn-network/sdk/dist/contracts.js +248 -0
  909. package/dist/vendor/@jinn-network/sdk/dist/harness.d.ts +120 -0
  910. package/dist/vendor/@jinn-network/sdk/dist/harness.js +31 -0
  911. package/dist/vendor/@jinn-network/sdk/dist/index.d.ts +2 -0
  912. package/dist/vendor/@jinn-network/sdk/dist/index.js +5 -0
  913. package/dist/vendor/@jinn-network/sdk/dist/json-schema.d.ts +32 -0
  914. package/dist/vendor/@jinn-network/sdk/dist/json-schema.js +131 -0
  915. package/dist/vendor/@jinn-network/sdk/dist/manifest.d.ts +69 -0
  916. package/dist/vendor/@jinn-network/sdk/dist/manifest.js +3 -0
  917. package/dist/vendor/@jinn-network/sdk/dist/payloads/prediction-v1.d.ts +223 -0
  918. package/dist/vendor/@jinn-network/sdk/dist/payloads/prediction-v1.js +64 -0
  919. package/dist/vendor/@jinn-network/sdk/dist/payloads/swe-rebench-v2.d.ts +107 -0
  920. package/dist/vendor/@jinn-network/sdk/dist/payloads/swe-rebench-v2.js +51 -0
  921. package/dist/vendor/@jinn-network/sdk/dist/plugins.d.ts +36 -0
  922. package/dist/vendor/@jinn-network/sdk/dist/plugins.js +54 -0
  923. package/dist/vendor/@jinn-network/sdk/dist/prediction-v1.d.ts +870 -0
  924. package/dist/vendor/@jinn-network/sdk/dist/prediction-v1.js +80 -0
  925. package/dist/vendor/@jinn-network/sdk/dist/solvernets/index.d.ts +6 -0
  926. package/dist/vendor/@jinn-network/sdk/dist/solvernets/index.js +8 -0
  927. package/dist/vendor/@jinn-network/sdk/dist/solvernets/manifest-schema.d.ts +559 -0
  928. package/dist/vendor/@jinn-network/sdk/dist/solvernets/manifest-schema.js +126 -0
  929. package/dist/vendor/@jinn-network/sdk/dist/solvernets/prediction-v1.d.ts +6 -0
  930. package/dist/vendor/@jinn-network/sdk/dist/solvernets/prediction-v1.js +3 -0
  931. package/dist/vendor/@jinn-network/sdk/dist/solvernets/swe-rebench-v2.d.ts +4 -0
  932. package/dist/vendor/@jinn-network/sdk/dist/solvernets/swe-rebench-v2.js +2 -0
  933. package/dist/vendor/@jinn-network/sdk/dist/swe-rebench-v2.d.ts +66 -0
  934. package/dist/vendor/@jinn-network/sdk/dist/swe-rebench-v2.js +44 -0
  935. package/dist/vendor/@jinn-network/sdk/dist/types.d.ts +116 -0
  936. package/dist/vendor/@jinn-network/sdk/dist/types.js +21 -0
  937. package/dist/vendor/@jinn-network/sdk/package.json +43 -0
  938. package/dist/venues/hyperliquid/account-value.d.ts +1 -1
  939. package/dist/venues/hyperliquid/account-value.js +1 -1
  940. package/dist/venues/polymarket/client.d.ts +77 -0
  941. package/dist/venues/polymarket/client.js +309 -0
  942. package/dist/venues/polymarket/client.js.map +1 -0
  943. package/dist/withdraw/run-withdraw-plan.js +0 -2
  944. package/dist/withdraw/run-withdraw-plan.js.map +1 -1
  945. package/dist/x402/acquire.d.ts +14 -3
  946. package/dist/x402/acquire.js +28 -11
  947. package/dist/x402/acquire.js.map +1 -1
  948. package/dist/x402/handler.d.ts +15 -3
  949. package/dist/x402/handler.js +67 -24
  950. package/dist/x402/handler.js.map +1 -1
  951. package/package.json +46 -15
  952. package/plugins/claude-code-learner/.claude-plugin/plugin.json +9 -0
  953. package/plugins/claude-code-learner/AGENTS.md +31 -0
  954. package/plugins/claude-code-learner/CLAUDE.md +33 -0
  955. package/plugins/claude-code-learner/README.md +57 -0
  956. package/plugins/claude-code-learner/hooks/hooks.json +16 -0
  957. package/plugins/claude-code-learner/hooks/session-start +38 -0
  958. package/plugins/claude-code-learner/skills/learn/SKILL.md +405 -0
  959. package/plugins/claude-code-learner/skills/learn/analyst-prompt.md +68 -0
  960. package/plugins/claude-code-learner/skills/learn/consolidator-prompt.md +94 -0
  961. package/plugins/claude-code-learner/skills/learn/explorer-prompt.md +53 -0
  962. package/plugins/claude-code-learner/skills/learn/planner-prompt.md +87 -0
  963. package/plugins/claude-code-learner/skills/learn/promoter-prompt.md +113 -0
  964. package/plugins/claude-code-learner/skills/learn/step-worker-prompt.md +47 -0
  965. package/plugins/claude-code-learner/skills/learn/strategist-prompt.md +85 -0
  966. package/plugins/jinn-prediction-plugin/.claude-plugin/plugin.json +19 -0
  967. package/plugins/jinn-prediction-plugin/.mcp.json +8 -0
  968. package/plugins/jinn-prediction-plugin/GEMINI.md +7 -0
  969. package/plugins/jinn-prediction-plugin/gemini-extension.json +13 -0
  970. package/plugins/jinn-prediction-plugin/jinn.plugin.json +26 -0
  971. package/plugins/jinn-prediction-plugin/mcp/polymarket-server.mjs +322 -0
  972. package/plugins/jinn-prediction-plugin/schemas/prediction-v0-solution.schema.json +12 -0
  973. package/plugins/jinn-prediction-plugin/schemas/prediction-v0-task.schema.json +25 -0
  974. package/plugins/jinn-prediction-plugin/schemas/prediction-v0-verdict.schema.json +11 -0
  975. package/plugins/jinn-prediction-plugin/schemas/prediction-v1-solution.schema.json +34 -0
  976. package/plugins/jinn-prediction-plugin/schemas/prediction-v1-task.schema.json +118 -0
  977. package/plugins/jinn-prediction-plugin/schemas/prediction-v1-verdict.schema.json +84 -0
  978. package/plugins/jinn-prediction-plugin/skills/base-rate-forecasting/SKILL.md +3 -0
  979. package/plugins/jinn-prediction-plugin/skills/calibration/SKILL.md +3 -0
  980. package/plugins/jinn-prediction-plugin/skills/common-biases/SKILL.md +3 -0
  981. package/plugins/jinn-prediction-plugin/skills/polymarket-task-handling/SKILL.md +5 -0
  982. package/plugins/jinn-prediction-plugin/skills/prediction-corpus-retrieval/SKILL.md +35 -0
  983. package/plugins/network-tools/.claude-plugin/plugin.json +12 -0
  984. package/plugins/network-tools/jinn.plugin.json +29 -0
  985. package/plugins/network-tools/mcp/jinn-client-server.mjs +110 -0
  986. package/plugins/swe-rebench-v2-runtime/.claude-plugin/plugin.json +9 -0
  987. package/plugins/swe-rebench-v2-runtime/README.md +11 -0
  988. package/plugins/swe-rebench-v2-runtime/jinn.plugin.json +12 -0
  989. package/plugins/swe-rebench-v2-runtime/skills/orient/SKILL.md +25 -0
  990. package/plugins/swe-rebench-v2-runtime/skills/plan/SKILL.md +24 -0
  991. package/skills/jinn-operator/SKILL.md +120 -101
  992. package/templates/harnesses/alternative-harness/README.md.tmpl +44 -0
  993. package/templates/harnesses/alternative-harness/gitignore.tmpl +3 -0
  994. package/templates/harnesses/alternative-harness/jinn.manifest.json.tmpl +22 -0
  995. package/templates/harnesses/alternative-harness/package.json.tmpl +26 -0
  996. package/templates/harnesses/alternative-harness/src/coordinator.ts.tmpl +50 -0
  997. package/templates/harnesses/alternative-harness/src/harness.ts.tmpl +31 -0
  998. package/templates/harnesses/alternative-harness/src/index.ts.tmpl +44 -0
  999. package/templates/harnesses/alternative-harness/src/mock-harness.ts.tmpl +41 -0
  1000. package/templates/harnesses/alternative-harness/src/phases/debrief.ts.tmpl +28 -0
  1001. package/templates/harnesses/alternative-harness/src/phases/execute.ts.tmpl +33 -0
  1002. package/templates/harnesses/alternative-harness/src/phases/improve.ts.tmpl +31 -0
  1003. package/templates/harnesses/alternative-harness/src/phases/memory.ts.tmpl +31 -0
  1004. package/templates/harnesses/alternative-harness/src/phases/orient.ts.tmpl +21 -0
  1005. package/templates/harnesses/alternative-harness/src/phases/plan.ts.tmpl +25 -0
  1006. package/templates/harnesses/alternative-harness/src/phases/strategize.ts.tmpl +29 -0
  1007. package/templates/harnesses/alternative-harness/test/coordinator.test.ts.tmpl +53 -0
  1008. package/templates/harnesses/alternative-harness/test/unit.test.ts.tmpl +55 -0
  1009. package/templates/harnesses/alternative-harness/tsconfig.json.tmpl +16 -0
  1010. package/templates/harnesses/evaluator/README.md.tmpl +36 -0
  1011. package/templates/harnesses/evaluator/gitignore.tmpl +3 -0
  1012. package/templates/harnesses/evaluator/jinn.manifest.json.tmpl +22 -0
  1013. package/templates/harnesses/evaluator/package.json.tmpl +26 -0
  1014. package/templates/harnesses/evaluator/src/index.ts.tmpl +35 -0
  1015. package/templates/harnesses/evaluator/test/unit.test.ts.tmpl +49 -0
  1016. package/templates/harnesses/evaluator/tsconfig.json.tmpl +16 -0
  1017. package/templates/harnesses/forecaster/README.md.tmpl +25 -0
  1018. package/templates/harnesses/forecaster/gitignore.tmpl +5 -0
  1019. package/templates/harnesses/forecaster/jinn.manifest.json.tmpl +22 -0
  1020. package/templates/harnesses/forecaster/package.json.tmpl +26 -0
  1021. package/templates/harnesses/forecaster/src/index.ts.tmpl +33 -0
  1022. package/templates/harnesses/forecaster/test/unit.test.ts.tmpl +42 -0
  1023. package/templates/harnesses/forecaster/tsconfig.json.tmpl +16 -0
  1024. package/dist/adapters/claim-registry/abi.d.ts +0 -127
  1025. package/dist/adapters/claim-registry/abi.js +0 -93
  1026. package/dist/adapters/claim-registry/abi.js.map +0 -1
  1027. package/dist/adapters/claim-registry/client.d.ts +0 -89
  1028. package/dist/adapters/claim-registry/client.js +0 -205
  1029. package/dist/adapters/claim-registry/client.js.map +0 -1
  1030. package/dist/adapters/mech/claim-policy.d.ts +0 -40
  1031. package/dist/adapters/mech/claim-policy.js +0 -104
  1032. package/dist/adapters/mech/claim-policy.js.map +0 -1
  1033. package/dist/bin/jinn-mcp.d.ts +0 -2
  1034. package/dist/bin/jinn-mcp.js +0 -10
  1035. package/dist/bin/jinn-mcp.js.map +0 -1
  1036. package/dist/cli/commands/intents.d.ts +0 -17
  1037. package/dist/cli/commands/intents.js +0 -489
  1038. package/dist/cli/commands/intents.js.map +0 -1
  1039. package/dist/cli/commands/plugin-install.js +0 -803
  1040. package/dist/cli/commands/plugin-install.js.map +0 -1
  1041. package/dist/cli/commands/submit-intent.js +0 -245
  1042. package/dist/cli/commands/submit-intent.js.map +0 -1
  1043. package/dist/cli/intent-registry-access.d.ts +0 -62
  1044. package/dist/cli/intent-registry-access.js +0 -165
  1045. package/dist/cli/intent-registry-access.js.map +0 -1
  1046. package/dist/discovery/registry.d.ts +0 -97
  1047. package/dist/discovery/registry.js +0 -177
  1048. package/dist/discovery/registry.js.map +0 -1
  1049. package/dist/discovery/subgraph.d.ts +0 -37
  1050. package/dist/discovery/subgraph.js +0 -87
  1051. package/dist/discovery/subgraph.js.map +0 -1
  1052. package/dist/intents/kinds/constants.d.ts +0 -5
  1053. package/dist/intents/kinds/constants.js +0 -6
  1054. package/dist/intents/kinds/constants.js.map +0 -1
  1055. package/dist/intents/kinds/index.d.ts +0 -28
  1056. package/dist/intents/kinds/index.js +0 -50
  1057. package/dist/intents/kinds/index.js.map +0 -1
  1058. package/dist/intents/kinds/portfolio-v0.d.ts +0 -2
  1059. package/dist/intents/kinds/portfolio-v0.js +0 -13
  1060. package/dist/intents/kinds/portfolio-v0.js.map +0 -1
  1061. package/dist/intents/kinds/prediction-apy-v0.d.ts +0 -3
  1062. package/dist/intents/kinds/prediction-apy-v0.js +0 -21
  1063. package/dist/intents/kinds/prediction-apy-v0.js.map +0 -1
  1064. package/dist/intents/kinds/prediction-v0.d.ts +0 -3
  1065. package/dist/intents/kinds/prediction-v0.js +0 -32
  1066. package/dist/intents/kinds/prediction-v0.js.map +0 -1
  1067. package/dist/intents/kinds/spec-kind.d.ts +0 -38
  1068. package/dist/intents/kinds/spec-kind.js +0 -6
  1069. package/dist/intents/kinds/spec-kind.js.map +0 -1
  1070. package/dist/intents/posting-service.d.ts +0 -26
  1071. package/dist/intents/posting-service.js +0 -218
  1072. package/dist/intents/posting-service.js.map +0 -1
  1073. package/dist/intents/prediction-apy-v0-auto.d.ts +0 -11
  1074. package/dist/intents/prediction-apy-v0-auto.js +0 -46
  1075. package/dist/intents/prediction-apy-v0-auto.js.map +0 -1
  1076. package/dist/intents/prediction-apy-v0-template.d.ts +0 -8
  1077. package/dist/intents/prediction-apy-v0-template.js +0 -22
  1078. package/dist/intents/prediction-apy-v0-template.js.map +0 -1
  1079. package/dist/intents/prediction-v0-auto.d.ts +0 -53
  1080. package/dist/intents/prediction-v0-auto.js +0 -84
  1081. package/dist/intents/prediction-v0-auto.js.map +0 -1
  1082. package/dist/intents/prediction-v0-template.d.ts +0 -70
  1083. package/dist/intents/prediction-v0-template.js +0 -145
  1084. package/dist/intents/prediction-v0-template.js.map +0 -1
  1085. package/dist/intents/sources.d.ts +0 -39
  1086. package/dist/intents/sources.js +0 -42
  1087. package/dist/intents/sources.js.map +0 -1
  1088. package/dist/restorer/engine/canonical-json.d.ts +0 -18
  1089. package/dist/restorer/engine/canonical-json.js +0 -59
  1090. package/dist/restorer/engine/canonical-json.js.map +0 -1
  1091. package/dist/restorer/engine/claim.d.ts +0 -69
  1092. package/dist/restorer/engine/claim.js +0 -104
  1093. package/dist/restorer/engine/claim.js.map +0 -1
  1094. package/dist/restorer/engine/delivery.d.ts +0 -52
  1095. package/dist/restorer/engine/delivery.js +0 -63
  1096. package/dist/restorer/engine/delivery.js.map +0 -1
  1097. package/dist/restorer/engine/engine.d.ts +0 -213
  1098. package/dist/restorer/engine/engine.js +0 -769
  1099. package/dist/restorer/engine/engine.js.map +0 -1
  1100. package/dist/restorer/engine/manifest-assembly.d.ts +0 -67
  1101. package/dist/restorer/engine/manifest-assembly.js +0 -79
  1102. package/dist/restorer/engine/manifest-assembly.js.map +0 -1
  1103. package/dist/restorer/engine/packaging.d.ts +0 -87
  1104. package/dist/restorer/engine/packaging.js +0 -350
  1105. package/dist/restorer/engine/packaging.js.map +0 -1
  1106. package/dist/restorer/engine/persistence.d.ts +0 -170
  1107. package/dist/restorer/engine/persistence.js +0 -381
  1108. package/dist/restorer/engine/persistence.js.map +0 -1
  1109. package/dist/restorer/engine/recovery.d.ts +0 -22
  1110. package/dist/restorer/engine/recovery.js +0 -24
  1111. package/dist/restorer/engine/recovery.js.map +0 -1
  1112. package/dist/restorer/engine/registry.d.ts +0 -62
  1113. package/dist/restorer/engine/registry.js +0 -73
  1114. package/dist/restorer/engine/registry.js.map +0 -1
  1115. package/dist/restorer/engine/signing.d.ts +0 -30
  1116. package/dist/restorer/engine/signing.js +0 -39
  1117. package/dist/restorer/engine/signing.js.map +0 -1
  1118. package/dist/restorer/engine/state.d.ts +0 -42
  1119. package/dist/restorer/engine/state.js +0 -87
  1120. package/dist/restorer/engine/state.js.map +0 -1
  1121. package/dist/restorer/impls/claude-mcp-hyperliquid/api-wallet.d.ts +0 -64
  1122. package/dist/restorer/impls/claude-mcp-hyperliquid/api-wallet.js.map +0 -1
  1123. package/dist/restorer/impls/claude-mcp-hyperliquid/index.d.ts +0 -104
  1124. package/dist/restorer/impls/claude-mcp-hyperliquid/index.js +0 -721
  1125. package/dist/restorer/impls/claude-mcp-hyperliquid/index.js.map +0 -1
  1126. package/dist/restorer/impls/claude-mcp-hyperliquid/mcp-tools.js.map +0 -1
  1127. package/dist/restorer/impls/claude-mcp-hyperliquid/safety-rails.js.map +0 -1
  1128. package/dist/restorer/impls/claude-mcp-hyperliquid/session-orchestrator.d.ts +0 -97
  1129. package/dist/restorer/impls/claude-mcp-hyperliquid/session-orchestrator.js +0 -226
  1130. package/dist/restorer/impls/claude-mcp-hyperliquid/session-orchestrator.js.map +0 -1
  1131. package/dist/restorer/impls/claude-mcp-prediction/index.d.ts +0 -44
  1132. package/dist/restorer/impls/claude-mcp-prediction/index.js +0 -239
  1133. package/dist/restorer/impls/claude-mcp-prediction/index.js.map +0 -1
  1134. package/dist/restorer/impls/claude-mcp-prediction/mcp-tools.js +0 -135
  1135. package/dist/restorer/impls/claude-mcp-prediction/mcp-tools.js.map +0 -1
  1136. package/dist/restorer/impls/claude-mcp-prediction/prompt.d.ts +0 -8
  1137. package/dist/restorer/impls/claude-mcp-prediction/prompt.js +0 -54
  1138. package/dist/restorer/impls/claude-mcp-prediction/prompt.js.map +0 -1
  1139. package/dist/restorer/impls/claude-mcp-prediction/session-orchestrator.d.ts +0 -36
  1140. package/dist/restorer/impls/claude-mcp-prediction/session-orchestrator.js +0 -137
  1141. package/dist/restorer/impls/claude-mcp-prediction/session-orchestrator.js.map +0 -1
  1142. package/dist/restorer/impls/claude-mcp-prediction/types.d.ts +0 -84
  1143. package/dist/restorer/impls/claude-mcp-prediction/types.js +0 -6
  1144. package/dist/restorer/impls/claude-mcp-prediction/types.js.map +0 -1
  1145. package/dist/restorer/impls/claude-mcp-prediction-apy/index.d.ts +0 -34
  1146. package/dist/restorer/impls/claude-mcp-prediction-apy/index.js +0 -233
  1147. package/dist/restorer/impls/claude-mcp-prediction-apy/index.js.map +0 -1
  1148. package/dist/restorer/impls/claude-mcp-prediction-apy/mcp-tools.js +0 -136
  1149. package/dist/restorer/impls/claude-mcp-prediction-apy/mcp-tools.js.map +0 -1
  1150. package/dist/restorer/impls/claude-mcp-prediction-apy/prompt.d.ts +0 -7
  1151. package/dist/restorer/impls/claude-mcp-prediction-apy/prompt.js +0 -46
  1152. package/dist/restorer/impls/claude-mcp-prediction-apy/prompt.js.map +0 -1
  1153. package/dist/restorer/impls/claude-mcp-prediction-apy/session-orchestrator.d.ts +0 -27
  1154. package/dist/restorer/impls/claude-mcp-prediction-apy/session-orchestrator.js +0 -128
  1155. package/dist/restorer/impls/claude-mcp-prediction-apy/session-orchestrator.js.map +0 -1
  1156. package/dist/restorer/impls/claude-mcp-prediction-apy/types.d.ts +0 -64
  1157. package/dist/restorer/impls/claude-mcp-prediction-apy/types.js +0 -6
  1158. package/dist/restorer/impls/claude-mcp-prediction-apy/types.js.map +0 -1
  1159. package/dist/restorer/impls/evaluation-context.d.ts +0 -16
  1160. package/dist/restorer/impls/evaluation-context.js +0 -18
  1161. package/dist/restorer/impls/evaluation-context.js.map +0 -1
  1162. package/dist/restorer/impls/index.d.ts +0 -46
  1163. package/dist/restorer/impls/index.js +0 -88
  1164. package/dist/restorer/impls/index.js.map +0 -1
  1165. package/dist/restorer/impls/legacy-claude/index.d.ts +0 -52
  1166. package/dist/restorer/impls/legacy-claude/index.js +0 -140
  1167. package/dist/restorer/impls/legacy-claude/index.js.map +0 -1
  1168. package/dist/restorer/impls/portfolio-v0-evaluator/canonical-metrics.d.ts +0 -68
  1169. package/dist/restorer/impls/portfolio-v0-evaluator/canonical-metrics.js +0 -117
  1170. package/dist/restorer/impls/portfolio-v0-evaluator/canonical-metrics.js.map +0 -1
  1171. package/dist/restorer/impls/portfolio-v0-evaluator/checks/availability.js.map +0 -1
  1172. package/dist/restorer/impls/portfolio-v0-evaluator/checks/consistency.d.ts +0 -78
  1173. package/dist/restorer/impls/portfolio-v0-evaluator/checks/consistency.js +0 -274
  1174. package/dist/restorer/impls/portfolio-v0-evaluator/checks/consistency.js.map +0 -1
  1175. package/dist/restorer/impls/portfolio-v0-evaluator/checks/eligibility.d.ts +0 -23
  1176. package/dist/restorer/impls/portfolio-v0-evaluator/checks/eligibility.js +0 -49
  1177. package/dist/restorer/impls/portfolio-v0-evaluator/checks/eligibility.js.map +0 -1
  1178. package/dist/restorer/impls/portfolio-v0-evaluator/checks/integrity.d.ts +0 -25
  1179. package/dist/restorer/impls/portfolio-v0-evaluator/checks/integrity.js +0 -44
  1180. package/dist/restorer/impls/portfolio-v0-evaluator/checks/integrity.js.map +0 -1
  1181. package/dist/restorer/impls/portfolio-v0-evaluator/checks/spec.d.ts +0 -17
  1182. package/dist/restorer/impls/portfolio-v0-evaluator/checks/spec.js +0 -43
  1183. package/dist/restorer/impls/portfolio-v0-evaluator/checks/spec.js.map +0 -1
  1184. package/dist/restorer/impls/portfolio-v0-evaluator/index.d.ts +0 -44
  1185. package/dist/restorer/impls/portfolio-v0-evaluator/index.js +0 -440
  1186. package/dist/restorer/impls/portfolio-v0-evaluator/index.js.map +0 -1
  1187. package/dist/restorer/impls/portfolio-v0-evaluator/score.js.map +0 -1
  1188. package/dist/restorer/impls/portfolio-v0-evaluator/types.d.ts +0 -34
  1189. package/dist/restorer/impls/portfolio-v0-evaluator/types.js.map +0 -1
  1190. package/dist/restorer/impls/prediction-apy-v0-baseline/index.d.ts +0 -40
  1191. package/dist/restorer/impls/prediction-apy-v0-baseline/index.js +0 -107
  1192. package/dist/restorer/impls/prediction-apy-v0-baseline/index.js.map +0 -1
  1193. package/dist/restorer/impls/prediction-apy-v0-baseline/strategy.js.map +0 -1
  1194. package/dist/restorer/impls/prediction-apy-v0-baseline/types.js.map +0 -1
  1195. package/dist/restorer/impls/prediction-apy-v0-evaluator/canonical-metrics.d.ts +0 -6
  1196. package/dist/restorer/impls/prediction-apy-v0-evaluator/canonical-metrics.js +0 -11
  1197. package/dist/restorer/impls/prediction-apy-v0-evaluator/canonical-metrics.js.map +0 -1
  1198. package/dist/restorer/impls/prediction-apy-v0-evaluator/index.d.ts +0 -42
  1199. package/dist/restorer/impls/prediction-apy-v0-evaluator/index.js +0 -208
  1200. package/dist/restorer/impls/prediction-apy-v0-evaluator/index.js.map +0 -1
  1201. package/dist/restorer/impls/prediction-apy-v0-evaluator/parse-submission.d.ts +0 -7
  1202. package/dist/restorer/impls/prediction-apy-v0-evaluator/parse-submission.js +0 -29
  1203. package/dist/restorer/impls/prediction-apy-v0-evaluator/parse-submission.js.map +0 -1
  1204. package/dist/restorer/impls/prediction-apy-v0-evaluator/score.js.map +0 -1
  1205. package/dist/restorer/impls/prediction-apy-v0-evaluator/types.js.map +0 -1
  1206. package/dist/restorer/impls/prediction-v0-baseline/index.d.ts +0 -31
  1207. package/dist/restorer/impls/prediction-v0-baseline/index.js +0 -100
  1208. package/dist/restorer/impls/prediction-v0-baseline/index.js.map +0 -1
  1209. package/dist/restorer/impls/prediction-v0-baseline/strategy.d.ts +0 -8
  1210. package/dist/restorer/impls/prediction-v0-baseline/strategy.js +0 -41
  1211. package/dist/restorer/impls/prediction-v0-baseline/strategy.js.map +0 -1
  1212. package/dist/restorer/impls/prediction-v0-baseline/types.d.ts +0 -7
  1213. package/dist/restorer/impls/prediction-v0-baseline/types.js.map +0 -1
  1214. package/dist/restorer/impls/prediction-v0-evaluator/canonical-metrics.d.ts +0 -20
  1215. package/dist/restorer/impls/prediction-v0-evaluator/canonical-metrics.js.map +0 -1
  1216. package/dist/restorer/impls/prediction-v0-evaluator/checks/availability.d.ts +0 -9
  1217. package/dist/restorer/impls/prediction-v0-evaluator/checks/availability.js.map +0 -1
  1218. package/dist/restorer/impls/prediction-v0-evaluator/checks/eligibility.d.ts +0 -3
  1219. package/dist/restorer/impls/prediction-v0-evaluator/checks/eligibility.js.map +0 -1
  1220. package/dist/restorer/impls/prediction-v0-evaluator/checks/integrity.d.ts +0 -13
  1221. package/dist/restorer/impls/prediction-v0-evaluator/checks/integrity.js +0 -111
  1222. package/dist/restorer/impls/prediction-v0-evaluator/checks/integrity.js.map +0 -1
  1223. package/dist/restorer/impls/prediction-v0-evaluator/checks/spec.d.ts +0 -5
  1224. package/dist/restorer/impls/prediction-v0-evaluator/checks/spec.js.map +0 -1
  1225. package/dist/restorer/impls/prediction-v0-evaluator/index.d.ts +0 -36
  1226. package/dist/restorer/impls/prediction-v0-evaluator/index.js +0 -234
  1227. package/dist/restorer/impls/prediction-v0-evaluator/index.js.map +0 -1
  1228. package/dist/restorer/impls/prediction-v0-evaluator/score.js.map +0 -1
  1229. package/dist/restorer/impls/prediction-v0-evaluator/types.js.map +0 -1
  1230. package/dist/restorer/types.d.ts +0 -194
  1231. package/dist/restorer/types.js +0 -28
  1232. package/dist/restorer/types.js.map +0 -1
  1233. package/dist/types/desired-state.d.ts +0 -94
  1234. package/dist/types/desired-state.js +0 -36
  1235. package/dist/types/desired-state.js.map +0 -1
  1236. /package/dist/cli/commands/{plugin-install.d.ts → solver-nets.d.ts} +0 -0
  1237. /package/dist/cli/commands/{submit-intent.d.ts → tasks.d.ts} +0 -0
  1238. /package/dist/{restorer/impls/prediction-apy-v0-baseline → harnesses/impls/claude-code-learner}/types.js +0 -0
  1239. /package/dist/{restorer → harnesses}/impls/claude-mcp-hyperliquid/api-wallet.js +0 -0
  1240. /package/dist/{restorer → harnesses}/impls/claude-mcp-hyperliquid/mcp-tools.d.ts +0 -0
  1241. /package/dist/{restorer → harnesses}/impls/claude-mcp-hyperliquid/mcp-tools.js +0 -0
  1242. /package/dist/{restorer → harnesses}/impls/claude-mcp-hyperliquid/safety-rails.d.ts +0 -0
  1243. /package/dist/{restorer → harnesses}/impls/claude-mcp-hyperliquid/safety-rails.js +0 -0
  1244. /package/dist/{restorer → harnesses}/impls/claude-mcp-prediction/mcp-tools.d.ts +0 -0
  1245. /package/dist/{restorer → harnesses}/impls/claude-mcp-prediction-apy/mcp-tools.d.ts +0 -0
  1246. /package/dist/{restorer → harnesses}/impls/portfolio-v0-evaluator/checks/availability.d.ts +0 -0
  1247. /package/dist/{restorer → harnesses}/impls/portfolio-v0-evaluator/checks/availability.js +0 -0
  1248. /package/dist/{restorer → harnesses}/impls/portfolio-v0-evaluator/score.d.ts +0 -0
  1249. /package/dist/{restorer → harnesses}/impls/portfolio-v0-evaluator/score.js +0 -0
  1250. /package/dist/{restorer → harnesses}/impls/portfolio-v0-evaluator/types.js +0 -0
  1251. /package/dist/{restorer → harnesses}/impls/prediction-apy-v0-baseline/strategy.d.ts +0 -0
  1252. /package/dist/{restorer → harnesses}/impls/prediction-apy-v0-baseline/strategy.js +0 -0
  1253. /package/dist/{restorer → harnesses}/impls/prediction-apy-v0-baseline/types.d.ts +0 -0
  1254. /package/dist/{restorer/impls/prediction-apy-v0-evaluator → harnesses/impls/prediction-apy-v0-baseline}/types.js +0 -0
  1255. /package/dist/{restorer → harnesses}/impls/prediction-apy-v0-evaluator/score.d.ts +0 -0
  1256. /package/dist/{restorer → harnesses}/impls/prediction-apy-v0-evaluator/score.js +0 -0
  1257. /package/dist/{restorer → harnesses}/impls/prediction-apy-v0-evaluator/types.d.ts +0 -0
  1258. /package/dist/{restorer/impls/prediction-v0-baseline → harnesses/impls/prediction-apy-v0-evaluator}/types.js +0 -0
  1259. /package/dist/{restorer/impls/prediction-v0-evaluator → harnesses/impls/prediction-v0-baseline}/types.js +0 -0
  1260. /package/dist/{restorer → harnesses}/impls/prediction-v0-evaluator/canonical-metrics.js +0 -0
  1261. /package/dist/{restorer → harnesses}/impls/prediction-v0-evaluator/checks/availability.js +0 -0
  1262. /package/dist/{restorer → harnesses}/impls/prediction-v0-evaluator/checks/eligibility.js +0 -0
  1263. /package/dist/{restorer → harnesses}/impls/prediction-v0-evaluator/checks/spec.js +0 -0
  1264. /package/dist/{restorer → harnesses}/impls/prediction-v0-evaluator/score.d.ts +0 -0
  1265. /package/dist/{restorer → harnesses}/impls/prediction-v0-evaluator/score.js +0 -0
  1266. /package/dist/{restorer → harnesses}/impls/prediction-v0-evaluator/types.d.ts +0 -0
@@ -0,0 +1,1023 @@
1
+ import { randomUUID } from 'node:crypto';
2
+ import { z } from 'zod';
3
+ import { getSolverNetContract, } from '../vendor/@jinn-network/sdk/dist/solvernets/index.js';
4
+ import { DraftSolverNetRecordSchema, LaunchedSolverNetRecordSchema, } from '../solvernets/store.js';
5
+ import { signManifest, } from '../solvernets/manifest.js';
6
+ // ── Draft CRUD validation schemas ──────────────────────────────────────────
7
+ // Zod schema for the editable subset of a draft. Mirrors
8
+ // `DraftSolverNetRecordSchema` from the store but drops the
9
+ // store-managed fields (`schemaVersion`, `draftId`, `createdAt`,
10
+ // `updatedAt`, `completedSteps` is editable by the UI).
11
+ //
12
+ // All fields are optional — POST with `{}` produces an empty draft, PATCH
13
+ // of a single field updates only that field. Wrong types → Zod fails fast,
14
+ // the route returns 400 with a structured error.
15
+ const DraftEditableSchema = z
16
+ .object({
17
+ templateContractId: z.string().optional(),
18
+ templateContractVersion: z.string().optional(),
19
+ name: z.string().optional(),
20
+ description: z.string().optional(),
21
+ generatorConfig: z.record(z.string(), z.unknown()).optional(),
22
+ solutionPriceWei: z.string().optional(),
23
+ verdictPriceWei: z.string().optional(),
24
+ openRoles: z.array(z.enum(['solver', 'evaluator'])).optional(),
25
+ completedSteps: z
26
+ .array(z.enum(['define', 'reviewContract', 'configureGenerator', 'configurePricing']))
27
+ .optional(),
28
+ })
29
+ .strict();
30
+ // Fields the API explicitly forbids in a request body. Surfaced here so the
31
+ // 400 message can name them rather than relying on `.strict()`'s generic
32
+ // "Unrecognized key" wording (which doesn't tell the SPA *why* a field is
33
+ // rejected — these are immutable, not just unknown).
34
+ const IMMUTABLE_FIELDS = ['draftId', 'createdAt', 'updatedAt', 'schemaVersion'];
35
+ function rejectImmutableFields(body) {
36
+ if (typeof body !== 'object' || body === null)
37
+ return null;
38
+ for (const f of IMMUTABLE_FIELDS) {
39
+ if (f in body) {
40
+ return { error: `\`${f}\` is immutable and cannot be set via the API`, field: f };
41
+ }
42
+ }
43
+ return null;
44
+ }
45
+ function applyEditable(current, patch, now) {
46
+ const next = { ...current, updatedAt: now };
47
+ // Only assign keys that are explicitly present in the patch object so that
48
+ // PATCH `{ name: 'x' }` doesn't clear `description` etc. The Zod schema's
49
+ // `.optional()` would let `undefined` slip through, hence the explicit
50
+ // `key in patch` check below.
51
+ if ('templateContractId' in patch)
52
+ next.templateContractId = patch.templateContractId;
53
+ if ('templateContractVersion' in patch)
54
+ next.templateContractVersion = patch.templateContractVersion;
55
+ if ('name' in patch)
56
+ next.name = patch.name;
57
+ if ('description' in patch)
58
+ next.description = patch.description;
59
+ if ('generatorConfig' in patch)
60
+ next.generatorConfig = patch.generatorConfig;
61
+ if ('solutionPriceWei' in patch)
62
+ next.solutionPriceWei = patch.solutionPriceWei;
63
+ if ('verdictPriceWei' in patch)
64
+ next.verdictPriceWei = patch.verdictPriceWei;
65
+ if ('openRoles' in patch)
66
+ next.openRoles = patch.openRoles;
67
+ if ('completedSteps' in patch && patch.completedSteps !== undefined) {
68
+ next.completedSteps = patch.completedSteps;
69
+ }
70
+ return next;
71
+ }
72
+ // ── Catalog query-string schemas (Task 15) ──────────────────────────────────
73
+ /**
74
+ * Status filter shared by `/launched` (owned-list) and `/registry`
75
+ * (global-list). The owned-list also accepts `launching`/`failed` because
76
+ * those are local-only states that never make it to the registry; the
77
+ * registry list is restricted to lifecycle-broadcast states.
78
+ */
79
+ const OwnedStatusFilterSchema = z.enum([
80
+ 'launching',
81
+ 'launched',
82
+ 'paused',
83
+ 'retired',
84
+ 'failed',
85
+ ]);
86
+ const RegistryStatusFilterSchema = z.enum(['launched', 'paused', 'retired']);
87
+ /**
88
+ * Loose CIDv0 / CIDv1 sniff. We are not validating the full multihash —
89
+ * that is the registry client's job — but rejecting trivial garbage here
90
+ * (slashes from path traversal, hyphens, empty strings) keeps the IPFS
91
+ * round-trip away from obvious attacks. CIDv0 = `Qm` + base58btc; CIDv1 in
92
+ * the dag-pb codec we use here is base32-lower and starts with `bafy`.
93
+ *
94
+ * We accept any sufficiently-long alphanumeric tail without enforcing the
95
+ * exact alphabet — the registry client's hash check against the on-chain
96
+ * advertised hash is the canonical gate; this regex only filters obviously
97
+ * non-CID inputs.
98
+ */
99
+ // CIDv0 (Qm-base58) or CIDv1 (any multicodec — multibase prefix `b` is
100
+ // base32 lowercase alphanumeric). Earlier this regex anchored to `bafy`,
101
+ // the dag-pb codec prefix; the IPFS adapter actually pins manifests as
102
+ // raw bytes (codec `raw`), producing `bafkrei...`. See jinn-mono-wkzp.
103
+ // Loose by design — the registry client does the canonical decode. This only
104
+ // blocks obviously invalid/path-like input before an IPFS round-trip.
105
+ const CID_SHAPE_REGEX = /^(Qm[A-Za-z0-9]{10,}|b[A-Za-z0-9]{10,})$/u;
106
+ // ── Lifecycle / generator-config validation schemas ─────────────────────────
107
+ const LifecycleBodySchema = z
108
+ .object({
109
+ target: z.enum(['paused', 'launched', 'retired']),
110
+ })
111
+ .strict();
112
+ /**
113
+ * Zod schema mirroring `PredictionV1GeneratorRuntimeConfig` from
114
+ * `solver-types/prediction-v1-auto.ts`. Kept narrow on purpose: only fields
115
+ * the operator can hot-apply are accepted. Static-config fields (agent
116
+ * identity, transport URLs) live in the daemon's static-config block and
117
+ * are never mutated through this endpoint.
118
+ *
119
+ * `.strict()` rejects unknown keys so a typo in the SPA surfaces as 400
120
+ * rather than silently dropping the field.
121
+ */
122
+ const GeneratorConfigPatchSchema = z
123
+ .object({
124
+ cadenceMs: z.number().int().nonnegative().optional(),
125
+ maxNewRoundsPerPoll: z.number().int().nonnegative().optional(),
126
+ maxNewRoundsPerDay: z.number().int().nonnegative().optional(),
127
+ maxOpenRounds: z.number().int().nonnegative().optional(),
128
+ submissionWindowMs: z.number().int().nonnegative().optional(),
129
+ allowlistConditionIds: z.array(z.string()).optional(),
130
+ blocklistConditionIds: z.array(z.string()).optional(),
131
+ minTimeToResolutionHours: z.number().nonnegative().optional(),
132
+ maxTimeToResolutionHours: z.number().nonnegative().optional(),
133
+ minLiquidityUsd: z.string().optional(),
134
+ minVolume24hUsd: z.string().optional(),
135
+ maxYesSpread: z.string().optional(),
136
+ maxOrderbookAgeSeconds: z.number().int().nonnegative().optional(),
137
+ })
138
+ .strict();
139
+ /**
140
+ * Inspect a draft to determine whether it is launchable. The launch endpoint
141
+ * uses this gate (and the gate alone) to decide whether to proceed; field-
142
+ * shape validation has already happened on every PATCH.
143
+ */
144
+ function checkDraftCompleteness(draft) {
145
+ const missing = [];
146
+ if (!draft.name || draft.name.trim().length === 0)
147
+ missing.push('name');
148
+ if (draft.description === undefined || draft.description === null)
149
+ missing.push('description');
150
+ if (!draft.templateContractId)
151
+ missing.push('templateContractId');
152
+ if (!draft.templateContractVersion)
153
+ missing.push('templateContractVersion');
154
+ if (!draft.solutionPriceWei)
155
+ missing.push('solutionPriceWei');
156
+ if (!draft.verdictPriceWei)
157
+ missing.push('verdictPriceWei');
158
+ if (!draft.openRoles || draft.openRoles.length === 0)
159
+ missing.push('openRoles');
160
+ return { ok: missing.length === 0, missingFields: missing };
161
+ }
162
+ /**
163
+ * Build an `UnsignedSolverNetManifestV1` from a launchable draft + the
164
+ * configured launcher identity + the SDK contract template. Caller signs
165
+ * the result and hands it to `LaunchAction.launch`.
166
+ *
167
+ * `solverNetId` is derived from the launcher agentId + a stable suffix
168
+ * derived from the draftId so re-launching the same draft would collide
169
+ * (idempotency) — but because we delete drafts post-launch, in practice each
170
+ * draft launches once and the id is unique.
171
+ */
172
+ function buildUnsignedManifest(args) {
173
+ const { draft, launcher, network, now } = args;
174
+ const contract = getSolverNetContract({
175
+ id: draft.templateContractId,
176
+ version: draft.templateContractVersion,
177
+ });
178
+ if (!contract) {
179
+ return {
180
+ ok: false,
181
+ error: `unknown contract template ${draft.templateContractId}.${draft.templateContractVersion}`,
182
+ };
183
+ }
184
+ // Stable solverNetId: launcher agentId + draftId tail. Draft ids are uuid-
185
+ // based so this gives uniqueness across launchers and within a launcher.
186
+ const draftTail = draft.draftId.replace(/^draft_/, '').slice(0, 8);
187
+ const solverNetId = `${launcher.agentId}_${contract.id}-${contract.version}_${draftTail}`;
188
+ const nowIso = now().toISOString();
189
+ const manifest = {
190
+ schemaVersion: 'solvernet.manifest.v1',
191
+ solverNetId,
192
+ network,
193
+ name: draft.name,
194
+ description: draft.description ?? '',
195
+ launcher: {
196
+ safeAddress: launcher.safeAddress,
197
+ agentEoa: launcher.agentEoa,
198
+ agentId: launcher.agentId,
199
+ },
200
+ contract: {
201
+ id: contract.id,
202
+ version: contract.version,
203
+ schemas: {
204
+ task: contract.schemas.task.json,
205
+ solution: contract.schemas.solution.json,
206
+ verdict: contract.schemas.verdict.json,
207
+ },
208
+ claimPolicyDefaults: contract.claimPolicyDefaults,
209
+ credentialRequirements: contract.credentialRequirements,
210
+ // Copy the readonly `inputs` arrays so the manifest's mutable-array
211
+ // schema accepts them. Functional content is identical.
212
+ evaluationFunction: {
213
+ ...contract.evaluationFunction,
214
+ inputs: [...contract.evaluationFunction.inputs],
215
+ },
216
+ aggregationFunction: {
217
+ ...contract.aggregationFunction,
218
+ inputs: [...contract.aggregationFunction.inputs],
219
+ },
220
+ },
221
+ solutionPriceWei: draft.solutionPriceWei,
222
+ verdictPriceWei: draft.verdictPriceWei,
223
+ openRoles: draft.openRoles,
224
+ createdAt: draft.createdAt,
225
+ launchedAt: nowIso,
226
+ };
227
+ return { ok: true, manifest };
228
+ }
229
+ /**
230
+ * Project a (record, manifest) pair into the catalog-row summary shape
231
+ * shared with `SolverNetRegistryClient.listLaunched`.
232
+ *
233
+ * The lifecycle fields (`status`, `statusUpdatedAt`, `anchorBlock`) come
234
+ * from the local `LaunchedSolverNetRecord` because the daemon owns the
235
+ * authoritative view of what it has launched — we do *not* want to pay
236
+ * an extra subgraph round-trip to re-derive lifecycle state when the
237
+ * record already has it. The remaining fields (name, contract, prices,
238
+ * openRoles, launcher) come from the manifest body.
239
+ *
240
+ * `status` widens to the registry's three-value enum: launching/failed
241
+ * are local-only and never present on a record that has a manifest cached,
242
+ * but we coerce them defensively to `launched`/`retired` respectively to
243
+ * keep the projection total. Callers should gate on `record.status`
244
+ * being one of {launched, paused, retired} before deciding to display.
245
+ */
246
+ function summarizeLaunchedRecord(record, manifest) {
247
+ const status = record.status === 'paused'
248
+ ? 'paused'
249
+ : record.status === 'retired'
250
+ ? 'retired'
251
+ : 'launched';
252
+ return {
253
+ manifestCid: record.manifestCid,
254
+ solverNetId: manifest.solverNetId,
255
+ name: manifest.name,
256
+ network: manifest.network,
257
+ launcherAgentId: manifest.launcher.agentId,
258
+ launcherSafeAddress: manifest.launcher.safeAddress,
259
+ status,
260
+ statusUpdatedAt: record.statusUpdatedAt,
261
+ contractId: manifest.contract.id,
262
+ contractVersion: manifest.contract.version,
263
+ solutionPriceWei: manifest.solutionPriceWei,
264
+ verdictPriceWei: manifest.verdictPriceWei,
265
+ openRoles: manifest.openRoles,
266
+ anchorBlock: record.registry.metadataBlockNumber ?? 0,
267
+ };
268
+ }
269
+ /**
270
+ * Look up a manifest summary for a record, using only the registry
271
+ * client's in-process cache. Returns `undefined` on cache miss or when
272
+ * the registry client is not wired — callers (the launched-list /
273
+ * launched-get endpoints) treat `undefined` as "no summary available"
274
+ * and fall back to displaying record-only fields.
275
+ *
276
+ * Cache-only by design: the launched-list endpoint runs on every SPA
277
+ * poll, and an IPFS round-trip per row would dominate latency. For
278
+ * SolverNets the daemon launched itself, the cache is warm by
279
+ * construction (the launch path populates it).
280
+ */
281
+ async function tryGetSummary(record, registry) {
282
+ if (!registry)
283
+ return undefined;
284
+ try {
285
+ const manifest = await registry.getManifestFromCache({
286
+ manifestCid: record.manifestCid,
287
+ });
288
+ if (manifest === null)
289
+ return undefined;
290
+ return summarizeLaunchedRecord(record, manifest);
291
+ }
292
+ catch {
293
+ // Defensive — the cache lookup is supposed to be infallible, but a
294
+ // future async-backed cache could throw (storage error). We surface
295
+ // an undefined summary rather than failing the entire list response.
296
+ return undefined;
297
+ }
298
+ }
299
+ // ── Implementation ──────────────────────────────────────────────────────────
300
+ export function registerSolverNetsEndpoints(app, deps) {
301
+ // jinn-mono-hqz0: deps may be a Proxy whose `store` property only resolves
302
+ // after the SolverNet subsystem finishes post-bootstrap init. We bind a
303
+ // Proxy-backed `store` so each method call dereferences the live value
304
+ // at invocation time — destructuring would capture the initial undefined.
305
+ const store = new Proxy({}, {
306
+ get(_t, prop) {
307
+ const live = deps.store;
308
+ if (!live) {
309
+ throw new Error('SolverNet store not initialised; subsystem still booting');
310
+ }
311
+ const value = live[prop];
312
+ return typeof value === 'function' ? value.bind(live) : value;
313
+ },
314
+ });
315
+ // POST /v1/solvernets/drafts — create a new draft.
316
+ app.post('/v1/solvernets/drafts', async (c) => {
317
+ // Body is optional. An empty body (or a request with no body at all)
318
+ // produces a fully-empty draft — the SPA fills it in via subsequent
319
+ // PATCH calls as the operator walks the wizard.
320
+ let raw = {};
321
+ const text = await c.req.text();
322
+ if (text.length > 0) {
323
+ try {
324
+ raw = JSON.parse(text);
325
+ }
326
+ catch {
327
+ return c.json({ error: 'invalid_body', message: 'expected JSON body' }, 400);
328
+ }
329
+ }
330
+ const immutable = rejectImmutableFields(raw);
331
+ if (immutable) {
332
+ return c.json({ error: 'invalid_body', message: immutable.error }, 400);
333
+ }
334
+ const parsed = DraftEditableSchema.safeParse(raw);
335
+ if (!parsed.success) {
336
+ return c.json({
337
+ error: 'invalid_body',
338
+ message: parsed.error.issues
339
+ .map((i) => `${i.path.join('.') || '<body>'}: ${i.message}`)
340
+ .join('; '),
341
+ }, 400);
342
+ }
343
+ const now = new Date().toISOString();
344
+ const draft = {
345
+ schemaVersion: 'solvernet.draft.v1',
346
+ draftId: `draft_${randomUUID()}`,
347
+ completedSteps: parsed.data.completedSteps ?? [],
348
+ createdAt: now,
349
+ updatedAt: now,
350
+ ...(parsed.data.templateContractId !== undefined && {
351
+ templateContractId: parsed.data.templateContractId,
352
+ }),
353
+ ...(parsed.data.templateContractVersion !== undefined && {
354
+ templateContractVersion: parsed.data.templateContractVersion,
355
+ }),
356
+ ...(parsed.data.name !== undefined && { name: parsed.data.name }),
357
+ ...(parsed.data.description !== undefined && {
358
+ description: parsed.data.description,
359
+ }),
360
+ ...(parsed.data.generatorConfig !== undefined && {
361
+ generatorConfig: parsed.data.generatorConfig,
362
+ }),
363
+ ...(parsed.data.solutionPriceWei !== undefined && {
364
+ solutionPriceWei: parsed.data.solutionPriceWei,
365
+ }),
366
+ ...(parsed.data.verdictPriceWei !== undefined && {
367
+ verdictPriceWei: parsed.data.verdictPriceWei,
368
+ }),
369
+ ...(parsed.data.openRoles !== undefined && {
370
+ openRoles: parsed.data.openRoles,
371
+ }),
372
+ };
373
+ // Defensive parse: ensures the constructed shape still satisfies the
374
+ // store's schema. If a future schema field becomes required and we
375
+ // forget to populate it, we want a 500 here rather than a corrupt
376
+ // file on disk.
377
+ const validated = DraftSolverNetRecordSchema.safeParse(draft);
378
+ if (!validated.success) {
379
+ return c.json({
380
+ error: 'internal_error',
381
+ message: `failed to construct draft: ${validated.error.issues.map((i) => i.message).join('; ')}`,
382
+ }, 500);
383
+ }
384
+ try {
385
+ await store.writeDraft(validated.data);
386
+ }
387
+ catch (err) {
388
+ return c.json({
389
+ error: 'store_write_failed',
390
+ message: err instanceof Error ? err.message : String(err),
391
+ }, 500);
392
+ }
393
+ return c.json(validated.data);
394
+ });
395
+ // GET /v1/solvernets/drafts — list all owned drafts.
396
+ app.get('/v1/solvernets/drafts', async (c) => {
397
+ let drafts;
398
+ try {
399
+ drafts = await store.listDrafts();
400
+ }
401
+ catch (err) {
402
+ return c.json({
403
+ error: 'store_read_failed',
404
+ message: err instanceof Error ? err.message : String(err),
405
+ }, 500);
406
+ }
407
+ return c.json({ drafts });
408
+ });
409
+ // GET /v1/solvernets/drafts/:id — load a single draft.
410
+ app.get('/v1/solvernets/drafts/:id', async (c) => {
411
+ const id = c.req.param('id');
412
+ if (!id) {
413
+ return c.json({ error: 'invalid_invocation', message: 'missing draft id' }, 400);
414
+ }
415
+ let draft;
416
+ try {
417
+ draft = await store.loadDraft(id);
418
+ }
419
+ catch (err) {
420
+ return c.json({
421
+ error: 'store_read_failed',
422
+ message: err instanceof Error ? err.message : String(err),
423
+ }, 500);
424
+ }
425
+ if (!draft) {
426
+ return c.json({ error: 'draft_not_found', message: `Unknown draft: ${id}` }, 404);
427
+ }
428
+ return c.json(draft);
429
+ });
430
+ // PATCH /v1/solvernets/drafts/:id — update a draft.
431
+ app.patch('/v1/solvernets/drafts/:id', async (c) => {
432
+ const id = c.req.param('id');
433
+ if (!id) {
434
+ return c.json({ error: 'invalid_invocation', message: 'missing draft id' }, 400);
435
+ }
436
+ let raw;
437
+ try {
438
+ raw = await c.req.json();
439
+ }
440
+ catch {
441
+ return c.json({ error: 'invalid_body', message: 'expected JSON body' }, 400);
442
+ }
443
+ const immutable = rejectImmutableFields(raw);
444
+ if (immutable) {
445
+ return c.json({ error: 'invalid_body', message: immutable.error }, 400);
446
+ }
447
+ const parsed = DraftEditableSchema.safeParse(raw);
448
+ if (!parsed.success) {
449
+ return c.json({
450
+ error: 'invalid_body',
451
+ message: parsed.error.issues
452
+ .map((i) => `${i.path.join('.') || '<body>'}: ${i.message}`)
453
+ .join('; '),
454
+ }, 400);
455
+ }
456
+ let existing;
457
+ try {
458
+ existing = await store.loadDraft(id);
459
+ }
460
+ catch (err) {
461
+ return c.json({
462
+ error: 'store_read_failed',
463
+ message: err instanceof Error ? err.message : String(err),
464
+ }, 500);
465
+ }
466
+ if (!existing) {
467
+ return c.json({ error: 'draft_not_found', message: `Unknown draft: ${id}` }, 404);
468
+ }
469
+ const next = applyEditable(existing, parsed.data, new Date().toISOString());
470
+ const validated = DraftSolverNetRecordSchema.safeParse(next);
471
+ if (!validated.success) {
472
+ return c.json({
473
+ error: 'invalid_body',
474
+ message: validated.error.issues
475
+ .map((i) => `${i.path.join('.') || '<body>'}: ${i.message}`)
476
+ .join('; '),
477
+ }, 400);
478
+ }
479
+ try {
480
+ await store.writeDraft(validated.data);
481
+ }
482
+ catch (err) {
483
+ return c.json({
484
+ error: 'store_write_failed',
485
+ message: err instanceof Error ? err.message : String(err),
486
+ }, 500);
487
+ }
488
+ return c.json(validated.data);
489
+ });
490
+ // DELETE /v1/solvernets/drafts/:id — delete a draft.
491
+ app.delete('/v1/solvernets/drafts/:id', async (c) => {
492
+ const id = c.req.param('id');
493
+ if (!id) {
494
+ return c.json({ error: 'invalid_invocation', message: 'missing draft id' }, 400);
495
+ }
496
+ // Surface 404 for unknown ids rather than silent-success. The SPA can
497
+ // distinguish "I deleted the only copy" from "this id was never there"
498
+ // — useful for stale-tab detection.
499
+ let existing;
500
+ try {
501
+ existing = await store.loadDraft(id);
502
+ }
503
+ catch (err) {
504
+ return c.json({
505
+ error: 'store_read_failed',
506
+ message: err instanceof Error ? err.message : String(err),
507
+ }, 500);
508
+ }
509
+ if (!existing) {
510
+ return c.json({ error: 'draft_not_found', message: `Unknown draft: ${id}` }, 404);
511
+ }
512
+ try {
513
+ await store.deleteDraft(id);
514
+ }
515
+ catch (err) {
516
+ return c.json({
517
+ error: 'store_write_failed',
518
+ message: err instanceof Error ? err.message : String(err),
519
+ }, 500);
520
+ }
521
+ return c.json({ ok: true });
522
+ });
523
+ // ── Task 14 routes ────────────────────────────────────────────────────────
524
+ // POST /v1/solvernets/drafts/:id/launch — kick off the launch state machine.
525
+ //
526
+ // Behaviour: validate completeness, build + sign the manifest, fire
527
+ // `launchAction.launch(...)` in the background, and return 202 with a
528
+ // poll URL. The state machine pins to IPFS, writes the initial record,
529
+ // broadcasts setMetadata, awaits confirmation, and spawns the generator
530
+ // — all asynchronously. The SPA polls `GET /v1/solvernets/launched/:id`
531
+ // to track progress (`launchProgress.phase` reflects which phase the
532
+ // machine is currently in).
533
+ app.post('/v1/solvernets/drafts/:id/launch', async (c) => {
534
+ const id = c.req.param('id');
535
+ if (!id) {
536
+ return c.json({ error: 'invalid_invocation', message: 'missing draft id' }, 400);
537
+ }
538
+ if (!deps.launch) {
539
+ return c.json({
540
+ error: 'launch_unavailable',
541
+ message: 'launch routes are not configured; the daemon is missing launch dependencies',
542
+ }, 503);
543
+ }
544
+ const launchDeps = deps.launch;
545
+ let draft;
546
+ try {
547
+ draft = await store.loadDraft(id);
548
+ }
549
+ catch (err) {
550
+ return c.json({
551
+ error: 'store_read_failed',
552
+ message: err instanceof Error ? err.message : String(err),
553
+ }, 500);
554
+ }
555
+ if (!draft) {
556
+ return c.json({ error: 'draft_not_found', message: `Unknown draft: ${id}` }, 404);
557
+ }
558
+ const completeness = checkDraftCompleteness(draft);
559
+ if (!completeness.ok) {
560
+ return c.json({
561
+ error: 'draft_incomplete',
562
+ message: `draft is missing required fields: ${completeness.missingFields.join(', ')}`,
563
+ missingFields: completeness.missingFields,
564
+ }, 400);
565
+ }
566
+ const built = buildUnsignedManifest({
567
+ draft,
568
+ launcher: launchDeps.launcher,
569
+ network: launchDeps.network,
570
+ now: launchDeps.now ?? (() => new Date()),
571
+ });
572
+ if (!built.ok) {
573
+ return c.json({ error: 'invalid_template', message: built.error }, 400);
574
+ }
575
+ let manifest;
576
+ try {
577
+ manifest = await signManifest(built.manifest, launchDeps.signer.agentEoaPrivateKey);
578
+ }
579
+ catch (err) {
580
+ return c.json({
581
+ error: 'manifest_sign_failed',
582
+ message: err instanceof Error ? err.message : String(err),
583
+ }, 500);
584
+ }
585
+ // Idempotency: if a record with this solverNetId already exists, return
586
+ // it instead of starting a second launch. The state machine itself is
587
+ // also idempotent (launch() routes to resume() for existing records),
588
+ // but short-circuiting here avoids a redundant signManifest round.
589
+ const existing = await store.loadRecord(manifest.solverNetId);
590
+ if (existing) {
591
+ return c.json({
592
+ solverNetId: manifest.solverNetId,
593
+ status: existing.status,
594
+ pollUrl: `/v1/solvernets/launched/${manifest.solverNetId}`,
595
+ }, 202);
596
+ }
597
+ // Fire-and-forget: the launch state machine pins, writes the record,
598
+ // broadcasts, awaits confirmation, and spawns the generator. We do not
599
+ // await it here — production launches can take 30+ seconds (IPFS pin +
600
+ // tx confirmation) and the SPA tracks progress via `launchProgress`.
601
+ void launchDeps.launchAction
602
+ .launch({
603
+ manifest,
604
+ signer: launchDeps.signer,
605
+ // jinn-mono-jnr1: forward the wizard's per-record runtime config so
606
+ // the launched record persists it; otherwise the generator falls
607
+ // back to DEFAULTS (cadence 6h etc.) regardless of what the
608
+ // operator picked in the Create flow.
609
+ generatorConfig: draft.generatorConfig,
610
+ })
611
+ .catch((err) => {
612
+ // The state machine has already persisted the failure to disk
613
+ // (`launchProgress.txError`); we just log so the daemon operator
614
+ // sees the failure in stderr without crashing the process.
615
+ // eslint-disable-next-line no-console
616
+ console.error(`[solvernets] background launch ${manifest.solverNetId} failed:`, err);
617
+ });
618
+ // Briefly wait for the initial record to land on disk so the SPA's
619
+ // first poll always finds a record. The launch action's first persisted
620
+ // checkpoint is after the IPFS upload — typically <100ms with mocked
621
+ // ipfs (tests) or a few seconds in production. If it does not show up
622
+ // within the timeout we return 202 anyway; the SPA's poll will reveal
623
+ // the failure.
624
+ const POLL_BUDGET_MS = 5_000;
625
+ const POLL_INTERVAL_MS = 25;
626
+ const start = Date.now();
627
+ let initialRecord = null;
628
+ while (Date.now() - start < POLL_BUDGET_MS) {
629
+ initialRecord = await store.loadRecord(manifest.solverNetId);
630
+ if (initialRecord)
631
+ break;
632
+ await new Promise((r) => setTimeout(r, POLL_INTERVAL_MS));
633
+ }
634
+ return c.json({
635
+ solverNetId: manifest.solverNetId,
636
+ status: initialRecord?.status ?? 'launching',
637
+ pollUrl: `/v1/solvernets/launched/${manifest.solverNetId}`,
638
+ }, 202);
639
+ });
640
+ // GET /v1/solvernets/launched/:id — read the current launched record.
641
+ //
642
+ // Prefers the in-memory recordRef (lifecycle / launch state machines
643
+ // mutate it synchronously after each disk write) and falls back to disk.
644
+ // Either source is up-to-date because both are written before the
645
+ // operation returns.
646
+ //
647
+ // Response shape: the persisted record fields + an optional
648
+ // `summary?: SolverNetManifestSummary` derived from the registry
649
+ // client's in-process manifest cache. Cache miss → `summary` is
650
+ // omitted. The summary is the only place catalog-y identity (name,
651
+ // contract id/version, prices, openRoles) appears on this surface;
652
+ // the SPA falls back to bare record fields when it is missing.
653
+ app.get('/v1/solvernets/launched/:id', async (c) => {
654
+ const id = c.req.param('id');
655
+ if (!id) {
656
+ return c.json({ error: 'invalid_invocation', message: 'missing record id' }, 400);
657
+ }
658
+ // Prefer in-memory ref when available (lifecycle / launch updates land
659
+ // there first via mutation).
660
+ if (deps.launch) {
661
+ const entry = deps.launch.pendingGenerators.current.find((g) => g.recordRef.current.solverNetId === id);
662
+ if (entry) {
663
+ const summary = await tryGetSummary(entry.recordRef.current, deps.registry);
664
+ return c.json({
665
+ ...entry.recordRef.current,
666
+ ...(summary !== undefined ? { summary } : {}),
667
+ });
668
+ }
669
+ }
670
+ let record;
671
+ try {
672
+ record = await store.loadRecord(id);
673
+ }
674
+ catch (err) {
675
+ return c.json({
676
+ error: 'store_read_failed',
677
+ message: err instanceof Error ? err.message : String(err),
678
+ }, 500);
679
+ }
680
+ if (!record) {
681
+ return c.json({ error: 'record_not_found', message: `Unknown record: ${id}` }, 404);
682
+ }
683
+ const summary = await tryGetSummary(record, deps.registry);
684
+ return c.json({
685
+ ...record,
686
+ ...(summary !== undefined ? { summary } : {}),
687
+ });
688
+ });
689
+ // PATCH /v1/solvernets/launched/:id/lifecycle — pause / resume / retire.
690
+ //
691
+ // Blocking: the lifecycle transition is one tx + one receipt, typically
692
+ // 5-30 seconds. We await completion and return the updated record so the
693
+ // SPA can re-render in a single round-trip.
694
+ app.patch('/v1/solvernets/launched/:id/lifecycle', async (c) => {
695
+ const id = c.req.param('id');
696
+ if (!id) {
697
+ return c.json({ error: 'invalid_invocation', message: 'missing record id' }, 400);
698
+ }
699
+ if (!deps.launch) {
700
+ return c.json({
701
+ error: 'launch_unavailable',
702
+ message: 'lifecycle routes are not configured',
703
+ }, 503);
704
+ }
705
+ const launchDeps = deps.launch;
706
+ let raw;
707
+ try {
708
+ raw = await c.req.json();
709
+ }
710
+ catch {
711
+ return c.json({ error: 'invalid_body', message: 'expected JSON body' }, 400);
712
+ }
713
+ const parsed = LifecycleBodySchema.safeParse(raw);
714
+ if (!parsed.success) {
715
+ return c.json({
716
+ error: 'invalid_body',
717
+ message: parsed.error.issues
718
+ .map((i) => `${i.path.join('.') || '<body>'}: ${i.message}`)
719
+ .join('; '),
720
+ }, 400);
721
+ }
722
+ const target = parsed.data.target;
723
+ let record;
724
+ try {
725
+ record = await store.loadRecord(id);
726
+ }
727
+ catch (err) {
728
+ return c.json({
729
+ error: 'store_read_failed',
730
+ message: err instanceof Error ? err.message : String(err),
731
+ }, 500);
732
+ }
733
+ if (!record) {
734
+ return c.json({ error: 'record_not_found', message: `Unknown record: ${id}` }, 404);
735
+ }
736
+ // Terminal-state guard at the API edge so the caller gets a typed error
737
+ // before we even touch the state machine. The state machine also
738
+ // rejects (it is the source of truth) but surfacing it here gives a
739
+ // stable error code.
740
+ if (record.status === 'retired' && target !== 'retired') {
741
+ return c.json({
742
+ error: 'lifecycle_terminal',
743
+ message: `SolverNet ${id} is retired; transitions are no-ops`,
744
+ }, 400);
745
+ }
746
+ // Idempotent no-op: caller's view matches current state, no work to do.
747
+ if (record.status === target && record.lifecycleProgress === undefined) {
748
+ return c.json(record);
749
+ }
750
+ let updated;
751
+ try {
752
+ updated = await launchDeps.lifecycleTransition.transition(record, target);
753
+ }
754
+ catch (err) {
755
+ return c.json({
756
+ error: 'lifecycle_failed',
757
+ message: err instanceof Error ? err.message : String(err),
758
+ }, 500);
759
+ }
760
+ // Mutate the in-memory recordRef so subsequent reads (and the next
761
+ // generator tick) see the new status without waiting for a disk reload.
762
+ const entry = launchDeps.pendingGenerators.current.find((g) => g.recordRef.current.solverNetId === id);
763
+ if (entry) {
764
+ entry.recordRef.current = updated;
765
+ }
766
+ return c.json(updated);
767
+ });
768
+ // PATCH /v1/solvernets/launched/:id/generator-config — hot-apply config.
769
+ //
770
+ // Updates the persisted record's `generatorConfig` AND mutates the live
771
+ // `configRef.current` for any pendingGenerators entry. The next generator
772
+ // tick reads the new cadence/allowlist/caps via the ref.
773
+ app.patch('/v1/solvernets/launched/:id/generator-config', async (c) => {
774
+ const id = c.req.param('id');
775
+ if (!id) {
776
+ return c.json({ error: 'invalid_invocation', message: 'missing record id' }, 400);
777
+ }
778
+ if (!deps.launch) {
779
+ return c.json({
780
+ error: 'launch_unavailable',
781
+ message: 'generator-config routes are not configured',
782
+ }, 503);
783
+ }
784
+ const launchDeps = deps.launch;
785
+ let raw;
786
+ try {
787
+ raw = await c.req.json();
788
+ }
789
+ catch {
790
+ return c.json({ error: 'invalid_body', message: 'expected JSON body' }, 400);
791
+ }
792
+ const parsed = GeneratorConfigPatchSchema.safeParse(raw);
793
+ if (!parsed.success) {
794
+ return c.json({
795
+ error: 'invalid_body',
796
+ message: parsed.error.issues
797
+ .map((i) => `${i.path.join('.') || '<body>'}: ${i.message}`)
798
+ .join('; '),
799
+ }, 400);
800
+ }
801
+ let record;
802
+ try {
803
+ record = await store.loadRecord(id);
804
+ }
805
+ catch (err) {
806
+ return c.json({
807
+ error: 'store_read_failed',
808
+ message: err instanceof Error ? err.message : String(err),
809
+ }, 500);
810
+ }
811
+ if (!record) {
812
+ return c.json({ error: 'record_not_found', message: `Unknown record: ${id}` }, 404);
813
+ }
814
+ // Patch semantics: merge the provided fields over the existing config.
815
+ // Operators editing one field shouldn't have to re-send the rest.
816
+ const nextConfig = {
817
+ ...(record.generatorConfig ?? {}),
818
+ ...parsed.data,
819
+ };
820
+ // Persist on disk. The store schema treats generatorConfig as an opaque
821
+ // record; we widen the strongly-typed runtime config back to that shape
822
+ // for storage.
823
+ const updatedRecord = {
824
+ ...record,
825
+ generatorConfig: nextConfig,
826
+ };
827
+ const validated = LaunchedSolverNetRecordSchema.safeParse(updatedRecord);
828
+ if (!validated.success) {
829
+ return c.json({
830
+ error: 'invalid_record',
831
+ message: `failed to construct updated record: ${validated.error.issues.map((i) => i.message).join('; ')}`,
832
+ }, 500);
833
+ }
834
+ try {
835
+ await store.writeRecord(validated.data);
836
+ }
837
+ catch (err) {
838
+ return c.json({
839
+ error: 'store_write_failed',
840
+ message: err instanceof Error ? err.message : String(err),
841
+ }, 500);
842
+ }
843
+ // Hot-apply: mutate the live configRef + recordRef in place so the next
844
+ // generator tick sees the new config without waiting for a disk reload.
845
+ // It is valid for there to be no pendingGenerators entry (e.g. the
846
+ // record is paused / retired and the generator is not running) — the
847
+ // disk write above is enough; the next time the daemon spawns the
848
+ // generator (next launched-status flip) it will seed configRef from
849
+ // the persisted record.
850
+ const entry = launchDeps.pendingGenerators.current.find((g) => g.recordRef.current.solverNetId === id);
851
+ if (entry) {
852
+ entry.configRef.current = nextConfig;
853
+ entry.recordRef.current = validated.data;
854
+ }
855
+ return c.json(nextConfig);
856
+ });
857
+ // ── Task 15 routes ────────────────────────────────────────────────────────
858
+ // GET /v1/solvernets/launched — list owned launched records (= what this
859
+ // daemon launched). The registry catalog (below) is the global view; this
860
+ // is the local mirror — exactly the rows the daemon is responsible for
861
+ // running generators for.
862
+ //
863
+ // Optional `?status=<launching|launched|paused|retired|failed>` filter
864
+ // narrows the list. Without the filter, all records (including retired)
865
+ // are returned — the SPA decides what to show. This shape lets the SPA
866
+ // render a unified "your SolverNets" tab without N round-trips.
867
+ //
868
+ // Each row also carries an optional `summary?: SolverNetManifestSummary`
869
+ // populated from the registry client's in-process manifest cache —
870
+ // populated for every SolverNet this daemon launched (the launch path
871
+ // primes the cache), `undefined` for the pre-cache window during a
872
+ // launch in flight. Cache-only on purpose: list responses run on every
873
+ // SPA poll, and an IPFS round-trip per row would dominate latency.
874
+ app.get('/v1/solvernets/launched', async (c) => {
875
+ const statusQuery = c.req.query('status');
876
+ let statusFilter;
877
+ if (statusQuery !== undefined) {
878
+ const parsed = OwnedStatusFilterSchema.safeParse(statusQuery);
879
+ if (!parsed.success) {
880
+ return c.json({
881
+ error: 'invalid_query',
882
+ message: `unknown status filter: ${statusQuery}`,
883
+ }, 400);
884
+ }
885
+ statusFilter = parsed.data;
886
+ }
887
+ let records;
888
+ try {
889
+ records = await store.loadOwnedRecords();
890
+ }
891
+ catch (err) {
892
+ return c.json({
893
+ error: 'store_read_failed',
894
+ message: err instanceof Error ? err.message : String(err),
895
+ }, 500);
896
+ }
897
+ if (statusFilter !== undefined) {
898
+ records = records.filter((r) => r.status === statusFilter);
899
+ }
900
+ // Enrich each record with its manifest summary from the cache, when
901
+ // available. We `Promise.all` the lookups so a future async-backed
902
+ // cache (e.g. SQLite) would not serialize per row, even though the
903
+ // day-1 implementation is a synchronous Map read.
904
+ const enriched = await Promise.all(records.map(async (record) => {
905
+ const summary = await tryGetSummary(record, deps.registry);
906
+ return summary !== undefined ? { ...record, summary } : record;
907
+ }));
908
+ return c.json({ records: enriched });
909
+ });
910
+ // GET /v1/solvernets/registry — list global launched SolverNets from the
911
+ // catalog cache (populated by the daemon's registry-catalog refresh loop
912
+ // wired in `daemon-init.ts`).
913
+ //
914
+ // Behaviour:
915
+ // - Default filter is `launched + paused`; retired entries are excluded
916
+ // unless the caller explicitly asks for `?status=retired`. This matches
917
+ // the join-flow's "useful surface" — operators picking a SolverNet to
918
+ // join shouldn't have to scroll past tombstoned ones.
919
+ // - `?refresh=1` forces a refresh before reading the snapshot. The SPA
920
+ // uses this on user-initiated reload; the auto-tick keeps the cache
921
+ // warm in the background.
922
+ // - Cache metadata (`lastRefreshedAt`, `lastError`) is always returned
923
+ // so the SPA can render a "stale" indicator and surface errors.
924
+ app.get('/v1/solvernets/registry', async (c) => {
925
+ if (!deps.catalog) {
926
+ return c.json({
927
+ error: 'registry_unavailable',
928
+ message: 'registry catalog cache is not configured',
929
+ }, 503);
930
+ }
931
+ const catalog = deps.catalog;
932
+ const statusQuery = c.req.query('status');
933
+ let statusFilter;
934
+ if (statusQuery !== undefined) {
935
+ const parsed = RegistryStatusFilterSchema.safeParse(statusQuery);
936
+ if (!parsed.success) {
937
+ return c.json({
938
+ error: 'invalid_query',
939
+ message: `unknown status filter: ${statusQuery}`,
940
+ }, 400);
941
+ }
942
+ statusFilter = [parsed.data];
943
+ }
944
+ else {
945
+ // Default: launched + paused. Retired is excluded from the default
946
+ // surface — operators see those only via explicit ?status=retired.
947
+ statusFilter = ['launched', 'paused'];
948
+ }
949
+ if (c.req.query('refresh') === '1') {
950
+ // Force a refresh before reading the snapshot. The cache itself
951
+ // suppresses errors — they land in `lastError` which we surface in
952
+ // the response, so the SPA can show "couldn't refresh, here's the
953
+ // last cached snapshot" rather than a blank page.
954
+ await catalog.refresh();
955
+ }
956
+ const snapshot = catalog.getCatalog();
957
+ const summaries = snapshot.filter((s) => statusFilter.includes(s.status));
958
+ const lastRefreshedAt = catalog.lastRefreshedAt();
959
+ const lastError = catalog.lastError();
960
+ return c.json({
961
+ summaries,
962
+ lastRefreshedAt: lastRefreshedAt === null ? null : lastRefreshedAt.toISOString(),
963
+ lastError: lastError === null
964
+ ? null
965
+ : { message: lastError.message, at: lastError.at.toISOString() },
966
+ });
967
+ });
968
+ // GET /v1/solvernets/registry/:cid — fetch a specific manifest from the
969
+ // registry, with its current lifecycle status.
970
+ //
971
+ // The registry client validates the manifest's canonical hash against the
972
+ // on-chain advertised hash; if it throws (missing IPFS body, schema
973
+ // mismatch, hash mismatch), we surface 404 — the manifest is "not found"
974
+ // from a useful-surface perspective regardless of which leg failed. The
975
+ // exact failure reason is in the response message for debugging.
976
+ //
977
+ // CID validation here is intentionally loose: we reject obvious garbage
978
+ // (path-traversal, decimals, empty) so we never round-trip them to IPFS,
979
+ // but the registry client does the canonical check.
980
+ app.get('/v1/solvernets/registry/:cid', async (c) => {
981
+ if (!deps.registry) {
982
+ return c.json({
983
+ error: 'registry_unavailable',
984
+ message: 'registry client is not configured',
985
+ }, 503);
986
+ }
987
+ const registry = deps.registry;
988
+ const cid = c.req.param('cid');
989
+ if (!cid || !CID_SHAPE_REGEX.test(cid)) {
990
+ return c.json({
991
+ error: 'invalid_cid',
992
+ message: `cid does not look like a CID: ${cid ?? '<empty>'}`,
993
+ }, 400);
994
+ }
995
+ let manifest;
996
+ try {
997
+ manifest = await registry.getManifest({ manifestCid: cid });
998
+ }
999
+ catch (err) {
1000
+ return c.json({
1001
+ error: 'manifest_not_found',
1002
+ message: err instanceof Error ? err.message : String(err),
1003
+ }, 404);
1004
+ }
1005
+ let lifecycle;
1006
+ try {
1007
+ lifecycle = await registry.getLifecycleStatus({ manifestCid: cid });
1008
+ }
1009
+ catch (err) {
1010
+ // The manifest body exists on IPFS but no lifecycle events were found
1011
+ // on chain — surface as 404 with the real reason in the message.
1012
+ // This is genuinely unusual (the launcher must have setMetadata'd the
1013
+ // initial cid for the manifest to be discoverable at all), but it can
1014
+ // happen during the brief window between IPFS pin and on-chain confirm.
1015
+ return c.json({
1016
+ error: 'manifest_not_found',
1017
+ message: err instanceof Error ? err.message : String(err),
1018
+ }, 404);
1019
+ }
1020
+ return c.json({ manifest, lifecycle });
1021
+ });
1022
+ }
1023
+ //# sourceMappingURL=solvernets-endpoints.js.map