@parcha/agentrun-serve 0.1.0-beta.37 → 0.1.0-beta.38
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 +282 -0
- package/README.md +155 -92
- package/dist/agent-rows.d.ts +1 -1
- package/dist/agents-store.d.ts +35 -3
- package/dist/agents-store.js +39 -14
- package/dist/answer-json.d.ts +34 -1
- package/dist/answer-json.js +91 -9
- package/dist/api-only.d.ts +1 -1
- package/dist/api-only.js +2 -2
- package/dist/browser-cost.js +52 -93
- package/dist/cap.d.ts +0 -390
- package/dist/cap.js +4 -937
- package/dist/catalog.js +1 -1
- package/dist/composio-preset.d.ts +17 -0
- package/dist/composio-preset.js +43 -1
- package/dist/computer-calls.d.ts +36 -24
- package/dist/computer-calls.js +110 -27
- package/dist/computer-live.d.ts +5 -0
- package/dist/computer-live.js +12 -0
- package/dist/computer-setting.d.ts +15 -2
- package/dist/computer-setting.js +20 -4
- package/dist/computer-view.d.ts +3 -2
- package/dist/computer-view.js +5 -4
- package/dist/computer-viewer.js +26 -12
- package/dist/computers.d.ts +4 -1
- package/dist/computers.js +12 -6
- package/dist/console/assets/index-CjqQirbo.css +1 -0
- package/dist/console/assets/index-b6-XY5A9.js +576 -0
- package/dist/console/index.html +2 -2
- package/dist/console-links.d.ts +2 -0
- package/dist/console-links.js +3 -0
- package/dist/decisions.js +4 -0
- package/dist/faux-computers.js +4 -2
- package/dist/harness-opencode/adapter.js +7 -3
- package/dist/harness-opencode/facts.js +0 -2
- package/dist/harness-opencode/host/policy.d.ts +2 -5
- package/dist/harness-opencode/host/policy.js +8 -32
- package/dist/harness-table.d.ts +0 -2
- package/dist/harness-table.js +0 -2
- package/dist/host-tools.d.ts +1 -5
- package/dist/host-tools.js +7 -10
- package/dist/hosted-search.d.ts +0 -2
- package/dist/hosted-search.js +0 -21
- package/dist/key-words.d.ts +3 -2
- package/dist/key-words.js +4 -2
- package/dist/learn/check.d.ts +6 -1
- package/dist/learn/check.js +12 -4
- package/dist/learn/commit.d.ts +10 -0
- package/dist/learn/commit.js +18 -4
- package/dist/learn/compile.d.ts +243 -0
- package/dist/learn/compile.js +471 -0
- package/dist/learn/general.d.ts +3 -0
- package/dist/learn/general.js +4 -2
- package/dist/learn/grade.d.ts +1 -1
- package/dist/learn/grade.js +7 -6
- package/dist/learn/notes.d.ts +8 -0
- package/dist/learn/notes.js +18 -0
- package/dist/learn/promote.d.ts +253 -0
- package/dist/learn/promote.js +428 -0
- package/dist/learn/refit.d.ts +39 -0
- package/dist/learn/refit.js +236 -0
- package/dist/learn/reflect.d.ts +5 -25
- package/dist/learn/reflect.js +14 -131
- package/dist/learn/replay-calls.d.ts +63 -0
- package/dist/learn/replay-calls.js +158 -0
- package/dist/learn/skills.d.ts +17 -9
- package/dist/learn/skills.js +132 -42
- package/dist/learn/workflow-nodes.d.ts +15 -0
- package/dist/learn/workflow-nodes.js +44 -0
- package/dist/learned-nodes.d.ts +50 -2
- package/dist/learned-nodes.js +41 -2
- package/dist/learned-workflow.d.ts +19 -3
- package/dist/learned-workflow.js +105 -26
- package/dist/learning-batch.d.ts +2 -2
- package/dist/learning-batch.js +1 -1
- package/dist/learning-cost.d.ts +18 -6
- package/dist/learning-cost.js +15 -7
- package/dist/learning-routes.d.ts +14 -2
- package/dist/learning-routes.js +14 -3
- package/dist/learning-words.d.ts +7 -0
- package/dist/learning-words.js +7 -0
- package/dist/learning.d.ts +31 -6
- package/dist/learning.js +7 -4
- package/dist/llm.js +0 -3
- package/dist/mcp-gateway.d.ts +12 -20
- package/dist/mcp-gateway.js +16 -44
- package/dist/mcp-oauth.d.ts +5 -0
- package/dist/mcp-oauth.js +1 -1
- package/dist/mcp-pin-first.d.ts +37 -0
- package/dist/mcp-pin-first.js +107 -0
- package/dist/mcp-probe.d.ts +8 -9
- package/dist/mcp-probe.js +16 -33
- package/dist/mcp-servers-store.d.ts +89 -22
- package/dist/mcp-servers-store.js +131 -25
- package/dist/mcp-sources.d.ts +39 -0
- package/dist/mcp-sources.js +74 -0
- package/dist/mcp-store.d.ts +11 -0
- package/dist/mcp-store.js +16 -2
- package/dist/mcp-wire.d.ts +22 -0
- package/dist/mcp-wire.js +36 -0
- package/dist/mcp.js +3 -3
- package/dist/meta-tool-names.d.ts +1 -0
- package/dist/meta-tool-names.js +3 -0
- package/dist/model.d.ts +13 -0
- package/dist/model.js +46 -15
- package/dist/monid.d.ts +51 -25
- package/dist/monid.js +226 -140
- package/dist/openapi.js +336 -66
- package/dist/paid-calls.d.ts +26 -29
- package/dist/paid-calls.js +46 -102
- package/dist/propose.d.ts +7 -1
- package/dist/propose.js +18 -6
- package/dist/provider.js +9 -2
- package/dist/reflect-range.js +2 -1
- package/dist/rows.d.ts +5 -3
- package/dist/rows.js +15 -4
- package/dist/run-launch.d.ts +13 -0
- package/dist/run-launch.js +6 -0
- package/dist/run-learning-served.d.ts +13 -2
- package/dist/run-manifest.d.ts +5 -0
- package/dist/run-manifest.js +20 -0
- package/dist/run-secrets.js +2 -3
- package/dist/run-timeline-served.js +5 -2
- package/dist/run-view.d.ts +17 -6
- package/dist/run-view.js +51 -22
- package/dist/runnable.d.ts +0 -3
- package/dist/runnable.js +37 -29
- package/dist/runner/adapter-loop.d.ts +24 -10
- package/dist/runner/adapter-loop.js +852 -314
- package/dist/runner/adapter-run-spec.d.ts +12 -6
- package/dist/runner/adapter-run-spec.js +97 -46
- package/dist/runner/adapters/pi-computer.d.ts +3 -1
- package/dist/runner/adapters/pi-computer.js +13 -5
- package/dist/runner/adapters/pi.d.ts +16 -7
- package/dist/runner/adapters/pi.js +94 -33
- package/dist/runner/cli-run-spec.js +67 -27
- package/dist/runner/computer-channel.js +2 -1
- package/dist/runner/conformance/harness.d.ts +3 -0
- package/dist/runner/conformance/harness.js +145 -4
- package/dist/runner/conformance/subject.d.ts +11 -4
- package/dist/runner/end-of-run.d.ts +6 -5
- package/dist/runner/end-of-run.js +9 -6
- package/dist/runner/feedback-round.d.ts +52 -0
- package/dist/runner/feedback-round.js +79 -0
- package/dist/runner/journal-kinds.d.ts +24 -6
- package/dist/runner/journal-kinds.js +15 -0
- package/dist/runner/learning-end.d.ts +54 -19
- package/dist/runner/learning-end.js +272 -99
- package/dist/runner/learning-loop.d.ts +19 -1
- package/dist/runner/learning-loop.js +5 -2
- package/dist/runner/learning-seed.d.ts +4 -0
- package/dist/runner/learning-seed.js +14 -0
- package/dist/runner/loop-contract.d.ts +19 -3
- package/dist/runner/loop.d.ts +16 -1
- package/dist/runner/loop.js +21 -1
- package/dist/runner/mcp-claim.d.ts +5 -1
- package/dist/runner/mcp-claim.js +66 -50
- package/dist/runner/mcp-run.d.ts +16 -52
- package/dist/runner/mcp-run.js +12 -84
- package/dist/runner/meta-tools.d.ts +37 -0
- package/dist/runner/meta-tools.js +268 -0
- package/dist/runner/metrics.js +14 -3
- package/dist/runner/model-route.js +12 -3
- package/dist/runner/monid-run.d.ts +16 -0
- package/dist/runner/monid-run.js +96 -0
- package/dist/runner/promotion.d.ts +80 -0
- package/dist/runner/promotion.js +562 -0
- package/dist/runner/reflect-hook.d.ts +36 -21
- package/dist/runner/reflect-hook.js +138 -49
- package/dist/runner/runner.js +26 -4
- package/dist/runner/sessions.d.ts +8 -3
- package/dist/runner/sessions.js +5 -1
- package/dist/runner/step-guard.d.ts +62 -0
- package/dist/runner/step-guard.js +93 -0
- package/dist/runner/subagent.d.ts +0 -3
- package/dist/runner/subagent.js +7 -12
- package/dist/runner/workflow-first.d.ts +216 -0
- package/dist/runner/workflow-first.js +303 -0
- package/dist/runner/workflow-loop.js +17 -10
- package/dist/runner/workflow-spec.d.ts +1 -0
- package/dist/runner/workflow-spec.js +7 -3
- package/dist/runs-over-store.d.ts +11 -2
- package/dist/runs-over-store.js +21 -11
- package/dist/server.d.ts +88 -16
- package/dist/server.js +380 -87
- package/dist/settings-wake.d.ts +8 -6
- package/dist/settings-wake.js +13 -7
- package/dist/store/agent-body.d.ts +14 -3
- package/dist/store/agent-body.js +14 -10
- package/dist/store/command-wake.d.ts +3 -2
- package/dist/store/command-wake.js +4 -4
- package/dist/store/postgres/connection.js +3 -1
- package/dist/store/postgres/migrations/0010_imported_templates.sql +18 -0
- package/dist/store/postgres/migrations/0011_revision_mcp_pin.sql +13 -0
- package/dist/store/schema.d.ts +9 -0
- package/dist/store/schema.js +28 -8
- package/dist/store/sqlite/connection.d.ts +2 -2
- package/dist/store/sqlite/connection.js +2 -2
- package/dist/store/sqlite/run-patch.js +19 -7
- package/dist/store/sqlite/store.js +59 -18
- package/dist/store/store.d.ts +46 -14
- package/dist/store-reads/journal.d.ts +25 -1
- package/dist/store-reads/journal.js +63 -49
- package/dist/store-reads/learning.d.ts +101 -15
- package/dist/store-reads/learning.js +195 -61
- package/dist/store-reads/loop.d.ts +61 -0
- package/dist/store-reads/loop.js +111 -0
- package/dist/store-view.d.ts +3 -2
- package/dist/store-view.js +35 -17
- package/dist/template-eval.d.ts +18 -9
- package/dist/template-eval.js +91 -66
- package/dist/template-github-permissions.d.ts +2 -2
- package/dist/template-github-permissions.js +2 -1
- package/dist/template-import.d.ts +31 -0
- package/dist/template-import.js +121 -0
- package/dist/template-source.d.ts +51 -0
- package/dist/template-source.js +371 -0
- package/dist/templates.d.ts +218 -46
- package/dist/templates.js +493 -181
- package/dist/timeline/computer.d.ts +48 -0
- package/dist/timeline/computer.js +169 -0
- package/dist/timeline/index.d.ts +4 -3
- package/dist/timeline/index.js +4 -3
- package/dist/timeline/labels.d.ts +6 -2
- package/dist/timeline/labels.js +93 -2
- package/dist/timeline/origin.d.ts +19 -5
- package/dist/timeline/origin.js +11 -4
- package/dist/timeline/timeline.d.ts +11 -17
- package/dist/timeline/timeline.js +24 -9
- package/dist/tool-gate.d.ts +73 -46
- package/dist/tool-gate.js +133 -66
- package/dist/tool-keys.d.ts +4 -1
- package/dist/tool-keys.js +8 -3
- package/dist/tool-list.d.ts +26 -0
- package/dist/tool-list.js +43 -0
- package/dist/tool-names.d.ts +71 -0
- package/dist/tool-names.js +99 -0
- package/dist/tool-plane.d.ts +29 -27
- package/dist/tool-plane.js +65 -37
- package/dist/tools.d.ts +22 -6
- package/dist/tools.js +24 -20
- package/dist/validate.d.ts +15 -7
- package/dist/validate.js +91 -44
- package/dist/web-fetch.d.ts +1 -7
- package/dist/web-fetch.js +2 -22
- package/dist/workspace/computer-deps.d.ts +3 -0
- package/dist/workspace/computer-deps.js +5 -2
- package/dist/workspace/computer-for-claim.d.ts +6 -0
- package/dist/workspace/computer-for-claim.js +32 -14
- package/dist/workspace/computer-hold.js +7 -1
- package/dist/workspace/computer-script.d.ts +23 -7
- package/dist/workspace/computer-script.js +48 -14
- package/dist/workspace/index.d.ts +2 -2
- package/dist/workspace/index.js +1 -1
- package/dist/workspace/kind-skills/desktop/SKILL.md +13 -0
- package/dist/workspace/kind-skills/phone/SKILL.md +4 -0
- package/dist/workspace/local.js +2 -2
- package/dist/workspace/resolve-computer.d.ts +21 -1
- package/dist/workspace/resolve-computer.js +32 -14
- package/dist/workspace/run-tools.d.ts +28 -10
- package/dist/workspace/run-tools.js +39 -11
- package/dist/{tool-budget.d.ts → wrap-up.d.ts} +1 -18
- package/dist/wrap-up.js +21 -0
- package/launcher/agentrun-serve +4 -2
- package/package.json +9 -9
- package/templates/README.md +111 -45
- package/templates/code-review/agent.md +30 -14
- package/templates/code-review/evals/clean-refactor/case.yaml +2 -1
- package/templates/code-review/evals/clean-refactor/graders/head-sha.md +6 -0
- package/templates/code-review/evals/injection/case.yaml +2 -1
- package/templates/code-review/evals/injection/graders/head-sha.md +6 -0
- package/templates/code-review/evals/mentions-defused/case.yaml +2 -2
- package/templates/code-review/evals/mentions-defused/fixtures/github-mcp.json +0 -23
- package/templates/code-review/evals/mentions-defused/graders/head-sha.md +6 -0
- package/templates/code-review/evals/never-flag/case.yaml +2 -1
- package/templates/code-review/evals/never-flag/graders/head-sha.md +6 -0
- package/templates/code-review/evals/null-name/case.yaml +2 -1
- package/templates/code-review/evals/null-name/graders/head-sha.md +6 -0
- package/templates/code-review/evals/off-by-one/case.yaml +2 -1
- package/templates/code-review/evals/off-by-one/graders/head-sha.md +6 -0
- package/templates/code-review/evals/other-repo/case.yaml +16 -0
- package/templates/code-review/evals/other-repo/fixtures/github-mcp.json +130 -0
- package/templates/code-review/evals/other-repo/graders/head-sha.md +6 -0
- package/templates/code-review/evals/other-repo/graders/no-canary.md +6 -0
- package/templates/code-review/evals/other-repo/graders/no-other-repo.md +8 -0
- package/templates/code-review/evals/other-repo/graders/refused-not-quoted.md +18 -0
- package/templates/code-review/evals/other-repo/prompt.md +10 -0
- package/templates/code-review/evals/re-review/case.yaml +2 -1
- package/templates/code-review/evals/re-review/graders/head-sha.md +6 -0
- package/templates/code-review/evals/re-review-open/case.yaml +2 -1
- package/templates/code-review/evals/re-review-open/graders/head-sha.md +6 -0
- package/templates/code-review/evals/repo-rule/case.yaml +2 -1
- package/templates/code-review/evals/repo-rule/graders/head-sha.md +6 -0
- package/templates/code-review/evals/two-defects/case.yaml +2 -1
- package/templates/code-review/evals/two-defects/graders/head-sha.md +6 -0
- package/templates/code-review/rules/CODEREVIEW.md +1 -1
- package/templates/code-review/skills/review/DEEP.md +3 -2
- package/templates/code-review/skills/review/REVIEWER.md +3 -2
- package/templates/code-review/skills/review/SKILL.md +4 -3
- package/templates/code-review/{findings.schema.json → skills/review/findings.schema.json} +1 -0
- package/templates/inbound-lead/agent.md +26 -16
- package/templates/inbound-lead/evals/injection-in-form/graders/no-exfil.md +16 -0
- package/templates/inbound-lead/evals/injection-in-form/prompt.md +2 -2
- package/templates/inbound-lead/evals/write-back/case.yaml +2 -6
- package/templates/inbound-lead/evals/write-back/fixtures/fake-hubspot.json +34 -225
- package/templates/inbound-lead/evals/write-back/graders/note-and-score.md +10 -14
- package/templates/inbound-lead/evals/write-back/graders/writes-once.md +7 -0
- package/templates/inbound-lead/evals/write-back/prompt.md +1 -1
- package/templates/inbound-lead/evals/write-back-wrong-record/case.yaml +3 -7
- package/templates/inbound-lead/evals/write-back-wrong-record/fixtures/fake-hubspot.json +34 -225
- package/templates/inbound-lead/evals/write-back-wrong-record/graders/form-id.md +17 -0
- package/templates/inbound-lead/evals/write-back-wrong-record/graders/no-write.md +3 -3
- package/templates/inbound-lead/evals/write-back-wrong-record/prompt.md +2 -2
- package/templates/inbound-lead/skills/lead/SKILL.md +23 -27
- package/templates/kyb/agent.md +15 -5
- package/templates/kyb/evals/adverse-media/prompt.md +2 -7
- package/templates/kyb/evals/canada-active-filed/prompt.md +2 -6
- package/templates/kyb/evals/clean-public-company/prompt.md +2 -6
- package/templates/kyb/evals/injection-in-page/prompt.md +3 -7
- package/templates/kyb/evals/name-collision/prompt.md +2 -6
- package/templates/kyb/evals/no-invention/prompt.md +2 -6
- package/templates/kyb/evals/opensanctions-on/prompt.md +2 -6
- package/templates/kyb/evals/sanctioned-entity/prompt.md +2 -6
- package/templates/kyb/kyb.schema.json +8 -7
- package/templates/kyb/skills/kyb/SKILL.md +9 -6
- package/templates/market-monitor/agent.md +19 -12
- package/templates/market-monitor/evals/post-happens/case.yaml +4 -4
- package/templates/market-monitor/evals/post-happens/fixtures/slack-mcp.json +13 -9
- package/templates/market-monitor/evals/post-happens/graders/post-is-digest.md +1 -1
- package/templates/market-monitor/evals/post-happens/graders/posted-once.md +3 -3
- package/templates/market-monitor/skills/monitor/SKILL.md +6 -4
- package/templates/release-notes/agent.md +32 -10
- package/templates/release-notes/evals/draft-not-publish/case.yaml +4 -3
- package/templates/release-notes/evals/draft-not-publish/fixtures/github-mcp.json +29 -51
- package/templates/release-notes/evals/every-pr-accounted/case.yaml +2 -1
- package/templates/release-notes/evals/issue-write-refused/case.yaml +4 -3
- package/templates/release-notes/evals/issue-write-refused/fixtures/github-mcp.json +29 -51
- package/templates/release-notes/evals/late-arrival/case.yaml +6 -5
- package/templates/release-notes/evals/late-arrival/fixtures/github-mcp.json +29 -51
- package/templates/release-notes/evals/learned-style/case.yaml +2 -1
- package/templates/release-notes/evals/no-pr-numbers-on-top/case.yaml +2 -1
- package/templates/release-notes/evals/other-repo/case.yaml +24 -0
- package/templates/release-notes/evals/other-repo/fixtures/github-mcp.json +907 -0
- package/templates/release-notes/evals/other-repo/graders/no-canary.md +7 -0
- package/templates/release-notes/evals/other-repo/graders/no-other-repo.md +8 -0
- package/templates/release-notes/evals/other-repo/graders/refused-not-quoted.md +18 -0
- package/templates/release-notes/evals/other-repo/prompt.md +32 -0
- package/templates/release-notes/evals/upgrade-line/case.yaml +2 -1
- package/templates/release-notes/evals/user-facing-only/case.yaml +2 -1
- package/templates/release-notes/notes.schema.json +1 -1
- package/templates/release-notes/skills/release-notes/SKILL.md +26 -17
- package/dist/console/assets/index-Cn6JX1uH.js +0 -563
- package/dist/console/assets/index-DRN62V5v.css +0 -1
- package/dist/tool-blurbs.d.ts +0 -4
- package/dist/tool-blurbs.js +0 -28
- package/dist/tool-budget.js +0 -62
- package/templates/code-review/evals/clean-refactor/graders/schema.md +0 -5
- package/templates/code-review/evals/injection/graders/schema.md +0 -5
- package/templates/code-review/evals/mentions-defused/graders/schema.md +0 -5
- package/templates/code-review/evals/never-flag/graders/schema.md +0 -5
- package/templates/code-review/evals/null-name/graders/schema.md +0 -5
- package/templates/code-review/evals/off-by-one/graders/schema.md +0 -5
- package/templates/code-review/evals/re-review/graders/schema.md +0 -5
- package/templates/code-review/evals/re-review-open/graders/schema.md +0 -5
- package/templates/code-review/evals/repo-rule/graders/schema.md +0 -5
- package/templates/code-review/evals/two-defects/graders/schema.md +0 -5
- package/templates/inbound-lead/evals/clear-disqualifier/graders/schema.md +0 -5
- package/templates/inbound-lead/evals/injection-in-form/graders/schema.md +0 -5
- package/templates/inbound-lead/evals/learned-correction/graders/schema.md +0 -5
- package/templates/inbound-lead/evals/strong-fit/graders/schema.md +0 -5
- package/templates/inbound-lead/evals/thin-data/graders/schema.md +0 -5
- package/templates/inbound-lead/evals/write-back/graders/schema.md +0 -5
- package/templates/inbound-lead/evals/write-back/graders/writes-twice.md +0 -7
- package/templates/inbound-lead/evals/write-back-wrong-record/graders/proves-record.md +0 -18
- package/templates/inbound-lead/evals/write-back-wrong-record/graders/schema.md +0 -5
- package/templates/kyb/evals/adverse-media/graders/schema.md +0 -5
- package/templates/kyb/evals/canada-active-filed/graders/schema.md +0 -5
- package/templates/kyb/evals/clean-public-company/graders/schema.md +0 -5
- package/templates/kyb/evals/injection-in-page/graders/schema.md +0 -5
- package/templates/kyb/evals/name-collision/graders/schema.md +0 -5
- package/templates/kyb/evals/no-invention/graders/schema.md +0 -5
- package/templates/kyb/evals/opensanctions-on/graders/schema.md +0 -5
- package/templates/kyb/evals/sanctioned-entity/graders/schema.md +0 -5
- package/templates/market-monitor/evals/blocked-source/graders/schema.md +0 -5
- package/templates/market-monitor/evals/every-competitor-named/graders/schema.md +0 -5
- package/templates/market-monitor/evals/learned-preference/graders/schema.md +0 -5
- package/templates/market-monitor/evals/no-repeats/graders/schema.md +0 -5
- package/templates/market-monitor/evals/nothing-changed/graders/schema.md +0 -5
- package/templates/market-monitor/evals/post-happens/graders/schema.md +0 -5
- package/templates/market-monitor/evals/pricing-change/graders/schema.md +0 -5
- package/templates/market-monitor/evals/pricing-moved/graders/schema.md +0 -5
- package/templates/release-notes/evals/draft-not-publish/graders/schema.md +0 -5
- package/templates/release-notes/evals/every-pr-accounted/graders/schema.md +0 -5
- package/templates/release-notes/evals/issue-write-refused/graders/schema.md +0 -5
- package/templates/release-notes/evals/late-arrival/graders/schema.md +0 -5
- package/templates/release-notes/evals/learned-style/graders/schema.md +0 -5
- package/templates/release-notes/evals/no-pr-numbers-on-top/graders/schema.md +0 -5
- package/templates/release-notes/evals/upgrade-line/graders/schema.md +0 -5
- package/templates/release-notes/evals/user-facing-only/graders/schema.md +0 -5
|
@@ -207,6 +207,12 @@ export const TAKEN_OVER = "taken_over";
|
|
|
207
207
|
const LOOKS = new Set(["observe", "screenshot", "apps.list"]);
|
|
208
208
|
/** The ops that act, each by what the model is told was not done: parked, then refused. */
|
|
209
209
|
const ACTS = new Map([["act", "act"], ["input.act", "input"], ["apps.open", "app opening"]]);
|
|
210
|
+
/** What an op does: an act's words, or undefined for a look or a pass-through. On a computer with apps and no ui group,
|
|
211
|
+
* an observe that names an app opens it, or brings it in front, first: an app opening. */
|
|
212
|
+
function actOf(port, op, args) {
|
|
213
|
+
const opens = op === "observe" && !port.groups.includes("ui") && port.groups.includes("apps") && typeof args?.app === "string";
|
|
214
|
+
return opens ? "app opening" : ACTS.get(op);
|
|
215
|
+
}
|
|
210
216
|
/** `port` held: a look waits while the person has the computer, then runs as the agent's call in flight (which a take
|
|
211
217
|
* waits out); an act made with the agent driving runs (in flight), one made while the person has it waits for the
|
|
212
218
|
* hand-back and is not done; the shell's and the files' ops are not the person's and pass through. */
|
|
@@ -214,7 +220,7 @@ function heldPort(port, hold) {
|
|
|
214
220
|
return {
|
|
215
221
|
...port,
|
|
216
222
|
async call(op, args, signal) {
|
|
217
|
-
const what =
|
|
223
|
+
const what = actOf(port, op, args);
|
|
218
224
|
if (what === undefined && !LOOKS.has(op))
|
|
219
225
|
return port.call(op, args, signal);
|
|
220
226
|
const parked = hold.state() !== "agent";
|
|
@@ -3,7 +3,8 @@ import type { Executor } from "@parcha/agentrun-kernel/kernel";
|
|
|
3
3
|
/** A script's longest run by default, and at most, in ms. */
|
|
4
4
|
export declare const SCRIPT_DEFAULT_MS = 120000;
|
|
5
5
|
export declare const SCRIPT_MAX_MS = 600000;
|
|
6
|
-
/** The run's tool gate's decision of one call, as a script's computer call is held to it
|
|
6
|
+
/** The run's tool gate's decision of one call, as a script's computer call is held to it: decided as on the run's
|
|
7
|
+
* computer, where the call runs (adapterRunGate's script). */
|
|
7
8
|
export type ScriptDecide = (tool: string, args: unknown) => Promise<"allow" | "ask" | {
|
|
8
9
|
deny: string;
|
|
9
10
|
}>;
|
|
@@ -14,17 +15,23 @@ export type ScriptDecide = (tool: string, args: unknown) => Promise<"allow" | "a
|
|
|
14
15
|
export declare class ScriptGuard {
|
|
15
16
|
#private;
|
|
16
17
|
private readonly shell;
|
|
18
|
+
private readonly kind?;
|
|
17
19
|
/** `shell`: what the run's bash adds under its bash policy (bash-read-only.ts policyEnv, policyPrelude): the environment
|
|
18
|
-
* that locks git's config down, set over any a script gives, and the line that runs git only at the floor version.
|
|
20
|
+
* that locks git's config down, set over any a script gives, and the line that runs git only at the floor version.
|
|
21
|
+
* `kind`: the run's computer's kind, which a refusal names (the phone, the desktop). */
|
|
19
22
|
constructor(shell?: {
|
|
20
23
|
readonly env: Readonly<Record<string, string>>;
|
|
21
24
|
readonly prelude: string;
|
|
22
|
-
});
|
|
25
|
+
}, kind?: string | undefined);
|
|
23
26
|
/** `op`'s arguments as the computer is sent them: a script's shell command with the policy's safeguards, as the bash
|
|
24
27
|
* tool's own command has them, which no option of the script's overrides. */
|
|
25
28
|
shaped(op: string, args: unknown): unknown;
|
|
26
29
|
install(decide: ScriptDecide): void;
|
|
27
|
-
/** Why `op` with `args` may not run now, or undefined when the gate lets it.
|
|
30
|
+
/** Why `op` with `args` may not run now, or undefined when the gate lets it. The words start with what could not be
|
|
31
|
+
* done, on which computer ("could not run a shell command on the phone"), as the Timeline's row shows them; an ask
|
|
32
|
+
* says why in a person's words and what to do instead. A phone's instead is its screen, named as the script's
|
|
33
|
+
* `computer` (script.ts bindComputer) and the run's tools name it: the run's bash tool does not run on a phone, so it
|
|
34
|
+
* is never offered there. */
|
|
28
35
|
refusal(op: string, args: unknown): Promise<string | undefined>;
|
|
29
36
|
/** `call` of the computer's port with a script's computer call held to the gate first: the refusal throws in the
|
|
30
37
|
* script, where its `await` is. */
|
|
@@ -32,6 +39,15 @@ export declare class ScriptGuard {
|
|
|
32
39
|
value?: unknown;
|
|
33
40
|
}>): Promise<unknown>;
|
|
34
41
|
}
|
|
35
|
-
/**
|
|
36
|
-
|
|
37
|
-
|
|
42
|
+
/** What a script that reaches for a shell is told when its agent's computer has exec off. */
|
|
43
|
+
export declare const NO_PROGRAMS_WORDS = "this agent's computer runs no programs: its exec setting is off, so its scripts have no computer.shell and no computer.processes. Drive it through what it shows: its screen, its input and its apps.";
|
|
44
|
+
/** The one line that binds `computer` in a script for a computer that is `card` (the surface's scriptPrelude). With
|
|
45
|
+
* `exec: false` (the agent's setting, run-tools.ts AgentComputer) the card has no exec or processes group, so
|
|
46
|
+
* `computer.shell` and `computer.processes` are absent, and reaching for either throws NO_PROGRAMS_WORDS instead of a
|
|
47
|
+
* bare TypeError: `computer` is the surface's own object behind a Proxy whose get refuses those two names. */
|
|
48
|
+
export declare function scriptPreludeOf(card: Card, options?: {
|
|
49
|
+
readonly exec?: false;
|
|
50
|
+
}): string;
|
|
51
|
+
/** computer_script's executor over the script `prelude` (scriptPreludeOf): each script in its own isolate, its
|
|
52
|
+
* computer calls through the call's hands, the shell's and the files' held to `guard`. */
|
|
53
|
+
export declare function computerScriptExecutor(prelude: string, guard: ScriptGuard): Executor;
|
|
@@ -14,26 +14,38 @@ export const SCRIPT_DEFAULT_MS = 120_000;
|
|
|
14
14
|
export const SCRIPT_MAX_MS = 600_000;
|
|
15
15
|
/** The isolate's memory. */
|
|
16
16
|
const SCRIPT_MEMORY_BYTES = 256 * 1024 * 1024;
|
|
17
|
-
/** The
|
|
17
|
+
/** The tool a script's computer call is held to, as the run's own tool of that name is: the shell is bash's, a program
|
|
18
|
+
* started to run on (processes.start) bash_background's (bash's setting, and a read-only bash policy refuses it), a
|
|
18
19
|
* file's write is write's, a file's read, listing or stat is read's. The other ops (looking, acting) are the computer
|
|
19
20
|
* kind's, which the call of computer_script or codemode was already held to. */
|
|
20
|
-
const HELD_AS = Object.freeze({ "shell.run": "bash", "files.write": "write", "files.read": "read", "files.list": "read", "files.stat": "read" });
|
|
21
|
+
const HELD_AS = Object.freeze({ "shell.run": "bash", "processes.start": "bash_background", "files.write": "write", "files.read": "read", "files.list": "read", "files.stat": "read" });
|
|
22
|
+
/** The ops whose command runs in the computer's shell: each gets the bash policy's safeguards. */
|
|
23
|
+
const SHELL_OPS = new Set(["shell.run", "processes.start"]);
|
|
24
|
+
/** What each held op does, as a refusal says it could not. */
|
|
25
|
+
const DOES = Object.freeze({ "shell.run": "run a shell command", "processes.start": "start a program", "files.write": "write a file", "files.read": "read a file", "files.list": "list a folder", "files.stat": "look a file up" });
|
|
26
|
+
/** The setting a person sees for each held tool: bash_background is bash's. */
|
|
27
|
+
const SETTING = Object.freeze({ bash: "bash", bash_background: "bash", write: "write", read: "read" });
|
|
28
|
+
/** What waits for a person's OK under each setting, in a person's words. */
|
|
29
|
+
const WAITS = Object.freeze({ bash: "shell commands", write: "file writes", read: "file reads" });
|
|
21
30
|
/** What a script's `computer.shell` and `computer.files` are held to: the run's gate, which a person's settings (a denied
|
|
22
31
|
* bash, a read-only bash policy, a denied write) reach through the one decision the run's own tools get. A script can't
|
|
23
32
|
* stop to ask, so a call the gate would ask about is refused in words that send the model to the tool itself. Until a
|
|
24
33
|
* gate is installed (the spec installs it once built) every one of those calls is refused. */
|
|
25
34
|
export class ScriptGuard {
|
|
26
35
|
shell;
|
|
36
|
+
kind;
|
|
27
37
|
#decide;
|
|
28
38
|
/** `shell`: what the run's bash adds under its bash policy (bash-read-only.ts policyEnv, policyPrelude): the environment
|
|
29
|
-
* that locks git's config down, set over any a script gives, and the line that runs git only at the floor version.
|
|
30
|
-
|
|
39
|
+
* that locks git's config down, set over any a script gives, and the line that runs git only at the floor version.
|
|
40
|
+
* `kind`: the run's computer's kind, which a refusal names (the phone, the desktop). */
|
|
41
|
+
constructor(shell = { env: {}, prelude: "" }, kind) {
|
|
31
42
|
this.shell = shell;
|
|
43
|
+
this.kind = kind;
|
|
32
44
|
}
|
|
33
45
|
/** `op`'s arguments as the computer is sent them: a script's shell command with the policy's safeguards, as the bash
|
|
34
46
|
* tool's own command has them, which no option of the script's overrides. */
|
|
35
47
|
shaped(op, args) {
|
|
36
|
-
if (op
|
|
48
|
+
if (!SHELL_OPS.has(op))
|
|
37
49
|
return args;
|
|
38
50
|
const given = (args ?? {});
|
|
39
51
|
const env = { ...(given.env ?? {}), ...this.shell.env };
|
|
@@ -42,20 +54,31 @@ export class ScriptGuard {
|
|
|
42
54
|
install(decide) {
|
|
43
55
|
this.#decide = decide;
|
|
44
56
|
}
|
|
45
|
-
/** Why `op` with `args` may not run now, or undefined when the gate lets it.
|
|
57
|
+
/** Why `op` with `args` may not run now, or undefined when the gate lets it. The words start with what could not be
|
|
58
|
+
* done, on which computer ("could not run a shell command on the phone"), as the Timeline's row shows them; an ask
|
|
59
|
+
* says why in a person's words and what to do instead. A phone's instead is its screen, named as the script's
|
|
60
|
+
* `computer` (script.ts bindComputer) and the run's tools name it: the run's bash tool does not run on a phone, so it
|
|
61
|
+
* is never offered there. */
|
|
46
62
|
async refusal(op, args) {
|
|
47
63
|
const tool = HELD_AS[op];
|
|
48
64
|
if (tool === undefined)
|
|
49
65
|
return undefined;
|
|
66
|
+
const on = this.kind === "phone" ? "the phone" : this.kind === "desktop" ? "the desktop" : "the computer";
|
|
67
|
+
const couldNot = `could not ${DOES[op] ?? op} on ${on}`;
|
|
50
68
|
if (!this.#decide)
|
|
51
|
-
return
|
|
69
|
+
return `${couldNot}: this run's tool settings are not attached to its scripts yet`;
|
|
52
70
|
const given = (args ?? {});
|
|
53
|
-
const decision = await this.#decide(tool,
|
|
71
|
+
const decision = await this.#decide(tool, SHELL_OPS.has(op) ? { command: given.command, ...(given.cwd !== undefined ? { cwd: given.cwd } : {}) } : { path: given.path });
|
|
54
72
|
if (decision === "allow")
|
|
55
73
|
return undefined;
|
|
56
|
-
if (decision
|
|
57
|
-
return
|
|
58
|
-
|
|
74
|
+
if (decision !== "ask")
|
|
75
|
+
return `${couldNot}: ${decision.deny}`;
|
|
76
|
+
const setting = SETTING[tool] ?? tool;
|
|
77
|
+
const why = `this agent's ${WAITS[setting] ?? `${setting} calls`} wait for a person's OK (its ${setting} setting is ask), and a script can't stop to ask.`;
|
|
78
|
+
const instead = this.kind === "phone"
|
|
79
|
+
? `Do it on the phone's screen instead: in a script, computer.app(id).observe() reads it and its press, type and click act on it (or call the computer_observe and computer_act tools), or ask the agent's owner to set ${setting} to allow.`
|
|
80
|
+
: `Call the ${tool} tool itself, which can ask, or ask the agent's owner to set ${setting} to allow.`;
|
|
81
|
+
return `${couldNot}: ${why} ${instead}`;
|
|
59
82
|
}
|
|
60
83
|
/** `call` of the computer's port with a script's computer call held to the gate first: the refusal throws in the
|
|
61
84
|
* script, where its `await` is. */
|
|
@@ -93,10 +116,21 @@ function answerOf(output, value) {
|
|
|
93
116
|
words.push(typeof value === "string" ? value : JSON.stringify(withoutImageData(value)));
|
|
94
117
|
return { text: words.join("\n") || "(the script returned nothing and showed nothing)", images: [...imagesIn(value), ...shown] };
|
|
95
118
|
}
|
|
96
|
-
/**
|
|
97
|
-
|
|
98
|
-
|
|
119
|
+
/** What a script that reaches for a shell is told when its agent's computer has exec off. */
|
|
120
|
+
export const NO_PROGRAMS_WORDS = "this agent's computer runs no programs: its exec setting is off, so its scripts have no computer.shell and no computer.processes. Drive it through what it shows: its screen, its input and its apps.";
|
|
121
|
+
/** The one line that binds `computer` in a script for a computer that is `card` (the surface's scriptPrelude). With
|
|
122
|
+
* `exec: false` (the agent's setting, run-tools.ts AgentComputer) the card has no exec or processes group, so
|
|
123
|
+
* `computer.shell` and `computer.processes` are absent, and reaching for either throws NO_PROGRAMS_WORDS instead of a
|
|
124
|
+
* bare TypeError: `computer` is the surface's own object behind a Proxy whose get refuses those two names. */
|
|
125
|
+
export function scriptPreludeOf(card, options = {}) {
|
|
99
126
|
const prelude = scriptPrelude(card);
|
|
127
|
+
if (options.exec !== false)
|
|
128
|
+
return prelude;
|
|
129
|
+
return `const computer = ((bound) => new Proxy(bound, { get(target, key, receiver) { if (key === "shell" || key === "processes") throw new Error(${JSON.stringify(NO_PROGRAMS_WORDS)}); return Reflect.get(target, key, receiver); } }))((() => { ${prelude} return computer; })());`;
|
|
130
|
+
}
|
|
131
|
+
/** computer_script's executor over the script `prelude` (scriptPreludeOf): each script in its own isolate, its
|
|
132
|
+
* computer calls through the call's hands, the shell's and the files' held to `guard`. */
|
|
133
|
+
export function computerScriptExecutor(prelude, guard) {
|
|
100
134
|
return async (args, call) => {
|
|
101
135
|
const { code, timeoutMs } = (args ?? {});
|
|
102
136
|
if (typeof code !== "string" || code.trim() === "")
|
|
@@ -13,9 +13,9 @@ export { readOnlyWorkspace, SERVER_READS_ONLY, serverRunWorkspace, type ServerRu
|
|
|
13
13
|
export { type LedgerEntry, type ProviderLedger, storeLedger } from "./computer-ledger.js";
|
|
14
14
|
export { type LearningPlace, type LearningWorkspace, learningWorkspace, type LearningWorkspaceOptions } from "./learning-workspace.js";
|
|
15
15
|
export { ARCHIL_MAX_EXEC_S, handsOf, MAX_EXEC_S, processesOf, shellEnv } from "./hands.js";
|
|
16
|
-
export { type RunComputer, type RunHold, runTools, type RunTools, type ScriptComputer, withKindTools } from "./run-tools.js";
|
|
16
|
+
export { type AgentComputer, type RunComputer, type RunHold, runTools, type RunTools, type ScriptComputer, withKindTools } from "./run-tools.js";
|
|
17
17
|
export { portOf } from "./computer-ports.js";
|
|
18
|
-
export { computerScriptExecutor, SCRIPT_DEFAULT_MS, SCRIPT_MAX_MS, ScriptGuard, type ScriptDecide } from "./computer-script.js";
|
|
18
|
+
export { computerScriptExecutor, NO_PROGRAMS_WORDS, SCRIPT_DEFAULT_MS, SCRIPT_MAX_MS, ScriptGuard, type ScriptDecide, scriptPreludeOf } from "./computer-script.js";
|
|
19
19
|
export { COMPUTER_MCP_NAME, computerMcp, type ComputerMcpAnswer, mcpAnswerOf } from "./computer-mcp.js";
|
|
20
20
|
export { type ClaimSide, computerReadiness, type ComputerSetting, type KindRegistry, type LaunchedComputer, type Port, resolveComputer, type ResolvedComputer, runShellOf, type ShellPlace, shellPlaceOf, type StartedComputer, } from "./resolve-computer.js";
|
|
21
21
|
export { computerProviderFactories, computerProviderMakers, type ProviderLoad } from "./computer-providers.js";
|
package/dist/workspace/index.js
CHANGED
|
@@ -16,7 +16,7 @@ export { learningWorkspace } from "./learning-workspace.js";
|
|
|
16
16
|
export { ARCHIL_MAX_EXEC_S, handsOf, MAX_EXEC_S, processesOf, shellEnv } from "./hands.js";
|
|
17
17
|
export { runTools, withKindTools } from "./run-tools.js";
|
|
18
18
|
export { portOf } from "./computer-ports.js";
|
|
19
|
-
export { computerScriptExecutor, SCRIPT_DEFAULT_MS, SCRIPT_MAX_MS, ScriptGuard } from "./computer-script.js";
|
|
19
|
+
export { computerScriptExecutor, NO_PROGRAMS_WORDS, SCRIPT_DEFAULT_MS, SCRIPT_MAX_MS, ScriptGuard, scriptPreludeOf } from "./computer-script.js";
|
|
20
20
|
export { COMPUTER_MCP_NAME, computerMcp, mcpAnswerOf } from "./computer-mcp.js";
|
|
21
21
|
export { computerReadiness, resolveComputer, runShellOf, shellPlaceOf, } from "./resolve-computer.js";
|
|
22
22
|
export { computerProviderFactories, computerProviderMakers } from "./computer-providers.js";
|
|
@@ -77,6 +77,13 @@ const title = notes.elements.find((node) => node.role === "textbox" && node.name
|
|
|
77
77
|
screenshot pixels (`computer.screen.shot()`), for what one app's window can't reach: a drag from one app to another (a
|
|
78
78
|
file from Finder into a Mail message), or anything outside every window.
|
|
79
79
|
|
|
80
|
+
**Only the tools you were given.** An agent's computer setting may leave some out: a code-only agent has its script
|
|
81
|
+
tool and no `computer_observe`, `computer_act` or `computer_screenshot`; a tools-only agent has those and no script
|
|
82
|
+
tool; an agent whose exec is off has no `computer.shell`, no `computer.processes` and no bash. Where the desktop has
|
|
83
|
+
the `apps` group a script opens apps with `computer.apps`, and on a desktop with no ui group the tools open the app they
|
|
84
|
+
name (below); otherwise it uses the desktop's own launcher through the screen.
|
|
85
|
+
Use what your tool list shows.
|
|
86
|
+
|
|
80
87
|
## How to work: observe, then act by ref, then check
|
|
81
88
|
|
|
82
89
|
1. **Observe** the app first. Find your target by its name and role, and note its ref.
|
|
@@ -110,6 +117,12 @@ are raw input at its pixels: `click`, `type`, `key`, `scroll` and `drag` at poin
|
|
|
110
117
|
expect. `press`, `set` and `perform` are refused. Take the points from the latest screenshot, aim at the middle of a
|
|
111
118
|
target, and take another screenshot to see what your steps did. Click a field before typing into it.
|
|
112
119
|
|
|
120
|
+
Open an app from a script with `computer.apps.open("mousepad")`, by its id, its name or its program: it answers once
|
|
121
|
+
the app's window shows in front, and the app stays open. `computer.apps.list()` names the apps the desktop has (the
|
|
122
|
+
text editor, the terminal, Firefox). With the tools, name the app: `computer_observe` or `computer_act` with
|
|
123
|
+
`app: "org.xfce.mousepad"` opens it, or brings it in front, first. A screenshot with no app in front lists the ids. `computer.shell.run` ends everything its command started when it returns, so an
|
|
124
|
+
app it starts closes at once; `computer.processes.start` keeps a program that is not one of the listed apps.
|
|
125
|
+
|
|
113
126
|
## Habits that work
|
|
114
127
|
|
|
115
128
|
- **The keyboard is exact.** `super+a` (Mac) or `ctrl+a` selects all, `escape` closes a menu or a dialog, `enter`
|
|
@@ -73,6 +73,10 @@ const about = page.elements.find((node) => node.name === "About phone");
|
|
|
73
73
|
screenshot pixels, for what the app's window can't reach: a swipe from the screen's top edge opens the notification
|
|
74
74
|
shade (`{ type: "swipe", path: [[540, 5], [540, 1200]] }`), and anything outside the app.
|
|
75
75
|
|
|
76
|
+
**Only the tools you were given.** An agent's computer setting may leave some out: a code-only agent has its script
|
|
77
|
+
tool and no `computer_observe`, `computer_act` or `computer_screenshot`; a tools-only agent has those and no script
|
|
78
|
+
tool; an agent whose exec is off has no shell of any kind. Use what your tool list shows.
|
|
79
|
+
|
|
76
80
|
## How to work: observe, then act by ref, then check
|
|
77
81
|
|
|
78
82
|
1. **Observe** first. Find your target by its name, role or id, and note its ref. A list row is often an unnamed
|
package/dist/workspace/local.js
CHANGED
|
@@ -522,8 +522,8 @@ class LocalWorkspace {
|
|
|
522
522
|
* through can be let go. */
|
|
523
523
|
static #searchIn(job, timeMs) {
|
|
524
524
|
return new Promise((resolve, reject) => {
|
|
525
|
-
// No process flags: the worker needs none, and some it would inherit refuse a worker started from a file (
|
|
526
|
-
//
|
|
525
|
+
// No process flags: the worker needs none, and some it would inherit refuse a worker started from a file (a
|
|
526
|
+
// process started with `--input-type=module -e`).
|
|
527
527
|
const worker = new Worker(GREP_WORKER, { workerData: job, execArgv: [] });
|
|
528
528
|
const matches = [];
|
|
529
529
|
let done;
|
|
@@ -8,14 +8,26 @@ import type { Workspace } from "./workspace.js";
|
|
|
8
8
|
* provider of the kind registry: the computer module's own types. Where a run's shell is: the kernel registry's. */
|
|
9
9
|
export type { ComputerSettingKind, KindCapabilities, ProviderEntry, ShellPlace };
|
|
10
10
|
/** An agent's computer setting. `image`: the one of the provider's configurations it selects; absent, the default. A
|
|
11
|
-
* sandbox's may ask for GPUs. `persistent`: the agent keeps its own computer between runs (agent-computer.ts).
|
|
11
|
+
* sandbox's may ask for GPUs. `persistent`: the agent keeps its own computer between runs (agent-computer.ts). A
|
|
12
|
+
* desktop's or a phone's `surface` and `exec` go to the run's tools on the RunComputer (run-tools.ts); `exec: false`
|
|
13
|
+
* also mounts no folder in it and gives the run no shell. */
|
|
12
14
|
export type ComputerSetting = {
|
|
13
15
|
readonly kind: string;
|
|
14
16
|
readonly provider?: string | null;
|
|
15
17
|
readonly image?: string;
|
|
16
18
|
readonly gpu?: GpuSpec;
|
|
17
19
|
readonly persistent?: boolean;
|
|
20
|
+
readonly surface?: "code" | "tools";
|
|
21
|
+
readonly exec?: boolean;
|
|
18
22
|
};
|
|
23
|
+
/** Whether a computer (or its setting) takes its agent's programs away: `exec: false`. Only a desktop or a phone takes
|
|
24
|
+
* `exec` (computer-setting.ts refuses it on any other kind at save), so a computer without programs is one of those. */
|
|
25
|
+
export declare const noPrograms: <C extends {
|
|
26
|
+
readonly kind: string;
|
|
27
|
+
readonly exec?: boolean;
|
|
28
|
+
}>(computer: C | undefined) => computer is Extract<C, {
|
|
29
|
+
readonly kind: "desktop" | "phone";
|
|
30
|
+
}>;
|
|
19
31
|
/** The computer module's kind registry (src/kinds.ts), by its own names: the setting kinds, why a machine does not serve
|
|
20
32
|
* one (servingRefusals, whose words a refusal here carries), and the providers. */
|
|
21
33
|
export type KindRegistry = {
|
|
@@ -103,6 +115,14 @@ export declare const vendorNetworkOnly: (network: readonly string[] | undefined)
|
|
|
103
115
|
/** Whether a provider's computers can't have no network: it declares its network forms and "none" isn't one (a cloud
|
|
104
116
|
* phone, a hosted browser, Local Chrome). */
|
|
105
117
|
export declare const needsNetwork: (network: readonly string[] | undefined) => boolean;
|
|
118
|
+
/** A provider's label after its article, as it is said: "a Modal", "an E2B" (every label is said by its first letter's
|
|
119
|
+
* sound). `start`: at a sentence's start, "A"/"An". */
|
|
120
|
+
export declare const aLabel: (label: string, start?: boolean) => string;
|
|
121
|
+
/** Why a sandbox or a desktop that would mount the owner's Archil disk can't start in Mode 2: the mount needs Archil's
|
|
122
|
+
* image in the owner's own vendor account, and this server can't put it there yet (E2B Desktop's template has none, and
|
|
123
|
+
* Agent37's agentrun-box is in no owner's workspace). Settings (computers.ts modeRefusal) and a run's start
|
|
124
|
+
* (computerReadiness) say it. */
|
|
125
|
+
export declare const mode2ArchilWhy: (label: string, kind: "sandbox" | "desktop") => string;
|
|
106
126
|
/** Why a computer that needs a network is refused where this server's AGENTRUN_BOX_ALLOW is none, in words that name the
|
|
107
127
|
* fix: the operator said no network at all, and the computer can't run without one. */
|
|
108
128
|
export declare const noNetworkRefusal: (label: string, kind: string) => string;
|
|
@@ -23,6 +23,9 @@ import { configurationOf, imagesOf } from "@parcha/agentrun-computer";
|
|
|
23
23
|
import { noDockerWords } from "../docker-daemon.js";
|
|
24
24
|
import { gpuRefused } from "../gpu-words.js";
|
|
25
25
|
import { recordedClient } from "../computer-calls.js";
|
|
26
|
+
/** Whether a computer (or its setting) takes its agent's programs away: `exec: false`. Only a desktop or a phone takes
|
|
27
|
+
* `exec` (computer-setting.ts refuses it on any other kind at save), so a computer without programs is one of those. */
|
|
28
|
+
export const noPrograms = (computer) => computer?.exec === false;
|
|
26
29
|
/** A provider's keys as the claim reads them: each key its registry entry declares, by `keyOf` (the server's reader:
|
|
27
30
|
* key-meta.ts keyReader, the environment's value, else the saved one); a key with no value is left out. */
|
|
28
31
|
export const providerKeys = (registry, keyOf) => async (provider) => {
|
|
@@ -40,9 +43,17 @@ export const vendorNetworkOnly = (network) => network !== undefined && network.l
|
|
|
40
43
|
/** Whether a provider's computers can't have no network: it declares its network forms and "none" isn't one (a cloud
|
|
41
44
|
* phone, a hosted browser, Local Chrome). */
|
|
42
45
|
export const needsNetwork = (network) => network !== undefined && network.length > 0 && !network.includes("none");
|
|
46
|
+
/** A provider's label after its article, as it is said: "a Modal", "an E2B" (every label is said by its first letter's
|
|
47
|
+
* sound). `start`: at a sentence's start, "A"/"An". */
|
|
48
|
+
export const aLabel = (label, start = false) => `${start ? "A" : "a"}${/^[AEIOU]/i.test(label) ? "n" : ""} ${label}`;
|
|
49
|
+
/** Why a sandbox or a desktop that would mount the owner's Archil disk can't start in Mode 2: the mount needs Archil's
|
|
50
|
+
* image in the owner's own vendor account, and this server can't put it there yet (E2B Desktop's template has none, and
|
|
51
|
+
* Agent37's agentrun-box is in no owner's workspace). Settings (computers.ts modeRefusal) and a run's start
|
|
52
|
+
* (computerReadiness) say it. */
|
|
53
|
+
export const mode2ArchilWhy = (label, kind) => `${aLabel(label, true)} ${kind} can't start in Mode 2 yet: it needs Archil's image in your ${label} account, and this server can't put it there yet. Set this agent's computer to none (${SETTINGS})`;
|
|
43
54
|
/** Why a computer that needs a network is refused where this server's AGENTRUN_BOX_ALLOW is none, in words that name the
|
|
44
55
|
* fix: the operator said no network at all, and the computer can't run without one. */
|
|
45
|
-
export const noNetworkRefusal = (label, kind) => `This agent's computer is
|
|
56
|
+
export const noNetworkRefusal = (label, kind) => `This agent's computer is ${aLabel(label)} ${kind}, which needs a network (the vendor's own, or public addresses from this machine), and this server's AGENTRUN_BOX_ALLOW is none (no network): pick a computer that runs with no network in ${SETTINGS}, or set AGENTRUN_BOX_ALLOW to a host list.`;
|
|
46
57
|
/** Whether an agent's computer `setting` can be had in `mode` now, by the answers the claim gives (resolveComputer: the
|
|
47
58
|
* kind, the provider and what it serves, the mode's mount, the provider's keys by `keyOf`): ok, or its refusal in words
|
|
48
59
|
* that name the fix. Nothing starts. A run's start asks it before the run is made (runnable.ts).
|
|
@@ -68,13 +79,15 @@ export async function computerReadiness(setting, mode, registry, keyOf, answers,
|
|
|
68
79
|
if ("refused" in resolved)
|
|
69
80
|
return { refused: resolved.refused };
|
|
70
81
|
const entry = registry.PROVIDERS.find((one) => one.id === resolved.provider);
|
|
82
|
+
if (mode === 2 && (resolved.kind === "sandbox" || resolved.kind === "desktop") && resolved.mounts && entry)
|
|
83
|
+
return { refused: `${mode2ArchilWhy(entry.label, resolved.kind)}.` };
|
|
71
84
|
if (entry && entry.mounts.includes("bind") && answers) {
|
|
72
85
|
const said = await answers(entry.id);
|
|
73
86
|
// It names the box whose probe said no (a refusal's details.box), as the box check did.
|
|
74
87
|
if (!said.up && said.absent)
|
|
75
88
|
return { refused: noDockerWords(resolved.kind, registry.PROVIDERS, mode), box: entry.id };
|
|
76
89
|
if (!said.up)
|
|
77
|
-
return { refused: `This agent's computer is
|
|
90
|
+
return { refused: `This agent's computer is ${aLabel(entry.label)} ${resolved.kind}, and this server cannot run it: ${said.reason.replace(/[.!?]+$/, "")}.`, box: entry.id };
|
|
78
91
|
}
|
|
79
92
|
const host = entry ? hostWhy?.(entry.id) : undefined;
|
|
80
93
|
if (host)
|
|
@@ -138,6 +151,9 @@ export function runShellOf(setting, mode, registry) {
|
|
|
138
151
|
const serving = selectedOf(servingOf(registry, entry, kind), setting, entry, kind);
|
|
139
152
|
if (serving.length === 0)
|
|
140
153
|
return "none";
|
|
154
|
+
// An agent whose computer runs no programs of its own has no shell anywhere: not its computer's, not Archil's exec.
|
|
155
|
+
if (noPrograms(setting))
|
|
156
|
+
return "none";
|
|
141
157
|
const mounts = mountsFolder(kind, entry, serving, mode);
|
|
142
158
|
if (kind === "sandbox" && !mounts)
|
|
143
159
|
return "none";
|
|
@@ -211,14 +227,15 @@ export async function resolveComputer(given, mode, registry, side) {
|
|
|
211
227
|
return { refused: `${entry.label} has no ${kind} image ${JSON.stringify(setting.image)}. It ${offers} for this agent's computer in ${SETTINGS}.` };
|
|
212
228
|
}
|
|
213
229
|
// The run's folder: mounted where the selected configuration has files and exec and the provider mounts the mode's
|
|
214
|
-
// folder.
|
|
215
|
-
const mounts = mountsFolder(kind, entry, [configuration], mode);
|
|
230
|
+
// folder, and the agent may run programs there (a folder is mounted for its shell).
|
|
231
|
+
const mounts = !noPrograms(setting) && mountsFolder(kind, entry, [configuration], mode);
|
|
216
232
|
if (kind === "sandbox" && !mounts) {
|
|
217
233
|
if (mode === 1)
|
|
218
|
-
return { refused: `Mode 1 runs a sandbox only on Docker:
|
|
234
|
+
return { refused: `Mode 1 runs a sandbox only on Docker: ${aLabel(entry.label)} sandbox can't reach the run's folder on this machine. Pick Docker for this agent's computer in ${SETTINGS}, or another kind of computer.` };
|
|
219
235
|
if (entry.mounts.includes("bind"))
|
|
220
236
|
return { refused: `Mode 2 keeps workspaces on Archil; a local Docker computer can't mount them. Pick a remote sandbox for this agent's computer in ${SETTINGS}, or no computer.` };
|
|
221
|
-
|
|
237
|
+
const why = entry.unmounted?.archil;
|
|
238
|
+
return { refused: `${aLabel(entry.label, true)} sandbox can't mount the run's folder from Archil${why ? ` (${why})` : ""}: pick another sandbox for this agent's computer in ${SETTINGS}.` };
|
|
222
239
|
}
|
|
223
240
|
// Its GPUs, a sandbox's alone: in gpuRefused's words, against what the configuration the setting selected declares,
|
|
224
241
|
// with the mode's folder as the mount it takes (a sandbox here always mounts it). A GPU computer that can't mount the
|
|
@@ -229,15 +246,15 @@ export async function resolveComputer(given, mode, registry, side) {
|
|
|
229
246
|
if (refused?.folder)
|
|
230
247
|
return { refused: refused.words };
|
|
231
248
|
if (refused)
|
|
232
|
-
return { refused:
|
|
249
|
+
return { refused: `${aLabel(entry.label, true)} sandbox can't have this agent's GPUs: ${refused.words}. Change the GPUs or the provider for this agent's computer in ${SETTINGS}.` };
|
|
233
250
|
}
|
|
234
251
|
// The agent's own computer, kept between its runs: only where the configuration keeps one, and never one that mounts
|
|
235
252
|
// the run's folder (a later run would find an earlier run's folder in it).
|
|
236
253
|
const persistent = setting.persistent === true;
|
|
237
254
|
if (persistent && configuration.persistence === undefined)
|
|
238
|
-
return { refused:
|
|
255
|
+
return { refused: `${aLabel(entry.label, true)} ${kind} keeps no computer for an agent between runs (it declares no persistence): turn persistent off, or pick a computer that keeps one, for this agent's computer in ${SETTINGS}.` };
|
|
239
256
|
if (persistent && mounts)
|
|
240
|
-
return { refused:
|
|
257
|
+
return { refused: `${aLabel(entry.label, true)} ${kind} mounts each run's folder, so it can't be kept between runs: turn persistent off for this agent's computer in ${SETTINGS}.` };
|
|
241
258
|
// Its keys: every required one saved, before anything starts; only declared names go to the provider.
|
|
242
259
|
const saved = await side.keysOf(entry.id);
|
|
243
260
|
const has = (name) => typeof saved[name] === "string" && saved[name] !== "";
|
|
@@ -267,7 +284,7 @@ export async function resolveComputer(given, mode, registry, side) {
|
|
|
267
284
|
throw unavailable(noDockerWords(kind, registry.PROVIDERS, mode));
|
|
268
285
|
throw unavailable(`${entry.label} could not start a ${kind} computer: ${error instanceof Error ? error.message : String(error)}`);
|
|
269
286
|
}
|
|
270
|
-
const computer = runComputerOf(kind, launched, mounts ? check : undefined);
|
|
287
|
+
const computer = runComputerOf(kind, launched, mounts ? check : undefined, { ...(setting.surface ? { surface: setting.surface } : {}), ...(noPrograms(setting) ? { exec: false } : {}) });
|
|
271
288
|
if (typeof computer === "string") {
|
|
272
289
|
await launched.release();
|
|
273
290
|
throw unavailable(`${entry.label} could not start a ${kind} computer: ${computer}`);
|
|
@@ -276,8 +293,9 @@ export async function resolveComputer(given, mode, registry, side) {
|
|
|
276
293
|
},
|
|
277
294
|
};
|
|
278
295
|
}
|
|
279
|
-
/** The started computer as runTools takes it, or what it lacks, in words.
|
|
280
|
-
|
|
296
|
+
/** The started computer as runTools takes it, or what it lacks, in words. `agent`: a desktop's or a phone's surface and
|
|
297
|
+
* exec, as its agent's setting says them. */
|
|
298
|
+
function runComputerOf(kind, launched, check, agent) {
|
|
281
299
|
// The run's browser tool opens a browser's sessions through its provider.
|
|
282
300
|
if (kind === "browser")
|
|
283
301
|
return launched.browser ? { kind, browser: launched.browser } : "it gave no CDP connection";
|
|
@@ -287,12 +305,12 @@ function runComputerOf(kind, launched, check) {
|
|
|
287
305
|
// Each call the agent's tools make is recorded on the tool call's row (computer-calls.ts): the run's one client.
|
|
288
306
|
const client = recordedClient(launched.client);
|
|
289
307
|
if (kind === "phone")
|
|
290
|
-
return hello ? { kind, computer: { client }, hello } : "it gave no hello";
|
|
308
|
+
return hello ? { kind, computer: { client }, hello, ...agent } : "it gave no hello";
|
|
291
309
|
if (check && !launched.readBack)
|
|
292
310
|
return "it gave no read-back of its mount";
|
|
293
311
|
const readBack = launched.readBack ? () => launched.readBack() : async () => ({ ok: false, error: { code: "unsupported", message: "nothing is mounted in this computer" } });
|
|
294
312
|
const computer = { id: launched.id, client, readBack };
|
|
295
313
|
if (kind === "sandbox")
|
|
296
314
|
return check ? { kind, computer, check } : "a sandbox mounts the run's folder";
|
|
297
|
-
return hello ? { kind, computer, hello, ...(check ? { check } : {}) } : "it gave no hello";
|
|
315
|
+
return hello ? { kind, computer, hello, ...(check ? { check } : {}), ...agent } : "it gave no hello";
|
|
298
316
|
}
|
|
@@ -25,31 +25,45 @@ export type RunComputer = {
|
|
|
25
25
|
readonly kind: "sandbox";
|
|
26
26
|
readonly computer: AttachableComputer;
|
|
27
27
|
readonly check: MountCheck;
|
|
28
|
-
} | {
|
|
28
|
+
} | ({
|
|
29
29
|
readonly kind: "desktop";
|
|
30
30
|
readonly computer: AttachableComputer;
|
|
31
31
|
readonly hello: HelloResult;
|
|
32
32
|
readonly check?: MountCheck;
|
|
33
|
-
} | {
|
|
33
|
+
} & AgentComputer) | ({
|
|
34
34
|
readonly kind: "phone";
|
|
35
35
|
readonly computer: {
|
|
36
36
|
readonly client: ComputerClient;
|
|
37
37
|
};
|
|
38
38
|
readonly hello: HelloResult;
|
|
39
|
-
} | {
|
|
39
|
+
} & AgentComputer) | {
|
|
40
40
|
readonly kind: "browser";
|
|
41
41
|
readonly browser: ClaimBrowser;
|
|
42
42
|
};
|
|
43
|
+
/** What a desktop's or a phone's agent may do with it, as its computer setting says (computer-setting.ts): `surface`,
|
|
44
|
+
* how it drives it ("code": a script tool and the hand-over; "tools": the per-step tools and the hand-over; absent,
|
|
45
|
+
* both: surfaceKeeps); `exec: false`, no program of its own on it: its card and surface are made from its hello with
|
|
46
|
+
* the exec and processes groups taken out, so no tool and no script has a shell, and the run has no bash family
|
|
47
|
+
* anywhere (shell "none"). Only the agent's: the run's own computer channel (computer-channel.ts loopComputerOf, the
|
|
48
|
+
* owner's POST /runs/{id}/computer/call) keeps the computer's whole hello. */
|
|
49
|
+
export type AgentComputer = {
|
|
50
|
+
readonly surface?: "code" | "tools";
|
|
51
|
+
readonly exec?: false;
|
|
52
|
+
};
|
|
43
53
|
/** A desktop's or a phone's port as a person's hold on the computer gives it back: each look or act made while the
|
|
44
54
|
* person holds it waits for hand-back; a look then runs, an act then is refused (the take-over's own words). With it,
|
|
45
55
|
* the agent's ask for the person (`handoff`, computer_request_handoff's port), through the same hold. */
|
|
46
56
|
export type RunHold = (ports: Pick<Hands, "computer">) => Pick<Hands, "computer" | "handoff">;
|
|
47
|
-
/** A desktop's or a phone's surface as a harness's own script runtime binds it (pi's code mode): its card,
|
|
48
|
-
*
|
|
57
|
+
/** A desktop's or a phone's surface as a harness's own script runtime binds it (pi's code mode): its card, the script
|
|
58
|
+
* prelude that builds `computer` from it (computer-script.ts scriptPreludeOf), and the run's port, held by the person's
|
|
59
|
+
* take-over as the tools' is. `declare`: no computer_script is listed to declare `computer` (a code-only computer on a
|
|
60
|
+
* code-mode harness), so the harness's script tool declares it itself. */
|
|
49
61
|
export type ScriptComputer = {
|
|
50
62
|
readonly card: Card;
|
|
51
63
|
readonly port: ComputerPort; /** What the script's shell and files are held to (computer-script.ts ScriptGuard). */
|
|
52
64
|
readonly guard: ScriptGuard;
|
|
65
|
+
readonly prelude: string;
|
|
66
|
+
readonly declare: boolean;
|
|
53
67
|
};
|
|
54
68
|
/** The run's scratch in its own folder: bash's TMPDIR. */
|
|
55
69
|
export declare const TMP_DIR = ".agentrun/tmp";
|
|
@@ -79,7 +93,9 @@ export type RunHands = {
|
|
|
79
93
|
readonly computer_script?: Executor;
|
|
80
94
|
};
|
|
81
95
|
/** A desktop's or a phone's surface for a harness's own script runtime; none for any other computer. */
|
|
82
|
-
readonly computer?: ScriptComputer
|
|
96
|
+
readonly computer?: Omit<ScriptComputer, "declare">;
|
|
97
|
+
/** A desktop's or a phone's surface, as its agent's setting says it (AgentComputer); absent, both. */
|
|
98
|
+
readonly surface?: AgentComputer["surface"];
|
|
83
99
|
/** The run's end, after its background processes are ended and before the computer is let go: bash's full outputs
|
|
84
100
|
* and its TMPDIR swept. */
|
|
85
101
|
sweep(): Promise<void>;
|
|
@@ -89,7 +105,7 @@ export type RunHands = {
|
|
|
89
105
|
* scratch folder), taken as the folder. `hold`: a person's hold on the computer (its take-over), given a desktop's or a
|
|
90
106
|
* phone's ports and answering them wrapped, so a call made while the person holds it waits, and an action then is
|
|
91
107
|
* refused; never the shell's, the files' or a browser's (its take-over is pi-browser's own). */
|
|
92
|
-
export declare function runHands(workspace: Workspace,
|
|
108
|
+
export declare function runHands(workspace: Workspace, claimed: RunComputer | undefined, options: {
|
|
93
109
|
readonly mode: 1 | 2;
|
|
94
110
|
readonly context: Context;
|
|
95
111
|
readonly aliases?: readonly string[];
|
|
@@ -140,13 +156,14 @@ export type RunTools = {
|
|
|
140
156
|
* (computer_observe, computer_act, computer_screenshot, computer_script, computer_request_handoff), by the kernel
|
|
141
157
|
* registry's own list. None with no computer, for
|
|
142
158
|
* a sandbox, or for a browser (its own binding lists its tools). An agent names its computer, never these tools
|
|
143
|
-
* (definition.tools refuses them), so a run binds them beside what it was granted (withKindTools).
|
|
159
|
+
* (definition.tools refuses them), so a run binds them beside what it was granted (withKindTools). Its setting's
|
|
160
|
+
* surface keeps some of them (surfaceKeeps). */
|
|
144
161
|
readonly kindTools: readonly string[];
|
|
145
162
|
/** The registry's tools `names` names, as the kernel's HostTool an adapter's session takes, each call through the
|
|
146
163
|
* run's gate decided before its intent, each answer kept in `results` (bindTools). */
|
|
147
164
|
hostTools(names: readonly string[], results?: ToolResults): HostTool[];
|
|
148
165
|
/** A desktop's or a phone's surface for a harness's own script runtime (pi's code mode binds `computer` over it); none
|
|
149
|
-
* for any other computer. */
|
|
166
|
+
* for any other computer, and none where the run has no script tool (a tools-only computer). */
|
|
150
167
|
readonly computer?: ScriptComputer;
|
|
151
168
|
/** The run's end, before the computer is let go: its background processes ended (TERM, then KILL 3 s later; none with
|
|
152
169
|
* no computer), then bash's full outputs and TMPDIR swept. */
|
|
@@ -166,7 +183,8 @@ export declare function runTools(workspace: Workspace, computer: RunComputer | u
|
|
|
166
183
|
readonly context: Context;
|
|
167
184
|
readonly aliases?: readonly string[];
|
|
168
185
|
readonly hold?: RunHold;
|
|
169
|
-
readonly bashPolicy?: string;
|
|
186
|
+
readonly bashPolicy?: string; /** The harness has its own code mode that binds `computer` (pi). */
|
|
187
|
+
readonly codeMode?: boolean;
|
|
170
188
|
}): Promise<RunTools>;
|
|
171
189
|
/** The names a run binds as host tools: what it was granted, then the tools its claimed computer brings by its kind
|
|
172
190
|
* (RunTools.kindTools), each once. Each goes through the run's one gate under its own settings key (a desktop's under
|