@jinn-network/client 0.1.5 → 0.1.6-canary.092089a9
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 +131 -0
- 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 +23 -1
- package/dist/adapters/mech/adapter.js +171 -33
- 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/ipfs-pinfile.d.ts +22 -0
- package/dist/adapters/mech/ipfs-pinfile.js +54 -0
- package/dist/adapters/mech/ipfs-pinfile.js.map +1 -0
- package/dist/adapters/mech/ipfs.d.ts +1 -0
- package/dist/adapters/mech/ipfs.js +24 -1
- package/dist/adapters/mech/ipfs.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/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/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.js +63 -1
- package/dist/api/bootstrap-endpoint.js.map +1 -1
- package/dist/api/codex-doctor-endpoint.d.ts +73 -0
- package/dist/api/codex-doctor-endpoint.js +177 -0
- package/dist/api/codex-doctor-endpoint.js.map +1 -0
- package/dist/api/discovery-endpoint.d.ts +32 -0
- package/dist/api/discovery-endpoint.js +104 -0
- package/dist/api/discovery-endpoint.js.map +1 -0
- package/dist/api/fleet-build.d.ts +8 -0
- package/dist/api/fleet-build.js +8 -2
- package/dist/api/fleet-build.js.map +1 -1
- package/dist/api/gather-status.d.ts +9 -0
- package/dist/api/gather-status.js +330 -7
- package/dist/api/gather-status.js.map +1 -1
- package/dist/api/harness-readiness-endpoint.d.ts +25 -0
- package/dist/api/harness-readiness-endpoint.js +24 -0
- package/dist/api/harness-readiness-endpoint.js.map +1 -0
- package/dist/api/hermes-doctor-endpoint.d.ts +66 -0
- package/dist/api/hermes-doctor-endpoint.js +75 -0
- package/dist/api/hermes-doctor-endpoint.js.map +1 -0
- 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 +9 -0
- package/dist/api/prediction-v1-build.js +6 -1
- package/dist/api/prediction-v1-build.js.map +1 -1
- package/dist/api/server.d.ts +74 -1
- package/dist/api/server.js +107 -1
- package/dist/api/server.js.map +1 -1
- package/dist/api/setup-endpoints.d.ts +21 -0
- package/dist/api/setup-endpoints.js +101 -8
- 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.js +8 -1
- package/dist/api/solvernets-endpoints.js.map +1 -1
- package/dist/api/status-build.d.ts +64 -0
- package/dist/api/status-build.js +72 -18
- package/dist/api/status-build.js.map +1 -1
- 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 +20 -0
- package/dist/api/task-runs-build.js +13 -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/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 +3 -1
- package/dist/cli/commands/auth.js.map +1 -1
- package/dist/cli/commands/create.d.ts +5 -3
- package/dist/cli/commands/create.js +102 -36
- package/dist/cli/commands/create.js.map +1 -1
- package/dist/cli/commands/solver-nets.d.ts +19 -0
- package/dist/cli/commands/solver-nets.js +164 -11
- package/dist/cli/commands/solver-nets.js.map +1 -1
- package/dist/cli/commands/solver-plugins-publish.d.ts +31 -0
- package/dist/cli/commands/solver-plugins-publish.js +169 -0
- package/dist/cli/commands/solver-plugins-publish.js.map +1 -0
- package/dist/cli/commands/solver-plugins-revoke.d.ts +15 -0
- package/dist/cli/commands/solver-plugins-revoke.js +91 -0
- package/dist/cli/commands/solver-plugins-revoke.js.map +1 -0
- package/dist/cli/commands/solver-plugins.d.ts +50 -6
- package/dist/cli/commands/solver-plugins.js +205 -68
- package/dist/cli/commands/solver-plugins.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/config.d.ts +79 -5
- package/dist/config.js +85 -9
- package/dist/config.js.map +1 -1
- package/dist/conformance/checks/hash-signature.js +6 -2
- package/dist/conformance/checks/hash-signature.js.map +1 -1
- package/dist/conformance/checks/payload.js +4 -2
- package/dist/conformance/checks/payload.js.map +1 -1
- package/dist/conformance/checks/verdict.d.ts +10 -10
- package/dist/conformance/checks/verdict.js +16 -15
- package/dist/conformance/checks/verdict.js.map +1 -1
- package/dist/conformance/harness.d.ts +1 -1
- package/dist/conformance/harness.js +16 -9
- package/dist/conformance/harness.js.map +1 -1
- package/dist/conformance/types.d.ts +10 -3
- package/dist/conformance/types.js.map +1 -1
- package/dist/corpus/acquire.d.ts +1 -3
- package/dist/corpus/acquire.js.map +1 -1
- package/dist/corpus/envelope-projection.d.ts +1 -1
- package/dist/corpus/envelope-projection.js +14 -7
- package/dist/corpus/envelope-projection.js.map +1 -1
- package/dist/corpus/index.d.ts +2 -1
- package/dist/corpus/index.js.map +1 -1
- package/dist/corpus/prediction-brier-scoreboard-report.js +1 -1
- package/dist/corpus/prediction-brier-scoreboard-report.js.map +1 -1
- package/dist/corpus/prediction-brier-scoreboard.js +3 -1
- package/dist/corpus/prediction-brier-scoreboard.js.map +1 -1
- package/dist/corpus/types.d.ts +2 -2
- package/dist/daemon/daemon.d.ts +26 -1
- package/dist/daemon/daemon.js +63 -1
- 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/freeze-fence.js +6 -3
- package/dist/daemon/freeze-fence.js.map +1 -1
- 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 +63 -21
- package/dist/daemon/jinn-claim-loop.js.map +1 -1
- package/dist/daemon/readiness-gate.d.ts +30 -0
- package/dist/daemon/readiness-gate.js +31 -0
- package/dist/daemon/readiness-gate.js.map +1 -0
- 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/dashboard/assets/index-CODvRk_l.js +294 -0
- package/dist/dashboard/assets/index-CV4x-_zC.css +32 -0
- package/dist/dashboard/index.html +2 -2
- package/dist/discovery/http.js +235 -0
- package/dist/discovery/http.js.map +1 -1
- package/dist/discovery/onchain.d.ts +5 -0
- package/dist/discovery/onchain.js +411 -8
- package/dist/discovery/onchain.js.map +1 -1
- package/dist/discovery/types.d.ts +157 -1
- package/dist/discovery/types.js +8 -10
- package/dist/discovery/types.js.map +1 -1
- package/dist/discovery/with-fallback.js +12 -0
- package/dist/discovery/with-fallback.js.map +1 -1
- package/dist/earning/agent-wallet-binding.d.ts +20 -1
- package/dist/earning/agent-wallet-binding.js +54 -16
- package/dist/earning/agent-wallet-binding.js.map +1 -1
- package/dist/earning/bootstrap.d.ts +178 -0
- package/dist/earning/bootstrap.js +628 -57
- package/dist/earning/bootstrap.js.map +1 -1
- package/dist/earning/contracts.d.ts +14 -0
- package/dist/earning/contracts.js +18 -1
- package/dist/earning/contracts.js.map +1 -1
- package/dist/earning/funding-plan.js +15 -2
- 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/store.d.ts +8 -0
- package/dist/earning/store.js +48 -1
- 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 +45 -0
- package/dist/earning/types.js +37 -0
- package/dist/earning/types.js.map +1 -1
- package/dist/erc8004/abis.d.ts +64 -0
- package/dist/erc8004/abis.js +48 -0
- package/dist/erc8004/abis.js.map +1 -1
- package/dist/erc8004/plugin-registry.d.ts +102 -0
- package/dist/erc8004/plugin-registry.js +165 -0
- package/dist/erc8004/plugin-registry.js.map +1 -0
- 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 +72 -0
- package/dist/harnesses/engine/engine.js +109 -11
- package/dist/harnesses/engine/engine.js.map +1 -1
- package/dist/harnesses/engine/envelope-assembly.d.ts +2 -2
- package/dist/harnesses/engine/envelope-assembly.js +4 -2
- package/dist/harnesses/engine/envelope-assembly.js.map +1 -1
- package/dist/harnesses/engine/persistence.d.ts +21 -0
- package/dist/harnesses/engine/persistence.js +39 -0
- 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/freeze.d.ts +4 -1
- package/dist/harnesses/freeze.js +12 -2
- package/dist/harnesses/freeze.js.map +1 -1
- package/dist/harnesses/impls/claude-mcp-prediction/index.d.ts +4 -1
- package/dist/harnesses/impls/claude-mcp-prediction/index.js +7 -2
- package/dist/harnesses/impls/claude-mcp-prediction/index.js.map +1 -1
- package/dist/harnesses/impls/claude-mcp-prediction-apy/index.d.ts +4 -1
- package/dist/harnesses/impls/claude-mcp-prediction-apy/index.js +7 -2
- package/dist/harnesses/impls/claude-mcp-prediction-apy/index.js.map +1 -1
- package/dist/harnesses/impls/evaluation-context.d.ts +15 -4
- package/dist/harnesses/impls/evaluation-context.js +24 -8
- package/dist/harnesses/impls/evaluation-context.js.map +1 -1
- package/dist/harnesses/impls/hermes-agent/adapter.d.ts +34 -0
- package/dist/harnesses/impls/hermes-agent/adapter.js +205 -0
- package/dist/harnesses/impls/hermes-agent/adapter.js.map +1 -0
- package/dist/harnesses/impls/hermes-agent/bootstrap.d.ts +18 -0
- package/dist/harnesses/impls/hermes-agent/bootstrap.js +231 -0
- package/dist/harnesses/impls/hermes-agent/bootstrap.js.map +1 -0
- package/dist/harnesses/impls/hermes-agent/config-builder.d.ts +49 -0
- package/dist/harnesses/impls/hermes-agent/config-builder.js +132 -0
- package/dist/harnesses/impls/hermes-agent/config-builder.js.map +1 -0
- package/dist/harnesses/impls/hermes-agent/harness.d.ts +58 -0
- package/dist/harnesses/impls/hermes-agent/harness.js +118 -0
- package/dist/harnesses/impls/hermes-agent/harness.js.map +1 -0
- package/dist/harnesses/impls/hermes-agent/index.d.ts +5 -0
- package/dist/harnesses/impls/hermes-agent/index.js +7 -0
- package/dist/harnesses/impls/hermes-agent/index.js.map +1 -0
- package/dist/harnesses/impls/hermes-agent/prompt.d.ts +15 -0
- package/dist/harnesses/impls/hermes-agent/prompt.js +37 -0
- package/dist/harnesses/impls/hermes-agent/prompt.js.map +1 -0
- package/dist/harnesses/impls/index.d.ts +13 -0
- package/dist/harnesses/impls/index.js +32 -4
- package/dist/harnesses/impls/index.js.map +1 -1
- package/dist/harnesses/impls/learner/adapters/claude-code.js.map +1 -0
- package/dist/harnesses/impls/{claude-code-learner → learner}/adapters/codex-code.js +13 -34
- package/dist/harnesses/impls/learner/adapters/codex-code.js.map +1 -0
- package/dist/harnesses/impls/learner/adapters/codex-workspace.js.map +1 -0
- package/dist/harnesses/impls/learner/harness.d.ts +62 -0
- package/dist/harnesses/impls/learner/harness.js +179 -0
- package/dist/harnesses/impls/learner/harness.js.map +1 -0
- package/dist/harnesses/impls/{claude-code-learner → learner}/harvest.js +15 -3
- package/dist/harnesses/impls/learner/harvest.js.map +1 -0
- package/dist/harnesses/impls/{claude-code-learner → learner}/index.d.ts +5 -5
- package/dist/harnesses/impls/{claude-code-learner → learner}/index.js +4 -4
- package/dist/harnesses/impls/learner/index.js.map +1 -0
- package/dist/harnesses/impls/{claude-code-learner → learner}/plugin-path.d.ts +4 -4
- package/dist/harnesses/impls/{claude-code-learner → learner}/plugin-path.js +7 -7
- package/dist/harnesses/impls/learner/plugin-path.js.map +1 -0
- package/dist/harnesses/impls/{claude-code-learner → learner}/restoration-patch.js +3 -1
- package/dist/harnesses/impls/learner/restoration-patch.js.map +1 -0
- package/dist/harnesses/impls/learner/test-utils/fake-plugin-outputs.js.map +1 -0
- package/dist/harnesses/impls/learner/test-utils/noop-adapter.js.map +1 -0
- package/dist/harnesses/impls/{claude-code-learner → learner}/types.d.ts +23 -2
- package/dist/harnesses/impls/learner/types.js.map +1 -0
- package/dist/harnesses/impls/portfolio-v0-evaluator/index.js +13 -12
- package/dist/harnesses/impls/portfolio-v0-evaluator/index.js.map +1 -1
- package/dist/harnesses/impls/prediction-apy-v0-evaluator/index.js +7 -7
- package/dist/harnesses/impls/prediction-apy-v0-evaluator/index.js.map +1 -1
- package/dist/harnesses/impls/prediction-apy-v0-evaluator/parse-submission.d.ts +3 -3
- package/dist/harnesses/impls/prediction-apy-v0-evaluator/parse-submission.js +7 -6
- package/dist/harnesses/impls/prediction-apy-v0-evaluator/parse-submission.js.map +1 -1
- package/dist/harnesses/impls/prediction-v0-evaluator/checks/integrity.js +1 -1
- package/dist/harnesses/impls/prediction-v0-evaluator/checks/integrity.js.map +1 -1
- package/dist/harnesses/impls/prediction-v0-evaluator/index.js +11 -10
- package/dist/harnesses/impls/prediction-v0-evaluator/index.js.map +1 -1
- package/dist/harnesses/impls/prediction-v1-evaluator/index.js +11 -10
- package/dist/harnesses/impls/prediction-v1-evaluator/index.js.map +1 -1
- 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 +48 -50
- package/dist/harnesses/impls/swe-rebench-v2-evaluator/eval-runner.js +92 -84
- 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 +24 -5
- package/dist/harnesses/impls/swe-rebench-v2-evaluator/harness.js +104 -4
- 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 +9 -0
- package/dist/harnesses/impls/swe-rebench-v2-evaluator/hf-fetcher.js +25 -1
- package/dist/harnesses/impls/swe-rebench-v2-evaluator/hf-fetcher.js.map +1 -1
- package/dist/harnesses/names.d.ts +1 -0
- package/dist/harnesses/names.js +3 -0
- package/dist/harnesses/names.js.map +1 -1
- package/dist/harnesses/readiness-registry.d.ts +48 -0
- package/dist/harnesses/readiness-registry.js +144 -0
- package/dist/harnesses/readiness-registry.js.map +1 -0
- package/dist/harnesses/types.d.ts +7 -0
- package/dist/main.d.ts +14 -0
- package/dist/main.js +417 -116
- package/dist/main.js.map +1 -1
- package/dist/mcp/server.js +14 -13
- 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.d.ts +7 -0
- package/dist/operator-errors.js +26 -2
- package/dist/operator-errors.js.map +1 -1
- package/dist/preflight/claude-auth.d.ts +18 -0
- package/dist/preflight/claude-auth.js +38 -0
- package/dist/preflight/claude-auth.js.map +1 -1
- package/dist/restart-daemon.d.ts +79 -0
- package/dist/restart-daemon.js +82 -0
- package/dist/restart-daemon.js.map +1 -0
- package/dist/scripts/donation-consumption-acceptance.js +1 -1
- package/dist/scripts/donation-consumption-acceptance.js.map +1 -1
- package/dist/scripts/swe-rebench-v2-known-bad.json +12 -0
- package/dist/scripts/swe-rebench-v2-seed-pool.json +26 -0
- 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.js +43 -3
- package/dist/solver-nets/prediction-operator-ux.js.map +1 -1
- package/dist/solver-nets/registry.d.ts +1 -0
- package/dist/solver-nets/registry.js +1 -1
- 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-substrate.d.ts +52 -0
- package/dist/solver-types/_swe-rebench-v2-substrate.js +76 -0
- package/dist/solver-types/_swe-rebench-v2-substrate.js.map +1 -0
- package/dist/solver-types/_swe-rebench-v2-validated-pool.d.ts +38 -12
- package/dist/solver-types/_swe-rebench-v2-validated-pool.js +136 -27
- package/dist/solver-types/_swe-rebench-v2-validated-pool.js.map +1 -1
- package/dist/solver-types/swe-rebench-v2-auto.d.ts +6 -0
- package/dist/solver-types/swe-rebench-v2-auto.js.map +1 -1
- package/dist/solver-types/swe-rebench-v2.d.ts +1 -0
- package/dist/solver-types/swe-rebench-v2.js +42 -17
- 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/store/store.js +12 -4
- package/dist/store/store.js.map +1 -1
- package/dist/templates/plugins/runtime-plugin/.mcp.json.tmpl +8 -0
- package/dist/templates/plugins/runtime-plugin/README.md.tmpl +30 -0
- package/dist/templates/plugins/runtime-plugin/gitignore.tmpl +3 -0
- package/dist/templates/plugins/runtime-plugin/jinn.plugin.json.tmpl +21 -0
- package/dist/templates/plugins/runtime-plugin/mcp/server.mjs.tmpl +33 -0
- package/dist/templates/plugins/runtime-plugin/package.json.tmpl +15 -0
- package/dist/templates/plugins/runtime-plugin/test/plugin.test.ts.tmpl +35 -0
- package/dist/templates/plugins/runtime-plugin/tsconfig.json.tmpl +11 -0
- package/dist/templates/plugins/solver-type-plugin/README.md.tmpl +35 -0
- package/dist/templates/plugins/solver-type-plugin/gitignore.tmpl +3 -0
- package/dist/templates/plugins/solver-type-plugin/jinn.plugin.json.tmpl +11 -0
- package/dist/templates/plugins/solver-type-plugin/package.json.tmpl +15 -0
- package/dist/templates/plugins/solver-type-plugin/skills/example/SKILL.md.tmpl +10 -0
- package/dist/templates/plugins/solver-type-plugin/test/plugin.test.ts.tmpl +25 -0
- package/dist/templates/plugins/solver-type-plugin/tsconfig.json.tmpl +11 -0
- package/dist/tx-retry.d.ts +13 -0
- package/dist/tx-retry.js +22 -0
- package/dist/tx-retry.js.map +1 -1
- package/dist/types/envelope.d.ts +28 -21
- package/dist/types/envelope.js +8 -3
- package/dist/types/envelope.js.map +1 -1
- package/dist/types/payloads/index.d.ts +2 -2
- package/dist/types/payloads/index.js +13 -12
- package/dist/types/payloads/index.js.map +1 -1
- package/dist/types/payloads/portfolio-v0.d.ts +60 -10
- package/dist/types/payloads/portfolio-v0.js +16 -6
- package/dist/types/payloads/portfolio-v0.js.map +1 -1
- package/dist/types/payloads/prediction-apy-v0.d.ts +56 -14
- package/dist/types/payloads/prediction-apy-v0.js +16 -6
- package/dist/types/payloads/prediction-apy-v0.js.map +1 -1
- package/dist/types/payloads/prediction-v0.d.ts +53 -14
- package/dist/types/payloads/prediction-v0.js +16 -6
- package/dist/types/payloads/prediction-v0.js.map +1 -1
- 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/payloads/prediction-v1.d.ts +45 -6
- package/dist/vendor/@jinn-network/sdk/dist/payloads/prediction-v1.js +16 -6
- package/dist/x402/handler.js +51 -20
- package/dist/x402/handler.js.map +1 -1
- package/package.json +38 -13
- package/plugins/swe-rebench-v2-diffmin/.claude-plugin/plugin.json +5 -0
- package/plugins/swe-rebench-v2-diffmin/.mcp.json +8 -0
- package/plugins/swe-rebench-v2-diffmin/README.md +69 -0
- package/plugins/swe-rebench-v2-diffmin/jinn.plugin.json +12 -0
- package/plugins/swe-rebench-v2-diffmin/mcp/diff-stats-server.mjs +72 -0
- package/plugins/swe-rebench-v2-diffmin/mcp/diff-stats.mjs +48 -0
- package/plugins/swe-rebench-v2-diffmin/package.json +19 -0
- package/plugins/swe-rebench-v2-diffmin/skills/diffmin/SKILL.md +116 -0
- package/plugins/swe-rebench-v2-diffmin/skills/test-map/SKILL.md +126 -0
- package/plugins/swe-rebench-v2-diffmin/test/diff-stats.test.ts +62 -0
- package/plugins/swe-rebench-v2-diffmin/test/manifest.test.ts +53 -0
- package/plugins/swe-rebench-v2-diffmin/tsconfig.json +12 -0
- package/plugins/swe-rebench-v2-runtime/README.md +13 -0
- package/plugins/swe-rebench-v2-runtime/skills/orient/SKILL.md +7 -3
- package/plugins/swe-rebench-v2-runtime/skills/plan/SKILL.md +6 -17
- package/templates/plugins/runtime-plugin/.mcp.json.tmpl +8 -0
- package/templates/plugins/runtime-plugin/README.md.tmpl +30 -0
- package/templates/plugins/runtime-plugin/gitignore.tmpl +3 -0
- package/templates/plugins/runtime-plugin/jinn.plugin.json.tmpl +21 -0
- package/templates/plugins/runtime-plugin/mcp/server.mjs.tmpl +33 -0
- package/templates/plugins/runtime-plugin/package.json.tmpl +15 -0
- package/templates/plugins/runtime-plugin/test/plugin.test.ts.tmpl +35 -0
- package/templates/plugins/runtime-plugin/tsconfig.json.tmpl +11 -0
- package/templates/plugins/solver-type-plugin/README.md.tmpl +35 -0
- package/templates/plugins/solver-type-plugin/gitignore.tmpl +3 -0
- package/templates/plugins/solver-type-plugin/jinn.plugin.json.tmpl +11 -0
- package/templates/plugins/solver-type-plugin/package.json.tmpl +15 -0
- package/templates/plugins/solver-type-plugin/skills/example/SKILL.md.tmpl +10 -0
- package/templates/plugins/solver-type-plugin/test/plugin.test.ts.tmpl +25 -0
- package/templates/plugins/solver-type-plugin/tsconfig.json.tmpl +11 -0
- package/dist/dashboard/assets/index-BjtltOGc.js +0 -76
- package/dist/dashboard/assets/index-D_NMfDfV.css +0 -32
- package/dist/harnesses/impls/claude-code-learner/adapters/claude-code.js.map +0 -1
- package/dist/harnesses/impls/claude-code-learner/adapters/codex-code.js.map +0 -1
- package/dist/harnesses/impls/claude-code-learner/adapters/codex-workspace.js.map +0 -1
- package/dist/harnesses/impls/claude-code-learner/harness.d.ts +0 -22
- package/dist/harnesses/impls/claude-code-learner/harness.js +0 -62
- package/dist/harnesses/impls/claude-code-learner/harness.js.map +0 -1
- package/dist/harnesses/impls/claude-code-learner/harvest.js.map +0 -1
- package/dist/harnesses/impls/claude-code-learner/index.js.map +0 -1
- package/dist/harnesses/impls/claude-code-learner/plugin-path.js.map +0 -1
- package/dist/harnesses/impls/claude-code-learner/restoration-patch.js.map +0 -1
- package/dist/harnesses/impls/claude-code-learner/test-utils/fake-plugin-outputs.js.map +0 -1
- package/dist/harnesses/impls/claude-code-learner/test-utils/noop-adapter.js.map +0 -1
- package/dist/harnesses/impls/claude-code-learner/types.js.map +0 -1
- package/dist/preflight/claude-required.d.ts +0 -8
- package/dist/preflight/claude-required.js +0 -17
- package/dist/preflight/claude-required.js.map +0 -1
- /package/dist/harnesses/impls/{claude-code-learner → learner}/adapters/claude-code.d.ts +0 -0
- /package/dist/harnesses/impls/{claude-code-learner → learner}/adapters/claude-code.js +0 -0
- /package/dist/harnesses/impls/{claude-code-learner → learner}/adapters/codex-code.d.ts +0 -0
- /package/dist/harnesses/impls/{claude-code-learner → learner}/adapters/codex-workspace.d.ts +0 -0
- /package/dist/harnesses/impls/{claude-code-learner → learner}/adapters/codex-workspace.js +0 -0
- /package/dist/harnesses/impls/{claude-code-learner → learner}/harvest.d.ts +0 -0
- /package/dist/harnesses/impls/{claude-code-learner → learner}/restoration-patch.d.ts +0 -0
- /package/dist/harnesses/impls/{claude-code-learner → learner}/test-utils/fake-plugin-outputs.d.ts +0 -0
- /package/dist/harnesses/impls/{claude-code-learner → learner}/test-utils/fake-plugin-outputs.js +0 -0
- /package/dist/harnesses/impls/{claude-code-learner → learner}/test-utils/noop-adapter.d.ts +0 -0
- /package/dist/harnesses/impls/{claude-code-learner → learner}/test-utils/noop-adapter.js +0 -0
- /package/dist/harnesses/impls/{claude-code-learner → learner}/types.js +0 -0
- /package/plugins/{claude-code-learner → learner}/.claude-plugin/plugin.json +0 -0
- /package/plugins/{claude-code-learner → learner}/.codex-plugin/plugin.json +0 -0
- /package/plugins/{claude-code-learner → learner}/AGENTS.md +0 -0
- /package/plugins/{claude-code-learner → learner}/CLAUDE.md +0 -0
- /package/plugins/{claude-code-learner → learner}/README.md +0 -0
- /package/plugins/{claude-code-learner → learner}/hooks/hooks.json +0 -0
- /package/plugins/{claude-code-learner → learner}/hooks/session-start +0 -0
- /package/plugins/{claude-code-learner → learner}/skills/learn/SKILL.md +0 -0
- /package/plugins/{claude-code-learner → learner}/skills/learn/analyst-prompt.md +0 -0
- /package/plugins/{claude-code-learner → learner}/skills/learn/consolidator-prompt.md +0 -0
- /package/plugins/{claude-code-learner → learner}/skills/learn/explorer-prompt.md +0 -0
- /package/plugins/{claude-code-learner → learner}/skills/learn/planner-prompt.md +0 -0
- /package/plugins/{claude-code-learner → learner}/skills/learn/promoter-prompt.md +0 -0
- /package/plugins/{claude-code-learner → learner}/skills/learn/step-worker-prompt.md +0 -0
- /package/plugins/{claude-code-learner → learner}/skills/learn/strategist-prompt.md +0 -0
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { DiscoveryUnavailableError } from '../discovery/types.js';
|
|
2
|
+
export function addDiscoveryRoutes(app, config) {
|
|
3
|
+
const getDiscovery = 'getDiscovery' in config ? config.getDiscovery : () => config.discovery();
|
|
4
|
+
app.get('/v1/discovery/plugin-publications', async (c) => {
|
|
5
|
+
const discovery = getDiscovery();
|
|
6
|
+
if (!discovery) {
|
|
7
|
+
return c.json({ error: 'subsystem_not_ready', message: 'DiscoveryAPI still initialising' }, 503);
|
|
8
|
+
}
|
|
9
|
+
const solverType = c.req.query('solverType');
|
|
10
|
+
const builderAgentId = c.req.query('builderAgentId');
|
|
11
|
+
const includeRevokedRaw = c.req.query('includeRevoked');
|
|
12
|
+
const includeRevoked = includeRevokedRaw === undefined ? undefined : includeRevokedRaw !== 'false';
|
|
13
|
+
try {
|
|
14
|
+
const publications = await discovery.listPluginPublications({
|
|
15
|
+
...(solverType !== undefined ? { solverType } : {}),
|
|
16
|
+
...(builderAgentId !== undefined ? { builderAgentId } : {}),
|
|
17
|
+
...(includeRevoked !== undefined ? { includeRevoked } : {}),
|
|
18
|
+
});
|
|
19
|
+
return c.json({ publications });
|
|
20
|
+
}
|
|
21
|
+
catch (err) {
|
|
22
|
+
if (err instanceof DiscoveryUnavailableError) {
|
|
23
|
+
return c.json({ error: 'discovery_unavailable' }, 503);
|
|
24
|
+
}
|
|
25
|
+
return c.json({ error: 'internal_error', detail: err.message }, 503);
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
app.get('/v1/discovery/builder-artifacts', async (c) => {
|
|
29
|
+
const discovery = getDiscovery();
|
|
30
|
+
if (!discovery) {
|
|
31
|
+
return c.json({ error: 'subsystem_not_ready', message: 'DiscoveryAPI still initialising' }, 503);
|
|
32
|
+
}
|
|
33
|
+
const builderAgentId = c.req.query('builderAgentId');
|
|
34
|
+
if (!builderAgentId) {
|
|
35
|
+
return c.json({ error: 'builderAgentId is required' }, 400);
|
|
36
|
+
}
|
|
37
|
+
const limitRaw = c.req.query('limit');
|
|
38
|
+
const limit = limitRaw === undefined ? undefined : Number(limitRaw);
|
|
39
|
+
try {
|
|
40
|
+
const artifacts = await discovery.listBuilderArtifacts({
|
|
41
|
+
builderAgentId,
|
|
42
|
+
...(limit !== undefined && Number.isFinite(limit) ? { limit } : {}),
|
|
43
|
+
});
|
|
44
|
+
return c.json({ artifacts });
|
|
45
|
+
}
|
|
46
|
+
catch (err) {
|
|
47
|
+
if (err instanceof DiscoveryUnavailableError) {
|
|
48
|
+
return c.json({ error: 'discovery_unavailable' }, 503);
|
|
49
|
+
}
|
|
50
|
+
return c.json({ error: 'internal_error', detail: err.message }, 503);
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
// GET /v1/discovery/solvernet-operator-count?cid=<manifestCid>
|
|
54
|
+
//
|
|
55
|
+
// Returns the count of distinct operators with on-chain activity (claimed
|
|
56
|
+
// tasks) on the SolverNet identified by `cid`. Backs the operator-count
|
|
57
|
+
// surface on the launched-SolverNet dashboard (issue #351). See
|
|
58
|
+
// `DiscoveryAPI.getSolverNetOperatorCount` for why this counts
|
|
59
|
+
// *participating* operators rather than config-level "joins".
|
|
60
|
+
app.get('/v1/discovery/solvernet-operator-count', async (c) => {
|
|
61
|
+
const discovery = getDiscovery();
|
|
62
|
+
if (!discovery) {
|
|
63
|
+
return c.json({ error: 'subsystem_not_ready', message: 'DiscoveryAPI still initialising' }, 503);
|
|
64
|
+
}
|
|
65
|
+
const cid = c.req.query('cid');
|
|
66
|
+
if (!cid)
|
|
67
|
+
return c.json({ error: 'cid is required' }, 400);
|
|
68
|
+
try {
|
|
69
|
+
const operatorCount = await discovery.getSolverNetOperatorCount(cid);
|
|
70
|
+
return c.json({ manifestCid: cid, operatorCount });
|
|
71
|
+
}
|
|
72
|
+
catch (err) {
|
|
73
|
+
if (err instanceof DiscoveryUnavailableError) {
|
|
74
|
+
return c.json({ error: 'discovery_unavailable' }, 503);
|
|
75
|
+
}
|
|
76
|
+
return c.json({ error: 'internal_error', detail: err.message }, 503);
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
app.get('/v1/discovery/plugin-scores', async (c) => {
|
|
80
|
+
const discovery = getDiscovery();
|
|
81
|
+
if (!discovery) {
|
|
82
|
+
return c.json({ error: 'subsystem_not_ready', message: 'DiscoveryAPI still initialising' }, 503);
|
|
83
|
+
}
|
|
84
|
+
const cid = c.req.query('cid');
|
|
85
|
+
if (!cid)
|
|
86
|
+
return c.json({ error: 'cid is required' }, 400);
|
|
87
|
+
const limitRaw = c.req.query('limit');
|
|
88
|
+
const limit = limitRaw === undefined ? undefined : Number(limitRaw);
|
|
89
|
+
try {
|
|
90
|
+
const scores = await discovery.getPluginScores({
|
|
91
|
+
pluginCid: cid,
|
|
92
|
+
...(limit !== undefined && Number.isFinite(limit) ? { limit } : {}),
|
|
93
|
+
});
|
|
94
|
+
return c.json({ scores });
|
|
95
|
+
}
|
|
96
|
+
catch (err) {
|
|
97
|
+
if (err instanceof DiscoveryUnavailableError) {
|
|
98
|
+
return c.json({ error: 'discovery_unavailable' }, 503);
|
|
99
|
+
}
|
|
100
|
+
return c.json({ error: 'internal_error', detail: err.message }, 503);
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
//# sourceMappingURL=discovery-endpoint.js.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,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QACpE,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,eAAe,CAAC;gBAC7C,SAAS,EAAE,GAAG;gBACd,GAAG,CAAC,KAAK,KAAK,SAAS,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;aACpE,CAAC,CAAC;YACH,OAAO,CAAC,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC;QAC5B,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,IAAI,GAAG,YAAY,yBAAyB,EAAE,CAAC;gBAC7C,OAAO,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,uBAAuB,EAAE,EAAE,GAAG,CAAC,CAAC;YACzD,CAAC;YACD,OAAO,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,gBAAgB,EAAE,MAAM,EAAG,GAAa,CAAC,OAAO,EAAE,EAAE,GAAG,CAAC,CAAC;QAClF,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -30,6 +30,7 @@ export interface FleetV1Service {
|
|
|
30
30
|
staked: boolean;
|
|
31
31
|
evicted: boolean;
|
|
32
32
|
sinceBlock: number | null;
|
|
33
|
+
inactivitySeconds: number | null;
|
|
33
34
|
};
|
|
34
35
|
activity: {
|
|
35
36
|
lastEventAt: string | null;
|
|
@@ -43,6 +44,13 @@ export interface FleetV1Service {
|
|
|
43
44
|
kind: AttentionKind;
|
|
44
45
|
hint: string;
|
|
45
46
|
exampleCli: string;
|
|
47
|
+
/** Machine-readable category for programmatic consumers (e.g. CLI tools). */
|
|
48
|
+
category?: string;
|
|
49
|
+
/**
|
|
50
|
+
* Decoded contract revert reason when `category === 'safe_binding_failed'`.
|
|
51
|
+
* Null when the revert had no reason data; absent for other attention kinds.
|
|
52
|
+
*/
|
|
53
|
+
revertReason?: string | null;
|
|
46
54
|
};
|
|
47
55
|
}
|
|
48
56
|
export interface FleetV1Response {
|
package/dist/api/fleet-build.js
CHANGED
|
@@ -18,10 +18,15 @@ function computeAttention(svc, raw, isFirstService) {
|
|
|
18
18
|
};
|
|
19
19
|
}
|
|
20
20
|
if (svc.error) {
|
|
21
|
+
const hint = svc.error_short_message ?? svc.error;
|
|
21
22
|
return {
|
|
22
23
|
kind: 'reconcile_needed',
|
|
23
|
-
hint
|
|
24
|
+
hint,
|
|
24
25
|
exampleCli: 'jinn status --detail',
|
|
26
|
+
...(svc.error?.startsWith('safe_binding_failed') ? { category: 'safe_binding_failed' } : {}),
|
|
27
|
+
...(svc.error_revert_reason !== undefined
|
|
28
|
+
? { revertReason: svc.error_revert_reason }
|
|
29
|
+
: {}),
|
|
25
30
|
};
|
|
26
31
|
}
|
|
27
32
|
if (svc.step === 'safe_binding_pending') {
|
|
@@ -67,8 +72,9 @@ export function assembleFleetV1(raw) {
|
|
|
67
72
|
},
|
|
68
73
|
staking: {
|
|
69
74
|
staked: isStakedLikeServiceStep(svc.step),
|
|
70
|
-
evicted: false,
|
|
75
|
+
evicted: raw.evictedByServiceIndex?.[di] ?? false,
|
|
71
76
|
sinceBlock: null,
|
|
77
|
+
inactivitySeconds: raw.inactivityByServiceIndex?.[di] ?? null,
|
|
72
78
|
},
|
|
73
79
|
activity: {
|
|
74
80
|
lastEventAt: per?.lastEventAt ?? null,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fleet-build.js","sourceRoot":"","sources":["../../src/api/fleet-build.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,wBAAwB,EAAE,uBAAuB,EAAqB,MAAM,qBAAqB,CAAC;AAC3G,OAAO,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;
|
|
1
|
+
{"version":3,"file":"fleet-build.js","sourceRoot":"","sources":["../../src/api/f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,CAAC"}
|
|
@@ -19,6 +19,15 @@ export declare function invalidatePredictionOperatorStatusCache(config: JinnConf
|
|
|
19
19
|
export interface StatusGatherConfig {
|
|
20
20
|
earningDir: string;
|
|
21
21
|
rpcUrl: string;
|
|
22
|
+
/**
|
|
23
|
+
* tJINN ERC-20 token address — resolved from the bundled JINN MVI L1
|
|
24
|
+
* deployment artifact in `main.ts` (single source of truth). Optional so
|
|
25
|
+
* test callers can omit it; gather-status falls back to the artifact-derived
|
|
26
|
+
* default when absent.
|
|
27
|
+
*/
|
|
28
|
+
tjinnTokenAddress?: string;
|
|
29
|
+
/** tJINN chain id — resolved from the same artifact as `tjinnTokenAddress`. */
|
|
30
|
+
tjinnChainId?: number;
|
|
22
31
|
network: 'mainnet' | 'testnet';
|
|
23
32
|
pollIntervalMs: number;
|
|
24
33
|
masterEthDailyEstimateWei?: string;
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Best-effort status collection for GET /v1/status (RPC + earning store + SQLite).
|
|
3
3
|
*/
|
|
4
|
-
import { createPublicClient, http } from 'viem';
|
|
4
|
+
import { createPublicClient, getAddress, http } from 'viem';
|
|
5
5
|
import { existsSync, readFileSync } from 'node:fs';
|
|
6
6
|
import { join } from 'node:path';
|
|
7
7
|
import { base, baseSepolia } from 'viem/chains';
|
|
8
8
|
import { FleetStateStore } from '../earning/store.js';
|
|
9
|
-
import { getChainConfig } from '../earning/contracts.js';
|
|
9
|
+
import { DEFAULT_TESTNET_ARTIFACTS, getChainConfig, loadJinnMviConfig, } from '../earning/contracts.js';
|
|
10
|
+
import { createJinnL1PublicClient } from '../earning/viem-clients.js';
|
|
11
|
+
import { stage1MinMasterEth } from '../earning/bootstrap.js';
|
|
10
12
|
import { JINN_STAKING_ABI } from '../earning/jinn-rewards.js';
|
|
11
13
|
import { displayFleetServiceIndex } from '../earning/fleet-display-index.js';
|
|
12
|
-
import { assembleStatusV1, resolveMasterDailyEstimateWei, } from './status-build.js';
|
|
14
|
+
import { assembleStatusV1, pendingTjinnStatus, TJINN_PUBLIC_INVALID_SAFE_ERROR, TJINN_PUBLIC_PARTIAL_ERROR, TJINN_PUBLIC_READ_ERROR, resolveMasterDailyEstimateWei, } from './status-build.js';
|
|
13
15
|
import { listStolasClaimTargets } from '../earning/stolas-claim.js';
|
|
14
16
|
import { gatherPortfolioV0Status, DEFAULT_ENGINE_WORKING_DIR_ROOT, } from './portfolio-v0-build.js';
|
|
15
17
|
import { gatherPredictionV1Status, } from './prediction-v1-build.js';
|
|
@@ -24,6 +26,51 @@ const ERC20_BALANCE_OF_ABI = [
|
|
|
24
26
|
outputs: [{ name: '', type: 'uint256' }],
|
|
25
27
|
},
|
|
26
28
|
];
|
|
29
|
+
const TJINN_BALANCE_CACHE_TTL_MS = 30_000;
|
|
30
|
+
const TJINN_BALANCE_TIMEOUT_MS = 4_000;
|
|
31
|
+
/**
|
|
32
|
+
* tJINN token address + chain id resolved from the bundled JINN MVI L1
|
|
33
|
+
* deployment artifact — the single source of truth. Used only when the caller
|
|
34
|
+
* (`main.ts`) does not thread explicit values through `StatusGatherConfig`
|
|
35
|
+
* (e.g. test callers, sqlite-only introspection without config). Lazy + cached
|
|
36
|
+
* so the artifact read happens at most once per process.
|
|
37
|
+
*/
|
|
38
|
+
let cachedTjinnArtifactIdentity;
|
|
39
|
+
function defaultTjinnIdentity() {
|
|
40
|
+
if (!cachedTjinnArtifactIdentity) {
|
|
41
|
+
let tokenAddress;
|
|
42
|
+
let chainId;
|
|
43
|
+
try {
|
|
44
|
+
const mvi = loadJinnMviConfig({ l1ArtifactPath: DEFAULT_TESTNET_ARTIFACTS.jinnMviL1 });
|
|
45
|
+
tokenAddress = mvi.jinn;
|
|
46
|
+
chainId = mvi.l1ChainId;
|
|
47
|
+
}
|
|
48
|
+
catch {
|
|
49
|
+
// Fall through to the hard defaults below if the artifact is unreadable.
|
|
50
|
+
}
|
|
51
|
+
cachedTjinnArtifactIdentity = {
|
|
52
|
+
tokenAddress: tokenAddress ?? '0x0bc0B2f733bF4229FD58Baaac5ebFEf2AEc83C4A',
|
|
53
|
+
chainId: chainId ?? 11155111,
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
return cachedTjinnArtifactIdentity;
|
|
57
|
+
}
|
|
58
|
+
function resolveTjinnIdentity(status) {
|
|
59
|
+
const fallback = defaultTjinnIdentity();
|
|
60
|
+
return {
|
|
61
|
+
tokenAddress: status?.tjinnTokenAddress ?? fallback.tokenAddress,
|
|
62
|
+
chainId: status?.tjinnChainId ?? fallback.chainId,
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
/** Fill a fresh errors Map with `TJINN_PUBLIC_READ_ERROR` for every key. */
|
|
66
|
+
function errorsForAllKeys(keys) {
|
|
67
|
+
const errors = new Map();
|
|
68
|
+
for (const key of keys) {
|
|
69
|
+
errors.set(key, TJINN_PUBLIC_READ_ERROR);
|
|
70
|
+
}
|
|
71
|
+
return errors;
|
|
72
|
+
}
|
|
73
|
+
const tjinnBalanceCache = new Map();
|
|
27
74
|
function readDaemonRuntime(earningDir) {
|
|
28
75
|
if (!earningDir)
|
|
29
76
|
return undefined;
|
|
@@ -43,7 +90,6 @@ function readDaemonRuntime(earningDir) {
|
|
|
43
90
|
return { pidPath, pid, alive: false, stale: true };
|
|
44
91
|
}
|
|
45
92
|
}
|
|
46
|
-
const STANDARD_MASTER_BOOTSTRAP_MULTIPLIER = 2n;
|
|
47
93
|
const predictionOperatorStatusCache = new WeakMap();
|
|
48
94
|
/**
|
|
49
95
|
* Drop any cached prediction operator status for `config`.
|
|
@@ -62,6 +108,27 @@ export function invalidatePredictionOperatorStatusCache(config) {
|
|
|
62
108
|
function chainKey(network) {
|
|
63
109
|
return network === 'testnet' ? 'base-sepolia' : 'base';
|
|
64
110
|
}
|
|
111
|
+
/**
|
|
112
|
+
* Derive the SolverNet name to use for the prediction operator diagnostic.
|
|
113
|
+
*
|
|
114
|
+
* Priority: (1) first legacy `solverNets` entry name, (2) first joined entry's
|
|
115
|
+
* `name` field, (3) first joined entry's manifestCid, (4) fallback `'prediction'`.
|
|
116
|
+
*
|
|
117
|
+
* This replaces the previous hard-coded `'prediction'` string so that operators
|
|
118
|
+
* who joined a SolverNet via the manifest-keyed flow still get a useful diagnostic
|
|
119
|
+
* (jinn-mono-hjex.2).
|
|
120
|
+
*/
|
|
121
|
+
function derivePredictionSolverNetName(config) {
|
|
122
|
+
const legacyNames = Object.keys(config.solverNets);
|
|
123
|
+
if (legacyNames.length > 0)
|
|
124
|
+
return legacyNames[0];
|
|
125
|
+
const joinedEntries = Object.entries(config.joinedSolverNets ?? {});
|
|
126
|
+
if (joinedEntries.length > 0) {
|
|
127
|
+
const [cid, entry] = joinedEntries[0];
|
|
128
|
+
return entry.name ?? cid;
|
|
129
|
+
}
|
|
130
|
+
return 'prediction';
|
|
131
|
+
}
|
|
65
132
|
function predictionOperatorCacheKey(configPath, name) {
|
|
66
133
|
return `${configPath}\0${name}`;
|
|
67
134
|
}
|
|
@@ -163,6 +230,8 @@ function predictionV1Unavailable(operator, operatorError) {
|
|
|
163
230
|
solutions: 0,
|
|
164
231
|
verdicts: 0,
|
|
165
232
|
failed: 0,
|
|
233
|
+
settledFailed: 0,
|
|
234
|
+
localErrors: 0,
|
|
166
235
|
},
|
|
167
236
|
latest: {
|
|
168
237
|
taskAt: null,
|
|
@@ -177,6 +246,78 @@ function predictionV1Unavailable(operator, operatorError) {
|
|
|
177
246
|
function errorMessage(error) {
|
|
178
247
|
return error instanceof Error ? error.message : String(error);
|
|
179
248
|
}
|
|
249
|
+
function tJinnBalanceCacheKey(ethereumRpcUrl, safeKeys) {
|
|
250
|
+
return `${ethereumRpcUrl}\0${[...safeKeys].sort().join(',')}`;
|
|
251
|
+
}
|
|
252
|
+
function timeoutError(message) {
|
|
253
|
+
const error = new Error(message);
|
|
254
|
+
error.name = 'TimeoutError';
|
|
255
|
+
return error;
|
|
256
|
+
}
|
|
257
|
+
function withTimeout(promise, timeoutMs, message) {
|
|
258
|
+
return new Promise((resolve, reject) => {
|
|
259
|
+
const timer = setTimeout(() => reject(timeoutError(message)), timeoutMs);
|
|
260
|
+
promise
|
|
261
|
+
.then(resolve, reject)
|
|
262
|
+
.finally(() => clearTimeout(timer));
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
async function readTjinnBalances(ethereumRpcUrl, tokenAddress, expectedChainId, safeToAddress) {
|
|
266
|
+
const safeEntries = [...safeToAddress.entries()];
|
|
267
|
+
const client = createJinnL1PublicClient(ethereumRpcUrl, 'sepolia');
|
|
268
|
+
const chainId = await client.getChainId();
|
|
269
|
+
const balances = new Map();
|
|
270
|
+
if (chainId !== expectedChainId) {
|
|
271
|
+
return { chainId, balances, errors: errorsForAllKeys(safeToAddress.keys()) };
|
|
272
|
+
}
|
|
273
|
+
const errors = new Map();
|
|
274
|
+
// Single multicall3 round-trip (Sepolia has multicall3). `allowFailure: true`
|
|
275
|
+
// preserves the per-Safe partial-failure handling — a failed entry yields a
|
|
276
|
+
// `{ status: 'failure' }` result rather than rejecting the whole batch.
|
|
277
|
+
const results = await client.multicall({
|
|
278
|
+
allowFailure: true,
|
|
279
|
+
contracts: safeEntries.map(([, safeAddress]) => ({
|
|
280
|
+
address: tokenAddress,
|
|
281
|
+
abi: ERC20_BALANCE_OF_ABI,
|
|
282
|
+
functionName: 'balanceOf',
|
|
283
|
+
args: [safeAddress],
|
|
284
|
+
})),
|
|
285
|
+
});
|
|
286
|
+
for (let i = 0; i < results.length; i++) {
|
|
287
|
+
const result = results[i];
|
|
288
|
+
const key = safeEntries[i]?.[0];
|
|
289
|
+
if (!key)
|
|
290
|
+
continue;
|
|
291
|
+
if (result.status === 'success') {
|
|
292
|
+
balances.set(key, result.result.toString());
|
|
293
|
+
}
|
|
294
|
+
else {
|
|
295
|
+
errors.set(key, TJINN_PUBLIC_READ_ERROR);
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
return { chainId, balances, errors };
|
|
299
|
+
}
|
|
300
|
+
async function getCachedTjinnBalances(ethereumRpcUrl, tokenAddress, expectedChainId, safeToAddress) {
|
|
301
|
+
const safeKeys = [...safeToAddress.keys()].sort();
|
|
302
|
+
const cacheKey = tJinnBalanceCacheKey(ethereumRpcUrl, safeKeys);
|
|
303
|
+
const now = Date.now();
|
|
304
|
+
const cached = tjinnBalanceCache.get(cacheKey);
|
|
305
|
+
if (cached && cached.expiresAt > now) {
|
|
306
|
+
return cached.promise;
|
|
307
|
+
}
|
|
308
|
+
const promise = withTimeout(readTjinnBalances(ethereumRpcUrl, tokenAddress, expectedChainId, safeToAddress), TJINN_BALANCE_TIMEOUT_MS, 'tJINN balance collection timed out').catch(() => {
|
|
309
|
+
return {
|
|
310
|
+
chainId: expectedChainId,
|
|
311
|
+
balances: new Map(),
|
|
312
|
+
errors: errorsForAllKeys(safeKeys),
|
|
313
|
+
};
|
|
314
|
+
});
|
|
315
|
+
tjinnBalanceCache.set(cacheKey, {
|
|
316
|
+
expiresAt: now + TJINN_BALANCE_CACHE_TTL_MS,
|
|
317
|
+
promise,
|
|
318
|
+
});
|
|
319
|
+
return promise;
|
|
320
|
+
}
|
|
180
321
|
async function sumPendingStakingRewards(rpcUrl, network, fleet) {
|
|
181
322
|
const targets = listStolasClaimTargets(fleet.services);
|
|
182
323
|
if (targets.length === 0) {
|
|
@@ -228,6 +369,112 @@ async function sumPendingStakingRewards(rpcUrl, network, fleet) {
|
|
|
228
369
|
return { error: e instanceof Error ? e.message : String(e) };
|
|
229
370
|
}
|
|
230
371
|
}
|
|
372
|
+
/**
|
|
373
|
+
* Resolve the public error string for a tJINN status with at least one error.
|
|
374
|
+
*
|
|
375
|
+
* Flattened from a 3-deep nested ternary into guard clauses:
|
|
376
|
+
* - partial success (some balances read) → PARTIAL
|
|
377
|
+
* - only invalid-Safe errors → INVALID_SAFE
|
|
378
|
+
* - otherwise (RPC read failures) → READ_ERROR
|
|
379
|
+
*
|
|
380
|
+
* Caller must only invoke this when `hasInvalidSafe || hasReadError` is true.
|
|
381
|
+
*/
|
|
382
|
+
function tjinnPublicError(opts) {
|
|
383
|
+
if (opts.hasAnyBalance)
|
|
384
|
+
return TJINN_PUBLIC_PARTIAL_ERROR;
|
|
385
|
+
if (opts.hasInvalidSafe && !opts.hasReadError)
|
|
386
|
+
return TJINN_PUBLIC_INVALID_SAFE_ERROR;
|
|
387
|
+
return TJINN_PUBLIC_READ_ERROR;
|
|
388
|
+
}
|
|
389
|
+
async function gatherTjinnStatus(ethereumRpcUrl, tokenAddress, chainId, fleet) {
|
|
390
|
+
if (!fleet) {
|
|
391
|
+
return pendingTjinnStatus(tokenAddress, chainId);
|
|
392
|
+
}
|
|
393
|
+
const services = [];
|
|
394
|
+
const safeToAddress = new Map();
|
|
395
|
+
for (const svc of fleet.services) {
|
|
396
|
+
const index = displayFleetServiceIndex(svc);
|
|
397
|
+
const safeAddress = svc.safe_address;
|
|
398
|
+
if (!safeAddress) {
|
|
399
|
+
services.push({
|
|
400
|
+
index,
|
|
401
|
+
safeAddress: null,
|
|
402
|
+
balanceWei: null,
|
|
403
|
+
state: 'pending',
|
|
404
|
+
error: null,
|
|
405
|
+
});
|
|
406
|
+
continue;
|
|
407
|
+
}
|
|
408
|
+
try {
|
|
409
|
+
const checksum = getAddress(safeAddress);
|
|
410
|
+
const key = checksum.toLowerCase();
|
|
411
|
+
services.push({
|
|
412
|
+
index,
|
|
413
|
+
safeAddress: checksum,
|
|
414
|
+
balanceWei: null,
|
|
415
|
+
state: 'pending',
|
|
416
|
+
error: null,
|
|
417
|
+
});
|
|
418
|
+
safeToAddress.set(key, checksum);
|
|
419
|
+
}
|
|
420
|
+
catch {
|
|
421
|
+
services.push({
|
|
422
|
+
index,
|
|
423
|
+
safeAddress,
|
|
424
|
+
balanceWei: null,
|
|
425
|
+
state: 'error',
|
|
426
|
+
error: TJINN_PUBLIC_INVALID_SAFE_ERROR,
|
|
427
|
+
});
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
const safeCount = safeToAddress.size;
|
|
431
|
+
if (safeCount === 0) {
|
|
432
|
+
const invalid = services.find((svc) => svc.state === 'error')?.error;
|
|
433
|
+
return pendingTjinnStatus(tokenAddress, chainId, {
|
|
434
|
+
state: invalid ? 'error' : 'pending',
|
|
435
|
+
safeCount,
|
|
436
|
+
services,
|
|
437
|
+
error: invalid ?? null,
|
|
438
|
+
});
|
|
439
|
+
}
|
|
440
|
+
if (!ethereumRpcUrl) {
|
|
441
|
+
return pendingTjinnStatus(tokenAddress, chainId, { safeCount, services });
|
|
442
|
+
}
|
|
443
|
+
const snapshot = await getCachedTjinnBalances(ethereumRpcUrl, tokenAddress, chainId, safeToAddress);
|
|
444
|
+
let total = 0n;
|
|
445
|
+
for (const balance of snapshot.balances.values()) {
|
|
446
|
+
total += BigInt(balance);
|
|
447
|
+
}
|
|
448
|
+
const hasInvalidSafe = services.some((svc) => svc.error === TJINN_PUBLIC_INVALID_SAFE_ERROR);
|
|
449
|
+
const hasReadError = snapshot.errors.size > 0;
|
|
450
|
+
const hasAnyError = hasInvalidSafe || hasReadError;
|
|
451
|
+
const hasAnyBalance = snapshot.balances.size > 0;
|
|
452
|
+
const publicError = hasAnyError
|
|
453
|
+
? tjinnPublicError({ hasInvalidSafe, hasReadError, hasAnyBalance })
|
|
454
|
+
: null;
|
|
455
|
+
return pendingTjinnStatus(tokenAddress, snapshot.chainId, {
|
|
456
|
+
state: hasAnyError ? 'error' : 'ready',
|
|
457
|
+
safeBalanceWei: hasAnyBalance ? total.toString() : null,
|
|
458
|
+
safeCount,
|
|
459
|
+
services: services.map((svc) => {
|
|
460
|
+
if (!svc.safeAddress)
|
|
461
|
+
return svc;
|
|
462
|
+
if (svc.state === 'error')
|
|
463
|
+
return svc;
|
|
464
|
+
const key = svc.safeAddress.toLowerCase();
|
|
465
|
+
const balance = snapshot.balances.get(key);
|
|
466
|
+
if (balance !== undefined) {
|
|
467
|
+
return { ...svc, state: 'ready', balanceWei: balance, error: null };
|
|
468
|
+
}
|
|
469
|
+
return {
|
|
470
|
+
...svc,
|
|
471
|
+
state: 'error',
|
|
472
|
+
error: snapshot.errors.get(key) ?? TJINN_PUBLIC_READ_ERROR,
|
|
473
|
+
};
|
|
474
|
+
}),
|
|
475
|
+
error: publicError,
|
|
476
|
+
});
|
|
477
|
+
}
|
|
231
478
|
function hasUsefulCacheValues(entry, isAgentRole) {
|
|
232
479
|
if (isAgentRole)
|
|
233
480
|
return entry.nativeWei != null;
|
|
@@ -350,6 +597,7 @@ export async function gatherGatheredStatusRaw(store, status) {
|
|
|
350
597
|
}));
|
|
351
598
|
const lastRewardClaimTickAt = store.getConfigValue('last_reward_claim_tick_at');
|
|
352
599
|
const daily = resolveMasterDailyEstimateWei(status?.masterEthDailyEstimateWei, status?.pollIntervalMs ?? 5000);
|
|
600
|
+
const tjinnIdentity = resolveTjinnIdentity(status);
|
|
353
601
|
// portfolio.v0 lifecycle data — best-effort, never throws
|
|
354
602
|
let portfolioV0;
|
|
355
603
|
try {
|
|
@@ -369,7 +617,8 @@ export async function gatherGatheredStatusRaw(store, status) {
|
|
|
369
617
|
let predictionOperatorError;
|
|
370
618
|
if (status?.config) {
|
|
371
619
|
try {
|
|
372
|
-
const
|
|
620
|
+
const solverNetName = derivePredictionSolverNetName(status.config);
|
|
621
|
+
const raw = await getCachedPredictionOperatorStatus(status.config, status.configPath ?? '<default>', solverNetName);
|
|
373
622
|
predictionOperator = narrowOperatorStatusForApi(raw);
|
|
374
623
|
}
|
|
375
624
|
catch (error) {
|
|
@@ -410,6 +659,8 @@ export async function gatherGatheredStatusRaw(store, status) {
|
|
|
410
659
|
serviceBalances: {},
|
|
411
660
|
pendingByService: {},
|
|
412
661
|
claimedByService: store.getClaimedRewardsByService(),
|
|
662
|
+
tjinnTokenAddress: tjinnIdentity.tokenAddress,
|
|
663
|
+
tjinnChainId: tjinnIdentity.chainId,
|
|
413
664
|
};
|
|
414
665
|
if (!status) {
|
|
415
666
|
return { ...baseRaw, hintsScope: 'sqlite_only' };
|
|
@@ -424,13 +675,35 @@ export async function gatherGatheredStatusRaw(store, status) {
|
|
|
424
675
|
testnetMechDeploymentPath: status.testnetMechDeploymentPath,
|
|
425
676
|
testnetStolasDeploymentPath: status.testnetStolasDeploymentPath,
|
|
426
677
|
});
|
|
678
|
+
// Start the Sepolia tJINN read up front so it overlaps the Base-RPC fan-out
|
|
679
|
+
// below for free. `gatherTjinnStatus` is internally error-safe (it catches
|
|
680
|
+
// and returns a snapshot), so the promise never rejects — it is awaited at
|
|
681
|
+
// the point its result is assigned to `raw.tJinn`.
|
|
682
|
+
const tJinnPromise = gatherTjinnStatus(status.network === 'testnet' ? status.config?.ethereumRpcUrl : undefined, tjinnIdentity.tokenAddress, tjinnIdentity.chainId, fleet);
|
|
427
683
|
const raw = {
|
|
428
684
|
...baseRaw,
|
|
429
685
|
fleet,
|
|
430
686
|
migrationArchive: migrationArchive.entries.length > 0 ? migrationArchive : undefined,
|
|
431
687
|
rpc: { ok: false, error: undefined },
|
|
432
|
-
|
|
433
|
-
|
|
688
|
+
// Pre-Stage-1 (fleet state missing or fleet_stage === 'none'):
|
|
689
|
+
// stage1MinMasterEth returns the FULL bootstrap budget — Stage 1 transfer
|
|
690
|
+
// + Stage 2 reserve + per-extra-service top-ups — so the operator funds
|
|
691
|
+
// ONCE and the daemon doesn't re-prompt at the Stage 2 gate. See
|
|
692
|
+
// jinn-mono-u34i (gate-vs-transfer parity) and the one-shot-funding
|
|
693
|
+
// follow-up.
|
|
694
|
+
// Post-Stage-1, fall back to the existing 1× / 2× minEoaGasEth heuristic
|
|
695
|
+
// (the operator already funded Stage 1; this gate only needs to cover
|
|
696
|
+
// what's left).
|
|
697
|
+
minMasterEthWei: (!fleet || fleet.fleet_stage === 'none'
|
|
698
|
+
? stage1MinMasterEth(chainCfg, status?.config?.targetServices ?? 1)
|
|
699
|
+
: // Stage 2 master gas budget — minEoaGasEth (stake gas) + per-extra-
|
|
700
|
+
// service transfers. The historic `× 2` for fresh fleets was wrong:
|
|
701
|
+
// it double-counted a service-1 transfer that doesn't fire (HD-1
|
|
702
|
+
// carries Stage 1 leftover). Dropped in jinn-mono-u34i so the
|
|
703
|
+
// operator-facing 0.020 ETH budget actually clears Stage 2's gate.
|
|
704
|
+
chainCfg.minEoaGasEth +
|
|
705
|
+
chainCfg.minEoaGasEth *
|
|
706
|
+
BigInt(Math.max(0, (status?.config?.targetServices ?? 1) - 1))).toString(),
|
|
434
707
|
master: {
|
|
435
708
|
address: fleet?.master_address ?? null,
|
|
436
709
|
},
|
|
@@ -486,6 +759,51 @@ export async function gatherGatheredStatusRaw(store, status) {
|
|
|
486
759
|
else {
|
|
487
760
|
raw.pendingRewardsError = pr.error;
|
|
488
761
|
}
|
|
762
|
+
// Eviction state + inactivity — best-effort; never blocks the rest of status assembly.
|
|
763
|
+
try {
|
|
764
|
+
const evictedByServiceIndex = {};
|
|
765
|
+
const inactivityByServiceIndex = {};
|
|
766
|
+
await Promise.all(fleet.services.map(async (svc) => {
|
|
767
|
+
const serviceId = svc.service_id;
|
|
768
|
+
const stakingProxy = svc.staking_address;
|
|
769
|
+
if (!serviceId || !stakingProxy)
|
|
770
|
+
return;
|
|
771
|
+
const di = displayFleetServiceIndex(svc);
|
|
772
|
+
try {
|
|
773
|
+
const [state, info] = await Promise.all([
|
|
774
|
+
client.readContract({
|
|
775
|
+
address: stakingProxy,
|
|
776
|
+
abi: JINN_STAKING_ABI,
|
|
777
|
+
functionName: 'getStakingState',
|
|
778
|
+
args: [BigInt(serviceId)],
|
|
779
|
+
}),
|
|
780
|
+
client.readContract({
|
|
781
|
+
address: stakingProxy,
|
|
782
|
+
abi: JINN_STAKING_ABI,
|
|
783
|
+
functionName: 'getServiceInfo',
|
|
784
|
+
args: [BigInt(serviceId)],
|
|
785
|
+
}).catch(() => null),
|
|
786
|
+
]);
|
|
787
|
+
// getStakingState returns uint8; 2 = Evicted enum value
|
|
788
|
+
evictedByServiceIndex[di] = Number(state) === 2;
|
|
789
|
+
// getServiceInfo returns a struct — inactivity is seconds of accumulated inactivity
|
|
790
|
+
if (info != null) {
|
|
791
|
+
const inactivity = info.inactivity;
|
|
792
|
+
if (typeof inactivity === 'bigint') {
|
|
793
|
+
inactivityByServiceIndex[di] = Number(inactivity);
|
|
794
|
+
}
|
|
795
|
+
}
|
|
796
|
+
}
|
|
797
|
+
catch {
|
|
798
|
+
// Transient RPC errors: skip silently; evicted defaults to false
|
|
799
|
+
}
|
|
800
|
+
}));
|
|
801
|
+
raw.evictedByServiceIndex = evictedByServiceIndex;
|
|
802
|
+
raw.inactivityByServiceIndex = inactivityByServiceIndex;
|
|
803
|
+
}
|
|
804
|
+
catch {
|
|
805
|
+
// Non-fatal: staking state reads should not prevent status from returning
|
|
806
|
+
}
|
|
489
807
|
}
|
|
490
808
|
if (fleet) {
|
|
491
809
|
const per = {};
|
|
@@ -503,6 +821,11 @@ export async function gatherGatheredStatusRaw(store, status) {
|
|
|
503
821
|
raw.serviceBalanceErrors = bal.errorsByDisplay;
|
|
504
822
|
}
|
|
505
823
|
}
|
|
824
|
+
// The tJINN read started up front (overlapping the Base-RPC fan-out). It is
|
|
825
|
+
// awaited here, as late as possible — after ALL other awaited Base-chain work
|
|
826
|
+
// — so the up-to-4s tJINN timeout never serializes the Base fan-out behind it.
|
|
827
|
+
// `gatherTjinnStatus` is internally error-safe, so a plain await is safe.
|
|
828
|
+
raw.tJinn = await tJinnPromise;
|
|
506
829
|
return raw;
|
|
507
830
|
}
|
|
508
831
|
export async function gatherStatusForApi(store, status) {
|