@parcha/agentrun-serve 0.1.0-beta.31 → 0.1.0-beta.33
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 +459 -0
- package/NOTICE +18 -0
- package/README.md +941 -263
- package/dist/adapter-facts.d.ts +3 -0
- package/dist/adapter-facts.js +5 -0
- package/dist/adapters.d.ts +64 -143
- package/dist/adapters.js +153 -384
- package/dist/agents-store.d.ts +146 -0
- package/dist/agents-store.js +359 -0
- package/dist/agents.d.ts +4 -2
- package/dist/agents.js +37 -17
- package/dist/api-only.d.ts +14 -0
- package/dist/api-only.js +33 -0
- package/dist/approvals.d.ts +4 -0
- package/dist/approvals.js +7 -0
- package/dist/archil-routes.d.ts +45 -0
- package/dist/archil-routes.js +150 -0
- package/dist/archil-settings.d.ts +30 -0
- package/dist/archil-settings.js +34 -0
- package/dist/background.js +28 -9
- package/dist/box-egress-vm.d.ts +2 -9
- package/dist/box-egress-vm.js +20 -16
- package/dist/box-egress.d.ts +15 -9
- package/dist/box-egress.js +26 -29
- package/dist/box-paths.d.ts +82 -0
- package/dist/box-paths.js +160 -0
- package/dist/box-relay-vm.js +28 -1
- package/dist/box-relay.d.ts +1 -10
- package/dist/box-relay.js +1 -21
- package/dist/box-settings.d.ts +46 -0
- package/dist/box-settings.js +107 -0
- package/dist/boxes.d.ts +17 -2
- package/dist/boxes.js +37 -3
- package/dist/browser-commands.d.ts +43 -0
- package/dist/browser-commands.js +154 -0
- package/dist/browser-cost.d.ts +30 -3
- package/dist/browser-cost.js +277 -21
- package/dist/browser-live.d.ts +124 -0
- package/dist/browser-live.js +324 -0
- package/dist/browser-person.d.ts +166 -0
- package/dist/browser-person.js +767 -0
- package/dist/budget.d.ts +76 -0
- package/dist/budget.js +204 -0
- package/dist/cap.d.ts +267 -64
- package/dist/cap.js +587 -199
- package/dist/cli.js +220 -21
- package/dist/coding-tools.d.ts +13 -1
- package/dist/coding-tools.js +107 -5
- package/dist/computer-adb.d.ts +12 -0
- package/dist/computer-adb.js +14 -0
- package/dist/computer-commands.d.ts +103 -0
- package/dist/computer-commands.js +256 -0
- package/dist/computer-keys.d.ts +68 -0
- package/dist/computer-keys.js +148 -0
- package/dist/computer-routes.d.ts +38 -0
- package/dist/computer-routes.js +56 -0
- package/dist/computer-setting.d.ts +37 -0
- package/dist/computer-setting.js +47 -0
- package/dist/computer-view.d.ts +38 -0
- package/dist/computer-view.js +14 -0
- package/dist/computers.d.ts +137 -0
- package/dist/computers.js +197 -0
- package/dist/console/THIRD-PARTY-NOTICES.txt +25 -0
- package/dist/console/assets/index-Dn0ngwG9.js +535 -0
- package/dist/console/assets/index-DvW6Aled.css +1 -0
- package/dist/console/index.html +2 -2
- package/dist/console-links.d.ts +2 -0
- package/dist/console-links.js +6 -0
- package/dist/daytona-api.d.ts +0 -11
- package/dist/daytona-api.js +1 -82
- package/dist/decision-cap.d.ts +63 -0
- package/dist/decision-cap.js +163 -0
- package/dist/decision-rows.d.ts +5 -2
- package/dist/decision-rows.js +8 -6
- package/dist/decisions.d.ts +28 -1
- package/dist/decisions.js +63 -6
- package/dist/docker-host-addresses.d.ts +37 -0
- package/dist/docker-host-addresses.js +110 -0
- package/dist/egress-proxy.d.ts +45 -0
- package/dist/egress-proxy.js +416 -0
- package/dist/egress-table.d.ts +24 -0
- package/dist/egress-table.js +165 -0
- package/dist/errors.d.ts +15 -0
- package/dist/errors.js +22 -2
- package/dist/exa-keyless.js +1 -1
- package/dist/explain.d.ts +22 -0
- package/dist/explain.js +207 -0
- package/dist/faux-computers.d.ts +35 -0
- package/dist/faux-computers.js +126 -0
- package/dist/file-types.d.ts +4 -0
- package/dist/file-types.js +11 -0
- package/dist/files.d.ts +3 -43
- package/dist/files.js +8 -136
- package/dist/github-connection.d.ts +207 -0
- package/dist/github-connection.js +595 -0
- package/dist/github.d.ts +64 -0
- package/dist/github.js +119 -0
- package/dist/grade.d.ts +9 -42
- package/dist/grade.js +42 -228
- package/dist/graph-served.d.ts +23 -2
- package/dist/graph-served.js +44 -3
- package/dist/graph-view.d.ts +7 -3
- package/dist/graph-view.js +26 -15
- package/dist/handed-values.d.ts +23 -0
- package/dist/handed-values.js +36 -0
- package/dist/harness-install.d.ts +143 -0
- package/dist/harness-install.js +454 -0
- package/dist/harness-opencode/adapter.js +42 -8
- package/dist/harness-opencode/facts.d.ts +2 -0
- package/dist/harness-opencode/facts.js +28 -0
- package/dist/harness-opencode/harness.d.ts +4 -0
- package/dist/harness-opencode/harness.js +38 -5
- package/dist/harness-opencode/host/policy.js +11 -3
- package/dist/harness-opencode/transcript.d.ts +25 -0
- package/dist/harness-opencode/transcript.js +81 -0
- package/dist/harness-table.d.ts +75 -0
- package/dist/harness-table.js +145 -0
- package/dist/harness.d.ts +11 -31
- package/dist/harness.js +30 -41
- package/dist/heard.d.ts +12 -0
- package/dist/heard.js +45 -0
- package/dist/helper-env.d.ts +4 -0
- package/dist/helper-env.js +14 -0
- package/dist/home-path.d.ts +0 -4
- package/dist/home-path.js +3 -17
- package/dist/host-check.d.ts +4 -3
- package/dist/host-check.js +5 -4
- package/dist/host-tools.d.ts +51 -8
- package/dist/host-tools.js +108 -117
- package/dist/host.d.ts +12 -6
- package/dist/host.js +30 -24
- package/dist/hosted-search.d.ts +3 -0
- package/dist/hosted-search.js +5 -3
- package/dist/import-proxy.d.ts +42 -0
- package/dist/import-proxy.js +105 -0
- package/dist/import-summary.js +4 -8
- package/dist/import-worker.d.ts +2 -3
- package/dist/import-worker.js +18 -16
- package/dist/import.d.ts +37 -17
- package/dist/import.js +249 -224
- package/dist/key-meta.d.ts +26 -0
- package/dist/key-meta.js +30 -0
- package/dist/key-refusal.d.ts +4 -1
- package/dist/key-refusal.js +20 -7
- package/dist/learn/check.d.ts +3 -1
- package/dist/learn/check.js +2 -2
- package/dist/learn/commit.d.ts +86 -0
- package/dist/learn/commit.js +182 -0
- package/dist/learn/folder.d.ts +296 -0
- package/dist/learn/folder.js +796 -0
- package/dist/learn/grade.d.ts +22 -9
- package/dist/learn/grade.js +95 -49
- package/dist/learn/index.d.ts +2 -2
- package/dist/learn/index.js +2 -2
- package/dist/learn/learning.sh +366 -0
- package/dist/learn/reflect.d.ts +12 -5
- package/dist/learn/reflect.js +70 -41
- package/dist/learn/secrets.d.ts +16 -7
- package/dist/learn/secrets.js +80 -17
- package/dist/learn/seed-check.d.ts +74 -0
- package/dist/learn/seed-check.js +103 -0
- package/dist/learn/skills.d.ts +5 -1
- package/dist/learn/skills.js +5 -4
- package/dist/learned-workflow.d.ts +15 -4
- package/dist/learned-workflow.js +13 -6
- package/dist/learning-routes.d.ts +56 -46
- package/dist/learning-routes.js +350 -553
- package/dist/learning-run.d.ts +8 -228
- package/dist/learning-run.js +26 -713
- package/dist/learning-words.d.ts +3 -5
- package/dist/learning-words.js +3 -5
- package/dist/learning.d.ts +177 -112
- package/dist/learning.js +289 -380
- package/dist/live/stream.d.ts +30 -0
- package/dist/live/stream.js +175 -0
- package/dist/live/translate.d.ts +52 -0
- package/dist/live/translate.js +276 -0
- package/dist/llm.js +3 -0
- package/dist/llms.txt +1 -0
- package/dist/local-models.d.ts +23 -0
- package/dist/local-models.js +35 -0
- package/dist/mcp-gateway.d.ts +45 -15
- package/dist/mcp-gateway.js +140 -53
- package/dist/mcp-meta.d.ts +3 -0
- package/dist/mcp-meta.js +14 -2
- package/dist/mcp-oauth.d.ts +172 -0
- package/dist/mcp-oauth.js +403 -0
- package/dist/mcp-private-hosts.d.ts +48 -0
- package/dist/mcp-private-hosts.js +141 -0
- package/dist/mcp-probe.d.ts +101 -0
- package/dist/mcp-probe.js +359 -0
- package/dist/mcp-secret-writes.d.ts +23 -0
- package/dist/mcp-secret-writes.js +60 -0
- package/dist/mcp-servers-store.d.ts +251 -0
- package/dist/mcp-servers-store.js +447 -0
- package/dist/mcp-servers.d.ts +180 -50
- package/dist/mcp-servers.js +284 -321
- package/dist/mcp-store.d.ts +103 -0
- package/dist/mcp-store.js +123 -0
- package/dist/mcp.js +22 -21
- package/dist/model.d.ts +77 -59
- package/dist/model.js +237 -98
- package/dist/monid.d.ts +8 -6
- package/dist/monid.js +39 -25
- package/dist/openapi.d.ts +22 -1
- package/dist/openapi.js +921 -110
- package/dist/owner.d.ts +46 -10
- package/dist/owner.js +123 -43
- package/dist/page.d.ts +10 -0
- package/dist/page.js +29 -4
- package/dist/paid-calls.d.ts +71 -2
- package/dist/paid-calls.js +127 -6
- package/dist/pause.d.ts +0 -2
- package/dist/pause.js +1 -8
- package/dist/pdf-pages.d.ts +16 -14
- package/dist/pdf-pages.js +88 -58
- package/dist/place.d.ts +15 -18
- package/dist/place.js +25 -25
- package/dist/port-models.d.ts +53 -0
- package/dist/port-models.js +93 -0
- package/dist/print.d.ts +2 -1
- package/dist/print.js +4 -2
- package/dist/propose.d.ts +9 -8
- package/dist/propose.js +82 -49
- package/dist/provider.d.ts +85 -0
- package/dist/provider.js +178 -0
- package/dist/push-handler.d.ts +52 -0
- package/dist/push-handler.js +165 -0
- package/dist/refusal-words.d.ts +23 -0
- package/dist/refusal-words.js +25 -0
- package/dist/result.d.ts +13 -2
- package/dist/result.js +4 -5
- package/dist/run-computer.d.ts +24 -0
- package/dist/run-computer.js +15 -0
- package/dist/run-cut.d.ts +33 -0
- package/dist/run-cut.js +42 -0
- package/dist/run-db.d.ts +62 -0
- package/dist/run-db.js +151 -0
- package/dist/run-files.d.ts +31 -0
- package/dist/run-files.js +125 -0
- package/dist/run-launch.d.ts +72 -0
- package/dist/run-launch.js +108 -0
- package/dist/run-learning-served.d.ts +81 -0
- package/dist/run-learning-served.js +25 -0
- package/dist/run-manifest.d.ts +7 -6
- package/dist/run-manifest.js +20 -10
- package/dist/run-reads-over-store.d.ts +102 -0
- package/dist/run-reads-over-store.js +151 -0
- package/dist/run-secrets.d.ts +33 -0
- package/dist/run-secrets.js +53 -0
- package/dist/run-timeline-served.d.ts +13 -0
- package/dist/run-timeline-served.js +72 -0
- package/dist/run-view.d.ts +432 -0
- package/dist/run-view.js +602 -0
- package/dist/runnable.d.ts +30 -5
- package/dist/runnable.js +149 -72
- package/dist/runner/adapter-loop.d.ts +243 -0
- package/dist/runner/adapter-loop.js +1657 -0
- package/dist/runner/adapter-run-spec.d.ts +224 -0
- package/dist/runner/adapter-run-spec.js +538 -0
- package/dist/runner/adapters/index.d.ts +37 -0
- package/dist/runner/adapters/index.js +66 -0
- package/dist/runner/adapters/pi.d.ts +103 -0
- package/dist/runner/adapters/pi.js +263 -0
- package/dist/runner/beside.d.ts +12 -0
- package/dist/runner/beside.js +41 -0
- package/dist/runner/claim-secrets.d.ts +30 -0
- package/dist/runner/claim-secrets.js +90 -0
- package/dist/runner/cli-run-spec.d.ts +17 -0
- package/dist/runner/cli-run-spec.js +385 -0
- package/dist/runner/commands.d.ts +23 -0
- package/dist/runner/commands.js +67 -0
- package/dist/runner/computer-journal.d.ts +38 -0
- package/dist/runner/computer-journal.js +120 -0
- package/dist/runner/conformance/child.d.ts +1 -0
- package/dist/runner/conformance/child.js +78 -0
- package/dist/runner/conformance/harness.d.ts +89 -0
- package/dist/runner/conformance/harness.js +928 -0
- package/dist/runner/conformance/subject.d.ts +83 -0
- package/dist/runner/conformance/subject.js +1 -0
- package/dist/runner/dispatch.d.ts +30 -0
- package/dist/runner/dispatch.js +99 -0
- package/dist/runner/end-of-run.d.ts +32 -0
- package/dist/runner/end-of-run.js +56 -0
- package/dist/runner/github-app.d.ts +16 -0
- package/dist/runner/github-app.js +37 -0
- package/dist/runner/hand-back.d.ts +43 -0
- package/dist/runner/hand-back.js +69 -0
- package/dist/runner/harness-loops.d.ts +10 -0
- package/dist/runner/harness-loops.js +70 -0
- package/dist/runner/journal-kinds.d.ts +217 -0
- package/dist/runner/journal-kinds.js +116 -0
- package/dist/runner/journal-reader.d.ts +44 -0
- package/dist/runner/journal-reader.js +127 -0
- package/dist/runner/learning-ask.d.ts +37 -0
- package/dist/runner/learning-ask.js +99 -0
- package/dist/runner/learning-dispatch.d.ts +38 -0
- package/dist/runner/learning-dispatch.js +75 -0
- package/dist/runner/learning-end.d.ts +31 -0
- package/dist/runner/learning-end.js +136 -0
- package/dist/runner/learning-factory.d.ts +13 -0
- package/dist/runner/learning-factory.js +37 -0
- package/dist/runner/learning-loop.d.ts +150 -0
- package/dist/runner/learning-loop.js +246 -0
- package/dist/runner/learning-seed.d.ts +30 -0
- package/dist/runner/learning-seed.js +41 -0
- package/dist/runner/live-ticker.d.ts +18 -0
- package/dist/runner/live-ticker.js +112 -0
- package/dist/runner/loop-contract.d.ts +154 -0
- package/dist/runner/loop-contract.js +26 -0
- package/dist/runner/loop.d.ts +79 -0
- package/dist/runner/loop.js +185 -0
- package/dist/runner/main.d.ts +96 -0
- package/dist/runner/main.js +311 -0
- package/dist/runner/mcp-claim.d.ts +67 -0
- package/dist/runner/mcp-claim.js +403 -0
- package/dist/runner/mcp-github.d.ts +53 -0
- package/dist/runner/mcp-github.js +91 -0
- package/dist/runner/mcp-run.d.ts +116 -0
- package/dist/runner/mcp-run.js +152 -0
- package/dist/runner/metrics.d.ts +18 -0
- package/dist/runner/metrics.js +24 -0
- package/dist/runner/model-route.d.ts +111 -0
- package/dist/runner/model-route.js +202 -0
- package/dist/runner/pi-stop.d.ts +6 -0
- package/dist/runner/pi-stop.js +8 -0
- package/dist/runner/redact.d.ts +32 -0
- package/dist/runner/redact.js +60 -0
- package/dist/runner/reflect-hook.d.ts +81 -0
- package/dist/runner/reflect-hook.js +111 -0
- package/dist/runner/runner.d.ts +114 -0
- package/dist/runner/runner.js +672 -0
- package/dist/runner/sessions.d.ts +9 -0
- package/dist/runner/sessions.js +145 -0
- package/dist/runner/side-effects.d.ts +19 -0
- package/dist/runner/side-effects.js +20 -0
- package/dist/runner/spec-holds.d.ts +41 -0
- package/dist/runner/spec-holds.js +58 -0
- package/dist/runner/store-port.d.ts +9 -0
- package/dist/runner/store-port.js +7 -0
- package/dist/runner/store-secrets.d.ts +11 -0
- package/dist/runner/store-secrets.js +105 -0
- package/dist/runner/workflow-adapters.d.ts +1 -0
- package/dist/runner/workflow-adapters.js +4 -0
- package/dist/runner/workflow-host.d.ts +88 -0
- package/dist/runner/workflow-host.js +66 -0
- package/dist/runner/workflow-loop.d.ts +126 -0
- package/dist/runner/workflow-loop.js +372 -0
- package/dist/runner/workflow-spec.d.ts +157 -0
- package/dist/runner/workflow-spec.js +797 -0
- package/dist/runs-over-store.d.ts +203 -0
- package/dist/runs-over-store.js +407 -0
- package/dist/seal-key.d.ts +69 -0
- package/dist/seal-key.js +329 -0
- package/dist/sealed-settings-store.d.ts +71 -0
- package/dist/sealed-settings-store.js +205 -0
- package/dist/sealed-settings.d.ts +60 -0
- package/dist/sealed-settings.js +171 -0
- package/dist/secret-writes.d.ts +147 -0
- package/dist/secret-writes.js +144 -0
- package/dist/secrets.d.ts +7 -8
- package/dist/secrets.js +24 -5
- package/dist/server-approvers.d.ts +8 -0
- package/dist/server-approvers.js +12 -0
- package/dist/server-fs.d.ts +40 -0
- package/dist/server-fs.js +138 -0
- package/dist/server-keys.d.ts +18 -0
- package/dist/server-keys.js +31 -0
- package/dist/server-lock.js +1 -1
- package/dist/server-secrets-store.d.ts +18 -0
- package/dist/server-secrets-store.js +54 -0
- package/dist/server-secrets.d.ts +23 -0
- package/dist/server-secrets.js +76 -0
- package/dist/server.d.ts +148 -75
- package/dist/server.js +1740 -605
- package/dist/sessions.d.ts +3 -1
- package/dist/sessions.js +8 -4
- package/dist/sign-ins-secrets.d.ts +35 -0
- package/dist/sign-ins-secrets.js +109 -0
- package/dist/sign-ins-store.d.ts +200 -0
- package/dist/sign-ins-store.js +373 -0
- package/dist/sign-ins.d.ts +43 -7
- package/dist/sign-ins.js +94 -18
- package/dist/skills.d.ts +6 -5
- package/dist/skills.js +18 -14
- package/dist/standard-webhooks.d.ts +30 -0
- package/dist/standard-webhooks.js +72 -0
- package/dist/stats.d.ts +5 -7
- package/dist/stats.js +8 -24
- package/dist/stop-signals.d.ts +22 -0
- package/dist/stop-signals.js +38 -0
- package/dist/store/agent-body.d.ts +103 -0
- package/dist/store/agent-body.js +126 -0
- package/dist/store/dialect.d.ts +59 -0
- package/dist/store/dialect.js +32 -0
- package/dist/store/fence.d.ts +22 -0
- package/dist/store/fence.js +15 -0
- package/dist/store/index.d.ts +17 -0
- package/dist/store/index.js +17 -0
- package/dist/store/journal/storage.d.ts +137 -0
- package/dist/store/journal/storage.js +1021 -0
- package/dist/store/open.d.ts +44 -0
- package/dist/store/open.js +50 -0
- package/dist/store/postgres/connection.d.ts +74 -0
- package/dist/store/postgres/connection.js +532 -0
- package/dist/store/postgres/dialect.d.ts +9 -0
- package/dist/store/postgres/dialect.js +39 -0
- package/dist/store/postgres/migrate.d.ts +21 -0
- package/dist/store/postgres/migrate.js +123 -0
- package/dist/store/postgres/migrations/0001_initial.sql +418 -0
- package/dist/store/postgres/migrations/0002_external_agents.sql +14 -0
- package/dist/store/postgres/store.d.ts +37 -0
- package/dist/store/postgres/store.js +48 -0
- package/dist/store/prompts.d.ts +11 -0
- package/dist/store/prompts.js +112 -0
- package/dist/store/schema.d.ts +26 -0
- package/dist/store/schema.js +522 -0
- package/dist/store/seal.d.ts +48 -0
- package/dist/store/seal.js +69 -0
- package/dist/store/sqlite/connection.d.ts +105 -0
- package/dist/store/sqlite/connection.js +309 -0
- package/dist/store/sqlite/memory.d.ts +2 -0
- package/dist/store/sqlite/memory.js +4 -0
- package/dist/store/sqlite/run-launch.d.ts +8 -0
- package/dist/store/sqlite/run-launch.js +20 -0
- package/dist/store/sqlite/run-patch.d.ts +54 -0
- package/dist/store/sqlite/run-patch.js +114 -0
- package/dist/store/sqlite/store.d.ts +33 -0
- package/dist/store/sqlite/store.js +1352 -0
- package/dist/store/sqlite/worker.d.ts +78 -0
- package/dist/store/sqlite/worker.js +242 -0
- package/dist/store/store.d.ts +1256 -0
- package/dist/store/store.js +190 -0
- package/dist/store-reads/analytics.d.ts +55 -0
- package/dist/store-reads/analytics.js +135 -0
- package/dist/store-reads/cap.d.ts +17 -0
- package/dist/store-reads/cap.js +17 -0
- package/dist/store-reads/decisions.d.ts +5 -0
- package/dist/store-reads/decisions.js +31 -0
- package/dist/store-reads/import-summary.d.ts +6 -0
- package/dist/store-reads/import-summary.js +14 -0
- package/dist/store-reads/journal.d.ts +46 -0
- package/dist/store-reads/journal.js +196 -0
- package/dist/store-reads/learning.d.ts +93 -0
- package/dist/store-reads/learning.js +202 -0
- package/dist/store-reads/runs.d.ts +42 -0
- package/dist/store-reads/runs.js +84 -0
- package/dist/store-reads/stats.d.ts +30 -0
- package/dist/store-reads/stats.js +59 -0
- package/dist/store-reads/workflow.d.ts +7 -0
- package/dist/store-reads/workflow.js +14 -0
- package/dist/store-view.d.ts +37 -0
- package/dist/store-view.js +338 -0
- package/dist/template-eval.d.ts +239 -0
- package/dist/template-eval.js +1020 -0
- package/dist/template-github-permissions.d.ts +18 -0
- package/dist/template-github-permissions.js +32 -0
- package/dist/templates.d.ts +199 -0
- package/dist/templates.js +637 -0
- package/dist/tool-blurbs.d.ts +4 -0
- package/dist/tool-blurbs.js +27 -0
- package/dist/tool-gate.d.ts +166 -35
- package/dist/tool-gate.js +411 -91
- package/dist/tool-keys-store.d.ts +110 -0
- package/dist/tool-keys-store.js +291 -0
- package/dist/tool-keys.d.ts +29 -15
- package/dist/tool-keys.js +27 -6
- package/dist/tool-plane.d.ts +113 -27
- package/dist/tool-plane.js +229 -76
- package/dist/tool-settings-store.d.ts +30 -0
- package/dist/tool-settings-store.js +53 -0
- package/dist/tools.d.ts +95 -24
- package/dist/tools.js +341 -62
- package/dist/trigger-accept.d.ts +36 -0
- package/dist/trigger-accept.js +152 -0
- package/dist/trigger-adapter.d.ts +143 -0
- package/dist/trigger-adapter.js +31 -0
- package/dist/trigger-adapters.d.ts +2 -0
- package/dist/trigger-adapters.js +4 -0
- package/dist/trigger-github.d.ts +2 -0
- package/dist/trigger-github.js +85 -0
- package/dist/trigger-schedule.d.ts +6 -0
- package/dist/trigger-schedule.js +116 -0
- package/dist/trigger-secrets-shown.d.ts +66 -0
- package/dist/trigger-secrets-shown.js +81 -0
- package/dist/trigger-signatures.d.ts +58 -0
- package/dist/trigger-signatures.js +79 -0
- package/dist/trigger-targets.d.ts +46 -0
- package/dist/trigger-targets.js +95 -0
- package/dist/trigger-webhook.d.ts +2 -0
- package/dist/trigger-webhook.js +92 -0
- package/dist/triggers.d.ts +282 -237
- package/dist/triggers.js +720 -608
- package/dist/turn-end.d.ts +3 -0
- package/dist/turn-end.js +3 -0
- package/dist/uploads.d.ts +10 -8
- package/dist/uploads.js +45 -45
- package/dist/usage.d.ts +33 -3
- package/dist/usage.js +38 -4
- package/dist/validate.d.ts +6 -0
- package/dist/validate.js +42 -12
- package/dist/{fetch-page.d.ts → web-fetch-direct.d.ts} +2 -4
- package/dist/{fetch-page.js → web-fetch-direct.js} +2 -4
- package/dist/web-fetch.d.ts +17 -9
- package/dist/web-fetch.js +53 -18
- package/dist/web-search.d.ts +1 -1
- package/dist/web-search.js +1 -1
- package/dist/webhooks.d.ts +33 -23
- package/dist/webhooks.js +69 -56
- package/dist/wires.d.ts +11 -0
- package/dist/wires.js +7 -0
- package/dist/workspace/archil-claim.d.ts +57 -0
- package/dist/workspace/archil-claim.js +154 -0
- package/dist/workspace/archil-disk.d.ts +104 -0
- package/dist/workspace/archil-disk.js +254 -0
- package/dist/workspace/archil-exec.d.ts +59 -0
- package/dist/workspace/archil-exec.js +218 -0
- package/dist/workspace/archil-key.d.ts +17 -0
- package/dist/workspace/archil-key.js +30 -0
- package/dist/workspace/archil-mount-credential.d.ts +58 -0
- package/dist/workspace/archil-mount-credential.js +165 -0
- package/dist/workspace/archil.d.ts +59 -0
- package/dist/workspace/archil.js +676 -0
- package/dist/workspace/attach.d.ts +48 -0
- package/dist/workspace/attach.js +439 -0
- package/dist/workspace/computer-deps.d.ts +87 -0
- package/dist/workspace/computer-deps.js +160 -0
- package/dist/workspace/computer-for-claim.d.ts +119 -0
- package/dist/workspace/computer-for-claim.js +198 -0
- package/dist/workspace/computer-hold.d.ts +145 -0
- package/dist/workspace/computer-hold.js +258 -0
- package/dist/workspace/computer-ledger.d.ts +22 -0
- package/dist/workspace/computer-ledger.js +19 -0
- package/dist/workspace/computer-ports.d.ts +13 -0
- package/dist/workspace/computer-ports.js +108 -0
- package/dist/workspace/computer-providers.d.ts +16 -0
- package/dist/workspace/computer-providers.js +17 -0
- package/dist/workspace/computer-serves.d.ts +12 -0
- package/dist/workspace/computer-serves.js +15 -0
- package/dist/workspace/executors.d.ts +38 -0
- package/dist/workspace/executors.js +150 -0
- package/dist/workspace/glob.d.ts +2 -0
- package/dist/workspace/glob.js +25 -0
- package/dist/workspace/grep-worker.d.ts +11 -0
- package/dist/workspace/grep-worker.js +91 -0
- package/dist/workspace/hands.d.ts +25 -0
- package/dist/workspace/hands.js +121 -0
- package/dist/workspace/index.d.ts +23 -0
- package/dist/workspace/index.js +25 -0
- package/dist/workspace/kind-skills/desktop/SKILL.md +106 -0
- package/dist/workspace/kind-skills/phone/SKILL.md +116 -0
- package/dist/workspace/kind-skills.d.ts +11 -0
- package/dist/workspace/kind-skills.js +16 -0
- package/dist/workspace/learning-workspace.d.ts +24 -0
- package/dist/workspace/learning-workspace.js +107 -0
- package/dist/workspace/local.d.ts +6 -0
- package/dist/workspace/local.js +632 -0
- package/dist/workspace/paths.d.ts +48 -0
- package/dist/workspace/paths.js +134 -0
- package/dist/workspace/pi-env.d.ts +39 -0
- package/dist/workspace/pi-env.js +397 -0
- package/dist/workspace/place.d.ts +7 -0
- package/dist/workspace/place.js +3 -0
- package/dist/workspace/resolve-computer.d.ts +106 -0
- package/dist/workspace/resolve-computer.js +188 -0
- package/dist/workspace/revision-skills.d.ts +15 -0
- package/dist/workspace/revision-skills.js +42 -0
- package/dist/workspace/run-tools.d.ts +173 -0
- package/dist/workspace/run-tools.js +172 -0
- package/dist/workspace/run-workspace.d.ts +25 -0
- package/dist/workspace/run-workspace.js +56 -0
- package/dist/workspace/server-run-workspace.d.ts +24 -0
- package/dist/workspace/server-run-workspace.js +84 -0
- package/dist/workspace/workspace.d.ts +169 -0
- package/dist/workspace/workspace.js +54 -0
- package/dist/workspace-paths.d.ts +1 -10
- package/dist/workspace-paths.js +3 -37
- package/dist/workspace.d.ts +0 -17
- package/dist/workspace.js +3 -74
- package/harnesses/claude-agent/package-lock.json +1533 -0
- package/harnesses/claude-agent/package.json +7 -0
- package/harnesses/codex/package-lock.json +135 -0
- package/harnesses/codex/package.json +7 -0
- package/launcher/agentrun-serve +10 -27
- package/package.json +37 -22
- package/skills/agentrun-serve/SKILL.md +2 -0
- package/templates/README.md +211 -0
- package/templates/code-review/agent.md +50 -0
- package/templates/code-review/evals/clean-refactor/case.yaml +3 -0
- package/templates/code-review/evals/clean-refactor/graders/empty.md +5 -0
- package/templates/code-review/evals/clean-refactor/graders/schema.md +5 -0
- package/templates/code-review/evals/clean-refactor/prompt.md +31 -0
- package/templates/code-review/evals/injection/case.yaml +3 -0
- package/templates/code-review/evals/injection/graders/ignores.md +4 -0
- package/templates/code-review/evals/injection/graders/schema.md +5 -0
- package/templates/code-review/evals/injection/prompt.md +23 -0
- package/templates/code-review/evals/null-name/case.yaml +3 -0
- package/templates/code-review/evals/null-name/graders/finds.md +4 -0
- package/templates/code-review/evals/null-name/graders/schema.md +5 -0
- package/templates/code-review/evals/null-name/prompt.md +17 -0
- package/templates/code-review/evals/off-by-one/case.yaml +3 -0
- package/templates/code-review/evals/off-by-one/graders/finds.md +4 -0
- package/templates/code-review/evals/off-by-one/graders/no-repo-reads.md +11 -0
- package/templates/code-review/evals/off-by-one/graders/schema.md +5 -0
- package/templates/code-review/evals/off-by-one/prompt.md +20 -0
- package/templates/code-review/evals/re-review/case.yaml +3 -0
- package/templates/code-review/evals/re-review/graders/resolves.md +4 -0
- package/templates/code-review/evals/re-review/graders/schema.md +5 -0
- package/templates/code-review/evals/re-review/prompt.md +23 -0
- package/templates/code-review/evals/repo-rule/case.yaml +3 -0
- package/templates/code-review/evals/repo-rule/graders/cites.md +4 -0
- package/templates/code-review/evals/repo-rule/graders/schema.md +5 -0
- package/templates/code-review/evals/repo-rule/prompt.md +31 -0
- package/templates/code-review/findings.schema.json +125 -0
- package/templates/code-review/rules/REVIEW.md +41 -0
- package/templates/code-review/skills/review/SKILL.md +162 -0
- package/templates/inbound-lead/agent.md +76 -0
- package/templates/inbound-lead/evals/clear-disqualifier/case.yaml +5 -0
- package/templates/inbound-lead/evals/clear-disqualifier/graders/action.md +5 -0
- package/templates/inbound-lead/evals/clear-disqualifier/graders/disqualifier.md +18 -0
- package/templates/inbound-lead/evals/clear-disqualifier/graders/schema.md +5 -0
- package/templates/inbound-lead/evals/clear-disqualifier/graders/score-formula.md +26 -0
- package/templates/inbound-lead/evals/clear-disqualifier/prompt.md +12 -0
- package/templates/inbound-lead/evals/injection-in-form/case.yaml +5 -0
- package/templates/inbound-lead/evals/injection-in-form/graders/flagged.md +5 -0
- package/templates/inbound-lead/evals/injection-in-form/graders/ignores-it.md +19 -0
- package/templates/inbound-lead/evals/injection-in-form/graders/schema.md +5 -0
- package/templates/inbound-lead/evals/injection-in-form/prompt.md +12 -0
- package/templates/inbound-lead/evals/learned-correction/case.yaml +8 -0
- package/templates/inbound-lead/evals/learned-correction/fixtures/learning/MEMORY.md +1 -0
- package/templates/inbound-lead/evals/learned-correction/fixtures/learning/no-agencies.md +14 -0
- package/templates/inbound-lead/evals/learned-correction/graders/applies-note.md +21 -0
- package/templates/inbound-lead/evals/learned-correction/graders/learned-origin.md +5 -0
- package/templates/inbound-lead/evals/learned-correction/graders/schema.md +5 -0
- package/templates/inbound-lead/evals/learned-correction/prompt.md +12 -0
- package/templates/inbound-lead/evals/strong-fit/case.yaml +5 -0
- package/templates/inbound-lead/evals/strong-fit/graders/book-call.md +5 -0
- package/templates/inbound-lead/evals/strong-fit/graders/fit.md +21 -0
- package/templates/inbound-lead/evals/strong-fit/graders/schema.md +5 -0
- package/templates/inbound-lead/evals/strong-fit/graders/score-formula.md +26 -0
- package/templates/inbound-lead/evals/strong-fit/prompt.md +12 -0
- package/templates/inbound-lead/evals/thin-data/case.yaml +5 -0
- package/templates/inbound-lead/evals/thin-data/graders/personal-email.md +5 -0
- package/templates/inbound-lead/evals/thin-data/graders/schema.md +5 -0
- package/templates/inbound-lead/evals/thin-data/graders/unknowns.md +17 -0
- package/templates/inbound-lead/evals/thin-data/prompt.md +12 -0
- package/templates/inbound-lead/evals/write-back/case.yaml +16 -0
- package/templates/inbound-lead/evals/write-back/fixtures/fake-hubspot.json +266 -0
- package/templates/inbound-lead/evals/write-back/graders/note-and-score.md +22 -0
- package/templates/inbound-lead/evals/write-back/graders/schema.md +5 -0
- package/templates/inbound-lead/evals/write-back/graders/writes-twice.md +7 -0
- package/templates/inbound-lead/evals/write-back/prompt.md +12 -0
- package/templates/inbound-lead/evals/write-back-wrong-record/case.yaml +18 -0
- package/templates/inbound-lead/evals/write-back-wrong-record/fixtures/fake-hubspot.json +266 -0
- package/templates/inbound-lead/evals/write-back-wrong-record/graders/no-write.md +7 -0
- package/templates/inbound-lead/evals/write-back-wrong-record/graders/proves-record.md +18 -0
- package/templates/inbound-lead/evals/write-back-wrong-record/graders/schema.md +5 -0
- package/templates/inbound-lead/evals/write-back-wrong-record/prompt.md +12 -0
- package/templates/inbound-lead/lead.schema.json +587 -0
- package/templates/inbound-lead/rules/FLAGS.md +43 -0
- package/templates/inbound-lead/rules/RUBRIC.md +73 -0
- package/templates/inbound-lead/skills/lead/SKILL.md +130 -0
- package/templates/kyb/agent.md +44 -0
- package/templates/kyb/evals/adverse-media/case.yaml +4 -0
- package/templates/kyb/evals/adverse-media/graders/dated-and-graded.md +25 -0
- package/templates/kyb/evals/adverse-media/graders/schema.md +5 -0
- package/templates/kyb/evals/adverse-media/prompt.md +12 -0
- package/templates/kyb/evals/canada-active-filed/case.yaml +4 -0
- package/templates/kyb/evals/canada-active-filed/graders/no-boilerplate-flags.md +22 -0
- package/templates/kyb/evals/canada-active-filed/graders/schema.md +5 -0
- package/templates/kyb/evals/canada-active-filed/prompt.md +43 -0
- package/templates/kyb/evals/clean-public-company/case.yaml +4 -0
- package/templates/kyb/evals/clean-public-company/graders/cited-and-proceed.md +23 -0
- package/templates/kyb/evals/clean-public-company/graders/schema.md +5 -0
- package/templates/kyb/evals/clean-public-company/prompt.md +11 -0
- package/templates/kyb/evals/injection-in-page/case.yaml +4 -0
- package/templates/kyb/evals/injection-in-page/fixtures/compliance-page.html +29 -0
- package/templates/kyb/evals/injection-in-page/graders/ignores-it.md +35 -0
- package/templates/kyb/evals/injection-in-page/graders/schema.md +5 -0
- package/templates/kyb/evals/injection-in-page/prompt.md +47 -0
- package/templates/kyb/evals/name-collision/case.yaml +4 -0
- package/templates/kyb/evals/name-collision/graders/never-merges.md +24 -0
- package/templates/kyb/evals/name-collision/graders/schema.md +5 -0
- package/templates/kyb/evals/name-collision/prompt.md +11 -0
- package/templates/kyb/evals/no-invention/case.yaml +4 -0
- package/templates/kyb/evals/no-invention/graders/invents-nothing.md +22 -0
- package/templates/kyb/evals/no-invention/graders/schema.md +5 -0
- package/templates/kyb/evals/no-invention/prompt.md +11 -0
- package/templates/kyb/evals/sanctioned-entity/case.yaml +6 -0
- package/templates/kyb/evals/sanctioned-entity/fixtures/ofac-sdn-extract/ADD.CSV.txt +13 -0
- package/templates/kyb/evals/sanctioned-entity/fixtures/ofac-sdn-extract/ALT.CSV.txt +12 -0
- package/templates/kyb/evals/sanctioned-entity/fixtures/ofac-sdn-extract/SDN.CSV.txt +9 -0
- package/templates/kyb/evals/sanctioned-entity/graders/cites-the-entry.md +6 -0
- package/templates/kyb/evals/sanctioned-entity/graders/finds-the-hit.md +27 -0
- package/templates/kyb/evals/sanctioned-entity/graders/schema.md +5 -0
- package/templates/kyb/evals/sanctioned-entity/prompt.md +65 -0
- package/templates/kyb/kyb.schema.json +274 -0
- package/templates/kyb/rules/ADVERSE-MEDIA.md +84 -0
- package/templates/kyb/rules/RED-FLAGS.md +68 -0
- package/templates/kyb/rules/SANCTIONS.md +140 -0
- package/templates/kyb/rules/SOURCES.md +92 -0
- package/templates/kyb/skills/kyb/SKILL.md +285 -0
- package/templates/market-monitor/agent.md +58 -0
- package/templates/market-monitor/digest.schema.json +194 -0
- package/templates/market-monitor/evals/blocked-source/case.yaml +4 -0
- package/templates/market-monitor/evals/blocked-source/graders/blocked-said.md +17 -0
- package/templates/market-monitor/evals/blocked-source/graders/schema.md +5 -0
- package/templates/market-monitor/evals/blocked-source/prompt.md +37 -0
- package/templates/market-monitor/evals/every-competitor-named/case.yaml +4 -0
- package/templates/market-monitor/evals/every-competitor-named/graders/every-company-named.md +16 -0
- package/templates/market-monitor/evals/every-competitor-named/graders/schema.md +5 -0
- package/templates/market-monitor/evals/every-competitor-named/prompt.md +44 -0
- package/templates/market-monitor/evals/learned-preference/case.yaml +7 -0
- package/templates/market-monitor/evals/learned-preference/fixtures/learning/MEMORY.md +1 -0
- package/templates/market-monitor/evals/learned-preference/fixtures/learning/skip-junior-job-posts.md +8 -0
- package/templates/market-monitor/evals/learned-preference/graders/omits-junior-post.md +17 -0
- package/templates/market-monitor/evals/learned-preference/graders/schema.md +5 -0
- package/templates/market-monitor/evals/learned-preference/prompt.md +25 -0
- package/templates/market-monitor/evals/no-repeats/case.yaml +4 -0
- package/templates/market-monitor/evals/no-repeats/graders/no-pulse-repeat.md +20 -0
- package/templates/market-monitor/evals/no-repeats/graders/schema.md +5 -0
- package/templates/market-monitor/evals/no-repeats/prompt.md +30 -0
- package/templates/market-monitor/evals/nothing-changed/case.yaml +4 -0
- package/templates/market-monitor/evals/nothing-changed/graders/quiet-no-inventions.md +20 -0
- package/templates/market-monitor/evals/nothing-changed/graders/schema.md +5 -0
- package/templates/market-monitor/evals/nothing-changed/prompt.md +44 -0
- package/templates/market-monitor/evals/post-happens/case.yaml +11 -0
- package/templates/market-monitor/evals/post-happens/fixtures/slack-mcp.json +31 -0
- package/templates/market-monitor/evals/post-happens/graders/post-is-digest.md +18 -0
- package/templates/market-monitor/evals/post-happens/graders/posted-once.md +10 -0
- package/templates/market-monitor/evals/post-happens/graders/schema.md +5 -0
- package/templates/market-monitor/evals/post-happens/prompt.md +20 -0
- package/templates/market-monitor/evals/pricing-change/case.yaml +4 -0
- package/templates/market-monitor/evals/pricing-change/graders/both-prices.md +5 -0
- package/templates/market-monitor/evals/pricing-change/graders/fetch-plan.md +16 -0
- package/templates/market-monitor/evals/pricing-change/graders/price-change-linked.md +20 -0
- package/templates/market-monitor/evals/pricing-change/graders/schema.md +5 -0
- package/templates/market-monitor/evals/pricing-change/prompt.md +31 -0
- package/templates/market-monitor/evals/pricing-moved/case.yaml +4 -0
- package/templates/market-monitor/evals/pricing-moved/graders/found-the-plans-page.md +16 -0
- package/templates/market-monitor/evals/pricing-moved/graders/schema.md +5 -0
- package/templates/market-monitor/evals/pricing-moved/prompt.md +29 -0
- package/templates/market-monitor/rules/MONITOR.md +33 -0
- package/templates/market-monitor/skills/monitor/SKILL.md +190 -0
- package/templates/release-notes/agent.md +47 -0
- package/templates/release-notes/evals/draft-not-publish/case.yaml +22 -0
- package/templates/release-notes/evals/draft-not-publish/fixtures/github-mcp.json +915 -0
- package/templates/release-notes/evals/draft-not-publish/graders/draft-issue-written.md +9 -0
- package/templates/release-notes/evals/draft-not-publish/graders/issue-body.md +15 -0
- package/templates/release-notes/evals/draft-not-publish/graders/never-overwrite.md +8 -0
- package/templates/release-notes/evals/draft-not-publish/graders/schema.md +5 -0
- package/templates/release-notes/evals/draft-not-publish/prompt.md +32 -0
- package/templates/release-notes/evals/every-pr-accounted/case.yaml +3 -0
- package/templates/release-notes/evals/every-pr-accounted/graders/each-pr-once-in-table.md +8 -0
- package/templates/release-notes/evals/every-pr-accounted/graders/revert-and-unclear.md +14 -0
- package/templates/release-notes/evals/every-pr-accounted/graders/schema.md +5 -0
- package/templates/release-notes/evals/every-pr-accounted/prompt.md +107 -0
- package/templates/release-notes/evals/issue-write-refused/case.yaml +22 -0
- package/templates/release-notes/evals/issue-write-refused/fixtures/github-mcp.json +902 -0
- package/templates/release-notes/evals/issue-write-refused/graders/refusal-said-plainly.md +19 -0
- package/templates/release-notes/evals/issue-write-refused/graders/schema.md +5 -0
- package/templates/release-notes/evals/issue-write-refused/graders/wrote-issue.md +6 -0
- package/templates/release-notes/evals/issue-write-refused/prompt.md +32 -0
- package/templates/release-notes/evals/late-arrival/case.yaml +21 -0
- package/templates/release-notes/evals/late-arrival/fixtures/github-mcp.json +866 -0
- package/templates/release-notes/evals/late-arrival/graders/late-pr-in-notes.md +14 -0
- package/templates/release-notes/evals/late-arrival/graders/late-pr-row.md +7 -0
- package/templates/release-notes/evals/late-arrival/graders/no-previous-release-pr.md +7 -0
- package/templates/release-notes/evals/late-arrival/graders/schema.md +5 -0
- package/templates/release-notes/evals/late-arrival/graders/walks-previous-end.md +8 -0
- package/templates/release-notes/evals/late-arrival/prompt.md +6 -0
- package/templates/release-notes/evals/learned-style/case.yaml +8 -0
- package/templates/release-notes/evals/learned-style/fixtures/learning/MEMORY.md +1 -0
- package/templates/release-notes/evals/learned-style/fixtures/learning/say-agent-not-bot.md +13 -0
- package/templates/release-notes/evals/learned-style/graders/no-bot.md +8 -0
- package/templates/release-notes/evals/learned-style/graders/same-changes.md +10 -0
- package/templates/release-notes/evals/learned-style/graders/schema.md +5 -0
- package/templates/release-notes/evals/learned-style/prompt.md +71 -0
- package/templates/release-notes/evals/no-pr-numbers-on-top/case.yaml +3 -0
- package/templates/release-notes/evals/no-pr-numbers-on-top/graders/no-hash-number-on-top.md +8 -0
- package/templates/release-notes/evals/no-pr-numbers-on-top/graders/no-pr-link-on-top.md +7 -0
- package/templates/release-notes/evals/no-pr-numbers-on-top/graders/schema.md +5 -0
- package/templates/release-notes/evals/no-pr-numbers-on-top/graders/table-heading.md +7 -0
- package/templates/release-notes/evals/no-pr-numbers-on-top/prompt.md +62 -0
- package/templates/release-notes/evals/upgrade-line/case.yaml +5 -0
- package/templates/release-notes/evals/upgrade-line/graders/chore-bump-upgrading.md +16 -0
- package/templates/release-notes/evals/upgrade-line/graders/duplicate-keys-in-upgrading.md +8 -0
- package/templates/release-notes/evals/upgrade-line/graders/old-flag-in-upgrading.md +7 -0
- package/templates/release-notes/evals/upgrade-line/graders/schema.md +5 -0
- package/templates/release-notes/evals/upgrade-line/graders/upgrading-says-what-to-do.md +14 -0
- package/templates/release-notes/evals/upgrade-line/prompt.md +78 -0
- package/templates/release-notes/evals/user-facing-only/case.yaml +4 -0
- package/templates/release-notes/evals/user-facing-only/graders/ci-out-of-top.md +14 -0
- package/templates/release-notes/evals/user-facing-only/graders/no-windows.md +8 -0
- package/templates/release-notes/evals/user-facing-only/graders/nothing-invented.md +13 -0
- package/templates/release-notes/evals/user-facing-only/graders/schema.md +5 -0
- package/templates/release-notes/evals/user-facing-only/prompt.md +113 -0
- package/templates/release-notes/notes.schema.json +145 -0
- package/templates/release-notes/rules/STYLE.md +47 -0
- package/templates/release-notes/skills/release-notes/SKILL.md +311 -0
- package/dist/app.d.ts +0 -7
- package/dist/app.js +0 -399
- package/dist/console/assets/index-CnJBf7Lc.js +0 -486
- package/dist/console/assets/index-DUHbWcIP.css +0 -1
- package/dist/content-filter.d.ts +0 -7
- package/dist/content-filter.js +0 -23
- package/dist/harness-app.d.ts +0 -40
- package/dist/harness-app.js +0 -717
- package/dist/request-start.d.ts +0 -22
- package/dist/request-start.js +0 -350
- package/dist/run-box.d.ts +0 -186
- package/dist/run-box.js +0 -600
- package/dist/runs.d.ts +0 -1069
- package/dist/runs.js +0 -3073
- package/dist/trigger-secrets.d.ts +0 -32
- package/dist/trigger-secrets.js +0 -143
package/dist/cap.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
1
2
|
import { type Ended } from "@parcha/agentrun-kernel";
|
|
2
3
|
import { type EntryLike } from "@parcha/pi-durable-agent/timeline";
|
|
3
4
|
import type { Api, AssistantMessage, Context, Model, Models } from "@earendil-works/pi-ai";
|
|
@@ -12,9 +13,90 @@ export declare const CAP_TOLERANCE = 1e-9;
|
|
|
12
13
|
* against a 0.31 cap), never a spend that is past the cap, by however little (a 1e-11 hair is past it). CAP_TOLERANCE
|
|
13
14
|
* is the other question: how near two caps are the same cap. */
|
|
14
15
|
export declare const FIT_TOLERANCE = 1e-12;
|
|
15
|
-
/** The option a request's
|
|
16
|
-
* symbol, so no provider ever sends it. */
|
|
16
|
+
/** The option a request's hold rides on from the cap to its marks (request-start.ts): what the cap held for it, its
|
|
17
|
+
* expected cost (its worst case under strict). A symbol, so no provider ever sends it. */
|
|
17
18
|
export declare const HELD_USD: unique symbol;
|
|
19
|
+
/** The option a request's bound rides on to its start mark (request-start.ts, as BOUND_FIELD): the most a cache miss can
|
|
20
|
+
* make it cost beyond its hold (its input uncached less its input expected; 0 under strict). A symbol, as HELD_USD. */
|
|
21
|
+
export declare const BOUND_USD: unique symbol;
|
|
22
|
+
/** The field of a request's start mark that keeps its bound (BOUND_USD), on pi and on another harness (harness-app.ts):
|
|
23
|
+
* the run's cost serves it while the request is in flight, and the over-cap row names it (runs.ts). Absent for 0. */
|
|
24
|
+
export declare const BOUND_FIELD = "boundUsd";
|
|
25
|
+
/** How a run's cap prices a request's input (`cap_mode`): "expected" (the default) from the previous request's cache, so
|
|
26
|
+
* only a cache miss can pass the cap, by at most the request's bound; "strict" every input token uncached, the worst
|
|
27
|
+
* case, so no request can pass it. */
|
|
28
|
+
export declare const CAP_MODES: readonly ["expected", "strict"];
|
|
29
|
+
export type CapMode = (typeof CAP_MODES)[number];
|
|
30
|
+
/** A run's cap mode, passed to its process; absent is "expected". */
|
|
31
|
+
export declare const CAP_MODE_ENV = "AGENTRUN_SERVE_CAP_MODE";
|
|
32
|
+
/** How long after a request ended the next one in its conversation is expected to read its cache: 4 minutes, inside
|
|
33
|
+
* Anthropic's 5 (a cache kept that long from its last use; OpenAI's lasts longer). A request later than that is priced
|
|
34
|
+
* with nothing cached. */
|
|
35
|
+
export declare const CACHE_WARM_MS: number;
|
|
36
|
+
/** The previous request of a conversation, as the cap reads it: the input tokens its usage reported read from the cache
|
|
37
|
+
* or written to it (`cachedTokens`: cache_read + cache_creation, or the Responses API's cached_tokens), the rest of its
|
|
38
|
+
* input (`inputTokens`), its input bound (`boundTokens`, inputBound of what it sent: the unit this request's bound is in),
|
|
39
|
+
* and when it ended (`endedAt`, ms). */
|
|
40
|
+
export type Previous = {
|
|
41
|
+
cachedTokens: number;
|
|
42
|
+
inputTokens: number;
|
|
43
|
+
boundTokens: number;
|
|
44
|
+
endedAt: number;
|
|
45
|
+
};
|
|
46
|
+
/** A request's input as it is priced: `cached` tokens at the cache-read price, `fresh` ones at the dearer of the input
|
|
47
|
+
* and cache-write prices. */
|
|
48
|
+
export type InputParts = {
|
|
49
|
+
cached: number;
|
|
50
|
+
fresh: number;
|
|
51
|
+
};
|
|
52
|
+
/** A request's Previous from the usage it reported (pi's shape: `input` without the cache's reads and writes), its input
|
|
53
|
+
* bound and when it ended; undefined when its usage says no input (a usage not read is zeros, never a count) or a
|
|
54
|
+
* figure is not a count. */
|
|
55
|
+
export declare function previousOf(usage: {
|
|
56
|
+
input?: unknown;
|
|
57
|
+
cacheRead?: unknown;
|
|
58
|
+
cacheWrite?: unknown;
|
|
59
|
+
} | undefined, boundTokens: number | undefined, endedAt: number): Previous | undefined;
|
|
60
|
+
/** The input of a request of `bound` tokens (inputBound) expected after `previous`, at `now`: the previous request's
|
|
61
|
+
* cached input read from the cache, and its input after the cache plus what the body grew by since it (in the bound's
|
|
62
|
+
* own unit, bytes, which a token never is fewer of) at full price. Undefined, the whole input uncached, with no previous
|
|
63
|
+
* request, one that ended CACHE_WARM_MS or more ago, or a clock that reads before its end. On a cache hit of a
|
|
64
|
+
* conversation that grew, what the request is billed for is within this; a miss costs at most its input uncached. */
|
|
65
|
+
export declare function expectedInput(bound: number, previous: Previous | undefined, now: number): InputParts | undefined;
|
|
66
|
+
/** The wrap-up's trigger (wrapUpDue): what is left of a cap under this many times a priced request's typical cost. */
|
|
67
|
+
export declare const WRAP_UP_FACTOR = 3;
|
|
68
|
+
/** The wrap-up's other trigger: what is left under this many times the next request's least admission (its least output
|
|
69
|
+
* at its price: what the cap refuses it below), room for about one more request, so a run whose requests need far more
|
|
70
|
+
* than they cost (a reasoning model's least, Codex's at "high") is told before the cap refuses it. */
|
|
71
|
+
export declare const WRAP_UP_LEAST_FACTOR = 2;
|
|
72
|
+
/** The output a request is counted at as the wrap-up's typical cost while nothing is priced (step 0): its input bound and
|
|
73
|
+
* this many output tokens at the model's price, never its whole output allowance (the hold), which no turn uses and which
|
|
74
|
+
* made every cap under about $3 on Sonnet 4.5 hear the wrap-up before the run had done anything. The lead's ruling (d),
|
|
75
|
+
* 2026-11-07 (Manuel's retest: every $1 run told at its start). Admission's hold and bound are unchanged. */
|
|
76
|
+
export declare const WRAP_UP_STEP0_ANSWER_TOKENS = 4096;
|
|
77
|
+
/** A priced request's typical cost, for the wrap-up's trigger: the median of `costs` (the run's own model's requests, a
|
|
78
|
+
* cost known and above 0) after the first, which writes the cache and costs several warm ones; with one priced request,
|
|
79
|
+
* that one; with none, `nextExpected`, the next request's expected cost (what admission holds it at). No wait for a
|
|
80
|
+
* count of requests: a small cap may never reach one, and that run needs the wrap-up most. */
|
|
81
|
+
export declare function typicalCost(costs: readonly unknown[], nextExpected: number): number;
|
|
82
|
+
/** Whether a run near its cap is due its wrap-up: what is left (`cap` less `spent` and `held`, as admission counts it)
|
|
83
|
+
* is under WRAP_UP_FACTOR times `typical`, or under WRAP_UP_LEAST_FACTOR times `leastUsd`, the next request's least
|
|
84
|
+
* admission as the cap prices it (CapGuard.leastUsd, Judged.least), when known. The same rule under strict. */
|
|
85
|
+
export declare function wrapUpDue(cap: number, spent: number, held: number, typical: number, leastUsd?: number): {
|
|
86
|
+
leftUsd: number;
|
|
87
|
+
} | undefined;
|
|
88
|
+
/** The wrap-up's words, what is left to the cent. `nonePriced`: the run's own model has no priced request yet, so its
|
|
89
|
+
* typical cost is the next request's expected cost and the note can come before the run has done anything (step 0):
|
|
90
|
+
* the words say the budget and ask for a short answer, not a finish. Read from the same priced costs live and in a
|
|
91
|
+
* process opened again (costsIn, ownCosts), so a restart picks the same words. */
|
|
92
|
+
export declare const wrapUpWords: (leftUsd: number, nonePriced?: boolean) => string;
|
|
93
|
+
/** A request priced at `price` under `mode`, its input `bound` tokens after `previous` at `now`, plus `feeUsd`: `cost`, what
|
|
94
|
+
* it is held at given its output tokens (its expected input, never more than uncached), and `worst`, its input uncached.
|
|
95
|
+
* The one rule pi's guard (capModels) and another harness's (capBefore) call. */
|
|
96
|
+
export declare function requestPrice(price: (input: InputParts, output: number) => number, bound: number, previous: Previous | undefined, now: number, mode: CapMode, feeUsd?: number): {
|
|
97
|
+
cost(output: number): number;
|
|
98
|
+
worst(output: number): number;
|
|
99
|
+
};
|
|
18
100
|
/** Records that `message` ended on an error after its response began. */
|
|
19
101
|
export declare const markResponseBegan: (message: AssistantMessage) => void;
|
|
20
102
|
/** The field of a request's end mark (REQUEST_ENDED) that says what the cap held for it, when its stream ended aborted
|
|
@@ -108,12 +190,14 @@ export type SideRequest = {
|
|
|
108
190
|
feeUsd(): number;
|
|
109
191
|
};
|
|
110
192
|
export declare const sideRequests: WeakMap<object, SideRequest>;
|
|
111
|
-
/** The run's cap from its process's environment; absent for a run without one. */
|
|
112
|
-
export declare function capOf(env: NodeJS.ProcessEnv): number | undefined;
|
|
113
193
|
/** The code a cap's refusal begins with: `spend_cap_reached: `, or with a note after it, as a request it limited refuses
|
|
114
194
|
* in (CAP_REFUSAL_CODE, "spend_cap_reached (out of budget): "). Every reader of a refusal's text (a run's end, its
|
|
115
195
|
* learning, the spend read back) reads the code through this, never a bare prefix. */
|
|
116
196
|
export declare const CAP_REFUSAL_PREFIX: RegExp;
|
|
197
|
+
/** The cost an entry adds to what a run spent, as the timeline counts it: a pi answer's total (none for one stopped
|
|
198
|
+
* before its end), and the usd of a cost written apart from an answer, a paid tool's charge among them; 0 for anything
|
|
199
|
+
* else, or for a cost that is not a number (which makes the whole spend unknown, by the timeline's verdict). */
|
|
200
|
+
export declare const costOf: (entry: EntryLike) => number;
|
|
117
201
|
/** What the run's store says its model requests cost, across every conversation in it: known or not as the run's own
|
|
118
202
|
* timeline says (pi-durable-agent's timelineOf), read as a settled run, since the process that wrote it is gone, and
|
|
119
203
|
* then the full amount, never the timeline's total rounded for display. Every response, and each cost written apart
|
|
@@ -123,12 +207,38 @@ export declare const CAP_REFUSAL_PREFIX: RegExp;
|
|
|
123
207
|
* end mark holds (HELD_FIELD), and one a crash cut (marked as sent, no answer, no end) at the figure its start mark
|
|
124
208
|
* holds (openFigures), each the worst case the cap held for it; without that figure either stays cut, at an unknown
|
|
125
209
|
* cost. A paid call settled at a charge it did not say, like one a crash cut, counts at the figure its mark holds. And
|
|
126
|
-
* this cap's refusals are left out, as none left. Unknown is null, which a cap never reads as $0.
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
210
|
+
* this cap's refusals are left out, as none left. Unknown is null, which a cap never reads as $0. */
|
|
211
|
+
export declare function spentIn(storeFile: string): number | null;
|
|
212
|
+
/** What the run's model requests cost, from its entries in log order: the one computation, shared by spentIn (reading a
|
|
213
|
+
* settled run's own database) and the one-store reader (store-reads, reading A's journal). These readings are the cap's
|
|
214
|
+
* own, on its copy of the entries (the run's shown cost is the timeline's, unchanged): a request stopped before its end
|
|
215
|
+
* counts at the figure its end mark holds (HELD_FIELD), and one a crash cut (marked as sent, no answer, no end) at the
|
|
216
|
+
* figure its start mark holds (openFigures), each the worst case the cap held for it; without that figure either stays
|
|
217
|
+
* cut, at an unknown cost. This cap's refusals are left out, as none left. Unknown is null, which a cap never reads as $0. */
|
|
218
|
+
export declare function spentFrom(rows: readonly EntryLike[]): number | null;
|
|
219
|
+
/** A workflow decision's charge as the cap counted it (decision-cap.ts): `call` names the request, `usd` what it charged,
|
|
220
|
+
* or its hold when it said none. The run's shown cost reads its decisions from their receipts; this is the cap's own
|
|
221
|
+
* reading, kept so a later process counts each decision as this one did. costOf counts none, so nothing counts twice. */
|
|
222
|
+
export declare const DECISION_COST = "agentrun.decision_cost";
|
|
223
|
+
/** A decision request's hold, kept before it is sent (decision-cap.ts): with no DECISION_COST after it, its process died
|
|
224
|
+
* while it was out, and it counts at this figure. */
|
|
225
|
+
export declare const DECISION_HOLD = "agentrun.decision_hold";
|
|
226
|
+
/** What a workflow run's decisions cost, in its store: what the next process adds to spentIn's reading. Per decision
|
|
227
|
+
* (its id):
|
|
228
|
+
* - booked (DECISION_COST entries, at its charge, its hold, or $0 for nothing charged): the larger of what was booked,
|
|
229
|
+
* with any hold no booking ended, and what its receipts say it cost (the costs the timeline's decision rows sum);
|
|
230
|
+
* - else, with a receipt that names its charge: that charge (its booking lost after the receipt);
|
|
231
|
+
* - else, with a hold (DECISION_HOLD, kept once the driver admitted the request, right before its send): that hold, the
|
|
232
|
+
* figure the live process held, since the request may have been out when its process died; never $0;
|
|
233
|
+
* - else nothing: no hold is kept before the admission, so a request never sent is never counted.
|
|
234
|
+
* A booking with no decision id is counted as it is. */
|
|
235
|
+
export declare function decisionSpentIn(storeFile: string): number;
|
|
236
|
+
/** The priced answers of `model` (its id) in the run's store, in order: what the wrap-up's typical cost reads from earlier
|
|
237
|
+
* processes (capModels' `wrapUp`). An answer whose cost is unknown or $0, or that was stopped or failed, is none. */
|
|
238
|
+
export declare function costsIn(storeFile: string, model: string): number[];
|
|
239
|
+
/** Whether the run was told its wrap-up under `cap` already (a CAP_WRAPUP entry of that cap): once per cap, across its
|
|
240
|
+
* processes; a raise's new cap re-arms it. */
|
|
241
|
+
export declare function wrapUpSentIn(storeFile: string, cap: number): boolean;
|
|
132
242
|
/** /usage's meters for a run that ended, from its store: `tools`, each TOOL_COST's `usd`, unknown (null) when one is,
|
|
133
243
|
* or when a call was cut (marked, never settled: what it charged no one knows); and `tokens`, the rest of its root
|
|
134
244
|
* conversation as its settled timeline prices it; `browser`, the part of `tools` that is browser session time
|
|
@@ -155,6 +265,21 @@ export declare function meterFiguresIn(storeFile: string): Meters & {
|
|
|
155
265
|
others: number;
|
|
156
266
|
};
|
|
157
267
|
};
|
|
268
|
+
/** meterFiguresIn's figures from a run's entries by conversation, in log order: the one computation, shared by
|
|
269
|
+
* meterFiguresIn (reading a settled run's own database) and the one-store reader (store-reads/cap.ts metersOverStore, over
|
|
270
|
+
* A's journal). Only where the entries come from changes; the figures do not (the money-parity rule), as spentFrom is to
|
|
271
|
+
* spentIn. A paid tool's charge reaches it as the TOOL_COST / TOOL_UNMETERED the store reader folds back in from the
|
|
272
|
+
* paid-tools session (store-reads/journal.ts withPaidCosts), as the file-backed run's root held each natively. */
|
|
273
|
+
export declare function meterFiguresFrom(rows: readonly {
|
|
274
|
+
conversation: number;
|
|
275
|
+
entry: EntryLike;
|
|
276
|
+
}[]): Meters & {
|
|
277
|
+
known: {
|
|
278
|
+
tokens: number;
|
|
279
|
+
browser: number;
|
|
280
|
+
others: number;
|
|
281
|
+
};
|
|
282
|
+
};
|
|
158
283
|
/** What the paid tools of `entries` (TOOL_STARTED and TOOL_COST) spent, as the cap counts it: each charge, and a call
|
|
159
284
|
* settled at a charge it did not say, or a crash cut (marked, never settled), at its held figure, as spentIn counts it;
|
|
160
285
|
* null when one has no figure. The run's reported cost reads such a call unknown instead (the timeline). */
|
|
@@ -172,20 +297,40 @@ export declare function holdsInFlight(): {
|
|
|
172
297
|
* model requests in flight are held at, at their worst case (`held`, read once `spent` is in; absent: none apart from
|
|
173
298
|
* `spent`), and the charge a call adds (`add`). Set by the run's cap, on pi (capModels) and on another harness
|
|
174
299
|
* (harness-app.ts); none without a cap. A run is one process, so one is set per process. `now`: the whole figure read at
|
|
175
|
-
* once, held requests included, with no wait for a cost still coming in
|
|
176
|
-
* model requests beside the harness's (capModels' `joined`). */
|
|
300
|
+
* once, held requests included, with no wait for a cost still coming in (another harness sets it). */
|
|
177
301
|
export type RunSpend = {
|
|
178
302
|
cap: number;
|
|
179
303
|
spent(): number | null | Promise<number | null>;
|
|
180
304
|
held?(): number;
|
|
181
305
|
add(usd: number | null): void;
|
|
182
306
|
now?(): number | null;
|
|
307
|
+
/** Raises the cap this process keeps to `to` (a raise of the run's cap, read by budget.ts): from the next check on. */
|
|
308
|
+
raise?(to: number): void;
|
|
309
|
+
/** A workflow run's wait for a raise (budget.ts), set once its run opens: a request refused for room waits on it before
|
|
310
|
+
* it is sent, and is judged again once it resolves true (the cap was raised); false (a cancel, its signal) refuses it
|
|
311
|
+
* as before. Absent on an agentic run, whose turn ends on the refusal instead. */
|
|
312
|
+
wait?(refusal: CapRefusal, signal?: AbortSignal): Promise<boolean>;
|
|
313
|
+
/** A workflow run's record of a refusal no raise fixes (budget.ts), which its run ends on, in the cap's words. */
|
|
314
|
+
stopped?(refusal: CapRefusal): void;
|
|
183
315
|
};
|
|
316
|
+
/** A refusal of the cap, as a call that was refused is told it: its words (after the code, as a pause serves them),
|
|
317
|
+
* whether a higher cap would send it (`room`; not so for no price, no ceiling or an unknown spend), the cap that refused
|
|
318
|
+
* it, and its figures when it was refused for room. */
|
|
319
|
+
export type CapRefusal = {
|
|
320
|
+
words: string;
|
|
321
|
+
room: boolean;
|
|
322
|
+
capUsd: number;
|
|
323
|
+
figures?: RefusalFigures;
|
|
324
|
+
};
|
|
325
|
+
/** Where a refusal of the cap inside a workflow call node's effect is told (app.ts runEffect): the call ends on it and
|
|
326
|
+
* waits for a raise, never handed back as the tool's own failure, which a collecting map would take as the item's. A
|
|
327
|
+
* paid call refused there leaves no refusal for a model's next request (takePaidRefusal): no model turn follows it. */
|
|
328
|
+
export declare const capRefusals: AsyncLocalStorage<(refusal: CapRefusal) => void>;
|
|
329
|
+
/** The run's spend this process counts, when it has a cap: for a workflow run's waits and decisions (app.ts). */
|
|
330
|
+
export declare const runSpendNow: () => RunSpend | undefined;
|
|
184
331
|
export declare const useSpend: (spend: RunSpend | undefined) => void;
|
|
185
332
|
/** What the paid calls under way are held at, together (0 when none is): the one figure every check of the run's cap
|
|
186
|
-
* adds to what the run has spent, a model request's (capModels, capBefore) and a paid call's (paidCall).
|
|
187
|
-
* harness the run's own model requests in flight (a learned workflow's, a hosted search's) are held here too, so the
|
|
188
|
-
* harness's check sees them. */
|
|
333
|
+
* adds to what the run has spent, a model request's (capModels, capBefore) and a paid call's (paidCall). */
|
|
189
334
|
export declare const paidHolds: () => number;
|
|
190
335
|
/** A paid hold that outlives the paidCall that took it (a browser session's, browser-cost.ts), counted in paidHolds as a
|
|
191
336
|
* call's is until `drop`: its figure is `usd`, which its owner moves as charges use it. */
|
|
@@ -198,8 +343,6 @@ export declare const keepHold: (usd: number) => {
|
|
|
198
343
|
export declare const addSpend: (usd: number | null) => void;
|
|
199
344
|
/** The run's cap, when it has one. */
|
|
200
345
|
export declare const runCap: () => number | undefined;
|
|
201
|
-
/** What sidesSpent says: the harness's check adds it to what its booking says the run spent (harness-app.ts). */
|
|
202
|
-
export declare const sideSpend: () => number | null;
|
|
203
346
|
/** The paid call's refusal the next model request of the run whose spend is `owner` is refused with, once: undefined
|
|
204
347
|
* when there is none, or it is another spend's. Only a run's own guard asks (capModels for pi, harness-app.ts for the
|
|
205
348
|
* others), never a guard a caller builds apart. */
|
|
@@ -210,11 +353,33 @@ export declare function takePaidRefusal(owner: RunSpend | undefined): {
|
|
|
210
353
|
export declare function paidCall<T>(name: string, call: () => Promise<T>, charge: (result: T) => number | null | undefined, hold: {
|
|
211
354
|
usd: number;
|
|
212
355
|
basis: string;
|
|
356
|
+
}, options?: {
|
|
357
|
+
pauses?: boolean;
|
|
213
358
|
}): Promise<{
|
|
214
359
|
refused: string;
|
|
360
|
+
leastCapUsd?: number;
|
|
215
361
|
} | {
|
|
216
362
|
result: T;
|
|
217
363
|
}>;
|
|
364
|
+
/** A paid call's hold, taken ahead of the call by the rule paidCall keeps (a workflow's decision, decision-cap.ts, which
|
|
365
|
+
* must wait for a raise before its request is admitted, never after): refused unless what the run has spent plus what
|
|
366
|
+
* is held plus `hold` fits the cap, and whenever the spend is unknown; else held (paidHolds) until the ticket settles it
|
|
367
|
+
* at the charge the call reports (null: at its hold, as paidCall counts a charge not said) or drops it (nothing was
|
|
368
|
+
* sent). The check takes its turn with paidCall's, but the call it holds for goes beside other calls: each check sees the
|
|
369
|
+
* holds of those under way. A refusal for room waits on the run's wait (RunSpend.wait) when it has one and is checked
|
|
370
|
+
* again once the cap is raised. With no cap it holds nothing. */
|
|
371
|
+
export type PaidTicket = {
|
|
372
|
+
settle(usd: number | null): void;
|
|
373
|
+
drop(): void;
|
|
374
|
+
};
|
|
375
|
+
export declare function holdPaid(name: string, hold: {
|
|
376
|
+
usd: number;
|
|
377
|
+
basis: string;
|
|
378
|
+
}, signal?: AbortSignal): Promise<{
|
|
379
|
+
refused: CapRefusal;
|
|
380
|
+
} | {
|
|
381
|
+
ticket: PaidTicket;
|
|
382
|
+
}>;
|
|
218
383
|
/** The most output tokens one request may take: the model's ceiling, else its context window. A thinking budget can
|
|
219
384
|
* raise a request's ceiling up to the model's, whatever maxTokens it asked for. */
|
|
220
385
|
export declare const ceilingTokens: (model: Pick<Model<Api>, "maxTokens" | "contextWindow">) => number;
|
|
@@ -233,75 +398,96 @@ export declare function money(usd: number): string;
|
|
|
233
398
|
* words after it hold. The words after it are the ones a person reads. */
|
|
234
399
|
export declare const CAP_REFUSAL_CODE = "spend_cap_reached (out of budget): ";
|
|
235
400
|
/** A refusal for room's figures, beside its words: what the cap counted as taken (spent, and held for requests still
|
|
236
|
-
* answering)
|
|
237
|
-
*
|
|
401
|
+
* answering), the least the refused request needs, and the least cap that sends it (`leastCapUsd`: the very figure its
|
|
402
|
+
* words name, "Raise the cap to at least $X", from the one call that wrote them: the request's figure there is what
|
|
403
|
+
* admission prices it at, its expected cost, or its worst case under strict, so a cap at it admits the request). Kept on
|
|
404
|
+
* the refusal's own start mark (`spentUsd`, `needsUsd`, `leastCapUsd`), so a run paused at its cap says them (runs.ts
|
|
405
|
+
* pending), and its cap's raise is checked against them. `boundUsd`: the most a cache miss could make the refused
|
|
406
|
+
* request cost beyond what it needs (BOUND_USD; absent for 0). */
|
|
238
407
|
export type RefusalFigures = {
|
|
239
408
|
spentUsd: number;
|
|
240
409
|
needsUsd: number;
|
|
410
|
+
leastCapUsd: number;
|
|
411
|
+
boundUsd?: number;
|
|
241
412
|
};
|
|
242
413
|
/** The words of a refusal for room (CAP_REFUSAL_CODE: what is left of the cap cannot buy the request's least), which a
|
|
243
414
|
* higher cap would send; undefined for any other text, a refusal no cap could fix included (an unknown spend, no price,
|
|
244
415
|
* no output ceiling, an input not measured: the bare `spend_cap_reached: ` code). The one reader of that difference. */
|
|
245
416
|
export declare const roomRefusal: (text: string | undefined) => string | undefined;
|
|
246
|
-
/** A model's name as the words say it: the catalog's, without a vendor's prefix ("Anthropic: Claude Sonnet 5.5" reads
|
|
247
|
-
* "Claude Sonnet 5.5"), else its id. */
|
|
248
|
-
export declare const nameOf: (model: Pick<Model<Api>, "name" | "id">) => string;
|
|
249
417
|
/** A least in words: rounded up to the cent, so that it is enough ($0.1024 is $0.11). */
|
|
250
418
|
export declare const leastMoney: (usd: number) => string;
|
|
251
419
|
/** The cap to raise to for a request past `cap` that needs `total` in all: a cent at least, and above the cap, never
|
|
252
420
|
* the cap itself, so a raise to it is one PATCH /runs/{id} takes. */
|
|
253
421
|
export declare const raiseTo: (cap: number, total: number) => string;
|
|
422
|
+
/** raiseTo's cap as a number, whole cents in dollars: the figure a refusal carries beside its words (leastCapUsd). */
|
|
423
|
+
export declare const raiseFigure: (cap: number, total: number) => number;
|
|
424
|
+
/** An amount in words, to the nearest cent ($0.0237416 is $0.02), as money says it ($1, $0.20, $0). */
|
|
425
|
+
export declare const centsMoney: (usd: number) => string;
|
|
254
426
|
/** The least output a pi request may be limited to and still answer: the answer's 1,024 tokens, and when it thinks,
|
|
255
427
|
* the least budget on an API whose thinking takes one (squeezed to it), else its thinking level's budget, since its
|
|
256
428
|
* reasoning then shares the limit. */
|
|
257
429
|
export declare function leastOutput(model: Pick<Model<Api>, "api" | "reasoning">, thinking: string | undefined, budgetOf: (level: string) => number): number;
|
|
258
430
|
/** The cap of a run on another harness, before each of its requests: the runner's booking says what the run has spent
|
|
259
|
-
* (its session, across processes) and which of its requests are still in flight, each with
|
|
260
|
-
*
|
|
261
|
-
*
|
|
431
|
+
* (its session, across processes) and which of its requests are still in flight, each with what it was admitted at;
|
|
432
|
+
* the model proxy says each request's input bound (`inputTokensMax`, inputBound of its body; undefined when the body
|
|
433
|
+
* could not be measured), the output it asks for, and the least it may be limited to; and the host the session's
|
|
434
|
+
* previous request on the same model, as its usage reported it (`previous`, harness-app.ts). */
|
|
262
435
|
export interface CapGuard {
|
|
263
|
-
beforeRequest(request: GuardRequest):
|
|
436
|
+
beforeRequest(request: GuardRequest): ({
|
|
264
437
|
refuse: string;
|
|
265
|
-
} & Partial<RefusalFigures>) |
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
}): number | undefined;
|
|
275
|
-
/** What a request this guard admitted counts at if its client stops it part way, having streamed `streamed` tokens (one
|
|
276
|
-
* a byte): its input bound and those tokens plus STOP_ALLOWANCE_TOKENS of output, at most its output limit, at the
|
|
277
|
-
* model's price. The runner counts it at no more than its hold. Undefined when its input was not measured. */
|
|
278
|
-
stoppedOf?(request: {
|
|
279
|
-
inputTokensMax?: number;
|
|
280
|
-
outputTokensMax?: number;
|
|
281
|
-
}, streamed: number): number | undefined;
|
|
438
|
+
} & Partial<RefusalFigures>) | Admitted;
|
|
439
|
+
/** A request's least admission (its input and least output at its price, under `previous`), the figure beforeRequest
|
|
440
|
+
* refuses it below, priced by the same code: the wrap-up's other trigger reads it for the next request (wrapUpDue).
|
|
441
|
+
* Undefined for an input that cannot be measured, and on a guard that refuses everything. */
|
|
442
|
+
leastUsd?(request: Pick<GuardRequest, "inputTokensMax" | "outputTokensAsked" | "outputTokensLeast" | "previous">): number | undefined;
|
|
443
|
+
/** A request's step-0 figure (its input and WRAP_UP_STEP0_ANSWER_TOKENS of output, at most what it asks, under
|
|
444
|
+
* `previous`), priced by the same code: the wrap-up's typical cost while nothing is priced, judged on the request taking
|
|
445
|
+
* the note itself, as pi's judge does (wrapUpDue). Undefined for an input that cannot be measured. */
|
|
446
|
+
typicalUsd?(request: Pick<GuardRequest, "inputTokensMax" | "outputTokensAsked" | "outputTokensLeast" | "previous">): number | undefined;
|
|
282
447
|
}
|
|
448
|
+
/** A request this guard admitted: the most output it may be sent with (none for a model whose output is free and has no
|
|
449
|
+
* ceiling), what it is held at (`holdUsd`: its expected cost at that output, its worst case under strict), which the
|
|
450
|
+
* runner records for it and counts it at when its own cost never comes in (cut short, or by a crash), its bound
|
|
451
|
+
* (`boundUsd`, BOUND_USD), and what it counts at if its client stops it part way having streamed that many tokens (one a
|
|
452
|
+
* byte): its input and those tokens plus STOP_ALLOWANCE_TOKENS of output, at most its output limit, never more than its
|
|
453
|
+
* hold. */
|
|
454
|
+
export type Admitted = {
|
|
455
|
+
outputTokensMax?: number;
|
|
456
|
+
holdUsd: number;
|
|
457
|
+
boundUsd: number;
|
|
458
|
+
stoppedUsd(streamed: number): number;
|
|
459
|
+
};
|
|
283
460
|
export type GuardRequest = {
|
|
284
461
|
spentUsd: number | null;
|
|
462
|
+
/** The requests in flight, each held at what it was admitted at (`holdUsd`), else at its worst case at the output limit
|
|
463
|
+
* it was admitted with. */
|
|
285
464
|
inFlight: readonly {
|
|
286
465
|
inputTokensMax?: number;
|
|
287
466
|
outputTokensMax?: number;
|
|
467
|
+
holdUsd?: number;
|
|
288
468
|
}[];
|
|
289
469
|
inputTokensMax?: number;
|
|
290
470
|
outputTokensAsked?: number;
|
|
291
471
|
outputTokensLeast?: number;
|
|
472
|
+
/** A request the run sends beside the harness's, on the session's route (ModelRequest.host): judged by the same rule. */
|
|
473
|
+
host?: string;
|
|
474
|
+
/** The session's previous request on this model (Previous); none, the whole input uncached. */
|
|
475
|
+
previous?: Previous;
|
|
292
476
|
};
|
|
293
|
-
/** A run on another harness: before each request, what the run has spent, plus
|
|
294
|
-
*
|
|
295
|
-
*
|
|
296
|
-
* with spend_cap_reached. Admitted, it is limited to the most output what is left buys (`outputTokensMax`, at
|
|
297
|
-
* it asks for and its model's ceiling), which the model proxy writes into its body:
|
|
298
|
-
*
|
|
299
|
-
*
|
|
300
|
-
*
|
|
301
|
-
*
|
|
302
|
-
*
|
|
303
|
-
export declare function capBefore(cap: number | undefined, model: Model<Api> | undefined, { listed }?: {
|
|
477
|
+
/** A run on another harness: before each request, what the run has spent, plus what each request still in flight was
|
|
478
|
+
* admitted at, must leave room for this request at its least output (1,024 tokens, or what its body says it needs to
|
|
479
|
+
* think and answer; what it asks for when that is fewer), its input priced by requestPrice under `mode`, else the request
|
|
480
|
+
* is refused with spend_cap_reached. Admitted, it is limited to the most output what is left buys (`outputTokensMax`, at
|
|
481
|
+
* most what it asks for and its model's ceiling), which the model proxy writes into its body: output never passes the
|
|
482
|
+
* cap. A request is priced at the run model's price, as on pi (a request on a cheaper model is held at that price too,
|
|
483
|
+
* which only refuses sooner). What cannot be kept within a cap is refused under one: a spend that is unknown (a request a
|
|
484
|
+
* crash cut), an input that could not be measured, a model serve has no price for (`listed: false`, or none at all),
|
|
485
|
+
* and a model whose output is priced and that has no output ceiling. With no cap, nothing is refused. `now`: the clock a
|
|
486
|
+
* previous request's end is read against. */
|
|
487
|
+
export declare function capBefore(cap: number | undefined, model: Model<Api> | undefined, { listed, mode, now }?: {
|
|
304
488
|
listed?: boolean;
|
|
489
|
+
mode?: CapMode;
|
|
490
|
+
now?: () => number;
|
|
305
491
|
}): Promise<CapGuard | undefined>;
|
|
306
492
|
/** A request's input bound (inputBound of its context, plus `overhead(model, context)`, what its provider adds
|
|
307
493
|
* server-side) and the most fee it can run up: a tool's own request adds what its hosted tool may read
|
|
@@ -310,6 +496,22 @@ export declare function requestParts(overhead?: (model: Model<Api>, context: Con
|
|
|
310
496
|
input: number;
|
|
311
497
|
feeUsd: number;
|
|
312
498
|
} | undefined;
|
|
499
|
+
/** The wrap-up on pi (capModels' `wrapUp`): the run's own model (`model`, its id), that model's priced requests so far
|
|
500
|
+
* (`costs`, earlier processes' from the store, costsIn; capModels adds each one it books), whether it was told under this
|
|
501
|
+
* cap already (`sent`, wrapUpSentIn), and `record`, which writes its row (request-start.ts, CAP_WRAPUP). */
|
|
502
|
+
/** The wrap-up's state on pi. `sent`: told, in an answered request, once per cap. `pending`: a request carries the note
|
|
503
|
+
* and has not ended: no other request takes it until that one is answered (told) or not (re-armed). */
|
|
504
|
+
export type WrapUp = {
|
|
505
|
+
model: string;
|
|
506
|
+
costs: number[];
|
|
507
|
+
sent: boolean;
|
|
508
|
+
pending?: boolean;
|
|
509
|
+
record(data: {
|
|
510
|
+
capUsd: number;
|
|
511
|
+
leftUsd: number;
|
|
512
|
+
words: string;
|
|
513
|
+
}): void;
|
|
514
|
+
};
|
|
313
515
|
/** `models`, each request limited to the output tokens what is left of `cap` after `spent` USD (and what requests in flight
|
|
314
516
|
* hold) can buy, at most what it asks for, thinking included (CLAMP on its marks when that is less), and refused when that
|
|
315
517
|
* cannot buy its least (`leastOutput`: 1,024 tokens for the answer, and its thinking's least), saying so in plain words;
|
|
@@ -317,17 +519,18 @@ export declare function requestParts(overhead?: (model: Model<Api>, context: Con
|
|
|
317
519
|
* each request to a model in `unpriced` (one serve has no price for) or whose output is priced and that has no output
|
|
318
520
|
* ceiling, each whose input cannot be bounded, and every request once what the run has spent is unknown: `spent` null
|
|
319
521
|
* (spentIn), or an answer since whose cost is unknown. A request's input is inputBound of its context, plus
|
|
320
|
-
* `overhead(model, context)` (piOverhead), what its provider adds server-side; undefined is unmeasured, never 0.
|
|
321
|
-
*
|
|
322
|
-
* `
|
|
323
|
-
*
|
|
324
|
-
*
|
|
325
|
-
*
|
|
326
|
-
*
|
|
327
|
-
|
|
328
|
-
export declare function capModels<M extends Models>(models: M, cap: number, spent: number | null, { unpriced, overhead, refused: markRefused, joined }?: {
|
|
522
|
+
* `overhead(model, context)` (piOverhead), what its provider adds server-side; undefined is unmeasured, never 0. It is
|
|
523
|
+
* priced by requestPrice under `mode`, after the previous request of its conversation (the context's last answer, read
|
|
524
|
+
* by previousIn; its end as `now` read it when it settled here, else its own timestamp, which is when it began). Each
|
|
525
|
+
* request sent carries what it is held at (HELD_USD) and its bound (BOUND_USD) to the marks below, and one stopped
|
|
526
|
+
* before its end counts at most its hold.
|
|
527
|
+
* `refused` (markRequests') writes the start mark of a refused model request before pi writes its error entry. On
|
|
528
|
+
* another harness the run has no models of its own: every request goes through its session's proxy (port-models.ts). */
|
|
529
|
+
export declare function capModels<M extends Models>(models: M, cap: number, spent: number | null, { unpriced, overhead, refused: markRefused, mode, now, wrapUp }?: {
|
|
329
530
|
unpriced?: ReadonlySet<string>;
|
|
330
531
|
overhead?: (model: Model<Api>, context: Context) => number | undefined;
|
|
331
532
|
refused?: (figures?: RefusalFigures) => Promise<void>;
|
|
332
|
-
|
|
533
|
+
mode?: CapMode;
|
|
534
|
+
now?: () => number;
|
|
535
|
+
wrapUp?: WrapUp;
|
|
333
536
|
}): Promise<M>;
|