@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/tool-plane.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { InputIssue } from "./errors.js";
|
|
2
2
|
import type { Settings } from "./store/index.js";
|
|
3
3
|
import { type HarnessId } from "./harness.js";
|
|
4
|
+
import { type ShellPlace } from "@parcha/agentrun-kernel/kernel";
|
|
4
5
|
import { type Permission, type Pin } from "./tool-gate.js";
|
|
5
6
|
import { type BashPolicy } from "./bash-read-only.js";
|
|
6
7
|
/**
|
|
@@ -10,19 +11,19 @@ import { type BashPolicy } from "./bash-read-only.js";
|
|
|
10
11
|
* never does), and a catalog's tools (`monid.*`, `mcp:<server>/<tool>`: catalog tools, which their catalog grants).
|
|
11
12
|
*/
|
|
12
13
|
export declare const CAPABILITIES: readonly ["read", "write", "edit", "web_search", "web_fetch", "browser", "ask_person"];
|
|
13
|
-
export type Capability = (typeof CAPABILITIES)[number];
|
|
14
14
|
/** The providers a user may pick for each capability that has a choice, its default first: `auto`, the native search
|
|
15
15
|
* where there is one (never on claude-agent, where Claude's own search is picked as `native`), else Parallel where the
|
|
16
16
|
* server holds its key, else keyless Exa; `native`, the harness's own tool or its model provider's hosted one, and
|
|
17
17
|
* nothing else; `exa-keyless`, Exa's public MCP endpoint, no key; `kernel`, the guarded direct fetch; `parallel`,
|
|
18
18
|
* Parallel's Search and Extract APIs on PARALLEL_API_KEY; `off`, web_search turned off: nothing is searched, and an
|
|
19
|
-
* agent naming it is refused until it is turned on again. The browser's: `auto`,
|
|
20
|
-
* keys, else Kernel
|
|
21
|
-
* server's own host, which no server sets up yet
|
|
19
|
+
* agent naming it is refused until it is turned on again. The browser's: `auto`, the computer registry's first browser
|
|
20
|
+
* provider whose keys the server holds (Browserbase, else Kernel); a browser provider's id (`browserbase`, `kernel`:
|
|
21
|
+
* BROWSER_VENDOR_IDS), that one alone; `chrome`, a Chrome on the server's own host, which no server sets up yet
|
|
22
|
+
* (browserBy). */
|
|
22
23
|
export declare const PROVIDERS: Readonly<{
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
web_search: readonly ["auto", "native", "exa-keyless", "parallel", "off"];
|
|
25
|
+
web_fetch: readonly ["kernel", "parallel"];
|
|
26
|
+
browser: readonly string[];
|
|
26
27
|
}>;
|
|
27
28
|
export type Pickable = keyof typeof PROVIDERS;
|
|
28
29
|
export declare const PICKABLE: Pickable[];
|
|
@@ -38,9 +39,9 @@ export declare const permissionsOf: (name: string) => readonly Permission[];
|
|
|
38
39
|
* give it: the one in force under the server's settings (`permission`), the owner's default (`default_permission`) and
|
|
39
40
|
* those it may be set to. An agent's read gives the same, the agent's own layer over it (agentTools). */
|
|
40
41
|
export declare const serverGate: (name: string, settings: ToolSettingsMap) => {
|
|
41
|
-
permission: "deny" | "
|
|
42
|
-
default_permission: "deny" | "
|
|
43
|
-
permissions: ("deny" | "
|
|
42
|
+
permission: "deny" | "allow" | "ask";
|
|
43
|
+
default_permission: "deny" | "allow" | "ask";
|
|
44
|
+
permissions: ("deny" | "allow" | "ask")[];
|
|
44
45
|
};
|
|
45
46
|
/** The run's own tools beyond the table, each its own settings key, allowed by default like a table tool: the learned
|
|
46
47
|
* workflow a run's pin names runs as `learned_workflow` (learned-workflow.ts LEARNED_WORKFLOW_TOOL). */
|
|
@@ -127,16 +128,12 @@ export declare const isUnavailable: (resolution: Resolution | undefined) => reso
|
|
|
127
128
|
/** Why `resolution` is unavailable, in words. A vendor picked whose key this server does not hold (its value, kept in a
|
|
128
129
|
* run's meta and read back, names the variables) names where to save the key first, then the variable to set. */
|
|
129
130
|
export declare const whyUnavailable: (resolution: string) => string;
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
readonly browserbase: readonly ["BROWSERBASE_API_KEY", "BROWSERBASE_PROJECT_ID"];
|
|
134
|
-
readonly kernel: readonly ["KERNEL_API_KEY"];
|
|
135
|
-
}>;
|
|
136
|
-
type BrowserVendor = keyof typeof BROWSER_KEYS;
|
|
131
|
+
export declare const BROWSER_VENDOR_IDS: readonly string[];
|
|
132
|
+
export declare const BROWSER_KEYS: Readonly<Record<string, readonly string[]>>;
|
|
133
|
+
type BrowserVendor = string;
|
|
137
134
|
/** The keys a browser that resolves to `resolution` runs on: its vendor's (BROWSER_KEYS), none for no vendor. */
|
|
138
135
|
export declare const browserNeeds: (resolution: string | undefined) => readonly string[];
|
|
139
|
-
/** `auto` where the server holds
|
|
136
|
+
/** `auto` where the server holds no vendor's keys. */
|
|
140
137
|
export declare const NO_BROWSER_KEY: Resolution;
|
|
141
138
|
/** `chrome` picked: a Chrome on the server's own host, refused by name until a server can set one up. */
|
|
142
139
|
export declare const NO_CHROME: Resolution;
|
|
@@ -190,9 +187,10 @@ export declare const keptFromBefore: (plane: Plane) => Plane;
|
|
|
190
187
|
* restored keys make it run. Every other saved value stays as it is: `auto` with no key at a run's first launch
|
|
191
188
|
* (NO_BROWSER_KEY) and `chrome` stay frozen. The same Plane where nothing changes. */
|
|
192
189
|
export declare function keptVendor(plane: Plane): Plane;
|
|
193
|
-
/** The key row (tool-keys.ts) of the browser's vendor on `resolution` with `picked` the provider in force:
|
|
194
|
-
*
|
|
195
|
-
|
|
190
|
+
/** The key row (tool-keys.ts) of the browser's vendor on `resolution` with `picked` the provider in force: the vendor it
|
|
191
|
+
* resolved to, else the one picked, else the registry's first (Browserbase), so a page links a missing key to the row
|
|
192
|
+
* it is saved on. */
|
|
193
|
+
export declare const browserKeyRow: (picked: string | undefined, resolution: string | undefined) => string;
|
|
196
194
|
/** The Plane a run's process is handed at a launch, under the server's `settings` now: its kept Plane (as keptVendor
|
|
197
195
|
* reads it) checked again (recheckPlane) against the one it would get today; with none kept, today's, its browser kept
|
|
198
196
|
* (keptFromBefore). At a launch after its first (a relaunch, a follow-up's, one after a restart) a capability set
|
|
@@ -263,16 +261,31 @@ export declare function keptSettings(map: ToolSettingsMap, current: ToolSettings
|
|
|
263
261
|
export declare function saveToolSettings(store: {
|
|
264
262
|
settings: Pick<Settings, "get" | "put">;
|
|
265
263
|
}, map: ToolSettingsMap): Promise<ToolSettingsMap>;
|
|
264
|
+
/** Why a tool of bash's family (SHELL_FAMILY: bash and the background tools) is not there for a run whose shell is
|
|
265
|
+
* `shell` (workspace/resolve-computer.ts runShellOf, the claim's own rule read off the agent's computer setting), in the
|
|
266
|
+
* kernel registry's words for a call of it there: with no computer that mounts the run's folder the background tools
|
|
267
|
+
* are refused (NEEDS_A_COMPUTER), and bash too where the run has no shell at all (NO_SHELL, Mode 1); in Mode 2 bash runs
|
|
268
|
+
* on Archil's exec. Undefined for any other tool, and where it is there. */
|
|
269
|
+
export declare function shellUnavailable(name: string, shell: ShellPlace): Resolution | undefined;
|
|
266
270
|
/** GET /v2/agents/{id}'s `tools`: each tool its current revision grants, in `order` (capabilities.tools'), with its
|
|
267
271
|
* permission in force and where it came from (the agent's own settings, the server's, or the default), the one that
|
|
268
272
|
* applies when the agent sets none (the server's, else the default) and those it may be set to; and for one with a
|
|
269
273
|
* provider choice the provider in force and where it came from, the one that applies when the agent sets none, and what
|
|
270
|
-
* it resolves to on the agent's harness and model.
|
|
271
|
-
|
|
272
|
-
|
|
274
|
+
* it resolves to on the agent's harness and model. `shell`: where a run of the agent has its shell (runShellOf on its
|
|
275
|
+
* computer setting); a tool of bash's family that leaves out resolves unavailable, saying why (shellUnavailable). */
|
|
276
|
+
export declare function agentTools(env: NodeJS.ProcessEnv, settings: ToolSettingsMap, agent: Tooling, order: readonly string[], shell?: ShellPlace): ({
|
|
277
|
+
resolved: Resolution;
|
|
278
|
+
permission: "deny" | "allow" | "ask";
|
|
279
|
+
permission_from: import("./refusal-words.js").SettingFrom;
|
|
280
|
+
default_permission: "deny" | "allow" | "ask";
|
|
281
|
+
permissions: ("deny" | "allow" | "ask")[];
|
|
282
|
+
blurb?: string | undefined;
|
|
283
|
+
name: string;
|
|
284
|
+
} | {
|
|
285
|
+
permission: "deny" | "allow" | "ask";
|
|
273
286
|
permission_from: import("./refusal-words.js").SettingFrom;
|
|
274
|
-
default_permission: "deny" | "
|
|
275
|
-
permissions: ("deny" | "
|
|
287
|
+
default_permission: "deny" | "allow" | "ask";
|
|
288
|
+
permissions: ("deny" | "allow" | "ask")[];
|
|
276
289
|
blurb?: string | undefined;
|
|
277
290
|
name: string;
|
|
278
291
|
} | {
|
|
@@ -280,10 +293,10 @@ export declare function agentTools(env: NodeJS.ProcessEnv, settings: ToolSetting
|
|
|
280
293
|
provider_from: string;
|
|
281
294
|
default_provider: string;
|
|
282
295
|
resolved: Resolution;
|
|
283
|
-
permission: "deny" | "
|
|
296
|
+
permission: "deny" | "allow" | "ask";
|
|
284
297
|
permission_from: import("./refusal-words.js").SettingFrom;
|
|
285
|
-
default_permission: "deny" | "
|
|
286
|
-
permissions: ("deny" | "
|
|
298
|
+
default_permission: "deny" | "allow" | "ask";
|
|
299
|
+
permissions: ("deny" | "allow" | "ask")[];
|
|
287
300
|
blurb?: string | undefined;
|
|
288
301
|
name: string;
|
|
289
302
|
})[];
|
package/dist/tool-plane.js
CHANGED
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
// told a deny: its Plane resolves a denied capability as under ask, and the gate, which reads the permission at each
|
|
21
21
|
// call, is the one place that refuses it, so a deny lifted mid-run is lifted at the next call.
|
|
22
22
|
import { blurbOf } from "./tool-blurbs.js";
|
|
23
|
+
import { PROVIDERS as COMPUTER_PROVIDERS } from "@parcha/agentrun-computer";
|
|
23
24
|
import { decisionKeysOf, PARALLEL_KEY_ENV } from "./decisions.js";
|
|
24
25
|
import { keyNeeded } from "./key-words.js";
|
|
25
26
|
import { DEFAULT_HARNESS, HARNESSES } from "./harness.js";
|
|
@@ -27,6 +28,7 @@ import { builtinHarness, harnessOf } from "./harness-table.js";
|
|
|
27
28
|
import { viaOpenRouter, WIRES } from "./provider.js";
|
|
28
29
|
import { savedIn } from "./secrets.js";
|
|
29
30
|
import { hostModel } from "./model.js";
|
|
31
|
+
import { NEEDS_A_COMPUTER, NO_SHELL } from "@parcha/agentrun-kernel/kernel";
|
|
30
32
|
import { canonicalPin, defaultPermission, isCatalogTool, isMcpTool, MAX_PIN_ARGS, MAX_PIN_CHOICES, PERMISSIONS, permissionFrom, permissionOf, SETTINGS_UNREAD, SHELL_FAMILY } from "./tool-gate.js";
|
|
31
33
|
import { BASH_POLICIES } from "./bash-read-only.js";
|
|
32
34
|
/**
|
|
@@ -41,13 +43,14 @@ export const CAPABILITIES = ["read", "write", "edit", "web_search", "web_fetch",
|
|
|
41
43
|
* server holds its key, else keyless Exa; `native`, the harness's own tool or its model provider's hosted one, and
|
|
42
44
|
* nothing else; `exa-keyless`, Exa's public MCP endpoint, no key; `kernel`, the guarded direct fetch; `parallel`,
|
|
43
45
|
* Parallel's Search and Extract APIs on PARALLEL_API_KEY; `off`, web_search turned off: nothing is searched, and an
|
|
44
|
-
* agent naming it is refused until it is turned on again. The browser's: `auto`,
|
|
45
|
-
* keys, else Kernel
|
|
46
|
-
* server's own host, which no server sets up yet
|
|
47
|
-
|
|
46
|
+
* agent naming it is refused until it is turned on again. The browser's: `auto`, the computer registry's first browser
|
|
47
|
+
* provider whose keys the server holds (Browserbase, else Kernel); a browser provider's id (`browserbase`, `kernel`:
|
|
48
|
+
* BROWSER_VENDOR_IDS), that one alone; `chrome`, a Chrome on the server's own host, which no server sets up yet
|
|
49
|
+
* (browserBy). */
|
|
50
|
+
export const PROVIDERS = Object.freeze({ web_search: ["auto", "native", "exa-keyless", "parallel", "off"], web_fetch: ["kernel", "parallel"], browser: Object.freeze(["auto", ...browserProviderIds(), "chrome"]) });
|
|
48
51
|
export const PICKABLE = Object.keys(PROVIDERS);
|
|
49
52
|
/** Every tool of serve's table (tools.ts), by name, so this module needs no import of it: a test holds the two as one. */
|
|
50
|
-
export const TABLE_TOOLS = ["read", "write", "edit", "bash", "ask_person", "web_fetch", "web_search", "browser", "pdf_pages", "llm"];
|
|
53
|
+
export const TABLE_TOOLS = ["read", "write", "edit", "bash", "ask_person", "web_fetch", "web_search", "browser", "subagent", "pdf_pages", "llm"];
|
|
51
54
|
/** The tools whose approved call the kernel runs itself, outside the model's turn (host-tools.ts's REPLAY): ask is
|
|
52
55
|
* offered for these and for catalog tools. Any other (browser, ask_person, the call-only ones) is allow or deny. The
|
|
53
56
|
* run's learned_workflow is one (tool-gate.ts runs an approved call of it on the run's own tools). */
|
|
@@ -200,37 +203,53 @@ export const isUnavailable = (resolution) => resolution?.startsWith("unavailable
|
|
|
200
203
|
* run's meta and read back, names the variables) names where to save the key first, then the variable to set. */
|
|
201
204
|
export const whyUnavailable = (resolution) => {
|
|
202
205
|
if (resolution === NO_BROWSER_KEY)
|
|
203
|
-
return `it needs ${keyNeeded(
|
|
206
|
+
return `it needs ${BROWSER_VENDORS.map((vendor) => keyNeeded(vendor.keys)).join(", or ")}`;
|
|
204
207
|
const why = resolution.replace(/^unavailable: /, "");
|
|
205
208
|
const picked = /^(\S+) picked, no (.+)$/.exec(why);
|
|
206
209
|
return picked ? `${picked[1]} is picked, and it needs ${keyNeeded(picked[2].split(" and "))}` : why;
|
|
207
210
|
};
|
|
208
|
-
/** The
|
|
209
|
-
*
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
211
|
+
/** The browser's vendors: the computer registry's providers of a browser (kinds.ts PROVIDERS), in its order, each with
|
|
212
|
+
* the keys it needs by name (its required keys: a tool key's fields, tool-keys.ts, set or saved) and its name in words.
|
|
213
|
+
* Its plane value is the provider's id: `kernel` on browser is Kernel's hosted browser, never the guarded fetch
|
|
214
|
+
* web_fetch calls so. A hosted browser provider added to the registry is a vendor here with no edit. A browser
|
|
215
|
+
* provider that needs no key (this machine's Chrome) is no hosted vendor: `auto` would always hold its keys, so it is
|
|
216
|
+
* left out, and an agent picks it as its computer instead. */
|
|
217
|
+
const BROWSER_VENDORS = Object.freeze(hostedBrowsers().map((entry) => Object.freeze({ id: entry.id, label: entry.label, keys: Object.freeze(entry.keys.filter((key) => key.required).map((key) => key.name)) })));
|
|
218
|
+
/** The registry's browser providers that need a key, in its order. */
|
|
219
|
+
function hostedBrowsers() {
|
|
220
|
+
return COMPUTER_PROVIDERS.filter((entry) => entry.kinds.includes("browser") && entry.keys.some((key) => key.required));
|
|
221
|
+
}
|
|
222
|
+
/** The hosted browser providers' ids, in the registry's order (PROVIDERS.browser lists them between `auto` and `chrome`). */
|
|
223
|
+
function browserProviderIds() {
|
|
224
|
+
return hostedBrowsers().map((entry) => entry.id);
|
|
225
|
+
}
|
|
226
|
+
export const BROWSER_VENDOR_IDS = Object.freeze(browserProviderIds());
|
|
227
|
+
export const BROWSER_KEYS = Object.freeze(Object.fromEntries(BROWSER_VENDORS.map((vendor) => [vendor.id, vendor.keys])));
|
|
228
|
+
const LABELS = Object.freeze(Object.fromEntries(BROWSER_VENDORS.map((vendor) => [vendor.id, vendor.label])));
|
|
229
|
+
const isVendor = (name) => typeof name === "string" && Object.hasOwn(BROWSER_KEYS, name);
|
|
230
|
+
const browserKeysOf = (env) => Object.fromEntries(BROWSER_VENDORS.map((vendor) => [vendor.id, vendor.keys.every((name) => Boolean(env[name]))]));
|
|
214
231
|
/** A vendor picked whose keys the server does not hold: unavailable, never the other vendor. */
|
|
215
232
|
const noBrowserKey = (vendor) => `unavailable: ${vendor} picked, no ${BROWSER_KEYS[vendor].join(" and ")}`;
|
|
216
233
|
/** The keys a browser that resolves to `resolution` runs on: its vendor's (BROWSER_KEYS), none for no vendor. */
|
|
217
234
|
export const browserNeeds = (resolution) => (isVendor(resolution) ? BROWSER_KEYS[resolution] : []);
|
|
218
|
-
/** `auto` where the server holds
|
|
219
|
-
export const NO_BROWSER_KEY =
|
|
235
|
+
/** `auto` where the server holds no vendor's keys. */
|
|
236
|
+
export const NO_BROWSER_KEY = `unavailable: no browser key: set or save ${BROWSER_VENDORS.map((vendor) => `${vendor.label}'s (${vendor.keys.join(" and ")})`).join(" or ")}`;
|
|
220
237
|
/** `chrome` picked: a Chrome on the server's own host, refused by name until a server can set one up. */
|
|
221
238
|
export const NO_CHROME = "unavailable: a local Chrome is not set up on this server";
|
|
222
|
-
/** The browser `chosen` (picked as `picked` says) resolves to with the vendors' `keys`: `auto` is
|
|
223
|
-
* keys are held, else Kernel
|
|
224
|
-
* is unavailable by name. */
|
|
225
|
-
function browserBy(chosen, picked, keys = {
|
|
239
|
+
/** The browser `chosen` (picked as `picked` says) resolves to with the vendors' `keys`: `auto` is the registry's first
|
|
240
|
+
* vendor whose keys are held (Browserbase, else Kernel), else unavailable; a vendor picked is that vendor or
|
|
241
|
+
* unavailable; `chrome` is unavailable by name. */
|
|
242
|
+
function browserBy(chosen, picked, keys = {}) {
|
|
226
243
|
if (chosen === "chrome")
|
|
227
244
|
return { resolves: NO_CHROME, why: whyUnavailable(NO_CHROME) };
|
|
228
245
|
if (isVendor(chosen))
|
|
229
246
|
return keys[chosen] ? { resolves: chosen, why: `${LABELS[chosen]}, ${picked}` } : { resolves: noBrowserKey(chosen), why: `${LABELS[chosen]} is picked, and it needs ${keyNeeded(BROWSER_KEYS[chosen])}` };
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
247
|
+
const first = BROWSER_VENDORS.findIndex((vendor) => keys[vendor.id]);
|
|
248
|
+
if (first >= 0) {
|
|
249
|
+
const vendor = BROWSER_VENDORS[first];
|
|
250
|
+
const passed = BROWSER_VENDORS.slice(0, first).map((one) => `${one.label}'s`);
|
|
251
|
+
return { resolves: vendor.id, why: `${vendor.label}: its key is set or saved${passed.length ? `, and ${passed.join(" and ")} is not` : ""}` };
|
|
252
|
+
}
|
|
234
253
|
return { resolves: NO_BROWSER_KEY, why: whyUnavailable(NO_BROWSER_KEY) };
|
|
235
254
|
}
|
|
236
255
|
/** The server's environment's part of every resolution: its gateway and Parallel's key, and where the key is from. */
|
|
@@ -312,9 +331,10 @@ export function keptVendor(plane) {
|
|
|
312
331
|
const vendor = Object.keys(BROWSER_KEYS).find((name) => plane.browser === noBrowserKey(name));
|
|
313
332
|
return vendor ? { ...plane, browser: vendor } : plane;
|
|
314
333
|
}
|
|
315
|
-
/** The key row (tool-keys.ts) of the browser's vendor on `resolution` with `picked` the provider in force:
|
|
316
|
-
*
|
|
317
|
-
|
|
334
|
+
/** The key row (tool-keys.ts) of the browser's vendor on `resolution` with `picked` the provider in force: the vendor it
|
|
335
|
+
* resolved to, else the one picked, else the registry's first (Browserbase), so a page links a missing key to the row
|
|
336
|
+
* it is saved on. */
|
|
337
|
+
export const browserKeyRow = (picked, resolution) => (isVendor(resolution) ? resolution : isVendor(picked) ? picked : BROWSER_VENDORS[0]?.id ?? "browserbase");
|
|
318
338
|
/** The Plane a run's process is handed at a launch, under the server's `settings` now: its kept Plane (as keptVendor
|
|
319
339
|
* reads it) checked again (recheckPlane) against the one it would get today; with none kept, today's, its browser kept
|
|
320
340
|
* (keptFromBefore). At a launch after its first (a relaunch, a follow-up's, one after a restart) a capability set
|
|
@@ -495,12 +515,25 @@ export async function saveToolSettings(store, map) {
|
|
|
495
515
|
await store.settings.put(TOOL_SETTINGS_KEY, written);
|
|
496
516
|
return structuredClone(kept);
|
|
497
517
|
}
|
|
518
|
+
/** Why a tool of bash's family (SHELL_FAMILY: bash and the background tools) is not there for a run whose shell is
|
|
519
|
+
* `shell` (workspace/resolve-computer.ts runShellOf, the claim's own rule read off the agent's computer setting), in the
|
|
520
|
+
* kernel registry's words for a call of it there: with no computer that mounts the run's folder the background tools
|
|
521
|
+
* are refused (NEEDS_A_COMPUTER), and bash too where the run has no shell at all (NO_SHELL, Mode 1); in Mode 2 bash runs
|
|
522
|
+
* on Archil's exec. Undefined for any other tool, and where it is there. */
|
|
523
|
+
export function shellUnavailable(name, shell) {
|
|
524
|
+
if (!Object.hasOwn(SHELL_FAMILY, name) || shell === "computer")
|
|
525
|
+
return undefined;
|
|
526
|
+
if (name === SHELL_FAMILY[name])
|
|
527
|
+
return shell === "none" ? `unavailable: ${NO_SHELL}` : undefined;
|
|
528
|
+
return `unavailable: ${NEEDS_A_COMPUTER}`;
|
|
529
|
+
}
|
|
498
530
|
/** GET /v2/agents/{id}'s `tools`: each tool its current revision grants, in `order` (capabilities.tools'), with its
|
|
499
531
|
* permission in force and where it came from (the agent's own settings, the server's, or the default), the one that
|
|
500
532
|
* applies when the agent sets none (the server's, else the default) and those it may be set to; and for one with a
|
|
501
533
|
* provider choice the provider in force and where it came from, the one that applies when the agent sets none, and what
|
|
502
|
-
* it resolves to on the agent's harness and model.
|
|
503
|
-
|
|
534
|
+
* it resolves to on the agent's harness and model. `shell`: where a run of the agent has its shell (runShellOf on its
|
|
535
|
+
* computer setting); a tool of bash's family that leaves out resolves unavailable, saying why (shellUnavailable). */
|
|
536
|
+
export function agentTools(env, settings, agent, order, shell = "computer") {
|
|
504
537
|
const plane = planeFor(env, agent, settings);
|
|
505
538
|
const rank = (name) => order.indexOf(name);
|
|
506
539
|
return [...new Set(agent.tools)].sort((a, b) => rank(a) - rank(b)).map((name) => {
|
|
@@ -509,6 +542,10 @@ export function agentTools(env, settings, agent, order) {
|
|
|
509
542
|
// One short line for people (tool-blurbs.ts), as capabilities serves it.
|
|
510
543
|
const blurb = blurbOf(name);
|
|
511
544
|
const shown = { name, ...(blurb ? { blurb } : {}) };
|
|
545
|
+
// A tool of bash's family the agent's computer gives no shell for: unavailable, in the words its run's call gets.
|
|
546
|
+
const noShell = shellUnavailable(name, shell);
|
|
547
|
+
if (noShell)
|
|
548
|
+
return { ...shown, ...gate, resolved: noShell };
|
|
512
549
|
if (!Object.hasOwn(PROVIDERS, name))
|
|
513
550
|
return { ...shown, ...gate };
|
|
514
551
|
const pick = name;
|
package/dist/tools.d.ts
CHANGED
|
@@ -7,15 +7,16 @@ import { type Complete } from "./llm.js";
|
|
|
7
7
|
import { type Ledger, type PaidBooking } from "./paid-calls.js";
|
|
8
8
|
import type { Refusal } from "@parcha/agentrun-kernel";
|
|
9
9
|
import { type ShellPlace } from "@parcha/agentrun-kernel/kernel";
|
|
10
|
-
import { type Plane, type Tooling, type ToolSettingsMap } from "./tool-plane.js";
|
|
10
|
+
import { type Plane, type Resolution, type Tooling, type ToolSettingsMap } from "./tool-plane.js";
|
|
11
11
|
import type { DenyFrom, SettingFrom } from "./tool-gate.js";
|
|
12
12
|
import type { LiveHandover, LiveViewerStore } from "./browser-live.js";
|
|
13
13
|
import type { Claim, Store } from "./store/store.js";
|
|
14
14
|
import { type RunSignIn } from "./sign-ins-store.js";
|
|
15
15
|
export declare const ASK_TOOL = "ask_person";
|
|
16
|
-
/** Under `--faux` only: a module whose default export gives the browser's `{
|
|
17
|
-
* environment, the vendor its plane names
|
|
18
|
-
*
|
|
16
|
+
/** Under `--faux` only: a module whose default export gives the browser's `{ computer, driver }` for the run's
|
|
17
|
+
* environment, the vendor its plane names and the saved sign-in it was handed for that vendor (`{ provider, ref, save }`,
|
|
18
|
+
* or undefined): a browser computer provider and a driver in place of the vendor's and the raw-CDP driver (the tests'
|
|
19
|
+
* fake backend). */
|
|
19
20
|
export declare const FAUX_BROWSER_ENV = "AGENTRUN_SERVE_FAUX_BROWSER";
|
|
20
21
|
/** Under `--faux` only: a module whose default export is the fetch a run's first saved sign-in is made with on the runner,
|
|
21
22
|
* in place of the browser vendors' REST APIs (the tests' fake). Absent under --faux, none is made: no network. */
|
|
@@ -68,9 +69,9 @@ export type ToolHost = {
|
|
|
68
69
|
put(handover: LiveHandover): Promise<boolean>;
|
|
69
70
|
drop(tag?: string): Promise<void>;
|
|
70
71
|
};
|
|
71
|
-
/** The one store, for the live-viewer seam above, the run's saved sign-in (its runs and sign-ins, read under `claim`)
|
|
72
|
-
*
|
|
73
|
-
store?: LiveViewerStore & Pick<Store, "runs" | "signIns">;
|
|
72
|
+
/** The one store, for the live-viewer seam above, the run's saved sign-in (its runs and sign-ins, read under `claim`),
|
|
73
|
+
* the sign-in verify the runner saves, and the Screen tab's ended state (settings: browser-wait-ended.ts). */
|
|
74
|
+
store?: LiveViewerStore & Pick<Store, "runs" | "signIns" | "settings">;
|
|
74
75
|
/** The claim this run is held under: the live-viewer rows are written under it (its epoch fences them), and the run's
|
|
75
76
|
* saved sign-in is read and its hand kept under it. Present, the run is on the runner: never the process's own pipe. */
|
|
76
77
|
claim?: Claim;
|
|
@@ -95,7 +96,8 @@ export type ToolHost = {
|
|
|
95
96
|
* folder at `where.work`. */
|
|
96
97
|
workspace?: Workspace;
|
|
97
98
|
/** The agent's computer, where it is a browser (computer-for-claim.ts): the browser tool opens its sessions through the
|
|
98
|
-
* claim's provider
|
|
99
|
+
* claim's provider, whatever the tool plane picked. Absent: the plane's vendor, opened the same way (browser-computer.ts
|
|
100
|
+
* planeBrowser). */
|
|
99
101
|
browserComputer?: ClaimBrowser;
|
|
100
102
|
};
|
|
101
103
|
/** What a name stands for in the run: the pi tools it offers, and the extensions a conversation selects for them. */
|
|
@@ -153,22 +155,23 @@ export declare const evidenceIn: (work: Workspace) => {
|
|
|
153
155
|
bodyLine?: undefined;
|
|
154
156
|
}>;
|
|
155
157
|
};
|
|
156
|
-
/**
|
|
157
|
-
*
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
resolve
|
|
158
|
+
/** What browser_upload may choose: a file of the run's Workspace, the one its read opens, by a path relative to it. The
|
|
159
|
+
* Workspace refuses a path that would leave it (absolute, "..", a link anywhere on the way), so nothing outside the run's
|
|
160
|
+
* folder is ever read; a file must be a regular one of at most `maxBytes`. `mime` names its media type by its name. */
|
|
161
|
+
export declare const uploadsFrom: (work: Workspace, maxBytes: number, mime: (name: string) => string) => {
|
|
162
|
+
resolve(rel: string): Promise<{
|
|
163
|
+
bytes: Uint8Array;
|
|
164
|
+
name: string;
|
|
165
|
+
mime: string;
|
|
166
|
+
} | {
|
|
167
|
+
refused: string;
|
|
168
|
+
}>;
|
|
161
169
|
};
|
|
162
|
-
/**
|
|
163
|
-
*
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
name: string;
|
|
168
|
-
save: boolean;
|
|
169
|
-
};
|
|
170
|
-
}, signal: AbortSignal): unknown;
|
|
171
|
-
}>(provider: P, ref: string) => P;
|
|
170
|
+
/** Every string in `value` (a tool's answer: its content, its details) passed through `cut`; anything else as it is. An
|
|
171
|
+
* image block's `data` that is an image (wholeImage) is its pixels' base64, not text, and is kept whole: the cut reads a
|
|
172
|
+
* run of more than 8,192 characters with no whitespace as "[redacted]" (key-refusal.ts redactedAnswer), which no model
|
|
173
|
+
* takes as an image. Any other `data`, on a block of any type, is cut like every other string. */
|
|
174
|
+
export declare function cutAnswer<T>(value: T, cut: (text: string) => string): T;
|
|
172
175
|
/** `provider`, its sessions' profile as this launch was handed it, whatever the policy a conversation was made with (a
|
|
173
176
|
* follow-up's was made under an earlier launch, which may have had no sign-in, or another lease): with a sign-in, every
|
|
174
177
|
* session opens on the profile `default`, saving only as `kept.save` says; without one, none asks for a profile. */
|
|
@@ -209,17 +212,35 @@ export declare const CALL_TOOLS: readonly string[];
|
|
|
209
212
|
/** Whether `name` is one of `allowed`. */
|
|
210
213
|
export declare const allows: (allowed: readonly string[], name: string) => boolean;
|
|
211
214
|
/** The tools a run's learned workflow may name (learn/check.ts at learn time, learned-workflow.ts at a call): those of the
|
|
212
|
-
* agent's `granted` tools a workflow's call node runs here (CALL_TOOLS
|
|
215
|
+
* agent's `granted` tools a workflow's call node runs here (CALL_TOOLS, and each MCP tool granted by its own name,
|
|
216
|
+
* skills.ts LEARNED_MCP_TOOL: a wildcard is read against its server's listing first, mcpGrantsListed), and with the run's `plane`, none it resolves unavailable (its agent's own tool of the name does not run either). A
|
|
213
217
|
* learned model node runs without tools (learn/skills.ts MODEL_NODE_TOOLS), and a harness's own tool (Bash,
|
|
214
218
|
* exec_command, apply_patch) is never one, so the DSL refuses a draft that names it. */
|
|
215
|
-
export declare const learnedWorkflowTools: (granted: readonly string[], plane?: Plane) => string[];
|
|
219
|
+
export declare const learnedWorkflowTools: (granted: readonly string[], plane?: Plane, options?: LearnedMcp) => string[];
|
|
220
|
+
/** `mcp: true` at learn time (the end-of-run step's draft tools, a person's write): an MCP tool the revision grants by its
|
|
221
|
+
* own name may be named. Without it (the runtime's read at a call, learned-workflow.ts), none is: the run's MCP tools are
|
|
222
|
+
* its pin's, which the runtime reads apart and holds to the gate itself (#2424). `approvers`: whether anyone can answer
|
|
223
|
+
* an ask here (server-approvers.ts). Only then is an MCP tool set to ask offered: with no one, #2424 refuses the
|
|
224
|
+
* learned call's ask at once, so offering it would only teach a workflow that never runs. Not said: no one. */
|
|
225
|
+
export type LearnedMcp = {
|
|
226
|
+
readonly mcp?: boolean;
|
|
227
|
+
readonly approvers?: boolean;
|
|
228
|
+
};
|
|
229
|
+
/** `granted` with each MCP server's wildcard (`mcp:<server>/*`) read as the tools its server lists now (`listed`, by the
|
|
230
|
+
* server's name: none for a server not saved), each `mcp:<server>/<tool>`, in place; every other name as it is, each
|
|
231
|
+
* once. What a revision grants under a wildcard is every tool of its server, so a learned draft may name each one
|
|
232
|
+
* (learnedWorkflowTools), its gate holding it as any tool (learnedDraftTools: the wildcard's setting, or the tool's own).
|
|
233
|
+
* At proposal time there is no run and no pin: whether the run's pin has the tool is the runtime's to check at the call,
|
|
234
|
+
* in the gate's words (learned-workflow.ts). */
|
|
235
|
+
export declare function mcpGrantsListed(granted: readonly string[], listed: (server: string) => readonly string[]): string[];
|
|
216
236
|
/** The tools a learned draft may name (learnedWorkflowTools) that the gate allows: `permission` is what the gate holds a
|
|
217
237
|
* tool to now (tool-gate.ts permissionOf, or the run's gate's policy), by its settings key. One set to ask or deny is left out of `tools`, so the end-of-run prompt never offers it, and named
|
|
218
238
|
* in `gated` with its setting, which the checker and a learned workflow's check before it runs refuse a draft for. */
|
|
219
|
-
export declare const learnedDraftTools: (granted: readonly string[], permission: (name: string) => string, plane?: Plane, from?: (name: string) => SettingFrom) => {
|
|
239
|
+
export declare const learnedDraftTools: (granted: readonly string[], permission: (name: string) => string, plane?: Plane, from?: (name: string) => SettingFrom, options?: LearnedMcp) => {
|
|
220
240
|
tools: string[];
|
|
221
241
|
gated: Record<string, string>;
|
|
222
242
|
deniedBy: Record<string, DenyFrom>;
|
|
243
|
+
asked: string[];
|
|
223
244
|
};
|
|
224
245
|
/** The tools a workflow names (`nodes` from workflowNodes): on its model nodes (`tools`), and on its `call` nodes
|
|
225
246
|
* `via: "tool"` (`tool`). */
|
|
@@ -244,13 +265,6 @@ export declare const shellTools: (shell: ShellPlace) => ReadonlySet<string>;
|
|
|
244
265
|
export declare function toolingOf(revision: Revision): Promise<Tooling>;
|
|
245
266
|
/** The variables `entry` needs that `env` does not set, by name. */
|
|
246
267
|
export declare const missingEnv: (entry: ToolEntry, env: NodeJS.ProcessEnv) => string[];
|
|
247
|
-
/** What keeps `names` from being bound here: names outside the table (or, for a workflow's model nodes, that a node may
|
|
248
|
-
* not name), and the variables each tool in it needs that `env` does not set. Undefined when nothing does. */
|
|
249
|
-
export declare function toolRefusal(names: readonly string[], env: NodeJS.ProcessEnv, where?: "agent" | "nodes" | "calls"): {
|
|
250
|
-
message: string;
|
|
251
|
-
unbound: string[];
|
|
252
|
-
missing: Record<string, string[]>;
|
|
253
|
-
} | undefined;
|
|
254
268
|
/** Every tool as capabilities show it, the server's one tool catalog: available here, or the variables it is missing
|
|
255
269
|
* (names only), and the harnesses that run it (another harness than pi runs only the host tools, host-tools.ts). A tool
|
|
256
270
|
* a user picks a provider for (tool-plane.ts) gives the providers offered, the server's (`provider`, the default where it
|
|
@@ -263,14 +277,14 @@ export declare function toolRefusal(names: readonly string[], env: NodeJS.Proces
|
|
|
263
277
|
* saying that. Each tool also gives its permission under the server's settings (tool-gate.ts), the owner's default
|
|
264
278
|
* and the permissions it may be set to. */
|
|
265
279
|
export declare const toolsView: (env: NodeJS.ProcessEnv, settings?: ToolSettingsMap, noBox?: string, refused?: Readonly<Record<string, string>>, runnerShell?: ReadonlySet<string>) => {
|
|
266
|
-
providers?:
|
|
280
|
+
providers?: string[] | undefined;
|
|
267
281
|
provider?: string | undefined;
|
|
268
|
-
default_provider?:
|
|
269
|
-
resolves?: Record<"opencode" | "codex" | "pi" | "claude-agent",
|
|
282
|
+
default_provider?: string | undefined;
|
|
283
|
+
resolves?: Record<"opencode" | "codex" | "pi" | "claude-agent", Resolution> | undefined;
|
|
270
284
|
why?: Record<"opencode" | "codex" | "pi" | "claude-agent", string> | undefined;
|
|
271
|
-
permission: "deny" | "
|
|
272
|
-
default_permission: "deny" | "
|
|
273
|
-
permissions: ("deny" | "
|
|
285
|
+
permission: "deny" | "allow" | "ask";
|
|
286
|
+
default_permission: "deny" | "allow" | "ask";
|
|
287
|
+
permissions: ("deny" | "allow" | "ask")[];
|
|
274
288
|
harnesses: ("opencode" | "codex" | "pi" | "claude-agent")[];
|
|
275
289
|
missing?: string[] | undefined;
|
|
276
290
|
reason?: string | undefined;
|