@jinn-network/client 0.1.2 → 0.1.3-canary.2d6b2676
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 +68 -42
- 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/dist/adapters/adapter.d.ts +7 -7
- package/dist/adapters/claim-registry/client.d.ts +9 -0
- package/dist/adapters/claim-registry/client.js +22 -2
- package/dist/adapters/claim-registry/client.js.map +1 -1
- package/dist/adapters/local/adapter.d.ts +4 -4
- package/dist/adapters/local/adapter.js +10 -10
- package/dist/adapters/local/adapter.js.map +1 -1
- package/dist/adapters/mech/adapter.d.ts +8 -6
- package/dist/adapters/mech/adapter.js +159 -95
- package/dist/adapters/mech/adapter.js.map +1 -1
- package/dist/adapters/mech/contracts.d.ts +8 -6
- package/dist/adapters/mech/contracts.js +119 -15
- 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 +130 -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 +8 -0
- package/dist/adapters/mech/types.js.map +1 -1
- package/dist/agent/agent-ws.d.ts +55 -0
- package/dist/agent/agent-ws.js +288 -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 +130 -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/bootstrap-endpoint.d.ts +16 -0
- package/dist/api/bootstrap-endpoint.js +78 -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.js +6 -2
- 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/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/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/rewards-build.js +3 -8
- package/dist/api/rewards-build.js.map +1 -1
- package/dist/api/server.d.ts +55 -1
- package/dist/api/server.js +243 -17
- package/dist/api/server.js.map +1 -1
- package/dist/api/setup-endpoints.d.ts +34 -0
- package/dist/api/setup-endpoints.js +188 -0
- package/dist/api/setup-endpoints.js.map +1 -0
- package/dist/api/status-build.d.ts +10 -2
- package/dist/api/status-build.js +44 -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/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 -132
- package/dist/cli/commands/bootstrap.js.map +1 -1
- 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 +34 -1
- package/dist/cli/commands/doctor.js +138 -123
- 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 +379 -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 +183 -174
- package/dist/cli/commands/fund-requirements.js.map +1 -1
- package/dist/cli/commands/harnesses.d.ts +18 -0
- package/dist/cli/commands/harnesses.js +208 -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/{plugin-install.js → integrations.js} +240 -33
- 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 +165 -0
- package/dist/cli/commands/migrate-agent-id.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 +233 -91
- package/dist/cli/commands/run.js.map +1 -1
- package/dist/cli/commands/solver-nets.js +207 -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 +184 -0
- package/dist/cli/commands/solver-plugins.js.map +1 -0
- package/dist/cli/commands/status.d.ts +10 -0
- package/dist/cli/commands/status.js +97 -34
- package/dist/cli/commands/status.js.map +1 -1
- package/dist/cli/commands/tasks.js +365 -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 +5 -0
- package/dist/cli/commands/update.js +110 -105
- package/dist/cli/commands/update.js.map +1 -1
- package/dist/cli/commands/version.js +3 -1
- 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/execution-context.d.ts +1 -1
- package/dist/cli/execution-context.js +4 -3
- 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 +24 -6
- package/dist/cli/index.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/config.d.ts +1232 -53
- package/dist/config.js +558 -24
- 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/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 +16 -0
- package/dist/corpus/index.js +78 -0
- package/dist/corpus/index.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 +108 -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 +5 -5
- package/dist/daemon/creator.js +8 -11
- package/dist/daemon/creator.js.map +1 -1
- package/dist/daemon/daemon.d.ts +84 -29
- package/dist/daemon/daemon.js +181 -63
- package/dist/daemon/daemon.js.map +1 -1
- package/dist/daemon/delivery-watcher.js +34 -4
- package/dist/daemon/delivery-watcher.js.map +1 -1
- 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-Bxlk5qpa.js +68 -0
- package/dist/dashboard/assets/index-DQ3u_vP5.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 +64 -0
- package/dist/earning/bootstrap.js +325 -32
- package/dist/earning/bootstrap.js.map +1 -1
- package/dist/earning/contracts.d.ts +323 -0
- package/dist/earning/contracts.js +276 -0
- package/dist/earning/contracts.js.map +1 -1
- package/dist/earning/evidence-simhash.d.ts +1 -1
- package/dist/earning/funding-plan.d.ts +90 -0
- package/dist/earning/funding-plan.js +203 -0
- package/dist/earning/funding-plan.js.map +1 -0
- package/dist/earning/migrate-agent-id.d.ts +130 -0
- package/dist/earning/migrate-agent-id.js +257 -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/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 +39 -0
- package/dist/earning/store.js +72 -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 +53 -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 +381 -0
- package/dist/erc8004/abis.js +238 -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 +202 -0
- package/dist/erc8004/identity.js +305 -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/{restorer → harnesses}/engine/claim.d.ts +7 -7
- package/dist/{restorer → harnesses}/engine/claim.js +14 -7
- package/dist/harnesses/engine/claim.js.map +1 -0
- package/dist/{restorer → harnesses}/engine/delivery.d.ts +3 -1
- package/dist/{restorer → harnesses}/engine/delivery.js +8 -8
- package/dist/harnesses/engine/delivery.js.map +1 -0
- package/dist/harnesses/engine/engine.d.ts +341 -0
- package/dist/harnesses/engine/engine.js +1203 -0
- package/dist/harnesses/engine/engine.js.map +1 -0
- package/dist/harnesses/engine/envelope-assembly.d.ts +72 -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/{restorer → harnesses}/engine/packaging.js +83 -57
- package/dist/harnesses/engine/packaging.js.map +1 -0
- package/dist/harnesses/engine/persistence.d.ts +172 -0
- package/dist/{restorer → harnesses}/engine/persistence.js +78 -71
- package/dist/harnesses/engine/persistence.js.map +1 -0
- package/dist/harnesses/engine/recovery.d.ts +22 -0
- package/dist/{restorer → harnesses}/engine/recovery.js +5 -5
- package/dist/harnesses/engine/recovery.js.map +1 -0
- package/dist/harnesses/engine/registry.d.ts +53 -0
- package/dist/harnesses/engine/registry.js +62 -0
- package/dist/harnesses/engine/registry.js.map +1 -0
- package/dist/{restorer → harnesses}/engine/signing.d.ts +1 -1
- package/dist/{restorer → harnesses}/engine/signing.js +1 -1
- package/dist/harnesses/engine/signing.js.map +1 -0
- package/dist/{restorer → harnesses}/engine/state.d.ts +8 -8
- package/dist/{restorer → harnesses}/engine/state.js +23 -23
- 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/impls/claude-code-learner/adapters/claude-code.d.ts +38 -0
- package/dist/harnesses/impls/claude-code-learner/adapters/claude-code.js +159 -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 +44 -0
- package/dist/harnesses/impls/claude-code-learner/harness.js.map +1 -0
- package/dist/harnesses/impls/claude-code-learner/harvest.d.ts +19 -0
- package/dist/harnesses/impls/claude-code-learner/harvest.js +146 -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 +19 -0
- package/dist/harnesses/impls/claude-code-learner/test-utils/fake-plugin-outputs.js +111 -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 +102 -0
- package/dist/harnesses/impls/claude-code-learner/types.js.map +1 -0
- package/dist/{restorer → harnesses}/impls/claude-mcp-hyperliquid/api-wallet.d.ts +1 -1
- package/dist/harnesses/impls/claude-mcp-hyperliquid/api-wallet.js.map +1 -0
- package/dist/{restorer → harnesses}/impls/claude-mcp-hyperliquid/index.d.ts +16 -14
- package/dist/{restorer → harnesses}/impls/claude-mcp-hyperliquid/index.js +62 -61
- 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/{restorer → harnesses}/impls/claude-mcp-hyperliquid/session-orchestrator.d.ts +7 -0
- package/dist/{restorer → harnesses}/impls/claude-mcp-hyperliquid/session-orchestrator.js +38 -0
- package/dist/harnesses/impls/claude-mcp-hyperliquid/session-orchestrator.js.map +1 -0
- package/dist/{restorer → harnesses}/impls/claude-mcp-prediction/index.d.ts +11 -11
- package/dist/{restorer → harnesses}/impls/claude-mcp-prediction/index.js +26 -16
- package/dist/harnesses/impls/claude-mcp-prediction/index.js.map +1 -0
- package/dist/{restorer → harnesses}/impls/claude-mcp-prediction/mcp-tools.js +1 -1
- package/dist/harnesses/impls/claude-mcp-prediction/mcp-tools.js.map +1 -0
- package/dist/{restorer → harnesses}/impls/claude-mcp-prediction/prompt.d.ts +2 -2
- package/dist/{restorer → harnesses}/impls/claude-mcp-prediction/prompt.js +5 -5
- package/dist/harnesses/impls/claude-mcp-prediction/prompt.js.map +1 -0
- package/dist/{restorer → harnesses}/impls/claude-mcp-prediction/session-orchestrator.d.ts +9 -2
- 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/{restorer → harnesses}/impls/claude-mcp-prediction/types.d.ts +3 -3
- 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/{restorer → harnesses}/impls/claude-mcp-prediction-apy/index.js +22 -15
- package/dist/harnesses/impls/claude-mcp-prediction-apy/index.js.map +1 -0
- package/dist/{restorer → harnesses}/impls/claude-mcp-prediction-apy/mcp-tools.js +1 -1
- 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/{restorer → harnesses}/impls/claude-mcp-prediction-apy/prompt.js +5 -5
- package/dist/harnesses/impls/claude-mcp-prediction-apy/prompt.js.map +1 -0
- package/dist/{restorer → harnesses}/impls/claude-mcp-prediction-apy/session-orchestrator.d.ts +10 -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/{restorer → harnesses}/impls/claude-mcp-prediction-apy/types.d.ts +1 -1
- 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/{restorer/impls/claude-mcp-prediction/session-orchestrator.js → harnesses/impls/claude-mcp-shared/single-session-orchestrator.js} +85 -16
- 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/{restorer → harnesses}/impls/index.js +32 -7
- package/dist/harnesses/impls/index.js.map +1 -0
- package/dist/harnesses/impls/legacy-claude/index.d.ts +66 -0
- package/dist/{restorer → harnesses}/impls/legacy-claude/index.js +47 -19
- package/dist/harnesses/impls/legacy-claude/index.js.map +1 -0
- package/dist/{restorer → harnesses}/impls/portfolio-v0-evaluator/canonical-metrics.d.ts +2 -2
- package/dist/{restorer → harnesses}/impls/portfolio-v0-evaluator/canonical-metrics.js +2 -2
- 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/{restorer → harnesses}/impls/portfolio-v0-evaluator/checks/consistency.d.ts +1 -1
- package/dist/{restorer → harnesses}/impls/portfolio-v0-evaluator/checks/consistency.js +1 -1
- package/dist/harnesses/impls/portfolio-v0-evaluator/checks/consistency.js.map +1 -0
- package/dist/{restorer → harnesses}/impls/portfolio-v0-evaluator/checks/eligibility.d.ts +2 -2
- package/dist/{restorer → harnesses}/impls/portfolio-v0-evaluator/checks/eligibility.js +2 -2
- package/dist/harnesses/impls/portfolio-v0-evaluator/checks/eligibility.js.map +1 -0
- package/dist/{restorer → harnesses}/impls/portfolio-v0-evaluator/checks/integrity.d.ts +2 -2
- package/dist/{restorer → harnesses}/impls/portfolio-v0-evaluator/checks/integrity.js +2 -2
- package/dist/harnesses/impls/portfolio-v0-evaluator/checks/integrity.js.map +1 -0
- package/dist/{restorer → harnesses}/impls/portfolio-v0-evaluator/checks/spec.d.ts +2 -2
- package/dist/{restorer → harnesses}/impls/portfolio-v0-evaluator/checks/spec.js +2 -2
- 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/{restorer → harnesses}/impls/portfolio-v0-evaluator/index.js +217 -88
- 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/{restorer → harnesses}/impls/portfolio-v0-evaluator/types.d.ts +1 -1
- package/dist/harnesses/impls/portfolio-v0-evaluator/types.js.map +1 -0
- package/dist/{restorer → harnesses}/impls/prediction-apy-v0-baseline/index.d.ts +10 -8
- package/dist/{restorer → harnesses}/impls/prediction-apy-v0-baseline/index.js +15 -8
- 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/{restorer → harnesses}/impls/prediction-apy-v0-evaluator/index.d.ts +9 -9
- 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/{restorer → harnesses}/impls/prediction-v0-baseline/index.js +25 -16
- package/dist/harnesses/impls/prediction-v0-baseline/index.js.map +1 -0
- package/dist/{restorer → harnesses}/impls/prediction-v0-baseline/strategy.d.ts +2 -2
- package/dist/{restorer → harnesses}/impls/prediction-v0-baseline/strategy.js +2 -2
- 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/{restorer → harnesses}/impls/prediction-v0-evaluator/canonical-metrics.d.ts +2 -2
- package/dist/harnesses/impls/prediction-v0-evaluator/canonical-metrics.js.map +1 -0
- package/dist/harnesses/impls/prediction-v0-evaluator/checks/availability.js.map +1 -0
- package/dist/{restorer → harnesses}/impls/prediction-v0-evaluator/checks/eligibility.d.ts +1 -1
- 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/{restorer → harnesses}/impls/prediction-v0-evaluator/checks/integrity.js +12 -12
- package/dist/harnesses/impls/prediction-v0-evaluator/checks/integrity.js.map +1 -0
- package/dist/{restorer → harnesses}/impls/prediction-v0-evaluator/checks/spec.d.ts +2 -2
- package/dist/harnesses/impls/prediction-v0-evaluator/checks/spec.js.map +1 -0
- package/dist/{restorer → harnesses}/impls/prediction-v0-evaluator/index.d.ts +10 -10
- 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/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/types.d.ts +263 -0
- package/dist/{restorer → harnesses}/types.js +3 -3
- package/dist/harnesses/types.js.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/main.d.ts +5 -2
- package/dist/main.js +793 -96
- 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-artifacts.d.ts +31 -0
- package/dist/mcp/search-artifacts.js +40 -0
- package/dist/mcp/search-artifacts.js.map +1 -0
- package/dist/mcp/server.d.ts +4 -4
- package/dist/mcp/server.js +110 -64
- 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.js +4 -5
- 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 +87 -0
- package/dist/plugins/resolvers.js.map +1 -0
- package/dist/plugins/types.d.ts +39 -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 +44 -0
- package/dist/plugins/validator.js.map +1 -0
- package/dist/preflight/claude-auth.d.ts +11 -11
- package/dist/preflight/claude-auth.js +18 -32
- 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-mode.d.ts +34 -0
- package/dist/setup-mode.js +49 -0
- package/dist/setup-mode.js.map +1 -0
- package/dist/solver-nets/registry.d.ts +33 -0
- package/dist/solver-nets/registry.js +66 -0
- package/dist/solver-nets/registry.js.map +1 -0
- package/dist/solver-types/constants.js.map +1 -0
- package/dist/solver-types/index.d.ts +38 -0
- package/dist/solver-types/index.js +57 -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 +21 -0
- package/dist/solver-types/prediction-apy-v0-auto.js +80 -0
- package/dist/solver-types/prediction-apy-v0-auto.js.map +1 -0
- package/dist/{intents → solver-types}/prediction-apy-v0-template.d.ts +2 -2
- package/dist/{intents → solver-types}/prediction-apy-v0-template.js +2 -2
- 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/{intents → solver-types}/prediction-v0-auto.d.ts +17 -7
- package/dist/{intents → solver-types}/prediction-v0-auto.js +41 -8
- package/dist/solver-types/prediction-v0-auto.js.map +1 -0
- package/dist/{intents → solver-types}/prediction-v0-template.d.ts +9 -9
- package/dist/{intents → solver-types}/prediction-v0-template.js +10 -10
- package/dist/solver-types/prediction-v0-template.js.map +1 -0
- package/dist/solver-types/prediction-v0.d.ts +3 -0
- package/dist/{intents/kinds → solver-types}/prediction-v0.js +11 -6
- package/dist/solver-types/prediction-v0.js.map +1 -0
- package/dist/solver-types/solver-type.d.ts +55 -0
- package/dist/solver-types/solver-type.js +6 -0
- package/dist/solver-types/solver-type.js.map +1 -0
- package/dist/store/store.d.ts +97 -21
- package/dist/store/store.js +228 -45
- package/dist/store/store.js.map +1 -1
- package/dist/tasks/posting-service.d.ts +22 -0
- package/dist/tasks/posting-service.js +143 -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 +42 -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 +23 -9
- package/dist/tx-retry.js.map +1 -1
- package/dist/types/envelope.d.ts +1619 -0
- package/dist/types/envelope.js +121 -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 +11 -0
- package/dist/types/payloads/index.js +46 -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/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.d.ts +40 -416
- package/dist/types/prediction.js +9 -83
- package/dist/types/prediction.js.map +1 -1
- package/dist/types/task-document.d.ts +498 -0
- package/dist/types/task-document.js +69 -0
- package/dist/types/task-document.js.map +1 -0
- package/dist/types/task.d.ts +455 -0
- package/dist/types/task.js +58 -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/venues/hyperliquid/account-value.d.ts +1 -1
- package/dist/venues/hyperliquid/account-value.js +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 +38 -13
- package/plugins/claude-code-learner/.claude-plugin/plugin.json +9 -0
- package/plugins/claude-code-learner/AGENTS.md +30 -0
- package/plugins/claude-code-learner/CLAUDE.md +31 -0
- package/plugins/claude-code-learner/README.md +58 -0
- package/plugins/claude-code-learner/agents/analyst.md +69 -0
- package/plugins/claude-code-learner/agents/consolidator.md +95 -0
- package/plugins/claude-code-learner/agents/explorer.md +54 -0
- package/plugins/claude-code-learner/agents/planner.md +88 -0
- package/plugins/claude-code-learner/agents/promoter.md +114 -0
- package/plugins/claude-code-learner/agents/step-worker.md +48 -0
- package/plugins/claude-code-learner/agents/strategist.md +86 -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/coordinator/SKILL.md +111 -0
- package/plugins/claude-code-learner/skills/debrief/SKILL.md +63 -0
- package/plugins/claude-code-learner/skills/execute/SKILL.md +87 -0
- package/plugins/claude-code-learner/skills/improve/SKILL.md +53 -0
- package/plugins/claude-code-learner/skills/memory-consolidation/SKILL.md +49 -0
- package/plugins/claude-code-learner/skills/orient/SKILL.md +71 -0
- package/plugins/claude-code-learner/skills/plan/SKILL.md +50 -0
- package/plugins/claude-code-learner/skills/strategize/SKILL.md +53 -0
- package/plugins/jinn-prediction-plugin/.claude-plugin/plugin.json +89 -0
- package/plugins/jinn-prediction-plugin/mcp/polymarket-server.mjs +2 -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/skills/base-rate-forecasting/SKILL.md +3 -0
- package/plugins/jinn-prediction-plugin/skills/calibration/SKILL.md +3 -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/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.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.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.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.js.map +0 -1
- package/dist/intents/prediction-v0-auto.js.map +0 -1
- 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.js.map +0 -1
- 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.map +0 -1
- package/dist/restorer/engine/persistence.d.ts +0 -170
- package/dist/restorer/engine/persistence.js.map +0 -1
- package/dist/restorer/engine/recovery.d.ts +0 -22
- 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.js.map +0 -1
- package/dist/restorer/engine/state.js.map +0 -1
- package/dist/restorer/impls/claude-mcp-hyperliquid/api-wallet.js.map +0 -1
- 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.js.map +0 -1
- package/dist/restorer/impls/claude-mcp-prediction/index.js.map +0 -1
- package/dist/restorer/impls/claude-mcp-prediction/mcp-tools.js.map +0 -1
- package/dist/restorer/impls/claude-mcp-prediction/prompt.js.map +0 -1
- package/dist/restorer/impls/claude-mcp-prediction/session-orchestrator.js.map +0 -1
- 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.map +0 -1
- 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.map +0 -1
- 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.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.map +0 -1
- package/dist/restorer/impls/legacy-claude/index.d.ts +0 -52
- package/dist/restorer/impls/legacy-claude/index.js.map +0 -1
- 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.js.map +0 -1
- package/dist/restorer/impls/portfolio-v0-evaluator/checks/eligibility.js.map +0 -1
- package/dist/restorer/impls/portfolio-v0-evaluator/checks/integrity.js.map +0 -1
- 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.map +0 -1
- package/dist/restorer/impls/portfolio-v0-evaluator/score.js.map +0 -1
- package/dist/restorer/impls/portfolio-v0-evaluator/types.js.map +0 -1
- 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.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.map +0 -1
- 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.js.map +0 -1
- package/dist/restorer/impls/prediction-v0-evaluator/checks/availability.js.map +0 -1
- 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.map +0 -1
- package/dist/restorer/impls/prediction-v0-evaluator/checks/spec.js.map +0 -1
- 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.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.d.ts +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/{intents/kinds → solver-types}/constants.d.ts +0 -0
- /package/dist/{intents/kinds → solver-types}/constants.js +0 -0
package/dist/main.js
CHANGED
|
@@ -10,63 +10,147 @@
|
|
|
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
27
|
import { loadConfig, getConfigPathFromArgs } from './config.js';
|
|
22
|
-
import {
|
|
28
|
+
import { Store } from './store/store.js';
|
|
29
|
+
import { startApiServer } from './api/server.js';
|
|
30
|
+
import { ensureUiToken } from './api/ui-token.js';
|
|
31
|
+
import { attachAgentWs } from './agent/agent-ws.js';
|
|
32
|
+
import { createSetupModeController } from './setup-mode.js';
|
|
33
|
+
import { buildEnvelope, emitEnvelope } from './errors/envelope.js';
|
|
34
|
+
import { clearBootstrapError, persistBootstrapError, } from './errors/persisted-bootstrap-error.js';
|
|
35
|
+
import { emitStructured } from './events/emitter.js';
|
|
23
36
|
import { checkClaudeBinary } from './preflight/claude-binary.js';
|
|
24
37
|
import { emitClaudeBinaryPreflightFailure } from './preflight/claude-invocation-envelope.js';
|
|
25
38
|
import { detectAuthContext, probeClaudeAuth } from './preflight/claude-auth.js';
|
|
26
39
|
import { FleetBootstrapper } from './earning/bootstrap.js';
|
|
27
|
-
import { getChainConfig } from './earning/contracts.js';
|
|
40
|
+
import { DEFAULT_TESTNET_ARTIFACTS, applyChainGasOverrides, getChainConfig, loadJinnMviConfig } from './earning/contracts.js';
|
|
41
|
+
import { runLegacyAgentIdMigration } from './earning/migrate-agent-id.js';
|
|
28
42
|
import { FleetStateStore } from './earning/store.js';
|
|
43
|
+
import { isOperationalServiceStep, } from './earning/types.js';
|
|
29
44
|
import { decryptMnemonic, deriveMasterSigner, walletPrivateKeyAtIndex } from './earning/wallet.js';
|
|
30
45
|
import { MechAdapter } from './adapters/mech/adapter.js';
|
|
31
46
|
import { ClaudeRunner } from './runner/claude.js';
|
|
32
47
|
import { Daemon } from './daemon/daemon.js';
|
|
33
|
-
import { createJinnPublicClient, createJinnWalletClient } from './earning/viem-clients.js';
|
|
34
|
-
import {
|
|
35
|
-
import {
|
|
48
|
+
import { createJinnPublicClient, createJinnWalletClient, createJinnL1PublicClient, createJinnL1WalletClient } from './earning/viem-clients.js';
|
|
49
|
+
import { privateKeyToAccount } from 'viem/accounts';
|
|
50
|
+
import { HarnessRegistry } from './harnesses/engine/registry.js';
|
|
51
|
+
import { buildHarnesses } from './harnesses/impls/index.js';
|
|
52
|
+
import { loadExternalImpl } from './harnesses/external-impls/index.js';
|
|
36
53
|
import { ClaimRegistryClient } from './adapters/claim-registry/client.js';
|
|
37
54
|
import { createClients } from './adapters/mech/safe.js';
|
|
38
|
-
import {
|
|
55
|
+
import { collectTestnetAutoTaskGenerators } from './solver-types/index.js';
|
|
56
|
+
import { loadSolverNets } from './solver-nets/registry.js';
|
|
57
|
+
import { createCorpus } from './corpus/index.js';
|
|
39
58
|
import { BASE_FEEDS } from './venues/chainlink/feeds.js';
|
|
40
|
-
import {
|
|
59
|
+
import { GeneratedTaskSource, StaticConfiguredTaskSource } from './tasks/sources.js';
|
|
41
60
|
import { checkRpcNetwork, logRpcLocalDevToStderr, rpcNetworkFailureHint } from './preflight/rpc-network.js';
|
|
42
61
|
import { apiPortFailureMessage, checkApiPortAvailable } from './preflight/api-port.js';
|
|
62
|
+
import { openBrowser } from './cli/open-browser.js';
|
|
43
63
|
dotenvConfig({ path: join(dirname(fileURLToPath(import.meta.url)), '..', '.env') });
|
|
44
|
-
// ── Password (env
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
64
|
+
// ── Password (env > file > auto-generated) ─────────────────────────────────
|
|
65
|
+
//
|
|
66
|
+
// Resolution order:
|
|
67
|
+
// 1. JINN_PASSWORD env var (explicit operator-set, never in config files)
|
|
68
|
+
// 2. ~/.jinn-client/keystore-password (file from a previous auto-gen)
|
|
69
|
+
// 3. Auto-generate a 32-byte hex string, persist mode 0600, and reuse next run
|
|
70
|
+
//
|
|
71
|
+
// Auto-generation matches what `jinn quickstart` used to do so a brand-new
|
|
72
|
+
// operator can run `jinn run` with no env var, no setup, no input. The
|
|
73
|
+
// known security trade-off is documented in client/src/cli/password.ts:
|
|
74
|
+
// plaintext on disk + encrypted keystore on the same disk only defends
|
|
75
|
+
// against casual snooping. Treat the wallet as hot until rotated.
|
|
76
|
+
function resolveOrGenerateKeystorePassword() {
|
|
77
|
+
const envPw = process.env['JINN_PASSWORD'];
|
|
78
|
+
if (envPw && envPw.length > 0) {
|
|
79
|
+
return { password: envPw, source: 'env' };
|
|
80
|
+
}
|
|
81
|
+
const home = process.env['HOME'] ?? homedir();
|
|
82
|
+
const pwFilePath = join(home, '.jinn-client', 'keystore-password');
|
|
83
|
+
if (existsSync(pwFilePath)) {
|
|
84
|
+
const fromDisk = readFileSync(pwFilePath, 'utf-8').trim();
|
|
85
|
+
if (fromDisk.length > 0) {
|
|
86
|
+
return { password: fromDisk, source: 'file', filePath: pwFilePath };
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
const generated = cryptoRandomBytes(32).toString('hex');
|
|
90
|
+
mkdirSync(dirname(pwFilePath), { recursive: true, mode: 0o700 });
|
|
91
|
+
writeFileSyncMain(pwFilePath, generated + '\n', { mode: 0o600 });
|
|
92
|
+
return { password: generated, source: 'generated', filePath: pwFilePath };
|
|
93
|
+
}
|
|
94
|
+
const passwordResolution = resolveOrGenerateKeystorePassword();
|
|
95
|
+
const PASSWORD = passwordResolution.password;
|
|
96
|
+
// Sub-commands (e.g. the embedded `init` invocation below) read JINN_PASSWORD
|
|
97
|
+
// from env. Mirror our resolved value so they don't have to redo this dance.
|
|
98
|
+
process.env['JINN_PASSWORD'] = PASSWORD;
|
|
99
|
+
if (passwordResolution.source === 'generated') {
|
|
100
|
+
console.log('━'.repeat(64));
|
|
101
|
+
console.log('A keystore password was auto-generated for you.');
|
|
102
|
+
console.log(` Stored at: ${passwordResolution.filePath}`);
|
|
103
|
+
console.log(' Mode 0600. Treat the wallet as hot until you rotate the password.');
|
|
104
|
+
console.log(' To rotate: JINN_NEW_PASSWORD=<new> jinn keys change-password');
|
|
105
|
+
console.log('━'.repeat(64));
|
|
106
|
+
}
|
|
54
107
|
// ── Load config ─────────────────────────────────────────────────────────────
|
|
55
|
-
const
|
|
108
|
+
const CONFIG_PATH = getConfigPathFromArgs();
|
|
109
|
+
const config = loadConfig(CONFIG_PATH);
|
|
56
110
|
const NETWORK_CHAIN = config.network === 'testnet' ? 'base-sepolia' : 'base';
|
|
57
|
-
const CHAIN_CONFIG = getChainConfig(NETWORK_CHAIN, {
|
|
111
|
+
const CHAIN_CONFIG = applyChainGasOverrides(getChainConfig(NETWORK_CHAIN, {
|
|
58
112
|
testnetL2DeploymentPath: config.testnetL2DeploymentPath,
|
|
59
113
|
testnetL2TokenDeploymentPath: config.testnetL2TokenDeploymentPath,
|
|
60
114
|
testnetMechDeploymentPath: config.testnetMechDeploymentPath,
|
|
61
115
|
testnetStolasDeploymentPath: config.testnetStolasDeploymentPath,
|
|
62
116
|
testnetClaimRegistryDeploymentPath: config.testnetClaimRegistryDeploymentPath,
|
|
117
|
+
}), {
|
|
118
|
+
minEoaGasWei: config.minEoaGasWei,
|
|
119
|
+
minSafeEthWei: config.minSafeEthWei,
|
|
63
120
|
});
|
|
121
|
+
const MESSENGER_MODE_EXPLICIT = process.env['JINN_MESSENGER_MODE'] !== undefined ||
|
|
122
|
+
configFileHasTopLevelKey(CONFIG_PATH, 'jinnMessengerMode');
|
|
123
|
+
const JINN_MVI_CONFIG = loadJinnMviConfig({
|
|
124
|
+
l1ArtifactPath: config.jinnMviL1DeploymentPath ??
|
|
125
|
+
(config.network === 'testnet' ? DEFAULT_TESTNET_ARTIFACTS.jinnMviL1 : undefined),
|
|
126
|
+
l2ArtifactPath: config.jinnMviL2DeploymentPath ??
|
|
127
|
+
(config.network === 'testnet' ? DEFAULT_TESTNET_ARTIFACTS.jinnMviL2 : undefined),
|
|
128
|
+
distributorAddress: config.jinnDistributorAddress,
|
|
129
|
+
messengerAddress: config.jinnMessengerAddress,
|
|
130
|
+
claimEmitterAddress: config.jinnClaimEmitterAddress,
|
|
131
|
+
messengerMode: MESSENGER_MODE_EXPLICIT ? config.jinnMessengerMode : undefined,
|
|
132
|
+
});
|
|
133
|
+
const JINN_CLAIM_MESSENGER_MODE = JINN_MVI_CONFIG.messengerMode ?? config.jinnMessengerMode;
|
|
64
134
|
const MARKETPLACE_ADDRESS = CHAIN_CONFIG.mechMarketplace;
|
|
65
135
|
const ROUTER_ADDRESS = (CHAIN_CONFIG.jinnRouter ?? '0xfFa7118A3D820cd4E820010837D65FAfF463181B');
|
|
136
|
+
function configFileHasTopLevelKey(configPath, key) {
|
|
137
|
+
const filePath = configPath ?? join(process.env['HOME'] ?? '', '.jinn-client', 'config.json');
|
|
138
|
+
if (!filePath || !existsSync(filePath))
|
|
139
|
+
return false;
|
|
140
|
+
try {
|
|
141
|
+
const raw = JSON.parse(readFileSync(filePath, 'utf8'));
|
|
142
|
+
return !!raw && typeof raw === 'object' && Object.prototype.hasOwnProperty.call(raw, key);
|
|
143
|
+
}
|
|
144
|
+
catch {
|
|
145
|
+
return false;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
66
148
|
const STANDARD_SERVICE_PROGRESSION = [
|
|
67
149
|
'awaiting_stake',
|
|
68
150
|
'staked',
|
|
69
151
|
'mech_deployed',
|
|
152
|
+
'agent_registered',
|
|
153
|
+
'safe_binding_pending',
|
|
70
154
|
'complete',
|
|
71
155
|
];
|
|
72
156
|
const SELF_BOND_SERVICE_PROGRESSION = [
|
|
@@ -77,6 +161,8 @@ const SELF_BOND_SERVICE_PROGRESSION = [
|
|
|
77
161
|
'service_deployed',
|
|
78
162
|
'service_staked',
|
|
79
163
|
'mech_deployed',
|
|
164
|
+
'agent_registered',
|
|
165
|
+
'safe_binding_pending',
|
|
80
166
|
'complete',
|
|
81
167
|
];
|
|
82
168
|
/** §6.2 `bootstrap_incomplete` — `{ currentStep, nextStep }` from persisted fleet state. */
|
|
@@ -85,13 +171,14 @@ function bootstrapIncompleteSteps(state) {
|
|
|
85
171
|
? SELF_BOND_SERVICE_PROGRESSION
|
|
86
172
|
: STANDARD_SERVICE_PROGRESSION;
|
|
87
173
|
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
|
|
174
|
+
const focus = byIndex.find(s => isOperationalServiceStep(s.step) && !s.safe_address) ??
|
|
175
|
+
byIndex.find(s => !isOperationalServiceStep(s.step)) ??
|
|
176
|
+
byIndex.find(s => s.step === 'safe_binding_pending') ??
|
|
90
177
|
byIndex[0];
|
|
91
178
|
if (!focus) {
|
|
92
179
|
return { currentStep: 'awaiting_service', nextStep: 'awaiting_stake' };
|
|
93
180
|
}
|
|
94
|
-
if (focus.step
|
|
181
|
+
if (isOperationalServiceStep(focus.step) && !focus.safe_address) {
|
|
95
182
|
return { currentStep: 'complete', nextStep: 'bootstrap' };
|
|
96
183
|
}
|
|
97
184
|
const i = progression.indexOf(focus.step);
|
|
@@ -106,6 +193,21 @@ function bootstrapIncompleteSteps(state) {
|
|
|
106
193
|
// ── Bootstrap ───────────────────────────────────────────────────────────────
|
|
107
194
|
async function bootstrap() {
|
|
108
195
|
console.log('[main] Running fleet bootstrap...');
|
|
196
|
+
// A fresh bootstrap attempt clears any stale error breadcrumb. If this run
|
|
197
|
+
// hits the same failure, it'll be re-persisted below; if it succeeds (or
|
|
198
|
+
// proceeds past the previously-failed step), the panel returns to a clean
|
|
199
|
+
// state on the next /v1/bootstrap poll.
|
|
200
|
+
clearBootstrapError(config.earningDir);
|
|
201
|
+
// Persist the envelope to disk before emitEnvelope's process.exit fires,
|
|
202
|
+
// so /v1/bootstrap can surface it to the panel after the daemon has
|
|
203
|
+
// exited (operator restart → panel reload → error visible).
|
|
204
|
+
function failBootstrap(input) {
|
|
205
|
+
const envelope = buildEnvelope(input);
|
|
206
|
+
persistBootstrapError(envelope, config.earningDir);
|
|
207
|
+
emitEnvelope(input);
|
|
208
|
+
// Unreachable in production (emitEnvelope exits); satisfies `never`.
|
|
209
|
+
throw new Error('unreachable');
|
|
210
|
+
}
|
|
109
211
|
const bootstrapper = new FleetBootstrapper({
|
|
110
212
|
earningDir: config.earningDir,
|
|
111
213
|
chain: NETWORK_CHAIN,
|
|
@@ -119,37 +221,160 @@ async function bootstrap() {
|
|
|
119
221
|
testnetClaimRegistryDeploymentPath: config.testnetClaimRegistryDeploymentPath,
|
|
120
222
|
debug: config.debug,
|
|
121
223
|
masterEthDailyEstimateWei: config.masterEthDailyEstimateWei,
|
|
224
|
+
minEoaGasWei: config.minEoaGasWei,
|
|
225
|
+
minSafeEthWei: config.minSafeEthWei,
|
|
122
226
|
pollIntervalMs: config.pollIntervalMs,
|
|
227
|
+
autoTestnetFaucet: process.env['JINN_AUTO_TESTNET_FAUCET'] === '1',
|
|
123
228
|
});
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
229
|
+
// Funding poll: stay up while waiting for the operator to fund the wallet.
|
|
230
|
+
// The setup-mode API server is already running; the panel renders the
|
|
231
|
+
// funding card and auto-advances when funds land. Daemon-side, we poll
|
|
232
|
+
// bootstrap on a 15s tick and only escalate (exit) if a non-funding error
|
|
233
|
+
// occurs or the configured timeout elapses. Each tick re-runs the full
|
|
234
|
+
// bootstrap state machine — completed steps are no-ops, so this is safe.
|
|
235
|
+
// Testnet faucet funding is panel-driven: bootstrap reports the funding gate,
|
|
236
|
+
// and the operator clicks the funding action before this loop can advance.
|
|
237
|
+
const FUNDING_POLL_INTERVAL_MS = 15_000;
|
|
238
|
+
const fundingTimeoutMs = (() => {
|
|
239
|
+
const raw = process.env['JINN_FUNDING_TIMEOUT_MS'];
|
|
240
|
+
if (!raw)
|
|
241
|
+
return Number.POSITIVE_INFINITY;
|
|
242
|
+
const n = Number.parseInt(raw, 10);
|
|
243
|
+
return Number.isFinite(n) && n > 0 ? n : Number.POSITIVE_INFINITY;
|
|
244
|
+
})();
|
|
245
|
+
emitProgress({
|
|
246
|
+
type: 'progress',
|
|
247
|
+
phase: 'bootstrap',
|
|
248
|
+
step: 'advance_state_machine',
|
|
249
|
+
estimatedWaitMs: 60_000,
|
|
250
|
+
});
|
|
251
|
+
const fundingStartedAt = Date.now();
|
|
252
|
+
let result;
|
|
253
|
+
let lastFundingMessage = '';
|
|
254
|
+
const fundingGatePath = join(config.earningDir, 'bootstrap-funding.json');
|
|
255
|
+
const persistFundingGate = (funding) => {
|
|
256
|
+
mkdirSync(config.earningDir, { recursive: true, mode: 0o700 });
|
|
257
|
+
writeFileSyncMain(fundingGatePath, `${JSON.stringify({
|
|
258
|
+
schemaVersion: 1,
|
|
259
|
+
generatedAt: new Date().toISOString(),
|
|
260
|
+
...funding,
|
|
261
|
+
}, null, 2)}\n`, { mode: 0o600 });
|
|
262
|
+
};
|
|
263
|
+
const clearFundingGate = () => {
|
|
264
|
+
try {
|
|
265
|
+
unlinkSync(fundingGatePath);
|
|
266
|
+
}
|
|
267
|
+
catch {
|
|
268
|
+
// best-effort: absent/stale funding gate should not affect bootstrap
|
|
269
|
+
}
|
|
270
|
+
};
|
|
271
|
+
// eslint-disable-next-line no-constant-condition
|
|
272
|
+
while (true) {
|
|
273
|
+
result = await bootstrapper.bootstrap(PASSWORD);
|
|
274
|
+
if (!result.funding) {
|
|
275
|
+
clearFundingGate();
|
|
276
|
+
break;
|
|
277
|
+
}
|
|
278
|
+
persistFundingGate(result.funding);
|
|
279
|
+
// Emit a structured event so the panel's Visibility region shows the gate.
|
|
280
|
+
// Dedupe by message to avoid spamming the ring buffer on each poll.
|
|
281
|
+
const fundingMsg = result.message ?? 'awaiting funding';
|
|
282
|
+
if (fundingMsg !== lastFundingMessage) {
|
|
283
|
+
emitStructured({
|
|
284
|
+
kind: 'fleet',
|
|
285
|
+
message: fundingMsg,
|
|
286
|
+
details: {
|
|
287
|
+
phase: 'awaiting_funding',
|
|
288
|
+
role: 'master',
|
|
289
|
+
address: result.funding.master_address,
|
|
290
|
+
asset: 'native',
|
|
291
|
+
needWei: result.funding.eth_required,
|
|
292
|
+
haveWei: result.funding.eth_balance,
|
|
293
|
+
},
|
|
294
|
+
});
|
|
295
|
+
// Mirror the structured event to NDJSON progress for --json-progress
|
|
296
|
+
// consumers (CI, agents). Same dedup gate so we don't spam stdout.
|
|
297
|
+
emitProgress({
|
|
298
|
+
type: 'progress',
|
|
299
|
+
phase: 'bootstrap',
|
|
300
|
+
step: 'awaiting_funding',
|
|
301
|
+
blocking: true,
|
|
302
|
+
nextAction: 'Fund the address shown in addresses.fundingAddress, then wait for automatic retry.',
|
|
303
|
+
addresses: { fundingAddress: result.funding.master_address },
|
|
304
|
+
estimatedWaitMs: 1_800_000,
|
|
305
|
+
});
|
|
306
|
+
lastFundingMessage = fundingMsg;
|
|
307
|
+
}
|
|
308
|
+
const elapsed = Date.now() - fundingStartedAt;
|
|
309
|
+
if (elapsed >= fundingTimeoutMs) {
|
|
310
|
+
failBootstrap({
|
|
311
|
+
code: 'funding_required',
|
|
312
|
+
message: `${result.message} (timeout after ${Math.round(elapsed / 1000)}s)`,
|
|
313
|
+
hint: 'Fund the listed address and re-run this command.',
|
|
314
|
+
exampleCli: 'jinn fund-requirements --json',
|
|
315
|
+
details: {
|
|
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
|
+
}
|
|
324
|
+
console.log(`[main] Awaiting funding... (${Math.round(elapsed / 1000)}s elapsed; ` +
|
|
325
|
+
`will retry in ${FUNDING_POLL_INTERVAL_MS / 1000}s)`);
|
|
326
|
+
await new Promise((r) => setTimeout(r, FUNDING_POLL_INTERVAL_MS));
|
|
139
327
|
}
|
|
140
328
|
if (!result.ok) {
|
|
141
|
-
|
|
329
|
+
failBootstrap({
|
|
142
330
|
code: 'fatal',
|
|
143
331
|
message: result.message,
|
|
144
332
|
hint: 'Bootstrap failed before the fleet reached a runnable state.',
|
|
145
333
|
details: { cause: result.message },
|
|
146
334
|
});
|
|
147
335
|
}
|
|
148
|
-
//
|
|
149
|
-
|
|
150
|
-
|
|
336
|
+
// Legacy migration (jinn-mono-jgp): backfill `agent_id` on `complete`
|
|
337
|
+
// services that pre-date j07. Idempotent + per-service failure-isolated;
|
|
338
|
+
// a failure here does not abort daemon startup, but we surface counts so
|
|
339
|
+
// operators notice. Disabled via `runLegacyMigrations: false` /
|
|
340
|
+
// JINN_RUN_LEGACY_MIGRATIONS=0 — operators can run `jinn migrate-agent-id`
|
|
341
|
+
// explicitly instead.
|
|
342
|
+
let state = result.fleet_state;
|
|
343
|
+
if (config.runLegacyMigrations) {
|
|
344
|
+
try {
|
|
345
|
+
const migration = await runLegacyAgentIdMigration({
|
|
346
|
+
earningDir: config.earningDir,
|
|
347
|
+
network: NETWORK_CHAIN,
|
|
348
|
+
rpcUrl: config.rpcUrl,
|
|
349
|
+
password: PASSWORD,
|
|
350
|
+
testnetL2DeploymentPath: config.testnetL2DeploymentPath,
|
|
351
|
+
testnetL2TokenDeploymentPath: config.testnetL2TokenDeploymentPath,
|
|
352
|
+
testnetMechDeploymentPath: config.testnetMechDeploymentPath,
|
|
353
|
+
testnetStolasDeploymentPath: config.testnetStolasDeploymentPath,
|
|
354
|
+
testnetClaimRegistryDeploymentPath: config.testnetClaimRegistryDeploymentPath,
|
|
355
|
+
});
|
|
356
|
+
if (migration.migrated.length > 0 || migration.failed.length > 0) {
|
|
357
|
+
console.log(`[main] Legacy agent_id migration: migrated=${migration.migrated.length} ` +
|
|
358
|
+
`skipped=${migration.skipped.length} failed=${migration.failed.length}`);
|
|
359
|
+
for (const f of migration.failed) {
|
|
360
|
+
console.log(`[main] service ${f.service.index} (agent ${f.service.agent_address}): ${f.error}`);
|
|
361
|
+
}
|
|
362
|
+
// Reload state so downstream wiring (agent_id, identityRegistry)
|
|
363
|
+
// sees the migrated rows.
|
|
364
|
+
state = await new FleetStateStore(config.earningDir).load(NETWORK_CHAIN);
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
catch (err) {
|
|
368
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
369
|
+
console.error(`[main] Legacy agent_id migration failed (non-fatal): ${message}`);
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
// Use the first operational service for the daemon. `safe_binding_pending`
|
|
373
|
+
// means staking/mech are live; only the ERC-8004 Safe→agent metadata bind
|
|
374
|
+
// is still retrying.
|
|
375
|
+
const firstComplete = state.services.find(s => isOperationalServiceStep(s.step));
|
|
151
376
|
if (!firstComplete || !firstComplete.safe_address) {
|
|
152
|
-
|
|
377
|
+
failBootstrap({
|
|
153
378
|
code: 'bootstrap_incomplete',
|
|
154
379
|
message: 'Bootstrap completed but no service is ready.',
|
|
155
380
|
hint: 'Re-run to continue the state machine toward a running fleet.',
|
|
@@ -163,7 +388,7 @@ async function bootstrap() {
|
|
|
163
388
|
const agentPrivateKey = walletPrivateKeyAtIndex(mnemonic, firstComplete.index);
|
|
164
389
|
console.log(`[main] Fleet bootstrap complete.`);
|
|
165
390
|
console.log(` Master: ${state.master_address}`);
|
|
166
|
-
console.log(` Services: ${state.services.filter(s => s.step
|
|
391
|
+
console.log(` Services: ${state.services.filter(s => isOperationalServiceStep(s.step)).length}/${config.targetServices}`);
|
|
167
392
|
console.log(` Active: service ${firstComplete.service_id} (agent ${firstComplete.agent_address})`);
|
|
168
393
|
if (firstComplete.mech_address) {
|
|
169
394
|
console.log(` Mech: ${firstComplete.mech_address}`);
|
|
@@ -172,14 +397,54 @@ async function bootstrap() {
|
|
|
172
397
|
masterAddress: state.master_address,
|
|
173
398
|
serviceIndex: firstComplete.index,
|
|
174
399
|
serviceId: firstComplete.service_id ?? null,
|
|
400
|
+
stakingAddress: firstComplete.staking_address ? firstComplete.staking_address : null,
|
|
175
401
|
agentPrivateKey: agentPrivateKey,
|
|
176
402
|
safeAddress: firstComplete.safe_address,
|
|
177
403
|
mechAddress: firstComplete.mech_address ? firstComplete.mech_address : undefined,
|
|
404
|
+
agentId: firstComplete.agent_id ?? null,
|
|
405
|
+
identityRegistryAddress: firstComplete.identity_registry_address
|
|
406
|
+
? firstComplete.identity_registry_address
|
|
407
|
+
: null,
|
|
178
408
|
};
|
|
179
409
|
}
|
|
180
410
|
// ── Main ────────────────────────────────────────────────────────────────────
|
|
411
|
+
/**
|
|
412
|
+
* --json-progress: emit NDJSON progress envelopes on stdout during long
|
|
413
|
+
* phases (init, bootstrap, daemon startup). The `jinn run --json-progress`
|
|
414
|
+
* flag flips JINN_JSON_PROGRESS=1 in run.ts before calling main(); when
|
|
415
|
+
* unset this is a no-op so tests / non-flag invocations stay silent on
|
|
416
|
+
* stdout.
|
|
417
|
+
*/
|
|
418
|
+
function progressEnabled() {
|
|
419
|
+
return process.env['JINN_JSON_PROGRESS'] === '1';
|
|
420
|
+
}
|
|
421
|
+
function emitProgress(envelope) {
|
|
422
|
+
if (progressEnabled()) {
|
|
423
|
+
process.stdout.write(JSON.stringify(envelope) + '\n');
|
|
424
|
+
}
|
|
425
|
+
}
|
|
181
426
|
export async function main() {
|
|
182
427
|
console.log(`[main] jinn-client starting on ${NETWORK_CHAIN}`);
|
|
428
|
+
// ── Daemon API bearer token (jinn-mono-pr64 hardening) ───────────────────
|
|
429
|
+
//
|
|
430
|
+
// Cost-mutating API routes (`POST /v1/artifacts/acquire`, `POST /artifacts`)
|
|
431
|
+
// require an `Authorization: Bearer <token>` header. Read from env when
|
|
432
|
+
// operators want a stable token (e.g. multi-process tools); otherwise
|
|
433
|
+
// generate a fresh one per daemon process. Logged only as an 8-char prefix.
|
|
434
|
+
// The token is forwarded to the MCP subprocess via `DAEMON_API_TOKEN` env
|
|
435
|
+
// so `acquire_artifact` and `submit_restoration_result` can authenticate
|
|
436
|
+
// their calls back to the daemon.
|
|
437
|
+
const envToken = process.env['DAEMON_API_TOKEN']?.trim();
|
|
438
|
+
const apiToken = envToken && envToken.length > 0
|
|
439
|
+
? envToken
|
|
440
|
+
: cryptoRandomBytes(32).toString('hex');
|
|
441
|
+
if (!envToken) {
|
|
442
|
+
console.log(`[main] Generated DAEMON_API_TOKEN (prefix=${apiToken.slice(0, 8)}...)`);
|
|
443
|
+
}
|
|
444
|
+
// The keystore-presence probe happens twice: once now (to decide initial
|
|
445
|
+
// setup-mode) and once after we run init below (to flip the controller).
|
|
446
|
+
const masterKeystorePath = join(config.earningDir, 'master_keystore.json');
|
|
447
|
+
const legacyKeystorePath = join(config.earningDir, 'agent_keystore.json');
|
|
183
448
|
const rpcPreflight = await checkRpcNetwork(config);
|
|
184
449
|
if (!rpcPreflight.ok) {
|
|
185
450
|
emitEnvelope({
|
|
@@ -214,7 +479,197 @@ export async function main() {
|
|
|
214
479
|
},
|
|
215
480
|
});
|
|
216
481
|
}
|
|
217
|
-
|
|
482
|
+
// ── Setup-mode API server ────────────────────────────────────────────────
|
|
483
|
+
// Start the operator-facing API early so the SPA can show bootstrap
|
|
484
|
+
// progress while we may still be waiting on funding. The daemon loops are
|
|
485
|
+
// gated until bootstrap completes — we just bring up the API + handshake +
|
|
486
|
+
// /v1/bootstrap + /v1/events + /v1/status here. The same Store instance is
|
|
487
|
+
// later passed into Daemon so we don't double-open the SQLite file.
|
|
488
|
+
const sharedStore = new Store(config.dbPath);
|
|
489
|
+
const earningStateStore = new FleetStateStore(config.earningDir);
|
|
490
|
+
const initialFleet = await earningStateStore.tryLoadExisting();
|
|
491
|
+
const initialServices = initialFleet?.services ?? [];
|
|
492
|
+
const initialAllComplete = initialServices.length > 0 && initialServices.every((s) => isOperationalServiceStep(s.step));
|
|
493
|
+
const setupController = createSetupModeController({
|
|
494
|
+
keystoreExists: existsSync(masterKeystorePath),
|
|
495
|
+
allComplete: initialAllComplete,
|
|
496
|
+
});
|
|
497
|
+
const uiToken = ensureUiToken();
|
|
498
|
+
const handshakeKey = cryptoRandomBytes(16).toString('hex');
|
|
499
|
+
const apiBindHost = process.env['JINN_API_BIND_HOST'] ?? '127.0.0.1';
|
|
500
|
+
let corpusForApi;
|
|
501
|
+
let setupApiServer;
|
|
502
|
+
try {
|
|
503
|
+
setupApiServer = await startApiServer({
|
|
504
|
+
port: config.apiPort,
|
|
505
|
+
store: sharedStore,
|
|
506
|
+
apiToken,
|
|
507
|
+
bindHost: apiBindHost,
|
|
508
|
+
corpus: config.subgraphUrl?.trim() ? () => corpusForApi : undefined,
|
|
509
|
+
ui: { token: uiToken, handshakeKey },
|
|
510
|
+
admin: {
|
|
511
|
+
onRestartRequested: () => {
|
|
512
|
+
console.log('[main] Restart requested via operator MCP. Exiting...');
|
|
513
|
+
process.exit(0);
|
|
514
|
+
},
|
|
515
|
+
},
|
|
516
|
+
bootstrap: { earningDir: config.earningDir },
|
|
517
|
+
setup: {
|
|
518
|
+
earningDir: config.earningDir,
|
|
519
|
+
chain: NETWORK_CHAIN,
|
|
520
|
+
rpcUrl: config.rpcUrl,
|
|
521
|
+
minEoaGasWei: (CHAIN_CONFIG.minEoaGasEth * 2n).toString(),
|
|
522
|
+
},
|
|
523
|
+
status: {
|
|
524
|
+
earningDir: config.earningDir,
|
|
525
|
+
rpcUrl: config.rpcUrl,
|
|
526
|
+
network: config.network,
|
|
527
|
+
pollIntervalMs: config.pollIntervalMs,
|
|
528
|
+
masterEthDailyEstimateWei: config.masterEthDailyEstimateWei,
|
|
529
|
+
rewardClaimIntervalMs: config.rewardClaimIntervalMs,
|
|
530
|
+
testnetL2DeploymentPath: config.testnetL2DeploymentPath,
|
|
531
|
+
testnetL2TokenDeploymentPath: config.testnetL2TokenDeploymentPath,
|
|
532
|
+
testnetMechDeploymentPath: config.testnetMechDeploymentPath,
|
|
533
|
+
testnetStolasDeploymentPath: config.testnetStolasDeploymentPath,
|
|
534
|
+
testnetClaimRegistryDeploymentPath: config.testnetClaimRegistryDeploymentPath,
|
|
535
|
+
engine: config.engine,
|
|
536
|
+
},
|
|
537
|
+
});
|
|
538
|
+
}
|
|
539
|
+
catch (error) {
|
|
540
|
+
sharedStore.close();
|
|
541
|
+
const err = error;
|
|
542
|
+
if (err?.code === 'EADDRINUSE') {
|
|
543
|
+
emitEnvelope({
|
|
544
|
+
code: 'invalid_invocation',
|
|
545
|
+
message: `Port ${config.apiPort} is already in use. Stop the other daemon or set JINN_API_PORT / apiPort to another port.`,
|
|
546
|
+
hint: 'Set JINN_API_PORT to a free port, or stop the process currently listening on the dashboard/API port.',
|
|
547
|
+
exampleCli: 'JINN_API_PORT=7332 jinn run',
|
|
548
|
+
details: {
|
|
549
|
+
field: 'apiPort',
|
|
550
|
+
port: config.apiPort,
|
|
551
|
+
reason: 'EADDRINUSE',
|
|
552
|
+
},
|
|
553
|
+
});
|
|
554
|
+
}
|
|
555
|
+
throw error;
|
|
556
|
+
}
|
|
557
|
+
process.env['JINN_UI_HANDSHAKE_URL'] =
|
|
558
|
+
`http://127.0.0.1:${setupApiServer.port}/?k=${handshakeKey}`;
|
|
559
|
+
// Auto-open the operator panel as soon as the setup-mode API is up so the
|
|
560
|
+
// operator can watch bootstrap progress (including the funding wait, which
|
|
561
|
+
// is the whole point of starting the API early). Suppressed by setting
|
|
562
|
+
// JINN_NO_UI=1 — `jinn run --no-ui` translates the flag into this env var.
|
|
563
|
+
if (process.env['JINN_NO_UI'] !== '1') {
|
|
564
|
+
openBrowser(process.env['JINN_UI_HANDSHAKE_URL']);
|
|
565
|
+
}
|
|
566
|
+
console.log(`[main] Setup-mode API up (mode=${setupController.mode()}). ` +
|
|
567
|
+
`Dashboard: http://127.0.0.1:${setupApiServer.port}`);
|
|
568
|
+
// ── Operator agent WebSocket bridge ──────────────────────────────────────
|
|
569
|
+
// Mount /api/agent/ws on the same HTTP server so the SPA's xterm.js panel
|
|
570
|
+
// can attach to a long-lived embedded `claude` subprocess. The embedded
|
|
571
|
+
// session reads MCP config we materialise to disk so it can reach the
|
|
572
|
+
// operator MCP server (`jinn mcp`) for tool calls.
|
|
573
|
+
const operatorMcpConfigPath = join(homedir(), '.jinn-client', 'operator-mcp-config.json');
|
|
574
|
+
try {
|
|
575
|
+
mkdirSync(dirname(operatorMcpConfigPath), { recursive: true });
|
|
576
|
+
writeFileSyncMain(operatorMcpConfigPath, JSON.stringify({
|
|
577
|
+
mcpServers: {
|
|
578
|
+
'jinn-operator': {
|
|
579
|
+
command: 'jinn',
|
|
580
|
+
args: ['mcp'],
|
|
581
|
+
},
|
|
582
|
+
},
|
|
583
|
+
}, null, 2));
|
|
584
|
+
}
|
|
585
|
+
catch (err) {
|
|
586
|
+
console.warn(`[main] Failed to write operator MCP config at ${operatorMcpConfigPath}: ` +
|
|
587
|
+
(err instanceof Error ? err.message : String(err)));
|
|
588
|
+
}
|
|
589
|
+
attachAgentWs({
|
|
590
|
+
httpServer: setupApiServer.server,
|
|
591
|
+
uiToken,
|
|
592
|
+
claudePath: config.claudePath ?? 'claude',
|
|
593
|
+
cwd: process.cwd(),
|
|
594
|
+
mcpConfigPath: operatorMcpConfigPath,
|
|
595
|
+
});
|
|
596
|
+
console.log(`[main] Agent WS bridge mounted at ws://127.0.0.1:${setupApiServer.port}/api/agent/ws`);
|
|
597
|
+
// ── Init-if-missing ──────────────────────────────────────────────────────
|
|
598
|
+
// If the keystore is missing but we have a password, run `jinn init` now so
|
|
599
|
+
// bootstrap has something to decrypt. Idempotent: init is a no-op when the
|
|
600
|
+
// keystore already exists. This makes `jinn run` work first-time on a fresh
|
|
601
|
+
// host. We run AFTER startApiServer so the operator's panel can already
|
|
602
|
+
// render the loading screen / setup steps while init does its work — the
|
|
603
|
+
// /v1/bootstrap endpoint reports `mode:'uninitialized'` until init writes
|
|
604
|
+
// earning_state.json, then the panel transitions on the next 3s poll.
|
|
605
|
+
if (!existsSync(masterKeystorePath) && !existsSync(legacyKeystorePath)) {
|
|
606
|
+
emitProgress({
|
|
607
|
+
type: 'progress',
|
|
608
|
+
phase: 'init',
|
|
609
|
+
step: 'creating_wallet',
|
|
610
|
+
estimatedWaitMs: 2000,
|
|
611
|
+
});
|
|
612
|
+
emitStructured({ kind: 'system', message: 'creating wallet keystore' });
|
|
613
|
+
console.log('[main] No keystore found — initializing wallet from password.');
|
|
614
|
+
const initCmd = (await import('./cli/commands/init.js')).default;
|
|
615
|
+
let initExitCode = 0;
|
|
616
|
+
await initCmd.run({
|
|
617
|
+
argv: ['--json'],
|
|
618
|
+
stdoutIsTty: false,
|
|
619
|
+
writer: { write: (_s) => true }, // discard init's structured output
|
|
620
|
+
exit: (code) => {
|
|
621
|
+
initExitCode = code;
|
|
622
|
+
},
|
|
623
|
+
env: { ...process.env, JINN_PASSWORD: PASSWORD },
|
|
624
|
+
});
|
|
625
|
+
if (initExitCode !== 0) {
|
|
626
|
+
console.error('[main] init failed; cannot continue.');
|
|
627
|
+
await setupApiServer.close().catch(() => undefined);
|
|
628
|
+
sharedStore.close();
|
|
629
|
+
process.exit(initExitCode);
|
|
630
|
+
}
|
|
631
|
+
emitStructured({ kind: 'system', message: 'wallet keystore ready' });
|
|
632
|
+
// Refresh the controller so the panel's loading screen knows the
|
|
633
|
+
// keystore is on disk and we're transitioning into bootstrap.
|
|
634
|
+
setupController.refresh({ keystoreExists: true, allComplete: false });
|
|
635
|
+
}
|
|
636
|
+
let bootstrapResult;
|
|
637
|
+
try {
|
|
638
|
+
bootstrapResult = await bootstrap();
|
|
639
|
+
}
|
|
640
|
+
catch (err) {
|
|
641
|
+
// If bootstrap throws (vs. emitEnvelope-exits), tear down the API we
|
|
642
|
+
// just started so we don't leave a dangling listener on the port.
|
|
643
|
+
await setupApiServer.close().catch(() => undefined);
|
|
644
|
+
sharedStore.close();
|
|
645
|
+
throw err;
|
|
646
|
+
}
|
|
647
|
+
// Bootstrap completed — flip the controller into 'running' so any waiters
|
|
648
|
+
// (future loops gated on this) unblock.
|
|
649
|
+
setupController.refresh({ keystoreExists: true, allComplete: true });
|
|
650
|
+
// ── --no-daemon: exit cleanly after bootstrap completes ──────────────────
|
|
651
|
+
// `jinn run --no-daemon` flips JINN_NO_DAEMON=1 in run.ts. Emit a JSON
|
|
652
|
+
// summary on stdout and exit 0 so CI / agent flows can stop after the
|
|
653
|
+
// bootstrap state machine reaches 'complete' without paying for the
|
|
654
|
+
// long-lived daemon.
|
|
655
|
+
// We close the setup-mode API server here because its listening socket
|
|
656
|
+
// would otherwise hold the event loop open and prevent process exit.
|
|
657
|
+
if (process.env['JINN_NO_DAEMON'] === '1') {
|
|
658
|
+
console.log('[main] --no-daemon: bootstrap complete, exiting before daemon loops.');
|
|
659
|
+
await setupApiServer.close().catch(() => undefined);
|
|
660
|
+
sharedStore.close();
|
|
661
|
+
const summary = {
|
|
662
|
+
schemaVersion: 1,
|
|
663
|
+
generatedAt: new Date().toISOString(),
|
|
664
|
+
verb: 'run',
|
|
665
|
+
status: 'ready',
|
|
666
|
+
masterAddress: bootstrapResult.masterAddress,
|
|
667
|
+
dashboardUrl: `http://127.0.0.1:${config.apiPort}`,
|
|
668
|
+
};
|
|
669
|
+
process.stdout.write(JSON.stringify(summary) + '\n');
|
|
670
|
+
process.exit(0);
|
|
671
|
+
}
|
|
672
|
+
const { agentPrivateKey, masterAddress, safeAddress, mechAddress, serviceIndex, serviceId, stakingAddress, agentId, identityRegistryAddress, } = bootstrapResult;
|
|
218
673
|
if (!mechAddress) {
|
|
219
674
|
emitEnvelope({
|
|
220
675
|
code: 'fatal',
|
|
@@ -227,19 +682,6 @@ export async function main() {
|
|
|
227
682
|
},
|
|
228
683
|
});
|
|
229
684
|
}
|
|
230
|
-
const adapter = new MechAdapter({
|
|
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
685
|
const preflight = await checkClaudeBinary(config.claudePath);
|
|
244
686
|
if (!preflight.ok) {
|
|
245
687
|
emitClaudeBinaryPreflightFailure(preflight.detail, config.claudePath);
|
|
@@ -268,27 +710,123 @@ export async function main() {
|
|
|
268
710
|
const masterAccount = deriveMasterSigner(mnemonicForMaster);
|
|
269
711
|
const publicClient = createJinnPublicClient(config.rpcUrl, NETWORK_CHAIN);
|
|
270
712
|
const masterWallet = createJinnWalletClient(config.rpcUrl, NETWORK_CHAIN, masterAccount);
|
|
271
|
-
|
|
713
|
+
const evictionRecovery = config.stakingMode === 'standard' &&
|
|
714
|
+
serviceId !== null &&
|
|
715
|
+
stakingAddress &&
|
|
716
|
+
CHAIN_CONFIG.distributorAddress
|
|
717
|
+
? {
|
|
718
|
+
serviceId,
|
|
719
|
+
stakingProxyAddress: stakingAddress,
|
|
720
|
+
distributorAddress: CHAIN_CONFIG.distributorAddress,
|
|
721
|
+
masterWalletClient: masterWallet,
|
|
722
|
+
}
|
|
723
|
+
: undefined;
|
|
724
|
+
const adapter = new MechAdapter({
|
|
725
|
+
rpcUrl: config.rpcUrl,
|
|
726
|
+
mechMarketplaceAddress: MARKETPLACE_ADDRESS,
|
|
727
|
+
routerAddress: ROUTER_ADDRESS,
|
|
728
|
+
mechContractAddress: mechAddress,
|
|
729
|
+
safeAddress,
|
|
730
|
+
agentEoaPrivateKey: agentPrivateKey,
|
|
731
|
+
ipfsRegistryUrl: config.ipfsRegistryUrl,
|
|
732
|
+
ipfsGatewayUrl: config.ipfsGatewayUrl,
|
|
733
|
+
pollIntervalMs: config.pollIntervalMs,
|
|
734
|
+
chainId: config.network === 'testnet' ? 84532 : 8453,
|
|
735
|
+
routerClaimDeliveryVariant: CHAIN_CONFIG.routerClaimDeliveryVersion,
|
|
736
|
+
evictionRecovery,
|
|
737
|
+
});
|
|
738
|
+
// ── TaskEngine wiring ─────────────────────────────────────────────────
|
|
272
739
|
// Build agent viem clients (same creds as MechAdapter uses internally).
|
|
740
|
+
const viemChains = await import('viem/chains');
|
|
273
741
|
const agentChain = config.network === 'testnet'
|
|
274
|
-
?
|
|
275
|
-
:
|
|
742
|
+
? viemChains.baseSepolia
|
|
743
|
+
: viemChains.base;
|
|
744
|
+
const l1Chain = config.jinnL1Network === 'sepolia' ? viemChains.sepolia : viemChains.mainnet;
|
|
745
|
+
const agentChainContracts = agentChain.contracts;
|
|
746
|
+
const optimismPortalAddress = agentChainContracts?.portal?.[l1Chain.id]?.address;
|
|
747
|
+
const disputeGameFactoryAddress = agentChainContracts?.disputeGameFactory?.[l1Chain.id]?.address;
|
|
748
|
+
const l2ProofClient = config.l2ProofRpcUrl
|
|
749
|
+
? createJinnPublicClient(config.l2ProofRpcUrl, NETWORK_CHAIN)
|
|
750
|
+
: undefined;
|
|
276
751
|
const agentClients = createClients(config.rpcUrl, agentPrivateKey, agentChain);
|
|
277
|
-
// ──
|
|
278
|
-
//
|
|
279
|
-
//
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
752
|
+
// ── L1 (Sepolia / Ethereum mainnet) clients for cross-chain JINN claim loop ──
|
|
753
|
+
// Uses the agent EOA because MockMessenger.owner is the agent on testnet.
|
|
754
|
+
// Same key as L2; only the chain differs.
|
|
755
|
+
const l1ClientsForJinnClaim = JINN_MVI_CONFIG.distributor && config.ethereumRpcUrl
|
|
756
|
+
? {
|
|
757
|
+
public: createJinnL1PublicClient(config.ethereumRpcUrl, config.jinnL1Network),
|
|
758
|
+
wallet: createJinnL1WalletClient(config.ethereumRpcUrl, config.jinnL1Network, privateKeyToAccount(agentPrivateKey)),
|
|
759
|
+
}
|
|
760
|
+
: undefined;
|
|
761
|
+
if (l1ClientsForJinnClaim) {
|
|
762
|
+
console.log(`[main] JinnClaimLoop: enabled (mode=${JINN_CLAIM_MESSENGER_MODE}, ` +
|
|
763
|
+
`interval=${config.jinnClaimLoopIntervalMs}ms, distributor=${JINN_MVI_CONFIG.distributor}, ` +
|
|
764
|
+
`emitter=${JINN_MVI_CONFIG.claimEmitter})`);
|
|
765
|
+
}
|
|
766
|
+
else {
|
|
767
|
+
console.log(`[main] JinnClaimLoop: disabled (JinnDistributor artifact/override or JINN_ETHEREUM_RPC_URL not set)`);
|
|
768
|
+
}
|
|
769
|
+
// ── Harness registry ─────────────────────────────────────────────────────────
|
|
770
|
+
const solverNetRegistry = await loadSolverNets(config);
|
|
771
|
+
for (const net of solverNetRegistry.list()) {
|
|
772
|
+
const plugins = [net.canonicalPlugin, ...net.plugins]
|
|
773
|
+
.map((plugin) => `${plugin.name}@${plugin.version}`)
|
|
774
|
+
.join(', ');
|
|
775
|
+
console.log(`[main] Loaded SolverNet: ${net.name} solverType=${net.solverType} harness=${net.harness} plugins=${plugins}`);
|
|
776
|
+
}
|
|
777
|
+
// Default-disable Harnesses with external dependencies the operator must opt into.
|
|
778
|
+
const DEFAULT_DISABLED_HARNESSES = ['claude-mcp-hyperliquid'];
|
|
779
|
+
const DEFAULT_HARNESS = 'claude-code-learner';
|
|
780
|
+
const implRegistry = new HarnessRegistry({
|
|
781
|
+
solverTypeHarnesses: solverNetRegistry.harnessSelections(),
|
|
782
|
+
default: config.harnesses?.default ?? DEFAULT_HARNESS,
|
|
783
|
+
disabled: config.harnesses?.disabled ?? [...DEFAULT_DISABLED_HARNESSES],
|
|
289
784
|
});
|
|
290
|
-
//
|
|
291
|
-
|
|
785
|
+
// Load operator-supplied external harness impls (Path 2 plug-in surface).
|
|
786
|
+
// Each entry in `config.harnesses.externalImpls` is verified against
|
|
787
|
+
// `config.trustedImplSigners` before its factory is invoked. Failed loads
|
|
788
|
+
// are logged + skipped — they don't bring down the daemon.
|
|
789
|
+
const externalImpls = [];
|
|
790
|
+
const trustedSigners = config.trustedImplSigners ?? [];
|
|
791
|
+
const externalEntries = config.harnesses?.externalImpls ?? [];
|
|
792
|
+
if (externalEntries.length > 0) {
|
|
793
|
+
for (const entry of externalEntries) {
|
|
794
|
+
const result = await loadExternalImpl({
|
|
795
|
+
entry: {
|
|
796
|
+
name: entry.name,
|
|
797
|
+
entry: entry.entry,
|
|
798
|
+
package: entry.package,
|
|
799
|
+
version: entry.version,
|
|
800
|
+
},
|
|
801
|
+
trustedSigners,
|
|
802
|
+
env: {
|
|
803
|
+
implName: entry.name,
|
|
804
|
+
implVersion: '0.0.0', // overridden by manifest validation below
|
|
805
|
+
network: config.network,
|
|
806
|
+
implStateDir: join(config.engine.implStateDirRoot, entry.name),
|
|
807
|
+
secrets: Object.freeze({}),
|
|
808
|
+
log: ({ level, msg, data }) => console.log(`[external-impl:${entry.name}] [${level}] ${msg}`, data ?? ''),
|
|
809
|
+
stub: false,
|
|
810
|
+
},
|
|
811
|
+
});
|
|
812
|
+
if (result.kind === 'ok') {
|
|
813
|
+
externalImpls.push(result.impl);
|
|
814
|
+
console.log(`[main] Loaded external impl: ${result.impl.name}@${result.impl.version}`);
|
|
815
|
+
}
|
|
816
|
+
else {
|
|
817
|
+
console.warn(`[main] Failed to load external impl ${entry.name}: ${result.reason}` +
|
|
818
|
+
(result.detail ? ` (${result.detail})` : ''));
|
|
819
|
+
}
|
|
820
|
+
}
|
|
821
|
+
}
|
|
822
|
+
// legacy-claude: wraps ClaudeRunner; handles spec=undefined (health-check) tasks
|
|
823
|
+
const corpusEnv = config.subgraphUrl?.trim()
|
|
824
|
+
? {
|
|
825
|
+
subgraphUrl: config.subgraphUrl,
|
|
826
|
+
ipfsGatewayUrl: config.ipfsGatewayUrl,
|
|
827
|
+
}
|
|
828
|
+
: undefined;
|
|
829
|
+
for (const impl of buildHarnesses({
|
|
292
830
|
rpcUrl: config.rpcUrl,
|
|
293
831
|
archiveRpcUrl: config.archiveRpcUrl,
|
|
294
832
|
claudePath: config.claudePath,
|
|
@@ -298,18 +836,44 @@ export async function main() {
|
|
|
298
836
|
runner,
|
|
299
837
|
storePath: config.dbPath,
|
|
300
838
|
daemonApiUrl: `http://127.0.0.1:${config.apiPort}`,
|
|
839
|
+
daemonApiToken: apiToken,
|
|
301
840
|
implStateDirRoot: config.engine.implStateDirRoot,
|
|
841
|
+
externalImpls,
|
|
842
|
+
disabledNames: config.harnesses?.disabled,
|
|
843
|
+
corpusEnv,
|
|
302
844
|
})) {
|
|
303
845
|
implRegistry.register(impl);
|
|
304
846
|
}
|
|
305
|
-
console.log(`[main]
|
|
847
|
+
console.log(`[main] HarnessRegistry: ${implRegistry.list().map(i => i.name).join(', ')}`);
|
|
306
848
|
// ── Engine deps ───────────────────────────────────────────────────────────────
|
|
307
|
-
// Packaging deps:
|
|
849
|
+
// Packaging deps: artifact bytes are written to served_artifacts (operator-local
|
|
850
|
+
// SQLite) and served via the operator's HTTP server with x402 gating per
|
|
851
|
+
// spec/2026-04-30-phase-a-umbrella.md §1. IPFS only holds the manifest envelope.
|
|
852
|
+
// The `store` field is filled by Daemon (which owns the SQLite handle); here
|
|
853
|
+
// we just configure the endpoint + price defaults from `config.operator`
|
|
854
|
+
// (Phase 3, jinn-mono-vy37.1.3). Operators who don't declare an operator
|
|
855
|
+
// block fall back to the daemon's local API port so dev/test runs still work
|
|
856
|
+
// — but the resulting envelopes won't be reachable from outside the host.
|
|
857
|
+
const operatorPublicEndpoint = config.operator?.publicEndpoint ?? `http://localhost:${config.apiPort}`;
|
|
858
|
+
const operatorDefaultPrice = config.operator?.defaultPriceUsdc ?? '0';
|
|
859
|
+
const operatorPerTypePrice = config.operator?.perArtifactTypePrice ?? {};
|
|
860
|
+
if (!config.operator?.publicEndpoint) {
|
|
861
|
+
console.warn('[main] config.operator.publicEndpoint not set; defaulting to local API port. ' +
|
|
862
|
+
'External evaluators will not be able to fetch artifacts from this operator. ' +
|
|
863
|
+
'Set operator.publicEndpoint (or JINN_OPERATOR_PUBLIC_ENDPOINT) before going live.');
|
|
864
|
+
}
|
|
308
865
|
const packagingDeps = {
|
|
309
|
-
|
|
866
|
+
operatorEndpoint: operatorPublicEndpoint,
|
|
867
|
+
defaultPriceUsdc: operatorDefaultPrice,
|
|
868
|
+
perArtifactTypePrice: operatorPerTypePrice,
|
|
310
869
|
};
|
|
311
|
-
|
|
312
|
-
|
|
870
|
+
const operatorConfig = {
|
|
871
|
+
publicEndpoint: operatorPublicEndpoint,
|
|
872
|
+
defaultPriceUsdc: operatorDefaultPrice,
|
|
873
|
+
perArtifactTypePrice: operatorPerTypePrice,
|
|
874
|
+
};
|
|
875
|
+
// Envelope assembly deps: sign envelopes with agent EOA private key
|
|
876
|
+
const envelopeDeps = {
|
|
313
877
|
ipfsRegistryUrl: config.ipfsRegistryUrl,
|
|
314
878
|
agentEoaPrivateKey: agentPrivateKey,
|
|
315
879
|
safeAddress,
|
|
@@ -322,6 +886,7 @@ export async function main() {
|
|
|
322
886
|
mechContractAddress: mechAddress,
|
|
323
887
|
routerAddress: ROUTER_ADDRESS,
|
|
324
888
|
claimDeliveryVariant: CHAIN_CONFIG.routerClaimDeliveryVersion,
|
|
889
|
+
evictionRecovery,
|
|
325
890
|
};
|
|
326
891
|
// Claim deps: use the network default when bundled, with env override for
|
|
327
892
|
// emergency redeploys or custom test deployments.
|
|
@@ -340,35 +905,134 @@ export async function main() {
|
|
|
340
905
|
else {
|
|
341
906
|
console.log('[main] ClaimRegistry: not configured (claim step will use NotImplementedError fallback)');
|
|
342
907
|
}
|
|
343
|
-
// ──
|
|
344
|
-
|
|
345
|
-
|
|
908
|
+
// ── IdentityPublisher (jinn-mono-3zk) ───────────────────────────────────────
|
|
909
|
+
//
|
|
910
|
+
// When the bootstrap has minted an ERC-8004 IdentityRegistry NFT for the
|
|
911
|
+
// active service (agent_id non-null) AND we know the registry address, wire
|
|
912
|
+
// an IdentityPublisher so the engine anchors each envelope under the
|
|
913
|
+
// operator's agent NFT via setMetadata. Otherwise log a warning — publishing
|
|
914
|
+
// is disabled until bootstrap completes that step (jinn-mono-j07).
|
|
915
|
+
let identityPublisher;
|
|
916
|
+
if (agentId && identityRegistryAddress) {
|
|
917
|
+
const { IdentityPublisher } = await import('./erc8004/index.js');
|
|
918
|
+
identityPublisher = new IdentityPublisher({
|
|
919
|
+
identityRegistryAddress,
|
|
920
|
+
agentId: BigInt(agentId),
|
|
921
|
+
walletClient: agentClients.walletClient,
|
|
922
|
+
publicClient: agentClients.publicClient,
|
|
923
|
+
});
|
|
924
|
+
console.log(`[main] IdentityPublisher: agentId=${agentId} registry=${identityRegistryAddress}`);
|
|
925
|
+
}
|
|
926
|
+
else {
|
|
927
|
+
console.log('[main] IdentityPublisher: disabled (no agent_id on active service — re-run bootstrap to mint the operator agent NFT)');
|
|
928
|
+
}
|
|
929
|
+
// ── Reputation feedback hook (jinn-mono-yg4) ──────────────────────────────
|
|
930
|
+
//
|
|
931
|
+
// After the evaluator's claimDelivery succeeds, the engine fires
|
|
932
|
+
// `ReputationRegistry.giveFeedback(harnessAgentId, …)` so the harness's
|
|
933
|
+
// agent NFT accrues a rating (DR §4.3). This requires:
|
|
934
|
+
//
|
|
935
|
+
// 1. A `ReputationRegistryClient` for the active chain. We use the
|
|
936
|
+
// canonical 0x8004… deployment; writes route through the operator's
|
|
937
|
+
// Safe so `msg.sender` matches the OLAS staking + 8004 IdentityRegistry
|
|
938
|
+
// identity.
|
|
939
|
+
// 2. An agentId resolver — looks up the harness's agentId from the
|
|
940
|
+
// parent manifest's evidenceHash via the subgraph. When `subgraphUrl`
|
|
941
|
+
// is unconfigured the resolver returns null cleanly and the hook
|
|
942
|
+
// becomes a no-op (defensive: feedback is non-fatal).
|
|
943
|
+
//
|
|
944
|
+
// Skipped when the operator hasn't minted an agent NFT yet (matches the
|
|
945
|
+
// IdentityPublisher gating above).
|
|
946
|
+
let reputationFeedback;
|
|
947
|
+
if (agentId) {
|
|
948
|
+
const { getReputationRegistryAddress, ReputationRegistryClient } = await import('./erc8004/index.js');
|
|
949
|
+
const chainId = config.network === 'testnet' ? 84532 : 8453;
|
|
950
|
+
const reputationRegistryAddress = getReputationRegistryAddress(chainId);
|
|
951
|
+
if (reputationRegistryAddress) {
|
|
952
|
+
const reputationClient = new ReputationRegistryClient({
|
|
953
|
+
reputationRegistryAddress,
|
|
954
|
+
publicClient: agentClients.publicClient,
|
|
955
|
+
walletClient: agentClients.walletClient,
|
|
956
|
+
safeAddress,
|
|
957
|
+
});
|
|
958
|
+
const { resolveAgentIdForManifest } = await import('./erc8004/index.js');
|
|
959
|
+
const subgraphUrl = config.subgraphUrl;
|
|
960
|
+
reputationFeedback = {
|
|
961
|
+
client: reputationClient,
|
|
962
|
+
resolveAgentId: (manifestHash) => resolveAgentIdForManifest({ manifestHash, subgraphUrl }),
|
|
963
|
+
};
|
|
964
|
+
console.log(`[main] ReputationFeedback: registry=${reputationRegistryAddress}${subgraphUrl ? ` subgraph=${subgraphUrl}` : ' (no subgraph configured — resolver always null)'}`);
|
|
965
|
+
}
|
|
966
|
+
else {
|
|
967
|
+
console.log(`[main] ReputationFeedback: disabled (no canonical ReputationRegistry deployed on chainId=${chainId})`);
|
|
968
|
+
}
|
|
969
|
+
}
|
|
970
|
+
else {
|
|
971
|
+
console.log('[main] ReputationFeedback: disabled (no agent_id on active service — same gating as IdentityPublisher)');
|
|
972
|
+
}
|
|
973
|
+
// ── Auto Task generators (testnet only, opt-out via env) ─────────────────
|
|
974
|
+
const autoTasksDisabled = process.env['JINN_DISABLE_AUTO_TASKS'] === '1';
|
|
975
|
+
const { privateKeyToAccount: _pkToAccount } = await import('viem/accounts');
|
|
976
|
+
const agentEoaAddress = _pkToAccount(agentPrivateKey).address;
|
|
977
|
+
const { generators: autoTaskGenerators, logLines: autoTaskLogLines } = collectTestnetAutoTaskGenerators({
|
|
346
978
|
network: config.network,
|
|
347
979
|
rpcUrl: config.rpcUrl,
|
|
348
|
-
|
|
980
|
+
autoTasksDisabled,
|
|
349
981
|
env: process.env,
|
|
982
|
+
agentEoa: agentEoaAddress,
|
|
983
|
+
safeAddress,
|
|
984
|
+
agentPrivateKey,
|
|
985
|
+
predictionV0WindowMs: config.predictionV0WindowMs,
|
|
986
|
+
predictionV0ResolveGapMs: config.predictionV0ResolveGapMs,
|
|
350
987
|
});
|
|
351
|
-
for (const line of
|
|
988
|
+
for (const line of autoTaskLogLines) {
|
|
352
989
|
console.log(line);
|
|
353
990
|
}
|
|
354
|
-
if (config.network === 'mainnet' && !
|
|
355
|
-
// Mainnet auto-
|
|
991
|
+
if (config.network === 'mainnet' && !autoTasksDisabled && BASE_FEEDS['ETH / USD']) {
|
|
992
|
+
// Mainnet auto-task opt-in only; default is OFF. Reserved for a future flag.
|
|
356
993
|
}
|
|
357
|
-
const
|
|
358
|
-
new
|
|
359
|
-
...
|
|
994
|
+
const taskSources = [
|
|
995
|
+
new StaticConfiguredTaskSource(config.tasks),
|
|
996
|
+
...autoTaskGenerators
|
|
997
|
+
.filter(({ solverType }) => solverNetRegistry.forSolverType(solverType)?.taskGenerator.enabled)
|
|
998
|
+
.map(({ solverType, generator }) => new GeneratedTaskSource(`generated:${solverType}`, generator)),
|
|
360
999
|
];
|
|
1000
|
+
// ── Corpus (daemon-side, jinn-mono-vy37.1.6) ─────────────────────────────
|
|
1001
|
+
//
|
|
1002
|
+
// Built once per daemon lifetime; the agent EOA private key stays in this
|
|
1003
|
+
// process's memory and never crosses into the MCP subprocess. The MCP
|
|
1004
|
+
// tool `acquire_artifact` proxies to `POST /v1/artifacts/acquire` instead.
|
|
1005
|
+
// Disabled when subgraphUrl is unset — the API route is then absent and
|
|
1006
|
+
// MCP falls back to local-only behaviour with a warning.
|
|
1007
|
+
const corpusFactory = config.subgraphUrl?.trim()
|
|
1008
|
+
? (store) => (corpusForApi = createCorpus({
|
|
1009
|
+
subgraphUrl: config.subgraphUrl,
|
|
1010
|
+
ipfsGatewayUrl: config.ipfsGatewayUrl,
|
|
1011
|
+
store,
|
|
1012
|
+
signer: { privateKey: agentPrivateKey },
|
|
1013
|
+
selfSafeAddress: safeAddress,
|
|
1014
|
+
}))
|
|
1015
|
+
: undefined;
|
|
1016
|
+
if (!corpusFactory) {
|
|
1017
|
+
console.warn('[main] Corpus disabled (config.subgraphUrl not set); ' +
|
|
1018
|
+
'MCP acquire_artifact / search_artifacts network branches will be unavailable.');
|
|
1019
|
+
}
|
|
361
1020
|
const daemon = new Daemon({
|
|
362
1021
|
adapter,
|
|
363
1022
|
runner,
|
|
364
|
-
|
|
1023
|
+
taskSources,
|
|
365
1024
|
dbPath: config.dbPath,
|
|
1025
|
+
store: sharedStore,
|
|
1026
|
+
apiServer: setupApiServer,
|
|
366
1027
|
pollIntervalMs: config.pollIntervalMs,
|
|
367
1028
|
apiPort: config.apiPort,
|
|
1029
|
+
apiBindHost,
|
|
1030
|
+
apiToken,
|
|
368
1031
|
peers: config.peers.length > 0 ? config.peers : undefined,
|
|
369
1032
|
subgraphUrl: config.subgraphUrl,
|
|
370
1033
|
nodeEndpoint: config.nodeEndpoint,
|
|
371
1034
|
creatorSafeAddress: safeAddress,
|
|
1035
|
+
corpusFactory,
|
|
372
1036
|
status: {
|
|
373
1037
|
earningDir: config.earningDir,
|
|
374
1038
|
rpcUrl: config.rpcUrl,
|
|
@@ -393,19 +1057,42 @@ export async function main() {
|
|
|
393
1057
|
distributorAddress: CHAIN_CONFIG.distributorAddress,
|
|
394
1058
|
}
|
|
395
1059
|
: undefined,
|
|
1060
|
+
jinnClaim: l1ClientsForJinnClaim &&
|
|
1061
|
+
JINN_MVI_CONFIG.claimEmitter &&
|
|
1062
|
+
JINN_MVI_CONFIG.messenger &&
|
|
1063
|
+
JINN_MVI_CONFIG.distributor &&
|
|
1064
|
+
config.jinnClaimLoopIntervalMs > 0
|
|
1065
|
+
? {
|
|
1066
|
+
intervalMs: config.jinnClaimLoopIntervalMs,
|
|
1067
|
+
l2Client: agentClients.publicClient,
|
|
1068
|
+
l2ProofClient,
|
|
1069
|
+
l2Wallet: agentClients.walletClient,
|
|
1070
|
+
l1Client: l1ClientsForJinnClaim.public,
|
|
1071
|
+
l1Wallet: l1ClientsForJinnClaim.wallet,
|
|
1072
|
+
store: earningStore,
|
|
1073
|
+
chain: NETWORK_CHAIN,
|
|
1074
|
+
claimEmitterAddress: JINN_MVI_CONFIG.claimEmitter,
|
|
1075
|
+
distributorAddress: JINN_MVI_CONFIG.distributor,
|
|
1076
|
+
messengerAddress: JINN_MVI_CONFIG.messenger,
|
|
1077
|
+
messengerMode: JINN_CLAIM_MESSENGER_MODE,
|
|
1078
|
+
optimismPortalAddress,
|
|
1079
|
+
disputeGameFactoryAddress,
|
|
1080
|
+
}
|
|
1081
|
+
: undefined,
|
|
396
1082
|
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
1083
|
paths: {
|
|
401
1084
|
workingDirRoot: config.engine.workingDirRoot,
|
|
402
1085
|
implStateDirRoot: config.engine.implStateDirRoot,
|
|
403
1086
|
},
|
|
404
1087
|
claimDeps,
|
|
405
1088
|
packagingDeps,
|
|
406
|
-
|
|
1089
|
+
envelopeDeps,
|
|
407
1090
|
deliveryDeps,
|
|
408
1091
|
implRegistry,
|
|
1092
|
+
solverNetRegistry,
|
|
1093
|
+
identityPublisher,
|
|
1094
|
+
reputationFeedback,
|
|
1095
|
+
operatorConfig,
|
|
409
1096
|
},
|
|
410
1097
|
balanceTopup: config.balanceTopupIntervalMs > 0
|
|
411
1098
|
? {
|
|
@@ -421,10 +1108,14 @@ export async function main() {
|
|
|
421
1108
|
}
|
|
422
1109
|
: undefined,
|
|
423
1110
|
});
|
|
424
|
-
// Graceful shutdown
|
|
1111
|
+
// Graceful shutdown — Daemon doesn't own the API server or Store in this
|
|
1112
|
+
// flow (they were created in setup-mode before bootstrap), so we close
|
|
1113
|
+
// them explicitly after Daemon.stop() completes.
|
|
425
1114
|
const shutdown = async (signal) => {
|
|
426
1115
|
console.log(`\n[main] Received ${signal}, shutting down...`);
|
|
427
1116
|
await daemon.stop();
|
|
1117
|
+
await setupApiServer.close().catch(() => undefined);
|
|
1118
|
+
sharedStore.close();
|
|
428
1119
|
console.log('[main] Shutdown complete.');
|
|
429
1120
|
process.exit(0);
|
|
430
1121
|
};
|
|
@@ -443,6 +1134,12 @@ export async function main() {
|
|
|
443
1134
|
}
|
|
444
1135
|
};
|
|
445
1136
|
process.on('exit', removePidfile);
|
|
1137
|
+
emitProgress({
|
|
1138
|
+
type: 'progress',
|
|
1139
|
+
phase: 'daemon',
|
|
1140
|
+
step: 'starting',
|
|
1141
|
+
estimatedWaitMs: 5000,
|
|
1142
|
+
});
|
|
446
1143
|
try {
|
|
447
1144
|
await daemon.start();
|
|
448
1145
|
}
|