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