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