@jinn-network/client 0.1.6-canary.fb9c8196 → 0.1.7-canary.d4e4e183
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.
- package/CHANGELOG.md +33 -0
- package/deployments/deployment-jinn-mvi-l1-sepolia-fast.json +23 -4
- package/deployments/deployment-jinn-mvi-l1-sepolia.json +23 -4
- package/deployments/deployment-jinn-mvi-l2-baseSepolia.json +5 -4
- package/dist/adapters/mech/adapter.d.ts +38 -1
- package/dist/adapters/mech/adapter.js +241 -54
- package/dist/adapters/mech/adapter.js.map +1 -1
- package/dist/adapters/mech/contracts.d.ts +17 -4
- package/dist/adapters/mech/contracts.js +8 -2
- package/dist/adapters/mech/contracts.js.map +1 -1
- package/dist/adapters/mech/safe-revert.d.ts +20 -0
- package/dist/adapters/mech/safe-revert.js +12 -4
- package/dist/adapters/mech/safe-revert.js.map +1 -1
- package/dist/adapters/mech/safe.d.ts +5 -1
- package/dist/adapters/mech/safe.js +27 -8
- package/dist/adapters/mech/safe.js.map +1 -1
- package/dist/adapters/mech/verdict-code.d.ts +1 -0
- package/dist/adapters/mech/verdict-code.js +18 -0
- package/dist/adapters/mech/verdict-code.js.map +1 -1
- package/dist/api/admin-endpoint.d.ts +15 -3
- package/dist/api/admin-endpoint.js +24 -2
- package/dist/api/admin-endpoint.js.map +1 -1
- package/dist/api/bootstrap-endpoint.js +9 -5
- package/dist/api/bootstrap-endpoint.js.map +1 -1
- package/dist/api/codex-doctor-endpoint.d.ts +73 -0
- package/dist/api/codex-doctor-endpoint.js +177 -0
- package/dist/api/codex-doctor-endpoint.js.map +1 -0
- package/dist/api/discovery-endpoint.d.ts +1 -0
- package/dist/api/discovery-endpoint.js +26 -0
- package/dist/api/discovery-endpoint.js.map +1 -1
- package/dist/api/gather-status.d.ts +11 -0
- package/dist/api/gather-status.js +332 -3
- package/dist/api/gather-status.js.map +1 -1
- package/dist/api/hermes-doctor-endpoint.d.ts +107 -0
- package/dist/api/hermes-doctor-endpoint.js +204 -5
- package/dist/api/hermes-doctor-endpoint.js.map +1 -1
- package/dist/api/launcher-status.d.ts +21 -16
- package/dist/api/launcher-status.js +2 -1
- package/dist/api/launcher-status.js.map +1 -1
- package/dist/api/portfolio-v0-build.d.ts +10 -0
- package/dist/api/portfolio-v0-build.js +24 -5
- package/dist/api/portfolio-v0-build.js.map +1 -1
- package/dist/api/prediction-v1-build.d.ts +10 -0
- package/dist/api/prediction-v1-build.js +7 -1
- package/dist/api/prediction-v1-build.js.map +1 -1
- package/dist/api/server.d.ts +31 -1
- package/dist/api/server.js +68 -1
- package/dist/api/server.js.map +1 -1
- package/dist/api/setup-endpoints.js +50 -4
- package/dist/api/setup-endpoints.js.map +1 -1
- package/dist/api/solvernets-endpoints.d.ts +8 -0
- package/dist/api/solvernets-endpoints.js +71 -43
- package/dist/api/solvernets-endpoints.js.map +1 -1
- package/dist/api/status-build.d.ts +58 -0
- package/dist/api/status-build.js +50 -0
- package/dist/api/status-build.js.map +1 -1
- package/dist/api/task-run-routing.d.ts +7 -0
- package/dist/api/task-run-routing.js +12 -0
- package/dist/api/task-run-routing.js.map +1 -0
- package/dist/api/task-runs-build.d.ts +21 -0
- package/dist/api/task-runs-build.js +14 -1
- package/dist/api/task-runs-build.js.map +1 -1
- package/dist/build-info.json +4 -4
- package/dist/build-meta.json +1 -1
- package/dist/chain-read-errors.d.ts +10 -0
- package/dist/chain-read-errors.js +15 -0
- package/dist/chain-read-errors.js.map +1 -1
- package/dist/cli/commands/auth.js +1 -1
- package/dist/cli/commands/auth.js.map +1 -1
- package/dist/cli/commands/create.js +3 -2
- package/dist/cli/commands/create.js.map +1 -1
- package/dist/cli/commands/doctor.d.ts +2 -0
- package/dist/cli/commands/doctor.js +2 -0
- package/dist/cli/commands/doctor.js.map +1 -1
- package/dist/cli/commands/rewards.js +11 -7
- package/dist/cli/commands/rewards.js.map +1 -1
- package/dist/cli/commands/status.js +1 -1
- package/dist/cli/commands/status.js.map +1 -1
- package/dist/cli/commands/tasks.js +86 -9
- package/dist/cli/commands/tasks.js.map +1 -1
- package/dist/cli/commands/update.d.ts +10 -0
- package/dist/cli/commands/update.js +36 -0
- package/dist/cli/commands/update.js.map +1 -1
- package/dist/cli/introspection-context.js +5 -0
- package/dist/cli/introspection-context.js.map +1 -1
- package/dist/cli/task-native-readiness.d.ts +3 -1
- package/dist/cli/task-native-readiness.js +28 -6
- package/dist/cli/task-native-readiness.js.map +1 -1
- package/dist/config.d.ts +97 -5
- package/dist/config.js +90 -18
- package/dist/config.js.map +1 -1
- package/dist/daemon/checkpoint-loop.d.ts +48 -0
- package/dist/daemon/checkpoint-loop.js +76 -0
- package/dist/daemon/checkpoint-loop.js.map +1 -0
- package/dist/daemon/creator.d.ts +1 -1
- package/dist/daemon/creator.js +7 -3
- package/dist/daemon/creator.js.map +1 -1
- package/dist/daemon/daemon.d.ts +11 -0
- package/dist/daemon/daemon.js +51 -1
- package/dist/daemon/daemon.js.map +1 -1
- package/dist/daemon/jinn-claim-loop-wiring.d.ts +33 -0
- package/dist/daemon/jinn-claim-loop-wiring.js +40 -0
- package/dist/daemon/jinn-claim-loop-wiring.js.map +1 -0
- package/dist/daemon/jinn-claim-loop.d.ts +24 -17
- package/dist/daemon/jinn-claim-loop.js +77 -23
- package/dist/daemon/jinn-claim-loop.js.map +1 -1
- package/dist/daemon/skip-log-dedup.d.ts +69 -0
- package/dist/daemon/skip-log-dedup.js +106 -0
- package/dist/daemon/skip-log-dedup.js.map +1 -0
- package/dist/dashboard/assets/index-BUlE8F3Y.js +330 -0
- package/dist/dashboard/assets/index-blqc7eqq.css +32 -0
- package/dist/dashboard/index.html +2 -2
- package/dist/discovery/factory.d.ts +17 -5
- package/dist/discovery/factory.js +46 -18
- package/dist/discovery/factory.js.map +1 -1
- package/dist/discovery/http.js +142 -3
- package/dist/discovery/http.js.map +1 -1
- package/dist/discovery/onchain.d.ts +5 -0
- package/dist/discovery/onchain.js +407 -15
- package/dist/discovery/onchain.js.map +1 -1
- package/dist/discovery/types.d.ts +45 -1
- package/dist/discovery/types.js +8 -10
- package/dist/discovery/types.js.map +1 -1
- package/dist/discovery/with-fallback.d.ts +7 -0
- package/dist/discovery/with-fallback.js +10 -0
- package/dist/discovery/with-fallback.js.map +1 -1
- package/dist/earning/bootstrap.d.ts +44 -12
- package/dist/earning/bootstrap.js +88 -46
- package/dist/earning/bootstrap.js.map +1 -1
- package/dist/earning/contracts.d.ts +5 -3
- package/dist/earning/contracts.js +12 -7
- package/dist/earning/contracts.js.map +1 -1
- package/dist/earning/funding-plan.js +27 -18
- package/dist/earning/funding-plan.js.map +1 -1
- package/dist/earning/safe-adapter.d.ts +2 -0
- package/dist/earning/safe-adapter.js +26 -12
- package/dist/earning/safe-adapter.js.map +1 -1
- package/dist/earning/store.d.ts +8 -0
- package/dist/earning/store.js.map +1 -1
- package/dist/earning/testnet-setup-migration.js +10 -0
- package/dist/earning/testnet-setup-migration.js.map +1 -1
- package/dist/erc8004/reputation.d.ts +8 -0
- package/dist/erc8004/reputation.js +22 -3
- package/dist/erc8004/reputation.js.map +1 -1
- package/dist/harnesses/engine/engine.d.ts +72 -0
- package/dist/harnesses/engine/engine.js +105 -8
- package/dist/harnesses/engine/engine.js.map +1 -1
- package/dist/harnesses/engine/persistence.d.ts +51 -1
- package/dist/harnesses/engine/persistence.js +118 -5
- package/dist/harnesses/engine/persistence.js.map +1 -1
- package/dist/harnesses/engine/work-dir-reaper.d.ts +65 -0
- package/dist/harnesses/engine/work-dir-reaper.js +100 -0
- package/dist/harnesses/engine/work-dir-reaper.js.map +1 -0
- package/dist/harnesses/impls/hermes-agent/adapter.js +40 -0
- package/dist/harnesses/impls/hermes-agent/adapter.js.map +1 -1
- package/dist/harnesses/impls/hermes-agent/bootstrap.d.ts +20 -0
- package/dist/harnesses/impls/hermes-agent/bootstrap.js +40 -6
- package/dist/harnesses/impls/hermes-agent/bootstrap.js.map +1 -1
- package/dist/harnesses/impls/hermes-agent/harness.d.ts +37 -1
- package/dist/harnesses/impls/hermes-agent/harness.js +59 -4
- package/dist/harnesses/impls/hermes-agent/harness.js.map +1 -1
- package/dist/harnesses/impls/index.d.ts +5 -0
- package/dist/harnesses/impls/index.js +11 -0
- package/dist/harnesses/impls/index.js.map +1 -1
- package/dist/harnesses/impls/learner/harness.d.ts +38 -4
- package/dist/harnesses/impls/learner/harness.js +96 -2
- package/dist/harnesses/impls/learner/harness.js.map +1 -1
- package/dist/harnesses/impls/learner/plugin-path.d.ts +0 -13
- package/dist/harnesses/impls/learner/plugin-path.js +35 -15
- package/dist/harnesses/impls/learner/plugin-path.js.map +1 -1
- package/dist/harnesses/impls/learner/types.d.ts +11 -0
- package/dist/harnesses/impls/stub.d.ts +58 -0
- package/dist/harnesses/impls/stub.js +89 -0
- package/dist/harnesses/impls/stub.js.map +1 -0
- package/dist/harnesses/impls/swe-rebench-v2-evaluator/eval-runner.d.ts +69 -50
- package/dist/harnesses/impls/swe-rebench-v2-evaluator/eval-runner.js +178 -93
- package/dist/harnesses/impls/swe-rebench-v2-evaluator/eval-runner.js.map +1 -1
- package/dist/harnesses/impls/swe-rebench-v2-evaluator/harness.d.ts +12 -1
- package/dist/harnesses/impls/swe-rebench-v2-evaluator/harness.js +121 -7
- package/dist/harnesses/impls/swe-rebench-v2-evaluator/harness.js.map +1 -1
- package/dist/harnesses/impls/swe-rebench-v2-evaluator/hf-fetcher.d.ts +15 -0
- package/dist/harnesses/impls/swe-rebench-v2-evaluator/hf-fetcher.js +54 -4
- package/dist/harnesses/impls/swe-rebench-v2-evaluator/hf-fetcher.js.map +1 -1
- package/dist/harnesses/impls/swe-rebench-v2-evaluator/index.d.ts +6 -0
- package/dist/harnesses/impls/swe-rebench-v2-evaluator/index.js +1 -1
- package/dist/harnesses/impls/swe-rebench-v2-evaluator/index.js.map +1 -1
- package/dist/harnesses/readiness-registry.js +9 -1
- package/dist/harnesses/readiness-registry.js.map +1 -1
- package/dist/main.js +168 -53
- package/dist/main.js.map +1 -1
- package/dist/observability/emit-event.d.ts +1 -1
- package/dist/observability/emit-event.js.map +1 -1
- package/dist/plugins/learner/.claude-plugin/plugin.json +9 -0
- package/dist/plugins/learner/.codex-plugin/plugin.json +39 -0
- package/dist/plugins/learner/AGENTS.md +40 -0
- package/dist/plugins/learner/CLAUDE.md +33 -0
- package/dist/plugins/learner/README.md +59 -0
- package/dist/plugins/learner/hooks/hooks.json +16 -0
- package/dist/plugins/learner/hooks/session-start +38 -0
- package/dist/plugins/learner/skills/learn/SKILL.md +412 -0
- package/dist/plugins/learner/skills/learn/analyst-prompt.md +68 -0
- package/dist/plugins/learner/skills/learn/consolidator-prompt.md +94 -0
- package/dist/plugins/learner/skills/learn/explorer-prompt.md +53 -0
- package/dist/plugins/learner/skills/learn/planner-prompt.md +87 -0
- package/dist/plugins/learner/skills/learn/promoter-prompt.md +113 -0
- package/dist/plugins/learner/skills/learn/step-worker-prompt.md +47 -0
- package/dist/plugins/learner/skills/learn/strategist-prompt.md +85 -0
- package/dist/restart-daemon.d.ts +29 -10
- package/dist/restart-daemon.js +27 -14
- package/dist/restart-daemon.js.map +1 -1
- package/dist/solver-nets/prediction-operator-ux.js +31 -12
- package/dist/solver-nets/prediction-operator-ux.js.map +1 -1
- package/dist/solver-types/_swe-rebench-v2-pool-cache.d.ts +58 -0
- package/dist/solver-types/_swe-rebench-v2-pool-cache.js +87 -0
- package/dist/solver-types/_swe-rebench-v2-pool-cache.js.map +1 -0
- package/dist/solver-types/_swe-rebench-v2-substrate.d.ts +1 -0
- package/dist/solver-types/_swe-rebench-v2-substrate.js +10 -0
- package/dist/solver-types/_swe-rebench-v2-substrate.js.map +1 -1
- package/dist/solver-types/_swe-rebench-v2-validated-pool.d.ts +65 -0
- package/dist/solver-types/_swe-rebench-v2-validated-pool.js +243 -26
- package/dist/solver-types/_swe-rebench-v2-validated-pool.js.map +1 -1
- package/dist/solver-types/swe-rebench-v2-auto.d.ts +22 -7
- package/dist/solver-types/swe-rebench-v2-auto.js +45 -20
- package/dist/solver-types/swe-rebench-v2-auto.js.map +1 -1
- package/dist/solver-types/swe-rebench-v2.d.ts +13 -2
- package/dist/solver-types/swe-rebench-v2.js +233 -94
- package/dist/solver-types/swe-rebench-v2.js.map +1 -1
- package/dist/solvernets/daemon-init.d.ts +10 -2
- package/dist/solvernets/daemon-init.js +22 -2
- package/dist/solvernets/daemon-init.js.map +1 -1
- package/dist/solvernets/launched-record-dispatcher.js +35 -7
- package/dist/solvernets/launched-record-dispatcher.js.map +1 -1
- package/dist/solvernets/store.d.ts +5 -0
- package/dist/solvernets/store.js +1 -0
- package/dist/solvernets/store.js.map +1 -1
- package/dist/store/store.d.ts +15 -0
- package/dist/store/store.js +118 -3
- package/dist/store/store.js.map +1 -1
- package/dist/tasks/sources.d.ts +18 -1
- package/dist/tasks/sources.js +33 -5
- package/dist/tasks/sources.js.map +1 -1
- package/dist/tx-retry.d.ts +151 -19
- package/dist/tx-retry.js +286 -32
- package/dist/tx-retry.js.map +1 -1
- package/dist/types/payloads/prediction-apy-v0.d.ts +5 -5
- package/dist/types/payloads/prediction-v0.d.ts +5 -5
- package/dist/types/task-document.d.ts +392 -0
- package/dist/types/task-document.js +10 -0
- package/dist/types/task-document.js.map +1 -1
- package/dist/types/task.d.ts +28 -0
- package/dist/util/extract-tx-hash.d.ts +14 -0
- package/dist/util/extract-tx-hash.js +19 -0
- package/dist/util/extract-tx-hash.js.map +1 -0
- package/dist/vendor/@jinn-network/sdk/dist/contracts.js +1 -1
- package/dist/vendor/@jinn-network/sdk/dist/solvernets/manifest-schema.d.ts +3 -0
- package/dist/vendor/@jinn-network/sdk/dist/solvernets/manifest-schema.js +1 -0
- package/package.json +29 -12
- package/dist/dashboard/assets/index-C_QnE4YV.js +0 -140
- package/dist/dashboard/assets/index-CarzUepP.css +0 -32
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Disk cache for the swe-rebench-v2 task pool. The pool is sourced from the
|
|
3
|
+
* HuggingFace datasets-server; this cache lets the generator keep posting
|
|
4
|
+
* tasks across HF outages instead of silently going idle (#466).
|
|
5
|
+
*
|
|
6
|
+
* Stored at `<stateDir>/pool-cache.json`, alongside `generator-state.json`
|
|
7
|
+
* and `validated-pool.json`. Mirrors the GeneratorStateStore persistence
|
|
8
|
+
* pattern in `_swe-rebench-v2-state.ts`.
|
|
9
|
+
*/
|
|
10
|
+
import type { PoolTask } from './_swe-rebench-v2-pool.js';
|
|
11
|
+
/** A pool read back from disk. */
|
|
12
|
+
export interface CachedPool {
|
|
13
|
+
tasks: PoolTask[];
|
|
14
|
+
/** ISO timestamp the cache was written. */
|
|
15
|
+
savedAt: string;
|
|
16
|
+
}
|
|
17
|
+
export declare class PoolCacheStore {
|
|
18
|
+
private cacheFile;
|
|
19
|
+
constructor(opts: {
|
|
20
|
+
stateDir: string;
|
|
21
|
+
});
|
|
22
|
+
/** Persist the pool. Creates the state dir if missing. */
|
|
23
|
+
write(tasks: PoolTask[]): Promise<void>;
|
|
24
|
+
/**
|
|
25
|
+
* Read the cached pool. Returns null when the file is absent, unparseable,
|
|
26
|
+
* or carries an unrecognised schema — never throws, so a corrupt cache
|
|
27
|
+
* degrades to "no cache" rather than crashing the generator.
|
|
28
|
+
*/
|
|
29
|
+
read(): Promise<CachedPool | null>;
|
|
30
|
+
}
|
|
31
|
+
/** Outcome of an HF pool load attempt with cache fallback. */
|
|
32
|
+
export interface PoolLoadResult {
|
|
33
|
+
/** The pool to use. May be empty only when HF failed and no cache exists. */
|
|
34
|
+
pool: PoolTask[];
|
|
35
|
+
/** True when `pool` was served from the disk cache rather than a live load. */
|
|
36
|
+
fromCache: boolean;
|
|
37
|
+
/** Set when the live HF load failed (even if a fallback pool was found). */
|
|
38
|
+
error?: {
|
|
39
|
+
message: string;
|
|
40
|
+
at: string;
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Load the pool from HF, falling back to the disk cache on failure.
|
|
45
|
+
*
|
|
46
|
+
* - load succeeds -> return it, persist it to the cache.
|
|
47
|
+
* - load fails, pool held -> keep the in-memory pool (no cache read needed).
|
|
48
|
+
* - load fails, no pool, cache present -> serve the cache (`fromCache: true`).
|
|
49
|
+
* - load fails, no pool, no cache -> empty pool (generator idle).
|
|
50
|
+
*
|
|
51
|
+
* Pure orchestration: the loader and cache are injected so every branch is
|
|
52
|
+
* unit-testable. Never throws.
|
|
53
|
+
*/
|
|
54
|
+
export declare function loadPoolWithCacheFallback(args: {
|
|
55
|
+
loadPool: () => Promise<PoolTask[]>;
|
|
56
|
+
cache: PoolCacheStore;
|
|
57
|
+
currentPool: PoolTask[];
|
|
58
|
+
}): Promise<PoolLoadResult>;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Disk cache for the swe-rebench-v2 task pool. The pool is sourced from the
|
|
3
|
+
* HuggingFace datasets-server; this cache lets the generator keep posting
|
|
4
|
+
* tasks across HF outages instead of silently going idle (#466).
|
|
5
|
+
*
|
|
6
|
+
* Stored at `<stateDir>/pool-cache.json`, alongside `generator-state.json`
|
|
7
|
+
* and `validated-pool.json`. Mirrors the GeneratorStateStore persistence
|
|
8
|
+
* pattern in `_swe-rebench-v2-state.ts`.
|
|
9
|
+
*/
|
|
10
|
+
import { readFile, writeFile, mkdir } from 'node:fs/promises';
|
|
11
|
+
import { join, dirname } from 'node:path';
|
|
12
|
+
const SCHEMA_VERSION = 'swe-rebench-v2-pool-cache.v1';
|
|
13
|
+
export class PoolCacheStore {
|
|
14
|
+
cacheFile;
|
|
15
|
+
constructor(opts) {
|
|
16
|
+
this.cacheFile = join(opts.stateDir, 'pool-cache.json');
|
|
17
|
+
}
|
|
18
|
+
/** Persist the pool. Creates the state dir if missing. */
|
|
19
|
+
async write(tasks) {
|
|
20
|
+
const payload = {
|
|
21
|
+
schemaVersion: SCHEMA_VERSION,
|
|
22
|
+
savedAt: new Date().toISOString(),
|
|
23
|
+
tasks,
|
|
24
|
+
};
|
|
25
|
+
await mkdir(dirname(this.cacheFile), { recursive: true });
|
|
26
|
+
await writeFile(this.cacheFile, JSON.stringify(payload, null, 2));
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Read the cached pool. Returns null when the file is absent, unparseable,
|
|
30
|
+
* or carries an unrecognised schema — never throws, so a corrupt cache
|
|
31
|
+
* degrades to "no cache" rather than crashing the generator.
|
|
32
|
+
*/
|
|
33
|
+
async read() {
|
|
34
|
+
let raw;
|
|
35
|
+
try {
|
|
36
|
+
raw = await readFile(this.cacheFile, 'utf8');
|
|
37
|
+
}
|
|
38
|
+
catch {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
try {
|
|
42
|
+
const parsed = JSON.parse(raw);
|
|
43
|
+
if (parsed.schemaVersion !== SCHEMA_VERSION ||
|
|
44
|
+
typeof parsed.savedAt !== 'string' ||
|
|
45
|
+
!Array.isArray(parsed.tasks)) {
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
return { tasks: parsed.tasks, savedAt: parsed.savedAt };
|
|
49
|
+
}
|
|
50
|
+
catch {
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Load the pool from HF, falling back to the disk cache on failure.
|
|
57
|
+
*
|
|
58
|
+
* - load succeeds -> return it, persist it to the cache.
|
|
59
|
+
* - load fails, pool held -> keep the in-memory pool (no cache read needed).
|
|
60
|
+
* - load fails, no pool, cache present -> serve the cache (`fromCache: true`).
|
|
61
|
+
* - load fails, no pool, no cache -> empty pool (generator idle).
|
|
62
|
+
*
|
|
63
|
+
* Pure orchestration: the loader and cache are injected so every branch is
|
|
64
|
+
* unit-testable. Never throws.
|
|
65
|
+
*/
|
|
66
|
+
export async function loadPoolWithCacheFallback(args) {
|
|
67
|
+
try {
|
|
68
|
+
const pool = await args.loadPool();
|
|
69
|
+
await args.cache.write(pool);
|
|
70
|
+
return { pool, fromCache: false };
|
|
71
|
+
}
|
|
72
|
+
catch (err) {
|
|
73
|
+
const error = {
|
|
74
|
+
message: err instanceof Error ? err.message : String(err),
|
|
75
|
+
at: new Date().toISOString(),
|
|
76
|
+
};
|
|
77
|
+
if (args.currentPool.length > 0) {
|
|
78
|
+
return { pool: args.currentPool, fromCache: false, error };
|
|
79
|
+
}
|
|
80
|
+
const cached = await args.cache.read();
|
|
81
|
+
if (cached && cached.tasks.length > 0) {
|
|
82
|
+
return { pool: cached.tasks, fromCache: true, error };
|
|
83
|
+
}
|
|
84
|
+
return { pool: [], fromCache: false, error };
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=_swe-rebench-v2-pool-cache.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_swe-rebench-v2-pool-cache.js","sourceRoot":"","sources":["../../src/solver-types/_swe-rebench-v2-pool-cache.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAG1C,MAAM,cAAc,GAAG,8BAAuC,CAAC;AAe/D,MAAM,OAAO,cAAc;IACjB,SAAS,CAAS;IAE1B,YAAY,IAA0B;QACpC,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,iBAAiB,CAAC,CAAC;IAC1D,CAAC;IAED,0DAA0D;IAC1D,KAAK,CAAC,KAAK,CAAC,KAAiB;QAC3B,MAAM,OAAO,GAAkB;YAC7B,aAAa,EAAE,cAAc;YAC7B,OAAO,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACjC,KAAK;SACN,CAAC;QACF,MAAM,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAC1D,MAAM,SAAS,CAAC,IAAI,CAAC,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D,EAAE,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;SAC7B,CAAC;QACF,IAAI,IAAI,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAChC,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,WAAW,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;QAC7D,CAAC;QACD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;QACvC,IAAI,MAAM,IAAI,MAAM,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACtC,OAAO,EAAE,IAAI,EAAE,MAAM,CAAC,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;QACxD,CAAC;QACD,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;IAC/C,CAAC;AACH,CAAC"}
|
|
@@ -39,6 +39,7 @@ export interface CommandResult {
|
|
|
39
39
|
export type CommandRunner = (bin: string, args: string[], opts?: {
|
|
40
40
|
cwd?: string;
|
|
41
41
|
}) => Promise<CommandResult>;
|
|
42
|
+
export declare const defaultCommandRunner: CommandRunner;
|
|
42
43
|
/**
|
|
43
44
|
* Resolve the digest of a local Docker image via `docker image inspect`.
|
|
44
45
|
* Returns null when docker fails or the image has no RepoDigests entry
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
* evaluator harness.
|
|
9
9
|
*/
|
|
10
10
|
import { createHash } from 'node:crypto';
|
|
11
|
+
import { spawn } from 'node:child_process';
|
|
11
12
|
/**
|
|
12
13
|
* Canonical-JSON SHA-256 over the HF row fields that affect grading.
|
|
13
14
|
* Keys are sorted recursively so field-reorder produces the same hash.
|
|
@@ -29,6 +30,15 @@ function sortedKeys(_key, value) {
|
|
|
29
30
|
}
|
|
30
31
|
return value;
|
|
31
32
|
}
|
|
33
|
+
export const defaultCommandRunner = (bin, args, opts) => new Promise((resolve, reject) => {
|
|
34
|
+
const child = spawn(bin, args, { ...(opts ?? {}), stdio: ['ignore', 'pipe', 'pipe'] });
|
|
35
|
+
let stdout = '';
|
|
36
|
+
let stderr = '';
|
|
37
|
+
child.stdout?.on('data', (d) => { stdout += d.toString(); });
|
|
38
|
+
child.stderr?.on('data', (d) => { stderr += d.toString(); });
|
|
39
|
+
child.on('error', reject);
|
|
40
|
+
child.on('close', (code) => resolve({ exitCode: code ?? 1, stdout, stderr }));
|
|
41
|
+
});
|
|
32
42
|
/**
|
|
33
43
|
* Resolve the digest of a local Docker image via `docker image inspect`.
|
|
34
44
|
* Returns null when docker fails or the image has no RepoDigests entry
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_swe-rebench-v2-substrate.js","sourceRoot":"","sources":["../../src/solver-types/_swe-rebench-v2-substrate.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"_swe-rebench-v2-substrate.js","sourceRoot":"","sources":["../../src/solver-types/_swe-rebench-v2-substrate.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAoB3C;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAAC,GAAiB;IAC9C,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC;IAClD,MAAM,GAAG,GAAG,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACjE,OAAO,UAAU,GAAG,EAAE,CAAC;AACzB,CAAC;AAED,SAAS,UAAU,CAAC,IAAY,EAAE,KAAc;IAC9C,IAAI,KAAK,IAAI,OAAO,KAAK,KAAK,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AU,yBAAyB,CAC7C,eAAuB,EACvB,MAAqB;IAErB,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,KAAK,EAAE,CAAC,WAAW,EAAE,MAAM,CAAC,EAAE,EAAE,GAAG,EAAE,eAAe,EAAE,CAAC,CAAC;IACjF,IAAI,GAAG,CAAC,QAAQ,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IACpC,MAAM,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;IAC9B,OAAO,gBAAgB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC;AACjD,CAAC"}
|
|
@@ -36,6 +36,10 @@ import { type CommandRunner } from './_swe-rebench-v2-substrate.js';
|
|
|
36
36
|
* import/setup failures) — jinn-mono-fufn.
|
|
37
37
|
*/
|
|
38
38
|
export declare const EVAL_SEMANTICS_VERSION = "3";
|
|
39
|
+
export declare const SWE_REBENCH_V2_VETTED_POOL_ARTIFACT_TYPE: "swe-rebench-v2-vetted-pool.v1";
|
|
40
|
+
export declare const SOLVERNET_ARTIFACT_REF_SCHEMA_VERSION: "solvernet.artifact-ref.v1";
|
|
41
|
+
export declare const VETTED_POOL_REF_ELIGIBILITY_KEY: "vettedPoolRef";
|
|
42
|
+
declare const PUBLICATION_SCHEMA_VERSION: "swe-rebench-v2-vetted-pool-publication.v1";
|
|
39
43
|
export interface ValidatedPoolEntry {
|
|
40
44
|
scorable: boolean;
|
|
41
45
|
/** Why scorable/unscorable — `'gold-patch-resolves'`, `'ungradeable:<reason>'`, etc. */
|
|
@@ -50,6 +54,48 @@ export interface ValidatedPoolEntry {
|
|
|
50
54
|
/** `git rev-parse HEAD` of the enabled upstream SWE-rebench repo at validation time. v3+. */
|
|
51
55
|
upstreamEvalCommit?: string;
|
|
52
56
|
}
|
|
57
|
+
export interface SweRebenchV2VettedPoolArtifactEntry extends ValidatedPoolEntry {
|
|
58
|
+
instance_id: string;
|
|
59
|
+
scorable: true;
|
|
60
|
+
}
|
|
61
|
+
export interface SweRebenchV2VettedPoolArtifact {
|
|
62
|
+
schemaVersion: typeof SWE_REBENCH_V2_VETTED_POOL_ARTIFACT_TYPE;
|
|
63
|
+
evalSemanticsVersion: string;
|
|
64
|
+
generatedAt: string;
|
|
65
|
+
entries: SweRebenchV2VettedPoolArtifactEntry[];
|
|
66
|
+
}
|
|
67
|
+
export interface SolverNetArtifactRef {
|
|
68
|
+
schemaVersion: typeof SOLVERNET_ARTIFACT_REF_SCHEMA_VERSION;
|
|
69
|
+
manifestCid: string;
|
|
70
|
+
artifactType: typeof SWE_REBENCH_V2_VETTED_POOL_ARTIFACT_TYPE;
|
|
71
|
+
artifactCid: string;
|
|
72
|
+
artifactHash: `sha256:${string}`;
|
|
73
|
+
evalSemanticsVersion: string;
|
|
74
|
+
publishedAt: string;
|
|
75
|
+
}
|
|
76
|
+
export interface VettedPoolArtifactPublication {
|
|
77
|
+
schemaVersion: typeof PUBLICATION_SCHEMA_VERSION;
|
|
78
|
+
updatedAt: string;
|
|
79
|
+
ref: SolverNetArtifactRef;
|
|
80
|
+
artifact: SweRebenchV2VettedPoolArtifact;
|
|
81
|
+
}
|
|
82
|
+
export interface ScorableVettedPoolArtifactEntries {
|
|
83
|
+
ids: Set<string>;
|
|
84
|
+
byId: Map<string, SweRebenchV2VettedPoolArtifactEntry>;
|
|
85
|
+
}
|
|
86
|
+
export declare function parseVettedPoolArtifact(raw: unknown): SweRebenchV2VettedPoolArtifact;
|
|
87
|
+
export declare function hashVettedPoolArtifact(artifact: SweRebenchV2VettedPoolArtifact): `sha256:${string}`;
|
|
88
|
+
export declare function loadVettedPoolArtifactScorableEntries(raw: unknown): ScorableVettedPoolArtifactEntries;
|
|
89
|
+
export declare function createVettedPoolArtifactRef(args: {
|
|
90
|
+
manifestCid: string;
|
|
91
|
+
artifactCid: string;
|
|
92
|
+
artifactHash: `sha256:${string}`;
|
|
93
|
+
evalSemanticsVersion: string;
|
|
94
|
+
publishedAt: string;
|
|
95
|
+
}): SolverNetArtifactRef;
|
|
96
|
+
export declare function sweRebenchV2VettedPoolArtifactMetadataKey(manifestCid: string): string;
|
|
97
|
+
export declare function parseVettedPoolArtifactRef(raw: unknown): SolverNetArtifactRef;
|
|
98
|
+
export declare function vettedPoolArtifactRefFromEligibility(eligibility: Record<string, unknown> | undefined): SolverNetArtifactRef | null;
|
|
53
99
|
export declare class ValidatedPoolStore {
|
|
54
100
|
private readonly file;
|
|
55
101
|
private cache;
|
|
@@ -68,10 +114,28 @@ export declare class ValidatedPoolStore {
|
|
|
68
114
|
* on-disk file is absent or built for a different version). Memoised by
|
|
69
115
|
* mtime so the generator's tick doesn't re-parse the JSON every poll. */
|
|
70
116
|
getScorableIds(evalSemanticsVersion: string): Promise<Set<string> | null>;
|
|
117
|
+
getScorableEntries(evalSemanticsVersion: string): Promise<{
|
|
118
|
+
entries: Record<string, ValidatedPoolEntry>;
|
|
119
|
+
updatedAt: string;
|
|
120
|
+
} | null>;
|
|
71
121
|
/** The entry for `instanceId`, or `null` if not validated for this semantics version. */
|
|
72
122
|
getEntry(instanceId: string, evalSemanticsVersion: string): Promise<ValidatedPoolEntry | null>;
|
|
73
123
|
record(instanceId: string, entry: ValidatedPoolEntry, evalSemanticsVersion: string): Promise<void>;
|
|
74
124
|
}
|
|
125
|
+
export declare function exportScorableVettedPoolArtifact(store: ValidatedPoolStore, evalSemanticsVersion: string, opts?: {
|
|
126
|
+
generatedAt?: string;
|
|
127
|
+
}): Promise<SweRebenchV2VettedPoolArtifact | null>;
|
|
128
|
+
export declare function readVettedPoolArtifactPublication(args: {
|
|
129
|
+
stateDir: string;
|
|
130
|
+
manifestCid?: string;
|
|
131
|
+
evalSemanticsVersion?: string;
|
|
132
|
+
}): Promise<VettedPoolArtifactPublication | null>;
|
|
133
|
+
export declare function writeVettedPoolArtifactPublication(args: {
|
|
134
|
+
stateDir: string;
|
|
135
|
+
ref: SolverNetArtifactRef;
|
|
136
|
+
artifact: SweRebenchV2VettedPoolArtifact;
|
|
137
|
+
updatedAt?: string;
|
|
138
|
+
}): Promise<VettedPoolArtifactPublication>;
|
|
75
139
|
export type AdmissionMode = 'required' | 'python-floor';
|
|
76
140
|
/**
|
|
77
141
|
* Restrict the generator's posting pool.
|
|
@@ -120,3 +184,4 @@ export declare function validatePoolInstances(pool: PoolTask[], deps: ValidatePo
|
|
|
120
184
|
limit?: number;
|
|
121
185
|
force?: boolean;
|
|
122
186
|
}): Promise<ValidatePoolSummary>;
|
|
187
|
+
export {};
|
|
@@ -20,10 +20,10 @@
|
|
|
20
20
|
* Refs: jinn-mono-uy6v.9.
|
|
21
21
|
*/
|
|
22
22
|
import { readFile, writeFile, mkdir, stat, rename, unlink } from 'node:fs/promises';
|
|
23
|
-
import { randomBytes } from 'node:crypto';
|
|
24
|
-
import { spawn } from 'node:child_process';
|
|
23
|
+
import { createHash, randomBytes } from 'node:crypto';
|
|
25
24
|
import { resolve as resolvePath, dirname, join } from 'node:path';
|
|
26
|
-
import { computeRowHash, resolveImageDigest, resolveUpstreamEvalCommit } from './_swe-rebench-v2-substrate.js';
|
|
25
|
+
import { computeRowHash, defaultCommandRunner, resolveImageDigest, resolveUpstreamEvalCommit, } from './_swe-rebench-v2-substrate.js';
|
|
26
|
+
import { canonicalJson } from '../harnesses/engine/canonical-json.js';
|
|
27
27
|
// In-process mutex map: serialises concurrent record() calls against the
|
|
28
28
|
// same file. Entries are never removed; bounded by the number of distinct
|
|
29
29
|
// validated-pool.json paths used in this process (typically 1).
|
|
@@ -58,6 +58,11 @@ function withWriteLock(file, fn) {
|
|
|
58
58
|
*/
|
|
59
59
|
export const EVAL_SEMANTICS_VERSION = '3';
|
|
60
60
|
const SCHEMA_VERSION = 'swe-rebench-v2-validated-pool.v1';
|
|
61
|
+
export const SWE_REBENCH_V2_VETTED_POOL_ARTIFACT_TYPE = 'swe-rebench-v2-vetted-pool.v1';
|
|
62
|
+
export const SOLVERNET_ARTIFACT_REF_SCHEMA_VERSION = 'solvernet.artifact-ref.v1';
|
|
63
|
+
export const VETTED_POOL_REF_ELIGIBILITY_KEY = 'vettedPoolRef';
|
|
64
|
+
const PUBLICATION_SCHEMA_VERSION = 'swe-rebench-v2-vetted-pool-publication.v1';
|
|
65
|
+
const PUBLICATION_FILE = 'vetted-pool-artifact-publication.json';
|
|
61
66
|
function freshFile(evalSemanticsVersion) {
|
|
62
67
|
return { schemaVersion: SCHEMA_VERSION, evalSemanticsVersion, updatedAt: new Date().toISOString(), entries: {} };
|
|
63
68
|
}
|
|
@@ -67,6 +72,153 @@ function isValidFile(raw, evalSemanticsVersion) {
|
|
|
67
72
|
raw.evalSemanticsVersion === evalSemanticsVersion &&
|
|
68
73
|
typeof raw.entries === 'object' && raw.entries !== null);
|
|
69
74
|
}
|
|
75
|
+
function publicationPath(stateDir) {
|
|
76
|
+
return resolvePath(join(stateDir, PUBLICATION_FILE));
|
|
77
|
+
}
|
|
78
|
+
async function writeJsonAtomic(file, value) {
|
|
79
|
+
await mkdir(dirname(file), { recursive: true });
|
|
80
|
+
const tmp = `${file}.${randomBytes(6).toString('hex')}.tmp`;
|
|
81
|
+
await writeFile(tmp, JSON.stringify(value, null, 2));
|
|
82
|
+
try {
|
|
83
|
+
await rename(tmp, file); // POSIX rename is atomic
|
|
84
|
+
}
|
|
85
|
+
catch (err) {
|
|
86
|
+
// Best-effort tempfile cleanup — don't mask the original error.
|
|
87
|
+
await unlink(tmp).catch(() => undefined);
|
|
88
|
+
throw err;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
function isObject(raw) {
|
|
92
|
+
return typeof raw === 'object' && raw !== null;
|
|
93
|
+
}
|
|
94
|
+
function isSha256(value) {
|
|
95
|
+
return typeof value === 'string' && /^sha256:[0-9a-f]{64}$/u.test(value);
|
|
96
|
+
}
|
|
97
|
+
function parseVettedPoolArtifactEntry(raw) {
|
|
98
|
+
if (!isObject(raw))
|
|
99
|
+
return null;
|
|
100
|
+
if (typeof raw['instance_id'] !== 'string' || raw['instance_id'].length === 0)
|
|
101
|
+
return null;
|
|
102
|
+
if (raw['scorable'] !== true)
|
|
103
|
+
return null;
|
|
104
|
+
if (typeof raw['reason'] !== 'string')
|
|
105
|
+
return null;
|
|
106
|
+
if (typeof raw['checkedAt'] !== 'string')
|
|
107
|
+
return null;
|
|
108
|
+
const entry = {
|
|
109
|
+
instance_id: raw['instance_id'],
|
|
110
|
+
scorable: true,
|
|
111
|
+
reason: raw['reason'],
|
|
112
|
+
checkedAt: raw['checkedAt'],
|
|
113
|
+
...(typeof raw['rowHash'] === 'string' ? { rowHash: raw['rowHash'] } : {}),
|
|
114
|
+
...(typeof raw['imageName'] === 'string' ? { imageName: raw['imageName'] } : {}),
|
|
115
|
+
...(typeof raw['imageDigest'] === 'string' ? { imageDigest: raw['imageDigest'] } : {}),
|
|
116
|
+
...(typeof raw['upstreamEvalCommit'] === 'string' ? { upstreamEvalCommit: raw['upstreamEvalCommit'] } : {}),
|
|
117
|
+
};
|
|
118
|
+
return entry;
|
|
119
|
+
}
|
|
120
|
+
export function parseVettedPoolArtifact(raw) {
|
|
121
|
+
if (!isObject(raw))
|
|
122
|
+
throw new Error('vetted pool artifact must be an object');
|
|
123
|
+
if (raw['schemaVersion'] !== SWE_REBENCH_V2_VETTED_POOL_ARTIFACT_TYPE) {
|
|
124
|
+
throw new Error(`vetted pool artifact schemaVersion must be ${SWE_REBENCH_V2_VETTED_POOL_ARTIFACT_TYPE}`);
|
|
125
|
+
}
|
|
126
|
+
if (typeof raw['evalSemanticsVersion'] !== 'string') {
|
|
127
|
+
throw new Error('vetted pool artifact evalSemanticsVersion must be a string');
|
|
128
|
+
}
|
|
129
|
+
if (typeof raw['generatedAt'] !== 'string') {
|
|
130
|
+
throw new Error('vetted pool artifact generatedAt must be a string');
|
|
131
|
+
}
|
|
132
|
+
if (!Array.isArray(raw['entries'])) {
|
|
133
|
+
throw new Error('vetted pool artifact entries must be an array');
|
|
134
|
+
}
|
|
135
|
+
const entries = raw['entries'].map(parseVettedPoolArtifactEntry);
|
|
136
|
+
if (entries.some((e) => e === null)) {
|
|
137
|
+
throw new Error('vetted pool artifact contains an invalid or unscorable entry');
|
|
138
|
+
}
|
|
139
|
+
return {
|
|
140
|
+
schemaVersion: SWE_REBENCH_V2_VETTED_POOL_ARTIFACT_TYPE,
|
|
141
|
+
evalSemanticsVersion: raw['evalSemanticsVersion'],
|
|
142
|
+
generatedAt: raw['generatedAt'],
|
|
143
|
+
entries: entries.sort((a, b) => a.instance_id.localeCompare(b.instance_id)),
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
function normalizeVettedPoolArtifact(artifact) {
|
|
147
|
+
return {
|
|
148
|
+
schemaVersion: SWE_REBENCH_V2_VETTED_POOL_ARTIFACT_TYPE,
|
|
149
|
+
evalSemanticsVersion: artifact.evalSemanticsVersion,
|
|
150
|
+
generatedAt: artifact.generatedAt,
|
|
151
|
+
entries: [...artifact.entries]
|
|
152
|
+
.map((entry) => ({ ...entry, scorable: true }))
|
|
153
|
+
.sort((a, b) => a.instance_id.localeCompare(b.instance_id)),
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
export function hashVettedPoolArtifact(artifact) {
|
|
157
|
+
const canonical = canonicalJson(normalizeVettedPoolArtifact(artifact));
|
|
158
|
+
return `sha256:${createHash('sha256').update(canonical).digest('hex')}`;
|
|
159
|
+
}
|
|
160
|
+
export function loadVettedPoolArtifactScorableEntries(raw) {
|
|
161
|
+
const artifact = parseVettedPoolArtifact(raw);
|
|
162
|
+
const byId = new Map();
|
|
163
|
+
for (const entry of artifact.entries) {
|
|
164
|
+
byId.set(entry.instance_id, entry);
|
|
165
|
+
}
|
|
166
|
+
return { ids: new Set(byId.keys()), byId };
|
|
167
|
+
}
|
|
168
|
+
export function createVettedPoolArtifactRef(args) {
|
|
169
|
+
return {
|
|
170
|
+
schemaVersion: SOLVERNET_ARTIFACT_REF_SCHEMA_VERSION,
|
|
171
|
+
manifestCid: args.manifestCid,
|
|
172
|
+
artifactType: SWE_REBENCH_V2_VETTED_POOL_ARTIFACT_TYPE,
|
|
173
|
+
artifactCid: args.artifactCid,
|
|
174
|
+
artifactHash: args.artifactHash,
|
|
175
|
+
evalSemanticsVersion: args.evalSemanticsVersion,
|
|
176
|
+
publishedAt: args.publishedAt,
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
export function sweRebenchV2VettedPoolArtifactMetadataKey(manifestCid) {
|
|
180
|
+
return `solvernet-artifact:${manifestCid}:swe-rebench-v2-vetted-pool`;
|
|
181
|
+
}
|
|
182
|
+
export function parseVettedPoolArtifactRef(raw) {
|
|
183
|
+
if (!isObject(raw))
|
|
184
|
+
throw new Error('vetted pool artifact ref must be an object');
|
|
185
|
+
if (raw['schemaVersion'] !== SOLVERNET_ARTIFACT_REF_SCHEMA_VERSION) {
|
|
186
|
+
throw new Error(`vetted pool artifact ref schemaVersion must be ${SOLVERNET_ARTIFACT_REF_SCHEMA_VERSION}`);
|
|
187
|
+
}
|
|
188
|
+
if (raw['artifactType'] !== SWE_REBENCH_V2_VETTED_POOL_ARTIFACT_TYPE) {
|
|
189
|
+
throw new Error(`vetted pool artifact ref artifactType must be ${SWE_REBENCH_V2_VETTED_POOL_ARTIFACT_TYPE}`);
|
|
190
|
+
}
|
|
191
|
+
if (typeof raw['manifestCid'] !== 'string' || raw['manifestCid'].length === 0) {
|
|
192
|
+
throw new Error('vetted pool artifact ref manifestCid must be a string');
|
|
193
|
+
}
|
|
194
|
+
if (typeof raw['artifactCid'] !== 'string' || raw['artifactCid'].length === 0) {
|
|
195
|
+
throw new Error('vetted pool artifact ref artifactCid must be a string');
|
|
196
|
+
}
|
|
197
|
+
if (!isSha256(raw['artifactHash'])) {
|
|
198
|
+
throw new Error('vetted pool artifact ref artifactHash must be sha256:<64 hex>');
|
|
199
|
+
}
|
|
200
|
+
if (typeof raw['evalSemanticsVersion'] !== 'string') {
|
|
201
|
+
throw new Error('vetted pool artifact ref evalSemanticsVersion must be a string');
|
|
202
|
+
}
|
|
203
|
+
if (typeof raw['publishedAt'] !== 'string') {
|
|
204
|
+
throw new Error('vetted pool artifact ref publishedAt must be a string');
|
|
205
|
+
}
|
|
206
|
+
return {
|
|
207
|
+
schemaVersion: SOLVERNET_ARTIFACT_REF_SCHEMA_VERSION,
|
|
208
|
+
manifestCid: raw['manifestCid'],
|
|
209
|
+
artifactType: SWE_REBENCH_V2_VETTED_POOL_ARTIFACT_TYPE,
|
|
210
|
+
artifactCid: raw['artifactCid'],
|
|
211
|
+
artifactHash: raw['artifactHash'],
|
|
212
|
+
evalSemanticsVersion: raw['evalSemanticsVersion'],
|
|
213
|
+
publishedAt: raw['publishedAt'],
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
export function vettedPoolArtifactRefFromEligibility(eligibility) {
|
|
217
|
+
const raw = eligibility?.[VETTED_POOL_REF_ELIGIBILITY_KEY];
|
|
218
|
+
if (raw === undefined)
|
|
219
|
+
return null;
|
|
220
|
+
return parseVettedPoolArtifactRef(raw);
|
|
221
|
+
}
|
|
70
222
|
export class ValidatedPoolStore {
|
|
71
223
|
file;
|
|
72
224
|
cache = null;
|
|
@@ -93,17 +245,7 @@ export class ValidatedPoolStore {
|
|
|
93
245
|
return this.cache;
|
|
94
246
|
}
|
|
95
247
|
async writeAtomic(file) {
|
|
96
|
-
await
|
|
97
|
-
const tmp = `${this.file}.${randomBytes(6).toString('hex')}.tmp`;
|
|
98
|
-
await writeFile(tmp, JSON.stringify(file, null, 2));
|
|
99
|
-
try {
|
|
100
|
-
await rename(tmp, this.file); // POSIX rename is atomic
|
|
101
|
-
}
|
|
102
|
-
catch (err) {
|
|
103
|
-
// Best-effort tempfile cleanup — don't mask the original error.
|
|
104
|
-
await unlink(tmp).catch(() => undefined);
|
|
105
|
-
throw err;
|
|
106
|
-
}
|
|
248
|
+
await writeJsonAtomic(this.file, file);
|
|
107
249
|
}
|
|
108
250
|
/** The set of instance ids known scorable for `evalSemanticsVersion`, or
|
|
109
251
|
* `null` if there is no validation data for this semantics version (the
|
|
@@ -122,6 +264,15 @@ export class ValidatedPoolStore {
|
|
|
122
264
|
this.scorableIdsCache = { mtimeMs, semanticsVersion: evalSemanticsVersion, ids };
|
|
123
265
|
return ids;
|
|
124
266
|
}
|
|
267
|
+
async getScorableEntries(evalSemanticsVersion) {
|
|
268
|
+
const raw = await this.readRaw();
|
|
269
|
+
if (!isValidFile(raw, evalSemanticsVersion))
|
|
270
|
+
return null;
|
|
271
|
+
return {
|
|
272
|
+
updatedAt: raw.updatedAt,
|
|
273
|
+
entries: Object.fromEntries(Object.entries(raw.entries).filter(([, entry]) => entry.scorable)),
|
|
274
|
+
};
|
|
275
|
+
}
|
|
125
276
|
/** The entry for `instanceId`, or `null` if not validated for this semantics version. */
|
|
126
277
|
async getEntry(instanceId, evalSemanticsVersion) {
|
|
127
278
|
const f = await this.loadForWrite(evalSemanticsVersion);
|
|
@@ -142,6 +293,80 @@ export class ValidatedPoolStore {
|
|
|
142
293
|
});
|
|
143
294
|
}
|
|
144
295
|
}
|
|
296
|
+
export async function exportScorableVettedPoolArtifact(store, evalSemanticsVersion, opts = {}) {
|
|
297
|
+
const scorable = await store.getScorableEntries(evalSemanticsVersion);
|
|
298
|
+
if (!scorable)
|
|
299
|
+
return null;
|
|
300
|
+
const entries = Object.entries(scorable.entries)
|
|
301
|
+
.map(([instance_id, entry]) => ({
|
|
302
|
+
instance_id,
|
|
303
|
+
scorable: true,
|
|
304
|
+
reason: entry.reason,
|
|
305
|
+
checkedAt: entry.checkedAt,
|
|
306
|
+
...(entry.rowHash ? { rowHash: entry.rowHash } : {}),
|
|
307
|
+
...(entry.imageName ? { imageName: entry.imageName } : {}),
|
|
308
|
+
...(entry.imageDigest ? { imageDigest: entry.imageDigest } : {}),
|
|
309
|
+
...(entry.upstreamEvalCommit ? { upstreamEvalCommit: entry.upstreamEvalCommit } : {}),
|
|
310
|
+
}))
|
|
311
|
+
.sort((a, b) => a.instance_id.localeCompare(b.instance_id));
|
|
312
|
+
return {
|
|
313
|
+
schemaVersion: SWE_REBENCH_V2_VETTED_POOL_ARTIFACT_TYPE,
|
|
314
|
+
evalSemanticsVersion,
|
|
315
|
+
generatedAt: opts.generatedAt ?? scorable.updatedAt,
|
|
316
|
+
entries,
|
|
317
|
+
};
|
|
318
|
+
}
|
|
319
|
+
function parsePublication(raw) {
|
|
320
|
+
if (!isObject(raw) || raw['schemaVersion'] !== PUBLICATION_SCHEMA_VERSION) {
|
|
321
|
+
throw new Error(`vetted pool publication schemaVersion must be ${PUBLICATION_SCHEMA_VERSION}`);
|
|
322
|
+
}
|
|
323
|
+
if (typeof raw['updatedAt'] !== 'string') {
|
|
324
|
+
throw new Error('vetted pool publication updatedAt must be a string');
|
|
325
|
+
}
|
|
326
|
+
const ref = parseVettedPoolArtifactRef(raw['ref']);
|
|
327
|
+
const artifact = parseVettedPoolArtifact(raw['artifact']);
|
|
328
|
+
const actualHash = hashVettedPoolArtifact(artifact);
|
|
329
|
+
if (actualHash !== ref.artifactHash) {
|
|
330
|
+
throw new Error(`vetted pool publication hash mismatch: ref=${ref.artifactHash} artifact=${actualHash}`);
|
|
331
|
+
}
|
|
332
|
+
return {
|
|
333
|
+
schemaVersion: PUBLICATION_SCHEMA_VERSION,
|
|
334
|
+
updatedAt: raw['updatedAt'],
|
|
335
|
+
ref,
|
|
336
|
+
artifact,
|
|
337
|
+
};
|
|
338
|
+
}
|
|
339
|
+
export async function readVettedPoolArtifactPublication(args) {
|
|
340
|
+
let raw;
|
|
341
|
+
try {
|
|
342
|
+
raw = JSON.parse(await readFile(publicationPath(args.stateDir), 'utf8'));
|
|
343
|
+
}
|
|
344
|
+
catch {
|
|
345
|
+
return null;
|
|
346
|
+
}
|
|
347
|
+
const publication = parsePublication(raw);
|
|
348
|
+
if (args.manifestCid !== undefined && publication.ref.manifestCid !== args.manifestCid)
|
|
349
|
+
return null;
|
|
350
|
+
if (args.evalSemanticsVersion !== undefined && publication.ref.evalSemanticsVersion !== args.evalSemanticsVersion)
|
|
351
|
+
return null;
|
|
352
|
+
return publication;
|
|
353
|
+
}
|
|
354
|
+
export async function writeVettedPoolArtifactPublication(args) {
|
|
355
|
+
const artifact = parseVettedPoolArtifact(args.artifact);
|
|
356
|
+
const ref = parseVettedPoolArtifactRef(args.ref);
|
|
357
|
+
const artifactHash = hashVettedPoolArtifact(artifact);
|
|
358
|
+
if (artifactHash !== ref.artifactHash) {
|
|
359
|
+
throw new Error(`vetted pool publication hash mismatch: ref=${ref.artifactHash} artifact=${artifactHash}`);
|
|
360
|
+
}
|
|
361
|
+
const publication = {
|
|
362
|
+
schemaVersion: PUBLICATION_SCHEMA_VERSION,
|
|
363
|
+
updatedAt: args.updatedAt ?? new Date().toISOString(),
|
|
364
|
+
ref,
|
|
365
|
+
artifact,
|
|
366
|
+
};
|
|
367
|
+
await writeJsonAtomic(publicationPath(args.stateDir), publication);
|
|
368
|
+
return publication;
|
|
369
|
+
}
|
|
145
370
|
/**
|
|
146
371
|
* Restrict the generator's posting pool.
|
|
147
372
|
*
|
|
@@ -182,15 +407,6 @@ function looksPython(patch) {
|
|
|
182
407
|
// Match `--- a/<p>` / `+++ b/<p>` / `diff --git a/<p>` ending in .py
|
|
183
408
|
return /(?:^|\n)(?:---|\+\+\+|diff --git) [ab]\/\S+\.py(?:\s|$)/.test(patch);
|
|
184
409
|
}
|
|
185
|
-
const defaultCommandRunner = (bin, args, opts) => new Promise((resolve, reject) => {
|
|
186
|
-
const child = spawn(bin, args, { ...(opts ?? {}), stdio: ['ignore', 'pipe', 'pipe'] });
|
|
187
|
-
let stdout = '';
|
|
188
|
-
let stderr = '';
|
|
189
|
-
child.stdout?.on('data', (d) => { stdout += d.toString(); });
|
|
190
|
-
child.stderr?.on('data', (d) => { stderr += d.toString(); });
|
|
191
|
-
child.on('error', reject);
|
|
192
|
-
child.on('close', (code) => resolve({ exitCode: code ?? 1, stdout, stderr }));
|
|
193
|
-
});
|
|
194
410
|
function nameOf(err) {
|
|
195
411
|
return typeof err === 'object' && err !== null && typeof err.name === 'string'
|
|
196
412
|
? err.name : '';
|
|
@@ -268,9 +484,10 @@ export async function validatePoolInstances(pool, deps, opts = {}) {
|
|
|
268
484
|
pass_to_pass: row.PASS_TO_PASS,
|
|
269
485
|
});
|
|
270
486
|
const checkedAt = new Date().toISOString();
|
|
271
|
-
//
|
|
272
|
-
//
|
|
273
|
-
|
|
487
|
+
// Prefer the digest captured by a real runner before per-round pruning.
|
|
488
|
+
// Test runners that do not carry it still use the legacy post-eval
|
|
489
|
+
// Docker inspect fallback.
|
|
490
|
+
const imageDigest = res.imageDigest ?? await resolveImageDigest(row.image_name, runner);
|
|
274
491
|
const substrate = {
|
|
275
492
|
checkedAt,
|
|
276
493
|
rowHash,
|