@jinn-network/client 0.1.6 → 0.1.7-canary.08ebd916
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 +33 -0
- package/README.md +67 -1
- package/deployments/deployment-jinn-mvi-l1-sepolia-fast.json +23 -4
- package/deployments/deployment-jinn-mvi-l1-sepolia.json +23 -4
- package/deployments/deployment-jinn-mvi-l2-baseSepolia.json +5 -4
- package/dist/adapters/mech/adapter.d.ts +38 -2
- package/dist/adapters/mech/adapter.js +269 -62
- package/dist/adapters/mech/adapter.js.map +1 -1
- package/dist/adapters/mech/contracts.d.ts +17 -4
- package/dist/adapters/mech/contracts.js +8 -2
- package/dist/adapters/mech/contracts.js.map +1 -1
- package/dist/adapters/mech/safe-revert.d.ts +20 -0
- package/dist/adapters/mech/safe-revert.js +12 -4
- package/dist/adapters/mech/safe-revert.js.map +1 -1
- package/dist/adapters/mech/safe.d.ts +6 -2
- package/dist/adapters/mech/safe.js +32 -11
- package/dist/adapters/mech/safe.js.map +1 -1
- package/dist/adapters/mech/types.d.ts +6 -1
- package/dist/adapters/mech/types.js.map +1 -1
- package/dist/adapters/mech/verdict-code.d.ts +1 -0
- package/dist/adapters/mech/verdict-code.js +18 -0
- package/dist/adapters/mech/verdict-code.js.map +1 -1
- package/dist/agent/operator-claude.js +8 -0
- package/dist/agent/operator-claude.js.map +1 -1
- package/dist/api/activity-events-endpoint.d.ts +14 -0
- package/dist/api/activity-events-endpoint.js +59 -0
- package/dist/api/activity-events-endpoint.js.map +1 -0
- package/dist/api/admin-endpoint.d.ts +15 -3
- package/dist/api/admin-endpoint.js +24 -2
- package/dist/api/admin-endpoint.js.map +1 -1
- package/dist/api/bootstrap-endpoint.d.ts +1 -2
- package/dist/api/bootstrap-endpoint.js +85 -18
- package/dist/api/bootstrap-endpoint.js.map +1 -1
- package/dist/api/codex-doctor-endpoint.d.ts +90 -0
- package/dist/api/codex-doctor-endpoint.js +296 -0
- package/dist/api/codex-doctor-endpoint.js.map +1 -0
- package/dist/api/discovery-endpoint.d.ts +1 -0
- package/dist/api/discovery-endpoint.js +26 -0
- package/dist/api/discovery-endpoint.js.map +1 -1
- package/dist/api/fleet-build.d.ts +1 -0
- package/dist/api/fleet-build.js +2 -1
- package/dist/api/fleet-build.js.map +1 -1
- package/dist/api/gather-status.d.ts +37 -0
- package/dist/api/gather-status.js +572 -19
- package/dist/api/gather-status.js.map +1 -1
- package/dist/api/hermes-doctor-endpoint.d.ts +128 -3
- package/dist/api/hermes-doctor-endpoint.js +265 -22
- package/dist/api/hermes-doctor-endpoint.js.map +1 -1
- package/dist/api/launcher-status.d.ts +25 -17
- package/dist/api/launcher-status.js +13 -11
- package/dist/api/launcher-status.js.map +1 -1
- package/dist/api/launcher-tasks.d.ts +1 -1
- package/dist/api/launcher-tasks.js +12 -8
- package/dist/api/launcher-tasks.js.map +1 -1
- package/dist/api/operator-artifacts-endpoint.js +73 -6
- package/dist/api/operator-artifacts-endpoint.js.map +1 -1
- package/dist/api/portfolio-v0-build.d.ts +10 -0
- package/dist/api/portfolio-v0-build.js +24 -5
- package/dist/api/portfolio-v0-build.js.map +1 -1
- package/dist/api/prediction-v1-build.d.ts +10 -0
- package/dist/api/prediction-v1-build.js +7 -1
- package/dist/api/prediction-v1-build.js.map +1 -1
- package/dist/api/server.d.ts +31 -1
- package/dist/api/server.js +95 -2
- package/dist/api/server.js.map +1 -1
- package/dist/api/setup-endpoints.d.ts +16 -0
- package/dist/api/setup-endpoints.js +89 -135
- package/dist/api/setup-endpoints.js.map +1 -1
- package/dist/api/setup-retry-endpoint.d.ts +19 -0
- package/dist/api/setup-retry-endpoint.js +32 -0
- package/dist/api/setup-retry-endpoint.js.map +1 -0
- package/dist/api/solvernets-endpoints.d.ts +8 -0
- package/dist/api/solvernets-endpoints.js +99 -60
- package/dist/api/solvernets-endpoints.js.map +1 -1
- package/dist/api/status-build.d.ts +168 -2
- package/dist/api/status-build.js +116 -27
- package/dist/api/status-build.js.map +1 -1
- package/dist/api/status-harness-rollup.d.ts +35 -0
- package/dist/api/status-harness-rollup.js +45 -0
- package/dist/api/status-harness-rollup.js.map +1 -0
- package/dist/api/task-run-routing.d.ts +7 -0
- package/dist/api/task-run-routing.js +12 -0
- package/dist/api/task-run-routing.js.map +1 -0
- package/dist/api/task-runs-build.d.ts +21 -0
- package/dist/api/task-runs-build.js +14 -1
- package/dist/api/task-runs-build.js.map +1 -1
- package/dist/build-info.json +4 -4
- package/dist/build-meta.json +1 -1
- package/dist/captures/live-publisher.js +24 -4
- package/dist/captures/live-publisher.js.map +1 -1
- package/dist/captures/publish.d.ts +1 -1
- package/dist/chain-read-errors.d.ts +10 -0
- package/dist/chain-read-errors.js +15 -0
- package/dist/chain-read-errors.js.map +1 -1
- package/dist/cli/commands/auth.js +1 -1
- package/dist/cli/commands/auth.js.map +1 -1
- package/dist/cli/commands/create.js +3 -2
- package/dist/cli/commands/create.js.map +1 -1
- package/dist/cli/commands/doctor.d.ts +2 -0
- package/dist/cli/commands/doctor.js +2 -0
- package/dist/cli/commands/doctor.js.map +1 -1
- package/dist/cli/commands/rewards.js +11 -7
- package/dist/cli/commands/rewards.js.map +1 -1
- package/dist/cli/commands/solver-nets.js +101 -15
- package/dist/cli/commands/solver-nets.js.map +1 -1
- package/dist/cli/commands/solver-plugins-block.d.ts +33 -0
- package/dist/cli/commands/solver-plugins-block.js +118 -0
- package/dist/cli/commands/solver-plugins-block.js.map +1 -0
- package/dist/cli/commands/solver-plugins-feedback.d.ts +72 -0
- package/dist/cli/commands/solver-plugins-feedback.js +262 -0
- package/dist/cli/commands/solver-plugins-feedback.js.map +1 -0
- package/dist/cli/commands/solver-plugins-read.d.ts +54 -0
- package/dist/cli/commands/solver-plugins-read.js +259 -0
- package/dist/cli/commands/solver-plugins-read.js.map +1 -0
- package/dist/cli/commands/solver-plugins.d.ts +35 -0
- package/dist/cli/commands/solver-plugins.js +399 -2
- package/dist/cli/commands/solver-plugins.js.map +1 -1
- package/dist/cli/commands/status.js +1 -1
- package/dist/cli/commands/status.js.map +1 -1
- package/dist/cli/commands/tasks.js +101 -11
- package/dist/cli/commands/tasks.js.map +1 -1
- package/dist/cli/commands/update.d.ts +10 -0
- package/dist/cli/commands/update.js +36 -0
- package/dist/cli/commands/update.js.map +1 -1
- package/dist/cli/introspection-context.js +5 -0
- package/dist/cli/introspection-context.js.map +1 -1
- package/dist/cli/task-native-readiness.d.ts +10 -1
- package/dist/cli/task-native-readiness.js +30 -6
- package/dist/cli/task-native-readiness.js.map +1 -1
- package/dist/config.d.ts +273 -235
- package/dist/config.js +305 -114
- package/dist/config.js.map +1 -1
- package/dist/daemon/checkpoint-loop.d.ts +48 -0
- package/dist/daemon/checkpoint-loop.js +76 -0
- package/dist/daemon/checkpoint-loop.js.map +1 -0
- package/dist/daemon/creator.d.ts +1 -1
- package/dist/daemon/creator.js +7 -3
- package/dist/daemon/creator.js.map +1 -1
- package/dist/daemon/daemon.d.ts +22 -0
- package/dist/daemon/daemon.js +156 -23
- package/dist/daemon/daemon.js.map +1 -1
- package/dist/daemon/eviction-loop.d.ts +40 -0
- package/dist/daemon/eviction-loop.js +67 -0
- package/dist/daemon/eviction-loop.js.map +1 -0
- package/dist/daemon/gate-logger.d.ts +9 -0
- package/dist/daemon/gate-logger.js +2 -0
- package/dist/daemon/gate-logger.js.map +1 -0
- package/dist/daemon/jinn-claim-loop-wiring.d.ts +33 -0
- package/dist/daemon/jinn-claim-loop-wiring.js +40 -0
- package/dist/daemon/jinn-claim-loop-wiring.js.map +1 -0
- package/dist/daemon/jinn-claim-loop.d.ts +24 -17
- package/dist/daemon/jinn-claim-loop.js +77 -23
- package/dist/daemon/jinn-claim-loop.js.map +1 -1
- package/dist/daemon/readiness-gate.d.ts +1 -4
- package/dist/daemon/readiness-gate.js.map +1 -1
- package/dist/daemon/skip-log-dedup.d.ts +69 -0
- package/dist/daemon/skip-log-dedup.js +106 -0
- package/dist/daemon/skip-log-dedup.js.map +1 -0
- package/dist/daemon/spend-cap-gate.d.ts +40 -0
- package/dist/daemon/spend-cap-gate.js +46 -0
- package/dist/daemon/spend-cap-gate.js.map +1 -0
- package/dist/dashboard/assets/index-C4huIsUW.css +32 -0
- package/dist/dashboard/assets/index-DkTglWXU.js +345 -0
- package/dist/dashboard/index.html +2 -2
- package/dist/discovery/factory.d.ts +17 -5
- package/dist/discovery/factory.js +46 -18
- package/dist/discovery/factory.js.map +1 -1
- package/dist/discovery/http.js +216 -3
- package/dist/discovery/http.js.map +1 -1
- package/dist/discovery/onchain.d.ts +5 -0
- package/dist/discovery/onchain.js +418 -15
- package/dist/discovery/onchain.js.map +1 -1
- package/dist/discovery/types.d.ts +75 -1
- package/dist/discovery/types.js +8 -10
- package/dist/discovery/types.js.map +1 -1
- package/dist/discovery/with-fallback.d.ts +7 -0
- package/dist/discovery/with-fallback.js +20 -0
- package/dist/discovery/with-fallback.js.map +1 -1
- package/dist/earning/bootstrap.d.ts +100 -4
- package/dist/earning/bootstrap.js +221 -74
- package/dist/earning/bootstrap.js.map +1 -1
- package/dist/earning/contracts.d.ts +14 -0
- package/dist/earning/contracts.js +17 -5
- package/dist/earning/contracts.js.map +1 -1
- package/dist/earning/funding-plan.js +27 -18
- package/dist/earning/funding-plan.js.map +1 -1
- package/dist/earning/jinn-rewards.d.ts +46 -0
- package/dist/earning/jinn-rewards.js +32 -0
- package/dist/earning/jinn-rewards.js.map +1 -1
- package/dist/earning/safe-adapter.d.ts +2 -0
- package/dist/earning/safe-adapter.js +37 -11
- package/dist/earning/safe-adapter.js.map +1 -1
- package/dist/earning/store.d.ts +8 -0
- package/dist/earning/store.js.map +1 -1
- package/dist/earning/testnet-setup-migration.d.ts +12 -0
- package/dist/earning/testnet-setup-migration.js +27 -1
- package/dist/earning/testnet-setup-migration.js.map +1 -1
- package/dist/earning/types.d.ts +21 -6
- package/dist/earning/viem-clients.d.ts +11 -4
- package/dist/earning/viem-clients.js +14 -5
- package/dist/earning/viem-clients.js.map +1 -1
- package/dist/erc8004/identity.d.ts +19 -3
- package/dist/erc8004/identity.js +21 -6
- package/dist/erc8004/identity.js.map +1 -1
- package/dist/erc8004/index.d.ts +1 -1
- package/dist/erc8004/index.js.map +1 -1
- package/dist/erc8004/reputation.d.ts +8 -0
- package/dist/erc8004/reputation.js +22 -3
- package/dist/erc8004/reputation.js.map +1 -1
- package/dist/events/types.d.ts +2 -2
- package/dist/harnesses/cost-estimates.d.ts +145 -0
- package/dist/harnesses/cost-estimates.js +297 -0
- package/dist/harnesses/cost-estimates.js.map +1 -0
- package/dist/harnesses/engine/engine.d.ts +78 -0
- package/dist/harnesses/engine/engine.js +153 -11
- package/dist/harnesses/engine/engine.js.map +1 -1
- package/dist/harnesses/engine/persistence.d.ts +51 -1
- package/dist/harnesses/engine/persistence.js +118 -5
- package/dist/harnesses/engine/persistence.js.map +1 -1
- package/dist/harnesses/engine/work-dir-reaper.d.ts +65 -0
- package/dist/harnesses/engine/work-dir-reaper.js +100 -0
- package/dist/harnesses/engine/work-dir-reaper.js.map +1 -0
- package/dist/harnesses/impls/hermes-agent/adapter.js +40 -0
- package/dist/harnesses/impls/hermes-agent/adapter.js.map +1 -1
- package/dist/harnesses/impls/hermes-agent/bootstrap.d.ts +20 -0
- package/dist/harnesses/impls/hermes-agent/bootstrap.js +40 -6
- package/dist/harnesses/impls/hermes-agent/bootstrap.js.map +1 -1
- package/dist/harnesses/impls/hermes-agent/harness.d.ts +59 -1
- package/dist/harnesses/impls/hermes-agent/harness.js +104 -0
- package/dist/harnesses/impls/hermes-agent/harness.js.map +1 -1
- package/dist/harnesses/impls/hermes-agent/prompt.d.ts +6 -6
- package/dist/harnesses/impls/hermes-agent/prompt.js +6 -6
- package/dist/harnesses/impls/index.d.ts +7 -0
- package/dist/harnesses/impls/index.js +16 -1
- package/dist/harnesses/impls/index.js.map +1 -1
- package/dist/harnesses/impls/learner/adapters/codex-code.d.ts +9 -0
- package/dist/harnesses/impls/learner/adapters/codex-code.js +30 -8
- package/dist/harnesses/impls/learner/adapters/codex-code.js.map +1 -1
- package/dist/harnesses/impls/learner/harness.d.ts +38 -4
- package/dist/harnesses/impls/learner/harness.js +96 -2
- package/dist/harnesses/impls/learner/harness.js.map +1 -1
- package/dist/harnesses/impls/learner/harvest.d.ts +1 -1
- package/dist/harnesses/impls/learner/harvest.js +23 -5
- package/dist/harnesses/impls/learner/harvest.js.map +1 -1
- package/dist/harnesses/impls/learner/plugin-path.d.ts +0 -13
- package/dist/harnesses/impls/learner/plugin-path.js +35 -15
- package/dist/harnesses/impls/learner/plugin-path.js.map +1 -1
- package/dist/harnesses/impls/learner/restoration-patch.d.ts +2 -2
- package/dist/harnesses/impls/learner/restoration-patch.js +25 -6
- package/dist/harnesses/impls/learner/restoration-patch.js.map +1 -1
- package/dist/harnesses/impls/learner/types.d.ts +11 -0
- package/dist/harnesses/impls/stub.d.ts +58 -0
- package/dist/harnesses/impls/stub.js +89 -0
- package/dist/harnesses/impls/stub.js.map +1 -0
- package/dist/harnesses/impls/swe-rebench-v2-evaluator/eval-runner.d.ts +69 -50
- package/dist/harnesses/impls/swe-rebench-v2-evaluator/eval-runner.js +178 -93
- package/dist/harnesses/impls/swe-rebench-v2-evaluator/eval-runner.js.map +1 -1
- package/dist/harnesses/impls/swe-rebench-v2-evaluator/harness.d.ts +12 -1
- package/dist/harnesses/impls/swe-rebench-v2-evaluator/harness.js +121 -7
- package/dist/harnesses/impls/swe-rebench-v2-evaluator/harness.js.map +1 -1
- package/dist/harnesses/impls/swe-rebench-v2-evaluator/hf-fetcher.d.ts +88 -4
- package/dist/harnesses/impls/swe-rebench-v2-evaluator/hf-fetcher.js +143 -22
- package/dist/harnesses/impls/swe-rebench-v2-evaluator/hf-fetcher.js.map +1 -1
- package/dist/harnesses/impls/swe-rebench-v2-evaluator/index.d.ts +6 -0
- package/dist/harnesses/impls/swe-rebench-v2-evaluator/index.js +1 -1
- package/dist/harnesses/impls/swe-rebench-v2-evaluator/index.js.map +1 -1
- package/dist/harnesses/readiness-registry.d.ts +7 -0
- package/dist/harnesses/readiness-registry.js +18 -1
- package/dist/harnesses/readiness-registry.js.map +1 -1
- package/dist/main.js +419 -111
- package/dist/main.js.map +1 -1
- package/dist/observability/emit-event.d.ts +3 -2
- package/dist/observability/emit-event.js +22 -1
- package/dist/observability/emit-event.js.map +1 -1
- package/dist/operator-errors.d.ts +7 -0
- package/dist/operator-errors.js +13 -1
- package/dist/operator-errors.js.map +1 -1
- package/dist/plugins/learner/.claude-plugin/plugin.json +9 -0
- package/dist/plugins/learner/.codex-plugin/plugin.json +39 -0
- package/dist/plugins/learner/AGENTS.md +40 -0
- package/dist/plugins/learner/CLAUDE.md +33 -0
- package/dist/plugins/learner/README.md +59 -0
- package/dist/plugins/learner/hooks/hooks.json +16 -0
- package/dist/plugins/learner/hooks/session-start +38 -0
- package/dist/plugins/learner/skills/learn/SKILL.md +412 -0
- package/dist/plugins/learner/skills/learn/analyst-prompt.md +68 -0
- package/dist/plugins/learner/skills/learn/consolidator-prompt.md +94 -0
- package/dist/plugins/learner/skills/learn/explorer-prompt.md +53 -0
- package/dist/plugins/learner/skills/learn/planner-prompt.md +87 -0
- package/dist/plugins/learner/skills/learn/promoter-prompt.md +113 -0
- package/dist/plugins/learner/skills/learn/step-worker-prompt.md +47 -0
- package/dist/plugins/learner/skills/learn/strategist-prompt.md +85 -0
- package/dist/preflight/rpc-network.d.ts +40 -0
- package/dist/preflight/rpc-network.js +67 -1
- package/dist/preflight/rpc-network.js.map +1 -1
- package/dist/restart-daemon.d.ts +90 -0
- package/dist/restart-daemon.js +95 -0
- package/dist/restart-daemon.js.map +1 -0
- package/dist/rpc/transport.d.ts +109 -0
- package/dist/rpc/transport.js +220 -0
- package/dist/rpc/transport.js.map +1 -0
- package/dist/scripts/donation-consumption-acceptance.js +7 -28
- package/dist/scripts/donation-consumption-acceptance.js.map +1 -1
- package/dist/setup/halt-mode.d.ts +14 -0
- package/dist/setup/halt-mode.js +17 -0
- package/dist/setup/halt-mode.js.map +1 -0
- package/dist/solver-nets/prediction-operator-ux.d.ts +1 -2
- package/dist/solver-nets/prediction-operator-ux.js +90 -47
- package/dist/solver-nets/prediction-operator-ux.js.map +1 -1
- package/dist/solver-nets/registry.d.ts +20 -1
- package/dist/solver-nets/registry.js +38 -25
- package/dist/solver-nets/registry.js.map +1 -1
- package/dist/solver-types/_swe-rebench-v2-pool-cache.d.ts +58 -0
- package/dist/solver-types/_swe-rebench-v2-pool-cache.js +87 -0
- package/dist/solver-types/_swe-rebench-v2-pool-cache.js.map +1 -0
- package/dist/solver-types/_swe-rebench-v2-pool.d.ts +9 -2
- package/dist/solver-types/_swe-rebench-v2-pool.js +15 -20
- package/dist/solver-types/_swe-rebench-v2-pool.js.map +1 -1
- package/dist/solver-types/_swe-rebench-v2-substrate.d.ts +1 -0
- package/dist/solver-types/_swe-rebench-v2-substrate.js +10 -0
- package/dist/solver-types/_swe-rebench-v2-substrate.js.map +1 -1
- package/dist/solver-types/_swe-rebench-v2-validated-pool.d.ts +94 -1
- package/dist/solver-types/_swe-rebench-v2-validated-pool.js +305 -39
- package/dist/solver-types/_swe-rebench-v2-validated-pool.js.map +1 -1
- package/dist/solver-types/swe-rebench-v2-auto.d.ts +22 -7
- package/dist/solver-types/swe-rebench-v2-auto.js +57 -20
- package/dist/solver-types/swe-rebench-v2-auto.js.map +1 -1
- package/dist/solver-types/swe-rebench-v2.d.ts +18 -2
- package/dist/solver-types/swe-rebench-v2.js +310 -94
- package/dist/solver-types/swe-rebench-v2.js.map +1 -1
- package/dist/solvernets/daemon-init.d.ts +10 -2
- package/dist/solvernets/daemon-init.js +22 -2
- package/dist/solvernets/daemon-init.js.map +1 -1
- package/dist/solvernets/launched-record-dispatcher.d.ts +4 -0
- package/dist/solvernets/launched-record-dispatcher.js +44 -7
- package/dist/solvernets/launched-record-dispatcher.js.map +1 -1
- package/dist/solvernets/store.d.ts +5 -0
- package/dist/solvernets/store.js +1 -0
- package/dist/solvernets/store.js.map +1 -1
- package/dist/spend/credential.d.ts +8 -0
- package/dist/spend/credential.js +30 -0
- package/dist/spend/credential.js.map +1 -0
- package/dist/spend/daemon-config.d.ts +13 -0
- package/dist/spend/daemon-config.js +24 -0
- package/dist/spend/daemon-config.js.map +1 -0
- package/dist/spend/pricing.d.ts +16 -0
- package/dist/spend/pricing.js +26 -0
- package/dist/spend/pricing.js.map +1 -0
- package/dist/spend/record.d.ts +13 -0
- package/dist/spend/record.js +30 -0
- package/dist/spend/record.js.map +1 -0
- package/dist/spend/usage.d.ts +27 -0
- package/dist/spend/usage.js +113 -0
- package/dist/spend/usage.js.map +1 -0
- package/dist/store/store.d.ts +61 -0
- package/dist/store/store.js +302 -7
- package/dist/store/store.js.map +1 -1
- package/dist/tasks/sources.d.ts +18 -1
- package/dist/tasks/sources.js +33 -5
- package/dist/tasks/sources.js.map +1 -1
- package/dist/trajectory/transcript-parsers/types.d.ts +8 -8
- package/dist/tx-retry.d.ts +166 -19
- package/dist/tx-retry.js +310 -32
- package/dist/tx-retry.js.map +1 -1
- package/dist/types/payloads/prediction-apy-v0.d.ts +5 -5
- package/dist/types/payloads/prediction-v0.d.ts +5 -5
- package/dist/types/task-document.d.ts +392 -0
- package/dist/types/task-document.js +10 -0
- package/dist/types/task-document.js.map +1 -1
- package/dist/types/task.d.ts +28 -0
- package/dist/util/extract-tx-hash.d.ts +14 -0
- package/dist/util/extract-tx-hash.js +19 -0
- package/dist/util/extract-tx-hash.js.map +1 -0
- package/dist/vendor/@jinn-network/sdk/dist/contracts.js +1 -1
- package/dist/vendor/@jinn-network/sdk/dist/solvernets/manifest-schema.d.ts +3 -0
- package/dist/vendor/@jinn-network/sdk/dist/solvernets/manifest-schema.js +1 -0
- package/package.json +36 -13
- package/plugins/swe-rebench-v2-diffmin/README.md +10 -9
- package/plugins/swe-rebench-v2-diffmin/jinn.plugin.json +1 -1
- package/plugins/swe-rebench-v2-diffmin/skills/diffmin/SKILL.md +15 -10
- package/plugins/swe-rebench-v2-diffmin/skills/test-map/SKILL.md +10 -12
- package/plugins/swe-rebench-v2-runtime/.claude-plugin/plugin.json +1 -1
- package/plugins/swe-rebench-v2-runtime/.codex-plugin/plugin.json +3 -3
- package/plugins/swe-rebench-v2-runtime/README.md +6 -6
- package/plugins/swe-rebench-v2-runtime/jinn.plugin.json +2 -3
- package/plugins/swe-rebench-v2-runtime/skills/task/SKILL.md +69 -0
- package/dist/dashboard/assets/index-DOlzFN8a.css +0 -32
- package/dist/dashboard/assets/index-NkZ7CTAT.js +0 -140
- package/plugins/swe-rebench-v2-runtime/skills/orient/SKILL.md +0 -29
- package/plugins/swe-rebench-v2-runtime/skills/plan/SKILL.md +0 -53
|
@@ -20,11 +20,95 @@ import { isUnauthorizedAccountError } from '../errors/unauthorized-account.js';
|
|
|
20
20
|
import { createJinnPublicClient, createJinnWalletClient } from './viem-clients.js';
|
|
21
21
|
import { isTransientEthReadError } from '../chain-read-errors.js';
|
|
22
22
|
import { nextFleetServiceIndex } from './next-service-index.js';
|
|
23
|
+
import { displayFleetServiceIndex } from './fleet-display-index.js';
|
|
23
24
|
import { rpcHostForDisplay } from '../preflight/rpc-network.js';
|
|
24
25
|
import { detectDeprecatedTestnetSetup, migrateDeprecatedTestnetSetup, } from './testnet-setup-migration.js';
|
|
25
26
|
const addr = (value) => getAddress(value);
|
|
26
27
|
const SAFE_TOKEN_BOOTSTRAP_MULTIPLIER = 2n;
|
|
27
|
-
|
|
28
|
+
/**
|
|
29
|
+
* 2× cold-start headroom for master ETH target on a fresh bootstrap.
|
|
30
|
+
*
|
|
31
|
+
* Gas accounting for a single standard-mode service on first run:
|
|
32
|
+
* ~1.3M gas for the Safe deploy + stake + mech (at 2 gwei ≈ 0.0026 ETH)
|
|
33
|
+
* + 0.002 ETH Safe seed (sent to the Safe so it can pay mech fees)
|
|
34
|
+
* ≈ 0.0046 ETH minimum; 2× gives ≈ 0.009–0.010 ETH — the bootstrap
|
|
35
|
+
* `minEoaGasEth` default.
|
|
36
|
+
*
|
|
37
|
+
* Used by {@link stage1MinMasterEth} to size the Stage 1 master gas budget.
|
|
38
|
+
*
|
|
39
|
+
* Single source of truth: imported by funding-plan.ts.
|
|
40
|
+
*/
|
|
41
|
+
export const STANDARD_MASTER_BOOTSTRAP_MULTIPLIER = 2n;
|
|
42
|
+
/**
|
|
43
|
+
* Self-bond mode needs much more ETH per service than standard mode because
|
|
44
|
+
* the master funds the agent which then pays for: Safe deploy, 5 service
|
|
45
|
+
* registry txs (create, activate, register, deploy, stake), and mech deploy.
|
|
46
|
+
* Roughly 15 txs at varying gas costs. 0.03 ETH per service is a safe
|
|
47
|
+
* estimate. Single source of truth: imported by funding-plan.ts.
|
|
48
|
+
*/
|
|
49
|
+
export const SELF_BOND_ETH_PER_SERVICE = 30000000000000000n; // 0.03 ETH
|
|
50
|
+
/**
|
|
51
|
+
* Single source of truth for the master-ETH cold-start funding gate.
|
|
52
|
+
*
|
|
53
|
+
* Both the mutating bootstrapper ({@link FleetBootstrapper.ensureStage1And2})
|
|
54
|
+
* and the read-only funding plan (`planFleetFunding` in funding-plan.ts) route
|
|
55
|
+
* through this helper, so a migration-wiped fleet computes an identical
|
|
56
|
+
* required-ETH gate in both views. Re-implementing the gate inline at either
|
|
57
|
+
* call site is the u34i cross-module invariant-drift hazard — do not do it.
|
|
58
|
+
*
|
|
59
|
+
* Standard-mode gate has three branches:
|
|
60
|
+
* 1. `standardFleetAlreadyComplete` — fleet already has its full target of
|
|
61
|
+
* operational services and no deprecated-setup migration is pending →
|
|
62
|
+
* `0n` (nothing to fund).
|
|
63
|
+
* 2. `preStage1` — no fleet identity yet (`fleet_stage === 'none'` or no
|
|
64
|
+
* fleet state at all) → the Stage 1 gate from {@link stage1MinMasterEth},
|
|
65
|
+
* which covers the master → agent transfer plus the master's own gas
|
|
66
|
+
* reserve. See jinn-mono-u34i.
|
|
67
|
+
* 3. otherwise — the Stage 2 master gas budget: `minEoaGasEth` (stake gas)
|
|
68
|
+
* plus a per-extra-service top-up transfer for services 2..N.
|
|
69
|
+
*
|
|
70
|
+
* Self-bond mode is a flat `SELF_BOND_ETH_PER_SERVICE × targetServices`
|
|
71
|
+
* regardless of stage.
|
|
72
|
+
*
|
|
73
|
+
* @param services Persisted service states
|
|
74
|
+
* @param minEoaGasEth Configured minimum EOA gas target (wei)
|
|
75
|
+
* @param pendingSetupMigration True when a deprecated testnet setup is
|
|
76
|
+
* detected — suppresses the `standardFleetAlreadyComplete` short-circuit so a
|
|
77
|
+
* migration-wiped fleet is correctly treated as needing funding. Both call
|
|
78
|
+
* sites MUST pass this so the bootstrapper gate and the funding-plan view
|
|
79
|
+
* agree for migration-wiped fleets.
|
|
80
|
+
* @param targetServices How many services the fleet is aiming for
|
|
81
|
+
* @param stakingMode `'standard'` (default) or `'self-bond'`
|
|
82
|
+
* @param preStage1 True when fleet identity is not yet provisioned —
|
|
83
|
+
* selects the Stage 1 gate. The bootstrapper passes `false` here because it
|
|
84
|
+
* only computes this gate *after* `ensureStage1` succeeds.
|
|
85
|
+
*/
|
|
86
|
+
export function computeRequiredMasterEth({ services, minEoaGasEth, pendingSetupMigration = false, targetServices = 1, stakingMode = 'standard', preStage1 = false, }) {
|
|
87
|
+
if (stakingMode !== 'standard') {
|
|
88
|
+
return SELF_BOND_ETH_PER_SERVICE * BigInt(targetServices);
|
|
89
|
+
}
|
|
90
|
+
// Reconciled `standardFleetAlreadyComplete` — a single definition replacing
|
|
91
|
+
// the three historic inline variants. Adopts the strictest of them (the
|
|
92
|
+
// FleetBootstrapper variant): the fleet must have at least `targetServices`
|
|
93
|
+
// rows AND every row must be operational AND no deprecated-setup migration
|
|
94
|
+
// may be pending. A migration-wiped fleet (which sets
|
|
95
|
+
// `pendingSetupMigration`) is therefore never short-circuited to `0n`.
|
|
96
|
+
const standardFleetAlreadyComplete = services.length >= targetServices &&
|
|
97
|
+
services.every(s => s.step !== undefined && isOperationalServiceStep(s.step)) &&
|
|
98
|
+
!pendingSetupMigration;
|
|
99
|
+
if (standardFleetAlreadyComplete)
|
|
100
|
+
return 0n;
|
|
101
|
+
if (preStage1) {
|
|
102
|
+
// Stage 1 gate: master → agent transfer (STAGE1_AGENT_ETH) + the master's
|
|
103
|
+
// own gas reserve, plus per-extra-service transfers. See jinn-mono-u34i.
|
|
104
|
+
return stage1MinMasterEth({ minEoaGasEth }, targetServices);
|
|
105
|
+
}
|
|
106
|
+
// Stage 2 master gas budget — covers distributor.stake() (~0.003 ETH at
|
|
107
|
+
// typical 6 gwei Base Sepolia) plus per-extra-service top-up transfers.
|
|
108
|
+
// Service 1 piggybacks on HD-1's Stage 1 funding, so the base term is a
|
|
109
|
+
// single `minEoaGasEth` (not `× 2`). See jinn-mono-u34i.
|
|
110
|
+
return minEoaGasEth + minEoaGasEth * BigInt(Math.max(0, targetServices - 1));
|
|
111
|
+
}
|
|
28
112
|
/** Master ETH required to FINISH the whole bootstrap from a fresh start (not
|
|
29
113
|
* just to enter Stage 1). Centralized so the daemon's ensureStage1 gate,
|
|
30
114
|
* the read-side funding-plan, gather-status, and the panel faucet target
|
|
@@ -64,8 +148,17 @@ export function stage1MinMasterEth(config, targetServices = 1) {
|
|
|
64
148
|
config.minEoaGasEth * STANDARD_MASTER_BOOTSTRAP_MULTIPLIER +
|
|
65
149
|
extraServiceTransfers);
|
|
66
150
|
}
|
|
67
|
-
/**
|
|
68
|
-
|
|
151
|
+
/**
|
|
152
|
+
* Conservative default: ~0.0005 ETH/day master gas if not configured.
|
|
153
|
+
*
|
|
154
|
+
* Post-bootstrap master burn is dominated by rare BalanceTopupLoop top-ups,
|
|
155
|
+
* not every-poll activity — the previous 0.001 ETH/day floor (alongside a
|
|
156
|
+
* poll-based blend, since removed) over-estimated steady-state burn and
|
|
157
|
+
* surfaced a misleading "1 days runway" dashboard reading at ~0.008 ETH
|
|
158
|
+
* balances (#288). Mirrored at client/src/api/status-build.ts; collapsing
|
|
159
|
+
* the two copies is a deferred follow-up per the #288 design note.
|
|
160
|
+
*/
|
|
161
|
+
const DEFAULT_MASTER_ETH_DAILY_WEI = 500000000000000n;
|
|
69
162
|
/** Warn when ETH above the minimum would last fewer than this many days at the daily estimate. */
|
|
70
163
|
const MASTER_ETH_RUNWAY_WARN_DAYS = 7n;
|
|
71
164
|
/**
|
|
@@ -210,16 +303,14 @@ export class FleetBootstrapper {
|
|
|
210
303
|
: new Error(String(lastThrowError));
|
|
211
304
|
}
|
|
212
305
|
/**
|
|
213
|
-
* Conservative daily master gas (wei)
|
|
306
|
+
* Conservative daily master gas (wei). Returns the floor; operators who
|
|
307
|
+
* want a more aggressive estimate can still set `JINN_MASTER_ETH_DAILY_WEI`.
|
|
308
|
+
* See DEFAULT_MASTER_ETH_DAILY_WEI for rationale (#288). The
|
|
309
|
+
* `pollIntervalMs` parameter is vestigial since the poll-based blend was
|
|
310
|
+
* removed; kept so the constructor call site stays unchanged.
|
|
214
311
|
*/
|
|
215
|
-
estimateMasterDailyGasWei(
|
|
216
|
-
|
|
217
|
-
const pollsPerDay = 86400000 / interval;
|
|
218
|
-
// Assume at most one funding-sized tx per ~600 polls (~50 min at 5s), capped at 12/day
|
|
219
|
-
const txsPerDay = Math.min(Math.ceil(pollsPerDay / 600), 12);
|
|
220
|
-
const txCostWei = 150000n * 2000000000n; // ~150k gas @ 2 gwei
|
|
221
|
-
const fromPoll = BigInt(txsPerDay) * txCostWei;
|
|
222
|
-
return fromPoll > DEFAULT_MASTER_ETH_DAILY_WEI ? fromPoll : DEFAULT_MASTER_ETH_DAILY_WEI;
|
|
312
|
+
estimateMasterDailyGasWei(_pollIntervalMs) {
|
|
313
|
+
return DEFAULT_MASTER_ETH_DAILY_WEI;
|
|
223
314
|
}
|
|
224
315
|
/**
|
|
225
316
|
* Snapshot of the current persisted fleet state. Reads only — no chain
|
|
@@ -389,12 +480,8 @@ export class FleetBootstrapper {
|
|
|
389
480
|
// Phase 1b: Check master funding for the full operator path.
|
|
390
481
|
const masterAddress = state.master_address;
|
|
391
482
|
let masterBalance = await this.publicClient.getBalance({ address: masterAddress });
|
|
392
|
-
//
|
|
393
|
-
//
|
|
394
|
-
// (create, activate, register, deploy, stake), and mech deploy. Roughly
|
|
395
|
-
// 15 txs at varying gas costs. 0.03 ETH per service is a safe estimate.
|
|
396
|
-
// On re-runs, include ETH already held by funded agents/safes in the total.
|
|
397
|
-
const SELF_BOND_ETH_PER_SERVICE = 30000000000000000n; // 0.03 ETH
|
|
483
|
+
// On re-runs, include ETH already held by funded agents/safes in the
|
|
484
|
+
// total for self-bond mode.
|
|
398
485
|
let systemEth = masterBalance;
|
|
399
486
|
if (this.stakingMode === 'self-bond') {
|
|
400
487
|
for (const svc of state.services) {
|
|
@@ -416,26 +503,20 @@ export class FleetBootstrapper {
|
|
|
416
503
|
stakingMode: this.stakingMode,
|
|
417
504
|
currentStakingContract: this.config.stakingContract,
|
|
418
505
|
}).services.length > 0;
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
// exceeded the post-Stage-1 master balance at the operator-facing
|
|
434
|
-
// 0.020 ETH budget by ~127k gwei of Stage 1 gas burn, causing a
|
|
435
|
-
// second funding prompt.
|
|
436
|
-
: this.config.minEoaGasEth +
|
|
437
|
-
this.config.minEoaGasEth * BigInt(Math.max(0, this.targetServices - 1)))
|
|
438
|
-
: SELF_BOND_ETH_PER_SERVICE * BigInt(this.targetServices);
|
|
506
|
+
// Single source of truth: the master-ETH gate is computed by
|
|
507
|
+
// `computeRequiredMasterEth` (defined above), the same helper the
|
|
508
|
+
// read-only `planFleetFunding` view routes through. Re-deriving it inline
|
|
509
|
+
// here is the u34i cross-module invariant-drift hazard. `ensureStage1And2`
|
|
510
|
+
// only reaches this point AFTER `ensureStage1` has succeeded, so the
|
|
511
|
+
// fleet is always past Stage 1 — `preStage1` is `false`.
|
|
512
|
+
const requiredMasterEth = computeRequiredMasterEth({
|
|
513
|
+
services: state.services,
|
|
514
|
+
minEoaGasEth: this.config.minEoaGasEth,
|
|
515
|
+
pendingSetupMigration,
|
|
516
|
+
targetServices: this.targetServices,
|
|
517
|
+
stakingMode: this.stakingMode,
|
|
518
|
+
preStage1: false,
|
|
519
|
+
});
|
|
439
520
|
const autoFaucetEnabled = this.autoTestnetFaucet;
|
|
440
521
|
// Re-sum system ETH (master + agent/safe balances for self-bond mode).
|
|
441
522
|
// Hoisted so the drip loop below can refresh cheaply.
|
|
@@ -578,7 +659,7 @@ export class FleetBootstrapper {
|
|
|
578
659
|
};
|
|
579
660
|
}
|
|
580
661
|
catch (error) {
|
|
581
|
-
const { summary, hint, rawMessage } = formatBootstrapOperatorMessage(error);
|
|
662
|
+
const { summary, hint, rawMessage, category } = formatBootstrapOperatorMessage(error);
|
|
582
663
|
const userMessage = hint !== undefined ? `${summary}\nHint: ${hint}` : summary;
|
|
583
664
|
if (this.debug) {
|
|
584
665
|
console.error(`[fleet-bootstrap] Bootstrap failed:`, error);
|
|
@@ -594,11 +675,21 @@ export class FleetBootstrapper {
|
|
|
594
675
|
console.error(`[fleet-bootstrap] raw: ${rawMessage.split('\n')[0]}`);
|
|
595
676
|
}
|
|
596
677
|
}
|
|
678
|
+
// Extract a tx hash embedded in the error message by the on-chain revert
|
|
679
|
+
// paths (format: "...tx failed for service N: 0x<hash>" or
|
|
680
|
+
// "...tx reverted: 0x<hash>"). Surfaced in the fatal envelope so the SPA
|
|
681
|
+
// can render a block-explorer link. jinn-mono-hjex reviewer fix.
|
|
682
|
+
const txHashMatch = /(0x[a-fA-F0-9]{64})/.exec(rawMessage);
|
|
683
|
+
const txHash = txHashMatch ? txHashMatch[1] : null;
|
|
597
684
|
return {
|
|
598
685
|
ok: false,
|
|
599
686
|
fleet_state: state,
|
|
600
687
|
message: userMessage,
|
|
601
688
|
rawErrorMessage: rawMessage,
|
|
689
|
+
// Preserve the structured category so the error envelope in main.ts
|
|
690
|
+
// can surface it in `details.category` for SPA consumers. jinn-mono-hjex.6
|
|
691
|
+
...(category !== undefined ? { errorCategory: category } : {}),
|
|
692
|
+
...(txHash !== null ? { txHash } : {}),
|
|
602
693
|
};
|
|
603
694
|
}
|
|
604
695
|
}
|
|
@@ -1044,6 +1135,39 @@ export class FleetBootstrapper {
|
|
|
1044
1135
|
return this.store.updateService(index, { step: 'staked' });
|
|
1045
1136
|
}
|
|
1046
1137
|
}
|
|
1138
|
+
// Pre-stake precondition: if migration cleared service_id but kept agent_address,
|
|
1139
|
+
// check the EOA is not already registered on-chain as an agent instance. If it is,
|
|
1140
|
+
// calling stake() again would revert with AgentInstanceRegistered (selector 0x631695bd)
|
|
1141
|
+
// and there is nothing useful the operator can do without rotating the agent EOA.
|
|
1142
|
+
// Fail fast with a typed error instead of letting the contract revert.
|
|
1143
|
+
//
|
|
1144
|
+
// ServiceRegistryL2 exposes the `mapAgentInstanceOperators(address) → address` mapping:
|
|
1145
|
+
// it returns the operator address that registered the given agent instance, or the
|
|
1146
|
+
// zero address when no operator has bound that instance. A non-zero return means the
|
|
1147
|
+
// EOA is already bound. (There is no `mapAgentInstances(address) → uint256` getter on
|
|
1148
|
+
// the deployed registry — an earlier draft of this guard referenced one and was a
|
|
1149
|
+
// permanent no-op.)
|
|
1150
|
+
if (svc.agent_address && svc.service_id === null && this.config.serviceRegistry) {
|
|
1151
|
+
let alreadyBound = false;
|
|
1152
|
+
try {
|
|
1153
|
+
const boundOperator = (await this.publicClient.readContract({
|
|
1154
|
+
address: getAddress(this.config.serviceRegistry),
|
|
1155
|
+
abi: SERVICE_REGISTRY_L2_ABI,
|
|
1156
|
+
functionName: 'mapAgentInstanceOperators',
|
|
1157
|
+
args: [getAddress(svc.agent_address)],
|
|
1158
|
+
}));
|
|
1159
|
+
alreadyBound = boundOperator !== '0x0000000000000000000000000000000000000000';
|
|
1160
|
+
}
|
|
1161
|
+
catch {
|
|
1162
|
+
// Registry read failure is non-fatal — proceed and let stake() surface
|
|
1163
|
+
// the error if the agent really is bound.
|
|
1164
|
+
}
|
|
1165
|
+
if (alreadyBound) {
|
|
1166
|
+
throw new Error(`agent_already_bound: agent EOA ${svc.agent_address} is already registered as an agent instance on-chain. ` +
|
|
1167
|
+
`The previous setup retirement may have been incomplete. ` +
|
|
1168
|
+
`Contact support or rotate the agent EOA to continue.`);
|
|
1169
|
+
}
|
|
1170
|
+
}
|
|
1047
1171
|
// Fresh distributor stake() creates a new on-chain service. If state still
|
|
1048
1172
|
// references an old Safe (e.g. hand-edited JSON), sweep it before replacing.
|
|
1049
1173
|
if (svc.service_id === null && svc.safe_address && state.master_address) {
|
|
@@ -1109,42 +1233,19 @@ export class FleetBootstrapper {
|
|
|
1109
1233
|
const svc = state.services.find(s => s.index === index);
|
|
1110
1234
|
const serviceId = svc.service_id;
|
|
1111
1235
|
const stakingAddress = this.stakingAddressForService(svc);
|
|
1112
|
-
|
|
1113
|
-
//
|
|
1114
|
-
//
|
|
1115
|
-
//
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1236
|
+
const di = displayFleetServiceIndex(svc);
|
|
1237
|
+
// Delegate to the standalone exported helper (shared with EvictionLoop /
|
|
1238
|
+
// the dashboard "Re-stake now" CTA). This eliminates the duplicate
|
|
1239
|
+
// implementation (jinn-mono-hjex.3).
|
|
1240
|
+
await recoverEvictedService({
|
|
1241
|
+
serviceDisplayIndex: di,
|
|
1242
|
+
serviceId,
|
|
1243
|
+
stakingAddress: stakingAddress,
|
|
1244
|
+
distributorAddress: this.config.distributorAddress,
|
|
1245
|
+
rpcUrl: this.config.rpcUrl,
|
|
1246
|
+
chain: this.chain,
|
|
1247
|
+
mnemonic,
|
|
1122
1248
|
});
|
|
1123
|
-
console.error(`[fleet-bootstrap] Service ${index}: calling distributor.reStake() for evicted service ${serviceId}`);
|
|
1124
|
-
let reStakeHash;
|
|
1125
|
-
try {
|
|
1126
|
-
reStakeHash = await viemSendTransactionWithRetry(masterWallet, this.publicClient, {
|
|
1127
|
-
account: masterAccount,
|
|
1128
|
-
to: addr(this.config.distributorAddress),
|
|
1129
|
-
data: reStakeData,
|
|
1130
|
-
gas: 1500000n,
|
|
1131
|
-
});
|
|
1132
|
-
}
|
|
1133
|
-
catch (err) {
|
|
1134
|
-
const message = flattenErrorMessage(err);
|
|
1135
|
-
if (isUnauthorizedAccountError(message)) {
|
|
1136
|
-
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. ` +
|
|
1137
|
-
`The distributor only permits the recorded service operator, a managing agent, or the owner. ` +
|
|
1138
|
-
`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. ` +
|
|
1139
|
-
`reStake revert: ${message}`);
|
|
1140
|
-
}
|
|
1141
|
-
throw err;
|
|
1142
|
-
}
|
|
1143
|
-
const receipt = await waitForTransactionReceiptWithRetry(this.publicClient, reStakeHash);
|
|
1144
|
-
if (receipt.status !== 'success') {
|
|
1145
|
-
throw new Error(`reStake failed for service ${index}: ${reStakeHash}`);
|
|
1146
|
-
}
|
|
1147
|
-
console.error(`[fleet-bootstrap] Service ${index}: reStake confirmed (tx: ${reStakeHash})`);
|
|
1148
1249
|
// Service is now Staked again with the same service_id, safe_address, and mech_address.
|
|
1149
1250
|
// Step back to `mech_deployed` so the resume loop advances through
|
|
1150
1251
|
// `stepRegisterAgent` (idempotent — short-circuits if `agent_id` is
|
|
@@ -1897,4 +1998,50 @@ export class FleetBootstrapper {
|
|
|
1897
1998
|
}
|
|
1898
1999
|
/** @deprecated Use FleetBootstrapper */
|
|
1899
2000
|
export const EarningBootstrapper = FleetBootstrapper;
|
|
2001
|
+
/**
|
|
2002
|
+
* Re-stake an evicted service by calling `distributor.reStake(stakingProxy, serviceId)`.
|
|
2003
|
+
*
|
|
2004
|
+
* Extracted from `FleetBootstrapper.recoverEvictedService` so it can be called
|
|
2005
|
+
* from the in-process `EvictionLoop` without requiring a full bootstrapper
|
|
2006
|
+
* context (jinn-mono-hjex.3).
|
|
2007
|
+
*
|
|
2008
|
+
* The caller is responsible for advancing the local service step back to
|
|
2009
|
+
* `mech_deployed` after this returns (just like the bootstrapper resume path does).
|
|
2010
|
+
*/
|
|
2011
|
+
export async function recoverEvictedService(opts) {
|
|
2012
|
+
const { serviceDisplayIndex, serviceId, stakingAddress, distributorAddress, rpcUrl, chain, mnemonic, } = opts;
|
|
2013
|
+
const masterAccount = deriveMasterSigner(mnemonic);
|
|
2014
|
+
const publicClient = createJinnPublicClient(rpcUrl, chain);
|
|
2015
|
+
const masterWallet = createJinnWalletClient(rpcUrl, chain, masterAccount);
|
|
2016
|
+
const reStakeData = encodeFunctionData({
|
|
2017
|
+
abi: STOLAS_DISTRIBUTOR_ABI,
|
|
2018
|
+
functionName: 'reStake',
|
|
2019
|
+
args: [addr(stakingAddress), BigInt(serviceId)],
|
|
2020
|
+
});
|
|
2021
|
+
console.error(`[eviction-recovery] Service ${serviceDisplayIndex}: calling distributor.reStake() for evicted service ${serviceId}`);
|
|
2022
|
+
let reStakeHash;
|
|
2023
|
+
try {
|
|
2024
|
+
reStakeHash = await viemSendTransactionWithRetry(masterWallet, publicClient, {
|
|
2025
|
+
account: masterAccount,
|
|
2026
|
+
to: addr(distributorAddress),
|
|
2027
|
+
data: reStakeData,
|
|
2028
|
+
gas: 1500000n,
|
|
2029
|
+
});
|
|
2030
|
+
}
|
|
2031
|
+
catch (err) {
|
|
2032
|
+
const message = flattenErrorMessage(err);
|
|
2033
|
+
if (isUnauthorizedAccountError(message)) {
|
|
2034
|
+
throw new Error(`Service ${serviceDisplayIndex} (service_id ${serviceId}) is evicted on the staking proxy, but master EOA ` +
|
|
2035
|
+
`${masterAccount.address} is not authorized to reStake it. ` +
|
|
2036
|
+
`Verify JINN_EARNING_DIR and JINN_PASSWORD derive the original master EOA for this service. ` +
|
|
2037
|
+
`reStake revert: ${message}`);
|
|
2038
|
+
}
|
|
2039
|
+
throw err;
|
|
2040
|
+
}
|
|
2041
|
+
const receipt = await waitForTransactionReceiptWithRetry(publicClient, reStakeHash);
|
|
2042
|
+
if (receipt.status !== 'success') {
|
|
2043
|
+
throw new Error(`reStake failed for service ${serviceDisplayIndex}: ${reStakeHash}`);
|
|
2044
|
+
}
|
|
2045
|
+
console.error(`[eviction-recovery] Service ${serviceDisplayIndex}: reStake confirmed (tx: ${reStakeHash})`);
|
|
2046
|
+
}
|
|
1900
2047
|
//# sourceMappingURL=bootstrap.js.map
|