@jinn-network/client 0.1.7 → 0.1.8-canary.0a152013
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/README.md +67 -1
- package/dist/adapters/mech/adapter.d.ts +19 -1
- package/dist/adapters/mech/adapter.js +130 -14
- package/dist/adapters/mech/adapter.js.map +1 -1
- package/dist/adapters/mech/contracts.d.ts +22 -1
- package/dist/adapters/mech/contracts.js +34 -24
- package/dist/adapters/mech/contracts.js.map +1 -1
- package/dist/adapters/mech/safe.d.ts +1 -1
- package/dist/adapters/mech/safe.js +5 -3
- package/dist/adapters/mech/safe.js.map +1 -1
- package/dist/adapters/mech/types.d.ts +6 -1
- package/dist/adapters/mech/types.js.map +1 -1
- package/dist/agent/operator-claude.js +8 -0
- package/dist/agent/operator-claude.js.map +1 -1
- package/dist/api/activity-events-endpoint.d.ts +14 -0
- package/dist/api/activity-events-endpoint.js +59 -0
- package/dist/api/activity-events-endpoint.js.map +1 -0
- package/dist/api/bootstrap-endpoint.d.ts +1 -2
- package/dist/api/bootstrap-endpoint.js +42 -24
- package/dist/api/bootstrap-endpoint.js.map +1 -1
- package/dist/api/codex-doctor-endpoint.d.ts +22 -5
- package/dist/api/codex-doctor-endpoint.js +136 -17
- package/dist/api/codex-doctor-endpoint.js.map +1 -1
- package/dist/api/debug-report-endpoint.d.ts +27 -0
- package/dist/api/debug-report-endpoint.js +157 -0
- package/dist/api/debug-report-endpoint.js.map +1 -0
- package/dist/api/discovery-endpoint.d.ts +1 -0
- package/dist/api/discovery-endpoint.js +24 -0
- package/dist/api/discovery-endpoint.js.map +1 -1
- package/dist/api/gather-status.d.ts +33 -0
- package/dist/api/gather-status.js +211 -26
- package/dist/api/gather-status.js.map +1 -1
- package/dist/api/hermes-doctor-endpoint.d.ts +15 -7
- package/dist/api/hermes-doctor-endpoint.js +56 -19
- package/dist/api/hermes-doctor-endpoint.js.map +1 -1
- package/dist/api/launcher-status.d.ts +4 -2
- package/dist/api/launcher-status.js +11 -10
- package/dist/api/launcher-status.js.map +1 -1
- package/dist/api/launcher-tasks.d.ts +1 -1
- package/dist/api/launcher-tasks.js +12 -8
- package/dist/api/launcher-tasks.js.map +1 -1
- package/dist/api/operator-artifacts-endpoint.js +73 -6
- package/dist/api/operator-artifacts-endpoint.js.map +1 -1
- package/dist/api/portfolio-v0-build.d.ts +7 -1
- package/dist/api/portfolio-v0-build.js +6 -2
- package/dist/api/portfolio-v0-build.js.map +1 -1
- package/dist/api/prediction-v1-build.d.ts +6 -0
- package/dist/api/prediction-v1-build.js +3 -1
- package/dist/api/prediction-v1-build.js.map +1 -1
- package/dist/api/server.d.ts +17 -0
- package/dist/api/server.js +40 -1
- package/dist/api/server.js.map +1 -1
- package/dist/api/setup-endpoints.d.ts +0 -9
- package/dist/api/setup-endpoints.js +11 -153
- package/dist/api/setup-endpoints.js.map +1 -1
- package/dist/api/solvernets-endpoints.js +30 -63
- package/dist/api/solvernets-endpoints.js.map +1 -1
- package/dist/api/status-build.d.ts +115 -2
- package/dist/api/status-build.js +47 -11
- package/dist/api/status-build.js.map +1 -1
- package/dist/api/status-harness-rollup.d.ts +35 -0
- package/dist/api/status-harness-rollup.js +45 -0
- package/dist/api/status-harness-rollup.js.map +1 -0
- package/dist/api/task-runs-build.d.ts +8 -0
- package/dist/api/task-runs-build.js +5 -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/captures/live-publisher.js +24 -4
- package/dist/captures/live-publisher.js.map +1 -1
- package/dist/captures/publish.d.ts +1 -1
- package/dist/chain-read-errors.d.ts +12 -0
- package/dist/chain-read-errors.js +26 -1
- package/dist/chain-read-errors.js.map +1 -1
- package/dist/cli/commands/codedigest-revert-check.d.ts +33 -0
- package/dist/cli/commands/codedigest-revert-check.js +249 -0
- package/dist/cli/commands/codedigest-revert-check.js.map +1 -0
- package/dist/cli/commands/eval.d.ts +76 -0
- package/dist/cli/commands/eval.js +391 -0
- package/dist/cli/commands/eval.js.map +1 -0
- package/dist/cli/commands/solver-nets.d.ts +1 -0
- package/dist/cli/commands/solver-nets.js +177 -22
- package/dist/cli/commands/solver-nets.js.map +1 -1
- package/dist/cli/commands/solver-plugins-block.d.ts +33 -0
- package/dist/cli/commands/solver-plugins-block.js +118 -0
- package/dist/cli/commands/solver-plugins-block.js.map +1 -0
- package/dist/cli/commands/solver-plugins-feedback.d.ts +72 -0
- package/dist/cli/commands/solver-plugins-feedback.js +262 -0
- package/dist/cli/commands/solver-plugins-feedback.js.map +1 -0
- package/dist/cli/commands/solver-plugins-read.d.ts +54 -0
- package/dist/cli/commands/solver-plugins-read.js +259 -0
- package/dist/cli/commands/solver-plugins-read.js.map +1 -0
- package/dist/cli/commands/solver-plugins.d.ts +35 -0
- package/dist/cli/commands/solver-plugins.js +399 -2
- package/dist/cli/commands/solver-plugins.js.map +1 -1
- package/dist/cli/commands/tasks.js +15 -2
- package/dist/cli/commands/tasks.js.map +1 -1
- package/dist/cli/index.js +4 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/task-native-readiness.d.ts +7 -0
- package/dist/cli/task-native-readiness.js +7 -5
- package/dist/cli/task-native-readiness.js.map +1 -1
- package/dist/config.d.ts +199 -232
- package/dist/config.js +268 -107
- package/dist/config.js.map +1 -1
- package/dist/daemon/ai-units-gate.d.ts +54 -0
- package/dist/daemon/ai-units-gate.js +82 -0
- package/dist/daemon/ai-units-gate.js.map +1 -0
- package/dist/daemon/creator.js +13 -0
- package/dist/daemon/creator.js.map +1 -1
- package/dist/daemon/daemon.d.ts +10 -0
- package/dist/daemon/daemon.js +203 -30
- package/dist/daemon/daemon.js.map +1 -1
- package/dist/daemon/eviction-loop.d.ts +7 -0
- package/dist/daemon/eviction-loop.js +16 -0
- package/dist/daemon/eviction-loop.js.map +1 -1
- package/dist/daemon/gate-logger.d.ts +9 -0
- package/dist/daemon/gate-logger.js +2 -0
- package/dist/daemon/gate-logger.js.map +1 -0
- package/dist/daemon/jinn-claim-loop.js +22 -4
- package/dist/daemon/jinn-claim-loop.js.map +1 -1
- package/dist/daemon/readiness-gate.d.ts +1 -4
- package/dist/daemon/readiness-gate.js.map +1 -1
- package/dist/daemon/spend-cap-gate.d.ts +40 -0
- package/dist/daemon/spend-cap-gate.js +46 -0
- package/dist/daemon/spend-cap-gate.js.map +1 -0
- package/dist/dashboard/assets/index-CldYENtT.js +359 -0
- package/dist/dashboard/assets/index-CzKxvMcU.css +32 -0
- package/dist/dashboard/index.html +2 -2
- package/dist/discovery/http.js +411 -2
- package/dist/discovery/http.js.map +1 -1
- package/dist/discovery/onchain.js +123 -5
- package/dist/discovery/onchain.js.map +1 -1
- package/dist/discovery/types.d.ts +202 -0
- package/dist/discovery/types.js +40 -0
- package/dist/discovery/types.js.map +1 -1
- package/dist/discovery/with-fallback.js +34 -0
- package/dist/discovery/with-fallback.js.map +1 -1
- package/dist/earning/bootstrap.d.ts +25 -3
- package/dist/earning/bootstrap.js +69 -15
- package/dist/earning/bootstrap.js.map +1 -1
- package/dist/earning/safe-adapter.js +34 -11
- package/dist/earning/safe-adapter.js.map +1 -1
- package/dist/earning/types.d.ts +6 -6
- package/dist/earning/viem-clients.d.ts +11 -4
- package/dist/earning/viem-clients.js +14 -5
- package/dist/earning/viem-clients.js.map +1 -1
- package/dist/erc8004/identity.d.ts +19 -3
- package/dist/erc8004/identity.js +38 -11
- package/dist/erc8004/identity.js.map +1 -1
- package/dist/erc8004/index.d.ts +1 -1
- package/dist/erc8004/index.js.map +1 -1
- package/dist/eval/eval-harness-run.d.ts +63 -0
- package/dist/eval/eval-harness-run.js +123 -0
- package/dist/eval/eval-harness-run.js.map +1 -0
- package/dist/eval/orchestrator.d.ts +146 -0
- package/dist/eval/orchestrator.js +221 -0
- package/dist/eval/orchestrator.js.map +1 -0
- package/dist/eval/resolve-slate-tasks.d.ts +35 -0
- package/dist/eval/resolve-slate-tasks.js +56 -0
- package/dist/eval/resolve-slate-tasks.js.map +1 -0
- package/dist/eval/slope.d.ts +29 -0
- package/dist/eval/slope.js +46 -0
- package/dist/eval/slope.js.map +1 -0
- package/dist/eval/train-sequence.d.ts +35 -0
- package/dist/eval/train-sequence.js +59 -0
- package/dist/eval/train-sequence.js.map +1 -0
- package/dist/eval/wilson.d.ts +45 -0
- package/dist/eval/wilson.js +48 -0
- package/dist/eval/wilson.js.map +1 -0
- package/dist/events/types.d.ts +2 -2
- package/dist/harnesses/cost-estimates.d.ts +10 -31
- package/dist/harnesses/cost-estimates.js +11 -43
- package/dist/harnesses/cost-estimates.js.map +1 -1
- package/dist/harnesses/engine/canonical-json.js +5 -3
- package/dist/harnesses/engine/canonical-json.js.map +1 -1
- package/dist/harnesses/engine/engine.d.ts +37 -4
- package/dist/harnesses/engine/engine.js +138 -17
- package/dist/harnesses/engine/engine.js.map +1 -1
- package/dist/harnesses/engine/persistence.d.ts +21 -4
- package/dist/harnesses/engine/persistence.js +43 -6
- package/dist/harnesses/engine/persistence.js.map +1 -1
- package/dist/harnesses/engine/state.d.ts +9 -0
- package/dist/harnesses/engine/state.js +23 -10
- package/dist/harnesses/engine/state.js.map +1 -1
- package/dist/harnesses/impls/hermes-agent/bootstrap.js +4 -2
- package/dist/harnesses/impls/hermes-agent/bootstrap.js.map +1 -1
- package/dist/harnesses/impls/hermes-agent/config-builder.d.ts +1 -1
- package/dist/harnesses/impls/hermes-agent/config-builder.js +4 -2
- package/dist/harnesses/impls/hermes-agent/config-builder.js.map +1 -1
- package/dist/harnesses/impls/hermes-agent/harness.d.ts +14 -0
- package/dist/harnesses/impls/hermes-agent/harness.js +16 -2
- package/dist/harnesses/impls/hermes-agent/harness.js.map +1 -1
- package/dist/harnesses/impls/hermes-agent/prompt.d.ts +6 -6
- package/dist/harnesses/impls/hermes-agent/prompt.js +6 -6
- package/dist/harnesses/impls/learner/adapters/claude-code.d.ts +17 -0
- package/dist/harnesses/impls/learner/adapters/claude-code.js +113 -14
- package/dist/harnesses/impls/learner/adapters/claude-code.js.map +1 -1
- package/dist/harnesses/impls/learner/adapters/codex-code.d.ts +9 -0
- package/dist/harnesses/impls/learner/adapters/codex-code.js +30 -8
- package/dist/harnesses/impls/learner/adapters/codex-code.js.map +1 -1
- package/dist/harnesses/impls/learner/harness.d.ts +24 -0
- package/dist/harnesses/impls/learner/harness.js +33 -4
- package/dist/harnesses/impls/learner/harness.js.map +1 -1
- package/dist/harnesses/impls/learner/harvest.d.ts +3 -1
- package/dist/harnesses/impls/learner/harvest.js +30 -6
- package/dist/harnesses/impls/learner/harvest.js.map +1 -1
- package/dist/harnesses/impls/learner/restoration-patch.d.ts +2 -2
- package/dist/harnesses/impls/learner/restoration-patch.js +25 -6
- package/dist/harnesses/impls/learner/restoration-patch.js.map +1 -1
- package/dist/harnesses/impls/swe-rebench-v2-evaluator/eval-runner.js +21 -1
- package/dist/harnesses/impls/swe-rebench-v2-evaluator/eval-runner.js.map +1 -1
- package/dist/harnesses/impls/swe-rebench-v2-evaluator/hf-fetcher.d.ts +74 -5
- package/dist/harnesses/impls/swe-rebench-v2-evaluator/hf-fetcher.js +103 -32
- package/dist/harnesses/impls/swe-rebench-v2-evaluator/hf-fetcher.js.map +1 -1
- package/dist/harnesses/readiness-registry.d.ts +7 -0
- package/dist/harnesses/readiness-registry.js +9 -0
- package/dist/harnesses/readiness-registry.js.map +1 -1
- package/dist/learner/revert-decision.d.ts +59 -0
- package/dist/learner/revert-decision.js +53 -0
- package/dist/learner/revert-decision.js.map +1 -0
- package/dist/learner/revert-stats.d.ts +24 -0
- package/dist/learner/revert-stats.js +44 -0
- package/dist/learner/revert-stats.js.map +1 -0
- package/dist/main.js +178 -104
- package/dist/main.js.map +1 -1
- package/dist/mcp/get-codedigest-reward.d.ts +13 -0
- package/dist/mcp/get-codedigest-reward.js +23 -0
- package/dist/mcp/get-codedigest-reward.js.map +1 -0
- package/dist/mcp/server.js +23 -0
- package/dist/mcp/server.js.map +1 -1
- package/dist/observability/debug-report-assemble.d.ts +43 -0
- package/dist/observability/debug-report-assemble.js +80 -0
- package/dist/observability/debug-report-assemble.js.map +1 -0
- package/dist/observability/emit-event.d.ts +9 -2
- package/dist/observability/emit-event.js +36 -2
- package/dist/observability/emit-event.js.map +1 -1
- package/dist/observability/file-logger.d.ts +69 -0
- package/dist/observability/file-logger.js +177 -0
- package/dist/observability/file-logger.js.map +1 -0
- package/dist/observability/redact-secrets.d.ts +65 -0
- package/dist/observability/redact-secrets.js +300 -0
- package/dist/observability/redact-secrets.js.map +1 -0
- package/dist/observability/tar.d.ts +30 -0
- package/dist/observability/tar.js +102 -0
- package/dist/observability/tar.js.map +1 -0
- package/dist/plugins/learner/hooks/session-start +18 -1
- package/dist/plugins/learner/skills/learn/consolidator-prompt.md +18 -1
- package/dist/plugins/learner/skills/learn/promoter-prompt.md +72 -1
- package/dist/preflight/pidfile-liveness.d.ts +50 -0
- package/dist/preflight/pidfile-liveness.js +117 -0
- package/dist/preflight/pidfile-liveness.js.map +1 -0
- package/dist/preflight/rpc-network.d.ts +40 -0
- package/dist/preflight/rpc-network.js +67 -1
- package/dist/preflight/rpc-network.js.map +1 -1
- package/dist/rpc/transport.d.ts +109 -0
- package/dist/rpc/transport.js +220 -0
- package/dist/rpc/transport.js.map +1 -0
- package/dist/scripts/donation-consumption-acceptance.js +7 -28
- package/dist/scripts/donation-consumption-acceptance.js.map +1 -1
- package/dist/scripts/swe-rebench-v2-pytest-missing.json +16 -0
- package/dist/solver-nets/prediction-operator-ux.d.ts +1 -2
- package/dist/solver-nets/prediction-operator-ux.js +56 -53
- package/dist/solver-nets/prediction-operator-ux.js.map +1 -1
- package/dist/solver-nets/registry.d.ts +19 -1
- package/dist/solver-nets/registry.js +37 -24
- package/dist/solver-nets/registry.js.map +1 -1
- package/dist/solver-types/_swe-rebench-v2-held-out-slate.d.ts +64 -0
- package/dist/solver-types/_swe-rebench-v2-held-out-slate.js +139 -0
- package/dist/solver-types/_swe-rebench-v2-held-out-slate.js.map +1 -0
- package/dist/solver-types/_swe-rebench-v2-pool.d.ts +9 -2
- package/dist/solver-types/_swe-rebench-v2-pool.js +15 -20
- package/dist/solver-types/_swe-rebench-v2-pool.js.map +1 -1
- package/dist/solver-types/_swe-rebench-v2-state.d.ts +15 -0
- package/dist/solver-types/_swe-rebench-v2-state.js +19 -0
- package/dist/solver-types/_swe-rebench-v2-state.js.map +1 -1
- package/dist/solver-types/_swe-rebench-v2-validated-pool.d.ts +116 -2
- package/dist/solver-types/_swe-rebench-v2-validated-pool.js +296 -21
- package/dist/solver-types/_swe-rebench-v2-validated-pool.js.map +1 -1
- package/dist/solver-types/slates/held-out-slate.swe-rebench-v2.v1.json +20 -0
- package/dist/solver-types/solver-type.d.ts +8 -0
- package/dist/solver-types/swe-rebench-v2-auto.d.ts +20 -11
- package/dist/solver-types/swe-rebench-v2-auto.js +64 -19
- package/dist/solver-types/swe-rebench-v2-auto.js.map +1 -1
- package/dist/solver-types/swe-rebench-v2.d.ts +8 -2
- package/dist/solver-types/swe-rebench-v2.js +151 -12
- package/dist/solver-types/swe-rebench-v2.js.map +1 -1
- package/dist/solvernets/daemon-init.d.ts +1 -1
- package/dist/solvernets/daemon-init.js +19 -4
- package/dist/solvernets/daemon-init.js.map +1 -1
- package/dist/solvernets/launched-record-dispatcher.d.ts +4 -0
- package/dist/solvernets/launched-record-dispatcher.js +10 -4
- package/dist/solvernets/launched-record-dispatcher.js.map +1 -1
- package/dist/solvernets/registry-client-erc8004.js +11 -0
- package/dist/solvernets/registry-client-erc8004.js.map +1 -1
- package/dist/solvernets/store.d.ts +2 -2
- package/dist/solvernets/store.js +7 -2
- package/dist/solvernets/store.js.map +1 -1
- package/dist/spend/ai-units-config.d.ts +39 -0
- package/dist/spend/ai-units-config.js +28 -0
- package/dist/spend/ai-units-config.js.map +1 -0
- package/dist/spend/ai-units.d.ts +89 -0
- package/dist/spend/ai-units.js +156 -0
- package/dist/spend/ai-units.js.map +1 -0
- package/dist/spend/cost-surface-status.d.ts +12 -0
- package/dist/spend/cost-surface-status.js +24 -0
- package/dist/spend/cost-surface-status.js.map +1 -0
- package/dist/spend/credential.d.ts +39 -0
- package/dist/spend/credential.js +71 -0
- package/dist/spend/credential.js.map +1 -0
- package/dist/spend/daemon-config.d.ts +13 -0
- package/dist/spend/daemon-config.js +24 -0
- package/dist/spend/daemon-config.js.map +1 -0
- package/dist/spend/pricing.d.ts +16 -0
- package/dist/spend/pricing.js +26 -0
- package/dist/spend/pricing.js.map +1 -0
- package/dist/spend/record.d.ts +13 -0
- package/dist/spend/record.js +36 -0
- package/dist/spend/record.js.map +1 -0
- package/dist/spend/usage.d.ts +27 -0
- package/dist/spend/usage.js +113 -0
- package/dist/spend/usage.js.map +1 -0
- package/dist/store/store.d.ts +144 -0
- package/dist/store/store.js +396 -4
- package/dist/store/store.js.map +1 -1
- package/dist/trajectory/transcript-parsers/codex-session.d.ts +12 -6
- package/dist/trajectory/transcript-parsers/codex-session.js +114 -13
- package/dist/trajectory/transcript-parsers/codex-session.js.map +1 -1
- package/dist/trajectory/transcript-parsers/types.d.ts +8 -8
- package/dist/trajectory/transcript-session-dirs.d.ts +18 -0
- package/dist/trajectory/transcript-session-dirs.js +85 -0
- package/dist/trajectory/transcript-session-dirs.js.map +1 -0
- package/dist/trajectory/transcript-watcher.d.ts +20 -1
- package/dist/trajectory/transcript-watcher.js +108 -32
- package/dist/trajectory/transcript-watcher.js.map +1 -1
- package/dist/tx-retry.d.ts +25 -0
- package/dist/tx-retry.js +95 -7
- package/dist/tx-retry.js.map +1 -1
- package/dist/types/payloads/portfolio-v0.d.ts +3 -3
- package/dist/types/payloads/prediction-apy-v0.d.ts +3 -3
- package/dist/types/payloads/prediction-v0.d.ts +12 -12
- package/dist/vendor/@jinn-network/sdk/dist/solvernets/swe-rebench-v2-held-out-slate.d.ts +65 -0
- package/dist/vendor/@jinn-network/sdk/dist/solvernets/swe-rebench-v2-held-out-slate.js +123 -0
- package/dist/vendor/@jinn-network/sdk/package.json +4 -0
- package/package.json +21 -12
- package/plugins/learner/hooks/session-start +18 -1
- package/plugins/learner/skills/learn/consolidator-prompt.md +18 -1
- package/plugins/learner/skills/learn/promoter-prompt.md +72 -1
- package/plugins/swe-rebench-v2-diffmin/README.md +10 -9
- package/plugins/swe-rebench-v2-diffmin/jinn.plugin.json +1 -1
- package/plugins/swe-rebench-v2-diffmin/skills/diffmin/SKILL.md +15 -10
- package/plugins/swe-rebench-v2-diffmin/skills/test-map/SKILL.md +10 -12
- package/plugins/swe-rebench-v2-runtime/.claude-plugin/plugin.json +1 -1
- package/plugins/swe-rebench-v2-runtime/.codex-plugin/plugin.json +3 -3
- package/plugins/swe-rebench-v2-runtime/README.md +6 -6
- package/plugins/swe-rebench-v2-runtime/jinn.plugin.json +2 -3
- package/plugins/swe-rebench-v2-runtime/skills/task/SKILL.md +81 -0
- package/dist/dashboard/assets/index-BUlE8F3Y.js +0 -330
- package/dist/dashboard/assets/index-blqc7eqq.css +0 -32
- package/plugins/swe-rebench-v2-runtime/skills/orient/SKILL.md +0 -29
- package/plugins/swe-rebench-v2-runtime/skills/plan/SKILL.md +0 -53
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `jinn eval` held-out checkpoint orchestrator (issue #818).
|
|
3
|
+
*
|
|
4
|
+
* Runs a held-out slate against a checkpoint in FROZEN mode, persists per-task
|
|
5
|
+
* pass/fail, and emits a Wilson-CI resolved-rate comparison vs the parent
|
|
6
|
+
* checkpoint. Every external boundary is constructor-injected — this is the
|
|
7
|
+
* thin slice #819 drives a deterministic slate against with NO Docker/IPFS.
|
|
8
|
+
*
|
|
9
|
+
* Acceptance criteria:
|
|
10
|
+
* AC#1 — run the slate frozen, write per-task pass/fail.
|
|
11
|
+
* AC#2 — emit a resolved-rate comparison vs the parent with a CI.
|
|
12
|
+
* AC#3 — the freeze-fence holds: a `runHarnessOnce` `{ violation }` throws
|
|
13
|
+
* LOUD and the instance is NOT recorded (no implStateDir mutation
|
|
14
|
+
* slips through; enforcement lives in `runHarnessWithFreezeFence`).
|
|
15
|
+
*
|
|
16
|
+
* Per log/decisions/2026-05-28-rl-eval-measurement.md §4: v1-simple. Only large
|
|
17
|
+
* deltas are trustworthy (disjoint Wilson intervals). No seed control, no
|
|
18
|
+
* multi-run averaging.
|
|
19
|
+
*/
|
|
20
|
+
import { compareRates } from './wilson.js';
|
|
21
|
+
/** Thrown when `runHarnessOnce` reports a freeze-fence violation (AC#3). */
|
|
22
|
+
export class FreezeFenceViolationError extends Error {
|
|
23
|
+
instanceId;
|
|
24
|
+
constructor(instanceId) {
|
|
25
|
+
super(`freeze-fence violation on instance ${instanceId}: the harness mutated implStateDir ` +
|
|
26
|
+
`during a frozen-mode eval run — refusing to record a tainted result`);
|
|
27
|
+
this.instanceId = instanceId;
|
|
28
|
+
this.name = 'FreezeFenceViolationError';
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Thrown when the locally-evaluated impl-state's codeDigest does not match the
|
|
33
|
+
* named checkpoint's manifest (C1). Guards against persisting + comparing
|
|
34
|
+
* results under a checkpoint name while the operator's local impl-state has
|
|
35
|
+
* drifted from that checkpoint.
|
|
36
|
+
*/
|
|
37
|
+
export class CheckpointStateMismatchError extends Error {
|
|
38
|
+
checkpointCid;
|
|
39
|
+
manifestCodeDigest;
|
|
40
|
+
evaluatedCodeDigest;
|
|
41
|
+
constructor(checkpointCid, manifestCodeDigest, evaluatedCodeDigest) {
|
|
42
|
+
super(`local impl-state does not match checkpoint ${checkpointCid}: ` +
|
|
43
|
+
`manifest codeDigest=${manifestCodeDigest} but the evaluated impl-state hashes to ` +
|
|
44
|
+
`${evaluatedCodeDigest}. Check out the impl-state for this checkpoint or pass the ` +
|
|
45
|
+
`correct --impl-state-dir; refusing to record results under a codeDigest that is a lie`);
|
|
46
|
+
this.checkpointCid = checkpointCid;
|
|
47
|
+
this.manifestCodeDigest = manifestCodeDigest;
|
|
48
|
+
this.evaluatedCodeDigest = evaluatedCodeDigest;
|
|
49
|
+
this.name = 'CheckpointStateMismatchError';
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
/** Thrown when the parent checkpoint has no aggregate for this slate version (AC#2). */
|
|
53
|
+
export class ParentNotEvaluatedError extends Error {
|
|
54
|
+
parentCheckpointCid;
|
|
55
|
+
slateVersion;
|
|
56
|
+
constructor(parentCheckpointCid, slateVersion) {
|
|
57
|
+
super(`parent checkpoint ${parentCheckpointCid} has no eval results for slate ${slateVersion} — ` +
|
|
58
|
+
`eval the parent checkpoint first (scores are only comparable within a slate version)`);
|
|
59
|
+
this.parentCheckpointCid = parentCheckpointCid;
|
|
60
|
+
this.slateVersion = slateVersion;
|
|
61
|
+
this.name = 'ParentNotEvaluatedError';
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Thrown when EITHER compared checkpoint was scored on a DIFFERENT slate
|
|
66
|
+
* *content* under the same version label (DR-2026-05-28 §2 — confounder control).
|
|
67
|
+
* A slate is content-addressed and scores are comparable ONLY within identical
|
|
68
|
+
* content; the store keys aggregates by version, so a content edit that skipped
|
|
69
|
+
* the version bump (or re-derived the declared hash — which the slate loader
|
|
70
|
+
* admits passes), or stale rows surviving `recordEvalResult`'s by-instance
|
|
71
|
+
* upsert, would let the comparison silently compare two checkpoints scored on
|
|
72
|
+
* different task sets. That is confounder #1 (task-selection) — exactly what the
|
|
73
|
+
* held-out exam exists to defeat — so we refuse the comparison loudly instead.
|
|
74
|
+
*/
|
|
75
|
+
export class SlateHashMismatchError extends Error {
|
|
76
|
+
slateVersion;
|
|
77
|
+
currentSlateHash;
|
|
78
|
+
drifted;
|
|
79
|
+
constructor(slateVersion, currentSlateHash, drifted) {
|
|
80
|
+
const detail = drifted
|
|
81
|
+
.map((d) => `${d.checkpointCid} carries [${d.hashes.join(', ')}]`)
|
|
82
|
+
.join('; ');
|
|
83
|
+
super(`a checkpoint was evaluated against a different slate content under the same version label ` +
|
|
84
|
+
`${slateVersion}: current slate hash is ${currentSlateHash} but ${detail}. Same version must ` +
|
|
85
|
+
`mean the same exam — a slate content change is a measurement discontinuity that must bump the ` +
|
|
86
|
+
`version. Bump the slate version and re-evaluate; refusing to report a delta across two ` +
|
|
87
|
+
`different task sets (confounder #1, task-selection)`);
|
|
88
|
+
this.slateVersion = slateVersion;
|
|
89
|
+
this.currentSlateHash = currentSlateHash;
|
|
90
|
+
this.drifted = drifted;
|
|
91
|
+
this.name = 'SlateHashMismatchError';
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
export async function runEval(args) {
|
|
95
|
+
const { deps, slate, checkpointCid, parentCheckpointCid } = args;
|
|
96
|
+
// Confounder guard (DR-2026-05-28 §2). The store keys aggregates by slate
|
|
97
|
+
// VERSION; if EITHER checkpoint has results recorded under a different slate
|
|
98
|
+
// CONTENT for that version — a content edit that skipped the version bump, or
|
|
99
|
+
// stale rows surviving recordEvalResult's by-instance upsert — comparing
|
|
100
|
+
// child-vs-parent reintroduces confounder #1 (task-selection: two scores over
|
|
101
|
+
// different task sets). Both arms' hashes are known up front, so detect drift
|
|
102
|
+
// in EITHER before the loop and refuse — never burn N× real spend producing a
|
|
103
|
+
// number we'd have to throw away.
|
|
104
|
+
const drifted = [parentCheckpointCid, checkpointCid]
|
|
105
|
+
.map((cid) => ({
|
|
106
|
+
checkpointCid: cid,
|
|
107
|
+
hashes: deps.store.getEvalSlateHashes(cid, slate.version).filter((hash) => hash !== slate.hash),
|
|
108
|
+
}))
|
|
109
|
+
.filter((arm) => arm.hashes.length > 0);
|
|
110
|
+
if (drifted.length > 0) {
|
|
111
|
+
throw new SlateHashMismatchError(slate.version, slate.hash, drifted);
|
|
112
|
+
}
|
|
113
|
+
// Hoist the impl-state-dir fetch outside the loop: every slate instance runs
|
|
114
|
+
// against the SAME checkpoint state.
|
|
115
|
+
const implStateDir = args.implStateDir ?? `/tmp/jinn-eval-${checkpointCid}`;
|
|
116
|
+
const localImplStateDir = await deps.fetchImplStateDirToLocal(args.checkpointManifest.implStateDirCid, implStateDir);
|
|
117
|
+
const perTask = [];
|
|
118
|
+
const runAtMs = Date.now();
|
|
119
|
+
let digestChecked = false;
|
|
120
|
+
// Real digest of the evaluated impl-state (from the freeze-fence), captured on
|
|
121
|
+
// the first run for provenance. Falls back to the manifest digest, which the
|
|
122
|
+
// C1 guard proves equal.
|
|
123
|
+
let evaluatedDigest = args.checkpointManifest.codeDigest;
|
|
124
|
+
for (const { task, row } of args.tasksWithRows) {
|
|
125
|
+
let passed;
|
|
126
|
+
let unscorable = false;
|
|
127
|
+
let logExcerpt = '';
|
|
128
|
+
try {
|
|
129
|
+
const run = await deps.runHarnessOnce({
|
|
130
|
+
harness: deps.harness,
|
|
131
|
+
implStateDir: localImplStateDir,
|
|
132
|
+
mode: 'frozen',
|
|
133
|
+
// Carry the full SweRebenchV2Task in `spec` + the `solverType` dispatch
|
|
134
|
+
// key so the harness can restore the repo (clone/checkout from
|
|
135
|
+
// spec.repo/base_commit). The harness emits a swe-rebench-v2 patch from
|
|
136
|
+
// spec; id/description/role alone are insufficient for a real run.
|
|
137
|
+
task: {
|
|
138
|
+
id: task.instance_id,
|
|
139
|
+
description: task.problem_statement,
|
|
140
|
+
role: 'restoration',
|
|
141
|
+
solverType: 'swe-rebench-v2.v1',
|
|
142
|
+
spec: task,
|
|
143
|
+
window: { startTs: 0, endTs: Date.now() + 3_600_000 },
|
|
144
|
+
},
|
|
145
|
+
});
|
|
146
|
+
// AC#3: a freeze violation is loud and terminal — do NOT record this
|
|
147
|
+
// instance (its implStateDir mutation taints the run). Thrown OUTSIDE the
|
|
148
|
+
// unscorable catch below so it propagates and aborts the whole eval.
|
|
149
|
+
if (run.violation) {
|
|
150
|
+
throw new FreezeFenceViolationError(task.instance_id);
|
|
151
|
+
}
|
|
152
|
+
if (!run.solution) {
|
|
153
|
+
throw new Error(`harness produced no solution for instance ${task.instance_id}`);
|
|
154
|
+
}
|
|
155
|
+
// C1: on the FIRST successful run, verify the real digest of the evaluated
|
|
156
|
+
// impl-state (computed by the freeze-fence) matches the named checkpoint's
|
|
157
|
+
// manifest. Fail fast — before grading any instance — to avoid Docker spend
|
|
158
|
+
// and to never persist a result under a codeDigest that is a lie.
|
|
159
|
+
if (!digestChecked) {
|
|
160
|
+
digestChecked = true;
|
|
161
|
+
const runDigest = run.envelope?.executor.codeDigest;
|
|
162
|
+
if (runDigest && runDigest !== args.checkpointManifest.codeDigest) {
|
|
163
|
+
throw new CheckpointStateMismatchError(checkpointCid, args.checkpointManifest.codeDigest, runDigest);
|
|
164
|
+
}
|
|
165
|
+
if (runDigest)
|
|
166
|
+
evaluatedDigest = runDigest;
|
|
167
|
+
}
|
|
168
|
+
const verdict = await deps.evaluator.grade({
|
|
169
|
+
task,
|
|
170
|
+
solutionPayload: { schemaVersion: 'swe-rebench-v2-solution.v1', patch: run.solution.patch },
|
|
171
|
+
row,
|
|
172
|
+
});
|
|
173
|
+
passed = verdict.passed_match;
|
|
174
|
+
logExcerpt = verdict.test_log.slice(0, 1000);
|
|
175
|
+
}
|
|
176
|
+
catch (err) {
|
|
177
|
+
// A freeze-fence violation taints the run and must stay a LOUD terminal
|
|
178
|
+
// abort (AC#3). Likewise the C1 digest mismatch — never record results
|
|
179
|
+
// under a codeDigest that is a lie. Both re-throw and abort the eval.
|
|
180
|
+
if (err instanceof FreezeFenceViolationError || err instanceof CheckpointStateMismatchError) {
|
|
181
|
+
throw err;
|
|
182
|
+
}
|
|
183
|
+
// Everything else is unscorable: excluded from the denominator, NEVER
|
|
184
|
+
// coerced to a fail (#476). This covers both grade-side failures
|
|
185
|
+
// (EvalCouldNotGradeError / InsufficientDiskError) and harness-run
|
|
186
|
+
// failures (Defect A — harvest missing-artifact, "produced no patch",
|
|
187
|
+
// clone/timeout, etc.); a harness/infra failure to produce a gradeable
|
|
188
|
+
// solution is environment-side, not an agent capability fail. The slate
|
|
189
|
+
// continues to the next instance.
|
|
190
|
+
passed = null;
|
|
191
|
+
unscorable = true;
|
|
192
|
+
logExcerpt = (err instanceof Error ? err.message : String(err)).slice(0, 1000);
|
|
193
|
+
}
|
|
194
|
+
deps.store.recordEvalResult({
|
|
195
|
+
checkpoint_cid: checkpointCid,
|
|
196
|
+
slate_hash: slate.hash,
|
|
197
|
+
slate_version: slate.version,
|
|
198
|
+
instance_id: task.instance_id,
|
|
199
|
+
passed,
|
|
200
|
+
unscorable,
|
|
201
|
+
code_digest: args.checkpointManifest.codeDigest,
|
|
202
|
+
run_at_ms: runAtMs,
|
|
203
|
+
test_log_excerpt: logExcerpt,
|
|
204
|
+
});
|
|
205
|
+
perTask.push({ instance_id: task.instance_id, passed, unscorable });
|
|
206
|
+
}
|
|
207
|
+
// AC#2: compare child vs parent at the SAME slate version. A parent with no
|
|
208
|
+
// rows is a hard error — no cross-version compare, eval the parent first.
|
|
209
|
+
const parentAgg = deps.store.getEvalAggregate(parentCheckpointCid, slate.version);
|
|
210
|
+
if (parentAgg.scorable === 0 && parentAgg.unscorable === 0) {
|
|
211
|
+
throw new ParentNotEvaluatedError(parentCheckpointCid, slate.version);
|
|
212
|
+
}
|
|
213
|
+
const childAgg = deps.store.getEvalAggregate(checkpointCid, slate.version);
|
|
214
|
+
const comparison = compareRates({ passed: childAgg.passed, scorable: childAgg.scorable }, { passed: parentAgg.passed, scorable: parentAgg.scorable });
|
|
215
|
+
return {
|
|
216
|
+
perTask,
|
|
217
|
+
comparison,
|
|
218
|
+
evaluated: { implStateDir: localImplStateDir, codeDigest: evaluatedDigest, matchedCheckpoint: true },
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
//# sourceMappingURL=orchestrator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"orchestrator.js","sourceRoot":"","sources":["../../src/eval/orchestrator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAQH,OAAO,EAAE,YAAY,EAAuB,MAAM,aAAa,CAAC;AAEhE,4EAA4E;AAC5E,MAAM,OAAO,yBAA0B,SAAQ,KAAK;IACtB;IAA5B,YAA4B,UAAkB;QAC5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EAAE,QAAQ,CAAC,QAAQ,EAAE,EACxD,EAAE,MAAM,EAAE,SAAS,CAAC,MAAM,EAAE,QAAQ,EAAE,SAAS,CAAC,QAAQ,EAAE,CAC3D,CAAC;IAEF,OAAO;QACL,OAAO;QACP,UAAU;QACV,SAAS,EAAE,EAAE,YAAY,EAAE,iBAAiB,EAAE,UAAU,EAAE,eAAe,EAAE,iBAAiB,EAAE,IAAI,EAAE;KACrG,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolve a held-out slate's `instance_id`s into `SweRebenchV2Task` objects
|
|
3
|
+
* for the `jinn eval` orchestrator (issue #818, AC#1).
|
|
4
|
+
*
|
|
5
|
+
* A slate stores only `instance_id`s (`_swe-rebench-v2-held-out-slate.ts`). The
|
|
6
|
+
* evaluator grades against the full HuggingFace row, fetched by
|
|
7
|
+
* `(hf_dataset, hf_split, instance_id)`. The `HfRow` does NOT echo
|
|
8
|
+
* `hf_dataset`/`hf_split` (see `swe-rebench-v2-evaluator/index.ts`), so the
|
|
9
|
+
* caller supplies the slate-level dataset+split as args; the resolver verifies
|
|
10
|
+
* each id exists by fetching its row and returns the `{ task, row }` pair so the
|
|
11
|
+
* orchestrator reuses the row at grade time (avoids a second fetch).
|
|
12
|
+
*
|
|
13
|
+
* No retry logic here — `HttpHfFetcher` owns retries. A fetcher throw for any id
|
|
14
|
+
* propagates loudly (a missing slate instance is a hard error, never a silent
|
|
15
|
+
* drop).
|
|
16
|
+
*/
|
|
17
|
+
import { type SweRebenchV2Task } from '../vendor/@jinn-network/sdk/dist/solvernets/swe-rebench-v2.js';
|
|
18
|
+
import type { HfFetcher, HfRow } from '../harnesses/impls/swe-rebench-v2-evaluator/index.js';
|
|
19
|
+
import type { PoolTask } from '../solver-types/_swe-rebench-v2-pool.js';
|
|
20
|
+
export interface ResolvedSlateTask {
|
|
21
|
+
task: SweRebenchV2Task;
|
|
22
|
+
row: HfRow;
|
|
23
|
+
}
|
|
24
|
+
export declare function resolveSlateTasks(args: {
|
|
25
|
+
/**
|
|
26
|
+
* The pool tasks for this slate group, each carrying the real
|
|
27
|
+
* `problem_statement` / `base_commit` / `language` the agent run needs to
|
|
28
|
+
* solve the instance (the slate stores only ids; the pool is the source of
|
|
29
|
+
* these fields).
|
|
30
|
+
*/
|
|
31
|
+
poolTasks: PoolTask[];
|
|
32
|
+
hf_dataset: string;
|
|
33
|
+
hf_split: string;
|
|
34
|
+
fetcher: HfFetcher;
|
|
35
|
+
}): Promise<ResolvedSlateTask[]>;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolve a held-out slate's `instance_id`s into `SweRebenchV2Task` objects
|
|
3
|
+
* for the `jinn eval` orchestrator (issue #818, AC#1).
|
|
4
|
+
*
|
|
5
|
+
* A slate stores only `instance_id`s (`_swe-rebench-v2-held-out-slate.ts`). The
|
|
6
|
+
* evaluator grades against the full HuggingFace row, fetched by
|
|
7
|
+
* `(hf_dataset, hf_split, instance_id)`. The `HfRow` does NOT echo
|
|
8
|
+
* `hf_dataset`/`hf_split` (see `swe-rebench-v2-evaluator/index.ts`), so the
|
|
9
|
+
* caller supplies the slate-level dataset+split as args; the resolver verifies
|
|
10
|
+
* each id exists by fetching its row and returns the `{ task, row }` pair so the
|
|
11
|
+
* orchestrator reuses the row at grade time (avoids a second fetch).
|
|
12
|
+
*
|
|
13
|
+
* No retry logic here — `HttpHfFetcher` owns retries. A fetcher throw for any id
|
|
14
|
+
* propagates loudly (a missing slate instance is a hard error, never a silent
|
|
15
|
+
* drop).
|
|
16
|
+
*/
|
|
17
|
+
import { SweRebenchV2TaskSchema } from '../vendor/@jinn-network/sdk/dist/solvernets/swe-rebench-v2.js';
|
|
18
|
+
export async function resolveSlateTasks(args) {
|
|
19
|
+
const tasks = [...args.poolTasks].sort((a, b) => a.instance_id.localeCompare(b.instance_id));
|
|
20
|
+
const out = [];
|
|
21
|
+
for (const poolTask of tasks) {
|
|
22
|
+
const row = await args.fetcher.fetchTaskRow({
|
|
23
|
+
hf_dataset: args.hf_dataset,
|
|
24
|
+
hf_split: args.hf_split,
|
|
25
|
+
instance_id: poolTask.instance_id,
|
|
26
|
+
});
|
|
27
|
+
out.push({ task: buildTask(poolTask, args.hf_dataset, args.hf_split, row), row });
|
|
28
|
+
}
|
|
29
|
+
return out;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Construct the `SweRebenchV2Task` the orchestrator hands to the harness +
|
|
33
|
+
* evaluator. The agent run needs the real `problem_statement` (what to solve)
|
|
34
|
+
* and `base_commit` (the repo state to check out) — these are threaded through
|
|
35
|
+
* from the pool task (the generator's mapping in `swe-rebench-v2.ts`).
|
|
36
|
+
* `hf_dataset`/`hf_split` are the evaluator's row-fetch key; `repo` comes from
|
|
37
|
+
* the fetched row. A pool task missing an optional field falls back the same
|
|
38
|
+
* way the generator does, so the object stays schema-valid.
|
|
39
|
+
*/
|
|
40
|
+
function buildTask(poolTask, hf_dataset, hf_split, row) {
|
|
41
|
+
const language = SweRebenchV2TaskSchema.shape.language.safeParse(poolTask.language);
|
|
42
|
+
return {
|
|
43
|
+
schemaVersion: 'swe-rebench-v2.v1',
|
|
44
|
+
instance_id: poolTask.instance_id,
|
|
45
|
+
repo: row.repo,
|
|
46
|
+
base_commit: poolTask.base_commit ?? '0'.repeat(40),
|
|
47
|
+
language: language.success ? language.data : 'python',
|
|
48
|
+
problem_statement: poolTask.problem_statement ?? '',
|
|
49
|
+
interface: poolTask.interface ?? '',
|
|
50
|
+
hf_dataset,
|
|
51
|
+
hf_split,
|
|
52
|
+
deadline_unix: 1,
|
|
53
|
+
round_month: hf_split.replace('_', '-'),
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=resolve-slate-tasks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve-slate-tasks.js","sourceRoot":"","sources":["../../src/eval/resolve-slate-tasks.ts"],"names":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,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ;QACrD,iBAAiB,EAAE,QAAQ,CAAC,iBAAiB,IAAI,EAAE;QACnD,SAAS,EAAE,QAAQ,CAAC,SAAS,IAAI,EAAE;QACnC,UAAU;QACV,QAAQ;QACR,aAAa,EAAE,CAAC;QAChB,WAAW,EAAE,QAAQ,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC;KACxC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ordinary least-squares slope of resolved-rate vs cycle index for the
|
|
3
|
+
* train-arm slope measurement (issue #822, AC#1).
|
|
4
|
+
*
|
|
5
|
+
* The train-arm e2e evaluates a checkpoint against the held-out slate (#817)
|
|
6
|
+
* at intervals via the eval orchestrator (#818), collecting one
|
|
7
|
+
* `{ cycleIndex, rate }` point per interval (`rate` = passed / scorable, the
|
|
8
|
+
* Wilson point estimate). The slope of the least-squares fit is the headline
|
|
9
|
+
* "is the learner improving across the training sequence" number.
|
|
10
|
+
*
|
|
11
|
+
* It is deliberately a thin helper over the closed-form OLS slope
|
|
12
|
+
* (`cov(x,y) / var(x)`); the per-point confidence intervals come from
|
|
13
|
+
* `wilson.ts` — this module does NOT reimplement them. The slope sign alone is
|
|
14
|
+
* never a verdict at small N: a flat or slightly negative slope is "within
|
|
15
|
+
* noise", which the e2e surfaces via the §4.1 honesty caveat.
|
|
16
|
+
*/
|
|
17
|
+
export interface RatePoint {
|
|
18
|
+
/** Training cycle index the eval ran at (0 = baseline, before any training). */
|
|
19
|
+
cycleIndex: number;
|
|
20
|
+
/** Observed resolved rate at that interval (passed / scorable, in [0, 1]). */
|
|
21
|
+
rate: number;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Least-squares slope of `rate` regressed on `cycleIndex`. Returns 0 for fewer
|
|
25
|
+
* than two points (no line to fit) and for a degenerate fit where every x is
|
|
26
|
+
* identical (zero variance — division would be NaN). A flat sequence yields
|
|
27
|
+
* exactly 0.
|
|
28
|
+
*/
|
|
29
|
+
export declare function leastSquaresSlope(points: RatePoint[]): number;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ordinary least-squares slope of resolved-rate vs cycle index for the
|
|
3
|
+
* train-arm slope measurement (issue #822, AC#1).
|
|
4
|
+
*
|
|
5
|
+
* The train-arm e2e evaluates a checkpoint against the held-out slate (#817)
|
|
6
|
+
* at intervals via the eval orchestrator (#818), collecting one
|
|
7
|
+
* `{ cycleIndex, rate }` point per interval (`rate` = passed / scorable, the
|
|
8
|
+
* Wilson point estimate). The slope of the least-squares fit is the headline
|
|
9
|
+
* "is the learner improving across the training sequence" number.
|
|
10
|
+
*
|
|
11
|
+
* It is deliberately a thin helper over the closed-form OLS slope
|
|
12
|
+
* (`cov(x,y) / var(x)`); the per-point confidence intervals come from
|
|
13
|
+
* `wilson.ts` — this module does NOT reimplement them. The slope sign alone is
|
|
14
|
+
* never a verdict at small N: a flat or slightly negative slope is "within
|
|
15
|
+
* noise", which the e2e surfaces via the §4.1 honesty caveat.
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* Least-squares slope of `rate` regressed on `cycleIndex`. Returns 0 for fewer
|
|
19
|
+
* than two points (no line to fit) and for a degenerate fit where every x is
|
|
20
|
+
* identical (zero variance — division would be NaN). A flat sequence yields
|
|
21
|
+
* exactly 0.
|
|
22
|
+
*/
|
|
23
|
+
export function leastSquaresSlope(points) {
|
|
24
|
+
const n = points.length;
|
|
25
|
+
if (n < 2)
|
|
26
|
+
return 0;
|
|
27
|
+
let sumX = 0;
|
|
28
|
+
let sumY = 0;
|
|
29
|
+
for (const { cycleIndex, rate } of points) {
|
|
30
|
+
sumX += cycleIndex;
|
|
31
|
+
sumY += rate;
|
|
32
|
+
}
|
|
33
|
+
const meanX = sumX / n;
|
|
34
|
+
const meanY = sumY / n;
|
|
35
|
+
let cov = 0;
|
|
36
|
+
let varX = 0;
|
|
37
|
+
for (const { cycleIndex, rate } of points) {
|
|
38
|
+
const dx = cycleIndex - meanX;
|
|
39
|
+
cov += dx * (rate - meanY);
|
|
40
|
+
varX += dx * dx;
|
|
41
|
+
}
|
|
42
|
+
if (varX === 0)
|
|
43
|
+
return 0;
|
|
44
|
+
return cov / varX;
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=slope.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slope.js","sourceRoot":"","sources":["../../src/eval/slope.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AASH;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB,CAAC,MAAmB;IACnD,MAAM,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC;IACxB,IAAI,CAAC,GAAG,CAAC;QAAE,OAAO,CAAC,CAAC;IACpB,IAAI,IAAI,GAAG,CAAC,CAAC;IACb,IAAI,IAAI,GAAG,CAAC,CAAC;IACb,KAAK,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,MAAM,EAAE,CAAC;QAC1C,IAAI,IAAI,UAAU,CAAC;QACnB,IAAI,IAAI,IAAI,CAAC;IACf,CAAC;IACD,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC,CAAC;IACvB,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC,CAAC;IACvB,IAAI,GAAG,GAAG,CAAC,CAAC;IACZ,IAAI,IAAI,GAAG,CAAC,CAAC;IACb,KAAK,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,MAAM,EAAE,CAAC;QAC1C,MAAM,EAAE,GAAG,UAAU,GAAG,KAAK,CAAC;QAC9B,GAAG,IAAI,EAAE,GAAG,CAAC,IAAI,GAAG,KAAK,CAAC,CAAC;QAC3B,IAAI,IAAI,EAAE,GAAG,EAAE,CAAC;IAClB,CAAC;IACD,IAAI,IAAI,KAAK,CAAC;QAAE,OAAO,CAAC,CAAC;IACzB,OAAO,GAAG,GAAG,IAAI,CAAC;AACpB,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Train-sequence builder with the no-train/test-overlap guard for the
|
|
3
|
+
* train-arm slope e2e (issue #822, AC#2).
|
|
4
|
+
*
|
|
5
|
+
* The learner-full-cycle e2e drives `runCycle` DIRECTLY (it does not post tasks
|
|
6
|
+
* through the generator), so the generator's `excludeHeldOutSlate` train-stream
|
|
7
|
+
* chokepoint (#817) is BYPASSED. This builder is therefore the load-bearing
|
|
8
|
+
* AC#2 mechanism for the e2e: it selects the N distinct training instances from
|
|
9
|
+
* the pool with the held-out slate excluded, and asserts the resulting
|
|
10
|
+
* sequence is disjoint from the slate (fail-loud, never a silent drop).
|
|
11
|
+
*
|
|
12
|
+
* It reuses `excludeHeldOutSlate` from the #817 primitive rather than
|
|
13
|
+
* reimplementing the exclusion. Selection is deterministic (instance-id sorted)
|
|
14
|
+
* so a given pool yields a stable sequence across runs.
|
|
15
|
+
*/
|
|
16
|
+
import type { PoolTask } from '../solver-types/_swe-rebench-v2-pool.js';
|
|
17
|
+
/** Thrown when a chosen training sequence intersects the held-out slate (AC#2). */
|
|
18
|
+
export declare class TrainTestOverlapError extends Error {
|
|
19
|
+
readonly overlap: string[];
|
|
20
|
+
constructor(overlap: string[]);
|
|
21
|
+
}
|
|
22
|
+
/** Assert a set of training ids is disjoint from the slate, else throw loud. */
|
|
23
|
+
export declare function assertNoOverlap(trainIds: string[], slateIds: Set<string>): void;
|
|
24
|
+
export declare function buildTrainSequence(args: {
|
|
25
|
+
pool: PoolTask[];
|
|
26
|
+
slateIds: Set<string>;
|
|
27
|
+
/** Number of distinct training tasks (= N training cycles). */
|
|
28
|
+
count: number;
|
|
29
|
+
/**
|
|
30
|
+
* Optional explicit, hand-picked instance_ids (in order). When set, the
|
|
31
|
+
* builder still runs the no-overlap guard and resolves each id against the
|
|
32
|
+
* pool — used to fail-loud on a hand-edited sequence that overlaps the slate.
|
|
33
|
+
*/
|
|
34
|
+
explicitIds?: string[];
|
|
35
|
+
}): PoolTask[];
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Train-sequence builder with the no-train/test-overlap guard for the
|
|
3
|
+
* train-arm slope e2e (issue #822, AC#2).
|
|
4
|
+
*
|
|
5
|
+
* The learner-full-cycle e2e drives `runCycle` DIRECTLY (it does not post tasks
|
|
6
|
+
* through the generator), so the generator's `excludeHeldOutSlate` train-stream
|
|
7
|
+
* chokepoint (#817) is BYPASSED. This builder is therefore the load-bearing
|
|
8
|
+
* AC#2 mechanism for the e2e: it selects the N distinct training instances from
|
|
9
|
+
* the pool with the held-out slate excluded, and asserts the resulting
|
|
10
|
+
* sequence is disjoint from the slate (fail-loud, never a silent drop).
|
|
11
|
+
*
|
|
12
|
+
* It reuses `excludeHeldOutSlate` from the #817 primitive rather than
|
|
13
|
+
* reimplementing the exclusion. Selection is deterministic (instance-id sorted)
|
|
14
|
+
* so a given pool yields a stable sequence across runs.
|
|
15
|
+
*/
|
|
16
|
+
import { excludeHeldOutSlate } from '../solver-types/_swe-rebench-v2-held-out-slate.js';
|
|
17
|
+
/** Thrown when a chosen training sequence intersects the held-out slate (AC#2). */
|
|
18
|
+
export class TrainTestOverlapError extends Error {
|
|
19
|
+
overlap;
|
|
20
|
+
constructor(overlap) {
|
|
21
|
+
super(`train/test overlap: training sequence includes held-out slate instance(s) ` +
|
|
22
|
+
`${overlap.join(', ')} — refusing to train on the eval slate (AC#2). ` +
|
|
23
|
+
`The slate must stay out-of-sample for the slope to mean anything.`);
|
|
24
|
+
this.overlap = overlap;
|
|
25
|
+
this.name = 'TrainTestOverlapError';
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
/** Assert a set of training ids is disjoint from the slate, else throw loud. */
|
|
29
|
+
export function assertNoOverlap(trainIds, slateIds) {
|
|
30
|
+
const overlap = trainIds.filter((id) => slateIds.has(id));
|
|
31
|
+
if (overlap.length > 0)
|
|
32
|
+
throw new TrainTestOverlapError(overlap);
|
|
33
|
+
}
|
|
34
|
+
export function buildTrainSequence(args) {
|
|
35
|
+
const eligible = excludeHeldOutSlate(args.pool, args.slateIds);
|
|
36
|
+
const byId = new Map(eligible.map((t) => [t.instance_id, t]));
|
|
37
|
+
if (args.explicitIds) {
|
|
38
|
+
// Guard the hand-picked sequence against the slate BEFORE resolving, so a
|
|
39
|
+
// slate-overlapping id is a TrainTestOverlapError, not a "not eligible".
|
|
40
|
+
assertNoOverlap(args.explicitIds, args.slateIds);
|
|
41
|
+
return args.explicitIds.map((id) => {
|
|
42
|
+
const task = byId.get(id);
|
|
43
|
+
if (!task) {
|
|
44
|
+
throw new Error(`explicit training instance ${id} not in the eligible pool`);
|
|
45
|
+
}
|
|
46
|
+
return task;
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
// Deterministic selection: instance-id sorted, first `count`.
|
|
50
|
+
const sorted = [...eligible].sort((a, b) => a.instance_id.localeCompare(b.instance_id));
|
|
51
|
+
if (sorted.length < args.count) {
|
|
52
|
+
throw new Error(`train sequence needs ${args.count} distinct tasks but only ${sorted.length} eligible ` +
|
|
53
|
+
`(pool size ${args.pool.length} minus ${args.slateIds.size} held-out slate instance(s))`);
|
|
54
|
+
}
|
|
55
|
+
const picked = sorted.slice(0, args.count);
|
|
56
|
+
assertNoOverlap(picked.map((t) => t.instance_id), args.slateIds);
|
|
57
|
+
return picked;
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=train-sequence.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"train-sequence.js","sourceRoot":"","sources":["../../src/eval/train-sequence.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAAE,mBAAmB,EAAE,MAAM,mDAAmD,CAAC;AAExF,mFAAmF;AACnF,MAAM,OAAO,qBAAsB,SAAQ,KAAK;IAClB;IAA5B,YAA4B,OAAiB;Q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CAAC;IACL,CAAC;IAED,8DAA8D;IAC9D,MAAM,MAAM,GAAG,CAAC,GAAG,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC;IACxF,IAAI,MAAM,CAAC,MAAM,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC;QAC/B,MAAM,IAAI,KAAK,CACb,wBAAwB,IAAI,CAAC,KAAK,4BAA4B,MAAM,CAAC,MAAM,YAAY;YACrF,cAAc,IAAI,CAAC,IAAI,CAAC,MAAM,UAAU,IAAI,CAAC,QAAQ,CAAC,IAAI,8BAA8B,CAC3F,CAAC;IACJ,CAAC;IACD,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;IAC3C,eAAe,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;IACjE,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wilson score interval + resolved-rate comparison for the `jinn eval`
|
|
3
|
+
* held-out checkpoint orchestrator (issue #818, AC#2).
|
|
4
|
+
*
|
|
5
|
+
* The Wilson score interval is a binomial proportion confidence interval that
|
|
6
|
+
* behaves well at the extremes (p=0, p=1) and for small n — unlike the naive
|
|
7
|
+
* normal-approximation interval. We write it small (no stats dependency, per
|
|
8
|
+
* repo convention): the formula is ~10 lines.
|
|
9
|
+
*
|
|
10
|
+
* Per log/decisions/2026-05-28-rl-eval-measurement.md §4: this is v1-simple.
|
|
11
|
+
* Only *large* deltas are trustworthy — we encode that as "the child and
|
|
12
|
+
* parent intervals do not overlap." No seed control, no multi-run averaging.
|
|
13
|
+
*/
|
|
14
|
+
export interface Interval {
|
|
15
|
+
/** Observed point estimate, passed / scorable (0 when scorable=0). */
|
|
16
|
+
p: number;
|
|
17
|
+
/** Lower bound, clamped to [0, 1]. */
|
|
18
|
+
lo: number;
|
|
19
|
+
/** Upper bound, clamped to [0, 1]. */
|
|
20
|
+
hi: number;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Wilson score interval for `passed` successes out of `scorable` trials.
|
|
24
|
+
* `scorable === 0` returns a degenerate `{ p: 0, lo: 0, hi: 0 }` (no NaN).
|
|
25
|
+
*/
|
|
26
|
+
export declare function wilsonInterval(passed: number, scorable: number, z?: number): Interval;
|
|
27
|
+
export type RateVerdict = 'trustworthy' | 'within-noise';
|
|
28
|
+
export interface RateComparison {
|
|
29
|
+
child: Interval;
|
|
30
|
+
parent: Interval;
|
|
31
|
+
/** child.p − parent.p (point-estimate difference, can be negative). */
|
|
32
|
+
delta: number;
|
|
33
|
+
/**
|
|
34
|
+
* 'trustworthy' iff the two Wilson intervals do NOT overlap; otherwise
|
|
35
|
+
* 'within-noise'. v1-simple: only disjoint intervals justify a claim.
|
|
36
|
+
*/
|
|
37
|
+
verdict: RateVerdict;
|
|
38
|
+
}
|
|
39
|
+
export declare function compareRates(child: {
|
|
40
|
+
passed: number;
|
|
41
|
+
scorable: number;
|
|
42
|
+
}, parent: {
|
|
43
|
+
passed: number;
|
|
44
|
+
scorable: number;
|
|
45
|
+
}): RateComparison;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wilson score interval + resolved-rate comparison for the `jinn eval`
|
|
3
|
+
* held-out checkpoint orchestrator (issue #818, AC#2).
|
|
4
|
+
*
|
|
5
|
+
* The Wilson score interval is a binomial proportion confidence interval that
|
|
6
|
+
* behaves well at the extremes (p=0, p=1) and for small n — unlike the naive
|
|
7
|
+
* normal-approximation interval. We write it small (no stats dependency, per
|
|
8
|
+
* repo convention): the formula is ~10 lines.
|
|
9
|
+
*
|
|
10
|
+
* Per log/decisions/2026-05-28-rl-eval-measurement.md §4: this is v1-simple.
|
|
11
|
+
* Only *large* deltas are trustworthy — we encode that as "the child and
|
|
12
|
+
* parent intervals do not overlap." No seed control, no multi-run averaging.
|
|
13
|
+
*/
|
|
14
|
+
/** Two-sided z for a 95% interval (1.96 ≈ Φ⁻¹(0.975)). */
|
|
15
|
+
const DEFAULT_Z = 1.96;
|
|
16
|
+
/**
|
|
17
|
+
* Wilson score interval for `passed` successes out of `scorable` trials.
|
|
18
|
+
* `scorable === 0` returns a degenerate `{ p: 0, lo: 0, hi: 0 }` (no NaN).
|
|
19
|
+
*/
|
|
20
|
+
export function wilsonInterval(passed, scorable, z = DEFAULT_Z) {
|
|
21
|
+
if (scorable === 0)
|
|
22
|
+
return { p: 0, lo: 0, hi: 0 };
|
|
23
|
+
const n = scorable;
|
|
24
|
+
const p = passed / n;
|
|
25
|
+
const z2 = z * z;
|
|
26
|
+
const denom = 1 + z2 / n;
|
|
27
|
+
const centre = p + z2 / (2 * n);
|
|
28
|
+
const margin = z * Math.sqrt((p * (1 - p)) / n + z2 / (4 * n * n));
|
|
29
|
+
const lo = (centre - margin) / denom;
|
|
30
|
+
const hi = (centre + margin) / denom;
|
|
31
|
+
return {
|
|
32
|
+
p,
|
|
33
|
+
lo: Math.max(0, lo),
|
|
34
|
+
hi: Math.min(1, hi),
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
export function compareRates(child, parent) {
|
|
38
|
+
const c = wilsonInterval(child.passed, child.scorable);
|
|
39
|
+
const p = wilsonInterval(parent.passed, parent.scorable);
|
|
40
|
+
const disjoint = c.lo > p.hi || p.lo > c.hi;
|
|
41
|
+
return {
|
|
42
|
+
child: c,
|
|
43
|
+
parent: p,
|
|
44
|
+
delta: c.p - p.p,
|
|
45
|
+
verdict: disjoint ? 'trustworthy' : 'within-noise',
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=wilson.js.map
|
|
@@ -0,0 +1 @@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M,CAAC,GAAG,cAAc,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC;IACvD,MAAM,CAAC,GAAG,cAAc,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC;IACzD,MAAM,QAAQ,GAAG,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC;IAC5C,OAAO;QACL,KAAK,EAAE,CAAC;QACR,MAAM,EAAE,CAAC;QACT,KAAK,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;QAChB,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,cAAc;KACnD,CAAC;AACJ,CAAC"}
|
package/dist/events/types.d.ts
CHANGED
|
@@ -21,7 +21,7 @@ export declare const StructuredEventSchema: z.ZodObject<{
|
|
|
21
21
|
}, "strip", z.ZodTypeAny, {
|
|
22
22
|
message: string;
|
|
23
23
|
id: string;
|
|
24
|
-
kind: "reward" | "error" | "
|
|
24
|
+
kind: "reward" | "error" | "intent" | "fleet" | "system" | "log";
|
|
25
25
|
schemaVersion: 1;
|
|
26
26
|
ts: string;
|
|
27
27
|
details?: Record<string, unknown> | undefined;
|
|
@@ -31,7 +31,7 @@ export declare const StructuredEventSchema: z.ZodObject<{
|
|
|
31
31
|
}, {
|
|
32
32
|
message: string;
|
|
33
33
|
id: string;
|
|
34
|
-
kind: "reward" | "error" | "
|
|
34
|
+
kind: "reward" | "error" | "intent" | "fleet" | "system" | "log";
|
|
35
35
|
schemaVersion: 1;
|
|
36
36
|
ts: string;
|
|
37
37
|
details?: Record<string, unknown> | undefined;
|