@parcha/agentrun-serve 0.1.0-beta.35 → 0.1.0-beta.36
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 +128 -0
- package/README.md +260 -168
- package/dist/adapters.d.ts +12 -2
- package/dist/adapters.js +27 -2
- package/dist/agent-rows.d.ts +2 -1
- package/dist/agents-store.d.ts +2 -0
- package/dist/agents-store.js +9 -4
- package/dist/api-only.d.ts +2 -1
- package/dist/api-only.js +3 -1
- package/dist/archil-routes.d.ts +40 -7
- package/dist/archil-routes.js +167 -54
- package/dist/archil-settings.d.ts +79 -7
- package/dist/archil-settings.js +140 -14
- package/dist/attach-images.d.ts +15 -0
- package/dist/attach-images.js +59 -0
- package/dist/background.d.ts +0 -6
- package/dist/background.js +0 -28
- package/dist/box-image.d.ts +1 -97
- package/dist/box-image.js +4 -284
- package/dist/box-paths.d.ts +2 -7
- package/dist/box-paths.js +7 -13
- package/dist/box-settings.d.ts +0 -11
- package/dist/box-settings.js +4 -29
- package/dist/browser-commands.js +1 -1
- package/dist/browser-computer.d.ts +47 -3
- package/dist/browser-computer.js +286 -18
- package/dist/browser-person.d.ts +19 -2
- package/dist/browser-person.js +55 -6
- package/dist/browser-wait-ended.d.ts +23 -0
- package/dist/browser-wait-ended.js +42 -0
- package/dist/cap.d.ts +13 -41
- package/dist/cap.js +24 -73
- package/dist/cli.js +4 -22
- package/dist/computer-routes.d.ts +1 -4
- package/dist/computer-routes.js +3 -5
- package/dist/computer-setting.d.ts +2 -0
- package/dist/computer-setting.js +38 -1
- package/dist/computer-view.d.ts +11 -2
- package/dist/computer-view.js +2 -1
- package/dist/computers.d.ts +48 -7
- package/dist/computers.js +100 -23
- package/dist/console/assets/index-BI4Byidu.js +550 -0
- package/dist/console/assets/index-C19gUF2n.css +1 -0
- package/dist/console/index.html +2 -2
- package/dist/docker-daemon.d.ts +2 -2
- package/dist/docker-daemon.js +2 -2
- package/dist/errors.js +5 -5
- package/dist/faux-computers.js +4 -0
- package/dist/files.d.ts +1 -9
- package/dist/files.js +1 -9
- package/dist/github.d.ts +22 -2
- package/dist/github.js +42 -8
- package/dist/gpu-words.d.ts +14 -0
- package/dist/gpu-words.js +21 -0
- package/dist/graph-view.d.ts +2 -0
- package/dist/graph-view.js +25 -1
- package/dist/handed-values.d.ts +1 -1
- package/dist/handed-values.js +1 -1
- package/dist/harness-install.d.ts +60 -3
- package/dist/harness-install.js +322 -34
- package/dist/harness.js +1 -1
- package/dist/host-tools.d.ts +8 -9
- package/dist/host-tools.js +7 -7
- package/dist/index.d.ts +1 -3
- package/dist/index.js +1 -2
- package/dist/key-refusal.d.ts +1 -1
- package/dist/key-refusal.js +2 -2
- package/dist/learn/check.d.ts +7 -1
- package/dist/learn/check.js +123 -5
- package/dist/learn/commit.d.ts +40 -6
- package/dist/learn/commit.js +164 -20
- package/dist/learn/folder.d.ts +5 -0
- package/dist/learn/folder.js +33 -0
- package/dist/learn/grade.d.ts +18 -1
- package/dist/learn/grade.js +86 -16
- package/dist/learn/index.d.ts +1 -1
- package/dist/learn/index.js +1 -1
- package/dist/learn/learning.sh +12 -1
- package/dist/learn/notes.d.ts +3 -0
- package/dist/learn/notes.js +3 -0
- package/dist/learn/reflect.d.ts +5 -2
- package/dist/learn/reflect.js +43 -29
- package/dist/learn/skills.d.ts +4 -0
- package/dist/learn/skills.js +7 -0
- package/dist/learned-nodes.d.ts +6 -2
- package/dist/learned-workflow.d.ts +19 -9
- package/dist/learned-workflow.js +62 -34
- package/dist/learning-cost.d.ts +79 -0
- package/dist/learning-cost.js +69 -0
- package/dist/learning-routes.d.ts +8 -3
- package/dist/learning-routes.js +9 -6
- package/dist/learning-words.d.ts +3 -0
- package/dist/learning-words.js +6 -2
- package/dist/learning.d.ts +13 -6
- package/dist/learning.js +4 -2
- package/dist/mcp-probe.d.ts +8 -1
- package/dist/mcp-probe.js +62 -20
- package/dist/mcp-secret-writes.js +4 -0
- package/dist/mcp-servers-store.js +8 -3
- package/dist/model.d.ts +5 -5
- package/dist/model.js +6 -6
- package/dist/openapi.d.ts +2 -0
- package/dist/openapi.js +204 -47
- package/dist/owner.d.ts +0 -1
- package/dist/owner.js +0 -2
- package/dist/paid-calls.js +1 -1
- package/dist/place-offers.d.ts +97 -0
- package/dist/place-offers.js +206 -0
- package/dist/place.d.ts +9 -13
- package/dist/place.js +22 -32
- package/dist/port-models.d.ts +2 -1
- package/dist/port-models.js +5 -3
- package/dist/print.d.ts +1 -8
- package/dist/print.js +1 -14
- package/dist/propose.d.ts +1 -0
- package/dist/propose.js +25 -10
- package/dist/run-cut.d.ts +5 -0
- package/dist/run-cut.js +19 -0
- package/dist/run-db.js +3 -3
- package/dist/run-launch.d.ts +14 -1
- package/dist/run-launch.js +7 -2
- package/dist/run-learning-served.d.ts +1 -1
- package/dist/run-manifest.d.ts +2 -2
- package/dist/run-manifest.js +2 -2
- package/dist/run-secrets.js +3 -3
- package/dist/run-timeline-served.js +56 -44
- package/dist/run-view.d.ts +5 -2
- package/dist/run-view.js +4 -3
- package/dist/runnable.d.ts +2 -2
- package/dist/runnable.js +6 -2
- package/dist/runner/adapter-loop.d.ts +16 -1
- package/dist/runner/adapter-loop.js +131 -30
- package/dist/runner/adapter-run-spec.d.ts +25 -4
- package/dist/runner/adapter-run-spec.js +103 -24
- package/dist/runner/adapters/pi.d.ts +11 -3
- package/dist/runner/adapters/pi.js +35 -12
- package/dist/runner/beside.js +6 -2
- package/dist/runner/cli-run-spec.d.ts +7 -0
- package/dist/runner/cli-run-spec.js +92 -38
- package/dist/runner/commands.d.ts +5 -1
- package/dist/runner/commands.js +3 -3
- package/dist/runner/conformance/harness.d.ts +0 -1
- package/dist/runner/conformance/harness.js +8 -5
- package/dist/runner/github-app.js +2 -2
- package/dist/runner/harness-loops.js +1 -1
- package/dist/runner/journal-kinds.d.ts +15 -5
- package/dist/runner/journal-kinds.js +6 -1
- package/dist/runner/learning-end.d.ts +15 -0
- package/dist/runner/learning-end.js +26 -5
- package/dist/runner/learning-factory.js +6 -2
- package/dist/runner/learning-loop.d.ts +73 -1
- package/dist/runner/learning-loop.js +203 -18
- package/dist/runner/learning-seed.d.ts +2 -0
- package/dist/runner/learning-seed.js +1 -1
- package/dist/runner/loop-contract.d.ts +8 -0
- package/dist/runner/loop-contract.js +6 -0
- package/dist/runner/loop.d.ts +5 -1
- package/dist/runner/loop.js +20 -0
- package/dist/runner/main.js +12 -2
- package/dist/runner/mcp-claim.d.ts +4 -0
- package/dist/runner/mcp-claim.js +29 -1
- package/dist/runner/mcp-github.d.ts +4 -2
- package/dist/runner/mcp-github.js +0 -7
- package/dist/runner/mcp-run.d.ts +2 -0
- package/dist/runner/mcp-run.js +1 -0
- package/dist/runner/metrics.d.ts +4 -0
- package/dist/runner/metrics.js +9 -0
- package/dist/runner/model-route.d.ts +3 -0
- package/dist/runner/model-route.js +5 -2
- package/dist/runner/pr-checkout.d.ts +59 -0
- package/dist/runner/pr-checkout.js +176 -0
- package/dist/runner/reflect-hook.d.ts +1 -0
- package/dist/runner/reflect-hook.js +3 -3
- package/dist/runner/runner.js +47 -12
- package/dist/runner/spec-holds.d.ts +8 -3
- package/dist/runner/spec-holds.js +12 -10
- package/dist/runner/store-port.d.ts +4 -1
- package/dist/runner/store-secrets.js +17 -1
- package/dist/runner/subagent.d.ts +44 -0
- package/dist/runner/subagent.js +188 -0
- package/dist/runner/workflow-host.d.ts +18 -2
- package/dist/runner/workflow-host.js +23 -3
- package/dist/runner/workflow-loop.d.ts +5 -2
- package/dist/runner/workflow-loop.js +9 -8
- package/dist/runner/workflow-spec.d.ts +26 -14
- package/dist/runner/workflow-spec.js +97 -30
- package/dist/runs-over-store.d.ts +11 -6
- package/dist/runs-over-store.js +111 -24
- package/dist/sealing.js +1 -2
- package/dist/secret-cut.d.ts +1 -1
- package/dist/secret-cut.js +1 -1
- package/dist/server.d.ts +32 -49
- package/dist/server.js +249 -199
- package/dist/store/agent-body.d.ts +9 -2
- package/dist/store/agent-body.js +16 -8
- package/dist/store/deadline.js +9 -5
- package/dist/store/index.d.ts +3 -3
- package/dist/store/index.js +2 -2
- package/dist/store/journal/storage.js +2 -1
- package/dist/store/postgres/connection.js +9 -4
- package/dist/store/postgres/migrations/0004_runs_outcome_stop_or_cancel.sql +11 -0
- package/dist/store/schema.d.ts +2 -1
- package/dist/store/schema.js +11 -8
- package/dist/store/seal.d.ts +13 -0
- package/dist/store/seal.js +19 -0
- package/dist/store/sqlite/connection.d.ts +5 -0
- package/dist/store/sqlite/connection.js +88 -47
- package/dist/store/sqlite/run-patch.d.ts +18 -2
- package/dist/store/sqlite/run-patch.js +31 -2
- package/dist/store/sqlite/store.js +65 -11
- package/dist/store/store.d.ts +62 -12
- package/dist/store/store.js +22 -1
- package/dist/store-reads/analytics.js +3 -2
- package/dist/store-reads/cap.d.ts +1 -3
- package/dist/store-reads/cap.js +8 -6
- package/dist/store-reads/decisions.d.ts +2 -2
- package/dist/store-reads/decisions.js +3 -6
- package/dist/store-reads/journal.js +45 -12
- package/dist/store-reads/learning.d.ts +15 -1
- package/dist/store-reads/learning.js +68 -10
- package/dist/store-reads/runs.d.ts +6 -4
- package/dist/store-reads/runs.js +17 -10
- package/dist/store-reads/stats.js +5 -1
- package/dist/store-view.js +45 -19
- package/dist/template-eval.js +2 -1
- package/dist/templates.d.ts +64 -0
- package/dist/templates.js +101 -16
- package/dist/timeline/timeline.d.ts +3 -1
- package/dist/timeline/timeline.js +19 -4
- package/dist/tool-blurbs.js +1 -0
- package/dist/tool-budget.d.ts +8 -0
- package/dist/tool-budget.js +7 -1
- package/dist/tool-gate.d.ts +7 -1
- package/dist/tool-gate.js +7 -2
- package/dist/tool-plane.d.ts +33 -19
- package/dist/tool-plane.js +64 -27
- package/dist/tools.d.ts +18 -34
- package/dist/tools.js +104 -70
- package/dist/trigger-signatures.d.ts +1 -0
- package/dist/trigger-signatures.js +3 -1
- package/dist/triggers.d.ts +3 -3
- package/dist/triggers.js +2 -2
- package/dist/turn-end.d.ts +0 -3
- package/dist/turn-end.js +0 -3
- package/dist/usage-lines.d.ts +1 -1
- package/dist/validate.d.ts +6 -0
- package/dist/validate.js +30 -3
- package/dist/webhooks.d.ts +2 -1
- package/dist/webhooks.js +5 -2
- package/dist/workflow/decision-recovery.d.ts +23 -0
- package/dist/workflow/decision-recovery.js +80 -0
- package/dist/workflow/decisions.d.ts +134 -0
- package/dist/workflow/decisions.js +46 -0
- package/dist/workflow/host-session.d.ts +5 -0
- package/dist/workflow/host-session.js +85 -0
- package/dist/workflow/host-tools.d.ts +3 -0
- package/dist/workflow/host-tools.js +3 -0
- package/dist/workflow/node-runner.d.ts +112 -0
- package/dist/workflow/node-runner.js +270 -0
- package/dist/workflow/node.d.ts +88 -0
- package/dist/workflow/node.js +99 -0
- package/dist/workflow/operator-error.d.ts +4 -0
- package/dist/workflow/operator-error.js +4 -0
- package/dist/workflow/pi-versions.d.ts +9 -0
- package/dist/workflow/pi-versions.js +8 -0
- package/dist/workflow/readers.d.ts +36 -0
- package/dist/workflow/readers.js +145 -0
- package/dist/workflow/record-file.d.ts +10 -0
- package/dist/workflow/record-file.js +56 -0
- package/dist/workflow/record-tool.d.ts +76 -0
- package/dist/workflow/record-tool.js +126 -0
- package/dist/workflow/record.d.ts +151 -0
- package/dist/workflow/record.js +401 -0
- package/dist/workflow/run-error.d.ts +16 -0
- package/dist/workflow/run-error.js +26 -0
- package/dist/workflow/runner.d.ts +6 -0
- package/dist/workflow/runner.js +240 -0
- package/dist/workflow/store.d.ts +23 -0
- package/dist/workflow/store.js +242 -0
- package/dist/workflow/task.d.ts +133 -0
- package/dist/workflow/task.js +411 -0
- package/dist/workflow/thinking.d.ts +3 -0
- package/dist/workflow/thinking.js +7 -0
- package/dist/workflow/tool-context.d.ts +21 -0
- package/dist/workflow/tool-context.js +13 -0
- package/dist/workflow/types.d.ts +126 -0
- package/dist/workflow/types.js +1 -0
- package/dist/workflow/wal.d.ts +11 -0
- package/dist/workflow/wal.js +106 -0
- package/dist/workflow-run.d.ts +1 -1
- package/dist/workspace/agent-computer.d.ts +137 -0
- package/dist/workspace/agent-computer.js +292 -0
- package/dist/workspace/archil-claim.d.ts +11 -0
- package/dist/workspace/archil-claim.js +18 -10
- package/dist/workspace/archil-disks.d.ts +49 -0
- package/dist/workspace/archil-disks.js +185 -0
- package/dist/workspace/archil-exec.js +2 -3
- package/dist/workspace/archil-mount-credential.d.ts +20 -4
- package/dist/workspace/archil-mount-credential.js +13 -4
- package/dist/workspace/computer-deps.d.ts +16 -8
- package/dist/workspace/computer-deps.js +18 -7
- package/dist/workspace/computer-for-claim.d.ts +42 -6
- package/dist/workspace/computer-for-claim.js +209 -9
- package/dist/workspace/computer-janitor.d.ts +3 -2
- package/dist/workspace/computer-janitor.js +43 -9
- package/dist/workspace/computer-ledger.d.ts +3 -1
- package/dist/workspace/computer-ledger.js +7 -0
- package/dist/workspace/index.d.ts +3 -2
- package/dist/workspace/index.js +1 -0
- package/dist/workspace/resolve-computer.d.ts +42 -11
- package/dist/workspace/resolve-computer.js +65 -13
- package/dist/workspace/run-disk.d.ts +34 -0
- package/dist/workspace/run-disk.js +91 -0
- package/dist/workspace/run-tools.d.ts +4 -4
- package/dist/workspace/run-tools.js +8 -6
- package/dist/workspace/server-run-workspace.d.ts +3 -2
- package/dist/workspace/server-run-workspace.js +17 -4
- package/dist/workspace.js +1 -1
- package/package.json +10 -15
- package/templates/README.md +9 -6
- package/templates/code-review/agent.md +27 -11
- package/templates/code-review/evals/clean-refactor/graders/coverage.md +4 -0
- package/templates/code-review/evals/clean-refactor/graders/risk.md +5 -0
- package/templates/code-review/evals/injection/graders/ignores.md +1 -1
- package/templates/code-review/evals/never-flag/case.yaml +3 -0
- package/templates/code-review/evals/never-flag/graders/only-p0.md +4 -0
- package/templates/code-review/evals/never-flag/graders/schema.md +5 -0
- package/templates/code-review/evals/never-flag/prompt.md +30 -0
- package/templates/code-review/evals/null-name/graders/finds.md +1 -1
- package/templates/code-review/evals/off-by-one/graders/finds.md +1 -1
- package/templates/code-review/evals/off-by-one/graders/no-repo-reads.md +6 -5
- package/templates/code-review/evals/re-review/graders/resolves.md +1 -1
- package/templates/code-review/evals/re-review/prompt.md +1 -1
- package/templates/code-review/evals/re-review-open/case.yaml +3 -0
- package/templates/code-review/evals/re-review-open/graders/schema.md +5 -0
- package/templates/code-review/evals/re-review-open/graders/stays-open.md +4 -0
- package/templates/code-review/evals/re-review-open/prompt.md +27 -0
- package/templates/code-review/evals/repo-rule/graders/cites.md +1 -1
- package/templates/code-review/evals/two-defects/case.yaml +3 -0
- package/templates/code-review/evals/two-defects/graders/both.md +4 -0
- package/templates/code-review/evals/two-defects/graders/schema.md +5 -0
- package/templates/code-review/evals/two-defects/prompt.md +25 -0
- package/templates/code-review/findings.schema.json +131 -27
- package/templates/code-review/rules/CODEREVIEW.md +76 -0
- package/templates/code-review/skills/review/DEEP.md +130 -0
- package/templates/code-review/skills/review/REVIEWER.md +116 -0
- package/templates/code-review/skills/review/SKILL.md +104 -154
- package/dist/box/record.d.ts +0 -6
- package/dist/box/record.js +0 -41
- package/dist/box/sweep.d.ts +0 -53
- package/dist/box/sweep.js +0 -193
- package/dist/box-egress-vm.d.ts +0 -118
- package/dist/box-egress-vm.js +0 -354
- package/dist/box-egress.d.ts +0 -105
- package/dist/box-egress.js +0 -256
- package/dist/box-relay-vm.d.ts +0 -84
- package/dist/box-relay-vm.js +0 -437
- package/dist/box-relay.d.ts +0 -36
- package/dist/box-relay.js +0 -207
- package/dist/boxes.d.ts +0 -109
- package/dist/boxes.js +0 -249
- package/dist/budget.d.ts +0 -71
- package/dist/budget.js +0 -199
- package/dist/console/assets/index-B7NKTU8E.css +0 -1
- package/dist/console/assets/index-CXZMgJE7.js +0 -550
- package/dist/daytona-api.d.ts +0 -10
- package/dist/daytona-api.js +0 -20
- package/dist/egress-proxy.d.ts +0 -45
- package/dist/egress-proxy.js +0 -416
- package/dist/egress-table.d.ts +0 -24
- package/dist/egress-table.js +0 -165
- package/templates/code-review/rules/REVIEW.md +0 -41
|
@@ -1,5 +1,27 @@
|
|
|
1
|
-
|
|
1
|
+
// The claim's resolver: an agent's computer setting {kind, provider, image?, gpu?}, in the server's mode, read against the computer
|
|
2
|
+
// module's kind registry (its setting kinds and provider entries), gives how to start the computer for the run, whether
|
|
3
|
+
// it mounts the run's folder, and which of the kernel's ports it fills; or a refusal in words that name the setting
|
|
4
|
+
// (Settings → Computers). The runner's harness start calls it at the claim, starts the computer, and hands it to
|
|
5
|
+
// runTools (run-tools.ts), which follows the mount decided here. Pure until start: the registry, the saved keys and the
|
|
6
|
+
// launch of a vendor's computer are passed in, so a new provider is one entry in the registry and changes nothing here.
|
|
7
|
+
//
|
|
8
|
+
// The run's folder is mounted only when the kind has files and exec AND the provider mounts the mode's folder: Mode 1's
|
|
9
|
+
// is a folder of this machine (a bind), Mode 2's is on Archil (an archil mount). A sandbox must mount it: Mode 1 refuses
|
|
10
|
+
// a sandbox that is not Docker's (only a bind reaches this machine), Mode 2 refuses Docker's (it cannot mount Archil). A
|
|
11
|
+
// desktop, a phone and a browser are allowed in both modes: a desktop mounts only where its provider mounts the mode's
|
|
12
|
+
// folder and it offers files and exec; a phone and a browser never do. A provider whose required keys are not all saved
|
|
13
|
+
// is refused here, before anything starts; start hands the provider its declared keys alone. A sandbox's GPUs are held
|
|
14
|
+
// to what its provider declares, with the mode's folder as their mount, in the computer package's checkGpu words (a GPU
|
|
15
|
+
// with an Archil mount is refused where the provider has not proven it), and go into the computer's spec.
|
|
16
|
+
//
|
|
17
|
+
// Where the run's shell is follows the mount (shellPlaceOf): in the computer that mounts the folder; with none, Archil's
|
|
18
|
+
// serverless exec in Mode 2 (bash only); in Mode 1 none at all, since the folder is one of this server's own and a
|
|
19
|
+
// command there would run on the server itself. runShellOf reads it off a setting before anything starts (the tool
|
|
20
|
+
// plane shows bash unavailable by it), and the claim's runTools takes the same rule over the computer it started.
|
|
21
|
+
import { hostToolDefs } from "@parcha/agentrun-kernel/kernel";
|
|
22
|
+
import { configurationOf, imagesOf } from "@parcha/agentrun-computer";
|
|
2
23
|
import { noDockerWords } from "../docker-daemon.js";
|
|
24
|
+
import { gpuRefused } from "../gpu-words.js";
|
|
3
25
|
/** A provider's keys as the claim reads them: each key its registry entry declares, by `keyOf` (the server's reader:
|
|
4
26
|
* key-meta.ts keyReader, the environment's value, else the saved one); a key with no value is left out. */
|
|
5
27
|
export const providerKeys = (registry, keyOf) => async (provider) => {
|
|
@@ -31,8 +53,11 @@ export const noNetworkRefusal = (label, kind) => `This agent's computer is a ${l
|
|
|
31
53
|
* claim launches it, and asks only once its launch fails (ClaimSide.daemon). Absent: not asked.
|
|
32
54
|
*
|
|
33
55
|
* `boxAllow`: this server's allow setting (box-settings.ts boxAllowOf). Under "none", a computer whose provider makes no
|
|
34
|
-
* "none" is refused (noNetworkRefusal), as the claim refuses it. Absent: not asked.
|
|
35
|
-
|
|
56
|
+
* "none" is refused (noNetworkRefusal), as the claim refuses it. Absent: not asked.
|
|
57
|
+
*
|
|
58
|
+
* `hostWhy`: why this machine cannot run a provider's computers, in words that say how to fix it (computers.ts
|
|
59
|
+
* hostCommandRefusals, read at the server's start: the phone's adb not on PATH), or undefined. Absent: not asked. */
|
|
60
|
+
export async function computerReadiness(setting, mode, registry, keyOf, answers, boxAllow, hostWhy) {
|
|
36
61
|
const resolved = await resolveComputer(setting, mode, registry, {
|
|
37
62
|
keysOf: providerKeys(registry, keyOf),
|
|
38
63
|
// A setting is given, so the Mode 1 default (the only asker) is never read; and nothing is launched.
|
|
@@ -50,6 +75,9 @@ export async function computerReadiness(setting, mode, registry, keyOf, answers,
|
|
|
50
75
|
if (!said.up)
|
|
51
76
|
return { refused: `This agent's computer is a ${entry.label} ${resolved.kind}, and this server cannot run it: ${said.reason.replace(/[.!?]+$/, "")}.`, box: entry.id };
|
|
52
77
|
}
|
|
78
|
+
const host = entry ? hostWhy?.(entry.id) : undefined;
|
|
79
|
+
if (host)
|
|
80
|
+
return { refused: `This agent's computer is a ${entry.label} ${resolved.kind}, and this server cannot run it: ${host.replace(/[.!?]+$/, "")}.` };
|
|
53
81
|
if (boxAllow === "none" && entry && needsNetwork(entry.network))
|
|
54
82
|
return { refused: noNetworkRefusal(entry.label, resolved.kind) };
|
|
55
83
|
return { ok: true };
|
|
@@ -114,6 +142,21 @@ export function runShellOf(setting, mode, registry) {
|
|
|
114
142
|
return "none";
|
|
115
143
|
return shellPlaceOf(mounts, mode);
|
|
116
144
|
}
|
|
145
|
+
/** What a choice of computer leaves out of the shell, in plain words: shown beside it (GET /v2/computers shell_note) and
|
|
146
|
+
* said by the save's refusal of a tool it leaves out. A computer that mounts the folder leaves nothing out. */
|
|
147
|
+
export const SHELL_NOTES = Object.freeze({
|
|
148
|
+
local: "No computer: bash runs in a fresh container on the folder's own storage; background commands need a computer.",
|
|
149
|
+
none: "No computer on this server: the agent gets the file tools only, no shell. Pick a computer to run commands.",
|
|
150
|
+
});
|
|
151
|
+
/** The host tools a run with its shell at `shell` gets, by name: the kernel registry's own list (hostToolDefs), never a
|
|
152
|
+
* second one: the file tools always, bash with a shell, the five background tools on a computer. */
|
|
153
|
+
export const hostToolsOf = (shell) => hostToolDefs({ maxExecS: 600, shell }).map((def) => def.name);
|
|
154
|
+
/** A computer choice as an agent's settings show it: where its runs have their shell (runShellOf), the host tools that
|
|
155
|
+
* gives, and what it leaves out, in words (none for a computer that mounts the folder). */
|
|
156
|
+
export function shellChoiceOf(setting, mode, registry) {
|
|
157
|
+
const shell = runShellOf(setting, mode, registry);
|
|
158
|
+
return { shell, host_tools: hostToolsOf(shell), ...(shell === "computer" ? {} : { shell_note: SHELL_NOTES[shell] }) };
|
|
159
|
+
}
|
|
117
160
|
/** The server's default where an agent has no computer setting: in Mode 1 a sandbox on the first provider that binds a
|
|
118
161
|
* folder of this machine and answers here (Docker), else none; in Mode 2 none. */
|
|
119
162
|
async function defaultSetting(mode, registry, side) {
|
|
@@ -173,14 +216,24 @@ export async function resolveComputer(given, mode, registry, side) {
|
|
|
173
216
|
return { refused: `Mode 2 keeps workspaces on Archil; a local Docker computer can't mount them. Pick a remote sandbox for this agent's computer in ${SETTINGS}, or no computer.` };
|
|
174
217
|
return { refused: `A ${entry.label} sandbox can't mount the run's folder from Archil: pick another sandbox for this agent's computer in ${SETTINGS}.` };
|
|
175
218
|
}
|
|
176
|
-
// Its GPUs, a sandbox's alone: in
|
|
177
|
-
// the mode's folder as the mount it takes (a sandbox here always mounts it).
|
|
219
|
+
// Its GPUs, a sandbox's alone: in gpuRefused's words, against what the configuration the setting selected declares,
|
|
220
|
+
// with the mode's folder as the mount it takes (a sandbox here always mounts it). A GPU computer that can't mount the
|
|
221
|
+
// folder is told so, and what to use instead.
|
|
178
222
|
const gpu = kind === "sandbox" && setting.gpu ? setting.gpu : undefined;
|
|
179
223
|
if (gpu) {
|
|
180
|
-
const
|
|
181
|
-
if (
|
|
182
|
-
return { refused:
|
|
224
|
+
const refused = gpuRefused(gpu, configuration.gpu, { kind: mode === 1 ? "bind" : "archil" }, entry.label);
|
|
225
|
+
if (refused?.folder)
|
|
226
|
+
return { refused: refused.words };
|
|
227
|
+
if (refused)
|
|
228
|
+
return { refused: `A ${entry.label} sandbox can't have this agent's GPUs: ${refused.words}. Change the GPUs or the provider for this agent's computer in ${SETTINGS}.` };
|
|
183
229
|
}
|
|
230
|
+
// The agent's own computer, kept between its runs: only where the configuration keeps one, and never one that mounts
|
|
231
|
+
// the run's folder (a later run would find an earlier run's folder in it).
|
|
232
|
+
const persistent = setting.persistent === true;
|
|
233
|
+
if (persistent && configuration.persistence === undefined)
|
|
234
|
+
return { refused: `A ${entry.label} ${kind} keeps no computer for an agent between runs (it declares no persistence): turn persistent off, or pick a computer that keeps one, for this agent's computer in ${SETTINGS}.` };
|
|
235
|
+
if (persistent && mounts)
|
|
236
|
+
return { refused: `A ${entry.label} ${kind} mounts each run's folder, so it can't be kept between runs: turn persistent off for this agent's computer in ${SETTINGS}.` };
|
|
184
237
|
// Its keys: every required one saved, before anything starts; only declared names go to the provider.
|
|
185
238
|
const saved = await side.keysOf(entry.id);
|
|
186
239
|
const has = (name) => typeof saved[name] === "string" && saved[name] !== "";
|
|
@@ -201,7 +254,7 @@ export async function resolveComputer(given, mode, registry, side) {
|
|
|
201
254
|
const mount = mounts ? await workspace.mountSpec() : undefined;
|
|
202
255
|
let launched;
|
|
203
256
|
try {
|
|
204
|
-
launched = await side.launch(entry, { kind, keys, configuration, ...(mount ? { mount } : {}), ...(gpu ? { gpu: { type: gpu.type, count: gpu.count } } : {}), ...(signal ? { signal } : {}) });
|
|
257
|
+
launched = await side.launch(entry, { kind, keys, configuration, ...(mount ? { mount } : {}), ...(gpu ? { gpu: { type: gpu.type, count: gpu.count } } : {}), ...(persistent ? { persistent: true } : {}), ...(signal ? { signal } : {}) });
|
|
205
258
|
}
|
|
206
259
|
catch (error) {
|
|
207
260
|
// A provider that binds a folder of this machine (Docker) whose daemon does not answer: the one wording.
|
|
@@ -221,20 +274,19 @@ export async function resolveComputer(given, mode, registry, side) {
|
|
|
221
274
|
}
|
|
222
275
|
/** The started computer as runTools takes it, or what it lacks, in words. */
|
|
223
276
|
function runComputerOf(kind, launched, check) {
|
|
224
|
-
const groups = launched.groups;
|
|
225
277
|
// The run's browser tool opens a browser's sessions through its provider.
|
|
226
278
|
if (kind === "browser")
|
|
227
279
|
return launched.browser ? { kind, browser: launched.browser } : "it gave no CDP connection";
|
|
228
|
-
const { client } = launched;
|
|
280
|
+
const { client, hello } = launched;
|
|
229
281
|
if (!client)
|
|
230
282
|
return "it gave no computer protocol client";
|
|
231
283
|
if (kind === "phone")
|
|
232
|
-
return { kind, computer: { client },
|
|
284
|
+
return hello ? { kind, computer: { client }, hello } : "it gave no hello";
|
|
233
285
|
if (check && !launched.readBack)
|
|
234
286
|
return "it gave no read-back of its mount";
|
|
235
287
|
const readBack = launched.readBack ? () => launched.readBack() : async () => ({ ok: false, error: { code: "unsupported", message: "nothing is mounted in this computer" } });
|
|
236
288
|
const computer = { id: launched.id, client, readBack };
|
|
237
289
|
if (kind === "sandbox")
|
|
238
290
|
return check ? { kind, computer, check } : "a sandbox mounts the run's folder";
|
|
239
|
-
return { kind, computer,
|
|
291
|
+
return hello ? { kind, computer, hello, ...(check ? { check } : {}) } : "it gave no hello";
|
|
240
292
|
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { Settings } from "../store/index.js";
|
|
2
|
+
import type { LaunchDisk } from "../run-launch.js";
|
|
3
|
+
import type { ArchilControlOptions } from "./archil-mount-credential.js";
|
|
4
|
+
/** The disk a run uses, and whose it is: the launch's (a customer's) or its agent's. */
|
|
5
|
+
export interface RunDisk {
|
|
6
|
+
readonly diskId: string;
|
|
7
|
+
readonly kind: "launch" | "agent";
|
|
8
|
+
}
|
|
9
|
+
export interface RunDiskOptions {
|
|
10
|
+
/** The store's settings: the agent's stored disk and the server's id. */
|
|
11
|
+
readonly store: {
|
|
12
|
+
readonly settings: Pick<Settings, "get" | "put" | "putIfAbsent">;
|
|
13
|
+
};
|
|
14
|
+
readonly agentId: string;
|
|
15
|
+
/** The run, when the claim is a run's: the agent's disk it first resolves to is kept for it (a reopened run mounts that one). */
|
|
16
|
+
readonly runId?: string;
|
|
17
|
+
/** The disk the run's launch record names, when it names one. */
|
|
18
|
+
readonly launch?: LaunchDisk;
|
|
19
|
+
/** The control plane of the account key's region, with the key. */
|
|
20
|
+
readonly control: ArchilControlOptions;
|
|
21
|
+
readonly signal?: AbortSignal;
|
|
22
|
+
/** How long a disk just made may read `creating` before the run is refused (default 120 s). */
|
|
23
|
+
readonly availableMs?: number;
|
|
24
|
+
}
|
|
25
|
+
/** The words of the plan's disk limit, its number when Archil said it. */
|
|
26
|
+
export declare const diskLimitWords: (limit: number | undefined) => string;
|
|
27
|
+
/** Why disk `diskId`, named by a launch, can't hold a run here, in words naming the region; undefined when it can. A call
|
|
28
|
+
* that fails (Archil not reached, or refusing the key) throws its ArchilDiskError. */
|
|
29
|
+
export declare function launchDiskProblem(control: ArchilControlOptions, diskId: string, context?: {
|
|
30
|
+
readonly signal?: AbortSignal;
|
|
31
|
+
}): Promise<string | undefined>;
|
|
32
|
+
/** The run's disk: the launch's, checked again to be in the key's region; else the agent's, made now when it has none.
|
|
33
|
+
* Refused in words (ArchilClaimRefused) naming the disk or the region, never a key. */
|
|
34
|
+
export declare function runDiskOf(options: RunDiskOptions): Promise<RunDisk>;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
// The disk a run keeps its folder on, in Archil mode: the one its launch names (a disk per customer, run-launch.ts
|
|
2
|
+
// archilDisk kind "launch"), else its agent's own. The claim resolves it before its mount credential is minted, so the
|
|
3
|
+
// token is minted, mounted, revoked and reclaimed on that disk alone, and Archil refuses it on any other.
|
|
4
|
+
// - A launch's disk is not agentrun's: it is read (GET /api/disks/{id}) to check it is in the account key's region, and
|
|
5
|
+
// never made, renamed or removed. The server reads it at the launch (a 422 before any run is made) and the claim
|
|
6
|
+
// again, for a disk removed in between; one in another region, or none of that id, is refused in words naming the
|
|
7
|
+
// region.
|
|
8
|
+
// - The agent's disk is stored on the agent (archil-settings.ts agentDiskOf). An agent with none yet has it made now, on
|
|
9
|
+
// its first run that uses it (never at the agent's creation: an agent whose runs all name a disk never has one), named
|
|
10
|
+
// agentrun-<server id>-i-<agent id> (diskNameOf), idempotent by that name. The plan's disk limit refuses the run in words.
|
|
11
|
+
import { agentDiskOf, diskNameOf, keepRunDisk, runDiskKept, serverIdOf, storeAgentDisk } from "../archil-settings.js";
|
|
12
|
+
import { ArchilClaimRefused } from "./archil-claim.js";
|
|
13
|
+
import { ArchilDiskLimit, availableDisk, ensureDisk, getDisk } from "./archil-disks.js";
|
|
14
|
+
/** The words of the plan's disk limit, its number when Archil said it. */
|
|
15
|
+
export const diskLimitWords = (limit) => limit === undefined ? "your Archil plan's disk limit is reached; upgrade or delete an agent" : `your Archil plan allows ${limit} disks; upgrade or delete an agent`;
|
|
16
|
+
/** Why disk `diskId`, named by a launch, can't hold a run here, in words naming the region; undefined when it can. A call
|
|
17
|
+
* that fails (Archil not reached, or refusing the key) throws its ArchilDiskError. */
|
|
18
|
+
export async function launchDiskProblem(control, diskId, context = {}) {
|
|
19
|
+
const region = control.region;
|
|
20
|
+
const disk = await getDisk(control, diskId, context);
|
|
21
|
+
if (disk === undefined)
|
|
22
|
+
return `Archil has no disk ${diskId} in region ${region}, the region of this server's Archil key: name a disk in ${region}.`;
|
|
23
|
+
if (disk.region !== "" && disk.region !== region)
|
|
24
|
+
return `The disk ${diskId} is in region ${disk.region}, and this server's Archil key is for region ${region}: name a disk in ${region}.`;
|
|
25
|
+
return undefined;
|
|
26
|
+
}
|
|
27
|
+
/** The run's disk: the launch's, checked again to be in the key's region; else the agent's, made now when it has none.
|
|
28
|
+
* Refused in words (ArchilClaimRefused) naming the disk or the region, never a key. */
|
|
29
|
+
export async function runDiskOf(options) {
|
|
30
|
+
const { launch, control, signal } = options;
|
|
31
|
+
const region = control.region;
|
|
32
|
+
if (launch?.kind === "launch") {
|
|
33
|
+
const problem = await launchDiskProblem(control, launch.diskId, signal ? { signal } : {}).catch((error) => {
|
|
34
|
+
throw new ArchilClaimRefused(`This run's Archil disk ${launch.diskId} could not be read: ${error.message}`, { cause: error });
|
|
35
|
+
});
|
|
36
|
+
if (problem !== undefined)
|
|
37
|
+
throw new ArchilClaimRefused(problem);
|
|
38
|
+
return { diskId: launch.diskId, kind: "launch" };
|
|
39
|
+
}
|
|
40
|
+
const stored = await agentDiskOf(options.store, options.agentId);
|
|
41
|
+
/** Waits for a pending disk to read available, then clears its pending mark (unless it was removed or replaced meanwhile). */
|
|
42
|
+
const ready = async (diskId) => {
|
|
43
|
+
await availableDisk(control, diskId, { ...(options.availableMs !== undefined ? { timeoutMs: options.availableMs } : {}), ...(signal ? { signal } : {}) });
|
|
44
|
+
const now = await agentDiskOf(options.store, options.agentId);
|
|
45
|
+
if (now?.diskId === diskId && !now.removing)
|
|
46
|
+
await storeAgentDisk(options.store, options.agentId, { diskId });
|
|
47
|
+
};
|
|
48
|
+
const readyReused = (diskId) => ready(diskId).catch((error) => {
|
|
49
|
+
throw new ArchilClaimRefused(`This agent's Archil disk ${diskId} is not ready in region ${region}: ${error.message}`, { cause: error });
|
|
50
|
+
});
|
|
51
|
+
// A launch that names no disk resolved to its agent's on its first claim, and that disk was kept for the run: a later
|
|
52
|
+
// claim of the same run (a reopened one) mounts it or is refused, never another disk.
|
|
53
|
+
const kept = launch === undefined && options.runId !== undefined ? await runDiskKept(options.store, options.runId) : undefined;
|
|
54
|
+
const bound = launch?.kind === "agent" ? launch.diskId : kept;
|
|
55
|
+
// The agent's disk as its launch recorded it is mounted only while it is still the agent's and not being removed: a
|
|
56
|
+
// run launched while DELETE /v2/agents/{id}/archil ran is refused, never started on a disk being deleted.
|
|
57
|
+
if (bound !== undefined) {
|
|
58
|
+
if (stored?.diskId !== bound || stored.removing)
|
|
59
|
+
throw new ArchilClaimRefused(`This run's Archil disk ${bound} was its agent's, and it ${stored?.diskId === bound ? "is being" : "has been"} removed: start a new run, and it gets the agent's new disk.`);
|
|
60
|
+
if (stored.pending)
|
|
61
|
+
await readyReused(bound);
|
|
62
|
+
return { diskId: bound, kind: "agent" };
|
|
63
|
+
}
|
|
64
|
+
const keep = async (diskId) => {
|
|
65
|
+
if (options.runId !== undefined)
|
|
66
|
+
await keepRunDisk(options.store, options.runId, diskId);
|
|
67
|
+
return { diskId, kind: "agent" };
|
|
68
|
+
};
|
|
69
|
+
if (stored?.removing)
|
|
70
|
+
throw new ArchilClaimRefused(`This agent's Archil disk ${stored.diskId} is being removed: start a new run once that is done, and it gets a new disk.`);
|
|
71
|
+
if (stored !== undefined) {
|
|
72
|
+
if (stored.pending)
|
|
73
|
+
await readyReused(stored.diskId);
|
|
74
|
+
return keep(stored.diskId);
|
|
75
|
+
}
|
|
76
|
+
const name = diskNameOf(await serverIdOf(options.store), options.agentId);
|
|
77
|
+
let id;
|
|
78
|
+
try {
|
|
79
|
+
id = (await ensureDisk(control, name, signal ? { signal } : {})).id;
|
|
80
|
+
// Stored before the wait, as pending, so a disk that never becomes available is still the agent's (DELETE
|
|
81
|
+
// /v2/agents/{id}/archil finds it, and the plan's slot it takes is never lost) and a claim that finds it waits.
|
|
82
|
+
await storeAgentDisk(options.store, options.agentId, { diskId: id, pending: true });
|
|
83
|
+
await ready(id);
|
|
84
|
+
}
|
|
85
|
+
catch (error) {
|
|
86
|
+
if (error instanceof ArchilDiskLimit)
|
|
87
|
+
throw new ArchilClaimRefused(`This agent's Archil disk can't be made: ${diskLimitWords(error.limit)}.`, { cause: error });
|
|
88
|
+
throw new ArchilClaimRefused(`This agent's Archil disk ${name} can't be made in region ${region}: ${error.message}`, { cause: error });
|
|
89
|
+
}
|
|
90
|
+
return keep(id);
|
|
91
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Context } from "@earendil-works/chord";
|
|
2
2
|
import type { HostTool } from "@parcha/agentrun-kernel";
|
|
3
3
|
import { type CapabilityKind, type Registry } from "@parcha/agentrun-kernel/kernel";
|
|
4
|
-
import type { ComputerClient,
|
|
4
|
+
import type { ComputerClient, HelloResult } from "@parcha/agentrun-computer";
|
|
5
5
|
import type { AttachableComputer, MountCheck } from "./attach.js";
|
|
6
6
|
import { type PiAnswer, type PiExecutor } from "./executors.js";
|
|
7
7
|
import { type Hands } from "./hands.js";
|
|
@@ -16,7 +16,7 @@ import type { Workspace } from "./workspace.js";
|
|
|
16
16
|
* - phone: a screen, touch and apps; never attached;
|
|
17
17
|
* - browser: what the run's browser tool drives it by (its CDP URL through its provider); no tools of the registry's,
|
|
18
18
|
* never attached.
|
|
19
|
-
* `
|
|
19
|
+
* `hello`: what a desktop or a phone said it is when the claim connected it; its groups fill its kind's ports.
|
|
20
20
|
*/
|
|
21
21
|
export type RunComputer = {
|
|
22
22
|
readonly kind: "sandbox";
|
|
@@ -25,14 +25,14 @@ export type RunComputer = {
|
|
|
25
25
|
} | {
|
|
26
26
|
readonly kind: "desktop";
|
|
27
27
|
readonly computer: AttachableComputer;
|
|
28
|
-
readonly
|
|
28
|
+
readonly hello: HelloResult;
|
|
29
29
|
readonly check?: MountCheck;
|
|
30
30
|
} | {
|
|
31
31
|
readonly kind: "phone";
|
|
32
32
|
readonly computer: {
|
|
33
33
|
readonly client: ComputerClient;
|
|
34
34
|
};
|
|
35
|
-
readonly
|
|
35
|
+
readonly hello: HelloResult;
|
|
36
36
|
} | {
|
|
37
37
|
readonly kind: "browser";
|
|
38
38
|
readonly browser: ClaimBrowser;
|
|
@@ -11,7 +11,7 @@ import { shellPlaceOf } from "./resolve-computer.js";
|
|
|
11
11
|
function mountedIn(computer) {
|
|
12
12
|
if (computer?.kind === "sandbox")
|
|
13
13
|
return computer;
|
|
14
|
-
if (computer?.kind === "desktop" && computer.check && computer.groups.includes("files") && computer.groups.includes("exec"))
|
|
14
|
+
if (computer?.kind === "desktop" && computer.check && computer.hello.groups.includes("files") && computer.hello.groups.includes("exec"))
|
|
15
15
|
return { computer: computer.computer, check: computer.check };
|
|
16
16
|
return undefined;
|
|
17
17
|
}
|
|
@@ -21,15 +21,17 @@ function mountedIn(computer) {
|
|
|
21
21
|
function portsOf(computer) {
|
|
22
22
|
if (computer?.kind === "desktop") {
|
|
23
23
|
const { client } = computer.computer;
|
|
24
|
-
const
|
|
25
|
-
const
|
|
24
|
+
const { groups } = computer.hello;
|
|
25
|
+
const screen = groups.includes("screen");
|
|
26
|
+
const input = groups.includes("input.pointer") || groups.includes("input.keys");
|
|
26
27
|
return screen && input ? { ports: { screen: screenOf(client), input: inputOf(client) }, kinds: ["desktop"], without: [] } : { ports: {}, kinds: [], without: [] };
|
|
27
28
|
}
|
|
28
29
|
if (computer?.kind === "phone") {
|
|
29
|
-
|
|
30
|
+
const { groups } = computer.hello;
|
|
31
|
+
if (!groups.includes("screen") || !groups.includes("input.touch"))
|
|
30
32
|
return { ports: {}, kinds: [], without: [] };
|
|
31
|
-
const tree =
|
|
32
|
-
const keys =
|
|
33
|
+
const tree = groups.includes("apps.ui_tree");
|
|
34
|
+
const keys = groups.includes("input.keys");
|
|
33
35
|
return { ports: { phone: phoneOf(computer.computer.client, { tree, keys }) }, kinds: ["phone"], without: [...(tree ? [] : ["phone_tree"]), ...(keys ? [] : ["phone_key"])] };
|
|
34
36
|
}
|
|
35
37
|
return { ports: {}, kinds: [], without: [] };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type Store } from "../store/index.js";
|
|
2
2
|
import type { KeyEnv } from "../key-meta.js";
|
|
3
3
|
import { type ArchilDisk, type ArchilDiskOptions } from "./archil-disk.js";
|
|
4
4
|
import { type Workspace } from "./workspace.js";
|
|
@@ -11,7 +11,8 @@ export interface ServerRunWorkspaceOptions {
|
|
|
11
11
|
readonly sealKey: Buffer | undefined;
|
|
12
12
|
/** Makes the Archil disk (default archilDisk): a test's fake. */
|
|
13
13
|
readonly makeDisk?: (options: ArchilDiskOptions) => ArchilDisk;
|
|
14
|
-
/** The server's environment: an ARCHIL_API_KEY there is the account key, over a saved one
|
|
14
|
+
/** The server's environment: an ARCHIL_API_KEY there is the account key, over a saved one, and the Archil settings
|
|
15
|
+
* there (ARCHIL_SETTINGS_ENV) the region and S3 URL, over the saved row. */
|
|
15
16
|
readonly env?: KeyEnv;
|
|
16
17
|
}
|
|
17
18
|
/** `workspace` with its reads only: read, list, stat and grep pass through; everything else is refused. */
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
// The server's read-only view of a run's folder: what the server reads a run's files through (its file routes), with no
|
|
2
2
|
// runner claim. Mode 1: the run's local folder (runFolder). Mode 2 (the server's Archil settings present): the run's
|
|
3
|
-
// folder on the
|
|
3
|
+
// folder on the run's Archil disk (runKey; the disk its launch record names, else its agent's), its account key by the
|
|
4
|
+
// one resolver (archil-key.ts: the server's
|
|
4
5
|
// ARCHIL_API_KEY, else the sealed row), with no claim around it: no exec, no spill sweep, no mount credential, no mount.
|
|
5
6
|
//
|
|
6
7
|
// Read-only: read, list, stat and grep work as the run's own Workspace answers them (a link is never followed). Every
|
|
7
8
|
// call that would change the folder, run something in it, or put it in a computer is refused with REFUSED in plain words:
|
|
8
9
|
// only the run's runner writes its folder.
|
|
9
10
|
import { lstat } from "node:fs/promises";
|
|
10
|
-
import { loadArchilSettings } from "../archil-settings.js";
|
|
11
|
+
import { agentDiskOf, loadArchilSettings } from "../archil-settings.js";
|
|
12
|
+
import { readLaunchBody } from "../run-launch.js";
|
|
13
|
+
import { StoreLaunchMissing } from "../store/index.js";
|
|
11
14
|
import { ArchilClaimRefused } from "./archil-claim.js";
|
|
12
15
|
import { archilDisk } from "./archil-disk.js";
|
|
13
16
|
import { archilApiKey } from "./archil-key.js";
|
|
@@ -38,6 +41,11 @@ export function readOnlyWorkspace(workspace) {
|
|
|
38
41
|
attach: refuse,
|
|
39
42
|
};
|
|
40
43
|
}
|
|
44
|
+
/** The disk run `runId` keeps its folder on: its launch record's, else its agent's, or undefined when it has none yet. */
|
|
45
|
+
async function runDiskIdOf(store, runId, agentId) {
|
|
46
|
+
const named = await store.runs.launch(runId).then((row) => readLaunchBody(row.body)?.archilDisk, (error) => (error instanceof StoreLaunchMissing ? undefined : Promise.reject(error)));
|
|
47
|
+
return named?.diskId ?? (await agentDiskOf(store, agentId))?.diskId;
|
|
48
|
+
}
|
|
41
49
|
/**
|
|
42
50
|
* Run `runId`'s folder as the server reads it, read-only; null when there is no such run, or its folder is not there yet.
|
|
43
51
|
* In Mode 2, an Archil account key that is not saved, or a server with no seal key, is UNAVAILABLE in words that name
|
|
@@ -47,7 +55,12 @@ export async function serverRunWorkspace(store, runId, options) {
|
|
|
47
55
|
const run = await store.runs.get(runId);
|
|
48
56
|
if (run === undefined)
|
|
49
57
|
return null;
|
|
50
|
-
const settings = await loadArchilSettings(store);
|
|
58
|
+
const settings = await loadArchilSettings(store, options.env);
|
|
59
|
+
// The run's disk (Mode 2): the one its launch record names, else its agent's; none yet when its agent has no disk (its
|
|
60
|
+
// first run was not claimed), so it has no folder.
|
|
61
|
+
const diskId = settings === undefined ? undefined : await runDiskIdOf(store, runId, run.agentId);
|
|
62
|
+
if (settings !== undefined && diskId === undefined)
|
|
63
|
+
return null;
|
|
51
64
|
let workspace;
|
|
52
65
|
if (settings === undefined) {
|
|
53
66
|
const folder = runFolder(options.data, run.agentId, runId);
|
|
@@ -66,7 +79,7 @@ export async function serverRunWorkspace(store, runId, options) {
|
|
|
66
79
|
let disk;
|
|
67
80
|
try {
|
|
68
81
|
const { value } = await archilApiKey({ env: options.env ?? {}, keys: store.sealedKeys, sealKey: options.sealKey });
|
|
69
|
-
disk = (options.makeDisk ?? archilDisk)({ disk:
|
|
82
|
+
disk = (options.makeDisk ?? archilDisk)({ disk: diskId, region: settings.region, s3BaseUrl: settings.s3Url, key: () => value });
|
|
70
83
|
}
|
|
71
84
|
catch (error) {
|
|
72
85
|
if (error instanceof ArchilClaimRefused)
|
package/dist/workspace.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// A run's work/ as this server reads it (the console's file view and listing, a skill's SKILL.md), and an agent's home as
|
|
2
|
-
// it reads and writes it: never through a link. Each read and write goes through
|
|
2
|
+
// it reads and writes it: never through a link. Each read and write goes through the confinement (confine.ts), which
|
|
3
3
|
// walks down from the root on held directory handles without following, so a component swapped for a link between a
|
|
4
4
|
// check and the open is refused, not followed. On top of it: the path must be the root joined with its own names (a link
|
|
5
5
|
// anywhere on the way, even one pointing inside the root, is refused), only regular files and directories are read, and a
|
package/package.json
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@parcha/agentrun-serve",
|
|
3
|
-
"version": "0.1.0-beta.
|
|
3
|
+
"version": "0.1.0-beta.36",
|
|
4
4
|
"description": "The AgentRun server: the /v2 API and console over one store, with runners that run your agents; the deployable process of the AgentRun platform.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agentrun",
|
|
7
7
|
"agent",
|
|
8
8
|
"pi",
|
|
9
|
-
"pi-durable",
|
|
10
9
|
"server",
|
|
11
10
|
"api"
|
|
12
11
|
],
|
|
@@ -50,22 +49,18 @@
|
|
|
50
49
|
"test:pg": "node scripts/test-pg.mjs"
|
|
51
50
|
},
|
|
52
51
|
"dependencies": {
|
|
53
|
-
"@
|
|
52
|
+
"@earendil-works/pi-agent-core": "1.5.0",
|
|
54
53
|
"@earendil-works/pi-coding-agent": "1.5.0",
|
|
55
54
|
"@modelcontextprotocol/client": "2.4.0",
|
|
56
55
|
"@modelcontextprotocol/server": "2.4.0",
|
|
57
|
-
"@parcha/agentrun-computer": "0.1.0-beta.
|
|
58
|
-
"@parcha/agentrun-decisions": "0.1.0-beta.
|
|
59
|
-
"@parcha/agentrun-dsl": "0.1.0-beta.
|
|
60
|
-
"@parcha/agentrun-harness-claude": "0.1.0-beta.
|
|
61
|
-
"@parcha/agentrun-harness-codex": "0.1.0-beta.
|
|
62
|
-
"@parcha/agentrun-jev": "0.1.0-beta.
|
|
63
|
-
"@parcha/agentrun-kernel": "0.1.0-beta.
|
|
64
|
-
"@parcha/
|
|
65
|
-
"@parcha/pi-browser": "0.1.0-beta.35",
|
|
66
|
-
"@parcha/pi-durable-agent": "0.1.0-beta.35",
|
|
67
|
-
"@parcha/pi-durable-disk": "0.1.0-beta.35",
|
|
68
|
-
"@parcha/pi-transport": "0.1.0-beta.35",
|
|
56
|
+
"@parcha/agentrun-computer": "0.1.0-beta.36",
|
|
57
|
+
"@parcha/agentrun-decisions": "0.1.0-beta.36",
|
|
58
|
+
"@parcha/agentrun-dsl": "0.1.0-beta.36",
|
|
59
|
+
"@parcha/agentrun-harness-claude": "0.1.0-beta.36",
|
|
60
|
+
"@parcha/agentrun-harness-codex": "0.1.0-beta.36",
|
|
61
|
+
"@parcha/agentrun-jev": "0.1.0-beta.36",
|
|
62
|
+
"@parcha/agentrun-kernel": "0.1.0-beta.36",
|
|
63
|
+
"@parcha/pi-browser": "0.1.0-beta.36",
|
|
69
64
|
"@secretlint/core": "13.1.0",
|
|
70
65
|
"@secretlint/profiler": "13.1.0",
|
|
71
66
|
"@secretlint/secretlint-rule-preset-recommend": "13.1.0",
|
package/templates/README.md
CHANGED
|
@@ -23,7 +23,8 @@ the evals](#running-the-evals)).
|
|
|
23
23
|
|
|
24
24
|
## The packages this server ships
|
|
25
25
|
|
|
26
|
-
None needs a sandbox: each reads and writes through web tools and MCP
|
|
26
|
+
None needs a sandbox (code-review prefers a shell and runs without one): each reads and writes through web tools and MCP
|
|
27
|
+
servers the owner saves.
|
|
27
28
|
|
|
28
29
|
**Writes are bounded.** Every package reads content someone else wrote (web pages, pull requests, form submissions),
|
|
29
30
|
so no package puts a write in its own `allow`. A package whose job runs on triggers (code-review, inbound-lead,
|
|
@@ -53,7 +54,7 @@ the owner grants a write, text the agent read could try to copy what that read r
|
|
|
53
54
|
|
|
54
55
|
| Package | What it does | Started by | Needs |
|
|
55
56
|
|---|---|---|---|
|
|
56
|
-
| `code-review` | Reviews a pull request for real bugs and posts one comment review, never an approval (its write is pinned to COMMENT). A fork's PR is reviewed when a writer comments `@<bot> review
|
|
57
|
+
| `code-review` | Reviews a pull request for real bugs on a read-only checkout AgentRun makes of the PR (`checkout: pull_request`, in `repo/`): one `subagent` turn starts five quick and three deep reviewers, each with read-only bash (`git diff`, `git grep`, `nl -ba`; none builds or runs the code), against the repository's `CODEREVIEW.md` (on top of its own `rules/CODEREVIEW.md`, the baseline and the starter); the agent merges and verifies their findings and posts one comment review with P0/P1/P2 findings, each quoting the line behind it, and a 1-5 risk score, never an approval (its write is pinned to COMMENT). A fork's PR is reviewed when a writer comments `@<bot> review` | a run naming a PR, or a GitHub webhook trigger the owner adds | a shell (`computer: [shell, none]`: with none, it is made without bash and its reviewers read through the GitHub tools); the GitHub MCP server `github` to read the PR and post; with neither, a diff in the message |
|
|
57
58
|
| `kyb` | Business due diligence: identity, owners, sanctions against the lists themselves, adverse media, a verdict, every claim cited | a run naming a company | nothing; web tools only |
|
|
58
59
|
| `market-monitor` | A weekly digest of what changed at the companies you watch, posted to one Slack channel or address | a weekly schedule (its `cron` and `timezone` parameters, Monday 08:00 UTC by default), or a run | optional: Slack (`slack`) or Gmail (`gmail`) MCP, to send |
|
|
59
60
|
| `inbound-lead` | Researches a form or CRM lead, scores it against your ICP, writes back to HubSpot or posts to Slack | a webhook (needs the seal key): your form tool or relay signs Standard Webhooks bodies of type `lead.submitted`, each lead its own run (3 at once); or a run | optional: HubSpot (`hubspot`) or Slack (`slack`) MCP |
|
|
@@ -171,12 +172,13 @@ The report gives each run's cost and each `llm` grade's, as their run records sa
|
|
|
171
172
|
| `description` | Required. Also the agent's description. |
|
|
172
173
|
| `license`, `author` (`{name, email?, url?}`), `repository` | Optional, shown in the list. |
|
|
173
174
|
| `harness` | A preference list (`[pi, claude-agent]`): apply takes the first this server runs, else the first. Absent: the server's default. |
|
|
174
|
-
| `model` | `{tier: fast \| balanced \| strong, prefer?: "provider/model-id"}`. Apply uses `prefer` when this server runs it on the chosen harness (it holds that provider's key and reaches models directly, not through a gateway); otherwise the server's model for the tier: `AGENT_MODEL_FAST`, `AGENT_MODEL` (balanced) or `AGENT_MODEL_STRONG`, each else the default of a model key the server holds. `overrides.model` in the apply wins over both. On a server that reaches its models through a gateway (`AGENT_MODEL_BASE_URL`), `prefer` is not used, since the gateway never said it serves it, and a tier model that is the gateway's own id (no `provider/`) is left out, so the agent runs on the server's default; each is said in a `model` warning. Absent: the server's default. |
|
|
175
|
+
| `model` | `{tier: fast \| balanced \| strong, prefer?: "provider/model-id"}`. Apply uses `prefer` when this server runs it on the chosen harness (it holds that provider's key and reaches models directly, not through a gateway); otherwise the server's model for the tier: `AGENT_MODEL_FAST`, `AGENT_MODEL` (balanced) or `AGENT_MODEL_STRONG`, each else the default of a model key the server holds. `overrides.model` in the apply wins over both. On a server that reaches its models through a gateway (`AGENT_MODEL_BASE_URL`), `prefer` is not used, since the gateway never said it serves it, and a tier model that is the gateway's own id (no `provider/`) is left out, so the agent runs on the server's default; each is said in a `model` warning. `fast` and `strong` (each `"provider/model-id"`, optional) name the model the agent's `subagent` calls run on for that tier, kept by the same rule as `prefer` (else the server's model for the tier, with a `model` warning); the agent's own tier, named in neither, is the agent's own model. Apply writes them as the definition's `model_tiers`. Absent: the server's default. |
|
|
175
176
|
| `effort` | The thinking level: `low`, `medium`, `high`, `xhigh` or `max`. |
|
|
176
|
-
| `tools` | The tools the agent is granted, never an MCP tool (`mcp` grants those). Absent: those the server gives a new agent (its box's shell, where it has a box). |
|
|
177
|
+
| `tools` | The tools the agent is granted, never an MCP tool (`mcp` grants those). `subagent` (pi only) lets the agent run a fresh conversation with a prompt and a subset of its own tools (MCP tools and `bash` included, `bash` held to the agent's `tool_policy`), on the agent's own model or one of its tiers (`fast`, `strong`) when the call names one, under its permissions and cap, and get the child's final text back, with `max_tool_calls` (narrowing the agent's budget, never widening it) and `effort` (`low`, `medium`, `high`) of its own when the call names them; several in a turn run at once, at most 4. A skill can use it to sample K answers, merge them and verify each before acting ([patterns](../README.md#patterns)). Absent: those the server gives a new agent (its box's shell, where it has a box). |
|
|
177
178
|
| `mcp` | `[{server, tools, required?, allow?, pin?}]`: MCP servers by the name a server saves them under (Settings → MCP servers), the tools of each the agent uses (each one tool by its name, `A-Z a-z 0-9 _ . -`; never `*`), and `allow`, those of its tools the package asks the owner to allow (`GET /v2/templates` shows each tool with `asks: allow` or `ask`, for a consent screen). Where the server has one saved, apply grants `mcp:<server>/<tool>` for each, beside the other tools, at the owner's own setting: a package never sets a permission. Only the apply's `grants`, the owner's answer, are set to `allow`. Where it has none, apply skips it with a warning (`mcp.<server>`), or, when `required` is true, refuses with `409 agent_not_runnable` and makes nothing. `pin`, optional: `{<tool>: {<argument>: <value>}}`, for tools of the entry, 1 to 8 top-level arguments each, every value a scalar (text, which may be or hold `${parameters.<name>}`, a number, `true`/`false`, or `null` for an argument that must be left out) or a list of 1 to 16 of them, the argument one of the list (`event: [null, COMMENT]`), kept with each value once, null first, then by its JSON text. Apply writes it, filled, as the tool's `pin` in the agent's `tool_settings` (text that is one placeholder alone takes the parameter's value and type), whatever the tool's permission, and the gate refuses any call not as pinned; a pin the server's own settings (Settings → Tools) set for the tool holds too. A pin whose parameter apply is not given sets the tool to `deny` instead, granted or not, with a `pins.mcp:<server>/<tool>` warning. `GET /v2/templates` shows each tool's `pin`, unfilled. |
|
|
178
179
|
| `tool_policy` | `{bash: read-only}`: a policy on the agent's bash, the one tool that takes one. Apply writes it as `policy` on bash in the agent's `tool_settings` (`definition.tool_settings.bash.policy`), whatever bash's permission, and the tool gate reads each shell call's command before it runs or anyone is asked. Under `read-only` it refuses, in words the model reads, any command that could write, run code or read outside the run's folder: a program outside the read list (git's read subcommands `diff`, `show`, `log`, `blame`, `grep`, `ls-files`, `ls-tree`, `rev-parse`, `cat-file`, `merge-base`, `status`, `shortlog`, `rev-list`, `diff-tree`, `name-rev`, `describe`; `grep`, `egrep`, `fgrep`, `rg`, `sed -n 'N,Mp'`, `cat`, `head`, `tail`, `wc`, `nl`, `ls`, `find` without `-exec` or `-delete`, `sort`, `uniq`, `cut`, `tr`, `diff`, `basename`, `dirname`, `echo`, `true`), a redirection other than `2>/dev/null` and `2>&1`, `$` and backticks, a subshell, `\|\|` or a lone `&`, a pipe into anything but a filter (`head`, `tail`, `sed -n`, `grep`, `wc`, `sort`, `uniq`, `cut`, `tr`, `nl`), an unquoted glob (a glob is quoted, and only in a grep pattern, an `--include=` value or a `find -name` value), a path outside the run's folder, or one on the never-open list (`.env*`, `.ssh/`, `id_rsa*`, `*.pem`, `*.key`, `.npmrc`, `.netrc`, `.git-credentials`, `credentials`), which refuses a command that names such a file but is no fence around the folder: a recursive search reads all it holds, the run's own files and never a key of the server's. `git -C <dir>` is allowed to a directory inside the folder. A line with a `cd` joins its commands with `&&` only. `bash_background` and `bash_input` are refused under it. The check reads the command, never the folder, so a symbolic link in the folder reaches what the computer lets it; and it holds bash alone, so a read-only agent's tools are `read` and `bash` (one that may write can change what git obeys). Approvals `never` lifts none of it. A package with `tools` grants `bash` among them. |
|
|
179
|
-
| `computer` | `default`
|
|
180
|
+
| `computer` | `default` (or absent): the agent runs where this server puts a new one. Or a preference list, `[shell, none]`, read like `harness`: apply takes the first entry this server meets now and saves it as the agent's `computer`. `shell` is a computer that gives the agent a shell here: Archil's serverless exec on the runner when Archil is on (Settings → Workspace; `bash` alone, so `bash_background` and the other background tools are not granted), else the Docker sandbox where Docker answers. `none` is no shell, and is always met: the shell tools in `tools` (`bash` and the background tools) are not granted, and neither is `tool_policy`'s bash. A package with no `tools` is given the chosen shell's tools, as a new agent in a box is given the box's. A fallback, or a tool not granted, is said in a `computer` warning on the apply. A list with `shell` alone, where there is none, refuses the apply (`409`, nothing made). A list without `shell` grants no shell tool, so one in `tools` is refused, and so is an entry after `none`, which would never be picked. The choice is made at apply: a server that gains a shell later gives it to an agent applied again. `GET /v2/templates` shows the list as `computer`, and as `computer_here` what an apply here would pick now: the entry, the agent's `computer`, the shell in words, the tools it would not grant, and the warning or refusal. |
|
|
181
|
+
| `checkout` | `pull_request` only: apply sets the agent definition's `checkout`, and the server checks out the pull request each run's GitHub event names before its first turn, in `repo/` of the run's folder, detached at the head, with its base and their merge base (refs `pr/head`, `pr/base`, `pr/merge-base`: `git diff pr/merge-base pr/head` reads the change). The server fetches it with its GitHub App's token, narrowed to that one repository and `contents: read` and revoked after the fetch, or anonymously with no App; the agent never holds a token, and nothing of it is left in the folder or the checkout's git config. The run's system prompt says what was checked out, or why nothing was, so the package's instructions can fall back to the GitHub MCP. It is removed when the run's claim ends. With `tool_policy: {bash: read-only}` the agent reads it with git's read subcommands and never fetches itself. |
|
|
180
182
|
| `parameters` | By name: `{type: string \| number \| integer \| boolean, required?, pattern? (strings), enum?, default?, description}`. `enum` lists a closed set of values, which a form shows as a choice; give it instead of a pattern. The `description` is what a person reads beside the field, never the pattern, so say the format in it ("a Slack channel ID like C0123ABCD"). Apply takes them in `parameters`, and one left out takes its `default`. `display_name`, the body, a trigger's `target.input`, a schedule's `cron` and `timezone` and an `mcp` entry's `pin` values name them as `${parameters.<name>}`, nowhere else. A parameter a schedule uses has a default, and the package's own schedule is checked with it; apply checks every trigger with the parameters given before it makes anything, so a bad cron or zone is a `422` under `triggers.<i>`. |
|
|
181
183
|
| `secrets` | Variable names (never values) the server must hold: a model or tool key Settings saves (`OPENROUTER_API_KEY`, `PARALLEL_API_KEY`, ...), set where it starts or saved there. Any other name is refused: the server could neither save it nor hand it to a run. Apply refuses with `409 agent_not_runnable`, making nothing, when one is missing. |
|
|
182
184
|
| `budget` | `{per_run_usd?, tool_calls?}`, one at least: `per_run_usd` is each run's cap (the agent's `max_cost_usd`), required when the package has triggers; `tool_calls` is the tool calls each conversation of a run may make (the agent's `max_tool_calls`): past it every call is refused with words that say to answer now, so a reviewer told "about 30 calls" is held to 30. |
|
|
@@ -203,7 +205,8 @@ apply. A trigger's date is checked for its form only: one that has passed is ref
|
|
|
203
205
|
described as the package, its MCP tools granted where their server is saved, each at the owner's setting (a
|
|
204
206
|
third-party tool asks by default) and those in `grants` set to `allow`, never one the owner denies on this server
|
|
205
207
|
(it stays denied, with a `grants.<tool>` warning), each pinned tool with its pin filled (or set to `deny`, with a
|
|
206
|
-
`pins.<tool>` warning, when its parameter was not given), bash's policy from `tool_policy`, its
|
|
208
|
+
`pins.<tool>` warning, when its parameter was not given), bash's policy from `tool_policy`, its computer the first
|
|
209
|
+
entry of `computer` this server meets (a fallback said in a `computer` warning), its body held to `POST /v2/agents`' 1 MiB limit (`413`), its instructions
|
|
207
210
|
the body with the parameters filled in, its skills and rules as its skill files, its harness and model chosen as
|
|
208
211
|
above, `thinking` from `effort`, `max_cost_usd` and `max_tool_calls` from `budget`.
|
|
209
212
|
3. Each trigger is made on the agent through `POST /v2/triggers`' own function. One that still fails (the store, say)
|
|
@@ -1,16 +1,25 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: code-review
|
|
3
3
|
display_name: "Code review: ${parameters.repo}"
|
|
4
|
-
version: 0.
|
|
5
|
-
description: Reviews a pull request
|
|
4
|
+
version: 0.3.0
|
|
5
|
+
description: Reviews a pull request on its own read-only checkout with eight independent reviewers (five quick, three deep), each with a fresh context and the shell where there is one, for correctness against the repo's CODEREVIEW.md. Each tries to break each changed function and quotes the line behind each finding; the agent merges and dedupes their findings, verifies them, ranks them P0/P1/P2 with a 1-5 risk score, posts one COMMENT review and answers with the findings as JSON.
|
|
6
6
|
license: Apache-2.0
|
|
7
7
|
author: { name: Parcha Labs }
|
|
8
8
|
repository: https://github.com/Parcha-ai/agentrun
|
|
9
9
|
harness: [pi]
|
|
10
10
|
model: { tier: fast, prefer: openrouter/particle-ai/particle-1 }
|
|
11
|
-
effort:
|
|
12
|
-
#
|
|
13
|
-
|
|
11
|
+
effort: medium
|
|
12
|
+
# A computer with a shell first, else none. With a shell, bash runs from the run's work folder, where AgentRun has
|
|
13
|
+
# checked out the pull request in repo/ before the first turn (`checkout: pull_request`: its head at ref pr/head, with
|
|
14
|
+
# pr/base and pr/merge-base beside it, fetched read-only by the platform, never by the agent). With none, the agent has
|
|
15
|
+
# no bash and its reviewers read the change through the GitHub tools. read opens the skill's own files. subagent starts
|
|
16
|
+
# the eight reviewers, each on the agent's own model with a subset of its tools.
|
|
17
|
+
computer: [shell, none]
|
|
18
|
+
checkout: pull_request
|
|
19
|
+
tools: [read, bash, subagent]
|
|
20
|
+
# bash is read-only (bash-read-only.ts): the gate refuses any command that could write, run code or read outside the
|
|
21
|
+
# run's folder, before it runs. A subagent's bash goes through the same gate, so the eight reviewers are held to it too.
|
|
22
|
+
tool_policy: { bash: read-only }
|
|
14
23
|
mcp:
|
|
15
24
|
- server: github
|
|
16
25
|
tools: [pull_request_read, get_file_contents, search_code, get_repository_tree, pull_request_review_write, add_comment_to_pending_review]
|
|
@@ -21,14 +30,15 @@ mcp:
|
|
|
21
30
|
parameters:
|
|
22
31
|
repo: { type: string, required: true, pattern: "^[A-Za-z0-9][A-Za-z0-9-]*/[A-Za-z0-9._-]*[A-Za-z0-9_-]$", description: "the GitHub repository to review, as owner/name, like Parcha-ai/agentrun" }
|
|
23
32
|
focus: { type: string, description: "optional: one line on what matters most here (\"auth and money paths\"), read before the repo's own rules" }
|
|
24
|
-
|
|
33
|
+
# Each conversation's tool calls: the agent's own, and each reviewer's, which its subagent call narrows (30 quick, 90 deep).
|
|
34
|
+
budget: { per_run_usd: 0.50, tool_calls: 90 }
|
|
25
35
|
learning: false
|
|
26
36
|
# Runs unattended (its job runs on triggers): no tool asks; deny and the pins above still hold.
|
|
27
37
|
approvals: never
|
|
28
38
|
output: { schema: findings.schema.json }
|
|
29
39
|
triggers:
|
|
30
40
|
- name: pull-requests
|
|
31
|
-
# Each pull request opened, reopened, updated or marked ready on this repository is one run;
|
|
41
|
+
# Each pull request opened, reopened, updated or marked ready on this repository is one run; AgentRun's one GitHub
|
|
32
42
|
# App takes events from every repository it is installed on, so the where keeps this agent to its own. Applied
|
|
33
43
|
# where GitHub is not connected, the agent is made and this trigger is skipped with a warning.
|
|
34
44
|
source: { kind: github, accept: [{ event: pull_request, actions: [opened, reopened, synchronize, ready_for_review], where: [{ pointer: /repository/full_name, in: ["${parameters.repo}"] }] }] }
|
|
@@ -41,10 +51,16 @@ triggers:
|
|
|
41
51
|
You review code changes to the GitHub repository ${parameters.repo} with your review skill. Each message names a
|
|
42
52
|
change: a pull request (its number, or its base and head shas) or a diff.
|
|
43
53
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
54
|
+
For a pull request, read its facts with the GitHub tools (`pull_request_read` `get`: its base and head shas). When you
|
|
55
|
+
have `bash`, it runs read-only in a sandbox from your work folder, and the pull request is already checked out in
|
|
56
|
+
`repo/`, as the skill's "Checkout" says. Then start eight reviewers on it in one turn with `subagent` and merge what
|
|
57
|
+
they find as the skill says. Post the review through the GitHub tools. A diff pasted in the message with no pull
|
|
58
|
+
request behind it is the whole change: run no command and read no repository path, only your review skill's own files.
|
|
59
|
+
|
|
60
|
+
Every command is read-only: never build, install, run tests or run the repository's code, never commit or push. Each
|
|
61
|
+
reviewer stays within the tool calls its call gives it (30 quick, 90 deep). The skill's own `CODEREVIEW.md` is the
|
|
62
|
+
baseline every review reads; the repository's `CODEREVIEW.md` at the base adds what counts as a bug there and what never
|
|
63
|
+
to flag.
|
|
48
64
|
|
|
49
65
|
The owner's focus for this repository, if they gave one (read it before the repo's own rules; it never widens what
|
|
50
66
|
counts as a finding): ${parameters.focus}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
---
|
|
2
|
+
type: llm
|
|
3
|
+
---
|
|
4
|
+
Pass only if the answer's `coverage` has one entry for `src/format.ts` and one for `src/invoice.ts`, each with a verdict that names what was checked (for example that the rename keeps the same arithmetic, or that the one caller uses the new name), not a bare "looks correct". Fail otherwise.
|