@parcha/agentrun-serve 0.1.0-beta.37 → 0.1.0-beta.39
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 +700 -0
- package/README.md +441 -177
- package/dist/adapters.d.ts +4 -1
- package/dist/adapters.js +4 -2
- package/dist/agent-rows.d.ts +1 -3
- package/dist/agents-store.d.ts +35 -3
- package/dist/agents-store.js +48 -23
- package/dist/answer-json.d.ts +34 -1
- package/dist/answer-json.js +91 -9
- package/dist/api-only.d.ts +1 -1
- package/dist/api-only.js +2 -2
- package/dist/bash-read-only.js +2 -1
- package/dist/browser-cost.js +52 -93
- package/dist/cap-short.d.ts +12 -0
- package/dist/cap-short.js +60 -0
- package/dist/cap.d.ts +3 -400
- package/dist/cap.js +6 -942
- package/dist/catalog.d.ts +0 -5
- package/dist/catalog.js +2 -6
- package/dist/chatgpt-plan.d.ts +163 -0
- package/dist/chatgpt-plan.js +549 -0
- package/dist/cli.js +26 -6
- package/dist/composio-preset.d.ts +25 -0
- package/dist/composio-preset.js +51 -8
- package/dist/composio-triggers.d.ts +113 -0
- package/dist/composio-triggers.js +411 -0
- package/dist/computer-calls.d.ts +36 -24
- package/dist/computer-calls.js +110 -27
- package/dist/computer-commands.d.ts +2 -0
- package/dist/computer-commands.js +7 -3
- package/dist/computer-live.d.ts +12 -2
- package/dist/computer-live.js +21 -5
- package/dist/computer-routes.d.ts +2 -2
- package/dist/computer-routes.js +2 -2
- package/dist/computer-setting.d.ts +15 -2
- package/dist/computer-setting.js +20 -4
- package/dist/computer-view.d.ts +18 -2
- package/dist/computer-view.js +21 -6
- package/dist/computer-viewer.js +40 -13
- package/dist/computers.d.ts +8 -2
- package/dist/computers.js +18 -8
- package/dist/console/assets/index-BNhZs-jp.css +1 -0
- package/dist/console/assets/index-BQv5aOGB.js +700 -0
- package/dist/console/index.html +2 -2
- package/dist/console-links.d.ts +2 -0
- package/dist/console-links.js +6 -3
- package/dist/decision-cap.d.ts +2 -5
- package/dist/decision-cap.js +3 -6
- package/dist/decision-rows.js +11 -11
- package/dist/decisions.js +4 -0
- package/dist/email/account.d.ts +84 -0
- package/dist/email/account.js +159 -0
- package/dist/email/answer.d.ts +10 -0
- package/dist/email/answer.js +182 -0
- package/dist/email/email-faux.d.ts +95 -0
- package/dist/email/email-faux.js +849 -0
- package/dist/email/labels.d.ts +1 -0
- package/dist/email/labels.js +84 -0
- package/dist/email/mail.d.ts +186 -0
- package/dist/email/mail.js +380 -0
- package/dist/email/names.d.ts +20 -0
- package/dist/email/names.js +40 -0
- package/dist/email/routes.d.ts +9 -0
- package/dist/email/routes.js +50 -0
- package/dist/email/tools.d.ts +20 -0
- package/dist/email/tools.js +517 -0
- package/dist/environment.d.ts +17 -2
- package/dist/environment.js +36 -8
- package/dist/errors.d.ts +6 -0
- package/dist/errors.js +12 -0
- package/dist/eval-mailbox.d.ts +103 -0
- package/dist/eval-mailbox.js +236 -0
- package/dist/faux-computers.js +4 -2
- package/dist/graph-view.d.ts +9 -2
- package/dist/graph-view.js +6 -2
- package/dist/harness-install.d.ts +28 -2
- package/dist/harness-install.js +147 -59
- package/dist/harness-opencode/adapter.js +2 -22
- package/dist/harness-opencode/facts.js +5 -4
- package/dist/harness-opencode/host/policy.d.ts +4 -5
- package/dist/harness-opencode/host/policy.js +14 -33
- package/dist/harness-opencode/index.d.ts +1 -1
- package/dist/harness-opencode/index.js +1 -1
- package/dist/harness-opencode/versions.d.ts +6 -0
- package/dist/harness-opencode/versions.js +6 -0
- package/dist/harness-table.d.ts +0 -2
- package/dist/harness-table.js +8 -7
- package/dist/harness.d.ts +12 -0
- package/dist/harness.js +15 -3
- package/dist/host-tools.d.ts +1 -5
- package/dist/host-tools.js +7 -10
- package/dist/hosted-search.d.ts +3 -3
- package/dist/hosted-search.js +51 -32
- package/dist/import-sources.d.ts +1 -1
- package/dist/import-sources.js +3 -3
- package/dist/import.d.ts +21 -0
- package/dist/import.js +186 -1
- package/dist/key-check.d.ts +0 -2
- package/dist/key-check.js +3 -4
- package/dist/key-refusal.d.ts +8 -2
- package/dist/key-refusal.js +16 -13
- package/dist/key-words.d.ts +3 -2
- package/dist/key-words.js +4 -2
- package/dist/learn/check.d.ts +24 -4
- package/dist/learn/check.js +340 -7
- package/dist/learn/commit.d.ts +10 -0
- package/dist/learn/commit.js +18 -4
- package/dist/learn/compile.d.ts +250 -0
- package/dist/learn/compile.js +507 -0
- package/dist/learn/general.d.ts +3 -0
- package/dist/learn/general.js +4 -2
- package/dist/learn/grade.d.ts +5 -1
- package/dist/learn/grade.js +11 -7
- package/dist/learn/notes.d.ts +8 -0
- package/dist/learn/notes.js +18 -0
- package/dist/learn/promote.d.ts +308 -0
- package/dist/learn/promote.js +321 -0
- package/dist/learn/refit.d.ts +48 -0
- package/dist/learn/refit.js +264 -0
- package/dist/learn/reflect.d.ts +5 -25
- package/dist/learn/reflect.js +14 -131
- package/dist/learn/replay-calls.d.ts +63 -0
- package/dist/learn/replay-calls.js +158 -0
- package/dist/learn/skills.d.ts +19 -16
- package/dist/learn/skills.js +157 -53
- package/dist/learn/workflow-nodes.d.ts +15 -0
- package/dist/learn/workflow-nodes.js +44 -0
- package/dist/learned-nodes.d.ts +58 -2
- package/dist/learned-nodes.js +68 -5
- package/dist/learned-workflow.d.ts +58 -32
- package/dist/learned-workflow.js +215 -77
- package/dist/learning-batch.d.ts +2 -2
- package/dist/learning-batch.js +4 -4
- package/dist/learning-cost.d.ts +41 -11
- package/dist/learning-cost.js +31 -13
- package/dist/learning-routes.d.ts +12 -2
- package/dist/learning-routes.js +34 -6
- package/dist/learning-words.d.ts +8 -1
- package/dist/learning-words.js +11 -1
- package/dist/learning.d.ts +26 -1
- package/dist/learning.js +7 -4
- package/dist/link-check.d.ts +27 -0
- package/dist/link-check.js +164 -0
- package/dist/llm.js +0 -3
- package/dist/local-models.d.ts +33 -2
- package/dist/local-models.js +43 -5
- package/dist/mcp-gateway.d.ts +12 -20
- package/dist/mcp-gateway.js +16 -44
- package/dist/mcp-oauth.d.ts +5 -0
- package/dist/mcp-oauth.js +1 -1
- package/dist/mcp-pin-first.d.ts +37 -0
- package/dist/mcp-pin-first.js +113 -0
- package/dist/mcp-probe.d.ts +8 -9
- package/dist/mcp-probe.js +16 -33
- package/dist/mcp-secret-writes.js +3 -0
- package/dist/mcp-servers-store.d.ts +102 -26
- package/dist/mcp-servers-store.js +151 -25
- package/dist/mcp-sources.d.ts +39 -0
- package/dist/mcp-sources.js +74 -0
- package/dist/mcp-store.d.ts +11 -0
- package/dist/mcp-store.js +16 -2
- package/dist/mcp-wire.d.ts +22 -0
- package/dist/mcp-wire.js +36 -0
- package/dist/mcp.js +3 -3
- package/dist/meta-tool-names.d.ts +1 -0
- package/dist/meta-tool-names.js +3 -0
- package/dist/model-form.d.ts +11 -0
- package/dist/model-form.js +17 -1
- package/dist/model.d.ts +39 -6
- package/dist/model.js +171 -32
- package/dist/monid.d.ts +50 -29
- package/dist/monid.js +234 -143
- package/dist/native/binding.d.ts +13 -0
- package/dist/native/binding.js +57 -0
- package/dist/native/cli.d.ts +2 -0
- package/dist/native/cli.js +48 -0
- package/dist/native/connection.d.ts +8 -0
- package/dist/native/connection.js +94 -0
- package/dist/native/context.d.ts +6 -0
- package/dist/native/context.js +22 -0
- package/dist/native/discovery.d.ts +27 -0
- package/dist/native/discovery.js +404 -0
- package/dist/native/environment.d.ts +4 -0
- package/dist/native/environment.js +18 -0
- package/dist/native/history.d.ts +20 -0
- package/dist/native/history.js +147 -0
- package/dist/native/instructions.d.ts +21 -0
- package/dist/native/instructions.js +173 -0
- package/dist/native/remote-worker-bridge.d.ts +3 -0
- package/dist/native/remote-worker-bridge.js +278 -0
- package/dist/native/remote.d.ts +187 -0
- package/dist/native/remote.js +492 -0
- package/dist/native/runtime.d.ts +17 -0
- package/dist/native/runtime.js +316 -0
- package/dist/native/runtimes.d.ts +66 -0
- package/dist/native/runtimes.js +41 -0
- package/dist/native/schema.d.ts +46 -0
- package/dist/native/schema.js +41 -0
- package/dist/native/types.d.ts +87 -0
- package/dist/native/types.js +1 -0
- package/dist/observation/http.d.ts +4 -0
- package/dist/observation/http.js +140 -0
- package/dist/observation/observer.d.ts +301 -0
- package/dist/observation/observer.js +919 -0
- package/dist/observation/schema.d.ts +52 -0
- package/dist/observation/schema.js +154 -0
- package/dist/openapi.d.ts +1 -0
- package/dist/openapi.js +705 -126
- package/dist/paid-calls.d.ts +34 -32
- package/dist/paid-calls.js +52 -104
- package/dist/place-offers.d.ts +4 -8
- package/dist/place-offers.js +4 -9
- package/dist/port-models.d.ts +7 -2
- package/dist/port-models.js +5 -2
- package/dist/print.d.ts +4 -2
- package/dist/print.js +4 -3
- package/dist/propose.d.ts +8 -3
- package/dist/propose.js +28 -7
- package/dist/provider.d.ts +5 -1
- package/dist/provider.js +17 -2
- package/dist/push-handler.d.ts +3 -2
- package/dist/push-handler.js +20 -6
- package/dist/reflect-range.js +2 -1
- package/dist/refusal-words.d.ts +11 -0
- package/dist/refusal-words.js +13 -2
- package/dist/rows.d.ts +5 -3
- package/dist/rows.js +15 -4
- package/dist/run-launch.d.ts +23 -1
- package/dist/run-launch.js +17 -4
- package/dist/run-learning-served.d.ts +84 -0
- package/dist/run-manifest.d.ts +8 -0
- package/dist/run-manifest.js +33 -1
- package/dist/run-reads-over-store.d.ts +3 -3
- package/dist/run-reads-over-store.js +13 -10
- package/dist/run-secrets.js +2 -3
- package/dist/run-timeline-served.d.ts +3 -2
- package/dist/run-timeline-served.js +12 -10
- package/dist/run-view.d.ts +59 -41
- package/dist/run-view.js +128 -64
- package/dist/runnable.d.ts +13 -8
- package/dist/runnable.js +77 -60
- package/dist/runner/adapter-loop.d.ts +60 -15
- package/dist/runner/adapter-loop.js +1406 -464
- package/dist/runner/adapter-run-spec.d.ts +45 -14
- package/dist/runner/adapter-run-spec.js +200 -116
- package/dist/runner/adapters/pi.d.ts +40 -7
- package/dist/runner/adapters/pi.js +149 -38
- package/dist/runner/beside.d.ts +3 -1
- package/dist/runner/beside.js +24 -8
- package/dist/runner/claim-secrets.d.ts +3 -1
- package/dist/runner/claim-secrets.js +28 -4
- package/dist/runner/cli-run-spec.d.ts +30 -0
- package/dist/runner/cli-run-spec.js +150 -66
- package/dist/runner/computer-channel.d.ts +5 -2
- package/dist/runner/computer-channel.js +5 -3
- package/dist/runner/computer-journal.d.ts +6 -0
- package/dist/runner/computer-journal.js +8 -10
- package/dist/runner/conformance/harness.d.ts +3 -0
- package/dist/runner/conformance/harness.js +149 -5
- package/dist/runner/conformance/subject.d.ts +11 -4
- package/dist/runner/end-of-run.d.ts +8 -5
- package/dist/runner/end-of-run.js +11 -6
- package/dist/runner/feedback-round.d.ts +79 -0
- package/dist/runner/feedback-round.js +127 -0
- package/dist/runner/harness-loops.js +17 -0
- package/dist/runner/journal-kinds.d.ts +55 -13
- package/dist/runner/journal-kinds.js +19 -0
- package/dist/runner/learning-dispatch.d.ts +3 -2
- package/dist/runner/learning-dispatch.js +6 -6
- package/dist/runner/learning-end.d.ts +58 -19
- package/dist/runner/learning-end.js +316 -115
- package/dist/runner/learning-factory.d.ts +3 -0
- package/dist/runner/learning-factory.js +8 -2
- package/dist/runner/learning-loop.d.ts +21 -1
- package/dist/runner/learning-loop.js +24 -6
- package/dist/runner/learning-seed.d.ts +4 -0
- package/dist/runner/learning-seed.js +14 -0
- package/dist/runner/loop-contract.d.ts +19 -3
- package/dist/runner/loop.d.ts +34 -1
- package/dist/runner/loop.js +55 -1
- package/dist/runner/main.d.ts +6 -1
- package/dist/runner/main.js +26 -4
- package/dist/runner/mcp-claim.d.ts +5 -1
- package/dist/runner/mcp-claim.js +66 -50
- package/dist/runner/mcp-run.d.ts +20 -53
- package/dist/runner/mcp-run.js +22 -88
- package/dist/runner/meta-tools.d.ts +44 -0
- package/dist/runner/meta-tools.js +344 -0
- package/dist/runner/metrics.d.ts +80 -21
- package/dist/runner/metrics.js +128 -42
- package/dist/runner/model-route.d.ts +12 -3
- package/dist/runner/model-route.js +149 -19
- package/dist/runner/monid-run.d.ts +18 -0
- package/dist/runner/monid-run.js +170 -0
- package/dist/runner/native-loop.d.ts +11 -0
- package/dist/runner/native-loop.js +438 -0
- package/dist/runner/promotion.d.ts +146 -0
- package/dist/runner/promotion.js +803 -0
- package/dist/runner/redact.js +3 -0
- package/dist/runner/reflect-hook.d.ts +36 -21
- package/dist/runner/reflect-hook.js +147 -49
- package/dist/runner/runner.d.ts +7 -1
- package/dist/runner/runner.js +34 -8
- package/dist/runner/sdk-loop.d.ts +7 -0
- package/dist/runner/sdk-loop.js +470 -0
- package/dist/runner/sessions.d.ts +8 -3
- package/dist/runner/sessions.js +5 -1
- package/dist/runner/spec-holds.d.ts +16 -2
- package/dist/runner/spec-holds.js +42 -14
- package/dist/runner/step-guard.d.ts +62 -0
- package/dist/runner/step-guard.js +93 -0
- package/dist/runner/store-secrets.js +17 -2
- package/dist/runner/subagent.d.ts +0 -3
- package/dist/runner/subagent.js +7 -12
- package/dist/runner/workflow-first.d.ts +226 -0
- package/dist/runner/workflow-first.js +293 -0
- package/dist/runner/workflow-loop.d.ts +1 -1
- package/dist/runner/workflow-loop.js +32 -19
- package/dist/runner/workflow-spec.d.ts +5 -1
- package/dist/runner/workflow-spec.js +63 -48
- package/dist/runs-over-store.d.ts +41 -4
- package/dist/runs-over-store.js +64 -22
- package/dist/sdk/runs.d.ts +115 -0
- package/dist/sdk/runs.js +422 -0
- package/dist/sdk/schema.d.ts +175 -0
- package/dist/sdk/schema.js +138 -0
- package/dist/sdk/workflows.d.ts +22 -0
- package/dist/sdk/workflows.js +39 -0
- package/dist/secrets.d.ts +2 -0
- package/dist/secrets.js +19 -1
- package/dist/server.d.ts +108 -20
- package/dist/server.js +874 -157
- package/dist/settings-wake.d.ts +8 -6
- package/dist/settings-wake.js +13 -7
- package/dist/skill-route.d.ts +3 -0
- package/dist/skill-route.js +16 -0
- package/dist/skills/agentrun-serve/SKILL.md +368 -0
- package/dist/stats.d.ts +10 -10
- package/dist/store/agent-body.d.ts +22 -7
- package/dist/store/agent-body.js +23 -14
- package/dist/store/command-wake.d.ts +3 -2
- package/dist/store/command-wake.js +4 -4
- package/dist/store/index.d.ts +1 -1
- package/dist/store/native-command-owner.d.ts +10 -0
- package/dist/store/native-command-owner.js +47 -0
- package/dist/store/postgres/connection.js +3 -1
- package/dist/store/postgres/migrations/0010_imported_templates.sql +18 -0
- package/dist/store/postgres/migrations/0011_revision_mcp_pin.sql +13 -0
- package/dist/store/postgres/migrations/0012_revision_monid_pin.sql +4 -0
- package/dist/store/postgres/migrations/0013_native_command_owner.sql +6 -0
- package/dist/store/postgres/migrations/0014_run_cost_upper_bound.sql +6 -0
- package/dist/store/postgres/store.js +3 -0
- package/dist/store/schema.d.ts +16 -0
- package/dist/store/schema.js +47 -8
- package/dist/store/sqlite/connection.d.ts +2 -2
- package/dist/store/sqlite/connection.js +2 -2
- package/dist/store/sqlite/run-patch.d.ts +8 -1
- package/dist/store/sqlite/run-patch.js +33 -10
- package/dist/store/sqlite/store.js +184 -28
- package/dist/store/store.d.ts +98 -21
- package/dist/store-reads/analytics.d.ts +7 -7
- package/dist/store-reads/analytics.js +23 -5
- package/dist/store-reads/cap.js +8 -6
- package/dist/store-reads/journal.d.ts +30 -1
- package/dist/store-reads/journal.js +141 -83
- package/dist/store-reads/learning.d.ts +179 -13
- package/dist/store-reads/learning.js +230 -68
- package/dist/store-reads/loop.d.ts +61 -0
- package/dist/store-reads/loop.js +111 -0
- package/dist/store-reads/runs.d.ts +5 -0
- package/dist/store-reads/runs.js +3 -2
- package/dist/store-view.d.ts +3 -2
- package/dist/store-view.js +109 -37
- package/dist/template-eval.d.ts +87 -16
- package/dist/template-eval.js +605 -120
- package/dist/template-github-permissions.d.ts +2 -2
- package/dist/template-github-permissions.js +2 -1
- package/dist/template-import.d.ts +31 -0
- package/dist/template-import.js +121 -0
- package/dist/template-source.d.ts +51 -0
- package/dist/template-source.js +371 -0
- package/dist/templates.d.ts +274 -52
- package/dist/templates.js +670 -201
- package/dist/text-urls.d.ts +38 -0
- package/dist/text-urls.js +170 -0
- package/dist/timeline/computer.d.ts +48 -0
- package/dist/timeline/computer.js +169 -0
- package/dist/timeline/index.d.ts +7 -5
- package/dist/timeline/index.js +7 -5
- package/dist/timeline/labels.d.ts +11 -4
- package/dist/timeline/labels.js +122 -8
- package/dist/timeline/origin.d.ts +20 -6
- package/dist/timeline/origin.js +13 -6
- package/dist/timeline/render-text.js +1 -1
- package/dist/timeline/timeline.d.ts +76 -20
- package/dist/timeline/timeline.js +184 -39
- package/dist/timeline/util.d.ts +5 -0
- package/dist/timeline/util.js +44 -8
- package/dist/timeline/web-calls.d.ts +17 -0
- package/dist/timeline/web-calls.js +106 -0
- package/dist/tool-gate.d.ts +103 -76
- package/dist/tool-gate.js +200 -127
- package/dist/tool-keys.d.ts +4 -1
- package/dist/tool-keys.js +8 -3
- package/dist/tool-list.d.ts +29 -0
- package/dist/tool-list.js +50 -0
- package/dist/tool-names.d.ts +76 -0
- package/dist/tool-names.js +101 -0
- package/dist/tool-plane.d.ts +34 -28
- package/dist/tool-plane.js +72 -37
- package/dist/tools.d.ts +59 -15
- package/dist/tools.js +46 -42
- package/dist/trigger-adapter.d.ts +85 -5
- package/dist/trigger-adapter.js +6 -0
- package/dist/trigger-adapters.js +3 -1
- package/dist/trigger-composio.d.ts +10 -0
- package/dist/trigger-composio.js +122 -0
- package/dist/trigger-email.d.ts +4 -0
- package/dist/trigger-email.js +228 -0
- package/dist/trigger-signatures.d.ts +6 -10
- package/dist/trigger-signatures.js +16 -16
- package/dist/trigger-targets.d.ts +1 -1
- package/dist/trigger-targets.js +4 -3
- package/dist/trigger-webhook.js +6 -4
- package/dist/triggers.d.ts +94 -9
- package/dist/triggers.js +263 -62
- package/dist/uploads.d.ts +9 -0
- package/dist/uploads.js +27 -0
- package/dist/validate.d.ts +15 -7
- package/dist/validate.js +91 -50
- package/dist/web-fake.d.ts +56 -0
- package/dist/web-fake.js +102 -0
- package/dist/web-fetch-direct.d.ts +3 -0
- package/dist/web-fetch-direct.js +4 -1
- package/dist/web-fetch.d.ts +6 -8
- package/dist/web-fetch.js +10 -53
- package/dist/web-search.d.ts +51 -2
- package/dist/web-search.js +116 -18
- package/dist/webhooks.d.ts +2 -1
- package/dist/webhooks.js +5 -1
- package/dist/workflow/node-runner.js +10 -2
- package/dist/workspace/archil-claim.d.ts +3 -0
- package/dist/workspace/archil-claim.js +9 -2
- package/dist/workspace/computer-deps.d.ts +25 -9
- package/dist/workspace/computer-deps.js +82 -38
- package/dist/workspace/computer-for-claim.d.ts +60 -4
- package/dist/workspace/computer-for-claim.js +203 -45
- package/dist/workspace/computer-hold.js +7 -1
- package/dist/workspace/computer-janitor.d.ts +10 -3
- package/dist/workspace/computer-janitor.js +96 -29
- package/dist/workspace/computer-kept.d.ts +82 -0
- package/dist/workspace/computer-kept.js +147 -0
- package/dist/workspace/computer-mcp.js +4 -3
- package/dist/workspace/computer-ports.d.ts +23 -3
- package/dist/workspace/computer-ports.js +115 -5
- package/dist/workspace/index.d.ts +2 -3
- package/dist/workspace/index.js +1 -2
- package/dist/workspace/kind-skills/desktop/SKILL.md +31 -11
- package/dist/workspace/kind-skills/phone/SKILL.md +29 -14
- package/dist/workspace/local.js +2 -2
- package/dist/workspace/resolve-computer.d.ts +33 -1
- package/dist/workspace/resolve-computer.js +37 -16
- package/dist/workspace/revision-skills.d.ts +6 -2
- package/dist/workspace/revision-skills.js +12 -5
- package/dist/workspace/run-end-computers.d.ts +30 -0
- package/dist/workspace/run-end-computers.js +137 -0
- package/dist/workspace/run-tools.d.ts +40 -23
- package/dist/workspace/run-tools.js +46 -19
- package/dist/wrap-up.d.ts +35 -0
- package/dist/wrap-up.js +48 -0
- package/launcher/agentrun-serve +4 -2
- package/package.json +13 -9
- package/skills/agentrun-serve/SKILL.md +248 -10
- package/templates/README.md +220 -60
- package/templates/TOOLS.md +168 -0
- package/templates/code-review/agent.md +46 -16
- package/templates/code-review/evals/clean-refactor/case.yaml +2 -1
- package/templates/code-review/evals/clean-refactor/graders/head-sha.md +6 -0
- package/templates/code-review/evals/injection/case.yaml +2 -1
- package/templates/code-review/evals/injection/graders/head-sha.md +6 -0
- package/templates/code-review/evals/mentions-defused/case.yaml +3 -3
- package/templates/code-review/evals/mentions-defused/fixtures/github-mcp.json +0 -23
- package/templates/code-review/evals/mentions-defused/graders/head-sha.md +6 -0
- package/templates/code-review/evals/never-flag/case.yaml +2 -1
- package/templates/code-review/evals/never-flag/graders/head-sha.md +6 -0
- package/templates/code-review/evals/null-name/case.yaml +2 -1
- package/templates/code-review/evals/null-name/graders/head-sha.md +6 -0
- package/templates/code-review/evals/off-by-one/case.yaml +2 -1
- package/templates/code-review/evals/off-by-one/graders/head-sha.md +6 -0
- package/templates/code-review/evals/off-by-one/graders/no-repo-reads.md +2 -1
- package/templates/code-review/evals/other-repo/case.yaml +16 -0
- package/templates/code-review/evals/other-repo/fixtures/github-mcp.json +130 -0
- package/templates/code-review/evals/other-repo/graders/head-sha.md +6 -0
- package/templates/code-review/evals/other-repo/graders/no-canary.md +6 -0
- package/templates/code-review/evals/other-repo/graders/no-other-repo.md +8 -0
- package/templates/code-review/evals/other-repo/graders/refused-not-quoted.md +18 -0
- package/templates/code-review/evals/other-repo/prompt.md +10 -0
- package/templates/code-review/evals/pasted-by-reference/case.yaml +5 -0
- package/templates/code-review/evals/pasted-by-reference/graders/by-reference.md +15 -0
- package/templates/code-review/evals/pasted-by-reference/graders/head-sha.md +6 -0
- package/templates/code-review/evals/pasted-by-reference/prompt.md +31 -0
- package/templates/code-review/evals/re-review/case.yaml +2 -1
- package/templates/code-review/evals/re-review/graders/head-sha.md +6 -0
- package/templates/code-review/evals/re-review-open/case.yaml +2 -1
- package/templates/code-review/evals/re-review-open/graders/head-sha.md +6 -0
- package/templates/code-review/evals/repo-rule/case.yaml +2 -1
- package/templates/code-review/evals/repo-rule/graders/head-sha.md +6 -0
- package/templates/code-review/evals/two-defects/case.yaml +2 -1
- package/templates/code-review/evals/two-defects/graders/head-sha.md +6 -0
- package/templates/code-review/rules/CODEREVIEW.md +1 -1
- package/templates/code-review/skills/review/DEEP.md +5 -4
- package/templates/code-review/skills/review/REVIEWER.md +5 -4
- package/templates/code-review/skills/review/SKILL.md +11 -6
- package/templates/code-review/{findings.schema.json → skills/review/findings.schema.json} +1 -0
- package/templates/inbound-lead/agent.md +26 -16
- package/templates/inbound-lead/evals/injection-in-form/graders/no-exfil.md +16 -0
- package/templates/inbound-lead/evals/injection-in-form/prompt.md +2 -2
- package/templates/inbound-lead/evals/write-back/case.yaml +2 -6
- package/templates/inbound-lead/evals/write-back/fixtures/fake-hubspot.json +34 -225
- package/templates/inbound-lead/evals/write-back/graders/note-and-score.md +10 -14
- package/templates/inbound-lead/evals/write-back/graders/writes-once.md +7 -0
- package/templates/inbound-lead/evals/write-back/prompt.md +1 -1
- package/templates/inbound-lead/evals/write-back-wrong-record/case.yaml +3 -7
- package/templates/inbound-lead/evals/write-back-wrong-record/fixtures/fake-hubspot.json +34 -225
- package/templates/inbound-lead/evals/write-back-wrong-record/graders/form-id.md +17 -0
- package/templates/inbound-lead/evals/write-back-wrong-record/graders/no-write.md +3 -3
- package/templates/inbound-lead/evals/write-back-wrong-record/prompt.md +2 -2
- package/templates/inbound-lead/skills/lead/SKILL.md +23 -27
- package/templates/kyb/agent.md +15 -5
- package/templates/kyb/evals/adverse-media/prompt.md +2 -7
- package/templates/kyb/evals/canada-active-filed/prompt.md +2 -6
- package/templates/kyb/evals/clean-public-company/prompt.md +2 -6
- package/templates/kyb/evals/injection-in-page/prompt.md +3 -7
- package/templates/kyb/evals/name-collision/prompt.md +2 -6
- package/templates/kyb/evals/no-invention/prompt.md +2 -6
- package/templates/kyb/evals/opensanctions-on/prompt.md +2 -6
- package/templates/kyb/evals/sanctioned-entity/prompt.md +2 -6
- package/templates/kyb/kyb.schema.json +8 -7
- package/templates/kyb/skills/kyb/SKILL.md +9 -6
- package/templates/market-monitor/agent.md +19 -12
- package/templates/market-monitor/evals/post-happens/case.yaml +4 -4
- package/templates/market-monitor/evals/post-happens/fixtures/slack-mcp.json +13 -9
- package/templates/market-monitor/evals/post-happens/graders/post-is-digest.md +1 -1
- package/templates/market-monitor/evals/post-happens/graders/posted-once.md +3 -3
- package/templates/market-monitor/skills/monitor/SKILL.md +6 -4
- package/templates/release-notes/agent.md +32 -10
- package/templates/release-notes/evals/draft-not-publish/case.yaml +5 -4
- package/templates/release-notes/evals/draft-not-publish/fixtures/github-mcp.json +29 -51
- package/templates/release-notes/evals/every-pr-accounted/case.yaml +2 -1
- package/templates/release-notes/evals/issue-write-refused/case.yaml +5 -4
- package/templates/release-notes/evals/issue-write-refused/fixtures/github-mcp.json +29 -51
- package/templates/release-notes/evals/late-arrival/case.yaml +6 -5
- package/templates/release-notes/evals/late-arrival/fixtures/github-mcp.json +29 -51
- package/templates/release-notes/evals/learned-style/case.yaml +2 -1
- package/templates/release-notes/evals/no-pr-numbers-on-top/case.yaml +2 -1
- package/templates/release-notes/evals/other-repo/case.yaml +24 -0
- package/templates/release-notes/evals/other-repo/fixtures/github-mcp.json +907 -0
- package/templates/release-notes/evals/other-repo/graders/no-canary.md +7 -0
- package/templates/release-notes/evals/other-repo/graders/no-other-repo.md +8 -0
- package/templates/release-notes/evals/other-repo/graders/refused-not-quoted.md +18 -0
- package/templates/release-notes/evals/other-repo/prompt.md +32 -0
- package/templates/release-notes/evals/upgrade-line/case.yaml +2 -1
- package/templates/release-notes/evals/user-facing-only/case.yaml +2 -1
- package/templates/release-notes/notes.schema.json +1 -1
- package/templates/release-notes/skills/release-notes/SKILL.md +26 -17
- package/dist/console/assets/index-Cn6JX1uH.js +0 -563
- package/dist/console/assets/index-DRN62V5v.css +0 -1
- package/dist/host-calls.d.ts +0 -20
- package/dist/host-calls.js +0 -12
- package/dist/runner/adapters/pi-computer.d.ts +0 -7
- package/dist/runner/adapters/pi-computer.js +0 -43
- package/dist/tool-blurbs.d.ts +0 -4
- package/dist/tool-blurbs.js +0 -28
- package/dist/tool-budget.d.ts +0 -38
- package/dist/tool-budget.js +0 -62
- package/dist/workspace/computer-script.d.ts +0 -37
- package/dist/workspace/computer-script.js +0 -138
- package/templates/code-review/evals/clean-refactor/graders/schema.md +0 -5
- package/templates/code-review/evals/injection/graders/schema.md +0 -5
- package/templates/code-review/evals/mentions-defused/graders/schema.md +0 -5
- package/templates/code-review/evals/never-flag/graders/schema.md +0 -5
- package/templates/code-review/evals/null-name/graders/schema.md +0 -5
- package/templates/code-review/evals/off-by-one/graders/schema.md +0 -5
- package/templates/code-review/evals/re-review/graders/schema.md +0 -5
- package/templates/code-review/evals/re-review-open/graders/schema.md +0 -5
- package/templates/code-review/evals/repo-rule/graders/schema.md +0 -5
- package/templates/code-review/evals/two-defects/graders/schema.md +0 -5
- package/templates/inbound-lead/evals/clear-disqualifier/graders/schema.md +0 -5
- package/templates/inbound-lead/evals/injection-in-form/graders/schema.md +0 -5
- package/templates/inbound-lead/evals/learned-correction/graders/schema.md +0 -5
- package/templates/inbound-lead/evals/strong-fit/graders/schema.md +0 -5
- package/templates/inbound-lead/evals/thin-data/graders/schema.md +0 -5
- package/templates/inbound-lead/evals/write-back/graders/schema.md +0 -5
- package/templates/inbound-lead/evals/write-back/graders/writes-twice.md +0 -7
- package/templates/inbound-lead/evals/write-back-wrong-record/graders/proves-record.md +0 -18
- package/templates/inbound-lead/evals/write-back-wrong-record/graders/schema.md +0 -5
- package/templates/kyb/evals/adverse-media/graders/schema.md +0 -5
- package/templates/kyb/evals/canada-active-filed/graders/schema.md +0 -5
- package/templates/kyb/evals/clean-public-company/graders/schema.md +0 -5
- package/templates/kyb/evals/injection-in-page/graders/schema.md +0 -5
- package/templates/kyb/evals/name-collision/graders/schema.md +0 -5
- package/templates/kyb/evals/no-invention/graders/schema.md +0 -5
- package/templates/kyb/evals/opensanctions-on/graders/schema.md +0 -5
- package/templates/kyb/evals/sanctioned-entity/graders/schema.md +0 -5
- package/templates/market-monitor/evals/blocked-source/graders/schema.md +0 -5
- package/templates/market-monitor/evals/every-competitor-named/graders/schema.md +0 -5
- package/templates/market-monitor/evals/learned-preference/graders/schema.md +0 -5
- package/templates/market-monitor/evals/no-repeats/graders/schema.md +0 -5
- package/templates/market-monitor/evals/nothing-changed/graders/schema.md +0 -5
- package/templates/market-monitor/evals/post-happens/graders/schema.md +0 -5
- package/templates/market-monitor/evals/pricing-change/graders/schema.md +0 -5
- package/templates/market-monitor/evals/pricing-moved/graders/schema.md +0 -5
- package/templates/release-notes/evals/draft-not-publish/graders/schema.md +0 -5
- package/templates/release-notes/evals/every-pr-accounted/graders/schema.md +0 -5
- package/templates/release-notes/evals/issue-write-refused/graders/schema.md +0 -5
- package/templates/release-notes/evals/late-arrival/graders/schema.md +0 -5
- package/templates/release-notes/evals/learned-style/graders/schema.md +0 -5
- package/templates/release-notes/evals/no-pr-numbers-on-top/graders/schema.md +0 -5
- package/templates/release-notes/evals/upgrade-line/graders/schema.md +0 -5
- package/templates/release-notes/evals/user-facing-only/graders/schema.md +0 -5
package/dist/store/store.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Context } from "@earendil-works/chord/context";
|
|
2
2
|
import type { Storage, StorageWrite } from "@earendil-works/pi-durable";
|
|
3
3
|
import type { JournalPage } from "./journal/storage.js";
|
|
4
|
+
import type { MonidPinBody } from "./agent-body.js";
|
|
4
5
|
/** A run's state. queued: a row, no runner yet. running: a runner holds the claim. parked: waiting for a person (an
|
|
5
6
|
* approval, a raised cap) with no claim held; a command row or its wake_at makes it claimable again. ended, stopped and
|
|
6
7
|
* failed are final. A running run whose runner died is claimable once its claim runs out. */
|
|
@@ -50,14 +51,13 @@ export interface AgentRow {
|
|
|
50
51
|
* agent with a reference is read-only from here: it is written on the first run that names it and never edited. */
|
|
51
52
|
readonly externalRef: string | null;
|
|
52
53
|
}
|
|
53
|
-
/**
|
|
54
|
+
/** The template package an agent was applied from, kept on the revision the apply made (its first): the package's id
|
|
55
|
+
* (a bundled one's name, an imported one's `github:<owner>/<repo>[/<path>]`), its SemVer version, and the commit SHA it
|
|
56
|
+
* was imported at (null for a bundled one, which is the server's own build). */
|
|
54
57
|
export interface TemplatePackage {
|
|
55
|
-
readonly
|
|
58
|
+
readonly id: string;
|
|
56
59
|
readonly version: string;
|
|
57
|
-
readonly
|
|
58
|
-
readonly ref?: string;
|
|
59
|
-
readonly sha?: string;
|
|
60
|
-
readonly parameters?: unknown;
|
|
60
|
+
readonly sha: string | null;
|
|
61
61
|
}
|
|
62
62
|
export interface NewRevision {
|
|
63
63
|
readonly id: string;
|
|
@@ -71,6 +71,11 @@ export interface NewRevision {
|
|
|
71
71
|
readonly package?: TemplatePackage;
|
|
72
72
|
/** The version this revision maps in an externally owned agent, set only on an inline-agent run's revision. */
|
|
73
73
|
readonly externalVersion?: string;
|
|
74
|
+
/** The MCP tools the revision grants, pinned as their servers listed them when it was saved (mcp-gateway.ts McpPin), which
|
|
75
|
+
* every run of it calls; none when it grants none. */
|
|
76
|
+
readonly mcpPin?: unknown;
|
|
77
|
+
/** Its monid endpoints, pinned as monid listed them when it was saved (agent-body.ts MonidPinBody); none for none. */
|
|
78
|
+
readonly monidPin?: MonidPinBody;
|
|
74
79
|
}
|
|
75
80
|
export interface RevisionRow {
|
|
76
81
|
readonly id: string;
|
|
@@ -88,6 +93,10 @@ export interface RevisionRow {
|
|
|
88
93
|
readonly createdAt: number;
|
|
89
94
|
/** The version this revision maps in the agent's owning system (one revision per version), or null for one committed here. */
|
|
90
95
|
readonly externalVersion: string | null;
|
|
96
|
+
/** Its MCP pin as its save made it (NewRevision.mcpPin), or null for a revision that grants no MCP tool. */
|
|
97
|
+
readonly mcpPin: unknown;
|
|
98
|
+
/** Its monid pin as its save made it (NewRevision.monidPin), or null for a revision that grants no monid endpoint. */
|
|
99
|
+
readonly monidPin: MonidPinBody | null;
|
|
91
100
|
}
|
|
92
101
|
/** How a run ended, beside its state. An ended run (state 'ended'): 'escalated' (it finished its work and waits for a
|
|
93
102
|
* person, which the v2 status reads as completed with a review) or 'completed'. A stopped run (state 'stopped'): 'stopped'
|
|
@@ -131,7 +140,13 @@ export interface RunRow {
|
|
|
131
140
|
readonly wakeAt: number | null;
|
|
132
141
|
/** A parked run's backoff after a failed resume: its untaken commands wait for it, a stop and its wake_at do not. */
|
|
133
142
|
readonly backoffUntil: number | null;
|
|
143
|
+
/** What the run cost, exactly: null when that is unknown, and null when its stored cost is only the most it can have
|
|
144
|
+
* cost (`costAtMostUsd`). Every reader that sums, compares or shows spend reads this, so a bound never reads as spend. */
|
|
134
145
|
readonly costUsd: number | null;
|
|
146
|
+
/** The most the run can have cost, set only when that is all its stored cost says (runs.cost_upper_bound): it counts a
|
|
147
|
+
* request cut with no answer at what its cap held for it (runner.ts CUT_AT_HOLD). Read only where a figure can be said
|
|
148
|
+
* "at most" (the run's view, the runs list); null otherwise, `costUsd` then the stored figure or null. */
|
|
149
|
+
readonly costAtMostUsd: number | null;
|
|
135
150
|
readonly metrics: unknown;
|
|
136
151
|
readonly summary: string | null;
|
|
137
152
|
/** How the run ended beside its state (RunOutcome), null for a plain completion, a failure, or a run not ended. */
|
|
@@ -150,6 +165,9 @@ export interface RunRow {
|
|
|
150
165
|
export interface RunPatch {
|
|
151
166
|
readonly state?: RunState;
|
|
152
167
|
readonly costUsd?: number | null;
|
|
168
|
+
/** Whether `costUsd` is the most the run can have cost (stored as runs.cost_upper_bound, read back as
|
|
169
|
+
* RunRow.costAtMostUsd): read only with `costUsd`, which always writes it (absent: false). */
|
|
170
|
+
readonly costUpperBound?: boolean;
|
|
153
171
|
readonly metrics?: unknown;
|
|
154
172
|
readonly summary?: string | null;
|
|
155
173
|
/** How the run ended (RunOutcome), set in its end commit; null clears it. */
|
|
@@ -206,6 +224,16 @@ export interface ImportRunInput {
|
|
|
206
224
|
readonly startedAt: number;
|
|
207
225
|
readonly endedAt?: number;
|
|
208
226
|
readonly transcript: readonly (readonly StorageWrite[])[];
|
|
227
|
+
/** Internal authorization fences for an outbound historical import. These settings rows are locked and their
|
|
228
|
+
* named fields checked in the same transaction as the terminal run and journal, so a completed revocation or
|
|
229
|
+
* disconnect cannot be followed by another imported run. Ordinary local imports leave this absent. */
|
|
230
|
+
readonly settingsGuards?: readonly {
|
|
231
|
+
readonly key: string;
|
|
232
|
+
readonly fields: Readonly<Record<string, unknown>>;
|
|
233
|
+
}[];
|
|
234
|
+
/** Remote history is admitted only while its agent remains active. Lock and check the agent in the import's
|
|
235
|
+
* transaction, ordering the write against archive; ordinary local imports leave this guard absent. */
|
|
236
|
+
readonly requireActiveAgent?: true;
|
|
209
237
|
}
|
|
210
238
|
/** Rows written in the same commit as a run's update (runs.update, or a journal commit's staged patch): a channel post the
|
|
211
239
|
* run's moment owes (the outbox), what a channel was told. A command consumed is Staged.take, refused when not untaken. */
|
|
@@ -588,6 +616,8 @@ export interface Agents {
|
|
|
588
616
|
byExternal(ref: string): Promise<AgentRow | undefined>;
|
|
589
617
|
/** Whether the agent already has the revision that maps `version` of its owning system (one row looked up, no bodies read). */
|
|
590
618
|
hasExternalVersion(agentId: string, version: string): Promise<boolean>;
|
|
619
|
+
/** The revision that maps `version` of its owning system, or undefined before that version's first run. */
|
|
620
|
+
externalRevision(agentId: string, version: string): Promise<RevisionRow | undefined>;
|
|
591
621
|
list(options?: {
|
|
592
622
|
archived?: boolean;
|
|
593
623
|
}): Promise<AgentRow[]>;
|
|
@@ -611,6 +641,10 @@ export interface Agents {
|
|
|
611
641
|
setCurrent(agentId: string, revisionId: string): Promise<void>;
|
|
612
642
|
revision(id: string): Promise<RevisionRow | undefined>;
|
|
613
643
|
revisions(agentId: string): Promise<RevisionRow[]>;
|
|
644
|
+
/** Pins a revision saved with no MCP pin (before pins were made at save) at its first run: `pin` is written only while
|
|
645
|
+
* the revision still has none, and the pin it has then is the answer, so two first runs at once agree on one. Null when
|
|
646
|
+
* there is no such revision. */
|
|
647
|
+
pinOnce(revisionId: string, pin: unknown): Promise<unknown>;
|
|
614
648
|
}
|
|
615
649
|
export interface Templates {
|
|
616
650
|
/** A template applied: the agent, its first revision (with the package) and its triggers, in one transaction, all or
|
|
@@ -754,6 +788,8 @@ export interface Runs {
|
|
|
754
788
|
body: unknown;
|
|
755
789
|
skills?: unknown;
|
|
756
790
|
note?: string;
|
|
791
|
+
mcpPin?: unknown;
|
|
792
|
+
monidPin?: MonidPinBody;
|
|
757
793
|
};
|
|
758
794
|
run: {
|
|
759
795
|
id: string;
|
|
@@ -908,7 +944,8 @@ export interface McpServerStamp {
|
|
|
908
944
|
* claim that opened the row at one end knows the token it holds is not the row's once this differs. */
|
|
909
945
|
readonly tokenUntil: number | null;
|
|
910
946
|
}
|
|
911
|
-
/** A run's MCP pin: what it may call, per granted server (url, tools, prices),
|
|
947
|
+
/** A run's MCP pin: what it may call, per granted server (url, tools, prices), as its revision's save pinned it
|
|
948
|
+
* (RevisionRow.mcpPin); `pinnedAt` is when that revision was saved. */
|
|
912
949
|
export interface McpPinRow {
|
|
913
950
|
readonly runId: string;
|
|
914
951
|
readonly body: unknown;
|
|
@@ -994,12 +1031,8 @@ export interface Mcp {
|
|
|
994
1031
|
* (runner/mcp-claim.ts) to see its credential removed, replaced or moved, or its access token near its end. Undefined
|
|
995
1032
|
* when it is no longer saved. */
|
|
996
1033
|
stamp(name: string): Promise<McpServerStamp | undefined>;
|
|
997
|
-
/** The run's pin,
|
|
1034
|
+
/** The run's pin: its revision's, as the revision's save made it; none for a run whose revision grants no MCP tool. */
|
|
998
1035
|
pin(runId: string): Promise<McpPinRow | undefined>;
|
|
999
|
-
/** Writes the run's pin under `claim` unless it has one, in one transaction with the claim's epoch fence, and answers the
|
|
1000
|
-
* pin as stored: never rewritten, so a second call (or a later claim's) reads the first. Fenced, writing nothing, on a
|
|
1001
|
-
* stale claim. */
|
|
1002
|
-
pinOnce(claim: Claim, body: unknown): Promise<McpPinRow>;
|
|
1003
1036
|
/** One refresh at a time per server (a provider that rotates refresh tokens spends the old one at each refresh): the lease
|
|
1004
1037
|
* is granted to `holder` for `ms` (MCP_REFRESH_LEASE_MS by default) only while the credential is still the one it read
|
|
1005
1038
|
* (`seen`: the sealed bytes, null for none) and no live lease is held. Not granted: the current row comes back, and the
|
|
@@ -1043,19 +1076,28 @@ export interface Settings {
|
|
|
1043
1076
|
get(key: string): Promise<unknown | undefined>;
|
|
1044
1077
|
/** Saves `value` (JSON) under `key`, inserted or replaced in place. */
|
|
1045
1078
|
put(key: string, value: unknown): Promise<void>;
|
|
1046
|
-
/** Saves `value` under `key` only when the key has no row yet
|
|
1047
|
-
*
|
|
1048
|
-
|
|
1079
|
+
/** Saves `value` under `key` only when the key has no row yet; the value saved after (this one, or the one there before).
|
|
1080
|
+
* With `capacity`, count and insert share a namespace lock and transaction across store handles. Every raw key under
|
|
1081
|
+
* the exact prefix counts, without decoding values. An existing key wins even at capacity; undefined means a new key
|
|
1082
|
+
* was refused. The nonempty prefix must contain the key, and limit must be a positive safe integer. */
|
|
1083
|
+
putIfAbsent(key: string, value: unknown, capacity?: {
|
|
1084
|
+
readonly prefix: string;
|
|
1085
|
+
readonly limit: number;
|
|
1086
|
+
}): Promise<unknown>;
|
|
1049
1087
|
/** Saves `value` under `key` only while its row still holds `was` (as get read it), in one statement: a compare-and-set,
|
|
1050
1088
|
* so of two writers that read one row only one replaces it. True when it was replaced; false, with nothing written,
|
|
1051
|
-
* when the row changed since or is gone.
|
|
1052
|
-
|
|
1089
|
+
* when the row changed since or is gone. With `claim`, holds the run's shared row lock and checks its epoch/lease in
|
|
1090
|
+
* the same transaction as the setting update; a stale claim throws Fenced without changing the setting. */
|
|
1091
|
+
replaceIf(key: string, was: unknown, value: unknown, claim?: Claim): Promise<boolean>;
|
|
1053
1092
|
/** The key's row goes only while it still holds `was`, in one statement: true when it went. */
|
|
1054
1093
|
removeIf(key: string, was: unknown): Promise<boolean>;
|
|
1055
1094
|
/** The key's row goes; a key with no row is left as it is. */
|
|
1056
1095
|
remove(key: string): Promise<void>;
|
|
1057
|
-
/**
|
|
1058
|
-
all(
|
|
1096
|
+
/** Settings by key, optionally selecting a namespace and native connector owner before values are read. */
|
|
1097
|
+
all(filter?: {
|
|
1098
|
+
readonly prefix: string;
|
|
1099
|
+
readonly connectorId?: string;
|
|
1100
|
+
}): Promise<SettingRow[]>;
|
|
1059
1101
|
}
|
|
1060
1102
|
/** A sealed key as a row (store schema `sealed_keys`): its name and the bytes the server sealed (store/seal.ts, AAD
|
|
1061
1103
|
* sealed_keys|<name>|sealed), which the store never opens. */
|
|
@@ -1085,8 +1127,19 @@ export interface SealedKeys {
|
|
|
1085
1127
|
get(name: string): Promise<Uint8Array | undefined>;
|
|
1086
1128
|
/** Saves `sealed` under `name`, inserted or replaced in place. */
|
|
1087
1129
|
put(name: string, sealed: Uint8Array): Promise<void>;
|
|
1130
|
+
/** Saves `sealed` under `name` only while its row still holds `was` (the bytes as get read them), in one statement: a
|
|
1131
|
+
* compare-and-set, so of two writers that read one row only one replaces it. Each seal is fresh bytes, so a row any
|
|
1132
|
+
* writer saved since reads as changed. True when it was replaced; false, writing nothing, when it changed or is gone. */
|
|
1133
|
+
replaceIf(name: string, was: Uint8Array, sealed: Uint8Array): Promise<boolean>;
|
|
1088
1134
|
/** The key's row goes. */
|
|
1089
1135
|
remove(name: string): Promise<void>;
|
|
1136
|
+
/** The key's row goes only while it still holds `was` (the bytes as get read them), in one statement: true when it
|
|
1137
|
+
* went; false, removing nothing, when it changed since or is gone. */
|
|
1138
|
+
removeIf(name: string, was: Uint8Array): Promise<boolean>;
|
|
1139
|
+
/** The deadlines' clock now, in ms: the database's on Postgres, the store's own on SQLite (fence.ts storeNow). A lease
|
|
1140
|
+
* kept inside a sealed key's bytes (the ChatGPT sign-in's renewal) is stamped and judged by it, so every process
|
|
1141
|
+
* sharing the store judges it by one clock, whatever its own says. */
|
|
1142
|
+
clock(): Promise<number>;
|
|
1090
1143
|
/** Every saved key, by name (its bytes never opened here). */
|
|
1091
1144
|
all(): Promise<SealedKeyRow[]>;
|
|
1092
1145
|
}
|
|
@@ -1171,6 +1224,27 @@ export interface PairedComputers {
|
|
|
1171
1224
|
/** Removes the computer: its token dials no more. False when it was not paired (unknown, or removed already). */
|
|
1172
1225
|
revoke(id: string): Promise<boolean>;
|
|
1173
1226
|
}
|
|
1227
|
+
/** A template package imported from GitHub (store schema `imported_templates`, POST /v2/templates/import): its id
|
|
1228
|
+
* (`github:<owner>/<repo>[/<path>]`), its source as given, the commit SHA read, its publisher (the GitHub account), and
|
|
1229
|
+
* its files as they were read, by path, base64. The server checks them again (templates.ts readPackage) as it loads them
|
|
1230
|
+
* at its start, so a package this build no longer takes is never served. */
|
|
1231
|
+
export interface ImportedTemplateRow {
|
|
1232
|
+
readonly id: string;
|
|
1233
|
+
readonly source: string;
|
|
1234
|
+
readonly sha: string;
|
|
1235
|
+
readonly publisher: string;
|
|
1236
|
+
readonly files: Readonly<Record<string, string>>;
|
|
1237
|
+
/** When it was last imported (stamped by the store). */
|
|
1238
|
+
readonly importedAt: number;
|
|
1239
|
+
}
|
|
1240
|
+
export interface ImportedTemplates {
|
|
1241
|
+
/** Every imported package, by id. */
|
|
1242
|
+
list(): Promise<ImportedTemplateRow[]>;
|
|
1243
|
+
/** Keeps the package under its id, in place of the one there (a re-import at a new SHA replaces it). */
|
|
1244
|
+
put(row: Omit<ImportedTemplateRow, "importedAt">): Promise<void>;
|
|
1245
|
+
/** Removes the package: false when none had that id. */
|
|
1246
|
+
remove(id: string): Promise<boolean>;
|
|
1247
|
+
}
|
|
1174
1248
|
/** A trigger source's sealed setting as a row (store schema `trigger_settings`): its adapter, scope ("server" for the one
|
|
1175
1249
|
* server-wide set, or a trigger's id for its own), field, and the value sealed (store/seal.ts) under AAD
|
|
1176
1250
|
* trigger_settings|<adapter>|<scope>|<field>: TEXT the store never opens. */
|
|
@@ -1386,6 +1460,8 @@ export interface Store {
|
|
|
1386
1460
|
readonly computerLedger: ComputerLedger;
|
|
1387
1461
|
/** The people's own machines paired with this server, and the codes that pair them (spec/computer/attach.md). */
|
|
1388
1462
|
readonly pairedComputers: PairedComputers;
|
|
1463
|
+
/** The template packages imported from GitHub, their files kept as read. */
|
|
1464
|
+
readonly importedTemplates: ImportedTemplates;
|
|
1389
1465
|
/** Each trigger source's sealed settings (design 2.1): a value per adapter, scope and field. */
|
|
1390
1466
|
readonly triggerSettings: TriggerSettings;
|
|
1391
1467
|
/** The outbox of a channel the server sends itself, its tries and what it told each run. */
|
|
@@ -1470,12 +1546,13 @@ export interface Store {
|
|
|
1470
1546
|
readonly value: unknown;
|
|
1471
1547
|
} | undefined>;
|
|
1472
1548
|
/** Tells `listener` when a command of a run in this store is written ("written", after command() commits) or taken,
|
|
1473
|
-
* refused or answered ("answered": a take, a run update that takes, a journal commit that takes or ends the run)
|
|
1549
|
+
* refused or answered ("answered": a take, a run update that takes, a journal commit that takes or ends the run), and
|
|
1550
|
+
* when a run is queued ("queued": runs.create, runs.createInline or a trigger's fire committed it, claimable now).
|
|
1474
1551
|
* A hint to read now, for handles in this process only: a row another process writes wakes nothing here, the reader's
|
|
1475
1552
|
* poll finds it. Called after the commit, asynchronously; a listener's throw is swallowed. Answers the unsubscribe. */
|
|
1476
1553
|
watchCommands(listener: (event: {
|
|
1477
1554
|
readonly runId: string;
|
|
1478
|
-
readonly what: "written" | "answered";
|
|
1555
|
+
readonly what: "written" | "answered" | "queued";
|
|
1479
1556
|
}) => void): () => void;
|
|
1480
1557
|
/** Counts a failed resume on the untaken command that woke the run, under the claim, and answers its tries; the command
|
|
1481
1558
|
* stays untaken. Fenced on a stale claim; StoreConstraint when the command is taken or not the run's. */
|
|
@@ -16,18 +16,18 @@ export type AnalyticsGroup = {
|
|
|
16
16
|
needsReview: number;
|
|
17
17
|
failed: number;
|
|
18
18
|
runsWithMetrics: number;
|
|
19
|
-
tokens: number;
|
|
19
|
+
tokens: number | null;
|
|
20
20
|
costUsd: number | null;
|
|
21
21
|
unknownCostRuns: number;
|
|
22
22
|
};
|
|
23
23
|
export type StoreAnalytics = {
|
|
24
24
|
totals: AnalyticsGroup & {
|
|
25
|
-
input: number;
|
|
26
|
-
cacheRead: number;
|
|
27
|
-
cacheWrite: number;
|
|
28
|
-
output: number;
|
|
29
|
-
requests: number;
|
|
30
|
-
unmetered: number;
|
|
25
|
+
input: number | null;
|
|
26
|
+
cacheRead: number | null;
|
|
27
|
+
cacheWrite: number | null;
|
|
28
|
+
output: number | null;
|
|
29
|
+
requests: number | null;
|
|
30
|
+
unmetered: number | null;
|
|
31
31
|
};
|
|
32
32
|
time: {
|
|
33
33
|
endedRuns: number;
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
// GET /v2/stats' analytics over the one store (design 2.1): the runs' metrics summed, the same StoreAnalytics the old store
|
|
2
|
+
// gave, from A's run rows — each run's metrics as its end commit wrote them (the StoredMetrics JSON on the row), its cost,
|
|
3
|
+
// and its revision's harness. The runs not archived (their own or their agent's), started in [from, to) and of `agent` when
|
|
4
|
+
// given. A pending run (its end on the caller's way, not yet in the store) is counted at the state its end will have, in
|
|
5
|
+
// the totals alone; its metrics, cost and effort wait for its end. No journal is read: the figures are the row's.
|
|
6
|
+
import { sdkOf } from "../sdk/runs.js";
|
|
1
7
|
import { DEFAULT_HARNESS } from "../harness.js";
|
|
2
8
|
import { runReadState } from "./runs.js";
|
|
3
9
|
const PENDING_ENDS = new Set(["completed", "escalated", "failed", "stopped"]);
|
|
@@ -29,7 +35,7 @@ export async function analytics(store, filter = {}) {
|
|
|
29
35
|
continue;
|
|
30
36
|
if (!harnessOf.has(run.revisionId)) {
|
|
31
37
|
const revision = await store.agents.revision(run.revisionId);
|
|
32
|
-
harnessOf.set(run.revisionId, revision?.kind === "workflow" ? "workflow" : (revision?.body?.harness ?? DEFAULT_HARNESS));
|
|
38
|
+
harnessOf.set(run.revisionId, revision?.kind === "workflow" ? "workflow" : (sdkOf(revision?.body)?.runtime ?? revision?.body?.harness ?? DEFAULT_HARNESS));
|
|
33
39
|
}
|
|
34
40
|
const read = runReadState(run, harnessOf.get(run.revisionId) === "workflow" ? "workflow" : "agentic");
|
|
35
41
|
const running = read === "running";
|
|
@@ -51,6 +57,7 @@ export async function analytics(store, filter = {}) {
|
|
|
51
57
|
});
|
|
52
58
|
}
|
|
53
59
|
const counted = (group) => {
|
|
60
|
+
let unknownTokens = false;
|
|
54
61
|
let runsN = 0, completed = 0, needsReview = 0, failed = 0, metered = 0, tokens = 0, costUsd = 0, known = 0, pend = 0;
|
|
55
62
|
for (const f of group) {
|
|
56
63
|
runsN += 1;
|
|
@@ -60,20 +67,31 @@ export async function analytics(store, filter = {}) {
|
|
|
60
67
|
needsReview += 1;
|
|
61
68
|
if (f.state === "failed")
|
|
62
69
|
failed += 1;
|
|
63
|
-
if (f.metered)
|
|
64
|
-
|
|
70
|
+
if (f.metered) {
|
|
71
|
+
metered += 1;
|
|
72
|
+
tokens += tokensOf(f.metrics);
|
|
73
|
+
if (['input', 'cacheRead', 'cacheWrite', 'output'].some(key => f.metrics?.[key] === null))
|
|
74
|
+
unknownTokens = true;
|
|
75
|
+
}
|
|
65
76
|
if (!f.running && !f.pending && f.costUsd !== null)
|
|
66
77
|
(costUsd += f.costUsd, (known += 1));
|
|
67
78
|
if (f.pending)
|
|
68
79
|
pend += 1;
|
|
69
80
|
}
|
|
70
|
-
return { runs: runsN, completed, needsReview, failed, runsWithMetrics: metered, tokens, costUsd: known > 0 ? costUsd : null, unknownCostRuns: runsN - known - pend };
|
|
81
|
+
return { runs: runsN, completed, needsReview, failed, runsWithMetrics: metered, tokens: unknownTokens ? null : tokens, costUsd: known > 0 ? costUsd : null, unknownCostRuns: runsN - known - pend };
|
|
71
82
|
};
|
|
72
83
|
// Totals over the whole scope: the group counts, the token sums, and the time figures.
|
|
73
84
|
let input = 0, cacheRead = 0, cacheWrite = 0, output = 0, requests = 0, unmetered = 0;
|
|
85
|
+
let unknownRequests = false;
|
|
86
|
+
const unknownTokens = new Set();
|
|
74
87
|
let endedRuns = 0, wallMs = 0, activeRuns = 0, activeMs = 0;
|
|
75
88
|
for (const f of facts) {
|
|
76
89
|
if (f.metered && f.metrics) {
|
|
90
|
+
if (f.metrics.requests === null)
|
|
91
|
+
unknownRequests = true;
|
|
92
|
+
for (const key of ['input', 'cacheRead', 'cacheWrite', 'output'])
|
|
93
|
+
if (f.metrics[key] === null)
|
|
94
|
+
unknownTokens.add(key);
|
|
77
95
|
input += num(f.metrics.input);
|
|
78
96
|
cacheRead += num(f.metrics.cacheRead);
|
|
79
97
|
cacheWrite += num(f.metrics.cacheWrite);
|
|
@@ -126,7 +144,7 @@ export async function analytics(store, filter = {}) {
|
|
|
126
144
|
const tools = [...calls.entries()].map(([tool, c]) => ({ tool, calls: c.calls, errors: c.errors })).sort((a, b) => b.calls - a.calls || (a.tool < b.tool ? -1 : a.tool > b.tool ? 1 : 0)).slice(0, 20);
|
|
127
145
|
const totalsGroup = counted(facts);
|
|
128
146
|
return {
|
|
129
|
-
totals: { ...totalsGroup, input, cacheRead, cacheWrite, output, requests, unmetered },
|
|
147
|
+
totals: { ...totalsGroup, input: unknownTokens.has('input') ? null : input, cacheRead: unknownTokens.has('cacheRead') ? null : cacheRead, cacheWrite: unknownTokens.has('cacheWrite') ? null : cacheWrite, output: unknownTokens.has('output') ? null : output, requests: unknownRequests ? null : requests, unmetered: unknownRequests ? null : unmetered },
|
|
130
148
|
time: { endedRuns, wallMs, activeRuns, activeMs },
|
|
131
149
|
byHarnessEffort: harnessEffort,
|
|
132
150
|
byDay,
|
package/dist/store-reads/cap.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { meterFiguresFrom, spentFrom } from "../cap.js";
|
|
2
|
-
import {
|
|
2
|
+
import { bookedListSpend, bookedSpend, cliModelWorked, costIsBooked } from "../runner/metrics.js";
|
|
3
3
|
import { isCliRecord, runEntries, withPaidCosts } from "./journal.js";
|
|
4
4
|
/** A CLI run whose model answered or called a tool with no model request booked (metrics.ts cliModelWorked): what it
|
|
5
5
|
* spent no booking read, so its spend is unknown. */
|
|
@@ -7,12 +7,12 @@ const unbookedCli = (entries) => isCliRecord(entries) && bookedSpend(entries, "m
|
|
|
7
7
|
/** What a run has spent, as the cap reads it, from the one store's journal: its model requests and its paid tool calls. */
|
|
8
8
|
export async function spentOverStore(store, runId, context) {
|
|
9
9
|
const entries = await runEntries(store, runId, context);
|
|
10
|
-
// A run whose record carries no cost of its own (a CLI harness's, a workflow's) reads what its sessions booked
|
|
11
|
-
//
|
|
12
|
-
// unknown booked spend unknown (null).
|
|
10
|
+
// A run whose record carries no cost of its own (a CLI harness's, a workflow's) reads what its sessions booked for the
|
|
11
|
+
// requests that answered (metrics.ts bookedListSpend), its record's answers reading $0: 0 before any request, an
|
|
12
|
+
// unknown booked spend unknown (null). A request still out is held, not spent: its hold never shows as spend.
|
|
13
13
|
// A CLI run whose model worked with no request booked (its requests went past its model proxy) reads unknown, never $0.
|
|
14
14
|
if (costIsBooked(entries, isCliRecord(entries)))
|
|
15
|
-
return unbookedCli(entries) ? null :
|
|
15
|
+
return unbookedCli(entries) ? null : bookedListSpend(entries);
|
|
16
16
|
// A pi run's paid tool calls (a browser's time, a search, a monid call) are booked on the run's one ledger, not its root:
|
|
17
17
|
// folded back as the charges the file-backed root held (withPaidCosts), as metersOverStore reads them, so a live run's
|
|
18
18
|
// listed spend counts them.
|
|
@@ -40,5 +40,7 @@ export async function metersOverStore(store, runId, context) {
|
|
|
40
40
|
const model = bookedSpend(raw, "model");
|
|
41
41
|
if (!model.requests)
|
|
42
42
|
return unbookedCli(raw) ? { ...figures, tokens: null } : figures;
|
|
43
|
-
|
|
43
|
+
// /usage says no "at most": a request booked at its hold (`bounded`) is no spend there, so its meter is unknown, as for
|
|
44
|
+
// a request of no known cost, and its known dollars are the exact charges alone.
|
|
45
|
+
return { ...figures, tokens: model.bounded > 0 ? null : model.usd, known: { ...figures.known, tokens: model.known } };
|
|
44
46
|
}
|
|
@@ -10,6 +10,12 @@ export declare function runEntries(store: Store, runId: string, context: Context
|
|
|
10
10
|
* `after`, the entry before its input, and `until`, the run's end entry once written; `earlier`, each earlier round's (a
|
|
11
11
|
* follow-up opened the run again after it). Undefined for a run that asked none. */
|
|
12
12
|
export declare function runReflect(store: Store, runId: string, context: Context): Promise<Pick<Reflect, "after" | "until" | "earlier"> | undefined>;
|
|
13
|
+
/** The CLI record (a harness whose own records are resume log only, record "loop": adapter-loop.ts openCliRecord) as the
|
|
14
|
+
* pi-shaped entries the timeline renderer reads: a model message is an assistant turn, a person message a user turn, and a
|
|
15
|
+
* tool call its assistant tool-call and its result. So a claude-agent / codex / opencode run reads the same rows, words
|
|
16
|
+
* and final answer as a pi run of the same conversation. A run's own pi entries and its end-of-run turn (already model
|
|
17
|
+
* shaped) pass through unchanged, so a pi run is untouched. */
|
|
18
|
+
export declare function piShaped(entries: readonly EntryLike[]): EntryLike[];
|
|
13
19
|
/** The paid tool charges a run booked, read back from its paid-tools session (the kernel cap's TOOL_SESSION) as the
|
|
14
20
|
* TOOL_COST entries the timeline renders, which the file-backed path had on the run's root (the paid-call ledger). Each
|
|
15
21
|
* paid request's runner.request names its tool (its model "paid:<name>") and the call it ran under (`call`, written by the
|
|
@@ -19,8 +25,26 @@ export declare function runReflect(store: Store, runId: string, context: Context
|
|
|
19
25
|
* given back unused shows nothing. Each charge is placed right after its call's result, joined by `call`, as the ledger
|
|
20
26
|
* wrote it there. A run with no paid-tools session reads unchanged. */
|
|
21
27
|
export declare function withPaidCosts(entries: readonly EntryLike[]): EntryLike[];
|
|
22
|
-
/** Whether `entries` are a CLI harness's record (its loop's calls and messages).
|
|
28
|
+
/** Whether `entries` are a CLI harness's record (its loop's calls and messages). A nested call's (`<callId>/<key>`, a
|
|
29
|
+
* script's or tools_call's) is the record of whichever harness made the call it nests in: on pi, the loop keeps it
|
|
30
|
+
* beside pi's own record (adapter-loop.ts nestedGate), so it makes no run a CLI's. */
|
|
23
31
|
export declare const isCliRecord: (entries: readonly EntryLike[]) => boolean;
|
|
32
|
+
/** The call a run's turn ended on waiting for a person (timeline endedOnTurnEndingTool), over its root's entries as the
|
|
33
|
+
* run keeps them: a CLI harness's record read as pi's (piShaped), as its Timeline and its view read it, so the runner's
|
|
34
|
+
* loop parks a CLI run on exactly the question the view calls waiting, as it does a pi run. */
|
|
35
|
+
export declare const turnEndedOnAsk: (entries: readonly EntryLike[]) => string | undefined;
|
|
36
|
+
/** A grade's feedback round's words (runner/feedback-round.ts, KINDS.feedback) as the reviewer's message: a host's
|
|
37
|
+
* user entry, which the Timeline shows and pi never reads (the entry on the journal carries no model message). */
|
|
38
|
+
export declare function withFeedback(entries: readonly EntryLike[]): EntryLike[];
|
|
39
|
+
/** The job's turns: a run's timeline `rows` (runTimeline's) with every grade's feedback round left out, from its words'
|
|
40
|
+
* row (FEEDBACK_SUFFIX) up to the run's next message. A round asks the agent no turn of the job's, so what the job did is
|
|
41
|
+
* what is left (a follow-up's turns, a person's, included). The one view every reader of what the job's turns said
|
|
42
|
+
* reads (the answer, the path, nothing new, a run's trace). */
|
|
43
|
+
export declare function withoutFeedbackRounds<Row extends {
|
|
44
|
+
readonly id: string;
|
|
45
|
+
readonly kind: string;
|
|
46
|
+
readonly origin?: string;
|
|
47
|
+
}>(rows: readonly Row[]): Row[];
|
|
24
48
|
/** A run's timeline rows, the renderer (timelineOf) unchanged, over the one store's entries, with a CLI harness's record
|
|
25
49
|
* rendered as its pi-shaped entries (piShaped) and its paid tool charges read back from the paid-tools session
|
|
26
50
|
* (withPaidCosts). A run whose record carries no per-request cost (a CLI harness's, a workflow's: metrics.ts
|
|
@@ -29,6 +53,11 @@ export declare const isCliRecord: (entries: readonly EntryLike[]) => boolean;
|
|
|
29
53
|
* run's usage row counts them; its decisions' rows and cost come from their receipts (decision-rows.ts withDecisions),
|
|
30
54
|
* once. The end-of-run turn's rows are labelled as the server labels them (reflect-range.ts labelled). */
|
|
31
55
|
export declare function runTimeline(store: Store, runId: string, context: Context, options?: TimelineOptions): Promise<TimelineEvent[]>;
|
|
56
|
+
/** The run's MCP tools called by a hashed wire name, by that name (hashedMcp over its pin): what its end's metrics count
|
|
57
|
+
* each one's calls under its catalog name by (runner/metrics.ts runMetrics's `catalog`), as its timeline names them. */
|
|
58
|
+
export declare const hashedMcpOf: (store: Store, runId: string) => Promise<ReadonlyMap<string, string>>;
|
|
59
|
+
/** A usage row's cost when every model request went to a free model (its known price $0 for every token): $0, and why. */
|
|
60
|
+
export declare const FREE_COST = "$0 \u00B7 free model";
|
|
32
61
|
/** How a reader serves an answer whole: its redactor over the whole text (key-refusal.ts redactedAnswer with the run's
|
|
33
62
|
* values), and a key for those values (their digest), so an answer is read once per held value set. */
|
|
34
63
|
export type WholeAnswer = {
|