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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (434) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/README.md +67 -1
  3. package/deployments/deployment-jinn-mvi-l1-sepolia-fast.json +23 -4
  4. package/deployments/deployment-jinn-mvi-l1-sepolia.json +23 -4
  5. package/deployments/deployment-jinn-mvi-l2-baseSepolia.json +5 -4
  6. package/dist/adapters/mech/adapter.d.ts +57 -2
  7. package/dist/adapters/mech/adapter.js +366 -63
  8. package/dist/adapters/mech/adapter.js.map +1 -1
  9. package/dist/adapters/mech/contracts.d.ts +17 -4
  10. package/dist/adapters/mech/contracts.js +19 -4
  11. package/dist/adapters/mech/contracts.js.map +1 -1
  12. package/dist/adapters/mech/safe-revert.d.ts +20 -0
  13. package/dist/adapters/mech/safe-revert.js +12 -4
  14. package/dist/adapters/mech/safe-revert.js.map +1 -1
  15. package/dist/adapters/mech/safe.d.ts +6 -2
  16. package/dist/adapters/mech/safe.js +32 -11
  17. package/dist/adapters/mech/safe.js.map +1 -1
  18. package/dist/adapters/mech/types.d.ts +6 -1
  19. package/dist/adapters/mech/types.js.map +1 -1
  20. package/dist/adapters/mech/verdict-code.d.ts +1 -0
  21. package/dist/adapters/mech/verdict-code.js +18 -0
  22. package/dist/adapters/mech/verdict-code.js.map +1 -1
  23. package/dist/agent/operator-claude.js +8 -0
  24. package/dist/agent/operator-claude.js.map +1 -1
  25. package/dist/api/activity-events-endpoint.d.ts +14 -0
  26. package/dist/api/activity-events-endpoint.js +59 -0
  27. package/dist/api/activity-events-endpoint.js.map +1 -0
  28. package/dist/api/admin-endpoint.d.ts +15 -3
  29. package/dist/api/admin-endpoint.js +24 -2
  30. package/dist/api/admin-endpoint.js.map +1 -1
  31. package/dist/api/bootstrap-endpoint.d.ts +1 -2
  32. package/dist/api/bootstrap-endpoint.js +85 -18
  33. package/dist/api/bootstrap-endpoint.js.map +1 -1
  34. package/dist/api/codex-doctor-endpoint.d.ts +90 -0
  35. package/dist/api/codex-doctor-endpoint.js +296 -0
  36. package/dist/api/codex-doctor-endpoint.js.map +1 -0
  37. package/dist/api/discovery-endpoint.d.ts +1 -0
  38. package/dist/api/discovery-endpoint.js +26 -0
  39. package/dist/api/discovery-endpoint.js.map +1 -1
  40. package/dist/api/fleet-build.d.ts +1 -0
  41. package/dist/api/fleet-build.js +2 -1
  42. package/dist/api/fleet-build.js.map +1 -1
  43. package/dist/api/gather-status.d.ts +37 -0
  44. package/dist/api/gather-status.js +572 -19
  45. package/dist/api/gather-status.js.map +1 -1
  46. package/dist/api/hermes-doctor-endpoint.d.ts +128 -3
  47. package/dist/api/hermes-doctor-endpoint.js +265 -22
  48. package/dist/api/hermes-doctor-endpoint.js.map +1 -1
  49. package/dist/api/launcher-status.d.ts +24 -17
  50. package/dist/api/launcher-status.js +13 -11
  51. package/dist/api/launcher-status.js.map +1 -1
  52. package/dist/api/launcher-tasks.d.ts +1 -1
  53. package/dist/api/launcher-tasks.js +12 -8
  54. package/dist/api/launcher-tasks.js.map +1 -1
  55. package/dist/api/operator-artifacts-endpoint.js +73 -6
  56. package/dist/api/operator-artifacts-endpoint.js.map +1 -1
  57. package/dist/api/portfolio-v0-build.d.ts +10 -0
  58. package/dist/api/portfolio-v0-build.js +24 -5
  59. package/dist/api/portfolio-v0-build.js.map +1 -1
  60. package/dist/api/prediction-v1-build.d.ts +10 -0
  61. package/dist/api/prediction-v1-build.js +7 -1
  62. package/dist/api/prediction-v1-build.js.map +1 -1
  63. package/dist/api/server.d.ts +31 -1
  64. package/dist/api/server.js +95 -2
  65. package/dist/api/server.js.map +1 -1
  66. package/dist/api/setup-endpoints.d.ts +7 -0
  67. package/dist/api/setup-endpoints.js +67 -135
  68. package/dist/api/setup-endpoints.js.map +1 -1
  69. package/dist/api/setup-retry-endpoint.d.ts +19 -0
  70. package/dist/api/setup-retry-endpoint.js +32 -0
  71. package/dist/api/setup-retry-endpoint.js.map +1 -0
  72. package/dist/api/solvernets-endpoints.d.ts +8 -0
  73. package/dist/api/solvernets-endpoints.js +100 -105
  74. package/dist/api/solvernets-endpoints.js.map +1 -1
  75. package/dist/api/status-build.d.ts +167 -2
  76. package/dist/api/status-build.js +118 -27
  77. package/dist/api/status-build.js.map +1 -1
  78. package/dist/api/status-harness-rollup.d.ts +35 -0
  79. package/dist/api/status-harness-rollup.js +45 -0
  80. package/dist/api/status-harness-rollup.js.map +1 -0
  81. package/dist/api/task-run-routing.d.ts +7 -0
  82. package/dist/api/task-run-routing.js +12 -0
  83. package/dist/api/task-run-routing.js.map +1 -0
  84. package/dist/api/task-runs-build.d.ts +21 -0
  85. package/dist/api/task-runs-build.js +14 -1
  86. package/dist/api/task-runs-build.js.map +1 -1
  87. package/dist/build-info.json +4 -4
  88. package/dist/build-meta.json +1 -1
  89. package/dist/captures/live-publisher.js +24 -4
  90. package/dist/captures/live-publisher.js.map +1 -1
  91. package/dist/captures/publish.d.ts +1 -1
  92. package/dist/chain-read-errors.d.ts +22 -0
  93. package/dist/chain-read-errors.js +41 -1
  94. package/dist/chain-read-errors.js.map +1 -1
  95. package/dist/cli/commands/auth.js +1 -1
  96. package/dist/cli/commands/auth.js.map +1 -1
  97. package/dist/cli/commands/codedigest-revert-check.d.ts +33 -0
  98. package/dist/cli/commands/codedigest-revert-check.js +249 -0
  99. package/dist/cli/commands/codedigest-revert-check.js.map +1 -0
  100. package/dist/cli/commands/create.js +3 -2
  101. package/dist/cli/commands/create.js.map +1 -1
  102. package/dist/cli/commands/doctor.d.ts +2 -0
  103. package/dist/cli/commands/doctor.js +2 -0
  104. package/dist/cli/commands/doctor.js.map +1 -1
  105. package/dist/cli/commands/rewards.js +11 -7
  106. package/dist/cli/commands/rewards.js.map +1 -1
  107. package/dist/cli/commands/solver-nets.d.ts +1 -0
  108. package/dist/cli/commands/solver-nets.js +179 -16
  109. package/dist/cli/commands/solver-nets.js.map +1 -1
  110. package/dist/cli/commands/solver-plugins-block.d.ts +33 -0
  111. package/dist/cli/commands/solver-plugins-block.js +118 -0
  112. package/dist/cli/commands/solver-plugins-block.js.map +1 -0
  113. package/dist/cli/commands/solver-plugins-feedback.d.ts +72 -0
  114. package/dist/cli/commands/solver-plugins-feedback.js +262 -0
  115. package/dist/cli/commands/solver-plugins-feedback.js.map +1 -0
  116. package/dist/cli/commands/solver-plugins-read.d.ts +54 -0
  117. package/dist/cli/commands/solver-plugins-read.js +259 -0
  118. package/dist/cli/commands/solver-plugins-read.js.map +1 -0
  119. package/dist/cli/commands/solver-plugins.d.ts +35 -0
  120. package/dist/cli/commands/solver-plugins.js +399 -2
  121. package/dist/cli/commands/solver-plugins.js.map +1 -1
  122. package/dist/cli/commands/status.js +1 -1
  123. package/dist/cli/commands/status.js.map +1 -1
  124. package/dist/cli/commands/tasks.js +101 -11
  125. package/dist/cli/commands/tasks.js.map +1 -1
  126. package/dist/cli/commands/update.d.ts +10 -0
  127. package/dist/cli/commands/update.js +36 -0
  128. package/dist/cli/commands/update.js.map +1 -1
  129. package/dist/cli/index.js +2 -0
  130. package/dist/cli/index.js.map +1 -1
  131. package/dist/cli/introspection-context.js +5 -0
  132. package/dist/cli/introspection-context.js.map +1 -1
  133. package/dist/cli/task-native-readiness.d.ts +10 -1
  134. package/dist/cli/task-native-readiness.js +30 -6
  135. package/dist/cli/task-native-readiness.js.map +1 -1
  136. package/dist/config.d.ts +287 -235
  137. package/dist/config.js +318 -114
  138. package/dist/config.js.map +1 -1
  139. package/dist/daemon/checkpoint-loop.d.ts +48 -0
  140. package/dist/daemon/checkpoint-loop.js +76 -0
  141. package/dist/daemon/checkpoint-loop.js.map +1 -0
  142. package/dist/daemon/creator.d.ts +1 -1
  143. package/dist/daemon/creator.js +20 -3
  144. package/dist/daemon/creator.js.map +1 -1
  145. package/dist/daemon/daemon.d.ts +22 -0
  146. package/dist/daemon/daemon.js +174 -31
  147. package/dist/daemon/daemon.js.map +1 -1
  148. package/dist/daemon/eviction-loop.d.ts +40 -0
  149. package/dist/daemon/eviction-loop.js +67 -0
  150. package/dist/daemon/eviction-loop.js.map +1 -0
  151. package/dist/daemon/gate-logger.d.ts +9 -0
  152. package/dist/daemon/gate-logger.js +2 -0
  153. package/dist/daemon/gate-logger.js.map +1 -0
  154. package/dist/daemon/jinn-claim-loop-wiring.d.ts +33 -0
  155. package/dist/daemon/jinn-claim-loop-wiring.js +40 -0
  156. package/dist/daemon/jinn-claim-loop-wiring.js.map +1 -0
  157. package/dist/daemon/jinn-claim-loop.d.ts +24 -17
  158. package/dist/daemon/jinn-claim-loop.js +77 -23
  159. package/dist/daemon/jinn-claim-loop.js.map +1 -1
  160. package/dist/daemon/readiness-gate.d.ts +1 -4
  161. package/dist/daemon/readiness-gate.js.map +1 -1
  162. package/dist/daemon/skip-log-dedup.d.ts +69 -0
  163. package/dist/daemon/skip-log-dedup.js +106 -0
  164. package/dist/daemon/skip-log-dedup.js.map +1 -0
  165. package/dist/daemon/spend-cap-gate.d.ts +40 -0
  166. package/dist/daemon/spend-cap-gate.js +46 -0
  167. package/dist/daemon/spend-cap-gate.js.map +1 -0
  168. package/dist/dashboard/assets/index-BNs_ewI6.js +345 -0
  169. package/dist/dashboard/assets/index-C4huIsUW.css +32 -0
  170. package/dist/dashboard/index.html +2 -2
  171. package/dist/discovery/factory.d.ts +17 -5
  172. package/dist/discovery/factory.js +46 -18
  173. package/dist/discovery/factory.js.map +1 -1
  174. package/dist/discovery/http.js +469 -3
  175. package/dist/discovery/http.js.map +1 -1
  176. package/dist/discovery/onchain.d.ts +5 -0
  177. package/dist/discovery/onchain.js +448 -18
  178. package/dist/discovery/onchain.js.map +1 -1
  179. package/dist/discovery/types.d.ts +174 -1
  180. package/dist/discovery/types.js +8 -10
  181. package/dist/discovery/types.js.map +1 -1
  182. package/dist/discovery/with-fallback.d.ts +7 -0
  183. package/dist/discovery/with-fallback.js +37 -0
  184. package/dist/discovery/with-fallback.js.map +1 -1
  185. package/dist/earning/bootstrap.d.ts +100 -4
  186. package/dist/earning/bootstrap.js +239 -76
  187. package/dist/earning/bootstrap.js.map +1 -1
  188. package/dist/earning/contracts.d.ts +14 -0
  189. package/dist/earning/contracts.js +17 -5
  190. package/dist/earning/contracts.js.map +1 -1
  191. package/dist/earning/funding-plan.js +27 -18
  192. package/dist/earning/funding-plan.js.map +1 -1
  193. package/dist/earning/jinn-rewards.d.ts +46 -0
  194. package/dist/earning/jinn-rewards.js +32 -0
  195. package/dist/earning/jinn-rewards.js.map +1 -1
  196. package/dist/earning/safe-adapter.d.ts +2 -0
  197. package/dist/earning/safe-adapter.js +37 -11
  198. package/dist/earning/safe-adapter.js.map +1 -1
  199. package/dist/earning/store.d.ts +8 -0
  200. package/dist/earning/store.js.map +1 -1
  201. package/dist/earning/testnet-setup-migration.d.ts +12 -0
  202. package/dist/earning/testnet-setup-migration.js +27 -1
  203. package/dist/earning/testnet-setup-migration.js.map +1 -1
  204. package/dist/earning/types.d.ts +21 -6
  205. package/dist/earning/viem-clients.d.ts +11 -4
  206. package/dist/earning/viem-clients.js +14 -5
  207. package/dist/earning/viem-clients.js.map +1 -1
  208. package/dist/erc8004/identity.d.ts +19 -3
  209. package/dist/erc8004/identity.js +21 -6
  210. package/dist/erc8004/identity.js.map +1 -1
  211. package/dist/erc8004/index.d.ts +1 -1
  212. package/dist/erc8004/index.js.map +1 -1
  213. package/dist/erc8004/reputation.d.ts +8 -0
  214. package/dist/erc8004/reputation.js +22 -3
  215. package/dist/erc8004/reputation.js.map +1 -1
  216. package/dist/events/types.d.ts +2 -2
  217. package/dist/harnesses/cost-estimates.d.ts +124 -0
  218. package/dist/harnesses/cost-estimates.js +265 -0
  219. package/dist/harnesses/cost-estimates.js.map +1 -0
  220. package/dist/harnesses/engine/engine.d.ts +78 -0
  221. package/dist/harnesses/engine/engine.js +153 -11
  222. package/dist/harnesses/engine/engine.js.map +1 -1
  223. package/dist/harnesses/engine/persistence.d.ts +51 -1
  224. package/dist/harnesses/engine/persistence.js +118 -5
  225. package/dist/harnesses/engine/persistence.js.map +1 -1
  226. package/dist/harnesses/engine/work-dir-reaper.d.ts +65 -0
  227. package/dist/harnesses/engine/work-dir-reaper.js +100 -0
  228. package/dist/harnesses/engine/work-dir-reaper.js.map +1 -0
  229. package/dist/harnesses/impls/hermes-agent/adapter.js +40 -0
  230. package/dist/harnesses/impls/hermes-agent/adapter.js.map +1 -1
  231. package/dist/harnesses/impls/hermes-agent/bootstrap.d.ts +20 -0
  232. package/dist/harnesses/impls/hermes-agent/bootstrap.js +44 -8
  233. package/dist/harnesses/impls/hermes-agent/bootstrap.js.map +1 -1
  234. package/dist/harnesses/impls/hermes-agent/config-builder.d.ts +1 -1
  235. package/dist/harnesses/impls/hermes-agent/config-builder.js +4 -2
  236. package/dist/harnesses/impls/hermes-agent/config-builder.js.map +1 -1
  237. package/dist/harnesses/impls/hermes-agent/harness.d.ts +59 -1
  238. package/dist/harnesses/impls/hermes-agent/harness.js +104 -0
  239. package/dist/harnesses/impls/hermes-agent/harness.js.map +1 -1
  240. package/dist/harnesses/impls/hermes-agent/prompt.d.ts +6 -6
  241. package/dist/harnesses/impls/hermes-agent/prompt.js +6 -6
  242. package/dist/harnesses/impls/index.d.ts +7 -0
  243. package/dist/harnesses/impls/index.js +16 -1
  244. package/dist/harnesses/impls/index.js.map +1 -1
  245. package/dist/harnesses/impls/learner/adapters/codex-code.d.ts +9 -0
  246. package/dist/harnesses/impls/learner/adapters/codex-code.js +30 -8
  247. package/dist/harnesses/impls/learner/adapters/codex-code.js.map +1 -1
  248. package/dist/harnesses/impls/learner/harness.d.ts +47 -4
  249. package/dist/harnesses/impls/learner/harness.js +105 -2
  250. package/dist/harnesses/impls/learner/harness.js.map +1 -1
  251. package/dist/harnesses/impls/learner/harvest.d.ts +1 -1
  252. package/dist/harnesses/impls/learner/harvest.js +23 -5
  253. package/dist/harnesses/impls/learner/harvest.js.map +1 -1
  254. package/dist/harnesses/impls/learner/plugin-path.d.ts +0 -13
  255. package/dist/harnesses/impls/learner/plugin-path.js +35 -15
  256. package/dist/harnesses/impls/learner/plugin-path.js.map +1 -1
  257. package/dist/harnesses/impls/learner/restoration-patch.d.ts +2 -2
  258. package/dist/harnesses/impls/learner/restoration-patch.js +25 -6
  259. package/dist/harnesses/impls/learner/restoration-patch.js.map +1 -1
  260. package/dist/harnesses/impls/learner/types.d.ts +11 -0
  261. package/dist/harnesses/impls/stub.d.ts +58 -0
  262. package/dist/harnesses/impls/stub.js +89 -0
  263. package/dist/harnesses/impls/stub.js.map +1 -0
  264. package/dist/harnesses/impls/swe-rebench-v2-evaluator/eval-runner.d.ts +69 -50
  265. package/dist/harnesses/impls/swe-rebench-v2-evaluator/eval-runner.js +199 -94
  266. package/dist/harnesses/impls/swe-rebench-v2-evaluator/eval-runner.js.map +1 -1
  267. package/dist/harnesses/impls/swe-rebench-v2-evaluator/harness.d.ts +12 -1
  268. package/dist/harnesses/impls/swe-rebench-v2-evaluator/harness.js +121 -7
  269. package/dist/harnesses/impls/swe-rebench-v2-evaluator/harness.js.map +1 -1
  270. package/dist/harnesses/impls/swe-rebench-v2-evaluator/hf-fetcher.d.ts +88 -4
  271. package/dist/harnesses/impls/swe-rebench-v2-evaluator/hf-fetcher.js +143 -22
  272. package/dist/harnesses/impls/swe-rebench-v2-evaluator/hf-fetcher.js.map +1 -1
  273. package/dist/harnesses/impls/swe-rebench-v2-evaluator/index.d.ts +6 -0
  274. package/dist/harnesses/impls/swe-rebench-v2-evaluator/index.js +1 -1
  275. package/dist/harnesses/impls/swe-rebench-v2-evaluator/index.js.map +1 -1
  276. package/dist/harnesses/readiness-registry.d.ts +7 -0
  277. package/dist/harnesses/readiness-registry.js +18 -1
  278. package/dist/harnesses/readiness-registry.js.map +1 -1
  279. package/dist/learner/revert-decision.d.ts +59 -0
  280. package/dist/learner/revert-decision.js +53 -0
  281. package/dist/learner/revert-decision.js.map +1 -0
  282. package/dist/learner/revert-stats.d.ts +24 -0
  283. package/dist/learner/revert-stats.js +44 -0
  284. package/dist/learner/revert-stats.js.map +1 -0
  285. package/dist/main.js +470 -142
  286. package/dist/main.js.map +1 -1
  287. package/dist/mcp/get-codedigest-reward.d.ts +13 -0
  288. package/dist/mcp/get-codedigest-reward.js +23 -0
  289. package/dist/mcp/get-codedigest-reward.js.map +1 -0
  290. package/dist/mcp/server.js +23 -0
  291. package/dist/mcp/server.js.map +1 -1
  292. package/dist/observability/emit-event.d.ts +3 -2
  293. package/dist/observability/emit-event.js +22 -1
  294. package/dist/observability/emit-event.js.map +1 -1
  295. package/dist/operator-errors.d.ts +7 -0
  296. package/dist/operator-errors.js +13 -1
  297. package/dist/operator-errors.js.map +1 -1
  298. package/dist/plugins/learner/.claude-plugin/plugin.json +9 -0
  299. package/dist/plugins/learner/.codex-plugin/plugin.json +39 -0
  300. package/dist/plugins/learner/AGENTS.md +40 -0
  301. package/dist/plugins/learner/CLAUDE.md +33 -0
  302. package/dist/plugins/learner/README.md +59 -0
  303. package/dist/plugins/learner/hooks/hooks.json +16 -0
  304. package/dist/plugins/learner/hooks/session-start +38 -0
  305. package/dist/plugins/learner/skills/learn/SKILL.md +412 -0
  306. package/dist/plugins/learner/skills/learn/analyst-prompt.md +68 -0
  307. package/dist/plugins/learner/skills/learn/consolidator-prompt.md +111 -0
  308. package/dist/plugins/learner/skills/learn/explorer-prompt.md +53 -0
  309. package/dist/plugins/learner/skills/learn/planner-prompt.md +87 -0
  310. package/dist/plugins/learner/skills/learn/promoter-prompt.md +184 -0
  311. package/dist/plugins/learner/skills/learn/step-worker-prompt.md +47 -0
  312. package/dist/plugins/learner/skills/learn/strategist-prompt.md +85 -0
  313. package/dist/preflight/pidfile-liveness.d.ts +44 -0
  314. package/dist/preflight/pidfile-liveness.js +103 -0
  315. package/dist/preflight/pidfile-liveness.js.map +1 -0
  316. package/dist/preflight/rpc-network.d.ts +40 -0
  317. package/dist/preflight/rpc-network.js +67 -1
  318. package/dist/preflight/rpc-network.js.map +1 -1
  319. package/dist/restart-daemon.d.ts +90 -0
  320. package/dist/restart-daemon.js +95 -0
  321. package/dist/restart-daemon.js.map +1 -0
  322. package/dist/rpc/transport.d.ts +109 -0
  323. package/dist/rpc/transport.js +220 -0
  324. package/dist/rpc/transport.js.map +1 -0
  325. package/dist/scripts/donation-consumption-acceptance.js +7 -28
  326. package/dist/scripts/donation-consumption-acceptance.js.map +1 -1
  327. package/dist/scripts/swe-rebench-v2-pytest-missing.json +16 -0
  328. package/dist/setup/halt-mode.d.ts +14 -0
  329. package/dist/setup/halt-mode.js +17 -0
  330. package/dist/setup/halt-mode.js.map +1 -0
  331. package/dist/solver-nets/prediction-operator-ux.d.ts +1 -2
  332. package/dist/solver-nets/prediction-operator-ux.js +90 -47
  333. package/dist/solver-nets/prediction-operator-ux.js.map +1 -1
  334. package/dist/solver-nets/registry.d.ts +20 -1
  335. package/dist/solver-nets/registry.js +38 -25
  336. package/dist/solver-nets/registry.js.map +1 -1
  337. package/dist/solver-types/_swe-rebench-v2-pool-cache.d.ts +58 -0
  338. package/dist/solver-types/_swe-rebench-v2-pool-cache.js +87 -0
  339. package/dist/solver-types/_swe-rebench-v2-pool-cache.js.map +1 -0
  340. package/dist/solver-types/_swe-rebench-v2-pool.d.ts +9 -2
  341. package/dist/solver-types/_swe-rebench-v2-pool.js +15 -20
  342. package/dist/solver-types/_swe-rebench-v2-pool.js.map +1 -1
  343. package/dist/solver-types/_swe-rebench-v2-state.d.ts +15 -0
  344. package/dist/solver-types/_swe-rebench-v2-state.js +19 -0
  345. package/dist/solver-types/_swe-rebench-v2-state.js.map +1 -1
  346. package/dist/solver-types/_swe-rebench-v2-substrate.d.ts +1 -0
  347. package/dist/solver-types/_swe-rebench-v2-substrate.js +10 -0
  348. package/dist/solver-types/_swe-rebench-v2-substrate.js.map +1 -1
  349. package/dist/solver-types/_swe-rebench-v2-validated-pool.d.ts +145 -2
  350. package/dist/solver-types/_swe-rebench-v2-validated-pool.js +482 -44
  351. package/dist/solver-types/_swe-rebench-v2-validated-pool.js.map +1 -1
  352. package/dist/solver-types/swe-rebench-v2-auto.d.ts +38 -14
  353. package/dist/solver-types/swe-rebench-v2-auto.js +87 -28
  354. package/dist/solver-types/swe-rebench-v2-auto.js.map +1 -1
  355. package/dist/solver-types/swe-rebench-v2.d.ts +19 -2
  356. package/dist/solver-types/swe-rebench-v2.js +351 -96
  357. package/dist/solver-types/swe-rebench-v2.js.map +1 -1
  358. package/dist/solvernets/daemon-init.d.ts +10 -2
  359. package/dist/solvernets/daemon-init.js +22 -2
  360. package/dist/solvernets/daemon-init.js.map +1 -1
  361. package/dist/solvernets/launched-record-dispatcher.d.ts +4 -0
  362. package/dist/solvernets/launched-record-dispatcher.js +41 -7
  363. package/dist/solvernets/launched-record-dispatcher.js.map +1 -1
  364. package/dist/solvernets/registry-client-erc8004.js +11 -0
  365. package/dist/solvernets/registry-client-erc8004.js.map +1 -1
  366. package/dist/solvernets/store.d.ts +7 -2
  367. package/dist/solvernets/store.js +1 -0
  368. package/dist/solvernets/store.js.map +1 -1
  369. package/dist/spend/cost-surface-status.d.ts +10 -0
  370. package/dist/spend/cost-surface-status.js +22 -0
  371. package/dist/spend/cost-surface-status.js.map +1 -0
  372. package/dist/spend/credential.d.ts +8 -0
  373. package/dist/spend/credential.js +30 -0
  374. package/dist/spend/credential.js.map +1 -0
  375. package/dist/spend/daemon-config.d.ts +13 -0
  376. package/dist/spend/daemon-config.js +24 -0
  377. package/dist/spend/daemon-config.js.map +1 -0
  378. package/dist/spend/pricing.d.ts +16 -0
  379. package/dist/spend/pricing.js +26 -0
  380. package/dist/spend/pricing.js.map +1 -0
  381. package/dist/spend/record.d.ts +13 -0
  382. package/dist/spend/record.js +30 -0
  383. package/dist/spend/record.js.map +1 -0
  384. package/dist/spend/usage.d.ts +27 -0
  385. package/dist/spend/usage.js +113 -0
  386. package/dist/spend/usage.js.map +1 -0
  387. package/dist/store/store.d.ts +61 -0
  388. package/dist/store/store.js +302 -7
  389. package/dist/store/store.js.map +1 -1
  390. package/dist/tasks/sources.d.ts +18 -1
  391. package/dist/tasks/sources.js +33 -5
  392. package/dist/tasks/sources.js.map +1 -1
  393. package/dist/trajectory/transcript-parsers/codex-session.d.ts +12 -6
  394. package/dist/trajectory/transcript-parsers/codex-session.js +114 -13
  395. package/dist/trajectory/transcript-parsers/codex-session.js.map +1 -1
  396. package/dist/trajectory/transcript-parsers/types.d.ts +8 -8
  397. package/dist/trajectory/transcript-session-dirs.d.ts +18 -0
  398. package/dist/trajectory/transcript-session-dirs.js +85 -0
  399. package/dist/trajectory/transcript-session-dirs.js.map +1 -0
  400. package/dist/trajectory/transcript-watcher.d.ts +20 -1
  401. package/dist/trajectory/transcript-watcher.js +98 -32
  402. package/dist/trajectory/transcript-watcher.js.map +1 -1
  403. package/dist/tx-retry.d.ts +166 -19
  404. package/dist/tx-retry.js +310 -32
  405. package/dist/tx-retry.js.map +1 -1
  406. package/dist/types/payloads/portfolio-v0.d.ts +3 -3
  407. package/dist/types/payloads/prediction-apy-v0.d.ts +8 -8
  408. package/dist/types/payloads/prediction-v0.d.ts +17 -17
  409. package/dist/types/task-document.d.ts +392 -0
  410. package/dist/types/task-document.js +10 -0
  411. package/dist/types/task-document.js.map +1 -1
  412. package/dist/types/task.d.ts +28 -0
  413. package/dist/util/extract-tx-hash.d.ts +14 -0
  414. package/dist/util/extract-tx-hash.js +19 -0
  415. package/dist/util/extract-tx-hash.js.map +1 -0
  416. package/dist/vendor/@jinn-network/sdk/dist/contracts.js +1 -1
  417. package/dist/vendor/@jinn-network/sdk/dist/solvernets/manifest-schema.d.ts +3 -0
  418. package/dist/vendor/@jinn-network/sdk/dist/solvernets/manifest-schema.js +1 -0
  419. package/package.json +37 -13
  420. package/plugins/learner/skills/learn/consolidator-prompt.md +18 -1
  421. package/plugins/learner/skills/learn/promoter-prompt.md +72 -1
  422. package/plugins/swe-rebench-v2-diffmin/README.md +10 -9
  423. package/plugins/swe-rebench-v2-diffmin/jinn.plugin.json +1 -1
  424. package/plugins/swe-rebench-v2-diffmin/skills/diffmin/SKILL.md +15 -10
  425. package/plugins/swe-rebench-v2-diffmin/skills/test-map/SKILL.md +10 -12
  426. package/plugins/swe-rebench-v2-runtime/.claude-plugin/plugin.json +1 -1
  427. package/plugins/swe-rebench-v2-runtime/.codex-plugin/plugin.json +3 -3
  428. package/plugins/swe-rebench-v2-runtime/README.md +6 -6
  429. package/plugins/swe-rebench-v2-runtime/jinn.plugin.json +2 -3
  430. package/plugins/swe-rebench-v2-runtime/skills/task/SKILL.md +69 -0
  431. package/dist/dashboard/assets/index-DOlzFN8a.css +0 -32
  432. package/dist/dashboard/assets/index-NkZ7CTAT.js +0 -140
  433. package/plugins/swe-rebench-v2-runtime/skills/orient/SKILL.md +0 -29
  434. package/plugins/swe-rebench-v2-runtime/skills/plan/SKILL.md +0 -53
@@ -20,11 +20,95 @@ import { isUnauthorizedAccountError } from '../errors/unauthorized-account.js';
20
20
  import { createJinnPublicClient, createJinnWalletClient } from './viem-clients.js';
21
21
  import { isTransientEthReadError } from '../chain-read-errors.js';
22
22
  import { nextFleetServiceIndex } from './next-service-index.js';
23
+ import { displayFleetServiceIndex } from './fleet-display-index.js';
23
24
  import { rpcHostForDisplay } from '../preflight/rpc-network.js';
24
25
  import { detectDeprecatedTestnetSetup, migrateDeprecatedTestnetSetup, } from './testnet-setup-migration.js';
25
26
  const addr = (value) => getAddress(value);
26
27
  const SAFE_TOKEN_BOOTSTRAP_MULTIPLIER = 2n;
27
- const STANDARD_MASTER_BOOTSTRAP_MULTIPLIER = 2n;
28
+ /**
29
+ * 2× cold-start headroom for master ETH target on a fresh bootstrap.
30
+ *
31
+ * Gas accounting for a single standard-mode service on first run:
32
+ * ~1.3M gas for the Safe deploy + stake + mech (at 2 gwei ≈ 0.0026 ETH)
33
+ * + 0.002 ETH Safe seed (sent to the Safe so it can pay mech fees)
34
+ * ≈ 0.0046 ETH minimum; 2× gives ≈ 0.009–0.010 ETH — the bootstrap
35
+ * `minEoaGasEth` default.
36
+ *
37
+ * Used by {@link stage1MinMasterEth} to size the Stage 1 master gas budget.
38
+ *
39
+ * Single source of truth: imported by funding-plan.ts.
40
+ */
41
+ export const STANDARD_MASTER_BOOTSTRAP_MULTIPLIER = 2n;
42
+ /**
43
+ * Self-bond mode needs much more ETH per service than standard mode because
44
+ * the master funds the agent which then pays for: Safe deploy, 5 service
45
+ * registry txs (create, activate, register, deploy, stake), and mech deploy.
46
+ * Roughly 15 txs at varying gas costs. 0.03 ETH per service is a safe
47
+ * estimate. Single source of truth: imported by funding-plan.ts.
48
+ */
49
+ export const SELF_BOND_ETH_PER_SERVICE = 30000000000000000n; // 0.03 ETH
50
+ /**
51
+ * Single source of truth for the master-ETH cold-start funding gate.
52
+ *
53
+ * Both the mutating bootstrapper ({@link FleetBootstrapper.ensureStage1And2})
54
+ * and the read-only funding plan (`planFleetFunding` in funding-plan.ts) route
55
+ * through this helper, so a migration-wiped fleet computes an identical
56
+ * required-ETH gate in both views. Re-implementing the gate inline at either
57
+ * call site is the u34i cross-module invariant-drift hazard — do not do it.
58
+ *
59
+ * Standard-mode gate has three branches:
60
+ * 1. `standardFleetAlreadyComplete` — fleet already has its full target of
61
+ * operational services and no deprecated-setup migration is pending →
62
+ * `0n` (nothing to fund).
63
+ * 2. `preStage1` — no fleet identity yet (`fleet_stage === 'none'` or no
64
+ * fleet state at all) → the Stage 1 gate from {@link stage1MinMasterEth},
65
+ * which covers the master → agent transfer plus the master's own gas
66
+ * reserve. See jinn-mono-u34i.
67
+ * 3. otherwise — the Stage 2 master gas budget: `minEoaGasEth` (stake gas)
68
+ * plus a per-extra-service top-up transfer for services 2..N.
69
+ *
70
+ * Self-bond mode is a flat `SELF_BOND_ETH_PER_SERVICE × targetServices`
71
+ * regardless of stage.
72
+ *
73
+ * @param services Persisted service states
74
+ * @param minEoaGasEth Configured minimum EOA gas target (wei)
75
+ * @param pendingSetupMigration True when a deprecated testnet setup is
76
+ * detected — suppresses the `standardFleetAlreadyComplete` short-circuit so a
77
+ * migration-wiped fleet is correctly treated as needing funding. Both call
78
+ * sites MUST pass this so the bootstrapper gate and the funding-plan view
79
+ * agree for migration-wiped fleets.
80
+ * @param targetServices How many services the fleet is aiming for
81
+ * @param stakingMode `'standard'` (default) or `'self-bond'`
82
+ * @param preStage1 True when fleet identity is not yet provisioned —
83
+ * selects the Stage 1 gate. The bootstrapper passes `false` here because it
84
+ * only computes this gate *after* `ensureStage1` succeeds.
85
+ */
86
+ export function computeRequiredMasterEth({ services, minEoaGasEth, pendingSetupMigration = false, targetServices = 1, stakingMode = 'standard', preStage1 = false, }) {
87
+ if (stakingMode !== 'standard') {
88
+ return SELF_BOND_ETH_PER_SERVICE * BigInt(targetServices);
89
+ }
90
+ // Reconciled `standardFleetAlreadyComplete` — a single definition replacing
91
+ // the three historic inline variants. Adopts the strictest of them (the
92
+ // FleetBootstrapper variant): the fleet must have at least `targetServices`
93
+ // rows AND every row must be operational AND no deprecated-setup migration
94
+ // may be pending. A migration-wiped fleet (which sets
95
+ // `pendingSetupMigration`) is therefore never short-circuited to `0n`.
96
+ const standardFleetAlreadyComplete = services.length >= targetServices &&
97
+ services.every(s => s.step !== undefined && isOperationalServiceStep(s.step)) &&
98
+ !pendingSetupMigration;
99
+ if (standardFleetAlreadyComplete)
100
+ return 0n;
101
+ if (preStage1) {
102
+ // Stage 1 gate: master → agent transfer (STAGE1_AGENT_ETH) + the master's
103
+ // own gas reserve, plus per-extra-service transfers. See jinn-mono-u34i.
104
+ return stage1MinMasterEth({ minEoaGasEth }, targetServices);
105
+ }
106
+ // Stage 2 master gas budget — covers distributor.stake() (~0.003 ETH at
107
+ // typical 6 gwei Base Sepolia) plus per-extra-service top-up transfers.
108
+ // Service 1 piggybacks on HD-1's Stage 1 funding, so the base term is a
109
+ // single `minEoaGasEth` (not `× 2`). See jinn-mono-u34i.
110
+ return minEoaGasEth + minEoaGasEth * BigInt(Math.max(0, targetServices - 1));
111
+ }
28
112
  /** Master ETH required to FINISH the whole bootstrap from a fresh start (not
29
113
  * just to enter Stage 1). Centralized so the daemon's ensureStage1 gate,
30
114
  * the read-side funding-plan, gather-status, and the panel faucet target
@@ -64,8 +148,17 @@ export function stage1MinMasterEth(config, targetServices = 1) {
64
148
  config.minEoaGasEth * STANDARD_MASTER_BOOTSTRAP_MULTIPLIER +
65
149
  extraServiceTransfers);
66
150
  }
67
- /** Conservative default: ~0.001 ETH/day master gas if not configured. */
68
- const DEFAULT_MASTER_ETH_DAILY_WEI = 1000000000000000n;
151
+ /**
152
+ * Conservative default: ~0.0005 ETH/day master gas if not configured.
153
+ *
154
+ * Post-bootstrap master burn is dominated by rare BalanceTopupLoop top-ups,
155
+ * not every-poll activity — the previous 0.001 ETH/day floor (alongside a
156
+ * poll-based blend, since removed) over-estimated steady-state burn and
157
+ * surfaced a misleading "1 days runway" dashboard reading at ~0.008 ETH
158
+ * balances (#288). Mirrored at client/src/api/status-build.ts; collapsing
159
+ * the two copies is a deferred follow-up per the #288 design note.
160
+ */
161
+ const DEFAULT_MASTER_ETH_DAILY_WEI = 500000000000000n;
69
162
  /** Warn when ETH above the minimum would last fewer than this many days at the daily estimate. */
70
163
  const MASTER_ETH_RUNWAY_WARN_DAYS = 7n;
71
164
  /**
@@ -210,16 +303,14 @@ export class FleetBootstrapper {
210
303
  : new Error(String(lastThrowError));
211
304
  }
212
305
  /**
213
- * Conservative daily master gas (wei): max(DEFAULT, rough tx count from poll interval × cost).
306
+ * Conservative daily master gas (wei). Returns the floor; operators who
307
+ * want a more aggressive estimate can still set `JINN_MASTER_ETH_DAILY_WEI`.
308
+ * See DEFAULT_MASTER_ETH_DAILY_WEI for rationale (#288). The
309
+ * `pollIntervalMs` parameter is vestigial since the poll-based blend was
310
+ * removed; kept so the constructor call site stays unchanged.
214
311
  */
215
- estimateMasterDailyGasWei(pollIntervalMs) {
216
- const interval = Math.max(pollIntervalMs ?? 5000, 1000);
217
- const pollsPerDay = 86400000 / interval;
218
- // Assume at most one funding-sized tx per ~600 polls (~50 min at 5s), capped at 12/day
219
- const txsPerDay = Math.min(Math.ceil(pollsPerDay / 600), 12);
220
- const txCostWei = 150000n * 2000000000n; // ~150k gas @ 2 gwei
221
- const fromPoll = BigInt(txsPerDay) * txCostWei;
222
- return fromPoll > DEFAULT_MASTER_ETH_DAILY_WEI ? fromPoll : DEFAULT_MASTER_ETH_DAILY_WEI;
312
+ estimateMasterDailyGasWei(_pollIntervalMs) {
313
+ return DEFAULT_MASTER_ETH_DAILY_WEI;
223
314
  }
224
315
  /**
225
316
  * Snapshot of the current persisted fleet state. Reads only — no chain
@@ -389,12 +480,8 @@ export class FleetBootstrapper {
389
480
  // Phase 1b: Check master funding for the full operator path.
390
481
  const masterAddress = state.master_address;
391
482
  let masterBalance = await this.publicClient.getBalance({ address: masterAddress });
392
- // Self-bond mode needs much more ETH than standard mode because the master
393
- // funds the agent which then pays for: Safe deploy, 5 service registry txs
394
- // (create, activate, register, deploy, stake), and mech deploy. Roughly
395
- // 15 txs at varying gas costs. 0.03 ETH per service is a safe estimate.
396
- // On re-runs, include ETH already held by funded agents/safes in the total.
397
- const SELF_BOND_ETH_PER_SERVICE = 30000000000000000n; // 0.03 ETH
483
+ // On re-runs, include ETH already held by funded agents/safes in the
484
+ // total for self-bond mode.
398
485
  let systemEth = masterBalance;
399
486
  if (this.stakingMode === 'self-bond') {
400
487
  for (const svc of state.services) {
@@ -416,26 +503,20 @@ export class FleetBootstrapper {
416
503
  stakingMode: this.stakingMode,
417
504
  currentStakingContract: this.config.stakingContract,
418
505
  }).services.length > 0;
419
- const completedCountBeforeFunding = state.services.filter(s => isOperationalServiceStep(s.step)).length;
420
- const standardFleetAlreadyComplete = this.stakingMode === 'standard' &&
421
- !pendingSetupMigration &&
422
- completedCountBeforeFunding >= this.targetServices;
423
- const standardFleetHasInProgressServices = this.stakingMode === 'standard' && state.services.length > 0;
424
- const requiredMasterEth = this.stakingMode === 'standard'
425
- ? (standardFleetAlreadyComplete
426
- ? 0n
427
- // Stage 2 master gas budget — covers distributor.stake() (~0.003
428
- // ETH at typical 6 gwei Base Sepolia) plus per-extra-service
429
- // top-up transfers. Previously this was `× 2` for fresh fleets,
430
- // which double-counted a service-1 transfer that doesn't actually
431
- // fire (HD-1 carries Stage 1 leftover, gets a conditional top-up
432
- // only if needed). See jinn-mono-u34i: the `× 2` figure also
433
- // exceeded the post-Stage-1 master balance at the operator-facing
434
- // 0.020 ETH budget by ~127k gwei of Stage 1 gas burn, causing a
435
- // second funding prompt.
436
- : this.config.minEoaGasEth +
437
- this.config.minEoaGasEth * BigInt(Math.max(0, this.targetServices - 1)))
438
- : SELF_BOND_ETH_PER_SERVICE * BigInt(this.targetServices);
506
+ // Single source of truth: the master-ETH gate is computed by
507
+ // `computeRequiredMasterEth` (defined above), the same helper the
508
+ // read-only `planFleetFunding` view routes through. Re-deriving it inline
509
+ // here is the u34i cross-module invariant-drift hazard. `ensureStage1And2`
510
+ // only reaches this point AFTER `ensureStage1` has succeeded, so the
511
+ // fleet is always past Stage 1 — `preStage1` is `false`.
512
+ const requiredMasterEth = computeRequiredMasterEth({
513
+ services: state.services,
514
+ minEoaGasEth: this.config.minEoaGasEth,
515
+ pendingSetupMigration,
516
+ targetServices: this.targetServices,
517
+ stakingMode: this.stakingMode,
518
+ preStage1: false,
519
+ });
439
520
  const autoFaucetEnabled = this.autoTestnetFaucet;
440
521
  // Re-sum system ETH (master + agent/safe balances for self-bond mode).
441
522
  // Hoisted so the drip loop below can refresh cheaply.
@@ -578,7 +659,7 @@ export class FleetBootstrapper {
578
659
  };
579
660
  }
580
661
  catch (error) {
581
- const { summary, hint, rawMessage } = formatBootstrapOperatorMessage(error);
662
+ const { summary, hint, rawMessage, category } = formatBootstrapOperatorMessage(error);
582
663
  const userMessage = hint !== undefined ? `${summary}\nHint: ${hint}` : summary;
583
664
  if (this.debug) {
584
665
  console.error(`[fleet-bootstrap] Bootstrap failed:`, error);
@@ -594,11 +675,21 @@ export class FleetBootstrapper {
594
675
  console.error(`[fleet-bootstrap] raw: ${rawMessage.split('\n')[0]}`);
595
676
  }
596
677
  }
678
+ // Extract a tx hash embedded in the error message by the on-chain revert
679
+ // paths (format: "...tx failed for service N: 0x<hash>" or
680
+ // "...tx reverted: 0x<hash>"). Surfaced in the fatal envelope so the SPA
681
+ // can render a block-explorer link. jinn-mono-hjex reviewer fix.
682
+ const txHashMatch = /(0x[a-fA-F0-9]{64})/.exec(rawMessage);
683
+ const txHash = txHashMatch ? txHashMatch[1] : null;
597
684
  return {
598
685
  ok: false,
599
686
  fleet_state: state,
600
687
  message: userMessage,
601
688
  rawErrorMessage: rawMessage,
689
+ // Preserve the structured category so the error envelope in main.ts
690
+ // can surface it in `details.category` for SPA consumers. jinn-mono-hjex.6
691
+ ...(category !== undefined ? { errorCategory: category } : {}),
692
+ ...(txHash !== null ? { txHash } : {}),
602
693
  };
603
694
  }
604
695
  }
@@ -957,8 +1048,24 @@ export class FleetBootstrapper {
957
1048
  }
958
1049
  if (onChainState === 2) {
959
1050
  console.error(`[jinn-earning] Noticed service ${svc.service_id} (fleet index ${index}) evicted on-chain; running distributor reStake to restake.`);
960
- state = await this.recoverEvictedService(state, mnemonic, index);
961
- svc = state.services.find(s => s.index === index);
1051
+ // #789: a startup reStake can revert (e.g. NotEnoughTimeStaked when the
1052
+ // service was re-staked < minStakingDuration ago) or fail transiently.
1053
+ // Treat it as non-fatal so the daemon still launches — work delivery and
1054
+ // JINN claims are decoupled from OLAS staking (JinnDistributor mints on
1055
+ // delivered-work counts, not stake state), so a failed startup reStake
1056
+ // must not block the operator from earning. The standalone EvictionLoop
1057
+ // retries on its own cadence when enabled; when staking is intentionally
1058
+ // dropped (evictionCheckIntervalMs=0) this simply leaves the service
1059
+ // evicted, which does not affect JINN earning.
1060
+ try {
1061
+ state = await this.recoverEvictedService(state, mnemonic, index);
1062
+ svc = state.services.find(s => s.index === index);
1063
+ }
1064
+ catch (err) {
1065
+ console.error(`[jinn-earning] Service ${svc.service_id} (fleet index ${index}) startup reStake failed (non-fatal); ` +
1066
+ `continuing launch and deferring to EvictionLoop if enabled: ` +
1067
+ `${err instanceof Error ? err.message : String(err)}`);
1068
+ }
962
1069
  }
963
1070
  }
964
1071
  if (isOperationalServiceStep(svc.step)) {
@@ -1044,6 +1151,39 @@ export class FleetBootstrapper {
1044
1151
  return this.store.updateService(index, { step: 'staked' });
1045
1152
  }
1046
1153
  }
1154
+ // Pre-stake precondition: if migration cleared service_id but kept agent_address,
1155
+ // check the EOA is not already registered on-chain as an agent instance. If it is,
1156
+ // calling stake() again would revert with AgentInstanceRegistered (selector 0x631695bd)
1157
+ // and there is nothing useful the operator can do without rotating the agent EOA.
1158
+ // Fail fast with a typed error instead of letting the contract revert.
1159
+ //
1160
+ // ServiceRegistryL2 exposes the `mapAgentInstanceOperators(address) → address` mapping:
1161
+ // it returns the operator address that registered the given agent instance, or the
1162
+ // zero address when no operator has bound that instance. A non-zero return means the
1163
+ // EOA is already bound. (There is no `mapAgentInstances(address) → uint256` getter on
1164
+ // the deployed registry — an earlier draft of this guard referenced one and was a
1165
+ // permanent no-op.)
1166
+ if (svc.agent_address && svc.service_id === null && this.config.serviceRegistry) {
1167
+ let alreadyBound = false;
1168
+ try {
1169
+ const boundOperator = (await this.publicClient.readContract({
1170
+ address: getAddress(this.config.serviceRegistry),
1171
+ abi: SERVICE_REGISTRY_L2_ABI,
1172
+ functionName: 'mapAgentInstanceOperators',
1173
+ args: [getAddress(svc.agent_address)],
1174
+ }));
1175
+ alreadyBound = boundOperator !== '0x0000000000000000000000000000000000000000';
1176
+ }
1177
+ catch {
1178
+ // Registry read failure is non-fatal — proceed and let stake() surface
1179
+ // the error if the agent really is bound.
1180
+ }
1181
+ if (alreadyBound) {
1182
+ throw new Error(`agent_already_bound: agent EOA ${svc.agent_address} is already registered as an agent instance on-chain. ` +
1183
+ `The previous setup retirement may have been incomplete. ` +
1184
+ `Contact support or rotate the agent EOA to continue.`);
1185
+ }
1186
+ }
1047
1187
  // Fresh distributor stake() creates a new on-chain service. If state still
1048
1188
  // references an old Safe (e.g. hand-edited JSON), sweep it before replacing.
1049
1189
  if (svc.service_id === null && svc.safe_address && state.master_address) {
@@ -1109,42 +1249,19 @@ export class FleetBootstrapper {
1109
1249
  const svc = state.services.find(s => s.index === index);
1110
1250
  const serviceId = svc.service_id;
1111
1251
  const stakingAddress = this.stakingAddressForService(svc);
1112
- // `reStake()` is operator-scoped: the master EOA must match the
1113
- // distributor's recorded `mapServiceIdCuratingAgents[serviceId]` entry.
1114
- // If it doesn't, the operator is likely using the wrong earning dir or
1115
- // password, or the service needs owner / managing-agent recovery.
1116
- const masterAccount = deriveMasterSigner(mnemonic);
1117
- const masterWallet = createJinnWalletClient(this.config.rpcUrl, this.chain, masterAccount);
1118
- const reStakeData = encodeFunctionData({
1119
- abi: STOLAS_DISTRIBUTOR_ABI,
1120
- functionName: 'reStake',
1121
- args: [stakingAddress, BigInt(serviceId)],
1252
+ const di = displayFleetServiceIndex(svc);
1253
+ // Delegate to the standalone exported helper (shared with EvictionLoop /
1254
+ // the dashboard "Re-stake now" CTA). This eliminates the duplicate
1255
+ // implementation (jinn-mono-hjex.3).
1256
+ await recoverEvictedService({
1257
+ serviceDisplayIndex: di,
1258
+ serviceId,
1259
+ stakingAddress: stakingAddress,
1260
+ distributorAddress: this.config.distributorAddress,
1261
+ rpcUrl: this.config.rpcUrl,
1262
+ chain: this.chain,
1263
+ mnemonic,
1122
1264
  });
1123
- console.error(`[fleet-bootstrap] Service ${index}: calling distributor.reStake() for evicted service ${serviceId}`);
1124
- let reStakeHash;
1125
- try {
1126
- reStakeHash = await viemSendTransactionWithRetry(masterWallet, this.publicClient, {
1127
- account: masterAccount,
1128
- to: addr(this.config.distributorAddress),
1129
- data: reStakeData,
1130
- gas: 1500000n,
1131
- });
1132
- }
1133
- catch (err) {
1134
- const message = flattenErrorMessage(err);
1135
- if (isUnauthorizedAccountError(message)) {
1136
- throw new Error(`Service ${index} (service_id ${serviceId}) is evicted on the staking proxy, but master EOA ${masterAccount.address} is not authorized to reStake it. ` +
1137
- `The distributor only permits the recorded service operator, a managing agent, or the owner. ` +
1138
- `Verify JINN_EARNING_DIR and JINN_PASSWORD derive the original master EOA for this service, then re-run jinn bootstrap; otherwise request owner / managing-agent recovery or abandon-and-rebootstrap. ` +
1139
- `reStake revert: ${message}`);
1140
- }
1141
- throw err;
1142
- }
1143
- const receipt = await waitForTransactionReceiptWithRetry(this.publicClient, reStakeHash);
1144
- if (receipt.status !== 'success') {
1145
- throw new Error(`reStake failed for service ${index}: ${reStakeHash}`);
1146
- }
1147
- console.error(`[fleet-bootstrap] Service ${index}: reStake confirmed (tx: ${reStakeHash})`);
1148
1265
  // Service is now Staked again with the same service_id, safe_address, and mech_address.
1149
1266
  // Step back to `mech_deployed` so the resume loop advances through
1150
1267
  // `stepRegisterAgent` (idempotent — short-circuits if `agent_id` is
@@ -1897,4 +2014,50 @@ export class FleetBootstrapper {
1897
2014
  }
1898
2015
  /** @deprecated Use FleetBootstrapper */
1899
2016
  export const EarningBootstrapper = FleetBootstrapper;
2017
+ /**
2018
+ * Re-stake an evicted service by calling `distributor.reStake(stakingProxy, serviceId)`.
2019
+ *
2020
+ * Extracted from `FleetBootstrapper.recoverEvictedService` so it can be called
2021
+ * from the in-process `EvictionLoop` without requiring a full bootstrapper
2022
+ * context (jinn-mono-hjex.3).
2023
+ *
2024
+ * The caller is responsible for advancing the local service step back to
2025
+ * `mech_deployed` after this returns (just like the bootstrapper resume path does).
2026
+ */
2027
+ export async function recoverEvictedService(opts) {
2028
+ const { serviceDisplayIndex, serviceId, stakingAddress, distributorAddress, rpcUrl, chain, mnemonic, } = opts;
2029
+ const masterAccount = deriveMasterSigner(mnemonic);
2030
+ const publicClient = createJinnPublicClient(rpcUrl, chain);
2031
+ const masterWallet = createJinnWalletClient(rpcUrl, chain, masterAccount);
2032
+ const reStakeData = encodeFunctionData({
2033
+ abi: STOLAS_DISTRIBUTOR_ABI,
2034
+ functionName: 'reStake',
2035
+ args: [addr(stakingAddress), BigInt(serviceId)],
2036
+ });
2037
+ console.error(`[eviction-recovery] Service ${serviceDisplayIndex}: calling distributor.reStake() for evicted service ${serviceId}`);
2038
+ let reStakeHash;
2039
+ try {
2040
+ reStakeHash = await viemSendTransactionWithRetry(masterWallet, publicClient, {
2041
+ account: masterAccount,
2042
+ to: addr(distributorAddress),
2043
+ data: reStakeData,
2044
+ gas: 1500000n,
2045
+ });
2046
+ }
2047
+ catch (err) {
2048
+ const message = flattenErrorMessage(err);
2049
+ if (isUnauthorizedAccountError(message)) {
2050
+ throw new Error(`Service ${serviceDisplayIndex} (service_id ${serviceId}) is evicted on the staking proxy, but master EOA ` +
2051
+ `${masterAccount.address} is not authorized to reStake it. ` +
2052
+ `Verify JINN_EARNING_DIR and JINN_PASSWORD derive the original master EOA for this service. ` +
2053
+ `reStake revert: ${message}`);
2054
+ }
2055
+ throw err;
2056
+ }
2057
+ const receipt = await waitForTransactionReceiptWithRetry(publicClient, reStakeHash);
2058
+ if (receipt.status !== 'success') {
2059
+ throw new Error(`reStake failed for service ${serviceDisplayIndex}: ${reStakeHash}`);
2060
+ }
2061
+ console.error(`[eviction-recovery] Service ${serviceDisplayIndex}: reStake confirmed (tx: ${reStakeHash})`);
2062
+ }
1900
2063
  //# sourceMappingURL=bootstrap.js.map