@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
package/dist/main.js
CHANGED
|
@@ -26,7 +26,9 @@ import { dirname, join } from 'node:path';
|
|
|
26
26
|
import { fileURLToPath } from 'node:url';
|
|
27
27
|
import { loadConfig, getConfigPathFromArgs, DEFAULT_CONFIG_PATH } from './config.js';
|
|
28
28
|
import { Store } from './store/store.js';
|
|
29
|
-
import { startApiServer } from './api/server.js';
|
|
29
|
+
import { startApiServer, isEmbeddedAgentEnabled } from './api/server.js';
|
|
30
|
+
// addHarnessReadinessRoutes is wired through startApiServer's holder ref now
|
|
31
|
+
// (jinn-mono-u34i). No direct import needed.
|
|
30
32
|
import { CapturePublishUnavailableError } from './api/captures.js';
|
|
31
33
|
import { invalidatePredictionOperatorStatusCache } from './api/gather-status.js';
|
|
32
34
|
import { ensureUiToken } from './api/ui-token.js';
|
|
@@ -34,14 +36,11 @@ import { hashImplStateDir } from './harnesses/freeze.js';
|
|
|
34
36
|
import { readModeState } from './harnesses/mode-state.js';
|
|
35
37
|
import { attachAgentWs, updateAgentClaudePath } from './agent/agent-ws.js';
|
|
36
38
|
import { createSetupModeController } from './setup-mode.js';
|
|
39
|
+
import { requestDaemonRestart } from './restart-daemon.js';
|
|
37
40
|
import { buildEnvelope, emitEnvelope } from './errors/envelope.js';
|
|
38
41
|
import { clearBootstrapError, persistBootstrapError, } from './errors/persisted-bootstrap-error.js';
|
|
39
42
|
import { emitStructured } from './events/emitter.js';
|
|
40
|
-
import {
|
|
41
|
-
import { emitClaudeBinaryPreflightFailure } from './preflight/claude-invocation-envelope.js';
|
|
42
|
-
import { detectAuthContext, probeClaudeAuth } from './preflight/claude-auth.js';
|
|
43
|
-
import { configRequiresClaudeAuth } from './preflight/claude-required.js';
|
|
44
|
-
import { FleetBootstrapper } from './earning/bootstrap.js';
|
|
43
|
+
import { FleetBootstrapper, recoverEvictedService as recoverEvictedServiceFn } from './earning/bootstrap.js';
|
|
45
44
|
import { DEFAULT_TESTNET_ARTIFACTS, applyChainGasOverrides, getChainConfig, loadJinnMviConfig } from './earning/contracts.js';
|
|
46
45
|
import { runLegacyAgentIdMigration } from './earning/migrate-agent-id.js';
|
|
47
46
|
import { FleetStateStore } from './earning/store.js';
|
|
@@ -57,7 +56,8 @@ import { DEFAULT_DISABLED_HARNESSES, DEFAULT_HARNESS, HarnessRegistry, } from '.
|
|
|
57
56
|
import { joinedSolverNetsViewFromConfig } from './harnesses/engine/engine.js';
|
|
58
57
|
import { buildHarnesses } from './harnesses/impls/index.js';
|
|
59
58
|
import { loadExternalImpl } from './harnesses/external-impls/index.js';
|
|
60
|
-
import { CLAUDE_CODE_HARNESS, CODEX_HARNESS, harnessStateDirName } from './harnesses/names.js';
|
|
59
|
+
import { CLAUDE_CODE_HARNESS, CODEX_HARNESS, HERMES_AGENT_HARNESS, harnessStateDirName } from './harnesses/names.js';
|
|
60
|
+
import { HarnessReadinessRegistry } from './harnesses/readiness-registry.js';
|
|
61
61
|
import { createClients } from './adapters/mech/safe.js';
|
|
62
62
|
import { loadSolverNets } from './solver-nets/registry.js';
|
|
63
63
|
import { createCorpus } from './corpus/index.js';
|
|
@@ -81,6 +81,7 @@ import { GeneratedTaskSource, StaticConfiguredTaskSource } from './tasks/sources
|
|
|
81
81
|
import { checkRpcNetwork, logRpcLocalDevToStderr, rpcNetworkFailureHint } from './preflight/rpc-network.js';
|
|
82
82
|
import { apiPortFailureMessage, checkApiPortAvailable } from './preflight/api-port.js';
|
|
83
83
|
import { openBrowser } from './cli/open-browser.js';
|
|
84
|
+
import { keepSetupUiOnBootstrapError } from './setup/halt-mode.js';
|
|
84
85
|
if (process.env['JINN_LOAD_DEV_ENV'] === '1' || process.env['NODE_ENV'] === 'development') {
|
|
85
86
|
dotenvConfig({ path: join(dirname(fileURLToPath(import.meta.url)), '..', '.env') });
|
|
86
87
|
}
|
|
@@ -133,8 +134,19 @@ const config = loadConfig(CONFIG_PATH);
|
|
|
133
134
|
if (config.network === 'mainnet' && process.env['JINN_ENABLE_MAINNET'] !== '1') {
|
|
134
135
|
console.warn('[main] Mainnet is disabled before launch; using testnet defaults.');
|
|
135
136
|
config.network = 'testnet';
|
|
136
|
-
config.rpcUrl = 'https://sepolia.
|
|
137
|
+
config.rpcUrl = 'https://base-sepolia.gateway.tenderly.co/75tyLMQuD8EHpXxMwINIKu';
|
|
137
138
|
}
|
|
139
|
+
// Issue #326: the embedded Claude agent chat surface (right rail + onboarding
|
|
140
|
+
// "Ask Claude" panel + /api/agent/ws bridge) is hidden by default while its
|
|
141
|
+
// action-authority / plugin-scope shape is still in design. Set
|
|
142
|
+
// `JINN_ENABLE_EMBEDDED_AGENT=1` to re-enable it for development. This does
|
|
143
|
+
// NOT affect Claude-Code-as-a-solver-harness — that path is independent.
|
|
144
|
+
//
|
|
145
|
+
// Issue #367: the SPA reads this flag via the injected `window.__JINN_FEATURES__`
|
|
146
|
+
// (`resolveFeatureFlags` in api/server.ts) like every other operator-app flag.
|
|
147
|
+
// This `embeddedAgentEnabled` const is the daemon-side consumer only — it gates
|
|
148
|
+
// whether the `/api/agent/ws` bridge is mounted below.
|
|
149
|
+
const embeddedAgentEnabled = isEmbeddedAgentEnabled();
|
|
138
150
|
let activeClaudePath = config.claudePath ?? 'claude';
|
|
139
151
|
const selectClaudePath = (claudePath) => {
|
|
140
152
|
activeClaudePath = claudePath;
|
|
@@ -442,7 +454,7 @@ async function bootstrap() {
|
|
|
442
454
|
};
|
|
443
455
|
// eslint-disable-next-line no-constant-condition
|
|
444
456
|
while (true) {
|
|
445
|
-
result = await bootstrapper.
|
|
457
|
+
result = await bootstrapper.ensureStage1And2(PASSWORD);
|
|
446
458
|
if (!result.funding) {
|
|
447
459
|
clearFundingGate();
|
|
448
460
|
break;
|
|
@@ -485,11 +497,17 @@ async function bootstrap() {
|
|
|
485
497
|
hint: 'Fund the listed address and re-run this command.',
|
|
486
498
|
exampleCli: 'jinn fund-requirements --json',
|
|
487
499
|
details: {
|
|
488
|
-
|
|
500
|
+
// jinn-mono-hjex.6: structured envelope so SPA can render the
|
|
501
|
+
// specific address + amount instead of a prose disjunction.
|
|
502
|
+
category: 'insufficient_funds',
|
|
503
|
+
step: 'awaiting_funding',
|
|
489
504
|
address: result.funding.master_address,
|
|
505
|
+
requiredWei: result.funding.eth_required,
|
|
506
|
+
haveWei: result.funding.eth_balance,
|
|
507
|
+
// Legacy aliases kept for any external consumers that read these.
|
|
508
|
+
role: 'master',
|
|
490
509
|
asset: 'native',
|
|
491
510
|
needWei: result.funding.eth_required,
|
|
492
|
-
haveWei: result.funding.eth_balance,
|
|
493
511
|
},
|
|
494
512
|
});
|
|
495
513
|
}
|
|
@@ -504,11 +522,17 @@ async function bootstrap() {
|
|
|
504
522
|
hint: 'Bootstrap failed before the fleet reached a runnable state.',
|
|
505
523
|
details: {
|
|
506
524
|
cause: result.message,
|
|
525
|
+
// jinn-mono-hjex.6: propagate structured category from the bootstrapper
|
|
526
|
+
// so the SPA can render category-specific UI (e.g. funding shortfall).
|
|
527
|
+
...(result.errorCategory !== undefined ? { category: result.errorCategory } : {}),
|
|
507
528
|
// Preserve the raw underlying error so a misclassified summary can
|
|
508
529
|
// be diagnosed without re-running with JINN_DEBUG. See jinn-mono-jz9f.
|
|
509
530
|
...(result.rawErrorMessage && result.rawErrorMessage !== result.message
|
|
510
531
|
? { rawErrorMessage: result.rawErrorMessage }
|
|
511
532
|
: {}),
|
|
533
|
+
// jinn-mono-hjex reviewer fix: propagate tx hash so the SPA can render
|
|
534
|
+
// a block-explorer link for failed on-chain revert transactions.
|
|
535
|
+
...(result.txHash != null ? { txHash: result.txHash } : {}),
|
|
512
536
|
},
|
|
513
537
|
});
|
|
514
538
|
}
|
|
@@ -593,7 +617,9 @@ class SetupBootstrapHalted extends Error {
|
|
|
593
617
|
this.name = 'SetupBootstrapHalted';
|
|
594
618
|
}
|
|
595
619
|
}
|
|
596
|
-
|
|
620
|
+
// hjex.6: gate for the halt-and-resume loop. Lives in ./setup/halt-mode.ts
|
|
621
|
+
// so it can be unit-tested without dragging main.ts's top-level side
|
|
622
|
+
// effects (password resolution, config load) into the test.
|
|
597
623
|
// ── Main ────────────────────────────────────────────────────────────────────
|
|
598
624
|
/**
|
|
599
625
|
* --json-progress: emit NDJSON progress envelopes on stdout during long
|
|
@@ -744,6 +770,34 @@ export async function main() {
|
|
|
744
770
|
// on first request); subsystem init below populates `holder.current` and
|
|
745
771
|
// the route handlers dereference it per-request.
|
|
746
772
|
const solverNetEndpointsDepsHolder = { current: undefined };
|
|
773
|
+
// jinn-mono-u34i: same pattern for the harness readiness registry. The
|
|
774
|
+
// registry is built post-bootstrap (depends on the keystore being
|
|
775
|
+
// available), but the routes must be registered at server start to land in
|
|
776
|
+
// Hono's matcher before the panel's first poll. Late-mounting via
|
|
777
|
+
// `addHarnessReadinessRoutes(setupApiServer.app, ...)` after the panel had
|
|
778
|
+
// been polling for minutes threw "Can not add a route since the matcher is
|
|
779
|
+
// already built" and crashed the daemon on the running-mode transition.
|
|
780
|
+
const harnessReadinessRegistryHolder = { current: undefined };
|
|
781
|
+
// jinn-mono-u34i: same eager-register / late-populate pattern for the
|
|
782
|
+
// DiscoveryAPI. Pre-fix, /v1/discovery/* routes only mounted when
|
|
783
|
+
// `config.discovery` was set at startApiServer time — but main.ts builds
|
|
784
|
+
// `sharedDiscoveryApi` post-bootstrap, so the routes were never registered
|
|
785
|
+
// and the panel's /build page got a permanent 404 on plugin-publications +
|
|
786
|
+
// builder-artifacts. Holder ref lets the routes register eagerly and
|
|
787
|
+
// start returning real data the moment main.ts assigns holder.current.
|
|
788
|
+
const discoveryApiHolder = { current: undefined };
|
|
789
|
+
// hjex.3: holder for the restake callback. Populated in running mode after
|
|
790
|
+
// bootstrap completes (when mnemonic + distributorAddress are available).
|
|
791
|
+
const restakeCallbackRef = {
|
|
792
|
+
current: undefined,
|
|
793
|
+
};
|
|
794
|
+
// hjex.6: retry signal for the bootstrap halt-and-resume loop.
|
|
795
|
+
// When a SetupBootstrapHalted is caught (fatal non-funding error or funding
|
|
796
|
+
// timeout), main() waits on this promise instead of returning, so the setup
|
|
797
|
+
// API stays alive and the operator can click Retry in the SPA.
|
|
798
|
+
// The retry endpoint resolves this promise to trigger a re-run.
|
|
799
|
+
let retryBootstrapResolve = null;
|
|
800
|
+
let retryBootstrapReject = null;
|
|
747
801
|
let setupApiServer;
|
|
748
802
|
try {
|
|
749
803
|
setupApiServer = await startApiServer({
|
|
@@ -753,11 +807,21 @@ export async function main() {
|
|
|
753
807
|
bindHost: apiBindHost,
|
|
754
808
|
corpus: () => corpusForApi,
|
|
755
809
|
ui: { token: uiToken, handshakeKey },
|
|
810
|
+
hermesDoctor: {
|
|
811
|
+
hermesPath: config.hermesPath,
|
|
812
|
+
hermesDoctorTimeoutMs: config.hermesDoctorTimeoutMs,
|
|
813
|
+
},
|
|
814
|
+
codexDoctor: {
|
|
815
|
+
codexPath: config.codexPath,
|
|
816
|
+
codexDoctorTimeoutMs: config.codexDoctorTimeoutMs,
|
|
817
|
+
},
|
|
756
818
|
admin: {
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
819
|
+
// jinn-mono #289: in interactive mode (the dashboard SPA case),
|
|
820
|
+
// spawn a detached replacement before exiting so the panel reconnects
|
|
821
|
+
// to a live daemon instead of seeing a 502 + terminal prompt. In
|
|
822
|
+
// headless mode (`JINN_NO_UI=1`), exit without respawning so the
|
|
823
|
+
// supervisor / systemd / docker entrypoint decides what to do.
|
|
824
|
+
onRestartRequested: () => requestDaemonRestart(),
|
|
761
825
|
},
|
|
762
826
|
harnessStatus: {
|
|
763
827
|
getStatus: async () => {
|
|
@@ -840,7 +904,12 @@ export async function main() {
|
|
|
840
904
|
contract: { id: 'swe-rebench-v2', version: 'v1' },
|
|
841
905
|
state: 'live',
|
|
842
906
|
supportedRoles: ['solving', 'evaluating'],
|
|
907
|
+
// Order matters: the dashboard pre-selects compatibleHarnesses[0]
|
|
908
|
+
// as the default solver harness. Hermes Agent is the SWE-rebench v2
|
|
909
|
+
// default per the 2026-05-12 decision (jinn-mono-8psp.2 / spec §10);
|
|
910
|
+
// operators may switch to Claude Code or Codex.
|
|
843
911
|
compatibleHarnesses: [
|
|
912
|
+
{ name: HERMES_AGENT_HARNESS, version: '0.1.0', supportsRoles: ['solving'] },
|
|
844
913
|
{ name: CLAUDE_CODE_HARNESS, version: '0.1.0', supportsRoles: ['solving'] },
|
|
845
914
|
{ name: CODEX_HARNESS, version: '0.1.0', supportsRoles: ['solving'] },
|
|
846
915
|
{ name: 'swe-rebench-v2-evaluator', version: '0.1.0', supportsRoles: ['evaluating'] },
|
|
@@ -856,6 +925,12 @@ export async function main() {
|
|
|
856
925
|
// eagerly here; deps are populated by main.ts post-bootstrap via the
|
|
857
926
|
// holder, and each route handler reads `holder.current` per-request.
|
|
858
927
|
solverNetsLauncher: { holder: solverNetEndpointsDepsHolder },
|
|
928
|
+
// jinn-mono-u34i: same eager-register / late-populate pattern for the
|
|
929
|
+
// harness readiness routes. Until main.ts sets the holder, requests
|
|
930
|
+
// return 503 subsystem_not_ready (the panel handles that gracefully).
|
|
931
|
+
harnessReadinessRegistry: { holder: harnessReadinessRegistryHolder },
|
|
932
|
+
// jinn-mono-u34i: see discoveryApiHolder comment above.
|
|
933
|
+
discovery: { holder: discoveryApiHolder },
|
|
859
934
|
// Agent-binding retry: re-run the ERC-1271 bind step from the SPA
|
|
860
935
|
// without forcing a daemon restart. Constructs a fresh bootstrapper
|
|
861
936
|
// per call so we don't tangle lifecycle with the long-running one.
|
|
@@ -907,7 +982,17 @@ export async function main() {
|
|
|
907
982
|
earningDir: config.earningDir,
|
|
908
983
|
chain: NETWORK_CHAIN,
|
|
909
984
|
rpcUrl: config.rpcUrl,
|
|
910
|
-
|
|
985
|
+
// Note: do NOT pass minEoaGasWei here. setup-endpoints.ts derives
|
|
986
|
+
// its faucet target from stage1MinMasterEth(getChainConfig(chain),
|
|
987
|
+
// targetServices) — the same helper the daemon's ensureStage1 gate
|
|
988
|
+
// uses. Passing a computed value from here would re-introduce the
|
|
989
|
+
// drift seam that hit operators in the 2026-05-18 canary
|
|
990
|
+
// (jinn-mono-u34i): faucet dripped to one target while the daemon
|
|
991
|
+
// waited for a different one. The override field remains for tests
|
|
992
|
+
// that want a custom target.
|
|
993
|
+
// targetServices DOES need to flow through so the faucet drips enough
|
|
994
|
+
// ETH to cover ALL services for the operator's chosen targetServices.
|
|
995
|
+
targetServices: config.targetServices,
|
|
911
996
|
claudePath: activeClaudePath,
|
|
912
997
|
getClaudePath: () => activeClaudePath,
|
|
913
998
|
configPath: CONFIG_PATH ?? DEFAULT_CONFIG_PATH,
|
|
@@ -922,6 +1007,30 @@ export async function main() {
|
|
|
922
1007
|
// toggle immediately. (jinn-mono-l2zl.15.4.12)
|
|
923
1008
|
invalidatePredictionOperatorStatusCache(config);
|
|
924
1009
|
},
|
|
1010
|
+
// hjex.3: delegate to the live callback populated once running mode starts.
|
|
1011
|
+
restake: (serviceId) => {
|
|
1012
|
+
if (!restakeCallbackRef.current) {
|
|
1013
|
+
return Promise.resolve({ ok: false, error: 'restake_not_available_in_setup_mode' });
|
|
1014
|
+
}
|
|
1015
|
+
return restakeCallbackRef.current(serviceId);
|
|
1016
|
+
},
|
|
1017
|
+
// hjex.6: re-trigger the bootstrap state machine from the SPA Retry button.
|
|
1018
|
+
// Resolves the halt-and-resume promise; main() will loop back and call
|
|
1019
|
+
// bootstrap() again. Rejects if the daemon is not currently halted.
|
|
1020
|
+
retryBootstrap: () => {
|
|
1021
|
+
return new Promise((resolve, reject) => {
|
|
1022
|
+
if (!retryBootstrapResolve) {
|
|
1023
|
+
reject(new Error('daemon_not_halted'));
|
|
1024
|
+
return;
|
|
1025
|
+
}
|
|
1026
|
+
const prevResolve = retryBootstrapResolve;
|
|
1027
|
+
// The resolve will unblock the main loop's await. When bootstrap
|
|
1028
|
+
// completes (success or new halt), the caller receives the result
|
|
1029
|
+
// via the /v1/bootstrap polling endpoint.
|
|
1030
|
+
prevResolve();
|
|
1031
|
+
resolve();
|
|
1032
|
+
});
|
|
1033
|
+
},
|
|
925
1034
|
},
|
|
926
1035
|
status: {
|
|
927
1036
|
earningDir: config.earningDir,
|
|
@@ -1074,30 +1183,41 @@ export async function main() {
|
|
|
1074
1183
|
// can attach to a long-lived embedded `claude` subprocess. The embedded
|
|
1075
1184
|
// session reads MCP config we materialise to disk so it can reach the
|
|
1076
1185
|
// operator MCP server (`jinn mcp`) for tool calls.
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1186
|
+
//
|
|
1187
|
+
// Issue #326: the embedded agent chat surface is hidden by default. The WS
|
|
1188
|
+
// bridge mounts only when `JINN_ENABLE_EMBEDDED_AGENT=1` so the dev-time
|
|
1189
|
+
// path stays end-to-end; with the flag off there is no /api/agent/ws route
|
|
1190
|
+
// and the SPA never renders the chat panel. Claude-Code-as-solver-harness
|
|
1191
|
+
// is independent of this bridge and unaffected.
|
|
1192
|
+
if (embeddedAgentEnabled) {
|
|
1193
|
+
const operatorMcpConfigPath = join(homedir(), '.jinn-client', 'operator-mcp-config.json');
|
|
1194
|
+
try {
|
|
1195
|
+
mkdirSync(dirname(operatorMcpConfigPath), { recursive: true });
|
|
1196
|
+
writeFileSyncMain(operatorMcpConfigPath, JSON.stringify({
|
|
1197
|
+
mcpServers: {
|
|
1198
|
+
'jinn-operator': {
|
|
1199
|
+
command: 'jinn',
|
|
1200
|
+
args: ['mcp'],
|
|
1201
|
+
},
|
|
1085
1202
|
},
|
|
1086
|
-
},
|
|
1087
|
-
}
|
|
1203
|
+
}, null, 2));
|
|
1204
|
+
}
|
|
1205
|
+
catch (err) {
|
|
1206
|
+
console.warn(`[main] Failed to write operator MCP config at ${operatorMcpConfigPath}: ` +
|
|
1207
|
+
(err instanceof Error ? err.message : String(err)));
|
|
1208
|
+
}
|
|
1209
|
+
attachAgentWs({
|
|
1210
|
+
httpServer: setupApiServer.server,
|
|
1211
|
+
uiToken,
|
|
1212
|
+
claudePath: activeClaudePath,
|
|
1213
|
+
cwd: process.cwd(),
|
|
1214
|
+
mcpConfigPath: operatorMcpConfigPath,
|
|
1215
|
+
});
|
|
1216
|
+
console.log(`[main] Agent WS bridge mounted at ws://127.0.0.1:${setupApiServer.port}/api/agent/ws`);
|
|
1088
1217
|
}
|
|
1089
|
-
|
|
1090
|
-
console.
|
|
1091
|
-
(err instanceof Error ? err.message : String(err)));
|
|
1218
|
+
else {
|
|
1219
|
+
console.log('[main] Embedded agent surface disabled (set JINN_ENABLE_EMBEDDED_AGENT=1 to enable).');
|
|
1092
1220
|
}
|
|
1093
|
-
attachAgentWs({
|
|
1094
|
-
httpServer: setupApiServer.server,
|
|
1095
|
-
uiToken,
|
|
1096
|
-
claudePath: activeClaudePath,
|
|
1097
|
-
cwd: process.cwd(),
|
|
1098
|
-
mcpConfigPath: operatorMcpConfigPath,
|
|
1099
|
-
});
|
|
1100
|
-
console.log(`[main] Agent WS bridge mounted at ws://127.0.0.1:${setupApiServer.port}/api/agent/ws`);
|
|
1101
1221
|
// ── Init-if-missing ──────────────────────────────────────────────────────
|
|
1102
1222
|
// If the keystore is missing but we have a password, run `jinn init` now so
|
|
1103
1223
|
// bootstrap has something to decrypt. Idempotent: init is a no-op when the
|
|
@@ -1138,30 +1258,96 @@ export async function main() {
|
|
|
1138
1258
|
// keystore is on disk and we're transitioning into bootstrap.
|
|
1139
1259
|
setupController.refresh({ keystoreExists: true, allComplete: false });
|
|
1140
1260
|
}
|
|
1261
|
+
// hjex.6: halt-and-resume loop for bootstrap retries.
|
|
1262
|
+
// When failBootstrap() throws SetupBootstrapHalted, we wait for the operator
|
|
1263
|
+
// to click Retry in the SPA (which resolves retryBootstrapResolve) rather
|
|
1264
|
+
// than returning and exiting. On each retry, we loop back and call bootstrap()
|
|
1265
|
+
// again. bootstrap() is idempotent — completed steps are no-ops.
|
|
1141
1266
|
let bootstrapResult;
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1267
|
+
// eslint-disable-next-line no-constant-condition
|
|
1268
|
+
while (true) {
|
|
1269
|
+
try {
|
|
1270
|
+
bootstrapResult = await bootstrap();
|
|
1271
|
+
break; // success — exit the retry loop
|
|
1272
|
+
}
|
|
1273
|
+
catch (err) {
|
|
1274
|
+
if (err instanceof SetupBootstrapHalted) {
|
|
1275
|
+
// Install the retry signal so the endpoint can unblock us.
|
|
1276
|
+
const retrySignal = new Promise((resolve, reject) => {
|
|
1277
|
+
retryBootstrapResolve = resolve;
|
|
1278
|
+
retryBootstrapReject = reject;
|
|
1279
|
+
});
|
|
1280
|
+
console.log('[main] Bootstrap halted. Waiting for retry signal from the dashboard...');
|
|
1281
|
+
// hjex.6: Auto-resume funding poller.
|
|
1282
|
+
// When the halt is a funding shortfall, poll the master EOA balance
|
|
1283
|
+
// every JINN_FUNDING_POLL_INTERVAL_MS (default 15s). When the balance
|
|
1284
|
+
// meets or exceeds the required amount, auto-signal the retry loop.
|
|
1285
|
+
// Only runs while the halt signal is pending; stops on any signal.
|
|
1286
|
+
let fundingPollHandle = null;
|
|
1287
|
+
const isHaltedOnFunding = err.envelope.code === 'funding_required';
|
|
1288
|
+
const haltDetails = err.envelope.details;
|
|
1289
|
+
const haltAddress = typeof haltDetails?.['address'] === 'string'
|
|
1290
|
+
? haltDetails['address']
|
|
1291
|
+
: null;
|
|
1292
|
+
const haltRequired = typeof haltDetails?.['requiredWei'] === 'string'
|
|
1293
|
+
? BigInt(haltDetails['requiredWei'])
|
|
1294
|
+
: typeof haltDetails?.['needWei'] === 'string'
|
|
1295
|
+
? BigInt(haltDetails['needWei'])
|
|
1296
|
+
: null;
|
|
1297
|
+
const fundingPollIntervalMs = (() => {
|
|
1298
|
+
const raw = process.env['JINN_FUNDING_POLL_INTERVAL_MS'];
|
|
1299
|
+
if (!raw)
|
|
1300
|
+
return 15_000;
|
|
1301
|
+
const n = Number.parseInt(raw, 10);
|
|
1302
|
+
return Number.isFinite(n) && n > 0 ? n : 15_000;
|
|
1303
|
+
})();
|
|
1304
|
+
if (isHaltedOnFunding && haltAddress && haltRequired !== null) {
|
|
1305
|
+
const publicClient = createJinnPublicClient(config.rpcUrl, NETWORK_CHAIN);
|
|
1306
|
+
const schedulePoll = () => {
|
|
1307
|
+
fundingPollHandle = setTimeout(async () => {
|
|
1308
|
+
// Guard: if the signal was already fired, stop polling.
|
|
1309
|
+
if (!retryBootstrapResolve)
|
|
1310
|
+
return;
|
|
1311
|
+
try {
|
|
1312
|
+
const balance = await publicClient.getBalance({ address: haltAddress });
|
|
1313
|
+
if (balance >= haltRequired) {
|
|
1314
|
+
console.log(`[main] Funding shortfall cleared (have ${balance}, required ${haltRequired}). ` +
|
|
1315
|
+
`Auto-resuming bootstrap...`);
|
|
1316
|
+
retryBootstrapResolve?.();
|
|
1317
|
+
return; // don't schedule the next poll
|
|
1318
|
+
}
|
|
1319
|
+
}
|
|
1320
|
+
catch (pollErr) {
|
|
1321
|
+
// Balance read failed — not fatal, just skip this tick.
|
|
1322
|
+
const msg = pollErr instanceof Error ? pollErr.message : String(pollErr);
|
|
1323
|
+
console.log(`[main] Funding poller balance read failed (will retry): ${msg}`);
|
|
1324
|
+
}
|
|
1325
|
+
schedulePoll(); // reschedule
|
|
1326
|
+
}, fundingPollIntervalMs);
|
|
1327
|
+
};
|
|
1328
|
+
schedulePoll();
|
|
1329
|
+
}
|
|
1330
|
+
try {
|
|
1331
|
+
await retrySignal;
|
|
1332
|
+
}
|
|
1333
|
+
finally {
|
|
1334
|
+
retryBootstrapResolve = null;
|
|
1335
|
+
retryBootstrapReject = null;
|
|
1336
|
+
if (fundingPollHandle !== null) {
|
|
1337
|
+
clearTimeout(fundingPollHandle);
|
|
1338
|
+
fundingPollHandle = null;
|
|
1339
|
+
}
|
|
1340
|
+
}
|
|
1341
|
+
console.log('[main] Retry triggered — re-running bootstrap...');
|
|
1342
|
+
continue; // loop back to the bootstrap() call
|
|
1343
|
+
}
|
|
1344
|
+
// If bootstrap throws an unexpected error (vs. SetupBootstrapHalted),
|
|
1345
|
+
// tear down the API we just started so we don't leave a dangling listener.
|
|
1346
|
+
await setupApiServer.close().catch(() => undefined);
|
|
1347
|
+
await closeCaptureReceiver();
|
|
1348
|
+
sharedStore.close();
|
|
1349
|
+
throw err;
|
|
1158
1350
|
}
|
|
1159
|
-
// If bootstrap throws (vs. emitEnvelope-exits), tear down the API we
|
|
1160
|
-
// just started so we don't leave a dangling listener on the port.
|
|
1161
|
-
await setupApiServer.close().catch(() => undefined);
|
|
1162
|
-
await closeCaptureReceiver();
|
|
1163
|
-
sharedStore.close();
|
|
1164
|
-
throw err;
|
|
1165
1351
|
}
|
|
1166
1352
|
// Bootstrap completed — flip the controller into 'running' so any waiters
|
|
1167
1353
|
// (future loops gated on this) unblock.
|
|
@@ -1207,35 +1393,6 @@ export async function main() {
|
|
|
1207
1393
|
},
|
|
1208
1394
|
});
|
|
1209
1395
|
}
|
|
1210
|
-
const claudeAuthRequired = configRequiresClaudeAuth(config);
|
|
1211
|
-
if (claudeAuthRequired) {
|
|
1212
|
-
const preflight = await checkClaudeBinary(activeClaudePath);
|
|
1213
|
-
if (!preflight.ok) {
|
|
1214
|
-
emitClaudeBinaryPreflightFailure(preflight.detail, activeClaudePath);
|
|
1215
|
-
}
|
|
1216
|
-
const authContext = detectAuthContext({ cwd: process.cwd(), configuredMode: config.runtimeMode });
|
|
1217
|
-
const authProbe = probeClaudeAuth({
|
|
1218
|
-
context: authContext,
|
|
1219
|
-
cwd: process.cwd(),
|
|
1220
|
-
claudePath: activeClaudePath,
|
|
1221
|
-
});
|
|
1222
|
-
if (!authProbe.authenticated) {
|
|
1223
|
-
emitEnvelope({
|
|
1224
|
-
code: 'invalid_invocation',
|
|
1225
|
-
message: 'Claude is not authenticated. Complete Claude setup in the operator app, then restart the daemon.',
|
|
1226
|
-
hint: `Detected context: ${authContext}. Run \`jinn run\` to open the app-guided setup flow.`,
|
|
1227
|
-
exampleCli: 'jinn run',
|
|
1228
|
-
details: {
|
|
1229
|
-
field: 'claude_auth',
|
|
1230
|
-
context: authContext,
|
|
1231
|
-
authenticated: false,
|
|
1232
|
-
},
|
|
1233
|
-
});
|
|
1234
|
-
}
|
|
1235
|
-
}
|
|
1236
|
-
else {
|
|
1237
|
-
console.log('[main] Claude auth preflight skipped; Claude-backed harnesses are disabled.');
|
|
1238
|
-
}
|
|
1239
1396
|
const runner = new ClaudeRunner({
|
|
1240
1397
|
claudePath: activeClaudePath,
|
|
1241
1398
|
model: config.claudeModel,
|
|
@@ -1246,6 +1403,33 @@ export async function main() {
|
|
|
1246
1403
|
const publicClient = createJinnPublicClient(config.rpcUrl, NETWORK_CHAIN);
|
|
1247
1404
|
publicClientForLauncher = publicClient;
|
|
1248
1405
|
const masterWallet = createJinnWalletClient(config.rpcUrl, NETWORK_CHAIN, masterAccount);
|
|
1406
|
+
// hjex.3: populate the restake callback now that mnemonic is available.
|
|
1407
|
+
if (config.stakingMode === 'standard' && CHAIN_CONFIG.distributorAddress) {
|
|
1408
|
+
const fleetStore = earningStore;
|
|
1409
|
+
restakeCallbackRef.current = async (serviceId) => {
|
|
1410
|
+
try {
|
|
1411
|
+
const state = await fleetStore.load(NETWORK_CHAIN);
|
|
1412
|
+
const svc = state.services.find(s => s.service_id === serviceId);
|
|
1413
|
+
if (!svc)
|
|
1414
|
+
return { ok: false, error: `service_not_found:${serviceId}` };
|
|
1415
|
+
if (!svc.staking_address)
|
|
1416
|
+
return { ok: false, error: 'staking_address_missing' };
|
|
1417
|
+
await recoverEvictedServiceFn({
|
|
1418
|
+
serviceDisplayIndex: Math.max(0, svc.index - 1),
|
|
1419
|
+
serviceId,
|
|
1420
|
+
stakingAddress: svc.staking_address,
|
|
1421
|
+
distributorAddress: CHAIN_CONFIG.distributorAddress,
|
|
1422
|
+
rpcUrl: config.rpcUrl,
|
|
1423
|
+
chain: NETWORK_CHAIN,
|
|
1424
|
+
mnemonic: mnemonicForMaster,
|
|
1425
|
+
});
|
|
1426
|
+
return { ok: true };
|
|
1427
|
+
}
|
|
1428
|
+
catch (err) {
|
|
1429
|
+
return { ok: false, error: err instanceof Error ? err.message : String(err) };
|
|
1430
|
+
}
|
|
1431
|
+
};
|
|
1432
|
+
}
|
|
1249
1433
|
const evictionRecovery = config.stakingMode === 'standard' &&
|
|
1250
1434
|
serviceId !== null &&
|
|
1251
1435
|
stakingAddress &&
|
|
@@ -1298,6 +1482,11 @@ export async function main() {
|
|
|
1298
1482
|
sharedDiscoveryApi = await buildOnchainFloor();
|
|
1299
1483
|
}
|
|
1300
1484
|
}
|
|
1485
|
+
// jinn-mono-u34i: populate the holder so the /v1/discovery/* routes
|
|
1486
|
+
// registered eagerly at server-start time start returning real data on
|
|
1487
|
+
// the panel's next refetch. Before this, the routes 404'd forever and
|
|
1488
|
+
// the /build page rendered "Discovery unavailable" permanently.
|
|
1489
|
+
discoveryApiHolder.current = sharedDiscoveryApi;
|
|
1301
1490
|
const adapter = new MechAdapter({
|
|
1302
1491
|
rpcUrl: config.rpcUrl,
|
|
1303
1492
|
mechMarketplaceAddress: MARKETPLACE_ADDRESS,
|
|
@@ -1315,7 +1504,12 @@ export async function main() {
|
|
|
1315
1504
|
? {
|
|
1316
1505
|
discoveryApi: sharedDiscoveryApi,
|
|
1317
1506
|
solverNetManifestCids: taskDiscoveryManifestCids,
|
|
1318
|
-
|
|
1507
|
+
// No explicit `onchainFromBlock` — let `MechAdapter`'s
|
|
1508
|
+
// `DEFAULT_TASK_DISCOVERY_FROM_BLOCK` per-chain default flow
|
|
1509
|
+
// through. Hardcoding here shadowed the adapter's default and
|
|
1510
|
+
// re-introduced the ghost-task floor every release; removing the
|
|
1511
|
+
// shadow makes `adapter.ts` the single source of truth. See gh
|
|
1512
|
+
// #300.
|
|
1319
1513
|
...(config.taskDiscoveryAllowedTaskIds?.length
|
|
1320
1514
|
? { allowedTaskIds: config.taskDiscoveryAllowedTaskIds }
|
|
1321
1515
|
: {}),
|
|
@@ -1440,10 +1634,42 @@ export async function main() {
|
|
|
1440
1634
|
externalImpls,
|
|
1441
1635
|
disabledNames: config.harnesses?.disabled,
|
|
1442
1636
|
corpusEnv,
|
|
1637
|
+
hermesPath: config.hermesPath,
|
|
1638
|
+
hermesModel: config.hermesModel,
|
|
1639
|
+
hermesProvider: config.hermesProvider,
|
|
1640
|
+
hermesDoctorTimeoutMs: config.hermesDoctorTimeoutMs,
|
|
1641
|
+
codexPath: config.codexPath,
|
|
1642
|
+
codexDoctorTimeoutMs: config.codexDoctorTimeoutMs,
|
|
1443
1643
|
})) {
|
|
1444
1644
|
implRegistry.register(impl);
|
|
1445
1645
|
}
|
|
1446
1646
|
console.log(`[main] HarnessRegistry: ${implRegistry.list().map(i => i.name).join(', ')}`);
|
|
1647
|
+
// ── Harness readiness registry ─────────────────────────────────────────────
|
|
1648
|
+
// Composes per-harness isReady() probes into a cached snapshot consumed by
|
|
1649
|
+
// claim loops (A5) and /v1/harnesses/readiness (A3).
|
|
1650
|
+
//
|
|
1651
|
+
// The registry is constructed here, after buildHarnesses() has run, which
|
|
1652
|
+
// is necessarily after bootstrap (bootstrap needs the keystore). The HTTP
|
|
1653
|
+
// server was started before bootstrap so it could show setup progress — we
|
|
1654
|
+
// mount the readiness routes on the already-running app via setupApiServer.app
|
|
1655
|
+
// (same pattern used by registerSolverNetsEndpoints). Routes are registered
|
|
1656
|
+
// before the first operator request that cares about harness readiness.
|
|
1657
|
+
//
|
|
1658
|
+
// A2 carry-over: start() only schedules the 4s tick; refreshNow() is called
|
|
1659
|
+
// immediately so the snapshot is populated before the first claim-loop tick.
|
|
1660
|
+
const harnessReadinessRegistry = buildHarnessReadinessRegistry({
|
|
1661
|
+
harnesses: implRegistry.list(),
|
|
1662
|
+
config,
|
|
1663
|
+
});
|
|
1664
|
+
harnessReadinessRegistry.start();
|
|
1665
|
+
await harnessReadinessRegistry.refreshNow();
|
|
1666
|
+
// Routes were registered eagerly at startApiServer time via the holder
|
|
1667
|
+
// ref pattern (jinn-mono-u34i). Populate the holder now and the already-
|
|
1668
|
+
// mounted /v1/harnesses/readiness routes start returning real data.
|
|
1669
|
+
// Late-mounting via addHarnessReadinessRoutes(setupApiServer.app, ...)
|
|
1670
|
+
// is no longer needed and would throw on Hono's locked matcher.
|
|
1671
|
+
harnessReadinessRegistryHolder.current = harnessReadinessRegistry;
|
|
1672
|
+
console.log('[main] HarnessReadinessRegistry started; /v1/harnesses/readiness routes active.');
|
|
1447
1673
|
// ── Engine deps ───────────────────────────────────────────────────────────────
|
|
1448
1674
|
// Packaging deps: artifacts are always written to served_artifacts
|
|
1449
1675
|
// (operator-local SQLite). In public-testnet donation mode, scrubbed artifact
|
|
@@ -1812,6 +2038,7 @@ export async function main() {
|
|
|
1812
2038
|
nodeEndpoint: config.nodeEndpoint,
|
|
1813
2039
|
creatorSafeAddress: safeAddress,
|
|
1814
2040
|
corpusFactory,
|
|
2041
|
+
harnessReadinessRegistry,
|
|
1815
2042
|
status: {
|
|
1816
2043
|
earningDir: config.earningDir,
|
|
1817
2044
|
rpcUrl: config.rpcUrl,
|
|
@@ -1903,6 +2130,32 @@ export async function main() {
|
|
|
1903
2130
|
safeTopupTarget: CHAIN_CONFIG.minSafeEth,
|
|
1904
2131
|
}
|
|
1905
2132
|
: undefined,
|
|
2133
|
+
// Eviction-check loop — only in standard staking mode (requires distributorAddress).
|
|
2134
|
+
// Running mode only: setup-halted daemons must not try to restake services that
|
|
2135
|
+
// haven't been staked yet (hjex.3).
|
|
2136
|
+
evictionCheck: config.evictionCheckIntervalMs > 0 &&
|
|
2137
|
+
config.stakingMode === 'standard' &&
|
|
2138
|
+
CHAIN_CONFIG.distributorAddress
|
|
2139
|
+
? {
|
|
2140
|
+
intervalMs: config.evictionCheckIntervalMs,
|
|
2141
|
+
store: earningStore,
|
|
2142
|
+
chain: NETWORK_CHAIN,
|
|
2143
|
+
readContract: (opts) => publicClient.readContract(opts),
|
|
2144
|
+
recoverEvictedService: async (svc) => {
|
|
2145
|
+
if (!svc.service_id || !svc.staking_address)
|
|
2146
|
+
return;
|
|
2147
|
+
await recoverEvictedServiceFn({
|
|
2148
|
+
serviceDisplayIndex: Math.max(0, svc.index - 1),
|
|
2149
|
+
serviceId: svc.service_id,
|
|
2150
|
+
stakingAddress: svc.staking_address,
|
|
2151
|
+
distributorAddress: CHAIN_CONFIG.distributorAddress,
|
|
2152
|
+
rpcUrl: config.rpcUrl,
|
|
2153
|
+
chain: NETWORK_CHAIN,
|
|
2154
|
+
mnemonic: mnemonicForMaster,
|
|
2155
|
+
});
|
|
2156
|
+
},
|
|
2157
|
+
}
|
|
2158
|
+
: undefined,
|
|
1906
2159
|
});
|
|
1907
2160
|
// Write pidfile so `jinn stop` can find us.
|
|
1908
2161
|
const pidPath = join(config.earningDir, 'daemon.pid');
|
|
@@ -1928,6 +2181,7 @@ export async function main() {
|
|
|
1928
2181
|
let exitCode = 0;
|
|
1929
2182
|
console.log(`\n[main] Received ${signal}, shutting down...`);
|
|
1930
2183
|
try {
|
|
2184
|
+
harnessReadinessRegistry.stop();
|
|
1931
2185
|
await daemon.stop();
|
|
1932
2186
|
await setupApiServer.close().catch(() => undefined);
|
|
1933
2187
|
await closeCaptureReceiver();
|
|
@@ -1994,4 +2248,32 @@ export async function main() {
|
|
|
1994
2248
|
serviceId,
|
|
1995
2249
|
};
|
|
1996
2250
|
}
|
|
2251
|
+
// ── Harness readiness registry factory ───────────────────────────────────────
|
|
2252
|
+
// Exported so tests can construct a registry without booting the full daemon.
|
|
2253
|
+
/**
|
|
2254
|
+
* Builds a HarnessReadinessRegistry from the harness list returned by
|
|
2255
|
+
* buildHarnesses() and the operator's joinedSolverNets config block.
|
|
2256
|
+
*
|
|
2257
|
+
* Per A2 carry-over: start() only schedules the background tick; callers that
|
|
2258
|
+
* need the snapshot populated immediately must call refreshNow() after start().
|
|
2259
|
+
*/
|
|
2260
|
+
export function buildHarnessReadinessRegistry(args) {
|
|
2261
|
+
const harnessesByName = {};
|
|
2262
|
+
for (const h of args.harnesses) {
|
|
2263
|
+
harnessesByName[h.name] = h;
|
|
2264
|
+
}
|
|
2265
|
+
const joinedHarnessesByCid = {};
|
|
2266
|
+
for (const [cid, entry] of Object.entries(args.config.joinedSolverNets ?? {})) {
|
|
2267
|
+
if (entry.harness) {
|
|
2268
|
+
joinedHarnessesByCid[cid] = {
|
|
2269
|
+
harnessName: entry.harness,
|
|
2270
|
+
roles: entry.roles,
|
|
2271
|
+
};
|
|
2272
|
+
}
|
|
2273
|
+
}
|
|
2274
|
+
return new HarnessReadinessRegistry({
|
|
2275
|
+
harnessesByName,
|
|
2276
|
+
joinedHarnessesByCid,
|
|
2277
|
+
});
|
|
2278
|
+
}
|
|
1997
2279
|
//# sourceMappingURL=main.js.map
|