@jinn-network/client 0.1.2 → 0.1.3-canary.262e5cda
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 +38 -14
- 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 +2 -2
- 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 +2 -2
- package/dist/adapters/local/adapter.js +8 -8
- package/dist/adapters/local/adapter.js.map +1 -1
- package/dist/adapters/mech/adapter.d.ts +3 -4
- package/dist/adapters/mech/adapter.js +86 -50
- package/dist/adapters/mech/adapter.js.map +1 -1
- package/dist/adapters/mech/contracts.d.ts +6 -4
- package/dist/adapters/mech/contracts.js +118 -14
- package/dist/adapters/mech/contracts.js.map +1 -1
- package/dist/adapters/mech/ipfs.d.ts +61 -6
- package/dist/adapters/mech/ipfs.js +159 -26
- 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 +47 -21
- 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 +5 -1
- 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/peers.js +20 -5
- package/dist/api/peers.js.map +1 -1
- package/dist/api/portfolio-v0-build.d.ts +6 -0
- package/dist/api/portfolio-v0-build.js +6 -1
- package/dist/api/portfolio-v0-build.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 +54 -0
- package/dist/api/server.js +239 -13
- 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 +9 -1
- 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 +36 -0
- package/dist/cli/commands/create.js +374 -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 +136 -121
- 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/history.d.ts +10 -1
- package/dist/cli/commands/history.js +66 -57
- package/dist/cli/commands/history.js.map +1 -1
- package/dist/cli/commands/impls.d.ts +18 -0
- package/dist/cli/commands/impls.js +208 -0
- package/dist/cli/commands/impls.js.map +1 -0
- package/dist/cli/commands/init.js +4 -1
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/commands/intents.js +13 -9
- package/dist/cli/commands/intents.js.map +1 -1
- 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/plug-ins.d.ts +34 -0
- package/dist/cli/commands/plug-ins.js +282 -0
- package/dist/cli/commands/plug-ins.js.map +1 -0
- package/dist/cli/commands/plugin-install.d.ts +10 -0
- package/dist/cli/commands/plugin-install.js +226 -14
- package/dist/cli/commands/plugin-install.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 +232 -90
- package/dist/cli/commands/run.js.map +1 -1
- 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/submit-intent.js +33 -6
- package/dist/cli/commands/submit-intent.js.map +1 -1
- 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 +102 -97
- 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 +2 -1
- package/dist/cli/execution-context.js.map +1 -1
- package/dist/cli/help.js +7 -0
- package/dist/cli/help.js.map +1 -1
- package/dist/cli/index.d.ts +7 -0
- package/dist/cli/index.js +18 -2
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/intent-registry-access.d.ts +33 -1
- package/dist/cli/intent-registry-access.js +40 -2
- package/dist/cli/intent-registry-access.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 +5 -5
- package/dist/cli/password.js.map +1 -1
- package/dist/config.d.ts +883 -11
- package/dist/config.js +435 -4
- 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 +228 -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 +107 -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 +2 -2
- package/dist/daemon/creator.js +2 -2
- package/dist/daemon/creator.js.map +1 -1
- package/dist/daemon/daemon.d.ts +70 -15
- package/dist/daemon/daemon.js +159 -41
- package/dist/daemon/daemon.js.map +1 -1
- package/dist/daemon/delivery-watcher.js +31 -1
- 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/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/index.d.ts +1 -1
- package/dist/intents/kinds/index.d.ts +10 -0
- package/dist/intents/kinds/index.js +7 -0
- package/dist/intents/kinds/index.js.map +1 -1
- package/dist/intents/kinds/learner-loop-test.d.ts +2 -0
- package/dist/intents/kinds/learner-loop-test.js +39 -0
- package/dist/intents/kinds/learner-loop-test.js.map +1 -0
- package/dist/intents/kinds/prediction-apy-v0.js +5 -1
- package/dist/intents/kinds/prediction-apy-v0.js.map +1 -1
- package/dist/intents/kinds/prediction-v0.js +5 -0
- package/dist/intents/kinds/prediction-v0.js.map +1 -1
- package/dist/intents/kinds/spec-kind.d.ts +18 -1
- package/dist/intents/posting-service.d.ts +3 -5
- package/dist/intents/posting-service.js +16 -50
- package/dist/intents/posting-service.js.map +1 -1
- package/dist/intents/prediction-apy-v0-auto.d.ts +12 -2
- package/dist/intents/prediction-apy-v0-auto.js +27 -2
- package/dist/intents/prediction-apy-v0-auto.js.map +1 -1
- package/dist/intents/prediction-v0-auto.d.ts +14 -4
- package/dist/intents/prediction-v0-auto.js +29 -5
- package/dist/intents/prediction-v0-auto.js.map +1 -1
- package/dist/intents/signing.d.ts +13 -0
- package/dist/intents/signing.js +27 -0
- package/dist/intents/signing.js.map +1 -0
- package/dist/intents/sources.d.ts +12 -5
- package/dist/intents/sources.js +11 -11
- package/dist/intents/sources.js.map +1 -1
- package/dist/main.d.ts +5 -2
- package/dist/main.js +792 -66
- 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 +20 -3
- package/dist/mcp/operator-server.js +500 -25
- 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.js +103 -58
- package/dist/mcp/server.js.map +1 -1
- package/dist/observability/emit-event.d.ts +1 -1
- 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/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/restorer/capability/index.d.ts +82 -0
- package/dist/restorer/capability/index.js +12 -0
- package/dist/restorer/capability/index.js.map +1 -0
- package/dist/restorer/capability/scoped-rpc.d.ts +12 -0
- package/dist/restorer/capability/scoped-rpc.js +34 -0
- package/dist/restorer/capability/scoped-rpc.js.map +1 -0
- package/dist/restorer/capability/scoped-secrets.d.ts +8 -0
- package/dist/restorer/capability/scoped-secrets.js +10 -0
- package/dist/restorer/capability/scoped-secrets.js.map +1 -0
- package/dist/restorer/capability/scoped-signer.d.ts +46 -0
- package/dist/restorer/capability/scoped-signer.js +73 -0
- package/dist/restorer/capability/scoped-signer.js.map +1 -0
- package/dist/restorer/engine/canonical-json.d.ts +0 -17
- package/dist/restorer/engine/canonical-json.js +56 -49
- package/dist/restorer/engine/canonical-json.js.map +1 -1
- package/dist/restorer/engine/claim.js +8 -1
- package/dist/restorer/engine/claim.js.map +1 -1
- package/dist/restorer/engine/delivery.d.ts +2 -0
- package/dist/restorer/engine/delivery.js +2 -2
- package/dist/restorer/engine/delivery.js.map +1 -1
- package/dist/restorer/engine/engine.d.ts +143 -26
- package/dist/restorer/engine/engine.js +485 -104
- package/dist/restorer/engine/engine.js.map +1 -1
- package/dist/restorer/engine/envelope-assembly.d.ts +65 -0
- package/dist/restorer/engine/envelope-assembly.js +60 -0
- package/dist/restorer/engine/envelope-assembly.js.map +1 -0
- package/dist/restorer/engine/packaging.d.ts +30 -30
- package/dist/restorer/engine/packaging.js +73 -47
- package/dist/restorer/engine/packaging.js.map +1 -1
- package/dist/restorer/engine/persistence.d.ts +7 -7
- package/dist/restorer/engine/persistence.js +4 -4
- package/dist/restorer/engine/persistence.js.map +1 -1
- package/dist/restorer/engine/registry.d.ts +24 -13
- package/dist/restorer/engine/registry.js +16 -13
- package/dist/restorer/engine/registry.js.map +1 -1
- package/dist/restorer/engine/validate-manifest.d.ts +23 -0
- package/dist/restorer/engine/validate-manifest.js +49 -0
- package/dist/restorer/engine/validate-manifest.js.map +1 -0
- package/dist/restorer/engine/verification-stub.d.ts +18 -0
- package/dist/restorer/engine/verification-stub.js +18 -0
- package/dist/restorer/engine/verification-stub.js.map +1 -0
- package/dist/restorer/external-impls/index.d.ts +3 -0
- package/dist/restorer/external-impls/index.js +2 -0
- package/dist/restorer/external-impls/index.js.map +1 -0
- package/dist/restorer/external-impls/loader.d.ts +49 -0
- package/dist/restorer/external-impls/loader.js +138 -0
- package/dist/restorer/external-impls/loader.js.map +1 -0
- package/dist/restorer/external-impls/package-hash.d.ts +26 -0
- package/dist/restorer/external-impls/package-hash.js +102 -0
- package/dist/restorer/external-impls/package-hash.js.map +1 -0
- package/dist/restorer/external-impls/types.d.ts +42 -0
- package/dist/restorer/external-impls/types.js +10 -0
- package/dist/restorer/external-impls/types.js.map +1 -0
- package/dist/restorer/impls/claude-code-learner/adapters/claude-code.d.ts +38 -0
- package/dist/restorer/impls/claude-code-learner/adapters/claude-code.js +200 -0
- package/dist/restorer/impls/claude-code-learner/adapters/claude-code.js.map +1 -0
- package/dist/restorer/impls/claude-code-learner/harvest.d.ts +19 -0
- package/dist/restorer/impls/claude-code-learner/harvest.js +146 -0
- package/dist/restorer/impls/claude-code-learner/harvest.js.map +1 -0
- package/dist/restorer/impls/claude-code-learner/index.d.ts +15 -0
- package/dist/restorer/impls/claude-code-learner/index.js +14 -0
- package/dist/restorer/impls/claude-code-learner/index.js.map +1 -0
- package/dist/restorer/impls/claude-code-learner/mcp-config.d.ts +48 -0
- package/dist/restorer/impls/claude-code-learner/mcp-config.js +52 -0
- package/dist/restorer/impls/claude-code-learner/mcp-config.js.map +1 -0
- package/dist/restorer/impls/claude-code-learner/plugin-path.d.ts +14 -0
- package/dist/restorer/impls/claude-code-learner/plugin-path.js +30 -0
- package/dist/restorer/impls/claude-code-learner/plugin-path.js.map +1 -0
- package/dist/restorer/impls/claude-code-learner/restorer.d.ts +38 -0
- package/dist/restorer/impls/claude-code-learner/restorer.js +73 -0
- package/dist/restorer/impls/claude-code-learner/restorer.js.map +1 -0
- package/dist/restorer/impls/claude-code-learner/test-utils/fake-plugin-outputs.d.ts +19 -0
- package/dist/restorer/impls/claude-code-learner/test-utils/fake-plugin-outputs.js +111 -0
- package/dist/restorer/impls/claude-code-learner/test-utils/fake-plugin-outputs.js.map +1 -0
- package/dist/restorer/impls/claude-code-learner/test-utils/noop-adapter.d.ts +22 -0
- package/dist/restorer/impls/claude-code-learner/test-utils/noop-adapter.js +35 -0
- package/dist/restorer/impls/claude-code-learner/test-utils/noop-adapter.js.map +1 -0
- package/dist/restorer/impls/claude-code-learner/test-utils/synthetic-session.d.ts +20 -0
- package/dist/restorer/impls/claude-code-learner/test-utils/synthetic-session.js +34 -0
- package/dist/restorer/impls/claude-code-learner/test-utils/synthetic-session.js.map +1 -0
- package/dist/restorer/impls/claude-code-learner/types.d.ts +99 -0
- package/dist/restorer/impls/claude-code-learner/types.js +2 -0
- package/dist/restorer/impls/claude-code-learner/types.js.map +1 -0
- package/dist/restorer/impls/claude-code-learner/wrapper.d.ts +49 -0
- package/dist/restorer/impls/claude-code-learner/wrapper.js +144 -0
- package/dist/restorer/impls/claude-code-learner/wrapper.js.map +1 -0
- package/dist/restorer/impls/claude-mcp-hyperliquid/index.d.ts +2 -2
- package/dist/restorer/impls/claude-mcp-hyperliquid/index.js +2 -2
- package/dist/restorer/impls/claude-mcp-hyperliquid/index.js.map +1 -1
- package/dist/restorer/impls/claude-mcp-hyperliquid/session-orchestrator.d.ts +7 -0
- package/dist/restorer/impls/claude-mcp-hyperliquid/session-orchestrator.js +38 -0
- package/dist/restorer/impls/claude-mcp-hyperliquid/session-orchestrator.js.map +1 -1
- package/dist/restorer/impls/claude-mcp-prediction/index.d.ts +2 -2
- package/dist/restorer/impls/claude-mcp-prediction/index.js +12 -2
- package/dist/restorer/impls/claude-mcp-prediction/index.js.map +1 -1
- package/dist/restorer/impls/claude-mcp-prediction/session-orchestrator.d.ts +9 -2
- package/dist/restorer/impls/claude-mcp-prediction/session-orchestrator.js +9 -125
- package/dist/restorer/impls/claude-mcp-prediction/session-orchestrator.js.map +1 -1
- package/dist/restorer/impls/claude-mcp-prediction-apy/index.d.ts +2 -2
- package/dist/restorer/impls/claude-mcp-prediction-apy/index.js +9 -2
- package/dist/restorer/impls/claude-mcp-prediction-apy/index.js.map +1 -1
- package/dist/restorer/impls/claude-mcp-prediction-apy/session-orchestrator.d.ts +10 -0
- package/dist/restorer/impls/claude-mcp-prediction-apy/session-orchestrator.js +10 -119
- package/dist/restorer/impls/claude-mcp-prediction-apy/session-orchestrator.js.map +1 -1
- package/dist/restorer/impls/claude-mcp-shared/single-session-orchestrator.d.ts +84 -0
- package/dist/restorer/impls/claude-mcp-shared/single-session-orchestrator.js +206 -0
- package/dist/restorer/impls/claude-mcp-shared/single-session-orchestrator.js.map +1 -0
- package/dist/restorer/impls/evaluation-context.d.ts +11 -4
- package/dist/restorer/impls/evaluation-context.js +9 -2
- package/dist/restorer/impls/evaluation-context.js.map +1 -1
- package/dist/restorer/impls/index.d.ts +46 -1
- package/dist/restorer/impls/index.js +38 -0
- package/dist/restorer/impls/index.js.map +1 -1
- package/dist/restorer/impls/legacy-claude/index.d.ts +13 -1
- package/dist/restorer/impls/legacy-claude/index.js +2 -0
- package/dist/restorer/impls/legacy-claude/index.js.map +1 -1
- package/dist/restorer/impls/portfolio-v0-evaluator/index.d.ts +4 -4
- package/dist/restorer/impls/portfolio-v0-evaluator/index.js +184 -55
- package/dist/restorer/impls/portfolio-v0-evaluator/index.js.map +1 -1
- package/dist/restorer/impls/prediction-apy-v0-baseline/index.d.ts +1 -1
- package/dist/restorer/impls/prediction-apy-v0-baseline/index.js +8 -1
- package/dist/restorer/impls/prediction-apy-v0-baseline/index.js.map +1 -1
- package/dist/restorer/impls/prediction-apy-v0-evaluator/index.d.ts +3 -3
- package/dist/restorer/impls/prediction-apy-v0-evaluator/index.js +153 -15
- package/dist/restorer/impls/prediction-apy-v0-evaluator/index.js.map +1 -1
- package/dist/restorer/impls/prediction-apy-v0-evaluator/parse-submission.d.ts +14 -5
- package/dist/restorer/impls/prediction-apy-v0-evaluator/parse-submission.js +16 -23
- package/dist/restorer/impls/prediction-apy-v0-evaluator/parse-submission.js.map +1 -1
- package/dist/restorer/impls/prediction-v0-baseline/index.d.ts +1 -1
- package/dist/restorer/impls/prediction-v0-baseline/index.js +16 -7
- package/dist/restorer/impls/prediction-v0-baseline/index.js.map +1 -1
- package/dist/restorer/impls/prediction-v0-evaluator/checks/integrity.d.ts +5 -3
- package/dist/restorer/impls/prediction-v0-evaluator/checks/integrity.js.map +1 -1
- package/dist/restorer/impls/prediction-v0-evaluator/index.d.ts +2 -2
- package/dist/restorer/impls/prediction-v0-evaluator/index.js +175 -67
- package/dist/restorer/impls/prediction-v0-evaluator/index.js.map +1 -1
- package/dist/restorer/manifest/index.d.ts +3 -0
- package/dist/restorer/manifest/index.js +3 -0
- package/dist/restorer/manifest/index.js.map +1 -0
- package/dist/restorer/manifest/load.d.ts +7 -0
- package/dist/restorer/manifest/load.js +49 -0
- package/dist/restorer/manifest/load.js.map +1 -0
- package/dist/restorer/manifest/types.d.ts +75 -0
- package/dist/restorer/manifest/types.js +8 -0
- package/dist/restorer/manifest/types.js.map +1 -0
- package/dist/restorer/manifest/verify.d.ts +15 -0
- package/dist/restorer/manifest/verify.js +53 -0
- package/dist/restorer/manifest/verify.js.map +1 -0
- package/dist/restorer/plug-ins/index.d.ts +14 -0
- package/dist/restorer/plug-ins/index.js +11 -0
- package/dist/restorer/plug-ins/index.js.map +1 -0
- package/dist/restorer/plug-ins/loader.d.ts +27 -0
- package/dist/restorer/plug-ins/loader.js +101 -0
- package/dist/restorer/plug-ins/loader.js.map +1 -0
- package/dist/restorer/plug-ins/manifest.d.ts +7 -0
- package/dist/restorer/plug-ins/manifest.js +97 -0
- package/dist/restorer/plug-ins/manifest.js.map +1 -0
- package/dist/restorer/plug-ins/registry.d.ts +24 -0
- package/dist/restorer/plug-ins/registry.js +17 -0
- package/dist/restorer/plug-ins/registry.js.map +1 -0
- package/dist/restorer/plug-ins/serialise.d.ts +29 -0
- package/dist/restorer/plug-ins/serialise.js +29 -0
- package/dist/restorer/plug-ins/serialise.js.map +1 -0
- package/dist/restorer/plug-ins/types.d.ts +77 -0
- package/dist/restorer/plug-ins/types.js +10 -0
- package/dist/restorer/plug-ins/types.js.map +1 -0
- package/dist/restorer/types.d.ts +66 -11
- package/dist/restorer/types.js.map +1 -1
- package/dist/runner/claude.d.ts +3 -3
- package/dist/runner/claude.js +57 -21
- 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/store/store.d.ts +79 -3
- package/dist/store/store.js +189 -6
- package/dist/store/store.js.map +1 -1
- package/dist/templates/plug-in/hook/README.md.tmpl +24 -0
- package/dist/templates/plug-in/hook/gitignore.tmpl +3 -0
- package/dist/templates/plug-in/hook/hooks/event.sh.tmpl +15 -0
- package/dist/templates/plug-in/hook/jinn-plugin.json.tmpl +16 -0
- package/dist/templates/plug-in/hook/package.json.tmpl +14 -0
- package/dist/templates/plug-in/hook/test/manifest.test.ts.tmpl +21 -0
- package/dist/templates/plug-in/mcp-tool/README.md.tmpl +26 -0
- package/dist/templates/plug-in/mcp-tool/gitignore.tmpl +4 -0
- package/dist/templates/plug-in/mcp-tool/jinn-plugin.json.tmpl +16 -0
- package/dist/templates/plug-in/mcp-tool/package.json.tmpl +19 -0
- package/dist/templates/plug-in/mcp-tool/src/server.ts.tmpl +17 -0
- package/dist/templates/plug-in/mcp-tool/test/server.test.ts.tmpl +18 -0
- package/dist/templates/plug-in/memory-backend/README.md.tmpl +33 -0
- package/dist/templates/plug-in/memory-backend/gitignore.tmpl +4 -0
- package/dist/templates/plug-in/memory-backend/jinn-plugin.json.tmpl +16 -0
- package/dist/templates/plug-in/memory-backend/package.json.tmpl +19 -0
- package/dist/templates/plug-in/memory-backend/src/server.ts.tmpl +23 -0
- package/dist/templates/plug-in/memory-backend/test/server.test.ts.tmpl +17 -0
- package/dist/templates/plug-in/phase-agent-override/README.md.tmpl +30 -0
- package/dist/templates/plug-in/phase-agent-override/agents/agent.md.tmpl +26 -0
- package/dist/templates/plug-in/phase-agent-override/gitignore.tmpl +3 -0
- package/dist/templates/plug-in/phase-agent-override/jinn-plugin.json.tmpl +17 -0
- package/dist/templates/plug-in/phase-agent-override/package.json.tmpl +14 -0
- package/dist/templates/plug-in/phase-agent-override/test/manifest.test.ts.tmpl +24 -0
- package/dist/templates/plug-in/skill-bundle/.claude-plugin/plugin.json.tmpl +5 -0
- package/dist/templates/plug-in/skill-bundle/README.md.tmpl +28 -0
- package/dist/templates/plug-in/skill-bundle/gitignore.tmpl +3 -0
- package/dist/templates/plug-in/skill-bundle/jinn-plugin.json.tmpl +15 -0
- package/dist/templates/plug-in/skill-bundle/package.json.tmpl +14 -0
- package/dist/templates/plug-in/skill-bundle/skills/example/SKILL.md.tmpl +14 -0
- package/dist/templates/plug-in/skill-bundle/test/manifest.test.ts.tmpl +21 -0
- package/dist/templates/plug-in/topic-explorer/README.md.tmpl +24 -0
- package/dist/templates/plug-in/topic-explorer/agents/explorer.md.tmpl +26 -0
- package/dist/templates/plug-in/topic-explorer/gitignore.tmpl +3 -0
- package/dist/templates/plug-in/topic-explorer/jinn-plugin.json.tmpl +17 -0
- package/dist/templates/plug-in/topic-explorer/package.json.tmpl +14 -0
- package/dist/templates/plug-in/topic-explorer/test/manifest.test.ts.tmpl +22 -0
- package/dist/templates/restorer/alternative-harness/README.md.tmpl +44 -0
- package/dist/templates/restorer/alternative-harness/gitignore.tmpl +3 -0
- package/dist/templates/restorer/alternative-harness/jinn.manifest.json.tmpl +22 -0
- package/dist/templates/restorer/alternative-harness/package.json.tmpl +26 -0
- package/dist/templates/restorer/alternative-harness/src/coordinator.ts.tmpl +50 -0
- package/dist/templates/restorer/alternative-harness/src/harness.ts.tmpl +31 -0
- package/dist/templates/restorer/alternative-harness/src/index.ts.tmpl +44 -0
- package/dist/templates/restorer/alternative-harness/src/mock-harness.ts.tmpl +41 -0
- package/dist/templates/restorer/alternative-harness/src/phases/debrief.ts.tmpl +28 -0
- package/dist/templates/restorer/alternative-harness/src/phases/execute.ts.tmpl +33 -0
- package/dist/templates/restorer/alternative-harness/src/phases/improve.ts.tmpl +31 -0
- package/dist/templates/restorer/alternative-harness/src/phases/memory.ts.tmpl +31 -0
- package/dist/templates/restorer/alternative-harness/src/phases/orient.ts.tmpl +21 -0
- package/dist/templates/restorer/alternative-harness/src/phases/plan.ts.tmpl +25 -0
- package/dist/templates/restorer/alternative-harness/src/phases/strategize.ts.tmpl +29 -0
- package/dist/templates/restorer/alternative-harness/test/coordinator.test.ts.tmpl +52 -0
- package/dist/templates/restorer/alternative-harness/test/unit.test.ts.tmpl +54 -0
- package/dist/templates/restorer/alternative-harness/tsconfig.json.tmpl +16 -0
- package/dist/templates/restorer/evaluator/README.md.tmpl +36 -0
- package/dist/templates/restorer/evaluator/gitignore.tmpl +3 -0
- package/dist/templates/restorer/evaluator/jinn.manifest.json.tmpl +22 -0
- package/dist/templates/restorer/evaluator/package.json.tmpl +26 -0
- package/dist/templates/restorer/evaluator/src/index.ts.tmpl +35 -0
- package/dist/templates/restorer/evaluator/test/unit.test.ts.tmpl +48 -0
- package/dist/templates/restorer/evaluator/tsconfig.json.tmpl +16 -0
- package/dist/templates/restorer/forecaster/README.md.tmpl +25 -0
- package/dist/templates/restorer/forecaster/gitignore.tmpl +5 -0
- package/dist/templates/restorer/forecaster/jinn.manifest.json.tmpl +22 -0
- package/dist/templates/restorer/forecaster/package.json.tmpl +26 -0
- package/dist/templates/restorer/forecaster/src/index.ts.tmpl +33 -0
- package/dist/templates/restorer/forecaster/test/unit.test.ts.tmpl +41 -0
- package/dist/templates/restorer/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/desired-state.d.ts +211 -21
- package/dist/types/desired-state.js +26 -15
- package/dist/types/desired-state.js.map +1 -1
- package/dist/types/envelope.d.ts +1473 -0
- package/dist/types/envelope.js +114 -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/intent.d.ts +276 -0
- package/dist/types/intent.js +74 -0
- package/dist/types/intent.js.map +1 -0
- 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 +23 -685
- package/dist/types/portfolio.js +16 -106
- package/dist/types/portfolio.js.map +1 -1
- package/dist/types/prediction-apy.d.ts +9 -344
- package/dist/types/prediction-apy.js +9 -65
- package/dist/types/prediction-apy.js.map +1 -1
- package/dist/types/prediction.d.ts +25 -396
- package/dist/types/prediction.js +5 -79
- package/dist/types/prediction.js.map +1 -1
- 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 +22 -0
- package/dist/util/path-safety.js +29 -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/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 +36 -11
- 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 +49 -0
- package/plugins/claude-code-learner/skills/coordinator/SKILL.md +131 -0
- package/plugins/claude-code-learner/skills/debrief/SKILL.md +71 -0
- package/plugins/claude-code-learner/skills/execute/SKILL.md +91 -0
- package/plugins/claude-code-learner/skills/improve/SKILL.md +57 -0
- package/plugins/claude-code-learner/skills/memory-consolidation/SKILL.md +57 -0
- package/plugins/claude-code-learner/skills/orient/SKILL.md +82 -0
- package/plugins/claude-code-learner/skills/plan/SKILL.md +54 -0
- package/plugins/claude-code-learner/skills/strategize/SKILL.md +63 -0
- package/skills/jinn-operator/SKILL.md +84 -35
- package/templates/plug-in/hook/README.md.tmpl +24 -0
- package/templates/plug-in/hook/gitignore.tmpl +3 -0
- package/templates/plug-in/hook/hooks/event.sh.tmpl +15 -0
- package/templates/plug-in/hook/jinn-plugin.json.tmpl +16 -0
- package/templates/plug-in/hook/package.json.tmpl +14 -0
- package/templates/plug-in/hook/test/manifest.test.ts.tmpl +21 -0
- package/templates/plug-in/mcp-tool/README.md.tmpl +26 -0
- package/templates/plug-in/mcp-tool/gitignore.tmpl +4 -0
- package/templates/plug-in/mcp-tool/jinn-plugin.json.tmpl +16 -0
- package/templates/plug-in/mcp-tool/package.json.tmpl +19 -0
- package/templates/plug-in/mcp-tool/src/server.ts.tmpl +17 -0
- package/templates/plug-in/mcp-tool/test/server.test.ts.tmpl +18 -0
- package/templates/plug-in/memory-backend/README.md.tmpl +33 -0
- package/templates/plug-in/memory-backend/gitignore.tmpl +4 -0
- package/templates/plug-in/memory-backend/jinn-plugin.json.tmpl +16 -0
- package/templates/plug-in/memory-backend/package.json.tmpl +19 -0
- package/templates/plug-in/memory-backend/src/server.ts.tmpl +23 -0
- package/templates/plug-in/memory-backend/test/server.test.ts.tmpl +17 -0
- package/templates/plug-in/phase-agent-override/README.md.tmpl +30 -0
- package/templates/plug-in/phase-agent-override/agents/agent.md.tmpl +26 -0
- package/templates/plug-in/phase-agent-override/gitignore.tmpl +3 -0
- package/templates/plug-in/phase-agent-override/jinn-plugin.json.tmpl +17 -0
- package/templates/plug-in/phase-agent-override/package.json.tmpl +14 -0
- package/templates/plug-in/phase-agent-override/test/manifest.test.ts.tmpl +24 -0
- package/templates/plug-in/skill-bundle/.claude-plugin/plugin.json.tmpl +5 -0
- package/templates/plug-in/skill-bundle/README.md.tmpl +28 -0
- package/templates/plug-in/skill-bundle/gitignore.tmpl +3 -0
- package/templates/plug-in/skill-bundle/jinn-plugin.json.tmpl +15 -0
- package/templates/plug-in/skill-bundle/package.json.tmpl +14 -0
- package/templates/plug-in/skill-bundle/skills/example/SKILL.md.tmpl +14 -0
- package/templates/plug-in/skill-bundle/test/manifest.test.ts.tmpl +21 -0
- package/templates/plug-in/topic-explorer/README.md.tmpl +24 -0
- package/templates/plug-in/topic-explorer/agents/explorer.md.tmpl +26 -0
- package/templates/plug-in/topic-explorer/gitignore.tmpl +3 -0
- package/templates/plug-in/topic-explorer/jinn-plugin.json.tmpl +17 -0
- package/templates/plug-in/topic-explorer/package.json.tmpl +14 -0
- package/templates/plug-in/topic-explorer/test/manifest.test.ts.tmpl +22 -0
- package/templates/restorer/alternative-harness/README.md.tmpl +44 -0
- package/templates/restorer/alternative-harness/gitignore.tmpl +3 -0
- package/templates/restorer/alternative-harness/jinn.manifest.json.tmpl +22 -0
- package/templates/restorer/alternative-harness/package.json.tmpl +26 -0
- package/templates/restorer/alternative-harness/src/coordinator.ts.tmpl +50 -0
- package/templates/restorer/alternative-harness/src/harness.ts.tmpl +31 -0
- package/templates/restorer/alternative-harness/src/index.ts.tmpl +44 -0
- package/templates/restorer/alternative-harness/src/mock-harness.ts.tmpl +41 -0
- package/templates/restorer/alternative-harness/src/phases/debrief.ts.tmpl +28 -0
- package/templates/restorer/alternative-harness/src/phases/execute.ts.tmpl +33 -0
- package/templates/restorer/alternative-harness/src/phases/improve.ts.tmpl +31 -0
- package/templates/restorer/alternative-harness/src/phases/memory.ts.tmpl +31 -0
- package/templates/restorer/alternative-harness/src/phases/orient.ts.tmpl +21 -0
- package/templates/restorer/alternative-harness/src/phases/plan.ts.tmpl +25 -0
- package/templates/restorer/alternative-harness/src/phases/strategize.ts.tmpl +29 -0
- package/templates/restorer/alternative-harness/test/coordinator.test.ts.tmpl +52 -0
- package/templates/restorer/alternative-harness/test/unit.test.ts.tmpl +54 -0
- package/templates/restorer/alternative-harness/tsconfig.json.tmpl +16 -0
- package/templates/restorer/evaluator/README.md.tmpl +36 -0
- package/templates/restorer/evaluator/gitignore.tmpl +3 -0
- package/templates/restorer/evaluator/jinn.manifest.json.tmpl +22 -0
- package/templates/restorer/evaluator/package.json.tmpl +26 -0
- package/templates/restorer/evaluator/src/index.ts.tmpl +35 -0
- package/templates/restorer/evaluator/test/unit.test.ts.tmpl +48 -0
- package/templates/restorer/evaluator/tsconfig.json.tmpl +16 -0
- package/templates/restorer/forecaster/README.md.tmpl +25 -0
- package/templates/restorer/forecaster/gitignore.tmpl +5 -0
- package/templates/restorer/forecaster/jinn.manifest.json.tmpl +22 -0
- package/templates/restorer/forecaster/package.json.tmpl +26 -0
- package/templates/restorer/forecaster/src/index.ts.tmpl +33 -0
- package/templates/restorer/forecaster/test/unit.test.ts.tmpl +41 -0
- package/templates/restorer/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/quickstart.js +0 -330
- package/dist/cli/commands/quickstart.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/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/cli/commands/{quickstart.d.ts → ui.d.ts} +0 -0
|
@@ -5,11 +5,12 @@
|
|
|
5
5
|
* Phase 2 (per-service): derive agent → stake → deploy mech
|
|
6
6
|
*/
|
|
7
7
|
import { decodeEventLog, encodeAbiParameters, encodeFunctionData, formatEther, getAddress, zeroAddress, } from 'viem';
|
|
8
|
-
import { ERC20_ABI, EVENT_TOPICS, SERVICE_MANAGER_ABI, SERVICE_REGISTRY_APPROVE_ABI, SERVICE_REGISTRY_L2_ABI, STAKING_ABI, MECH_MARKETPLACE_CREATE_ABI, STOLAS_DISTRIBUTOR_ABI, STOLAS_STAKING_SLOTS_ABI, cidToBytes32, getChainConfig, } from './contracts.js';
|
|
8
|
+
import { ERC20_ABI, EVENT_TOPICS, IDENTITY_REGISTRY_ABI, IDENTITY_REGISTRY_ADDRESSES, SERVICE_MANAGER_ABI, SERVICE_REGISTRY_APPROVE_ABI, SERVICE_REGISTRY_L2_ABI, STAKING_ABI, MECH_MARKETPLACE_CREATE_ABI, STOLAS_DISTRIBUTOR_ABI, STOLAS_STAKING_SLOTS_ABI, applyChainGasOverrides, cidToBytes32, getChainConfig, } from './contracts.js';
|
|
9
9
|
import { executeSafeTxBatch, executeSafeTxDirect, initDeployedSafe, initPredictedSafe, } from './safe-adapter.js';
|
|
10
|
+
import { bindAgentWalletToSafe } from './agent-wallet-binding.js';
|
|
10
11
|
import { FleetStateStore } from './store.js';
|
|
11
12
|
import { generateMnemonic, encryptMnemonic, decryptMnemonic, deriveMasterAddress, deriveMasterSigner, deriveAgentAddress, deriveAgentSigner, walletPrivateKeyAtIndex, } from './wallet.js';
|
|
12
|
-
import { createDefaultServiceState } from './types.js';
|
|
13
|
+
import { createDefaultServiceState, isOperationalServiceStep } from './types.js';
|
|
13
14
|
import { formatBootstrapOperatorMessage, isJinnDebug, } from '../operator-errors.js';
|
|
14
15
|
import { reconcileServiceAgainstChain, } from './reconcile.js';
|
|
15
16
|
import { previousSafeBeingAbandoned, sweepOrphanedServiceFunds, } from './orphan-sweep.js';
|
|
@@ -20,8 +21,10 @@ import { createJinnPublicClient, createJinnWalletClient } from './viem-clients.j
|
|
|
20
21
|
import { isTransientEthReadError } from '../chain-read-errors.js';
|
|
21
22
|
import { nextFleetServiceIndex } from './next-service-index.js';
|
|
22
23
|
import { rpcHostForDisplay } from '../preflight/rpc-network.js';
|
|
24
|
+
import { detectDeprecatedTestnetSetup, migrateDeprecatedTestnetSetup, } from './testnet-setup-migration.js';
|
|
23
25
|
const addr = (value) => getAddress(value);
|
|
24
26
|
const SAFE_TOKEN_BOOTSTRAP_MULTIPLIER = 2n;
|
|
27
|
+
const STANDARD_MASTER_BOOTSTRAP_MULTIPLIER = 2n;
|
|
25
28
|
/** Conservative default: ~0.001 ETH/day master gas if not configured. */
|
|
26
29
|
const DEFAULT_MASTER_ETH_DAILY_WEI = 1000000000000000n;
|
|
27
30
|
/** Warn when ETH above the minimum would last fewer than this many days at the daily estimate. */
|
|
@@ -36,6 +39,8 @@ export class FleetBootstrapper {
|
|
|
36
39
|
debug;
|
|
37
40
|
masterEthDailyEstimateWei;
|
|
38
41
|
env;
|
|
42
|
+
requestFunding;
|
|
43
|
+
autoTestnetFaucet;
|
|
39
44
|
constructor(options = {}) {
|
|
40
45
|
this.store = new FleetStateStore(options.earningDir);
|
|
41
46
|
this.chain = options.chain ?? 'base';
|
|
@@ -43,17 +48,23 @@ export class FleetBootstrapper {
|
|
|
43
48
|
this.stakingMode = options.stakingMode ?? 'standard';
|
|
44
49
|
this.targetServices = options.targetServices ?? 1;
|
|
45
50
|
this.debug = options.debug ?? isJinnDebug();
|
|
51
|
+
this.requestFunding = options.requestFunding ?? requestTestnetFunding;
|
|
52
|
+
this.autoTestnetFaucet =
|
|
53
|
+
options.autoTestnetFaucet ?? this.env['JINN_DISABLE_TESTNET_FAUCET'] !== '1';
|
|
46
54
|
const dailyOpt = options.masterEthDailyEstimateWei;
|
|
47
55
|
this.masterEthDailyEstimateWei =
|
|
48
56
|
dailyOpt !== undefined
|
|
49
57
|
? BigInt(dailyOpt)
|
|
50
58
|
: this.estimateMasterDailyGasWei(options.pollIntervalMs);
|
|
51
|
-
this.config = getChainConfig(this.chain, {
|
|
59
|
+
this.config = applyChainGasOverrides(getChainConfig(this.chain, {
|
|
52
60
|
testnetL2DeploymentPath: options.testnetL2DeploymentPath,
|
|
53
61
|
testnetL2TokenDeploymentPath: options.testnetL2TokenDeploymentPath,
|
|
54
62
|
testnetMechDeploymentPath: options.testnetMechDeploymentPath,
|
|
55
63
|
testnetStolasDeploymentPath: options.testnetStolasDeploymentPath,
|
|
56
64
|
testnetClaimRegistryDeploymentPath: options.testnetClaimRegistryDeploymentPath,
|
|
65
|
+
}), {
|
|
66
|
+
minEoaGasWei: options.minEoaGasWei ?? this.env['JINN_MIN_EOA_GAS_WEI'],
|
|
67
|
+
minSafeEthWei: options.minSafeEthWei ?? this.env['JINN_MIN_SAFE_ETH_WEI'],
|
|
57
68
|
});
|
|
58
69
|
if (options.rpcUrl) {
|
|
59
70
|
this.config.rpcUrl = options.rpcUrl;
|
|
@@ -108,10 +119,23 @@ export class FleetBootstrapper {
|
|
|
108
119
|
}
|
|
109
120
|
}
|
|
110
121
|
}
|
|
122
|
+
const pendingSetupMigration = detectDeprecatedTestnetSetup({
|
|
123
|
+
state,
|
|
124
|
+
chain: this.chain,
|
|
125
|
+
stakingMode: this.stakingMode,
|
|
126
|
+
currentStakingContract: this.config.stakingContract,
|
|
127
|
+
}).services.length > 0;
|
|
128
|
+
const completedCountBeforeFunding = state.services.filter(s => isOperationalServiceStep(s.step)).length;
|
|
129
|
+
const standardFleetAlreadyComplete = this.stakingMode === 'standard' &&
|
|
130
|
+
!pendingSetupMigration &&
|
|
131
|
+
completedCountBeforeFunding >= this.targetServices;
|
|
132
|
+
const standardFleetHasInProgressServices = this.stakingMode === 'standard' && state.services.length > 0;
|
|
111
133
|
const requiredMasterEth = this.stakingMode === 'standard'
|
|
112
|
-
?
|
|
134
|
+
? (standardFleetAlreadyComplete
|
|
135
|
+
? 0n
|
|
136
|
+
: this.config.minEoaGasEth * (standardFleetHasInProgressServices ? 1n : STANDARD_MASTER_BOOTSTRAP_MULTIPLIER))
|
|
113
137
|
: SELF_BOND_ETH_PER_SERVICE * BigInt(this.targetServices);
|
|
114
|
-
const autoFaucetEnabled = this.
|
|
138
|
+
const autoFaucetEnabled = this.autoTestnetFaucet;
|
|
115
139
|
// Re-sum system ETH (master + agent/safe balances for self-bond mode).
|
|
116
140
|
// Hoisted so the drip loop below can refresh cheaply.
|
|
117
141
|
const refreshSystemEth = async () => {
|
|
@@ -145,7 +169,7 @@ export class FleetBootstrapper {
|
|
|
145
169
|
`Draining CDP faucet on ${this.chain} via ${rpcHostForDisplay(this.config.rpcUrl)} ` +
|
|
146
170
|
`(each drip ≈ 0.0001 ETH, up to ${MAX_FAUCET_ITERS} drips; expect ~30-60 s on first run).`);
|
|
147
171
|
for (let i = 0; i < MAX_FAUCET_ITERS; i++) {
|
|
148
|
-
const faucetResult = await
|
|
172
|
+
const faucetResult = await this.requestFunding(masterAddress, 'base-sepolia');
|
|
149
173
|
if (!faucetResult.ok) {
|
|
150
174
|
if (faucetResult.rateLimited) {
|
|
151
175
|
console.error(`[fleet-bootstrap] CDP faucet rate-limited after ${i} drips: ${faucetResult.reason}`);
|
|
@@ -191,19 +215,37 @@ export class FleetBootstrapper {
|
|
|
191
215
|
this.warnMasterEthRunway(masterAddress, masterBalance, requiredMasterEth);
|
|
192
216
|
// Phase 2: Bootstrap services up to target
|
|
193
217
|
const mnemonic = await decryptMnemonic(await this.store.loadMnemonicKeystore(), password);
|
|
218
|
+
if (pendingSetupMigration) {
|
|
219
|
+
const masterAccount = deriveMasterSigner(mnemonic);
|
|
220
|
+
const masterWallet = createJinnWalletClient(this.config.rpcUrl, this.chain, masterAccount);
|
|
221
|
+
const migration = await migrateDeprecatedTestnetSetup({
|
|
222
|
+
stateStore: this.store,
|
|
223
|
+
state,
|
|
224
|
+
chain: this.chain,
|
|
225
|
+
stakingMode: this.stakingMode,
|
|
226
|
+
currentStakingContract: this.config.stakingContract,
|
|
227
|
+
distributorAddress: this.config.distributorAddress,
|
|
228
|
+
publicClient: this.publicClient,
|
|
229
|
+
masterWallet,
|
|
230
|
+
});
|
|
231
|
+
state = migration.state;
|
|
232
|
+
}
|
|
194
233
|
state = await this.reconcileFleetWithChain(state, mnemonic);
|
|
195
234
|
// Resume all services. For incomplete services, this picks up where they
|
|
196
235
|
// left off. For "complete" services in standard mode, this also runs the
|
|
197
236
|
// eviction recovery check (since on-chain state may have changed since
|
|
198
237
|
// the daemon was last running — e.g., evicted due to inactivity).
|
|
199
238
|
for (const svc of state.services) {
|
|
200
|
-
if (svc.step
|
|
239
|
+
if (!isOperationalServiceStep(svc.step)) {
|
|
201
240
|
console.error(`[fleet-bootstrap] Resuming service ${svc.index} at step '${svc.step}'`);
|
|
202
241
|
}
|
|
242
|
+
else if (svc.step === 'safe_binding_pending') {
|
|
243
|
+
console.error(`[fleet-bootstrap] Resuming service ${svc.index} at step 'safe_binding_pending'`);
|
|
244
|
+
}
|
|
203
245
|
state = await this.resumeService(state, mnemonic, svc.index);
|
|
204
246
|
}
|
|
205
247
|
// Then create new services if needed
|
|
206
|
-
const completedCount = state.services.filter(s => s.step
|
|
248
|
+
const completedCount = state.services.filter(s => isOperationalServiceStep(s.step)).length;
|
|
207
249
|
const needed = this.targetServices - completedCount;
|
|
208
250
|
if (needed > 0) {
|
|
209
251
|
console.error(`[fleet-bootstrap] ${completedCount}/${this.targetServices} services complete, bootstrapping ${needed} more`);
|
|
@@ -215,7 +257,7 @@ export class FleetBootstrapper {
|
|
|
215
257
|
return {
|
|
216
258
|
ok: true,
|
|
217
259
|
fleet_state: state,
|
|
218
|
-
message: `Fleet bootstrap complete. ${state.services.filter(s => s.step
|
|
260
|
+
message: `Fleet bootstrap complete. ${state.services.filter(s => isOperationalServiceStep(s.step)).length}/${this.targetServices} services running.`,
|
|
219
261
|
};
|
|
220
262
|
}
|
|
221
263
|
catch (error) {
|
|
@@ -292,10 +334,13 @@ export class FleetBootstrapper {
|
|
|
292
334
|
* when local JSON is ahead, behind, or stale (idempotent; safe to repeat).
|
|
293
335
|
*/
|
|
294
336
|
async reconcileFleetWithChain(state, mnemonic) {
|
|
295
|
-
const ctx = { stakingContract: this.config.stakingContract };
|
|
296
337
|
let next = state;
|
|
297
338
|
for (const svc of state.services) {
|
|
298
339
|
const signals = await this.gatherChainSignals(svc);
|
|
340
|
+
const ctx = {
|
|
341
|
+
stakingContract: this.stakingAddressForService(svc),
|
|
342
|
+
preserveExistingSetup: this.shouldPreserveExistingSetup(svc),
|
|
343
|
+
};
|
|
299
344
|
const result = reconcileServiceAgainstChain(this.stakingMode, svc, signals, ctx);
|
|
300
345
|
if (result) {
|
|
301
346
|
const abandoned = previousSafeBeingAbandoned(svc, result.patch);
|
|
@@ -348,7 +393,7 @@ export class FleetBootstrapper {
|
|
|
348
393
|
};
|
|
349
394
|
}
|
|
350
395
|
const id = svc.service_id;
|
|
351
|
-
const stakingAddr = this.
|
|
396
|
+
const stakingAddr = this.stakingAddressForService(svc);
|
|
352
397
|
const registryAddr = this.config.serviceRegistry;
|
|
353
398
|
let stakingState = 0;
|
|
354
399
|
try {
|
|
@@ -412,21 +457,45 @@ export class FleetBootstrapper {
|
|
|
412
457
|
let svc = state.services.find(s => s.index === index);
|
|
413
458
|
if (!svc)
|
|
414
459
|
throw new Error(`Service ${index} not found in state`);
|
|
460
|
+
if (this.stakingMode === 'standard' &&
|
|
461
|
+
svc.error &&
|
|
462
|
+
this.shouldPreserveExistingSetup(svc)) {
|
|
463
|
+
return state;
|
|
464
|
+
}
|
|
415
465
|
// Eviction recovery: even for "complete" services, check if on-chain shows
|
|
416
466
|
// evicted (state=2). If so, unstake and reset to awaiting_stake so the
|
|
417
467
|
// bootstrap restakes fresh. Only applies to standard mode (distributor-managed).
|
|
418
468
|
if (this.stakingMode === 'standard' &&
|
|
419
469
|
svc.service_id !== null &&
|
|
420
|
-
(svc.step
|
|
421
|
-
|
|
470
|
+
(isOperationalServiceStep(svc.step) || svc.step === 'mech_deployed' || svc.step === 'staked')) {
|
|
471
|
+
let onChainState;
|
|
472
|
+
try {
|
|
473
|
+
onChainState = await this.getStakingState(svc.service_id, svc.staking_address);
|
|
474
|
+
}
|
|
475
|
+
catch (error) {
|
|
476
|
+
if (this.shouldPreserveExistingSetup(svc)) {
|
|
477
|
+
console.error(`[jinn-earning] Service ${index}: existing setup staking state could not be checked automatically. Leaving local service id and wallet fields unchanged for recovery/support.`);
|
|
478
|
+
return state;
|
|
479
|
+
}
|
|
480
|
+
throw error;
|
|
481
|
+
}
|
|
422
482
|
if (onChainState === 2) {
|
|
423
483
|
console.error(`[jinn-earning] Noticed service ${svc.service_id} (fleet index ${index}) evicted on-chain; running distributor reStake to restake.`);
|
|
424
484
|
state = await this.recoverEvictedService(state, mnemonic, index);
|
|
425
485
|
svc = state.services.find(s => s.index === index);
|
|
426
486
|
}
|
|
427
487
|
}
|
|
428
|
-
if (svc.step
|
|
488
|
+
if (isOperationalServiceStep(svc.step)) {
|
|
489
|
+
// Identity binding retry: services at `safe_binding_pending` are already
|
|
490
|
+
// staked and operational, but their ERC-8004 Safe→agentId link still
|
|
491
|
+
// needs to be written. Older `complete` services with safe_bound=false
|
|
492
|
+
// are treated the same way so legacy operators self-heal on resume.
|
|
493
|
+
if (svc.agent_id && svc.safe_address && svc.safe_bound_to_agent !== true) {
|
|
494
|
+
console.error(`[fleet-bootstrap] Service ${index}: agent_id=${svc.agent_id} with unbound Safe; running binding step.`);
|
|
495
|
+
state = await this.stepRegisterAgent(state, mnemonic, index);
|
|
496
|
+
}
|
|
429
497
|
return state;
|
|
498
|
+
}
|
|
430
499
|
if (this.stakingMode === 'standard') {
|
|
431
500
|
return this.resumeServiceStandard(state, mnemonic, index);
|
|
432
501
|
}
|
|
@@ -438,11 +507,18 @@ export class FleetBootstrapper {
|
|
|
438
507
|
state = await this.stepStolasStake(state, mnemonic, index);
|
|
439
508
|
}
|
|
440
509
|
// Reload service state after stake
|
|
441
|
-
|
|
510
|
+
let updatedSvc = (await this.store.load(this.chain)).services.find(s => s.index === index);
|
|
442
511
|
if (!updatedSvc)
|
|
443
512
|
throw new Error(`Service ${index} disappeared from state`);
|
|
444
513
|
if (updatedSvc.step === 'staked' || updatedSvc.step === 'mech_deployed') {
|
|
445
514
|
state = await this.stepDeployMech(state, mnemonic, index);
|
|
515
|
+
updatedSvc = (await this.store.load(this.chain)).services.find(s => s.index === index);
|
|
516
|
+
}
|
|
517
|
+
if (updatedSvc.step === 'mech_deployed' ||
|
|
518
|
+
updatedSvc.step === 'agent_registered' ||
|
|
519
|
+
updatedSvc.step === 'safe_binding_pending') {
|
|
520
|
+
state = await this.stepRegisterAgent(state, mnemonic, index);
|
|
521
|
+
updatedSvc = (await this.store.load(this.chain)).services.find(s => s.index === index);
|
|
446
522
|
}
|
|
447
523
|
return this.store.load(this.chain);
|
|
448
524
|
}
|
|
@@ -474,6 +550,11 @@ export class FleetBootstrapper {
|
|
|
474
550
|
}
|
|
475
551
|
if (svc.step === 'staked' || svc.step === 'mech_deployed') {
|
|
476
552
|
state = await this.stepDeployMech(state, mnemonic, index);
|
|
553
|
+
svc = (await this.store.load(this.chain)).services.find(s => s.index === index);
|
|
554
|
+
}
|
|
555
|
+
if (svc.step === 'mech_deployed' || svc.step === 'agent_registered' || svc.step === 'safe_binding_pending') {
|
|
556
|
+
state = await this.stepRegisterAgent(state, mnemonic, index);
|
|
557
|
+
svc = (await this.store.load(this.chain)).services.find(s => s.index === index);
|
|
477
558
|
}
|
|
478
559
|
return this.store.load(this.chain);
|
|
479
560
|
}
|
|
@@ -481,7 +562,7 @@ export class FleetBootstrapper {
|
|
|
481
562
|
const svc = state.services.find(s => s.index === index);
|
|
482
563
|
// Idempotency: if this service already has an id and is already staked, skip
|
|
483
564
|
if (svc.service_id !== null) {
|
|
484
|
-
const stakingState = await this.getStakingState(svc.service_id);
|
|
565
|
+
const stakingState = await this.getStakingState(svc.service_id, svc.staking_address);
|
|
485
566
|
if (stakingState === 1) {
|
|
486
567
|
console.error(`[fleet-bootstrap] Service ${index} already staked, skipping`);
|
|
487
568
|
return this.store.updateService(index, { step: 'staked' });
|
|
@@ -551,17 +632,17 @@ export class FleetBootstrapper {
|
|
|
551
632
|
}
|
|
552
633
|
const svc = state.services.find(s => s.index === index);
|
|
553
634
|
const serviceId = svc.service_id;
|
|
554
|
-
|
|
555
|
-
//
|
|
556
|
-
//
|
|
557
|
-
//
|
|
558
|
-
//
|
|
635
|
+
const stakingAddress = this.stakingAddressForService(svc);
|
|
636
|
+
// `reStake()` is operator-scoped: the master EOA must match the
|
|
637
|
+
// distributor's recorded `mapServiceIdCuratingAgents[serviceId]` entry.
|
|
638
|
+
// If it doesn't, the operator is likely using the wrong earning dir or
|
|
639
|
+
// password, or the service needs owner / managing-agent recovery.
|
|
559
640
|
const masterAccount = deriveMasterSigner(mnemonic);
|
|
560
641
|
const masterWallet = createJinnWalletClient(this.config.rpcUrl, this.chain, masterAccount);
|
|
561
642
|
const reStakeData = encodeFunctionData({
|
|
562
643
|
abi: STOLAS_DISTRIBUTOR_ABI,
|
|
563
644
|
functionName: 'reStake',
|
|
564
|
-
args: [
|
|
645
|
+
args: [stakingAddress, BigInt(serviceId)],
|
|
565
646
|
});
|
|
566
647
|
console.error(`[fleet-bootstrap] Service ${index}: calling distributor.reStake() for evicted service ${serviceId}`);
|
|
567
648
|
let reStakeHash;
|
|
@@ -576,10 +657,9 @@ export class FleetBootstrapper {
|
|
|
576
657
|
catch (err) {
|
|
577
658
|
const message = flattenErrorMessage(err);
|
|
578
659
|
if (isUnauthorizedAccountError(message)) {
|
|
579
|
-
throw new Error(`Service ${index} (service_id ${serviceId}) is evicted on the staking proxy
|
|
580
|
-
`
|
|
581
|
-
`
|
|
582
|
-
`(b) abandon this service and provision a new one (stOLAS bond stays with the old Safe until it's manually swept). ` +
|
|
660
|
+
throw new Error(`Service ${index} (service_id ${serviceId}) is evicted on the staking proxy, but master EOA ${masterAccount.address} is not authorized to reStake it. ` +
|
|
661
|
+
`The distributor only permits the recorded service operator, a managing agent, or the owner. ` +
|
|
662
|
+
`Verify JINN_EARNING_DIR and JINN_PASSWORD derive the original master EOA for this service, then re-run jinn bootstrap; otherwise request owner / managing-agent recovery or abandon-and-rebootstrap. ` +
|
|
583
663
|
`reStake revert: ${message}`);
|
|
584
664
|
}
|
|
585
665
|
throw err;
|
|
@@ -590,16 +670,19 @@ export class FleetBootstrapper {
|
|
|
590
670
|
}
|
|
591
671
|
console.error(`[fleet-bootstrap] Service ${index}: reStake confirmed (tx: ${reStakeHash})`);
|
|
592
672
|
// Service is now Staked again with the same service_id, safe_address, and mech_address.
|
|
593
|
-
//
|
|
673
|
+
// Step back to `mech_deployed` so the resume loop advances through
|
|
674
|
+
// `stepRegisterAgent` (idempotent — short-circuits if `agent_id` is
|
|
675
|
+
// already set; mints if a pre-j07 operator was just re-staked and
|
|
676
|
+
// never had the operator agent NFT). See jinn-mono-jgp.
|
|
594
677
|
return this.store.updateService(index, {
|
|
595
|
-
step: '
|
|
678
|
+
step: 'mech_deployed',
|
|
596
679
|
});
|
|
597
680
|
}
|
|
598
681
|
async stepDeployMech(state, mnemonic, index) {
|
|
599
682
|
const svc = state.services.find(s => s.index === index);
|
|
600
683
|
if (svc.mech_address) {
|
|
601
684
|
console.error(`[fleet-bootstrap] Service ${index}: mech already deployed at ${svc.mech_address}`);
|
|
602
|
-
return this.store.updateService(index, { step: '
|
|
685
|
+
return this.store.updateService(index, { step: 'mech_deployed' });
|
|
603
686
|
}
|
|
604
687
|
const serviceId = svc.service_id;
|
|
605
688
|
const safeAddress = svc.safe_address;
|
|
@@ -658,9 +741,173 @@ export class FleetBootstrapper {
|
|
|
658
741
|
console.error(`[fleet-bootstrap] Service ${index}: mech deployed at ${mechAddress}`);
|
|
659
742
|
return this.store.updateService(index, {
|
|
660
743
|
mech_address: mechAddress,
|
|
661
|
-
step: '
|
|
744
|
+
step: 'mech_deployed',
|
|
662
745
|
});
|
|
663
746
|
}
|
|
747
|
+
/**
|
|
748
|
+
* ERC-8004 IdentityRegistry mint + Safe wallet bind (jinn-mono-j07,
|
|
749
|
+
* jinn-mono-aev).
|
|
750
|
+
*
|
|
751
|
+
* Two on-chain effects, gated independently for idempotency:
|
|
752
|
+
*
|
|
753
|
+
* 1. **Mint** (jinn-mono-j07): one operator agent NFT per service Safe;
|
|
754
|
+
* the agent EOA owns the token. Persists `agent_id` (and metadata)
|
|
755
|
+
* to state immediately after the receipt parses, so a crash between
|
|
756
|
+
* register and the subsequent `setAgentWallet` does not lose the
|
|
757
|
+
* token. v0 uses an empty `agentURI` — operators are expected to
|
|
758
|
+
* populate it later via `setAgentURI`. Re-run with `svc.agent_id`
|
|
759
|
+
* already set short-circuits the mint.
|
|
760
|
+
*
|
|
761
|
+
* 2. **Bind** (jinn-mono-aev): `IdentityRegistry.setAgentWallet(agentId,
|
|
762
|
+
* safe, deadline, sig)` from the agent EOA. The contract recovers
|
|
763
|
+
* `sig` against the Safe via ERC-1271; we wrap the EIP-712
|
|
764
|
+
* AgentWalletSet digest in Safe's SafeMessage typed-data and
|
|
765
|
+
* raw-ECDSA-sign with the sole owner (= agent EOA). On success,
|
|
766
|
+
* `safe_bound_to_agent` flips to true. Re-run with
|
|
767
|
+
* `svc.safe_bound_to_agent` already true short-circuits the bind.
|
|
768
|
+
* See `agent-wallet-binding.ts` + spec §4.1.
|
|
769
|
+
*
|
|
770
|
+
* The bind is a discrete operational state (`safe_binding_pending`) because
|
|
771
|
+
* the service is already staked and runnable once the mint exists. A failed
|
|
772
|
+
* binding should be visible and resumable, but should not block the daemon
|
|
773
|
+
* from reaching the running dashboard.
|
|
774
|
+
*/
|
|
775
|
+
async stepRegisterAgent(state, mnemonic, index) {
|
|
776
|
+
void state;
|
|
777
|
+
let svc = (await this.store.load(this.chain)).services.find(s => s.index === index);
|
|
778
|
+
if (!svc)
|
|
779
|
+
throw new Error(`Service ${index} not found in state`);
|
|
780
|
+
const identityRegistry = this.config.identityRegistry
|
|
781
|
+
?? IDENTITY_REGISTRY_ADDRESSES[this.config.chainId];
|
|
782
|
+
if (!identityRegistry) {
|
|
783
|
+
throw new Error(`IdentityRegistry address not configured for chainId=${this.config.chainId}; ` +
|
|
784
|
+
`update IDENTITY_REGISTRY_ADDRESSES in earning/contracts.ts.`);
|
|
785
|
+
}
|
|
786
|
+
const agentSigner = deriveAgentSigner(mnemonic, index);
|
|
787
|
+
const agentWallet = createJinnWalletClient(this.config.rpcUrl, this.chain, agentSigner);
|
|
788
|
+
// ── Sub-step A: mint NFT (skip if agent_id is already set). ─────────
|
|
789
|
+
let agentId;
|
|
790
|
+
if (svc.agent_id) {
|
|
791
|
+
console.error(`[fleet-bootstrap] Service ${index}: ERC-8004 agent already registered ` +
|
|
792
|
+
`(agentId=${svc.agent_id}); skipping mint.`);
|
|
793
|
+
agentId = svc.agent_id;
|
|
794
|
+
svc = await this.firstServiceUpdate(index, {
|
|
795
|
+
identity_registry_address: svc.identity_registry_address ?? getAddress(identityRegistry),
|
|
796
|
+
step: svc.step === 'safe_binding_pending' ? 'safe_binding_pending' : 'agent_registered',
|
|
797
|
+
});
|
|
798
|
+
}
|
|
799
|
+
else {
|
|
800
|
+
// v0: empty agentURI. The richer agent card (per §6 of the spec) is
|
|
801
|
+
// future work — operators may later call `setAgentURI`.
|
|
802
|
+
const agentURI = '';
|
|
803
|
+
const registerData = encodeFunctionData({
|
|
804
|
+
abi: IDENTITY_REGISTRY_ABI,
|
|
805
|
+
functionName: 'register',
|
|
806
|
+
args: [agentURI],
|
|
807
|
+
});
|
|
808
|
+
console.error(`[fleet-bootstrap] Service ${index}: minting ERC-8004 agent NFT ` +
|
|
809
|
+
`(IdentityRegistry=${identityRegistry}, agentEOA=${agentSigner.address})`);
|
|
810
|
+
const mintTxHash = await viemSendTransactionWithRetry(agentWallet, this.publicClient, {
|
|
811
|
+
account: agentSigner,
|
|
812
|
+
to: addr(identityRegistry),
|
|
813
|
+
data: registerData,
|
|
814
|
+
});
|
|
815
|
+
const receipt = await waitForTransactionReceiptWithRetry(this.publicClient, mintTxHash);
|
|
816
|
+
if (receipt.status !== 'success') {
|
|
817
|
+
throw new Error(`IdentityRegistry.register() tx failed for service ${index}: ${mintTxHash}`);
|
|
818
|
+
}
|
|
819
|
+
const parsed = this.parseAgentIdFromReceipt(receipt, identityRegistry);
|
|
820
|
+
if (parsed === null) {
|
|
821
|
+
throw new Error(`IdentityRegistry.register() succeeded but Registered event was not found ` +
|
|
822
|
+
`(service ${index}, tx: ${mintTxHash})`);
|
|
823
|
+
}
|
|
824
|
+
agentId = parsed;
|
|
825
|
+
console.error(`[fleet-bootstrap] Service ${index}: ERC-8004 agent registered ` +
|
|
826
|
+
`(agentId=${agentId}, tx=${mintTxHash})`);
|
|
827
|
+
// Persist agentId IMMEDIATELY so a crash between this write and the
|
|
828
|
+
// setAgentWallet call below does not lose the token.
|
|
829
|
+
svc = await this.firstServiceUpdate(index, {
|
|
830
|
+
agent_id: agentId,
|
|
831
|
+
agent_uri: agentURI,
|
|
832
|
+
identity_registry_address: getAddress(identityRegistry),
|
|
833
|
+
agent_registered_tx: mintTxHash,
|
|
834
|
+
step: 'agent_registered',
|
|
835
|
+
error: null,
|
|
836
|
+
});
|
|
837
|
+
}
|
|
838
|
+
// ── Sub-step B: bind Safe wallet via ERC-1271 (jinn-mono-aev). ──────
|
|
839
|
+
// Idempotent: skip when already bound. Requires safe_address — if the
|
|
840
|
+
// operator is in a topology without a Safe (future), the bind step is
|
|
841
|
+
// simply not applicable and `safe_bound_to_agent` stays false.
|
|
842
|
+
if (svc.safe_bound_to_agent) {
|
|
843
|
+
console.error(`[fleet-bootstrap] Service ${index}: Safe already bound to agentId=${agentId} ` +
|
|
844
|
+
`(safe=${svc.safe_address}); skipping setAgentWallet.`);
|
|
845
|
+
svc = await this.firstServiceUpdate(index, {
|
|
846
|
+
step: 'complete',
|
|
847
|
+
error: null,
|
|
848
|
+
});
|
|
849
|
+
}
|
|
850
|
+
else if (!svc.safe_address) {
|
|
851
|
+
console.error(`[fleet-bootstrap] Service ${index}: no safe_address — cannot bind agent NFT ` +
|
|
852
|
+
`(agentId=${agentId}). Bootstrap will leave safe_bound_to_agent=false; this is ` +
|
|
853
|
+
`unexpected for the standard staking topology.`);
|
|
854
|
+
svc = await this.firstServiceUpdate(index, {
|
|
855
|
+
step: 'safe_binding_pending',
|
|
856
|
+
error: 'safe_address_missing_for_agent_wallet_binding',
|
|
857
|
+
});
|
|
858
|
+
}
|
|
859
|
+
else {
|
|
860
|
+
const safeAddress = svc.safe_address;
|
|
861
|
+
console.error(`[fleet-bootstrap] Service ${index}: binding Safe ${safeAddress} to ` +
|
|
862
|
+
`agentId=${agentId} via setAgentWallet (ERC-1271).`);
|
|
863
|
+
svc = await this.firstServiceUpdate(index, {
|
|
864
|
+
step: 'safe_binding_pending',
|
|
865
|
+
error: null,
|
|
866
|
+
});
|
|
867
|
+
try {
|
|
868
|
+
const result = await bindAgentWalletToSafe({
|
|
869
|
+
identityRegistryAddress: addr(identityRegistry),
|
|
870
|
+
agentId: BigInt(agentId),
|
|
871
|
+
safeAddress: addr(safeAddress),
|
|
872
|
+
agentEoaAccount: agentSigner,
|
|
873
|
+
agentEoaWalletClient: agentWallet,
|
|
874
|
+
publicClient: this.publicClient,
|
|
875
|
+
chainId: this.config.chainId,
|
|
876
|
+
});
|
|
877
|
+
console.error(`[fleet-bootstrap] Service ${index}: setAgentWallet succeeded ` +
|
|
878
|
+
`(tx=${result.txHash}, safe=${safeAddress}).`);
|
|
879
|
+
svc = await this.firstServiceUpdate(index, {
|
|
880
|
+
safe_bound_to_agent: true,
|
|
881
|
+
step: 'complete',
|
|
882
|
+
error: null,
|
|
883
|
+
});
|
|
884
|
+
}
|
|
885
|
+
catch (err) {
|
|
886
|
+
const reason = err instanceof Error ? err.message : String(err);
|
|
887
|
+
console.error(`[fleet-bootstrap] Service ${index}: setAgentWallet failed; continuing with ` +
|
|
888
|
+
`safe_bound_to_agent=false (${reason}).`);
|
|
889
|
+
svc = await this.firstServiceUpdate(index, {
|
|
890
|
+
safe_bound_to_agent: false,
|
|
891
|
+
step: 'safe_binding_pending',
|
|
892
|
+
error: `safe_binding_failed: ${reason}`,
|
|
893
|
+
});
|
|
894
|
+
}
|
|
895
|
+
}
|
|
896
|
+
return this.store.load(this.chain);
|
|
897
|
+
}
|
|
898
|
+
/**
|
|
899
|
+
* Tiny store wrapper: re-loads the service row after `updateService` so
|
|
900
|
+
* the next sub-step sees the latest persisted shape (including any
|
|
901
|
+
* fields written by sibling code paths since this fn started).
|
|
902
|
+
*/
|
|
903
|
+
async firstServiceUpdate(index, patch) {
|
|
904
|
+
await this.store.updateService(index, patch);
|
|
905
|
+
const fleet = await this.store.load(this.chain);
|
|
906
|
+
const svc = fleet.services.find(s => s.index === index);
|
|
907
|
+
if (!svc)
|
|
908
|
+
throw new Error(`Service ${index} not found after update`);
|
|
909
|
+
return svc;
|
|
910
|
+
}
|
|
664
911
|
// ── Self-bond step handlers ──────────────────────────────────────────
|
|
665
912
|
async stepSelfBondSetup(state, mnemonic, index) {
|
|
666
913
|
const svc = state.services.find(s => s.index === index);
|
|
@@ -1032,9 +1279,22 @@ export class FleetBootstrapper {
|
|
|
1032
1279
|
}
|
|
1033
1280
|
console.error(`[fleet-bootstrap] Preflight passed: ${slotsRemaining} slots remaining`);
|
|
1034
1281
|
}
|
|
1035
|
-
|
|
1282
|
+
stakingAddressForService(svc) {
|
|
1283
|
+
return addr(svc.staking_address ?? this.config.stakingContract);
|
|
1284
|
+
}
|
|
1285
|
+
shouldPreserveExistingSetup(svc) {
|
|
1286
|
+
if (this.stakingMode !== 'standard' || !svc.staking_address)
|
|
1287
|
+
return false;
|
|
1288
|
+
try {
|
|
1289
|
+
return getAddress(svc.staking_address) !== getAddress(this.config.stakingContract);
|
|
1290
|
+
}
|
|
1291
|
+
catch {
|
|
1292
|
+
return true;
|
|
1293
|
+
}
|
|
1294
|
+
}
|
|
1295
|
+
async getStakingState(serviceId, stakingAddress) {
|
|
1036
1296
|
return Number(await this.publicClient.readContract({
|
|
1037
|
-
address: this.config.stakingContract,
|
|
1297
|
+
address: addr(stakingAddress ?? this.config.stakingContract),
|
|
1038
1298
|
abi: STAKING_ABI,
|
|
1039
1299
|
functionName: 'getStakingState',
|
|
1040
1300
|
args: [BigInt(serviceId)],
|
|
@@ -1075,6 +1335,39 @@ export class FleetBootstrapper {
|
|
|
1075
1335
|
}
|
|
1076
1336
|
return null;
|
|
1077
1337
|
}
|
|
1338
|
+
/**
|
|
1339
|
+
* Extract `agentId` from an `IdentityRegistry.Registered` log emitted in
|
|
1340
|
+
* the receipt. Filters by `(address, topic[0])` first to avoid colliding
|
|
1341
|
+
* with any other contract that happens to share the event signature.
|
|
1342
|
+
*
|
|
1343
|
+
* Returns the agentId as a decimal string (uint256) so it round-trips
|
|
1344
|
+
* cleanly through JSON-persisted EarningState.
|
|
1345
|
+
*/
|
|
1346
|
+
parseAgentIdFromReceipt(receipt, identityRegistry) {
|
|
1347
|
+
const topic = EVENT_TOPICS.Registered;
|
|
1348
|
+
const target = identityRegistry.toLowerCase();
|
|
1349
|
+
for (const log of receipt.logs) {
|
|
1350
|
+
if (log.address.toLowerCase() !== target)
|
|
1351
|
+
continue;
|
|
1352
|
+
if (log.topics[0] !== topic)
|
|
1353
|
+
continue;
|
|
1354
|
+
try {
|
|
1355
|
+
const decoded = decodeEventLog({
|
|
1356
|
+
abi: IDENTITY_REGISTRY_ABI,
|
|
1357
|
+
data: log.data,
|
|
1358
|
+
topics: log.topics,
|
|
1359
|
+
strict: false,
|
|
1360
|
+
});
|
|
1361
|
+
if (decoded.eventName === 'Registered' && 'agentId' in decoded.args) {
|
|
1362
|
+
return decoded.args.agentId.toString();
|
|
1363
|
+
}
|
|
1364
|
+
}
|
|
1365
|
+
catch {
|
|
1366
|
+
// Not a matching event
|
|
1367
|
+
}
|
|
1368
|
+
}
|
|
1369
|
+
return null;
|
|
1370
|
+
}
|
|
1078
1371
|
}
|
|
1079
1372
|
/** @deprecated Use FleetBootstrapper */
|
|
1080
1373
|
export const EarningBootstrapper = FleetBootstrapper;
|