@parcha/agentrun-serve 0.1.0-beta.34 → 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 +263 -0
- package/README.md +339 -179
- package/dist/adapters.d.ts +15 -2
- package/dist/adapters.js +34 -2
- package/dist/agent-rows.d.ts +3 -1
- package/dist/agents-store.d.ts +2 -0
- package/dist/agents-store.js +25 -5
- 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 +90 -8
- package/dist/archil-settings.js +150 -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/bash-read-only.d.ts +13 -0
- package/dist/bash-read-only.js +77 -0
- 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-cost.d.ts +2 -2
- package/dist/browser-cost.js +6 -4
- 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 +19 -44
- package/dist/cap.js +31 -77
- package/dist/cli.js +36 -27
- package/dist/computer-keys.d.ts +20 -10
- package/dist/computer-keys.js +36 -57
- package/dist/computer-routes.d.ts +1 -4
- package/dist/computer-routes.js +3 -5
- package/dist/computer-setting.d.ts +8 -5
- package/dist/computer-setting.js +91 -26
- package/dist/computer-view.d.ts +11 -2
- package/dist/computer-view.js +2 -1
- package/dist/computers.d.ts +54 -8
- package/dist/computers.js +101 -22
- 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/content-filter.d.ts +7 -0
- package/dist/content-filter.js +23 -0
- package/dist/decision-cap.d.ts +7 -29
- package/dist/decision-cap.js +3 -94
- package/dist/docker-daemon.d.ts +2 -2
- package/dist/docker-daemon.js +2 -2
- package/dist/errors.d.ts +1 -0
- package/dist/errors.js +8 -5
- package/dist/explain.js +3 -1
- package/dist/faux-computers.js +4 -0
- package/dist/files.d.ts +1 -9
- package/dist/files.js +1 -9
- package/dist/github-connection.js +25 -7
- package/dist/github-faux.d.ts +26 -0
- package/dist/github-faux.js +76 -0
- package/dist/github.d.ts +28 -4
- package/dist/github.js +46 -10
- package/dist/gpu-words.d.ts +14 -0
- package/dist/gpu-words.js +21 -0
- package/dist/graph-served.d.ts +5 -3
- package/dist/graph-served.js +14 -6
- package/dist/graph-view.d.ts +2 -0
- package/dist/graph-view.js +29 -2
- 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-opencode/harness.js +0 -1
- package/dist/harness-opencode/host/policy.js +2 -2
- 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 +2 -3
- package/dist/index.js +2 -2
- package/dist/key-refusal.d.ts +1 -1
- package/dist/key-refusal.js +2 -2
- package/dist/learn/check.d.ts +10 -2
- package/dist/learn/check.js +126 -8
- package/dist/learn/commit.d.ts +40 -6
- package/dist/learn/commit.js +164 -20
- package/dist/learn/folder.d.ts +11 -3
- package/dist/learn/folder.js +40 -16
- package/dist/learn/grade.d.ts +22 -2
- package/dist/learn/grade.js +127 -19
- package/dist/learn/index.d.ts +2 -2
- package/dist/learn/index.js +2 -2
- package/dist/learn/learning.sh +11 -13
- package/dist/learn/notes.d.ts +17 -3
- package/dist/learn/notes.js +19 -6
- package/dist/learn/reflect.d.ts +5 -2
- package/dist/learn/reflect.js +48 -32
- package/dist/learn/skills.d.ts +52 -5
- package/dist/learn/skills.js +104 -21
- package/dist/learned-nodes.d.ts +18 -0
- package/dist/learned-nodes.js +8 -0
- package/dist/learned-workflow.d.ts +27 -13
- package/dist/learned-workflow.js +110 -38
- package/dist/learning-cost.d.ts +79 -0
- package/dist/learning-cost.js +69 -0
- package/dist/learning-routes.d.ts +48 -2
- package/dist/learning-routes.js +99 -28
- package/dist/learning-run.d.ts +7 -5
- package/dist/learning-run.js +9 -6
- package/dist/learning-words.d.ts +3 -0
- package/dist/learning-words.js +6 -2
- package/dist/learning.d.ts +13 -28
- package/dist/learning.js +4 -18
- package/dist/llm.d.ts +4 -1
- package/dist/llm.js +4 -2
- package/dist/mcp-gateway.d.ts +6 -0
- package/dist/mcp-gateway.js +11 -1
- 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.d.ts +12 -12
- package/dist/mcp-servers-store.js +8 -3
- package/dist/model.d.ts +8 -5
- package/dist/model.js +14 -6
- package/dist/openapi.d.ts +2 -0
- package/dist/openapi.js +236 -55
- package/dist/owner.d.ts +0 -1
- package/dist/owner.js +0 -2
- package/dist/pause.d.ts +2 -19
- package/dist/pause.js +5 -74
- 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 +12 -4
- package/dist/port-models.js +31 -9
- package/dist/print.d.ts +1 -8
- package/dist/print.js +1 -14
- package/dist/propose.d.ts +3 -0
- package/dist/propose.js +25 -19
- 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 +18 -3
- package/dist/run-launch.js +11 -5
- package/dist/run-learning-served.d.ts +12 -1
- package/dist/run-manifest.d.ts +2 -2
- package/dist/run-manifest.js +2 -2
- package/dist/run-reads-over-store.d.ts +4 -2
- package/dist/run-reads-over-store.js +10 -8
- package/dist/run-secrets.js +3 -3
- package/dist/run-timeline-served.js +60 -38
- package/dist/run-view.d.ts +35 -16
- package/dist/run-view.js +64 -35
- package/dist/runnable.d.ts +6 -3
- package/dist/runnable.js +20 -4
- package/dist/runner/adapter-loop.d.ts +46 -5
- package/dist/runner/adapter-loop.js +381 -56
- package/dist/runner/adapter-run-spec.d.ts +46 -4
- package/dist/runner/adapter-run-spec.js +200 -45
- package/dist/runner/adapters/pi.d.ts +39 -3
- package/dist/runner/adapters/pi.js +124 -29
- package/dist/runner/beside.d.ts +8 -0
- package/dist/runner/beside.js +24 -2
- package/dist/runner/claim-secrets.d.ts +6 -0
- package/dist/runner/claim-secrets.js +15 -1
- package/dist/runner/cli-run-spec.d.ts +10 -0
- package/dist/runner/cli-run-spec.js +207 -64
- package/dist/runner/commands.d.ts +5 -1
- package/dist/runner/commands.js +3 -3
- package/dist/runner/conformance/harness.d.ts +1 -1
- package/dist/runner/conformance/harness.js +13 -10
- package/dist/runner/github-app.d.ts +7 -2
- package/dist/runner/github-app.js +46 -15
- package/dist/runner/harness-loops.d.ts +6 -1
- package/dist/runner/harness-loops.js +24 -1
- package/dist/runner/journal-kinds.d.ts +53 -7
- package/dist/runner/journal-kinds.js +29 -1
- package/dist/runner/learning-end.d.ts +15 -0
- package/dist/runner/learning-end.js +113 -20
- package/dist/runner/learning-factory.js +6 -2
- package/dist/runner/learning-loop.d.ts +75 -1
- package/dist/runner/learning-loop.js +215 -22
- package/dist/runner/learning-seed.d.ts +8 -0
- package/dist/runner/learning-seed.js +7 -1
- package/dist/runner/loop-contract.d.ts +12 -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.d.ts +9 -4
- package/dist/runner/main.js +38 -13
- package/dist/runner/mcp-claim.d.ts +7 -0
- package/dist/runner/mcp-claim.js +35 -2
- package/dist/runner/mcp-github.d.ts +15 -4
- package/dist/runner/mcp-github.js +55 -11
- package/dist/runner/mcp-run.d.ts +2 -0
- package/dist/runner/mcp-run.js +2 -0
- package/dist/runner/metrics.d.ts +18 -1
- package/dist/runner/metrics.js +81 -1
- package/dist/runner/model-route.d.ts +6 -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 +136 -19
- package/dist/runner/spec-holds.d.ts +13 -3
- package/dist/runner/spec-holds.js +13 -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 +25 -4
- package/dist/runner/workflow-host.js +26 -4
- package/dist/runner/workflow-loop.d.ts +9 -3
- package/dist/runner/workflow-loop.js +17 -10
- package/dist/runner/workflow-spec.d.ts +28 -13
- package/dist/runner/workflow-spec.js +247 -102
- package/dist/runs-over-store.d.ts +18 -7
- package/dist/runs-over-store.js +149 -31
- package/dist/seal-key.d.ts +0 -2
- package/dist/seal-key.js +0 -2
- package/dist/sealing.js +1 -2
- package/dist/secret-cut.d.ts +1 -1
- package/dist/secret-cut.js +1 -1
- package/dist/server-lock.js +4 -5
- package/dist/server.d.ts +49 -63
- package/dist/server.js +429 -230
- package/dist/stop-signals.d.ts +4 -2
- package/dist/stop-signals.js +5 -3
- package/dist/store/agent-body.d.ts +14 -3
- package/dist/store/agent-body.js +22 -8
- package/dist/store/deadline.d.ts +18 -0
- package/dist/store/deadline.js +49 -0
- 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.d.ts +4 -0
- package/dist/store/postgres/connection.js +64 -13
- 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 -82
- 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 +83 -15
- package/dist/store-reads/learning.d.ts +73 -3
- package/dist/store-reads/learning.js +232 -9
- 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.d.ts +15 -1
- package/dist/store-view.js +88 -29
- package/dist/template-eval.js +2 -1
- package/dist/templates.d.ts +73 -4
- package/dist/templates.js +113 -23
- package/dist/timeline/timeline.d.ts +11 -1
- package/dist/timeline/timeline.js +19 -4
- package/dist/tool-blurbs.js +1 -0
- package/dist/tool-budget.d.ts +26 -0
- package/dist/tool-budget.js +56 -0
- package/dist/tool-gate.d.ts +13 -3
- package/dist/tool-gate.js +15 -7
- package/dist/tool-plane.d.ts +42 -29
- package/dist/tool-plane.js +64 -27
- package/dist/tools.d.ts +53 -39
- package/dist/tools.js +174 -79
- 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/uploads.d.ts +28 -5
- package/dist/uploads.js +82 -9
- package/dist/usage-lines.d.ts +1 -1
- package/dist/usage.d.ts +1 -47
- package/dist/usage.js +3 -82
- package/dist/validate.d.ts +8 -0
- package/dist/validate.js +40 -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 +13 -2
- package/dist/workspace/archil-claim.js +22 -13
- package/dist/workspace/archil-disk.d.ts +10 -1
- package/dist/workspace/archil-disk.js +4 -0
- package/dist/workspace/archil-disks.d.ts +49 -0
- package/dist/workspace/archil-disks.js +185 -0
- package/dist/workspace/archil-exec.d.ts +12 -2
- package/dist/workspace/archil-exec.js +18 -3
- package/dist/workspace/archil-mount-credential.d.ts +20 -4
- package/dist/workspace/archil-mount-credential.js +13 -4
- package/dist/workspace/archil.d.ts +2 -2
- package/dist/workspace/archil.js +25 -5
- package/dist/workspace/attach.js +2 -0
- package/dist/workspace/computer-deps.d.ts +18 -11
- package/dist/workspace/computer-deps.js +64 -40
- package/dist/workspace/computer-for-claim.d.ts +47 -9
- package/dist/workspace/computer-for-claim.js +236 -24
- 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 -8
- package/dist/workspace/computer-ledger.js +7 -3
- package/dist/workspace/computer-providers.d.ts +5 -3
- package/dist/workspace/computer-providers.js +11 -9
- package/dist/workspace/hands.d.ts +5 -2
- package/dist/workspace/hands.js +4 -3
- package/dist/workspace/index.d.ts +5 -4
- package/dist/workspace/index.js +2 -1
- package/dist/workspace/local.d.ts +3 -0
- package/dist/workspace/local.js +9 -0
- package/dist/workspace/paths.js +3 -2
- package/dist/workspace/pi-env.d.ts +4 -0
- package/dist/workspace/pi-env.js +3 -2
- package/dist/workspace/resolve-computer.d.ts +48 -12
- package/dist/workspace/resolve-computer.js +88 -19
- package/dist/workspace/run-disk.d.ts +34 -0
- package/dist/workspace/run-disk.js +91 -0
- package/dist/workspace/run-tools.d.ts +6 -4
- package/dist/workspace/run-tools.js +17 -9
- package/dist/workspace/server-run-workspace.d.ts +3 -2
- package/dist/workspace/server-run-workspace.js +17 -4
- package/dist/workspace/workspace.d.ts +5 -0
- package/dist/workspace.d.ts +0 -3
- package/dist/workspace.js +2 -15
- package/package.json +11 -16
- package/skills/agentrun-serve/SKILL.md +1 -1
- package/templates/README.md +11 -8
- 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/mentions-defused/case.yaml +15 -0
- package/templates/code-review/evals/mentions-defused/fixtures/github-mcp.json +254 -0
- package/templates/code-review/evals/mentions-defused/graders/no-pings.md +16 -0
- package/templates/code-review/evals/mentions-defused/graders/posted-a-review.md +5 -0
- package/templates/code-review/evals/mentions-defused/graders/schema.md +5 -0
- package/templates/code-review/evals/mentions-defused/prompt.md +10 -0
- 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/templates/kyb/evals/clean-public-company/graders/no-opensanctions.md +5 -0
- package/templates/kyb/evals/opensanctions-on/case.yaml +5 -0
- package/templates/kyb/evals/opensanctions-on/graders/licence-and-evidence.md +18 -0
- package/templates/kyb/evals/opensanctions-on/graders/schema.md +5 -0
- package/templates/kyb/evals/opensanctions-on/prompt.md +11 -0
- package/templates/release-notes/agent.md +11 -0
- 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 -76
- package/dist/budget.js +0 -204
- package/dist/console/assets/index-RPHGlXmM.js +0 -540
- package/dist/console/assets/index-opTN5Naq.css +0 -1
- 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
package/dist/templates.js
CHANGED
|
@@ -16,10 +16,10 @@ import { chooseModel, harnessRuns, hostModel, MODEL_KEYS, THINKING_LEVELS } from
|
|
|
16
16
|
import { mcpToolName } from "./tool-gate.js";
|
|
17
17
|
import { pinIssues, sortedPin } from "./tool-plane.js";
|
|
18
18
|
import { BASH_POLICIES } from "./bash-read-only.js";
|
|
19
|
-
import { BOUND_TOOLS } from "./tools.js";
|
|
19
|
+
import { BOUND_TOOLS, toolOf } from "./tools.js";
|
|
20
20
|
import { TRIGGER_ADAPTERS } from "./trigger-adapters.js";
|
|
21
21
|
import { triggerBodyIssues } from "./triggers.js";
|
|
22
|
-
import { DEFAULT_INPUT_SCHEMA, definitionBodyIssues, inputIssues, isObject, MODEL_REF, unknownFields } from "./validate.js";
|
|
22
|
+
import { DEFAULT_INPUT_SCHEMA, definitionBodyIssues, inputIssues, isObject, MAX_TOOL_CALLS, MODEL_REF, MODEL_TIER_NAMES, unknownFields } from "./validate.js";
|
|
23
23
|
import { APPROVALS } from "./approvals.js";
|
|
24
24
|
export const TEMPLATES_DIR = fileURLToPath(new URL("../templates/", import.meta.url));
|
|
25
25
|
export const MANIFEST = "agent.md";
|
|
@@ -30,7 +30,10 @@ export const PARAMETER_TYPES = ["string", "number", "integer", "boolean"];
|
|
|
30
30
|
* (market-monitor's schedule). A form shows a schedule picker and a time-zone choice; the value is the same text. */
|
|
31
31
|
export const PARAMETER_FORMATS = ["cron", "timezone"];
|
|
32
32
|
export const GRADER_TYPES = ["llm", "regex", "tool_used", "file_exists", "schema"];
|
|
33
|
-
|
|
33
|
+
/** The entries of a package's `computer` preference list: `shell`, a computer that gives the agent a shell here (bash);
|
|
34
|
+
* `none`, no shell, the file tools alone. Apply takes the first this server meets now (pickComputer). */
|
|
35
|
+
export const COMPUTER_ENTRIES = ["shell", "none"];
|
|
36
|
+
const FIELDS = ["name", "display_name", "version", "description", "license", "author", "repository", "harness", "model", "effort", "tools", "mcp", "tool_policy", "computer", "checkout", "parameters", "secrets", "budget", "learning", "approvals", "triggers", "output", "checks"];
|
|
34
37
|
const NAME = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
|
|
35
38
|
const PARAMETER = /^[a-z][a-z0-9_]{0,63}$/;
|
|
36
39
|
/** The keys a package may need: those Settings saves (a tool's or a model provider's), each one a run is handed. */
|
|
@@ -98,9 +101,10 @@ export function githubTriggerWords(packageName, source) {
|
|
|
98
101
|
const or = (words) => (words.length < 2 ? words.join("") : `${words.slice(0, -1).join(", ")} or ${words.at(-1)}`);
|
|
99
102
|
return `${subject} runs on each ${or(events)} ${repos.length ? `to ${or(repos)}` : "to a repository the GitHub App is installed on"}.`;
|
|
100
103
|
}
|
|
101
|
-
const GITHUB_EVENT_WORDS = { pull_request: "pull request", pull_request_review: "pull request review", pull_request_review_comment: "review comment", issue_comment: "comment", issues: "issue" };
|
|
102
|
-
/** What an apply says of a github trigger it skipped because GitHub is not connected here
|
|
103
|
-
|
|
104
|
+
const GITHUB_EVENT_WORDS = { pull_request: "pull request", pull_request_review: "pull request review", pull_request_review_comment: "review comment", issue_comment: "comment", issues: "issue", release: "release" };
|
|
105
|
+
/** What an apply says of a github trigger it skipped because GitHub is not connected here: what to do, and what the
|
|
106
|
+
* trigger would then run on, in the package's own words ("Code review runs on each pull request to acme/widgets."). */
|
|
107
|
+
export const githubTriggerUnconnected = (packageName, source) => `Connect GitHub in Settings, then apply again so it runs by itself: ${githubTriggerWords(packageName, source)}`;
|
|
104
108
|
/** Every string in `value`, deep. */
|
|
105
109
|
const strings = (value) => (typeof value === "string" ? [value] : Array.isArray(value) ? value.flatMap(strings) : isObject(value) ? Object.values(value).flatMap(strings) : []);
|
|
106
110
|
/** `value` with each `${parameters.x}` in its strings replaced by the value given for x (its own: never an inherited
|
|
@@ -254,8 +258,9 @@ export function readPackage(dir) {
|
|
|
254
258
|
const harness = f.harness === undefined ? undefined : list(f.harness, "harness", (id) => HARNESSES.includes(id));
|
|
255
259
|
if (harness && !harness.length)
|
|
256
260
|
bad(MANIFEST, `harness is a non-empty preference list of ${HARNESSES.join(", ")}; leave it out for any`);
|
|
257
|
-
|
|
258
|
-
|
|
261
|
+
const ref = (value) => value === undefined || (typeof value === "string" && MODEL_REF.test(value));
|
|
262
|
+
if (f.model !== undefined && !(isObject(f.model) && !unknownFields(f.model, ["tier", "prefer", ...MODEL_TIER_NAMES]).length && typeof f.model.tier === "string" && Object.hasOwn(MODEL_TIERS, f.model.tier) && ref(f.model.prefer) && MODEL_TIER_NAMES.every((tier) => ref(f.model[tier]))))
|
|
263
|
+
bad(MANIFEST, `model is {tier: ${Object.keys(MODEL_TIERS).join(" | ")}, prefer?: "provider/model-id", ${MODEL_TIER_NAMES.map((tier) => `${tier}?: "provider/model-id"`).join(", ")}}`);
|
|
259
264
|
if (f.effort !== undefined && !THINKING_LEVELS.includes(f.effort))
|
|
260
265
|
bad(MANIFEST, `effort is one of ${THINKING_LEVELS.join(", ")}`);
|
|
261
266
|
const tools = f.tools === undefined ? undefined : list(f.tools, "tools");
|
|
@@ -291,9 +296,26 @@ export function readPackage(dir) {
|
|
|
291
296
|
else
|
|
292
297
|
toolPolicy = { bash: given.bash };
|
|
293
298
|
}
|
|
294
|
-
//
|
|
295
|
-
|
|
296
|
-
|
|
299
|
+
// The computer: default (where this server puts a new agent), or a preference list apply takes the first it meets of
|
|
300
|
+
// (pickComputer). none is always met, so an entry after it is never picked; a list without shell never gives a shell,
|
|
301
|
+
// so a shell tool in tools would never be granted.
|
|
302
|
+
let computer;
|
|
303
|
+
if (f.computer !== undefined && f.computer !== "default") {
|
|
304
|
+
const given = f.computer;
|
|
305
|
+
if (!Array.isArray(given) || !given.length || !given.every((entry) => COMPUTER_ENTRIES.includes(entry)) || new Set(given).size !== given.length)
|
|
306
|
+
bad(MANIFEST, `computer is default (where this server puts a new agent), or a preference list of ${COMPUTER_ENTRIES.join(", ")}, each once ([shell, none]): apply takes the first this server meets now. shell: a computer that gives the agent a shell here; none: no shell, the file tools alone`);
|
|
307
|
+
else if (given.indexOf("none") !== -1 && given.indexOf("none") < given.length - 1)
|
|
308
|
+
bad(MANIFEST, "computer: none is always met, so nothing after it is ever picked: end the list with it");
|
|
309
|
+
else {
|
|
310
|
+
computer = given;
|
|
311
|
+
const shellOnly = tools?.filter((tool) => toolOf(tool)?.sandboxOnly) ?? [];
|
|
312
|
+
if (!computer.includes("shell") && shellOnly.length)
|
|
313
|
+
bad(MANIFEST, `computer: [none] gives no shell, so ${shellOnly.join(", ")} would never be granted: add shell to computer, or take ${shellOnly.length === 1 ? "it" : "them"} out of tools`);
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
// The server's checkout before each run's first turn: the pull request the run's GitHub event names, at its head.
|
|
317
|
+
if (f.checkout !== undefined && f.checkout !== "pull_request")
|
|
318
|
+
bad(MANIFEST, "checkout is pull_request: the server checks out the pull request the run's GitHub event names, at its head, in repo/ before the first turn");
|
|
297
319
|
const parameters = {};
|
|
298
320
|
for (const [key, p] of Object.entries(f.parameters === undefined ? {} : isObject(f.parameters) ? f.parameters : (bad(MANIFEST, "parameters is a mapping of names"), {}))) {
|
|
299
321
|
const ok = PARAMETER.test(key) && isObject(p) && !unknownFields(p, ["type", "required", "pattern", "enum", "format", "description", "default"]).length && PARAMETER_TYPES.includes(p.type) && (p.required === undefined || typeof p.required === "boolean") && typeof p.description === "string" && p.description.trim() !== "" && (p.pattern === undefined || (p.type === "string" && typeof p.pattern === "string"));
|
|
@@ -329,8 +351,12 @@ export function readPackage(dir) {
|
|
|
329
351
|
const secrets = list(f.secrets, "secrets", (secret) => /^[A-Z][A-Z0-9_]{0,127}$/.test(secret));
|
|
330
352
|
for (const secret of secrets.filter((name) => !PACKAGE_SECRETS.includes(name)))
|
|
331
353
|
bad(MANIFEST, `secrets names ${secret}, a key this server cannot hold: a package needs the keys Settings saves and a run is handed (${PACKAGE_SECRETS.join(", ")})`);
|
|
332
|
-
|
|
333
|
-
|
|
354
|
+
// Each run's limits: its spend cap (per_run_usd, the agent's max_cost_usd) and its tool-call budget (tool_calls, the
|
|
355
|
+
// agent's max_tool_calls: each conversation's calls), one of them at least.
|
|
356
|
+
const perRun = (value) => typeof value === "number" && Number.isFinite(value) && value > 0;
|
|
357
|
+
const toolCalls = (value) => Number.isSafeInteger(value) && value > 0 && value <= MAX_TOOL_CALLS;
|
|
358
|
+
if (f.budget !== undefined && !(isObject(f.budget) && Object.keys(f.budget).length && !unknownFields(f.budget, ["per_run_usd", "tool_calls"]).length && (f.budget.per_run_usd === undefined || perRun(f.budget.per_run_usd)) && (f.budget.tool_calls === undefined || toolCalls(f.budget.tool_calls))))
|
|
359
|
+
bad(MANIFEST, `budget is {per_run_usd?: a number above 0, tool_calls?: a whole number from 1 to ${MAX_TOOL_CALLS}}, one of them at least`);
|
|
334
360
|
if (f.learning !== undefined && typeof f.learning !== "boolean")
|
|
335
361
|
bad(MANIFEST, "learning is true or false");
|
|
336
362
|
if (f.approvals !== undefined && f.approvals !== "ask" && f.approvals !== "never")
|
|
@@ -350,7 +376,7 @@ export function readPackage(dir) {
|
|
|
350
376
|
if (!isObject(target) || target.kind !== "start_run" || target.agent_id !== undefined)
|
|
351
377
|
bad(MANIFEST, `triggers[${i}].target is a start_run with no agent_id: the agent is the one the package makes`);
|
|
352
378
|
});
|
|
353
|
-
if (triggers.length && f.budget
|
|
379
|
+
if (triggers.length && !(isObject(f.budget) && f.budget.per_run_usd !== undefined))
|
|
354
380
|
bad(MANIFEST, "budget is required when the package has triggers: {per_run_usd}, each run's cap");
|
|
355
381
|
let outputSchema;
|
|
356
382
|
let schemaBounded = true;
|
|
@@ -496,7 +522,7 @@ export function readPackage(dir) {
|
|
|
496
522
|
name, ...(typeof f.display_name === "string" ? { displayName: f.display_name } : {}), version: f.version, description: f.description,
|
|
497
523
|
...(typeof f.license === "string" ? { license: f.license } : {}), ...(isObject(f.author) ? { author: f.author } : {}), ...(typeof f.repository === "string" ? { repository: f.repository } : {}),
|
|
498
524
|
...(harness ? { harness } : {}), ...(isObject(f.model) ? { model: f.model } : {}), ...(typeof f.effort === "string" ? { effort: f.effort } : {}),
|
|
499
|
-
...(tools ? { tools } : {}), mcp, ...(toolPolicy ? { toolPolicy } : {}), parameters, secrets, ...(isObject(f.budget) ? { budget: { per_run_usd: f.budget.per_run_usd } } : {}), ...(typeof f.learning === "boolean" ? { learning: f.learning } : {}), ...(f.approvals === "ask" || f.approvals === "never" ? { approvals: f.approvals } : {}),
|
|
525
|
+
...(tools ? { tools } : {}), mcp, ...(computer ? { computer } : {}), ...(toolPolicy ? { toolPolicy } : {}), ...(f.checkout === "pull_request" ? { checkout: "pull_request" } : {}), parameters, secrets, ...(isObject(f.budget) ? { budget: { ...(typeof f.budget.per_run_usd === "number" ? { per_run_usd: f.budget.per_run_usd } : {}), ...(typeof f.budget.tool_calls === "number" ? { tool_calls: f.budget.tool_calls } : {}) } } : {}), ...(typeof f.learning === "boolean" ? { learning: f.learning } : {}), ...(f.approvals === "ask" || f.approvals === "never" ? { approvals: f.approvals } : {}),
|
|
500
526
|
triggers: triggers, ...(isObject(f.output) ? { output: { schema: f.output.schema } } : {}), ...(isObject(outputSchema) ? { outputSchema } : {}), checks, instructions, skills, evals,
|
|
501
527
|
};
|
|
502
528
|
// What an apply makes, made here with each parameter's default, else a sample of its type, and checked as POST
|
|
@@ -504,7 +530,8 @@ export function readPackage(dir) {
|
|
|
504
530
|
// trigger's times are read as of the epoch, so its form is checked here and a date that has passed is the apply's
|
|
505
531
|
// refusal, never a server's start.
|
|
506
532
|
const samples = Object.fromEntries(Object.entries(parameters).map(([key, spec]) => [key, spec.default ?? SAMPLES[spec.type]]));
|
|
507
|
-
const
|
|
533
|
+
const declared = Object.fromEntries(MODEL_TIER_NAMES.flatMap((tier) => (p.model?.[tier] ? [[tier, p.model[tier]]] : [])));
|
|
534
|
+
const made = compiled(p, samples, { ...(harness ? { harness: harness[0] } : {}), ...(p.model?.prefer ? { model: p.model.prefer } : {}), ...(Object.keys(declared).length ? { modelTiers: declared } : {}), mcp, defaultTools: [], grants: [] });
|
|
508
535
|
for (const issue of definitionBodyIssues(made.agent))
|
|
509
536
|
bad(issue.field.startsWith("skills.") ? `skills/${issue.field.slice("skills.".length)}` : MANIFEST, `${issue.field.startsWith("skills.") ? "" : `the agent it makes: ${issue.field}: `}${issue.message}`);
|
|
510
537
|
for (const issue of madeTriggerIssues(made.triggers, 0))
|
|
@@ -535,7 +562,7 @@ export function packageView(p) {
|
|
|
535
562
|
return {
|
|
536
563
|
name: p.name, display_name: p.displayName ?? null, version: p.version, description: p.description, license: p.license ?? null, author: p.author ?? null, repository: p.repository ?? null,
|
|
537
564
|
output: p.output ? { schema: p.output.schema, json_schema: p.outputSchema ?? null } : null,
|
|
538
|
-
harness: p.harness ?? null, model: p.model ?? null, effort: p.effort ?? null, tools: p.tools ?? null, tool_policy: p.toolPolicy ?? null,
|
|
565
|
+
harness: p.harness ?? null, model: p.model ?? null, effort: p.effort ?? null, tools: p.tools ?? null, tool_policy: p.toolPolicy ?? null, computer: p.computer ?? null, checkout: p.checkout ?? null,
|
|
539
566
|
mcp: p.mcp.map(({ server, tools, required, allow, pin }) => ({ server, required, tools: tools.map((name) => ({ name, tool: mcpToolName(server, name), asks: allow.includes(name) ? "allow" : "ask", ...(Object.hasOwn(pin, name) ? { pin: pin[name] } : {}) })) })), parameters: p.parameters, secrets: p.secrets,
|
|
540
567
|
budget: p.budget ?? null, learning: p.learning ?? false, approvals_default: p.approvals ?? "ask", triggers: p.triggers, skills: Object.keys(p.skills).filter((path) => /^[^/]+\/SKILL\.md$/.test(path)).map((path) => path.slice(0, -"/SKILL.md".length)), evals: p.evals,
|
|
541
568
|
};
|
|
@@ -621,6 +648,61 @@ export async function packageModel(env, model, harness) {
|
|
|
621
648
|
const warning = [skipped, runsOn, skipped ? "overrides.model picks another the gateway serves." : undefined].filter(Boolean).join(" ");
|
|
622
649
|
return { ...(id && !bare ? { model: id } : {}), ...(warning ? { warning } : {}) };
|
|
623
650
|
}
|
|
651
|
+
/** What to do where a package's computer list has no shell to take: in the apply's refusal and its fallback warning. */
|
|
652
|
+
export const COMPUTER_FIX = "Turn on Archil in Settings → Workspace, or run AgentRun where Docker answers, then apply again to give it a shell.";
|
|
653
|
+
/** The first entry of a package's computer list (`[shell, none]`) this server meets now, given the shell it has
|
|
654
|
+
* (`here`): shell, where it has one; none, always (kind none, and no shell tool: a run on the runner in Mode 2 has bash,
|
|
655
|
+
* so a shell tool is dropped rather than left to it). Undefined for a package with no list (it runs where a new agent
|
|
656
|
+
* does); `refused`, in words, when no entry is met. The rule is the package's preference alone: nothing here knows a
|
|
657
|
+
* template. */
|
|
658
|
+
export function pickComputer(p, here) {
|
|
659
|
+
if (!p.computer)
|
|
660
|
+
return undefined;
|
|
661
|
+
// A shell that is a sandbox runs the agent in the box, where a runner-only tool (browser) is refused: such a package
|
|
662
|
+
// cannot take that shell, so its list falls to the next entry, as it does where there is no shell at all.
|
|
663
|
+
const runnerOnly = (p.tools ?? []).filter((tool) => toolOf(tool)?.runnerOnly);
|
|
664
|
+
const found = "none" in here ? undefined : here;
|
|
665
|
+
const clash = found && found.computer.kind === "sandbox" && runnerOnly.length ? `${found.words} runs ${runnerOnly.join(", ")} nowhere` : undefined;
|
|
666
|
+
const shell = clash ? undefined : found;
|
|
667
|
+
const lack = "none" in here ? here.none : clash ?? "this server has none";
|
|
668
|
+
const entry = p.computer.find((one) => one === "none" || shell);
|
|
669
|
+
if (!entry)
|
|
670
|
+
return { refused: `The ${p.name} template needs a shell, and ${lack}. Nothing was created.` };
|
|
671
|
+
const runs = entry === "shell" && shell ? shell.tools : [];
|
|
672
|
+
const dropped = (p.tools ?? []).filter((tool) => toolOf(tool)?.sandboxOnly && !runs.includes(tool));
|
|
673
|
+
const without = new Intl.ListFormat("en", { type: "conjunction" }).format(dropped);
|
|
674
|
+
const note = entry === "none" && p.computer[0] === "shell" && !shell
|
|
675
|
+
? `${lack.charAt(0).toUpperCase()}${lack.slice(1)}, so the agent was made with the template's next choice, no computer${dropped.length ? `, and without ${without}` : ""}. ${COMPUTER_FIX}`
|
|
676
|
+
: dropped.length && shell ? `The shell here is ${shell.words}, which runs ${runs.join(", ")} alone, so the agent was made without ${without}.` : null;
|
|
677
|
+
return entry === "shell" && shell
|
|
678
|
+
? { entry, computer: { ...shell.computer }, shell: shell.words, dropped, defaults: [...shell.tools], note }
|
|
679
|
+
: { entry, computer: { kind: "none" }, shell: null, dropped, defaults: [], note };
|
|
680
|
+
}
|
|
681
|
+
/** The model of each tier a package's subagents run on here (the definition's model_tiers), as `{modelTiers?, warning?}`:
|
|
682
|
+
* a tier's model the package names (`model.fast`, `model.strong`) when this server runs it on `harness` with a key for its
|
|
683
|
+
* provider, never through a gateway, as packageModel keeps `prefer`; else none, the tier then this server's own
|
|
684
|
+
* (AGENT_MODEL_FAST, AGENT_MODEL_STRONG), and a warning says so. The agent's own tier, named nowhere else, is the model
|
|
685
|
+
* the agent itself got (`own`), so a subagent on the agent's tier runs on the agent's model. */
|
|
686
|
+
export async function packageTiers(env, model, harness, own) {
|
|
687
|
+
if (!model)
|
|
688
|
+
return {};
|
|
689
|
+
const gateway = Boolean(env.AGENT_MODEL_BASE_URL);
|
|
690
|
+
const tiers = {};
|
|
691
|
+
const skipped = [];
|
|
692
|
+
for (const tier of MODEL_TIER_NAMES) {
|
|
693
|
+
const named = model[tier];
|
|
694
|
+
if (!named)
|
|
695
|
+
continue;
|
|
696
|
+
if (!gateway && harnessRuns(env, named, harness) && !("why" in (await chooseModel(env, named, tier, harness))))
|
|
697
|
+
tiers[tier] = named;
|
|
698
|
+
else
|
|
699
|
+
skipped.push(`model.${tier} ${named} is not used: ${gateway ? "this server reaches its models through a gateway, which has not said it serves that model" : "this server cannot run it"}, so the agent's ${tier} subagents run on this server's model for the tier.`);
|
|
700
|
+
}
|
|
701
|
+
const mine = MODEL_TIER_NAMES.includes(model.tier) ? model.tier : undefined;
|
|
702
|
+
if (mine && !model[mine] && own)
|
|
703
|
+
tiers[mine] = own;
|
|
704
|
+
return { ...(Object.keys(tiers).length ? { modelTiers: tiers } : {}), ...(skipped.length ? { warning: skipped.join(" ") } : {}) };
|
|
705
|
+
}
|
|
624
706
|
/** The bodies an apply makes: POST /v2/agents' (its definition and skill files) and each trigger's, with no agent_id,
|
|
625
707
|
* every `${parameters.x}` filled. `mcp`: the package's MCP servers this server has saved, whose tools are granted beside
|
|
626
708
|
* the package's tools (or, when it names none, `defaultTools`, those this server gives a new agent), each at the
|
|
@@ -632,10 +714,16 @@ export function compiled(p, parameters, chosen, _deps) {
|
|
|
632
714
|
const skills = Object.keys(p.skills).filter((path) => /^[^/]+\/SKILL\.md$/.test(path)).map((path) => path.slice(0, -"/SKILL.md".length));
|
|
633
715
|
const granted = chosen.mcp.flatMap(({ server, tools }) => tools.map((tool) => mcpToolName(server, tool)));
|
|
634
716
|
const allowed = chosen.grants.filter((tool) => granted.includes(tool));
|
|
635
|
-
|
|
717
|
+
// The computer its list picked (pickComputer): its tools less the shell tools that computer does not run; a package
|
|
718
|
+
// that names none is given that computer's shell tools, as a new agent in a box is given the box's.
|
|
719
|
+
const pick = chosen.computer;
|
|
720
|
+
const own = pick ? (p.tools ?? pick.defaults).filter((tool) => !pick.dropped.includes(tool)) : p.tools;
|
|
721
|
+
const named = own && (p.tools || own.length) ? own : undefined;
|
|
722
|
+
const tools = granted.length ? [...(named ?? (pick ? [] : chosen.defaultTools)), ...granted] : named;
|
|
636
723
|
const settings = Object.fromEntries(allowed.map((tool) => [tool, { permission: "allow" }]));
|
|
637
|
-
// A tool's policy (bash's read-only), written as its setting, whatever its permission: never one an apply grants.
|
|
638
|
-
|
|
724
|
+
// A tool's policy (bash's read-only), written as its setting, whatever its permission: never one an apply grants. With
|
|
725
|
+
// a picked computer, only where the agent's tools hold bash: none for a bash the computer dropped, or never gave.
|
|
726
|
+
if (p.toolPolicy && (!pick || tools?.includes("bash")))
|
|
639
727
|
settings.bash = { ...settings.bash, policy: p.toolPolicy.bash };
|
|
640
728
|
const unpinned = [];
|
|
641
729
|
for (const { tool: name, pin, empty } of filledPins(chosen.mcp, parameters)) {
|
|
@@ -648,13 +736,15 @@ export function compiled(p, parameters, chosen, _deps) {
|
|
|
648
736
|
}
|
|
649
737
|
const definition = {
|
|
650
738
|
name: p.displayName ? filled(p.displayName, parameters) : p.name, description: p.description, instructions: filled(p.instructions, parameters),
|
|
651
|
-
...(chosen.harness ? { harness: chosen.harness } : {}), ...(chosen.model ? { model: chosen.model } : {}), ...(p.effort ? { thinking: p.effort } : {}),
|
|
652
|
-
...(tools ? { tools } : {}), ...(Object.keys(settings).length ? { tool_settings: settings } : {}),
|
|
653
|
-
...(p.learning !== undefined ? { learning: p.learning } : {}), ...(p.budget ? { max_cost_usd: p.budget.per_run_usd } : {}), skills,
|
|
739
|
+
...(chosen.harness ? { harness: chosen.harness } : {}), ...(chosen.model ? { model: chosen.model } : {}), ...(chosen.modelTiers && Object.keys(chosen.modelTiers).length ? { model_tiers: chosen.modelTiers } : {}), ...(p.effort ? { thinking: p.effort } : {}),
|
|
740
|
+
...(pick ? { computer: pick.computer } : {}), ...(tools ? { tools } : {}), ...(Object.keys(settings).length ? { tool_settings: settings } : {}),
|
|
741
|
+
...(p.learning !== undefined ? { learning: p.learning } : {}), ...(p.budget?.per_run_usd ? { max_cost_usd: p.budget.per_run_usd } : {}), ...(p.budget?.tool_calls ? { max_tool_calls: p.budget.tool_calls } : {}), skills,
|
|
654
742
|
// The apply's choice: unattended only when it says never (none given: the agent asks).
|
|
655
743
|
...(chosen.approvals === "never" ? { approvals: "never" } : {}),
|
|
656
744
|
// The package's answer schema (manifest `output`): each completed run's structured answer, checked, is its result.output.
|
|
657
745
|
...(isObject(p.outputSchema) ? { output_schema: p.outputSchema } : {}),
|
|
746
|
+
// The package's checkout (manifest `checkout`): the server fetches it before each run's first turn.
|
|
747
|
+
...(p.checkout ? { checkout: p.checkout } : {}),
|
|
658
748
|
};
|
|
659
749
|
return { agent: { definition, skills: { ...p.skills } }, triggers: p.triggers.map((trigger) => filled(trigger, parameters)), unpinned };
|
|
660
750
|
}
|
|
@@ -63,6 +63,16 @@ export type TimelineEvent = {
|
|
|
63
63
|
unpriced?: number;
|
|
64
64
|
not_metered?: number;
|
|
65
65
|
};
|
|
66
|
+
/** On a learned workflow call's `tool_result` row (learned_workflow): each of the workflow's nodes that ran, as the
|
|
67
|
+
* workflow DSL ended it, in order (store-reads/journal.ts withLearnedNodes). This projector writes none. */
|
|
68
|
+
learned_nodes?: {
|
|
69
|
+
label: string;
|
|
70
|
+
kind: string;
|
|
71
|
+
status: string;
|
|
72
|
+
duration_ms: number;
|
|
73
|
+
model?: string;
|
|
74
|
+
tier?: string;
|
|
75
|
+
}[];
|
|
66
76
|
};
|
|
67
77
|
/** A pi conversation entry as stored: `pi.assistant`, `pi.tool-result`, a host's own kind. */
|
|
68
78
|
export type EntryLike = {
|
|
@@ -240,7 +250,7 @@ export declare function timelineOf(entries: readonly EntryLike[], options?: Time
|
|
|
240
250
|
* runner's loop parks on exactly the turn ends the view would call waiting, and the two can never disagree; the id is the
|
|
241
251
|
* call the park entry names. Truthy when it waits, undefined when it does not. */
|
|
242
252
|
export declare function endedOnTurnEndingTool(entries: readonly EntryLike[]): string | undefined;
|
|
243
|
-
/** A workflow's decision receipt as its run's store keeps it (
|
|
253
|
+
/** A workflow's decision receipt as its run's store keeps it (workflow/decisions.ts's DecisionRow): the fields
|
|
244
254
|
* runMetricsOf reads. */
|
|
245
255
|
export type DecisionLike = {
|
|
246
256
|
usage?: unknown;
|
|
@@ -24,15 +24,24 @@ export const REQUEST_REFUSED = "agentrun.request_refused";
|
|
|
24
24
|
export const CALL_REFUSED = "agentrun.refused";
|
|
25
25
|
/** Whether pi's error for a request is the model proxy's own refusal of it for the run's spend cap, before it was sent:
|
|
26
26
|
* the proxy's JSON body after the HTTP status pi-ai puts first, read by its fields (`type` "agentrun_proxy", `code`
|
|
27
|
-
* "spend_cap_reached", as the proxy writes them), never by its words. Any other error, a provider's 400 included, is not.
|
|
27
|
+
* "spend_cap_reached", as the proxy writes them), never by its words. Any other error, a provider's 400 included, is not.
|
|
28
|
+
* pi-ai puts the status first in either of its clients' forms: the Responses client's "400 {...}" with the fields under
|
|
29
|
+
* `error`, or the Messages client's "<api> API error (400): {...}" with them at the top (the runner's pi route speaks
|
|
30
|
+
* Messages to the session's proxy). */
|
|
28
31
|
function proxyCapRefusal(errorMessage) {
|
|
29
32
|
if (typeof errorMessage !== "string")
|
|
30
33
|
return false;
|
|
31
34
|
const at = errorMessage.indexOf("{");
|
|
32
|
-
if (at < 0
|
|
35
|
+
if (at < 0)
|
|
36
|
+
return false;
|
|
37
|
+
const head = errorMessage.slice(0, at);
|
|
38
|
+
// The provider's name is any word with no space (agentrun-session today; a route's own, such as openrouter/anthropic):
|
|
39
|
+
// the body's fields, never the name, say whose refusal it is.
|
|
40
|
+
if (!/^\d{3}\s*$/.test(head) && !/^\S+ API error \(\d{3}\):\s*$/.test(head))
|
|
33
41
|
return false;
|
|
34
42
|
try {
|
|
35
|
-
const
|
|
43
|
+
const body = JSON.parse(errorMessage.slice(at));
|
|
44
|
+
const error = body?.error ?? body;
|
|
36
45
|
return error?.type === "agentrun_proxy" && error.code === "spend_cap_reached";
|
|
37
46
|
}
|
|
38
47
|
catch {
|
|
@@ -548,10 +557,16 @@ function createProjector(options) {
|
|
|
548
557
|
* the output as it came (`view`), as its status is; only the words the summary shows of that are redacted. */
|
|
549
558
|
const resultRow = (conv, rowId, tool, named, view, shown, parent) => {
|
|
550
559
|
const outcome = outcomeOf(tool.name, view);
|
|
560
|
+
// The words the summary shows of it, read from the whole output as redacted (`shown`), never from the output as it
|
|
561
|
+
// came: an outcome that takes the output apart (a learned workflow's lines, joined) could split a held value the
|
|
562
|
+
// whole text's redaction finds into pieces the summary's own redaction no longer would (#2452). Whether it failed
|
|
563
|
+
// is still read from the output as it came: one whose redacted output gives no words reads failed with no detail, never
|
|
564
|
+
// ok, and never the detail as it came.
|
|
565
|
+
const worded = shown.text === view.text ? outcome : outcomeOf(tool.name, { ...view, text: shown.text });
|
|
551
566
|
// A call refused before it ran is named refused already (refusedLabel): its row says why, never that it failed.
|
|
552
567
|
const failedSummary = refused(view) ? `${named}: ${failure(shown.text)}` : `${named} failed: ${failure(shown.text)}`;
|
|
553
568
|
return make("tool_result", conv, rowId, {
|
|
554
|
-
summary: !view.isError && pageChanged(tool.name, view) ? PAGE_CHANGED_ROW : view.isError ? failedSummary :
|
|
569
|
+
summary: !view.isError && pageChanged(tool.name, view) ? PAGE_CHANGED_ROW : view.isError ? failedSummary : worded ? `${named}: ${saidOf(worded.text)}` : outcome?.failed ? `${named}: failed` : `${named}: ok`, tool_name: tool.name, tool_use_id: tool.callId,
|
|
555
570
|
tool_status: failedWith(view, outcome) ? "failed" : "success", tool_result_preview: shown.text ? cut(scrubUrls(shown.text), caps.preview) : null,
|
|
556
571
|
tool_result_size_bytes: utf8Bytes(view.text), round: tool.round, parent_tool_use_id: parent,
|
|
557
572
|
});
|
package/dist/tool-blurbs.js
CHANGED
|
@@ -19,6 +19,7 @@ export const TOOL_BLURBS = Object.freeze({
|
|
|
19
19
|
"monid.discover": "Find paid data sources in monid's catalog",
|
|
20
20
|
"monid.inspect": "Check a monid source's input and price",
|
|
21
21
|
"monid.run": "Get paid data from a monid source",
|
|
22
|
+
subagent: "Run a task in a fresh helper conversation",
|
|
22
23
|
pdf_pages: "Turn a PDF's pages into images",
|
|
23
24
|
llm: "Ask the model once, with no tools",
|
|
24
25
|
learned_workflow: "Run a workflow this agent learned",
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type EntryRecord } from "@earendil-works/pi-durable";
|
|
2
|
+
/** A conversation's own budget, narrower than the run's (a subagent call's `max_tool_calls`, runner/subagent.ts): written
|
|
3
|
+
* in the commit that makes the conversation, so a restart reads the same one, and held by the gate with the run's. */
|
|
4
|
+
export declare const ConversationToolBudget: import("@earendil-works/pi-durable").ConversationDocToken<{
|
|
5
|
+
toolCalls?: number;
|
|
6
|
+
}>;
|
|
7
|
+
/** The budget a conversation's calls are held to: the run's and its own, whichever is smaller (its own never widens the
|
|
8
|
+
* run's); absent, none. */
|
|
9
|
+
export declare const budgetOf: (run: number | undefined, own: number | undefined) => number | undefined;
|
|
10
|
+
/** What a call past the budget reads: the same words every time, never a count the model could argue with. */
|
|
11
|
+
export declare const TOOL_BUDGET_TEXT = "Tool budget spent: this conversation has made every tool call it may. Don't call another tool: answer now, from what you have.";
|
|
12
|
+
/** The tool calls before `callId` once one more page of a conversation's entries (`entries`, oldest first) is read, from
|
|
13
|
+
* `count`, the earlier pages': `done` once the call is reached or the count is `upTo`, where a reader stops. */
|
|
14
|
+
export declare function countCalls(entries: readonly EntryRecord[], callId: string, upTo: number, count?: number): {
|
|
15
|
+
count: number;
|
|
16
|
+
done: boolean;
|
|
17
|
+
};
|
|
18
|
+
/** What a call reads once its run's cap is nearly taken: the same words every time, as the tool-call budget's. */
|
|
19
|
+
export declare const WRAP_UP_TEXT = "Budget nearly spent: stop calling tools and answer now from what you have.";
|
|
20
|
+
/** The share of a run's cap at which it wraps up. Its spend and its holds together: a hold is a request's worst case,
|
|
21
|
+
* never its cost, so several requests out at once reach the line long before their spend does, and the quarter left
|
|
22
|
+
* above it is room for each conversation still working to answer. */
|
|
23
|
+
export declare const WRAP_UP_SHARE = 0.75;
|
|
24
|
+
/** Whether a run under `capUsd` that has taken `takenUsd` (its spend and what its steps still out hold, as the cap counts
|
|
25
|
+
* them; null: unknown) wraps up. No cap, or a figure no one knows (the cap refuses the next request for that), is no. */
|
|
26
|
+
export declare const wrappingUp: (capUsd: number | undefined, takenUsd: number | null) => boolean;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
// A tool-call budget: an agent's `max_tool_calls`, held by the run's tool gate on pi. Each conversation of the run (the
|
|
2
|
+
// root, and any conversation a tool opens) may make that many tool calls; past it, every call is refused before its
|
|
3
|
+
// intent with one fixed text that tells the model to answer now from what it has. The refusal is not counted, and the
|
|
4
|
+
// run is never ended by it: the model's next answer is the turn's.
|
|
5
|
+
//
|
|
6
|
+
// The count is read from the conversation's committed entries, never kept in memory, so a restart or a moved claim counts
|
|
7
|
+
// the same calls: the tool calls of its assistant entries before this one, oldest first. The read stops at the budget: no
|
|
8
|
+
// refusal can come before the budget's last allowed call, so every call it counts is one that was let through, and a
|
|
9
|
+
// check never reads past them however long the run goes on. A call of the same round whose result has not landed yet
|
|
10
|
+
// counts as made: a round's calls are counted in the order the model gave them, so a round that crosses the line runs
|
|
11
|
+
// its first calls up to it and the rest are refused.
|
|
12
|
+
//
|
|
13
|
+
// The cap's wrap-up, the same refusal for money: a run with a cap whose spend, plus what its requests and paid steps
|
|
14
|
+
// still out hold at their worst case, reaches WRAP_UP_SHARE of the cap has every model-issued tool call refused before
|
|
15
|
+
// its intent, in WRAP_UP_TEXT, on every harness and in every conversation of the run (a `subagent` spawn is a call too).
|
|
16
|
+
// Nothing in flight is cut, and model requests are not touched: each conversation answers from what it has, under the
|
|
17
|
+
// cap, which stays the last line. The figure is read from the run's committed booking records at each call (the cap's
|
|
18
|
+
// own: a request still out counts at its hold and bound, one a lost claim cut the same), so a restart or a moved claim
|
|
19
|
+
// reads the same figure, and a raise of the cap ends the wrap-up from its next call.
|
|
20
|
+
import { AssistantEntry, defineDoc } from "@earendil-works/pi-durable";
|
|
21
|
+
/** A conversation's own budget, narrower than the run's (a subagent call's `max_tool_calls`, runner/subagent.ts): written
|
|
22
|
+
* in the commit that makes the conversation, so a restart reads the same one, and held by the gate with the run's. */
|
|
23
|
+
export const ConversationToolBudget = defineDoc({ kind: "agentrun.tool-budget", version: 1, scope: "conversation", history: "latest", fork: "current", initial: () => ({}), checkpointWhen: () => false });
|
|
24
|
+
/** The budget a conversation's calls are held to: the run's and its own, whichever is smaller (its own never widens the
|
|
25
|
+
* run's); absent, none. */
|
|
26
|
+
export const budgetOf = (run, own) => (run === undefined ? own : own === undefined ? run : Math.min(run, own));
|
|
27
|
+
/** What a call past the budget reads: the same words every time, never a count the model could argue with. */
|
|
28
|
+
export const TOOL_BUDGET_TEXT = "Tool budget spent: this conversation has made every tool call it may. Don't call another tool: answer now, from what you have.";
|
|
29
|
+
/** The tool calls before `callId` once one more page of a conversation's entries (`entries`, oldest first) is read, from
|
|
30
|
+
* `count`, the earlier pages': `done` once the call is reached or the count is `upTo`, where a reader stops. */
|
|
31
|
+
export function countCalls(entries, callId, upTo, count = 0) {
|
|
32
|
+
for (const entry of entries) {
|
|
33
|
+
if (!AssistantEntry.is(entry))
|
|
34
|
+
continue;
|
|
35
|
+
const content = entry.model?.[0]?.content;
|
|
36
|
+
if (!Array.isArray(content))
|
|
37
|
+
continue;
|
|
38
|
+
for (const part of content) {
|
|
39
|
+
if (part?.type !== "toolCall" || typeof part.id !== "string")
|
|
40
|
+
continue;
|
|
41
|
+
if (part.id === callId || count >= upTo)
|
|
42
|
+
return { count, done: true };
|
|
43
|
+
count++;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return { count, done: count >= upTo };
|
|
47
|
+
}
|
|
48
|
+
/** What a call reads once its run's cap is nearly taken: the same words every time, as the tool-call budget's. */
|
|
49
|
+
export const WRAP_UP_TEXT = "Budget nearly spent: stop calling tools and answer now from what you have.";
|
|
50
|
+
/** The share of a run's cap at which it wraps up. Its spend and its holds together: a hold is a request's worst case,
|
|
51
|
+
* never its cost, so several requests out at once reach the line long before their spend does, and the quarter left
|
|
52
|
+
* above it is room for each conversation still working to answer. */
|
|
53
|
+
export const WRAP_UP_SHARE = 0.75;
|
|
54
|
+
/** Whether a run under `capUsd` that has taken `takenUsd` (its spend and what its steps still out hold, as the cap counts
|
|
55
|
+
* them; null: unknown) wraps up. No cap, or a figure no one knows (the cap refuses the next request for that), is no. */
|
|
56
|
+
export const wrappingUp = (capUsd, takenUsd) => capUsd !== undefined && takenUsd !== null && Number.isFinite(takenUsd) && takenUsd >= WRAP_UP_SHARE * capUsd;
|
package/dist/tool-gate.d.ts
CHANGED
|
@@ -9,6 +9,10 @@ export type Permission = (typeof PERMISSIONS)[number];
|
|
|
9
9
|
export declare const mcpToolName: (server: string, tool: string) => string;
|
|
10
10
|
/** Whether `name` is an MCP tool's gate name. */
|
|
11
11
|
export declare const isMcpTool: (name: string) => boolean;
|
|
12
|
+
/** The MCP servers a revision grants tools of, by their catalog names (`mcp:<server>/<tool>`, a server's wildcard too), each
|
|
13
|
+
* once: what a harness that names a session's MCP tool its own way (its facts' toolAlias: OpenCode's `<server>_<tool>`) is
|
|
14
|
+
* matched against, so its call is held to that tool's settings and never to a table tool's of the same shape. */
|
|
15
|
+
export declare const mcpServersOf: (granted: readonly string[]) => string[];
|
|
12
16
|
/** A third-party catalog tool, by its name: monid's (`monid.<tool>`) or an MCP server's (`mcp:<server>/<tool>`). */
|
|
13
17
|
export declare const isCatalogTool: (name: string) => boolean;
|
|
14
18
|
/** Where a run's shell is, as its default permissions read it: `computer` false for a run with no computer (its bash, where
|
|
@@ -165,11 +169,13 @@ export declare function resumeText(request: Pick<ApprovalRequest, "tool" | "call
|
|
|
165
169
|
/** The gate of the run `runId` whose folder is `where`, on its pinned revision. `serverSettings`: the server's tool
|
|
166
170
|
* settings as the runner read them from the one store at the claim (tool-plane.ts loadToolSettings), read at each call as
|
|
167
171
|
* the gate reads them. `approvers`: whether anyone can answer an ask here, the store's (server-approvers.ts, read at each
|
|
168
|
-
* claim). The gate reads nothing of the run's own files: they are the agent's to write.
|
|
172
|
+
* claim). The gate reads nothing of the run's own files: they are the agent's to write. `mcpServers`: the run's MCP
|
|
173
|
+
* servers (mcpServersOf its grants), so a harness's own name for an MCP tool is held to that tool's settings. */
|
|
169
174
|
export declare function runGate(where: {
|
|
170
175
|
root: string;
|
|
171
176
|
work: string;
|
|
172
177
|
computer?: boolean;
|
|
178
|
+
mcpServers?: readonly string[];
|
|
173
179
|
}, runId: string, revision: {
|
|
174
180
|
kind: string;
|
|
175
181
|
body: {
|
|
@@ -207,8 +213,12 @@ export declare class RunGate {
|
|
|
207
213
|
* the deny (with where it was set, and that nothing was sent or charged), a pin, bash's policy (policyRefusal), then
|
|
208
214
|
* the allow, then the ask, so an allow that approvals "never" made is decided
|
|
209
215
|
* only after every refusal. Where no one can approve (accounts off: the store's approvers row a runner reads at each
|
|
210
|
-
* claim, server-approvers.ts), the ask is refused at once in words, never parked, as `enter` refuses it.
|
|
211
|
-
|
|
216
|
+
* claim, server-approvers.ts), the ask is refused at once in words, never parked, as `enter` refuses it. `replayed`:
|
|
217
|
+
* the call is run again after an earlier attempt that may have been sent (a replay-safe call rerun after a crash), so a
|
|
218
|
+
* refusal says whether it took effect is not known, never that nothing was sent. */
|
|
219
|
+
decide(name: string, args: unknown, options?: {
|
|
220
|
+
readonly replayed?: boolean;
|
|
221
|
+
}): Promise<"allow" | "ask" | {
|
|
212
222
|
deny: string;
|
|
213
223
|
}>;
|
|
214
224
|
/** The name a call is asked about by, as main's request names it (enter's `tool`): its settings key, a shell tool its
|
package/dist/tool-gate.js
CHANGED
|
@@ -39,6 +39,10 @@ export const PERMISSIONS = ["allow", "ask", "deny"];
|
|
|
39
39
|
export const mcpToolName = (server, tool) => `mcp:${server}/${tool}`;
|
|
40
40
|
/** Whether `name` is an MCP tool's gate name. */
|
|
41
41
|
export const isMcpTool = (name) => /^mcp:[^/]+\/.+$/.test(name);
|
|
42
|
+
/** The MCP servers a revision grants tools of, by their catalog names (`mcp:<server>/<tool>`, a server's wildcard too), each
|
|
43
|
+
* once: what a harness that names a session's MCP tool its own way (its facts' toolAlias: OpenCode's `<server>_<tool>`) is
|
|
44
|
+
* matched against, so its call is held to that tool's settings and never to a table tool's of the same shape. */
|
|
45
|
+
export const mcpServersOf = (granted) => [...new Set(granted.flatMap((name) => /^mcp:([^/]+)\//.exec(name)?.[1] ?? []))];
|
|
42
46
|
/** A third-party catalog tool, by its name: monid's (`monid.<tool>`) or an MCP server's (`mcp:<server>/<tool>`). */
|
|
43
47
|
export const isCatalogTool = (name) => name.startsWith("monid.") || isMcpTool(name);
|
|
44
48
|
/** The owner's defaults (11-01): a built-in kernel tool allow; a third-party catalog tool ask. On a run with no computer,
|
|
@@ -318,9 +322,10 @@ export function resumeText(request, shown, decision, result) {
|
|
|
318
322
|
/** The gate of the run `runId` whose folder is `where`, on its pinned revision. `serverSettings`: the server's tool
|
|
319
323
|
* settings as the runner read them from the one store at the claim (tool-plane.ts loadToolSettings), read at each call as
|
|
320
324
|
* the gate reads them. `approvers`: whether anyone can answer an ask here, the store's (server-approvers.ts, read at each
|
|
321
|
-
* claim). The gate reads nothing of the run's own files: they are the agent's to write.
|
|
325
|
+
* claim). The gate reads nothing of the run's own files: they are the agent's to write. `mcpServers`: the run's MCP
|
|
326
|
+
* servers (mcpServersOf its grants), so a harness's own name for an MCP tool is held to that tool's settings. */
|
|
322
327
|
export function runGate(where, runId, revision, serverSettings, approvers) {
|
|
323
|
-
return new RunGate({ root: where.root, work: where.work, runId, harness: revision.body.harness ?? DEFAULT_HARNESS, ...(where.computer === undefined ? {} : { computer: where.computer }) }, serverSettings, (revision.body.toolSettings ?? {}), approvers, approvalsOf(revision.body.approvals));
|
|
328
|
+
return new RunGate({ root: where.root, work: where.work, runId, harness: revision.body.harness ?? DEFAULT_HARNESS, ...(where.computer === undefined ? {} : { computer: where.computer }), ...(where.mcpServers ? { mcpServers: where.mcpServers } : {}) }, serverSettings, (revision.body.toolSettings ?? {}), approvers, approvalsOf(revision.body.approvals));
|
|
324
329
|
}
|
|
325
330
|
/** A run's tool gate on the runner: its policy, asked before each call's intent (decide). */
|
|
326
331
|
export class RunGate {
|
|
@@ -347,14 +352,17 @@ export class RunGate {
|
|
|
347
352
|
* the deny (with where it was set, and that nothing was sent or charged), a pin, bash's policy (policyRefusal), then
|
|
348
353
|
* the allow, then the ask, so an allow that approvals "never" made is decided
|
|
349
354
|
* only after every refusal. Where no one can approve (accounts off: the store's approvers row a runner reads at each
|
|
350
|
-
* claim, server-approvers.ts), the ask is refused at once in words, never parked, as `enter` refuses it.
|
|
351
|
-
|
|
355
|
+
* claim, server-approvers.ts), the ask is refused at once in words, never parked, as `enter` refuses it. `replayed`:
|
|
356
|
+
* the call is run again after an earlier attempt that may have been sent (a replay-safe call rerun after a crash), so a
|
|
357
|
+
* refusal says whether it took effect is not known, never that nothing was sent. */
|
|
358
|
+
async decide(name, args, options = {}) {
|
|
352
359
|
const key = settingsKeyOf(this.where.harness ?? DEFAULT_HARNESS, name, this.where.mcpServers) ?? name;
|
|
353
360
|
const tool = this.askedAs(name);
|
|
361
|
+
const ran = options.replayed ? "unknown" : "no";
|
|
354
362
|
const verdict = this.policy(name);
|
|
355
363
|
if (verdict === "deny")
|
|
356
|
-
return { deny: deniedText(tool, key, this.denyFrom(name),
|
|
357
|
-
const pinned = this.pinned(key, args,
|
|
364
|
+
return { deny: deniedText(tool, key, this.denyFrom(name), ran) };
|
|
365
|
+
const pinned = this.pinned(key, args, ran);
|
|
358
366
|
if (pinned)
|
|
359
367
|
return { deny: pinned.text };
|
|
360
368
|
const policed = this.policyRefusal(key, name, args);
|
|
@@ -362,7 +370,7 @@ export class RunGate {
|
|
|
362
370
|
return { deny: policed };
|
|
363
371
|
if (verdict === "allow")
|
|
364
372
|
return "allow";
|
|
365
|
-
return this.approvers ? "ask" : { deny: noApproverText(tool,
|
|
373
|
+
return this.approvers ? "ask" : { deny: noApproverText(tool, ran) };
|
|
366
374
|
}
|
|
367
375
|
/** The name a call is asked about by, as main's request names it (enter's `tool`): its settings key, a shell tool its
|
|
368
376
|
* own name; a name nothing maps, as it came. */
|