@jinn-network/client 0.1.2 → 0.1.3-canary.216cf7e6
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 +20 -0
- package/CONTRIBUTING.md +9 -2
- package/README.md +67 -47
- package/deployments/deployment-jinn-mvi-l1-sepolia-fast.json +36 -0
- package/deployments/deployment-jinn-mvi-l1-sepolia.json +36 -0
- package/deployments/deployment-jinn-mvi-l2-baseSepolia.json +12 -0
- package/deployments/deployment-phase1b-mech-baseSepolia-fast.json +3 -3
- package/deployments/deployment-stolas-l2-baseSepolia-fast.json +1 -1
- package/deployments/deployment-task-coordinator-router-v3-baseSepolia-fast.json +38 -0
- package/dist/adapters/adapter.d.ts +19 -8
- package/dist/adapters/local/adapter.d.ts +10 -9
- package/dist/adapters/local/adapter.js +52 -79
- package/dist/adapters/local/adapter.js.map +1 -1
- package/dist/adapters/mech/adapter.d.ts +41 -15
- package/dist/adapters/mech/adapter.js +623 -362
- package/dist/adapters/mech/adapter.js.map +1 -1
- package/dist/adapters/mech/contracts.d.ts +82 -20
- package/dist/adapters/mech/contracts.js +374 -100
- package/dist/adapters/mech/contracts.js.map +1 -1
- package/dist/adapters/mech/ipfs.d.ts +66 -12
- package/dist/adapters/mech/ipfs.js +165 -30
- package/dist/adapters/mech/ipfs.js.map +1 -1
- package/dist/adapters/mech/safe-revert.d.ts +40 -0
- package/dist/adapters/mech/safe-revert.js +261 -0
- package/dist/adapters/mech/safe-revert.js.map +1 -0
- package/dist/adapters/mech/safe.js +48 -22
- package/dist/adapters/mech/safe.js.map +1 -1
- package/dist/adapters/mech/task-subgraph.d.ts +23 -0
- package/dist/adapters/mech/task-subgraph.js +157 -0
- package/dist/adapters/mech/task-subgraph.js.map +1 -0
- package/dist/adapters/mech/types.d.ts +263 -84
- package/dist/adapters/mech/types.js +125 -50
- package/dist/adapters/mech/types.js.map +1 -1
- package/dist/agent/agent-ws.d.ts +57 -0
- package/dist/agent/agent-ws.js +301 -0
- package/dist/agent/agent-ws.js.map +1 -0
- package/dist/agent/auto-mode-detect.d.ts +6 -0
- package/dist/agent/auto-mode-detect.js +44 -0
- package/dist/agent/auto-mode-detect.js.map +1 -0
- package/dist/agent/operator-claude.d.ts +22 -0
- package/dist/agent/operator-claude.js +176 -0
- package/dist/agent/operator-claude.js.map +1 -0
- package/dist/api/admin-endpoint.d.ts +12 -0
- package/dist/api/admin-endpoint.js +71 -0
- package/dist/api/admin-endpoint.js.map +1 -0
- package/dist/api/agent-binding-endpoint.d.ts +26 -0
- package/dist/api/agent-binding-endpoint.js +28 -0
- package/dist/api/agent-binding-endpoint.js.map +1 -0
- package/dist/api/bootstrap-endpoint.d.ts +25 -0
- package/dist/api/bootstrap-endpoint.js +104 -0
- package/dist/api/bootstrap-endpoint.js.map +1 -0
- package/dist/api/captures.d.ts +22 -0
- package/dist/api/captures.js +88 -0
- package/dist/api/captures.js.map +1 -0
- package/dist/api/events-endpoint.d.ts +9 -0
- package/dist/api/events-endpoint.js +46 -0
- package/dist/api/events-endpoint.js.map +1 -0
- package/dist/api/fleet-build.d.ts +1 -1
- package/dist/api/fleet-build.js +17 -8
- package/dist/api/fleet-build.js.map +1 -1
- package/dist/api/gather-status.d.ts +16 -1
- package/dist/api/gather-status.js +194 -3
- package/dist/api/gather-status.js.map +1 -1
- package/dist/api/handshake.d.ts +17 -0
- package/dist/api/handshake.js +28 -0
- package/dist/api/handshake.js.map +1 -0
- package/dist/api/harness-status-endpoint.d.ts +20 -0
- package/dist/api/harness-status-endpoint.js +13 -0
- package/dist/api/harness-status-endpoint.js.map +1 -0
- package/dist/api/history-build.d.ts +2 -2
- package/dist/api/history-build.js +3 -3
- package/dist/api/history-build.js.map +1 -1
- package/dist/api/launcher-endpoints.d.ts +43 -0
- package/dist/api/launcher-endpoints.js +50 -0
- package/dist/api/launcher-endpoints.js.map +1 -0
- package/dist/api/launcher-status.d.ts +93 -0
- package/dist/api/launcher-status.js +84 -0
- package/dist/api/launcher-status.js.map +1 -0
- package/dist/api/launcher-tasks.d.ts +76 -0
- package/dist/api/launcher-tasks.js +127 -0
- package/dist/api/launcher-tasks.js.map +1 -0
- package/dist/api/leaderboard-api.d.ts +20 -0
- package/dist/api/leaderboard-api.js +18 -0
- package/dist/api/leaderboard-api.js.map +1 -0
- package/dist/api/operator-artifacts-endpoint.d.ts +19 -0
- package/dist/api/operator-artifacts-endpoint.js +271 -0
- package/dist/api/operator-artifacts-endpoint.js.map +1 -0
- package/dist/api/peers.js +21 -6
- package/dist/api/peers.js.map +1 -1
- package/dist/api/portfolio-v0-build.d.ts +16 -10
- package/dist/api/portfolio-v0-build.js +36 -31
- package/dist/api/portfolio-v0-build.js.map +1 -1
- package/dist/api/portfolio-v0-doctor.js +1 -1
- package/dist/api/portfolio-v0-doctor.js.map +1 -1
- package/dist/api/prediction-v1-build.d.ts +65 -0
- package/dist/api/prediction-v1-build.js +73 -0
- package/dist/api/prediction-v1-build.js.map +1 -0
- package/dist/api/rewards-build.js +3 -8
- package/dist/api/rewards-build.js.map +1 -1
- package/dist/api/server.d.ts +106 -1
- package/dist/api/server.js +418 -17
- package/dist/api/server.js.map +1 -1
- package/dist/api/setup-endpoints.d.ts +62 -0
- package/dist/api/setup-endpoints.js +752 -0
- package/dist/api/setup-endpoints.js.map +1 -0
- package/dist/api/solvernets-catalog-build.d.ts +47 -0
- package/dist/api/solvernets-catalog-build.js +19 -0
- package/dist/api/solvernets-catalog-build.js.map +1 -0
- package/dist/api/solvernets-endpoint.d.ts +15 -0
- package/dist/api/solvernets-endpoint.js +5 -0
- package/dist/api/solvernets-endpoint.js.map +1 -0
- package/dist/api/solvernets-endpoints.d.ts +104 -0
- package/dist/api/solvernets-endpoints.js +1121 -0
- package/dist/api/solvernets-endpoints.js.map +1 -0
- package/dist/api/status-build.d.ts +26 -2
- package/dist/api/status-build.js +46 -9
- package/dist/api/status-build.js.map +1 -1
- package/dist/api/status-rollup-build.d.ts +46 -1
- package/dist/api/status-rollup-build.js +174 -8
- package/dist/api/status-rollup-build.js.map +1 -1
- package/dist/api/stop-hook.d.ts +36 -0
- package/dist/api/stop-hook.js +77 -0
- package/dist/api/stop-hook.js.map +1 -0
- package/dist/api/task-runs-build.d.ts +29 -0
- package/dist/api/task-runs-build.js +50 -0
- package/dist/api/task-runs-build.js.map +1 -0
- package/dist/api/ui-token.d.ts +5 -0
- package/dist/api/ui-token.js +36 -0
- package/dist/api/ui-token.js.map +1 -0
- package/dist/bin/jinn-stop-hook.d.ts +9 -0
- package/dist/bin/jinn-stop-hook.js +52 -0
- package/dist/bin/jinn-stop-hook.js.map +1 -0
- package/dist/build-info.d.ts +32 -0
- package/dist/build-info.js +69 -0
- package/dist/build-info.js.map +1 -0
- package/dist/build-info.json +6 -0
- package/dist/build-meta.json +1 -1
- package/dist/captures/dedup.d.ts +27 -0
- package/dist/captures/dedup.js +48 -0
- package/dist/captures/dedup.js.map +1 -0
- package/dist/captures/index.d.ts +4 -0
- package/dist/captures/index.js +5 -0
- package/dist/captures/index.js.map +1 -0
- package/dist/captures/live-publisher.d.ts +33 -0
- package/dist/captures/live-publisher.js +101 -0
- package/dist/captures/live-publisher.js.map +1 -0
- package/dist/captures/publish.d.ts +83 -0
- package/dist/captures/publish.js +212 -0
- package/dist/captures/publish.js.map +1 -0
- package/dist/captures/rate-limit.d.ts +39 -0
- package/dist/captures/rate-limit.js +79 -0
- package/dist/captures/rate-limit.js.map +1 -0
- package/dist/cli/command.d.ts +9 -0
- package/dist/cli/commands/auth.js +6 -3
- package/dist/cli/commands/auth.js.map +1 -1
- package/dist/cli/commands/balance.d.ts +7 -0
- package/dist/cli/commands/balance.js +38 -32
- package/dist/cli/commands/balance.js.map +1 -1
- package/dist/cli/commands/bootstrap.d.ts +13 -1
- package/dist/cli/commands/bootstrap.js +150 -133
- package/dist/cli/commands/bootstrap.js.map +1 -1
- package/dist/cli/commands/capture.d.ts +33 -0
- package/dist/cli/commands/capture.js +345 -0
- package/dist/cli/commands/capture.js.map +1 -0
- package/dist/cli/commands/checkpoint.d.ts +85 -0
- package/dist/cli/commands/checkpoint.js +75 -0
- package/dist/cli/commands/checkpoint.js.map +1 -0
- package/dist/cli/commands/claim-rewards.js +14 -2
- package/dist/cli/commands/claim-rewards.js.map +1 -1
- package/dist/cli/commands/conformance.d.ts +12 -0
- package/dist/cli/commands/conformance.js +140 -0
- package/dist/cli/commands/conformance.js.map +1 -0
- package/dist/cli/commands/create.d.ts +22 -0
- package/dist/cli/commands/create.js +226 -0
- package/dist/cli/commands/create.js.map +1 -0
- package/dist/cli/commands/doctor.d.ts +49 -1
- package/dist/cli/commands/doctor.js +162 -134
- package/dist/cli/commands/doctor.js.map +1 -1
- package/dist/cli/commands/fleet-scale.d.ts +19 -1
- package/dist/cli/commands/fleet-scale.js +378 -361
- package/dist/cli/commands/fleet-scale.js.map +1 -1
- package/dist/cli/commands/fleet.d.ts +7 -0
- package/dist/cli/commands/fleet.js +39 -33
- package/dist/cli/commands/fleet.js.map +1 -1
- package/dist/cli/commands/fund-requirements.d.ts +14 -1
- package/dist/cli/commands/fund-requirements.js +182 -174
- package/dist/cli/commands/fund-requirements.js.map +1 -1
- package/dist/cli/commands/harnesses.d.ts +38 -0
- package/dist/cli/commands/harnesses.js +376 -0
- package/dist/cli/commands/harnesses.js.map +1 -0
- package/dist/cli/commands/history.d.ts +10 -1
- package/dist/cli/commands/history.js +68 -59
- package/dist/cli/commands/history.js.map +1 -1
- package/dist/cli/commands/init.js +4 -1
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/commands/integrations.d.ts +13 -0
- package/dist/cli/commands/integrations.js +1010 -0
- package/dist/cli/commands/integrations.js.map +1 -0
- package/dist/cli/commands/logs.d.ts +6 -1
- package/dist/cli/commands/logs.js +77 -70
- package/dist/cli/commands/logs.js.map +1 -1
- package/dist/cli/commands/migrate-agent-id.d.ts +26 -0
- package/dist/cli/commands/migrate-agent-id.js +164 -0
- package/dist/cli/commands/migrate-agent-id.js.map +1 -0
- package/dist/cli/commands/prediction-scoreboard.d.ts +10 -0
- package/dist/cli/commands/prediction-scoreboard.js +136 -0
- package/dist/cli/commands/prediction-scoreboard.js.map +1 -0
- package/dist/cli/commands/quickstart.d.ts +51 -1
- package/dist/cli/commands/quickstart.js +514 -296
- package/dist/cli/commands/quickstart.js.map +1 -1
- package/dist/cli/commands/rewards.d.ts +7 -0
- package/dist/cli/commands/rewards.js +46 -40
- package/dist/cli/commands/rewards.js.map +1 -1
- package/dist/cli/commands/run.d.ts +14 -1
- package/dist/cli/commands/run.js +243 -91
- package/dist/cli/commands/run.js.map +1 -1
- package/dist/cli/commands/solver-nets.js +231 -0
- package/dist/cli/commands/solver-nets.js.map +1 -0
- package/dist/cli/commands/solver-plugins.d.ts +9 -0
- package/dist/cli/commands/solver-plugins.js +186 -0
- package/dist/cli/commands/solver-plugins.js.map +1 -0
- package/dist/cli/commands/status.d.ts +13 -0
- package/dist/cli/commands/status.js +105 -34
- package/dist/cli/commands/status.js.map +1 -1
- package/dist/cli/commands/stop.js +87 -14
- package/dist/cli/commands/stop.js.map +1 -1
- package/dist/cli/commands/tasks.js +405 -0
- package/dist/cli/commands/tasks.js.map +1 -0
- package/dist/cli/commands/ui.d.ts +3 -0
- package/dist/cli/commands/ui.js +45 -0
- package/dist/cli/commands/ui.js.map +1 -0
- package/dist/cli/commands/update.d.ts +12 -0
- package/dist/cli/commands/update.js +321 -91
- package/dist/cli/commands/update.js.map +1 -1
- package/dist/cli/commands/version.js +3 -2
- package/dist/cli/commands/version.js.map +1 -1
- package/dist/cli/commands/withdraw.d.ts +21 -1
- package/dist/cli/commands/withdraw.js +175 -159
- package/dist/cli/commands/withdraw.js.map +1 -1
- package/dist/cli/deployment-digest.js +0 -5
- package/dist/cli/deployment-digest.js.map +1 -1
- package/dist/cli/execution-context.d.ts +1 -1
- package/dist/cli/execution-context.js +4 -4
- package/dist/cli/execution-context.js.map +1 -1
- package/dist/cli/help.js +8 -1
- package/dist/cli/help.js.map +1 -1
- package/dist/cli/index.d.ts +7 -0
- package/dist/cli/index.js +28 -6
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/introspection-context.js +0 -1
- package/dist/cli/introspection-context.js.map +1 -1
- package/dist/cli/open-browser.d.ts +1 -0
- package/dist/cli/open-browser.js +18 -0
- package/dist/cli/open-browser.js.map +1 -0
- package/dist/cli/password.d.ts +3 -3
- package/dist/cli/password.js +6 -6
- package/dist/cli/password.js.map +1 -1
- package/dist/cli/task-native-readiness.d.ts +27 -0
- package/dist/cli/task-native-readiness.js +170 -0
- package/dist/cli/task-native-readiness.js.map +1 -0
- package/dist/config.d.ts +1907 -60
- package/dist/config.js +608 -33
- package/dist/config.js.map +1 -1
- package/dist/conformance/checks/artifacts.d.ts +37 -0
- package/dist/conformance/checks/artifacts.js +110 -0
- package/dist/conformance/checks/artifacts.js.map +1 -0
- package/dist/conformance/checks/envelope-schema.d.ts +17 -0
- package/dist/conformance/checks/envelope-schema.js +36 -0
- package/dist/conformance/checks/envelope-schema.js.map +1 -0
- package/dist/conformance/checks/hash-signature.d.ts +26 -0
- package/dist/conformance/checks/hash-signature.js +70 -0
- package/dist/conformance/checks/hash-signature.js.map +1 -0
- package/dist/conformance/checks/payload.d.ts +19 -0
- package/dist/conformance/checks/payload.js +52 -0
- package/dist/conformance/checks/payload.js.map +1 -0
- package/dist/conformance/checks/secret-scrub.d.ts +33 -0
- package/dist/conformance/checks/secret-scrub.js +118 -0
- package/dist/conformance/checks/secret-scrub.js.map +1 -0
- package/dist/conformance/checks/source-runtime.d.ts +43 -0
- package/dist/conformance/checks/source-runtime.js +68 -0
- package/dist/conformance/checks/source-runtime.js.map +1 -0
- package/dist/conformance/checks/source-static.d.ts +61 -0
- package/dist/conformance/checks/source-static.js +311 -0
- package/dist/conformance/checks/source-static.js.map +1 -0
- package/dist/conformance/checks/trajectory-chain.d.ts +18 -0
- package/dist/conformance/checks/trajectory-chain.js +51 -0
- package/dist/conformance/checks/trajectory-chain.js.map +1 -0
- package/dist/conformance/checks/trajectory-profile.d.ts +17 -0
- package/dist/conformance/checks/trajectory-profile.js +51 -0
- package/dist/conformance/checks/trajectory-profile.js.map +1 -0
- package/dist/conformance/checks/trajectory-schema.d.ts +20 -0
- package/dist/conformance/checks/trajectory-schema.js +40 -0
- package/dist/conformance/checks/trajectory-schema.js.map +1 -0
- package/dist/conformance/checks/verdict.d.ts +44 -0
- package/dist/conformance/checks/verdict.js +122 -0
- package/dist/conformance/checks/verdict.js.map +1 -0
- package/dist/conformance/harness.d.ts +32 -0
- package/dist/conformance/harness.js +227 -0
- package/dist/conformance/harness.js.map +1 -0
- package/dist/conformance/types.d.ts +88 -0
- package/dist/conformance/types.js +31 -0
- package/dist/conformance/types.js.map +1 -0
- package/dist/corpus/acquire.d.ts +42 -0
- package/dist/corpus/acquire.js +213 -0
- package/dist/corpus/acquire.js.map +1 -0
- package/dist/corpus/cache.d.ts +14 -0
- package/dist/corpus/cache.js +18 -0
- package/dist/corpus/cache.js.map +1 -0
- package/dist/corpus/envelope-projection.d.ts +12 -0
- package/dist/corpus/envelope-projection.js +110 -0
- package/dist/corpus/envelope-projection.js.map +1 -0
- package/dist/corpus/fetch.d.ts +9 -0
- package/dist/corpus/fetch.js +24 -0
- package/dist/corpus/fetch.js.map +1 -0
- package/dist/corpus/index.d.ts +19 -0
- package/dist/corpus/index.js +118 -0
- package/dist/corpus/index.js.map +1 -0
- package/dist/corpus/onchain-query.d.ts +13 -0
- package/dist/corpus/onchain-query.js +165 -0
- package/dist/corpus/onchain-query.js.map +1 -0
- package/dist/corpus/prediction-brier-scoreboard-report.d.ts +17 -0
- package/dist/corpus/prediction-brier-scoreboard-report.js +148 -0
- package/dist/corpus/prediction-brier-scoreboard-report.js.map +1 -0
- package/dist/corpus/prediction-brier-scoreboard.d.ts +56 -0
- package/dist/corpus/prediction-brier-scoreboard.js +269 -0
- package/dist/corpus/prediction-brier-scoreboard.js.map +1 -0
- package/dist/corpus/prediction-scoreable-verdicts.d.ts +4 -0
- package/dist/corpus/prediction-scoreable-verdicts.js +23 -0
- package/dist/corpus/prediction-scoreable-verdicts.js.map +1 -0
- package/dist/corpus/query.d.ts +17 -0
- package/dist/corpus/query.js +113 -0
- package/dist/corpus/query.js.map +1 -0
- package/dist/corpus/route-resolver.d.ts +16 -0
- package/dist/corpus/route-resolver.js +20 -0
- package/dist/corpus/route-resolver.js.map +1 -0
- package/dist/corpus/types.d.ts +153 -0
- package/dist/corpus/types.js +50 -0
- package/dist/corpus/types.js.map +1 -0
- package/dist/daemon/balance-topup-loop.js +2 -1
- package/dist/daemon/balance-topup-loop.js.map +1 -1
- package/dist/daemon/creator.d.ts +7 -7
- package/dist/daemon/creator.js +11 -14
- package/dist/daemon/creator.js.map +1 -1
- package/dist/daemon/daemon.d.ts +83 -31
- package/dist/daemon/daemon.js +206 -67
- package/dist/daemon/daemon.js.map +1 -1
- package/dist/daemon/delivery-watcher.js +50 -4
- package/dist/daemon/delivery-watcher.js.map +1 -1
- package/dist/daemon/freeze-fence.d.ts +42 -0
- package/dist/daemon/freeze-fence.js +71 -0
- package/dist/daemon/freeze-fence.js.map +1 -0
- package/dist/daemon/jinn-claim-loop-canonical.d.ts +207 -0
- package/dist/daemon/jinn-claim-loop-canonical.js +296 -0
- package/dist/daemon/jinn-claim-loop-canonical.js.map +1 -0
- package/dist/daemon/jinn-claim-loop-mock.d.ts +61 -0
- package/dist/daemon/jinn-claim-loop-mock.js +122 -0
- package/dist/daemon/jinn-claim-loop-mock.js.map +1 -0
- package/dist/daemon/jinn-claim-loop.d.ts +123 -0
- package/dist/daemon/jinn-claim-loop.js +256 -0
- package/dist/daemon/jinn-claim-loop.js.map +1 -0
- package/dist/daemon/reward-claim-loop.d.ts +2 -0
- package/dist/daemon/reward-claim-loop.js +32 -27
- package/dist/daemon/reward-claim-loop.js.map +1 -1
- package/dist/dashboard/assets/index-D_NMfDfV.css +32 -0
- package/dist/dashboard/assets/index-gfrALgiG.js +76 -0
- package/dist/dashboard/index.html +18 -74
- package/dist/earning/agent-wallet-binding.d.ts +133 -0
- package/dist/earning/agent-wallet-binding.js +202 -0
- package/dist/earning/agent-wallet-binding.js.map +1 -0
- package/dist/earning/bootstrap.d.ts +88 -1
- package/dist/earning/bootstrap.js +409 -56
- package/dist/earning/bootstrap.js.map +1 -1
- package/dist/earning/contracts.d.ts +328 -6
- package/dist/earning/contracts.js +295 -14
- package/dist/earning/contracts.js.map +1 -1
- package/dist/earning/evidence-simhash.d.ts +1 -1
- package/dist/earning/faucet.d.ts +31 -0
- package/dist/earning/faucet.js +37 -0
- package/dist/earning/faucet.js.map +1 -1
- package/dist/earning/funding-plan.d.ts +89 -0
- package/dist/earning/funding-plan.js +202 -0
- package/dist/earning/funding-plan.js.map +1 -0
- package/dist/earning/migrate-agent-id.d.ts +129 -0
- package/dist/earning/migrate-agent-id.js +256 -0
- package/dist/earning/migrate-agent-id.js.map +1 -0
- package/dist/earning/orphan-sweep.d.ts +14 -0
- package/dist/earning/orphan-sweep.js +63 -2
- package/dist/earning/orphan-sweep.js.map +1 -1
- package/dist/earning/reconcile.d.ts +2 -0
- package/dist/earning/reconcile.js +30 -0
- package/dist/earning/reconcile.js.map +1 -1
- package/dist/earning/safe-adapter.js +45 -3
- package/dist/earning/safe-adapter.js.map +1 -1
- package/dist/earning/stolas-claim.d.ts +86 -6
- package/dist/earning/stolas-claim.js +123 -9
- package/dist/earning/stolas-claim.js.map +1 -1
- package/dist/earning/store.d.ts +47 -0
- package/dist/earning/store.js +113 -1
- package/dist/earning/store.js.map +1 -1
- package/dist/earning/testnet-setup-migration.d.ts +32 -0
- package/dist/earning/testnet-setup-migration.js +214 -0
- package/dist/earning/testnet-setup-migration.js.map +1 -0
- package/dist/earning/types.d.ts +57 -9
- package/dist/earning/types.js +51 -2
- package/dist/earning/types.js.map +1 -1
- package/dist/earning/viem-clients.d.ts +20 -0
- package/dist/earning/viem-clients.js +32 -1
- package/dist/earning/viem-clients.js.map +1 -1
- package/dist/erc8004/abis.d.ts +423 -0
- package/dist/erc8004/abis.js +265 -0
- package/dist/erc8004/abis.js.map +1 -0
- package/dist/erc8004/addresses.d.ts +40 -0
- package/dist/erc8004/addresses.js +64 -0
- package/dist/erc8004/addresses.js.map +1 -0
- package/dist/erc8004/identity.d.ts +273 -0
- package/dist/erc8004/identity.js +405 -0
- package/dist/erc8004/identity.js.map +1 -0
- package/dist/erc8004/index.d.ts +13 -0
- package/dist/erc8004/index.js +20 -0
- package/dist/erc8004/index.js.map +1 -0
- package/dist/erc8004/reputation.d.ts +349 -0
- package/dist/erc8004/reputation.js +464 -0
- package/dist/erc8004/reputation.js.map +1 -0
- package/dist/erc8004/subgraph.d.ts +46 -0
- package/dist/erc8004/subgraph.js +37 -0
- package/dist/erc8004/subgraph.js.map +1 -0
- package/dist/erc8004/validation.d.ts +145 -0
- package/dist/erc8004/validation.js +219 -0
- package/dist/erc8004/validation.js.map +1 -0
- package/dist/errors/persisted-bootstrap-error.d.ts +4 -0
- package/dist/errors/persisted-bootstrap-error.js +50 -0
- package/dist/errors/persisted-bootstrap-error.js.map +1 -0
- package/dist/events/emitter.d.ts +12 -0
- package/dist/events/emitter.js +23 -0
- package/dist/events/emitter.js.map +1 -0
- package/dist/events/ring-buffer.d.ts +25 -0
- package/dist/events/ring-buffer.js +46 -0
- package/dist/events/ring-buffer.js.map +1 -0
- package/dist/events/types.d.ts +42 -0
- package/dist/events/types.js +28 -0
- package/dist/events/types.js.map +1 -0
- package/dist/harnesses/capability/index.d.ts +82 -0
- package/dist/harnesses/capability/index.js +12 -0
- package/dist/harnesses/capability/index.js.map +1 -0
- package/dist/harnesses/capability/scoped-rpc.d.ts +12 -0
- package/dist/harnesses/capability/scoped-rpc.js +34 -0
- package/dist/harnesses/capability/scoped-rpc.js.map +1 -0
- package/dist/harnesses/capability/scoped-secrets.d.ts +8 -0
- package/dist/harnesses/capability/scoped-secrets.js +10 -0
- package/dist/harnesses/capability/scoped-secrets.js.map +1 -0
- package/dist/harnesses/capability/scoped-signer.d.ts +46 -0
- package/dist/harnesses/capability/scoped-signer.js +73 -0
- package/dist/harnesses/capability/scoped-signer.js.map +1 -0
- package/dist/harnesses/engine/artifact-scrub.d.ts +12 -0
- package/dist/harnesses/engine/artifact-scrub.js +104 -0
- package/dist/harnesses/engine/artifact-scrub.js.map +1 -0
- package/dist/harnesses/engine/canonical-json.d.ts +1 -0
- package/dist/harnesses/engine/canonical-json.js +66 -0
- package/dist/harnesses/engine/canonical-json.js.map +1 -0
- package/dist/harnesses/engine/delivery.d.ts +58 -0
- package/dist/harnesses/engine/delivery.js +67 -0
- package/dist/harnesses/engine/delivery.js.map +1 -0
- package/dist/harnesses/engine/engine.d.ts +534 -0
- package/dist/harnesses/engine/engine.js +1626 -0
- package/dist/harnesses/engine/engine.js.map +1 -0
- package/dist/harnesses/engine/envelope-assembly.d.ts +73 -0
- package/dist/harnesses/engine/envelope-assembly.js +60 -0
- package/dist/harnesses/engine/envelope-assembly.js.map +1 -0
- package/dist/harnesses/engine/packaging.d.ts +99 -0
- package/dist/harnesses/engine/packaging.js +424 -0
- package/dist/harnesses/engine/packaging.js.map +1 -0
- package/dist/harnesses/engine/persistence.d.ts +198 -0
- package/dist/harnesses/engine/persistence.js +443 -0
- package/dist/harnesses/engine/persistence.js.map +1 -0
- package/dist/harnesses/engine/recovery.d.ts +22 -0
- package/dist/harnesses/engine/recovery.js +24 -0
- package/dist/harnesses/engine/recovery.js.map +1 -0
- package/dist/harnesses/engine/registry.d.ts +55 -0
- package/dist/harnesses/engine/registry.js +66 -0
- package/dist/harnesses/engine/registry.js.map +1 -0
- package/dist/harnesses/engine/signing.d.ts +30 -0
- package/dist/harnesses/engine/signing.js +39 -0
- package/dist/harnesses/engine/signing.js.map +1 -0
- package/dist/harnesses/engine/state.d.ts +42 -0
- package/dist/harnesses/engine/state.js +87 -0
- package/dist/harnesses/engine/state.js.map +1 -0
- package/dist/harnesses/engine/validate-manifest.d.ts +23 -0
- package/dist/harnesses/engine/validate-manifest.js +63 -0
- package/dist/harnesses/engine/validate-manifest.js.map +1 -0
- package/dist/harnesses/engine/verification-stub.d.ts +18 -0
- package/dist/harnesses/engine/verification-stub.js +18 -0
- package/dist/harnesses/engine/verification-stub.js.map +1 -0
- package/dist/harnesses/external-impls/index.d.ts +3 -0
- package/dist/harnesses/external-impls/index.js +2 -0
- package/dist/harnesses/external-impls/index.js.map +1 -0
- package/dist/harnesses/external-impls/loader.d.ts +50 -0
- package/dist/harnesses/external-impls/loader.js +139 -0
- package/dist/harnesses/external-impls/loader.js.map +1 -0
- package/dist/harnesses/external-impls/package-hash.d.ts +26 -0
- package/dist/harnesses/external-impls/package-hash.js +102 -0
- package/dist/harnesses/external-impls/package-hash.js.map +1 -0
- package/dist/harnesses/external-impls/types.d.ts +42 -0
- package/dist/harnesses/external-impls/types.js +10 -0
- package/dist/harnesses/external-impls/types.js.map +1 -0
- package/dist/harnesses/freeze.d.ts +34 -0
- package/dist/harnesses/freeze.js +60 -0
- package/dist/harnesses/freeze.js.map +1 -0
- package/dist/harnesses/impls/claude-code-learner/adapters/claude-code.d.ts +61 -0
- package/dist/harnesses/impls/claude-code-learner/adapters/claude-code.js +243 -0
- package/dist/harnesses/impls/claude-code-learner/adapters/claude-code.js.map +1 -0
- package/dist/harnesses/impls/claude-code-learner/adapters/codex-code.d.ts +35 -0
- package/dist/harnesses/impls/claude-code-learner/adapters/codex-code.js +280 -0
- package/dist/harnesses/impls/claude-code-learner/adapters/codex-code.js.map +1 -0
- package/dist/harnesses/impls/claude-code-learner/adapters/codex-workspace.d.ts +21 -0
- package/dist/harnesses/impls/claude-code-learner/adapters/codex-workspace.js +193 -0
- package/dist/harnesses/impls/claude-code-learner/adapters/codex-workspace.js.map +1 -0
- package/dist/harnesses/impls/claude-code-learner/harness.d.ts +22 -0
- package/dist/harnesses/impls/claude-code-learner/harness.js +62 -0
- package/dist/harnesses/impls/claude-code-learner/harness.js.map +1 -0
- package/dist/harnesses/impls/claude-code-learner/harvest.d.ts +20 -0
- package/dist/harnesses/impls/claude-code-learner/harvest.js +558 -0
- package/dist/harnesses/impls/claude-code-learner/harvest.js.map +1 -0
- package/dist/harnesses/impls/claude-code-learner/index.d.ts +18 -0
- package/dist/harnesses/impls/claude-code-learner/index.js +15 -0
- package/dist/harnesses/impls/claude-code-learner/index.js.map +1 -0
- package/dist/harnesses/impls/claude-code-learner/plugin-path.d.ts +14 -0
- package/dist/harnesses/impls/claude-code-learner/plugin-path.js +30 -0
- package/dist/harnesses/impls/claude-code-learner/plugin-path.js.map +1 -0
- package/dist/harnesses/impls/claude-code-learner/test-utils/fake-plugin-outputs.d.ts +50 -0
- package/dist/harnesses/impls/claude-code-learner/test-utils/fake-plugin-outputs.js +192 -0
- package/dist/harnesses/impls/claude-code-learner/test-utils/fake-plugin-outputs.js.map +1 -0
- package/dist/harnesses/impls/claude-code-learner/test-utils/noop-adapter.d.ts +22 -0
- package/dist/harnesses/impls/claude-code-learner/test-utils/noop-adapter.js +35 -0
- package/dist/harnesses/impls/claude-code-learner/test-utils/noop-adapter.js.map +1 -0
- package/dist/harnesses/impls/claude-code-learner/types.d.ts +114 -0
- package/dist/harnesses/impls/claude-code-learner/types.js.map +1 -0
- package/dist/harnesses/impls/claude-mcp-hyperliquid/api-wallet.d.ts +64 -0
- package/dist/harnesses/impls/claude-mcp-hyperliquid/api-wallet.js.map +1 -0
- package/dist/harnesses/impls/claude-mcp-hyperliquid/index.d.ts +106 -0
- package/dist/harnesses/impls/claude-mcp-hyperliquid/index.js +723 -0
- package/dist/harnesses/impls/claude-mcp-hyperliquid/index.js.map +1 -0
- package/dist/harnesses/impls/claude-mcp-hyperliquid/mcp-tools.js.map +1 -0
- package/dist/harnesses/impls/claude-mcp-hyperliquid/safety-rails.js.map +1 -0
- package/dist/harnesses/impls/claude-mcp-hyperliquid/session-orchestrator.d.ts +104 -0
- package/dist/harnesses/impls/claude-mcp-hyperliquid/session-orchestrator.js +264 -0
- package/dist/harnesses/impls/claude-mcp-hyperliquid/session-orchestrator.js.map +1 -0
- package/dist/harnesses/impls/claude-mcp-prediction/index.d.ts +44 -0
- package/dist/harnesses/impls/claude-mcp-prediction/index.js +250 -0
- package/dist/harnesses/impls/claude-mcp-prediction/index.js.map +1 -0
- package/dist/harnesses/impls/claude-mcp-prediction/mcp-tools.js +135 -0
- package/dist/harnesses/impls/claude-mcp-prediction/mcp-tools.js.map +1 -0
- package/dist/harnesses/impls/claude-mcp-prediction/prompt.d.ts +8 -0
- package/dist/harnesses/impls/claude-mcp-prediction/prompt.js +54 -0
- package/dist/harnesses/impls/claude-mcp-prediction/prompt.js.map +1 -0
- package/dist/harnesses/impls/claude-mcp-prediction/session-orchestrator.d.ts +43 -0
- package/dist/harnesses/impls/claude-mcp-prediction/session-orchestrator.js +21 -0
- package/dist/harnesses/impls/claude-mcp-prediction/session-orchestrator.js.map +1 -0
- package/dist/harnesses/impls/claude-mcp-prediction/types.d.ts +84 -0
- package/dist/harnesses/impls/claude-mcp-prediction/types.js +6 -0
- package/dist/harnesses/impls/claude-mcp-prediction/types.js.map +1 -0
- package/dist/harnesses/impls/claude-mcp-prediction-apy/index.d.ts +36 -0
- package/dist/harnesses/impls/claude-mcp-prediction-apy/index.js +241 -0
- package/dist/harnesses/impls/claude-mcp-prediction-apy/index.js.map +1 -0
- package/dist/harnesses/impls/claude-mcp-prediction-apy/mcp-tools.js +136 -0
- package/dist/harnesses/impls/claude-mcp-prediction-apy/mcp-tools.js.map +1 -0
- package/dist/harnesses/impls/claude-mcp-prediction-apy/prompt.d.ts +7 -0
- package/dist/harnesses/impls/claude-mcp-prediction-apy/prompt.js +46 -0
- package/dist/harnesses/impls/claude-mcp-prediction-apy/prompt.js.map +1 -0
- package/dist/harnesses/impls/claude-mcp-prediction-apy/session-orchestrator.d.ts +37 -0
- package/dist/harnesses/impls/claude-mcp-prediction-apy/session-orchestrator.js +19 -0
- package/dist/harnesses/impls/claude-mcp-prediction-apy/session-orchestrator.js.map +1 -0
- package/dist/harnesses/impls/claude-mcp-prediction-apy/types.d.ts +64 -0
- package/dist/harnesses/impls/claude-mcp-prediction-apy/types.js +6 -0
- package/dist/harnesses/impls/claude-mcp-prediction-apy/types.js.map +1 -0
- package/dist/harnesses/impls/claude-mcp-shared/single-session-orchestrator.d.ts +84 -0
- package/dist/harnesses/impls/claude-mcp-shared/single-session-orchestrator.js +206 -0
- package/dist/harnesses/impls/claude-mcp-shared/single-session-orchestrator.js.map +1 -0
- package/dist/harnesses/impls/evaluation-context.d.ts +23 -0
- package/dist/harnesses/impls/evaluation-context.js +25 -0
- package/dist/harnesses/impls/evaluation-context.js.map +1 -0
- package/dist/harnesses/impls/index.d.ts +84 -0
- package/dist/harnesses/impls/index.js +136 -0
- package/dist/harnesses/impls/index.js.map +1 -0
- package/dist/harnesses/impls/legacy-claude/index.d.ts +66 -0
- package/dist/harnesses/impls/legacy-claude/index.js +168 -0
- package/dist/harnesses/impls/legacy-claude/index.js.map +1 -0
- package/dist/harnesses/impls/portfolio-v0-evaluator/canonical-metrics.d.ts +68 -0
- package/dist/harnesses/impls/portfolio-v0-evaluator/canonical-metrics.js +117 -0
- package/dist/harnesses/impls/portfolio-v0-evaluator/canonical-metrics.js.map +1 -0
- package/dist/harnesses/impls/portfolio-v0-evaluator/checks/availability.js.map +1 -0
- package/dist/harnesses/impls/portfolio-v0-evaluator/checks/consistency.d.ts +78 -0
- package/dist/harnesses/impls/portfolio-v0-evaluator/checks/consistency.js +274 -0
- package/dist/harnesses/impls/portfolio-v0-evaluator/checks/consistency.js.map +1 -0
- package/dist/harnesses/impls/portfolio-v0-evaluator/checks/eligibility.d.ts +23 -0
- package/dist/harnesses/impls/portfolio-v0-evaluator/checks/eligibility.js +49 -0
- package/dist/harnesses/impls/portfolio-v0-evaluator/checks/eligibility.js.map +1 -0
- package/dist/harnesses/impls/portfolio-v0-evaluator/checks/integrity.d.ts +25 -0
- package/dist/harnesses/impls/portfolio-v0-evaluator/checks/integrity.js +44 -0
- package/dist/harnesses/impls/portfolio-v0-evaluator/checks/integrity.js.map +1 -0
- package/dist/harnesses/impls/portfolio-v0-evaluator/checks/spec.d.ts +17 -0
- package/dist/harnesses/impls/portfolio-v0-evaluator/checks/spec.js +43 -0
- package/dist/harnesses/impls/portfolio-v0-evaluator/checks/spec.js.map +1 -0
- package/dist/harnesses/impls/portfolio-v0-evaluator/index.d.ts +44 -0
- package/dist/harnesses/impls/portfolio-v0-evaluator/index.js +569 -0
- package/dist/harnesses/impls/portfolio-v0-evaluator/index.js.map +1 -0
- package/dist/harnesses/impls/portfolio-v0-evaluator/score.js.map +1 -0
- package/dist/harnesses/impls/portfolio-v0-evaluator/types.d.ts +34 -0
- package/dist/harnesses/impls/portfolio-v0-evaluator/types.js.map +1 -0
- package/dist/harnesses/impls/prediction-apy-v0-baseline/index.d.ts +42 -0
- package/dist/harnesses/impls/prediction-apy-v0-baseline/index.js +114 -0
- package/dist/harnesses/impls/prediction-apy-v0-baseline/index.js.map +1 -0
- package/dist/harnesses/impls/prediction-apy-v0-baseline/strategy.js.map +1 -0
- package/dist/harnesses/impls/prediction-apy-v0-baseline/types.js.map +1 -0
- package/dist/harnesses/impls/prediction-apy-v0-evaluator/canonical-metrics.d.ts +6 -0
- package/dist/harnesses/impls/prediction-apy-v0-evaluator/canonical-metrics.js +11 -0
- package/dist/harnesses/impls/prediction-apy-v0-evaluator/canonical-metrics.js.map +1 -0
- package/dist/harnesses/impls/prediction-apy-v0-evaluator/index.d.ts +42 -0
- package/dist/harnesses/impls/prediction-apy-v0-evaluator/index.js +346 -0
- package/dist/harnesses/impls/prediction-apy-v0-evaluator/index.js.map +1 -0
- package/dist/harnesses/impls/prediction-apy-v0-evaluator/parse-submission.d.ts +16 -0
- package/dist/harnesses/impls/prediction-apy-v0-evaluator/parse-submission.js +22 -0
- package/dist/harnesses/impls/prediction-apy-v0-evaluator/parse-submission.js.map +1 -0
- package/dist/harnesses/impls/prediction-apy-v0-evaluator/score.js.map +1 -0
- package/dist/harnesses/impls/prediction-apy-v0-evaluator/types.js.map +1 -0
- package/dist/harnesses/impls/prediction-v0-baseline/index.d.ts +33 -0
- package/dist/harnesses/impls/prediction-v0-baseline/index.js +109 -0
- package/dist/harnesses/impls/prediction-v0-baseline/index.js.map +1 -0
- package/dist/harnesses/impls/prediction-v0-baseline/strategy.d.ts +8 -0
- package/dist/harnesses/impls/prediction-v0-baseline/strategy.js +41 -0
- package/dist/harnesses/impls/prediction-v0-baseline/strategy.js.map +1 -0
- package/dist/harnesses/impls/prediction-v0-baseline/types.d.ts +7 -0
- package/dist/harnesses/impls/prediction-v0-baseline/types.js.map +1 -0
- package/dist/harnesses/impls/prediction-v0-evaluator/canonical-metrics.d.ts +20 -0
- package/dist/harnesses/impls/prediction-v0-evaluator/canonical-metrics.js.map +1 -0
- package/dist/harnesses/impls/prediction-v0-evaluator/checks/availability.d.ts +9 -0
- package/dist/harnesses/impls/prediction-v0-evaluator/checks/availability.js.map +1 -0
- package/dist/harnesses/impls/prediction-v0-evaluator/checks/eligibility.d.ts +3 -0
- package/dist/harnesses/impls/prediction-v0-evaluator/checks/eligibility.js.map +1 -0
- package/dist/harnesses/impls/prediction-v0-evaluator/checks/integrity.d.ts +15 -0
- package/dist/harnesses/impls/prediction-v0-evaluator/checks/integrity.js +111 -0
- package/dist/harnesses/impls/prediction-v0-evaluator/checks/integrity.js.map +1 -0
- package/dist/harnesses/impls/prediction-v0-evaluator/checks/spec.d.ts +5 -0
- package/dist/harnesses/impls/prediction-v0-evaluator/checks/spec.js.map +1 -0
- package/dist/harnesses/impls/prediction-v0-evaluator/index.d.ts +36 -0
- package/dist/harnesses/impls/prediction-v0-evaluator/index.js +342 -0
- package/dist/harnesses/impls/prediction-v0-evaluator/index.js.map +1 -0
- package/dist/harnesses/impls/prediction-v0-evaluator/score.js.map +1 -0
- package/dist/harnesses/impls/prediction-v0-evaluator/types.js +2 -0
- package/dist/harnesses/impls/prediction-v0-evaluator/types.js.map +1 -0
- package/dist/harnesses/impls/prediction-v1-baseline/index.d.ts +31 -0
- package/dist/harnesses/impls/prediction-v1-baseline/index.js +79 -0
- package/dist/harnesses/impls/prediction-v1-baseline/index.js.map +1 -0
- package/dist/harnesses/impls/prediction-v1-evaluator/index.d.ts +32 -0
- package/dist/harnesses/impls/prediction-v1-evaluator/index.js +219 -0
- package/dist/harnesses/impls/prediction-v1-evaluator/index.js.map +1 -0
- package/dist/harnesses/impls/session-derived-evaluator/index.d.ts +4 -0
- package/dist/harnesses/impls/session-derived-evaluator/index.js +5 -0
- package/dist/harnesses/impls/session-derived-evaluator/index.js.map +1 -0
- package/dist/harnesses/impls/session-derived-evaluator/llm-judge.d.ts +16 -0
- package/dist/harnesses/impls/session-derived-evaluator/llm-judge.js +16 -0
- package/dist/harnesses/impls/session-derived-evaluator/llm-judge.js.map +1 -0
- package/dist/harnesses/impls/session-derived-evaluator/signals.d.ts +13 -0
- package/dist/harnesses/impls/session-derived-evaluator/signals.js +15 -0
- package/dist/harnesses/impls/session-derived-evaluator/signals.js.map +1 -0
- package/dist/harnesses/impls/session-derived-evaluator/structural-similarity.d.ts +7 -0
- package/dist/harnesses/impls/session-derived-evaluator/structural-similarity.js +28 -0
- package/dist/harnesses/impls/session-derived-evaluator/structural-similarity.js.map +1 -0
- package/dist/harnesses/impls/session-derived-evaluator/test-suite-rerun.d.ts +15 -0
- package/dist/harnesses/impls/session-derived-evaluator/test-suite-rerun.js +17 -0
- package/dist/harnesses/impls/session-derived-evaluator/test-suite-rerun.js.map +1 -0
- package/dist/harnesses/impls/swe-rebench-v2-evaluator/eval-runner.d.ts +20 -0
- package/dist/harnesses/impls/swe-rebench-v2-evaluator/eval-runner.js +107 -0
- package/dist/harnesses/impls/swe-rebench-v2-evaluator/eval-runner.js.map +1 -0
- package/dist/harnesses/impls/swe-rebench-v2-evaluator/harness.d.ts +74 -0
- package/dist/harnesses/impls/swe-rebench-v2-evaluator/harness.js +288 -0
- package/dist/harnesses/impls/swe-rebench-v2-evaluator/harness.js.map +1 -0
- package/dist/harnesses/impls/swe-rebench-v2-evaluator/hf-fetcher.d.ts +33 -0
- package/dist/harnesses/impls/swe-rebench-v2-evaluator/hf-fetcher.js +96 -0
- package/dist/harnesses/impls/swe-rebench-v2-evaluator/hf-fetcher.js.map +1 -0
- package/dist/harnesses/impls/swe-rebench-v2-evaluator/index.d.ts +61 -0
- package/dist/harnesses/impls/swe-rebench-v2-evaluator/index.js +42 -0
- package/dist/harnesses/impls/swe-rebench-v2-evaluator/index.js.map +1 -0
- package/dist/harnesses/manifest/index.d.ts +3 -0
- package/dist/harnesses/manifest/index.js +3 -0
- package/dist/harnesses/manifest/index.js.map +1 -0
- package/dist/harnesses/manifest/load.d.ts +7 -0
- package/dist/harnesses/manifest/load.js +49 -0
- package/dist/harnesses/manifest/load.js.map +1 -0
- package/dist/harnesses/manifest/types.d.ts +75 -0
- package/dist/harnesses/manifest/types.js +8 -0
- package/dist/harnesses/manifest/types.js.map +1 -0
- package/dist/harnesses/manifest/verify.d.ts +15 -0
- package/dist/harnesses/manifest/verify.js +53 -0
- package/dist/harnesses/manifest/verify.js.map +1 -0
- package/dist/harnesses/mode-state.d.ts +7 -0
- package/dist/harnesses/mode-state.js +43 -0
- package/dist/harnesses/mode-state.js.map +1 -0
- package/dist/harnesses/names.d.ts +6 -0
- package/dist/harnesses/names.js +24 -0
- package/dist/harnesses/names.js.map +1 -0
- package/dist/harnesses/types.d.ts +276 -0
- package/dist/harnesses/types.js +28 -0
- package/dist/harnesses/types.js.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/main.d.ts +17 -2
- package/dist/main.js +1615 -147
- package/dist/main.js.map +1 -1
- package/dist/mcp/acquire-artifact.d.ts +42 -0
- package/dist/mcp/acquire-artifact.js +169 -0
- package/dist/mcp/acquire-artifact.js.map +1 -0
- package/dist/mcp/operator-server.d.ts +21 -4
- package/dist/mcp/operator-server.js +505 -30
- package/dist/mcp/operator-server.js.map +1 -1
- package/dist/mcp/search-records.d.ts +95 -0
- package/dist/mcp/search-records.js +407 -0
- package/dist/mcp/search-records.js.map +1 -0
- package/dist/mcp/server.d.ts +4 -4
- package/dist/mcp/server.js +258 -61
- package/dist/mcp/server.js.map +1 -1
- package/dist/observability/emit-event.d.ts +2 -2
- package/dist/observability/emit-event.js +2 -2
- package/dist/observability/emit-event.js.map +1 -1
- package/dist/operator-errors.d.ts +14 -0
- package/dist/operator-errors.js +39 -10
- package/dist/operator-errors.js.map +1 -1
- package/dist/plugins/digest.d.ts +1 -0
- package/dist/plugins/digest.js +28 -0
- package/dist/plugins/digest.js.map +1 -0
- package/dist/plugins/index.d.ts +6 -0
- package/dist/plugins/index.js +6 -0
- package/dist/plugins/index.js.map +1 -0
- package/dist/plugins/manifest.d.ts +7 -0
- package/dist/plugins/manifest.js +22 -0
- package/dist/plugins/manifest.js.map +1 -0
- package/dist/plugins/registry.d.ts +9 -0
- package/dist/plugins/registry.js +24 -0
- package/dist/plugins/registry.js.map +1 -0
- package/dist/plugins/resolvers.d.ts +2 -0
- package/dist/plugins/resolvers.js +126 -0
- package/dist/plugins/resolvers.js.map +1 -0
- package/dist/plugins/types.d.ts +35 -0
- package/dist/plugins/types.js +2 -0
- package/dist/plugins/types.js.map +1 -0
- package/dist/plugins/validator.d.ts +3 -0
- package/dist/plugins/validator.js +50 -0
- package/dist/plugins/validator.js.map +1 -0
- package/dist/preflight/claude-auth.d.ts +14 -12
- package/dist/preflight/claude-auth.js +23 -37
- package/dist/preflight/claude-auth.js.map +1 -1
- package/dist/preflight/claude-required.d.ts +8 -0
- package/dist/preflight/claude-required.js +17 -0
- package/dist/preflight/claude-required.js.map +1 -0
- package/dist/runner/claude.d.ts +3 -3
- package/dist/runner/claude.js +66 -26
- package/dist/runner/claude.js.map +1 -1
- package/dist/runner/runner.d.ts +33 -2
- package/dist/runner/simple.d.ts +2 -2
- package/dist/runner/simple.js +2 -2
- package/dist/runner/simple.js.map +1 -1
- package/dist/scripts/donation-consumption-acceptance.d.ts +81 -0
- package/dist/scripts/donation-consumption-acceptance.js +1385 -0
- package/dist/scripts/donation-consumption-acceptance.js.map +1 -0
- package/dist/scripts/fix-node-pty.mjs +113 -0
- package/dist/setup/claude-code-install.d.ts +19 -0
- package/dist/setup/claude-code-install.js +51 -0
- package/dist/setup/claude-code-install.js.map +1 -0
- package/dist/setup-mode.d.ts +34 -0
- package/dist/setup-mode.js +49 -0
- package/dist/setup-mode.js.map +1 -0
- package/dist/solver-nets/contracts.d.ts +2 -0
- package/dist/solver-nets/contracts.js +2 -0
- package/dist/solver-nets/contracts.js.map +1 -0
- package/dist/solver-nets/prediction-operator-ux.d.ts +112 -0
- package/dist/solver-nets/prediction-operator-ux.js +463 -0
- package/dist/solver-nets/prediction-operator-ux.js.map +1 -0
- package/dist/solver-nets/registry.d.ts +64 -0
- package/dist/solver-nets/registry.js +218 -0
- package/dist/solver-nets/registry.js.map +1 -0
- package/dist/solver-types/_session-derived-distill.d.ts +28 -0
- package/dist/solver-types/_session-derived-distill.js +52 -0
- package/dist/solver-types/_session-derived-distill.js.map +1 -0
- package/dist/solver-types/_session-derived-pool.d.ts +10 -0
- package/dist/solver-types/_session-derived-pool.js +27 -0
- package/dist/solver-types/_session-derived-pool.js.map +1 -0
- package/dist/solver-types/_session-derived-state.d.ts +17 -0
- package/dist/solver-types/_session-derived-state.js +25 -0
- package/dist/solver-types/_session-derived-state.js.map +1 -0
- package/dist/solver-types/_swe-rebench-v2-aggregate.d.ts +31 -0
- package/dist/solver-types/_swe-rebench-v2-aggregate.js +49 -0
- package/dist/solver-types/_swe-rebench-v2-aggregate.js.map +1 -0
- package/dist/solver-types/_swe-rebench-v2-escrow.d.ts +27 -0
- package/dist/solver-types/_swe-rebench-v2-escrow.js +26 -0
- package/dist/solver-types/_swe-rebench-v2-escrow.js.map +1 -0
- package/dist/solver-types/_swe-rebench-v2-pool.d.ts +51 -0
- package/dist/solver-types/_swe-rebench-v2-pool.js +72 -0
- package/dist/solver-types/_swe-rebench-v2-pool.js.map +1 -0
- package/dist/solver-types/_swe-rebench-v2-state.d.ts +24 -0
- package/dist/solver-types/_swe-rebench-v2-state.js +54 -0
- package/dist/solver-types/_swe-rebench-v2-state.js.map +1 -0
- package/dist/solver-types/constants.d.ts +5 -0
- package/dist/solver-types/constants.js +6 -0
- package/dist/solver-types/constants.js.map +1 -0
- package/dist/solver-types/index.d.ts +10 -0
- package/dist/solver-types/index.js +32 -0
- package/dist/solver-types/index.js.map +1 -0
- package/dist/solver-types/learner-loop-test.d.ts +2 -0
- package/dist/solver-types/learner-loop-test.js +39 -0
- package/dist/solver-types/learner-loop-test.js.map +1 -0
- package/dist/solver-types/portfolio-v0.d.ts +2 -0
- package/dist/solver-types/portfolio-v0.js +13 -0
- package/dist/solver-types/portfolio-v0.js.map +1 -0
- package/dist/solver-types/prediction-apy-v0-auto.d.ts +27 -0
- package/dist/solver-types/prediction-apy-v0-auto.js +109 -0
- package/dist/solver-types/prediction-apy-v0-auto.js.map +1 -0
- package/dist/solver-types/prediction-apy-v0-template.d.ts +8 -0
- package/dist/solver-types/prediction-apy-v0-template.js +22 -0
- package/dist/solver-types/prediction-apy-v0-template.js.map +1 -0
- package/dist/solver-types/prediction-apy-v0.d.ts +3 -0
- package/dist/solver-types/prediction-apy-v0.js +25 -0
- package/dist/solver-types/prediction-apy-v0.js.map +1 -0
- package/dist/solver-types/prediction-v0-auto.d.ts +69 -0
- package/dist/solver-types/prediction-v0-auto.js +146 -0
- package/dist/solver-types/prediction-v0-auto.js.map +1 -0
- package/dist/solver-types/prediction-v0-template.d.ts +70 -0
- package/dist/solver-types/prediction-v0-template.js +145 -0
- package/dist/solver-types/prediction-v0-template.js.map +1 -0
- package/dist/solver-types/prediction-v0.d.ts +13 -0
- package/dist/solver-types/prediction-v0.js +31 -0
- package/dist/solver-types/prediction-v0.js.map +1 -0
- package/dist/solver-types/prediction-v1-auto.d.ts +122 -0
- package/dist/solver-types/prediction-v1-auto.js +366 -0
- package/dist/solver-types/prediction-v1-auto.js.map +1 -0
- package/dist/solver-types/prediction-v1.d.ts +11 -0
- package/dist/solver-types/prediction-v1.js +27 -0
- package/dist/solver-types/prediction-v1.js.map +1 -0
- package/dist/solver-types/session-derived.d.ts +2 -0
- package/dist/solver-types/session-derived.js +24 -0
- package/dist/solver-types/session-derived.js.map +1 -0
- package/dist/solver-types/solver-type.d.ts +53 -0
- package/dist/solver-types/solver-type.js +6 -0
- package/dist/solver-types/solver-type.js.map +1 -0
- package/dist/solver-types/swe-rebench-v2-auto.d.ts +38 -0
- package/dist/solver-types/swe-rebench-v2-auto.js +56 -0
- package/dist/solver-types/swe-rebench-v2-auto.js.map +1 -0
- package/dist/solver-types/swe-rebench-v2.d.ts +69 -0
- package/dist/solver-types/swe-rebench-v2.js +356 -0
- package/dist/solver-types/swe-rebench-v2.js.map +1 -0
- package/dist/solvernets/daemon-init.d.ts +291 -0
- package/dist/solvernets/daemon-init.js +431 -0
- package/dist/solvernets/daemon-init.js.map +1 -0
- package/dist/solvernets/launch-state-machine.d.ts +165 -0
- package/dist/solvernets/launch-state-machine.js +406 -0
- package/dist/solvernets/launch-state-machine.js.map +1 -0
- package/dist/solvernets/launched-record-dispatcher.d.ts +55 -0
- package/dist/solvernets/launched-record-dispatcher.js +169 -0
- package/dist/solvernets/launched-record-dispatcher.js.map +1 -0
- package/dist/solvernets/lifecycle-transitions.d.ts +183 -0
- package/dist/solvernets/lifecycle-transitions.js +386 -0
- package/dist/solvernets/lifecycle-transitions.js.map +1 -0
- package/dist/solvernets/manifest.d.ts +120 -0
- package/dist/solvernets/manifest.js +166 -0
- package/dist/solvernets/manifest.js.map +1 -0
- package/dist/solvernets/most-recent-wins.d.ts +77 -0
- package/dist/solvernets/most-recent-wins.js +82 -0
- package/dist/solvernets/most-recent-wins.js.map +1 -0
- package/dist/solvernets/registry-client-erc8004.d.ts +239 -0
- package/dist/solvernets/registry-client-erc8004.js +396 -0
- package/dist/solvernets/registry-client-erc8004.js.map +1 -0
- package/dist/solvernets/registry-client.d.ts +121 -0
- package/dist/solvernets/registry-client.js +19 -0
- package/dist/solvernets/registry-client.js.map +1 -0
- package/dist/solvernets/store.d.ts +298 -0
- package/dist/solvernets/store.js +271 -0
- package/dist/solvernets/store.js.map +1 -0
- package/dist/store/captures.d.ts +85 -0
- package/dist/store/captures.js +167 -0
- package/dist/store/captures.js.map +1 -0
- package/dist/store/store.d.ts +235 -21
- package/dist/store/store.js +1000 -46
- package/dist/store/store.js.map +1 -1
- package/dist/tasks/posting-service.d.ts +25 -0
- package/dist/tasks/posting-service.js +149 -0
- package/dist/tasks/posting-service.js.map +1 -0
- package/dist/tasks/signing.d.ts +4 -0
- package/dist/tasks/signing.js +18 -0
- package/dist/tasks/signing.js.map +1 -0
- package/dist/tasks/sources.d.ts +46 -0
- package/dist/tasks/sources.js +45 -0
- package/dist/tasks/sources.js.map +1 -0
- package/dist/templates/harnesses/alternative-harness/README.md.tmpl +44 -0
- package/dist/templates/harnesses/alternative-harness/gitignore.tmpl +3 -0
- package/dist/templates/harnesses/alternative-harness/jinn.manifest.json.tmpl +22 -0
- package/dist/templates/harnesses/alternative-harness/package.json.tmpl +26 -0
- package/dist/templates/harnesses/alternative-harness/src/coordinator.ts.tmpl +50 -0
- package/dist/templates/harnesses/alternative-harness/src/harness.ts.tmpl +31 -0
- package/dist/templates/harnesses/alternative-harness/src/index.ts.tmpl +44 -0
- package/dist/templates/harnesses/alternative-harness/src/mock-harness.ts.tmpl +41 -0
- package/dist/templates/harnesses/alternative-harness/src/phases/debrief.ts.tmpl +28 -0
- package/dist/templates/harnesses/alternative-harness/src/phases/execute.ts.tmpl +33 -0
- package/dist/templates/harnesses/alternative-harness/src/phases/improve.ts.tmpl +31 -0
- package/dist/templates/harnesses/alternative-harness/src/phases/memory.ts.tmpl +31 -0
- package/dist/templates/harnesses/alternative-harness/src/phases/orient.ts.tmpl +21 -0
- package/dist/templates/harnesses/alternative-harness/src/phases/plan.ts.tmpl +25 -0
- package/dist/templates/harnesses/alternative-harness/src/phases/strategize.ts.tmpl +29 -0
- package/dist/templates/harnesses/alternative-harness/test/coordinator.test.ts.tmpl +53 -0
- package/dist/templates/harnesses/alternative-harness/test/unit.test.ts.tmpl +55 -0
- package/dist/templates/harnesses/alternative-harness/tsconfig.json.tmpl +16 -0
- package/dist/templates/harnesses/evaluator/README.md.tmpl +36 -0
- package/dist/templates/harnesses/evaluator/gitignore.tmpl +3 -0
- package/dist/templates/harnesses/evaluator/jinn.manifest.json.tmpl +22 -0
- package/dist/templates/harnesses/evaluator/package.json.tmpl +26 -0
- package/dist/templates/harnesses/evaluator/src/index.ts.tmpl +35 -0
- package/dist/templates/harnesses/evaluator/test/unit.test.ts.tmpl +49 -0
- package/dist/templates/harnesses/evaluator/tsconfig.json.tmpl +16 -0
- package/dist/templates/harnesses/forecaster/README.md.tmpl +25 -0
- package/dist/templates/harnesses/forecaster/gitignore.tmpl +5 -0
- package/dist/templates/harnesses/forecaster/jinn.manifest.json.tmpl +22 -0
- package/dist/templates/harnesses/forecaster/package.json.tmpl +26 -0
- package/dist/templates/harnesses/forecaster/src/index.ts.tmpl +33 -0
- package/dist/templates/harnesses/forecaster/test/unit.test.ts.tmpl +42 -0
- package/dist/templates/harnesses/forecaster/tsconfig.json.tmpl +16 -0
- package/dist/trajectory/collector.d.ts +59 -0
- package/dist/trajectory/collector.js +164 -0
- package/dist/trajectory/collector.js.map +1 -0
- package/dist/trajectory/emit.d.ts +29 -0
- package/dist/trajectory/emit.js +81 -0
- package/dist/trajectory/emit.js.map +1 -0
- package/dist/trajectory/harness-bundle-rules/aider.d.ts +13 -0
- package/dist/trajectory/harness-bundle-rules/aider.js +26 -0
- package/dist/trajectory/harness-bundle-rules/aider.js.map +1 -0
- package/dist/trajectory/harness-bundle-rules/claude-code.d.ts +16 -0
- package/dist/trajectory/harness-bundle-rules/claude-code.js +71 -0
- package/dist/trajectory/harness-bundle-rules/claude-code.js.map +1 -0
- package/dist/trajectory/harness-bundle-rules/codex.d.ts +13 -0
- package/dist/trajectory/harness-bundle-rules/codex.js +96 -0
- package/dist/trajectory/harness-bundle-rules/codex.js.map +1 -0
- package/dist/trajectory/harness-bundle-rules/continue.d.ts +10 -0
- package/dist/trajectory/harness-bundle-rules/continue.js +43 -0
- package/dist/trajectory/harness-bundle-rules/continue.js.map +1 -0
- package/dist/trajectory/harness-bundle-rules/cursor.d.ts +20 -0
- package/dist/trajectory/harness-bundle-rules/cursor.js +55 -0
- package/dist/trajectory/harness-bundle-rules/cursor.js.map +1 -0
- package/dist/trajectory/harness-bundle-rules/gemini-cli.d.ts +15 -0
- package/dist/trajectory/harness-bundle-rules/gemini-cli.js +112 -0
- package/dist/trajectory/harness-bundle-rules/gemini-cli.js.map +1 -0
- package/dist/trajectory/harness-bundle-rules/types.d.ts +25 -0
- package/dist/trajectory/harness-bundle-rules/types.js +15 -0
- package/dist/trajectory/harness-bundle-rules/types.js.map +1 -0
- package/dist/trajectory/harness-bundle-schema.d.ts +74 -0
- package/dist/trajectory/harness-bundle-schema.js +34 -0
- package/dist/trajectory/harness-bundle-schema.js.map +1 -0
- package/dist/trajectory/harness-bundle.d.ts +73 -0
- package/dist/trajectory/harness-bundle.js +128 -0
- package/dist/trajectory/harness-bundle.js.map +1 -0
- package/dist/trajectory/hash-chain.d.ts +18 -0
- package/dist/trajectory/hash-chain.js +23 -0
- package/dist/trajectory/hash-chain.js.map +1 -0
- package/dist/trajectory/index.d.ts +28 -0
- package/dist/trajectory/index.js +28 -0
- package/dist/trajectory/index.js.map +1 -0
- package/dist/trajectory/llm-proxy-spans.d.ts +14 -0
- package/dist/trajectory/llm-proxy-spans.js +51 -0
- package/dist/trajectory/llm-proxy-spans.js.map +1 -0
- package/dist/trajectory/llm-proxy.d.ts +32 -0
- package/dist/trajectory/llm-proxy.js +97 -0
- package/dist/trajectory/llm-proxy.js.map +1 -0
- package/dist/trajectory/processors/credential-scrub.d.ts +11 -0
- package/dist/trajectory/processors/credential-scrub.js +40 -0
- package/dist/trajectory/processors/credential-scrub.js.map +1 -0
- package/dist/trajectory/processors/identity-scrub.d.ts +18 -0
- package/dist/trajectory/processors/identity-scrub.js +43 -0
- package/dist/trajectory/processors/identity-scrub.js.map +1 -0
- package/dist/trajectory/processors/manifest-builder.d.ts +18 -0
- package/dist/trajectory/processors/manifest-builder.js +26 -0
- package/dist/trajectory/processors/manifest-builder.js.map +1 -0
- package/dist/trajectory/processors/path-scrub.d.ts +15 -0
- package/dist/trajectory/processors/path-scrub.js +52 -0
- package/dist/trajectory/processors/path-scrub.js.map +1 -0
- package/dist/trajectory/processors/sentinel.d.ts +16 -0
- package/dist/trajectory/processors/sentinel.js +17 -0
- package/dist/trajectory/processors/sentinel.js.map +1 -0
- package/dist/trajectory/processors/sqlite-exporter.d.ts +32 -0
- package/dist/trajectory/processors/sqlite-exporter.js +48 -0
- package/dist/trajectory/processors/sqlite-exporter.js.map +1 -0
- package/dist/trajectory/processors/transcript-content-scrub.d.ts +9 -0
- package/dist/trajectory/processors/transcript-content-scrub.js +58 -0
- package/dist/trajectory/processors/transcript-content-scrub.js.map +1 -0
- package/dist/trajectory/receiver.d.ts +37 -0
- package/dist/trajectory/receiver.js +616 -0
- package/dist/trajectory/receiver.js.map +1 -0
- package/dist/trajectory/schema.d.ts +102 -14
- package/dist/trajectory/schema.js +29 -0
- package/dist/trajectory/schema.js.map +1 -1
- package/dist/trajectory/secret-scrub.d.ts +32 -0
- package/dist/trajectory/secret-scrub.js +51 -0
- package/dist/trajectory/secret-scrub.js.map +1 -0
- package/dist/trajectory/span-profile.d.ts +27 -0
- package/dist/trajectory/span-profile.js +51 -0
- package/dist/trajectory/span-profile.js.map +1 -0
- package/dist/trajectory/synthetic-span-builder.d.ts +50 -0
- package/dist/trajectory/synthetic-span-builder.js +115 -0
- package/dist/trajectory/synthetic-span-builder.js.map +1 -0
- package/dist/trajectory/transcript-parsers/aider-history.d.ts +42 -0
- package/dist/trajectory/transcript-parsers/aider-history.js +182 -0
- package/dist/trajectory/transcript-parsers/aider-history.js.map +1 -0
- package/dist/trajectory/transcript-parsers/claude-code-jsonl.d.ts +37 -0
- package/dist/trajectory/transcript-parsers/claude-code-jsonl.js +143 -0
- package/dist/trajectory/transcript-parsers/claude-code-jsonl.js.map +1 -0
- package/dist/trajectory/transcript-parsers/codex-session.d.ts +36 -0
- package/dist/trajectory/transcript-parsers/codex-session.js +135 -0
- package/dist/trajectory/transcript-parsers/codex-session.js.map +1 -0
- package/dist/trajectory/transcript-parsers/continue-devdata.d.ts +41 -0
- package/dist/trajectory/transcript-parsers/continue-devdata.js +191 -0
- package/dist/trajectory/transcript-parsers/continue-devdata.js.map +1 -0
- package/dist/trajectory/transcript-parsers/cursor-sqlite.d.ts +38 -0
- package/dist/trajectory/transcript-parsers/cursor-sqlite.js +119 -0
- package/dist/trajectory/transcript-parsers/cursor-sqlite.js.map +1 -0
- package/dist/trajectory/transcript-parsers/gemini-session.d.ts +35 -0
- package/dist/trajectory/transcript-parsers/gemini-session.js +138 -0
- package/dist/trajectory/transcript-parsers/gemini-session.js.map +1 -0
- package/dist/trajectory/transcript-parsers/types.d.ts +101 -0
- package/dist/trajectory/transcript-parsers/types.js +33 -0
- package/dist/trajectory/transcript-parsers/types.js.map +1 -0
- package/dist/trajectory/transcript-watcher.d.ts +62 -0
- package/dist/trajectory/transcript-watcher.js +157 -0
- package/dist/trajectory/transcript-watcher.js.map +1 -0
- package/dist/trajectory/wrappers/http.d.ts +37 -0
- package/dist/trajectory/wrappers/http.js +85 -0
- package/dist/trajectory/wrappers/http.js.map +1 -0
- package/dist/trajectory/wrappers/mcp.d.ts +17 -0
- package/dist/trajectory/wrappers/mcp.js +58 -0
- package/dist/trajectory/wrappers/mcp.js.map +1 -0
- package/dist/trajectory/wrappers/subprocess.d.ts +32 -0
- package/dist/trajectory/wrappers/subprocess.js +70 -0
- package/dist/trajectory/wrappers/subprocess.js.map +1 -0
- package/dist/tx-retry.js +90 -9
- package/dist/tx-retry.js.map +1 -1
- package/dist/types/envelope.d.ts +2742 -0
- package/dist/types/envelope.js +149 -0
- package/dist/types/envelope.js.map +1 -0
- package/dist/types/index.d.ts +4 -4
- package/dist/types/index.js +4 -4
- package/dist/types/index.js.map +1 -1
- package/dist/types/payloads/index.d.ts +12 -0
- package/dist/types/payloads/index.js +62 -0
- package/dist/types/payloads/index.js.map +1 -0
- package/dist/types/payloads/portfolio-v0.d.ts +481 -0
- package/dist/types/payloads/portfolio-v0.js +94 -0
- package/dist/types/payloads/portfolio-v0.js.map +1 -0
- package/dist/types/payloads/prediction-apy-v0.d.ts +231 -0
- package/dist/types/payloads/prediction-apy-v0.js +63 -0
- package/dist/types/payloads/prediction-apy-v0.js.map +1 -0
- package/dist/types/payloads/prediction-v0.d.ts +262 -0
- package/dist/types/payloads/prediction-v0.js +73 -0
- package/dist/types/payloads/prediction-v0.js.map +1 -0
- package/dist/types/payloads/prediction-v1.d.ts +2 -0
- package/dist/types/payloads/prediction-v1.js +2 -0
- package/dist/types/payloads/prediction-v1.js.map +1 -0
- package/dist/types/portfolio.d.ts +31 -698
- package/dist/types/portfolio.js +20 -110
- package/dist/types/portfolio.js.map +1 -1
- package/dist/types/prediction-apy.d.ts +26 -366
- package/dist/types/prediction-apy.js +12 -68
- package/dist/types/prediction-apy.js.map +1 -1
- package/dist/types/prediction-v1.d.ts +2 -0
- package/dist/types/prediction-v1.js +2 -0
- package/dist/types/prediction-v1.js.map +1 -0
- package/dist/types/prediction.d.ts +546 -382
- package/dist/types/prediction.js +16 -87
- package/dist/types/prediction.js.map +1 -1
- package/dist/types/session-provenance.d.ts +71 -0
- package/dist/types/session-provenance.js +19 -0
- package/dist/types/session-provenance.js.map +1 -0
- package/dist/types/task-document.d.ts +1121 -0
- package/dist/types/task-document.js +99 -0
- package/dist/types/task-document.js.map +1 -0
- package/dist/types/task.d.ts +805 -0
- package/dist/types/task.js +88 -0
- package/dist/types/task.js.map +1 -0
- package/dist/types/window.d.ts +12 -0
- package/dist/types/window.js +6 -0
- package/dist/types/window.js.map +1 -0
- package/dist/util/path-safety.d.ts +21 -0
- package/dist/util/path-safety.js +28 -0
- package/dist/util/path-safety.js.map +1 -0
- package/dist/util/redact-rpc-urls.d.ts +5 -0
- package/dist/util/redact-rpc-urls.js +9 -0
- package/dist/util/redact-rpc-urls.js.map +1 -0
- package/dist/vendor/@jinn-network/sdk/README.md +89 -0
- package/dist/vendor/@jinn-network/sdk/dist/capabilities.d.ts +52 -0
- package/dist/vendor/@jinn-network/sdk/dist/capabilities.js +1 -0
- package/dist/vendor/@jinn-network/sdk/dist/checkpoint.d.ts +120 -0
- package/dist/vendor/@jinn-network/sdk/dist/checkpoint.js +39 -0
- package/dist/vendor/@jinn-network/sdk/dist/contracts.d.ts +145 -0
- package/dist/vendor/@jinn-network/sdk/dist/contracts.js +317 -0
- package/dist/vendor/@jinn-network/sdk/dist/harness.d.ts +120 -0
- package/dist/vendor/@jinn-network/sdk/dist/harness.js +31 -0
- package/dist/vendor/@jinn-network/sdk/dist/index.d.ts +4 -0
- package/dist/vendor/@jinn-network/sdk/dist/index.js +7 -0
- package/dist/vendor/@jinn-network/sdk/dist/json-schema.d.ts +32 -0
- package/dist/vendor/@jinn-network/sdk/dist/json-schema.js +131 -0
- package/dist/vendor/@jinn-network/sdk/dist/manifest.d.ts +69 -0
- package/dist/vendor/@jinn-network/sdk/dist/manifest.js +3 -0
- package/dist/vendor/@jinn-network/sdk/dist/payloads/prediction-v1.d.ts +223 -0
- package/dist/vendor/@jinn-network/sdk/dist/payloads/prediction-v1.js +64 -0
- package/dist/vendor/@jinn-network/sdk/dist/payloads/session-derived.d.ts +359 -0
- package/dist/vendor/@jinn-network/sdk/dist/payloads/session-derived.js +60 -0
- package/dist/vendor/@jinn-network/sdk/dist/payloads/swe-rebench-v2.d.ts +110 -0
- package/dist/vendor/@jinn-network/sdk/dist/payloads/swe-rebench-v2.js +58 -0
- package/dist/vendor/@jinn-network/sdk/dist/plugins.d.ts +36 -0
- package/dist/vendor/@jinn-network/sdk/dist/plugins.js +54 -0
- package/dist/vendor/@jinn-network/sdk/dist/prediction-v1.d.ts +870 -0
- package/dist/vendor/@jinn-network/sdk/dist/prediction-v1.js +80 -0
- package/dist/vendor/@jinn-network/sdk/dist/session-derived/distill-prompt-v1.d.ts +2 -0
- package/dist/vendor/@jinn-network/sdk/dist/session-derived/distill-prompt-v1.js +10 -0
- package/dist/vendor/@jinn-network/sdk/dist/solvernets/index.d.ts +6 -0
- package/dist/vendor/@jinn-network/sdk/dist/solvernets/index.js +8 -0
- package/dist/vendor/@jinn-network/sdk/dist/solvernets/manifest-schema.d.ts +559 -0
- package/dist/vendor/@jinn-network/sdk/dist/solvernets/manifest-schema.js +126 -0
- package/dist/vendor/@jinn-network/sdk/dist/solvernets/prediction-v1.d.ts +6 -0
- package/dist/vendor/@jinn-network/sdk/dist/solvernets/prediction-v1.js +3 -0
- package/dist/vendor/@jinn-network/sdk/dist/solvernets/swe-rebench-v2.d.ts +4 -0
- package/dist/vendor/@jinn-network/sdk/dist/solvernets/swe-rebench-v2.js +2 -0
- package/dist/vendor/@jinn-network/sdk/dist/swe-rebench-v2.d.ts +66 -0
- package/dist/vendor/@jinn-network/sdk/dist/swe-rebench-v2.js +44 -0
- package/dist/vendor/@jinn-network/sdk/dist/types.d.ts +116 -0
- package/dist/vendor/@jinn-network/sdk/dist/types.js +21 -0
- package/dist/vendor/@jinn-network/sdk/package.json +43 -0
- package/dist/venues/hyperliquid/account-value.d.ts +1 -1
- package/dist/venues/hyperliquid/account-value.js +1 -1
- package/dist/venues/polymarket/client.d.ts +77 -0
- package/dist/venues/polymarket/client.js +309 -0
- package/dist/venues/polymarket/client.js.map +1 -0
- package/dist/withdraw/run-withdraw-plan.js +0 -2
- package/dist/withdraw/run-withdraw-plan.js.map +1 -1
- package/dist/x402/acquire.d.ts +14 -3
- package/dist/x402/acquire.js +28 -11
- package/dist/x402/acquire.js.map +1 -1
- package/dist/x402/handler.d.ts +15 -3
- package/dist/x402/handler.js +189 -24
- package/dist/x402/handler.js.map +1 -1
- package/package.json +60 -15
- package/plugins/claude-code-learner/.claude-plugin/plugin.json +9 -0
- package/plugins/claude-code-learner/.codex-plugin/plugin.json +39 -0
- package/plugins/claude-code-learner/AGENTS.md +40 -0
- package/plugins/claude-code-learner/CLAUDE.md +33 -0
- package/plugins/claude-code-learner/README.md +59 -0
- package/plugins/claude-code-learner/hooks/hooks.json +16 -0
- package/plugins/claude-code-learner/hooks/session-start +38 -0
- package/plugins/claude-code-learner/skills/learn/SKILL.md +412 -0
- package/plugins/claude-code-learner/skills/learn/analyst-prompt.md +68 -0
- package/plugins/claude-code-learner/skills/learn/consolidator-prompt.md +94 -0
- package/plugins/claude-code-learner/skills/learn/explorer-prompt.md +53 -0
- package/plugins/claude-code-learner/skills/learn/planner-prompt.md +87 -0
- package/plugins/claude-code-learner/skills/learn/promoter-prompt.md +113 -0
- package/plugins/claude-code-learner/skills/learn/step-worker-prompt.md +47 -0
- package/plugins/claude-code-learner/skills/learn/strategist-prompt.md +85 -0
- package/plugins/jinn-prediction-plugin/.claude-plugin/plugin.json +19 -0
- package/plugins/jinn-prediction-plugin/.mcp.json +8 -0
- package/plugins/jinn-prediction-plugin/GEMINI.md +7 -0
- package/plugins/jinn-prediction-plugin/gemini-extension.json +13 -0
- package/plugins/jinn-prediction-plugin/jinn.plugin.json +26 -0
- package/plugins/jinn-prediction-plugin/mcp/polymarket-server.mjs +322 -0
- package/plugins/jinn-prediction-plugin/schemas/prediction-v0-solution.schema.json +12 -0
- package/plugins/jinn-prediction-plugin/schemas/prediction-v0-task.schema.json +25 -0
- package/plugins/jinn-prediction-plugin/schemas/prediction-v0-verdict.schema.json +11 -0
- package/plugins/jinn-prediction-plugin/schemas/prediction-v1-solution.schema.json +34 -0
- package/plugins/jinn-prediction-plugin/schemas/prediction-v1-task.schema.json +118 -0
- package/plugins/jinn-prediction-plugin/schemas/prediction-v1-verdict.schema.json +84 -0
- package/plugins/jinn-prediction-plugin/skills/base-rate-forecasting/SKILL.md +3 -0
- package/plugins/jinn-prediction-plugin/skills/calibration/SKILL.md +3 -0
- package/plugins/jinn-prediction-plugin/skills/common-biases/SKILL.md +3 -0
- package/plugins/jinn-prediction-plugin/skills/polymarket-task-handling/SKILL.md +5 -0
- package/plugins/jinn-prediction-plugin/skills/prediction-corpus-retrieval/SKILL.md +35 -0
- package/plugins/network-tools/.claude-plugin/plugin.json +12 -0
- package/plugins/network-tools/.codex-plugin/plugin.json +39 -0
- package/plugins/network-tools/.mcp.json +11 -0
- package/plugins/network-tools/jinn.plugin.json +29 -0
- package/plugins/network-tools/mcp/jinn-client-server.mjs +110 -0
- package/plugins/swe-rebench-v2-runtime/.claude-plugin/plugin.json +5 -0
- package/plugins/swe-rebench-v2-runtime/.codex-plugin/plugin.json +39 -0
- package/plugins/swe-rebench-v2-runtime/README.md +11 -0
- package/plugins/swe-rebench-v2-runtime/jinn.plugin.json +12 -0
- package/plugins/swe-rebench-v2-runtime/skills/orient/SKILL.md +25 -0
- package/plugins/swe-rebench-v2-runtime/skills/plan/SKILL.md +64 -0
- package/skills/jinn-operator/SKILL.md +120 -101
- package/templates/harnesses/alternative-harness/README.md.tmpl +44 -0
- package/templates/harnesses/alternative-harness/gitignore.tmpl +3 -0
- package/templates/harnesses/alternative-harness/jinn.manifest.json.tmpl +22 -0
- package/templates/harnesses/alternative-harness/package.json.tmpl +26 -0
- package/templates/harnesses/alternative-harness/src/coordinator.ts.tmpl +50 -0
- package/templates/harnesses/alternative-harness/src/harness.ts.tmpl +31 -0
- package/templates/harnesses/alternative-harness/src/index.ts.tmpl +44 -0
- package/templates/harnesses/alternative-harness/src/mock-harness.ts.tmpl +41 -0
- package/templates/harnesses/alternative-harness/src/phases/debrief.ts.tmpl +28 -0
- package/templates/harnesses/alternative-harness/src/phases/execute.ts.tmpl +33 -0
- package/templates/harnesses/alternative-harness/src/phases/improve.ts.tmpl +31 -0
- package/templates/harnesses/alternative-harness/src/phases/memory.ts.tmpl +31 -0
- package/templates/harnesses/alternative-harness/src/phases/orient.ts.tmpl +21 -0
- package/templates/harnesses/alternative-harness/src/phases/plan.ts.tmpl +25 -0
- package/templates/harnesses/alternative-harness/src/phases/strategize.ts.tmpl +29 -0
- package/templates/harnesses/alternative-harness/test/coordinator.test.ts.tmpl +53 -0
- package/templates/harnesses/alternative-harness/test/unit.test.ts.tmpl +55 -0
- package/templates/harnesses/alternative-harness/tsconfig.json.tmpl +16 -0
- package/templates/harnesses/evaluator/README.md.tmpl +36 -0
- package/templates/harnesses/evaluator/gitignore.tmpl +3 -0
- package/templates/harnesses/evaluator/jinn.manifest.json.tmpl +22 -0
- package/templates/harnesses/evaluator/package.json.tmpl +26 -0
- package/templates/harnesses/evaluator/src/index.ts.tmpl +35 -0
- package/templates/harnesses/evaluator/test/unit.test.ts.tmpl +49 -0
- package/templates/harnesses/evaluator/tsconfig.json.tmpl +16 -0
- package/templates/harnesses/forecaster/README.md.tmpl +25 -0
- package/templates/harnesses/forecaster/gitignore.tmpl +5 -0
- package/templates/harnesses/forecaster/jinn.manifest.json.tmpl +22 -0
- package/templates/harnesses/forecaster/package.json.tmpl +26 -0
- package/templates/harnesses/forecaster/src/index.ts.tmpl +33 -0
- package/templates/harnesses/forecaster/test/unit.test.ts.tmpl +42 -0
- package/templates/harnesses/forecaster/tsconfig.json.tmpl +16 -0
- package/dist/adapters/claim-registry/abi.d.ts +0 -127
- package/dist/adapters/claim-registry/abi.js +0 -93
- package/dist/adapters/claim-registry/abi.js.map +0 -1
- package/dist/adapters/claim-registry/client.d.ts +0 -89
- package/dist/adapters/claim-registry/client.js +0 -205
- package/dist/adapters/claim-registry/client.js.map +0 -1
- package/dist/adapters/mech/claim-policy.d.ts +0 -40
- package/dist/adapters/mech/claim-policy.js +0 -104
- package/dist/adapters/mech/claim-policy.js.map +0 -1
- package/dist/bin/jinn-mcp.d.ts +0 -2
- package/dist/bin/jinn-mcp.js +0 -10
- package/dist/bin/jinn-mcp.js.map +0 -1
- package/dist/cli/commands/intents.d.ts +0 -17
- package/dist/cli/commands/intents.js +0 -489
- package/dist/cli/commands/intents.js.map +0 -1
- package/dist/cli/commands/plugin-install.js +0 -803
- package/dist/cli/commands/plugin-install.js.map +0 -1
- package/dist/cli/commands/submit-intent.js +0 -245
- package/dist/cli/commands/submit-intent.js.map +0 -1
- package/dist/cli/intent-registry-access.d.ts +0 -62
- package/dist/cli/intent-registry-access.js +0 -165
- package/dist/cli/intent-registry-access.js.map +0 -1
- package/dist/discovery/registry.d.ts +0 -97
- package/dist/discovery/registry.js +0 -177
- package/dist/discovery/registry.js.map +0 -1
- package/dist/discovery/subgraph.d.ts +0 -37
- package/dist/discovery/subgraph.js +0 -87
- package/dist/discovery/subgraph.js.map +0 -1
- package/dist/intents/kinds/constants.d.ts +0 -5
- package/dist/intents/kinds/constants.js +0 -6
- package/dist/intents/kinds/constants.js.map +0 -1
- package/dist/intents/kinds/index.d.ts +0 -28
- package/dist/intents/kinds/index.js +0 -50
- package/dist/intents/kinds/index.js.map +0 -1
- package/dist/intents/kinds/portfolio-v0.d.ts +0 -2
- package/dist/intents/kinds/portfolio-v0.js +0 -13
- package/dist/intents/kinds/portfolio-v0.js.map +0 -1
- package/dist/intents/kinds/prediction-apy-v0.d.ts +0 -3
- package/dist/intents/kinds/prediction-apy-v0.js +0 -21
- package/dist/intents/kinds/prediction-apy-v0.js.map +0 -1
- package/dist/intents/kinds/prediction-v0.d.ts +0 -3
- package/dist/intents/kinds/prediction-v0.js +0 -32
- package/dist/intents/kinds/prediction-v0.js.map +0 -1
- package/dist/intents/kinds/spec-kind.d.ts +0 -38
- package/dist/intents/kinds/spec-kind.js +0 -6
- package/dist/intents/kinds/spec-kind.js.map +0 -1
- package/dist/intents/posting-service.d.ts +0 -26
- package/dist/intents/posting-service.js +0 -218
- package/dist/intents/posting-service.js.map +0 -1
- package/dist/intents/prediction-apy-v0-auto.d.ts +0 -11
- package/dist/intents/prediction-apy-v0-auto.js +0 -46
- package/dist/intents/prediction-apy-v0-auto.js.map +0 -1
- package/dist/intents/prediction-apy-v0-template.d.ts +0 -8
- package/dist/intents/prediction-apy-v0-template.js +0 -22
- package/dist/intents/prediction-apy-v0-template.js.map +0 -1
- package/dist/intents/prediction-v0-auto.d.ts +0 -53
- package/dist/intents/prediction-v0-auto.js +0 -84
- package/dist/intents/prediction-v0-auto.js.map +0 -1
- package/dist/intents/prediction-v0-template.d.ts +0 -70
- package/dist/intents/prediction-v0-template.js +0 -145
- package/dist/intents/prediction-v0-template.js.map +0 -1
- package/dist/intents/sources.d.ts +0 -39
- package/dist/intents/sources.js +0 -42
- package/dist/intents/sources.js.map +0 -1
- package/dist/restorer/engine/canonical-json.d.ts +0 -18
- package/dist/restorer/engine/canonical-json.js +0 -59
- package/dist/restorer/engine/canonical-json.js.map +0 -1
- package/dist/restorer/engine/claim.d.ts +0 -69
- package/dist/restorer/engine/claim.js +0 -104
- package/dist/restorer/engine/claim.js.map +0 -1
- package/dist/restorer/engine/delivery.d.ts +0 -52
- package/dist/restorer/engine/delivery.js +0 -63
- package/dist/restorer/engine/delivery.js.map +0 -1
- package/dist/restorer/engine/engine.d.ts +0 -213
- package/dist/restorer/engine/engine.js +0 -769
- package/dist/restorer/engine/engine.js.map +0 -1
- package/dist/restorer/engine/manifest-assembly.d.ts +0 -67
- package/dist/restorer/engine/manifest-assembly.js +0 -79
- package/dist/restorer/engine/manifest-assembly.js.map +0 -1
- package/dist/restorer/engine/packaging.d.ts +0 -87
- package/dist/restorer/engine/packaging.js +0 -350
- package/dist/restorer/engine/packaging.js.map +0 -1
- package/dist/restorer/engine/persistence.d.ts +0 -170
- package/dist/restorer/engine/persistence.js +0 -381
- package/dist/restorer/engine/persistence.js.map +0 -1
- package/dist/restorer/engine/recovery.d.ts +0 -22
- package/dist/restorer/engine/recovery.js +0 -24
- package/dist/restorer/engine/recovery.js.map +0 -1
- package/dist/restorer/engine/registry.d.ts +0 -62
- package/dist/restorer/engine/registry.js +0 -73
- package/dist/restorer/engine/registry.js.map +0 -1
- package/dist/restorer/engine/signing.d.ts +0 -30
- package/dist/restorer/engine/signing.js +0 -39
- package/dist/restorer/engine/signing.js.map +0 -1
- package/dist/restorer/engine/state.d.ts +0 -42
- package/dist/restorer/engine/state.js +0 -87
- package/dist/restorer/engine/state.js.map +0 -1
- package/dist/restorer/impls/claude-mcp-hyperliquid/api-wallet.d.ts +0 -64
- package/dist/restorer/impls/claude-mcp-hyperliquid/api-wallet.js.map +0 -1
- package/dist/restorer/impls/claude-mcp-hyperliquid/index.d.ts +0 -104
- package/dist/restorer/impls/claude-mcp-hyperliquid/index.js +0 -721
- package/dist/restorer/impls/claude-mcp-hyperliquid/index.js.map +0 -1
- package/dist/restorer/impls/claude-mcp-hyperliquid/mcp-tools.js.map +0 -1
- package/dist/restorer/impls/claude-mcp-hyperliquid/safety-rails.js.map +0 -1
- package/dist/restorer/impls/claude-mcp-hyperliquid/session-orchestrator.d.ts +0 -97
- package/dist/restorer/impls/claude-mcp-hyperliquid/session-orchestrator.js +0 -226
- package/dist/restorer/impls/claude-mcp-hyperliquid/session-orchestrator.js.map +0 -1
- package/dist/restorer/impls/claude-mcp-prediction/index.d.ts +0 -44
- package/dist/restorer/impls/claude-mcp-prediction/index.js +0 -239
- package/dist/restorer/impls/claude-mcp-prediction/index.js.map +0 -1
- package/dist/restorer/impls/claude-mcp-prediction/mcp-tools.js +0 -135
- package/dist/restorer/impls/claude-mcp-prediction/mcp-tools.js.map +0 -1
- package/dist/restorer/impls/claude-mcp-prediction/prompt.d.ts +0 -8
- package/dist/restorer/impls/claude-mcp-prediction/prompt.js +0 -54
- package/dist/restorer/impls/claude-mcp-prediction/prompt.js.map +0 -1
- package/dist/restorer/impls/claude-mcp-prediction/session-orchestrator.d.ts +0 -36
- package/dist/restorer/impls/claude-mcp-prediction/session-orchestrator.js +0 -137
- package/dist/restorer/impls/claude-mcp-prediction/session-orchestrator.js.map +0 -1
- package/dist/restorer/impls/claude-mcp-prediction/types.d.ts +0 -84
- package/dist/restorer/impls/claude-mcp-prediction/types.js +0 -6
- package/dist/restorer/impls/claude-mcp-prediction/types.js.map +0 -1
- package/dist/restorer/impls/claude-mcp-prediction-apy/index.d.ts +0 -34
- package/dist/restorer/impls/claude-mcp-prediction-apy/index.js +0 -233
- package/dist/restorer/impls/claude-mcp-prediction-apy/index.js.map +0 -1
- package/dist/restorer/impls/claude-mcp-prediction-apy/mcp-tools.js +0 -136
- package/dist/restorer/impls/claude-mcp-prediction-apy/mcp-tools.js.map +0 -1
- package/dist/restorer/impls/claude-mcp-prediction-apy/prompt.d.ts +0 -7
- package/dist/restorer/impls/claude-mcp-prediction-apy/prompt.js +0 -46
- package/dist/restorer/impls/claude-mcp-prediction-apy/prompt.js.map +0 -1
- package/dist/restorer/impls/claude-mcp-prediction-apy/session-orchestrator.d.ts +0 -27
- package/dist/restorer/impls/claude-mcp-prediction-apy/session-orchestrator.js +0 -128
- package/dist/restorer/impls/claude-mcp-prediction-apy/session-orchestrator.js.map +0 -1
- package/dist/restorer/impls/claude-mcp-prediction-apy/types.d.ts +0 -64
- package/dist/restorer/impls/claude-mcp-prediction-apy/types.js +0 -6
- package/dist/restorer/impls/claude-mcp-prediction-apy/types.js.map +0 -1
- package/dist/restorer/impls/evaluation-context.d.ts +0 -16
- package/dist/restorer/impls/evaluation-context.js +0 -18
- package/dist/restorer/impls/evaluation-context.js.map +0 -1
- package/dist/restorer/impls/index.d.ts +0 -46
- package/dist/restorer/impls/index.js +0 -88
- package/dist/restorer/impls/index.js.map +0 -1
- package/dist/restorer/impls/legacy-claude/index.d.ts +0 -52
- package/dist/restorer/impls/legacy-claude/index.js +0 -140
- package/dist/restorer/impls/legacy-claude/index.js.map +0 -1
- package/dist/restorer/impls/portfolio-v0-evaluator/canonical-metrics.d.ts +0 -68
- package/dist/restorer/impls/portfolio-v0-evaluator/canonical-metrics.js +0 -117
- package/dist/restorer/impls/portfolio-v0-evaluator/canonical-metrics.js.map +0 -1
- package/dist/restorer/impls/portfolio-v0-evaluator/checks/availability.js.map +0 -1
- package/dist/restorer/impls/portfolio-v0-evaluator/checks/consistency.d.ts +0 -78
- package/dist/restorer/impls/portfolio-v0-evaluator/checks/consistency.js +0 -274
- package/dist/restorer/impls/portfolio-v0-evaluator/checks/consistency.js.map +0 -1
- package/dist/restorer/impls/portfolio-v0-evaluator/checks/eligibility.d.ts +0 -23
- package/dist/restorer/impls/portfolio-v0-evaluator/checks/eligibility.js +0 -49
- package/dist/restorer/impls/portfolio-v0-evaluator/checks/eligibility.js.map +0 -1
- package/dist/restorer/impls/portfolio-v0-evaluator/checks/integrity.d.ts +0 -25
- package/dist/restorer/impls/portfolio-v0-evaluator/checks/integrity.js +0 -44
- package/dist/restorer/impls/portfolio-v0-evaluator/checks/integrity.js.map +0 -1
- package/dist/restorer/impls/portfolio-v0-evaluator/checks/spec.d.ts +0 -17
- package/dist/restorer/impls/portfolio-v0-evaluator/checks/spec.js +0 -43
- package/dist/restorer/impls/portfolio-v0-evaluator/checks/spec.js.map +0 -1
- package/dist/restorer/impls/portfolio-v0-evaluator/index.d.ts +0 -44
- package/dist/restorer/impls/portfolio-v0-evaluator/index.js +0 -440
- package/dist/restorer/impls/portfolio-v0-evaluator/index.js.map +0 -1
- package/dist/restorer/impls/portfolio-v0-evaluator/score.js.map +0 -1
- package/dist/restorer/impls/portfolio-v0-evaluator/types.d.ts +0 -34
- package/dist/restorer/impls/portfolio-v0-evaluator/types.js.map +0 -1
- package/dist/restorer/impls/prediction-apy-v0-baseline/index.d.ts +0 -40
- package/dist/restorer/impls/prediction-apy-v0-baseline/index.js +0 -107
- package/dist/restorer/impls/prediction-apy-v0-baseline/index.js.map +0 -1
- package/dist/restorer/impls/prediction-apy-v0-baseline/strategy.js.map +0 -1
- package/dist/restorer/impls/prediction-apy-v0-baseline/types.js.map +0 -1
- package/dist/restorer/impls/prediction-apy-v0-evaluator/canonical-metrics.d.ts +0 -6
- package/dist/restorer/impls/prediction-apy-v0-evaluator/canonical-metrics.js +0 -11
- package/dist/restorer/impls/prediction-apy-v0-evaluator/canonical-metrics.js.map +0 -1
- package/dist/restorer/impls/prediction-apy-v0-evaluator/index.d.ts +0 -42
- package/dist/restorer/impls/prediction-apy-v0-evaluator/index.js +0 -208
- package/dist/restorer/impls/prediction-apy-v0-evaluator/index.js.map +0 -1
- package/dist/restorer/impls/prediction-apy-v0-evaluator/parse-submission.d.ts +0 -7
- package/dist/restorer/impls/prediction-apy-v0-evaluator/parse-submission.js +0 -29
- package/dist/restorer/impls/prediction-apy-v0-evaluator/parse-submission.js.map +0 -1
- package/dist/restorer/impls/prediction-apy-v0-evaluator/score.js.map +0 -1
- package/dist/restorer/impls/prediction-apy-v0-evaluator/types.js.map +0 -1
- package/dist/restorer/impls/prediction-v0-baseline/index.d.ts +0 -31
- package/dist/restorer/impls/prediction-v0-baseline/index.js +0 -100
- package/dist/restorer/impls/prediction-v0-baseline/index.js.map +0 -1
- package/dist/restorer/impls/prediction-v0-baseline/strategy.d.ts +0 -8
- package/dist/restorer/impls/prediction-v0-baseline/strategy.js +0 -41
- package/dist/restorer/impls/prediction-v0-baseline/strategy.js.map +0 -1
- package/dist/restorer/impls/prediction-v0-baseline/types.d.ts +0 -7
- package/dist/restorer/impls/prediction-v0-baseline/types.js.map +0 -1
- package/dist/restorer/impls/prediction-v0-evaluator/canonical-metrics.d.ts +0 -20
- package/dist/restorer/impls/prediction-v0-evaluator/canonical-metrics.js.map +0 -1
- package/dist/restorer/impls/prediction-v0-evaluator/checks/availability.d.ts +0 -9
- package/dist/restorer/impls/prediction-v0-evaluator/checks/availability.js.map +0 -1
- package/dist/restorer/impls/prediction-v0-evaluator/checks/eligibility.d.ts +0 -3
- package/dist/restorer/impls/prediction-v0-evaluator/checks/eligibility.js.map +0 -1
- package/dist/restorer/impls/prediction-v0-evaluator/checks/integrity.d.ts +0 -13
- package/dist/restorer/impls/prediction-v0-evaluator/checks/integrity.js +0 -111
- package/dist/restorer/impls/prediction-v0-evaluator/checks/integrity.js.map +0 -1
- package/dist/restorer/impls/prediction-v0-evaluator/checks/spec.d.ts +0 -5
- package/dist/restorer/impls/prediction-v0-evaluator/checks/spec.js.map +0 -1
- package/dist/restorer/impls/prediction-v0-evaluator/index.d.ts +0 -36
- package/dist/restorer/impls/prediction-v0-evaluator/index.js +0 -234
- package/dist/restorer/impls/prediction-v0-evaluator/index.js.map +0 -1
- package/dist/restorer/impls/prediction-v0-evaluator/score.js.map +0 -1
- package/dist/restorer/impls/prediction-v0-evaluator/types.js.map +0 -1
- package/dist/restorer/types.d.ts +0 -194
- package/dist/restorer/types.js +0 -28
- package/dist/restorer/types.js.map +0 -1
- package/dist/types/desired-state.d.ts +0 -94
- package/dist/types/desired-state.js +0 -36
- package/dist/types/desired-state.js.map +0 -1
- /package/dist/cli/commands/{plugin-install.d.ts → solver-nets.d.ts} +0 -0
- /package/dist/cli/commands/{submit-intent.d.ts → tasks.d.ts} +0 -0
- /package/dist/{restorer/impls/prediction-apy-v0-baseline → harnesses/impls/claude-code-learner}/types.js +0 -0
- /package/dist/{restorer → harnesses}/impls/claude-mcp-hyperliquid/api-wallet.js +0 -0
- /package/dist/{restorer → harnesses}/impls/claude-mcp-hyperliquid/mcp-tools.d.ts +0 -0
- /package/dist/{restorer → harnesses}/impls/claude-mcp-hyperliquid/mcp-tools.js +0 -0
- /package/dist/{restorer → harnesses}/impls/claude-mcp-hyperliquid/safety-rails.d.ts +0 -0
- /package/dist/{restorer → harnesses}/impls/claude-mcp-hyperliquid/safety-rails.js +0 -0
- /package/dist/{restorer → harnesses}/impls/claude-mcp-prediction/mcp-tools.d.ts +0 -0
- /package/dist/{restorer → harnesses}/impls/claude-mcp-prediction-apy/mcp-tools.d.ts +0 -0
- /package/dist/{restorer → harnesses}/impls/portfolio-v0-evaluator/checks/availability.d.ts +0 -0
- /package/dist/{restorer → harnesses}/impls/portfolio-v0-evaluator/checks/availability.js +0 -0
- /package/dist/{restorer → harnesses}/impls/portfolio-v0-evaluator/score.d.ts +0 -0
- /package/dist/{restorer → harnesses}/impls/portfolio-v0-evaluator/score.js +0 -0
- /package/dist/{restorer → harnesses}/impls/portfolio-v0-evaluator/types.js +0 -0
- /package/dist/{restorer → harnesses}/impls/prediction-apy-v0-baseline/strategy.d.ts +0 -0
- /package/dist/{restorer → harnesses}/impls/prediction-apy-v0-baseline/strategy.js +0 -0
- /package/dist/{restorer → harnesses}/impls/prediction-apy-v0-baseline/types.d.ts +0 -0
- /package/dist/{restorer/impls/prediction-apy-v0-evaluator → harnesses/impls/prediction-apy-v0-baseline}/types.js +0 -0
- /package/dist/{restorer → harnesses}/impls/prediction-apy-v0-evaluator/score.d.ts +0 -0
- /package/dist/{restorer → harnesses}/impls/prediction-apy-v0-evaluator/score.js +0 -0
- /package/dist/{restorer → harnesses}/impls/prediction-apy-v0-evaluator/types.d.ts +0 -0
- /package/dist/{restorer/impls/prediction-v0-baseline → harnesses/impls/prediction-apy-v0-evaluator}/types.js +0 -0
- /package/dist/{restorer/impls/prediction-v0-evaluator → harnesses/impls/prediction-v0-baseline}/types.js +0 -0
- /package/dist/{restorer → harnesses}/impls/prediction-v0-evaluator/canonical-metrics.js +0 -0
- /package/dist/{restorer → harnesses}/impls/prediction-v0-evaluator/checks/availability.js +0 -0
- /package/dist/{restorer → harnesses}/impls/prediction-v0-evaluator/checks/eligibility.js +0 -0
- /package/dist/{restorer → harnesses}/impls/prediction-v0-evaluator/checks/spec.js +0 -0
- /package/dist/{restorer → harnesses}/impls/prediction-v0-evaluator/score.d.ts +0 -0
- /package/dist/{restorer → harnesses}/impls/prediction-v0-evaluator/score.js +0 -0
- /package/dist/{restorer → harnesses}/impls/prediction-v0-evaluator/types.d.ts +0 -0
package/dist/main.js
CHANGED
|
@@ -10,63 +10,305 @@
|
|
|
10
10
|
* 2. Config file (~/.jinn-client/config.json or --config <path>)
|
|
11
11
|
* 3. Built-in defaults
|
|
12
12
|
*
|
|
13
|
-
*
|
|
13
|
+
* Keystore password (used to encrypt the wallet at rest) resolves in this
|
|
14
|
+
* order: JINN_PASSWORD env var → ~/.jinn-client/keystore-password file →
|
|
15
|
+
* auto-generated random value (persisted mode 0600 to that same file). A
|
|
16
|
+
* brand-new operator can run `jinn run` with no env var and no input.
|
|
14
17
|
*
|
|
15
18
|
* Canonical operator command:
|
|
16
19
|
* jinn run
|
|
17
20
|
*/
|
|
18
21
|
import { config as dotenvConfig } from 'dotenv';
|
|
22
|
+
import { existsSync, mkdirSync, readFileSync, unlinkSync, writeFileSync as writeFileSyncMain } from 'node:fs';
|
|
23
|
+
import { homedir, hostname, userInfo } from 'node:os';
|
|
24
|
+
import { randomBytes as cryptoRandomBytes } from 'node:crypto';
|
|
19
25
|
import { dirname, join } from 'node:path';
|
|
20
26
|
import { fileURLToPath } from 'node:url';
|
|
21
|
-
import { loadConfig, getConfigPathFromArgs } from './config.js';
|
|
22
|
-
import {
|
|
27
|
+
import { loadConfig, getConfigPathFromArgs, DEFAULT_CONFIG_PATH } from './config.js';
|
|
28
|
+
import { Store } from './store/store.js';
|
|
29
|
+
import { startApiServer } from './api/server.js';
|
|
30
|
+
import { CapturePublishUnavailableError } from './api/captures.js';
|
|
31
|
+
import { invalidatePredictionOperatorStatusCache } from './api/gather-status.js';
|
|
32
|
+
import { ensureUiToken } from './api/ui-token.js';
|
|
33
|
+
import { hashImplStateDir } from './harnesses/freeze.js';
|
|
34
|
+
import { readModeState } from './harnesses/mode-state.js';
|
|
35
|
+
import { attachAgentWs, updateAgentClaudePath } from './agent/agent-ws.js';
|
|
36
|
+
import { createSetupModeController } from './setup-mode.js';
|
|
37
|
+
import { buildEnvelope, emitEnvelope } from './errors/envelope.js';
|
|
38
|
+
import { clearBootstrapError, persistBootstrapError, } from './errors/persisted-bootstrap-error.js';
|
|
39
|
+
import { emitStructured } from './events/emitter.js';
|
|
23
40
|
import { checkClaudeBinary } from './preflight/claude-binary.js';
|
|
24
41
|
import { emitClaudeBinaryPreflightFailure } from './preflight/claude-invocation-envelope.js';
|
|
25
42
|
import { detectAuthContext, probeClaudeAuth } from './preflight/claude-auth.js';
|
|
43
|
+
import { configRequiresClaudeAuth } from './preflight/claude-required.js';
|
|
26
44
|
import { FleetBootstrapper } from './earning/bootstrap.js';
|
|
27
|
-
import { getChainConfig } from './earning/contracts.js';
|
|
45
|
+
import { DEFAULT_TESTNET_ARTIFACTS, applyChainGasOverrides, getChainConfig, loadJinnMviConfig } from './earning/contracts.js';
|
|
46
|
+
import { runLegacyAgentIdMigration } from './earning/migrate-agent-id.js';
|
|
28
47
|
import { FleetStateStore } from './earning/store.js';
|
|
48
|
+
import { isOperationalServiceStep, } from './earning/types.js';
|
|
29
49
|
import { decryptMnemonic, deriveMasterSigner, walletPrivateKeyAtIndex } from './earning/wallet.js';
|
|
30
50
|
import { MechAdapter } from './adapters/mech/adapter.js';
|
|
31
51
|
import { ClaudeRunner } from './runner/claude.js';
|
|
32
52
|
import { Daemon } from './daemon/daemon.js';
|
|
33
|
-
import { createJinnPublicClient, createJinnWalletClient } from './earning/viem-clients.js';
|
|
34
|
-
import {
|
|
35
|
-
import {
|
|
36
|
-
import {
|
|
53
|
+
import { createJinnPublicClient, createJinnWalletClient, createJinnL1PublicClient, createJinnL1WalletClient } from './earning/viem-clients.js';
|
|
54
|
+
import { privateKeyToAccount } from 'viem/accounts';
|
|
55
|
+
import { getAddress } from 'viem';
|
|
56
|
+
import { DEFAULT_DISABLED_HARNESSES, DEFAULT_HARNESS, HarnessRegistry, } from './harnesses/engine/registry.js';
|
|
57
|
+
import { joinedSolverNetsViewFromConfig } from './harnesses/engine/engine.js';
|
|
58
|
+
import { buildHarnesses } from './harnesses/impls/index.js';
|
|
59
|
+
import { loadExternalImpl } from './harnesses/external-impls/index.js';
|
|
60
|
+
import { CLAUDE_CODE_HARNESS, CODEX_HARNESS, harnessStateDirName } from './harnesses/names.js';
|
|
37
61
|
import { createClients } from './adapters/mech/safe.js';
|
|
38
|
-
import {
|
|
62
|
+
import { loadSolverNets } from './solver-nets/registry.js';
|
|
63
|
+
import { createCorpus } from './corpus/index.js';
|
|
64
|
+
import { DEFAULT_EXECUTION_DISCOVERY_FROM_BLOCK } from './corpus/onchain-query.js';
|
|
65
|
+
import { CapturesStore } from './store/captures.js';
|
|
66
|
+
import { createLiveCapturePublisher } from './captures/live-publisher.js';
|
|
67
|
+
import { startReceiver } from './trajectory/receiver.js';
|
|
68
|
+
import { startSyntheticSpanProvider, emitSyntheticSpan } from './trajectory/synthetic-span-builder.js';
|
|
69
|
+
import { CredentialScrubProcessor } from './trajectory/processors/credential-scrub.js';
|
|
70
|
+
import { TranscriptContentScrubProcessor } from './trajectory/processors/transcript-content-scrub.js';
|
|
71
|
+
import { IdentityScrubProcessor } from './trajectory/processors/identity-scrub.js';
|
|
72
|
+
import { PathScrubProcessor } from './trajectory/processors/path-scrub.js';
|
|
73
|
+
import { SqliteExporterProcessor } from './trajectory/processors/sqlite-exporter.js';
|
|
74
|
+
import { ClaudeCodeJsonlParser } from './trajectory/transcript-parsers/claude-code-jsonl.js';
|
|
75
|
+
import { CodexSessionParser } from './trajectory/transcript-parsers/codex-session.js';
|
|
76
|
+
import { GeminiSessionParser } from './trajectory/transcript-parsers/gemini-session.js';
|
|
77
|
+
import { CursorSqliteParser } from './trajectory/transcript-parsers/cursor-sqlite.js';
|
|
78
|
+
import { buildInfo } from './build-info.js';
|
|
39
79
|
import { BASE_FEEDS } from './venues/chainlink/feeds.js';
|
|
40
|
-
import {
|
|
80
|
+
import { GeneratedTaskSource, StaticConfiguredTaskSource } from './tasks/sources.js';
|
|
41
81
|
import { checkRpcNetwork, logRpcLocalDevToStderr, rpcNetworkFailureHint } from './preflight/rpc-network.js';
|
|
42
82
|
import { apiPortFailureMessage, checkApiPortAvailable } from './preflight/api-port.js';
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
83
|
+
import { openBrowser } from './cli/open-browser.js';
|
|
84
|
+
if (process.env['JINN_LOAD_DEV_ENV'] === '1' || process.env['NODE_ENV'] === 'development') {
|
|
85
|
+
dotenvConfig({ path: join(dirname(fileURLToPath(import.meta.url)), '..', '.env') });
|
|
86
|
+
}
|
|
87
|
+
// ── Password (env > file > auto-generated) ─────────────────────────────────
|
|
88
|
+
//
|
|
89
|
+
// Resolution order:
|
|
90
|
+
// 1. JINN_PASSWORD env var (explicit operator-set, never in config files)
|
|
91
|
+
// 2. ~/.jinn-client/keystore-password (file from a previous auto-gen)
|
|
92
|
+
// 3. Auto-generate a 32-byte hex string, persist mode 0600, and reuse next run
|
|
93
|
+
//
|
|
94
|
+
// Auto-generation matches what `jinn quickstart` used to do so a brand-new
|
|
95
|
+
// operator can run `jinn run` with no env var, no setup, no input. The
|
|
96
|
+
// known security trade-off is documented in client/src/cli/password.ts:
|
|
97
|
+
// plaintext on disk + encrypted keystore on the same disk only defends
|
|
98
|
+
// against casual snooping. Treat the wallet as hot until rotated.
|
|
99
|
+
function resolveOrGenerateKeystorePassword() {
|
|
100
|
+
const envPw = process.env['JINN_PASSWORD'];
|
|
101
|
+
if (envPw && envPw.length > 0) {
|
|
102
|
+
return { password: envPw, source: 'env' };
|
|
103
|
+
}
|
|
104
|
+
const home = process.env['HOME'] ?? homedir();
|
|
105
|
+
const pwFilePath = join(home, '.jinn-client', 'keystore-password');
|
|
106
|
+
if (existsSync(pwFilePath)) {
|
|
107
|
+
const fromDisk = readFileSync(pwFilePath, 'utf-8').trim();
|
|
108
|
+
if (fromDisk.length > 0) {
|
|
109
|
+
return { password: fromDisk, source: 'file', filePath: pwFilePath };
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
const generated = cryptoRandomBytes(32).toString('hex');
|
|
113
|
+
mkdirSync(dirname(pwFilePath), { recursive: true, mode: 0o700 });
|
|
114
|
+
writeFileSyncMain(pwFilePath, generated + '\n', { mode: 0o600 });
|
|
115
|
+
return { password: generated, source: 'generated', filePath: pwFilePath };
|
|
116
|
+
}
|
|
117
|
+
const passwordResolution = resolveOrGenerateKeystorePassword();
|
|
118
|
+
const PASSWORD = passwordResolution.password;
|
|
119
|
+
// Sub-commands (e.g. the embedded `init` invocation below) read JINN_PASSWORD
|
|
120
|
+
// from env. Mirror our resolved value so they don't have to redo this dance.
|
|
121
|
+
process.env['JINN_PASSWORD'] = PASSWORD;
|
|
122
|
+
if (passwordResolution.source === 'generated') {
|
|
123
|
+
console.log('━'.repeat(64));
|
|
124
|
+
console.log('A keystore password was auto-generated for you.');
|
|
125
|
+
console.log(` Stored at: ${passwordResolution.filePath}`);
|
|
126
|
+
console.log(' Mode 0600. Treat the wallet as hot until you rotate the password.');
|
|
127
|
+
console.log(' To rotate: JINN_NEW_PASSWORD=<new> jinn keys change-password');
|
|
128
|
+
console.log('━'.repeat(64));
|
|
129
|
+
}
|
|
54
130
|
// ── Load config ─────────────────────────────────────────────────────────────
|
|
55
|
-
const
|
|
131
|
+
const CONFIG_PATH = getConfigPathFromArgs();
|
|
132
|
+
const config = loadConfig(CONFIG_PATH);
|
|
133
|
+
if (config.network === 'mainnet' && process.env['JINN_ENABLE_MAINNET'] !== '1') {
|
|
134
|
+
console.warn('[main] Mainnet is disabled before launch; using testnet defaults.');
|
|
135
|
+
config.network = 'testnet';
|
|
136
|
+
config.rpcUrl = 'https://sepolia.base.org';
|
|
137
|
+
}
|
|
138
|
+
let activeClaudePath = config.claudePath ?? 'claude';
|
|
139
|
+
const selectClaudePath = (claudePath) => {
|
|
140
|
+
activeClaudePath = claudePath;
|
|
141
|
+
config.claudePath = claudePath;
|
|
142
|
+
updateAgentClaudePath(claudePath);
|
|
143
|
+
};
|
|
56
144
|
const NETWORK_CHAIN = config.network === 'testnet' ? 'base-sepolia' : 'base';
|
|
57
|
-
const CHAIN_CONFIG = getChainConfig(NETWORK_CHAIN, {
|
|
145
|
+
const CHAIN_CONFIG = applyChainGasOverrides(getChainConfig(NETWORK_CHAIN, {
|
|
58
146
|
testnetL2DeploymentPath: config.testnetL2DeploymentPath,
|
|
59
147
|
testnetL2TokenDeploymentPath: config.testnetL2TokenDeploymentPath,
|
|
60
148
|
testnetMechDeploymentPath: config.testnetMechDeploymentPath,
|
|
61
149
|
testnetStolasDeploymentPath: config.testnetStolasDeploymentPath,
|
|
62
|
-
|
|
150
|
+
}), {
|
|
151
|
+
minEoaGasWei: config.minEoaGasWei,
|
|
152
|
+
minSafeEthWei: config.minSafeEthWei,
|
|
63
153
|
});
|
|
154
|
+
const MESSENGER_MODE_EXPLICIT = process.env['JINN_MESSENGER_MODE'] !== undefined ||
|
|
155
|
+
configFileHasTopLevelKey(CONFIG_PATH, 'jinnMessengerMode');
|
|
156
|
+
const JINN_MVI_CONFIG = loadJinnMviConfig({
|
|
157
|
+
l1ArtifactPath: config.jinnMviL1DeploymentPath ??
|
|
158
|
+
(config.network === 'testnet' ? DEFAULT_TESTNET_ARTIFACTS.jinnMviL1 : undefined),
|
|
159
|
+
l2ArtifactPath: config.jinnMviL2DeploymentPath ??
|
|
160
|
+
(config.network === 'testnet' ? DEFAULT_TESTNET_ARTIFACTS.jinnMviL2 : undefined),
|
|
161
|
+
distributorAddress: config.jinnDistributorAddress,
|
|
162
|
+
messengerAddress: config.jinnMessengerAddress,
|
|
163
|
+
claimEmitterAddress: config.jinnClaimEmitterAddress,
|
|
164
|
+
messengerMode: MESSENGER_MODE_EXPLICIT ? config.jinnMessengerMode : undefined,
|
|
165
|
+
});
|
|
166
|
+
const JINN_CLAIM_MESSENGER_MODE = JINN_MVI_CONFIG.messengerMode ?? config.jinnMessengerMode;
|
|
64
167
|
const MARKETPLACE_ADDRESS = CHAIN_CONFIG.mechMarketplace;
|
|
65
168
|
const ROUTER_ADDRESS = (CHAIN_CONFIG.jinnRouter ?? '0xfFa7118A3D820cd4E820010837D65FAfF463181B');
|
|
169
|
+
function configFileHasTopLevelKey(configPath, key) {
|
|
170
|
+
const filePath = configPath ?? join(process.env['HOME'] ?? '', '.jinn-client', 'config.json');
|
|
171
|
+
if (!filePath || !existsSync(filePath))
|
|
172
|
+
return false;
|
|
173
|
+
try {
|
|
174
|
+
const raw = JSON.parse(readFileSync(filePath, 'utf8'));
|
|
175
|
+
return !!raw && typeof raw === 'object' && Object.prototype.hasOwnProperty.call(raw, key);
|
|
176
|
+
}
|
|
177
|
+
catch {
|
|
178
|
+
return false;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
class EnsurePendingCaptureProcessor {
|
|
182
|
+
captures;
|
|
183
|
+
constructor(captures) {
|
|
184
|
+
this.captures = captures;
|
|
185
|
+
}
|
|
186
|
+
forceFlush() { return Promise.resolve(); }
|
|
187
|
+
shutdown() { return Promise.resolve(); }
|
|
188
|
+
onStart() { }
|
|
189
|
+
onEnd(span) {
|
|
190
|
+
const sessionId = stringAttribute(span.attributes['jinn.session.id']);
|
|
191
|
+
if (!sessionId || this.captures.getBySession(sessionId))
|
|
192
|
+
return;
|
|
193
|
+
try {
|
|
194
|
+
this.captures.savePending({
|
|
195
|
+
sessionId,
|
|
196
|
+
capturedAt: hrTimeToIso(span.startTime),
|
|
197
|
+
originatingTool: { name: inferCaptureTool(span) },
|
|
198
|
+
capturePath: 'A',
|
|
199
|
+
status: 'pending',
|
|
200
|
+
spanCount: 0,
|
|
201
|
+
durationMs: 0,
|
|
202
|
+
redactedSpanCount: 0,
|
|
203
|
+
...repoMetadataFromSpan(span),
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
catch (err) {
|
|
207
|
+
if (!this.captures.getBySession(sessionId))
|
|
208
|
+
throw err;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
function stringAttribute(value) {
|
|
213
|
+
return typeof value === 'string' && value.trim() !== '' ? value : undefined;
|
|
214
|
+
}
|
|
215
|
+
function hrTimeToIso(time) {
|
|
216
|
+
const millis = (time[0] * 1000) + Math.floor(time[1] / 1_000_000);
|
|
217
|
+
return new Date(millis).toISOString();
|
|
218
|
+
}
|
|
219
|
+
function inferCaptureTool(span) {
|
|
220
|
+
return stringAttribute(span.attributes['transcript.tool'])
|
|
221
|
+
?? stringAttribute(span.resource.attributes['service.name'])
|
|
222
|
+
?? 'otel';
|
|
223
|
+
}
|
|
224
|
+
function repoMetadataFromSpan(span) {
|
|
225
|
+
const attrs = span.attributes;
|
|
226
|
+
const repoRemoteUrl = stringAttribute(attrs['repo.remote_url'])
|
|
227
|
+
?? stringAttribute(attrs['vcs.repository.url'])
|
|
228
|
+
?? stringAttribute(attrs['git.remote_url']);
|
|
229
|
+
const repoCommitHash = stringAttribute(attrs['repo.commit_hash'])
|
|
230
|
+
?? stringAttribute(attrs['vcs.ref.head.revision'])
|
|
231
|
+
?? stringAttribute(attrs['git.commit']);
|
|
232
|
+
return {
|
|
233
|
+
...(repoRemoteUrl ? { repoRemoteUrl } : {}),
|
|
234
|
+
...(repoCommitHash ? { repoCommitHash } : {}),
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
function parserForStopHookTool(tool) {
|
|
238
|
+
switch (tool) {
|
|
239
|
+
case 'claude-code':
|
|
240
|
+
return new ClaudeCodeJsonlParser();
|
|
241
|
+
case 'codex':
|
|
242
|
+
return new CodexSessionParser();
|
|
243
|
+
case 'gemini-cli':
|
|
244
|
+
return new GeminiSessionParser();
|
|
245
|
+
case 'cursor':
|
|
246
|
+
return new CursorSqliteParser();
|
|
247
|
+
default: {
|
|
248
|
+
const exhaustive = tool;
|
|
249
|
+
throw new Error(`No transcript parser for stop-hook tool: ${String(exhaustive)}`);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
function ensurePendingStopHookCapture(captures, payload) {
|
|
254
|
+
if (captures.getBySession(payload.sessionId))
|
|
255
|
+
return;
|
|
256
|
+
try {
|
|
257
|
+
captures.savePending({
|
|
258
|
+
sessionId: payload.sessionId,
|
|
259
|
+
capturedAt: payload.stoppedAt,
|
|
260
|
+
originatingTool: { name: payload.tool },
|
|
261
|
+
capturePath: 'D',
|
|
262
|
+
status: 'pending',
|
|
263
|
+
spanCount: 0,
|
|
264
|
+
durationMs: 0,
|
|
265
|
+
redactedSpanCount: 0,
|
|
266
|
+
});
|
|
267
|
+
}
|
|
268
|
+
catch (err) {
|
|
269
|
+
if (!captures.getBySession(payload.sessionId))
|
|
270
|
+
throw err;
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
async function ingestStopHookCapture(captures, receiver, payload) {
|
|
274
|
+
ensurePendingStopHookCapture(captures, payload);
|
|
275
|
+
if (!payload.transcriptPath)
|
|
276
|
+
return;
|
|
277
|
+
if (!receiver) {
|
|
278
|
+
console.warn('[main] stop-hook capture received but OTLP receiver is unavailable; pending capture has no transcript spans.');
|
|
279
|
+
return;
|
|
280
|
+
}
|
|
281
|
+
const parser = parserForStopHookTool(payload.tool);
|
|
282
|
+
let events;
|
|
283
|
+
try {
|
|
284
|
+
events = await parser.parseFull({ sessionId: payload.sessionId, path: payload.transcriptPath });
|
|
285
|
+
}
|
|
286
|
+
catch (err) {
|
|
287
|
+
console.warn(`[main] stop-hook transcript import failed for ${payload.transcriptPath}: ` +
|
|
288
|
+
`${err instanceof Error ? err.message : String(err)}`);
|
|
289
|
+
return;
|
|
290
|
+
}
|
|
291
|
+
if (events.length === 0)
|
|
292
|
+
return;
|
|
293
|
+
const provider = startSyntheticSpanProvider({
|
|
294
|
+
otlpHttpEndpoint: `http://127.0.0.1:${receiver.httpPort}/v1/traces`,
|
|
295
|
+
});
|
|
296
|
+
try {
|
|
297
|
+
for (const event of events) {
|
|
298
|
+
emitSyntheticSpan(provider, { tool: parser.tool, sessionId: payload.sessionId, event });
|
|
299
|
+
}
|
|
300
|
+
await provider.flush();
|
|
301
|
+
}
|
|
302
|
+
finally {
|
|
303
|
+
await provider.shutdown();
|
|
304
|
+
}
|
|
305
|
+
}
|
|
66
306
|
const STANDARD_SERVICE_PROGRESSION = [
|
|
67
307
|
'awaiting_stake',
|
|
68
308
|
'staked',
|
|
69
309
|
'mech_deployed',
|
|
310
|
+
'agent_registered',
|
|
311
|
+
'safe_binding_pending',
|
|
70
312
|
'complete',
|
|
71
313
|
];
|
|
72
314
|
const SELF_BOND_SERVICE_PROGRESSION = [
|
|
@@ -77,6 +319,8 @@ const SELF_BOND_SERVICE_PROGRESSION = [
|
|
|
77
319
|
'service_deployed',
|
|
78
320
|
'service_staked',
|
|
79
321
|
'mech_deployed',
|
|
322
|
+
'agent_registered',
|
|
323
|
+
'safe_binding_pending',
|
|
80
324
|
'complete',
|
|
81
325
|
];
|
|
82
326
|
/** §6.2 `bootstrap_incomplete` — `{ currentStep, nextStep }` from persisted fleet state. */
|
|
@@ -85,13 +329,14 @@ function bootstrapIncompleteSteps(state) {
|
|
|
85
329
|
? SELF_BOND_SERVICE_PROGRESSION
|
|
86
330
|
: STANDARD_SERVICE_PROGRESSION;
|
|
87
331
|
const byIndex = [...state.services].sort((a, b) => a.index - b.index);
|
|
88
|
-
const focus = byIndex.find(s => s.step
|
|
89
|
-
byIndex.find(s => s.step
|
|
332
|
+
const focus = byIndex.find(s => isOperationalServiceStep(s.step) && !s.safe_address) ??
|
|
333
|
+
byIndex.find(s => !isOperationalServiceStep(s.step)) ??
|
|
334
|
+
byIndex.find(s => s.step === 'safe_binding_pending') ??
|
|
90
335
|
byIndex[0];
|
|
91
336
|
if (!focus) {
|
|
92
337
|
return { currentStep: 'awaiting_service', nextStep: 'awaiting_stake' };
|
|
93
338
|
}
|
|
94
|
-
if (focus.step
|
|
339
|
+
if (isOperationalServiceStep(focus.step) && !focus.safe_address) {
|
|
95
340
|
return { currentStep: 'complete', nextStep: 'bootstrap' };
|
|
96
341
|
}
|
|
97
342
|
const i = progression.indexOf(focus.step);
|
|
@@ -106,6 +351,36 @@ function bootstrapIncompleteSteps(state) {
|
|
|
106
351
|
// ── Bootstrap ───────────────────────────────────────────────────────────────
|
|
107
352
|
async function bootstrap() {
|
|
108
353
|
console.log('[main] Running fleet bootstrap...');
|
|
354
|
+
// A fresh bootstrap attempt clears any stale error breadcrumb. If this run
|
|
355
|
+
// hits the same failure, it'll be re-persisted below; if it succeeds (or
|
|
356
|
+
// proceeds past the previously-failed step), the panel returns to a clean
|
|
357
|
+
// state on the next /v1/bootstrap poll.
|
|
358
|
+
clearBootstrapError(config.earningDir);
|
|
359
|
+
// Persist the envelope to disk before emitEnvelope's process.exit fires,
|
|
360
|
+
// so /v1/bootstrap can surface it to the panel after the daemon has
|
|
361
|
+
// exited (operator restart → panel reload → error visible).
|
|
362
|
+
function failBootstrap(input) {
|
|
363
|
+
const envelope = buildEnvelope(input);
|
|
364
|
+
persistBootstrapError(envelope, config.earningDir);
|
|
365
|
+
if (keepSetupUiOnBootstrapError()) {
|
|
366
|
+
emitStructured({
|
|
367
|
+
kind: 'error',
|
|
368
|
+
message: envelope.message,
|
|
369
|
+
errorCode: envelope.code,
|
|
370
|
+
details: {
|
|
371
|
+
phase: 'bootstrap',
|
|
372
|
+
exitCode: envelope.exitCode,
|
|
373
|
+
...(envelope.details ?? {}),
|
|
374
|
+
},
|
|
375
|
+
});
|
|
376
|
+
console.error(`[main] Bootstrap halted (${envelope.code}); setup UI remains available. ` +
|
|
377
|
+
`Resolve the issue and run jinn run again.`);
|
|
378
|
+
throw new SetupBootstrapHalted(envelope);
|
|
379
|
+
}
|
|
380
|
+
emitEnvelope(input);
|
|
381
|
+
// Unreachable in production (emitEnvelope exits); satisfies `never`.
|
|
382
|
+
throw new Error('unreachable');
|
|
383
|
+
}
|
|
109
384
|
const bootstrapper = new FleetBootstrapper({
|
|
110
385
|
earningDir: config.earningDir,
|
|
111
386
|
chain: NETWORK_CHAIN,
|
|
@@ -116,40 +391,168 @@ async function bootstrap() {
|
|
|
116
391
|
testnetL2TokenDeploymentPath: config.testnetL2TokenDeploymentPath,
|
|
117
392
|
testnetMechDeploymentPath: config.testnetMechDeploymentPath,
|
|
118
393
|
testnetStolasDeploymentPath: config.testnetStolasDeploymentPath,
|
|
119
|
-
testnetClaimRegistryDeploymentPath: config.testnetClaimRegistryDeploymentPath,
|
|
120
394
|
debug: config.debug,
|
|
121
395
|
masterEthDailyEstimateWei: config.masterEthDailyEstimateWei,
|
|
396
|
+
minEoaGasWei: config.minEoaGasWei,
|
|
397
|
+
minSafeEthWei: config.minSafeEthWei,
|
|
122
398
|
pollIntervalMs: config.pollIntervalMs,
|
|
399
|
+
autoTestnetFaucet: process.env['JINN_AUTO_TESTNET_FAUCET'] === '1',
|
|
123
400
|
});
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
401
|
+
// Funding poll: stay up while waiting for the operator to fund the wallet.
|
|
402
|
+
// The setup-mode API server is already running; the panel renders the
|
|
403
|
+
// funding card and auto-advances when funds land. Daemon-side, we poll
|
|
404
|
+
// bootstrap on a 15s tick and only escalate (exit) if a non-funding error
|
|
405
|
+
// occurs or the configured timeout elapses. Each tick re-runs the full
|
|
406
|
+
// bootstrap state machine — completed steps are no-ops, so this is safe.
|
|
407
|
+
// Testnet faucet funding is panel-driven: bootstrap reports the funding gate,
|
|
408
|
+
// and the operator clicks the funding action before this loop can advance.
|
|
409
|
+
const FUNDING_POLL_INTERVAL_MS = 15_000;
|
|
410
|
+
const fundingTimeoutMs = (() => {
|
|
411
|
+
const raw = process.env['JINN_FUNDING_TIMEOUT_MS'];
|
|
412
|
+
if (!raw)
|
|
413
|
+
return Number.POSITIVE_INFINITY;
|
|
414
|
+
const n = Number.parseInt(raw, 10);
|
|
415
|
+
return Number.isFinite(n) && n > 0 ? n : Number.POSITIVE_INFINITY;
|
|
416
|
+
})();
|
|
417
|
+
emitProgress({
|
|
418
|
+
type: 'progress',
|
|
419
|
+
phase: 'bootstrap',
|
|
420
|
+
step: 'advance_state_machine',
|
|
421
|
+
estimatedWaitMs: 60_000,
|
|
422
|
+
});
|
|
423
|
+
const fundingStartedAt = Date.now();
|
|
424
|
+
let result;
|
|
425
|
+
let lastFundingMessage = '';
|
|
426
|
+
const fundingGatePath = join(config.earningDir, 'bootstrap-funding.json');
|
|
427
|
+
const persistFundingGate = (funding) => {
|
|
428
|
+
mkdirSync(config.earningDir, { recursive: true, mode: 0o700 });
|
|
429
|
+
writeFileSyncMain(fundingGatePath, `${JSON.stringify({
|
|
430
|
+
schemaVersion: 1,
|
|
431
|
+
generatedAt: new Date().toISOString(),
|
|
432
|
+
...funding,
|
|
433
|
+
}, null, 2)}\n`, { mode: 0o600 });
|
|
434
|
+
};
|
|
435
|
+
const clearFundingGate = () => {
|
|
436
|
+
try {
|
|
437
|
+
unlinkSync(fundingGatePath);
|
|
438
|
+
}
|
|
439
|
+
catch {
|
|
440
|
+
// best-effort: absent/stale funding gate should not affect bootstrap
|
|
441
|
+
}
|
|
442
|
+
};
|
|
443
|
+
// eslint-disable-next-line no-constant-condition
|
|
444
|
+
while (true) {
|
|
445
|
+
result = await bootstrapper.bootstrap(PASSWORD);
|
|
446
|
+
if (!result.funding) {
|
|
447
|
+
clearFundingGate();
|
|
448
|
+
break;
|
|
449
|
+
}
|
|
450
|
+
persistFundingGate(result.funding);
|
|
451
|
+
// Emit a structured event so the panel's Visibility region shows the gate.
|
|
452
|
+
// Dedupe by message to avoid spamming the ring buffer on each poll.
|
|
453
|
+
const fundingMsg = result.message ?? 'awaiting funding';
|
|
454
|
+
if (fundingMsg !== lastFundingMessage) {
|
|
455
|
+
emitStructured({
|
|
456
|
+
kind: 'fleet',
|
|
457
|
+
message: fundingMsg,
|
|
458
|
+
details: {
|
|
459
|
+
phase: 'awaiting_funding',
|
|
460
|
+
role: 'master',
|
|
461
|
+
address: result.funding.master_address,
|
|
462
|
+
asset: 'native',
|
|
463
|
+
needWei: result.funding.eth_required,
|
|
464
|
+
haveWei: result.funding.eth_balance,
|
|
465
|
+
},
|
|
466
|
+
});
|
|
467
|
+
// Mirror the structured event to NDJSON progress for --json-progress
|
|
468
|
+
// consumers (CI, agents). Same dedup gate so we don't spam stdout.
|
|
469
|
+
emitProgress({
|
|
470
|
+
type: 'progress',
|
|
471
|
+
phase: 'bootstrap',
|
|
472
|
+
step: 'awaiting_funding',
|
|
473
|
+
blocking: true,
|
|
474
|
+
nextAction: 'Fund the address shown in addresses.fundingAddress, then wait for automatic retry.',
|
|
475
|
+
addresses: { fundingAddress: result.funding.master_address },
|
|
476
|
+
estimatedWaitMs: 1_800_000,
|
|
477
|
+
});
|
|
478
|
+
lastFundingMessage = fundingMsg;
|
|
479
|
+
}
|
|
480
|
+
const elapsed = Date.now() - fundingStartedAt;
|
|
481
|
+
if (elapsed >= fundingTimeoutMs) {
|
|
482
|
+
failBootstrap({
|
|
483
|
+
code: 'funding_required',
|
|
484
|
+
message: `${result.message} (timeout after ${Math.round(elapsed / 1000)}s)`,
|
|
485
|
+
hint: 'Fund the listed address and re-run this command.',
|
|
486
|
+
exampleCli: 'jinn fund-requirements --json',
|
|
487
|
+
details: {
|
|
488
|
+
role: 'master',
|
|
489
|
+
address: result.funding.master_address,
|
|
490
|
+
asset: 'native',
|
|
491
|
+
needWei: result.funding.eth_required,
|
|
492
|
+
haveWei: result.funding.eth_balance,
|
|
493
|
+
},
|
|
494
|
+
});
|
|
495
|
+
}
|
|
496
|
+
console.log(`[main] Awaiting funding... (${Math.round(elapsed / 1000)}s elapsed; ` +
|
|
497
|
+
`will retry in ${FUNDING_POLL_INTERVAL_MS / 1000}s)`);
|
|
498
|
+
await new Promise((r) => setTimeout(r, FUNDING_POLL_INTERVAL_MS));
|
|
139
499
|
}
|
|
140
500
|
if (!result.ok) {
|
|
141
|
-
|
|
501
|
+
failBootstrap({
|
|
142
502
|
code: 'fatal',
|
|
143
503
|
message: result.message,
|
|
144
504
|
hint: 'Bootstrap failed before the fleet reached a runnable state.',
|
|
145
|
-
details: {
|
|
505
|
+
details: {
|
|
506
|
+
cause: result.message,
|
|
507
|
+
// Preserve the raw underlying error so a misclassified summary can
|
|
508
|
+
// be diagnosed without re-running with JINN_DEBUG. See jinn-mono-jz9f.
|
|
509
|
+
...(result.rawErrorMessage && result.rawErrorMessage !== result.message
|
|
510
|
+
? { rawErrorMessage: result.rawErrorMessage }
|
|
511
|
+
: {}),
|
|
512
|
+
},
|
|
146
513
|
});
|
|
147
514
|
}
|
|
148
|
-
//
|
|
149
|
-
|
|
150
|
-
|
|
515
|
+
// Legacy migration (jinn-mono-jgp): backfill `agent_id` on `complete`
|
|
516
|
+
// services that pre-date j07. Idempotent + per-service failure-isolated;
|
|
517
|
+
// a failure here does not abort daemon startup, but we surface counts so
|
|
518
|
+
// operators notice. Disabled via `runLegacyMigrations: false` /
|
|
519
|
+
// JINN_RUN_LEGACY_MIGRATIONS=0 — operators can run `jinn migrate-agent-id`
|
|
520
|
+
// explicitly instead.
|
|
521
|
+
let state = result.fleet_state;
|
|
522
|
+
if (config.runLegacyMigrations) {
|
|
523
|
+
try {
|
|
524
|
+
const migration = await runLegacyAgentIdMigration({
|
|
525
|
+
earningDir: config.earningDir,
|
|
526
|
+
network: NETWORK_CHAIN,
|
|
527
|
+
rpcUrl: config.rpcUrl,
|
|
528
|
+
password: PASSWORD,
|
|
529
|
+
testnetL2DeploymentPath: config.testnetL2DeploymentPath,
|
|
530
|
+
testnetL2TokenDeploymentPath: config.testnetL2TokenDeploymentPath,
|
|
531
|
+
testnetMechDeploymentPath: config.testnetMechDeploymentPath,
|
|
532
|
+
testnetStolasDeploymentPath: config.testnetStolasDeploymentPath,
|
|
533
|
+
});
|
|
534
|
+
if (migration.migrated.length > 0 || migration.failed.length > 0) {
|
|
535
|
+
console.log(`[main] Legacy agent_id migration: migrated=${migration.migrated.length} ` +
|
|
536
|
+
`skipped=${migration.skipped.length} failed=${migration.failed.length}`);
|
|
537
|
+
for (const f of migration.failed) {
|
|
538
|
+
console.log(`[main] service ${f.service.index} (agent ${f.service.agent_address}): ${f.error}`);
|
|
539
|
+
}
|
|
540
|
+
// Reload state so downstream wiring (agent_id, identityRegistry)
|
|
541
|
+
// sees the migrated rows.
|
|
542
|
+
state = await new FleetStateStore(config.earningDir).load(NETWORK_CHAIN);
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
catch (err) {
|
|
546
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
547
|
+
console.error(`[main] Legacy agent_id migration failed (non-fatal): ${message}`);
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
// Use the first operational service for the daemon. `safe_binding_pending`
|
|
551
|
+
// means staking/mech are live; only the ERC-8004 Safe→agent metadata bind
|
|
552
|
+
// is still retrying.
|
|
553
|
+
const firstComplete = state.services.find(s => isOperationalServiceStep(s.step));
|
|
151
554
|
if (!firstComplete || !firstComplete.safe_address) {
|
|
152
|
-
|
|
555
|
+
failBootstrap({
|
|
153
556
|
code: 'bootstrap_incomplete',
|
|
154
557
|
message: 'Bootstrap completed but no service is ready.',
|
|
155
558
|
hint: 'Re-run to continue the state machine toward a running fleet.',
|
|
@@ -163,7 +566,7 @@ async function bootstrap() {
|
|
|
163
566
|
const agentPrivateKey = walletPrivateKeyAtIndex(mnemonic, firstComplete.index);
|
|
164
567
|
console.log(`[main] Fleet bootstrap complete.`);
|
|
165
568
|
console.log(` Master: ${state.master_address}`);
|
|
166
|
-
console.log(` Services: ${state.services.filter(s => s.step
|
|
569
|
+
console.log(` Services: ${state.services.filter(s => isOperationalServiceStep(s.step)).length}/${config.targetServices}`);
|
|
167
570
|
console.log(` Active: service ${firstComplete.service_id} (agent ${firstComplete.agent_address})`);
|
|
168
571
|
if (firstComplete.mech_address) {
|
|
169
572
|
console.log(` Mech: ${firstComplete.mech_address}`);
|
|
@@ -172,14 +575,63 @@ async function bootstrap() {
|
|
|
172
575
|
masterAddress: state.master_address,
|
|
173
576
|
serviceIndex: firstComplete.index,
|
|
174
577
|
serviceId: firstComplete.service_id ?? null,
|
|
578
|
+
stakingAddress: firstComplete.staking_address ? firstComplete.staking_address : null,
|
|
175
579
|
agentPrivateKey: agentPrivateKey,
|
|
176
580
|
safeAddress: firstComplete.safe_address,
|
|
177
581
|
mechAddress: firstComplete.mech_address ? firstComplete.mech_address : undefined,
|
|
582
|
+
agentId: firstComplete.agent_id ?? null,
|
|
583
|
+
identityRegistryAddress: firstComplete.identity_registry_address
|
|
584
|
+
? firstComplete.identity_registry_address
|
|
585
|
+
: null,
|
|
178
586
|
};
|
|
179
587
|
}
|
|
588
|
+
class SetupBootstrapHalted extends Error {
|
|
589
|
+
envelope;
|
|
590
|
+
constructor(envelope) {
|
|
591
|
+
super(envelope.message);
|
|
592
|
+
this.envelope = envelope;
|
|
593
|
+
this.name = 'SetupBootstrapHalted';
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
const keepSetupUiOnBootstrapError = () => process.env['JINN_NO_UI'] !== '1' && process.env['JINN_NO_DAEMON'] !== '1';
|
|
180
597
|
// ── Main ────────────────────────────────────────────────────────────────────
|
|
598
|
+
/**
|
|
599
|
+
* --json-progress: emit NDJSON progress envelopes on stdout during long
|
|
600
|
+
* phases (init, bootstrap, daemon startup). The `jinn run --json-progress`
|
|
601
|
+
* flag flips JINN_JSON_PROGRESS=1 in run.ts before calling main(); when
|
|
602
|
+
* unset this is a no-op so tests / non-flag invocations stay silent on
|
|
603
|
+
* stdout.
|
|
604
|
+
*/
|
|
605
|
+
function progressEnabled() {
|
|
606
|
+
return process.env['JINN_JSON_PROGRESS'] === '1';
|
|
607
|
+
}
|
|
608
|
+
function emitProgress(envelope) {
|
|
609
|
+
if (progressEnabled()) {
|
|
610
|
+
process.stdout.write(JSON.stringify(envelope) + '\n');
|
|
611
|
+
}
|
|
612
|
+
}
|
|
181
613
|
export async function main() {
|
|
182
614
|
console.log(`[main] jinn-client starting on ${NETWORK_CHAIN}`);
|
|
615
|
+
// ── Daemon API bearer token (jinn-mono-pr64 hardening) ───────────────────
|
|
616
|
+
//
|
|
617
|
+
// Cost-mutating API routes (`POST /v1/artifacts/acquire`, `POST /artifacts`)
|
|
618
|
+
// require an `Authorization: Bearer <token>` header. Read from env when
|
|
619
|
+
// operators want a stable token (e.g. multi-process tools); otherwise
|
|
620
|
+
// generate a fresh one per daemon process. Logged only as an 8-char prefix.
|
|
621
|
+
// The token is forwarded to the MCP subprocess via `DAEMON_API_TOKEN` env
|
|
622
|
+
// so `acquire_artifact` and `submit_restoration_result` can authenticate
|
|
623
|
+
// their calls back to the daemon.
|
|
624
|
+
const envToken = process.env['DAEMON_API_TOKEN']?.trim();
|
|
625
|
+
const apiToken = envToken && envToken.length > 0
|
|
626
|
+
? envToken
|
|
627
|
+
: cryptoRandomBytes(32).toString('hex');
|
|
628
|
+
if (!envToken) {
|
|
629
|
+
console.log(`[main] Generated DAEMON_API_TOKEN (prefix=${apiToken.slice(0, 8)}...)`);
|
|
630
|
+
}
|
|
631
|
+
// The keystore-presence probe happens twice: once now (to decide initial
|
|
632
|
+
// setup-mode) and once after we run init below (to flip the controller).
|
|
633
|
+
const masterKeystorePath = join(config.earningDir, 'master_keystore.json');
|
|
634
|
+
const legacyKeystorePath = join(config.earningDir, 'agent_keystore.json');
|
|
183
635
|
const rpcPreflight = await checkRpcNetwork(config);
|
|
184
636
|
if (!rpcPreflight.ok) {
|
|
185
637
|
emitEnvelope({
|
|
@@ -214,7 +666,535 @@ export async function main() {
|
|
|
214
666
|
},
|
|
215
667
|
});
|
|
216
668
|
}
|
|
217
|
-
const
|
|
669
|
+
const preflightEarningStateStore = new FleetStateStore(config.earningDir);
|
|
670
|
+
const archivedMismatchedState = await preflightEarningStateStore.archiveIfChainMismatch(NETWORK_CHAIN);
|
|
671
|
+
if (archivedMismatchedState) {
|
|
672
|
+
console.warn(`[main] Archived ${archivedMismatchedState.actualChain} earning state before starting ` +
|
|
673
|
+
`${archivedMismatchedState.expectedChain}. ` +
|
|
674
|
+
`Files: ${archivedMismatchedState.archivedPaths.join(', ')}`);
|
|
675
|
+
}
|
|
676
|
+
// ── Setup-mode API server ────────────────────────────────────────────────
|
|
677
|
+
// Start the operator-facing API early so the SPA can show bootstrap
|
|
678
|
+
// progress while we may still be waiting on funding. The daemon loops are
|
|
679
|
+
// gated until bootstrap completes — we just bring up the API + handshake +
|
|
680
|
+
// /v1/bootstrap + /v1/events + /v1/status here. The same Store instance is
|
|
681
|
+
// later passed into Daemon so we don't double-open the SQLite file.
|
|
682
|
+
const sharedStore = new Store(config.dbPath);
|
|
683
|
+
const capturesStore = new CapturesStore(sharedStore);
|
|
684
|
+
let captureReceiver;
|
|
685
|
+
try {
|
|
686
|
+
captureReceiver = await startReceiver({
|
|
687
|
+
grpcPort: 4317,
|
|
688
|
+
httpPort: 4318,
|
|
689
|
+
processors: [
|
|
690
|
+
new CredentialScrubProcessor(),
|
|
691
|
+
new TranscriptContentScrubProcessor(),
|
|
692
|
+
new IdentityScrubProcessor({
|
|
693
|
+
username: userInfo().username,
|
|
694
|
+
hostname: hostname(),
|
|
695
|
+
}),
|
|
696
|
+
new PathScrubProcessor({ home: homedir() }),
|
|
697
|
+
new EnsurePendingCaptureProcessor(capturesStore),
|
|
698
|
+
new SqliteExporterProcessor({ captures: capturesStore }),
|
|
699
|
+
],
|
|
700
|
+
});
|
|
701
|
+
console.log(`[main] Capture OTLP receiver listening on grpc=:${captureReceiver.grpcPort} http=:${captureReceiver.httpPort}`);
|
|
702
|
+
}
|
|
703
|
+
catch (err) {
|
|
704
|
+
console.warn('[main] Capture OTLP receiver disabled; path-A telemetry capture unavailable: ' +
|
|
705
|
+
`${err instanceof Error ? err.message : String(err)}`);
|
|
706
|
+
}
|
|
707
|
+
const closeCaptureReceiver = async () => {
|
|
708
|
+
const receiver = captureReceiver;
|
|
709
|
+
captureReceiver = undefined;
|
|
710
|
+
await receiver?.shutdown().catch(() => undefined);
|
|
711
|
+
};
|
|
712
|
+
const capturePublishRef = { current: undefined };
|
|
713
|
+
const earningStateStore = new FleetStateStore(config.earningDir);
|
|
714
|
+
const initialFleet = await earningStateStore.tryLoadExisting();
|
|
715
|
+
const initialServices = initialFleet?.services ?? [];
|
|
716
|
+
const initialAllComplete = initialServices.length > 0 && initialServices.every((s) => isOperationalServiceStep(s.step));
|
|
717
|
+
const setupController = createSetupModeController({
|
|
718
|
+
keystoreExists: existsSync(masterKeystorePath),
|
|
719
|
+
allComplete: initialAllComplete,
|
|
720
|
+
});
|
|
721
|
+
const uiToken = ensureUiToken();
|
|
722
|
+
const handshakeKey = cryptoRandomBytes(16).toString('hex');
|
|
723
|
+
const apiBindHost = process.env['JINN_API_BIND_HOST'] ?? '127.0.0.1';
|
|
724
|
+
const operatorArtifactsConfig = {
|
|
725
|
+
publicEndpoint: config.operator?.publicEndpoint ?? `http://localhost:${config.apiPort}`,
|
|
726
|
+
defaultPriceUsdc: config.operator?.defaultPriceUsdc ?? '0',
|
|
727
|
+
perArtifactTypePrice: config.operator?.perArtifactTypePrice ?? {},
|
|
728
|
+
donation: {
|
|
729
|
+
enabled: config.network === 'testnet' && config.operator?.donation?.enabled === true,
|
|
730
|
+
},
|
|
731
|
+
};
|
|
732
|
+
let corpusForApi;
|
|
733
|
+
// Launcher mode wiring (Task 6 of spec/2026-05-05-launcher-role-and-mode.md).
|
|
734
|
+
// The API server is constructed before bootstrap finishes, so the operator's
|
|
735
|
+
// Safe address and the prediction.v1 generator are not yet known at start-up.
|
|
736
|
+
// We capture both into closures here and let `addLauncherRoutes` read them
|
|
737
|
+
// lazily — by the time `/v1/launcher/status` is hit, both are populated.
|
|
738
|
+
let predictionGeneratorRef;
|
|
739
|
+
const launchedGeneratorStateBySolverType = new Map();
|
|
740
|
+
let safeAddressForLauncher;
|
|
741
|
+
let publicClientForLauncher;
|
|
742
|
+
// jinn-mono-hqz0: holder for SolverNet creation/launch endpoint deps.
|
|
743
|
+
// The routes register eagerly in startApiServer (Hono freezes its matcher
|
|
744
|
+
// on first request); subsystem init below populates `holder.current` and
|
|
745
|
+
// the route handlers dereference it per-request.
|
|
746
|
+
const solverNetEndpointsDepsHolder = { current: undefined };
|
|
747
|
+
let setupApiServer;
|
|
748
|
+
try {
|
|
749
|
+
setupApiServer = await startApiServer({
|
|
750
|
+
port: config.apiPort,
|
|
751
|
+
store: sharedStore,
|
|
752
|
+
apiToken,
|
|
753
|
+
bindHost: apiBindHost,
|
|
754
|
+
corpus: config.subgraphUrl?.trim() ? () => corpusForApi : undefined,
|
|
755
|
+
ui: { token: uiToken, handshakeKey },
|
|
756
|
+
admin: {
|
|
757
|
+
onRestartRequested: () => {
|
|
758
|
+
console.log('[main] Restart requested via operator MCP. Exiting...');
|
|
759
|
+
process.exit(0);
|
|
760
|
+
},
|
|
761
|
+
},
|
|
762
|
+
harnessStatus: {
|
|
763
|
+
getStatus: async () => {
|
|
764
|
+
const mode = config.harness.mode;
|
|
765
|
+
const defaultHarness = config.harnesses?.default ?? DEFAULT_HARNESS;
|
|
766
|
+
const implStateDir = join(config.engine.implStateDirRoot, harnessStateDirName(defaultHarness));
|
|
767
|
+
let codeDigest = '';
|
|
768
|
+
try {
|
|
769
|
+
codeDigest = await hashImplStateDir(implStateDir);
|
|
770
|
+
}
|
|
771
|
+
catch {
|
|
772
|
+
// implStateDir may not exist yet on first boot. Surface as empty
|
|
773
|
+
// rather than 500ing — the panel renders "—" gracefully.
|
|
774
|
+
codeDigest = '';
|
|
775
|
+
}
|
|
776
|
+
const persisted = readModeState();
|
|
777
|
+
return {
|
|
778
|
+
mode,
|
|
779
|
+
codeDigest,
|
|
780
|
+
...(persisted ? { lastModeSwitchAt: persisted.switchedAt } : {}),
|
|
781
|
+
};
|
|
782
|
+
},
|
|
783
|
+
},
|
|
784
|
+
operatorArtifacts: {
|
|
785
|
+
configPath: CONFIG_PATH ?? DEFAULT_CONFIG_PATH,
|
|
786
|
+
operatorConfig: operatorArtifactsConfig,
|
|
787
|
+
onOperatorConfigUpdated: (operator) => {
|
|
788
|
+
config.operator = operator;
|
|
789
|
+
},
|
|
790
|
+
},
|
|
791
|
+
captures: {
|
|
792
|
+
captures: capturesStore,
|
|
793
|
+
publishCapture: async (sessionId) => {
|
|
794
|
+
const publish = capturePublishRef.current;
|
|
795
|
+
if (!publish) {
|
|
796
|
+
throw new CapturePublishUnavailableError('Capture publisher is waiting for bootstrap to finish.');
|
|
797
|
+
}
|
|
798
|
+
return publish(sessionId);
|
|
799
|
+
},
|
|
800
|
+
setTrustedRepo: (repoRemoteUrl, trusted) => {
|
|
801
|
+
console.log(`[main] captures trust-repo ${trusted ? 'enabled' : 'disabled'} for ${repoRemoteUrl}`);
|
|
802
|
+
},
|
|
803
|
+
},
|
|
804
|
+
stopHook: {
|
|
805
|
+
onStopHook: async (payload) => {
|
|
806
|
+
await ingestStopHookCapture(capturesStore, captureReceiver, payload);
|
|
807
|
+
},
|
|
808
|
+
},
|
|
809
|
+
bootstrap: {
|
|
810
|
+
earningDir: config.earningDir,
|
|
811
|
+
configReader: () => ({
|
|
812
|
+
rpcUrl: config.rpcUrl,
|
|
813
|
+
defaultRpcUrl: CHAIN_CONFIG.rpcUrl,
|
|
814
|
+
solverNets: config.solverNets,
|
|
815
|
+
joinedSolverNets: config.joinedSolverNets,
|
|
816
|
+
}),
|
|
817
|
+
},
|
|
818
|
+
// SolverNet catalog. Stubbed to the bundled `prediction` net for v1.
|
|
819
|
+
// Once the daemon's harness/plugin registry is loaded, swap this for a
|
|
820
|
+
// real registry adapter (separate task in the page-split plan).
|
|
821
|
+
solverNets: {
|
|
822
|
+
registry: {
|
|
823
|
+
list: () => [
|
|
824
|
+
{
|
|
825
|
+
name: 'prediction',
|
|
826
|
+
description: 'Forecast resolved outcomes; rewarded by Brier score on verified resolutions.',
|
|
827
|
+
contract: { id: 'prediction', version: 'v1' },
|
|
828
|
+
state: 'live',
|
|
829
|
+
supportedRoles: ['solving', 'evaluating'],
|
|
830
|
+
compatibleHarnesses: [
|
|
831
|
+
{ name: CLAUDE_CODE_HARNESS, version: '0.1.0', supportsRoles: ['solving'] },
|
|
832
|
+
],
|
|
833
|
+
compatiblePlugins: [
|
|
834
|
+
{ name: 'jinn-prediction-plugin', version: '0.1.0', source: 'bundled' },
|
|
835
|
+
],
|
|
836
|
+
},
|
|
837
|
+
{
|
|
838
|
+
name: 'swe-rebench-v2',
|
|
839
|
+
description: 'Code-issue benchmark tasks from SWE-rebench v2. Solvers submit unified-diff patches; evaluators run the per-instance Docker harness.',
|
|
840
|
+
contract: { id: 'swe-rebench-v2', version: 'v1' },
|
|
841
|
+
state: 'live',
|
|
842
|
+
supportedRoles: ['solving', 'evaluating'],
|
|
843
|
+
compatibleHarnesses: [
|
|
844
|
+
{ name: CLAUDE_CODE_HARNESS, version: '0.1.0', supportsRoles: ['solving'] },
|
|
845
|
+
{ name: CODEX_HARNESS, version: '0.1.0', supportsRoles: ['solving'] },
|
|
846
|
+
{ name: 'swe-rebench-v2-evaluator', version: '0.1.0', supportsRoles: ['evaluating'] },
|
|
847
|
+
],
|
|
848
|
+
compatiblePlugins: [
|
|
849
|
+
{ name: 'swe-rebench-v2-runtime', version: '0.1.0', source: 'bundled' },
|
|
850
|
+
],
|
|
851
|
+
},
|
|
852
|
+
],
|
|
853
|
+
},
|
|
854
|
+
},
|
|
855
|
+
// jinn-mono-hqz0: SolverNet creation/launch endpoints. Routes register
|
|
856
|
+
// eagerly here; deps are populated by main.ts post-bootstrap via the
|
|
857
|
+
// holder, and each route handler reads `holder.current` per-request.
|
|
858
|
+
solverNetsLauncher: { holder: solverNetEndpointsDepsHolder },
|
|
859
|
+
// Agent-binding retry: re-run the ERC-1271 bind step from the SPA
|
|
860
|
+
// without forcing a daemon restart. Constructs a fresh bootstrapper
|
|
861
|
+
// per call so we don't tangle lifecycle with the long-running one.
|
|
862
|
+
agentBinding: {
|
|
863
|
+
listUnbound: async () => {
|
|
864
|
+
const bs = new FleetBootstrapper({
|
|
865
|
+
earningDir: config.earningDir,
|
|
866
|
+
chain: NETWORK_CHAIN,
|
|
867
|
+
rpcUrl: config.rpcUrl,
|
|
868
|
+
stakingMode: config.stakingMode,
|
|
869
|
+
targetServices: config.targetServices,
|
|
870
|
+
});
|
|
871
|
+
const state = await bs.loadState();
|
|
872
|
+
return state.services
|
|
873
|
+
.filter((s) => !s.safe_bound_to_agent && s.agent_id !== null)
|
|
874
|
+
.map((s) => ({ serviceIndex: s.index }));
|
|
875
|
+
},
|
|
876
|
+
retryBind: async (serviceIndex) => {
|
|
877
|
+
const bs = new FleetBootstrapper({
|
|
878
|
+
earningDir: config.earningDir,
|
|
879
|
+
chain: NETWORK_CHAIN,
|
|
880
|
+
rpcUrl: config.rpcUrl,
|
|
881
|
+
stakingMode: config.stakingMode,
|
|
882
|
+
targetServices: config.targetServices,
|
|
883
|
+
testnetL2DeploymentPath: config.testnetL2DeploymentPath,
|
|
884
|
+
testnetL2TokenDeploymentPath: config.testnetL2TokenDeploymentPath,
|
|
885
|
+
testnetMechDeploymentPath: config.testnetMechDeploymentPath,
|
|
886
|
+
testnetStolasDeploymentPath: config.testnetStolasDeploymentPath,
|
|
887
|
+
});
|
|
888
|
+
try {
|
|
889
|
+
const state = await bs.retryAgentBindingFor(serviceIndex, PASSWORD);
|
|
890
|
+
const svc = state.services.find((s) => s.index === serviceIndex);
|
|
891
|
+
return {
|
|
892
|
+
serviceIndex,
|
|
893
|
+
status: svc?.safe_bound_to_agent ? 'success' : 'reverted',
|
|
894
|
+
txHash: svc?.agent_registered_tx ?? undefined,
|
|
895
|
+
};
|
|
896
|
+
}
|
|
897
|
+
catch (err) {
|
|
898
|
+
return {
|
|
899
|
+
serviceIndex,
|
|
900
|
+
status: 'reverted',
|
|
901
|
+
detail: err instanceof Error ? err.message : String(err),
|
|
902
|
+
};
|
|
903
|
+
}
|
|
904
|
+
},
|
|
905
|
+
},
|
|
906
|
+
setup: {
|
|
907
|
+
earningDir: config.earningDir,
|
|
908
|
+
chain: NETWORK_CHAIN,
|
|
909
|
+
rpcUrl: config.rpcUrl,
|
|
910
|
+
minEoaGasWei: (CHAIN_CONFIG.minEoaGasEth * 2n).toString(),
|
|
911
|
+
claudePath: activeClaudePath,
|
|
912
|
+
getClaudePath: () => activeClaudePath,
|
|
913
|
+
configPath: CONFIG_PATH ?? DEFAULT_CONFIG_PATH,
|
|
914
|
+
defaultRpcUrlForChain: () => CHAIN_CONFIG.rpcUrl,
|
|
915
|
+
onClaudePathSelected: selectClaudePath,
|
|
916
|
+
onSolverNetsUpdated: (solverNets) => {
|
|
917
|
+
config.solverNets = solverNets;
|
|
918
|
+
// The prediction operator status is memoised per-`JinnConfig`
|
|
919
|
+
// reference; mutating in place leaves the cache pointing at the
|
|
920
|
+
// pre-edit snapshot. Drop the entry so the next /v1/status read
|
|
921
|
+
// (and thus Overview's `solverNet.enabled` gating) reflects the
|
|
922
|
+
// toggle immediately. (jinn-mono-l2zl.15.4.12)
|
|
923
|
+
invalidatePredictionOperatorStatusCache(config);
|
|
924
|
+
},
|
|
925
|
+
},
|
|
926
|
+
status: {
|
|
927
|
+
earningDir: config.earningDir,
|
|
928
|
+
rpcUrl: config.rpcUrl,
|
|
929
|
+
network: config.network,
|
|
930
|
+
pollIntervalMs: config.pollIntervalMs,
|
|
931
|
+
masterEthDailyEstimateWei: config.masterEthDailyEstimateWei,
|
|
932
|
+
rewardClaimIntervalMs: config.rewardClaimIntervalMs,
|
|
933
|
+
testnetL2DeploymentPath: config.testnetL2DeploymentPath,
|
|
934
|
+
testnetL2TokenDeploymentPath: config.testnetL2TokenDeploymentPath,
|
|
935
|
+
testnetMechDeploymentPath: config.testnetMechDeploymentPath,
|
|
936
|
+
testnetStolasDeploymentPath: config.testnetStolasDeploymentPath,
|
|
937
|
+
engine: config.engine,
|
|
938
|
+
config,
|
|
939
|
+
configPath: CONFIG_PATH ?? DEFAULT_CONFIG_PATH,
|
|
940
|
+
},
|
|
941
|
+
// Launcher mode (Tasks 6 + 7). Deps are resolved lazily because the
|
|
942
|
+
// generator and Safe address are constructed after bootstrap, after
|
|
943
|
+
// this `startApiServer` call. By the time the SPA hits the route,
|
|
944
|
+
// bootstrap has completed and both refs are populated.
|
|
945
|
+
//
|
|
946
|
+
// Open-task-count is now real: it counts posted Tasks recorded against
|
|
947
|
+
// the creator Safe with the SolverNet's solver_type. The result is a
|
|
948
|
+
// strict superset of the in-flight count (we don't yet drop settled or
|
|
949
|
+
// failed Tasks; that lifecycle tracking lands with the router-watcher
|
|
950
|
+
// hardening lane, jinn-mono-l2zl.12). Safe balance is read live through
|
|
951
|
+
// the daemon's viem public client once bootstrap has created it.
|
|
952
|
+
// Reserved-budget remains unavailable until per-Task payment lifecycle
|
|
953
|
+
// state is persisted; return an empty string rather than a fake zero so
|
|
954
|
+
// the UI does not project runway from placeholder data.
|
|
955
|
+
//
|
|
956
|
+
// TODO(jinn-mono-l2zl.12): once Task lifecycle events are persisted,
|
|
957
|
+
// narrow `getOpenTaskCount` to states in
|
|
958
|
+
// ('open', 'claims-in-flight', 'fully-claimed') so the operator's
|
|
959
|
+
// "open Tasks" stat doesn't drift upward across the daemon's lifetime.
|
|
960
|
+
// TODO(jinn-mono launcher Task 8): real `getReservedBudgetWei`
|
|
961
|
+
// (sum of unconsumed claim payments across open Tasks).
|
|
962
|
+
launcher: {
|
|
963
|
+
getConfig: () => ({ solverNets: config.solverNets }),
|
|
964
|
+
configPath: CONFIG_PATH ?? DEFAULT_CONFIG_PATH,
|
|
965
|
+
// Cache-invalidation hook retained for the operator-mode
|
|
966
|
+
// setup-endpoints flow; the launcher-mode PATCH route was retired
|
|
967
|
+
// by Task 22, so this currently fires only when operator mode
|
|
968
|
+
// mutates `solverNets`.
|
|
969
|
+
onSolverNetsUpdated: (solverNets) => {
|
|
970
|
+
config.solverNets = solverNets;
|
|
971
|
+
invalidatePredictionOperatorStatusCache(config);
|
|
972
|
+
},
|
|
973
|
+
getGeneratorState: (netName) => {
|
|
974
|
+
if (netName === 'prediction') {
|
|
975
|
+
return predictionGeneratorRef?.getState();
|
|
976
|
+
}
|
|
977
|
+
const solverType = config.solverNets?.[netName]?.solverType;
|
|
978
|
+
if (!solverType)
|
|
979
|
+
return undefined;
|
|
980
|
+
return launchedGeneratorStateBySolverType.get(solverType)?.();
|
|
981
|
+
},
|
|
982
|
+
getOpenTaskCount: (netName) => {
|
|
983
|
+
const net = config.solverNets?.[netName];
|
|
984
|
+
const solverType = net?.solverType;
|
|
985
|
+
if (!solverType || !safeAddressForLauncher)
|
|
986
|
+
return 0;
|
|
987
|
+
return sharedStore.countPostedTasksByCreatorAndSolverType({
|
|
988
|
+
creatorSafeAddress: safeAddressForLauncher,
|
|
989
|
+
solverType,
|
|
990
|
+
});
|
|
991
|
+
},
|
|
992
|
+
getReservedBudgetWei: () => '',
|
|
993
|
+
getSafeBalanceWei: async () => {
|
|
994
|
+
const safeAddress = safeAddressForLauncher;
|
|
995
|
+
const publicClient = publicClientForLauncher;
|
|
996
|
+
if (!safeAddress || !publicClient)
|
|
997
|
+
return '';
|
|
998
|
+
try {
|
|
999
|
+
return (await publicClient.getBalance({
|
|
1000
|
+
address: getAddress(safeAddress),
|
|
1001
|
+
})).toString();
|
|
1002
|
+
}
|
|
1003
|
+
catch (err) {
|
|
1004
|
+
console.warn(`[main] launcher status Safe balance read failed for ${safeAddress}: ${err instanceof Error ? err.message : String(err)}`);
|
|
1005
|
+
return '';
|
|
1006
|
+
}
|
|
1007
|
+
},
|
|
1008
|
+
safeAddress: () => safeAddressForLauncher ?? '0x0000000000000000000000000000000000000000',
|
|
1009
|
+
tasksDeps: {
|
|
1010
|
+
// Resolved per-request for the same reason `safeAddress` is a
|
|
1011
|
+
// closure — `safeAddressForLauncher` is undefined until bootstrap
|
|
1012
|
+
// finishes. Before that, the response is an empty list, which is
|
|
1013
|
+
// accurate (no posts can have happened pre-bootstrap).
|
|
1014
|
+
get creatorAddress() {
|
|
1015
|
+
return safeAddressForLauncher ?? '0x0000000000000000000000000000000000000000';
|
|
1016
|
+
},
|
|
1017
|
+
fetchPostedTasks: ({ creatorAddress, limit, before }) => {
|
|
1018
|
+
// No-op when bootstrap hasn't resolved a Safe yet.
|
|
1019
|
+
if (creatorAddress === '0x0000000000000000000000000000000000000000') {
|
|
1020
|
+
return [];
|
|
1021
|
+
}
|
|
1022
|
+
const opts = {
|
|
1023
|
+
creatorSafeAddress: creatorAddress,
|
|
1024
|
+
limit,
|
|
1025
|
+
};
|
|
1026
|
+
if (before)
|
|
1027
|
+
opts.before = before;
|
|
1028
|
+
const rows = sharedStore.listPostedTasksByCreator(opts);
|
|
1029
|
+
return rows.map((r) => ({
|
|
1030
|
+
taskId: r.taskId,
|
|
1031
|
+
taskCid: r.taskCid,
|
|
1032
|
+
solverType: r.solverType ?? undefined,
|
|
1033
|
+
postedAt: r.postedAt,
|
|
1034
|
+
...(r.state ? { state: r.state } : {}),
|
|
1035
|
+
...(r.claims ? { claims: r.claims } : {}),
|
|
1036
|
+
}));
|
|
1037
|
+
},
|
|
1038
|
+
},
|
|
1039
|
+
},
|
|
1040
|
+
});
|
|
1041
|
+
}
|
|
1042
|
+
catch (error) {
|
|
1043
|
+
await closeCaptureReceiver();
|
|
1044
|
+
sharedStore.close();
|
|
1045
|
+
const err = error;
|
|
1046
|
+
if (err?.code === 'EADDRINUSE') {
|
|
1047
|
+
emitEnvelope({
|
|
1048
|
+
code: 'invalid_invocation',
|
|
1049
|
+
message: `Port ${config.apiPort} is already in use. Stop the other daemon or set JINN_API_PORT / apiPort to another port.`,
|
|
1050
|
+
hint: 'Set JINN_API_PORT to a free port, or stop the process currently listening on the dashboard/API port.',
|
|
1051
|
+
exampleCli: 'JINN_API_PORT=7332 jinn run',
|
|
1052
|
+
details: {
|
|
1053
|
+
field: 'apiPort',
|
|
1054
|
+
port: config.apiPort,
|
|
1055
|
+
reason: 'EADDRINUSE',
|
|
1056
|
+
},
|
|
1057
|
+
});
|
|
1058
|
+
}
|
|
1059
|
+
throw error;
|
|
1060
|
+
}
|
|
1061
|
+
process.env['JINN_UI_HANDSHAKE_URL'] =
|
|
1062
|
+
`http://127.0.0.1:${setupApiServer.port}/?k=${handshakeKey}`;
|
|
1063
|
+
// Auto-open the operator panel as soon as the setup-mode API is up so the
|
|
1064
|
+
// operator can watch bootstrap progress (including the funding wait, which
|
|
1065
|
+
// is the whole point of starting the API early). Suppressed by setting
|
|
1066
|
+
// JINN_NO_UI=1 — `jinn run --no-ui` translates the flag into this env var.
|
|
1067
|
+
if (process.env['JINN_NO_UI'] !== '1') {
|
|
1068
|
+
openBrowser(process.env['JINN_UI_HANDSHAKE_URL']);
|
|
1069
|
+
}
|
|
1070
|
+
console.log(`[main] Setup-mode API up (mode=${setupController.mode()}). ` +
|
|
1071
|
+
`Dashboard: http://127.0.0.1:${setupApiServer.port}`);
|
|
1072
|
+
// ── Operator agent WebSocket bridge ──────────────────────────────────────
|
|
1073
|
+
// Mount /api/agent/ws on the same HTTP server so the SPA's xterm.js panel
|
|
1074
|
+
// can attach to a long-lived embedded `claude` subprocess. The embedded
|
|
1075
|
+
// session reads MCP config we materialise to disk so it can reach the
|
|
1076
|
+
// operator MCP server (`jinn mcp`) for tool calls.
|
|
1077
|
+
const operatorMcpConfigPath = join(homedir(), '.jinn-client', 'operator-mcp-config.json');
|
|
1078
|
+
try {
|
|
1079
|
+
mkdirSync(dirname(operatorMcpConfigPath), { recursive: true });
|
|
1080
|
+
writeFileSyncMain(operatorMcpConfigPath, JSON.stringify({
|
|
1081
|
+
mcpServers: {
|
|
1082
|
+
'jinn-operator': {
|
|
1083
|
+
command: 'jinn',
|
|
1084
|
+
args: ['mcp'],
|
|
1085
|
+
},
|
|
1086
|
+
},
|
|
1087
|
+
}, null, 2));
|
|
1088
|
+
}
|
|
1089
|
+
catch (err) {
|
|
1090
|
+
console.warn(`[main] Failed to write operator MCP config at ${operatorMcpConfigPath}: ` +
|
|
1091
|
+
(err instanceof Error ? err.message : String(err)));
|
|
1092
|
+
}
|
|
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
|
+
// ── Init-if-missing ──────────────────────────────────────────────────────
|
|
1102
|
+
// If the keystore is missing but we have a password, run `jinn init` now so
|
|
1103
|
+
// bootstrap has something to decrypt. Idempotent: init is a no-op when the
|
|
1104
|
+
// keystore already exists. This makes `jinn run` work first-time on a fresh
|
|
1105
|
+
// host. We run AFTER startApiServer so the operator's panel can already
|
|
1106
|
+
// render the loading screen / setup steps while init does its work — the
|
|
1107
|
+
// /v1/bootstrap endpoint reports `mode:'uninitialized'` until init writes
|
|
1108
|
+
// earning_state.json, then the panel transitions on the next 3s poll.
|
|
1109
|
+
if (!existsSync(masterKeystorePath) && !existsSync(legacyKeystorePath)) {
|
|
1110
|
+
emitProgress({
|
|
1111
|
+
type: 'progress',
|
|
1112
|
+
phase: 'init',
|
|
1113
|
+
step: 'creating_wallet',
|
|
1114
|
+
estimatedWaitMs: 2000,
|
|
1115
|
+
});
|
|
1116
|
+
emitStructured({ kind: 'system', message: 'creating wallet keystore' });
|
|
1117
|
+
console.log('[main] No keystore found — initializing wallet from password.');
|
|
1118
|
+
const initCmd = (await import('./cli/commands/init.js')).default;
|
|
1119
|
+
let initExitCode = 0;
|
|
1120
|
+
await initCmd.run({
|
|
1121
|
+
argv: ['--json'],
|
|
1122
|
+
stdoutIsTty: false,
|
|
1123
|
+
writer: { write: (_s) => true }, // discard init's structured output
|
|
1124
|
+
exit: (code) => {
|
|
1125
|
+
initExitCode = code;
|
|
1126
|
+
},
|
|
1127
|
+
env: { ...process.env, JINN_PASSWORD: PASSWORD },
|
|
1128
|
+
});
|
|
1129
|
+
if (initExitCode !== 0) {
|
|
1130
|
+
console.error('[main] init failed; cannot continue.');
|
|
1131
|
+
await setupApiServer.close().catch(() => undefined);
|
|
1132
|
+
await closeCaptureReceiver();
|
|
1133
|
+
sharedStore.close();
|
|
1134
|
+
process.exit(initExitCode);
|
|
1135
|
+
}
|
|
1136
|
+
emitStructured({ kind: 'system', message: 'wallet keystore ready' });
|
|
1137
|
+
// Refresh the controller so the panel's loading screen knows the
|
|
1138
|
+
// keystore is on disk and we're transitioning into bootstrap.
|
|
1139
|
+
setupController.refresh({ keystoreExists: true, allComplete: false });
|
|
1140
|
+
}
|
|
1141
|
+
let bootstrapResult;
|
|
1142
|
+
try {
|
|
1143
|
+
bootstrapResult = await bootstrap();
|
|
1144
|
+
}
|
|
1145
|
+
catch (err) {
|
|
1146
|
+
if (err instanceof SetupBootstrapHalted) {
|
|
1147
|
+
return {
|
|
1148
|
+
schemaVersion: 1,
|
|
1149
|
+
generatedAt: new Date().toISOString(),
|
|
1150
|
+
kind: 'setup_halted',
|
|
1151
|
+
pid: process.pid,
|
|
1152
|
+
network: config.network,
|
|
1153
|
+
phase: config.network === 'testnet' ? 'phase-1b' : 'phase-0',
|
|
1154
|
+
apiPort: setupApiServer.port,
|
|
1155
|
+
dashboardUrl: `http://127.0.0.1:${setupApiServer.port}`,
|
|
1156
|
+
error: err.envelope,
|
|
1157
|
+
};
|
|
1158
|
+
}
|
|
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
|
+
}
|
|
1166
|
+
// Bootstrap completed — flip the controller into 'running' so any waiters
|
|
1167
|
+
// (future loops gated on this) unblock.
|
|
1168
|
+
setupController.refresh({ keystoreExists: true, allComplete: true });
|
|
1169
|
+
// ── --no-daemon: exit cleanly after bootstrap completes ──────────────────
|
|
1170
|
+
// `jinn run --no-daemon` flips JINN_NO_DAEMON=1 in run.ts. Emit a JSON
|
|
1171
|
+
// summary on stdout and exit 0 so CI / agent flows can stop after the
|
|
1172
|
+
// bootstrap state machine reaches 'complete' without paying for the
|
|
1173
|
+
// long-lived daemon.
|
|
1174
|
+
// We close the setup-mode API server here because its listening socket
|
|
1175
|
+
// would otherwise hold the event loop open and prevent process exit.
|
|
1176
|
+
if (process.env['JINN_NO_DAEMON'] === '1') {
|
|
1177
|
+
console.log('[main] --no-daemon: bootstrap complete, exiting before daemon loops.');
|
|
1178
|
+
await setupApiServer.close().catch(() => undefined);
|
|
1179
|
+
await closeCaptureReceiver();
|
|
1180
|
+
sharedStore.close();
|
|
1181
|
+
const summary = {
|
|
1182
|
+
schemaVersion: 1,
|
|
1183
|
+
generatedAt: new Date().toISOString(),
|
|
1184
|
+
verb: 'run',
|
|
1185
|
+
status: 'ready',
|
|
1186
|
+
masterAddress: bootstrapResult.masterAddress,
|
|
1187
|
+
dashboardUrl: `http://127.0.0.1:${config.apiPort}`,
|
|
1188
|
+
};
|
|
1189
|
+
process.stdout.write(JSON.stringify(summary) + '\n');
|
|
1190
|
+
process.exit(0);
|
|
1191
|
+
}
|
|
1192
|
+
const { agentPrivateKey, masterAddress, safeAddress, mechAddress, serviceIndex, serviceId, stakingAddress, agentId, identityRegistryAddress, } = bootstrapResult;
|
|
1193
|
+
// Now that bootstrap has resolved a Safe, expose it to the Launcher
|
|
1194
|
+
// mode endpoint so `/v1/launcher/status.budget.safeAddress` is accurate
|
|
1195
|
+
// on the very first SPA poll. (Task 6 of the launcher plan.)
|
|
1196
|
+
safeAddressForLauncher = safeAddress;
|
|
1197
|
+
const agentEoaAddress = privateKeyToAccount(agentPrivateKey).address;
|
|
218
1198
|
if (!mechAddress) {
|
|
219
1199
|
emitEnvelope({
|
|
220
1200
|
code: 'fatal',
|
|
@@ -227,6 +1207,59 @@ export async function main() {
|
|
|
227
1207
|
},
|
|
228
1208
|
});
|
|
229
1209
|
}
|
|
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. Run `jinn auth` in an interactive terminal before starting the daemon.',
|
|
1226
|
+
hint: `Detected context: ${authContext}. The daemon cannot function without Claude authentication.`,
|
|
1227
|
+
exampleCli: 'jinn auth',
|
|
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
|
+
const runner = new ClaudeRunner({
|
|
1240
|
+
claudePath: activeClaudePath,
|
|
1241
|
+
model: config.claudeModel,
|
|
1242
|
+
});
|
|
1243
|
+
const earningStore = new FleetStateStore(config.earningDir);
|
|
1244
|
+
const mnemonicForMaster = await decryptMnemonic(await earningStore.loadMnemonicKeystore(), PASSWORD);
|
|
1245
|
+
const masterAccount = deriveMasterSigner(mnemonicForMaster);
|
|
1246
|
+
const publicClient = createJinnPublicClient(config.rpcUrl, NETWORK_CHAIN);
|
|
1247
|
+
publicClientForLauncher = publicClient;
|
|
1248
|
+
const masterWallet = createJinnWalletClient(config.rpcUrl, NETWORK_CHAIN, masterAccount);
|
|
1249
|
+
const evictionRecovery = config.stakingMode === 'standard' &&
|
|
1250
|
+
serviceId !== null &&
|
|
1251
|
+
stakingAddress &&
|
|
1252
|
+
CHAIN_CONFIG.distributorAddress
|
|
1253
|
+
? {
|
|
1254
|
+
serviceId,
|
|
1255
|
+
stakingProxyAddress: stakingAddress,
|
|
1256
|
+
distributorAddress: CHAIN_CONFIG.distributorAddress,
|
|
1257
|
+
masterWalletClient: masterWallet,
|
|
1258
|
+
}
|
|
1259
|
+
: undefined;
|
|
1260
|
+
const taskDiscoveryManifestCids = Object.values(config.joinedSolverNets ?? {})
|
|
1261
|
+
.filter((entry) => entry.roles.includes('solver'))
|
|
1262
|
+
.map((entry) => entry.manifestCid);
|
|
230
1263
|
const adapter = new MechAdapter({
|
|
231
1264
|
rpcUrl: config.rpcUrl,
|
|
232
1265
|
mechMarketplaceAddress: MARKETPLACE_ADDRESS,
|
|
@@ -239,77 +1272,180 @@ export async function main() {
|
|
|
239
1272
|
pollIntervalMs: config.pollIntervalMs,
|
|
240
1273
|
chainId: config.network === 'testnet' ? 84532 : 8453,
|
|
241
1274
|
routerClaimDeliveryVariant: CHAIN_CONFIG.routerClaimDeliveryVersion,
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
details: {
|
|
256
|
-
field: 'claude_auth',
|
|
257
|
-
context: authContext,
|
|
258
|
-
authenticated: false,
|
|
259
|
-
},
|
|
260
|
-
});
|
|
261
|
-
}
|
|
262
|
-
const runner = new ClaudeRunner({
|
|
263
|
-
claudePath: config.claudePath,
|
|
264
|
-
model: config.claudeModel,
|
|
265
|
-
});
|
|
266
|
-
const earningStore = new FleetStateStore(config.earningDir);
|
|
267
|
-
const mnemonicForMaster = await decryptMnemonic(await earningStore.loadMnemonicKeystore(), PASSWORD);
|
|
268
|
-
const masterAccount = deriveMasterSigner(mnemonicForMaster);
|
|
269
|
-
const publicClient = createJinnPublicClient(config.rpcUrl, NETWORK_CHAIN);
|
|
270
|
-
const masterWallet = createJinnWalletClient(config.rpcUrl, NETWORK_CHAIN, masterAccount);
|
|
271
|
-
// ── RestorationEngine wiring ─────────────────────────────────────────────────
|
|
1275
|
+
evictionRecovery,
|
|
1276
|
+
taskDiscovery: taskDiscoveryManifestCids.length > 0
|
|
1277
|
+
? {
|
|
1278
|
+
...(config.subgraphUrl ? { subgraphUrl: config.subgraphUrl } : {}),
|
|
1279
|
+
solverNetManifestCids: taskDiscoveryManifestCids,
|
|
1280
|
+
onchainFromBlock: config.network === 'testnet' ? 41_153_291 : 25_000_000,
|
|
1281
|
+
...(config.taskDiscoveryAllowedTaskIds?.length
|
|
1282
|
+
? { allowedTaskIds: config.taskDiscoveryAllowedTaskIds }
|
|
1283
|
+
: {}),
|
|
1284
|
+
}
|
|
1285
|
+
: undefined,
|
|
1286
|
+
}, sharedStore);
|
|
1287
|
+
// ── TaskEngine wiring ─────────────────────────────────────────────────
|
|
272
1288
|
// Build agent viem clients (same creds as MechAdapter uses internally).
|
|
1289
|
+
const viemChains = await import('viem/chains');
|
|
273
1290
|
const agentChain = config.network === 'testnet'
|
|
274
|
-
?
|
|
275
|
-
:
|
|
1291
|
+
? viemChains.baseSepolia
|
|
1292
|
+
: viemChains.base;
|
|
1293
|
+
const l1Chain = config.jinnL1Network === 'sepolia' ? viemChains.sepolia : viemChains.mainnet;
|
|
1294
|
+
const agentChainContracts = agentChain.contracts;
|
|
1295
|
+
const optimismPortalAddress = agentChainContracts?.portal?.[l1Chain.id]?.address;
|
|
1296
|
+
const disputeGameFactoryAddress = agentChainContracts?.disputeGameFactory?.[l1Chain.id]?.address;
|
|
1297
|
+
const l2ProofClient = config.l2ProofRpcUrl
|
|
1298
|
+
? createJinnPublicClient(config.l2ProofRpcUrl, NETWORK_CHAIN)
|
|
1299
|
+
: undefined;
|
|
276
1300
|
const agentClients = createClients(config.rpcUrl, agentPrivateKey, agentChain);
|
|
277
|
-
// ──
|
|
278
|
-
//
|
|
279
|
-
//
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
1301
|
+
// ── L1 (Sepolia / Ethereum mainnet) clients for cross-chain JINN claim loop ──
|
|
1302
|
+
// Uses the agent EOA because MockMessenger.owner is the agent on testnet.
|
|
1303
|
+
// Same key as L2; only the chain differs.
|
|
1304
|
+
const l1ClientsForJinnClaim = JINN_MVI_CONFIG.distributor && config.ethereumRpcUrl
|
|
1305
|
+
? {
|
|
1306
|
+
public: createJinnL1PublicClient(config.ethereumRpcUrl, config.jinnL1Network),
|
|
1307
|
+
wallet: createJinnL1WalletClient(config.ethereumRpcUrl, config.jinnL1Network, privateKeyToAccount(agentPrivateKey)),
|
|
1308
|
+
}
|
|
1309
|
+
: undefined;
|
|
1310
|
+
if (l1ClientsForJinnClaim) {
|
|
1311
|
+
console.log(`[main] JinnClaimLoop: enabled (mode=${JINN_CLAIM_MESSENGER_MODE}, ` +
|
|
1312
|
+
`interval=${config.jinnClaimLoopIntervalMs}ms, distributor=${JINN_MVI_CONFIG.distributor}, ` +
|
|
1313
|
+
`emitter=${JINN_MVI_CONFIG.claimEmitter})`);
|
|
1314
|
+
}
|
|
1315
|
+
else {
|
|
1316
|
+
console.log(`[main] JinnClaimLoop: disabled (JinnDistributor artifact/override or JINN_ETHEREUM_RPC_URL not set)`);
|
|
1317
|
+
}
|
|
1318
|
+
// ── Harness registry ─────────────────────────────────────────────────────────
|
|
1319
|
+
const solverNetRegistry = await loadSolverNets(config);
|
|
1320
|
+
for (const net of solverNetRegistry.list()) {
|
|
1321
|
+
const plugins = net.runtimePlugins
|
|
1322
|
+
.map((plugin) => `${plugin.name}@${plugin.version}`)
|
|
1323
|
+
.join(', ');
|
|
1324
|
+
console.log(`[main] Loaded SolverNet: ${net.name} solverType=${net.solverType} harness=${net.harness} plugins=${plugins}`);
|
|
1325
|
+
}
|
|
1326
|
+
const implRegistry = new HarnessRegistry({
|
|
1327
|
+
solverTypeHarnesses: solverNetRegistry.harnessSelections(),
|
|
1328
|
+
default: config.harnesses?.default ?? DEFAULT_HARNESS,
|
|
1329
|
+
disabled: config.harnesses?.disabled ?? [...DEFAULT_DISABLED_HARNESSES],
|
|
289
1330
|
});
|
|
290
|
-
//
|
|
291
|
-
|
|
1331
|
+
// Load operator-supplied external harness impls (Path 2 plug-in surface).
|
|
1332
|
+
// Each entry in `config.harnesses.externalImpls` is verified against
|
|
1333
|
+
// `config.trustedImplSigners` before its factory is invoked. Failed loads
|
|
1334
|
+
// are logged + skipped — they don't bring down the daemon.
|
|
1335
|
+
const externalImpls = [];
|
|
1336
|
+
const trustedSigners = config.trustedImplSigners ?? [];
|
|
1337
|
+
const externalEntries = config.harnesses?.externalImpls ?? [];
|
|
1338
|
+
if (externalEntries.length > 0) {
|
|
1339
|
+
for (const entry of externalEntries) {
|
|
1340
|
+
const result = await loadExternalImpl({
|
|
1341
|
+
entry: {
|
|
1342
|
+
name: entry.name,
|
|
1343
|
+
entry: entry.entry,
|
|
1344
|
+
package: entry.package,
|
|
1345
|
+
version: entry.version,
|
|
1346
|
+
},
|
|
1347
|
+
trustedSigners,
|
|
1348
|
+
env: {
|
|
1349
|
+
implName: entry.name,
|
|
1350
|
+
implVersion: '0.0.0', // overridden by manifest validation below
|
|
1351
|
+
network: config.network,
|
|
1352
|
+
implStateDir: join(config.engine.implStateDirRoot, entry.name),
|
|
1353
|
+
secrets: Object.freeze({}),
|
|
1354
|
+
log: ({ level, msg, data }) => console.log(`[external-impl:${entry.name}] [${level}] ${msg}`, data ?? ''),
|
|
1355
|
+
stub: false,
|
|
1356
|
+
},
|
|
1357
|
+
});
|
|
1358
|
+
if (result.kind === 'ok') {
|
|
1359
|
+
externalImpls.push(result.impl);
|
|
1360
|
+
console.log(`[main] Loaded external impl: ${result.impl.name}@${result.impl.version}`);
|
|
1361
|
+
}
|
|
1362
|
+
else {
|
|
1363
|
+
console.warn(`[main] Failed to load external impl ${entry.name}: ${result.reason}` +
|
|
1364
|
+
(result.detail ? ` (${result.detail})` : ''));
|
|
1365
|
+
}
|
|
1366
|
+
}
|
|
1367
|
+
}
|
|
1368
|
+
// legacy-claude: wraps ClaudeRunner; handles spec=undefined (health-check) tasks
|
|
1369
|
+
const corpusChainId = config.network === 'testnet' ? 84532 : 8453;
|
|
1370
|
+
const corpusFromBlock = Number(DEFAULT_EXECUTION_DISCOVERY_FROM_BLOCK[corpusChainId] ?? 0n);
|
|
1371
|
+
const corpusEnv = (config.subgraphUrl?.trim() || identityRegistryAddress)
|
|
1372
|
+
? {
|
|
1373
|
+
...(config.subgraphUrl?.trim() ? { subgraphUrl: config.subgraphUrl } : {}),
|
|
1374
|
+
ipfsGatewayUrl: config.ipfsGatewayUrl,
|
|
1375
|
+
rpcUrl: config.rpcUrl,
|
|
1376
|
+
chainId: corpusChainId,
|
|
1377
|
+
...(identityRegistryAddress ? { identityRegistryAddress } : {}),
|
|
1378
|
+
...(corpusFromBlock > 0 ? { fromBlock: corpusFromBlock } : {}),
|
|
1379
|
+
}
|
|
1380
|
+
: undefined;
|
|
1381
|
+
for (const impl of buildHarnesses({
|
|
292
1382
|
rpcUrl: config.rpcUrl,
|
|
293
1383
|
archiveRpcUrl: config.archiveRpcUrl,
|
|
294
|
-
claudePath:
|
|
1384
|
+
claudePath: activeClaudePath,
|
|
295
1385
|
claudeModel: config.claudeModel,
|
|
296
1386
|
pk: agentPrivateKey,
|
|
297
1387
|
safe: safeAddress,
|
|
298
1388
|
runner,
|
|
299
1389
|
storePath: config.dbPath,
|
|
300
1390
|
daemonApiUrl: `http://127.0.0.1:${config.apiPort}`,
|
|
1391
|
+
daemonApiToken: apiToken,
|
|
301
1392
|
implStateDirRoot: config.engine.implStateDirRoot,
|
|
1393
|
+
ipfsRegistryUrl: config.ipfsRegistryUrl,
|
|
1394
|
+
externalImpls,
|
|
1395
|
+
disabledNames: config.harnesses?.disabled,
|
|
1396
|
+
corpusEnv,
|
|
302
1397
|
})) {
|
|
303
1398
|
implRegistry.register(impl);
|
|
304
1399
|
}
|
|
305
|
-
console.log(`[main]
|
|
1400
|
+
console.log(`[main] HarnessRegistry: ${implRegistry.list().map(i => i.name).join(', ')}`);
|
|
306
1401
|
// ── Engine deps ───────────────────────────────────────────────────────────────
|
|
307
|
-
// Packaging deps:
|
|
1402
|
+
// Packaging deps: artifacts are always written to served_artifacts
|
|
1403
|
+
// (operator-local SQLite). In public-testnet donation mode, scrubbed artifact
|
|
1404
|
+
// bytes are also pinned to IPFS and advertised as signed donation sources;
|
|
1405
|
+
// that IPFS path is the canonical release path. The HTTP endpoint and price
|
|
1406
|
+
// fields are kept as compatibility/future data-market fallback plumbing.
|
|
1407
|
+
const operatorPublicEndpoint = config.operator?.publicEndpoint ?? `http://localhost:${config.apiPort}`;
|
|
1408
|
+
const operatorDefaultPrice = config.operator?.defaultPriceUsdc ?? '0';
|
|
1409
|
+
const operatorPerTypePrice = config.operator?.perArtifactTypePrice ?? {};
|
|
1410
|
+
const donationRequested = config.operator?.donation?.enabled === true;
|
|
1411
|
+
const donationEnabled = donationRequested && config.network === 'testnet';
|
|
1412
|
+
if (donationRequested && !donationEnabled) {
|
|
1413
|
+
console.warn('[main] operator.donation.enabled is testnet-only; donation disabled on mainnet.');
|
|
1414
|
+
}
|
|
1415
|
+
if (!config.operator?.publicEndpoint) {
|
|
1416
|
+
if (donationEnabled) {
|
|
1417
|
+
console.log('[main] config.operator.publicEndpoint not set; using IPFS donation as the public artifact path. ' +
|
|
1418
|
+
'Direct HTTP artifact fallback will remain local-only.');
|
|
1419
|
+
}
|
|
1420
|
+
else {
|
|
1421
|
+
console.warn('[main] operator donation is disabled and config.operator.publicEndpoint is not set; ' +
|
|
1422
|
+
'new artifacts will remain local-only until donation mode is enabled.');
|
|
1423
|
+
}
|
|
1424
|
+
}
|
|
308
1425
|
const packagingDeps = {
|
|
309
|
-
|
|
1426
|
+
operatorEndpoint: operatorPublicEndpoint,
|
|
1427
|
+
defaultPriceUsdc: operatorDefaultPrice,
|
|
1428
|
+
perArtifactTypePrice: operatorPerTypePrice,
|
|
1429
|
+
donation: {
|
|
1430
|
+
enabled: donationEnabled,
|
|
1431
|
+
ipfsRegistryUrl: config.ipfsRegistryUrl,
|
|
1432
|
+
scrub: {
|
|
1433
|
+
identity: {
|
|
1434
|
+
username: userInfo().username,
|
|
1435
|
+
hostname: hostname(),
|
|
1436
|
+
},
|
|
1437
|
+
path: { home: homedir() },
|
|
1438
|
+
},
|
|
1439
|
+
},
|
|
310
1440
|
};
|
|
311
|
-
|
|
312
|
-
|
|
1441
|
+
const operatorConfig = {
|
|
1442
|
+
publicEndpoint: operatorPublicEndpoint,
|
|
1443
|
+
defaultPriceUsdc: operatorDefaultPrice,
|
|
1444
|
+
perArtifactTypePrice: operatorPerTypePrice,
|
|
1445
|
+
donation: { enabled: donationEnabled },
|
|
1446
|
+
};
|
|
1447
|
+
// Envelope assembly deps: sign envelopes with agent EOA private key
|
|
1448
|
+
const envelopeDeps = {
|
|
313
1449
|
ipfsRegistryUrl: config.ipfsRegistryUrl,
|
|
314
1450
|
agentEoaPrivateKey: agentPrivateKey,
|
|
315
1451
|
safeAddress,
|
|
@@ -322,53 +1458,313 @@ export async function main() {
|
|
|
322
1458
|
mechContractAddress: mechAddress,
|
|
323
1459
|
routerAddress: ROUTER_ADDRESS,
|
|
324
1460
|
claimDeliveryVariant: CHAIN_CONFIG.routerClaimDeliveryVersion,
|
|
1461
|
+
evictionRecovery,
|
|
325
1462
|
};
|
|
326
|
-
//
|
|
327
|
-
//
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
1463
|
+
// ── IdentityPublisher (jinn-mono-3zk) ───────────────────────────────────────
|
|
1464
|
+
//
|
|
1465
|
+
// When the bootstrap has minted an ERC-8004 IdentityRegistry NFT for the
|
|
1466
|
+
// active service (agent_id non-null) AND we know the registry address, wire
|
|
1467
|
+
// an IdentityPublisher so the engine anchors each envelope under the
|
|
1468
|
+
// operator's agent NFT via setMetadata. Otherwise log a warning — publishing
|
|
1469
|
+
// is disabled until bootstrap completes that step (jinn-mono-j07).
|
|
1470
|
+
let identityPublisher;
|
|
1471
|
+
if (agentId && identityRegistryAddress) {
|
|
1472
|
+
const { IdentityPublisher } = await import('./erc8004/index.js');
|
|
1473
|
+
identityPublisher = new IdentityPublisher({
|
|
1474
|
+
identityRegistryAddress,
|
|
1475
|
+
agentId: BigInt(agentId),
|
|
1476
|
+
walletClient: agentClients.walletClient,
|
|
1477
|
+
publicClient: agentClients.publicClient,
|
|
1478
|
+
});
|
|
1479
|
+
console.log(`[main] IdentityPublisher: agentId=${agentId} registry=${identityRegistryAddress}`);
|
|
339
1480
|
}
|
|
340
1481
|
else {
|
|
341
|
-
console.log('[main]
|
|
1482
|
+
console.log('[main] IdentityPublisher: disabled (no agent_id on active service — re-run bootstrap to mint the operator agent NFT)');
|
|
342
1483
|
}
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
1484
|
+
const liveCapturePublisher = createLiveCapturePublisher({
|
|
1485
|
+
store: sharedStore,
|
|
1486
|
+
captures: capturesStore,
|
|
1487
|
+
ipfsRegistryUrl: config.ipfsRegistryUrl,
|
|
1488
|
+
operatorEndpoint: operatorPublicEndpoint,
|
|
1489
|
+
defaultPriceUsdc: operatorDefaultPrice,
|
|
1490
|
+
perArtifactTypePrice: operatorPerTypePrice,
|
|
1491
|
+
participant: { safeAddress, agentEoa: agentEoaAddress },
|
|
1492
|
+
signer: { address: agentEoaAddress, privateKey: agentPrivateKey },
|
|
1493
|
+
clientGitSha: buildInfo.clientGitSha,
|
|
1494
|
+
identityPublisher,
|
|
1495
|
+
harnessMode: config.harness.mode,
|
|
350
1496
|
});
|
|
351
|
-
|
|
352
|
-
|
|
1497
|
+
capturePublishRef.current = liveCapturePublisher.publishCapture;
|
|
1498
|
+
// ── Reputation feedback hook (jinn-mono-yg4) ──────────────────────────────
|
|
1499
|
+
//
|
|
1500
|
+
// After the evaluator's claimDelivery succeeds, the engine fires
|
|
1501
|
+
// `ReputationRegistry.giveFeedback(harnessAgentId, …)` so the harness's
|
|
1502
|
+
// agent NFT accrues a rating (DR §4.3). This requires:
|
|
1503
|
+
//
|
|
1504
|
+
// 1. A `ReputationRegistryClient` for the active chain. We use the
|
|
1505
|
+
// canonical 0x8004… deployment; writes route through the operator's
|
|
1506
|
+
// Safe so `msg.sender` matches the OLAS staking + 8004 IdentityRegistry
|
|
1507
|
+
// identity.
|
|
1508
|
+
// 2. An agentId resolver — looks up the harness's agentId from the
|
|
1509
|
+
// parent manifest's evidenceHash via the subgraph. When `subgraphUrl`
|
|
1510
|
+
// is unconfigured the resolver returns null cleanly and the hook
|
|
1511
|
+
// becomes a no-op (defensive: feedback is non-fatal).
|
|
1512
|
+
//
|
|
1513
|
+
// Skipped when the operator hasn't minted an agent NFT yet (matches the
|
|
1514
|
+
// IdentityPublisher gating above).
|
|
1515
|
+
let reputationFeedback;
|
|
1516
|
+
if (agentId) {
|
|
1517
|
+
const { getReputationRegistryAddress, ReputationRegistryClient } = await import('./erc8004/index.js');
|
|
1518
|
+
const chainId = config.network === 'testnet' ? 84532 : 8453;
|
|
1519
|
+
const reputationRegistryAddress = getReputationRegistryAddress(chainId);
|
|
1520
|
+
if (reputationRegistryAddress) {
|
|
1521
|
+
const reputationClient = new ReputationRegistryClient({
|
|
1522
|
+
reputationRegistryAddress,
|
|
1523
|
+
publicClient: agentClients.publicClient,
|
|
1524
|
+
walletClient: agentClients.walletClient,
|
|
1525
|
+
safeAddress,
|
|
1526
|
+
});
|
|
1527
|
+
const { resolveAgentIdForManifest } = await import('./erc8004/index.js');
|
|
1528
|
+
const subgraphUrl = config.subgraphUrl;
|
|
1529
|
+
reputationFeedback = {
|
|
1530
|
+
client: reputationClient,
|
|
1531
|
+
resolveAgentId: (manifestHash) => resolveAgentIdForManifest({ manifestHash, subgraphUrl }),
|
|
1532
|
+
};
|
|
1533
|
+
console.log(`[main] ReputationFeedback: registry=${reputationRegistryAddress}${subgraphUrl ? ` subgraph=${subgraphUrl}` : ' (no subgraph configured — resolver always null)'}`);
|
|
1534
|
+
}
|
|
1535
|
+
else {
|
|
1536
|
+
console.log(`[main] ReputationFeedback: disabled (no canonical ReputationRegistry deployed on chainId=${chainId})`);
|
|
1537
|
+
}
|
|
1538
|
+
}
|
|
1539
|
+
else {
|
|
1540
|
+
console.log('[main] ReputationFeedback: disabled (no agent_id on active service — same gating as IdentityPublisher)');
|
|
1541
|
+
}
|
|
1542
|
+
// ── SolverNet subsystem (Task 11 of solvernet-creation-and-launch.md) ─────
|
|
1543
|
+
//
|
|
1544
|
+
// Loads owned launched records from `~/.jinn-client/solvernets/launched/`,
|
|
1545
|
+
// resumes any in-flight launch / lifecycle transitions, and starts the
|
|
1546
|
+
// operator catalog refresher. Generator construction per launched record
|
|
1547
|
+
// lands in Task 12; until then we expose `pendingGenerators` so the
|
|
1548
|
+
// upcoming wiring has a clean handoff point.
|
|
1549
|
+
//
|
|
1550
|
+
// Day-1 SubgraphClient is the no-op stub — Task 25 wires the real
|
|
1551
|
+
// subgraph extension. The launch state machine still resumes correctly
|
|
1552
|
+
// through the receipt-confirmation path; only the mempool-drop fallback
|
|
1553
|
+
// depends on subgraph reads.
|
|
1554
|
+
let solverNetSubsystem;
|
|
1555
|
+
// Hoisted so the engine wiring below can pick the registry client up as
|
|
1556
|
+
// its `manifestResolver` (Task 27 of the SolverNet creation-and-launch
|
|
1557
|
+
// spec — task validation goes manifest → contract → schemas).
|
|
1558
|
+
let solverNetRegistryClientForEngine;
|
|
1559
|
+
if (agentId && identityRegistryAddress && config.network === 'testnet') {
|
|
1560
|
+
const { initSolverNetSubsystem, createIpfsClientAdapter, createNoopSubgraphClient, createGraphqlSubgraphClient, createMetadataPublisherFromViem, createDefaultRegistryClient, } = await import('./solvernets/daemon-init.js');
|
|
1561
|
+
const { createSolverNetStore } = await import('./solvernets/store.js');
|
|
1562
|
+
const solverNetStore = createSolverNetStore({ baseDir: config.earningDir });
|
|
1563
|
+
const solverNetIpfs = createIpfsClientAdapter({
|
|
1564
|
+
registryUrl: config.ipfsRegistryUrl,
|
|
1565
|
+
gatewayUrl: config.ipfsGatewayUrl,
|
|
1566
|
+
});
|
|
1567
|
+
const solverNetSubgraph = config.subgraphUrl?.trim()
|
|
1568
|
+
? createGraphqlSubgraphClient({ url: config.subgraphUrl })
|
|
1569
|
+
: createNoopSubgraphClient();
|
|
1570
|
+
const solverNetPublisher = createMetadataPublisherFromViem({
|
|
1571
|
+
identityRegistryAddress,
|
|
1572
|
+
walletClient: agentClients.walletClient,
|
|
1573
|
+
publicClient: agentClients.publicClient,
|
|
1574
|
+
});
|
|
1575
|
+
const solverNetRegistryClient = createDefaultRegistryClient({
|
|
1576
|
+
ipfs: solverNetIpfs,
|
|
1577
|
+
publisher: solverNetPublisher,
|
|
1578
|
+
subgraph: solverNetSubgraph,
|
|
1579
|
+
network: 'base-sepolia',
|
|
1580
|
+
});
|
|
1581
|
+
solverNetRegistryClientForEngine = solverNetRegistryClient;
|
|
1582
|
+
const launcherSigner = {
|
|
1583
|
+
agentEoaAddress: privateKeyToAccount(agentPrivateKey).address,
|
|
1584
|
+
agentEoaPrivateKey: agentPrivateKey,
|
|
1585
|
+
agentId,
|
|
1586
|
+
};
|
|
1587
|
+
try {
|
|
1588
|
+
solverNetSubsystem = await initSolverNetSubsystem({
|
|
1589
|
+
store: solverNetStore,
|
|
1590
|
+
ipfs: solverNetIpfs,
|
|
1591
|
+
publisher: solverNetPublisher,
|
|
1592
|
+
subgraph: solverNetSubgraph,
|
|
1593
|
+
registryClient: solverNetRegistryClient,
|
|
1594
|
+
network: 'base-sepolia',
|
|
1595
|
+
resolveSigner: async () => launcherSigner,
|
|
1596
|
+
lifecycleSigner: launcherSigner,
|
|
1597
|
+
awaitTxConfirmation: async (txHash) => {
|
|
1598
|
+
const receipt = await agentClients.publicClient.waitForTransactionReceipt({ hash: txHash });
|
|
1599
|
+
return { blockNumber: Number(receipt.blockNumber) };
|
|
1600
|
+
},
|
|
1601
|
+
});
|
|
1602
|
+
console.log(`[main] SolverNet subsystem ready: ${solverNetSubsystem.records.length} owned record(s), ` +
|
|
1603
|
+
`${solverNetSubsystem.pendingGenerators.length} ready for spawn (Task 12)`);
|
|
1604
|
+
// jinn-mono-hqz0: populate the launcher endpoints' deps holder. The
|
|
1605
|
+
// routes themselves were registered eagerly inside startApiServer
|
|
1606
|
+
// (Hono's matcher freezes before the holder is filled, so handlers
|
|
1607
|
+
// dereference holder.current per-request). Without this the SPA's
|
|
1608
|
+
// /launcher list page 404s on /v1/solvernets/launched.
|
|
1609
|
+
if (solverNetEndpointsDepsHolder) {
|
|
1610
|
+
const { LaunchAction } = await import('./solvernets/launch-state-machine.js');
|
|
1611
|
+
const { LifecycleTransition } = await import('./solvernets/lifecycle-transitions.js');
|
|
1612
|
+
const awaitLauncherTxConfirmation = async (txHash) => {
|
|
1613
|
+
const receipt = await agentClients.publicClient.waitForTransactionReceipt({ hash: txHash });
|
|
1614
|
+
return { blockNumber: Number(receipt.blockNumber) };
|
|
1615
|
+
};
|
|
1616
|
+
const pendingGeneratorsRef = { current: solverNetSubsystem.pendingGenerators };
|
|
1617
|
+
const launchAction = new LaunchAction({
|
|
1618
|
+
store: solverNetStore,
|
|
1619
|
+
ipfs: solverNetIpfs,
|
|
1620
|
+
publisher: solverNetPublisher,
|
|
1621
|
+
subgraph: solverNetSubgraph,
|
|
1622
|
+
spawnGenerator: async () => {
|
|
1623
|
+
/* Generators are spawned by main.ts post-launch loop;
|
|
1624
|
+
* the launcher endpoint just persists the record here. */
|
|
1625
|
+
},
|
|
1626
|
+
awaitTxConfirmation: awaitLauncherTxConfirmation,
|
|
1627
|
+
});
|
|
1628
|
+
const lifecycleTransition = new LifecycleTransition({
|
|
1629
|
+
store: solverNetStore,
|
|
1630
|
+
registry: solverNetRegistryClient,
|
|
1631
|
+
signer: launcherSigner,
|
|
1632
|
+
subgraph: solverNetSubgraph,
|
|
1633
|
+
awaitTxConfirmation: awaitLauncherTxConfirmation,
|
|
1634
|
+
});
|
|
1635
|
+
if (!safeAddressForLauncher) {
|
|
1636
|
+
throw new Error('[main] safeAddressForLauncher missing at SolverNet endpoints registration');
|
|
1637
|
+
}
|
|
1638
|
+
solverNetEndpointsDepsHolder.current = {
|
|
1639
|
+
store: solverNetStore,
|
|
1640
|
+
launch: {
|
|
1641
|
+
launchAction,
|
|
1642
|
+
lifecycleTransition,
|
|
1643
|
+
pendingGenerators: pendingGeneratorsRef,
|
|
1644
|
+
signer: launcherSigner,
|
|
1645
|
+
network: 'base-sepolia',
|
|
1646
|
+
launcher: {
|
|
1647
|
+
safeAddress: safeAddressForLauncher,
|
|
1648
|
+
agentEoa: launcherSigner.agentEoaAddress,
|
|
1649
|
+
agentId: launcherSigner.agentId,
|
|
1650
|
+
},
|
|
1651
|
+
},
|
|
1652
|
+
catalog: solverNetSubsystem.catalog,
|
|
1653
|
+
registry: solverNetRegistryClient,
|
|
1654
|
+
};
|
|
1655
|
+
console.log('[main] SolverNet endpoints deps populated (jinn-mono-hqz0)');
|
|
1656
|
+
}
|
|
1657
|
+
}
|
|
1658
|
+
catch (err) {
|
|
1659
|
+
console.warn(`[main] SolverNet subsystem init failed; continuing without it: ${err instanceof Error ? err.message : String(err)}`);
|
|
1660
|
+
}
|
|
353
1661
|
}
|
|
354
|
-
|
|
355
|
-
|
|
1662
|
+
else {
|
|
1663
|
+
console.log('[main] SolverNet subsystem: disabled ' +
|
|
1664
|
+
'(requires testnet + agent_id + identity_registry_address — Task 11 scaffolding)');
|
|
1665
|
+
}
|
|
1666
|
+
// The catalog cache will be consumed by the API server in Tasks 14/15.
|
|
1667
|
+
// The `pendingGenerators` set is iterated below to wire generators per
|
|
1668
|
+
// launched record (Task 12).
|
|
1669
|
+
// ── Auto Task generators (launched-record-driven) ────────────────────────
|
|
1670
|
+
//
|
|
1671
|
+
// Per spec/2026-05-05-solvernet-creation-and-launch.md §11 + Task 22 of the
|
|
1672
|
+
// implementation plan, generator construction is wholly driven by the
|
|
1673
|
+
// SolverNet launched-record subsystem. The legacy
|
|
1674
|
+
// `collectTestnetAutoTaskGenerators` path (config-block-keyed Polymarket
|
|
1675
|
+
// generator + role-based hot-spawn gate) is retired — SolverNet ownership
|
|
1676
|
+
// is determined by which launched records the daemon owns, not by the
|
|
1677
|
+
// operator-config role enum.
|
|
1678
|
+
const autoTasksDisabled = process.env['JINN_DISABLE_AUTO_TASKS'] === '1';
|
|
1679
|
+
// ── SolverNet launched-record generators (Task 12 of
|
|
1680
|
+
// spec/2026-05-05-solvernet-creation-and-launch.md §11) ────────────────
|
|
1681
|
+
//
|
|
1682
|
+
// For each owned launched record where `status === 'launched'` and
|
|
1683
|
+
// `generatorEnabled === true`, construct a prediction.v1 Polymarket
|
|
1684
|
+
// generator wired to the live `recordRef` and `configRef` exposed by
|
|
1685
|
+
// `initSolverNetSubsystem`. Lifecycle transitions (pause/resume/retire)
|
|
1686
|
+
// and the SolverNet config API endpoint (Task 14) mutate these refs at
|
|
1687
|
+
// runtime; the per-tick gate inside the generator picks the change up
|
|
1688
|
+
// within one cadence — no daemon restart, no recreation.
|
|
1689
|
+
const launchedRecordGenerators = [];
|
|
1690
|
+
if (solverNetSubsystem && !autoTasksDisabled) {
|
|
1691
|
+
const { wireLaunchedRecordGenerators } = await import('./solvernets/launched-record-dispatcher.js');
|
|
1692
|
+
const wired = await wireLaunchedRecordGenerators({
|
|
1693
|
+
pendingGenerators: solverNetSubsystem.pendingGenerators,
|
|
1694
|
+
launchedDir: join(config.earningDir, 'solvernets', 'launched'),
|
|
1695
|
+
staticConfig: {
|
|
1696
|
+
agentEoa: agentEoaAddress,
|
|
1697
|
+
safeAddress,
|
|
1698
|
+
agentPrivateKey,
|
|
1699
|
+
},
|
|
1700
|
+
logger: {
|
|
1701
|
+
info: (message) => console.log(message),
|
|
1702
|
+
warn: (message) => console.warn(message),
|
|
1703
|
+
},
|
|
1704
|
+
});
|
|
1705
|
+
launchedRecordGenerators.push(...wired.generators);
|
|
1706
|
+
for (const [solverType, getState] of wired.generatorStatesBySolverType) {
|
|
1707
|
+
launchedGeneratorStateBySolverType.set(solverType, getState);
|
|
1708
|
+
}
|
|
1709
|
+
if (!predictionGeneratorRef && wired.predictionGeneratorRef) {
|
|
1710
|
+
predictionGeneratorRef =
|
|
1711
|
+
wired.predictionGeneratorRef;
|
|
1712
|
+
}
|
|
356
1713
|
}
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
1714
|
+
if (config.network === 'mainnet' && !autoTasksDisabled && BASE_FEEDS['ETH / USD']) {
|
|
1715
|
+
// Mainnet auto-task opt-in only; default is OFF. Reserved for a future flag.
|
|
1716
|
+
}
|
|
1717
|
+
const taskSources = [
|
|
1718
|
+
new StaticConfiguredTaskSource(config.tasks),
|
|
1719
|
+
...launchedRecordGenerators.map(({ solverType, generator }, idx) => new GeneratedTaskSource(`launched:${solverType}:${idx}`, generator)),
|
|
360
1720
|
];
|
|
1721
|
+
// ── Corpus (daemon-side, jinn-mono-vy37.1.6) ─────────────────────────────
|
|
1722
|
+
//
|
|
1723
|
+
// Built once per daemon lifetime; the agent EOA private key stays in this
|
|
1724
|
+
// process's memory and never crosses into the MCP subprocess. The MCP
|
|
1725
|
+
// tool `acquire_artifact` proxies to `POST /v1/artifacts/acquire` instead.
|
|
1726
|
+
// Enabled when either the optional subgraph accelerator or canonical
|
|
1727
|
+
// on-chain ERC-8004/IPFS discovery is configured. Otherwise the API route is
|
|
1728
|
+
// absent and MCP falls back to local-only behaviour with a warning.
|
|
1729
|
+
const corpusFactory = (config.subgraphUrl?.trim() || identityRegistryAddress)
|
|
1730
|
+
? (store) => (corpusForApi = createCorpus({
|
|
1731
|
+
...(config.subgraphUrl?.trim() ? { subgraphUrl: config.subgraphUrl } : {}),
|
|
1732
|
+
ipfsGatewayUrl: config.ipfsGatewayUrl,
|
|
1733
|
+
store,
|
|
1734
|
+
signer: { privateKey: agentPrivateKey },
|
|
1735
|
+
selfSafeAddress: safeAddress,
|
|
1736
|
+
...(identityRegistryAddress
|
|
1737
|
+
? {
|
|
1738
|
+
onchain: {
|
|
1739
|
+
rpcUrl: config.rpcUrl,
|
|
1740
|
+
chainId: corpusChainId,
|
|
1741
|
+
identityRegistryAddress,
|
|
1742
|
+
...(corpusFromBlock > 0 ? { fromBlock: corpusFromBlock } : {}),
|
|
1743
|
+
},
|
|
1744
|
+
}
|
|
1745
|
+
: {}),
|
|
1746
|
+
}))
|
|
1747
|
+
: undefined;
|
|
1748
|
+
if (!corpusFactory) {
|
|
1749
|
+
console.warn('[main] Corpus disabled (no subgraphUrl or on-chain identity registry); ' +
|
|
1750
|
+
'MCP record lookup and artifact acquisition network branches will be unavailable.');
|
|
1751
|
+
}
|
|
361
1752
|
const daemon = new Daemon({
|
|
362
1753
|
adapter,
|
|
363
1754
|
runner,
|
|
364
|
-
|
|
1755
|
+
taskSources,
|
|
365
1756
|
dbPath: config.dbPath,
|
|
1757
|
+
store: sharedStore,
|
|
1758
|
+
apiServer: setupApiServer,
|
|
366
1759
|
pollIntervalMs: config.pollIntervalMs,
|
|
367
1760
|
apiPort: config.apiPort,
|
|
1761
|
+
apiBindHost,
|
|
1762
|
+
apiToken,
|
|
368
1763
|
peers: config.peers.length > 0 ? config.peers : undefined,
|
|
369
1764
|
subgraphUrl: config.subgraphUrl,
|
|
370
1765
|
nodeEndpoint: config.nodeEndpoint,
|
|
371
1766
|
creatorSafeAddress: safeAddress,
|
|
1767
|
+
corpusFactory,
|
|
372
1768
|
status: {
|
|
373
1769
|
earningDir: config.earningDir,
|
|
374
1770
|
rpcUrl: config.rpcUrl,
|
|
@@ -380,8 +1776,9 @@ export async function main() {
|
|
|
380
1776
|
testnetL2TokenDeploymentPath: config.testnetL2TokenDeploymentPath,
|
|
381
1777
|
testnetMechDeploymentPath: config.testnetMechDeploymentPath,
|
|
382
1778
|
testnetStolasDeploymentPath: config.testnetStolasDeploymentPath,
|
|
383
|
-
testnetClaimRegistryDeploymentPath: config.testnetClaimRegistryDeploymentPath,
|
|
384
1779
|
engine: config.engine,
|
|
1780
|
+
config,
|
|
1781
|
+
configPath: CONFIG_PATH ?? DEFAULT_CONFIG_PATH,
|
|
385
1782
|
},
|
|
386
1783
|
rewardClaim: config.rewardClaimIntervalMs > 0
|
|
387
1784
|
? {
|
|
@@ -393,19 +1790,58 @@ export async function main() {
|
|
|
393
1790
|
distributorAddress: CHAIN_CONFIG.distributorAddress,
|
|
394
1791
|
}
|
|
395
1792
|
: undefined,
|
|
1793
|
+
jinnClaim: l1ClientsForJinnClaim &&
|
|
1794
|
+
JINN_MVI_CONFIG.claimEmitter &&
|
|
1795
|
+
JINN_MVI_CONFIG.messenger &&
|
|
1796
|
+
JINN_MVI_CONFIG.distributor &&
|
|
1797
|
+
config.jinnClaimLoopIntervalMs > 0
|
|
1798
|
+
? {
|
|
1799
|
+
intervalMs: config.jinnClaimLoopIntervalMs,
|
|
1800
|
+
l2Client: agentClients.publicClient,
|
|
1801
|
+
l2ProofClient,
|
|
1802
|
+
l2Wallet: agentClients.walletClient,
|
|
1803
|
+
l1Client: l1ClientsForJinnClaim.public,
|
|
1804
|
+
l1Wallet: l1ClientsForJinnClaim.wallet,
|
|
1805
|
+
store: earningStore,
|
|
1806
|
+
chain: NETWORK_CHAIN,
|
|
1807
|
+
claimEmitterAddress: JINN_MVI_CONFIG.claimEmitter,
|
|
1808
|
+
distributorAddress: JINN_MVI_CONFIG.distributor,
|
|
1809
|
+
messengerAddress: JINN_MVI_CONFIG.messenger,
|
|
1810
|
+
messengerMode: JINN_CLAIM_MESSENGER_MODE,
|
|
1811
|
+
optimismPortalAddress,
|
|
1812
|
+
disputeGameFactoryAddress,
|
|
1813
|
+
}
|
|
1814
|
+
: undefined,
|
|
396
1815
|
restorationEngine: {
|
|
397
|
-
// TODO(jinn-mono-cy4): RestorationEngineOptions has redundant registry+implRegistry
|
|
398
|
-
// fields. Engine refactor should consolidate to one. Locked in this PR.
|
|
399
|
-
registry: implRegistry,
|
|
400
1816
|
paths: {
|
|
401
1817
|
workingDirRoot: config.engine.workingDirRoot,
|
|
402
1818
|
implStateDirRoot: config.engine.implStateDirRoot,
|
|
403
1819
|
},
|
|
404
|
-
claimDeps,
|
|
405
1820
|
packagingDeps,
|
|
406
|
-
|
|
1821
|
+
envelopeDeps,
|
|
407
1822
|
deliveryDeps,
|
|
408
1823
|
implRegistry,
|
|
1824
|
+
solverNetRegistry,
|
|
1825
|
+
// Spec §14, Task 28: per-launch claim eligibility filter. Operators
|
|
1826
|
+
// populate `joinedSolverNets[<manifestCid>]` via the SPA's join flow;
|
|
1827
|
+
// the engine refuses tasks whose `manifestDigest = keccak256(cid)`
|
|
1828
|
+
// doesn't match a joined entry (plus a role gate). Absent when the
|
|
1829
|
+
// operator hasn't joined any nets yet — the engine then falls back to
|
|
1830
|
+
// the legacy solverType-keyed gate.
|
|
1831
|
+
...(config.joinedSolverNets
|
|
1832
|
+
? { joinedSolverNets: joinedSolverNetsViewFromConfig(config.joinedSolverNets) }
|
|
1833
|
+
: {}),
|
|
1834
|
+
// Spec §14: task validation resolves manifest → contract → schemas.
|
|
1835
|
+
// Threaded only when the SolverNet registry client was constructed
|
|
1836
|
+
// (testnet branch above). The engine treats absence as "schema
|
|
1837
|
+
// validation skipped" — production callers always have it.
|
|
1838
|
+
...(solverNetRegistryClientForEngine
|
|
1839
|
+
? { manifestResolver: solverNetRegistryClientForEngine }
|
|
1840
|
+
: {}),
|
|
1841
|
+
identityPublisher,
|
|
1842
|
+
reputationFeedback,
|
|
1843
|
+
operatorConfig,
|
|
1844
|
+
harnessMode: config.harness.mode,
|
|
409
1845
|
},
|
|
410
1846
|
balanceTopup: config.balanceTopupIntervalMs > 0
|
|
411
1847
|
? {
|
|
@@ -421,15 +1857,6 @@ export async function main() {
|
|
|
421
1857
|
}
|
|
422
1858
|
: undefined,
|
|
423
1859
|
});
|
|
424
|
-
// Graceful shutdown
|
|
425
|
-
const shutdown = async (signal) => {
|
|
426
|
-
console.log(`\n[main] Received ${signal}, shutting down...`);
|
|
427
|
-
await daemon.stop();
|
|
428
|
-
console.log('[main] Shutdown complete.');
|
|
429
|
-
process.exit(0);
|
|
430
|
-
};
|
|
431
|
-
process.on('SIGINT', () => shutdown('SIGINT'));
|
|
432
|
-
process.on('SIGTERM', () => shutdown('SIGTERM'));
|
|
433
1860
|
// Write pidfile so `jinn stop` can find us.
|
|
434
1861
|
const pidPath = join(config.earningDir, 'daemon.pid');
|
|
435
1862
|
const { writeFileSync, unlinkSync } = await import('node:fs');
|
|
@@ -443,6 +1870,47 @@ export async function main() {
|
|
|
443
1870
|
}
|
|
444
1871
|
};
|
|
445
1872
|
process.on('exit', removePidfile);
|
|
1873
|
+
// Graceful shutdown — Daemon doesn't own the API server or Store in this
|
|
1874
|
+
// flow (they were created in setup-mode before bootstrap), so we close
|
|
1875
|
+
// them explicitly after Daemon.stop() completes.
|
|
1876
|
+
let shutdownPromise = null;
|
|
1877
|
+
const shutdown = async (signal) => {
|
|
1878
|
+
if (shutdownPromise)
|
|
1879
|
+
return shutdownPromise;
|
|
1880
|
+
shutdownPromise = (async () => {
|
|
1881
|
+
let exitCode = 0;
|
|
1882
|
+
console.log(`\n[main] Received ${signal}, shutting down...`);
|
|
1883
|
+
try {
|
|
1884
|
+
await daemon.stop();
|
|
1885
|
+
await setupApiServer.close().catch(() => undefined);
|
|
1886
|
+
await closeCaptureReceiver();
|
|
1887
|
+
}
|
|
1888
|
+
catch (err) {
|
|
1889
|
+
exitCode = 1;
|
|
1890
|
+
console.error('[main] Shutdown failed:', err instanceof Error ? err.message : String(err));
|
|
1891
|
+
}
|
|
1892
|
+
finally {
|
|
1893
|
+
removePidfile();
|
|
1894
|
+
try {
|
|
1895
|
+
sharedStore.close();
|
|
1896
|
+
}
|
|
1897
|
+
catch {
|
|
1898
|
+
/* ignore */
|
|
1899
|
+
}
|
|
1900
|
+
}
|
|
1901
|
+
console.log('[main] Shutdown complete.');
|
|
1902
|
+
process.exit(exitCode);
|
|
1903
|
+
})();
|
|
1904
|
+
return shutdownPromise;
|
|
1905
|
+
};
|
|
1906
|
+
process.on('SIGINT', () => { void shutdown('SIGINT'); });
|
|
1907
|
+
process.on('SIGTERM', () => { void shutdown('SIGTERM'); });
|
|
1908
|
+
emitProgress({
|
|
1909
|
+
type: 'progress',
|
|
1910
|
+
phase: 'daemon',
|
|
1911
|
+
step: 'starting',
|
|
1912
|
+
estimatedWaitMs: 5000,
|
|
1913
|
+
});
|
|
446
1914
|
try {
|
|
447
1915
|
await daemon.start();
|
|
448
1916
|
}
|