@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
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { readFileSync } from 'node:fs';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
import { CLAUDE_CODE_HARNESS, CODEX_HARNESS, canonicalHarnessName } from '../harnesses/names.js';
|
|
4
|
+
import { estimateModelCost } from '../harnesses/cost-estimates.js';
|
|
5
|
+
import { priceTokens } from './pricing.js';
|
|
6
|
+
/** USD attributed to a task whose model has no known price. */
|
|
7
|
+
export const UNKNOWN_MODEL_FALLBACK_USD = 1.0;
|
|
8
|
+
/** Parse Claude Code `--output-format stream-json` output for the terminal result. */
|
|
9
|
+
export function parseClaudeCodeUsage(stdoutJsonl) {
|
|
10
|
+
let result = null;
|
|
11
|
+
for (const line of stdoutJsonl.split('\n')) {
|
|
12
|
+
const trimmed = line.trim();
|
|
13
|
+
if (!trimmed)
|
|
14
|
+
continue;
|
|
15
|
+
let obj;
|
|
16
|
+
try {
|
|
17
|
+
obj = JSON.parse(trimmed);
|
|
18
|
+
}
|
|
19
|
+
catch {
|
|
20
|
+
continue;
|
|
21
|
+
}
|
|
22
|
+
if (obj['type'] === 'result' && typeof obj['total_cost_usd'] === 'number') {
|
|
23
|
+
const usage = obj['usage'];
|
|
24
|
+
result = {
|
|
25
|
+
costUsd: obj['total_cost_usd'],
|
|
26
|
+
inputTokens: typeof usage?.['input_tokens'] === 'number' ? usage['input_tokens'] : undefined,
|
|
27
|
+
outputTokens: typeof usage?.['output_tokens'] === 'number' ? usage['output_tokens'] : undefined,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return result;
|
|
32
|
+
}
|
|
33
|
+
/** Parse Codex `--json` output for the last turn.completed token usage. */
|
|
34
|
+
export function parseCodexUsage(stdoutJsonl) {
|
|
35
|
+
let result = null;
|
|
36
|
+
for (const line of stdoutJsonl.split('\n')) {
|
|
37
|
+
const trimmed = line.trim();
|
|
38
|
+
if (!trimmed)
|
|
39
|
+
continue;
|
|
40
|
+
let obj;
|
|
41
|
+
try {
|
|
42
|
+
obj = JSON.parse(trimmed);
|
|
43
|
+
}
|
|
44
|
+
catch {
|
|
45
|
+
continue;
|
|
46
|
+
}
|
|
47
|
+
if (obj['type'] === 'turn.completed' && obj['usage']) {
|
|
48
|
+
const usage = obj['usage'];
|
|
49
|
+
const inT = usage['input_tokens'];
|
|
50
|
+
const outT = usage['output_tokens'];
|
|
51
|
+
if (typeof inT === 'number' && typeof outT === 'number') {
|
|
52
|
+
result = { inputTokens: inT, outputTokens: outT };
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return result;
|
|
57
|
+
}
|
|
58
|
+
function heuristicUsage(model) {
|
|
59
|
+
const est = model ? estimateModelCost(model) : null;
|
|
60
|
+
return {
|
|
61
|
+
model: model ?? 'unknown',
|
|
62
|
+
costUsd: est?.usd ?? UNKNOWN_MODEL_FALLBACK_USD,
|
|
63
|
+
estimated: true,
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Determine the USD cost of a finished harness run. Reads the harness's own
|
|
68
|
+
* output file for observed usage; falls back to a heuristic on any failure.
|
|
69
|
+
* Always returns a HarnessUsage — never throws.
|
|
70
|
+
*/
|
|
71
|
+
export function harvestHarnessUsage(harness, workingDir, model) {
|
|
72
|
+
try {
|
|
73
|
+
const canonical = canonicalHarnessName(harness);
|
|
74
|
+
if (canonical === CLAUDE_CODE_HARNESS) {
|
|
75
|
+
const raw = readFileSync(join(workingDir, '.claude-code', 'stdout.jsonl'), 'utf8');
|
|
76
|
+
const parsed = parseClaudeCodeUsage(raw);
|
|
77
|
+
if (parsed) {
|
|
78
|
+
return {
|
|
79
|
+
model: model ?? 'unknown',
|
|
80
|
+
costUsd: parsed.costUsd,
|
|
81
|
+
estimated: false,
|
|
82
|
+
inputTokens: parsed.inputTokens,
|
|
83
|
+
outputTokens: parsed.outputTokens,
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
return heuristicUsage(model);
|
|
87
|
+
}
|
|
88
|
+
if (canonical === CODEX_HARNESS) {
|
|
89
|
+
const raw = readFileSync(join(workingDir, '.codex-code', 'stdout.jsonl'), 'utf8');
|
|
90
|
+
const parsed = parseCodexUsage(raw);
|
|
91
|
+
// When there is no model id, parsed token counts cannot be priced —
|
|
92
|
+
// discard them and fall back to the heuristic (per spec).
|
|
93
|
+
if (parsed && model) {
|
|
94
|
+
const usd = priceTokens(model, parsed);
|
|
95
|
+
if (usd != null) {
|
|
96
|
+
return {
|
|
97
|
+
model,
|
|
98
|
+
costUsd: usd,
|
|
99
|
+
estimated: false,
|
|
100
|
+
inputTokens: parsed.inputTokens,
|
|
101
|
+
outputTokens: parsed.outputTokens,
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
return heuristicUsage(model);
|
|
106
|
+
}
|
|
107
|
+
return heuristicUsage(model);
|
|
108
|
+
}
|
|
109
|
+
catch {
|
|
110
|
+
return heuristicUsage(model);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
//# sourceMappingURL=usage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usage.js","sourceRoot":"","sources":["../../src/spend/usage.ts"],"names":[],"mappings":"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"}
|
package/dist/store/store.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import Database from 'better-sqlite3';
|
|
2
2
|
import type { EnvelopeProjection, EnvelopeProjectionQuery } from '../corpus/types.js';
|
|
3
|
+
import type { TxSubmissionKey, TxSubmissionLedgerEntry } from '../tx-retry.js';
|
|
3
4
|
export interface ActivityEventInput {
|
|
4
5
|
ts: string | null;
|
|
5
6
|
kind: string;
|
|
@@ -9,6 +10,9 @@ export interface ActivityEventInput {
|
|
|
9
10
|
solverType?: string | null;
|
|
10
11
|
outcome?: string | null;
|
|
11
12
|
detail?: string | null;
|
|
13
|
+
credentialId?: string | null;
|
|
14
|
+
costUsdMicros?: number | null;
|
|
15
|
+
model?: string | null;
|
|
12
16
|
}
|
|
13
17
|
export interface ActivityEventRow {
|
|
14
18
|
id: number;
|
|
@@ -20,6 +24,9 @@ export interface ActivityEventRow {
|
|
|
20
24
|
solverType: string | null;
|
|
21
25
|
outcome: string | null;
|
|
22
26
|
detail: string | null;
|
|
27
|
+
credentialId: string | null;
|
|
28
|
+
costUsdMicros: number | null;
|
|
29
|
+
model: string | null;
|
|
23
30
|
}
|
|
24
31
|
export interface RewardClaimInput {
|
|
25
32
|
ts: string;
|
|
@@ -147,6 +154,22 @@ export interface NetworkArtifactMetadataRow {
|
|
|
147
154
|
lastUsedAt: string;
|
|
148
155
|
peerCatalogId: string | null;
|
|
149
156
|
}
|
|
157
|
+
export interface Erc8004AnchorInput {
|
|
158
|
+
envelopeId: string;
|
|
159
|
+
envelopeCid: string;
|
|
160
|
+
contentKind: string;
|
|
161
|
+
metadataKey: string;
|
|
162
|
+
agentId: string;
|
|
163
|
+
chainId: number;
|
|
164
|
+
identityRegistryAddress: string;
|
|
165
|
+
txHash: string;
|
|
166
|
+
blockNumber: number | null;
|
|
167
|
+
payloadHex: string;
|
|
168
|
+
anchoredAt: number;
|
|
169
|
+
}
|
|
170
|
+
export interface Erc8004AnchorRow extends Erc8004AnchorInput {
|
|
171
|
+
id: number;
|
|
172
|
+
}
|
|
150
173
|
export type TaskPostingPolicyType = 'once_per_safe' | 'once_per_bucket' | 'interval';
|
|
151
174
|
type LauncherTaskProjectionState = 'open' | 'claims-in-flight' | 'fully-claimed' | 'settled' | 'failed';
|
|
152
175
|
export interface TaskPostRecord {
|
|
@@ -166,6 +189,15 @@ export declare class Store {
|
|
|
166
189
|
/** Exposed for engine persistence layer — treat as package-internal. */
|
|
167
190
|
readonly db: Database.Database;
|
|
168
191
|
readonly path: string;
|
|
192
|
+
/**
|
|
193
|
+
* Legacy schemas predating Task-native IDs (#406) defined `desired_state_id`
|
|
194
|
+
* as `TEXT NOT NULL` on `artifacts`. Newer code only writes `task_id`, which
|
|
195
|
+
* makes inserts revert with "NOT NULL constraint failed: artifacts.desired_state_id"
|
|
196
|
+
* on databases created before the migration. We can't ALTER COLUMN to drop
|
|
197
|
+
* the constraint in SQLite without rebuilding the table, so we detect the
|
|
198
|
+
* legacy column on startup and mirror `task_id` into it from `insertArtifact`.
|
|
199
|
+
*/
|
|
200
|
+
private hasLegacyDesiredStateId;
|
|
169
201
|
constructor(dbPath: string);
|
|
170
202
|
/** Older request-first DBs keyed artifacts by desired_state_id before Task-native IDs landed. */
|
|
171
203
|
private ensureArtifactsTaskColumns;
|
|
@@ -175,6 +207,8 @@ export declare class Store {
|
|
|
175
207
|
private ensureTaskPostsTaskCoordinatorColumns;
|
|
176
208
|
/** Older local DBs may have the projection table from before Task grouping fields landed. */
|
|
177
209
|
private ensureEnvelopeProjectionColumns;
|
|
210
|
+
/** Older local DBs predate the per-credential spend-ledger columns on activity_events. */
|
|
211
|
+
private ensureActivityEventCostColumns;
|
|
178
212
|
/**
|
|
179
213
|
* Task-native startup ignores the retired request-first `restoration_intents`
|
|
180
214
|
* table. Keep a one-time local marker when old in-flight rows are present so
|
|
@@ -189,6 +223,11 @@ export declare class Store {
|
|
|
189
223
|
getShutdownState(): string | null;
|
|
190
224
|
setDaemonStartedAt(value: string): void;
|
|
191
225
|
getDaemonStartedAt(): string | null;
|
|
226
|
+
recordTxSubmission(entry: TxSubmissionLedgerEntry): void;
|
|
227
|
+
getTxSubmission(key: TxSubmissionKey): TxSubmissionLedgerEntry | null;
|
|
228
|
+
markTxSubmissionResolved(key: TxSubmissionKey & {
|
|
229
|
+
resolvedAtMs: number;
|
|
230
|
+
}): void;
|
|
192
231
|
/** Generic config row (e.g. last_reward_claim_tick_at). */
|
|
193
232
|
getConfigValue(key: string): string | null;
|
|
194
233
|
setConfigValue(key: string, value: string): void;
|
|
@@ -264,8 +303,28 @@ export declare class Store {
|
|
|
264
303
|
since?: string;
|
|
265
304
|
cursor?: string;
|
|
266
305
|
}): ActivityEventRow[];
|
|
306
|
+
/**
|
|
307
|
+
* Total cost in micro-dollars recorded against a credential since the most
|
|
308
|
+
* recent UTC midnight. Backs the daily spend cap.
|
|
309
|
+
*/
|
|
310
|
+
spentTodayMicros(credentialId: string, now?: Date): number;
|
|
267
311
|
/** Newer events first, then ascending id for `jinn logs --follow` (oldest in batch printed first in caller). */
|
|
268
312
|
getActivityEventsAfterId(afterId: number, limit: number): ActivityEventRow[];
|
|
313
|
+
/**
|
|
314
|
+
* Filtered, id-cursored page of activity events for the dedicated Events
|
|
315
|
+
* page. Newest-first.
|
|
316
|
+
*
|
|
317
|
+
* Cursors on `id` rather than `ts` so startup/shutdown rows with null
|
|
318
|
+
* timestamps remain reachable.
|
|
319
|
+
*/
|
|
320
|
+
getActivityEventsPage(opts?: {
|
|
321
|
+
kinds?: string[];
|
|
322
|
+
outcome?: string;
|
|
323
|
+
requestId?: string;
|
|
324
|
+
beforeId?: number;
|
|
325
|
+
limit?: number;
|
|
326
|
+
}): ActivityEventRow[];
|
|
327
|
+
getActivityEventById(id: number): ActivityEventRow | null;
|
|
269
328
|
getActivityCountsByKind(): Record<string, number>;
|
|
270
329
|
getLastEventAtForService(serviceIndex: number): string | null;
|
|
271
330
|
getActivityCountsForService(serviceIndex: number): Record<string, number>;
|
|
@@ -383,6 +442,8 @@ export declare class Store {
|
|
|
383
442
|
}>;
|
|
384
443
|
saveEnvelopeProjection(projection: EnvelopeProjection): void;
|
|
385
444
|
queryEnvelopeProjections(query?: EnvelopeProjectionQuery): EnvelopeProjection[];
|
|
445
|
+
saveErc8004Anchor(input: Erc8004AnchorInput): void;
|
|
446
|
+
listErc8004AnchorsByEnvelopeCids(envelopeCids: readonly string[]): Erc8004AnchorRow[];
|
|
386
447
|
close(): void;
|
|
387
448
|
}
|
|
388
449
|
export {};
|
package/dist/store/store.js
CHANGED
|
@@ -73,6 +73,26 @@ CREATE INDEX IF NOT EXISTS idx_activity_events_ts ON activity_events (ts DESC);
|
|
|
73
73
|
CREATE INDEX IF NOT EXISTS idx_activity_events_req ON activity_events (request_id);
|
|
74
74
|
CREATE INDEX IF NOT EXISTS idx_activity_events_service_idx ON activity_events (service_index);
|
|
75
75
|
|
|
76
|
+
CREATE TABLE IF NOT EXISTS tx_submissions (
|
|
77
|
+
chain_id INTEGER NOT NULL,
|
|
78
|
+
from_address TEXT NOT NULL,
|
|
79
|
+
nonce INTEGER NOT NULL,
|
|
80
|
+
hash TEXT,
|
|
81
|
+
logical_tx TEXT,
|
|
82
|
+
submitted_at_ms INTEGER NOT NULL,
|
|
83
|
+
max_fee_per_gas TEXT,
|
|
84
|
+
max_priority_fee_per_gas TEXT,
|
|
85
|
+
gas_price TEXT,
|
|
86
|
+
to_address TEXT,
|
|
87
|
+
value_wei TEXT,
|
|
88
|
+
data TEXT,
|
|
89
|
+
resolved_at_ms INTEGER,
|
|
90
|
+
PRIMARY KEY (chain_id, from_address, nonce)
|
|
91
|
+
);
|
|
92
|
+
CREATE INDEX IF NOT EXISTS idx_tx_submissions_unresolved
|
|
93
|
+
ON tx_submissions (chain_id, from_address, nonce)
|
|
94
|
+
WHERE resolved_at_ms IS NULL;
|
|
95
|
+
|
|
76
96
|
CREATE TABLE IF NOT EXISTS reward_claims (
|
|
77
97
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
78
98
|
ts TEXT NOT NULL,
|
|
@@ -208,6 +228,23 @@ CREATE TABLE IF NOT EXISTS envelope_projection_metadata (
|
|
|
208
228
|
CREATE INDEX IF NOT EXISTS idx_envelope_projection_metadata_key_value
|
|
209
229
|
ON envelope_projection_metadata (key, value_text);
|
|
210
230
|
|
|
231
|
+
CREATE TABLE IF NOT EXISTS erc8004_anchors (
|
|
232
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
233
|
+
envelope_id TEXT NOT NULL,
|
|
234
|
+
envelope_cid TEXT NOT NULL,
|
|
235
|
+
content_kind TEXT NOT NULL,
|
|
236
|
+
metadata_key TEXT NOT NULL,
|
|
237
|
+
agent_id TEXT NOT NULL,
|
|
238
|
+
chain_id INTEGER NOT NULL,
|
|
239
|
+
identity_registry_address TEXT NOT NULL,
|
|
240
|
+
tx_hash TEXT NOT NULL,
|
|
241
|
+
block_number INTEGER,
|
|
242
|
+
payload_hex TEXT NOT NULL,
|
|
243
|
+
anchored_at INTEGER NOT NULL
|
|
244
|
+
);
|
|
245
|
+
CREATE INDEX IF NOT EXISTS idx_erc8004_anchors_envelope_cid ON erc8004_anchors(envelope_cid);
|
|
246
|
+
CREATE INDEX IF NOT EXISTS idx_erc8004_anchors_envelope_id ON erc8004_anchors(envelope_id);
|
|
247
|
+
|
|
211
248
|
CREATE TABLE IF NOT EXISTS task_post_locks (
|
|
212
249
|
creator_safe_address TEXT NOT NULL,
|
|
213
250
|
source_key TEXT NOT NULL,
|
|
@@ -256,6 +293,15 @@ export class Store {
|
|
|
256
293
|
/** Exposed for engine persistence layer — treat as package-internal. */
|
|
257
294
|
db;
|
|
258
295
|
path;
|
|
296
|
+
/**
|
|
297
|
+
* Legacy schemas predating Task-native IDs (#406) defined `desired_state_id`
|
|
298
|
+
* as `TEXT NOT NULL` on `artifacts`. Newer code only writes `task_id`, which
|
|
299
|
+
* makes inserts revert with "NOT NULL constraint failed: artifacts.desired_state_id"
|
|
300
|
+
* on databases created before the migration. We can't ALTER COLUMN to drop
|
|
301
|
+
* the constraint in SQLite without rebuilding the table, so we detect the
|
|
302
|
+
* legacy column on startup and mirror `task_id` into it from `insertArtifact`.
|
|
303
|
+
*/
|
|
304
|
+
hasLegacyDesiredStateId = false;
|
|
259
305
|
constructor(dbPath) {
|
|
260
306
|
this.path = dbPath;
|
|
261
307
|
if (dbPath !== ':memory:') {
|
|
@@ -270,6 +316,7 @@ export class Store {
|
|
|
270
316
|
this.ensureNetworkArtifactsPeerCatalogId();
|
|
271
317
|
this.ensureTaskPostsTaskCoordinatorColumns();
|
|
272
318
|
this.ensureEnvelopeProjectionColumns();
|
|
319
|
+
this.ensureActivityEventCostColumns();
|
|
273
320
|
this.backfillActivityEvents();
|
|
274
321
|
this.recordLegacyRestorationIntentsIgnored();
|
|
275
322
|
}
|
|
@@ -277,9 +324,10 @@ export class Store {
|
|
|
277
324
|
ensureArtifactsTaskColumns() {
|
|
278
325
|
const cols = this.db.prepare(`PRAGMA table_info(artifacts)`).all();
|
|
279
326
|
const names = new Set(cols.map((c) => c.name));
|
|
327
|
+
this.hasLegacyDesiredStateId = names.has('desired_state_id');
|
|
280
328
|
if (!names.has('task_id')) {
|
|
281
329
|
this.db.exec(`ALTER TABLE artifacts ADD COLUMN task_id TEXT`);
|
|
282
|
-
if (
|
|
330
|
+
if (this.hasLegacyDesiredStateId) {
|
|
283
331
|
this.db.exec(`UPDATE artifacts SET task_id = desired_state_id WHERE task_id IS NULL`);
|
|
284
332
|
}
|
|
285
333
|
}
|
|
@@ -333,6 +381,19 @@ export class Store {
|
|
|
333
381
|
this.db.exec(`CREATE INDEX IF NOT EXISTS idx_envelope_projections_solution_ref ON envelope_projections (solution_envelope_ref)`);
|
|
334
382
|
this.db.exec(`CREATE INDEX IF NOT EXISTS idx_envelope_projections_generated ON envelope_projections (generated_at DESC)`);
|
|
335
383
|
}
|
|
384
|
+
/** Older local DBs predate the per-credential spend-ledger columns on activity_events. */
|
|
385
|
+
ensureActivityEventCostColumns() {
|
|
386
|
+
const activityCols = new Set(this.db.prepare(`PRAGMA table_info(activity_events)`).all()
|
|
387
|
+
.map(c => c.name));
|
|
388
|
+
const addActivityColumn = (name, ddl) => {
|
|
389
|
+
if (!activityCols.has(name))
|
|
390
|
+
this.db.exec(`ALTER TABLE activity_events ADD COLUMN ${ddl}`);
|
|
391
|
+
};
|
|
392
|
+
addActivityColumn('credential_id', 'credential_id TEXT');
|
|
393
|
+
addActivityColumn('cost_usd_micros', 'cost_usd_micros INTEGER');
|
|
394
|
+
addActivityColumn('model', 'model TEXT');
|
|
395
|
+
this.db.exec(`CREATE INDEX IF NOT EXISTS idx_activity_events_credential ON activity_events (credential_id, ts)`);
|
|
396
|
+
}
|
|
336
397
|
/**
|
|
337
398
|
* Task-native startup ignores the retired request-first `restoration_intents`
|
|
338
399
|
* table. Keep a one-time local marker when old in-flight rows are present so
|
|
@@ -405,6 +466,85 @@ export class Store {
|
|
|
405
466
|
const row = this.db.prepare('SELECT value FROM config WHERE key = ?').get('daemon_started_at');
|
|
406
467
|
return row?.value ?? null;
|
|
407
468
|
}
|
|
469
|
+
recordTxSubmission(entry) {
|
|
470
|
+
this.db.prepare(`INSERT INTO tx_submissions
|
|
471
|
+
(chain_id, from_address, nonce, hash, logical_tx, submitted_at_ms,
|
|
472
|
+
max_fee_per_gas, max_priority_fee_per_gas, gas_price, to_address, value_wei, data, resolved_at_ms)
|
|
473
|
+
VALUES
|
|
474
|
+
(@chainId, @fromAddress, @nonce, @hash, @logicalTx, @submittedAtMs,
|
|
475
|
+
@maxFeePerGas, @maxPriorityFeePerGas, @gasPrice, @toAddress, @valueWei, @data, @resolvedAtMs)
|
|
476
|
+
ON CONFLICT(chain_id, from_address, nonce) DO UPDATE SET
|
|
477
|
+
hash = excluded.hash,
|
|
478
|
+
logical_tx = excluded.logical_tx,
|
|
479
|
+
submitted_at_ms = excluded.submitted_at_ms,
|
|
480
|
+
max_fee_per_gas = excluded.max_fee_per_gas,
|
|
481
|
+
max_priority_fee_per_gas = excluded.max_priority_fee_per_gas,
|
|
482
|
+
gas_price = excluded.gas_price,
|
|
483
|
+
to_address = excluded.to_address,
|
|
484
|
+
value_wei = excluded.value_wei,
|
|
485
|
+
data = excluded.data,
|
|
486
|
+
resolved_at_ms = excluded.resolved_at_ms`).run({
|
|
487
|
+
chainId: entry.chainId,
|
|
488
|
+
fromAddress: entry.from.toLowerCase(),
|
|
489
|
+
nonce: entry.nonce,
|
|
490
|
+
hash: entry.hash ?? null,
|
|
491
|
+
logicalTx: entry.logicalTx ?? null,
|
|
492
|
+
submittedAtMs: entry.submittedAtMs,
|
|
493
|
+
maxFeePerGas: entry.fees.maxFeePerGas?.toString() ?? null,
|
|
494
|
+
maxPriorityFeePerGas: entry.fees.maxPriorityFeePerGas?.toString() ?? null,
|
|
495
|
+
gasPrice: entry.fees.gasPrice?.toString() ?? null,
|
|
496
|
+
toAddress: entry.to?.toLowerCase() ?? null,
|
|
497
|
+
valueWei: entry.value?.toString() ?? null,
|
|
498
|
+
data: entry.data ?? null,
|
|
499
|
+
resolvedAtMs: entry.resolvedAtMs ?? null,
|
|
500
|
+
});
|
|
501
|
+
}
|
|
502
|
+
getTxSubmission(key) {
|
|
503
|
+
const row = this.db.prepare(`SELECT chain_id, from_address, nonce, hash, logical_tx, submitted_at_ms,
|
|
504
|
+
max_fee_per_gas, max_priority_fee_per_gas, gas_price,
|
|
505
|
+
to_address, value_wei, data, resolved_at_ms
|
|
506
|
+
FROM tx_submissions
|
|
507
|
+
WHERE chain_id = @chainId
|
|
508
|
+
AND from_address = @fromAddress
|
|
509
|
+
AND nonce = @nonce`).get({
|
|
510
|
+
chainId: key.chainId,
|
|
511
|
+
fromAddress: key.from.toLowerCase(),
|
|
512
|
+
nonce: key.nonce,
|
|
513
|
+
});
|
|
514
|
+
if (!row)
|
|
515
|
+
return null;
|
|
516
|
+
return {
|
|
517
|
+
chainId: row.chain_id,
|
|
518
|
+
from: row.from_address,
|
|
519
|
+
nonce: row.nonce,
|
|
520
|
+
hash: row.hash,
|
|
521
|
+
logicalTx: row.logical_tx ?? undefined,
|
|
522
|
+
submittedAtMs: row.submitted_at_ms,
|
|
523
|
+
fees: {
|
|
524
|
+
...(row.max_fee_per_gas !== null ? { maxFeePerGas: BigInt(row.max_fee_per_gas) } : {}),
|
|
525
|
+
...(row.max_priority_fee_per_gas !== null
|
|
526
|
+
? { maxPriorityFeePerGas: BigInt(row.max_priority_fee_per_gas) }
|
|
527
|
+
: {}),
|
|
528
|
+
...(row.gas_price !== null ? { gasPrice: BigInt(row.gas_price) } : {}),
|
|
529
|
+
},
|
|
530
|
+
to: row.to_address,
|
|
531
|
+
value: row.value_wei === null ? undefined : BigInt(row.value_wei),
|
|
532
|
+
data: row.data,
|
|
533
|
+
resolvedAtMs: row.resolved_at_ms,
|
|
534
|
+
};
|
|
535
|
+
}
|
|
536
|
+
markTxSubmissionResolved(key) {
|
|
537
|
+
this.db.prepare(`UPDATE tx_submissions
|
|
538
|
+
SET resolved_at_ms = @resolvedAtMs
|
|
539
|
+
WHERE chain_id = @chainId
|
|
540
|
+
AND from_address = @fromAddress
|
|
541
|
+
AND nonce = @nonce`).run({
|
|
542
|
+
chainId: key.chainId,
|
|
543
|
+
fromAddress: key.from.toLowerCase(),
|
|
544
|
+
nonce: key.nonce,
|
|
545
|
+
resolvedAtMs: key.resolvedAtMs,
|
|
546
|
+
});
|
|
547
|
+
}
|
|
408
548
|
/** Generic config row (e.g. last_reward_claim_tick_at). */
|
|
409
549
|
getConfigValue(key) {
|
|
410
550
|
const row = this.db.prepare('SELECT value FROM config WHERE key = ?').get(key);
|
|
@@ -637,8 +777,12 @@ export class Store {
|
|
|
637
777
|
return legacyRows.map(r => ({ requestId: r.request_id, role: r.role }));
|
|
638
778
|
}
|
|
639
779
|
recordActivityEvent(event) {
|
|
640
|
-
this.db.prepare(`INSERT INTO activity_events
|
|
641
|
-
|
|
780
|
+
this.db.prepare(`INSERT INTO activity_events
|
|
781
|
+
(ts, kind, request_id, service_index, tx_hash, solver_type, outcome, detail,
|
|
782
|
+
credential_id, cost_usd_micros, model)
|
|
783
|
+
VALUES
|
|
784
|
+
(@ts, @kind, @requestId, @serviceIndex, @txHash, @solverType, @outcome, @detail,
|
|
785
|
+
@credentialId, @costUsdMicros, @model)`).run({
|
|
642
786
|
ts: event.ts ?? null,
|
|
643
787
|
kind: event.kind,
|
|
644
788
|
requestId: event.requestId ?? null,
|
|
@@ -647,6 +791,9 @@ export class Store {
|
|
|
647
791
|
solverType: event.solverType ?? null,
|
|
648
792
|
outcome: event.outcome ?? null,
|
|
649
793
|
detail: event.detail ?? null,
|
|
794
|
+
credentialId: event.credentialId ?? null,
|
|
795
|
+
costUsdMicros: event.costUsdMicros ?? null,
|
|
796
|
+
model: event.model ?? null,
|
|
650
797
|
});
|
|
651
798
|
}
|
|
652
799
|
getRecentActivityEvents(limit, opts = {}) {
|
|
@@ -662,7 +809,8 @@ export class Store {
|
|
|
662
809
|
params['cursor'] = opts.cursor;
|
|
663
810
|
}
|
|
664
811
|
const where = clauses.length > 0 ? `WHERE ${clauses.join(' AND ')}` : '';
|
|
665
|
-
const rows = this.db.prepare(`SELECT id, ts, kind, request_id, service_index, tx_hash, solver_type, outcome, detail
|
|
812
|
+
const rows = this.db.prepare(`SELECT id, ts, kind, request_id, service_index, tx_hash, solver_type, outcome, detail,
|
|
813
|
+
credential_id, cost_usd_micros, model
|
|
666
814
|
FROM activity_events
|
|
667
815
|
${where}
|
|
668
816
|
ORDER BY id DESC
|
|
@@ -677,13 +825,28 @@ export class Store {
|
|
|
677
825
|
solverType: r.solver_type,
|
|
678
826
|
outcome: r.outcome,
|
|
679
827
|
detail: r.detail,
|
|
828
|
+
credentialId: r.credential_id,
|
|
829
|
+
costUsdMicros: r.cost_usd_micros,
|
|
830
|
+
model: r.model,
|
|
680
831
|
}));
|
|
681
832
|
}
|
|
833
|
+
/**
|
|
834
|
+
* Total cost in micro-dollars recorded against a credential since the most
|
|
835
|
+
* recent UTC midnight. Backs the daily spend cap.
|
|
836
|
+
*/
|
|
837
|
+
spentTodayMicros(credentialId, now = new Date()) {
|
|
838
|
+
const midnight = new Date(Date.UTC(now.getUTCFullYear(), now.getUTCMonth(), now.getUTCDate())).toISOString();
|
|
839
|
+
const row = this.db.prepare(`SELECT COALESCE(SUM(cost_usd_micros), 0) AS total
|
|
840
|
+
FROM activity_events
|
|
841
|
+
WHERE credential_id = @cid AND ts IS NOT NULL AND ts >= @midnight`).get({ cid: credentialId, midnight });
|
|
842
|
+
return row.total;
|
|
843
|
+
}
|
|
682
844
|
/** Newer events first, then ascending id for `jinn logs --follow` (oldest in batch printed first in caller). */
|
|
683
845
|
getActivityEventsAfterId(afterId, limit) {
|
|
684
846
|
const effectiveLimit = Math.max(0, Math.min(limit, 1000));
|
|
685
847
|
const rows = this.db
|
|
686
|
-
.prepare(`SELECT id, ts, kind, request_id, service_index, tx_hash, solver_type, outcome, detail
|
|
848
|
+
.prepare(`SELECT id, ts, kind, request_id, service_index, tx_hash, solver_type, outcome, detail,
|
|
849
|
+
credential_id, cost_usd_micros, model
|
|
687
850
|
FROM activity_events
|
|
688
851
|
WHERE id > @afterId
|
|
689
852
|
ORDER BY id ASC
|
|
@@ -699,8 +862,85 @@ export class Store {
|
|
|
699
862
|
solverType: r.solver_type,
|
|
700
863
|
outcome: r.outcome,
|
|
701
864
|
detail: r.detail,
|
|
865
|
+
credentialId: r.credential_id,
|
|
866
|
+
costUsdMicros: r.cost_usd_micros,
|
|
867
|
+
model: r.model,
|
|
702
868
|
}));
|
|
703
869
|
}
|
|
870
|
+
/**
|
|
871
|
+
* Filtered, id-cursored page of activity events for the dedicated Events
|
|
872
|
+
* page. Newest-first.
|
|
873
|
+
*
|
|
874
|
+
* Cursors on `id` rather than `ts` so startup/shutdown rows with null
|
|
875
|
+
* timestamps remain reachable.
|
|
876
|
+
*/
|
|
877
|
+
getActivityEventsPage(opts = {}) {
|
|
878
|
+
const effectiveLimit = Math.max(1, Math.min(opts.limit ?? 50, 200));
|
|
879
|
+
const clauses = [];
|
|
880
|
+
const params = { limit: effectiveLimit };
|
|
881
|
+
if (opts.kinds && opts.kinds.length > 0) {
|
|
882
|
+
const placeholders = opts.kinds.map((_, i) => `@kind${i}`);
|
|
883
|
+
clauses.push(`kind IN (${placeholders.join(', ')})`);
|
|
884
|
+
opts.kinds.forEach((k, i) => {
|
|
885
|
+
params[`kind${i}`] = k;
|
|
886
|
+
});
|
|
887
|
+
}
|
|
888
|
+
if (opts.outcome) {
|
|
889
|
+
clauses.push('outcome = @outcome');
|
|
890
|
+
params['outcome'] = opts.outcome;
|
|
891
|
+
}
|
|
892
|
+
if (opts.requestId) {
|
|
893
|
+
clauses.push('request_id = @requestId');
|
|
894
|
+
params['requestId'] = opts.requestId;
|
|
895
|
+
}
|
|
896
|
+
if (opts.beforeId !== undefined) {
|
|
897
|
+
clauses.push('id < @beforeId');
|
|
898
|
+
params['beforeId'] = opts.beforeId;
|
|
899
|
+
}
|
|
900
|
+
const where = clauses.length > 0 ? `WHERE ${clauses.join(' AND ')}` : '';
|
|
901
|
+
const rows = this.db.prepare(`SELECT id, ts, kind, request_id, service_index, tx_hash, solver_type, outcome, detail,
|
|
902
|
+
credential_id, cost_usd_micros, model
|
|
903
|
+
FROM activity_events
|
|
904
|
+
${where}
|
|
905
|
+
ORDER BY id DESC
|
|
906
|
+
LIMIT @limit`).all(params);
|
|
907
|
+
return rows.map((r) => ({
|
|
908
|
+
id: r.id,
|
|
909
|
+
ts: r.ts,
|
|
910
|
+
kind: r.kind,
|
|
911
|
+
requestId: r.request_id,
|
|
912
|
+
serviceIndex: r.service_index,
|
|
913
|
+
txHash: r.tx_hash,
|
|
914
|
+
solverType: r.solver_type,
|
|
915
|
+
outcome: r.outcome,
|
|
916
|
+
detail: r.detail,
|
|
917
|
+
credentialId: r.credential_id,
|
|
918
|
+
costUsdMicros: r.cost_usd_micros,
|
|
919
|
+
model: r.model,
|
|
920
|
+
}));
|
|
921
|
+
}
|
|
922
|
+
getActivityEventById(id) {
|
|
923
|
+
const r = this.db.prepare(`SELECT id, ts, kind, request_id, service_index, tx_hash, solver_type, outcome, detail,
|
|
924
|
+
credential_id, cost_usd_micros, model
|
|
925
|
+
FROM activity_events
|
|
926
|
+
WHERE id = ?`).get(id);
|
|
927
|
+
if (!r)
|
|
928
|
+
return null;
|
|
929
|
+
return {
|
|
930
|
+
id: r.id,
|
|
931
|
+
ts: r.ts,
|
|
932
|
+
kind: r.kind,
|
|
933
|
+
requestId: r.request_id,
|
|
934
|
+
serviceIndex: r.service_index,
|
|
935
|
+
txHash: r.tx_hash,
|
|
936
|
+
solverType: r.solver_type,
|
|
937
|
+
outcome: r.outcome,
|
|
938
|
+
detail: r.detail,
|
|
939
|
+
credentialId: r.credential_id,
|
|
940
|
+
costUsdMicros: r.cost_usd_micros,
|
|
941
|
+
model: r.model,
|
|
942
|
+
};
|
|
943
|
+
}
|
|
704
944
|
getActivityCountsByKind() {
|
|
705
945
|
const rows = this.db.prepare(`SELECT kind, COUNT(*) as c FROM activity_events GROUP BY kind`).all();
|
|
706
946
|
const out = {};
|
|
@@ -815,9 +1055,15 @@ export class Store {
|
|
|
815
1055
|
this.db.prepare('INSERT OR REPLACE INTO config (key, value) VALUES (?, ?)').run('last_processed_block', block.toString());
|
|
816
1056
|
}
|
|
817
1057
|
insertArtifact(artifact) {
|
|
1058
|
+
const columns = ['id', 'task_id', 'request_id', 'title', 'content', 'tags', 'outcome'];
|
|
1059
|
+
const values = ['@id', '@taskId', '@requestId', '@title', '@content', '@tags', '@outcome'];
|
|
1060
|
+
if (this.hasLegacyDesiredStateId) {
|
|
1061
|
+
columns.push('desired_state_id');
|
|
1062
|
+
values.push('@taskId');
|
|
1063
|
+
}
|
|
818
1064
|
this.db.prepare(`
|
|
819
|
-
INSERT OR REPLACE INTO artifacts (
|
|
820
|
-
VALUES (
|
|
1065
|
+
INSERT OR REPLACE INTO artifacts (${columns.join(', ')})
|
|
1066
|
+
VALUES (${values.join(', ')})
|
|
821
1067
|
`).run({
|
|
822
1068
|
...artifact,
|
|
823
1069
|
tags: JSON.stringify(artifact.tags),
|
|
@@ -1404,6 +1650,55 @@ export class Store {
|
|
|
1404
1650
|
LIMIT @limit`).all(params);
|
|
1405
1651
|
return rows.map(rowToEnvelopeProjection);
|
|
1406
1652
|
}
|
|
1653
|
+
saveErc8004Anchor(input) {
|
|
1654
|
+
this.db.prepare(`INSERT INTO erc8004_anchors
|
|
1655
|
+
(envelope_id, envelope_cid, content_kind, metadata_key, agent_id,
|
|
1656
|
+
chain_id, identity_registry_address, tx_hash, block_number,
|
|
1657
|
+
payload_hex, anchored_at)
|
|
1658
|
+
VALUES
|
|
1659
|
+
(@envelopeId, @envelopeCid, @contentKind, @metadataKey, @agentId,
|
|
1660
|
+
@chainId, @identityRegistryAddress, @txHash, @blockNumber,
|
|
1661
|
+
@payloadHex, @anchoredAt)`).run({
|
|
1662
|
+
envelopeId: input.envelopeId,
|
|
1663
|
+
envelopeCid: input.envelopeCid,
|
|
1664
|
+
contentKind: input.contentKind,
|
|
1665
|
+
metadataKey: input.metadataKey,
|
|
1666
|
+
agentId: input.agentId,
|
|
1667
|
+
chainId: input.chainId,
|
|
1668
|
+
identityRegistryAddress: input.identityRegistryAddress,
|
|
1669
|
+
txHash: input.txHash,
|
|
1670
|
+
blockNumber: input.blockNumber,
|
|
1671
|
+
payloadHex: input.payloadHex,
|
|
1672
|
+
anchoredAt: input.anchoredAt,
|
|
1673
|
+
});
|
|
1674
|
+
}
|
|
1675
|
+
listErc8004AnchorsByEnvelopeCids(envelopeCids) {
|
|
1676
|
+
if (envelopeCids.length === 0)
|
|
1677
|
+
return [];
|
|
1678
|
+
const placeholders = envelopeCids.map((_, i) => `@cid${i}`).join(', ');
|
|
1679
|
+
const params = {};
|
|
1680
|
+
envelopeCids.forEach((cid, i) => { params[`cid${i}`] = cid; });
|
|
1681
|
+
const rows = this.db.prepare(`SELECT id, envelope_id, envelope_cid, content_kind, metadata_key, agent_id,
|
|
1682
|
+
chain_id, identity_registry_address, tx_hash, block_number,
|
|
1683
|
+
payload_hex, anchored_at
|
|
1684
|
+
FROM erc8004_anchors
|
|
1685
|
+
WHERE envelope_cid IN (${placeholders})
|
|
1686
|
+
ORDER BY anchored_at ASC, id ASC`).all(params);
|
|
1687
|
+
return rows.map((r) => ({
|
|
1688
|
+
id: r.id,
|
|
1689
|
+
envelopeId: r.envelope_id,
|
|
1690
|
+
envelopeCid: r.envelope_cid,
|
|
1691
|
+
contentKind: r.content_kind,
|
|
1692
|
+
metadataKey: r.metadata_key,
|
|
1693
|
+
agentId: r.agent_id,
|
|
1694
|
+
chainId: r.chain_id,
|
|
1695
|
+
identityRegistryAddress: r.identity_registry_address,
|
|
1696
|
+
txHash: r.tx_hash,
|
|
1697
|
+
blockNumber: r.block_number,
|
|
1698
|
+
payloadHex: r.payload_hex,
|
|
1699
|
+
anchoredAt: r.anchored_at,
|
|
1700
|
+
}));
|
|
1701
|
+
}
|
|
1407
1702
|
close() {
|
|
1408
1703
|
this.db.close();
|
|
1409
1704
|
}
|