@jinn-network/client 0.1.5 → 0.1.6-canary.107ea271
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 +131 -0
- package/dist/adapters/mech/adapter.d.ts +23 -1
- package/dist/adapters/mech/adapter.js +169 -33
- package/dist/adapters/mech/adapter.js.map +1 -1
- package/dist/adapters/mech/contracts.d.ts +1 -0
- package/dist/adapters/mech/contracts.js +1 -0
- package/dist/adapters/mech/contracts.js.map +1 -1
- package/dist/adapters/mech/ipfs-pinfile.d.ts +22 -0
- package/dist/adapters/mech/ipfs-pinfile.js +54 -0
- package/dist/adapters/mech/ipfs-pinfile.js.map +1 -0
- package/dist/adapters/mech/ipfs.d.ts +1 -0
- package/dist/adapters/mech/ipfs.js +24 -1
- package/dist/adapters/mech/ipfs.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/bootstrap-endpoint.js +63 -1
- 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 +158 -0
- package/dist/api/codex-doctor-endpoint.js.map +1 -0
- package/dist/api/discovery-endpoint.d.ts +31 -0
- package/dist/api/discovery-endpoint.js +78 -0
- package/dist/api/discovery-endpoint.js.map +1 -0
- package/dist/api/fleet-build.d.ts +8 -0
- package/dist/api/fleet-build.js +8 -2
- package/dist/api/fleet-build.js.map +1 -1
- package/dist/api/gather-status.js +90 -4
- package/dist/api/gather-status.js.map +1 -1
- package/dist/api/harness-readiness-endpoint.d.ts +25 -0
- package/dist/api/harness-readiness-endpoint.js +24 -0
- package/dist/api/harness-readiness-endpoint.js.map +1 -0
- package/dist/api/hermes-doctor-endpoint.d.ts +66 -0
- package/dist/api/hermes-doctor-endpoint.js +75 -0
- package/dist/api/hermes-doctor-endpoint.js.map +1 -0
- 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 +9 -0
- package/dist/api/prediction-v1-build.js +6 -1
- package/dist/api/prediction-v1-build.js.map +1 -1
- package/dist/api/server.d.ts +70 -0
- package/dist/api/server.js +107 -1
- package/dist/api/server.js.map +1 -1
- package/dist/api/setup-endpoints.d.ts +21 -0
- package/dist/api/setup-endpoints.js +101 -8
- package/dist/api/setup-endpoints.js.map +1 -1
- package/dist/api/setup-retry-endpoint.d.ts +19 -0
- package/dist/api/setup-retry-endpoint.js +32 -0
- package/dist/api/setup-retry-endpoint.js.map +1 -0
- package/dist/api/solvernets-endpoints.js +8 -1
- package/dist/api/solvernets-endpoints.js.map +1 -1
- package/dist/api/status-build.d.ts +14 -0
- package/dist/api/status-build.js +23 -18
- 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 +20 -0
- package/dist/api/task-runs-build.js +4 -0
- 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 +3 -1
- package/dist/cli/commands/auth.js.map +1 -1
- package/dist/cli/commands/create.d.ts +5 -3
- package/dist/cli/commands/create.js +102 -36
- package/dist/cli/commands/create.js.map +1 -1
- package/dist/cli/commands/solver-nets.d.ts +19 -0
- package/dist/cli/commands/solver-nets.js +164 -11
- package/dist/cli/commands/solver-nets.js.map +1 -1
- package/dist/cli/commands/solver-plugins-publish.d.ts +31 -0
- package/dist/cli/commands/solver-plugins-publish.js +169 -0
- package/dist/cli/commands/solver-plugins-publish.js.map +1 -0
- package/dist/cli/commands/solver-plugins-revoke.d.ts +15 -0
- package/dist/cli/commands/solver-plugins-revoke.js +91 -0
- package/dist/cli/commands/solver-plugins-revoke.js.map +1 -0
- package/dist/cli/commands/solver-plugins.d.ts +50 -6
- package/dist/cli/commands/solver-plugins.js +205 -68
- package/dist/cli/commands/solver-plugins.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/config.d.ts +51 -0
- package/dist/config.js +49 -2
- package/dist/config.js.map +1 -1
- package/dist/conformance/checks/hash-signature.js +6 -2
- package/dist/conformance/checks/hash-signature.js.map +1 -1
- package/dist/conformance/checks/payload.js +4 -2
- package/dist/conformance/checks/payload.js.map +1 -1
- package/dist/conformance/checks/verdict.d.ts +10 -10
- package/dist/conformance/checks/verdict.js +16 -15
- package/dist/conformance/checks/verdict.js.map +1 -1
- package/dist/conformance/harness.d.ts +1 -1
- package/dist/conformance/harness.js +16 -9
- package/dist/conformance/harness.js.map +1 -1
- package/dist/conformance/types.d.ts +10 -3
- package/dist/conformance/types.js.map +1 -1
- package/dist/corpus/acquire.d.ts +1 -3
- package/dist/corpus/acquire.js.map +1 -1
- package/dist/corpus/envelope-projection.d.ts +1 -1
- package/dist/corpus/envelope-projection.js +14 -7
- package/dist/corpus/envelope-projection.js.map +1 -1
- package/dist/corpus/index.d.ts +2 -1
- package/dist/corpus/index.js.map +1 -1
- package/dist/corpus/prediction-brier-scoreboard-report.js +1 -1
- package/dist/corpus/prediction-brier-scoreboard-report.js.map +1 -1
- package/dist/corpus/prediction-brier-scoreboard.js +3 -1
- package/dist/corpus/prediction-brier-scoreboard.js.map +1 -1
- package/dist/corpus/types.d.ts +2 -2
- package/dist/daemon/daemon.d.ts +26 -1
- package/dist/daemon/daemon.js +63 -1
- package/dist/daemon/daemon.js.map +1 -1
- package/dist/daemon/eviction-loop.d.ts +40 -0
- package/dist/daemon/eviction-loop.js +67 -0
- package/dist/daemon/eviction-loop.js.map +1 -0
- package/dist/daemon/freeze-fence.js +6 -3
- package/dist/daemon/freeze-fence.js.map +1 -1
- package/dist/daemon/readiness-gate.d.ts +30 -0
- package/dist/daemon/readiness-gate.js +31 -0
- package/dist/daemon/readiness-gate.js.map +1 -0
- 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-D_NMfDfV.css → index-DE4qUnzV.css} +1 -1
- package/dist/dashboard/assets/index-Di7xA4eB.js +170 -0
- package/dist/dashboard/index.html +2 -2
- package/dist/discovery/http.js +121 -0
- package/dist/discovery/http.js.map +1 -1
- package/dist/discovery/onchain.d.ts +5 -0
- package/dist/discovery/onchain.js +292 -7
- package/dist/discovery/onchain.js.map +1 -1
- package/dist/discovery/types.d.ts +127 -1
- package/dist/discovery/types.js +8 -10
- package/dist/discovery/types.js.map +1 -1
- package/dist/discovery/with-fallback.js +9 -0
- package/dist/discovery/with-fallback.js.map +1 -1
- package/dist/earning/agent-wallet-binding.d.ts +20 -1
- package/dist/earning/agent-wallet-binding.js +54 -16
- package/dist/earning/agent-wallet-binding.js.map +1 -1
- package/dist/earning/bootstrap.d.ts +178 -0
- package/dist/earning/bootstrap.js +628 -57
- package/dist/earning/bootstrap.js.map +1 -1
- package/dist/earning/contracts.d.ts +12 -0
- package/dist/earning/contracts.js +16 -1
- package/dist/earning/contracts.js.map +1 -1
- package/dist/earning/funding-plan.js +15 -2
- package/dist/earning/funding-plan.js.map +1 -1
- package/dist/earning/jinn-rewards.d.ts +46 -0
- package/dist/earning/jinn-rewards.js +32 -0
- package/dist/earning/jinn-rewards.js.map +1 -1
- package/dist/earning/store.d.ts +8 -0
- package/dist/earning/store.js +48 -1
- package/dist/earning/store.js.map +1 -1
- package/dist/earning/testnet-setup-migration.d.ts +12 -0
- package/dist/earning/testnet-setup-migration.js +27 -1
- package/dist/earning/testnet-setup-migration.js.map +1 -1
- package/dist/earning/types.d.ts +45 -0
- package/dist/earning/types.js +37 -0
- package/dist/earning/types.js.map +1 -1
- package/dist/erc8004/abis.d.ts +64 -0
- package/dist/erc8004/abis.js +48 -0
- package/dist/erc8004/abis.js.map +1 -1
- package/dist/erc8004/plugin-registry.d.ts +102 -0
- package/dist/erc8004/plugin-registry.js +165 -0
- package/dist/erc8004/plugin-registry.js.map +1 -0
- 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/events/types.d.ts +2 -2
- package/dist/harnesses/cost-estimates.d.ts +145 -0
- package/dist/harnesses/cost-estimates.js +297 -0
- package/dist/harnesses/cost-estimates.js.map +1 -0
- package/dist/harnesses/engine/engine.d.ts +40 -0
- package/dist/harnesses/engine/engine.js +69 -8
- package/dist/harnesses/engine/engine.js.map +1 -1
- package/dist/harnesses/engine/envelope-assembly.d.ts +2 -2
- package/dist/harnesses/engine/envelope-assembly.js +4 -2
- package/dist/harnesses/engine/envelope-assembly.js.map +1 -1
- package/dist/harnesses/engine/persistence.d.ts +21 -0
- package/dist/harnesses/engine/persistence.js +39 -0
- 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/freeze.d.ts +4 -1
- package/dist/harnesses/freeze.js +12 -2
- package/dist/harnesses/freeze.js.map +1 -1
- package/dist/harnesses/impls/claude-mcp-prediction/index.d.ts +4 -1
- package/dist/harnesses/impls/claude-mcp-prediction/index.js +7 -2
- package/dist/harnesses/impls/claude-mcp-prediction/index.js.map +1 -1
- package/dist/harnesses/impls/claude-mcp-prediction-apy/index.d.ts +4 -1
- package/dist/harnesses/impls/claude-mcp-prediction-apy/index.js +7 -2
- package/dist/harnesses/impls/claude-mcp-prediction-apy/index.js.map +1 -1
- package/dist/harnesses/impls/evaluation-context.d.ts +15 -4
- package/dist/harnesses/impls/evaluation-context.js +24 -8
- package/dist/harnesses/impls/evaluation-context.js.map +1 -1
- package/dist/harnesses/impls/hermes-agent/adapter.d.ts +34 -0
- package/dist/harnesses/impls/hermes-agent/adapter.js +205 -0
- package/dist/harnesses/impls/hermes-agent/adapter.js.map +1 -0
- package/dist/harnesses/impls/hermes-agent/bootstrap.d.ts +18 -0
- package/dist/harnesses/impls/hermes-agent/bootstrap.js +231 -0
- package/dist/harnesses/impls/hermes-agent/bootstrap.js.map +1 -0
- package/dist/harnesses/impls/hermes-agent/config-builder.d.ts +49 -0
- package/dist/harnesses/impls/hermes-agent/config-builder.js +132 -0
- package/dist/harnesses/impls/hermes-agent/config-builder.js.map +1 -0
- package/dist/harnesses/impls/hermes-agent/harness.d.ts +58 -0
- package/dist/harnesses/impls/hermes-agent/harness.js +118 -0
- package/dist/harnesses/impls/hermes-agent/harness.js.map +1 -0
- package/dist/harnesses/impls/hermes-agent/index.d.ts +5 -0
- package/dist/harnesses/impls/hermes-agent/index.js +7 -0
- package/dist/harnesses/impls/hermes-agent/index.js.map +1 -0
- package/dist/harnesses/impls/hermes-agent/prompt.d.ts +15 -0
- package/dist/harnesses/impls/hermes-agent/prompt.js +37 -0
- package/dist/harnesses/impls/hermes-agent/prompt.js.map +1 -0
- package/dist/harnesses/impls/index.d.ts +13 -0
- package/dist/harnesses/impls/index.js +32 -4
- package/dist/harnesses/impls/index.js.map +1 -1
- package/dist/harnesses/impls/learner/adapters/claude-code.js.map +1 -0
- package/dist/harnesses/impls/{claude-code-learner → learner}/adapters/codex-code.js +13 -34
- package/dist/harnesses/impls/learner/adapters/codex-code.js.map +1 -0
- package/dist/harnesses/impls/learner/adapters/codex-workspace.js.map +1 -0
- package/dist/harnesses/impls/learner/harness.d.ts +62 -0
- package/dist/harnesses/impls/learner/harness.js +179 -0
- package/dist/harnesses/impls/learner/harness.js.map +1 -0
- package/dist/harnesses/impls/{claude-code-learner → learner}/harvest.js +15 -3
- package/dist/harnesses/impls/learner/harvest.js.map +1 -0
- package/dist/harnesses/impls/{claude-code-learner → learner}/index.d.ts +5 -5
- package/dist/harnesses/impls/{claude-code-learner → learner}/index.js +4 -4
- package/dist/harnesses/impls/learner/index.js.map +1 -0
- package/dist/harnesses/impls/{claude-code-learner → learner}/plugin-path.d.ts +4 -4
- package/dist/harnesses/impls/{claude-code-learner → learner}/plugin-path.js +7 -7
- package/dist/harnesses/impls/learner/plugin-path.js.map +1 -0
- package/dist/harnesses/impls/{claude-code-learner → learner}/restoration-patch.js +3 -1
- package/dist/harnesses/impls/learner/restoration-patch.js.map +1 -0
- package/dist/harnesses/impls/learner/test-utils/fake-plugin-outputs.js.map +1 -0
- package/dist/harnesses/impls/learner/test-utils/noop-adapter.js.map +1 -0
- package/dist/harnesses/impls/{claude-code-learner → learner}/types.d.ts +23 -2
- package/dist/harnesses/impls/learner/types.js.map +1 -0
- package/dist/harnesses/impls/portfolio-v0-evaluator/index.js +13 -12
- package/dist/harnesses/impls/portfolio-v0-evaluator/index.js.map +1 -1
- package/dist/harnesses/impls/prediction-apy-v0-evaluator/index.js +7 -7
- package/dist/harnesses/impls/prediction-apy-v0-evaluator/index.js.map +1 -1
- package/dist/harnesses/impls/prediction-apy-v0-evaluator/parse-submission.d.ts +3 -3
- package/dist/harnesses/impls/prediction-apy-v0-evaluator/parse-submission.js +7 -6
- package/dist/harnesses/impls/prediction-apy-v0-evaluator/parse-submission.js.map +1 -1
- package/dist/harnesses/impls/prediction-v0-evaluator/checks/integrity.js +1 -1
- package/dist/harnesses/impls/prediction-v0-evaluator/checks/integrity.js.map +1 -1
- package/dist/harnesses/impls/prediction-v0-evaluator/index.js +11 -10
- package/dist/harnesses/impls/prediction-v0-evaluator/index.js.map +1 -1
- package/dist/harnesses/impls/prediction-v1-evaluator/index.js +11 -10
- package/dist/harnesses/impls/prediction-v1-evaluator/index.js.map +1 -1
- 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 +1 -0
- package/dist/harnesses/impls/swe-rebench-v2-evaluator/eval-runner.js +10 -2
- 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 +24 -5
- package/dist/harnesses/impls/swe-rebench-v2-evaluator/harness.js +104 -4
- 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 +9 -0
- package/dist/harnesses/impls/swe-rebench-v2-evaluator/hf-fetcher.js +25 -1
- package/dist/harnesses/impls/swe-rebench-v2-evaluator/hf-fetcher.js.map +1 -1
- package/dist/harnesses/names.d.ts +1 -0
- package/dist/harnesses/names.js +3 -0
- package/dist/harnesses/names.js.map +1 -1
- package/dist/harnesses/readiness-registry.d.ts +48 -0
- package/dist/harnesses/readiness-registry.js +144 -0
- package/dist/harnesses/readiness-registry.js.map +1 -0
- package/dist/harnesses/types.d.ts +7 -0
- package/dist/main.d.ts +14 -0
- package/dist/main.js +372 -90
- package/dist/main.js.map +1 -1
- package/dist/mcp/server.js +14 -13
- package/dist/mcp/server.js.map +1 -1
- package/dist/operator-errors.d.ts +7 -0
- package/dist/operator-errors.js +26 -2
- package/dist/operator-errors.js.map +1 -1
- package/dist/preflight/claude-auth.d.ts +18 -0
- package/dist/preflight/claude-auth.js +38 -0
- package/dist/preflight/claude-auth.js.map +1 -1
- package/dist/restart-daemon.d.ts +71 -0
- package/dist/restart-daemon.js +82 -0
- package/dist/restart-daemon.js.map +1 -0
- package/dist/scripts/donation-consumption-acceptance.js +1 -1
- package/dist/scripts/donation-consumption-acceptance.js.map +1 -1
- package/dist/scripts/swe-rebench-v2-known-bad.json +12 -0
- package/dist/scripts/swe-rebench-v2-seed-pool.json +26 -0
- package/dist/setup/halt-mode.d.ts +14 -0
- package/dist/setup/halt-mode.js +17 -0
- package/dist/setup/halt-mode.js.map +1 -0
- package/dist/solver-nets/prediction-operator-ux.js +43 -3
- package/dist/solver-nets/prediction-operator-ux.js.map +1 -1
- package/dist/solver-nets/registry.d.ts +1 -0
- package/dist/solver-nets/registry.js +1 -1
- package/dist/solver-nets/registry.js.map +1 -1
- package/dist/solver-types/_swe-rebench-v2-substrate.d.ts +52 -0
- package/dist/solver-types/_swe-rebench-v2-substrate.js +76 -0
- package/dist/solver-types/_swe-rebench-v2-substrate.js.map +1 -0
- package/dist/solver-types/_swe-rebench-v2-validated-pool.d.ts +38 -12
- package/dist/solver-types/_swe-rebench-v2-validated-pool.js +136 -27
- package/dist/solver-types/_swe-rebench-v2-validated-pool.js.map +1 -1
- package/dist/solver-types/swe-rebench-v2-auto.d.ts +6 -0
- package/dist/solver-types/swe-rebench-v2-auto.js.map +1 -1
- package/dist/solver-types/swe-rebench-v2.d.ts +1 -0
- package/dist/solver-types/swe-rebench-v2.js +19 -6
- 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/store/store.js +12 -4
- package/dist/store/store.js.map +1 -1
- package/dist/templates/plugins/runtime-plugin/.mcp.json.tmpl +8 -0
- package/dist/templates/plugins/runtime-plugin/README.md.tmpl +30 -0
- package/dist/templates/plugins/runtime-plugin/gitignore.tmpl +3 -0
- package/dist/templates/plugins/runtime-plugin/jinn.plugin.json.tmpl +21 -0
- package/dist/templates/plugins/runtime-plugin/mcp/server.mjs.tmpl +33 -0
- package/dist/templates/plugins/runtime-plugin/package.json.tmpl +15 -0
- package/dist/templates/plugins/runtime-plugin/test/plugin.test.ts.tmpl +35 -0
- package/dist/templates/plugins/runtime-plugin/tsconfig.json.tmpl +11 -0
- package/dist/templates/plugins/solver-type-plugin/README.md.tmpl +35 -0
- package/dist/templates/plugins/solver-type-plugin/gitignore.tmpl +3 -0
- package/dist/templates/plugins/solver-type-plugin/jinn.plugin.json.tmpl +11 -0
- package/dist/templates/plugins/solver-type-plugin/package.json.tmpl +15 -0
- package/dist/templates/plugins/solver-type-plugin/skills/example/SKILL.md.tmpl +10 -0
- package/dist/templates/plugins/solver-type-plugin/test/plugin.test.ts.tmpl +25 -0
- package/dist/templates/plugins/solver-type-plugin/tsconfig.json.tmpl +11 -0
- package/dist/tx-retry.d.ts +13 -0
- package/dist/tx-retry.js +22 -0
- package/dist/tx-retry.js.map +1 -1
- package/dist/types/envelope.d.ts +28 -21
- package/dist/types/envelope.js +8 -3
- package/dist/types/envelope.js.map +1 -1
- package/dist/types/payloads/index.d.ts +2 -2
- package/dist/types/payloads/index.js +13 -12
- package/dist/types/payloads/index.js.map +1 -1
- package/dist/types/payloads/portfolio-v0.d.ts +60 -10
- package/dist/types/payloads/portfolio-v0.js +16 -6
- package/dist/types/payloads/portfolio-v0.js.map +1 -1
- package/dist/types/payloads/prediction-apy-v0.d.ts +56 -14
- package/dist/types/payloads/prediction-apy-v0.js +16 -6
- package/dist/types/payloads/prediction-apy-v0.js.map +1 -1
- package/dist/types/payloads/prediction-v0.d.ts +53 -14
- package/dist/types/payloads/prediction-v0.js +16 -6
- package/dist/types/payloads/prediction-v0.js.map +1 -1
- 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/payloads/prediction-v1.d.ts +45 -6
- package/dist/vendor/@jinn-network/sdk/dist/payloads/prediction-v1.js +16 -6
- package/dist/x402/handler.js +51 -20
- package/dist/x402/handler.js.map +1 -1
- package/package.json +38 -13
- package/plugins/swe-rebench-v2-diffmin/.claude-plugin/plugin.json +5 -0
- package/plugins/swe-rebench-v2-diffmin/.mcp.json +8 -0
- package/plugins/swe-rebench-v2-diffmin/README.md +69 -0
- package/plugins/swe-rebench-v2-diffmin/jinn.plugin.json +12 -0
- package/plugins/swe-rebench-v2-diffmin/mcp/diff-stats-server.mjs +72 -0
- package/plugins/swe-rebench-v2-diffmin/mcp/diff-stats.mjs +48 -0
- package/plugins/swe-rebench-v2-diffmin/package.json +19 -0
- package/plugins/swe-rebench-v2-diffmin/skills/diffmin/SKILL.md +116 -0
- package/plugins/swe-rebench-v2-diffmin/skills/test-map/SKILL.md +126 -0
- package/plugins/swe-rebench-v2-diffmin/test/diff-stats.test.ts +62 -0
- package/plugins/swe-rebench-v2-diffmin/test/manifest.test.ts +53 -0
- package/plugins/swe-rebench-v2-diffmin/tsconfig.json +12 -0
- package/plugins/swe-rebench-v2-runtime/README.md +13 -0
- package/plugins/swe-rebench-v2-runtime/skills/orient/SKILL.md +7 -3
- package/plugins/swe-rebench-v2-runtime/skills/plan/SKILL.md +6 -17
- package/templates/plugins/runtime-plugin/.mcp.json.tmpl +8 -0
- package/templates/plugins/runtime-plugin/README.md.tmpl +30 -0
- package/templates/plugins/runtime-plugin/gitignore.tmpl +3 -0
- package/templates/plugins/runtime-plugin/jinn.plugin.json.tmpl +21 -0
- package/templates/plugins/runtime-plugin/mcp/server.mjs.tmpl +33 -0
- package/templates/plugins/runtime-plugin/package.json.tmpl +15 -0
- package/templates/plugins/runtime-plugin/test/plugin.test.ts.tmpl +35 -0
- package/templates/plugins/runtime-plugin/tsconfig.json.tmpl +11 -0
- package/templates/plugins/solver-type-plugin/README.md.tmpl +35 -0
- package/templates/plugins/solver-type-plugin/gitignore.tmpl +3 -0
- package/templates/plugins/solver-type-plugin/jinn.plugin.json.tmpl +11 -0
- package/templates/plugins/solver-type-plugin/package.json.tmpl +15 -0
- package/templates/plugins/solver-type-plugin/skills/example/SKILL.md.tmpl +10 -0
- package/templates/plugins/solver-type-plugin/test/plugin.test.ts.tmpl +25 -0
- package/templates/plugins/solver-type-plugin/tsconfig.json.tmpl +11 -0
- package/dist/dashboard/assets/index-BjtltOGc.js +0 -76
- package/dist/harnesses/impls/claude-code-learner/adapters/claude-code.js.map +0 -1
- package/dist/harnesses/impls/claude-code-learner/adapters/codex-code.js.map +0 -1
- package/dist/harnesses/impls/claude-code-learner/adapters/codex-workspace.js.map +0 -1
- package/dist/harnesses/impls/claude-code-learner/harness.d.ts +0 -22
- package/dist/harnesses/impls/claude-code-learner/harness.js +0 -62
- package/dist/harnesses/impls/claude-code-learner/harness.js.map +0 -1
- package/dist/harnesses/impls/claude-code-learner/harvest.js.map +0 -1
- package/dist/harnesses/impls/claude-code-learner/index.js.map +0 -1
- package/dist/harnesses/impls/claude-code-learner/plugin-path.js.map +0 -1
- package/dist/harnesses/impls/claude-code-learner/restoration-patch.js.map +0 -1
- package/dist/harnesses/impls/claude-code-learner/test-utils/fake-plugin-outputs.js.map +0 -1
- package/dist/harnesses/impls/claude-code-learner/test-utils/noop-adapter.js.map +0 -1
- package/dist/harnesses/impls/claude-code-learner/types.js.map +0 -1
- package/dist/preflight/claude-required.d.ts +0 -8
- package/dist/preflight/claude-required.js +0 -17
- package/dist/preflight/claude-required.js.map +0 -1
- /package/dist/harnesses/impls/{claude-code-learner → learner}/adapters/claude-code.d.ts +0 -0
- /package/dist/harnesses/impls/{claude-code-learner → learner}/adapters/claude-code.js +0 -0
- /package/dist/harnesses/impls/{claude-code-learner → learner}/adapters/codex-code.d.ts +0 -0
- /package/dist/harnesses/impls/{claude-code-learner → learner}/adapters/codex-workspace.d.ts +0 -0
- /package/dist/harnesses/impls/{claude-code-learner → learner}/adapters/codex-workspace.js +0 -0
- /package/dist/harnesses/impls/{claude-code-learner → learner}/harvest.d.ts +0 -0
- /package/dist/harnesses/impls/{claude-code-learner → learner}/restoration-patch.d.ts +0 -0
- /package/dist/harnesses/impls/{claude-code-learner → learner}/test-utils/fake-plugin-outputs.d.ts +0 -0
- /package/dist/harnesses/impls/{claude-code-learner → learner}/test-utils/fake-plugin-outputs.js +0 -0
- /package/dist/harnesses/impls/{claude-code-learner → learner}/test-utils/noop-adapter.d.ts +0 -0
- /package/dist/harnesses/impls/{claude-code-learner → learner}/test-utils/noop-adapter.js +0 -0
- /package/dist/harnesses/impls/{claude-code-learner → learner}/types.js +0 -0
- /package/plugins/{claude-code-learner → learner}/.claude-plugin/plugin.json +0 -0
- /package/plugins/{claude-code-learner → learner}/.codex-plugin/plugin.json +0 -0
- /package/plugins/{claude-code-learner → learner}/AGENTS.md +0 -0
- /package/plugins/{claude-code-learner → learner}/CLAUDE.md +0 -0
- /package/plugins/{claude-code-learner → learner}/README.md +0 -0
- /package/plugins/{claude-code-learner → learner}/hooks/hooks.json +0 -0
- /package/plugins/{claude-code-learner → learner}/hooks/session-start +0 -0
- /package/plugins/{claude-code-learner → learner}/skills/learn/SKILL.md +0 -0
- /package/plugins/{claude-code-learner → learner}/skills/learn/analyst-prompt.md +0 -0
- /package/plugins/{claude-code-learner → learner}/skills/learn/consolidator-prompt.md +0 -0
- /package/plugins/{claude-code-learner → learner}/skills/learn/explorer-prompt.md +0 -0
- /package/plugins/{claude-code-learner → learner}/skills/learn/planner-prompt.md +0 -0
- /package/plugins/{claude-code-learner → learner}/skills/learn/promoter-prompt.md +0 -0
- /package/plugins/{claude-code-learner → learner}/skills/learn/step-worker-prompt.md +0 -0
- /package/plugins/{claude-code-learner → learner}/skills/learn/strategist-prompt.md +0 -0
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Per-task cost estimates for paid-API-key harnesses.
|
|
3
|
+
*
|
|
4
|
+
* Background — Issue #331 (Run-mode `feat`, P0 tier under release-feedback
|
|
5
|
+
* umbrella #328). The operator dashboard surfaces a harness/model selection
|
|
6
|
+
* at SolverNet-join time and again in Settings. Operators routing a paid
|
|
7
|
+
* API key (Anthropic, OpenAI, OpenRouter, Nous Portal) through the Hermes
|
|
8
|
+
* harness — or a "raw API key" Claude Code variant if we ever add one —
|
|
9
|
+
* have **no UI nudge** at join-time about per-task cost. The v0.1.6 dogfood
|
|
10
|
+
* surfaced the concrete worry: a first-run operator could pick Opus 4.7 +
|
|
11
|
+
* SWE-rebench v2 and burn $100s/hr before they figure out what Jinn does.
|
|
12
|
+
*
|
|
13
|
+
* This module captures the heuristic the SPA uses to render that estimate
|
|
14
|
+
* and to gate the Save & Join action when the estimate exceeds a
|
|
15
|
+
* configurable per-task threshold (default $1).
|
|
16
|
+
*
|
|
17
|
+
* Heuristic shape per the spec:
|
|
18
|
+
* per-1k-token rate × typical task length, by model id.
|
|
19
|
+
*
|
|
20
|
+
* Subscription harnesses (Claude Code, Codex) are flagged via
|
|
21
|
+
* `subscriptionPath: true` on the harness; in that case the surface shows
|
|
22
|
+
* "Included in subscription, no per-task API cost" and **does not** trigger
|
|
23
|
+
* the confirmation gate, regardless of the model selected.
|
|
24
|
+
*
|
|
25
|
+
* To add a new model: append an entry to `MODEL_COST_TABLE`. The id is the
|
|
26
|
+
* exact `model` string persisted to `joinedSolverNets[<cid>].model`. To
|
|
27
|
+
* shape a new harness: append to `HARNESS_BILLING`. Keep the units
|
|
28
|
+
* consistent: token counts in tokens, rates in USD-per-1k-tokens.
|
|
29
|
+
*
|
|
30
|
+
* Units note: Anthropic + OpenAI publish prices per million tokens; we
|
|
31
|
+
* convert to per-1k-tokens here so the multiplication reads as
|
|
32
|
+
* `(tokens / 1000) * pricePer1k`. Avoids floating-point surprises when the
|
|
33
|
+
* dashboard renders cents.
|
|
34
|
+
*
|
|
35
|
+
* Pricing references captured at the time of this commit (see PR body):
|
|
36
|
+
* - Anthropic Claude Opus 4.7: $15/M input, $75/M output (≈ $0.015 / 1k
|
|
37
|
+
* input, $0.075 / 1k output). Typical SWE-rebench v2 task estimated at
|
|
38
|
+
* ~50k input + 20k output → ~$2.25/task. Anthropic public pricing.
|
|
39
|
+
* - Anthropic Claude Sonnet 4.6: $3/M input, $15/M output.
|
|
40
|
+
* - OpenAI GPT-5.4: $1.25/M input, $10/M output (OpenAI public pricing).
|
|
41
|
+
* - OpenAI GPT-5.4 Mini: $0.25/M input, $2/M output.
|
|
42
|
+
*
|
|
43
|
+
* These are heuristics. Provider-API reconciliation (actual usage) is
|
|
44
|
+
* deferred to the P1 follow-up tracked in #331.
|
|
45
|
+
*/
|
|
46
|
+
import { CLAUDE_CODE_HARNESS, CODEX_HARNESS, HERMES_AGENT_HARNESS, canonicalHarnessName, } from './names.js';
|
|
47
|
+
/**
|
|
48
|
+
* Per-model cost entries. Keyed by the exact `model` id persisted to
|
|
49
|
+
* `joinedSolverNets[<cid>].model`. The dashboard model dropdown in
|
|
50
|
+
* `claudeModels.ts` is the source of truth for which ids appear here.
|
|
51
|
+
*/
|
|
52
|
+
export const MODEL_COST_TABLE = {
|
|
53
|
+
// ---------- Anthropic family (direct + via OpenRouter) ----------
|
|
54
|
+
'claude-opus-4-7': {
|
|
55
|
+
provider: 'anthropic',
|
|
56
|
+
inputPer1kTokens: 0.015,
|
|
57
|
+
outputPer1kTokens: 0.075,
|
|
58
|
+
typicalInputTokens: 50_000,
|
|
59
|
+
typicalOutputTokens: 20_000,
|
|
60
|
+
},
|
|
61
|
+
'claude-sonnet-4-6': {
|
|
62
|
+
provider: 'anthropic',
|
|
63
|
+
inputPer1kTokens: 0.003,
|
|
64
|
+
outputPer1kTokens: 0.015,
|
|
65
|
+
typicalInputTokens: 50_000,
|
|
66
|
+
typicalOutputTokens: 20_000,
|
|
67
|
+
},
|
|
68
|
+
'claude-haiku-4-5-20251001': {
|
|
69
|
+
provider: 'anthropic',
|
|
70
|
+
inputPer1kTokens: 0.001,
|
|
71
|
+
outputPer1kTokens: 0.005,
|
|
72
|
+
typicalInputTokens: 50_000,
|
|
73
|
+
typicalOutputTokens: 20_000,
|
|
74
|
+
},
|
|
75
|
+
// OpenRouter routing of the same families (Hermes harness uses these).
|
|
76
|
+
'anthropic/claude-opus-4.7': {
|
|
77
|
+
provider: 'openrouter',
|
|
78
|
+
inputPer1kTokens: 0.015,
|
|
79
|
+
outputPer1kTokens: 0.075,
|
|
80
|
+
typicalInputTokens: 50_000,
|
|
81
|
+
typicalOutputTokens: 20_000,
|
|
82
|
+
},
|
|
83
|
+
'anthropic/claude-sonnet-4.6': {
|
|
84
|
+
provider: 'openrouter',
|
|
85
|
+
inputPer1kTokens: 0.003,
|
|
86
|
+
outputPer1kTokens: 0.015,
|
|
87
|
+
typicalInputTokens: 50_000,
|
|
88
|
+
typicalOutputTokens: 20_000,
|
|
89
|
+
},
|
|
90
|
+
// ---------- OpenAI family ----------
|
|
91
|
+
'gpt-5.4': {
|
|
92
|
+
provider: 'openai',
|
|
93
|
+
inputPer1kTokens: 0.00125,
|
|
94
|
+
outputPer1kTokens: 0.01,
|
|
95
|
+
typicalInputTokens: 50_000,
|
|
96
|
+
typicalOutputTokens: 20_000,
|
|
97
|
+
},
|
|
98
|
+
'gpt-5.4-mini': {
|
|
99
|
+
provider: 'openai',
|
|
100
|
+
inputPer1kTokens: 0.00025,
|
|
101
|
+
outputPer1kTokens: 0.002,
|
|
102
|
+
typicalInputTokens: 50_000,
|
|
103
|
+
typicalOutputTokens: 20_000,
|
|
104
|
+
},
|
|
105
|
+
'gpt-5.5': {
|
|
106
|
+
provider: 'openai',
|
|
107
|
+
// Newer flagship; public pricing not confirmed at heuristic-capture
|
|
108
|
+
// time, so use Opus-4.7-class rates as a conservative upper bound
|
|
109
|
+
// until we get a verified figure.
|
|
110
|
+
inputPer1kTokens: 0.015,
|
|
111
|
+
outputPer1kTokens: 0.06,
|
|
112
|
+
typicalInputTokens: 50_000,
|
|
113
|
+
typicalOutputTokens: 20_000,
|
|
114
|
+
},
|
|
115
|
+
'gpt-5.3-codex': {
|
|
116
|
+
provider: 'openai',
|
|
117
|
+
inputPer1kTokens: 0.00125,
|
|
118
|
+
outputPer1kTokens: 0.01,
|
|
119
|
+
typicalInputTokens: 50_000,
|
|
120
|
+
typicalOutputTokens: 20_000,
|
|
121
|
+
},
|
|
122
|
+
'gpt-5.3-codex-spark': {
|
|
123
|
+
provider: 'openai',
|
|
124
|
+
inputPer1kTokens: 0.00125,
|
|
125
|
+
outputPer1kTokens: 0.01,
|
|
126
|
+
typicalInputTokens: 50_000,
|
|
127
|
+
typicalOutputTokens: 20_000,
|
|
128
|
+
},
|
|
129
|
+
// ---------- OpenRouter long-tail (Hermes) ----------
|
|
130
|
+
// These rates are coarse — OpenRouter's effective price depends on the
|
|
131
|
+
// route picked. We pick the published list-price upper bound so the
|
|
132
|
+
// estimate biases toward over-warning rather than under-warning.
|
|
133
|
+
'tencent/hy3-preview': {
|
|
134
|
+
provider: 'openrouter',
|
|
135
|
+
inputPer1kTokens: 0.003,
|
|
136
|
+
outputPer1kTokens: 0.015,
|
|
137
|
+
typicalInputTokens: 50_000,
|
|
138
|
+
typicalOutputTokens: 20_000,
|
|
139
|
+
},
|
|
140
|
+
'deepseek/deepseek-v4-pro': {
|
|
141
|
+
provider: 'openrouter',
|
|
142
|
+
inputPer1kTokens: 0.0014,
|
|
143
|
+
outputPer1kTokens: 0.0028,
|
|
144
|
+
typicalInputTokens: 50_000,
|
|
145
|
+
typicalOutputTokens: 20_000,
|
|
146
|
+
},
|
|
147
|
+
'deepseek/deepseek-v4-flash': {
|
|
148
|
+
provider: 'openrouter',
|
|
149
|
+
inputPer1kTokens: 0.0001,
|
|
150
|
+
outputPer1kTokens: 0.0004,
|
|
151
|
+
typicalInputTokens: 50_000,
|
|
152
|
+
typicalOutputTokens: 20_000,
|
|
153
|
+
},
|
|
154
|
+
'google/gemini-3.1-flash-lite': {
|
|
155
|
+
provider: 'openrouter',
|
|
156
|
+
inputPer1kTokens: 0.0001,
|
|
157
|
+
outputPer1kTokens: 0.0004,
|
|
158
|
+
typicalInputTokens: 50_000,
|
|
159
|
+
typicalOutputTokens: 20_000,
|
|
160
|
+
},
|
|
161
|
+
'moonshotai/kimi-k2.6': {
|
|
162
|
+
provider: 'openrouter',
|
|
163
|
+
inputPer1kTokens: 0.0006,
|
|
164
|
+
outputPer1kTokens: 0.0025,
|
|
165
|
+
typicalInputTokens: 50_000,
|
|
166
|
+
typicalOutputTokens: 20_000,
|
|
167
|
+
},
|
|
168
|
+
'openrouter/owl-alpha': {
|
|
169
|
+
provider: 'openrouter',
|
|
170
|
+
inputPer1kTokens: 0.002,
|
|
171
|
+
outputPer1kTokens: 0.008,
|
|
172
|
+
typicalInputTokens: 50_000,
|
|
173
|
+
typicalOutputTokens: 20_000,
|
|
174
|
+
},
|
|
175
|
+
'minimax/minimax-m2.7': {
|
|
176
|
+
provider: 'openrouter',
|
|
177
|
+
inputPer1kTokens: 0.0008,
|
|
178
|
+
outputPer1kTokens: 0.0032,
|
|
179
|
+
typicalInputTokens: 50_000,
|
|
180
|
+
typicalOutputTokens: 20_000,
|
|
181
|
+
},
|
|
182
|
+
'nousresearch/hermes-4-405b': {
|
|
183
|
+
provider: 'nous',
|
|
184
|
+
inputPer1kTokens: 0.0009,
|
|
185
|
+
outputPer1kTokens: 0.0009,
|
|
186
|
+
typicalInputTokens: 50_000,
|
|
187
|
+
typicalOutputTokens: 20_000,
|
|
188
|
+
},
|
|
189
|
+
};
|
|
190
|
+
/**
|
|
191
|
+
* Harness-level billing classification.
|
|
192
|
+
*
|
|
193
|
+
* `subscriptionPath: true` means the harness shells out to a
|
|
194
|
+
* subscription-billed CLI (Claude Code, Codex) and the operator does NOT
|
|
195
|
+
* incur per-task API charges — the cost surface is suppressed entirely
|
|
196
|
+
* and the confirmation gate is never triggered.
|
|
197
|
+
*
|
|
198
|
+
* `subscriptionPath: false` means the harness routes to a paid API key
|
|
199
|
+
* (Hermes via OpenRouter / Anthropic API / Nous Portal). The cost surface
|
|
200
|
+
* is shown and the gate fires above the configured threshold.
|
|
201
|
+
*/
|
|
202
|
+
export const HARNESS_BILLING = {
|
|
203
|
+
[CLAUDE_CODE_HARNESS]: { subscriptionPath: true },
|
|
204
|
+
[CODEX_HARNESS]: { subscriptionPath: true },
|
|
205
|
+
[HERMES_AGENT_HARNESS]: { subscriptionPath: false },
|
|
206
|
+
};
|
|
207
|
+
/** Default per-task USD threshold above which the confirmation gate fires. */
|
|
208
|
+
export const DEFAULT_HIGH_COST_THRESHOLD_USD = 1;
|
|
209
|
+
/**
|
|
210
|
+
* Compute the per-task cost estimate for a given model id. Returns `null`
|
|
211
|
+
* when the id has no entry in `MODEL_COST_TABLE` — callers should treat
|
|
212
|
+
* that as "unknown, don't surface a number" rather than rendering $0.
|
|
213
|
+
*/
|
|
214
|
+
export function estimateModelCost(modelId) {
|
|
215
|
+
const entry = MODEL_COST_TABLE[modelId];
|
|
216
|
+
if (!entry)
|
|
217
|
+
return null;
|
|
218
|
+
const inputUsd = (entry.typicalInputTokens / 1000) * entry.inputPer1kTokens;
|
|
219
|
+
const outputUsd = (entry.typicalOutputTokens / 1000) * entry.outputPer1kTokens;
|
|
220
|
+
return {
|
|
221
|
+
usd: inputUsd + outputUsd,
|
|
222
|
+
inputUsd,
|
|
223
|
+
outputUsd,
|
|
224
|
+
typicalInputTokens: entry.typicalInputTokens,
|
|
225
|
+
typicalOutputTokens: entry.typicalOutputTokens,
|
|
226
|
+
entry,
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* `true` when the harness routes through a paid API key. Subscription
|
|
231
|
+
* harnesses (Claude Code, Codex) return `false`; unknown harnesses
|
|
232
|
+
* conservatively return `true` so a misnamed harness doesn't silently
|
|
233
|
+
* skip the cost surface.
|
|
234
|
+
*/
|
|
235
|
+
export function harnessUsesPaidApiKey(harness) {
|
|
236
|
+
if (!harness)
|
|
237
|
+
return false;
|
|
238
|
+
const canonical = canonicalHarnessName(harness);
|
|
239
|
+
const billing = HARNESS_BILLING[canonical];
|
|
240
|
+
if (!billing)
|
|
241
|
+
return true;
|
|
242
|
+
return !billing.subscriptionPath;
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* Decide what the cost surface should render for a given harness + model
|
|
246
|
+
* combination, plus whether the confirmation gate fires.
|
|
247
|
+
*
|
|
248
|
+
* Defaults:
|
|
249
|
+
* - threshold: $1 / task (see DEFAULT_HIGH_COST_THRESHOLD_USD).
|
|
250
|
+
* - subscription harness → suppress surface + skip gate.
|
|
251
|
+
* - unknown model on a paid harness → show estimate slot (caller may
|
|
252
|
+
* render "estimate unavailable") but DO NOT trigger the gate.
|
|
253
|
+
*/
|
|
254
|
+
export function decideCostSurface(harness, modelId, thresholdUsd = DEFAULT_HIGH_COST_THRESHOLD_USD) {
|
|
255
|
+
if (!harnessUsesPaidApiKey(harness)) {
|
|
256
|
+
return {
|
|
257
|
+
showEstimate: false,
|
|
258
|
+
estimate: null,
|
|
259
|
+
requiresConfirmation: false,
|
|
260
|
+
suppressedReason: 'Included in subscription, no per-task API cost.',
|
|
261
|
+
};
|
|
262
|
+
}
|
|
263
|
+
const estimate = modelId ? estimateModelCost(modelId) : null;
|
|
264
|
+
const modelOverridesSubscription = estimate?.entry.subscriptionPath === true;
|
|
265
|
+
if (modelOverridesSubscription) {
|
|
266
|
+
return {
|
|
267
|
+
showEstimate: false,
|
|
268
|
+
estimate: null,
|
|
269
|
+
requiresConfirmation: false,
|
|
270
|
+
suppressedReason: 'Included in subscription, no per-task API cost.',
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
return {
|
|
274
|
+
showEstimate: true,
|
|
275
|
+
estimate,
|
|
276
|
+
requiresConfirmation: estimate !== null && estimate.usd > thresholdUsd,
|
|
277
|
+
suppressedReason: null,
|
|
278
|
+
};
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* Format a USD amount for compact display in the dashboard. Picks the
|
|
282
|
+
* smallest fraction count that still distinguishes the value from $0.
|
|
283
|
+
*/
|
|
284
|
+
export function formatUsd(amount) {
|
|
285
|
+
if (!Number.isFinite(amount))
|
|
286
|
+
return '—';
|
|
287
|
+
if (amount === 0)
|
|
288
|
+
return '$0';
|
|
289
|
+
if (amount < 0.01)
|
|
290
|
+
return `<$0.01`;
|
|
291
|
+
if (amount < 1)
|
|
292
|
+
return `$${amount.toFixed(2)}`;
|
|
293
|
+
if (amount < 10)
|
|
294
|
+
return `$${amount.toFixed(2)}`;
|
|
295
|
+
return `$${amount.toFixed(2)}`;
|
|
296
|
+
}
|
|
297
|
+
//# sourceMappingURL=cost-estimates.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cost-estimates.js","sourceRoot":"","sources":["../../src/harnesses/cost-estimates.ts"],"names":[],"mappings":"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"}
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import { TaskRunPersistence, type PersistedTaskRun, type PersistedTaskRunInput } from './persistence.js';
|
|
10
10
|
import type { Store } from '../../store/store.js';
|
|
11
|
+
import { type ReapWorkDirsReport } from './work-dir-reaper.js';
|
|
11
12
|
import { type PackagingDeps } from './packaging.js';
|
|
12
13
|
import { type EnvelopeAssemblyDeps } from './envelope-assembly.js';
|
|
13
14
|
import { type DeliveryDeps } from './delivery.js';
|
|
@@ -240,6 +241,28 @@ export interface TaskEngineOptions {
|
|
|
240
241
|
* Spec: docs/superpowers/specs/2026-05-06-agent-harness-solvernet-design.md §6.3
|
|
241
242
|
*/
|
|
242
243
|
harnessMode?: 'train' | 'frozen';
|
|
244
|
+
/**
|
|
245
|
+
* Working-directory reaper tuning (issue #320). Each task run provisions a
|
|
246
|
+
* heavy scratch directory under `paths.workingDirRoot`; without cleanup an
|
|
247
|
+
* operator accumulates hundreds of dirs / tens of GB. The engine reaps a
|
|
248
|
+
* task's directory once it reaches a terminal state (COMPLETE / FAILED),
|
|
249
|
+
* and periodically sweeps the root for crash-orphaned dirs.
|
|
250
|
+
*
|
|
251
|
+
* Optional — sensible defaults apply when absent.
|
|
252
|
+
*/
|
|
253
|
+
workDirReaper?: {
|
|
254
|
+
/**
|
|
255
|
+
* Age above which a directory with no DB row (orphaned by a crash or an
|
|
256
|
+
* older daemon) is removed. Defaults to {@link DEFAULT_ORPHAN_MAX_AGE_MS}
|
|
257
|
+
* (24h). Set to a large value to keep orphans for forensic inspection.
|
|
258
|
+
*/
|
|
259
|
+
orphanMaxAgeMs?: number;
|
|
260
|
+
/**
|
|
261
|
+
* Disable the reaper entirely (escape hatch for debugging a stuck task).
|
|
262
|
+
* Defaults to false — the reaper runs.
|
|
263
|
+
*/
|
|
264
|
+
disabled?: boolean;
|
|
265
|
+
};
|
|
243
266
|
}
|
|
244
267
|
/** Per-task outcome from a recovery pass. */
|
|
245
268
|
export interface RecoveryReport {
|
|
@@ -289,6 +312,11 @@ export declare class TaskEngine {
|
|
|
289
312
|
private stopped;
|
|
290
313
|
private stopResolve?;
|
|
291
314
|
private readonly stopPromise;
|
|
315
|
+
/** Working-dir reaper tuning (issue #320). */
|
|
316
|
+
protected readonly workDirReaperOpts: {
|
|
317
|
+
orphanMaxAgeMs: number;
|
|
318
|
+
disabled: boolean;
|
|
319
|
+
};
|
|
292
320
|
constructor(opts: TaskEngineOptions);
|
|
293
321
|
/**
|
|
294
322
|
* Called when an task is observed from an on-chain event.
|
|
@@ -320,6 +348,18 @@ export declare class TaskEngine {
|
|
|
320
348
|
* Errors from individual tasks are logged but do not stop the loop.
|
|
321
349
|
*/
|
|
322
350
|
tick(options?: TickOptions): Promise<void>;
|
|
351
|
+
/**
|
|
352
|
+
* Reap on-disk per-task working directories (issue #320).
|
|
353
|
+
*
|
|
354
|
+
* Removes the scratch directory of every task in a terminal state
|
|
355
|
+
* (COMPLETE / FAILED) and any crash-orphaned directory older than the
|
|
356
|
+
* configured max age. In-flight tasks are never touched. Safe to call at
|
|
357
|
+
* any time; never throws (filesystem errors are collected into the report).
|
|
358
|
+
*
|
|
359
|
+
* Called automatically every `tick()`; also exposed for the one-shot
|
|
360
|
+
* cleanup script and for tests.
|
|
361
|
+
*/
|
|
362
|
+
reapWorkDirsNow(): ReapWorkDirsReport;
|
|
323
363
|
/**
|
|
324
364
|
* Drive `tick()` on a fixed interval until `stop()` is called.
|
|
325
365
|
* Errors thrown by tick() itself are logged and do not stop the loop.
|
|
@@ -11,6 +11,7 @@ import { createHash, randomUUID } from 'node:crypto';
|
|
|
11
11
|
import { keccak256, toBytes } from 'viem';
|
|
12
12
|
import { TaskRunPersistence } from './persistence.js';
|
|
13
13
|
import { TaskRunState, MissingEvidenceHashError } from './state.js';
|
|
14
|
+
import { reapWorkDirs, DEFAULT_ORPHAN_MAX_AGE_MS, } from './work-dir-reaper.js';
|
|
14
15
|
import { provisionWorkingDir, provisionImplStateDir, walkArtifacts, uploadArtifacts, } from './packaging.js';
|
|
15
16
|
import { DONATION_ARTIFACT_ENCODING } from './artifact-scrub.js';
|
|
16
17
|
import { assembleAndSignEnvelope, } from './envelope-assembly.js';
|
|
@@ -109,6 +110,8 @@ export class TaskEngine {
|
|
|
109
110
|
stopPromise = new Promise((resolve) => {
|
|
110
111
|
this.stopResolve = resolve;
|
|
111
112
|
});
|
|
113
|
+
/** Working-dir reaper tuning (issue #320). */
|
|
114
|
+
workDirReaperOpts;
|
|
112
115
|
constructor(opts) {
|
|
113
116
|
this.persistence = new TaskRunPersistence(opts.store.db);
|
|
114
117
|
this.store = opts.store;
|
|
@@ -124,6 +127,10 @@ export class TaskEngine {
|
|
|
124
127
|
this.reputationFeedback = opts.reputationFeedback;
|
|
125
128
|
this.operatorConfig = opts.operatorConfig;
|
|
126
129
|
this.harnessMode = opts.harnessMode ?? 'train';
|
|
130
|
+
this.workDirReaperOpts = {
|
|
131
|
+
orphanMaxAgeMs: opts.workDirReaper?.orphanMaxAgeMs ?? DEFAULT_ORPHAN_MAX_AGE_MS,
|
|
132
|
+
disabled: opts.workDirReaper?.disabled ?? false,
|
|
133
|
+
};
|
|
127
134
|
}
|
|
128
135
|
// ── Public API ──────────────────────────────────────────────────────────────
|
|
129
136
|
/**
|
|
@@ -186,6 +193,10 @@ export class TaskEngine {
|
|
|
186
193
|
void processPromise.then((report) => this.logProcessReport('tick', report));
|
|
187
194
|
}
|
|
188
195
|
}
|
|
196
|
+
// Reap the working directories of tasks that have reached a terminal
|
|
197
|
+
// state. Cheap (one readdir + a few rmSync) and idempotent, so it runs
|
|
198
|
+
// every tick — there is no separate reaper loop to keep alive or crash.
|
|
199
|
+
this.reapWorkDirsNow();
|
|
189
200
|
if (!wait)
|
|
190
201
|
return;
|
|
191
202
|
const reports = await Promise.all(scheduled);
|
|
@@ -193,6 +204,41 @@ export class TaskEngine {
|
|
|
193
204
|
this.logProcessReport('tick', report);
|
|
194
205
|
}
|
|
195
206
|
}
|
|
207
|
+
/**
|
|
208
|
+
* Reap on-disk per-task working directories (issue #320).
|
|
209
|
+
*
|
|
210
|
+
* Removes the scratch directory of every task in a terminal state
|
|
211
|
+
* (COMPLETE / FAILED) and any crash-orphaned directory older than the
|
|
212
|
+
* configured max age. In-flight tasks are never touched. Safe to call at
|
|
213
|
+
* any time; never throws (filesystem errors are collected into the report).
|
|
214
|
+
*
|
|
215
|
+
* Called automatically every `tick()`; also exposed for the one-shot
|
|
216
|
+
* cleanup script and for tests.
|
|
217
|
+
*/
|
|
218
|
+
reapWorkDirsNow() {
|
|
219
|
+
const empty = { removed: [], protected: [], scanned: 0, errors: [] };
|
|
220
|
+
if (this.workDirReaperOpts.disabled)
|
|
221
|
+
return empty;
|
|
222
|
+
// Read the in-flight / terminal partition as a single atomic snapshot.
|
|
223
|
+
// Two separate queries would leave a TOCTOU window: a task transitioning
|
|
224
|
+
// DELIVERING → COMPLETE between the reads could be classified terminal and
|
|
225
|
+
// have its working directory deleted while deliver() still needs it.
|
|
226
|
+
const { terminal: terminalRequestIds, inFlight: inFlightRequestIds } = this.persistence.getReaperPartition();
|
|
227
|
+
const report = reapWorkDirs({
|
|
228
|
+
workingDirRoot: this.paths.workingDirRoot,
|
|
229
|
+
terminalRequestIds,
|
|
230
|
+
inFlightRequestIds,
|
|
231
|
+
orphanMaxAgeMs: this.workDirReaperOpts.orphanMaxAgeMs,
|
|
232
|
+
});
|
|
233
|
+
if (report.removed.length > 0) {
|
|
234
|
+
console.log(`[harness-engine] work-dir reaper removed ${report.removed.length} ` +
|
|
235
|
+
`terminal/orphaned task dir(s) under ${this.paths.workingDirRoot}`);
|
|
236
|
+
}
|
|
237
|
+
for (const e of report.errors) {
|
|
238
|
+
console.warn(`[harness-engine] work-dir reaper failed to remove ${e.requestId}: ${e.error}`);
|
|
239
|
+
}
|
|
240
|
+
return report;
|
|
241
|
+
}
|
|
196
242
|
/**
|
|
197
243
|
* Drive `tick()` on a fixed interval until `stop()` is called.
|
|
198
244
|
* Errors thrown by tick() itself are logged and do not stop the loop.
|
|
@@ -350,6 +396,7 @@ export class TaskEngine {
|
|
|
350
396
|
}
|
|
351
397
|
if (current.state === TaskRunState.DISCOVERED) {
|
|
352
398
|
this.persistence.transition(task.requestId, TaskRunState.CLAIMED);
|
|
399
|
+
console.log(`[harness-engine] ${task.requestId} DISCOVERED → CLAIMED`);
|
|
353
400
|
}
|
|
354
401
|
else {
|
|
355
402
|
console.log(`[harness-engine] ${task.requestId}: claim completed but state is already ${current.state}; skipping CLAIMED transition`);
|
|
@@ -818,6 +865,18 @@ export class TaskEngine {
|
|
|
818
865
|
console.warn(`[harness-engine] ${task.requestId}: failed to hydrate solutionOutputsJson: ${err instanceof Error ? err.message : err}`);
|
|
819
866
|
}
|
|
820
867
|
}
|
|
868
|
+
// jinn-mono-4tfq: SkippableError caught in RUNNING leaves a skip-marker
|
|
869
|
+
// Solution with no payload; short-circuit before envelope assembly.
|
|
870
|
+
// Runs BEFORE the deps guard — skipping needs nothing wired.
|
|
871
|
+
const earlyImplOutput = this.solutionOutputs.get(task.requestId);
|
|
872
|
+
const gatingClaim = earlyImplOutput?.gating;
|
|
873
|
+
if (gatingClaim?.['skipped'] === true) {
|
|
874
|
+
const reason = String(gatingClaim['reason'] ?? 'unknown');
|
|
875
|
+
const detail = String(earlyImplOutput?.informational?.['detail'] ?? '');
|
|
876
|
+
console.log(`[harness-engine] ${task.requestId}: PACKAGING short-circuited — impl was skipped (${reason})${detail ? `: ${detail}` : ''}`);
|
|
877
|
+
this.persistence.markFailed(task.requestId, `impl skipped: ${reason}${detail ? ` — ${detail}` : ''}`);
|
|
878
|
+
return;
|
|
879
|
+
}
|
|
821
880
|
if (!this.packagingDeps || !this.envelopeDeps) {
|
|
822
881
|
throw new NotImplementedError('pack');
|
|
823
882
|
}
|
|
@@ -911,9 +970,9 @@ export class TaskEngine {
|
|
|
911
970
|
// Record payload so validatePayload does not reject the output.
|
|
912
971
|
const solverType = task.solverType ?? 'legacy.v0';
|
|
913
972
|
// Derive role from Task.role. Evaluator tasks produce 'verdict' envelopes;
|
|
914
|
-
// all other tasks produce '
|
|
973
|
+
// all other tasks produce 'solution' envelopes.
|
|
915
974
|
const isEvaluation = task.taskRole === 'evaluation';
|
|
916
|
-
const role = isEvaluation ? 'verdict' : '
|
|
975
|
+
const role = isEvaluation ? 'verdict' : 'solution';
|
|
917
976
|
let envelopePayload;
|
|
918
977
|
if (isEvaluation) {
|
|
919
978
|
// ── Verdict envelope payload ──────────────────────────────────────────────
|
|
@@ -926,7 +985,7 @@ export class TaskEngine {
|
|
|
926
985
|
// with a wrong shape — validatePayload will catch schema mismatches.
|
|
927
986
|
//
|
|
928
987
|
// verificationOfRestoration: stubbed — Plan D will connect the real SDK.
|
|
929
|
-
//
|
|
988
|
+
// solutionEnvelope.sha256: placeholder — Plan D wires real sha256 derivation.
|
|
930
989
|
const verdictPayload = implOutput?.verdictPayload;
|
|
931
990
|
if (!verdictPayload) {
|
|
932
991
|
throw new Error(`pack: evaluator impl for ${task.requestId} did not produce verdictPayload on Solution; ` +
|
|
@@ -1471,13 +1530,15 @@ export class TaskEngine {
|
|
|
1471
1530
|
* throws, the task is marked FAILED with the error message.
|
|
1472
1531
|
*/
|
|
1473
1532
|
async _runTransition(task, fn) {
|
|
1474
|
-
|
|
1533
|
+
// Each transition method (claim, takePreSnapshot, runImpl, pack, deliver)
|
|
1534
|
+
// logs its own domain-specific line on success (e.g. with manifestCid,
|
|
1535
|
+
// deliveryTx, impl name). We deliberately don't emit a generic
|
|
1536
|
+
// `oldState → newState` line here: doing so produced duplicate
|
|
1537
|
+
// transition lines in the operator log (jinn-mono-kzan). On failure,
|
|
1538
|
+
// the catch below marks the task FAILED and rethrows so the caller can
|
|
1539
|
+
// surface the error.
|
|
1475
1540
|
try {
|
|
1476
1541
|
await fn();
|
|
1477
|
-
const updated = this.persistence.getByRequestId(task.requestId);
|
|
1478
|
-
if (updated && updated.state !== oldState) {
|
|
1479
|
-
console.log(`[harness-engine] ${task.requestId} ${oldState} → ${updated.state}`);
|
|
1480
|
-
}
|
|
1481
1542
|
}
|
|
1482
1543
|
catch (err) {
|
|
1483
1544
|
const reason = err instanceof Error ? err.message : String(err);
|