@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/paid-calls.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type { Context } from "@earendil-works/chord/context";
|
|
2
1
|
import type { Refusal } from "@parcha/agentrun-kernel";
|
|
3
|
-
import
|
|
2
|
+
import type { ToolRegistration } from "@earendil-works/pi-durable";
|
|
4
3
|
/** Parallel's published prices (https://docs.parallel.ai/getting-started/pricing, read 2026-11-03): a `fast` search
|
|
5
4
|
* $1 per 1,000 requests for up to 10 results, each further result $1 per 1,000; an extract $1 per 1,000 URLs. */
|
|
6
5
|
export declare const PARALLEL_SEARCH_USD = 0.001;
|
|
@@ -10,7 +9,6 @@ export declare const PARALLEL_EXTRACT_USD = 0.001;
|
|
|
10
9
|
/** One paid request: `name` in the cap's refusal, `tool` and `by` on its records, `usd` its price, `basis` why. */
|
|
11
10
|
export type Fee = {
|
|
12
11
|
name: string;
|
|
13
|
-
tool: string;
|
|
14
12
|
by: string;
|
|
15
13
|
usd: number;
|
|
16
14
|
basis: string;
|
|
@@ -22,23 +20,21 @@ export declare const parallelExtractFee: (urls?: number) => Fee;
|
|
|
22
20
|
/** The fee of a request to Parallel's `url` with `body`: its search's, by the results it asks for (10 by default), or its
|
|
23
21
|
* extract's, by the URLs; undefined for an endpoint the web tools do not ask. */
|
|
24
22
|
export declare function parallelFeeOf(url: string, body: unknown): Fee | undefined;
|
|
25
|
-
/** A paid request the run's cap refused,
|
|
26
|
-
* refusal, in the cap's words. */
|
|
23
|
+
/** A paid request the run's cap refused, whose hold could not be kept, or that has no run's ledger to book it on:
|
|
24
|
+
* nothing was sent. Its message is the refusal, in the cap's words. */
|
|
27
25
|
export declare class PaidRefused extends Error {
|
|
28
26
|
readonly name = "PaidRefused";
|
|
29
27
|
}
|
|
30
|
-
/** Where a paid request is booked: the call it is booked under, and
|
|
31
|
-
* spend is read on every harness (cap.ts, harness-app.ts). */
|
|
28
|
+
/** Where a paid request is booked: the call it is booked under, and the run's one ledger. */
|
|
32
29
|
export type Ledger = {
|
|
33
30
|
call: string;
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
* settled there, in the run's runner records, in place of this process's run spend (cap.ts paidCall) and the root's
|
|
37
|
-
* TOOL_STARTED/TOOL_COST marks. */
|
|
31
|
+
/** The run's one ledger (the kernel cap's paid tool calls, the adapter loop's): a paid request is admitted and settled
|
|
32
|
+
* there, in the run's runner records. With none, a paid request is refused unsent. */
|
|
38
33
|
paid?: PaidBooking;
|
|
39
34
|
/** The run's pause on the runner (the adapter loop's RunLedger.pause): a paid step of the agent's own that `paid`
|
|
40
35
|
* refused for room is handed to it, so the run pauses at its next request in the cap's words, as main's paidCall
|
|
41
|
-
* pauses by default. A person's take-over books through no paid step (browser-cost.ts personTime) and never pauses.
|
|
36
|
+
* pauses by default. A person's take-over books through no paid step (browser-cost.ts personTime) and never pauses.
|
|
37
|
+
* A refusal for good (stopRun) ends the run there instead. */
|
|
42
38
|
pause?: (refusal: LedgerRefusal) => Promise<void>;
|
|
43
39
|
};
|
|
44
40
|
/** A cap refusal as the run's pause reads it: its words, and for room its figures. */
|
|
@@ -46,7 +42,8 @@ export type LedgerRefusal = Refusal;
|
|
|
46
42
|
/** The kernel cap's booking of a run's paid calls (RunTools), as a paid request uses it. */
|
|
47
43
|
export type PaidBooking = {
|
|
48
44
|
/** `chargedBy`: who charges for it (the charge's `charged_by` on main's records: parallel, monid, an MCP server, a
|
|
49
|
-
* browser vendor), named on its runner.request.
|
|
45
|
+
* browser vendor), named on its runner.request. `under`: the model session whose tool call it runs in (RunTools.admit),
|
|
46
|
+
* whose requests in flight it is judged beside and never waits on. */
|
|
50
47
|
admit(request: {
|
|
51
48
|
id: string;
|
|
52
49
|
name: string;
|
|
@@ -59,37 +56,42 @@ export type PaidBooking = {
|
|
|
59
56
|
owed?: true;
|
|
60
57
|
hold?: true;
|
|
61
58
|
ref?: string;
|
|
59
|
+
under?: string;
|
|
62
60
|
}): Promise<unknown>;
|
|
63
61
|
/** `givenBack`: the hold let go unused, nothing sent (RunTools.settle). */
|
|
64
62
|
settle(id: string, usd: number | null, options?: {
|
|
65
63
|
readonly givenBack?: true;
|
|
66
64
|
}): Promise<unknown>;
|
|
67
65
|
};
|
|
68
|
-
/**
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
export declare const
|
|
74
|
-
/** The ledger of a tool call: its id, and its commits to the run's store. Its mark (TOOL_STARTED) and its settle are the
|
|
75
|
-
* call's own commits, so a stopped turn sends nothing new. On the
|
|
76
|
-
* runner the call runs inside the run's one ledger (the adapter loop's bookedIn, which carries the run's paid tool calls
|
|
77
|
-
* and its pause): its `paid` and `pause` are kept, so a paid request is admitted on the run's cap before it is sent and
|
|
78
|
-
* settled there, never booked beside it where the cap does not judge it. */
|
|
79
|
-
export declare const ledgerOf: (api: ToolExecutionApi, context: Context) => Ledger;
|
|
66
|
+
/** What a paid call with no run's ledger to book it on tells the model: `name` was not sent (as mcp-gateway.ts says it). */
|
|
67
|
+
export declare const unbookedRefusal: (name: string) => string;
|
|
68
|
+
/** The ledger of tool call `call`: the run's one ledger it runs in (the adapter loop's bookedIn, which carries the run's
|
|
69
|
+
* paid tool calls and its pause), under the call's own id, so a paid request is admitted on the run's cap before it is
|
|
70
|
+
* sent and settled there; none outside one. */
|
|
71
|
+
export declare const ledgerOf: (call: string) => Ledger;
|
|
80
72
|
/** `tool` with each call's paid requests booked under it: its execute runs with the call's ledger set. */
|
|
81
73
|
export declare function booking<T extends ToolRegistration>(tool: T): T;
|
|
82
|
-
/** `work` with its paid requests booked in `ledger` (a workflow call node's); with none,
|
|
74
|
+
/** `work` with its paid requests booked in `ledger` (a host tool call's, a workflow call node's); with none, outside any
|
|
75
|
+
* call's ledger, where a paid request is refused. */
|
|
83
76
|
export declare const bookedIn: <T>(ledger: Ledger | undefined, work: () => Promise<T>) => Promise<T>;
|
|
84
|
-
/** `send`, one request to a paid provider at `fee`,
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
*
|
|
77
|
+
/** `send`, one request to a paid provider at `fee`, on the run's one ledger under the call it runs in (Ledger.paid):
|
|
78
|
+
* admitted at the fee's price, then sent, then settled at what it may have charged (its price on a 2xx, a 408 or a 5xx
|
|
79
|
+
* or when it threw after it was sent; $0 on another 4xx); a settle that cannot be written leaves it at its hold, never
|
|
80
|
+
* less. It throws PaidRefused, in the cap's words, when the cap does not hold its price, when its hold could not be kept,
|
|
81
|
+
* or when the call has no run's ledger, and then nothing is sent. A request that throws throws, settled at its price. */
|
|
88
82
|
export declare function paidRequest(fee: Fee, send: () => Promise<Response>): Promise<Response>;
|
|
83
|
+
/** paidStep's chargeOf for a step that charged nothing and is given back: its mark settled with no charge row. */
|
|
84
|
+
export declare const GIVEN_BACK = "given back";
|
|
89
85
|
/** The run's one ledger the current call books on (Ledger.paid), when it has one: the runner's. */
|
|
90
86
|
export declare const paidLedger: () => PaidBooking | undefined;
|
|
87
|
+
/** Stops the run the current call books in, in `words`: handed to its pause (Ledger.pause) as a cap refusal no raise
|
|
88
|
+
* could fix, so the run's next request and every tool call after this one (a script's too) are refused in them, and the
|
|
89
|
+
* run ends failed in them, past its cap too, as a cap refusal for good ends it. Its code is the cap's, so the refused
|
|
90
|
+
* request reads as the cap's refusal (no model error row of its own). */
|
|
91
|
+
export declare const stopRun: (words: string) => Promise<void>;
|
|
91
92
|
/** One paid step on the run's one ledger `paid`, under call `call`: admitted at `holdUsd` (refused unsent: the cap's words,
|
|
92
|
-
* or why its hold could not be kept), then `run`, then settled at `chargeOf` its outcome (null: at its hold
|
|
93
|
+
* or why its hold could not be kept), then `run`, then settled at `chargeOf` its outcome (null: at its hold; GIVEN_BACK:
|
|
94
|
+
* given back, nothing charged, as a hold-only step's: a request its provider refused unrun leaves no charge row). One refused
|
|
93
95
|
* for room pauses the run through `pause`, else through the ledger of the call it runs in (bookedIn's), as main's
|
|
94
96
|
* paidCall pauses: a step outside any host tool call (a pi-native tool's, the browser's) passes the run's own. */
|
|
95
97
|
export declare function paidStep<T>(paid: PaidBooking, call: string | undefined, fee: {
|
|
@@ -106,7 +108,7 @@ export declare function paidStep<T>(paid: PaidBooking, call: string | undefined,
|
|
|
106
108
|
result: T;
|
|
107
109
|
} | {
|
|
108
110
|
thrown: unknown;
|
|
109
|
-
}) => number | null, pause?: Ledger["pause"]): Promise<{
|
|
111
|
+
}) => number | null | typeof GIVEN_BACK, pause?: Ledger["pause"]): Promise<{
|
|
110
112
|
refused: string;
|
|
111
113
|
} | {
|
|
112
114
|
result: T;
|
package/dist/paid-calls.js
CHANGED
|
@@ -1,22 +1,20 @@
|
|
|
1
|
-
// A web tool's request to Parallel (its search, web-search.ts; its extract, web-fetch.ts), booked as monid
|
|
2
|
-
// is (monid.ts):
|
|
3
|
-
//
|
|
4
|
-
// run's
|
|
5
|
-
//
|
|
6
|
-
// the run's one Parallel client's `post` (web-fetch.ts), which books it here by the endpoint it asks.
|
|
1
|
+
// A web tool's request to Parallel (its search, web-search.ts; its extract, web-fetch.ts), booked as a monid endpoint's
|
|
2
|
+
// call is (monid.ts): on the run's one ledger (the kernel cap's paid tool calls, RunTools), admitted at the request's price
|
|
3
|
+
// before it is sent (refused unsent in the cap's words when the cap does not hold it) and settled after at what it
|
|
4
|
+
// charged. A charge is the run's cost, a line of its own on its timeline and /usage's `tools` meter. Every request goes
|
|
5
|
+
// through the run's one Parallel client's `post` (web-fetch.ts), which books it here by the endpoint it asks.
|
|
7
6
|
// Parallel's answers report what they used as SKU counts, never an amount, so each request is booked at Parallel's
|
|
8
7
|
// published price, an estimate: its price on a 2xx; nothing on a 4xx other than a 408 (Parallel refused it before any
|
|
9
8
|
// work); and its price on a 408, a 5xx or a request that failed or was stopped after it was sent, which Parallel may
|
|
10
9
|
// have billed, as the decision provider books Parallel's (@parcha/agentrun-decisions).
|
|
11
|
-
// A request with no
|
|
12
|
-
//
|
|
13
|
-
//
|
|
14
|
-
// call
|
|
15
|
-
//
|
|
10
|
+
// A request with no run's ledger to book it on, or to an endpoint with no price here, is never sent: it fails closed,
|
|
11
|
+
// as a priced MCP call does (mcp-gateway.ts).
|
|
12
|
+
// The ledger a request is booked on (the run's RunTools, its pause, the call it runs under) is set around the call: around
|
|
13
|
+
// each host tool call by the adapter loop's `bookedIn`, around a workflow call node's tool by its own (workflow-spec.ts),
|
|
14
|
+
// and narrowed to the tool's own call by `booking`, where the web tools are bound (tools.ts). The client deep inside a
|
|
15
|
+
// tool books without the ledger passed down to it.
|
|
16
16
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
17
|
-
import {
|
|
18
|
-
import { TOOL_COST, TOOL_STARTED } from "./timeline/index.js";
|
|
19
|
-
import { paidCall, SPEND_CAP_REACHED } from "./cap.js";
|
|
17
|
+
import { SPEND_CAP_REACHED } from "./cap.js";
|
|
20
18
|
/** Parallel's published prices (https://docs.parallel.ai/getting-started/pricing, read 2026-11-03): a `fast` search
|
|
21
19
|
* $1 per 1,000 requests for up to 10 results, each further result $1 per 1,000; an extract $1 per 1,000 URLs. */
|
|
22
20
|
export const PARALLEL_SEARCH_USD = 0.001;
|
|
@@ -28,10 +26,10 @@ const usd = (dollars) => Math.round(dollars * 1e6) / 1e6;
|
|
|
28
26
|
/** A fast search for `n` results: $0.001, and $0.001 for each past the 10 it includes. */
|
|
29
27
|
export const parallelSearchFee = (n) => {
|
|
30
28
|
const more = Math.max(0, n - PARALLEL_SEARCH_INCLUDED);
|
|
31
|
-
return { name: "Parallel's search",
|
|
29
|
+
return { name: "Parallel's search", by: "parallel", usd: usd(PARALLEL_SEARCH_USD + PARALLEL_SEARCH_RESULT_USD * more), basis: more ? `Parallel's list price for a fast search of ${n} results` : "Parallel's list price for a fast search" };
|
|
32
30
|
};
|
|
33
31
|
/** An extract of `urls` URLs (the web tools ask one at a time). */
|
|
34
|
-
export const parallelExtractFee = (urls = 1) => ({ name: "Parallel's extract",
|
|
32
|
+
export const parallelExtractFee = (urls = 1) => ({ name: "Parallel's extract", by: "parallel", usd: usd(PARALLEL_EXTRACT_USD * urls), basis: urls === 1 ? "Parallel's list price for one URL" : `Parallel's list price for ${urls} URLs` });
|
|
35
33
|
/** The fee of a request to Parallel's `url` with `body`: its search's, by the results it asks for (10 by default), or its
|
|
36
34
|
* extract's, by the URLs; undefined for an endpoint the web tools do not ask. */
|
|
37
35
|
export function parallelFeeOf(url, body) {
|
|
@@ -43,8 +41,8 @@ export function parallelFeeOf(url, body) {
|
|
|
43
41
|
return parallelExtractFee(Array.isArray(asked.urls) ? Math.max(1, asked.urls.length) : 1);
|
|
44
42
|
return undefined;
|
|
45
43
|
}
|
|
46
|
-
/** A paid request the run's cap refused,
|
|
47
|
-
* refusal, in the cap's words. */
|
|
44
|
+
/** A paid request the run's cap refused, whose hold could not be kept, or that has no run's ledger to book it on:
|
|
45
|
+
* nothing was sent. Its message is the refusal, in the cap's words. */
|
|
48
46
|
export class PaidRefused extends Error {
|
|
49
47
|
name = "PaidRefused";
|
|
50
48
|
}
|
|
@@ -65,82 +63,56 @@ const pauseOn = async (error, pause = ledgers.getStore()?.pause) => {
|
|
|
65
63
|
await pause(room);
|
|
66
64
|
};
|
|
67
65
|
const ledgers = new AsyncLocalStorage();
|
|
68
|
-
/**
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
export
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
export const
|
|
76
|
-
/** The ledger of a tool call: its id, and its commits to the run's store. Its mark (TOOL_STARTED) and its settle are the
|
|
77
|
-
* call's own commits, so a stopped turn sends nothing new. On the
|
|
78
|
-
* runner the call runs inside the run's one ledger (the adapter loop's bookedIn, which carries the run's paid tool calls
|
|
79
|
-
* and its pause): its `paid` and `pause` are kept, so a paid request is admitted on the run's cap before it is sent and
|
|
80
|
-
* settled there, never booked beside it where the cap does not judge it. */
|
|
81
|
-
export const ledgerOf = (api, context) => {
|
|
66
|
+
/** What a paid call whose hold the run's ledger could not keep tells the model: `name` was not sent, and why. */
|
|
67
|
+
const holdRefusal = (name, error) => `${name} was not sent: its mark could not be written (${String(error?.message ?? error).slice(0, 200)})`;
|
|
68
|
+
/** What a paid call with no run's ledger to book it on tells the model: `name` was not sent (as mcp-gateway.ts says it). */
|
|
69
|
+
export const unbookedRefusal = (name) => `${name} was not sent: this call has no run to book its price under.`;
|
|
70
|
+
/** The ledger of tool call `call`: the run's one ledger it runs in (the adapter loop's bookedIn, which carries the run's
|
|
71
|
+
* paid tool calls and its pause), under the call's own id, so a paid request is admitted on the run's cap before it is
|
|
72
|
+
* sent and settled there; none outside one. */
|
|
73
|
+
export const ledgerOf = (call) => {
|
|
82
74
|
const outer = ledgers.getStore();
|
|
83
|
-
return {
|
|
84
|
-
call: api.callId,
|
|
85
|
-
record: (kind, data) => api.commit(async (tx) => void (await tx.appendEntry(ROOT_CONVERSATION_ID, { kind, data })), context),
|
|
86
|
-
...(outer?.paid ? { paid: outer.paid } : {}),
|
|
87
|
-
...(outer?.pause ? { pause: outer.pause } : {}),
|
|
88
|
-
};
|
|
75
|
+
return { call, ...(outer?.paid ? { paid: outer.paid } : {}), ...(outer?.pause ? { pause: outer.pause } : {}) };
|
|
89
76
|
};
|
|
90
77
|
/** `tool` with each call's paid requests booked under it: its execute runs with the call's ledger set. */
|
|
91
78
|
export function booking(tool) {
|
|
92
|
-
return { ...tool, execute: (args, api, context) => ledgers.run(ledgerOf(api
|
|
79
|
+
return { ...tool, execute: (args, api, context) => ledgers.run(ledgerOf(api.callId), () => tool.execute(args, api, context)) };
|
|
93
80
|
}
|
|
94
|
-
/** `work` with its paid requests booked in `ledger` (a workflow call node's); with none,
|
|
81
|
+
/** `work` with its paid requests booked in `ledger` (a host tool call's, a workflow call node's); with none, outside any
|
|
82
|
+
* call's ledger, where a paid request is refused. */
|
|
95
83
|
export const bookedIn = (ledger, work) => (ledger ? ledgers.run(ledger, work) : work());
|
|
96
84
|
/** Whether Parallel may have billed a request it answered `status`: a 2xx, a 408 or a 5xx; never another 4xx. */
|
|
97
85
|
const billed = (status) => (status >= 200 && status < 300) || status === 408 || status >= 500;
|
|
98
|
-
/** `send`, one request to a paid provider at `fee`,
|
|
99
|
-
*
|
|
100
|
-
*
|
|
101
|
-
*
|
|
86
|
+
/** `send`, one request to a paid provider at `fee`, on the run's one ledger under the call it runs in (Ledger.paid):
|
|
87
|
+
* admitted at the fee's price, then sent, then settled at what it may have charged (its price on a 2xx, a 408 or a 5xx
|
|
88
|
+
* or when it threw after it was sent; $0 on another 4xx); a settle that cannot be written leaves it at its hold, never
|
|
89
|
+
* less. It throws PaidRefused, in the cap's words, when the cap does not hold its price, when its hold could not be kept,
|
|
90
|
+
* or when the call has no run's ledger, and then nothing is sent. A request that throws throws, settled at its price. */
|
|
102
91
|
export async function paidRequest(fee, send) {
|
|
103
92
|
const ledger = ledgers.getStore();
|
|
104
|
-
if (!ledger)
|
|
105
|
-
throw new PaidRefused(
|
|
106
|
-
const
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
const sent = async () => {
|
|
111
|
-
try {
|
|
112
|
-
await writeHold(ledger.record, { ...label, heldUsd: fee.usd });
|
|
113
|
-
}
|
|
114
|
-
catch (error) {
|
|
115
|
-
return { unmarked: holdRefusal(fee.name, error) };
|
|
116
|
-
}
|
|
117
|
-
let outcome;
|
|
118
|
-
try {
|
|
119
|
-
outcome = { response: await send() };
|
|
120
|
-
}
|
|
121
|
-
catch (thrown) {
|
|
122
|
-
outcome = { thrown };
|
|
123
|
-
}
|
|
124
|
-
// Settled at what it may have charged, even when this cannot be written: the request was sent.
|
|
125
|
-
await ledger.record(TOOL_COST, { ...label, usd: chargeOf(outcome) ?? null }).catch(() => undefined);
|
|
126
|
-
return outcome;
|
|
127
|
-
};
|
|
128
|
-
const paid = await paidCall(fee.name, sent, chargeOf, { usd: fee.usd, basis: fee.basis });
|
|
129
|
-
if ("refused" in paid)
|
|
130
|
-
throw new PaidRefused(paid.refused);
|
|
131
|
-
const outcome = paid.result;
|
|
132
|
-
if ("unmarked" in outcome)
|
|
133
|
-
throw new PaidRefused(outcome.unmarked);
|
|
134
|
-
if ("thrown" in outcome)
|
|
135
|
-
throw outcome.thrown;
|
|
136
|
-
return outcome.response;
|
|
93
|
+
if (!ledger?.paid)
|
|
94
|
+
throw new PaidRefused(unbookedRefusal(fee.name));
|
|
95
|
+
const stepped = await paidStep(ledger.paid, ledger.call, { name: fee.name, holdUsd: fee.usd, basis: fee.basis, by: fee.by }, send, (outcome) => ("thrown" in outcome || billed(outcome.result.status) ? fee.usd : 0));
|
|
96
|
+
if ("refused" in stepped)
|
|
97
|
+
throw new PaidRefused(stepped.refused);
|
|
98
|
+
return stepped.result;
|
|
137
99
|
}
|
|
100
|
+
/** paidStep's chargeOf for a step that charged nothing and is given back: its mark settled with no charge row. */
|
|
101
|
+
export const GIVEN_BACK = "given back";
|
|
138
102
|
/** Each paid request of this process on the run's one ledger, numbered within its call (one call may make several). */
|
|
139
103
|
let paidSeq = 0;
|
|
140
104
|
/** The run's one ledger the current call books on (Ledger.paid), when it has one: the runner's. */
|
|
141
105
|
export const paidLedger = () => ledgers.getStore()?.paid;
|
|
106
|
+
/** Stops the run the current call books in, in `words`: handed to its pause (Ledger.pause) as a cap refusal no raise
|
|
107
|
+
* could fix, so the run's next request and every tool call after this one (a script's too) are refused in them, and the
|
|
108
|
+
* run ends failed in them, past its cap too, as a cap refusal for good ends it. Its code is the cap's, so the refused
|
|
109
|
+
* request reads as the cap's refusal (no model error row of its own). */
|
|
110
|
+
export const stopRun = async (words) => {
|
|
111
|
+
await ledgers.getStore()?.pause?.({ refuse: words, code: SPEND_CAP_REACHED, forGood: true });
|
|
112
|
+
};
|
|
142
113
|
/** One paid step on the run's one ledger `paid`, under call `call`: admitted at `holdUsd` (refused unsent: the cap's words,
|
|
143
|
-
* or why its hold could not be kept), then `run`, then settled at `chargeOf` its outcome (null: at its hold
|
|
114
|
+
* or why its hold could not be kept), then `run`, then settled at `chargeOf` its outcome (null: at its hold; GIVEN_BACK:
|
|
115
|
+
* given back, nothing charged, as a hold-only step's: a request its provider refused unrun leaves no charge row). One refused
|
|
144
116
|
* for room pauses the run through `pause`, else through the ledger of the call it runs in (bookedIn's), as main's
|
|
145
117
|
* paidCall pauses: a step outside any host tool call (a pi-native tool's, the browser's) passes the run's own. */
|
|
146
118
|
export async function paidStep(paid, call, fee, run, chargeOf, pause) {
|
|
@@ -164,33 +136,9 @@ export async function paidStep(paid, call, fee, run, chargeOf, pause) {
|
|
|
164
136
|
outcome = { thrown };
|
|
165
137
|
}
|
|
166
138
|
// A hold-only step (`hold`) is given back, never a charge: its money is booked by its own charges' steps.
|
|
167
|
-
|
|
139
|
+
const charge = fee.hold ? GIVEN_BACK : chargeOf(outcome);
|
|
140
|
+
await (charge === GIVEN_BACK ? paid.settle(id, 0, { givenBack: true }) : paid.settle(id, charge)).catch(() => undefined);
|
|
168
141
|
if ("thrown" in outcome)
|
|
169
142
|
throw outcome.thrown;
|
|
170
143
|
return outcome;
|
|
171
144
|
}
|
|
172
|
-
/** `send` on the run's one ledger (Ledger.paid): admitted at the fee's price (refused unsent in the cap's words), then
|
|
173
|
-
* sent, then settled at what it may have charged (chargeOf: its price on a 2xx, a 408 or a 5xx or when it threw after
|
|
174
|
-
* it was sent; $0 on another 4xx). A settle that cannot be written leaves the request at its hold, never less. */
|
|
175
|
-
async function paidOn(paid, call, fee, send, chargeOf) {
|
|
176
|
-
const id = `${call}#${(paidSeq += 1)}`;
|
|
177
|
-
try {
|
|
178
|
-
await paid.admit({ id, name: fee.name, holdUsd: fee.usd, basis: fee.basis, call, chargedBy: fee.by });
|
|
179
|
-
}
|
|
180
|
-
catch (error) {
|
|
181
|
-
await pauseOn(error);
|
|
182
|
-
const said = String(error?.message ?? error);
|
|
183
|
-
throw new PaidRefused(error?.code === "spend_cap_reached" ? said : holdRefusal(fee.name, error));
|
|
184
|
-
}
|
|
185
|
-
let outcome;
|
|
186
|
-
try {
|
|
187
|
-
outcome = { response: await send() };
|
|
188
|
-
}
|
|
189
|
-
catch (thrown) {
|
|
190
|
-
outcome = { thrown };
|
|
191
|
-
}
|
|
192
|
-
await paid.settle(id, chargeOf(outcome) ?? null).catch(() => undefined);
|
|
193
|
-
if ("thrown" in outcome)
|
|
194
|
-
throw outcome.thrown;
|
|
195
|
-
return outcome.response;
|
|
196
|
-
}
|
package/dist/place-offers.d.ts
CHANGED
|
@@ -1,14 +1,9 @@
|
|
|
1
|
-
/** Why a remote box (Daytona's, Modal's) has no network, said in capabilities whenever the server's host list is set:
|
|
2
|
-
* its computer is made with no network (Daytona) or no network or an open one (Modal), never with a host list, so a
|
|
3
|
-
* list is narrowed to none (workspace/computer-deps.ts networkOf). */
|
|
4
|
-
export declare const remoteNoList: (id: "daytona" | "modal") => string;
|
|
5
1
|
/** Every box a place may name, in the order capabilities lists them. */
|
|
6
2
|
export declare const BOX_IDS: readonly ["docker", "modal", "daytona"];
|
|
7
3
|
export type BoxId = (typeof BOX_IDS)[number];
|
|
8
4
|
/** A box as capabilities show it: whether this server has it, and why when not (or how it was checked); `state`, which
|
|
9
5
|
* capabilities derive from it (place.ts stated). `network`: what an available box reaches (BOX_NETWORKS), with
|
|
10
|
-
* `network_reason` when it is available and has none for a cause of its own (a daemon elsewhere
|
|
11
|
-
* computer is never made with a host list). `host_addresses`: for Docker from a container (compose.yaml), the Docker host's own addresses
|
|
6
|
+
* `network_reason` when it is available and has none for a cause of its own (a daemon elsewhere). `host_addresses`: for Docker from a container (compose.yaml), the Docker host's own addresses
|
|
12
7
|
* its computers' egress proxy refuses as the host's (docker-host-addresses.ts: the read through the socket and
|
|
13
8
|
* AGENTRUN_DOCKER_HOST_ADDRESSES). */
|
|
14
9
|
export type BoxOffer = {
|
|
@@ -87,8 +82,9 @@ export declare function placeOffers(env: NodeJS.ProcessEnv, options?: PlaceOffer
|
|
|
87
82
|
/** What each available box reaches, from the server's host list (`allow`, box-settings.ts boxAllowOf): Docker's
|
|
88
83
|
* computers through their egress proxy (an allowlist), with the Docker host's own addresses it refuses when the server
|
|
89
84
|
* runs in a container (`hostAddresses`), or unavailable where `dockerRefused` says Docker can't run a computer here
|
|
90
|
-
* (box-paths.ts dockerComputerRefusal, docker-host-addresses.ts noHostAddresses); Daytona's and Modal's
|
|
91
|
-
*
|
|
85
|
+
* (box-paths.ts dockerComputerRefusal, docker-host-addresses.ts noHostAddresses); Daytona's and Modal's through the
|
|
86
|
+
* egress proxy their computer's init starts (an allowlist too: @parcha/agentrun-computer's hosted/network.ts). With
|
|
87
|
+
* `allow` none, none has a network. */
|
|
92
88
|
export declare function withNetworks(offers: readonly BoxOffer[], allow: readonly string[] | "none", docker?: {
|
|
93
89
|
refused?: string;
|
|
94
90
|
hostAddresses?: readonly string[];
|
package/dist/place-offers.js
CHANGED
|
@@ -14,10 +14,6 @@ import { readFile } from "node:fs/promises";
|
|
|
14
14
|
import { userInfo } from "node:os";
|
|
15
15
|
import { PROVIDERS } from "@parcha/agentrun-computer";
|
|
16
16
|
import { withoutSecrets } from "./secrets.js";
|
|
17
|
-
/** Why a remote box (Daytona's, Modal's) has no network, said in capabilities whenever the server's host list is set:
|
|
18
|
-
* its computer is made with no network (Daytona) or no network or an open one (Modal), never with a host list, so a
|
|
19
|
-
* list is narrowed to none (workspace/computer-deps.ts networkOf). */
|
|
20
|
-
export const remoteNoList = (id) => `a ${id === "daytona" ? "Daytona" : "Modal"} computer is never made with a host list, so a ${id} box has no network`;
|
|
21
17
|
/** Every box a place may name, in the order capabilities lists them. */
|
|
22
18
|
export const BOX_IDS = ["docker", "modal", "daytona"];
|
|
23
19
|
/** What an available box reaches: the hosts of `places.allow` (`allowlist`), or nothing (`none`). */
|
|
@@ -180,8 +176,9 @@ export async function placeOffers(env, options = {}) {
|
|
|
180
176
|
/** What each available box reaches, from the server's host list (`allow`, box-settings.ts boxAllowOf): Docker's
|
|
181
177
|
* computers through their egress proxy (an allowlist), with the Docker host's own addresses it refuses when the server
|
|
182
178
|
* runs in a container (`hostAddresses`), or unavailable where `dockerRefused` says Docker can't run a computer here
|
|
183
|
-
* (box-paths.ts dockerComputerRefusal, docker-host-addresses.ts noHostAddresses); Daytona's and Modal's
|
|
184
|
-
*
|
|
179
|
+
* (box-paths.ts dockerComputerRefusal, docker-host-addresses.ts noHostAddresses); Daytona's and Modal's through the
|
|
180
|
+
* egress proxy their computer's init starts (an allowlist too: @parcha/agentrun-computer's hosted/network.ts). With
|
|
181
|
+
* `allow` none, none has a network. */
|
|
185
182
|
export function withNetworks(offers, allow, docker = {}) {
|
|
186
183
|
return offers.map((offer) => {
|
|
187
184
|
if (!offer.available)
|
|
@@ -195,8 +192,6 @@ export function withNetworks(offers, allow, docker = {}) {
|
|
|
195
192
|
return { ...offer, network: "none", network_reason: "AGENTRUN_BOX_ALLOW is none" };
|
|
196
193
|
return { ...offer, network: "allowlist", ...(docker.hostAddresses?.length ? { host_addresses: [...docker.hostAddresses] } : {}) };
|
|
197
194
|
}
|
|
198
|
-
|
|
199
|
-
return { ...offer, network: "none" };
|
|
200
|
-
return { ...offer, network: "none", network_reason: remoteNoList(offer.id) };
|
|
195
|
+
return { ...offer, network: allow === "none" ? "none" : "allowlist" };
|
|
201
196
|
});
|
|
202
197
|
}
|
package/dist/port-models.d.ts
CHANGED
|
@@ -10,11 +10,16 @@ export declare const tierProvider: (tier: string) => string;
|
|
|
10
10
|
* base; OpenAI's adds /responses to a base that holds /v1. The one rule for the port's models and pi's own (runner
|
|
11
11
|
* adapters/pi.ts). */
|
|
12
12
|
export declare const sessionBaseUrl: (api: SessionPort["api"], url: string) => string;
|
|
13
|
+
/** The effort a model asks for at each thinking level, as pi-ai's catalog says (null: no effort sent). */
|
|
14
|
+
export type ThinkingLevelMap = NonNullable<Model<Api>["thinkingLevelMap"]>;
|
|
13
15
|
/** The catalog's entry for a session's model, as its route carries it (model-route.ts `like`): its reasoning, price,
|
|
14
|
-
* window and ceiling, and what it takes as input with its input limits. */
|
|
15
|
-
|
|
16
|
+
* window and ceiling, the effort each thinking level asks for, and what it takes as input with its input limits. */
|
|
17
|
+
/** `developerRole`: on Responses, the instructions go as a developer message, not a system one (a ChatGPT plan's route,
|
|
18
|
+
* which takes no system message). */
|
|
19
|
+
export type SessionLike = Partial<Pick<Model<Api>, "reasoning" | "cost" | "contextWindow" | "maxTokens" | "thinkingLevelMap">> & {
|
|
16
20
|
readonly input?: readonly string[];
|
|
17
21
|
readonly inputLimits?: unknown;
|
|
22
|
+
readonly developerRole?: boolean;
|
|
18
23
|
};
|
|
19
24
|
/** The one model of a session's route as pi-ai lists it, for the port's requests and for pi's own (runner adapters/pi.ts):
|
|
20
25
|
* `model` in `api` at the proxy `url` (sessionBaseUrl), under `provider`, with `headers` (the session key as the proxy
|
package/dist/port-models.js
CHANGED
|
@@ -24,11 +24,14 @@ export function sessionModel(api, url, model, options) {
|
|
|
24
24
|
// What the model takes as input and its input limits, as the catalog says (the route's `like`): a model that takes no
|
|
25
25
|
// images is sent pi-ai's placeholder in place of one, and pi's read holds an image to its limits. Unsaid, text and
|
|
26
26
|
// images within pi's defaults.
|
|
27
|
-
|
|
27
|
+
// The effort each thinking level asks for, as the catalog says: a level it maps to null sends none, so pi's thinking
|
|
28
|
+
// off sends no "none" to a model that refuses it (gpt-6.1-sol). Unsaid, pi-ai's defaults.
|
|
29
|
+
reasoning: like?.reasoning ?? options.reasoning, ...(like?.thinkingLevelMap ? { thinkingLevelMap: like.thinkingLevelMap } : {}),
|
|
30
|
+
input: like?.input ? [...like.input] : ["text", "image"],
|
|
28
31
|
...(like?.inputLimits ? { inputLimits: like.inputLimits } : {}),
|
|
29
32
|
cost: like?.cost ?? { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
|
|
30
33
|
contextWindow: like?.contextWindow ?? 200_000, maxTokens: like?.maxTokens ?? 32_000,
|
|
31
|
-
...(api === "openai-responses" ? { compat: { supportsDeveloperRole:
|
|
34
|
+
...(api === "openai-responses" ? { compat: { supportsDeveloperRole: like?.developerRole === true } } : {}),
|
|
32
35
|
};
|
|
33
36
|
}
|
|
34
37
|
/** pi-ai's provider for the one model of a session's proxy on its wire: pi-ai's client of `api` (Anthropic's Messages or
|
package/dist/print.d.ts
CHANGED
|
@@ -21,8 +21,9 @@ export declare function banner(o: {
|
|
|
21
21
|
/** One log line. */
|
|
22
22
|
export declare const logLine: (event: string, fields?: Record<string, string | number>) => string;
|
|
23
23
|
/** The log line of a runner's start or end event (runner.ts RunnerEvent): `run_started` (run, agent, kind) once a run's
|
|
24
|
-
* first claim, `run_ended` (run, agent, status, cost_usd) once it is final
|
|
25
|
-
*
|
|
24
|
+
* first claim, `run_ended` (run, agent, status, cost_usd) once it is final: `cost_usd` the exact cost or "unknown", and
|
|
25
|
+
* beside an unknown one `cost_usd_at_most` when the run's stored cost is the most it can have cost. Any other event has
|
|
26
|
+
* none. Ids and numbers only: no token or secret reaches a line. */
|
|
26
27
|
export declare function runLine(event: {
|
|
27
28
|
type: string;
|
|
28
29
|
runId?: string;
|
|
@@ -30,6 +31,7 @@ export declare function runLine(event: {
|
|
|
30
31
|
kind?: string;
|
|
31
32
|
status?: string;
|
|
32
33
|
costUsd?: number | null;
|
|
34
|
+
costAtMostUsd?: number;
|
|
33
35
|
}): string | undefined;
|
|
34
36
|
/** A duration as --drain-timeout takes it ("8s", "500ms", "1m"), in milliseconds; undefined when it is not one. */
|
|
35
37
|
export declare function durationMs(text: string): number | undefined;
|
package/dist/print.js
CHANGED
|
@@ -26,13 +26,14 @@ const value = (v) => {
|
|
|
26
26
|
/** One log line. */
|
|
27
27
|
export const logLine = (event, fields = {}) => [`at=${new Date().toISOString()}`, `event=${event}`, ...Object.entries(fields).map(([k, v]) => `${k}=${value(v)}`)].join(" ");
|
|
28
28
|
/** The log line of a runner's start or end event (runner.ts RunnerEvent): `run_started` (run, agent, kind) once a run's
|
|
29
|
-
* first claim, `run_ended` (run, agent, status, cost_usd) once it is final
|
|
30
|
-
*
|
|
29
|
+
* first claim, `run_ended` (run, agent, status, cost_usd) once it is final: `cost_usd` the exact cost or "unknown", and
|
|
30
|
+
* beside an unknown one `cost_usd_at_most` when the run's stored cost is the most it can have cost. Any other event has
|
|
31
|
+
* none. Ids and numbers only: no token or secret reaches a line. */
|
|
31
32
|
export function runLine(event) {
|
|
32
33
|
if (event.type === "started")
|
|
33
34
|
return logLine("run_started", { run: event.runId, agent: event.agent, kind: event.kind });
|
|
34
35
|
if (event.type === "ended")
|
|
35
|
-
return logLine("run_ended", { run: event.runId, agent: event.agent, status: event.status === "ended" ? "completed" : event.status, cost_usd: event.costUsd ?? "unknown" });
|
|
36
|
+
return logLine("run_ended", { run: event.runId, agent: event.agent, status: event.status === "ended" ? "completed" : event.status, cost_usd: event.costUsd ?? "unknown", ...(event.costAtMostUsd !== undefined ? { cost_usd_at_most: event.costAtMostUsd } : {}) });
|
|
36
37
|
return undefined;
|
|
37
38
|
}
|
|
38
39
|
/** A duration as --drain-timeout takes it ("8s", "500ms", "1m"), in milliseconds; undefined when it is not one. */
|
package/dist/propose.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { DraftAsk } from "./learn/skills.js";
|
|
2
1
|
import { type Problem } from "./learn/index.js";
|
|
3
2
|
import type { DraftDecisions } from "./learn/skills.js";
|
|
4
3
|
import { type Turn } from "./learning.js";
|
|
@@ -29,19 +28,25 @@ export type Proposed = {
|
|
|
29
28
|
* seed holds is no change, and `MEMORY.md` is the host's (the checker ignores it). A skill is laid at
|
|
30
29
|
* `skills/<name>/SKILL.md`; a draft at `workflows/<name>/workflow.json`, with the README.md the host writes from the
|
|
31
30
|
* description its block gives. `outcome`, how the run's job ended (only a completed run adds or changes a skill);
|
|
32
|
-
* `tools`, those a draft may name (tools.ts learnedWorkflowTools); `refuse`: this host's secrets
|
|
31
|
+
* `tools`, those a draft may name (tools.ts learnedWorkflowTools); `refuse`: this host's secrets; `outputSchema`: the
|
|
32
|
+
* agent's, which a draft's dry run holds its answer to (learn/skills.ts draftDryRun). */
|
|
33
33
|
export declare const proposeRun: (input: {
|
|
34
34
|
folder: Workspace;
|
|
35
35
|
runDir: string;
|
|
36
36
|
seed: string;
|
|
37
37
|
notesSeed?: string;
|
|
38
|
+
revised?: {
|
|
39
|
+
workflow: string;
|
|
40
|
+
base: string;
|
|
41
|
+
};
|
|
38
42
|
turn: Turn;
|
|
39
43
|
refuse: readonly string[];
|
|
40
44
|
outcome?: string;
|
|
41
45
|
tools?: readonly string[];
|
|
42
46
|
gated?: Readonly<Record<string, string>>;
|
|
43
47
|
deniedBy?: Readonly<Record<string, "agent" | "server" | "default">>;
|
|
44
|
-
ask?: DraftAsk;
|
|
45
48
|
decisions?: DraftDecisions;
|
|
49
|
+
workflowAdapters?: readonly ("runNode" | "runJudge")[];
|
|
46
50
|
workflows?: false;
|
|
51
|
+
outputSchema?: unknown;
|
|
47
52
|
}) => Promise<Proposed>;
|