@jinn-network/client 0.1.8 → 0.1.9-canary.159b38f5

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 (229) hide show
  1. package/dist/adapters/mech/adapter.d.ts +21 -1
  2. package/dist/adapters/mech/adapter.js +67 -10
  3. package/dist/adapters/mech/adapter.js.map +1 -1
  4. package/dist/adapters/mech/contracts.js +62 -28
  5. package/dist/adapters/mech/contracts.js.map +1 -1
  6. package/dist/adapters/mech/safe-revert.d.ts +4 -0
  7. package/dist/adapters/mech/safe-revert.js +5 -1
  8. package/dist/adapters/mech/safe-revert.js.map +1 -1
  9. package/dist/adapters/mech/safe.js +5 -1
  10. package/dist/adapters/mech/safe.js.map +1 -1
  11. package/dist/api/discovery-endpoint.d.ts +1 -0
  12. package/dist/api/discovery-endpoint.js +24 -0
  13. package/dist/api/discovery-endpoint.js.map +1 -1
  14. package/dist/api/fleet-build.d.ts +1 -7
  15. package/dist/api/fleet-build.js +0 -7
  16. package/dist/api/fleet-build.js.map +1 -1
  17. package/dist/api/gather-status.d.ts +8 -2
  18. package/dist/api/gather-status.js +29 -117
  19. package/dist/api/gather-status.js.map +1 -1
  20. package/dist/api/loop-completion-build.d.ts +79 -0
  21. package/dist/api/loop-completion-build.js +155 -0
  22. package/dist/api/loop-completion-build.js.map +1 -0
  23. package/dist/api/setup-endpoints.d.ts +13 -0
  24. package/dist/api/setup-endpoints.js +39 -20
  25. package/dist/api/setup-endpoints.js.map +1 -1
  26. package/dist/api/solvernets-endpoints.js +3 -0
  27. package/dist/api/solvernets-endpoints.js.map +1 -1
  28. package/dist/api/status-build.d.ts +43 -33
  29. package/dist/api/status-build.js +3 -26
  30. package/dist/api/status-build.js.map +1 -1
  31. package/dist/api/status-rollup-build.d.ts +0 -4
  32. package/dist/api/status-rollup-build.js +0 -4
  33. package/dist/api/status-rollup-build.js.map +1 -1
  34. package/dist/build-info.json +4 -4
  35. package/dist/build-meta.json +1 -1
  36. package/dist/cli/commands/codedigest-revert-check.js +6 -2
  37. package/dist/cli/commands/codedigest-revert-check.js.map +1 -1
  38. package/dist/cli/commands/doctor.d.ts +3 -0
  39. package/dist/cli/commands/doctor.js +35 -0
  40. package/dist/cli/commands/doctor.js.map +1 -1
  41. package/dist/cli/commands/eval.d.ts +76 -0
  42. package/dist/cli/commands/eval.js +401 -0
  43. package/dist/cli/commands/eval.js.map +1 -0
  44. package/dist/cli/commands/rewards.d.ts +2 -0
  45. package/dist/cli/commands/rewards.js +27 -0
  46. package/dist/cli/commands/rewards.js.map +1 -1
  47. package/dist/cli/commands/solver-nets.js +68 -0
  48. package/dist/cli/commands/solver-nets.js.map +1 -1
  49. package/dist/cli/commands/status.js +0 -1
  50. package/dist/cli/commands/status.js.map +1 -1
  51. package/dist/cli/index.js +2 -0
  52. package/dist/cli/index.js.map +1 -1
  53. package/dist/config.d.ts +31 -7
  54. package/dist/config.js +72 -7
  55. package/dist/config.js.map +1 -1
  56. package/dist/daemon/ai-units-gate.d.ts +6 -6
  57. package/dist/daemon/ai-units-gate.js +11 -10
  58. package/dist/daemon/ai-units-gate.js.map +1 -1
  59. package/dist/daemon/daemon.js +24 -22
  60. package/dist/daemon/daemon.js.map +1 -1
  61. package/dist/daemon/eviction-loop.d.ts +7 -0
  62. package/dist/daemon/eviction-loop.js +16 -0
  63. package/dist/daemon/eviction-loop.js.map +1 -1
  64. package/dist/dashboard/assets/index-BVAWkLwY.css +1 -0
  65. package/dist/dashboard/assets/index-DEPqtGOA.js +167 -0
  66. package/dist/dashboard/index.html +2 -2
  67. package/dist/discovery/http.d.ts +7 -0
  68. package/dist/discovery/http.js +241 -25
  69. package/dist/discovery/http.js.map +1 -1
  70. package/dist/discovery/onchain.js +155 -1
  71. package/dist/discovery/onchain.js.map +1 -1
  72. package/dist/discovery/types.d.ts +106 -0
  73. package/dist/discovery/types.js +40 -0
  74. package/dist/discovery/types.js.map +1 -1
  75. package/dist/discovery/with-fallback.js +14 -0
  76. package/dist/discovery/with-fallback.js.map +1 -1
  77. package/dist/earning/bootstrap.d.ts +23 -0
  78. package/dist/earning/bootstrap.js +76 -27
  79. package/dist/earning/bootstrap.js.map +1 -1
  80. package/dist/earning/faucet.d.ts +1 -1
  81. package/dist/earning/faucet.js +2 -2
  82. package/dist/earning/faucet.js.map +1 -1
  83. package/dist/earning/safe-adapter.js +11 -0
  84. package/dist/earning/safe-adapter.js.map +1 -1
  85. package/dist/eval/eval-harness-run.d.ts +63 -0
  86. package/dist/eval/eval-harness-run.js +123 -0
  87. package/dist/eval/eval-harness-run.js.map +1 -0
  88. package/dist/eval/orchestrator.d.ts +163 -0
  89. package/dist/eval/orchestrator.js +232 -0
  90. package/dist/eval/orchestrator.js.map +1 -0
  91. package/dist/eval/paired.d.ts +68 -0
  92. package/dist/eval/paired.js +93 -0
  93. package/dist/eval/paired.js.map +1 -0
  94. package/dist/eval/resolve-slate-tasks.d.ts +35 -0
  95. package/dist/eval/resolve-slate-tasks.js +56 -0
  96. package/dist/eval/resolve-slate-tasks.js.map +1 -0
  97. package/dist/eval/screen-discovery.d.ts +22 -0
  98. package/dist/eval/screen-discovery.js +71 -0
  99. package/dist/eval/screen-discovery.js.map +1 -0
  100. package/dist/eval/screen-progress.d.ts +41 -0
  101. package/dist/eval/screen-progress.js +60 -0
  102. package/dist/eval/screen-progress.js.map +1 -0
  103. package/dist/eval/screen-runner.d.ts +30 -0
  104. package/dist/eval/screen-runner.js +289 -0
  105. package/dist/eval/screen-runner.js.map +1 -0
  106. package/dist/eval/screen.d.ts +107 -0
  107. package/dist/eval/screen.js +159 -0
  108. package/dist/eval/screen.js.map +1 -0
  109. package/dist/eval/slope.d.ts +29 -0
  110. package/dist/eval/slope.js +46 -0
  111. package/dist/eval/slope.js.map +1 -0
  112. package/dist/eval/train-sequence.d.ts +35 -0
  113. package/dist/eval/train-sequence.js +59 -0
  114. package/dist/eval/train-sequence.js.map +1 -0
  115. package/dist/eval/wilson.d.ts +45 -0
  116. package/dist/eval/wilson.js +48 -0
  117. package/dist/eval/wilson.js.map +1 -0
  118. package/dist/harnesses/engine/canonical-json.js +5 -3
  119. package/dist/harnesses/engine/canonical-json.js.map +1 -1
  120. package/dist/harnesses/engine/engine.d.ts +9 -0
  121. package/dist/harnesses/engine/engine.js +50 -5
  122. package/dist/harnesses/engine/engine.js.map +1 -1
  123. package/dist/harnesses/engine/persistence.d.ts +17 -0
  124. package/dist/harnesses/engine/persistence.js +28 -0
  125. package/dist/harnesses/engine/persistence.js.map +1 -1
  126. package/dist/harnesses/impls/hermes-agent/adapter.d.ts +2 -0
  127. package/dist/harnesses/impls/hermes-agent/adapter.js +8 -5
  128. package/dist/harnesses/impls/hermes-agent/adapter.js.map +1 -1
  129. package/dist/harnesses/impls/hermes-agent/bootstrap.d.ts +1 -0
  130. package/dist/harnesses/impls/hermes-agent/bootstrap.js +6 -1
  131. package/dist/harnesses/impls/hermes-agent/bootstrap.js.map +1 -1
  132. package/dist/harnesses/impls/hermes-agent/harness.d.ts +17 -3
  133. package/dist/harnesses/impls/hermes-agent/harness.js +68 -5
  134. package/dist/harnesses/impls/hermes-agent/harness.js.map +1 -1
  135. package/dist/harnesses/impls/index.d.ts +2 -0
  136. package/dist/harnesses/impls/index.js +2 -0
  137. package/dist/harnesses/impls/index.js.map +1 -1
  138. package/dist/harnesses/impls/learner/adapters/claude-code.js +5 -0
  139. package/dist/harnesses/impls/learner/adapters/claude-code.js.map +1 -1
  140. package/dist/harnesses/impls/learner/harness.d.ts +17 -1
  141. package/dist/harnesses/impls/learner/harness.js +51 -1
  142. package/dist/harnesses/impls/learner/harness.js.map +1 -1
  143. package/dist/harnesses/impls/learner/harvest.d.ts +2 -0
  144. package/dist/harnesses/impls/learner/harvest.js +7 -1
  145. package/dist/harnesses/impls/learner/harvest.js.map +1 -1
  146. package/dist/harnesses/impls/learner/plugin-path.js +1 -0
  147. package/dist/harnesses/impls/learner/plugin-path.js.map +1 -1
  148. package/dist/harnesses/impls/swe-rebench-v2-evaluator/harness.js +3 -1
  149. package/dist/harnesses/impls/swe-rebench-v2-evaluator/harness.js.map +1 -1
  150. package/dist/harnesses/impls/swe-rebench-v2-evaluator/index.d.ts +2 -2
  151. package/dist/harnesses/impls/swe-rebench-v2-evaluator/index.js +3 -1
  152. package/dist/harnesses/impls/swe-rebench-v2-evaluator/index.js.map +1 -1
  153. package/dist/harnesses/types.d.ts +14 -0
  154. package/dist/learner/revert-decision.d.ts +16 -1
  155. package/dist/learner/revert-decision.js +38 -18
  156. package/dist/learner/revert-decision.js.map +1 -1
  157. package/dist/learner/revert-stats.d.ts +14 -0
  158. package/dist/learner/revert-stats.js +42 -0
  159. package/dist/learner/revert-stats.js.map +1 -1
  160. package/dist/local-provider-url.d.ts +3 -0
  161. package/dist/local-provider-url.js +28 -0
  162. package/dist/local-provider-url.js.map +1 -0
  163. package/dist/main.js +22 -0
  164. package/dist/main.js.map +1 -1
  165. package/dist/plugins/learner/.claude-plugin/plugin.json +1 -1
  166. package/dist/plugins/learner/.codex-plugin/plugin.json +1 -1
  167. package/dist/plugins/learner/hooks/session-start +30 -1
  168. package/dist/plugins/learner/skills/learn/consolidator-prompt.md +4 -0
  169. package/dist/preflight/deployment-readiness.d.ts +147 -0
  170. package/dist/preflight/deployment-readiness.js +366 -0
  171. package/dist/preflight/deployment-readiness.js.map +1 -0
  172. package/dist/preflight/pidfile-liveness.d.ts +7 -1
  173. package/dist/preflight/pidfile-liveness.js +14 -0
  174. package/dist/preflight/pidfile-liveness.js.map +1 -1
  175. package/dist/rpc/transport.d.ts +36 -0
  176. package/dist/rpc/transport.js +123 -24
  177. package/dist/rpc/transport.js.map +1 -1
  178. package/dist/scripts/swe-rebench-v2-seed-pool.json +2 -1
  179. package/dist/solver-types/_swe-rebench-v2-held-out-slate.d.ts +76 -0
  180. package/dist/solver-types/_swe-rebench-v2-held-out-slate.js +156 -0
  181. package/dist/solver-types/_swe-rebench-v2-held-out-slate.js.map +1 -0
  182. package/dist/solver-types/_swe-rebench-v2-pool-recovery.d.ts +81 -0
  183. package/dist/solver-types/_swe-rebench-v2-pool-recovery.js +116 -0
  184. package/dist/solver-types/_swe-rebench-v2-pool-recovery.js.map +1 -0
  185. package/dist/solver-types/_swe-rebench-v2-state.d.ts +9 -0
  186. package/dist/solver-types/_swe-rebench-v2-state.js +14 -0
  187. package/dist/solver-types/_swe-rebench-v2-state.js.map +1 -1
  188. package/dist/solver-types/slates/held-out-slate.swe-rebench-v2.v1.json +20 -0
  189. package/dist/solver-types/slates/held-out-slate.swe-rebench-v2.v2.json +19 -0
  190. package/dist/solver-types/slates/held-out-slate.swe-rebench-v2.v2.screening-report.json +628 -0
  191. package/dist/solver-types/solver-type.d.ts +8 -0
  192. package/dist/solver-types/swe-rebench-v2.d.ts +2 -0
  193. package/dist/solver-types/swe-rebench-v2.js +106 -2
  194. package/dist/solver-types/swe-rebench-v2.js.map +1 -1
  195. package/dist/solvernets/launched-record-dispatcher.d.ts +3 -0
  196. package/dist/solvernets/launched-record-dispatcher.js.map +1 -1
  197. package/dist/solvernets/registry-client-erc8004.js +29 -37
  198. package/dist/solvernets/registry-client-erc8004.js.map +1 -1
  199. package/dist/solvernets/registry-client.d.ts +6 -0
  200. package/dist/solvernets/store.js +7 -2
  201. package/dist/solvernets/store.js.map +1 -1
  202. package/dist/spend/ai-units-config.d.ts +10 -0
  203. package/dist/spend/ai-units-config.js +7 -1
  204. package/dist/spend/ai-units-config.js.map +1 -1
  205. package/dist/spend/ai-units.d.ts +51 -0
  206. package/dist/spend/ai-units.js +73 -0
  207. package/dist/spend/ai-units.js.map +1 -1
  208. package/dist/spend/record.js +12 -5
  209. package/dist/spend/record.js.map +1 -1
  210. package/dist/store/store.d.ts +91 -5
  211. package/dist/store/store.js +170 -7
  212. package/dist/store/store.js.map +1 -1
  213. package/dist/vendor/@jinn-network/sdk/dist/payloads/swe-rebench-v2.d.ts +108 -1
  214. package/dist/vendor/@jinn-network/sdk/dist/payloads/swe-rebench-v2.js +25 -1
  215. package/dist/vendor/@jinn-network/sdk/dist/solvernets/swe-rebench-v2-held-out-slate.d.ts +65 -0
  216. package/dist/vendor/@jinn-network/sdk/dist/solvernets/swe-rebench-v2-held-out-slate.js +123 -0
  217. package/dist/vendor/@jinn-network/sdk/dist/solvernets/swe-rebench-v2.d.ts +2 -2
  218. package/dist/vendor/@jinn-network/sdk/dist/solvernets/swe-rebench-v2.js +1 -1
  219. package/dist/vendor/@jinn-network/sdk/package.json +4 -0
  220. package/docker-compose.yml +3 -2
  221. package/package.json +22 -18
  222. package/plugins/learner/.claude-plugin/plugin.json +1 -1
  223. package/plugins/learner/.codex-plugin/plugin.json +1 -1
  224. package/plugins/learner/hooks/session-start +30 -1
  225. package/plugins/learner/skills/learn/consolidator-prompt.md +4 -0
  226. package/plugins/swe-rebench-v2-runtime/hooks/hooks.json +16 -0
  227. package/plugins/swe-rebench-v2-runtime/hooks/session-start +74 -0
  228. package/dist/dashboard/assets/index-CzKxvMcU.css +0 -32
  229. package/dist/dashboard/assets/index-yVemxHot.js +0 -351
@@ -24,7 +24,7 @@
24
24
  * at the read-API level (Ponder → eth_getLogs floor). This helper sits beneath
25
25
  * both layers at the JSON-RPC transport level.
26
26
  */
27
- import { ExecutionRevertedError, fallback, http, TransactionRejectedRpcError, UserRejectedRequestError, } from 'viem';
27
+ import { ExecutionRevertedError, fallback, http, LimitExceededRpcError, TransactionRejectedRpcError, UserRejectedRequestError, } from 'viem';
28
28
  /**
29
29
  * Hard cap on the number of providers in a single fallback chain. Four covers
30
30
  * the "operator paid primary + public publicnode + public sepolia.base.org +
@@ -142,6 +142,58 @@ export function isViemShouldThrowError(err) {
142
142
  }
143
143
  return false;
144
144
  }
145
+ /**
146
+ * Default cooldown applied to a slot that returns a quota / rate-limit error
147
+ * (#835). After this window the demoted slot becomes eligible again rather than
148
+ * being permanently disabled (AC2), so a transient 429 / monthly-quota blip
149
+ * never strands an operator on a degraded provider for the rest of the process.
150
+ */
151
+ export const DEFAULT_RPC_COOLDOWN_MS = 60_000;
152
+ /**
153
+ * Detect quota / rate-limit errors from an RPC provider (#835). Unlike
154
+ * {@link isViemShouldThrowError} (which marks EVM/wallet-level signals that must
155
+ * NOT trigger fallback), a quota error means the *slot* is temporarily unusable
156
+ * and should be demoted behind healthy slots for a cooldown window. Walks the
157
+ * cause chain (cycle-safe, mirroring `isViemShouldThrowError`) and matches on:
158
+ * - HTTP `status === 429` (the `http()` transport's `HttpRequestError`);
159
+ * - JSON-RPC `code === LimitExceededRpcError.code` (-32005);
160
+ * - a narrow message regex backstop covering unambiguous provider phrasings
161
+ * ("rate limit", "too many requests", "429", "quota", "compute unit",
162
+ * "request rate", "throughput") — deliberately excluding the ambiguous
163
+ * "limit"/"exceeded" words that collide with gas-limit errors.
164
+ *
165
+ * Deliberately narrow: a 5xx / network error is NOT a quota error (it falls
166
+ * through via viem but does not cool the slot — AC3 keeps static order when no
167
+ * quota errors occur), and a contract revert (code 3) is never a quota error.
168
+ */
169
+ export function isRpcQuotaError(err) {
170
+ // HTTP 429 (below) and JSON-RPC -32005 (LimitExceededRpcError) are the PRIMARY
171
+ // detectors. This message regex is only a backstop for providers that surface
172
+ // quota errors as plain text. It deliberately avoids the ambiguous "limit" /
173
+ // "exceeded" words: a bare `exceeded.*limit` alternative false-positives on
174
+ // gas errors like "exceeded block gas limit" / "gas limit exceeded", which can
175
+ // arrive with a non-shouldThrow code (e.g. -32000) and would wrongly cool a
176
+ // healthy slot. The phrases below are unambiguously quota/rate-limit and never
177
+ // appear in gas/execution errors; the only thing dropped is a text-only quota
178
+ // error carrying no 429 / -32005, which no major provider (Alchemy / Infura /
179
+ // publicnode / Tenderly) produces.
180
+ const quotaMessage = /rate.?limit|too many requests|429|quota|compute unit|request rate|throughput/i;
181
+ const seen = new Set();
182
+ let cursor = err;
183
+ while (cursor instanceof Error && !seen.has(cursor)) {
184
+ seen.add(cursor);
185
+ // Comparing against a numeric constant already excludes non-numbers, so no
186
+ // separate `typeof === 'number'` guard is needed here.
187
+ if (cursor.status === 429)
188
+ return true;
189
+ if (cursor.code === LimitExceededRpcError.code)
190
+ return true;
191
+ if (quotaMessage.test(cursor.message))
192
+ return true;
193
+ cursor = cursor.cause;
194
+ }
195
+ return false;
196
+ }
145
197
  /**
146
198
  * Mask an RPC URL down to its hostname for display / error reporting. Drops
147
199
  * the path so api-key segments in the URL don't leak into logs.
@@ -172,39 +224,86 @@ export function buildFallbackTransport(urls, options = {}) {
172
224
  */
173
225
  buildFallbackTransport.buildFromTransports = function buildFromTransports(transports, urls, options = {}) {
174
226
  const maskedProviders = urls.map(maskRpcHost);
175
- const inner = fallback(transports, {
176
- rank: options.rank ?? false,
177
- retryCount: 0,
227
+ const now = options.now ?? Date.now;
228
+ const cooldownMs = options.cooldownMs ?? DEFAULT_RPC_COOLDOWN_MS;
229
+ const rank = options.rank ?? false;
230
+ // Cooldown bookkeeping, indexed by ORIGINAL slot index (#835). A slot that
231
+ // returns a quota / rate-limit error is demoted behind the healthy slots
232
+ // until `cooldownUntil[i]`, then becomes eligible again (AC1 + AC2). When no
233
+ // quota errors occur every entry stays 0 and the configured order is
234
+ // preserved verbatim (AC3).
235
+ const cooldownUntil = new Array(transports.length).fill(0);
236
+ // Self-stamping slot wrappers, built ONCE over the original slot order. Each
237
+ // wraps its original transport FACTORY, closing over its ORIGINAL index `i`.
238
+ // When the instantiated slot's request rejects with a quota error it stamps
239
+ // its OWN `cooldownUntil[i]` and re-throws unchanged. This per-slot
240
+ // self-stamping is why we don't use viem's `onResponse` — its `transport`
241
+ // arg is a freshly-instantiated instance that can't be mapped back to a slot
242
+ // index. Only the wrapper ARRAY is reordered per request (below); the
243
+ // wrappers themselves keep their original index for the lifetime of the
244
+ // chain.
245
+ const stampingTransports = transports.map((make, i) => {
246
+ return ((config) => {
247
+ const instance = make(config);
248
+ const innerRequest = instance.request.bind(instance);
249
+ instance.request = (async (args) => {
250
+ try {
251
+ return await innerRequest(args);
252
+ }
253
+ catch (err) {
254
+ // A revert / user-rejected (shouldThrow-class) is an EVM/wallet
255
+ // signal, never a transport quota problem — must NOT cool the slot.
256
+ if (!isViemShouldThrowError(err) && isRpcQuotaError(err)) {
257
+ cooldownUntil[i] = now() + cooldownMs;
258
+ }
259
+ throw err;
260
+ }
261
+ });
262
+ return instance;
263
+ });
178
264
  });
179
- // Wrap the transport so that the final exhausted-chain rejection surfaces
180
- // as our structured `AllRpcsFailedError` (carrying the masked host list).
181
- // We do the wrap at the transport-factory level rather than swapping the
182
- // returned function's `request` so the FallbackTransport's typed shape
183
- // (`onResponse`, `transports`, etc.) is preserved.
265
+ // Per-request slot order: healthy slots (in original order) first, then
266
+ // cooling slots (in original order) as a last resort. Strict `<` means a
267
+ // slot is healthy again exactly at `now() === cooldownUntil[i]`.
268
+ const orderSlots = () => {
269
+ const healthy = [];
270
+ const cooling = [];
271
+ const t = now();
272
+ for (let i = 0; i < stampingTransports.length; i++) {
273
+ if (t < cooldownUntil[i])
274
+ cooling.push(stampingTransports[i]);
275
+ else
276
+ healthy.push(stampingTransports[i]);
277
+ }
278
+ return [...healthy, ...cooling];
279
+ };
184
280
  const wrapped = ((config) => {
185
- const t = inner(config);
186
- const originalRequest = t.request.bind(t);
187
- t.request = (async (args) => {
281
+ // Instantiate one inner fallback so the returned object carries the
282
+ // canonical `FallbackTransport` shape (`type: 'fallback'`, `onResponse`,
283
+ // `transports`). Its `request` is overridden to rebuild a fresh
284
+ // `fallback()` over the reordered slots on every call — the reorder is the
285
+ // whole point of #835, and a fresh chain with `retryCount: 0` reproduces
286
+ // the existing per-slot fall-through behaviour exactly.
287
+ const shape = fallback(stampingTransports, { rank, retryCount: 0 })(config);
288
+ shape.request = (async (args) => {
289
+ const perCall = fallback(orderSlots(), { rank, retryCount: 0 })(config);
188
290
  try {
189
- return await originalRequest(args);
291
+ return await perCall.request(args);
190
292
  }
191
293
  catch (err) {
192
- // viem's fallback() short-circuits on shouldThrow-class errors
193
- // (contract revert, user-rejected, CAIP 5000) — those are
194
- // EVM/wallet-level, not transport-level failures. Propagate them
195
- // unchanged so callers (and the operator-app's `rpc_all_failed`
196
- // state message) don't misread a single-slot revert as an
197
- // exhausted-chain outage.
294
+ // shouldThrow-class errors (revert, user-rejected, CAIP 5000) are
295
+ // EVM/wallet-level — propagate unchanged so a single-slot revert is
296
+ // never misread as an exhausted-chain outage.
198
297
  if (isViemShouldThrowError(err))
199
298
  throw err;
200
- // Otherwise: viem doesn't expose a distinct "all transports failed"
201
- // error class — when fallback exhausts the chain it throws the last
202
- // underlying error. Wrap so the caller gets a stable structural
203
- // error carrying the masked provider list.
299
+ // The whole chain is exhausted. viem has no distinct "all transports
300
+ // failed" class, so wrap the last underlying error in our structured
301
+ // `AllRpcsFailedError` carrying the masked host list in ORIGINAL
302
+ // configured order (never reordered).
204
303
  throw new AllRpcsFailedError(maskedProviders, err);
205
304
  }
206
305
  });
207
- return t;
306
+ return shape;
208
307
  });
209
308
  return wrapped;
210
309
  };
@@ -1 +1 @@
1
- {"version":3,"file":"transport.js","sourceRoot":"","sources":["../../src/rpc/transport.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,EACL,sBAAsB,EACtB,QAAQ,EACR,IAAI,EACJ,2BAA2B,EAC3B,wBAAwB,GAGzB,MAAM,MAAM,CAAC;AAEd;;;;;GAKG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC;AAOtC;;;;;;;;;GASG;AACH,MAAM,UAAU,YAAY,CAC1B,KAAiC,EACjC,UAA+B,EAAE;IAEjC,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,IAAI,CAAC,CAAC,CAAS,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;IAC3E,MAAM,GAAG,GAAG,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,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AC,CAAC,CAAE,CAAC,EAAE,CAAC;AACxF,CAAC"}
@@ -1,7 +1,8 @@
1
1
  {
2
- "comment": "Real Python instance IDs that exist in the current nebius/SWE-rebench-leaderboard pool (split 2025_01). validate-pool --seed-positive runs gold-eval against each. Not every entry is guaranteed to record scorable:true — some leaderboard rows have nondeterministic gold patches or upstream-substrate issues. The team prunes this list over time as empirical admit-rates surface. See DR 2026-05-14-swe-rebench-eval-admission.",
2
+ "comment": "Real Python instance IDs that exist in the current nebius/SWE-rebench-leaderboard pool (split 2025_01). validate-pool --seed-positive runs gold-eval against each. Not every entry is guaranteed to record scorable:true — some leaderboard rows have nondeterministic gold patches or upstream-substrate issues. The team prunes this list over time as empirical admit-rates surface. See DR 2026-05-14-swe-rebench-eval-admission. NOTE: sympy__sympy-27510 is the shared T2.2/T3.1 release-gate fixture (client/test/release/tier-2/fixtures/known-instance.ts) — it MUST stay in this list so `validate-pool --seed-positive` keeps it admitted across each EVAL_SEMANTICS_VERSION bump; without a v4 admission the env-suite real-harness loop times out on admission_missing_or_unscorable (2026-06-08 cut).",
3
3
  "source": "spike jinn-mono-fufn — initial set sampled from loadSweRebenchV2Pool() on 2026-05-14",
4
4
  "instance_ids": [
5
+ "sympy__sympy-27510",
5
6
  "tobymao__sqlglot-4661",
6
7
  "Blaizzy__mlx-vlm-179",
7
8
  "pydata__xarray-9974",
@@ -0,0 +1,76 @@
1
+ /**
2
+ * Held-out task slate for the swe-rebench-v2 RL eval harness (issue #817).
3
+ *
4
+ * A slate is a versioned, content-addressed set of swe-rebench-v2
5
+ * `instance_id`s RESERVED from the training pool. The generator excludes
6
+ * slate instances from the train stream so they never enter training; a
7
+ * future eval orchestrator runs solvers against the slate to measure
8
+ * out-of-sample performance. Scores are only comparable *within* a slate
9
+ * version — a version bump (`v2`, …) is a distinct artifact with a distinct
10
+ * content hash, never compared against an earlier version.
11
+ *
12
+ * The artifact ships as a JSON file under `slates/` next to this module
13
+ * (`held-out-slate.swe-rebench-v2.<version>.json`). It carries a self-declared
14
+ * content hash: the loader recomputes a sha256 over the canonicalised,
15
+ * instance-id-sorted artifact and compares it to the file's `hash` field,
16
+ * failing loud on mismatch. This guards against accidental drift — a hand-edit
17
+ * that adds or removes an instance without re-deriving the hash. It is NOT a
18
+ * tamper-proof anchor: the declared hash lives in the same file it verifies, so
19
+ * a deliberate edit that also re-derives the hash passes, and the check is
20
+ * skipped entirely when the `hash` field is absent. A real trust anchor (an
21
+ * external/on-chain hash) is out of scope here.
22
+ *
23
+ * Hashing mirrors `hashVettedPoolArtifact` in `_swe-rebench-v2-validated-pool`:
24
+ * `sha256(canonicalJson(normalized))` with a `sha256:` prefix.
25
+ */
26
+ import type { PoolTask } from './_swe-rebench-v2-pool.js';
27
+ export declare const HELD_OUT_SLATE_SCHEMA_VERSION: "held-out-slate.v1";
28
+ export interface HeldOutSlateArtifact {
29
+ schemaVersion: typeof HELD_OUT_SLATE_SCHEMA_VERSION;
30
+ solverType: string;
31
+ version: string;
32
+ generatedAt: string;
33
+ instanceIds: string[];
34
+ }
35
+ export interface LoadedHeldOutSlate {
36
+ version: string;
37
+ hash: `sha256:${string}`;
38
+ instanceIds: Set<string>;
39
+ }
40
+ export declare function parseHeldOutSlateArtifact(raw: unknown): HeldOutSlateArtifact;
41
+ export declare function hashHeldOutSlateArtifact(artifact: HeldOutSlateArtifact): `sha256:${string}`;
42
+ /**
43
+ * Load the held-out slate for `solverType` at `version`. Validates the version
44
+ * shape, that the file's declared `solverType`/`version` match the request, and
45
+ * (when a `hash` field is present) that the recomputed content hash matches it —
46
+ * catching accidental edit-without-rehash drift, not deliberate tampering (see
47
+ * the module header). Throws if no slate file exists for the requested version
48
+ * (scores are only comparable within a known version).
49
+ *
50
+ * `opts.dir` overrides the slate file directory; it defaults to the
51
+ * module-relative `slatesDir()`. Production callers omit it (and so resolve the
52
+ * shipped slates); tests inject a temp dir to drive the fail-loud throw paths
53
+ * against malformed fixtures.
54
+ */
55
+ export declare function loadHeldOutSlate(solverType: string, version: string, opts?: {
56
+ dir?: string;
57
+ }): LoadedHeldOutSlate;
58
+ /**
59
+ * Drop any pool task whose `instance_id` is in the held-out slate. This is the
60
+ * single train-stream exclusion (issue #817 AC#2): the generator is the sole
61
+ * train-stream chokepoint, so a slate instance filtered here is never posted,
62
+ * never claimable, and never trains.
63
+ */
64
+ export declare function excludeHeldOutSlate(pool: PoolTask[], slateIds: Set<string>): PoolTask[];
65
+ /**
66
+ * Slate versions currently used as held-out exams. The generator excludes the
67
+ * UNION of these from the train stream, so every active exam stays out of
68
+ * training while non-slate instances of every repo remain trainable. Add a
69
+ * version here ONLY when its slate file exists (loadHeldOutSlate fails loud on
70
+ * a missing file).
71
+ */
72
+ export declare const ACTIVE_HELD_OUT_SLATE_VERSIONS: readonly ["v1", "v2"];
73
+ /** Union of instance ids across the given active slate versions. */
74
+ export declare function loadActiveHeldOutSlateIds(solverType: string, versions: readonly string[], opts?: {
75
+ dir?: string;
76
+ }): Set<string>;
@@ -0,0 +1,156 @@
1
+ /**
2
+ * Held-out task slate for the swe-rebench-v2 RL eval harness (issue #817).
3
+ *
4
+ * A slate is a versioned, content-addressed set of swe-rebench-v2
5
+ * `instance_id`s RESERVED from the training pool. The generator excludes
6
+ * slate instances from the train stream so they never enter training; a
7
+ * future eval orchestrator runs solvers against the slate to measure
8
+ * out-of-sample performance. Scores are only comparable *within* a slate
9
+ * version — a version bump (`v2`, …) is a distinct artifact with a distinct
10
+ * content hash, never compared against an earlier version.
11
+ *
12
+ * The artifact ships as a JSON file under `slates/` next to this module
13
+ * (`held-out-slate.swe-rebench-v2.<version>.json`). It carries a self-declared
14
+ * content hash: the loader recomputes a sha256 over the canonicalised,
15
+ * instance-id-sorted artifact and compares it to the file's `hash` field,
16
+ * failing loud on mismatch. This guards against accidental drift — a hand-edit
17
+ * that adds or removes an instance without re-deriving the hash. It is NOT a
18
+ * tamper-proof anchor: the declared hash lives in the same file it verifies, so
19
+ * a deliberate edit that also re-derives the hash passes, and the check is
20
+ * skipped entirely when the `hash` field is absent. A real trust anchor (an
21
+ * external/on-chain hash) is out of scope here.
22
+ *
23
+ * Hashing mirrors `hashVettedPoolArtifact` in `_swe-rebench-v2-validated-pool`:
24
+ * `sha256(canonicalJson(normalized))` with a `sha256:` prefix.
25
+ */
26
+ import { readFileSync } from 'node:fs';
27
+ import { createHash } from 'node:crypto';
28
+ import { fileURLToPath } from 'node:url';
29
+ import { dirname, resolve as resolvePath, join } from 'node:path';
30
+ import { canonicalJson } from '../harnesses/engine/canonical-json.js';
31
+ export const HELD_OUT_SLATE_SCHEMA_VERSION = 'held-out-slate.v1';
32
+ function isObject(raw) {
33
+ return typeof raw === 'object' && raw !== null;
34
+ }
35
+ export function parseHeldOutSlateArtifact(raw) {
36
+ if (!isObject(raw))
37
+ throw new Error('held-out slate artifact must be an object');
38
+ if (raw['schemaVersion'] !== HELD_OUT_SLATE_SCHEMA_VERSION) {
39
+ throw new Error(`held-out slate schemaVersion must be ${HELD_OUT_SLATE_SCHEMA_VERSION}`);
40
+ }
41
+ if (typeof raw['solverType'] !== 'string' || raw['solverType'].length === 0) {
42
+ throw new Error('held-out slate solverType must be a non-empty string');
43
+ }
44
+ if (typeof raw['version'] !== 'string' || raw['version'].length === 0) {
45
+ throw new Error('held-out slate version must be a non-empty string');
46
+ }
47
+ if (typeof raw['generatedAt'] !== 'string') {
48
+ throw new Error('held-out slate generatedAt must be a string');
49
+ }
50
+ if (!Array.isArray(raw['instanceIds']) ||
51
+ raw['instanceIds'].some((id) => typeof id !== 'string' || id.length === 0)) {
52
+ throw new Error('held-out slate instanceIds must be an array of non-empty strings');
53
+ }
54
+ return {
55
+ schemaVersion: HELD_OUT_SLATE_SCHEMA_VERSION,
56
+ solverType: raw['solverType'],
57
+ version: raw['version'],
58
+ generatedAt: raw['generatedAt'],
59
+ instanceIds: raw['instanceIds'].slice(),
60
+ };
61
+ }
62
+ function normalizeHeldOutSlateArtifact(artifact) {
63
+ return {
64
+ schemaVersion: HELD_OUT_SLATE_SCHEMA_VERSION,
65
+ solverType: artifact.solverType,
66
+ version: artifact.version,
67
+ generatedAt: artifact.generatedAt,
68
+ instanceIds: [...artifact.instanceIds].sort((a, b) => a.localeCompare(b)),
69
+ };
70
+ }
71
+ export function hashHeldOutSlateArtifact(artifact) {
72
+ const canonical = canonicalJson(normalizeHeldOutSlateArtifact(artifact));
73
+ return `sha256:${createHash('sha256').update(canonical).digest('hex')}`;
74
+ }
75
+ /**
76
+ * Resolve the slate file directory. At runtime the compiled module lives at
77
+ * `dist/solver-types/<this>.js` and the slate JSON at `dist/solver-types/slates/`
78
+ * (copied during `yarn build`); in dev/test the source module is at
79
+ * `src/solver-types/<this>.ts` with the slate JSON at `src/solver-types/slates/`.
80
+ * `./slates` resolves correctly in both layouts.
81
+ */
82
+ function slatesDir() {
83
+ return resolvePath(dirname(fileURLToPath(import.meta.url)), 'slates');
84
+ }
85
+ function slateFileName(solverType, version) {
86
+ if (!/^v\d+$/.test(version)) {
87
+ throw new Error(`held-out slate version must match /^v\\d+$/ (got ${JSON.stringify(version)})`);
88
+ }
89
+ return `held-out-slate.${solverType.replace(/\.v\d+$/, '')}.${version}.json`;
90
+ }
91
+ /**
92
+ * Load the held-out slate for `solverType` at `version`. Validates the version
93
+ * shape, that the file's declared `solverType`/`version` match the request, and
94
+ * (when a `hash` field is present) that the recomputed content hash matches it —
95
+ * catching accidental edit-without-rehash drift, not deliberate tampering (see
96
+ * the module header). Throws if no slate file exists for the requested version
97
+ * (scores are only comparable within a known version).
98
+ *
99
+ * `opts.dir` overrides the slate file directory; it defaults to the
100
+ * module-relative `slatesDir()`. Production callers omit it (and so resolve the
101
+ * shipped slates); tests inject a temp dir to drive the fail-loud throw paths
102
+ * against malformed fixtures.
103
+ */
104
+ export function loadHeldOutSlate(solverType, version, opts = {}) {
105
+ const path = join(opts.dir ?? slatesDir(), slateFileName(solverType, version));
106
+ let raw;
107
+ try {
108
+ raw = readFileSync(path, 'utf8');
109
+ }
110
+ catch {
111
+ throw new Error(`held-out slate not found for solverType=${solverType} version=${version} (expected ${path})`);
112
+ }
113
+ const parsed = JSON.parse(raw);
114
+ const artifact = parseHeldOutSlateArtifact(parsed);
115
+ if (artifact.version !== version) {
116
+ throw new Error(`held-out slate version mismatch: file declares ${artifact.version}, requested ${version}`);
117
+ }
118
+ if (artifact.solverType !== solverType) {
119
+ throw new Error(`held-out slate solverType mismatch: file declares ${artifact.solverType}, requested ${solverType}`);
120
+ }
121
+ const hash = hashHeldOutSlateArtifact(artifact);
122
+ const declared = parsed['hash'];
123
+ if (typeof declared === 'string' && declared !== hash) {
124
+ throw new Error(`held-out slate hash mismatch for ${solverType} ${version}: declared ${declared}, computed ${hash} (artifact was edited without re-deriving the hash)`);
125
+ }
126
+ return { version: artifact.version, hash, instanceIds: new Set(artifact.instanceIds) };
127
+ }
128
+ /**
129
+ * Drop any pool task whose `instance_id` is in the held-out slate. This is the
130
+ * single train-stream exclusion (issue #817 AC#2): the generator is the sole
131
+ * train-stream chokepoint, so a slate instance filtered here is never posted,
132
+ * never claimable, and never trains.
133
+ */
134
+ export function excludeHeldOutSlate(pool, slateIds) {
135
+ if (slateIds.size === 0)
136
+ return pool;
137
+ return pool.filter((task) => !slateIds.has(task.instance_id));
138
+ }
139
+ /**
140
+ * Slate versions currently used as held-out exams. The generator excludes the
141
+ * UNION of these from the train stream, so every active exam stays out of
142
+ * training while non-slate instances of every repo remain trainable. Add a
143
+ * version here ONLY when its slate file exists (loadHeldOutSlate fails loud on
144
+ * a missing file).
145
+ */
146
+ export const ACTIVE_HELD_OUT_SLATE_VERSIONS = ['v1', 'v2'];
147
+ /** Union of instance ids across the given active slate versions. */
148
+ export function loadActiveHeldOutSlateIds(solverType, versions, opts = {}) {
149
+ const ids = new Set();
150
+ for (const version of versions) {
151
+ for (const id of loadHeldOutSlate(solverType, version, opts).instanceIds)
152
+ ids.add(id);
153
+ }
154
+ return ids;
155
+ }
156
+ //# sourceMappingURL=_swe-rebench-v2-held-out-slate.js.map
@@ -0,0 +1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AAgB,CAAC,UAAU,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC,WAAW;YAAE,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IACxF,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
@@ -0,0 +1,81 @@
1
+ /**
2
+ * Fresh-volume vetted-pool recovery for the swe-rebench-v2 generator (#957).
3
+ *
4
+ * A freshly-deployed operator has an empty disk: no `validated-pool.json`, so
5
+ * the generator's admission gate hits `admission-required-no-data` and posts 0
6
+ * tasks. The vetted pool was previously published to IPFS; we recover it via the
7
+ * indexer (DR-2026-06-02 open-question #4, Option B — read the artifact ref via
8
+ * the DiscoveryAPI, not on-chain directly):
9
+ *
10
+ * 1. `discoveryApi.getMostRecentTaskCidDigest(manifestCid)` → a recent task's
11
+ * on-chain `taskCidDigest` (pure indexer/chain read; no IPFS in discovery).
12
+ * 2. Reconstruct the IPFS task CID (`f01551220 + digestHexWithout0x`, the same
13
+ * derivation as `adapters/mech/adapter.ts`) and fetch the task body.
14
+ * 3. Read the vetted-pool ref from the task's `eligibility.vettedPoolRef`
15
+ * (`VETTED_POOL_REF_ELIGIBILITY_KEY`).
16
+ * 4. Fetch + parse the artifact at `ref.artifactCid`.
17
+ * 5. SECURITY: verify `hashVettedPoolArtifact(artifact) === ref.artifactHash`.
18
+ * A mismatch is REJECTED — no file is written.
19
+ * 6. Write the scorable entries into `validated-pool.json` via
20
+ * `ValidatedPoolStore.record`. After a successful recovery the generator's
21
+ * existing `resolvePublishedVettedPool` / pool-load path picks up the now-
22
+ * present `validated-pool.json`.
23
+ *
24
+ * Never-overwrite: if a local validated pool already exists for the current
25
+ * `EVAL_SEMANTICS_VERSION`, recovery is a no-op (`local-pool-present`) — the same
26
+ * "don't clobber newer local data" stance as `resolvePublishedVettedPool`'s
27
+ * `validatedNewer` guard.
28
+ *
29
+ * Fail-closed: every external call is wrapped so any failure returns a structured
30
+ * `{ recovered: false, reason }`. Recovery NEVER throws — it must fall through to
31
+ * the existing `admission-required-no-data` path so a recovery failure can never
32
+ * crash the generator tick.
33
+ */
34
+ import { ValidatedPoolStore } from './_swe-rebench-v2-validated-pool.js';
35
+ import type { DiscoveryAPI } from '../discovery/types.js';
36
+ export interface RecoverVettedPoolResult {
37
+ recovered: boolean;
38
+ /**
39
+ * Why recovery did not complete (only set when `recovered === false`):
40
+ * - `local-pool-present` — a local validated pool already exists; not clobbered.
41
+ * - `no-task` — the indexer reports no task for the manifest yet.
42
+ * - `no-ref` — the recovered task carries no `vettedPoolRef` eligibility.
43
+ * - `hash-mismatch` — the fetched artifact's hash did not match the ref (SECURITY).
44
+ * - `error:<msg>` — any external call failed (discovery / IPFS / parse).
45
+ */
46
+ reason?: string;
47
+ /** Count of scorable entries written, on a successful recovery. */
48
+ entriesRecovered?: number;
49
+ }
50
+ /**
51
+ * Whether a recovery outcome is TERMINAL — i.e. retrying cannot help, so the
52
+ * caller should latch permanently and never attempt recovery again:
53
+ *
54
+ * - `recovered === true` — done; the pool was written.
55
+ * - `local-pool-present` — a local pool already exists; nothing to recover.
56
+ *
57
+ * All other outcomes (`no-task`, `no-ref`, `error:*`, `hash-mismatch`) are
58
+ * TRANSIENT/retryable, so the caller must NOT latch on them (it retries under a
59
+ * bounded cap instead):
60
+ * - `no-task` — a fresh SolverNet may not have posted its first task yet.
61
+ * - `no-ref` — the task's eligibility may not yet carry a vettedPoolRef.
62
+ * - `error:*` — the indexer / IPFS gateway may be having a transient blip.
63
+ * - `hash-mismatch` — the fetched artifact's hash didn't match the ref. This is
64
+ * SECURITY-rejected at write time (the bad artifact is NEVER written), and it
65
+ * can be transient: a corrupted IPFS-gateway response may fetch cleanly on a
66
+ * later attempt, or the launcher may re-publish a corrected ref that a later
67
+ * task carries. Retrying re-resolves the most-recent task's ref AND re-fetches
68
+ * from IPFS, so a corrected pool is picked up without a restart; the bounded
69
+ * retry cap prevents looping on a genuinely-bad ref.
70
+ */
71
+ export declare function isTerminalRecoveryOutcome(result: RecoverVettedPoolResult): boolean;
72
+ export interface RecoverVettedPoolDeps {
73
+ stateDir: string;
74
+ manifestCid: string;
75
+ discoveryApi: DiscoveryAPI;
76
+ ipfsGatewayUrl: string;
77
+ store: ValidatedPoolStore;
78
+ /** Injected so tests can stub the IPFS round-trip; production passes `fetchFromIpfs`. */
79
+ fetchFromIpfs: (gatewayUrl: string, cid: string) => Promise<unknown>;
80
+ }
81
+ export declare function recoverVettedPoolFromNetwork(deps: RecoverVettedPoolDeps): Promise<RecoverVettedPoolResult>;