@parcha/agentrun-serve 0.1.0-beta.30 → 0.1.0-beta.32
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 +472 -0
- package/NOTICE +18 -0
- package/README.md +1042 -240
- package/dist/adapter-facts.d.ts +3 -0
- package/dist/adapter-facts.js +5 -0
- package/dist/adapters.d.ts +64 -140
- package/dist/adapters.js +153 -377
- package/dist/agents-store.d.ts +146 -0
- package/dist/agents-store.js +359 -0
- package/dist/agents.d.ts +12 -5
- package/dist/agents.js +40 -17
- package/dist/app.d.ts +2 -4
- package/dist/app.js +227 -97
- 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.d.ts +2 -1
- package/dist/background.js +69 -29
- package/dist/bounds.d.ts +26 -0
- package/dist/bounds.js +137 -0
- package/dist/box-egress-vm.d.ts +126 -0
- package/dist/box-egress-vm.js +364 -0
- package/dist/box-egress.d.ts +19 -8
- package/dist/box-egress.js +27 -15
- package/dist/box-paths.d.ts +59 -0
- package/dist/box-paths.js +92 -0
- package/dist/box-relay-vm.d.ts +4 -0
- package/dist/box-relay-vm.js +103 -55
- package/dist/box-relay.d.ts +2 -0
- package/dist/box-relay.js +2 -2
- package/dist/boxes.d.ts +20 -3
- package/dist/boxes.js +67 -14
- 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 +276 -21
- package/dist/browser-live.d.ts +124 -0
- package/dist/browser-live.js +324 -0
- package/dist/browser-person.d.ts +168 -0
- package/dist/browser-person.js +769 -0
- package/dist/budget.d.ts +80 -0
- package/dist/budget.js +211 -0
- package/dist/cap.d.ts +274 -63
- package/dist/cap.js +599 -188
- package/dist/cli.js +226 -16
- 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-35-7aeIZ.js +519 -0
- package/dist/console/assets/index-Cejbov-Y.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/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 +31 -4
- package/dist/decisions.js +66 -8
- package/dist/disk.d.ts +33 -0
- package/dist/disk.js +85 -0
- package/dist/door-line.d.ts +23 -0
- package/dist/door-line.js +83 -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 -32
- package/dist/files.js +9 -117
- 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 +14 -44
- package/dist/grade.js +55 -233
- 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-app.d.ts +33 -4
- package/dist/harness-app.js +539 -85
- package/dist/harness-install.d.ts +120 -0
- package/dist/harness-install.js +359 -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 +7 -28
- package/dist/harness.js +15 -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 +13 -0
- package/dist/host-check.js +35 -0
- 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 +208 -222
- 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/key-words.d.ts +37 -0
- package/dist/key-words.js +40 -0
- 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 +25 -9
- package/dist/learn/grade.js +98 -50
- 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 +72 -41
- package/dist/learn/secrets.d.ts +15 -7
- package/dist/learn/secrets.js +66 -16
- package/dist/learn/seed-check.d.ts +74 -0
- package/dist/learn/seed-check.js +103 -0
- package/dist/learn/skills.d.ts +7 -1
- package/dist/learn/skills.js +21 -4
- package/dist/learned-workflow.d.ts +12 -2
- package/dist/learned-workflow.js +9 -5
- package/dist/learning-routes.d.ts +107 -31
- package/dist/learning-routes.js +358 -403
- package/dist/learning-run.d.ts +61 -54
- package/dist/learning-run.js +183 -205
- package/dist/learning-words.d.ts +10 -8
- package/dist/learning-words.js +29 -13
- package/dist/learning.d.ts +186 -113
- package/dist/learning.js +345 -381
- 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 +129 -0
- package/dist/mcp-gateway.js +508 -0
- package/dist/mcp-meta.d.ts +20 -0
- package/dist/mcp-meta.js +50 -0
- 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 +185 -34
- package/dist/mcp-servers.js +304 -298
- 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 +965 -111
- package/dist/owner.d.ts +46 -10
- package/dist/owner.js +123 -43
- package/dist/page.d.ts +12 -0
- package/dist/page.js +28 -2
- package/dist/paid-calls.d.ts +71 -2
- package/dist/paid-calls.js +125 -5
- package/dist/pdf-pages.d.ts +16 -14
- package/dist/pdf-pages.js +88 -58
- package/dist/place.d.ts +18 -15
- package/dist/place.js +36 -18
- package/dist/port-models.d.ts +53 -0
- package/dist/port-models.js +93 -0
- package/dist/print.d.ts +7 -0
- package/dist/print.js +13 -0
- 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/request-start.d.ts +6 -1
- package/dist/request-start.js +41 -10
- package/dist/result.d.ts +13 -2
- package/dist/result.js +4 -5
- package/dist/run-box.d.ts +22 -3
- package/dist/run-box.js +91 -20
- 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 +64 -0
- package/dist/run-db.js +155 -0
- package/dist/run-files.d.ts +31 -0
- package/dist/run-files.js +125 -0
- package/dist/run-holder.d.ts +52 -0
- package/dist/run-holder.js +139 -0
- package/dist/run-launch.d.ts +72 -0
- package/dist/run-launch.js +108 -0
- package/dist/run-learning-served.d.ts +43 -0
- package/dist/run-learning-served.js +16 -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-timeline-served.d.ts +13 -0
- package/dist/run-timeline-served.js +69 -0
- package/dist/run-view.d.ts +436 -0
- package/dist/run-view.js +620 -0
- package/dist/runnable.d.ts +36 -4
- package/dist/runnable.js +157 -31
- package/dist/runner/adapter-loop.d.ts +237 -0
- package/dist/runner/adapter-loop.js +1625 -0
- package/dist/runner/adapter-run-spec.d.ts +216 -0
- package/dist/runner/adapter-run-spec.js +537 -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 +99 -0
- package/dist/runner/adapters/pi.js +260 -0
- package/dist/runner/beside.d.ts +12 -0
- package/dist/runner/beside.js +30 -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 +371 -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 +211 -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 +88 -0
- package/dist/runner/loop-contract.d.ts +153 -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 +89 -0
- package/dist/runner/main.js +282 -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 +183 -0
- package/dist/runner/pi-stop.d.ts +6 -0
- package/dist/runner/pi-stop.js +8 -0
- package/dist/runner/redact.d.ts +26 -0
- package/dist/runner/redact.js +51 -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 +801 -0
- package/dist/runs-over-store.d.ts +203 -0
- package/dist/runs-over-store.js +396 -0
- package/dist/runs.d.ts +360 -222
- package/dist/runs.js +1619 -536
- package/dist/seal-key.d.ts +30 -0
- package/dist/seal-key.js +141 -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 +178 -0
- package/dist/secret-writes.d.ts +147 -0
- package/dist/secret-writes.js +144 -0
- package/dist/secrets.d.ts +22 -0
- package/dist/secrets.js +37 -4
- package/dist/served-only.d.ts +5 -0
- package/dist/served-only.js +12 -0
- 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 +73 -0
- package/dist/server.d.ts +152 -74
- package/dist/server.js +1757 -588
- 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 +34 -0
- package/dist/store/open.js +30 -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 +106 -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 +1337 -0
- package/dist/store/sqlite/worker.d.ts +78 -0
- package/dist/store/sqlite/worker.js +242 -0
- package/dist/store/store.d.ts +1253 -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 +30 -0
- package/dist/store-reads/journal.js +120 -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 +305 -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 +183 -37
- package/dist/tool-gate.js +450 -99
- package/dist/tool-keys-store.d.ts +110 -0
- package/dist/tool-keys-store.js +291 -0
- package/dist/tool-keys.d.ts +27 -13
- package/dist/tool-keys.js +24 -10
- package/dist/tool-plane.d.ts +115 -25
- package/dist/tool-plane.js +251 -74
- 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 +344 -65
- 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 +115 -0
- package/dist/trigger-secrets-shown.d.ts +66 -0
- package/dist/trigger-secrets-shown.js +77 -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 +56 -21
- 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 +58 -0
- package/dist/workspace/computer-deps.js +113 -0
- package/dist/workspace/computer-for-claim.d.ts +115 -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 +12 -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 +3 -17
- package/dist/workspace.js +6 -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 +13 -3
- package/package.json +36 -25
- 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/console/assets/index-34jfpIbQ.js +0 -481
- package/dist/console/assets/index-DUHbWcIP.css +0 -1
- package/dist/trigger-secrets.d.ts +0 -32
- package/dist/trigger-secrets.js +0 -143
package/dist/cli.js
CHANGED
|
@@ -7,14 +7,23 @@ import { secret } from "./secrets.js";
|
|
|
7
7
|
import "./quiet-sqlite-warning.js";
|
|
8
8
|
import { parseArgs } from "node:util";
|
|
9
9
|
import { spawn } from "node:child_process";
|
|
10
|
-
import {
|
|
10
|
+
import { accessSync, chmodSync, constants as fsConstants, statSync, writeFileSync } from "node:fs";
|
|
11
|
+
import { dirname, join, resolve } from "node:path";
|
|
12
|
+
import { defaultData, removeOwnRecord, SERVER_FILE, writeDurableSync } from "./server-fs.js";
|
|
13
|
+
import { startedWith } from "./adapters.js";
|
|
14
|
+
import { REPEAT_MS, stopOnSignals } from "./stop-signals.js";
|
|
11
15
|
import { canOpen } from "./host.js";
|
|
12
16
|
import { resetPassword } from "./owner.js";
|
|
13
|
-
import { banner } from "./print.js";
|
|
14
|
-
import { DEFAULT_PORT, startServe } from "./server.js";
|
|
15
|
-
|
|
17
|
+
import { banner, boxImageLine } from "./print.js";
|
|
18
|
+
import { DEFAULT_PORT, fauxEnvOf, startServe } from "./server.js";
|
|
19
|
+
import { runnerBeside } from "./runner/beside.js";
|
|
20
|
+
const USAGE = `usage: agentrun-serve [--data DIR] [--listen ADDR] [--port N] [--open] [--faux MODULE] [--faux-browser MODULE] [--allow-host NAME ...] [--max-runs N] [--drain-timeout D] [--documents DIR] [--allow-code-nodes] [--learning on|off] [--learning-budget BYTES] [--grade-model MODEL] [--no-runner]
|
|
16
21
|
agentrun-serve reset-password [--data DIR]
|
|
22
|
+
agentrun-serve validate-template DIR
|
|
23
|
+
agentrun-serve eval-template DIR [--case NAME ...] [--runs N] [--server URL] [--grader-model PROVIDER/MODEL] [--report FILE] [--faux MODULE]
|
|
17
24
|
agentrun-serve import [--data DIR] [--from claude-code,codex,pi] [--dry-run] [--include-deleted] [--all] [--verbose] [--port N]
|
|
25
|
+
agentrun-serve runner --data DIR [--loops N] [--name NAME]
|
|
26
|
+
agentrun-serve runner --check --data DIR [--name NAME]
|
|
18
27
|
|
|
19
28
|
--data DIR the agent store and its runs (default ~/.local/share/agentrun/agents); the token is DIR/.token, mode 0600
|
|
20
29
|
--listen ADDR the address to listen on (default 127.0.0.1); on any other, every Host name is served and the token
|
|
@@ -23,6 +32,9 @@ const USAGE = `usage: agentrun-serve [--data DIR] [--listen ADDR] [--port N] [--
|
|
|
23
32
|
--open open the console in this machine's browser once the server listens (not in CI, nor on Linux with no
|
|
24
33
|
display)
|
|
25
34
|
--faux MODULE answer every model request from MODULE's default export: no key, no network
|
|
35
|
+
--faux-browser MODULE
|
|
36
|
+
with --faux only: the browser tool's provider and driver from MODULE's default export (a fake
|
|
37
|
+
browser, no vendor, no key), for the console's real-browser tests
|
|
26
38
|
--allow-host NAME another Host name to accept (repeatable)
|
|
27
39
|
--max-runs N the most runs at once (default AGENTRUN_MAX_RUNS, else as many pi runs as this host's memory
|
|
28
40
|
holds); each run also reserves its harness's memory, and over either a new run is 429
|
|
@@ -39,18 +51,23 @@ const USAGE = `usage: agentrun-serve [--data DIR] [--listen ADDR] [--port N] [--
|
|
|
39
51
|
notes changed last, whole, while they fit
|
|
40
52
|
--grade-model MODEL the model that grades what a run proposes to learn (default AGENTRUN_SERVE_GRADE_MODEL, else the
|
|
41
53
|
strong tier, AGENT_MODEL_STRONG, else each run's own model), named as the strong tier takes one
|
|
54
|
+
--no-runner run the server alone, with no runner beside it (default: one runner beside the server); start one or
|
|
55
|
+
more \`agentrun-serve runner --data DIR\` processes on the same data directory to claim and run runs
|
|
42
56
|
|
|
43
57
|
Without --faux, a revision's model ("provider/model-id", or AGENT_MODEL when it names none; a workflow node's tier maps
|
|
44
58
|
to AGENT_MODEL_FAST or AGENT_MODEL_STRONG, each falling back to AGENT_MODEL) is served by pi-ai's providers with their
|
|
45
59
|
keys from the environment, or, with AGENT_MODEL_BASE_URL, by that one OpenAI Responses gateway (AGENT_MODEL_API_KEY when
|
|
46
|
-
it needs a key). AGENTRUN_TOKEN, when set, is the token in place of DIR/.token's, and is never printed; DIR/.token's is
|
|
60
|
+
it needs a key). AGENTRUN_TOKEN, when set, is the token in place of DIR/.token's (a DIR/.token from an earlier start is removed), and is never printed; DIR/.token's is
|
|
47
61
|
printed only by the start that made it. AGENTRUN_PUBLIC_URL, when set, is the address people open (a container's
|
|
48
62
|
published port, or a proxy's URL), and the link printed uses it; with none, Render's RENDER_EXTERNAL_URL is. stdout gets one line per request, per run start and
|
|
49
63
|
end, and per refused credential; AGENTRUN_LOG=quiet leaves out the request lines.
|
|
50
64
|
|
|
51
65
|
The page is for one person, who signs in with a password (AGENTRUN_ACCOUNTS=0 turns this off; the token works for
|
|
52
|
-
scripts and the CLI either way). With no AGENTRUN_PUBLIC_URL the first visit to the page sets the
|
|
53
|
-
setup link this server prints carries a code.
|
|
66
|
+
scripts and the CLI either way). With no AGENTRUN_PUBLIC_URL, listening on loopback, the first visit to the page sets the
|
|
67
|
+
password; with it, or on any other address, the setup link this server prints carries a code. Sign-in tries are limited
|
|
68
|
+
per address (an IPv6 one by its /64) and wrong passwords per server; past the limit a try waits, a minute at most.
|
|
69
|
+
Behind a proxy, set AGENTRUN_TRUSTED_PROXIES to its addresses or ranges (comma-separated; or loopback, linklocal,
|
|
70
|
+
uniquelocal) so each visitor counts by the address its X-Forwarded-For names; unset, that header is never read. Forgot the password: \`agentrun-serve reset-password --data DIR\` where the
|
|
54
71
|
data directory is (inside the container) clears it and signs every browser out, and the next visit sets a new one.
|
|
55
72
|
|
|
56
73
|
\`agentrun-serve import\` reads the Claude Code, Codex and pi sessions in your own home (~/.claude/projects,
|
|
@@ -61,7 +78,16 @@ import; run again, it imports only what it has not. Sessions written in the last
|
|
|
61
78
|
What is left out is counted by why; --verbose lists each file. --include-deleted keeps projects whose directory is gone (a
|
|
62
79
|
deleted worktree's); --all keeps those and temporary ones too. Each run keeps what its session used (tokens, requests, tools,
|
|
63
80
|
time at work), priced at the catalog's list prices when its source did not price it. Both end with a summary of every
|
|
64
|
-
session found, those imported before included, and the address to open the console at (--port as the server takes it)
|
|
81
|
+
session found, those imported before included, and the address to open the console at (--port as the server takes it).
|
|
82
|
+
|
|
83
|
+
\`agentrun-serve eval-template DIR\` runs a template package's eval cases (all, or each --case) as real runs of its agent
|
|
84
|
+
and grades each run with the case's graders (templates/README.md, "Running the evals"). By default on a server of its
|
|
85
|
+
own in this process, over a temp data directory removed at the end, so it never touches your server; --server URL runs
|
|
86
|
+
them on that server instead, its token in AGENTRUN_API_KEY, and archives the agents it made. --runs N runs each case N
|
|
87
|
+
times in place of its own count; --grader-model is the llm graders' model (default: the server's); --faux answers every
|
|
88
|
+
model request from MODULE, as the server's --faux does. Progress goes to stderr, a summary to stdout, the whole report
|
|
89
|
+
as JSON to --report FILE. Exit 0 when every case passed, 1 when one failed, 2 when the flags, the package or a case are
|
|
90
|
+
wrong and nothing ran. Real runs cost money: each case's prompt.md caps each of its runs (max_cost_usd).`;
|
|
65
91
|
if (process.argv[2] === "reset-password") {
|
|
66
92
|
let dir;
|
|
67
93
|
try {
|
|
@@ -76,6 +102,123 @@ if (process.argv[2] === "reset-password") {
|
|
|
76
102
|
console.log(`The password is cleared and every browser is signed out (${target}). The next visit to the page sets a new one.`);
|
|
77
103
|
process.exit(0);
|
|
78
104
|
}
|
|
105
|
+
// A template package folder checked by the one validator the server runs on the packages it ships (templates.ts): what
|
|
106
|
+
// it holds as one JSON line and 0, or each problem and 1. Nothing in the package runs.
|
|
107
|
+
if (process.argv[2] === "validate-template") {
|
|
108
|
+
const { PackageError, readPackage } = await import("./templates.js");
|
|
109
|
+
const { positionals } = parseArgs({ args: process.argv.slice(3), options: { data: { type: "string" } }, allowPositionals: true });
|
|
110
|
+
if (positionals.length !== 1) {
|
|
111
|
+
console.error(`agentrun-serve validate-template takes one folder.\n\n${USAGE}`);
|
|
112
|
+
process.exit(2);
|
|
113
|
+
}
|
|
114
|
+
try {
|
|
115
|
+
const { name, version, skills, evals } = readPackage(resolve(positionals[0]));
|
|
116
|
+
console.log(JSON.stringify({ valid: true, name, version, skills: Object.keys(skills).filter((path) => /^[^/]+\/SKILL\.md$/.test(path)).map((path) => path.split("/")[0]), evals }));
|
|
117
|
+
process.exit(0);
|
|
118
|
+
}
|
|
119
|
+
catch (error) {
|
|
120
|
+
if (!(error instanceof PackageError))
|
|
121
|
+
throw error;
|
|
122
|
+
console.error(error.message);
|
|
123
|
+
process.exit(1);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
// A template package's evals run and graded (template-eval.ts): on a server in this process over a temp data directory,
|
|
127
|
+
// or with --server on one already running, its token from AGENTRUN_API_KEY (the launcher hands it over its pipe, never
|
|
128
|
+
// in the environment or the arguments). Progress on stderr, the summary on stdout, the whole report as JSON to --report.
|
|
129
|
+
// 0: every case passed; 1: one failed; 2: the flags, the package or a case is wrong, and nothing ran. --data is taken and
|
|
130
|
+
// ignored, as validate-template's is: the npx launcher hands every server command one, and an eval's store is a temp one.
|
|
131
|
+
if (process.argv[2] === "eval-template") {
|
|
132
|
+
const { CaseError, evalTemplate, exitCodeOf, markdownReport } = await import("./template-eval.js");
|
|
133
|
+
const { PackageError } = await import("./templates.js");
|
|
134
|
+
const usage = (message) => (console.error(`agentrun-serve eval-template: ${message}\n\n${USAGE}`), process.exit(2));
|
|
135
|
+
const read = () => {
|
|
136
|
+
try {
|
|
137
|
+
return parseArgs({ args: process.argv.slice(3), allowPositionals: true, options: { case: { type: "string", multiple: true, default: [] }, runs: { type: "string" }, server: { type: "string" }, "grader-model": { type: "string" }, report: { type: "string" }, faux: { type: "string" }, data: { type: "string" } } });
|
|
138
|
+
}
|
|
139
|
+
catch (error) {
|
|
140
|
+
return usage(error.message);
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
const { values: given, positionals } = read();
|
|
144
|
+
if (positionals.length !== 1)
|
|
145
|
+
usage("it takes one package folder.");
|
|
146
|
+
if (given.runs !== undefined && !/^[1-9]\d{0,2}$/.test(given.runs))
|
|
147
|
+
usage("--runs takes a whole number from 1 to 999.");
|
|
148
|
+
if (given.server !== undefined && !(URL.canParse(given.server) && /^https?:$/.test(new URL(given.server).protocol)))
|
|
149
|
+
usage("--server takes the server's http(s) address.");
|
|
150
|
+
if (given.server !== undefined && given.faux !== undefined)
|
|
151
|
+
usage("--faux is the model of the server it starts itself, and --server names another server.");
|
|
152
|
+
const token = given.server === undefined ? undefined : secret("AGENTRUN_API_KEY") || secret("AGENTRUN_TOKEN");
|
|
153
|
+
if (given.server !== undefined && !token)
|
|
154
|
+
usage("--server needs that server's token in AGENTRUN_API_KEY.");
|
|
155
|
+
// The report is written after every case ran, so where it goes is checked now, before anything runs or is paid for.
|
|
156
|
+
if (given.report !== undefined) {
|
|
157
|
+
const folder = dirname(resolve(given.report));
|
|
158
|
+
const writable = (() => {
|
|
159
|
+
try {
|
|
160
|
+
accessSync(folder, fsConstants.W_OK);
|
|
161
|
+
const existing = statSync(resolve(given.report), { throwIfNoEntry: false });
|
|
162
|
+
// A report already there is written over: it must be a file this command can write.
|
|
163
|
+
if (existing)
|
|
164
|
+
accessSync(resolve(given.report), fsConstants.W_OK);
|
|
165
|
+
return statSync(folder).isDirectory() && !(existing?.isDirectory() ?? false);
|
|
166
|
+
}
|
|
167
|
+
catch {
|
|
168
|
+
return false;
|
|
169
|
+
}
|
|
170
|
+
})();
|
|
171
|
+
if (!writable)
|
|
172
|
+
usage(`--report's folder ${folder} is not a folder this command can write in, or the report's path is a folder or a file it can't write.`);
|
|
173
|
+
}
|
|
174
|
+
// The first Ctrl-C (or a stop) cancels the run in progress and cleans up what the eval made, as its end does: a run
|
|
175
|
+
// left going would go on spending. A second one leaves at once; one within a second of the first is the same Ctrl-C,
|
|
176
|
+
// reaching this process twice (stop-signals.ts REPEAT_MS).
|
|
177
|
+
const stop = new AbortController();
|
|
178
|
+
let stoppedAt = 0;
|
|
179
|
+
const onStop = () => {
|
|
180
|
+
if (stop.signal.aborted) {
|
|
181
|
+
if (Date.now() - stoppedAt > REPEAT_MS)
|
|
182
|
+
process.exit(130);
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
stoppedAt = Date.now();
|
|
186
|
+
console.error("agentrun-serve eval-template: stopping: cancelling the run in progress and cleaning up (again to leave now)");
|
|
187
|
+
stop.abort();
|
|
188
|
+
};
|
|
189
|
+
process.on("SIGINT", onStop);
|
|
190
|
+
process.on("SIGTERM", onStop);
|
|
191
|
+
try {
|
|
192
|
+
const report = await evalTemplate({
|
|
193
|
+
dir: resolve(positionals[0]), cases: given.case, ...(given.runs !== undefined ? { runs: Number(given.runs) } : {}),
|
|
194
|
+
...(given.server !== undefined ? { server: { baseUrl: given.server, token: token } } : {}), ...(given["grader-model"] !== undefined ? { graderModel: given["grader-model"] } : {}),
|
|
195
|
+
...(given.faux !== undefined ? { serve: { faux: resolve(given.faux) } } : {}), log: (line) => console.error(line), signal: stop.signal,
|
|
196
|
+
});
|
|
197
|
+
// A stop asked as the eval ended still stops it: no report, 130.
|
|
198
|
+
stop.signal.throwIfAborted();
|
|
199
|
+
if (given.report !== undefined)
|
|
200
|
+
writeFileSync(resolve(given.report), `${JSON.stringify(report, null, 2)}\n`);
|
|
201
|
+
process.stdout.write(markdownReport(report));
|
|
202
|
+
process.exit(exitCodeOf(report));
|
|
203
|
+
}
|
|
204
|
+
catch (error) {
|
|
205
|
+
if (stop.signal.aborted) {
|
|
206
|
+
console.error("agentrun-serve eval-template: stopped; no report.");
|
|
207
|
+
process.exit(130);
|
|
208
|
+
}
|
|
209
|
+
if (!(error instanceof PackageError || error instanceof CaseError))
|
|
210
|
+
throw error;
|
|
211
|
+
console.error(error.message);
|
|
212
|
+
process.exit(2);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
// The runner process (runner/main.ts): beside the server, its own store connection in --data, claiming runs until SIGTERM
|
|
216
|
+
// or SIGINT. Its exit: 2 bad arguments, 3 a store schema it does not know, 1 anything else, 0 closed. `--check` reads its
|
|
217
|
+
// heartbeat (0 fresh, 1 not).
|
|
218
|
+
if (process.argv[2] === "runner") {
|
|
219
|
+
const { runnerMain } = await import("./runner/main.js");
|
|
220
|
+
process.exit(await runnerMain(process.argv.slice(3)));
|
|
221
|
+
}
|
|
79
222
|
if (process.argv[2] === "import") {
|
|
80
223
|
const { importCommand } = await import("./import.js");
|
|
81
224
|
process.exit(await importCommand(process.argv.slice(3), USAGE));
|
|
@@ -91,6 +234,7 @@ try {
|
|
|
91
234
|
port: { type: "string" },
|
|
92
235
|
open: { type: "boolean", default: false },
|
|
93
236
|
faux: { type: "string" },
|
|
237
|
+
"faux-browser": { type: "string" },
|
|
94
238
|
"allow-host": { type: "string", multiple: true, default: [] },
|
|
95
239
|
"max-runs": { type: "string" },
|
|
96
240
|
"drain-timeout": { type: "string" },
|
|
@@ -99,6 +243,7 @@ try {
|
|
|
99
243
|
learning: { type: "string" },
|
|
100
244
|
"grade-model": { type: "string" },
|
|
101
245
|
"learning-budget": { type: "string" },
|
|
246
|
+
"no-runner": { type: "boolean", default: false },
|
|
102
247
|
help: { type: "boolean", short: "h", default: false },
|
|
103
248
|
},
|
|
104
249
|
}));
|
|
@@ -128,6 +273,10 @@ if (publicName) {
|
|
|
128
273
|
}
|
|
129
274
|
publicUrl = parsed.href.replace(/\/+$/, "");
|
|
130
275
|
}
|
|
276
|
+
if (values["faux-browser"] && !values.faux) {
|
|
277
|
+
console.error(`--faux-browser goes with --faux\n\n${USAGE}`);
|
|
278
|
+
process.exit(2);
|
|
279
|
+
}
|
|
131
280
|
const budget = values["learning-budget"];
|
|
132
281
|
if (budget !== undefined && !/^\d+$/.test(budget)) {
|
|
133
282
|
console.error(`--learning-budget takes a whole number of bytes\n\n${USAGE}`);
|
|
@@ -138,30 +287,91 @@ const given = secret("AGENTRUN_TOKEN") || undefined;
|
|
|
138
287
|
// A stdout its reader closed (a pipe left behind) loses the log lines, never the server.
|
|
139
288
|
process.stdout.on("error", () => undefined);
|
|
140
289
|
const accounts = process.env.AGENTRUN_ACCOUNTS !== "0";
|
|
290
|
+
// The Docker box image's first build said in words, as it starts and as it ends (print.ts boxImageLine); a line told
|
|
291
|
+
// before the banner is printed waits for it.
|
|
292
|
+
let imageSaid = false;
|
|
293
|
+
let bannered = false;
|
|
294
|
+
const early = [];
|
|
295
|
+
const onBoxImage = (state) => {
|
|
296
|
+
const line = boxImageLine(state, imageSaid);
|
|
297
|
+
if (line === undefined)
|
|
298
|
+
return;
|
|
299
|
+
imageSaid = true;
|
|
300
|
+
if (bannered)
|
|
301
|
+
console.log(line);
|
|
302
|
+
else
|
|
303
|
+
early.push(line);
|
|
304
|
+
};
|
|
305
|
+
// How it was started, for the hints that start it again (adapters.ts npxLine): itself and its runs read it.
|
|
306
|
+
Object.assign(process.env, startedWith({ ...(values.port !== undefined ? { port: values.port } : {}), open: values.open === true }));
|
|
141
307
|
let serve;
|
|
308
|
+
let serveOptions;
|
|
309
|
+
const trustedProxies = (process.env.AGENTRUN_TRUSTED_PROXIES ?? "").split(",").map((entry) => entry.trim()).filter(Boolean);
|
|
142
310
|
try {
|
|
143
|
-
serve = await startServe({
|
|
144
|
-
|
|
311
|
+
serve = await startServe(serveOptions = {
|
|
312
|
+
onBoxImage,
|
|
313
|
+
data, port, ...(values.port === undefined ? { nextFreePort: true } : {}), ...(values.listen ? { host: values.listen } : {}), ...(given ? { token: given } : {}), ...(values.faux ? { faux: values.faux } : {}), ...(values["faux-browser"] ? { fauxBrowser: values["faux-browser"] } : {}), allowHosts: values["allow-host"],
|
|
145
314
|
...(values["max-runs"] !== undefined ? { maxRuns: Number(values["max-runs"]) } : {}),
|
|
146
315
|
...(values["drain-timeout"] ? { drainTimeout: values["drain-timeout"] } : {}), ...(values.documents ? { documents: values.documents } : {}), ...(values["allow-code-nodes"] ? { allowCodeNodes: true } : {}), ...(values.learning !== undefined ? { learning: values.learning } : {}), ...(values["grade-model"] ? { gradeModel: values["grade-model"] } : {}), ...(budget !== undefined ? { learningBudget: Number(budget) } : {}), log: (line) => void process.stdout.write(`${line}\n`),
|
|
147
|
-
|
|
316
|
+
// The public address is the server's with accounts on or off: the Host names it serves, the webhook URLs it gives.
|
|
317
|
+
...(publicUrl ? { publicUrl } : {}),
|
|
318
|
+
...(accounts ? { accounts, openSetup: !publicUrl, countSessions: true } : {}),
|
|
319
|
+
// The proxies whose X-Forwarded-For the sign-in limit reads (comma-separated); none unless set.
|
|
320
|
+
...(trustedProxies.length ? { trustedProxies } : {}),
|
|
148
321
|
});
|
|
149
322
|
}
|
|
150
323
|
catch (error) {
|
|
151
324
|
console.error(`agentrun-serve: ${error.message}`);
|
|
152
325
|
process.exit(1);
|
|
153
326
|
}
|
|
327
|
+
// The start launches one runner beside the server on the same data dir (design: "server and runner"): it claims and runs
|
|
328
|
+
// every run, sharing only the store. With --no-runner the server runs alone, so the operator starts one or more separate
|
|
329
|
+
// `agentrun runner --data DIR` processes on the same data directory instead.
|
|
330
|
+
let runnerProc;
|
|
331
|
+
if (!values["no-runner"]) {
|
|
332
|
+
try {
|
|
333
|
+
// The beside-runner sees the server's test switches (server.ts fauxEnvOf: --faux and its modules), which the CLI hands
|
|
334
|
+
// the server as options, never through this process's environment: without them a --faux start's runner looks its faux
|
|
335
|
+
// model up in pi-ai's own catalog and every run fails on its first request. Assigned onto runEnv's result, never spread:
|
|
336
|
+
// its secrets are non-enumerable and a spread drops them.
|
|
337
|
+
const { runEnv } = await import("./runner/main.js");
|
|
338
|
+
runnerProc = await runnerBeside(data, { env: Object.assign(runEnv(process.env), fauxEnvOf(serveOptions)) });
|
|
339
|
+
}
|
|
340
|
+
catch (error) {
|
|
341
|
+
console.error(`agentrun-serve: the runner could not start: ${error.message}`);
|
|
342
|
+
await serve.close();
|
|
343
|
+
process.exit(1);
|
|
344
|
+
}
|
|
345
|
+
}
|
|
154
346
|
// A token from the environment is the operator's already, and the stored one is printed by the start that made it only.
|
|
155
347
|
const source = given ? "env" : serve.tokenMade ? "made" : "file";
|
|
156
348
|
for (const line of banner({ url: serve.url, baseUrl: serve.baseUrl, data, token: serve.token, source, accounts, boxes: serve.boxesLine, ...(values.listen ? { listen: values.listen } : {}), ...(publicUrl ? { publicUrl } : {}) }))
|
|
157
349
|
console.log(line);
|
|
158
|
-
//
|
|
159
|
-
|
|
350
|
+
// Open setup (no public address, a loopback listener): the link that sets the password. Any other start printed the
|
|
351
|
+
// setup link with its code as the code was made (owner.ts).
|
|
352
|
+
if (serve.setupUrl && serve.setupOpen)
|
|
160
353
|
console.log(`Set your password: ${serve.setupUrl} (the first visit sets it)`);
|
|
354
|
+
bannered = true;
|
|
355
|
+
for (const line of early.splice(0))
|
|
356
|
+
console.log(line);
|
|
161
357
|
// The console's page, once the server listens: never its sign-in link, whose token would sit in the opener's arguments
|
|
162
358
|
// and the browser's history.
|
|
163
359
|
if (values.open && canOpen(process.env))
|
|
164
360
|
spawn(process.platform === "darwin" ? "open" : "xdg-open", [`${publicUrl ?? serve.url}/`], { stdio: "ignore", detached: true }).on("error", () => { }).unref();
|
|
165
|
-
const
|
|
166
|
-
|
|
167
|
-
process
|
|
361
|
+
const record = join(resolve(data), SERVER_FILE);
|
|
362
|
+
// The record goes only while it is this server's: a server that takes the lock next writes its own, which this stop must
|
|
363
|
+
// not remove. One stop per press or process-manager stop; a later signal, or a stop past its deadline, stops at once
|
|
364
|
+
// (stop-signals.ts). The stop is in place before the record is written: a SIGTERM sent the moment the record appears is
|
|
365
|
+
// a clean stop that removes it, never the default end by signal that leaves it behind.
|
|
366
|
+
const stop = stopOnSignals({
|
|
367
|
+
close: () => (removeOwnRecord(record), Promise.all([runnerProc?.close() ?? Promise.resolve(), serve.close()]).then(() => undefined)),
|
|
368
|
+
stopping: () => serve.stopping(),
|
|
369
|
+
done: (code) => (removeOwnRecord(record), process.exit(code)),
|
|
370
|
+
say: (line) => console.error(line),
|
|
371
|
+
});
|
|
372
|
+
process.on("SIGINT", stop);
|
|
373
|
+
process.on("SIGTERM", stop);
|
|
374
|
+
// Written whole under a name of its own, then renamed into place: a reader in another process (the npx command, a test
|
|
375
|
+
// waiting for this server) that finds the record reads all of it, never a file made but not yet filled.
|
|
376
|
+
writeDurableSync(record, `${JSON.stringify({ base_url: serve.baseUrl, pid: process.pid, ...(serve.tokenFile ? { token_file: serve.tokenFile } : {}) })}\n`);
|
|
377
|
+
chmodSync(record, 0o600);
|
package/dist/coding-tools.d.ts
CHANGED
|
@@ -21,13 +21,25 @@ export type BoxedEnv = {
|
|
|
21
21
|
env(context: Context, note?: (summary: string) => Promise<void>): Promise<unknown>;
|
|
22
22
|
hostWork?: string;
|
|
23
23
|
bound?(): Promise<boolean>;
|
|
24
|
-
leftEnded?(context: Context): Promise<void>;
|
|
24
|
+
leftEnded?(context: Context): Promise<void>; /** Once, what the model is told of a box this process made in place of an earlier one's (run-box.ts BOX_REPLACED_NOTE). */
|
|
25
|
+
replaced?(): string | undefined;
|
|
25
26
|
};
|
|
27
|
+
/** A call's answer with what `box` has to tell the model first, once (its box replaced since the run's last process),
|
|
28
|
+
* asked once the box is had: its first line, in the output an answer with no content of its own is made of, and a text
|
|
29
|
+
* part before the answer's `output` blocks. */
|
|
30
|
+
export declare function withBoxNote<T>(box: Pick<BoxedEnv, "replaced">, output: (chunk: string) => void, call: () => Promise<T>): Promise<T>;
|
|
26
31
|
/** A boxed file tool's path as the box names it, or undefined when it leaves the box's work dir (`~` and `file:`
|
|
27
32
|
* included). A path under the run's own host work dir (another harness's cwd can name one) is the same file at
|
|
28
33
|
* BOX_WORK, the bind renamed one for one; every other host path (the data root, another run) is never taken for a box
|
|
29
34
|
* path. */
|
|
30
35
|
export declare function boxPath(path: string, hostWork?: string): string | undefined;
|
|
36
|
+
/** bash's timeout, in seconds: the default when a call names none, and the most any call gets (Claude Code's own 120 s
|
|
37
|
+
* and 600 s). A command that needs longer is a background process (bash_background). */
|
|
38
|
+
export declare const BASH_DEFAULT_TIMEOUT_S = 120;
|
|
39
|
+
export declare const BASH_MAX_TIMEOUT_S = 600;
|
|
40
|
+
/** The largest image read hands the model, in bytes: 3.75 MiB, whose base64 is the 5 MiB the strictest platform a
|
|
41
|
+
* harness sends images to takes (the claude-agent adapter's CLAUDE_AGENT_MAX_IMAGE_BYTES, Amazon Bedrock's). */
|
|
42
|
+
export declare const READ_IMAGE_MAX_BYTES = 3932160;
|
|
31
43
|
/** A run's coding tools by its place: on the runner, CodingTools (no bash); in a box, pi's read, write, edit and bash,
|
|
32
44
|
* each with its arguments, output and replay as pi ships it and its environment the box's, and the background tools
|
|
33
45
|
* (background.ts), each call a command in the box. A file tool's path stays in the box's work dir; bash's command is
|
package/dist/coding-tools.js
CHANGED
|
@@ -20,10 +20,9 @@ import { ArchilCodingTools } from "@parcha/pi-durable-disk";
|
|
|
20
20
|
import { BACKGROUND_TOOLS, backgroundTools, SHELL_TOOLS } from "./background.js";
|
|
21
21
|
import { boundFiles } from "./bound-files.js";
|
|
22
22
|
import { BOX_WORK } from "./place.js";
|
|
23
|
+
import { forModelBlocks } from "./result.js";
|
|
23
24
|
import { asGivenRefusals, refuseOutsideWorkspace } from "./workspace-paths.js";
|
|
24
25
|
import { writesHeld } from "./workspace.js";
|
|
25
|
-
// pi-durable-disk's types name the pi-durable it resolves, which a build at another pi version (the pi-floor legs) can
|
|
26
|
-
// hold apart from this package's own: the extension crosses that boundary as a value, typed on this side.
|
|
27
26
|
const pis = ArchilCodingTools;
|
|
28
27
|
/** pi's coding tools on the runner, without bash, each refusal of a path outside the workspace named by the path the
|
|
29
28
|
* call gave (`asGivenRefusals`): the model reads that refusal, and the run's timeline shows it. */
|
|
@@ -34,6 +33,19 @@ const PI_BOXED = ["read", "write", "edit", "bash"];
|
|
|
34
33
|
export { SHELL_TOOLS };
|
|
35
34
|
/** The tools a box runs, by name: pi's four and the background tools. */
|
|
36
35
|
export const BOXED_TOOLS = [...PI_BOXED, ...BACKGROUND_TOOLS];
|
|
36
|
+
/** A call's answer with what `box` has to tell the model first, once (its box replaced since the run's last process),
|
|
37
|
+
* asked once the box is had: its first line, in the output an answer with no content of its own is made of, and a text
|
|
38
|
+
* part before the answer's `output` blocks. */
|
|
39
|
+
export async function withBoxNote(box, output, call) {
|
|
40
|
+
const note = box.replaced?.();
|
|
41
|
+
if (!note)
|
|
42
|
+
return call();
|
|
43
|
+
output(`${note}\n`);
|
|
44
|
+
const result = await call();
|
|
45
|
+
// Before the answer's model blocks, under `output` (pi's result key).
|
|
46
|
+
const fields = result;
|
|
47
|
+
return fields && Array.isArray(fields.output) ? { ...result, output: [{ type: "text", text: note }, ...fields.output] } : result;
|
|
48
|
+
}
|
|
37
49
|
/** A failed call's error with what the file environment said, where pi's message gives only its code (edit's "Error
|
|
38
50
|
* code: permission_denied."), so the model reads why and what it can do. */
|
|
39
51
|
const withCause = (error) => {
|
|
@@ -51,6 +63,78 @@ export function boxPath(path, hostWork) {
|
|
|
51
63
|
const at = posix.resolve(BOX_WORK, named);
|
|
52
64
|
return at === BOX_WORK || at.startsWith(`${BOX_WORK}/`) ? named : undefined;
|
|
53
65
|
}
|
|
66
|
+
/** bash's timeout, in seconds: the default when a call names none, and the most any call gets (Claude Code's own 120 s
|
|
67
|
+
* and 600 s). A command that needs longer is a background process (bash_background). */
|
|
68
|
+
export const BASH_DEFAULT_TIMEOUT_S = 120;
|
|
69
|
+
export const BASH_MAX_TIMEOUT_S = 600;
|
|
70
|
+
const BASH_TIMEOUT_WORDS = `Timeout in seconds: ${BASH_DEFAULT_TIMEOUT_S} s by default, at most ${BASH_MAX_TIMEOUT_S} s; for longer work use bash_background.`;
|
|
71
|
+
const BASH_TIMEOUT_SENTENCE = ` Each command is stopped after ${BASH_DEFAULT_TIMEOUT_S} s by default, at most ${BASH_MAX_TIMEOUT_S} s; for longer work use bash_background.`;
|
|
72
|
+
const capWords = (asked) => `bash runs a command for at most ${BASH_MAX_TIMEOUT_S} s: this one ran with ${BASH_MAX_TIMEOUT_S} s, not the ${asked} s asked. For longer work use bash_background.`;
|
|
73
|
+
/** pi's bash with its timeout said and kept: the description and the timeout's own words name the default and the
|
|
74
|
+
* ceiling, a call with none runs at the default, and one asking for more runs at the ceiling and says so (a diagnostic
|
|
75
|
+
* when it ends, its error when it times out). Its schema's shape is pi's; only words change. */
|
|
76
|
+
function boundedBash(tool) {
|
|
77
|
+
const parameters = tool.parameters;
|
|
78
|
+
const timeout = parameters.properties?.timeout;
|
|
79
|
+
return {
|
|
80
|
+
...tool,
|
|
81
|
+
description: `${tool.description}${BASH_TIMEOUT_SENTENCE}`,
|
|
82
|
+
parameters: (timeout ? { ...parameters, properties: { ...parameters.properties, timeout: { ...timeout, description: BASH_TIMEOUT_WORDS } } } : parameters),
|
|
83
|
+
execute: async (args, api, context) => {
|
|
84
|
+
const asked = args?.timeout;
|
|
85
|
+
const capped = typeof asked === "number" && asked > BASH_MAX_TIMEOUT_S;
|
|
86
|
+
const timeoutS = typeof asked === "number" ? Math.min(asked, BASH_MAX_TIMEOUT_S) : BASH_DEFAULT_TIMEOUT_S;
|
|
87
|
+
try {
|
|
88
|
+
const result = await tool.execute({ ...args, timeout: timeoutS }, api, context);
|
|
89
|
+
return capped ? { ...result, diagnostics: [...(result.diagnostics ?? []), { severity: "warn", code: "timeout_capped", message: capWords(asked) }] } : result;
|
|
90
|
+
}
|
|
91
|
+
catch (error) {
|
|
92
|
+
if (capped && error instanceof Error && /timed out/i.test(error.message))
|
|
93
|
+
throw new Error(`${error.message}. ${capWords(asked)}`, { cause: error });
|
|
94
|
+
throw error;
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
/** The image types read opens, by extension; the bytes must say the same (imageTypeOf). */
|
|
100
|
+
const IMAGE_EXTENSIONS = { png: "image/png", jpg: "image/jpeg", jpeg: "image/jpeg", gif: "image/gif", webp: "image/webp" };
|
|
101
|
+
/** The largest image read hands the model, in bytes: 3.75 MiB, whose base64 is the 5 MiB the strictest platform a
|
|
102
|
+
* harness sends images to takes (the claude-agent adapter's CLAUDE_AGENT_MAX_IMAGE_BYTES, Amazon Bedrock's). */
|
|
103
|
+
export const READ_IMAGE_MAX_BYTES = 3_932_160;
|
|
104
|
+
/** The box's side of an image read: at most `$2` bytes of `$1`, as base64 (env.exec answers in text). A file over the
|
|
105
|
+
* bound never leaves the box whole: the server holds one byte past it at most, and refuses it. */
|
|
106
|
+
const READ_IMAGE_SCRIPT = '[ -f "$1" ] && [ -r "$1" ] || exit 6; head -c "$2" -- "$1" | base64';
|
|
107
|
+
/** At most `limit` bytes of the box's `path`, read in the box, or undefined when it can't be read there. */
|
|
108
|
+
async function boxBytes(env, path, limit, context) {
|
|
109
|
+
let out = "";
|
|
110
|
+
const ran = await env.exec(["sh", "-c", READ_IMAGE_SCRIPT, "agentrun-read-image", path, String(limit)], {
|
|
111
|
+
timeout: 30,
|
|
112
|
+
onOutput: (text, _context, info) => {
|
|
113
|
+
if (info.stream === "stdout")
|
|
114
|
+
out += text;
|
|
115
|
+
},
|
|
116
|
+
}, context);
|
|
117
|
+
if (!ran.ok || ran.value.exitCode !== 0)
|
|
118
|
+
return undefined;
|
|
119
|
+
return new Uint8Array(Buffer.from(out.replace(/\s+/g, ""), "base64"));
|
|
120
|
+
}
|
|
121
|
+
const READ_IMAGE_SENTENCE = " It also opens an image (png, jpg, gif, webp) at any path in the run's box, such as one rendered to /tmp, and returns it as an image; any other file only inside work/.";
|
|
122
|
+
/** The image type the bytes say they are, or undefined: the magic bytes of PNG, JPEG, GIF and WebP. */
|
|
123
|
+
function imageTypeOf(bytes) {
|
|
124
|
+
const at = (offset, ...values) => values.every((value, index) => bytes[offset + index] === value);
|
|
125
|
+
if (at(0, 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a))
|
|
126
|
+
return "image/png";
|
|
127
|
+
if (at(0, 0xff, 0xd8, 0xff))
|
|
128
|
+
return "image/jpeg";
|
|
129
|
+
if (at(0, 0x47, 0x49, 0x46, 0x38))
|
|
130
|
+
return "image/gif";
|
|
131
|
+
if (at(0, 0x52, 0x49, 0x46, 0x46) && at(8, 0x57, 0x45, 0x42, 0x50))
|
|
132
|
+
return "image/webp";
|
|
133
|
+
return undefined;
|
|
134
|
+
}
|
|
135
|
+
/** A path read may open as an image anywhere in the box: an absolute box path (not `~`, not a URL) whose extension is an
|
|
136
|
+
* image's. */
|
|
137
|
+
const boxImagePath = (path) => path.startsWith("/") && !path.startsWith("//") && IMAGE_EXTENSIONS[posix.extname(path).slice(1).toLowerCase()] !== undefined;
|
|
54
138
|
/** A run's coding tools by its place: on the runner, CodingTools (no bash); in a box, pi's read, write, edit and bash,
|
|
55
139
|
* each with its arguments, output and replay as pi ships it and its environment the box's, and the background tools
|
|
56
140
|
* (background.ts), each call a command in the box. A file tool's path stays in the box's work dir; bash's command is
|
|
@@ -61,13 +145,30 @@ export function codingSource(place, box) {
|
|
|
61
145
|
if (!box)
|
|
62
146
|
throw new Error("a run whose place is a box needs its box for its coding tools");
|
|
63
147
|
const here = box.hostWork && writesHeld() ? boundFiles(box.hostWork) : undefined;
|
|
64
|
-
const
|
|
148
|
+
const boxed = (pis.tools ?? []).filter((tool) => PI_BOXED.includes(tool.name)).map((tool) => (tool.name === "bash" ? boundedBash(tool) : tool.name === "read" ? { ...tool, description: `${tool.description}${READ_IMAGE_SENTENCE}` } : tool));
|
|
149
|
+
const tools = asGivenRefusals([...boxed, ...backgroundTools()].map((tool) => ({
|
|
65
150
|
...tool,
|
|
66
151
|
execute: async (args, api, context) => {
|
|
67
152
|
// A file tool's path in the box's words, or refused as the confined tools refuse (refuseOutsideWorkspace): named
|
|
68
153
|
// by the path the call gave and no other, the box's work dir included.
|
|
69
154
|
const path = args?.path;
|
|
70
155
|
const inBox = typeof path === "string" ? boxPath(path, box.hostWork) : undefined;
|
|
156
|
+
// read opens an image anywhere in the box (a render in /tmp): read through the box itself, never on this machine,
|
|
157
|
+
// and only when the bytes are an image's; anything else outside work/ is refused as before.
|
|
158
|
+
if (tool.name === "read" && typeof path === "string" && inBox === undefined && boxImagePath(path)) {
|
|
159
|
+
const note = (summary) => api.commit(async (tx) => void (await tx.appendEntry(ROOT_CONVERSATION_ID, { kind: HOST_PHASE, data: { summary } })), context);
|
|
160
|
+
const bytes = await boxBytes((await box.env(context, note)), path, READ_IMAGE_MAX_BYTES + 1, context);
|
|
161
|
+
// Said as what it is: a path the box could not read (no such file, no permission), or bytes that are no image's.
|
|
162
|
+
if (!bytes)
|
|
163
|
+
throw new Error(`${path} could not be read in the box`);
|
|
164
|
+
const mimeType = imageTypeOf(bytes);
|
|
165
|
+
if (!mimeType)
|
|
166
|
+
throw new Error(`${path} is not an image`);
|
|
167
|
+
if (bytes.byteLength > READ_IMAGE_MAX_BYTES)
|
|
168
|
+
throw new Error(`${path} is an image over read's ${READ_IMAGE_MAX_BYTES} bytes: scale it down first (for example with ffmpeg in bash).`);
|
|
169
|
+
// A line naming it, then the image: an answer is never an empty text, on pi or on another harness (host-tools.ts).
|
|
170
|
+
return forModelBlocks([{ type: "text", text: `${path}: ${mimeType}, ${bytes.byteLength} bytes` }, { type: "image", data: Buffer.from(bytes).toString("base64"), mimeType }]);
|
|
171
|
+
}
|
|
71
172
|
if (typeof path === "string" && inBox === undefined)
|
|
72
173
|
refuseOutsideWorkspace(path);
|
|
73
174
|
const given = inBox === undefined ? args : { ...args, path: inBox };
|
|
@@ -75,11 +176,12 @@ export function codingSource(place, box) {
|
|
|
75
176
|
// process left has its left commands killed first, so none of them changes work/ under these tools.
|
|
76
177
|
if (here && !SHELL_TOOLS.includes(tool.name) && (await box.bound?.()) === true) {
|
|
77
178
|
await box.leftEnded?.(context);
|
|
78
|
-
return tool.execute(given, { ...api, env: here }, context).catch((error) => Promise.reject(withCause(error)));
|
|
179
|
+
return withBoxNote(box, api.output, () => tool.execute(given, { ...api, env: here }, context).catch((error) => Promise.reject(withCause(error))));
|
|
79
180
|
}
|
|
80
181
|
// A row the box's wait writes goes on the run's root, as a host's phase (pi-durable-agent's timeline shows it).
|
|
81
182
|
const note = (summary) => api.commit(async (tx) => void (await tx.appendEntry(ROOT_CONVERSATION_ID, { kind: HOST_PHASE, data: { summary } })), context);
|
|
82
|
-
|
|
183
|
+
const env = await box.env(context, note);
|
|
184
|
+
return withBoxNote(box, api.output, () => tool.execute(given, { ...api, env: env }, context));
|
|
83
185
|
},
|
|
84
186
|
})));
|
|
85
187
|
// The permission gate (allow, ask, deny) wraps this source: the one call it takes, whichever of the two lands second.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** adb's env: the host bash's PATH, and a HOME and a TMPDIR (paths only). Nothing else, whatever this process holds. */
|
|
2
|
+
export declare function adbEnv(dirs?: {
|
|
3
|
+
readonly home?: string;
|
|
4
|
+
readonly tmpdir?: string;
|
|
5
|
+
}): Readonly<Record<string, string>>;
|
|
6
|
+
/** The phone provider's adb: the computer library's adbCli at `path`, spawned from adbEnv() alone. */
|
|
7
|
+
export declare function phoneAdb<A>(adbCli: (path: string, options: {
|
|
8
|
+
readonly env: Readonly<Record<string, string>>;
|
|
9
|
+
}) => A, path: string, dirs?: {
|
|
10
|
+
readonly home?: string;
|
|
11
|
+
readonly tmpdir?: string;
|
|
12
|
+
}): A;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// The phone provider's adb, wherever serve builds that provider (the claim's computerForClaim and Settings → Computers'
|
|
2
|
+
// test): one helper both use. The computer library spawns adb from the env it is given, so adb is given a fixed, minimal
|
|
3
|
+
// env (PATH, HOME, TMPDIR), never this process's: no vendor key and no seal key reaches adb, as none reaches the host's
|
|
4
|
+
// bash (workspace/hands.ts shellEnv).
|
|
5
|
+
import { homedir, tmpdir } from "node:os";
|
|
6
|
+
import { shellEnv } from "./workspace/hands.js";
|
|
7
|
+
/** adb's env: the host bash's PATH, and a HOME and a TMPDIR (paths only). Nothing else, whatever this process holds. */
|
|
8
|
+
export function adbEnv(dirs = {}) {
|
|
9
|
+
return Object.freeze({ PATH: shellEnv().PATH, HOME: dirs.home ?? homedir(), TMPDIR: dirs.tmpdir ?? tmpdir() });
|
|
10
|
+
}
|
|
11
|
+
/** The phone provider's adb: the computer library's adbCli at `path`, spawned from adbEnv() alone. */
|
|
12
|
+
export function phoneAdb(adbCli, path, dirs = {}) {
|
|
13
|
+
return adbCli(path, { env: adbEnv(dirs) });
|
|
14
|
+
}
|