@parcha/agentrun-serve 0.1.0-beta.36 → 0.1.0-beta.38
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 +452 -0
- package/README.md +311 -142
- package/dist/agent-rows.d.ts +1 -1
- package/dist/agents-store.d.ts +35 -3
- package/dist/agents-store.js +39 -14
- 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/attach-conformance-cli.d.ts +1 -0
- package/dist/attach-conformance-cli.js +18 -0
- package/dist/attach-conformance.d.ts +25 -0
- package/dist/attach-conformance.js +343 -0
- package/dist/browser-cost.d.ts +1 -1
- package/dist/browser-cost.js +52 -93
- package/dist/browser-live.d.ts +20 -8
- package/dist/browser-live.js +50 -27
- package/dist/cap.d.ts +0 -407
- package/dist/cap.js +4 -1028
- package/dist/catalog.d.ts +1 -12
- package/dist/catalog.js +4 -34
- package/dist/cli.js +13 -4
- package/dist/composio-preset.d.ts +53 -0
- package/dist/composio-preset.js +221 -0
- package/dist/computer-attach.d.ts +125 -0
- package/dist/computer-attach.js +330 -0
- package/dist/computer-calls.d.ts +60 -0
- package/dist/computer-calls.js +209 -0
- package/dist/computer-channel.d.ts +57 -0
- package/dist/computer-channel.js +115 -0
- package/dist/computer-commands.d.ts +1 -1
- package/dist/computer-held-routes.d.ts +35 -0
- package/dist/computer-held-routes.js +106 -0
- package/dist/computer-held.d.ts +48 -0
- package/dist/computer-held.js +87 -0
- package/dist/computer-keys.d.ts +21 -1
- package/dist/computer-keys.js +53 -11
- package/dist/computer-live.d.ts +165 -0
- package/dist/computer-live.js +655 -0
- package/dist/computer-setting.d.ts +15 -2
- package/dist/computer-setting.js +20 -4
- package/dist/computer-view.d.ts +14 -0
- package/dist/computer-view.js +51 -3
- package/dist/computer-viewer.d.ts +6 -0
- package/dist/computer-viewer.js +311 -0
- package/dist/computers.d.ts +37 -8
- package/dist/computers.js +62 -14
- package/dist/console/assets/index-CjqQirbo.css +1 -0
- package/dist/console/assets/index-b6-XY5A9.js +576 -0
- package/dist/console/index.html +2 -2
- package/dist/console-links.d.ts +2 -0
- package/dist/console-links.js +3 -0
- package/dist/decisions.js +4 -0
- package/dist/faux-computers.d.ts +9 -20
- package/dist/faux-computers.js +56 -26
- package/dist/github-connection.d.ts +10 -2
- package/dist/github-connection.js +65 -2
- package/dist/github-faux.js +1 -1
- package/dist/graph-view.d.ts +1 -1
- package/dist/harness-opencode/adapter.js +7 -3
- package/dist/harness-opencode/facts.js +0 -2
- package/dist/harness-opencode/host/policy.d.ts +2 -5
- package/dist/harness-opencode/host/policy.js +8 -32
- package/dist/harness-table.d.ts +0 -2
- package/dist/harness-table.js +0 -2
- package/dist/harness.d.ts +1 -0
- package/dist/harness.js +35 -1
- package/dist/host-tools.d.ts +2 -6
- package/dist/host-tools.js +7 -10
- package/dist/hosted-search.d.ts +5 -6
- package/dist/hosted-search.js +2 -28
- package/dist/import-sources.d.ts +10 -0
- package/dist/import-sources.js +44 -2
- package/dist/import.d.ts +3 -3
- package/dist/import.js +37 -6
- package/dist/key-words.d.ts +3 -2
- package/dist/key-words.js +4 -2
- package/dist/learn/check.d.ts +10 -2
- package/dist/learn/check.js +13 -5
- package/dist/learn/commit.d.ts +14 -2
- package/dist/learn/commit.js +23 -9
- package/dist/learn/compile.d.ts +243 -0
- package/dist/learn/compile.js +471 -0
- package/dist/learn/folder.d.ts +6 -0
- package/dist/learn/folder.js +4 -1
- package/dist/learn/general.d.ts +69 -0
- package/dist/learn/general.js +75 -0
- package/dist/learn/grade.d.ts +5 -1
- package/dist/learn/grade.js +29 -7
- package/dist/learn/notes.d.ts +8 -0
- package/dist/learn/notes.js +18 -0
- package/dist/learn/promote.d.ts +253 -0
- package/dist/learn/promote.js +428 -0
- package/dist/learn/refit.d.ts +39 -0
- package/dist/learn/refit.js +236 -0
- package/dist/learn/reflect.d.ts +9 -20
- package/dist/learn/reflect.js +18 -125
- package/dist/learn/replay-calls.d.ts +63 -0
- package/dist/learn/replay-calls.js +158 -0
- package/dist/learn/skills.d.ts +50 -14
- package/dist/learn/skills.js +183 -47
- package/dist/learn/workflow-nodes.d.ts +15 -0
- package/dist/learn/workflow-nodes.js +44 -0
- package/dist/learned-nodes.d.ts +50 -2
- package/dist/learned-nodes.js +41 -2
- package/dist/learned-workflow.d.ts +43 -3
- package/dist/learned-workflow.js +170 -28
- package/dist/learning-batch.d.ts +283 -0
- package/dist/learning-batch.js +574 -0
- package/dist/learning-cost.d.ts +18 -6
- package/dist/learning-cost.js +15 -7
- package/dist/learning-evals.d.ts +33 -0
- package/dist/learning-evals.js +98 -0
- package/dist/learning-routes.d.ts +37 -2
- package/dist/learning-routes.js +52 -8
- package/dist/learning-words.d.ts +13 -0
- package/dist/learning-words.js +13 -0
- package/dist/learning.d.ts +55 -17
- package/dist/learning.js +91 -48
- package/dist/live/stream.js +6 -3
- package/dist/live/translate.d.ts +4 -3
- package/dist/live/translate.js +8 -4
- package/dist/live-reach.d.ts +37 -0
- package/dist/live-reach.js +62 -0
- package/dist/llm.js +0 -3
- package/dist/mcp-gateway.d.ts +21 -20
- package/dist/mcp-gateway.js +76 -55
- package/dist/mcp-oauth.d.ts +62 -7
- package/dist/mcp-oauth.js +134 -19
- package/dist/mcp-pin-first.d.ts +37 -0
- package/dist/mcp-pin-first.js +107 -0
- package/dist/mcp-private-hosts.d.ts +4 -4
- package/dist/mcp-private-hosts.js +20 -12
- package/dist/mcp-probe.d.ts +27 -11
- package/dist/mcp-probe.js +60 -42
- package/dist/mcp-secret-writes.js +4 -0
- package/dist/mcp-servers-store.d.ts +115 -25
- package/dist/mcp-servers-store.js +241 -43
- package/dist/mcp-sources.d.ts +39 -0
- package/dist/mcp-sources.js +74 -0
- package/dist/mcp-store.d.ts +21 -4
- package/dist/mcp-store.js +33 -8
- 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 +26 -0
- package/dist/model-form.js +80 -0
- package/dist/model.d.ts +13 -0
- package/dist/model.js +69 -25
- package/dist/monid.d.ts +51 -25
- package/dist/monid.js +226 -140
- package/dist/openapi.js +694 -59
- package/dist/page.d.ts +18 -0
- package/dist/page.js +48 -20
- package/dist/paid-calls.d.ts +26 -29
- package/dist/paid-calls.js +46 -102
- package/dist/place-offers.d.ts +2 -3
- package/dist/place-offers.js +3 -7
- package/dist/place.js +1 -2
- package/dist/print.d.ts +15 -1
- package/dist/print.js +14 -3
- package/dist/propose.d.ts +10 -1
- package/dist/propose.js +30 -10
- package/dist/provider.js +12 -4
- package/dist/reflect-range.d.ts +8 -1
- package/dist/reflect-range.js +3 -2
- package/dist/rows.d.ts +5 -3
- package/dist/rows.js +15 -4
- package/dist/run-launch.d.ts +27 -2
- package/dist/run-launch.js +15 -4
- package/dist/run-learning-served.d.ts +13 -2
- package/dist/run-manifest.d.ts +5 -0
- package/dist/run-manifest.js +20 -0
- package/dist/run-reads-over-store.d.ts +1 -1
- package/dist/run-repo.d.ts +20 -0
- package/dist/run-repo.js +63 -0
- package/dist/run-secrets.js +2 -3
- package/dist/run-timeline-served.d.ts +1 -1
- package/dist/run-timeline-served.js +5 -2
- package/dist/run-view.d.ts +19 -8
- package/dist/run-view.js +62 -26
- package/dist/runnable.d.ts +0 -3
- package/dist/runnable.js +37 -29
- package/dist/runner/adapter-loop.d.ts +47 -17
- package/dist/runner/adapter-loop.js +1427 -303
- package/dist/runner/adapter-run-spec.d.ts +23 -9
- package/dist/runner/adapter-run-spec.js +162 -56
- package/dist/runner/adapters/pi-computer.d.ts +9 -0
- package/dist/runner/adapters/pi-computer.js +51 -0
- package/dist/runner/adapters/pi.d.ts +25 -11
- package/dist/runner/adapters/pi.js +168 -45
- package/dist/runner/beside.d.ts +7 -3
- package/dist/runner/beside.js +21 -11
- package/dist/runner/claim-secrets.d.ts +4 -0
- package/dist/runner/claim-secrets.js +6 -1
- package/dist/runner/cli-run-spec.d.ts +20 -3
- package/dist/runner/cli-run-spec.js +174 -64
- package/dist/runner/commands.d.ts +3 -1
- package/dist/runner/commands.js +28 -3
- package/dist/runner/computer-channel.d.ts +34 -0
- package/dist/runner/computer-channel.js +62 -0
- package/dist/runner/conformance/harness.d.ts +3 -0
- package/dist/runner/conformance/harness.js +224 -17
- package/dist/runner/conformance/subject.d.ts +12 -5
- package/dist/runner/dispatch.js +3 -0
- package/dist/runner/end-of-run.d.ts +23 -12
- package/dist/runner/end-of-run.js +41 -16
- package/dist/runner/feedback-round.d.ts +52 -0
- package/dist/runner/feedback-round.js +79 -0
- package/dist/runner/github-app.d.ts +2 -1
- package/dist/runner/github-app.js +4 -2
- package/dist/runner/harness-loops.js +15 -1
- package/dist/runner/held-run.d.ts +65 -0
- package/dist/runner/held-run.js +158 -0
- package/dist/runner/journal-kinds.d.ts +44 -7
- package/dist/runner/journal-kinds.js +29 -0
- package/dist/runner/journal-reader.d.ts +5 -4
- package/dist/runner/journal-reader.js +12 -10
- package/dist/runner/learning-ask.d.ts +7 -1
- package/dist/runner/learning-ask.js +21 -6
- package/dist/runner/learning-dispatch.d.ts +22 -0
- package/dist/runner/learning-dispatch.js +77 -10
- package/dist/runner/learning-end.d.ts +69 -13
- package/dist/runner/learning-end.js +340 -87
- package/dist/runner/learning-factory.d.ts +1 -1
- package/dist/runner/learning-factory.js +11 -5
- package/dist/runner/learning-loop.d.ts +86 -8
- package/dist/runner/learning-loop.js +178 -23
- package/dist/runner/learning-seed.d.ts +11 -0
- package/dist/runner/learning-seed.js +27 -0
- package/dist/runner/live-ticker.js +1 -0
- package/dist/runner/loop-contract.d.ts +26 -3
- package/dist/runner/loop.d.ts +21 -2
- package/dist/runner/loop.js +23 -2
- package/dist/runner/main.d.ts +13 -1
- package/dist/runner/main.js +27 -5
- package/dist/runner/mcp-claim.d.ts +15 -8
- package/dist/runner/mcp-claim.js +176 -71
- package/dist/runner/mcp-github.js +1 -1
- package/dist/runner/mcp-run.d.ts +21 -57
- package/dist/runner/mcp-run.js +25 -85
- package/dist/runner/meta-tools.d.ts +37 -0
- package/dist/runner/meta-tools.js +268 -0
- package/dist/runner/metrics.d.ts +11 -2
- package/dist/runner/metrics.js +26 -5
- package/dist/runner/model-route.js +12 -3
- package/dist/runner/monid-run.d.ts +16 -0
- package/dist/runner/monid-run.js +96 -0
- package/dist/runner/pr-checkout.d.ts +1 -0
- package/dist/runner/pr-checkout.js +1 -1
- package/dist/runner/promotion.d.ts +80 -0
- package/dist/runner/promotion.js +562 -0
- package/dist/runner/reflect-hook.d.ts +46 -13
- package/dist/runner/reflect-hook.js +149 -48
- package/dist/runner/runner.d.ts +26 -0
- package/dist/runner/runner.js +208 -17
- package/dist/runner/scratch-sweep.d.ts +13 -0
- package/dist/runner/scratch-sweep.js +62 -0
- package/dist/runner/sessions.d.ts +9 -4
- package/dist/runner/sessions.js +5 -1
- package/dist/runner/step-guard.d.ts +62 -0
- package/dist/runner/step-guard.js +93 -0
- package/dist/runner/store-port.d.ts +4 -2
- package/dist/runner/store-secrets.js +4 -3
- package/dist/runner/subagent.d.ts +0 -3
- package/dist/runner/subagent.js +10 -13
- package/dist/runner/workflow-first.d.ts +216 -0
- package/dist/runner/workflow-first.js +303 -0
- package/dist/runner/workflow-host.d.ts +6 -1
- package/dist/runner/workflow-host.js +1 -1
- package/dist/runner/workflow-loop.d.ts +1 -1
- package/dist/runner/workflow-loop.js +17 -10
- package/dist/runner/workflow-spec.d.ts +15 -2
- package/dist/runner/workflow-spec.js +63 -23
- package/dist/runs-over-store.d.ts +17 -3
- package/dist/runs-over-store.js +59 -20
- package/dist/seal-key.js +3 -3
- package/dist/sealed-settings-store.d.ts +5 -2
- package/dist/sealed-settings-store.js +10 -4
- package/dist/secret-writes.d.ts +5 -4
- package/dist/secret-writes.js +5 -4
- package/dist/server-secrets-store.d.ts +4 -3
- package/dist/server-secrets-store.js +15 -9
- package/dist/server-secrets.js +3 -2
- package/dist/server.d.ts +119 -18
- package/dist/server.js +841 -202
- package/dist/settings-wake.d.ts +23 -0
- package/dist/settings-wake.js +65 -0
- package/dist/standard-webhooks.d.ts +4 -1
- package/dist/standard-webhooks.js +8 -4
- package/dist/store/agent-body.d.ts +14 -3
- package/dist/store/agent-body.js +14 -10
- package/dist/store/command-wake.d.ts +13 -0
- package/dist/store/command-wake.js +37 -0
- package/dist/store/dialect.d.ts +6 -0
- package/dist/store/dialect.js +5 -0
- package/dist/store/index.d.ts +1 -1
- package/dist/store/journal/storage.d.ts +3 -2
- package/dist/store/journal/storage.js +13 -5
- package/dist/store/postgres/connection.js +3 -1
- package/dist/store/postgres/dialect.js +4 -0
- package/dist/store/postgres/migrations/0005_learning_rounds.sql +14 -0
- package/dist/store/postgres/migrations/0006_run_changes_channel_attempts.sql +57 -0
- package/dist/store/postgres/migrations/0007_viewer_host.sql +11 -0
- package/dist/store/postgres/migrations/0008_paired_computers.sql +30 -0
- package/dist/store/postgres/migrations/0009_commands_answer.sql +10 -0
- 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/schema.d.ts +10 -1
- package/dist/store/schema.js +104 -15
- 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 +7 -5
- package/dist/store/sqlite/run-patch.js +45 -18
- package/dist/store/sqlite/store.js +331 -72
- package/dist/store/store.d.ts +312 -21
- package/dist/store/store.js +12 -1
- package/dist/store-reads/cap.d.ts +1 -1
- package/dist/store-reads/cap.js +8 -1
- package/dist/store-reads/decisions.d.ts +2 -2
- package/dist/store-reads/decisions.js +1 -1
- package/dist/store-reads/import-summary.d.ts +1 -1
- package/dist/store-reads/journal.d.ts +30 -5
- package/dist/store-reads/journal.js +128 -56
- package/dist/store-reads/learning.d.ts +114 -12
- package/dist/store-reads/learning.js +238 -48
- package/dist/store-reads/loop.d.ts +61 -0
- package/dist/store-reads/loop.js +111 -0
- package/dist/store-reads/runs.d.ts +1 -1
- package/dist/store-reads/workflow.d.ts +1 -1
- package/dist/store-view.d.ts +6 -0
- package/dist/store-view.js +59 -26
- package/dist/template-eval.d.ts +18 -9
- package/dist/template-eval.js +95 -68
- package/dist/template-github-permissions.d.ts +24 -10
- package/dist/template-github-permissions.js +36 -15
- 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 +218 -46
- package/dist/templates.js +493 -181
- package/dist/timeline/computer.d.ts +48 -0
- package/dist/timeline/computer.js +169 -0
- package/dist/timeline/index.d.ts +4 -3
- package/dist/timeline/index.js +4 -3
- package/dist/timeline/labels.d.ts +6 -2
- package/dist/timeline/labels.js +93 -2
- package/dist/timeline/origin.d.ts +19 -5
- package/dist/timeline/origin.js +11 -4
- package/dist/timeline/timeline.d.ts +22 -1
- package/dist/timeline/timeline.js +34 -18
- package/dist/timeline/util.d.ts +4 -0
- package/dist/timeline/util.js +14 -0
- package/dist/tool-gate.d.ts +84 -50
- package/dist/tool-gate.js +179 -101
- package/dist/tool-keys.d.ts +4 -1
- package/dist/tool-keys.js +8 -3
- package/dist/tool-list.d.ts +26 -0
- package/dist/tool-list.js +43 -0
- package/dist/tool-names.d.ts +71 -0
- package/dist/tool-names.js +99 -0
- package/dist/tool-plane.d.ts +33 -27
- package/dist/tool-plane.js +72 -39
- package/dist/tools.d.ts +32 -7
- package/dist/tools.js +37 -24
- package/dist/trigger-adapter.d.ts +4 -0
- package/dist/trigger-secrets-shown.d.ts +2 -2
- package/dist/trigger-secrets-shown.js +1 -1
- package/dist/trigger-signatures.d.ts +25 -6
- package/dist/trigger-signatures.js +41 -7
- package/dist/trigger-targets.d.ts +2 -0
- package/dist/trigger-targets.js +1 -0
- package/dist/trigger-webhook.js +5 -2
- package/dist/triggers.d.ts +7 -3
- package/dist/triggers.js +35 -5
- package/dist/turns.js +16 -1
- package/dist/validate.d.ts +15 -7
- package/dist/validate.js +102 -45
- package/dist/web-fetch.d.ts +2 -8
- package/dist/web-fetch.js +2 -22
- package/dist/web-search.d.ts +10 -5
- package/dist/web-search.js +7 -6
- package/dist/webhooks.d.ts +145 -102
- package/dist/webhooks.js +559 -322
- package/dist/workflow/decisions.d.ts +1 -1
- package/dist/workflow/node-runner.d.ts +2 -1
- package/dist/workflow/node.d.ts +2 -1
- package/dist/workflow/node.js +3 -1
- package/dist/workflow/pi-versions.d.ts +23 -0
- package/dist/workflow/pi-versions.js +57 -0
- package/dist/workflow/record-tool.d.ts +2 -1
- package/dist/workflow/store.d.ts +1 -1
- package/dist/workflow/task.js +3 -2
- package/dist/workflow-run.d.ts +1 -1
- package/dist/workspace/attached-computers.d.ts +41 -0
- package/dist/workspace/attached-computers.js +114 -0
- package/dist/workspace/computer-deps.d.ts +19 -9
- package/dist/workspace/computer-deps.js +24 -9
- package/dist/workspace/computer-for-claim.d.ts +23 -8
- package/dist/workspace/computer-for-claim.js +92 -33
- package/dist/workspace/computer-hold.d.ts +11 -27
- package/dist/workspace/computer-hold.js +41 -55
- package/dist/workspace/computer-ledger.d.ts +3 -1
- package/dist/workspace/computer-ledger.js +4 -0
- package/dist/workspace/computer-mcp.d.ts +25 -0
- package/dist/workspace/computer-mcp.js +41 -0
- package/dist/workspace/computer-ports.d.ts +4 -13
- package/dist/workspace/computer-ports.js +4 -107
- package/dist/workspace/computer-script.d.ts +53 -0
- package/dist/workspace/computer-script.js +172 -0
- package/dist/workspace/executors.d.ts +1 -1
- package/dist/workspace/index.d.ts +4 -2
- package/dist/workspace/index.js +3 -1
- package/dist/workspace/kind-skills/desktop/SKILL.md +132 -84
- package/dist/workspace/kind-skills/phone/SKILL.md +104 -85
- package/dist/workspace/local.js +2 -2
- package/dist/workspace/resolve-computer.d.ts +24 -1
- package/dist/workspace/resolve-computer.js +40 -16
- package/dist/workspace/run-tools.d.ts +56 -21
- package/dist/workspace/run-tools.js +55 -34
- package/dist/wrap-up.d.ts +21 -0
- package/dist/wrap-up.js +21 -0
- package/launcher/agentrun-serve +4 -2
- package/package.json +19 -16
- package/templates/README.md +111 -45
- package/templates/code-review/agent.md +30 -14
- 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 +2 -2
- 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/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/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 +3 -2
- package/templates/code-review/skills/review/REVIEWER.md +3 -2
- package/templates/code-review/skills/review/SKILL.md +4 -3
- 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 +4 -3
- 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 +4 -3
- 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-BI4Byidu.js +0 -550
- package/dist/console/assets/index-C19gUF2n.css +0 -1
- package/dist/run-db.d.ts +0 -53
- package/dist/run-db.js +0 -116
- package/dist/tool-blurbs.d.ts +0 -4
- package/dist/tool-blurbs.js +0 -28
- package/dist/tool-budget.d.ts +0 -26
- package/dist/tool-budget.js +0 -56
- package/dist/workflow/readers.d.ts +0 -36
- package/dist/workflow/readers.js +0 -145
- package/dist/workflow/wal.d.ts +0 -11
- package/dist/workflow/wal.js +0 -106
- 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
|
@@ -22,6 +22,10 @@ import { hostToolDefs } from "@parcha/agentrun-kernel/kernel";
|
|
|
22
22
|
import { configurationOf, imagesOf } from "@parcha/agentrun-computer";
|
|
23
23
|
import { noDockerWords } from "../docker-daemon.js";
|
|
24
24
|
import { gpuRefused } from "../gpu-words.js";
|
|
25
|
+
import { recordedClient } from "../computer-calls.js";
|
|
26
|
+
/** Whether a computer (or its setting) takes its agent's programs away: `exec: false`. Only a desktop or a phone takes
|
|
27
|
+
* `exec` (computer-setting.ts refuses it on any other kind at save), so a computer without programs is one of those. */
|
|
28
|
+
export const noPrograms = (computer) => computer?.exec === false;
|
|
25
29
|
/** A provider's keys as the claim reads them: each key its registry entry declares, by `keyOf` (the server's reader:
|
|
26
30
|
* key-meta.ts keyReader, the environment's value, else the saved one); a key with no value is left out. */
|
|
27
31
|
export const providerKeys = (registry, keyOf) => async (provider) => {
|
|
@@ -39,9 +43,17 @@ export const vendorNetworkOnly = (network) => network !== undefined && network.l
|
|
|
39
43
|
/** Whether a provider's computers can't have no network: it declares its network forms and "none" isn't one (a cloud
|
|
40
44
|
* phone, a hosted browser, Local Chrome). */
|
|
41
45
|
export const needsNetwork = (network) => network !== undefined && network.length > 0 && !network.includes("none");
|
|
46
|
+
/** A provider's label after its article, as it is said: "a Modal", "an E2B" (every label is said by its first letter's
|
|
47
|
+
* sound). `start`: at a sentence's start, "A"/"An". */
|
|
48
|
+
export const aLabel = (label, start = false) => `${start ? "A" : "a"}${/^[AEIOU]/i.test(label) ? "n" : ""} ${label}`;
|
|
49
|
+
/** Why a sandbox or a desktop that would mount the owner's Archil disk can't start in Mode 2: the mount needs Archil's
|
|
50
|
+
* image in the owner's own vendor account, and this server can't put it there yet (E2B Desktop's template has none, and
|
|
51
|
+
* Agent37's agentrun-box is in no owner's workspace). Settings (computers.ts modeRefusal) and a run's start
|
|
52
|
+
* (computerReadiness) say it. */
|
|
53
|
+
export const mode2ArchilWhy = (label, kind) => `${aLabel(label, true)} ${kind} can't start in Mode 2 yet: it needs Archil's image in your ${label} account, and this server can't put it there yet. Set this agent's computer to none (${SETTINGS})`;
|
|
42
54
|
/** Why a computer that needs a network is refused where this server's AGENTRUN_BOX_ALLOW is none, in words that name the
|
|
43
55
|
* fix: the operator said no network at all, and the computer can't run without one. */
|
|
44
|
-
export const noNetworkRefusal = (label, kind) => `This agent's computer is
|
|
56
|
+
export const noNetworkRefusal = (label, kind) => `This agent's computer is ${aLabel(label)} ${kind}, which needs a network (the vendor's own, or public addresses from this machine), and this server's AGENTRUN_BOX_ALLOW is none (no network): pick a computer that runs with no network in ${SETTINGS}, or set AGENTRUN_BOX_ALLOW to a host list.`;
|
|
45
57
|
/** Whether an agent's computer `setting` can be had in `mode` now, by the answers the claim gives (resolveComputer: the
|
|
46
58
|
* kind, the provider and what it serves, the mode's mount, the provider's keys by `keyOf`): ok, or its refusal in words
|
|
47
59
|
* that name the fix. Nothing starts. A run's start asks it before the run is made (runnable.ts).
|
|
@@ -67,13 +79,15 @@ export async function computerReadiness(setting, mode, registry, keyOf, answers,
|
|
|
67
79
|
if ("refused" in resolved)
|
|
68
80
|
return { refused: resolved.refused };
|
|
69
81
|
const entry = registry.PROVIDERS.find((one) => one.id === resolved.provider);
|
|
82
|
+
if (mode === 2 && (resolved.kind === "sandbox" || resolved.kind === "desktop") && resolved.mounts && entry)
|
|
83
|
+
return { refused: `${mode2ArchilWhy(entry.label, resolved.kind)}.` };
|
|
70
84
|
if (entry && entry.mounts.includes("bind") && answers) {
|
|
71
85
|
const said = await answers(entry.id);
|
|
72
86
|
// It names the box whose probe said no (a refusal's details.box), as the box check did.
|
|
73
87
|
if (!said.up && said.absent)
|
|
74
88
|
return { refused: noDockerWords(resolved.kind, registry.PROVIDERS, mode), box: entry.id };
|
|
75
89
|
if (!said.up)
|
|
76
|
-
return { refused: `This agent's computer is
|
|
90
|
+
return { refused: `This agent's computer is ${aLabel(entry.label)} ${resolved.kind}, and this server cannot run it: ${said.reason.replace(/[.!?]+$/, "")}.`, box: entry.id };
|
|
77
91
|
}
|
|
78
92
|
const host = entry ? hostWhy?.(entry.id) : undefined;
|
|
79
93
|
if (host)
|
|
@@ -137,6 +151,9 @@ export function runShellOf(setting, mode, registry) {
|
|
|
137
151
|
const serving = selectedOf(servingOf(registry, entry, kind), setting, entry, kind);
|
|
138
152
|
if (serving.length === 0)
|
|
139
153
|
return "none";
|
|
154
|
+
// An agent whose computer runs no programs of its own has no shell anywhere: not its computer's, not Archil's exec.
|
|
155
|
+
if (noPrograms(setting))
|
|
156
|
+
return "none";
|
|
140
157
|
const mounts = mountsFolder(kind, entry, serving, mode);
|
|
141
158
|
if (kind === "sandbox" && !mounts)
|
|
142
159
|
return "none";
|
|
@@ -191,6 +208,9 @@ export async function resolveComputer(given, mode, registry, side) {
|
|
|
191
208
|
// The configurations of the provider that serve the kind; none, and the registry says why, by its closest one.
|
|
192
209
|
const serving = servingOf(registry, entry, kind);
|
|
193
210
|
if (serving.length === 0) {
|
|
211
|
+
const own = registry.unservedWhy?.(entry, kind);
|
|
212
|
+
if (own !== undefined)
|
|
213
|
+
return { refused: `${own}, or pick ${pick}` };
|
|
194
214
|
const why = entry.capabilities.map((one) => registry.servingRefusals(one, kind)).sort((a, b) => a.length - b.length)[0] ?? [];
|
|
195
215
|
return { refused: `${entry.label} gives no ${kind} computer${why.length > 0 ? `: ${why.join("; ")}` : ""}. Pick ${pick}` };
|
|
196
216
|
}
|
|
@@ -207,14 +227,15 @@ export async function resolveComputer(given, mode, registry, side) {
|
|
|
207
227
|
return { refused: `${entry.label} has no ${kind} image ${JSON.stringify(setting.image)}. It ${offers} for this agent's computer in ${SETTINGS}.` };
|
|
208
228
|
}
|
|
209
229
|
// The run's folder: mounted where the selected configuration has files and exec and the provider mounts the mode's
|
|
210
|
-
// folder.
|
|
211
|
-
const mounts = mountsFolder(kind, entry, [configuration], mode);
|
|
230
|
+
// folder, and the agent may run programs there (a folder is mounted for its shell).
|
|
231
|
+
const mounts = !noPrograms(setting) && mountsFolder(kind, entry, [configuration], mode);
|
|
212
232
|
if (kind === "sandbox" && !mounts) {
|
|
213
233
|
if (mode === 1)
|
|
214
|
-
return { refused: `Mode 1 runs a sandbox only on Docker:
|
|
234
|
+
return { refused: `Mode 1 runs a sandbox only on Docker: ${aLabel(entry.label)} sandbox can't reach the run's folder on this machine. Pick Docker for this agent's computer in ${SETTINGS}, or another kind of computer.` };
|
|
215
235
|
if (entry.mounts.includes("bind"))
|
|
216
236
|
return { refused: `Mode 2 keeps workspaces on Archil; a local Docker computer can't mount them. Pick a remote sandbox for this agent's computer in ${SETTINGS}, or no computer.` };
|
|
217
|
-
|
|
237
|
+
const why = entry.unmounted?.archil;
|
|
238
|
+
return { refused: `${aLabel(entry.label, true)} sandbox can't mount the run's folder from Archil${why ? ` (${why})` : ""}: pick another sandbox for this agent's computer in ${SETTINGS}.` };
|
|
218
239
|
}
|
|
219
240
|
// Its GPUs, a sandbox's alone: in gpuRefused's words, against what the configuration the setting selected declares,
|
|
220
241
|
// with the mode's folder as the mount it takes (a sandbox here always mounts it). A GPU computer that can't mount the
|
|
@@ -225,15 +246,15 @@ export async function resolveComputer(given, mode, registry, side) {
|
|
|
225
246
|
if (refused?.folder)
|
|
226
247
|
return { refused: refused.words };
|
|
227
248
|
if (refused)
|
|
228
|
-
return { refused:
|
|
249
|
+
return { refused: `${aLabel(entry.label, true)} sandbox can't have this agent's GPUs: ${refused.words}. Change the GPUs or the provider for this agent's computer in ${SETTINGS}.` };
|
|
229
250
|
}
|
|
230
251
|
// The agent's own computer, kept between its runs: only where the configuration keeps one, and never one that mounts
|
|
231
252
|
// the run's folder (a later run would find an earlier run's folder in it).
|
|
232
253
|
const persistent = setting.persistent === true;
|
|
233
254
|
if (persistent && configuration.persistence === undefined)
|
|
234
|
-
return { refused:
|
|
255
|
+
return { refused: `${aLabel(entry.label, true)} ${kind} keeps no computer for an agent between runs (it declares no persistence): turn persistent off, or pick a computer that keeps one, for this agent's computer in ${SETTINGS}.` };
|
|
235
256
|
if (persistent && mounts)
|
|
236
|
-
return { refused:
|
|
257
|
+
return { refused: `${aLabel(entry.label, true)} ${kind} mounts each run's folder, so it can't be kept between runs: turn persistent off for this agent's computer in ${SETTINGS}.` };
|
|
237
258
|
// Its keys: every required one saved, before anything starts; only declared names go to the provider.
|
|
238
259
|
const saved = await side.keysOf(entry.id);
|
|
239
260
|
const has = (name) => typeof saved[name] === "string" && saved[name] !== "";
|
|
@@ -263,7 +284,7 @@ export async function resolveComputer(given, mode, registry, side) {
|
|
|
263
284
|
throw unavailable(noDockerWords(kind, registry.PROVIDERS, mode));
|
|
264
285
|
throw unavailable(`${entry.label} could not start a ${kind} computer: ${error instanceof Error ? error.message : String(error)}`);
|
|
265
286
|
}
|
|
266
|
-
const computer = runComputerOf(kind, launched, mounts ? check : undefined);
|
|
287
|
+
const computer = runComputerOf(kind, launched, mounts ? check : undefined, { ...(setting.surface ? { surface: setting.surface } : {}), ...(noPrograms(setting) ? { exec: false } : {}) });
|
|
267
288
|
if (typeof computer === "string") {
|
|
268
289
|
await launched.release();
|
|
269
290
|
throw unavailable(`${entry.label} could not start a ${kind} computer: ${computer}`);
|
|
@@ -272,21 +293,24 @@ export async function resolveComputer(given, mode, registry, side) {
|
|
|
272
293
|
},
|
|
273
294
|
};
|
|
274
295
|
}
|
|
275
|
-
/** The started computer as runTools takes it, or what it lacks, in words.
|
|
276
|
-
|
|
296
|
+
/** The started computer as runTools takes it, or what it lacks, in words. `agent`: a desktop's or a phone's surface and
|
|
297
|
+
* exec, as its agent's setting says them. */
|
|
298
|
+
function runComputerOf(kind, launched, check, agent) {
|
|
277
299
|
// The run's browser tool opens a browser's sessions through its provider.
|
|
278
300
|
if (kind === "browser")
|
|
279
301
|
return launched.browser ? { kind, browser: launched.browser } : "it gave no CDP connection";
|
|
280
|
-
const {
|
|
281
|
-
if (!client)
|
|
302
|
+
const { hello } = launched;
|
|
303
|
+
if (!launched.client)
|
|
282
304
|
return "it gave no computer protocol client";
|
|
305
|
+
// Each call the agent's tools make is recorded on the tool call's row (computer-calls.ts): the run's one client.
|
|
306
|
+
const client = recordedClient(launched.client);
|
|
283
307
|
if (kind === "phone")
|
|
284
|
-
return hello ? { kind, computer: { client }, hello } : "it gave no hello";
|
|
308
|
+
return hello ? { kind, computer: { client }, hello, ...agent } : "it gave no hello";
|
|
285
309
|
if (check && !launched.readBack)
|
|
286
310
|
return "it gave no read-back of its mount";
|
|
287
311
|
const readBack = launched.readBack ? () => launched.readBack() : async () => ({ ok: false, error: { code: "unsupported", message: "nothing is mounted in this computer" } });
|
|
288
312
|
const computer = { id: launched.id, client, readBack };
|
|
289
313
|
if (kind === "sandbox")
|
|
290
314
|
return check ? { kind, computer, check } : "a sandbox mounts the run's folder";
|
|
291
|
-
return hello ? { kind, computer, hello, ...(check ? { check } : {}) } : "it gave no hello";
|
|
315
|
+
return hello ? { kind, computer, hello, ...(check ? { check } : {}), ...agent } : "it gave no hello";
|
|
292
316
|
}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import type { Context } from "@earendil-works/chord";
|
|
1
|
+
import type { Context } from "@earendil-works/chord/context";
|
|
2
2
|
import type { HostTool } from "@parcha/agentrun-kernel";
|
|
3
|
-
import { type CapabilityKind, type Registry } from "@parcha/agentrun-kernel/kernel";
|
|
3
|
+
import { type CapabilityKind, type ComputerPort, type Executor, type Registry } from "@parcha/agentrun-kernel/kernel";
|
|
4
4
|
import type { ComputerClient, HelloResult } from "@parcha/agentrun-computer";
|
|
5
|
+
import { type Card } from "@parcha/agentrun-computer/surface";
|
|
5
6
|
import type { AttachableComputer, MountCheck } from "./attach.js";
|
|
7
|
+
import { ScriptGuard } from "./computer-script.js";
|
|
6
8
|
import { type PiAnswer, type PiExecutor } from "./executors.js";
|
|
7
9
|
import { type Hands } from "./hands.js";
|
|
8
10
|
import { type ClaimBrowser, type ShellPlace } from "./resolve-computer.js";
|
|
@@ -11,36 +13,58 @@ import type { Workspace } from "./workspace.js";
|
|
|
11
13
|
* The run's computer, as runTools takes it, by its kind:
|
|
12
14
|
* - sandbox: the run's folder is mounted in it, always; `check` is the mount check attach runs (the claim's epoch bound
|
|
13
15
|
* in);
|
|
14
|
-
* - desktop:
|
|
15
|
-
* files and exec;
|
|
16
|
-
* - phone:
|
|
16
|
+
* - desktop: the computer's tools; the folder is attached only when its provider mounts it (`check` given) and it
|
|
17
|
+
* offers files and exec;
|
|
18
|
+
* - phone: the computer's tools; never attached;
|
|
17
19
|
* - browser: what the run's browser tool drives it by (its CDP URL through its provider); no tools of the registry's,
|
|
18
20
|
* never attached.
|
|
19
|
-
* `hello`: what a desktop or a phone said it is when the claim connected it; its groups
|
|
21
|
+
* `hello`: what a desktop or a phone said it is when the claim connected it; its groups say which of the computer's
|
|
22
|
+
* tools it has, and its surface is made from it.
|
|
20
23
|
*/
|
|
21
24
|
export type RunComputer = {
|
|
22
25
|
readonly kind: "sandbox";
|
|
23
26
|
readonly computer: AttachableComputer;
|
|
24
27
|
readonly check: MountCheck;
|
|
25
|
-
} | {
|
|
28
|
+
} | ({
|
|
26
29
|
readonly kind: "desktop";
|
|
27
30
|
readonly computer: AttachableComputer;
|
|
28
31
|
readonly hello: HelloResult;
|
|
29
32
|
readonly check?: MountCheck;
|
|
30
|
-
} | {
|
|
33
|
+
} & AgentComputer) | ({
|
|
31
34
|
readonly kind: "phone";
|
|
32
35
|
readonly computer: {
|
|
33
36
|
readonly client: ComputerClient;
|
|
34
37
|
};
|
|
35
38
|
readonly hello: HelloResult;
|
|
36
|
-
} | {
|
|
39
|
+
} & AgentComputer) | {
|
|
37
40
|
readonly kind: "browser";
|
|
38
41
|
readonly browser: ClaimBrowser;
|
|
39
42
|
};
|
|
40
|
-
/**
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
|
|
43
|
+
/** What a desktop's or a phone's agent may do with it, as its computer setting says (computer-setting.ts): `surface`,
|
|
44
|
+
* how it drives it ("code": a script tool and the hand-over; "tools": the per-step tools and the hand-over; absent,
|
|
45
|
+
* both: surfaceKeeps); `exec: false`, no program of its own on it: its card and surface are made from its hello with
|
|
46
|
+
* the exec and processes groups taken out, so no tool and no script has a shell, and the run has no bash family
|
|
47
|
+
* anywhere (shell "none"). Only the agent's: the run's own computer channel (computer-channel.ts loopComputerOf, the
|
|
48
|
+
* owner's POST /runs/{id}/computer/call) keeps the computer's whole hello. */
|
|
49
|
+
export type AgentComputer = {
|
|
50
|
+
readonly surface?: "code" | "tools";
|
|
51
|
+
readonly exec?: false;
|
|
52
|
+
};
|
|
53
|
+
/** A desktop's or a phone's port as a person's hold on the computer gives it back: each look or act made while the
|
|
54
|
+
* person holds it waits for hand-back; a look then runs, an act then is refused (the take-over's own words). With it,
|
|
55
|
+
* the agent's ask for the person (`handoff`, computer_request_handoff's port), through the same hold. */
|
|
56
|
+
export type RunHold = (ports: Pick<Hands, "computer">) => Pick<Hands, "computer" | "handoff">;
|
|
57
|
+
/** A desktop's or a phone's surface as a harness's own script runtime binds it (pi's code mode): its card, the script
|
|
58
|
+
* prelude that builds `computer` from it (computer-script.ts scriptPreludeOf), and the run's port, held by the person's
|
|
59
|
+
* take-over as the tools' is. `declare`: no computer_script is listed to declare `computer` (a code-only computer on a
|
|
60
|
+
* code-mode harness), so the harness's script tool declares it itself. */
|
|
61
|
+
export type ScriptComputer = {
|
|
62
|
+
readonly card: Card;
|
|
63
|
+
readonly port: ComputerPort; /** What the script's shell and files are held to (computer-script.ts ScriptGuard). */
|
|
64
|
+
readonly guard: ScriptGuard;
|
|
65
|
+
readonly prelude: string;
|
|
66
|
+
readonly declare: boolean;
|
|
67
|
+
};
|
|
44
68
|
/** The run's scratch in its own folder: bash's TMPDIR. */
|
|
45
69
|
export declare const TMP_DIR = ".agentrun/tmp";
|
|
46
70
|
/** What runHands binds for a run. */
|
|
@@ -52,8 +76,8 @@ export type RunHands = {
|
|
|
52
76
|
readonly shell: ShellPlace;
|
|
53
77
|
/** The computer's kinds whose tools the run gets, past files and a shell. */
|
|
54
78
|
readonly kinds: readonly CapabilityKind[];
|
|
55
|
-
/**
|
|
56
|
-
readonly
|
|
79
|
+
/** What the computer offers (its groups): which of the computer's tools are listed to the model. */
|
|
80
|
+
readonly groups: readonly string[];
|
|
57
81
|
readonly maxExecS: number;
|
|
58
82
|
/** The name the model knows the run's folder by: /workspace in a computer, the folder's own path otherwise. */
|
|
59
83
|
readonly cwd: string;
|
|
@@ -65,8 +89,13 @@ export type RunHands = {
|
|
|
65
89
|
readonly read: PiExecutor;
|
|
66
90
|
readonly write: PiExecutor;
|
|
67
91
|
readonly edit: PiExecutor;
|
|
68
|
-
readonly bash?: PiExecutor;
|
|
92
|
+
readonly bash?: PiExecutor; /** computer_script's run in serve's isolate, with a desktop or a phone. */
|
|
93
|
+
readonly computer_script?: Executor;
|
|
69
94
|
};
|
|
95
|
+
/** A desktop's or a phone's surface for a harness's own script runtime; none for any other computer. */
|
|
96
|
+
readonly computer?: Omit<ScriptComputer, "declare">;
|
|
97
|
+
/** A desktop's or a phone's surface, as its agent's setting says it (AgentComputer); absent, both. */
|
|
98
|
+
readonly surface?: AgentComputer["surface"];
|
|
70
99
|
/** The run's end, after its background processes are ended and before the computer is let go: bash's full outputs
|
|
71
100
|
* and its TMPDIR swept. */
|
|
72
101
|
sweep(): Promise<void>;
|
|
@@ -76,7 +105,7 @@ export type RunHands = {
|
|
|
76
105
|
* scratch folder), taken as the folder. `hold`: a person's hold on the computer (its take-over), given a desktop's or a
|
|
77
106
|
* phone's ports and answering them wrapped, so a call made while the person holds it waits, and an action then is
|
|
78
107
|
* refused; never the shell's, the files' or a browser's (its take-over is pi-browser's own). */
|
|
79
|
-
export declare function runHands(workspace: Workspace,
|
|
108
|
+
export declare function runHands(workspace: Workspace, claimed: RunComputer | undefined, options: {
|
|
80
109
|
readonly mode: 1 | 2;
|
|
81
110
|
readonly context: Context;
|
|
82
111
|
readonly aliases?: readonly string[];
|
|
@@ -123,14 +152,19 @@ export type RunTools = {
|
|
|
123
152
|
readonly hands: Hands;
|
|
124
153
|
/** Where the run's shell is (runHands' shell): its gate reads its defaults by it (tool-gate.ts defaultPermission). */
|
|
125
154
|
readonly shell: ShellPlace;
|
|
126
|
-
/** The tools the claimed computer brings by its kind, as its groups offer them: a desktop's
|
|
127
|
-
*
|
|
155
|
+
/** The tools the claimed computer brings by its kind, as its groups offer them: a desktop's or a phone's
|
|
156
|
+
* (computer_observe, computer_act, computer_screenshot, computer_script, computer_request_handoff), by the kernel
|
|
157
|
+
* registry's own list. None with no computer, for
|
|
128
158
|
* a sandbox, or for a browser (its own binding lists its tools). An agent names its computer, never these tools
|
|
129
|
-
* (definition.tools refuses them), so a run binds them beside what it was granted (withKindTools).
|
|
159
|
+
* (definition.tools refuses them), so a run binds them beside what it was granted (withKindTools). Its setting's
|
|
160
|
+
* surface keeps some of them (surfaceKeeps). */
|
|
130
161
|
readonly kindTools: readonly string[];
|
|
131
162
|
/** The registry's tools `names` names, as the kernel's HostTool an adapter's session takes, each call through the
|
|
132
163
|
* run's gate decided before its intent, each answer kept in `results` (bindTools). */
|
|
133
164
|
hostTools(names: readonly string[], results?: ToolResults): HostTool[];
|
|
165
|
+
/** A desktop's or a phone's surface for a harness's own script runtime (pi's code mode binds `computer` over it); none
|
|
166
|
+
* for any other computer, and none where the run has no script tool (a tools-only computer). */
|
|
167
|
+
readonly computer?: ScriptComputer;
|
|
134
168
|
/** The run's end, before the computer is let go: its background processes ended (TERM, then KILL 3 s later; none with
|
|
135
169
|
* no computer), then bash's full outputs and TMPDIR swept. */
|
|
136
170
|
end(): Promise<void>;
|
|
@@ -149,7 +183,8 @@ export declare function runTools(workspace: Workspace, computer: RunComputer | u
|
|
|
149
183
|
readonly context: Context;
|
|
150
184
|
readonly aliases?: readonly string[];
|
|
151
185
|
readonly hold?: RunHold;
|
|
152
|
-
readonly bashPolicy?: string;
|
|
186
|
+
readonly bashPolicy?: string; /** The harness has its own code mode that binds `computer` (pi). */
|
|
187
|
+
readonly codeMode?: boolean;
|
|
153
188
|
}): Promise<RunTools>;
|
|
154
189
|
/** The names a run binds as host tools: what it was granted, then the tools its claimed computer brings by its kind
|
|
155
190
|
* (RunTools.kindTools), each once. Each goes through the run's one gate under its own settings key (a desktop's under
|
|
@@ -1,11 +1,31 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { COMPUTER_TOOLS, createRegistry, endBackground, HANDOFF_TOOL, SCRIPT_TOOL } from "@parcha/agentrun-kernel/kernel";
|
|
2
|
+
import { createSurface } from "@parcha/agentrun-computer/surface";
|
|
3
|
+
import { portOf } from "./computer-ports.js";
|
|
4
|
+
import { computerScriptExecutor, ScriptGuard, scriptPreludeOf } from "./computer-script.js";
|
|
3
5
|
import { answerText, piExecutor } from "./executors.js";
|
|
4
6
|
import { ARCHIL_MAX_EXEC_S, handsOf, MAX_EXEC_S, shellEnv } from "./hands.js";
|
|
5
7
|
import { policyEnv, policyPrelude } from "../bash-read-only.js";
|
|
6
8
|
import { COMPUTER_ROOT, realOf, workspaceRelative } from "./paths.js";
|
|
7
9
|
import { bashTool, fileTools, OUTPUT_DIR, piEnv, readAnywhereInComputer } from "./pi-env.js";
|
|
8
|
-
import { shellPlaceOf } from "./resolve-computer.js";
|
|
10
|
+
import { noPrograms, shellPlaceOf } from "./resolve-computer.js";
|
|
11
|
+
/** The groups that run a program on a computer: what `exec: false` takes out of the agent's card. */
|
|
12
|
+
const PROGRAM_GROUPS = new Set(["exec", "processes"]);
|
|
13
|
+
/** `computer` as its agent may use it: with `exec: false`, its hello without the groups that run programs. */
|
|
14
|
+
function agentsOwn(computer) {
|
|
15
|
+
if (!noPrograms(computer))
|
|
16
|
+
return computer;
|
|
17
|
+
return { ...computer, hello: { ...computer.hello, groups: computer.hello.groups.filter((group) => !PROGRAM_GROUPS.has(group)) } };
|
|
18
|
+
}
|
|
19
|
+
/** Whether a computer's tool is listed for `surface`: the hand-over always; "tools", never a script tool; "code", only
|
|
20
|
+
* the script tool, and computer_script not even that where the harness has its own code mode (`codeMode`: pi's
|
|
21
|
+
* codemode binds `computer` and is its script tool); absent, every one. */
|
|
22
|
+
function surfaceKeeps(name, surface, codeMode) {
|
|
23
|
+
if (name === HANDOFF_TOOL || surface === undefined)
|
|
24
|
+
return true;
|
|
25
|
+
if (surface === "tools")
|
|
26
|
+
return name !== SCRIPT_TOOL;
|
|
27
|
+
return name === SCRIPT_TOOL && !codeMode;
|
|
28
|
+
}
|
|
9
29
|
/** The computer the run's folder is attached to, with its check: a sandbox, or a desktop with files and exec whose
|
|
10
30
|
* provider mounts the folder; none for any other. */
|
|
11
31
|
function mountedIn(computer) {
|
|
@@ -15,26 +35,14 @@ function mountedIn(computer) {
|
|
|
15
35
|
return { computer: computer.computer, check: computer.check };
|
|
16
36
|
return undefined;
|
|
17
37
|
}
|
|
18
|
-
/**
|
|
19
|
-
*
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
const input = groups.includes("input.pointer") || groups.includes("input.keys");
|
|
27
|
-
return screen && input ? { ports: { screen: screenOf(client), input: inputOf(client) }, kinds: ["desktop"], without: [] } : { ports: {}, kinds: [], without: [] };
|
|
28
|
-
}
|
|
29
|
-
if (computer?.kind === "phone") {
|
|
30
|
-
const { groups } = computer.hello;
|
|
31
|
-
if (!groups.includes("screen") || !groups.includes("input.touch"))
|
|
32
|
-
return { ports: {}, kinds: [], without: [] };
|
|
33
|
-
const tree = groups.includes("apps.ui_tree");
|
|
34
|
-
const keys = groups.includes("input.keys");
|
|
35
|
-
return { ports: { phone: phoneOf(computer.computer.client, { tree, keys }) }, kinds: ["phone"], without: [...(tree ? [] : ["phone_tree"]), ...(keys ? [] : ["phone_key"])] };
|
|
36
|
-
}
|
|
37
|
-
return { ports: {}, kinds: [], without: [] };
|
|
38
|
+
/** A desktop's or a phone's port, over its surface, the kind whose tools the run gets, its groups, and the script's
|
|
39
|
+
* executor for its card; none for any other computer. */
|
|
40
|
+
async function portsOf(computer, guard) {
|
|
41
|
+
if (computer?.kind !== "desktop" && computer?.kind !== "phone")
|
|
42
|
+
return { ports: {}, kinds: [], groups: [] };
|
|
43
|
+
const surface = createSurface(computer.computer.client, computer.hello);
|
|
44
|
+
const prelude = scriptPreludeOf(surface.card, noPrograms(computer) ? { exec: false } : {});
|
|
45
|
+
return { ports: { computer: portOf(surface) }, kinds: [computer.kind], groups: surface.card.groups, script: computerScriptExecutor(prelude, guard), card: surface.card, prelude };
|
|
38
46
|
}
|
|
39
47
|
/** The run's scratch in its own folder: bash's TMPDIR. */
|
|
40
48
|
export const TMP_DIR = ".agentrun/tmp";
|
|
@@ -43,13 +51,16 @@ export const TMP_DIR = ".agentrun/tmp";
|
|
|
43
51
|
* scratch folder), taken as the folder. `hold`: a person's hold on the computer (its take-over), given a desktop's or a
|
|
44
52
|
* phone's ports and answering them wrapped, so a call made while the person holds it waits, and an action then is
|
|
45
53
|
* refused; never the shell's, the files' or a browser's (its take-over is pi-browser's own). */
|
|
46
|
-
export async function runHands(workspace,
|
|
54
|
+
export async function runHands(workspace, claimed, options) {
|
|
47
55
|
// The folder's own path on this machine, Mode 1's bind. A Mode 2 folder (Archil) has none, and asking its mount would
|
|
48
56
|
// mint the run's mount credential: only a computer that mounts the folder asks it (attach, below).
|
|
49
57
|
const spec = options.mode === 1 ? await workspace.mountSpec() : undefined;
|
|
50
58
|
const here = spec?.kind === "bind" ? spec.path : undefined;
|
|
59
|
+
// The computer as its agent may use it: one with exec off has no group that runs a program, so nothing mounts the
|
|
60
|
+
// folder in it, and the run has no shell at all (no bash family, not even Archil's exec).
|
|
61
|
+
const computer = agentsOwn(claimed);
|
|
51
62
|
const mounted = mountedIn(computer);
|
|
52
|
-
const shell = shellPlaceOf(mounted !== undefined, options.mode);
|
|
63
|
+
const shell = noPrograms(computer) ? "none" : shellPlaceOf(mounted !== undefined, options.mode);
|
|
53
64
|
const attached = mounted === undefined ? workspace : await workspace.attach(mounted.computer, mounted.check);
|
|
54
65
|
// The folder's name: /workspace in a computer (and on Archil's exec, which has no path of this machine), its own path here.
|
|
55
66
|
const cwd = mounted === undefined && here !== undefined ? here : COMPUTER_ROOT;
|
|
@@ -66,9 +77,9 @@ export async function runHands(workspace, computer, options) {
|
|
|
66
77
|
const tools = Object.fromEntries([...fileTools(), bashTool()].map((tool) => [tool.name, tool]));
|
|
67
78
|
const read = mounted === undefined ? tools.read : readAnywhereInComputer(tools.read, attached, names, env);
|
|
68
79
|
const executor = (tool) => piExecutor(tool, fileEnv, options.context);
|
|
69
|
-
const
|
|
70
|
-
const
|
|
71
|
-
const { ports, kinds,
|
|
80
|
+
const guard = new ScriptGuard({ env: policyEnv(options.bashPolicy), prelude }, computer?.kind);
|
|
81
|
+
const own = await portsOf(computer, guard);
|
|
82
|
+
const { ports, kinds, groups, script, card, prelude: scriptPrelude } = options.hold !== undefined && own.ports.computer ? { ...own, ports: options.hold(own.ports) } : own;
|
|
72
83
|
return {
|
|
73
84
|
workspace: attached,
|
|
74
85
|
// The computer's processes, for the five background tools: the attached Workspace's own; none when the folder is not
|
|
@@ -76,11 +87,13 @@ export async function runHands(workspace, computer, options) {
|
|
|
76
87
|
hands: { ...handsOf(attached, { maxExecS, env, ...(prelude ? { prelude } : {}), ...network, ...(mounted === undefined ? {} : { processes: attached.process }) }), ...ports },
|
|
77
88
|
shell,
|
|
78
89
|
kinds,
|
|
79
|
-
|
|
90
|
+
groups,
|
|
80
91
|
maxExecS,
|
|
81
92
|
cwd,
|
|
82
93
|
names,
|
|
83
|
-
executors: { read: executor(read), write: executor(tools.write), edit: executor(tools.edit), ...(shell === "none" ? {} : { bash: executor(tools.bash) }) },
|
|
94
|
+
executors: { read: executor(read), write: executor(tools.write), edit: executor(tools.edit), ...(shell === "none" ? {} : { bash: executor(tools.bash) }), ...(script ? { computer_script: script } : {}) },
|
|
95
|
+
...(card && scriptPrelude && ports.computer ? { computer: { card, port: ports.computer, guard, prelude: scriptPrelude } } : {}),
|
|
96
|
+
...((computer?.kind === "desktop" || computer?.kind === "phone") && computer.surface ? { surface: computer.surface } : {}),
|
|
84
97
|
async sweep() {
|
|
85
98
|
// Through the run's own Workspace, not the computer's: the sweep holds whether or not the computer still answers.
|
|
86
99
|
for (const dir of [OUTPUT_DIR, TMP_DIR])
|
|
@@ -124,7 +137,9 @@ export function bindTools(run, registry, names, options = {}) {
|
|
|
124
137
|
const isError = given.isError === true || given.error !== undefined;
|
|
125
138
|
const answer = { text: isError || SAYS_PATH.has(name) ? workspaceRelative(said, works) : said, isError };
|
|
126
139
|
options.results?.set(callId, answer);
|
|
127
|
-
|
|
140
|
+
// A computer tool's value beside its words: what a script's nested call reads (Codex's code mode), and an MCP
|
|
141
|
+
// client's structuredContent.
|
|
142
|
+
return { ...answer, ...(given.images?.length ? { images: given.images } : {}), ...(given.structured !== undefined && !isError ? { structured: given.structured } : {}) };
|
|
128
143
|
},
|
|
129
144
|
}];
|
|
130
145
|
});
|
|
@@ -140,15 +155,21 @@ export function bindTools(run, registry, names, options = {}) {
|
|
|
140
155
|
*/
|
|
141
156
|
export async function runTools(workspace, computer, options) {
|
|
142
157
|
const run = await runHands(workspace, computer, options);
|
|
143
|
-
const registry = createRegistry({ maxExecS: run.maxExecS, shell: run.shell, kinds: run.kinds,
|
|
144
|
-
const brought = new Set(
|
|
158
|
+
const registry = createRegistry({ maxExecS: run.maxExecS, shell: run.shell, kinds: run.kinds, groups: run.groups, executors: run.executors });
|
|
159
|
+
const brought = new Set(COMPUTER_TOOLS);
|
|
160
|
+
const codeMode = options.codeMode === true;
|
|
161
|
+
const kindTools = registry.list().map((def) => def.name).filter((name) => brought.has(name) && surfaceKeeps(name, run.surface, codeMode));
|
|
162
|
+
// The script runtime, where the run has a script tool: computer_script listed, or the harness's own code mode on a
|
|
163
|
+
// surface that has scripts. A tools-only computer has none, so a code-mode harness binds no `computer`.
|
|
164
|
+
const scripts = kindTools.includes(SCRIPT_TOOL) || (codeMode && run.surface !== "tools");
|
|
145
165
|
return {
|
|
146
166
|
workspace: run.workspace,
|
|
147
167
|
registry,
|
|
148
168
|
hands: run.hands,
|
|
149
169
|
shell: run.shell,
|
|
150
|
-
kindTools
|
|
170
|
+
kindTools,
|
|
151
171
|
hostTools: (names, results) => bindTools(run, registry, names, results ? { results } : {}),
|
|
172
|
+
...(run.computer && scripts ? { computer: { ...run.computer, declare: !kindTools.includes(SCRIPT_TOOL) } } : {}),
|
|
152
173
|
async end() {
|
|
153
174
|
await endBackground(run.hands);
|
|
154
175
|
await run.sweep();
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/** What a call reads once its run's cap is nearly taken: the same words every time, never a count the model could argue with. */
|
|
2
|
+
export declare const WRAP_UP_TEXT = "Budget nearly spent: stop calling tools and answer now from what you have.";
|
|
3
|
+
/** A main-model request's figures as the cap prices them (kernel cap requestFigures): its answer at its least, its step-0
|
|
4
|
+
* typical cost, and its worst (its full asked output). */
|
|
5
|
+
export type RequestFigures = {
|
|
6
|
+
readonly leastUsd: number;
|
|
7
|
+
readonly step0Usd: number;
|
|
8
|
+
readonly worstUsd: number;
|
|
9
|
+
};
|
|
10
|
+
/** What a run keeps back of its cap so it can still answer: one typical step and one final answer at its least. The
|
|
11
|
+
* typical step is the run's own priced answers' typical cost (the wrap-up note's figure, kernel cap typicalCost; before
|
|
12
|
+
* any is priced, the step-0 cost of the request), the answer the cap's least for the main model's next request.
|
|
13
|
+
* Undefined when the request cannot be priced. The rule's one place: keeping back one final answer at its worst case
|
|
14
|
+
* instead would be `figures.worstUsd`, and a worst step and a least answer `figures.worstUsd + figures.leastUsd`. */
|
|
15
|
+
export declare const reserveFor: (figures: RequestFigures | undefined, typical: (step0Usd: number) => number) => number | undefined;
|
|
16
|
+
/** Whether a run under `capUsd` that has taken `takenUsd` wraps up. `takenUsd`: its spend and every step still out at its
|
|
17
|
+
* worst case, as the cap counts them (null: unknown). It wraps up once what it keeps back to answer (`reserveUsd`,
|
|
18
|
+
* reserveFor) no longer fits on top: in flight is reserved as it stands, so a fan-out keeps room for each conversation to
|
|
19
|
+
* answer, and a simple run uses its cap up to its last step and answer. No cap, a figure no one knows (the cap refuses
|
|
20
|
+
* the next request for that), or no reserve yet (no main-model request priced on this claim) is no. */
|
|
21
|
+
export declare const wrappingUp: (capUsd: number | undefined, takenUsd: number | null, reserveUsd: number | undefined) => boolean;
|
package/dist/wrap-up.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// The cap's wrap-up: a run with a cap whose spend, plus what its requests and paid steps still out hold at their worst
|
|
2
|
+
// case, leaves too little to keep back one typical step and one final answer (reserveFor) has every model-issued tool
|
|
3
|
+
// call refused before its intent, in WRAP_UP_TEXT, on every harness and in every conversation of the run (a `subagent`
|
|
4
|
+
// spawn is a call too). Nothing in flight is cut, and model requests are not touched: each conversation answers from what
|
|
5
|
+
// it has, under the cap, which stays the last line. The figure is read from the run's committed booking records at each
|
|
6
|
+
// call (the cap's own: a request still out counts at its hold and bound, one a lost claim cut the same), so a restart or a
|
|
7
|
+
// moved claim reads the same figure, and a raise of the cap ends the wrap-up from its next call.
|
|
8
|
+
/** What a call reads once its run's cap is nearly taken: the same words every time, never a count the model could argue with. */
|
|
9
|
+
export const WRAP_UP_TEXT = "Budget nearly spent: stop calling tools and answer now from what you have.";
|
|
10
|
+
/** What a run keeps back of its cap so it can still answer: one typical step and one final answer at its least. The
|
|
11
|
+
* typical step is the run's own priced answers' typical cost (the wrap-up note's figure, kernel cap typicalCost; before
|
|
12
|
+
* any is priced, the step-0 cost of the request), the answer the cap's least for the main model's next request.
|
|
13
|
+
* Undefined when the request cannot be priced. The rule's one place: keeping back one final answer at its worst case
|
|
14
|
+
* instead would be `figures.worstUsd`, and a worst step and a least answer `figures.worstUsd + figures.leastUsd`. */
|
|
15
|
+
export const reserveFor = (figures, typical) => figures === undefined ? undefined : typical(figures.step0Usd) + figures.leastUsd;
|
|
16
|
+
/** Whether a run under `capUsd` that has taken `takenUsd` wraps up. `takenUsd`: its spend and every step still out at its
|
|
17
|
+
* worst case, as the cap counts them (null: unknown). It wraps up once what it keeps back to answer (`reserveUsd`,
|
|
18
|
+
* reserveFor) no longer fits on top: in flight is reserved as it stands, so a fan-out keeps room for each conversation to
|
|
19
|
+
* answer, and a simple run uses its cap up to its last step and answer. No cap, a figure no one knows (the cap refuses
|
|
20
|
+
* the next request for that), or no reserve yet (no main-model request priced on this claim) is no. */
|
|
21
|
+
export const wrappingUp = (capUsd, takenUsd, reserveUsd) => capUsd !== undefined && takenUsd !== null && reserveUsd !== undefined && Number.isFinite(takenUsd) && Number.isFinite(reserveUsd) && takenUsd + reserveUsd > capUsd;
|
package/launcher/agentrun-serve
CHANGED
|
@@ -82,8 +82,10 @@ if [ -n "$locale_set" ]; then LC_ALL=$locale; else unset LC_ALL; fi
|
|
|
82
82
|
if [ "${1-}" = "--" ]; then
|
|
83
83
|
shift
|
|
84
84
|
else
|
|
85
|
-
# The server beside this launcher, found by node from this file's real path: a package manager's bin is a link.
|
|
86
|
-
|
|
85
|
+
# The server beside this launcher, found by node from this file's real path: a package manager's bin is a link. The
|
|
86
|
+
# code is CommonJS (no --input-type): a worker thread inherits its process's flags, and Node refuses a worker from a
|
|
87
|
+
# file that inherits --input-type, as a codemode script's sandbox is.
|
|
88
|
+
set -- node -e 'const { realpathSync } = require("node:fs"); const { pathToFileURL } = require("node:url"); const cli = new URL("../dist/cli.js", pathToFileURL(realpathSync(process.argv[1]))); process.argv[1] = cli.pathname; import(cli.href).catch((error) => { process.exitCode = 1; console.error(error); });' "$0" "$@"
|
|
87
89
|
fi
|
|
88
90
|
set -- AGENTRUN_SECRETS_FD=3 "AGENTRUN_SECRETS_LEN=$total" "$@"
|
|
89
91
|
for name in $SECRETS; do
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@parcha/agentrun-serve",
|
|
3
|
-
"version": "0.1.0-beta.
|
|
3
|
+
"version": "0.1.0-beta.38",
|
|
4
4
|
"description": "The AgentRun server: the /v2 API and console over one store, with runners that run your agents; the deployable process of the AgentRun platform.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agentrun",
|
|
@@ -49,18 +49,19 @@
|
|
|
49
49
|
"test:pg": "node scripts/test-pg.mjs"
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@earendil-works/pi-agent-core": "1.5.
|
|
53
|
-
"@earendil-works/pi-
|
|
52
|
+
"@earendil-works/pi-agent-core": "1.5.2",
|
|
53
|
+
"@earendil-works/pi-codemode": "1.5.2",
|
|
54
|
+
"@earendil-works/pi-coding-agent": "1.5.2",
|
|
54
55
|
"@modelcontextprotocol/client": "2.4.0",
|
|
55
56
|
"@modelcontextprotocol/server": "2.4.0",
|
|
56
|
-
"@parcha/agentrun-computer": "0.1.0-beta.
|
|
57
|
-
"@parcha/agentrun-decisions": "0.1.0-beta.
|
|
58
|
-
"@parcha/agentrun-dsl": "0.1.0-beta.
|
|
59
|
-
"@parcha/agentrun-harness-claude": "0.1.0-beta.
|
|
60
|
-
"@parcha/agentrun-harness-codex": "0.1.0-beta.
|
|
61
|
-
"@parcha/agentrun-jev": "0.1.0-beta.
|
|
62
|
-
"@parcha/agentrun-kernel": "0.1.0-beta.
|
|
63
|
-
"@parcha/pi-browser": "0.1.0-beta.
|
|
57
|
+
"@parcha/agentrun-computer": "0.1.0-beta.38",
|
|
58
|
+
"@parcha/agentrun-decisions": "0.1.0-beta.38",
|
|
59
|
+
"@parcha/agentrun-dsl": "0.1.0-beta.38",
|
|
60
|
+
"@parcha/agentrun-harness-claude": "0.1.0-beta.38",
|
|
61
|
+
"@parcha/agentrun-harness-codex": "0.1.0-beta.38",
|
|
62
|
+
"@parcha/agentrun-jev": "0.1.0-beta.38",
|
|
63
|
+
"@parcha/agentrun-kernel": "0.1.0-beta.38",
|
|
64
|
+
"@parcha/pi-browser": "0.1.0-beta.38",
|
|
64
65
|
"@secretlint/core": "13.1.0",
|
|
65
66
|
"@secretlint/profiler": "13.1.0",
|
|
66
67
|
"@secretlint/secretlint-rule-preset-recommend": "13.1.0",
|
|
@@ -71,12 +72,13 @@
|
|
|
71
72
|
"proxy-addr": "2.0.8",
|
|
72
73
|
"typebox": "1.3.27",
|
|
73
74
|
"undici": "^8.12.2",
|
|
75
|
+
"ws": "8.21.0",
|
|
74
76
|
"yaml": "2.9.0"
|
|
75
77
|
},
|
|
76
78
|
"peerDependencies": {
|
|
77
|
-
"@earendil-works/chord": "1.5.
|
|
79
|
+
"@earendil-works/chord": "1.5.2",
|
|
78
80
|
"@earendil-works/pi-ai": "*",
|
|
79
|
-
"@earendil-works/pi-durable": "1.5.
|
|
81
|
+
"@earendil-works/pi-durable": "1.5.2",
|
|
80
82
|
"opencode-ai": "1.19.5"
|
|
81
83
|
},
|
|
82
84
|
"peerDependenciesMeta": {
|
|
@@ -85,11 +87,12 @@
|
|
|
85
87
|
}
|
|
86
88
|
},
|
|
87
89
|
"devDependencies": {
|
|
88
|
-
"@earendil-works/chord": "1.5.
|
|
89
|
-
"@earendil-works/pi-ai": "1.5.
|
|
90
|
-
"@earendil-works/pi-durable": "1.5.
|
|
90
|
+
"@earendil-works/chord": "1.5.2",
|
|
91
|
+
"@earendil-works/pi-ai": "1.5.2",
|
|
92
|
+
"@earendil-works/pi-durable": "1.5.2",
|
|
91
93
|
"@types/pg": "8.23.1",
|
|
92
94
|
"@types/proxy-addr": "2.0.3",
|
|
95
|
+
"@types/ws": "8.18.2",
|
|
93
96
|
"opencode-ai": "1.19.5"
|
|
94
97
|
},
|
|
95
98
|
"repository": {
|