@parcha/agentrun-serve 0.1.0-beta.31 → 0.1.0-beta.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +459 -0
- package/NOTICE +18 -0
- package/README.md +941 -263
- package/dist/adapter-facts.d.ts +3 -0
- package/dist/adapter-facts.js +5 -0
- package/dist/adapters.d.ts +64 -143
- package/dist/adapters.js +153 -384
- package/dist/agents-store.d.ts +146 -0
- package/dist/agents-store.js +359 -0
- package/dist/agents.d.ts +4 -2
- package/dist/agents.js +37 -17
- package/dist/api-only.d.ts +14 -0
- package/dist/api-only.js +33 -0
- package/dist/approvals.d.ts +4 -0
- package/dist/approvals.js +7 -0
- package/dist/archil-routes.d.ts +45 -0
- package/dist/archil-routes.js +150 -0
- package/dist/archil-settings.d.ts +30 -0
- package/dist/archil-settings.js +34 -0
- package/dist/background.js +28 -9
- package/dist/box-egress-vm.d.ts +2 -9
- package/dist/box-egress-vm.js +20 -16
- package/dist/box-egress.d.ts +15 -9
- package/dist/box-egress.js +26 -29
- package/dist/box-paths.d.ts +82 -0
- package/dist/box-paths.js +160 -0
- package/dist/box-relay-vm.js +28 -1
- package/dist/box-relay.d.ts +1 -10
- package/dist/box-relay.js +1 -21
- package/dist/box-settings.d.ts +46 -0
- package/dist/box-settings.js +107 -0
- package/dist/boxes.d.ts +17 -2
- package/dist/boxes.js +37 -3
- package/dist/browser-commands.d.ts +43 -0
- package/dist/browser-commands.js +154 -0
- package/dist/browser-cost.d.ts +30 -3
- package/dist/browser-cost.js +277 -21
- package/dist/browser-live.d.ts +124 -0
- package/dist/browser-live.js +324 -0
- package/dist/browser-person.d.ts +166 -0
- package/dist/browser-person.js +767 -0
- package/dist/budget.d.ts +76 -0
- package/dist/budget.js +204 -0
- package/dist/cap.d.ts +267 -64
- package/dist/cap.js +587 -199
- package/dist/cli.js +220 -21
- package/dist/coding-tools.d.ts +13 -1
- package/dist/coding-tools.js +107 -5
- package/dist/computer-adb.d.ts +12 -0
- package/dist/computer-adb.js +14 -0
- package/dist/computer-commands.d.ts +103 -0
- package/dist/computer-commands.js +256 -0
- package/dist/computer-keys.d.ts +68 -0
- package/dist/computer-keys.js +148 -0
- package/dist/computer-routes.d.ts +38 -0
- package/dist/computer-routes.js +56 -0
- package/dist/computer-setting.d.ts +37 -0
- package/dist/computer-setting.js +47 -0
- package/dist/computer-view.d.ts +38 -0
- package/dist/computer-view.js +14 -0
- package/dist/computers.d.ts +137 -0
- package/dist/computers.js +197 -0
- package/dist/console/THIRD-PARTY-NOTICES.txt +25 -0
- package/dist/console/assets/index-Dn0ngwG9.js +535 -0
- package/dist/console/assets/index-DvW6Aled.css +1 -0
- package/dist/console/index.html +2 -2
- package/dist/console-links.d.ts +2 -0
- package/dist/console-links.js +6 -0
- package/dist/daytona-api.d.ts +0 -11
- package/dist/daytona-api.js +1 -82
- package/dist/decision-cap.d.ts +63 -0
- package/dist/decision-cap.js +163 -0
- package/dist/decision-rows.d.ts +5 -2
- package/dist/decision-rows.js +8 -6
- package/dist/decisions.d.ts +28 -1
- package/dist/decisions.js +63 -6
- package/dist/docker-host-addresses.d.ts +37 -0
- package/dist/docker-host-addresses.js +110 -0
- package/dist/egress-proxy.d.ts +45 -0
- package/dist/egress-proxy.js +416 -0
- package/dist/egress-table.d.ts +24 -0
- package/dist/egress-table.js +165 -0
- package/dist/errors.d.ts +15 -0
- package/dist/errors.js +22 -2
- package/dist/exa-keyless.js +1 -1
- package/dist/explain.d.ts +22 -0
- package/dist/explain.js +207 -0
- package/dist/faux-computers.d.ts +35 -0
- package/dist/faux-computers.js +126 -0
- package/dist/file-types.d.ts +4 -0
- package/dist/file-types.js +11 -0
- package/dist/files.d.ts +3 -43
- package/dist/files.js +8 -136
- package/dist/github-connection.d.ts +207 -0
- package/dist/github-connection.js +595 -0
- package/dist/github.d.ts +64 -0
- package/dist/github.js +119 -0
- package/dist/grade.d.ts +9 -42
- package/dist/grade.js +42 -228
- package/dist/graph-served.d.ts +23 -2
- package/dist/graph-served.js +44 -3
- package/dist/graph-view.d.ts +7 -3
- package/dist/graph-view.js +26 -15
- package/dist/handed-values.d.ts +23 -0
- package/dist/handed-values.js +36 -0
- package/dist/harness-install.d.ts +143 -0
- package/dist/harness-install.js +454 -0
- package/dist/harness-opencode/adapter.js +42 -8
- package/dist/harness-opencode/facts.d.ts +2 -0
- package/dist/harness-opencode/facts.js +28 -0
- package/dist/harness-opencode/harness.d.ts +4 -0
- package/dist/harness-opencode/harness.js +38 -5
- package/dist/harness-opencode/host/policy.js +11 -3
- package/dist/harness-opencode/transcript.d.ts +25 -0
- package/dist/harness-opencode/transcript.js +81 -0
- package/dist/harness-table.d.ts +75 -0
- package/dist/harness-table.js +145 -0
- package/dist/harness.d.ts +11 -31
- package/dist/harness.js +30 -41
- package/dist/heard.d.ts +12 -0
- package/dist/heard.js +45 -0
- package/dist/helper-env.d.ts +4 -0
- package/dist/helper-env.js +14 -0
- package/dist/home-path.d.ts +0 -4
- package/dist/home-path.js +3 -17
- package/dist/host-check.d.ts +4 -3
- package/dist/host-check.js +5 -4
- package/dist/host-tools.d.ts +51 -8
- package/dist/host-tools.js +108 -117
- package/dist/host.d.ts +12 -6
- package/dist/host.js +30 -24
- package/dist/hosted-search.d.ts +3 -0
- package/dist/hosted-search.js +5 -3
- package/dist/import-proxy.d.ts +42 -0
- package/dist/import-proxy.js +105 -0
- package/dist/import-summary.js +4 -8
- package/dist/import-worker.d.ts +2 -3
- package/dist/import-worker.js +18 -16
- package/dist/import.d.ts +37 -17
- package/dist/import.js +249 -224
- package/dist/key-meta.d.ts +26 -0
- package/dist/key-meta.js +30 -0
- package/dist/key-refusal.d.ts +4 -1
- package/dist/key-refusal.js +20 -7
- package/dist/learn/check.d.ts +3 -1
- package/dist/learn/check.js +2 -2
- package/dist/learn/commit.d.ts +86 -0
- package/dist/learn/commit.js +182 -0
- package/dist/learn/folder.d.ts +296 -0
- package/dist/learn/folder.js +796 -0
- package/dist/learn/grade.d.ts +22 -9
- package/dist/learn/grade.js +95 -49
- package/dist/learn/index.d.ts +2 -2
- package/dist/learn/index.js +2 -2
- package/dist/learn/learning.sh +366 -0
- package/dist/learn/reflect.d.ts +12 -5
- package/dist/learn/reflect.js +70 -41
- package/dist/learn/secrets.d.ts +16 -7
- package/dist/learn/secrets.js +80 -17
- package/dist/learn/seed-check.d.ts +74 -0
- package/dist/learn/seed-check.js +103 -0
- package/dist/learn/skills.d.ts +5 -1
- package/dist/learn/skills.js +5 -4
- package/dist/learned-workflow.d.ts +15 -4
- package/dist/learned-workflow.js +13 -6
- package/dist/learning-routes.d.ts +56 -46
- package/dist/learning-routes.js +350 -553
- package/dist/learning-run.d.ts +8 -228
- package/dist/learning-run.js +26 -713
- package/dist/learning-words.d.ts +3 -5
- package/dist/learning-words.js +3 -5
- package/dist/learning.d.ts +177 -112
- package/dist/learning.js +289 -380
- package/dist/live/stream.d.ts +30 -0
- package/dist/live/stream.js +175 -0
- package/dist/live/translate.d.ts +52 -0
- package/dist/live/translate.js +276 -0
- package/dist/llm.js +3 -0
- package/dist/llms.txt +1 -0
- package/dist/local-models.d.ts +23 -0
- package/dist/local-models.js +35 -0
- package/dist/mcp-gateway.d.ts +45 -15
- package/dist/mcp-gateway.js +140 -53
- package/dist/mcp-meta.d.ts +3 -0
- package/dist/mcp-meta.js +14 -2
- package/dist/mcp-oauth.d.ts +172 -0
- package/dist/mcp-oauth.js +403 -0
- package/dist/mcp-private-hosts.d.ts +48 -0
- package/dist/mcp-private-hosts.js +141 -0
- package/dist/mcp-probe.d.ts +101 -0
- package/dist/mcp-probe.js +359 -0
- package/dist/mcp-secret-writes.d.ts +23 -0
- package/dist/mcp-secret-writes.js +60 -0
- package/dist/mcp-servers-store.d.ts +251 -0
- package/dist/mcp-servers-store.js +447 -0
- package/dist/mcp-servers.d.ts +180 -50
- package/dist/mcp-servers.js +284 -321
- package/dist/mcp-store.d.ts +103 -0
- package/dist/mcp-store.js +123 -0
- package/dist/mcp.js +22 -21
- package/dist/model.d.ts +77 -59
- package/dist/model.js +237 -98
- package/dist/monid.d.ts +8 -6
- package/dist/monid.js +39 -25
- package/dist/openapi.d.ts +22 -1
- package/dist/openapi.js +921 -110
- package/dist/owner.d.ts +46 -10
- package/dist/owner.js +123 -43
- package/dist/page.d.ts +10 -0
- package/dist/page.js +29 -4
- package/dist/paid-calls.d.ts +71 -2
- package/dist/paid-calls.js +127 -6
- package/dist/pause.d.ts +0 -2
- package/dist/pause.js +1 -8
- package/dist/pdf-pages.d.ts +16 -14
- package/dist/pdf-pages.js +88 -58
- package/dist/place.d.ts +15 -18
- package/dist/place.js +25 -25
- package/dist/port-models.d.ts +53 -0
- package/dist/port-models.js +93 -0
- package/dist/print.d.ts +2 -1
- package/dist/print.js +4 -2
- package/dist/propose.d.ts +9 -8
- package/dist/propose.js +82 -49
- package/dist/provider.d.ts +85 -0
- package/dist/provider.js +178 -0
- package/dist/push-handler.d.ts +52 -0
- package/dist/push-handler.js +165 -0
- package/dist/refusal-words.d.ts +23 -0
- package/dist/refusal-words.js +25 -0
- package/dist/result.d.ts +13 -2
- package/dist/result.js +4 -5
- package/dist/run-computer.d.ts +24 -0
- package/dist/run-computer.js +15 -0
- package/dist/run-cut.d.ts +33 -0
- package/dist/run-cut.js +42 -0
- package/dist/run-db.d.ts +62 -0
- package/dist/run-db.js +151 -0
- package/dist/run-files.d.ts +31 -0
- package/dist/run-files.js +125 -0
- package/dist/run-launch.d.ts +72 -0
- package/dist/run-launch.js +108 -0
- package/dist/run-learning-served.d.ts +81 -0
- package/dist/run-learning-served.js +25 -0
- package/dist/run-manifest.d.ts +7 -6
- package/dist/run-manifest.js +20 -10
- package/dist/run-reads-over-store.d.ts +102 -0
- package/dist/run-reads-over-store.js +151 -0
- package/dist/run-secrets.d.ts +33 -0
- package/dist/run-secrets.js +53 -0
- package/dist/run-timeline-served.d.ts +13 -0
- package/dist/run-timeline-served.js +72 -0
- package/dist/run-view.d.ts +432 -0
- package/dist/run-view.js +602 -0
- package/dist/runnable.d.ts +30 -5
- package/dist/runnable.js +149 -72
- package/dist/runner/adapter-loop.d.ts +243 -0
- package/dist/runner/adapter-loop.js +1657 -0
- package/dist/runner/adapter-run-spec.d.ts +224 -0
- package/dist/runner/adapter-run-spec.js +538 -0
- package/dist/runner/adapters/index.d.ts +37 -0
- package/dist/runner/adapters/index.js +66 -0
- package/dist/runner/adapters/pi.d.ts +103 -0
- package/dist/runner/adapters/pi.js +263 -0
- package/dist/runner/beside.d.ts +12 -0
- package/dist/runner/beside.js +41 -0
- package/dist/runner/claim-secrets.d.ts +30 -0
- package/dist/runner/claim-secrets.js +90 -0
- package/dist/runner/cli-run-spec.d.ts +17 -0
- package/dist/runner/cli-run-spec.js +385 -0
- package/dist/runner/commands.d.ts +23 -0
- package/dist/runner/commands.js +67 -0
- package/dist/runner/computer-journal.d.ts +38 -0
- package/dist/runner/computer-journal.js +120 -0
- package/dist/runner/conformance/child.d.ts +1 -0
- package/dist/runner/conformance/child.js +78 -0
- package/dist/runner/conformance/harness.d.ts +89 -0
- package/dist/runner/conformance/harness.js +928 -0
- package/dist/runner/conformance/subject.d.ts +83 -0
- package/dist/runner/conformance/subject.js +1 -0
- package/dist/runner/dispatch.d.ts +30 -0
- package/dist/runner/dispatch.js +99 -0
- package/dist/runner/end-of-run.d.ts +32 -0
- package/dist/runner/end-of-run.js +56 -0
- package/dist/runner/github-app.d.ts +16 -0
- package/dist/runner/github-app.js +37 -0
- package/dist/runner/hand-back.d.ts +43 -0
- package/dist/runner/hand-back.js +69 -0
- package/dist/runner/harness-loops.d.ts +10 -0
- package/dist/runner/harness-loops.js +70 -0
- package/dist/runner/journal-kinds.d.ts +217 -0
- package/dist/runner/journal-kinds.js +116 -0
- package/dist/runner/journal-reader.d.ts +44 -0
- package/dist/runner/journal-reader.js +127 -0
- package/dist/runner/learning-ask.d.ts +37 -0
- package/dist/runner/learning-ask.js +99 -0
- package/dist/runner/learning-dispatch.d.ts +38 -0
- package/dist/runner/learning-dispatch.js +75 -0
- package/dist/runner/learning-end.d.ts +31 -0
- package/dist/runner/learning-end.js +136 -0
- package/dist/runner/learning-factory.d.ts +13 -0
- package/dist/runner/learning-factory.js +37 -0
- package/dist/runner/learning-loop.d.ts +150 -0
- package/dist/runner/learning-loop.js +246 -0
- package/dist/runner/learning-seed.d.ts +30 -0
- package/dist/runner/learning-seed.js +41 -0
- package/dist/runner/live-ticker.d.ts +18 -0
- package/dist/runner/live-ticker.js +112 -0
- package/dist/runner/loop-contract.d.ts +154 -0
- package/dist/runner/loop-contract.js +26 -0
- package/dist/runner/loop.d.ts +79 -0
- package/dist/runner/loop.js +185 -0
- package/dist/runner/main.d.ts +96 -0
- package/dist/runner/main.js +311 -0
- package/dist/runner/mcp-claim.d.ts +67 -0
- package/dist/runner/mcp-claim.js +403 -0
- package/dist/runner/mcp-github.d.ts +53 -0
- package/dist/runner/mcp-github.js +91 -0
- package/dist/runner/mcp-run.d.ts +116 -0
- package/dist/runner/mcp-run.js +152 -0
- package/dist/runner/metrics.d.ts +18 -0
- package/dist/runner/metrics.js +24 -0
- package/dist/runner/model-route.d.ts +111 -0
- package/dist/runner/model-route.js +202 -0
- package/dist/runner/pi-stop.d.ts +6 -0
- package/dist/runner/pi-stop.js +8 -0
- package/dist/runner/redact.d.ts +32 -0
- package/dist/runner/redact.js +60 -0
- package/dist/runner/reflect-hook.d.ts +81 -0
- package/dist/runner/reflect-hook.js +111 -0
- package/dist/runner/runner.d.ts +114 -0
- package/dist/runner/runner.js +672 -0
- package/dist/runner/sessions.d.ts +9 -0
- package/dist/runner/sessions.js +145 -0
- package/dist/runner/side-effects.d.ts +19 -0
- package/dist/runner/side-effects.js +20 -0
- package/dist/runner/spec-holds.d.ts +41 -0
- package/dist/runner/spec-holds.js +58 -0
- package/dist/runner/store-port.d.ts +9 -0
- package/dist/runner/store-port.js +7 -0
- package/dist/runner/store-secrets.d.ts +11 -0
- package/dist/runner/store-secrets.js +105 -0
- package/dist/runner/workflow-adapters.d.ts +1 -0
- package/dist/runner/workflow-adapters.js +4 -0
- package/dist/runner/workflow-host.d.ts +88 -0
- package/dist/runner/workflow-host.js +66 -0
- package/dist/runner/workflow-loop.d.ts +126 -0
- package/dist/runner/workflow-loop.js +372 -0
- package/dist/runner/workflow-spec.d.ts +157 -0
- package/dist/runner/workflow-spec.js +797 -0
- package/dist/runs-over-store.d.ts +203 -0
- package/dist/runs-over-store.js +407 -0
- package/dist/seal-key.d.ts +69 -0
- package/dist/seal-key.js +329 -0
- package/dist/sealed-settings-store.d.ts +71 -0
- package/dist/sealed-settings-store.js +205 -0
- package/dist/sealed-settings.d.ts +60 -0
- package/dist/sealed-settings.js +171 -0
- package/dist/secret-writes.d.ts +147 -0
- package/dist/secret-writes.js +144 -0
- package/dist/secrets.d.ts +7 -8
- package/dist/secrets.js +24 -5
- package/dist/server-approvers.d.ts +8 -0
- package/dist/server-approvers.js +12 -0
- package/dist/server-fs.d.ts +40 -0
- package/dist/server-fs.js +138 -0
- package/dist/server-keys.d.ts +18 -0
- package/dist/server-keys.js +31 -0
- package/dist/server-lock.js +1 -1
- package/dist/server-secrets-store.d.ts +18 -0
- package/dist/server-secrets-store.js +54 -0
- package/dist/server-secrets.d.ts +23 -0
- package/dist/server-secrets.js +76 -0
- package/dist/server.d.ts +148 -75
- package/dist/server.js +1740 -605
- package/dist/sessions.d.ts +3 -1
- package/dist/sessions.js +8 -4
- package/dist/sign-ins-secrets.d.ts +35 -0
- package/dist/sign-ins-secrets.js +109 -0
- package/dist/sign-ins-store.d.ts +200 -0
- package/dist/sign-ins-store.js +373 -0
- package/dist/sign-ins.d.ts +43 -7
- package/dist/sign-ins.js +94 -18
- package/dist/skills.d.ts +6 -5
- package/dist/skills.js +18 -14
- package/dist/standard-webhooks.d.ts +30 -0
- package/dist/standard-webhooks.js +72 -0
- package/dist/stats.d.ts +5 -7
- package/dist/stats.js +8 -24
- package/dist/stop-signals.d.ts +22 -0
- package/dist/stop-signals.js +38 -0
- package/dist/store/agent-body.d.ts +103 -0
- package/dist/store/agent-body.js +126 -0
- package/dist/store/dialect.d.ts +59 -0
- package/dist/store/dialect.js +32 -0
- package/dist/store/fence.d.ts +22 -0
- package/dist/store/fence.js +15 -0
- package/dist/store/index.d.ts +17 -0
- package/dist/store/index.js +17 -0
- package/dist/store/journal/storage.d.ts +137 -0
- package/dist/store/journal/storage.js +1021 -0
- package/dist/store/open.d.ts +44 -0
- package/dist/store/open.js +50 -0
- package/dist/store/postgres/connection.d.ts +74 -0
- package/dist/store/postgres/connection.js +532 -0
- package/dist/store/postgres/dialect.d.ts +9 -0
- package/dist/store/postgres/dialect.js +39 -0
- package/dist/store/postgres/migrate.d.ts +21 -0
- package/dist/store/postgres/migrate.js +123 -0
- package/dist/store/postgres/migrations/0001_initial.sql +418 -0
- package/dist/store/postgres/migrations/0002_external_agents.sql +14 -0
- package/dist/store/postgres/store.d.ts +37 -0
- package/dist/store/postgres/store.js +48 -0
- package/dist/store/prompts.d.ts +11 -0
- package/dist/store/prompts.js +112 -0
- package/dist/store/schema.d.ts +26 -0
- package/dist/store/schema.js +522 -0
- package/dist/store/seal.d.ts +48 -0
- package/dist/store/seal.js +69 -0
- package/dist/store/sqlite/connection.d.ts +105 -0
- package/dist/store/sqlite/connection.js +309 -0
- package/dist/store/sqlite/memory.d.ts +2 -0
- package/dist/store/sqlite/memory.js +4 -0
- package/dist/store/sqlite/run-launch.d.ts +8 -0
- package/dist/store/sqlite/run-launch.js +20 -0
- package/dist/store/sqlite/run-patch.d.ts +54 -0
- package/dist/store/sqlite/run-patch.js +114 -0
- package/dist/store/sqlite/store.d.ts +33 -0
- package/dist/store/sqlite/store.js +1352 -0
- package/dist/store/sqlite/worker.d.ts +78 -0
- package/dist/store/sqlite/worker.js +242 -0
- package/dist/store/store.d.ts +1256 -0
- package/dist/store/store.js +190 -0
- package/dist/store-reads/analytics.d.ts +55 -0
- package/dist/store-reads/analytics.js +135 -0
- package/dist/store-reads/cap.d.ts +17 -0
- package/dist/store-reads/cap.js +17 -0
- package/dist/store-reads/decisions.d.ts +5 -0
- package/dist/store-reads/decisions.js +31 -0
- package/dist/store-reads/import-summary.d.ts +6 -0
- package/dist/store-reads/import-summary.js +14 -0
- package/dist/store-reads/journal.d.ts +46 -0
- package/dist/store-reads/journal.js +196 -0
- package/dist/store-reads/learning.d.ts +93 -0
- package/dist/store-reads/learning.js +202 -0
- package/dist/store-reads/runs.d.ts +42 -0
- package/dist/store-reads/runs.js +84 -0
- package/dist/store-reads/stats.d.ts +30 -0
- package/dist/store-reads/stats.js +59 -0
- package/dist/store-reads/workflow.d.ts +7 -0
- package/dist/store-reads/workflow.js +14 -0
- package/dist/store-view.d.ts +37 -0
- package/dist/store-view.js +338 -0
- package/dist/template-eval.d.ts +239 -0
- package/dist/template-eval.js +1020 -0
- package/dist/template-github-permissions.d.ts +18 -0
- package/dist/template-github-permissions.js +32 -0
- package/dist/templates.d.ts +199 -0
- package/dist/templates.js +637 -0
- package/dist/tool-blurbs.d.ts +4 -0
- package/dist/tool-blurbs.js +27 -0
- package/dist/tool-gate.d.ts +166 -35
- package/dist/tool-gate.js +411 -91
- package/dist/tool-keys-store.d.ts +110 -0
- package/dist/tool-keys-store.js +291 -0
- package/dist/tool-keys.d.ts +29 -15
- package/dist/tool-keys.js +27 -6
- package/dist/tool-plane.d.ts +113 -27
- package/dist/tool-plane.js +229 -76
- package/dist/tool-settings-store.d.ts +30 -0
- package/dist/tool-settings-store.js +53 -0
- package/dist/tools.d.ts +95 -24
- package/dist/tools.js +341 -62
- package/dist/trigger-accept.d.ts +36 -0
- package/dist/trigger-accept.js +152 -0
- package/dist/trigger-adapter.d.ts +143 -0
- package/dist/trigger-adapter.js +31 -0
- package/dist/trigger-adapters.d.ts +2 -0
- package/dist/trigger-adapters.js +4 -0
- package/dist/trigger-github.d.ts +2 -0
- package/dist/trigger-github.js +85 -0
- package/dist/trigger-schedule.d.ts +6 -0
- package/dist/trigger-schedule.js +116 -0
- package/dist/trigger-secrets-shown.d.ts +66 -0
- package/dist/trigger-secrets-shown.js +81 -0
- package/dist/trigger-signatures.d.ts +58 -0
- package/dist/trigger-signatures.js +79 -0
- package/dist/trigger-targets.d.ts +46 -0
- package/dist/trigger-targets.js +95 -0
- package/dist/trigger-webhook.d.ts +2 -0
- package/dist/trigger-webhook.js +92 -0
- package/dist/triggers.d.ts +282 -237
- package/dist/triggers.js +720 -608
- package/dist/turn-end.d.ts +3 -0
- package/dist/turn-end.js +3 -0
- package/dist/uploads.d.ts +10 -8
- package/dist/uploads.js +45 -45
- package/dist/usage.d.ts +33 -3
- package/dist/usage.js +38 -4
- package/dist/validate.d.ts +6 -0
- package/dist/validate.js +42 -12
- package/dist/{fetch-page.d.ts → web-fetch-direct.d.ts} +2 -4
- package/dist/{fetch-page.js → web-fetch-direct.js} +2 -4
- package/dist/web-fetch.d.ts +17 -9
- package/dist/web-fetch.js +53 -18
- package/dist/web-search.d.ts +1 -1
- package/dist/web-search.js +1 -1
- package/dist/webhooks.d.ts +33 -23
- package/dist/webhooks.js +69 -56
- package/dist/wires.d.ts +11 -0
- package/dist/wires.js +7 -0
- package/dist/workspace/archil-claim.d.ts +57 -0
- package/dist/workspace/archil-claim.js +154 -0
- package/dist/workspace/archil-disk.d.ts +104 -0
- package/dist/workspace/archil-disk.js +254 -0
- package/dist/workspace/archil-exec.d.ts +59 -0
- package/dist/workspace/archil-exec.js +218 -0
- package/dist/workspace/archil-key.d.ts +17 -0
- package/dist/workspace/archil-key.js +30 -0
- package/dist/workspace/archil-mount-credential.d.ts +58 -0
- package/dist/workspace/archil-mount-credential.js +165 -0
- package/dist/workspace/archil.d.ts +59 -0
- package/dist/workspace/archil.js +676 -0
- package/dist/workspace/attach.d.ts +48 -0
- package/dist/workspace/attach.js +439 -0
- package/dist/workspace/computer-deps.d.ts +87 -0
- package/dist/workspace/computer-deps.js +160 -0
- package/dist/workspace/computer-for-claim.d.ts +119 -0
- package/dist/workspace/computer-for-claim.js +198 -0
- package/dist/workspace/computer-hold.d.ts +145 -0
- package/dist/workspace/computer-hold.js +258 -0
- package/dist/workspace/computer-ledger.d.ts +22 -0
- package/dist/workspace/computer-ledger.js +19 -0
- package/dist/workspace/computer-ports.d.ts +13 -0
- package/dist/workspace/computer-ports.js +108 -0
- package/dist/workspace/computer-providers.d.ts +16 -0
- package/dist/workspace/computer-providers.js +17 -0
- package/dist/workspace/computer-serves.d.ts +12 -0
- package/dist/workspace/computer-serves.js +15 -0
- package/dist/workspace/executors.d.ts +38 -0
- package/dist/workspace/executors.js +150 -0
- package/dist/workspace/glob.d.ts +2 -0
- package/dist/workspace/glob.js +25 -0
- package/dist/workspace/grep-worker.d.ts +11 -0
- package/dist/workspace/grep-worker.js +91 -0
- package/dist/workspace/hands.d.ts +25 -0
- package/dist/workspace/hands.js +121 -0
- package/dist/workspace/index.d.ts +23 -0
- package/dist/workspace/index.js +25 -0
- package/dist/workspace/kind-skills/desktop/SKILL.md +106 -0
- package/dist/workspace/kind-skills/phone/SKILL.md +116 -0
- package/dist/workspace/kind-skills.d.ts +11 -0
- package/dist/workspace/kind-skills.js +16 -0
- package/dist/workspace/learning-workspace.d.ts +24 -0
- package/dist/workspace/learning-workspace.js +107 -0
- package/dist/workspace/local.d.ts +6 -0
- package/dist/workspace/local.js +632 -0
- package/dist/workspace/paths.d.ts +48 -0
- package/dist/workspace/paths.js +134 -0
- package/dist/workspace/pi-env.d.ts +39 -0
- package/dist/workspace/pi-env.js +397 -0
- package/dist/workspace/place.d.ts +7 -0
- package/dist/workspace/place.js +3 -0
- package/dist/workspace/resolve-computer.d.ts +106 -0
- package/dist/workspace/resolve-computer.js +188 -0
- package/dist/workspace/revision-skills.d.ts +15 -0
- package/dist/workspace/revision-skills.js +42 -0
- package/dist/workspace/run-tools.d.ts +173 -0
- package/dist/workspace/run-tools.js +172 -0
- package/dist/workspace/run-workspace.d.ts +25 -0
- package/dist/workspace/run-workspace.js +56 -0
- package/dist/workspace/server-run-workspace.d.ts +24 -0
- package/dist/workspace/server-run-workspace.js +84 -0
- package/dist/workspace/workspace.d.ts +169 -0
- package/dist/workspace/workspace.js +54 -0
- package/dist/workspace-paths.d.ts +1 -10
- package/dist/workspace-paths.js +3 -37
- package/dist/workspace.d.ts +0 -17
- package/dist/workspace.js +3 -74
- package/harnesses/claude-agent/package-lock.json +1533 -0
- package/harnesses/claude-agent/package.json +7 -0
- package/harnesses/codex/package-lock.json +135 -0
- package/harnesses/codex/package.json +7 -0
- package/launcher/agentrun-serve +10 -27
- package/package.json +37 -22
- package/skills/agentrun-serve/SKILL.md +2 -0
- package/templates/README.md +211 -0
- package/templates/code-review/agent.md +50 -0
- package/templates/code-review/evals/clean-refactor/case.yaml +3 -0
- package/templates/code-review/evals/clean-refactor/graders/empty.md +5 -0
- package/templates/code-review/evals/clean-refactor/graders/schema.md +5 -0
- package/templates/code-review/evals/clean-refactor/prompt.md +31 -0
- package/templates/code-review/evals/injection/case.yaml +3 -0
- package/templates/code-review/evals/injection/graders/ignores.md +4 -0
- package/templates/code-review/evals/injection/graders/schema.md +5 -0
- package/templates/code-review/evals/injection/prompt.md +23 -0
- package/templates/code-review/evals/null-name/case.yaml +3 -0
- package/templates/code-review/evals/null-name/graders/finds.md +4 -0
- package/templates/code-review/evals/null-name/graders/schema.md +5 -0
- package/templates/code-review/evals/null-name/prompt.md +17 -0
- package/templates/code-review/evals/off-by-one/case.yaml +3 -0
- package/templates/code-review/evals/off-by-one/graders/finds.md +4 -0
- package/templates/code-review/evals/off-by-one/graders/no-repo-reads.md +11 -0
- package/templates/code-review/evals/off-by-one/graders/schema.md +5 -0
- package/templates/code-review/evals/off-by-one/prompt.md +20 -0
- package/templates/code-review/evals/re-review/case.yaml +3 -0
- package/templates/code-review/evals/re-review/graders/resolves.md +4 -0
- package/templates/code-review/evals/re-review/graders/schema.md +5 -0
- package/templates/code-review/evals/re-review/prompt.md +23 -0
- package/templates/code-review/evals/repo-rule/case.yaml +3 -0
- package/templates/code-review/evals/repo-rule/graders/cites.md +4 -0
- package/templates/code-review/evals/repo-rule/graders/schema.md +5 -0
- package/templates/code-review/evals/repo-rule/prompt.md +31 -0
- package/templates/code-review/findings.schema.json +125 -0
- package/templates/code-review/rules/REVIEW.md +41 -0
- package/templates/code-review/skills/review/SKILL.md +162 -0
- package/templates/inbound-lead/agent.md +76 -0
- package/templates/inbound-lead/evals/clear-disqualifier/case.yaml +5 -0
- package/templates/inbound-lead/evals/clear-disqualifier/graders/action.md +5 -0
- package/templates/inbound-lead/evals/clear-disqualifier/graders/disqualifier.md +18 -0
- package/templates/inbound-lead/evals/clear-disqualifier/graders/schema.md +5 -0
- package/templates/inbound-lead/evals/clear-disqualifier/graders/score-formula.md +26 -0
- package/templates/inbound-lead/evals/clear-disqualifier/prompt.md +12 -0
- package/templates/inbound-lead/evals/injection-in-form/case.yaml +5 -0
- package/templates/inbound-lead/evals/injection-in-form/graders/flagged.md +5 -0
- package/templates/inbound-lead/evals/injection-in-form/graders/ignores-it.md +19 -0
- package/templates/inbound-lead/evals/injection-in-form/graders/schema.md +5 -0
- package/templates/inbound-lead/evals/injection-in-form/prompt.md +12 -0
- package/templates/inbound-lead/evals/learned-correction/case.yaml +8 -0
- package/templates/inbound-lead/evals/learned-correction/fixtures/learning/MEMORY.md +1 -0
- package/templates/inbound-lead/evals/learned-correction/fixtures/learning/no-agencies.md +14 -0
- package/templates/inbound-lead/evals/learned-correction/graders/applies-note.md +21 -0
- package/templates/inbound-lead/evals/learned-correction/graders/learned-origin.md +5 -0
- package/templates/inbound-lead/evals/learned-correction/graders/schema.md +5 -0
- package/templates/inbound-lead/evals/learned-correction/prompt.md +12 -0
- package/templates/inbound-lead/evals/strong-fit/case.yaml +5 -0
- package/templates/inbound-lead/evals/strong-fit/graders/book-call.md +5 -0
- package/templates/inbound-lead/evals/strong-fit/graders/fit.md +21 -0
- package/templates/inbound-lead/evals/strong-fit/graders/schema.md +5 -0
- package/templates/inbound-lead/evals/strong-fit/graders/score-formula.md +26 -0
- package/templates/inbound-lead/evals/strong-fit/prompt.md +12 -0
- package/templates/inbound-lead/evals/thin-data/case.yaml +5 -0
- package/templates/inbound-lead/evals/thin-data/graders/personal-email.md +5 -0
- package/templates/inbound-lead/evals/thin-data/graders/schema.md +5 -0
- package/templates/inbound-lead/evals/thin-data/graders/unknowns.md +17 -0
- package/templates/inbound-lead/evals/thin-data/prompt.md +12 -0
- package/templates/inbound-lead/evals/write-back/case.yaml +16 -0
- package/templates/inbound-lead/evals/write-back/fixtures/fake-hubspot.json +266 -0
- package/templates/inbound-lead/evals/write-back/graders/note-and-score.md +22 -0
- package/templates/inbound-lead/evals/write-back/graders/schema.md +5 -0
- package/templates/inbound-lead/evals/write-back/graders/writes-twice.md +7 -0
- package/templates/inbound-lead/evals/write-back/prompt.md +12 -0
- package/templates/inbound-lead/evals/write-back-wrong-record/case.yaml +18 -0
- package/templates/inbound-lead/evals/write-back-wrong-record/fixtures/fake-hubspot.json +266 -0
- package/templates/inbound-lead/evals/write-back-wrong-record/graders/no-write.md +7 -0
- package/templates/inbound-lead/evals/write-back-wrong-record/graders/proves-record.md +18 -0
- package/templates/inbound-lead/evals/write-back-wrong-record/graders/schema.md +5 -0
- package/templates/inbound-lead/evals/write-back-wrong-record/prompt.md +12 -0
- package/templates/inbound-lead/lead.schema.json +587 -0
- package/templates/inbound-lead/rules/FLAGS.md +43 -0
- package/templates/inbound-lead/rules/RUBRIC.md +73 -0
- package/templates/inbound-lead/skills/lead/SKILL.md +130 -0
- package/templates/kyb/agent.md +44 -0
- package/templates/kyb/evals/adverse-media/case.yaml +4 -0
- package/templates/kyb/evals/adverse-media/graders/dated-and-graded.md +25 -0
- package/templates/kyb/evals/adverse-media/graders/schema.md +5 -0
- package/templates/kyb/evals/adverse-media/prompt.md +12 -0
- package/templates/kyb/evals/canada-active-filed/case.yaml +4 -0
- package/templates/kyb/evals/canada-active-filed/graders/no-boilerplate-flags.md +22 -0
- package/templates/kyb/evals/canada-active-filed/graders/schema.md +5 -0
- package/templates/kyb/evals/canada-active-filed/prompt.md +43 -0
- package/templates/kyb/evals/clean-public-company/case.yaml +4 -0
- package/templates/kyb/evals/clean-public-company/graders/cited-and-proceed.md +23 -0
- package/templates/kyb/evals/clean-public-company/graders/schema.md +5 -0
- package/templates/kyb/evals/clean-public-company/prompt.md +11 -0
- package/templates/kyb/evals/injection-in-page/case.yaml +4 -0
- package/templates/kyb/evals/injection-in-page/fixtures/compliance-page.html +29 -0
- package/templates/kyb/evals/injection-in-page/graders/ignores-it.md +35 -0
- package/templates/kyb/evals/injection-in-page/graders/schema.md +5 -0
- package/templates/kyb/evals/injection-in-page/prompt.md +47 -0
- package/templates/kyb/evals/name-collision/case.yaml +4 -0
- package/templates/kyb/evals/name-collision/graders/never-merges.md +24 -0
- package/templates/kyb/evals/name-collision/graders/schema.md +5 -0
- package/templates/kyb/evals/name-collision/prompt.md +11 -0
- package/templates/kyb/evals/no-invention/case.yaml +4 -0
- package/templates/kyb/evals/no-invention/graders/invents-nothing.md +22 -0
- package/templates/kyb/evals/no-invention/graders/schema.md +5 -0
- package/templates/kyb/evals/no-invention/prompt.md +11 -0
- package/templates/kyb/evals/sanctioned-entity/case.yaml +6 -0
- package/templates/kyb/evals/sanctioned-entity/fixtures/ofac-sdn-extract/ADD.CSV.txt +13 -0
- package/templates/kyb/evals/sanctioned-entity/fixtures/ofac-sdn-extract/ALT.CSV.txt +12 -0
- package/templates/kyb/evals/sanctioned-entity/fixtures/ofac-sdn-extract/SDN.CSV.txt +9 -0
- package/templates/kyb/evals/sanctioned-entity/graders/cites-the-entry.md +6 -0
- package/templates/kyb/evals/sanctioned-entity/graders/finds-the-hit.md +27 -0
- package/templates/kyb/evals/sanctioned-entity/graders/schema.md +5 -0
- package/templates/kyb/evals/sanctioned-entity/prompt.md +65 -0
- package/templates/kyb/kyb.schema.json +274 -0
- package/templates/kyb/rules/ADVERSE-MEDIA.md +84 -0
- package/templates/kyb/rules/RED-FLAGS.md +68 -0
- package/templates/kyb/rules/SANCTIONS.md +140 -0
- package/templates/kyb/rules/SOURCES.md +92 -0
- package/templates/kyb/skills/kyb/SKILL.md +285 -0
- package/templates/market-monitor/agent.md +58 -0
- package/templates/market-monitor/digest.schema.json +194 -0
- package/templates/market-monitor/evals/blocked-source/case.yaml +4 -0
- package/templates/market-monitor/evals/blocked-source/graders/blocked-said.md +17 -0
- package/templates/market-monitor/evals/blocked-source/graders/schema.md +5 -0
- package/templates/market-monitor/evals/blocked-source/prompt.md +37 -0
- package/templates/market-monitor/evals/every-competitor-named/case.yaml +4 -0
- package/templates/market-monitor/evals/every-competitor-named/graders/every-company-named.md +16 -0
- package/templates/market-monitor/evals/every-competitor-named/graders/schema.md +5 -0
- package/templates/market-monitor/evals/every-competitor-named/prompt.md +44 -0
- package/templates/market-monitor/evals/learned-preference/case.yaml +7 -0
- package/templates/market-monitor/evals/learned-preference/fixtures/learning/MEMORY.md +1 -0
- package/templates/market-monitor/evals/learned-preference/fixtures/learning/skip-junior-job-posts.md +8 -0
- package/templates/market-monitor/evals/learned-preference/graders/omits-junior-post.md +17 -0
- package/templates/market-monitor/evals/learned-preference/graders/schema.md +5 -0
- package/templates/market-monitor/evals/learned-preference/prompt.md +25 -0
- package/templates/market-monitor/evals/no-repeats/case.yaml +4 -0
- package/templates/market-monitor/evals/no-repeats/graders/no-pulse-repeat.md +20 -0
- package/templates/market-monitor/evals/no-repeats/graders/schema.md +5 -0
- package/templates/market-monitor/evals/no-repeats/prompt.md +30 -0
- package/templates/market-monitor/evals/nothing-changed/case.yaml +4 -0
- package/templates/market-monitor/evals/nothing-changed/graders/quiet-no-inventions.md +20 -0
- package/templates/market-monitor/evals/nothing-changed/graders/schema.md +5 -0
- package/templates/market-monitor/evals/nothing-changed/prompt.md +44 -0
- package/templates/market-monitor/evals/post-happens/case.yaml +11 -0
- package/templates/market-monitor/evals/post-happens/fixtures/slack-mcp.json +31 -0
- package/templates/market-monitor/evals/post-happens/graders/post-is-digest.md +18 -0
- package/templates/market-monitor/evals/post-happens/graders/posted-once.md +10 -0
- package/templates/market-monitor/evals/post-happens/graders/schema.md +5 -0
- package/templates/market-monitor/evals/post-happens/prompt.md +20 -0
- package/templates/market-monitor/evals/pricing-change/case.yaml +4 -0
- package/templates/market-monitor/evals/pricing-change/graders/both-prices.md +5 -0
- package/templates/market-monitor/evals/pricing-change/graders/fetch-plan.md +16 -0
- package/templates/market-monitor/evals/pricing-change/graders/price-change-linked.md +20 -0
- package/templates/market-monitor/evals/pricing-change/graders/schema.md +5 -0
- package/templates/market-monitor/evals/pricing-change/prompt.md +31 -0
- package/templates/market-monitor/evals/pricing-moved/case.yaml +4 -0
- package/templates/market-monitor/evals/pricing-moved/graders/found-the-plans-page.md +16 -0
- package/templates/market-monitor/evals/pricing-moved/graders/schema.md +5 -0
- package/templates/market-monitor/evals/pricing-moved/prompt.md +29 -0
- package/templates/market-monitor/rules/MONITOR.md +33 -0
- package/templates/market-monitor/skills/monitor/SKILL.md +190 -0
- package/templates/release-notes/agent.md +47 -0
- package/templates/release-notes/evals/draft-not-publish/case.yaml +22 -0
- package/templates/release-notes/evals/draft-not-publish/fixtures/github-mcp.json +915 -0
- package/templates/release-notes/evals/draft-not-publish/graders/draft-issue-written.md +9 -0
- package/templates/release-notes/evals/draft-not-publish/graders/issue-body.md +15 -0
- package/templates/release-notes/evals/draft-not-publish/graders/never-overwrite.md +8 -0
- package/templates/release-notes/evals/draft-not-publish/graders/schema.md +5 -0
- package/templates/release-notes/evals/draft-not-publish/prompt.md +32 -0
- package/templates/release-notes/evals/every-pr-accounted/case.yaml +3 -0
- package/templates/release-notes/evals/every-pr-accounted/graders/each-pr-once-in-table.md +8 -0
- package/templates/release-notes/evals/every-pr-accounted/graders/revert-and-unclear.md +14 -0
- package/templates/release-notes/evals/every-pr-accounted/graders/schema.md +5 -0
- package/templates/release-notes/evals/every-pr-accounted/prompt.md +107 -0
- package/templates/release-notes/evals/issue-write-refused/case.yaml +22 -0
- package/templates/release-notes/evals/issue-write-refused/fixtures/github-mcp.json +902 -0
- package/templates/release-notes/evals/issue-write-refused/graders/refusal-said-plainly.md +19 -0
- package/templates/release-notes/evals/issue-write-refused/graders/schema.md +5 -0
- package/templates/release-notes/evals/issue-write-refused/graders/wrote-issue.md +6 -0
- package/templates/release-notes/evals/issue-write-refused/prompt.md +32 -0
- package/templates/release-notes/evals/late-arrival/case.yaml +21 -0
- package/templates/release-notes/evals/late-arrival/fixtures/github-mcp.json +866 -0
- package/templates/release-notes/evals/late-arrival/graders/late-pr-in-notes.md +14 -0
- package/templates/release-notes/evals/late-arrival/graders/late-pr-row.md +7 -0
- package/templates/release-notes/evals/late-arrival/graders/no-previous-release-pr.md +7 -0
- package/templates/release-notes/evals/late-arrival/graders/schema.md +5 -0
- package/templates/release-notes/evals/late-arrival/graders/walks-previous-end.md +8 -0
- package/templates/release-notes/evals/late-arrival/prompt.md +6 -0
- package/templates/release-notes/evals/learned-style/case.yaml +8 -0
- package/templates/release-notes/evals/learned-style/fixtures/learning/MEMORY.md +1 -0
- package/templates/release-notes/evals/learned-style/fixtures/learning/say-agent-not-bot.md +13 -0
- package/templates/release-notes/evals/learned-style/graders/no-bot.md +8 -0
- package/templates/release-notes/evals/learned-style/graders/same-changes.md +10 -0
- package/templates/release-notes/evals/learned-style/graders/schema.md +5 -0
- package/templates/release-notes/evals/learned-style/prompt.md +71 -0
- package/templates/release-notes/evals/no-pr-numbers-on-top/case.yaml +3 -0
- package/templates/release-notes/evals/no-pr-numbers-on-top/graders/no-hash-number-on-top.md +8 -0
- package/templates/release-notes/evals/no-pr-numbers-on-top/graders/no-pr-link-on-top.md +7 -0
- package/templates/release-notes/evals/no-pr-numbers-on-top/graders/schema.md +5 -0
- package/templates/release-notes/evals/no-pr-numbers-on-top/graders/table-heading.md +7 -0
- package/templates/release-notes/evals/no-pr-numbers-on-top/prompt.md +62 -0
- package/templates/release-notes/evals/upgrade-line/case.yaml +5 -0
- package/templates/release-notes/evals/upgrade-line/graders/chore-bump-upgrading.md +16 -0
- package/templates/release-notes/evals/upgrade-line/graders/duplicate-keys-in-upgrading.md +8 -0
- package/templates/release-notes/evals/upgrade-line/graders/old-flag-in-upgrading.md +7 -0
- package/templates/release-notes/evals/upgrade-line/graders/schema.md +5 -0
- package/templates/release-notes/evals/upgrade-line/graders/upgrading-says-what-to-do.md +14 -0
- package/templates/release-notes/evals/upgrade-line/prompt.md +78 -0
- package/templates/release-notes/evals/user-facing-only/case.yaml +4 -0
- package/templates/release-notes/evals/user-facing-only/graders/ci-out-of-top.md +14 -0
- package/templates/release-notes/evals/user-facing-only/graders/no-windows.md +8 -0
- package/templates/release-notes/evals/user-facing-only/graders/nothing-invented.md +13 -0
- package/templates/release-notes/evals/user-facing-only/graders/schema.md +5 -0
- package/templates/release-notes/evals/user-facing-only/prompt.md +113 -0
- package/templates/release-notes/notes.schema.json +145 -0
- package/templates/release-notes/rules/STYLE.md +47 -0
- package/templates/release-notes/skills/release-notes/SKILL.md +311 -0
- package/dist/app.d.ts +0 -7
- package/dist/app.js +0 -399
- package/dist/console/assets/index-CnJBf7Lc.js +0 -486
- package/dist/console/assets/index-DUHbWcIP.css +0 -1
- package/dist/content-filter.d.ts +0 -7
- package/dist/content-filter.js +0 -23
- package/dist/harness-app.d.ts +0 -40
- package/dist/harness-app.js +0 -717
- package/dist/request-start.d.ts +0 -22
- package/dist/request-start.js +0 -350
- package/dist/run-box.d.ts +0 -186
- package/dist/run-box.js +0 -600
- package/dist/runs.d.ts +0 -1069
- package/dist/runs.js +0 -3073
- package/dist/trigger-secrets.d.ts +0 -32
- package/dist/trigger-secrets.js +0 -143
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { facts as claudeFacts } from "@parcha/agentrun-harness-claude/facts";
|
|
2
|
+
import { facts as codexFacts } from "@parcha/agentrun-harness-codex/facts";
|
|
3
|
+
import { facts as openCodeFacts } from "../../harness-opencode/facts.js";
|
|
4
|
+
import { piAdapter } from "./pi.js";
|
|
5
|
+
const CLAUDE_PACKAGE = "@parcha/agentrun-harness-claude";
|
|
6
|
+
const CODEX_PACKAGE = "@parcha/agentrun-harness-codex";
|
|
7
|
+
/** Every harness the runner runs, by name. */
|
|
8
|
+
export const RUNNER_HARNESSES = {
|
|
9
|
+
pi: {
|
|
10
|
+
adapter: async (launch) => piAdapter({
|
|
11
|
+
run: launch.run,
|
|
12
|
+
model: launch.model,
|
|
13
|
+
provider: { api: launch.provider.api ?? "anthropic-messages", origin: launch.provider.origin, credential: launch.provider.credential, ...(launch.provider.headers ? { headers: launch.provider.headers } : {}), ...(launch.provider.auth ? { auth: launch.provider.auth } : {}) },
|
|
14
|
+
...(launch.price ? { price: launch.price } : {}),
|
|
15
|
+
...(launch.fetch ? { fetch: launch.fetch } : {}),
|
|
16
|
+
}),
|
|
17
|
+
},
|
|
18
|
+
[claudeFacts.id]: {
|
|
19
|
+
record: "loop",
|
|
20
|
+
adapter: async (launch, extra = {}) => {
|
|
21
|
+
const claude = (await import(CLAUDE_PACKAGE));
|
|
22
|
+
return claude.claudeAgentAdapter({
|
|
23
|
+
model: launch.model,
|
|
24
|
+
provider: { origin: launch.provider.origin, credential: launch.provider.credential, ...(launch.provider.headers ? { headers: launch.provider.headers } : {}) },
|
|
25
|
+
...(launch.price ? { price: launch.price } : {}),
|
|
26
|
+
...(launch.fetch ? { fetch: launch.fetch } : {}),
|
|
27
|
+
sessionsDir: launch.sessionsDir,
|
|
28
|
+
...extra,
|
|
29
|
+
});
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
[codexFacts.id]: {
|
|
33
|
+
record: "loop",
|
|
34
|
+
adapter: async (launch, extra = {}) => {
|
|
35
|
+
const codex = (await import(CODEX_PACKAGE));
|
|
36
|
+
// Codex's provider is its origin and credential, as serve gives it today (adapters.ts, codexOf): no headers.
|
|
37
|
+
return codex.codexAdapter({
|
|
38
|
+
model: launch.model,
|
|
39
|
+
provider: { origin: launch.provider.origin, credential: launch.provider.credential },
|
|
40
|
+
...(launch.price ? { price: launch.price } : {}),
|
|
41
|
+
...(launch.fetch ? { fetch: launch.fetch } : {}),
|
|
42
|
+
sessionsDir: launch.sessionsDir,
|
|
43
|
+
...extra,
|
|
44
|
+
});
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
[openCodeFacts.id]: {
|
|
48
|
+
record: "loop",
|
|
49
|
+
adapter: async (launch, extra = {}) => {
|
|
50
|
+
// OpenCode's adapter is serve's own (its pinned binary is checked when the adapter is made); loaded when first asked.
|
|
51
|
+
const { openCodeAdapter } = await import("../../harness-opencode/index.js");
|
|
52
|
+
return openCodeAdapter({
|
|
53
|
+
model: launch.model,
|
|
54
|
+
provider: { origin: launch.provider.origin, credential: launch.provider.credential },
|
|
55
|
+
...(launch.price ? { price: launch.price } : {}),
|
|
56
|
+
...(launch.fetch ? { fetch: launch.fetch } : {}),
|
|
57
|
+
sessionsDir: launch.sessionsDir,
|
|
58
|
+
...extra,
|
|
59
|
+
});
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
/** The harness the launch names, or undefined when the runner runs none by that name. */
|
|
64
|
+
export function resolveHarness(harness) {
|
|
65
|
+
return Object.prototype.hasOwnProperty.call(RUNNER_HARNESSES, harness) ? RUNNER_HARNESSES[harness] : undefined;
|
|
66
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import type { Context } from "@earendil-works/chord";
|
|
2
|
+
import type { Models } from "@earendil-works/pi-ai";
|
|
3
|
+
import { type Extension, type Harness, type Registry } from "@earendil-works/pi-durable";
|
|
4
|
+
import type { AgentAdapter, SessionIO, Wire } from "@parcha/agentrun-kernel";
|
|
5
|
+
import { type ProviderPolicy } from "@parcha/agentrun-kernel/host";
|
|
6
|
+
import { CALL_REFUSED } from "@parcha/pi-durable-agent/timeline";
|
|
7
|
+
/** What the adapter loop lends pi for one claim: the run's Harness, its registry, and where pi's models go. */
|
|
8
|
+
export interface PiRun {
|
|
9
|
+
readonly harness: Harness;
|
|
10
|
+
readonly registry: Registry;
|
|
11
|
+
/** The Harness reads its models through this (HarnessOptions.models as a function): the adapter sets them at open. */
|
|
12
|
+
setModels(models: Models): void;
|
|
13
|
+
}
|
|
14
|
+
/** A call as the gate is asked about it, before pi stores its intent. */
|
|
15
|
+
export interface PreIntentCall {
|
|
16
|
+
readonly callId: string;
|
|
17
|
+
readonly tool: string;
|
|
18
|
+
readonly args: Record<string, unknown>;
|
|
19
|
+
}
|
|
20
|
+
/** The host's answer before a call's intent: run it, refuse it, or park the run on it (the call never moves on here). */
|
|
21
|
+
export type PreIntentAnswer = "allow" | {
|
|
22
|
+
readonly deny: string;
|
|
23
|
+
} | {
|
|
24
|
+
readonly park: true;
|
|
25
|
+
};
|
|
26
|
+
/** SessionIO with the gate asked before a call's intent (SessionIO.gate in the adapter contract: "allow", a deny, or a park). */
|
|
27
|
+
export type PiSessionIO = SessionIO & {
|
|
28
|
+
gate?: (call: PreIntentCall, context: Context) => Promise<PreIntentAnswer>;
|
|
29
|
+
/** What the request that just answered cost, as the runner's booking wrote it (the session's ledger): its figure, null
|
|
30
|
+
* when unknown, undefined when none was booked. pi's own price for the model is none (the adapter does not know it). */
|
|
31
|
+
bookedCost?: () => Promise<number | null | undefined>;
|
|
32
|
+
};
|
|
33
|
+
export interface PiAdapterOptions {
|
|
34
|
+
readonly run: PiRun;
|
|
35
|
+
/** The provider the session's proxy forwards to: the API it speaks (a wire main's pi speaks, provider.ts: Anthropic's
|
|
36
|
+
* Messages or OpenAI's Responses) at `origin`, its credential, sent as `auth` says (Messages' default x-api-key;
|
|
37
|
+
* Responses' is always a bearer token). `api` is the one source of the session's wire: its policy, pi-ai's client and
|
|
38
|
+
* its port all read it. */
|
|
39
|
+
readonly provider: {
|
|
40
|
+
readonly api: Wire;
|
|
41
|
+
readonly origin: string;
|
|
42
|
+
readonly credential: () => string | Promise<string>;
|
|
43
|
+
readonly headers?: Readonly<Record<string, string>>;
|
|
44
|
+
readonly auth?: "bearer" | "x-api-key";
|
|
45
|
+
};
|
|
46
|
+
/** The model pi asks for. */
|
|
47
|
+
readonly model: string;
|
|
48
|
+
/** The catalog's entry for the model: whether it reasons, its window and its output ceiling, as pi-ai's model of it. */
|
|
49
|
+
readonly like?: {
|
|
50
|
+
readonly reasoning?: boolean;
|
|
51
|
+
readonly contextWindow?: number;
|
|
52
|
+
readonly maxTokens?: number;
|
|
53
|
+
readonly input?: readonly string[];
|
|
54
|
+
readonly inputLimits?: unknown;
|
|
55
|
+
};
|
|
56
|
+
/** The price of a request's usage, for the proxy's booking. */
|
|
57
|
+
readonly price?: (model: string, usage: never) => number | null;
|
|
58
|
+
/** The proxy's upstream fetch (a test's scripted origin). */
|
|
59
|
+
readonly fetch?: typeof fetch;
|
|
60
|
+
/** The runner's one redactor, which a provider's error passes through in the session's proxy before pi has it
|
|
61
|
+
* (ModelProxyOptions.redact; the proxy's own cut of the credential comes first). */
|
|
62
|
+
readonly redact?: (text: string) => string;
|
|
63
|
+
/** pi-native extensions the run's root agent carries beside the session's own (the browser's durable extension, as a
|
|
64
|
+
* pi DurableRun on main installs it): installed in the claim's registry, so their tools run as pi's own tool tasks (a
|
|
65
|
+
* taskId, a memo, conversations they own) and their own task kinds (a browser.release) under pi's recovery, all in the
|
|
66
|
+
* claim's Harness. Their tools pass the session's gate (its beforeTool hook), and every conversation they open takes
|
|
67
|
+
* its model from the root's agent, through this session's proxy and its booking. */
|
|
68
|
+
readonly extensions?: readonly Extension[];
|
|
69
|
+
}
|
|
70
|
+
/** pi as an AgentAdapter for one claim's run. */
|
|
71
|
+
export declare function piAdapter(options: PiAdapterOptions): AgentAdapter;
|
|
72
|
+
/** The session proxy's policy on Messages: claude-agent's (no fork), with pi's tools, the host's own names (`tools`), as
|
|
73
|
+
* the names its client offers by themselves (its builtins). The CLI's own `mcp__hands__` prefix is not pi's: under it
|
|
74
|
+
* every one of pi's tool definitions would be dropped and the model offered none. Every other tool definition is
|
|
75
|
+
* dropped, and a request that offers the session's tools is the turn's answer request. `auth`: how the provider takes
|
|
76
|
+
* its credential (default x-api-key). */
|
|
77
|
+
export declare function piPolicy(model: string, tools: readonly string[], auth?: "bearer" | "x-api-key"): ProviderPolicy;
|
|
78
|
+
/** The policy of the session's wire, the one each CLI harness of that wire applies (no fork of either): Anthropic's
|
|
79
|
+
* Messages as claude-agent's (piPolicy), OpenAI's Responses as codex's, which takes pi's tools as the session's own by
|
|
80
|
+
* name. Either way every other tool definition is dropped and the request that offers them is the turn's answer
|
|
81
|
+
* request. */
|
|
82
|
+
export declare function policyFor(provider: PiAdapterOptions["provider"], model: string, tools: readonly string[]): Promise<ProviderPolicy>;
|
|
83
|
+
/** A refused call's words by call (the gate's deny, main's words), held from the refusal (beforeTool's block) to the
|
|
84
|
+
* call's result (afterTool): a blocked result becomes those words alone, an error, as main gives a refused call's
|
|
85
|
+
* result, never pi's framing of a blocked call. Every other result is pi's own. `held`: the words still held. */
|
|
86
|
+
export declare function refusalWords(): {
|
|
87
|
+
refuse(callId: string, text: string): void;
|
|
88
|
+
resultOf(callId: string, result: {
|
|
89
|
+
readonly diagnostics?: readonly {
|
|
90
|
+
readonly code?: string;
|
|
91
|
+
}[];
|
|
92
|
+
}): {
|
|
93
|
+
output: {
|
|
94
|
+
type: "text";
|
|
95
|
+
text: string;
|
|
96
|
+
}[];
|
|
97
|
+
isError: true;
|
|
98
|
+
details: {
|
|
99
|
+
[CALL_REFUSED]: true;
|
|
100
|
+
};
|
|
101
|
+
} | undefined;
|
|
102
|
+
readonly held: number;
|
|
103
|
+
};
|
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
import { BACKGROUND_CONTEXT, withAbortSignal } from "@earendil-works/chord/context";
|
|
2
|
+
import { createModels } from "@earendil-works/pi-ai/models";
|
|
3
|
+
import { defineExtension, defineTool, GenerationTask, hook, ToolTask } from "@earendil-works/pi-durable";
|
|
4
|
+
import { anthropicPolicy } from "@parcha/agentrun-harness-claude";
|
|
5
|
+
import { startModelProxy } from "@parcha/agentrun-kernel/host";
|
|
6
|
+
import { randomBytes } from "node:crypto";
|
|
7
|
+
import { DEFAULT_HARNESS } from "../../harness.js";
|
|
8
|
+
import { sessionProvider } from "../../port-models.js";
|
|
9
|
+
import { KINDS } from "../journal-kinds.js";
|
|
10
|
+
import { CALL_REFUSED } from "@parcha/pi-durable-agent/timeline";
|
|
11
|
+
const PROVIDER = "agentrun-session";
|
|
12
|
+
const INPUT_REQUEST = "agentrun:input";
|
|
13
|
+
/** pi as an AgentAdapter for one claim's run. */
|
|
14
|
+
export function piAdapter(options) {
|
|
15
|
+
return {
|
|
16
|
+
// pi is the default harness: its id is the harness table's, never a literal of its own.
|
|
17
|
+
id: DEFAULT_HARNESS,
|
|
18
|
+
capabilities: () => ({}),
|
|
19
|
+
check: () => [],
|
|
20
|
+
open: (spec, io) => openPi(options, spec, io),
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
/** The names of the run's pi-native extensions' tools (options.extensions): the model is offered them beside the session's
|
|
24
|
+
* own (so it may call one), and pi runs it. Offered and run by one mechanism; sessionOn never also piTool-wraps a session
|
|
25
|
+
* tool a native extension already owns, so the name is in the request's tools exactly once. */
|
|
26
|
+
const nativeToolNames = (options) => (options.extensions ?? []).flatMap((extension) => extension.tools ?? []).map((tool) => tool.name);
|
|
27
|
+
async function openPi(options, spec, io) {
|
|
28
|
+
const { model } = options;
|
|
29
|
+
const context = withAbortSignal(io.signal, BACKGROUND_CONTEXT);
|
|
30
|
+
// The session's route: pi-ai's requests reach the provider only through this proxy, which admits and books each one
|
|
31
|
+
// through the runner's booking (io.models).
|
|
32
|
+
const proxy = await startModelProxy({
|
|
33
|
+
policy: await policyFor(options.provider, model, [...spec.tools.map((tool) => tool.name), ...nativeToolNames(options)]),
|
|
34
|
+
hooks: io.models,
|
|
35
|
+
model,
|
|
36
|
+
origin: options.provider.origin,
|
|
37
|
+
credential: async () => (await options.provider.credential()) ?? "",
|
|
38
|
+
...(options.price ? { price: options.price } : {}),
|
|
39
|
+
...(options.provider.headers ? { headers: options.provider.headers } : {}),
|
|
40
|
+
...(options.fetch ? { fetch: options.fetch } : {}),
|
|
41
|
+
...(options.redact ? { redact: options.redact } : {}),
|
|
42
|
+
}, randomBytes(32).toString("base64url"));
|
|
43
|
+
// An open that fails from here (the claim lost while the session opened) closes the proxy: its server would hold the
|
|
44
|
+
// runner's process open.
|
|
45
|
+
try {
|
|
46
|
+
return await sessionOn(proxy, options, spec, io, context);
|
|
47
|
+
}
|
|
48
|
+
catch (error) {
|
|
49
|
+
await proxy.close().catch(() => undefined);
|
|
50
|
+
throw error;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
/** The session proxy's policy on Messages: claude-agent's (no fork), with pi's tools, the host's own names (`tools`), as
|
|
54
|
+
* the names its client offers by themselves (its builtins). The CLI's own `mcp__hands__` prefix is not pi's: under it
|
|
55
|
+
* every one of pi's tool definitions would be dropped and the model offered none. Every other tool definition is
|
|
56
|
+
* dropped, and a request that offers the session's tools is the turn's answer request. `auth`: how the provider takes
|
|
57
|
+
* its credential (default x-api-key). */
|
|
58
|
+
export function piPolicy(model, tools, auth) {
|
|
59
|
+
return anthropicPolicy({ model, tools: [], builtins: tools, ...(auth ? { auth } : {}) });
|
|
60
|
+
}
|
|
61
|
+
/** The policy of the session's wire, the one each CLI harness of that wire applies (no fork of either): Anthropic's
|
|
62
|
+
* Messages as claude-agent's (piPolicy), OpenAI's Responses as codex's, which takes pi's tools as the session's own by
|
|
63
|
+
* name. Either way every other tool definition is dropped and the request that offers them is the turn's answer
|
|
64
|
+
* request. */
|
|
65
|
+
export async function policyFor(provider, model, tools) {
|
|
66
|
+
if (provider.api === "anthropic-messages")
|
|
67
|
+
return piPolicy(model, tools, provider.auth);
|
|
68
|
+
// Loaded when a session of its wire opens, as the runner loads the codex harness.
|
|
69
|
+
const { codexPolicy } = (await import("@parcha/agentrun-harness-codex"));
|
|
70
|
+
return codexPolicy({ model, tools });
|
|
71
|
+
}
|
|
72
|
+
/** The session on its proxy: pi's models through it, the host's tools and the gate as pi's extension, the root's state. */
|
|
73
|
+
async function sessionOn(proxy, options, spec, io, context) {
|
|
74
|
+
const { run, model, like } = options;
|
|
75
|
+
const { api } = options.provider;
|
|
76
|
+
const models = createModels();
|
|
77
|
+
// pi-ai's client of the session's wire at its proxy (port-models.ts sessionProvider). pi prices nothing itself (the
|
|
78
|
+
// proxy's booking does), so the model's cost stays $0. Image input on either wire (sessionModel): a host tool's images
|
|
79
|
+
// (a screenshot) reach the model in its tool result.
|
|
80
|
+
models.setProvider(sessionProvider(api, proxy, model, { provider: PROVIDER, keyName: "AGENTRUN_SESSION_KEY", ...(like ? { like } : {}), reasoning: false }));
|
|
81
|
+
run.setModels(models);
|
|
82
|
+
// A session tool whose name a native extension already owns is run by that extension (pi's own tool task), so it is not
|
|
83
|
+
// piTool-wrapped here too: one tool by that name on the agent, offered once.
|
|
84
|
+
const owned = new Set(nativeToolNames(options));
|
|
85
|
+
const tools = spec.tools.filter((tool) => !owned.has(tool.name)).map((tool) => piTool(tool, io));
|
|
86
|
+
// A refused call's words (the gate's deny, main's), by call: its result is those words alone, as main gives them.
|
|
87
|
+
const refusals = refusalWords();
|
|
88
|
+
const extension = defineExtension({
|
|
89
|
+
name: `agentrun-session-${spec.key}`,
|
|
90
|
+
tools,
|
|
91
|
+
hooks: [
|
|
92
|
+
hook(ToolTask, {
|
|
93
|
+
beforeTool: async (call, _api, hookContext) => {
|
|
94
|
+
if (!io.gate)
|
|
95
|
+
return undefined;
|
|
96
|
+
const answer = await io.gate({ callId: call.id, tool: call.name, args: (call.arguments ?? {}) }, hookContext);
|
|
97
|
+
if (answer === "allow")
|
|
98
|
+
return undefined;
|
|
99
|
+
if ("deny" in answer) {
|
|
100
|
+
refusals.refuse(call.id, answer.deny);
|
|
101
|
+
return { block: answer.deny };
|
|
102
|
+
}
|
|
103
|
+
// Parked: held until pi closes the Session, so the call never reaches its intent in this process.
|
|
104
|
+
return new Promise((_, reject) => {
|
|
105
|
+
const signal = hookContext.abortSignal;
|
|
106
|
+
if (signal?.aborted)
|
|
107
|
+
return reject(new Error("parked"));
|
|
108
|
+
signal?.addEventListener("abort", () => reject(new Error("parked")), { once: true });
|
|
109
|
+
});
|
|
110
|
+
},
|
|
111
|
+
// A call the gate refused: its result is main's words alone, an error, never pi's framing of a blocked call (its
|
|
112
|
+
// diagnostic, which the model reads as "<harness>[error] Tool call blocked: ..."). Every other result is pi's.
|
|
113
|
+
afterTool: async (call, result) => refusals.resultOf(call.id, result),
|
|
114
|
+
}),
|
|
115
|
+
// An answer's cost is the runner's booking of its request, never pi's $0 for a model it has no price for: set on
|
|
116
|
+
// the answer before pi stores it, so the answer, pi.usage and the live timeline carry it; unknown stays unknown.
|
|
117
|
+
hook(GenerationTask, {
|
|
118
|
+
afterResponse: async (message) => {
|
|
119
|
+
if (!io.bookedCost)
|
|
120
|
+
return;
|
|
121
|
+
const usd = await io.bookedCost();
|
|
122
|
+
if (usd === undefined)
|
|
123
|
+
return;
|
|
124
|
+
const cost = message.usage?.cost;
|
|
125
|
+
if (cost)
|
|
126
|
+
cost.total = usd;
|
|
127
|
+
},
|
|
128
|
+
}),
|
|
129
|
+
],
|
|
130
|
+
});
|
|
131
|
+
run.registry.install(extension);
|
|
132
|
+
// The run's pi-native extensions (options.extensions), in the claim's registry beside the session's.
|
|
133
|
+
const native = options.extensions ?? [];
|
|
134
|
+
for (const each of native)
|
|
135
|
+
run.registry.install(each);
|
|
136
|
+
// The root conversation may exist already (the loop's session records live beside it, under it): its agent is set here,
|
|
137
|
+
// the session's model, the run's system text (pi's instructions, its parts as the CLI adapters join them), this
|
|
138
|
+
// session's tools and the run's native extensions, on every open. A conversation a native tool opens takes this agent's
|
|
139
|
+
// model (pi copies its owner's), so its requests go through this session's proxy.
|
|
140
|
+
const instructions = spec.system.join("\n\n");
|
|
141
|
+
const agent = { model: { provider: PROVIDER, modelId: model }, extensions: [extension, ...native], ...(instructions ? { instructions } : {}) };
|
|
142
|
+
const root = await run.harness.root(context, { agent });
|
|
143
|
+
await root.configure(agent, context);
|
|
144
|
+
// The run's input submission, if one was placed: its state says where the session is. Answered: idle. Open, or settled
|
|
145
|
+
// unanswered (a failed turn whose end the loop never read: a claim lost before the run's end landed): an open turn,
|
|
146
|
+
// whose end recover() reads, so a failed turn ends the run failed, never as a completed one.
|
|
147
|
+
let input;
|
|
148
|
+
/** The session closed (its proxy with it): its port gives no route. */
|
|
149
|
+
let closed = false;
|
|
150
|
+
const existing = await run.harness.commit((tx) => tx.submissionByRequest(root.id, INPUT_REQUEST), context);
|
|
151
|
+
if (existing)
|
|
152
|
+
input = await run.harness.submission(existing.id, context);
|
|
153
|
+
let state = existing === undefined ? "new" : existing.status === "done" ? "idle" : "open_turn";
|
|
154
|
+
let running;
|
|
155
|
+
const watch = (submission) => {
|
|
156
|
+
running = submission.wait(context).then((record) => {
|
|
157
|
+
state = "idle";
|
|
158
|
+
const status = record.status === "done" ? "completed" : "failed";
|
|
159
|
+
io.onEvent({ type: "turn_end", status });
|
|
160
|
+
return { status };
|
|
161
|
+
}, (error) => {
|
|
162
|
+
io.onEvent({ type: "turn_end", status: "interrupted" });
|
|
163
|
+
return { status: "interrupted", error: error.message };
|
|
164
|
+
});
|
|
165
|
+
};
|
|
166
|
+
// No watch here: recover() starts it. A watch from open would set state idle as soon as a settled (or fast-recovered)
|
|
167
|
+
// turn's wait returned, before the loop read state, and the loop would take the turn as never placed and so completed.
|
|
168
|
+
return {
|
|
169
|
+
get state() {
|
|
170
|
+
return state;
|
|
171
|
+
},
|
|
172
|
+
async send(text, options) {
|
|
173
|
+
// The run's first input under INPUT_REQUEST; a follow-up (a raised run's turn) under its own id, a turn of its own.
|
|
174
|
+
// With `origin` (a trigger's first input), the host's input entry carries it, as a trigger's steer's does.
|
|
175
|
+
const entry = options?.origin ? { entry: { kind: KINDS.input, data: { origin: options.origin } } } : {};
|
|
176
|
+
input = await root.submit({ type: "input", content: text, requestId: options?.id ?? INPUT_REQUEST, ...entry }, context);
|
|
177
|
+
state = "open_turn";
|
|
178
|
+
watch(input);
|
|
179
|
+
},
|
|
180
|
+
async recover() {
|
|
181
|
+
// pi recovers its own tasks when its Harness opens; the turn is the input's.
|
|
182
|
+
if (input)
|
|
183
|
+
watch(input);
|
|
184
|
+
},
|
|
185
|
+
async settleOpenTurn() {
|
|
186
|
+
await root.abort(context).catch(() => undefined);
|
|
187
|
+
await run.harness.waitForIdle(context).catch(() => undefined);
|
|
188
|
+
state = "idle";
|
|
189
|
+
},
|
|
190
|
+
async turnEnd() {
|
|
191
|
+
if (!running)
|
|
192
|
+
throw new Error("pi: no turn is in flight");
|
|
193
|
+
return running;
|
|
194
|
+
},
|
|
195
|
+
async interrupt() {
|
|
196
|
+
await root.abort(context).catch(() => undefined);
|
|
197
|
+
},
|
|
198
|
+
async close() {
|
|
199
|
+
closed = true;
|
|
200
|
+
await proxy.close().catch(() => undefined);
|
|
201
|
+
},
|
|
202
|
+
// The session's own model route for a request the host sends beside pi's (a learned workflow's model node): its proxy
|
|
203
|
+
// with a side key minted for `label`, pi's model and the provider's wire (never a literal), so the request goes through
|
|
204
|
+
// the same policy, origin, credential, price and booking as pi's own, labelled. None once the session is closed.
|
|
205
|
+
port: (label) => (closed ? undefined : { url: proxy.url, key: proxy.sideKey(label), model, api }),
|
|
206
|
+
// A steer: pi places it in the turn in flight, at its next boundary. `id`: its request id (the command's), so the
|
|
207
|
+
// commit that places it is the one that takes its row. `origin` (a trigger's message): its input is the host's user
|
|
208
|
+
// entry (KINDS.input) with that origin, in the same submission, so the attribution lands with the message or not at all.
|
|
209
|
+
async steer(text, id, mode = "steer", options) {
|
|
210
|
+
const entry = options?.origin ? { entry: { kind: KINDS.input, data: { origin: options.origin } } } : {};
|
|
211
|
+
await root.submit({ type: "input", content: text, whenBusy: mode, ...(id ? { requestId: id } : {}), ...entry }, context);
|
|
212
|
+
},
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
/** A refused call's words by call (the gate's deny, main's words), held from the refusal (beforeTool's block) to the
|
|
216
|
+
* call's result (afterTool): a blocked result becomes those words alone, an error, as main gives a refused call's
|
|
217
|
+
* result, never pi's framing of a blocked call. Every other result is pi's own. `held`: the words still held. */
|
|
218
|
+
export function refusalWords() {
|
|
219
|
+
const words = new Map();
|
|
220
|
+
return {
|
|
221
|
+
refuse(callId, text) {
|
|
222
|
+
words.set(callId, text);
|
|
223
|
+
},
|
|
224
|
+
resultOf(callId, result) {
|
|
225
|
+
const text = words.get(callId);
|
|
226
|
+
// Let go on every result: the call has its one result now, whatever it is.
|
|
227
|
+
words.delete(callId);
|
|
228
|
+
const blocked = result.diagnostics?.some((diagnostic) => diagnostic.code === "blocked");
|
|
229
|
+
if (text === undefined || !blocked)
|
|
230
|
+
return undefined;
|
|
231
|
+
// Marked refused in its details (which the model never reads): its Timeline rows say it was refused, never that it
|
|
232
|
+
// ran and failed.
|
|
233
|
+
return { output: [{ type: "text", text }], isError: true, details: { [CALL_REFUSED]: true } };
|
|
234
|
+
},
|
|
235
|
+
get held() {
|
|
236
|
+
return words.size;
|
|
237
|
+
},
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
/** A host tool as a pi tool: replay-safe or at most once, its answer the host's text and any images it shows. Each call
|
|
241
|
+
* gets what pi's own tool task gives a tool: the calling agent's model, resolved in the session's models (its input and
|
|
242
|
+
* input limits, which a file read sizes an image by), and pi's output stream (the running tool's live slot). */
|
|
243
|
+
function piTool(tool, io) {
|
|
244
|
+
return defineTool({
|
|
245
|
+
name: tool.name,
|
|
246
|
+
description: tool.description,
|
|
247
|
+
parameters: tool.inputSchema,
|
|
248
|
+
replay: tool.replay === "safe" ? "safe" : "unsafe",
|
|
249
|
+
execute: async (args, api, toolContext) => {
|
|
250
|
+
io.onEvent({ type: "tool_start", callId: api.callId, name: tool.name, args });
|
|
251
|
+
const ref = (await api.agent(toolContext)).model;
|
|
252
|
+
const model = ref === undefined ? undefined : api.models.getModel(ref.provider, ref.modelId);
|
|
253
|
+
const answer = await tool.call(args ?? {}, {
|
|
254
|
+
callId: api.callId, signal: toolContext.abortSignal ?? io.signal,
|
|
255
|
+
...(model ? { model } : {}),
|
|
256
|
+
output: (chunk) => api.output(chunk),
|
|
257
|
+
});
|
|
258
|
+
io.onEvent({ type: "tool_end", callId: api.callId, name: tool.name, isError: Boolean(answer.isError), result: answer.text });
|
|
259
|
+
const images = (answer.images ?? []).map((image) => ({ type: "image", data: image.data, mimeType: image.mimeType }));
|
|
260
|
+
return { output: [{ type: "text", text: answer.text }, ...images], ...(answer.isError ? { isError: true } : {}) };
|
|
261
|
+
},
|
|
262
|
+
});
|
|
263
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** A runner beside the server on the same data directory (the CLI start's server-and-runner, and the `runner` subcommand):
|
|
2
|
+
* its own store handle (role runner), and the runner's dispatch (dispatch.ts) for each claimed run — pi on the kernel's
|
|
3
|
+
* adapter loop, a learning run on the learning loop. `env`: the runs' environment (runEnv of this process's, unless a
|
|
4
|
+
* caller hands its own: the template eval's in-process server, its faux's). Returns the runner and a close() that
|
|
5
|
+
* stops it and closes its store. */
|
|
6
|
+
export declare function runnerBeside(dataDir: string, { loops, env }?: {
|
|
7
|
+
loops?: number;
|
|
8
|
+
env?: NodeJS.ProcessEnv;
|
|
9
|
+
}): Promise<{
|
|
10
|
+
runner: Awaited<ReturnType<typeof import("./runner.js")["startRunner"]>>;
|
|
11
|
+
close: () => Promise<void>;
|
|
12
|
+
}>;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// A runner beside a server on the same data directory: the CLI start's server-and-runner, the `runner` subcommand and
|
|
2
|
+
// the template eval's in-process server (template-eval.ts), which would otherwise leave every run it starts queued.
|
|
3
|
+
/** A runner beside the server on the same data directory (the CLI start's server-and-runner, and the `runner` subcommand):
|
|
4
|
+
* its own store handle (role runner), and the runner's dispatch (dispatch.ts) for each claimed run — pi on the kernel's
|
|
5
|
+
* adapter loop, a learning run on the learning loop. `env`: the runs' environment (runEnv of this process's, unless a
|
|
6
|
+
* caller hands its own: the template eval's in-process server, its faux's). Returns the runner and a close() that
|
|
7
|
+
* stops it and closes its store. */
|
|
8
|
+
export async function runnerBeside(dataDir, { loops, env } = {}) {
|
|
9
|
+
const { startRunner } = await import("./runner.js");
|
|
10
|
+
const { dispatchRunner } = await import("./harness-loops.js");
|
|
11
|
+
const { routeOf } = await import("./model-route.js");
|
|
12
|
+
const { openRunnerStore, runEnv } = await import("./main.js");
|
|
13
|
+
const { computerDepsFrom } = await import("../workspace/index.js");
|
|
14
|
+
// The server's store, the runner's one way in (main.ts openRunnerStore, store/open.ts): Postgres when this process's
|
|
15
|
+
// AGENTRUN_STORE_URL secret names one, else SQLite in the data directory; a schema it does not know is RunnerRefused.
|
|
16
|
+
const { store } = await openRunnerStore(dataDir, process.env, (message) => void process.stderr.write(`agentrun-serve runner: ${message}\n`), undefined);
|
|
17
|
+
// The server's seal key (seal-key.ts), booted the one way and checked against the store: the one handed over (read
|
|
18
|
+
// through secrets.js, which moves it out of the environment as it loads), else the one in the data directory. A runner
|
|
19
|
+
// never starts without it, nor with a key that is not the store's: it seals the live-viewer tokens, and there is no
|
|
20
|
+
// stand-in key.
|
|
21
|
+
const { bootSealKey } = await import("../seal-key.js");
|
|
22
|
+
let seal;
|
|
23
|
+
try {
|
|
24
|
+
seal = await bootSealKey(store, dataDir, { role: "runner" });
|
|
25
|
+
}
|
|
26
|
+
catch (error) {
|
|
27
|
+
await store.close();
|
|
28
|
+
throw error;
|
|
29
|
+
}
|
|
30
|
+
// The beside-runner sees the server's environment as a separate runner would (runEnv, not withoutFaux): so an API run on
|
|
31
|
+
// a --faux server reaches the faux gateway and its computers. The run's claim-time computer is composed once, the one way
|
|
32
|
+
// (workspace/computer-deps.ts computerDepsFrom), from that same environment; a Docker computer's mounts by where this
|
|
33
|
+
// process's Docker has the data directory (box-paths.ts), read once.
|
|
34
|
+
const runs = env ?? runEnv(process.env);
|
|
35
|
+
const { dockerPathsForRuns } = await import("../box-paths.js");
|
|
36
|
+
const { hostAddressesOnce } = await import("../docker-host-addresses.js");
|
|
37
|
+
const computers = computerDepsFrom({ env: runs, store, sealKey: seal.key, dockerPaths: () => dockerPathsForRuns(runs, dataDir), hostAddresses: () => hostAddressesOnce(runs) });
|
|
38
|
+
const createLoop = dispatchRunner({ env: runs, data: dataDir, journal: (claim) => store.journal(claim), store, sealKey: seal.key, routeOf, computerForClaim: computers.computerForClaim, computerDeps: computers.computerDeps });
|
|
39
|
+
const runner = startRunner({ store, createLoop, ...(loops !== undefined ? { loops } : {}) });
|
|
40
|
+
return { runner, close: async () => { await runner.close(); await store.close(); seal.release(); } };
|
|
41
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { RunLaunch } from "../run-launch.js";
|
|
2
|
+
import type { SealedKeys } from "../store/store.js";
|
|
3
|
+
import type { Revision } from "@parcha/pi-durable-agent";
|
|
4
|
+
/** What claimSecrets reads the keys from: the one store (its sealed keys) and the runner's seal key, and the runner's base
|
|
5
|
+
* environment (its own, with no server secret in it: those are the store's). */
|
|
6
|
+
export interface ClaimSecretsDeps {
|
|
7
|
+
readonly store: {
|
|
8
|
+
readonly sealedKeys: Pick<SealedKeys, "get">;
|
|
9
|
+
};
|
|
10
|
+
/** The runner's seal key: with none, no saved key is opened, and only the environment's values are read. */
|
|
11
|
+
readonly sealKey: Buffer | undefined;
|
|
12
|
+
readonly env?: NodeJS.ProcessEnv;
|
|
13
|
+
}
|
|
14
|
+
/** The environment a claimed run's tools run under: the runner's base (its secrets stripped), with the keys the run's
|
|
15
|
+
* revision needs read from the store on top — the tool keys its tools unlock, the model keys its model needs, and its
|
|
16
|
+
* decision provider keys. A fresh object per claim, so no run's keys reach another's. */
|
|
17
|
+
export declare function claimSecrets(deps: ClaimSecretsDeps, revision: Revision, launch: Pick<RunLaunch, "plane" | "model">): Promise<NodeJS.ProcessEnv>;
|
|
18
|
+
/** Every model key a model route reads by name: each of pi-ai's providers' (model.ts PROVIDER_KEYS) and the gateway's. */
|
|
19
|
+
export declare const MODEL_KEY_NAMES: readonly string[];
|
|
20
|
+
/** `env` for a model route (model-route.ts routeOf, a CLI's providerFor): the runner's own environment, its secrets kept
|
|
21
|
+
* as runEnv makes them (readable by name, never enumerable), with each model key it lacks taken from `opened`: the keys
|
|
22
|
+
* a claim opened from the store (claimSecrets, scoped to the run's model), or every one the server holds
|
|
23
|
+
* (savedModelKeys). So a model key saved in Settings → Model keys reaches the next run's model requests with no
|
|
24
|
+
* restart, as a tool key reaches its tools; a key set where AgentRun starts still wins (claimSecrets reads it first),
|
|
25
|
+
* and a provider the runner holds any key of gets none of its saved ones.
|
|
26
|
+
* The keys added are never enumerable either: a spread of the result, or a spawn given it, carries none of them. */
|
|
27
|
+
export declare function withModelKeys(env: NodeJS.ProcessEnv, opened: NodeJS.ProcessEnv): NodeJS.ProcessEnv;
|
|
28
|
+
/** Every model key the server holds, for a model route with no revision to scope it by (a learning run's grade): each
|
|
29
|
+
* by its name from `deps.env` first, then the store's sealed value, as claimSecrets reads them. */
|
|
30
|
+
export declare function savedModelKeys(deps: ClaimSecretsDeps): Promise<NodeJS.ProcessEnv>;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
// The secrets a claimed run's tools get, read from the one store (store.sealedKeys, each sealed under the runner's seal
|
|
2
|
+
// key), never from this process's environment or a pipe (the old per-run process read its own over a pipe; the runner is
|
|
3
|
+
// one process for many runs). Scoped to the run as the old per-run environment was: the keys its revision's tools unlock
|
|
4
|
+
// and its model needs (runs.ts keysFor/needsOf), and its decision provider keys (decisions.ts decisionKeysFor, Parallel's
|
|
5
|
+
// where a web tool resolves there), and no other. So a run that names no monid never gets the monid key, and two runs on
|
|
6
|
+
// one runner never see each other's keys: each claim reads its own, into its own environment. (MCP credentials are the
|
|
7
|
+
// other per-claim secret; they come through mcp-claim.ts, which already opens them from the store under the claim.)
|
|
8
|
+
import { decisionKeysFor } from "../decisions.js";
|
|
9
|
+
import { GATEWAY_KEY_ENV, PROVIDER_KEYS } from "../model.js";
|
|
10
|
+
import { keysFor, needsOf, RUN_SECRETS } from "../run-secrets.js";
|
|
11
|
+
import { DECISION_KEYS, withoutSecrets } from "../secrets.js";
|
|
12
|
+
import { getSealedKey } from "../server-keys.js";
|
|
13
|
+
import { handsParallel } from "../tool-plane.js";
|
|
14
|
+
/** Every server secret a run might be handed (runs.ts RUN_SECRETS is the tool and model keys; the decision keys go beside
|
|
15
|
+
* them). Read from the store into a working environment, then scoped to the run below. */
|
|
16
|
+
const CANDIDATES = [...new Set([...RUN_SECRETS, ...DECISION_KEYS])];
|
|
17
|
+
/** The environment a claimed run's tools run under: the runner's base (its secrets stripped), with the keys the run's
|
|
18
|
+
* revision needs read from the store on top — the tool keys its tools unlock, the model keys its model needs, and its
|
|
19
|
+
* decision provider keys. A fresh object per claim, so no run's keys reach another's. */
|
|
20
|
+
export async function claimSecrets(deps, revision, launch) {
|
|
21
|
+
const base = withoutSecrets(deps.env ?? {});
|
|
22
|
+
// Every candidate secret into a working environment, then scoped to the run below so a key the run does not need is never
|
|
23
|
+
// put on the environment its tools run under. The server process's own environment value wins over the store's by the same
|
|
24
|
+
// name (the secrets rule 4: env always overrides a pasted value), so a key set where the server starts is not shadowed by a
|
|
25
|
+
// stale one saved in the store.
|
|
26
|
+
const working = { ...base };
|
|
27
|
+
// A name present with no value (`-e NAME`, an empty optional secret) is not a key: the store's saved one stands.
|
|
28
|
+
for (const name of CANDIDATES) {
|
|
29
|
+
const value = deps.env?.[name] || (deps.sealKey ? await getSealedKey(deps.store, deps.sealKey, name) : undefined);
|
|
30
|
+
if (value !== undefined)
|
|
31
|
+
working[name] = value;
|
|
32
|
+
}
|
|
33
|
+
const needs = await needsOf(revision);
|
|
34
|
+
// An agentic run's model keys are its PINNED model's (the launch's, chosen at its start), the one its route sends, never
|
|
35
|
+
// the host's default now: a key saved since the run started (another provider's, now first) would otherwise be opened
|
|
36
|
+
// in its place, and the run would hold a key its model never sends and lack the one it does.
|
|
37
|
+
const scoped = launch.model && !needs.tiers ? { ...needs, model: `${launch.model.provider}/${launch.model.modelId}` } : needs;
|
|
38
|
+
const env = { ...base };
|
|
39
|
+
for (const name of keysFor(scoped, working))
|
|
40
|
+
if (working[name] !== undefined)
|
|
41
|
+
env[name] = working[name];
|
|
42
|
+
const decision = decisionKeysFor(working, { providers: needs.decisionProviders, parallelWeb: launch.plane ? handsParallel(launch.plane) : false });
|
|
43
|
+
for (const [name, value] of Object.entries(decision))
|
|
44
|
+
env[name] = value;
|
|
45
|
+
return env;
|
|
46
|
+
}
|
|
47
|
+
/** Every model key a model route reads by name: each of pi-ai's providers' (model.ts PROVIDER_KEYS) and the gateway's. */
|
|
48
|
+
export const MODEL_KEY_NAMES = [...new Set([...Object.values(PROVIDER_KEYS).flat(), GATEWAY_KEY_ENV])];
|
|
49
|
+
/** `env` for a model route (model-route.ts routeOf, a CLI's providerFor): the runner's own environment, its secrets kept
|
|
50
|
+
* as runEnv makes them (readable by name, never enumerable), with each model key it lacks taken from `opened`: the keys
|
|
51
|
+
* a claim opened from the store (claimSecrets, scoped to the run's model), or every one the server holds
|
|
52
|
+
* (savedModelKeys). So a model key saved in Settings → Model keys reaches the next run's model requests with no
|
|
53
|
+
* restart, as a tool key reaches its tools; a key set where AgentRun starts still wins (claimSecrets reads it first),
|
|
54
|
+
* and a provider the runner holds any key of gets none of its saved ones.
|
|
55
|
+
* The keys added are never enumerable either: a spread of the result, or a spawn given it, carries none of them. */
|
|
56
|
+
export function withModelKeys(env, opened) {
|
|
57
|
+
// A provider's keys are filled together or not at all: only when the runner holds none of them. A credential handed where
|
|
58
|
+
// AgentRun started (ANTHROPIC_AUTH_TOKEN, an AWS key id) is never mixed with a saved key of the same provider, which its
|
|
59
|
+
// route would send first (ANTHROPIC_API_KEY before the token) or pair with it (another AWS name). A key held empty
|
|
60
|
+
// (`-e NAME` with no value, which runEnv keeps as a fixed property) holds nothing: the saved key takes its place.
|
|
61
|
+
const fill = new Map();
|
|
62
|
+
for (const names of [...Object.values(PROVIDER_KEYS), [GATEWAY_KEY_ENV]]) {
|
|
63
|
+
if (names.some((name) => env[name]))
|
|
64
|
+
continue;
|
|
65
|
+
for (const name of names)
|
|
66
|
+
if (opened[name])
|
|
67
|
+
fill.set(name, opened[name]);
|
|
68
|
+
}
|
|
69
|
+
// Every property of `env` as it is (enumerable or not, as runEnv made it), but a name the fill replaces, so a fixed empty
|
|
70
|
+
// property is never copied in its way.
|
|
71
|
+
const out = {};
|
|
72
|
+
for (const name of Object.getOwnPropertyNames(env)) {
|
|
73
|
+
if (!fill.has(name))
|
|
74
|
+
Object.defineProperty(out, name, Object.getOwnPropertyDescriptor(env, name));
|
|
75
|
+
}
|
|
76
|
+
for (const [name, value] of fill)
|
|
77
|
+
Object.defineProperty(out, name, { value, enumerable: false, writable: false, configurable: false });
|
|
78
|
+
return out;
|
|
79
|
+
}
|
|
80
|
+
/** Every model key the server holds, for a model route with no revision to scope it by (a learning run's grade): each
|
|
81
|
+
* by its name from `deps.env` first, then the store's sealed value, as claimSecrets reads them. */
|
|
82
|
+
export async function savedModelKeys(deps) {
|
|
83
|
+
const out = {};
|
|
84
|
+
for (const name of MODEL_KEY_NAMES) {
|
|
85
|
+
const value = deps.env?.[name] || (deps.sealKey ? await getSealedKey(deps.store, deps.sealKey, name) : undefined);
|
|
86
|
+
if (value !== undefined)
|
|
87
|
+
out[name] = value;
|
|
88
|
+
}
|
|
89
|
+
return out;
|
|
90
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type RunLaunch } from "../run-launch.js";
|
|
2
|
+
import { type AdapterRun, type AdapterRunSpec } from "./adapter-loop.js";
|
|
3
|
+
import { type AdapterSpecDeps } from "./adapter-run-spec.js";
|
|
4
|
+
import type { Claim } from "./loop-contract.js";
|
|
5
|
+
/** The shared claim-time computer types live on the base spec (adapter-run-spec.ts), re-exported for this module's API. */
|
|
6
|
+
export type { ClaimComputer, ClaimDeps, ClaimLaunch, ComputerForClaim } from "./adapter-run-spec.js";
|
|
7
|
+
/** What the runner hands the CLI spec builder: the same deps the pi spec takes (computerForClaim, computerDeps and
|
|
8
|
+
* makeArchilDisk are on AdapterSpecDeps, shared by both). One per runner. */
|
|
9
|
+
export type CliSpecDeps = AdapterSpecDeps;
|
|
10
|
+
/**
|
|
11
|
+
* One claimed CLI run's AdapterRunSpec, built from its launch record and its revision.
|
|
12
|
+
*
|
|
13
|
+
* `launch` is the run's launch body (run-launch.ts), read by the dispatch at the claim; `run` is the loop's open Harness
|
|
14
|
+
* (AdapterRun: a CLI adds no turns to it, its records are its session's); `deps` is the runner's store, data directory
|
|
15
|
+
* and environment; `claim` is the claim this pass holds.
|
|
16
|
+
*/
|
|
17
|
+
export declare function cliRunSpecFromLaunch(launch: RunLaunch, run: AdapterRun, deps: CliSpecDeps, claim: Claim): Promise<AdapterRunSpec>;
|