@jinn-network/client 0.1.7 → 0.1.8-canary.09a3b2f6

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 (438) hide show
  1. package/README.md +67 -1
  2. package/dist/adapters/mech/adapter.d.ts +39 -2
  3. package/dist/adapters/mech/adapter.js +178 -20
  4. package/dist/adapters/mech/adapter.js.map +1 -1
  5. package/dist/adapters/mech/contracts.d.ts +22 -1
  6. package/dist/adapters/mech/contracts.js +96 -52
  7. package/dist/adapters/mech/contracts.js.map +1 -1
  8. package/dist/adapters/mech/safe-revert.d.ts +4 -0
  9. package/dist/adapters/mech/safe-revert.js +5 -1
  10. package/dist/adapters/mech/safe-revert.js.map +1 -1
  11. package/dist/adapters/mech/safe.d.ts +1 -1
  12. package/dist/adapters/mech/safe.js +10 -4
  13. package/dist/adapters/mech/safe.js.map +1 -1
  14. package/dist/adapters/mech/types.d.ts +6 -1
  15. package/dist/adapters/mech/types.js.map +1 -1
  16. package/dist/agent/operator-claude.js +8 -0
  17. package/dist/agent/operator-claude.js.map +1 -1
  18. package/dist/api/activity-events-endpoint.d.ts +14 -0
  19. package/dist/api/activity-events-endpoint.js +59 -0
  20. package/dist/api/activity-events-endpoint.js.map +1 -0
  21. package/dist/api/bootstrap-endpoint.d.ts +1 -2
  22. package/dist/api/bootstrap-endpoint.js +42 -24
  23. package/dist/api/bootstrap-endpoint.js.map +1 -1
  24. package/dist/api/codex-doctor-endpoint.d.ts +22 -5
  25. package/dist/api/codex-doctor-endpoint.js +136 -17
  26. package/dist/api/codex-doctor-endpoint.js.map +1 -1
  27. package/dist/api/debug-report-endpoint.d.ts +27 -0
  28. package/dist/api/debug-report-endpoint.js +157 -0
  29. package/dist/api/debug-report-endpoint.js.map +1 -0
  30. package/dist/api/discovery-endpoint.d.ts +1 -0
  31. package/dist/api/discovery-endpoint.js +24 -0
  32. package/dist/api/discovery-endpoint.js.map +1 -1
  33. package/dist/api/fleet-build.d.ts +1 -7
  34. package/dist/api/fleet-build.js +0 -7
  35. package/dist/api/fleet-build.js.map +1 -1
  36. package/dist/api/gather-status.d.ts +39 -0
  37. package/dist/api/gather-status.js +181 -84
  38. package/dist/api/gather-status.js.map +1 -1
  39. package/dist/api/hermes-doctor-endpoint.d.ts +15 -7
  40. package/dist/api/hermes-doctor-endpoint.js +56 -19
  41. package/dist/api/hermes-doctor-endpoint.js.map +1 -1
  42. package/dist/api/launcher-status.d.ts +4 -2
  43. package/dist/api/launcher-status.js +11 -10
  44. package/dist/api/launcher-status.js.map +1 -1
  45. package/dist/api/launcher-tasks.d.ts +1 -1
  46. package/dist/api/launcher-tasks.js +12 -8
  47. package/dist/api/launcher-tasks.js.map +1 -1
  48. package/dist/api/loop-completion-build.d.ts +79 -0
  49. package/dist/api/loop-completion-build.js +155 -0
  50. package/dist/api/loop-completion-build.js.map +1 -0
  51. package/dist/api/operator-artifacts-endpoint.js +73 -6
  52. package/dist/api/operator-artifacts-endpoint.js.map +1 -1
  53. package/dist/api/portfolio-v0-build.d.ts +7 -1
  54. package/dist/api/portfolio-v0-build.js +6 -2
  55. package/dist/api/portfolio-v0-build.js.map +1 -1
  56. package/dist/api/prediction-v1-build.d.ts +6 -0
  57. package/dist/api/prediction-v1-build.js +3 -1
  58. package/dist/api/prediction-v1-build.js.map +1 -1
  59. package/dist/api/server.d.ts +17 -0
  60. package/dist/api/server.js +40 -1
  61. package/dist/api/server.js.map +1 -1
  62. package/dist/api/setup-endpoints.d.ts +13 -9
  63. package/dist/api/setup-endpoints.js +50 -173
  64. package/dist/api/setup-endpoints.js.map +1 -1
  65. package/dist/api/solvernets-endpoints.js +33 -63
  66. package/dist/api/solvernets-endpoints.js.map +1 -1
  67. package/dist/api/status-build.d.ts +140 -17
  68. package/dist/api/status-build.js +47 -34
  69. package/dist/api/status-build.js.map +1 -1
  70. package/dist/api/status-harness-rollup.d.ts +35 -0
  71. package/dist/api/status-harness-rollup.js +45 -0
  72. package/dist/api/status-harness-rollup.js.map +1 -0
  73. package/dist/api/status-rollup-build.d.ts +0 -4
  74. package/dist/api/status-rollup-build.js +0 -4
  75. package/dist/api/status-rollup-build.js.map +1 -1
  76. package/dist/api/task-runs-build.d.ts +8 -0
  77. package/dist/api/task-runs-build.js +5 -1
  78. package/dist/api/task-runs-build.js.map +1 -1
  79. package/dist/build-info.json +4 -4
  80. package/dist/build-meta.json +1 -1
  81. package/dist/captures/live-publisher.js +24 -4
  82. package/dist/captures/live-publisher.js.map +1 -1
  83. package/dist/captures/publish.d.ts +1 -1
  84. package/dist/chain-read-errors.d.ts +12 -0
  85. package/dist/chain-read-errors.js +26 -1
  86. package/dist/chain-read-errors.js.map +1 -1
  87. package/dist/cli/commands/codedigest-revert-check.d.ts +33 -0
  88. package/dist/cli/commands/codedigest-revert-check.js +253 -0
  89. package/dist/cli/commands/codedigest-revert-check.js.map +1 -0
  90. package/dist/cli/commands/doctor.d.ts +3 -0
  91. package/dist/cli/commands/doctor.js +35 -0
  92. package/dist/cli/commands/doctor.js.map +1 -1
  93. package/dist/cli/commands/eval.d.ts +76 -0
  94. package/dist/cli/commands/eval.js +401 -0
  95. package/dist/cli/commands/eval.js.map +1 -0
  96. package/dist/cli/commands/rewards.d.ts +2 -0
  97. package/dist/cli/commands/rewards.js +27 -0
  98. package/dist/cli/commands/rewards.js.map +1 -1
  99. package/dist/cli/commands/solver-nets.d.ts +1 -0
  100. package/dist/cli/commands/solver-nets.js +245 -22
  101. package/dist/cli/commands/solver-nets.js.map +1 -1
  102. package/dist/cli/commands/solver-plugins-block.d.ts +33 -0
  103. package/dist/cli/commands/solver-plugins-block.js +118 -0
  104. package/dist/cli/commands/solver-plugins-block.js.map +1 -0
  105. package/dist/cli/commands/solver-plugins-feedback.d.ts +72 -0
  106. package/dist/cli/commands/solver-plugins-feedback.js +262 -0
  107. package/dist/cli/commands/solver-plugins-feedback.js.map +1 -0
  108. package/dist/cli/commands/solver-plugins-read.d.ts +54 -0
  109. package/dist/cli/commands/solver-plugins-read.js +259 -0
  110. package/dist/cli/commands/solver-plugins-read.js.map +1 -0
  111. package/dist/cli/commands/solver-plugins.d.ts +35 -0
  112. package/dist/cli/commands/solver-plugins.js +399 -2
  113. package/dist/cli/commands/solver-plugins.js.map +1 -1
  114. package/dist/cli/commands/status.js +0 -1
  115. package/dist/cli/commands/status.js.map +1 -1
  116. package/dist/cli/commands/tasks.js +15 -2
  117. package/dist/cli/commands/tasks.js.map +1 -1
  118. package/dist/cli/index.js +4 -0
  119. package/dist/cli/index.js.map +1 -1
  120. package/dist/cli/task-native-readiness.d.ts +7 -0
  121. package/dist/cli/task-native-readiness.js +7 -5
  122. package/dist/cli/task-native-readiness.js.map +1 -1
  123. package/dist/config.d.ts +206 -232
  124. package/dist/config.js +289 -107
  125. package/dist/config.js.map +1 -1
  126. package/dist/daemon/ai-units-gate.d.ts +54 -0
  127. package/dist/daemon/ai-units-gate.js +83 -0
  128. package/dist/daemon/ai-units-gate.js.map +1 -0
  129. package/dist/daemon/creator.js +13 -0
  130. package/dist/daemon/creator.js.map +1 -1
  131. package/dist/daemon/daemon.d.ts +10 -0
  132. package/dist/daemon/daemon.js +205 -30
  133. package/dist/daemon/daemon.js.map +1 -1
  134. package/dist/daemon/eviction-loop.d.ts +7 -0
  135. package/dist/daemon/eviction-loop.js +16 -0
  136. package/dist/daemon/eviction-loop.js.map +1 -1
  137. package/dist/daemon/gate-logger.d.ts +9 -0
  138. package/dist/daemon/gate-logger.js +2 -0
  139. package/dist/daemon/gate-logger.js.map +1 -0
  140. package/dist/daemon/jinn-claim-loop.js +22 -4
  141. package/dist/daemon/jinn-claim-loop.js.map +1 -1
  142. package/dist/daemon/readiness-gate.d.ts +1 -4
  143. package/dist/daemon/readiness-gate.js.map +1 -1
  144. package/dist/daemon/spend-cap-gate.d.ts +40 -0
  145. package/dist/daemon/spend-cap-gate.js +46 -0
  146. package/dist/daemon/spend-cap-gate.js.map +1 -0
  147. package/dist/dashboard/assets/index-3quVQqik.js +167 -0
  148. package/dist/dashboard/assets/index-BVAWkLwY.css +1 -0
  149. package/dist/dashboard/index.html +2 -2
  150. package/dist/discovery/http.d.ts +7 -0
  151. package/dist/discovery/http.js +567 -24
  152. package/dist/discovery/http.js.map +1 -1
  153. package/dist/discovery/onchain.js +197 -5
  154. package/dist/discovery/onchain.js.map +1 -1
  155. package/dist/discovery/types.d.ts +235 -0
  156. package/dist/discovery/types.js +40 -0
  157. package/dist/discovery/types.js.map +1 -1
  158. package/dist/discovery/with-fallback.js +41 -0
  159. package/dist/discovery/with-fallback.js.map +1 -1
  160. package/dist/earning/bootstrap.d.ts +31 -3
  161. package/dist/earning/bootstrap.js +94 -22
  162. package/dist/earning/bootstrap.js.map +1 -1
  163. package/dist/earning/faucet.d.ts +1 -1
  164. package/dist/earning/faucet.js +2 -2
  165. package/dist/earning/faucet.js.map +1 -1
  166. package/dist/earning/safe-adapter.js +34 -11
  167. package/dist/earning/safe-adapter.js.map +1 -1
  168. package/dist/earning/types.d.ts +6 -6
  169. package/dist/earning/viem-clients.d.ts +11 -4
  170. package/dist/earning/viem-clients.js +14 -5
  171. package/dist/earning/viem-clients.js.map +1 -1
  172. package/dist/erc8004/identity.d.ts +19 -3
  173. package/dist/erc8004/identity.js +38 -11
  174. package/dist/erc8004/identity.js.map +1 -1
  175. package/dist/erc8004/index.d.ts +1 -1
  176. package/dist/erc8004/index.js.map +1 -1
  177. package/dist/eval/eval-harness-run.d.ts +63 -0
  178. package/dist/eval/eval-harness-run.js +123 -0
  179. package/dist/eval/eval-harness-run.js.map +1 -0
  180. package/dist/eval/orchestrator.d.ts +163 -0
  181. package/dist/eval/orchestrator.js +232 -0
  182. package/dist/eval/orchestrator.js.map +1 -0
  183. package/dist/eval/paired.d.ts +68 -0
  184. package/dist/eval/paired.js +93 -0
  185. package/dist/eval/paired.js.map +1 -0
  186. package/dist/eval/resolve-slate-tasks.d.ts +35 -0
  187. package/dist/eval/resolve-slate-tasks.js +56 -0
  188. package/dist/eval/resolve-slate-tasks.js.map +1 -0
  189. package/dist/eval/screen-discovery.d.ts +22 -0
  190. package/dist/eval/screen-discovery.js +71 -0
  191. package/dist/eval/screen-discovery.js.map +1 -0
  192. package/dist/eval/screen-progress.d.ts +41 -0
  193. package/dist/eval/screen-progress.js +60 -0
  194. package/dist/eval/screen-progress.js.map +1 -0
  195. package/dist/eval/screen-runner.d.ts +30 -0
  196. package/dist/eval/screen-runner.js +289 -0
  197. package/dist/eval/screen-runner.js.map +1 -0
  198. package/dist/eval/screen.d.ts +107 -0
  199. package/dist/eval/screen.js +159 -0
  200. package/dist/eval/screen.js.map +1 -0
  201. package/dist/eval/slope.d.ts +29 -0
  202. package/dist/eval/slope.js +46 -0
  203. package/dist/eval/slope.js.map +1 -0
  204. package/dist/eval/train-sequence.d.ts +35 -0
  205. package/dist/eval/train-sequence.js +59 -0
  206. package/dist/eval/train-sequence.js.map +1 -0
  207. package/dist/eval/wilson.d.ts +45 -0
  208. package/dist/eval/wilson.js +48 -0
  209. package/dist/eval/wilson.js.map +1 -0
  210. package/dist/events/types.d.ts +2 -2
  211. package/dist/harnesses/cost-estimates.d.ts +10 -31
  212. package/dist/harnesses/cost-estimates.js +11 -43
  213. package/dist/harnesses/cost-estimates.js.map +1 -1
  214. package/dist/harnesses/engine/canonical-json.js +5 -3
  215. package/dist/harnesses/engine/canonical-json.js.map +1 -1
  216. package/dist/harnesses/engine/engine.d.ts +37 -4
  217. package/dist/harnesses/engine/engine.js +151 -20
  218. package/dist/harnesses/engine/engine.js.map +1 -1
  219. package/dist/harnesses/engine/persistence.d.ts +38 -4
  220. package/dist/harnesses/engine/persistence.js +71 -6
  221. package/dist/harnesses/engine/persistence.js.map +1 -1
  222. package/dist/harnesses/engine/state.d.ts +9 -0
  223. package/dist/harnesses/engine/state.js +23 -10
  224. package/dist/harnesses/engine/state.js.map +1 -1
  225. package/dist/harnesses/impls/hermes-agent/adapter.d.ts +2 -0
  226. package/dist/harnesses/impls/hermes-agent/adapter.js +8 -5
  227. package/dist/harnesses/impls/hermes-agent/adapter.js.map +1 -1
  228. package/dist/harnesses/impls/hermes-agent/bootstrap.d.ts +1 -0
  229. package/dist/harnesses/impls/hermes-agent/bootstrap.js +10 -3
  230. package/dist/harnesses/impls/hermes-agent/bootstrap.js.map +1 -1
  231. package/dist/harnesses/impls/hermes-agent/config-builder.d.ts +1 -1
  232. package/dist/harnesses/impls/hermes-agent/config-builder.js +4 -2
  233. package/dist/harnesses/impls/hermes-agent/config-builder.js.map +1 -1
  234. package/dist/harnesses/impls/hermes-agent/harness.d.ts +31 -3
  235. package/dist/harnesses/impls/hermes-agent/harness.js +84 -7
  236. package/dist/harnesses/impls/hermes-agent/harness.js.map +1 -1
  237. package/dist/harnesses/impls/hermes-agent/prompt.d.ts +6 -6
  238. package/dist/harnesses/impls/hermes-agent/prompt.js +6 -6
  239. package/dist/harnesses/impls/index.d.ts +2 -0
  240. package/dist/harnesses/impls/index.js +2 -0
  241. package/dist/harnesses/impls/index.js.map +1 -1
  242. package/dist/harnesses/impls/learner/adapters/claude-code.d.ts +17 -0
  243. package/dist/harnesses/impls/learner/adapters/claude-code.js +118 -14
  244. package/dist/harnesses/impls/learner/adapters/claude-code.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 +41 -1
  249. package/dist/harnesses/impls/learner/harness.js +78 -4
  250. package/dist/harnesses/impls/learner/harness.js.map +1 -1
  251. package/dist/harnesses/impls/learner/harvest.d.ts +3 -1
  252. package/dist/harnesses/impls/learner/harvest.js +30 -6
  253. package/dist/harnesses/impls/learner/harvest.js.map +1 -1
  254. package/dist/harnesses/impls/learner/plugin-path.js +1 -0
  255. package/dist/harnesses/impls/learner/plugin-path.js.map +1 -1
  256. package/dist/harnesses/impls/learner/restoration-patch.d.ts +2 -2
  257. package/dist/harnesses/impls/learner/restoration-patch.js +25 -6
  258. package/dist/harnesses/impls/learner/restoration-patch.js.map +1 -1
  259. package/dist/harnesses/impls/swe-rebench-v2-evaluator/eval-runner.js +21 -1
  260. package/dist/harnesses/impls/swe-rebench-v2-evaluator/eval-runner.js.map +1 -1
  261. package/dist/harnesses/impls/swe-rebench-v2-evaluator/harness.js +3 -1
  262. package/dist/harnesses/impls/swe-rebench-v2-evaluator/harness.js.map +1 -1
  263. package/dist/harnesses/impls/swe-rebench-v2-evaluator/hf-fetcher.d.ts +74 -5
  264. package/dist/harnesses/impls/swe-rebench-v2-evaluator/hf-fetcher.js +103 -32
  265. package/dist/harnesses/impls/swe-rebench-v2-evaluator/hf-fetcher.js.map +1 -1
  266. package/dist/harnesses/impls/swe-rebench-v2-evaluator/index.d.ts +2 -2
  267. package/dist/harnesses/impls/swe-rebench-v2-evaluator/index.js +3 -1
  268. package/dist/harnesses/impls/swe-rebench-v2-evaluator/index.js.map +1 -1
  269. package/dist/harnesses/readiness-registry.d.ts +7 -0
  270. package/dist/harnesses/readiness-registry.js +9 -0
  271. package/dist/harnesses/readiness-registry.js.map +1 -1
  272. package/dist/harnesses/types.d.ts +14 -0
  273. package/dist/learner/revert-decision.d.ts +74 -0
  274. package/dist/learner/revert-decision.js +73 -0
  275. package/dist/learner/revert-decision.js.map +1 -0
  276. package/dist/learner/revert-stats.d.ts +38 -0
  277. package/dist/learner/revert-stats.js +86 -0
  278. package/dist/learner/revert-stats.js.map +1 -0
  279. package/dist/local-provider-url.d.ts +3 -0
  280. package/dist/local-provider-url.js +28 -0
  281. package/dist/local-provider-url.js.map +1 -0
  282. package/dist/main.js +199 -104
  283. package/dist/main.js.map +1 -1
  284. package/dist/mcp/get-codedigest-reward.d.ts +13 -0
  285. package/dist/mcp/get-codedigest-reward.js +23 -0
  286. package/dist/mcp/get-codedigest-reward.js.map +1 -0
  287. package/dist/mcp/server.js +23 -0
  288. package/dist/mcp/server.js.map +1 -1
  289. package/dist/observability/debug-report-assemble.d.ts +43 -0
  290. package/dist/observability/debug-report-assemble.js +80 -0
  291. package/dist/observability/debug-report-assemble.js.map +1 -0
  292. package/dist/observability/emit-event.d.ts +9 -2
  293. package/dist/observability/emit-event.js +36 -2
  294. package/dist/observability/emit-event.js.map +1 -1
  295. package/dist/observability/file-logger.d.ts +69 -0
  296. package/dist/observability/file-logger.js +177 -0
  297. package/dist/observability/file-logger.js.map +1 -0
  298. package/dist/observability/redact-secrets.d.ts +65 -0
  299. package/dist/observability/redact-secrets.js +300 -0
  300. package/dist/observability/redact-secrets.js.map +1 -0
  301. package/dist/observability/tar.d.ts +30 -0
  302. package/dist/observability/tar.js +102 -0
  303. package/dist/observability/tar.js.map +1 -0
  304. package/dist/plugins/learner/.claude-plugin/plugin.json +1 -1
  305. package/dist/plugins/learner/.codex-plugin/plugin.json +1 -1
  306. package/dist/plugins/learner/hooks/session-start +30 -1
  307. package/dist/plugins/learner/skills/learn/consolidator-prompt.md +22 -1
  308. package/dist/plugins/learner/skills/learn/promoter-prompt.md +72 -1
  309. package/dist/preflight/deployment-readiness.d.ts +147 -0
  310. package/dist/preflight/deployment-readiness.js +366 -0
  311. package/dist/preflight/deployment-readiness.js.map +1 -0
  312. package/dist/preflight/pidfile-liveness.d.ts +50 -0
  313. package/dist/preflight/pidfile-liveness.js +117 -0
  314. package/dist/preflight/pidfile-liveness.js.map +1 -0
  315. package/dist/preflight/rpc-network.d.ts +40 -0
  316. package/dist/preflight/rpc-network.js +67 -1
  317. package/dist/preflight/rpc-network.js.map +1 -1
  318. package/dist/rpc/transport.d.ts +145 -0
  319. package/dist/rpc/transport.js +319 -0
  320. package/dist/rpc/transport.js.map +1 -0
  321. package/dist/scripts/donation-consumption-acceptance.js +7 -28
  322. package/dist/scripts/donation-consumption-acceptance.js.map +1 -1
  323. package/dist/scripts/swe-rebench-v2-pytest-missing.json +16 -0
  324. package/dist/solver-nets/prediction-operator-ux.d.ts +1 -2
  325. package/dist/solver-nets/prediction-operator-ux.js +56 -53
  326. package/dist/solver-nets/prediction-operator-ux.js.map +1 -1
  327. package/dist/solver-nets/registry.d.ts +19 -1
  328. package/dist/solver-nets/registry.js +37 -24
  329. package/dist/solver-nets/registry.js.map +1 -1
  330. package/dist/solver-types/_swe-rebench-v2-held-out-slate.d.ts +76 -0
  331. package/dist/solver-types/_swe-rebench-v2-held-out-slate.js +156 -0
  332. package/dist/solver-types/_swe-rebench-v2-held-out-slate.js.map +1 -0
  333. package/dist/solver-types/_swe-rebench-v2-pool-recovery.d.ts +81 -0
  334. package/dist/solver-types/_swe-rebench-v2-pool-recovery.js +116 -0
  335. package/dist/solver-types/_swe-rebench-v2-pool-recovery.js.map +1 -0
  336. package/dist/solver-types/_swe-rebench-v2-pool.d.ts +9 -2
  337. package/dist/solver-types/_swe-rebench-v2-pool.js +15 -20
  338. package/dist/solver-types/_swe-rebench-v2-pool.js.map +1 -1
  339. package/dist/solver-types/_swe-rebench-v2-state.d.ts +24 -0
  340. package/dist/solver-types/_swe-rebench-v2-state.js +33 -0
  341. package/dist/solver-types/_swe-rebench-v2-state.js.map +1 -1
  342. package/dist/solver-types/_swe-rebench-v2-validated-pool.d.ts +116 -2
  343. package/dist/solver-types/_swe-rebench-v2-validated-pool.js +296 -21
  344. package/dist/solver-types/_swe-rebench-v2-validated-pool.js.map +1 -1
  345. package/dist/solver-types/slates/held-out-slate.swe-rebench-v2.v1.json +20 -0
  346. package/dist/solver-types/slates/held-out-slate.swe-rebench-v2.v2.json +19 -0
  347. package/dist/solver-types/slates/held-out-slate.swe-rebench-v2.v2.screening-report.json +628 -0
  348. package/dist/solver-types/solver-type.d.ts +8 -0
  349. package/dist/solver-types/swe-rebench-v2-auto.d.ts +20 -11
  350. package/dist/solver-types/swe-rebench-v2-auto.js +64 -19
  351. package/dist/solver-types/swe-rebench-v2-auto.js.map +1 -1
  352. package/dist/solver-types/swe-rebench-v2.d.ts +10 -2
  353. package/dist/solver-types/swe-rebench-v2.js +233 -13
  354. package/dist/solver-types/swe-rebench-v2.js.map +1 -1
  355. package/dist/solvernets/daemon-init.d.ts +1 -1
  356. package/dist/solvernets/daemon-init.js +19 -4
  357. package/dist/solvernets/daemon-init.js.map +1 -1
  358. package/dist/solvernets/launched-record-dispatcher.d.ts +7 -0
  359. package/dist/solvernets/launched-record-dispatcher.js +10 -4
  360. package/dist/solvernets/launched-record-dispatcher.js.map +1 -1
  361. package/dist/solvernets/registry-client-erc8004.js +40 -37
  362. package/dist/solvernets/registry-client-erc8004.js.map +1 -1
  363. package/dist/solvernets/registry-client.d.ts +6 -0
  364. package/dist/solvernets/store.d.ts +2 -2
  365. package/dist/solvernets/store.js +7 -2
  366. package/dist/solvernets/store.js.map +1 -1
  367. package/dist/spend/ai-units-config.d.ts +49 -0
  368. package/dist/spend/ai-units-config.js +34 -0
  369. package/dist/spend/ai-units-config.js.map +1 -0
  370. package/dist/spend/ai-units.d.ts +140 -0
  371. package/dist/spend/ai-units.js +229 -0
  372. package/dist/spend/ai-units.js.map +1 -0
  373. package/dist/spend/cost-surface-status.d.ts +12 -0
  374. package/dist/spend/cost-surface-status.js +24 -0
  375. package/dist/spend/cost-surface-status.js.map +1 -0
  376. package/dist/spend/credential.d.ts +39 -0
  377. package/dist/spend/credential.js +71 -0
  378. package/dist/spend/credential.js.map +1 -0
  379. package/dist/spend/daemon-config.d.ts +13 -0
  380. package/dist/spend/daemon-config.js +24 -0
  381. package/dist/spend/daemon-config.js.map +1 -0
  382. package/dist/spend/pricing.d.ts +16 -0
  383. package/dist/spend/pricing.js +26 -0
  384. package/dist/spend/pricing.js.map +1 -0
  385. package/dist/spend/record.d.ts +13 -0
  386. package/dist/spend/record.js +43 -0
  387. package/dist/spend/record.js.map +1 -0
  388. package/dist/spend/usage.d.ts +27 -0
  389. package/dist/spend/usage.js +113 -0
  390. package/dist/spend/usage.js.map +1 -0
  391. package/dist/store/store.d.ts +187 -0
  392. package/dist/store/store.js +467 -4
  393. package/dist/store/store.js.map +1 -1
  394. package/dist/trajectory/transcript-parsers/codex-session.d.ts +12 -6
  395. package/dist/trajectory/transcript-parsers/codex-session.js +114 -13
  396. package/dist/trajectory/transcript-parsers/codex-session.js.map +1 -1
  397. package/dist/trajectory/transcript-parsers/types.d.ts +8 -8
  398. package/dist/trajectory/transcript-session-dirs.d.ts +18 -0
  399. package/dist/trajectory/transcript-session-dirs.js +85 -0
  400. package/dist/trajectory/transcript-session-dirs.js.map +1 -0
  401. package/dist/trajectory/transcript-watcher.d.ts +20 -1
  402. package/dist/trajectory/transcript-watcher.js +108 -32
  403. package/dist/trajectory/transcript-watcher.js.map +1 -1
  404. package/dist/tx-retry.d.ts +25 -0
  405. package/dist/tx-retry.js +95 -7
  406. package/dist/tx-retry.js.map +1 -1
  407. package/dist/types/payloads/portfolio-v0.d.ts +3 -3
  408. package/dist/types/payloads/prediction-apy-v0.d.ts +3 -3
  409. package/dist/types/payloads/prediction-v0.d.ts +12 -12
  410. package/dist/vendor/@jinn-network/sdk/dist/payloads/swe-rebench-v2.d.ts +108 -1
  411. package/dist/vendor/@jinn-network/sdk/dist/payloads/swe-rebench-v2.js +25 -1
  412. package/dist/vendor/@jinn-network/sdk/dist/solvernets/swe-rebench-v2-held-out-slate.d.ts +65 -0
  413. package/dist/vendor/@jinn-network/sdk/dist/solvernets/swe-rebench-v2-held-out-slate.js +123 -0
  414. package/dist/vendor/@jinn-network/sdk/dist/solvernets/swe-rebench-v2.d.ts +2 -2
  415. package/dist/vendor/@jinn-network/sdk/dist/solvernets/swe-rebench-v2.js +1 -1
  416. package/dist/vendor/@jinn-network/sdk/package.json +4 -0
  417. package/docker-compose.yml +3 -2
  418. package/package.json +30 -18
  419. package/plugins/learner/.claude-plugin/plugin.json +1 -1
  420. package/plugins/learner/.codex-plugin/plugin.json +1 -1
  421. package/plugins/learner/hooks/session-start +30 -1
  422. package/plugins/learner/skills/learn/consolidator-prompt.md +22 -1
  423. package/plugins/learner/skills/learn/promoter-prompt.md +72 -1
  424. package/plugins/swe-rebench-v2-diffmin/README.md +10 -9
  425. package/plugins/swe-rebench-v2-diffmin/jinn.plugin.json +1 -1
  426. package/plugins/swe-rebench-v2-diffmin/skills/diffmin/SKILL.md +15 -10
  427. package/plugins/swe-rebench-v2-diffmin/skills/test-map/SKILL.md +10 -12
  428. package/plugins/swe-rebench-v2-runtime/.claude-plugin/plugin.json +1 -1
  429. package/plugins/swe-rebench-v2-runtime/.codex-plugin/plugin.json +3 -3
  430. package/plugins/swe-rebench-v2-runtime/README.md +6 -6
  431. package/plugins/swe-rebench-v2-runtime/hooks/hooks.json +16 -0
  432. package/plugins/swe-rebench-v2-runtime/hooks/session-start +74 -0
  433. package/plugins/swe-rebench-v2-runtime/jinn.plugin.json +2 -3
  434. package/plugins/swe-rebench-v2-runtime/skills/task/SKILL.md +81 -0
  435. package/dist/dashboard/assets/index-BUlE8F3Y.js +0 -330
  436. package/dist/dashboard/assets/index-blqc7eqq.css +0 -32
  437. package/plugins/swe-rebench-v2-runtime/skills/orient/SKILL.md +0 -29
  438. package/plugins/swe-rebench-v2-runtime/skills/plan/SKILL.md +0 -53
@@ -0,0 +1,117 @@
1
+ /**
2
+ * Pidfile liveness preflight (issue #649). Classifies the recorded PID and
3
+ * returns a discriminated decision; side-effect-free so the caller owns the
4
+ * unlink (mirrors the idiom at `client/src/mcp/operator-server.ts:209-213`).
5
+ *
6
+ * Branches (load-bearing — see #649 acceptance criteria):
7
+ * - File missing → { decision: 'proceed' }
8
+ * - File malformed (NaN/empty) → { decision: 'unlink-stale', reason: 'malformed' }
9
+ * - PID 1 or our own pid → { decision: 'unlink-stale', reason: 'self-or-pid1-container' }
10
+ * - process.kill(pid, 0) ESRCH → { decision: 'unlink-stale', reason: 'esrch' }
11
+ * - process.kill(pid, 0) ok → { decision: 'refuse', reason: 'alive' }
12
+ * - process.kill(pid, 0) EPERM → { decision: 'refuse', reason: 'eperm' }
13
+ * - any other errno → { decision: 'refuse', reason: 'unknown' }
14
+ *
15
+ * The PID-1/self branch classifies *before* the `process.kill` probe (#805): in
16
+ * a container the daemon is PID 1, whose pidfile outlives the container on the
17
+ * persistent volume; `process.kill(1, 0)` always succeeds, so a probe-first
18
+ * order would mis-classify the stale record as a live sibling and crash-loop.
19
+ *
20
+ * `.trim()` before `parseInt` is required: `main.ts` writes the PID with a
21
+ * trailing `\n` (see `client/src/main.ts` writeFileSync near the pidfile site).
22
+ */
23
+ import { existsSync, readFileSync, unlinkSync } from 'node:fs';
24
+ import { emitEnvelope } from '../errors/envelope.js';
25
+ import { emitStructured } from '../events/emitter.js';
26
+ export function checkPidfileLiveness(input) {
27
+ const { pidPath } = input;
28
+ if (!existsSync(pidPath)) {
29
+ return { decision: 'proceed' };
30
+ }
31
+ let raw;
32
+ try {
33
+ raw = readFileSync(pidPath, 'utf-8');
34
+ }
35
+ catch {
36
+ // Unreadable pidfile: treat as stale. If the caller's subsequent write also
37
+ // fails, that surfaces via main.ts's `writeFileSync`.
38
+ return { decision: 'unlink-stale', pid: null, pidfilePath: pidPath, reason: 'malformed' };
39
+ }
40
+ const parsed = parseInt(raw.trim(), 10);
41
+ if (!Number.isFinite(parsed) || parsed <= 0) {
42
+ return { decision: 'unlink-stale', pid: null, pidfilePath: pidPath, reason: 'malformed' };
43
+ }
44
+ // #805: in a container the daemon is PID 1; the pidfile on the persistent
45
+ // volume outlives the container, and `process.kill(1, 0)` always succeeds, so
46
+ // we must classify the self/PID-1 record as stale *before* the liveness probe
47
+ // below — otherwise the probe reports it alive and the daemon crash-loops. A
48
+ // record of our own pid is likewise self, never a live sibling.
49
+ if (parsed === 1 || parsed === process.pid) {
50
+ return { decision: 'unlink-stale', pid: parsed, pidfilePath: pidPath, reason: 'self-or-pid1-container' };
51
+ }
52
+ try {
53
+ process.kill(parsed, 0);
54
+ return { decision: 'refuse', pid: parsed, pidfilePath: pidPath, reason: 'alive' };
55
+ }
56
+ catch (err) {
57
+ const errno = err.code;
58
+ if (errno === 'ESRCH') {
59
+ return { decision: 'unlink-stale', pid: parsed, pidfilePath: pidPath, reason: 'esrch' };
60
+ }
61
+ if (errno === 'EPERM') {
62
+ return { decision: 'refuse', pid: parsed, pidfilePath: pidPath, reason: 'eperm' };
63
+ }
64
+ // Any other errno: conservative refuse rather than risk trampling a daemon
65
+ // we can't classify.
66
+ return { decision: 'refuse', pid: parsed, pidfilePath: pidPath, reason: 'unknown' };
67
+ }
68
+ }
69
+ /**
70
+ * Apply the pidfile-liveness gate at `jinn run` startup (#649). On `refuse`
71
+ * emits the `invalid_invocation` envelope and exits (does not return); on
72
+ * `unlink-stale` logs the cleanup, removes the stale pidfile, and returns;
73
+ * on `proceed` returns immediately. Callers MUST write the pidfile themselves
74
+ * after this returns — the helper deliberately stops short of the write so the
75
+ * "// DO NOT add store mutations above this line — see #649" invariant in
76
+ * main.ts stays visible at the call site.
77
+ */
78
+ export function applyPidfileLivenessGate(pidPath, sinks = {}) {
79
+ const liveness = checkPidfileLiveness({ pidPath });
80
+ if (liveness.decision === 'refuse') {
81
+ emitEnvelope({
82
+ code: 'invalid_invocation',
83
+ message: `Another jinn daemon is already running (PID ${liveness.pid}).`,
84
+ hint: 'Run `jinn stop` to terminate it, or set JINN_EARNING_DIR to a different earning directory.',
85
+ exampleCli: 'jinn stop',
86
+ details: {
87
+ field: 'daemon_pidfile',
88
+ pid: liveness.pid,
89
+ pidfilePath: pidPath,
90
+ reason: liveness.reason,
91
+ },
92
+ }, sinks);
93
+ // emitEnvelope calls process.exit in production; the test sink may throw
94
+ // or no-op. Either way control does not fall through to the writeFileSync
95
+ // in the caller.
96
+ return;
97
+ }
98
+ if (liveness.decision === 'unlink-stale') {
99
+ emitStructured({
100
+ kind: 'system',
101
+ message: `cleaning up stale pidfile (${liveness.reason})`,
102
+ details: {
103
+ phase: 'preflight',
104
+ pidfilePath: pidPath,
105
+ reason: liveness.reason,
106
+ pid: liveness.pid,
107
+ },
108
+ });
109
+ try {
110
+ unlinkSync(pidPath);
111
+ }
112
+ catch {
113
+ /* best-effort — the writeFileSync that follows surfaces any real problem */
114
+ }
115
+ }
116
+ }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AE,CAAC;QACnC,YAAY,CACV;YACE,IAAI,EAAE,oBAAoB;YAC1B,OAAO,EAAE,+CAA+C,QAAQ,CAAC,GAAG,IAAI;YACxE,IAAI,EAAE,4FAA4F;YAClG,UAAU,EAAE,WAAW;YACvB,OAAO,EAAE;gBACP,KAAK,EAAE,gBAAgB;gBACvB,GAAG,EAAE,QAAQ,CAAC,GAAG;gBACjB,WAAW,EAAE,OAAO;gBACpB,MAAM,EAAE,QAAQ,CAAC,MAAM;aACxB;SACF,EACD,KAAK,CACN,CAAC;QACF,yEAAyE;QACzE,0EAA0E;QAC1E,iBAAiB;QACjB,OAAO;IACT,CAAC;IACD,IAAI,QAAQ,CAAC,QAAQ,KAAK,cAAc,EAAE,CAAC;QACzC,cAAc,CAAC;YACb,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,8BAA8B,QAAQ,CAAC,MAAM,GAAG;YACzD,OAAO,EAAE;gBACP,KAAK,EAAE,WAAW;gBAClB,WAAW,EAAE,OAAO;gBACpB,MAAM,EAAE,QAAQ,CAAC,MAAM;gBACvB,GAAG,EAAE,QAAQ,CAAC,GAAG;aAClB;SACF,CAAC,CAAC;QACH,IAAI,CAAC;YACH,UAAU,CAAC,OAAO,CAAC,CAAC;QACtB,CAAC;QAAC,MAAM,CAAC;YACP,4EAA4E;QAC9E,CAAC;IACH,CAAC;AACH,CAAC"}
@@ -42,3 +42,43 @@ export declare function logRpcLocalDevToStderr(r: RpcNetworkPreflightOk, write?:
42
42
  export declare function rpcHostForDisplay(rpcUrl: string): string;
43
43
  export declare function checkRpcNetwork(config: Pick<JinnConfig, 'network' | 'rpcUrl'>): Promise<RpcNetworkPreflightResult>;
44
44
  export declare function rpcNetworkFailureHint(result: RpcNetworkPreflightFail): string;
45
+ /** Layer label for log lines and AC7 summary formatting. */
46
+ export type ProbeLayer = 'L1' | 'L2';
47
+ export type ProbeOk = {
48
+ ok: true;
49
+ host: string;
50
+ latencyMs: number;
51
+ };
52
+ export type ProbeFail = {
53
+ ok: false;
54
+ host: string;
55
+ /** HTTP status when applicable (4xx / 5xx). */
56
+ code?: number;
57
+ /** Failure shape when no HTTP status is available. */
58
+ reason?: 'unreachable' | 'unknown';
59
+ message: string;
60
+ };
61
+ export type ProbeResult = ProbeOk | ProbeFail;
62
+ export interface ProbeFallbackChainOptions {
63
+ /** Logger for per-slot lines. Defaults to `console.error`. */
64
+ log?: (message: string) => void;
65
+ }
66
+ /**
67
+ * Probe each URL in a fallback chain with a per-slot `eth_blockNumber` call.
68
+ * Records ok/latency or a structured failure (HTTP status / unreachable).
69
+ *
70
+ * The probe is **log-only** — it never throws on per-slot failures. Startup
71
+ * gating remains the job of {@link checkRpcNetwork}, which fails loud on
72
+ * chain-id mismatch.
73
+ *
74
+ * Per AC9 (issue #592): emits one log line per slot
75
+ * `[rpc] <layer> <host> ok latency=Nms`
76
+ * `[rpc] <layer> <host> warn <http-status>` (e.g. 429, 503)
77
+ * `[rpc] <layer> <host> warn unreachable: <message>`
78
+ */
79
+ export declare function probeFallbackChain(urls: readonly string[], network: ExpectedRpcNetwork, layer: ProbeLayer, options?: ProbeFallbackChainOptions): Promise<ProbeResult[]>;
80
+ /**
81
+ * Boot-log summary line for a fallback chain, formatted per AC7:
82
+ * `[rpc] L2 transport: fallback chain (N providers) — primary=<host>`
83
+ */
84
+ export declare function summarizeFallbackChain(layer: ProbeLayer, urls: readonly string[]): string;
@@ -1,5 +1,6 @@
1
- import { createPublicClient, http } from 'viem';
1
+ import { createPublicClient, http, HttpRequestError } from 'viem';
2
2
  import { base, baseSepolia } from 'viem/chains';
3
+ import { describeFallbackChain, maskRpcHost } from '../rpc/transport.js';
3
4
  export function expectedChainIdForNetwork(network) {
4
5
  return network === 'testnet' ? 84532 : 8453;
5
6
  }
@@ -118,4 +119,69 @@ export function rpcNetworkFailureHint(result) {
118
119
  }
119
120
  return 'Set rpcUrl to a Base mainnet endpoint such as https://mainnet.base.org, or set BASE_RPC_URL.';
120
121
  }
122
+ function classifyProbeError(host, err) {
123
+ const message = err instanceof Error ? err.message : String(err);
124
+ if (err instanceof HttpRequestError && typeof err.status === 'number') {
125
+ return { ok: false, host, code: err.status, message };
126
+ }
127
+ // viem wraps HTTP errors inside other shapes; walk the cause chain.
128
+ let cur = err?.cause;
129
+ while (cur) {
130
+ if (cur instanceof HttpRequestError && typeof cur.status === 'number') {
131
+ return { ok: false, host, code: cur.status, message };
132
+ }
133
+ cur = cur.cause;
134
+ }
135
+ return { ok: false, host, reason: 'unreachable', message };
136
+ }
137
+ /**
138
+ * Probe each URL in a fallback chain with a per-slot `eth_blockNumber` call.
139
+ * Records ok/latency or a structured failure (HTTP status / unreachable).
140
+ *
141
+ * The probe is **log-only** — it never throws on per-slot failures. Startup
142
+ * gating remains the job of {@link checkRpcNetwork}, which fails loud on
143
+ * chain-id mismatch.
144
+ *
145
+ * Per AC9 (issue #592): emits one log line per slot
146
+ * `[rpc] <layer> <host> ok latency=Nms`
147
+ * `[rpc] <layer> <host> warn <http-status>` (e.g. 429, 503)
148
+ * `[rpc] <layer> <host> warn unreachable: <message>`
149
+ */
150
+ export async function probeFallbackChain(urls, network, layer, options = {}) {
151
+ const log = options.log ?? ((m) => process.stderr.write(`${m}\n`));
152
+ // Chain is informational only — eth_blockNumber doesn't depend on chain
153
+ // identity. Both L1 and L2 layers reuse the same Base/Base-Sepolia pair
154
+ // since this is just used to satisfy viem's typing.
155
+ const chain = network === 'testnet' ? baseSepolia : base;
156
+ const results = [];
157
+ for (const url of urls) {
158
+ const host = maskRpcHost(url);
159
+ const client = createPublicClient({ chain, transport: http(url, { retryCount: 0 }) });
160
+ const t0 = performance.now();
161
+ try {
162
+ await client.getBlockNumber();
163
+ const latencyMs = Math.max(0, Math.round(performance.now() - t0));
164
+ log(`[rpc] ${layer} ${host} ok latency=${latencyMs}ms`);
165
+ results.push({ ok: true, host, latencyMs });
166
+ }
167
+ catch (err) {
168
+ const failure = classifyProbeError(host, err);
169
+ if (failure.code !== undefined) {
170
+ log(`[rpc] ${layer} ${host} warn ${failure.code}`);
171
+ }
172
+ else {
173
+ log(`[rpc] ${layer} ${host} warn unreachable: ${failure.message.split('\n')[0]}`);
174
+ }
175
+ results.push(failure);
176
+ }
177
+ }
178
+ return results;
179
+ }
180
+ /**
181
+ * Boot-log summary line for a fallback chain, formatted per AC7:
182
+ * `[rpc] L2 transport: fallback chain (N providers) — primary=<host>`
183
+ */
184
+ export function summarizeFallbackChain(layer, urls) {
185
+ return `[rpc] ${layer} transport: ${describeFallbackChain(urls)}`;
186
+ }
121
187
  //# sourceMappingURL=rpc-network.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"rpc-network.js","sourceRoot":"","sources":["../../src/preflight/rpc-network.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AA+BhD,MAAM,UAAU,yBAAyB,CAAC,OAA2B;IACnE,OAAO,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;AAC9C,CAAC;AAED;;;;;GAKG;AACH,MAAM,uBAAuB,GAAG,IAAI,GAAG,CAAC,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC;AAEvD;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAAC,MAAc;IAC7C,IAAI,CAAC;QACH,MAAM,CAAC,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC;QACnC,OAAO,CAAC,KAAK,WAAW,IAAI,CAAC,KAAK,WAAW,IAAI,CAAC,KAAK,KAAK,IAAI,CAAC,KAAK,OAAO,CAAC;IAChF,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,6BAA6B,CAC3C,eAAuB,EACvB,aAAqB,EACrB,MAAc;IAEd,OAAO,CACL,aAA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AO,CAAC,IAAI,EAAE,CAAC,CAAC;YACrD,CAAC;iBAAM,CAAC;gBACN,GAAG,CAAC,SAAS,KAAK,IAAI,IAAI,sBAAsB,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;YACpF,CAAC;YACD,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACxB,CAAC;IACH,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,sBAAsB,CAAC,KAAiB,EAAE,IAAuB;IAC/E,OAAO,SAAS,KAAK,eAAe,qBAAqB,CAAC,IAAI,CAAC,EAAE,CAAC;AACpE,CAAC"}
@@ -0,0 +1,145 @@
1
+ /**
2
+ * RPC transport helper — builds a viem `fallback()` transport from a single
3
+ * URL, an array of URLs, or a comma-separated string. The substrate for issue
4
+ * #592 (multi-RPC fallback chain across daemon / relayer / indexer / CI).
5
+ *
6
+ * Design:
7
+ * - `parseRpcUrls` normalises `string | readonly string[]` to a deduplicated
8
+ * non-empty array, splits comma-strings, trims, drops empties, and caps the
9
+ * chain at {@link MAX_RPC_CHAIN_LENGTH} providers (extras are dropped with a
10
+ * warning). Throws when no URLs remain.
11
+ * - `buildFallbackTransport` wraps `http(url)` per slot inside viem's
12
+ * `fallback([...], { rank: false, retryCount: 0 })`. `rank: false` is
13
+ * explicit — the issue's "Tenderly stays in slot 3" constraint requires
14
+ * order preservation (no latency-based reshuffling). `retryCount: 0` keeps
15
+ * the helper from doubling retries on top of the existing
16
+ * `withRecoverableRetry` wrapper used by callers like the mech adapter.
17
+ * - On exhausted fall-through the helper rejects with `AllRpcsFailedError`,
18
+ * which carries a structured `providers: readonly string[]` list of masked
19
+ * hosts so callers and tests can assert on it.
20
+ * - `describeFallbackChain` formats the canonical AC7 boot-log summary line:
21
+ * `fallback chain (N providers) — primary=<host>`.
22
+ *
23
+ * Do not conflate with `discovery.fallbackToOnchain` — that's a separate layer
24
+ * at the read-API level (Ponder → eth_getLogs floor). This helper sits beneath
25
+ * both layers at the JSON-RPC transport level.
26
+ */
27
+ import { type FallbackTransport, type Transport } from 'viem';
28
+ /**
29
+ * Hard cap on the number of providers in a single fallback chain. Four covers
30
+ * the "operator paid primary + public publicnode + public sepolia.base.org +
31
+ * Tenderly slot-3" shape from the issue; beyond that the boot probe takes too
32
+ * long and slot 5+ is almost always copy-paste noise.
33
+ */
34
+ export declare const MAX_RPC_CHAIN_LENGTH = 4;
35
+ export interface ParseRpcUrlsOptions {
36
+ /** Logger used to emit the "capped" warning. Defaults to `console.error`. */
37
+ log?: (message: string) => void;
38
+ }
39
+ /**
40
+ * Normalise `string | readonly string[]` into a non-empty, deduplicated,
41
+ * capped list of RPC URLs. Comma-separated strings are split (operator
42
+ * convention, see `peers` in `config.ts`). Duplicates are removed before the
43
+ * cap is applied so the effective chain length matches operator intent (an
44
+ * operator who prepends their paid primary to the existing fallback list
45
+ * shouldn't burn a slot on the duplicate).
46
+ *
47
+ * @throws if the input yields zero non-empty URLs.
48
+ */
49
+ export declare function parseRpcUrls(input: string | readonly string[], options?: ParseRpcUrlsOptions): string[];
50
+ /**
51
+ * Error thrown when every provider in a fallback chain has failed. Carries
52
+ * the masked host list so callers can surface a useful operator-facing message
53
+ * without leaking secret query strings (api-key paths).
54
+ */
55
+ export declare class AllRpcsFailedError extends Error {
56
+ readonly providers: readonly string[];
57
+ readonly cause?: unknown;
58
+ constructor(providers: readonly string[], cause?: unknown);
59
+ }
60
+ /**
61
+ * Detect errors that viem's `fallback()` short-circuits on (via its
62
+ * `shouldThrow(err)` fast-exit) — `ExecutionRevertedError`,
63
+ * `TransactionRejectedRpcError`, `UserRejectedRequestError`,
64
+ * `WalletConnectSessionSettlementError`, and CAIP user-rejected (code
65
+ * `5000`). These are EVM- or wallet-level signals, NOT transport-level
66
+ * failures, so they must propagate unchanged. Wrapping them as
67
+ * `AllRpcsFailedError` would give the operator-app a false-positive
68
+ * "all RPCs failed" message when the actual problem is e.g. a contract
69
+ * revert on a view function.
70
+ *
71
+ * Mirrors viem's own predicate at
72
+ * `node_modules/viem/clients/transports/fallback.ts` (`shouldThrow`),
73
+ * dispatching by **numeric JSON-RPC code** (the path that catches real
74
+ * `RpcRequestError` instances coming out of the HTTP transport) plus the
75
+ * `ExecutionRevertedError.nodeMessage` regex (the path that catches reverts
76
+ * surfaced as plain `Error` with no numeric code). The cause-chain walk by
77
+ * class `name` remains as a third path for wallet-provider stacks that
78
+ * deliver proper class instances (and for already-normalised errors after
79
+ * viem's `buildRequest` re-wrap pass).
80
+ */
81
+ export declare function isViemShouldThrowError(err: unknown): boolean;
82
+ /**
83
+ * Default cooldown applied to a slot that returns a quota / rate-limit error
84
+ * (#835). After this window the demoted slot becomes eligible again rather than
85
+ * being permanently disabled (AC2), so a transient 429 / monthly-quota blip
86
+ * never strands an operator on a degraded provider for the rest of the process.
87
+ */
88
+ export declare const DEFAULT_RPC_COOLDOWN_MS = 60000;
89
+ /**
90
+ * Detect quota / rate-limit errors from an RPC provider (#835). Unlike
91
+ * {@link isViemShouldThrowError} (which marks EVM/wallet-level signals that must
92
+ * NOT trigger fallback), a quota error means the *slot* is temporarily unusable
93
+ * and should be demoted behind healthy slots for a cooldown window. Walks the
94
+ * cause chain (cycle-safe, mirroring `isViemShouldThrowError`) and matches on:
95
+ * - HTTP `status === 429` (the `http()` transport's `HttpRequestError`);
96
+ * - JSON-RPC `code === LimitExceededRpcError.code` (-32005);
97
+ * - a narrow message regex backstop covering unambiguous provider phrasings
98
+ * ("rate limit", "too many requests", "429", "quota", "compute unit",
99
+ * "request rate", "throughput") — deliberately excluding the ambiguous
100
+ * "limit"/"exceeded" words that collide with gas-limit errors.
101
+ *
102
+ * Deliberately narrow: a 5xx / network error is NOT a quota error (it falls
103
+ * through via viem but does not cool the slot — AC3 keeps static order when no
104
+ * quota errors occur), and a contract revert (code 3) is never a quota error.
105
+ */
106
+ export declare function isRpcQuotaError(err: unknown): boolean;
107
+ /**
108
+ * Mask an RPC URL down to its hostname for display / error reporting. Drops
109
+ * the path so api-key segments in the URL don't leak into logs.
110
+ */
111
+ export declare function maskRpcHost(url: string): string;
112
+ export interface BuildFallbackTransportOptions {
113
+ /**
114
+ * Set to `true` to let viem rank providers by latency. Default `false` —
115
+ * order matters for operator-configured paid primaries and the
116
+ * "Tenderly stays in slot 3" constraint from the issue.
117
+ */
118
+ rank?: boolean;
119
+ /**
120
+ * Injectable clock for the quota-cooldown bookkeeping (#835). Defaults to
121
+ * {@link Date.now}. Tests pass a controllable stub so cooldown expiry (AC2)
122
+ * is deterministic without real timers.
123
+ */
124
+ now?: () => number;
125
+ /**
126
+ * How long a slot stays demoted after a quota / rate-limit error, in ms
127
+ * (#835). Defaults to {@link DEFAULT_RPC_COOLDOWN_MS}.
128
+ */
129
+ cooldownMs?: number;
130
+ }
131
+ /**
132
+ * Build a viem fallback transport over the given URLs. Returns a callable
133
+ * transport suitable for `createPublicClient({ transport })`.
134
+ *
135
+ * Errors that exhaust the chain are wrapped in `AllRpcsFailedError`.
136
+ */
137
+ export declare function buildFallbackTransport(urls: readonly string[], options?: BuildFallbackTransportOptions): FallbackTransport;
138
+ export declare namespace buildFallbackTransport {
139
+ var buildFromTransports: (transports: readonly Transport[], urls: readonly string[], options?: BuildFallbackTransportOptions) => FallbackTransport;
140
+ }
141
+ /**
142
+ * Boot-log summary line for a fallback chain. Matches the canonical AC7
143
+ * format: `fallback chain (N providers) — primary=<host>`.
144
+ */
145
+ export declare function describeFallbackChain(urls: readonly string[]): string;