@parcha/agentrun-serve 0.1.0-beta.36 → 0.1.0-beta.37
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 +170 -0
- package/README.md +158 -52
- package/dist/attach-conformance-cli.d.ts +1 -0
- package/dist/attach-conformance-cli.js +18 -0
- package/dist/attach-conformance.d.ts +25 -0
- package/dist/attach-conformance.js +343 -0
- package/dist/browser-cost.d.ts +1 -1
- package/dist/browser-live.d.ts +20 -8
- package/dist/browser-live.js +50 -27
- package/dist/cap.d.ts +0 -17
- package/dist/cap.js +0 -91
- package/dist/catalog.d.ts +1 -12
- package/dist/catalog.js +3 -33
- package/dist/cli.js +13 -4
- package/dist/composio-preset.d.ts +36 -0
- package/dist/composio-preset.js +179 -0
- package/dist/computer-attach.d.ts +125 -0
- package/dist/computer-attach.js +330 -0
- package/dist/computer-calls.d.ts +48 -0
- package/dist/computer-calls.js +126 -0
- package/dist/computer-channel.d.ts +57 -0
- package/dist/computer-channel.js +115 -0
- package/dist/computer-commands.d.ts +1 -1
- package/dist/computer-held-routes.d.ts +35 -0
- package/dist/computer-held-routes.js +106 -0
- package/dist/computer-held.d.ts +48 -0
- package/dist/computer-held.js +87 -0
- package/dist/computer-keys.d.ts +21 -1
- package/dist/computer-keys.js +53 -11
- package/dist/computer-live.d.ts +160 -0
- package/dist/computer-live.js +643 -0
- package/dist/computer-view.d.ts +13 -0
- package/dist/computer-view.js +50 -3
- package/dist/computer-viewer.d.ts +6 -0
- package/dist/computer-viewer.js +297 -0
- package/dist/computers.d.ts +33 -7
- package/dist/computers.js +50 -8
- package/dist/console/assets/index-Cn6JX1uH.js +563 -0
- package/dist/console/assets/index-DRN62V5v.css +1 -0
- package/dist/console/index.html +2 -2
- package/dist/faux-computers.d.ts +9 -20
- package/dist/faux-computers.js +53 -25
- package/dist/github-connection.d.ts +10 -2
- package/dist/github-connection.js +65 -2
- package/dist/github-faux.js +1 -1
- package/dist/graph-view.d.ts +1 -1
- package/dist/harness.d.ts +1 -0
- package/dist/harness.js +35 -1
- package/dist/host-tools.d.ts +1 -1
- package/dist/hosted-search.d.ts +5 -4
- package/dist/hosted-search.js +2 -7
- package/dist/import-sources.d.ts +10 -0
- package/dist/import-sources.js +44 -2
- package/dist/import.d.ts +3 -3
- package/dist/import.js +37 -6
- package/dist/learn/check.d.ts +4 -1
- package/dist/learn/check.js +1 -1
- package/dist/learn/commit.d.ts +4 -2
- package/dist/learn/commit.js +5 -5
- package/dist/learn/folder.d.ts +6 -0
- package/dist/learn/folder.js +4 -1
- package/dist/learn/general.d.ts +66 -0
- package/dist/learn/general.js +73 -0
- package/dist/learn/grade.d.ts +4 -0
- package/dist/learn/grade.js +22 -1
- package/dist/learn/reflect.d.ts +10 -1
- package/dist/learn/reflect.js +14 -4
- package/dist/learn/skills.d.ts +33 -5
- package/dist/learn/skills.js +53 -7
- package/dist/learned-workflow.d.ts +24 -0
- package/dist/learned-workflow.js +66 -3
- package/dist/learning-batch.d.ts +283 -0
- package/dist/learning-batch.js +574 -0
- package/dist/learning-evals.d.ts +33 -0
- package/dist/learning-evals.js +98 -0
- package/dist/learning-routes.d.ts +25 -2
- package/dist/learning-routes.js +39 -6
- package/dist/learning-words.d.ts +6 -0
- package/dist/learning-words.js +6 -0
- package/dist/learning.d.ts +28 -15
- package/dist/learning.js +84 -44
- package/dist/live/stream.js +6 -3
- package/dist/live/translate.d.ts +4 -3
- package/dist/live/translate.js +8 -4
- package/dist/live-reach.d.ts +37 -0
- package/dist/live-reach.js +62 -0
- package/dist/mcp-gateway.d.ts +9 -0
- package/dist/mcp-gateway.js +60 -11
- package/dist/mcp-oauth.d.ts +57 -7
- package/dist/mcp-oauth.js +133 -18
- package/dist/mcp-private-hosts.d.ts +4 -4
- package/dist/mcp-private-hosts.js +20 -12
- package/dist/mcp-probe.d.ts +19 -2
- package/dist/mcp-probe.js +44 -9
- package/dist/mcp-secret-writes.js +4 -0
- package/dist/mcp-servers-store.d.ts +38 -15
- package/dist/mcp-servers-store.js +112 -20
- package/dist/mcp-store.d.ts +10 -4
- package/dist/mcp-store.js +17 -6
- package/dist/model-form.d.ts +26 -0
- package/dist/model-form.js +80 -0
- package/dist/model.js +23 -10
- package/dist/openapi.js +386 -21
- package/dist/page.d.ts +18 -0
- package/dist/page.js +48 -20
- package/dist/paid-calls.d.ts +1 -1
- package/dist/place-offers.d.ts +2 -3
- package/dist/place-offers.js +3 -7
- package/dist/place.js +1 -2
- package/dist/print.d.ts +15 -1
- package/dist/print.js +14 -3
- package/dist/propose.d.ts +3 -0
- package/dist/propose.js +13 -5
- package/dist/provider.js +3 -2
- package/dist/reflect-range.d.ts +8 -1
- package/dist/reflect-range.js +1 -1
- package/dist/run-launch.d.ts +14 -2
- package/dist/run-launch.js +9 -4
- package/dist/run-learning-served.d.ts +2 -2
- package/dist/run-reads-over-store.d.ts +1 -1
- package/dist/run-repo.d.ts +20 -0
- package/dist/run-repo.js +63 -0
- package/dist/run-timeline-served.d.ts +1 -1
- package/dist/run-view.d.ts +3 -3
- package/dist/run-view.js +14 -7
- package/dist/runner/adapter-loop.d.ts +23 -7
- package/dist/runner/adapter-loop.js +648 -62
- package/dist/runner/adapter-run-spec.d.ts +11 -3
- package/dist/runner/adapter-run-spec.js +77 -22
- package/dist/runner/adapters/pi-computer.d.ts +7 -0
- package/dist/runner/adapters/pi-computer.js +43 -0
- package/dist/runner/adapters/pi.d.ts +9 -4
- package/dist/runner/adapters/pi.js +76 -14
- package/dist/runner/beside.d.ts +7 -3
- package/dist/runner/beside.js +21 -11
- package/dist/runner/claim-secrets.d.ts +4 -0
- package/dist/runner/claim-secrets.js +6 -1
- package/dist/runner/cli-run-spec.d.ts +20 -3
- package/dist/runner/cli-run-spec.js +113 -43
- package/dist/runner/commands.d.ts +3 -1
- package/dist/runner/commands.js +28 -3
- package/dist/runner/computer-channel.d.ts +34 -0
- package/dist/runner/computer-channel.js +61 -0
- package/dist/runner/conformance/harness.js +80 -14
- package/dist/runner/conformance/subject.d.ts +1 -1
- package/dist/runner/dispatch.js +3 -0
- package/dist/runner/end-of-run.d.ts +22 -12
- package/dist/runner/end-of-run.js +38 -16
- package/dist/runner/github-app.d.ts +2 -1
- package/dist/runner/github-app.js +4 -2
- package/dist/runner/harness-loops.js +15 -1
- package/dist/runner/held-run.d.ts +65 -0
- package/dist/runner/held-run.js +158 -0
- package/dist/runner/journal-kinds.d.ts +20 -1
- package/dist/runner/journal-kinds.js +14 -0
- package/dist/runner/journal-reader.d.ts +5 -4
- package/dist/runner/journal-reader.js +12 -10
- package/dist/runner/learning-ask.d.ts +7 -1
- package/dist/runner/learning-ask.js +21 -6
- package/dist/runner/learning-dispatch.d.ts +22 -0
- package/dist/runner/learning-dispatch.js +77 -10
- package/dist/runner/learning-end.d.ts +22 -1
- package/dist/runner/learning-end.js +92 -12
- package/dist/runner/learning-factory.d.ts +1 -1
- package/dist/runner/learning-factory.js +11 -5
- package/dist/runner/learning-loop.d.ts +67 -7
- package/dist/runner/learning-loop.js +173 -21
- package/dist/runner/learning-seed.d.ts +7 -0
- package/dist/runner/learning-seed.js +13 -0
- package/dist/runner/live-ticker.js +1 -0
- package/dist/runner/loop-contract.d.ts +8 -1
- package/dist/runner/loop.d.ts +5 -1
- package/dist/runner/loop.js +2 -1
- package/dist/runner/main.d.ts +13 -1
- package/dist/runner/main.js +27 -5
- package/dist/runner/mcp-claim.d.ts +10 -7
- package/dist/runner/mcp-claim.js +113 -24
- package/dist/runner/mcp-github.js +1 -1
- package/dist/runner/mcp-run.d.ts +5 -5
- package/dist/runner/mcp-run.js +15 -3
- package/dist/runner/metrics.d.ts +11 -2
- package/dist/runner/metrics.js +12 -2
- package/dist/runner/pr-checkout.d.ts +1 -0
- package/dist/runner/pr-checkout.js +1 -1
- package/dist/runner/reflect-hook.d.ts +18 -0
- package/dist/runner/reflect-hook.js +20 -8
- package/dist/runner/runner.d.ts +26 -0
- package/dist/runner/runner.js +184 -15
- package/dist/runner/scratch-sweep.d.ts +13 -0
- package/dist/runner/scratch-sweep.js +62 -0
- package/dist/runner/sessions.d.ts +1 -1
- package/dist/runner/store-port.d.ts +4 -2
- package/dist/runner/store-secrets.js +4 -3
- package/dist/runner/subagent.js +3 -1
- package/dist/runner/workflow-host.d.ts +6 -1
- package/dist/runner/workflow-host.js +1 -1
- package/dist/runner/workflow-loop.d.ts +1 -1
- package/dist/runner/workflow-spec.d.ts +14 -2
- package/dist/runner/workflow-spec.js +56 -20
- package/dist/runs-over-store.d.ts +6 -1
- package/dist/runs-over-store.js +38 -9
- package/dist/seal-key.js +3 -3
- package/dist/sealed-settings-store.d.ts +5 -2
- package/dist/sealed-settings-store.js +10 -4
- package/dist/secret-writes.d.ts +5 -4
- package/dist/secret-writes.js +5 -4
- package/dist/server-secrets-store.d.ts +4 -3
- package/dist/server-secrets-store.js +15 -9
- package/dist/server-secrets.js +3 -2
- package/dist/server.d.ts +43 -14
- package/dist/server.js +472 -126
- package/dist/settings-wake.d.ts +21 -0
- package/dist/settings-wake.js +59 -0
- package/dist/standard-webhooks.d.ts +4 -1
- package/dist/standard-webhooks.js +8 -4
- package/dist/store/command-wake.d.ts +12 -0
- package/dist/store/command-wake.js +37 -0
- package/dist/store/dialect.d.ts +6 -0
- package/dist/store/dialect.js +5 -0
- package/dist/store/index.d.ts +1 -1
- package/dist/store/journal/storage.d.ts +3 -2
- package/dist/store/journal/storage.js +13 -5
- package/dist/store/postgres/dialect.js +4 -0
- package/dist/store/postgres/migrations/0005_learning_rounds.sql +14 -0
- package/dist/store/postgres/migrations/0006_run_changes_channel_attempts.sql +57 -0
- package/dist/store/postgres/migrations/0007_viewer_host.sql +11 -0
- package/dist/store/postgres/migrations/0008_paired_computers.sql +30 -0
- package/dist/store/postgres/migrations/0009_commands_answer.sql +10 -0
- package/dist/store/schema.d.ts +1 -1
- package/dist/store/schema.js +77 -8
- package/dist/store/sqlite/run-patch.d.ts +7 -5
- package/dist/store/sqlite/run-patch.js +28 -13
- package/dist/store/sqlite/store.js +272 -54
- package/dist/store/store.d.ts +268 -9
- package/dist/store/store.js +12 -1
- package/dist/store-reads/cap.d.ts +1 -1
- package/dist/store-reads/cap.js +8 -1
- package/dist/store-reads/decisions.d.ts +2 -2
- package/dist/store-reads/decisions.js +1 -1
- package/dist/store-reads/import-summary.d.ts +1 -1
- package/dist/store-reads/journal.d.ts +5 -4
- package/dist/store-reads/journal.js +73 -15
- package/dist/store-reads/learning.d.ts +20 -4
- package/dist/store-reads/learning.js +74 -18
- package/dist/store-reads/runs.d.ts +1 -1
- package/dist/store-reads/workflow.d.ts +1 -1
- package/dist/store-view.d.ts +5 -0
- package/dist/store-view.js +26 -11
- package/dist/template-eval.js +6 -4
- package/dist/template-github-permissions.d.ts +22 -8
- package/dist/template-github-permissions.js +35 -15
- package/dist/timeline/timeline.d.ts +27 -0
- package/dist/timeline/timeline.js +10 -9
- package/dist/timeline/util.d.ts +4 -0
- package/dist/timeline/util.js +14 -0
- package/dist/tool-budget.d.ts +19 -7
- package/dist/tool-budget.js +14 -8
- package/dist/tool-gate.d.ts +16 -9
- package/dist/tool-gate.js +53 -42
- package/dist/tool-plane.d.ts +16 -12
- package/dist/tool-plane.js +9 -4
- package/dist/tools.d.ts +13 -4
- package/dist/tools.js +13 -4
- package/dist/trigger-adapter.d.ts +4 -0
- package/dist/trigger-secrets-shown.d.ts +2 -2
- package/dist/trigger-secrets-shown.js +1 -1
- package/dist/trigger-signatures.d.ts +25 -6
- package/dist/trigger-signatures.js +41 -7
- package/dist/trigger-targets.d.ts +2 -0
- package/dist/trigger-targets.js +1 -0
- package/dist/trigger-webhook.js +5 -2
- package/dist/triggers.d.ts +7 -3
- package/dist/triggers.js +35 -5
- package/dist/turns.js +16 -1
- package/dist/validate.js +11 -1
- package/dist/web-fetch.d.ts +1 -1
- package/dist/web-search.d.ts +10 -5
- package/dist/web-search.js +7 -6
- package/dist/webhooks.d.ts +145 -102
- package/dist/webhooks.js +559 -322
- package/dist/workflow/decisions.d.ts +1 -1
- package/dist/workflow/node-runner.d.ts +2 -1
- package/dist/workflow/node.d.ts +2 -1
- package/dist/workflow/node.js +3 -1
- package/dist/workflow/pi-versions.d.ts +23 -0
- package/dist/workflow/pi-versions.js +57 -0
- package/dist/workflow/record-tool.d.ts +2 -1
- package/dist/workflow/store.d.ts +1 -1
- package/dist/workflow/task.js +3 -2
- package/dist/workflow-run.d.ts +1 -1
- package/dist/workspace/attached-computers.d.ts +41 -0
- package/dist/workspace/attached-computers.js +114 -0
- package/dist/workspace/computer-deps.d.ts +16 -9
- package/dist/workspace/computer-deps.js +19 -7
- package/dist/workspace/computer-for-claim.d.ts +17 -8
- package/dist/workspace/computer-for-claim.js +62 -21
- package/dist/workspace/computer-hold.d.ts +11 -27
- package/dist/workspace/computer-hold.js +36 -56
- package/dist/workspace/computer-ledger.d.ts +3 -1
- package/dist/workspace/computer-ledger.js +4 -0
- package/dist/workspace/computer-mcp.d.ts +25 -0
- package/dist/workspace/computer-mcp.js +41 -0
- package/dist/workspace/computer-ports.d.ts +4 -13
- package/dist/workspace/computer-ports.js +4 -107
- package/dist/workspace/computer-script.d.ts +37 -0
- package/dist/workspace/computer-script.js +138 -0
- package/dist/workspace/executors.d.ts +1 -1
- package/dist/workspace/index.d.ts +4 -2
- package/dist/workspace/index.js +3 -1
- package/dist/workspace/kind-skills/desktop/SKILL.md +119 -84
- package/dist/workspace/kind-skills/phone/SKILL.md +100 -85
- package/dist/workspace/resolve-computer.d.ts +3 -0
- package/dist/workspace/resolve-computer.js +8 -2
- package/dist/workspace/run-tools.d.ts +32 -15
- package/dist/workspace/run-tools.js +23 -30
- package/package.json +19 -16
- package/templates/market-monitor/agent.md +1 -1
- package/dist/console/assets/index-BI4Byidu.js +0 -550
- package/dist/console/assets/index-C19gUF2n.css +0 -1
- package/dist/run-db.d.ts +0 -53
- package/dist/run-db.js +0 -116
- package/dist/workflow/readers.d.ts +0 -36
- package/dist/workflow/readers.js +0 -145
- package/dist/workflow/wal.d.ts +0 -11
- package/dist/workflow/wal.js +0 -106
|
@@ -1,116 +1,131 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: phone-computer
|
|
3
|
-
description: Use a phone (a cloud Android or an iPhone) through
|
|
3
|
+
description: Use a phone (a cloud Android or an iPhone) through computer_observe, computer_act, computer_screenshot and computer_script. It covers reading the screen's elements, acting on them by ref, running known steps as one script, checking what happened, recovering, and what a phone cannot do. Use when a run has a phone and the task needs its screen or apps.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Using a phone
|
|
7
7
|
|
|
8
|
-
The run has a phone, a real one, rented while the run lives.
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
The run has a phone, a real one, rented while the run lives. Where it lists its elements (the `ui` group, an Android's
|
|
9
|
+
today), you read the screen as lines of elements and act on them by their refs. Where it doesn't (an iPhone today), you
|
|
10
|
+
see it through screenshots and act with one finger at their pixels. The tools say which one you have.
|
|
11
11
|
|
|
12
12
|
## The tools
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|---|---|
|
|
16
|
-
| `phone_tree` | Lists what on the screen can be tapped or typed into, one line each: its class, its text or label, its id, whether it is a field (and focused), its **center** (to tap) and its bounds. |
|
|
17
|
-
| `phone_screen` | A screenshot of the whole screen. Its size in pixels is in the answer. |
|
|
18
|
-
| `phone_tap` `{x, y}` | One tap at that point. |
|
|
19
|
-
| `phone_swipe` `{from, to, duration_ms?}` | One finger from `from` to `to` (300 ms by default, at most 10 000). |
|
|
20
|
-
| `phone_type` `{text}` | Types the text into the field that has focus. |
|
|
21
|
-
| `phone_key` `{key}` | Presses `back` (leaves a page, closes a dialog or the keyboard), `home` (the home screen) or `enter` (submits the field in focus). |
|
|
22
|
-
| `phone_apps` | The installed apps by id, and which app is in front. |
|
|
23
|
-
| `phone_open` `{id}` | Opens an app by its id, on its first screen. |
|
|
24
|
-
|
|
25
|
-
**Coordinates are screenshot pixels**, origin top left, `x` to the right and `y` down, in whole numbers.
|
|
26
|
-
`phone_tree`'s centers and bounds are in the same pixels as `phone_screen`. A phone's screen is large (for example
|
|
27
|
-
720 x 1280) and its text is small, so tap a center from the tree rather than a point you estimate from a picture.
|
|
28
|
-
|
|
29
|
-
## The loop: look, act, check, recover
|
|
30
|
-
|
|
31
|
-
1. **Look.** Call `phone_tree` first. Find your target by its text, label or id, and note its center. Take
|
|
32
|
-
`phone_screen` when the tree doesn't settle it: to see layout, images and colours, or to find a node that has no
|
|
33
|
-
name in the tree.
|
|
34
|
-
- A list row is often listed with no name, because the row's title is drawn by something inside it. Match the
|
|
35
|
-
row's bounds to the screenshot to see which row it is.
|
|
36
|
-
- The tree holds at most 150 nodes. Its last line counts any it left out: scroll, or use the screenshot.
|
|
37
|
-
2. **Act.** Do one act that changes the screen (a tap that opens something, a swipe, a key), then look again. Don't
|
|
38
|
-
chain taps blind: once the screen changes under you, the second tap lands on something else.
|
|
39
|
-
3. **Check.** Take a screenshot or the tree again, and look for the change the act should have made:
|
|
40
|
-
- after a tap on a list row: the list is replaced by that row's page;
|
|
41
|
-
- after a swipe up: the rows have moved up;
|
|
42
|
-
- after typing: the field holds the text.
|
|
43
|
-
4. **Recover.** If nothing changed, look closer before trying again. A dialog, the keyboard or a banner may cover
|
|
44
|
-
your target, or the tap may have landed between two rows. Use the tree's center rather than a guess. After two or
|
|
45
|
-
three tries that change nothing, change approach:
|
|
46
|
-
- `phone_key` `back` to leave the page or close what covers it;
|
|
47
|
-
- then `home`;
|
|
48
|
-
- then `phone_open` the app afresh.
|
|
49
|
-
|
|
50
|
-
## What the screen looks like
|
|
14
|
+
**`computer_observe` `{app?, image?, full?}`** shows the app in front as compact lines, one per element:
|
|
51
15
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
Don't repeat the tap, which may land on the new screen.
|
|
16
|
+
```
|
|
17
|
+
state s2 · com.android.settings "Settings" · window 360×800 pt
|
|
18
|
+
@e1 generic
|
|
19
|
+
@e3 searchbox "Search settings"
|
|
20
|
+
@e5 button "Network & internet"
|
|
21
|
+
@e9 button "About phone"
|
|
22
|
+
```
|
|
60
23
|
|
|
61
|
-
|
|
24
|
+
Each line is a ref (`@e5`), a role, a name, a value after `=`, what else the element says in parentheses (a row's
|
|
25
|
+
second line: `("Mobile, Wi-Fi, hotspot")`) and flags in brackets. A child is indented under its parent. The head line names the **state**. `image: true` adds a screenshot, for what the elements can't tell you:
|
|
26
|
+
layout, images, colours. Without the `ui` group, observe is the screenshot.
|
|
62
27
|
|
|
63
|
-
|
|
64
|
-
moves a list **down**. Swipe in the middle of the list, from about 75% of its height to about 25%, then look again.
|
|
65
|
-
- **Long press**: `phone_swipe` with `from` and `to` the same point and `duration_ms` about 800.
|
|
66
|
-
- **Go back**: `phone_key` `back`, or the page's back arrow (in the tree as "Navigate up" on Android).
|
|
67
|
-
- **Open an app**: `phone_apps` gives the ids (like `com.android.settings`), then `phone_open` with one of them.
|
|
68
|
-
- `phone_open` starts the app on its first screen, not where it was left, which makes it the surest way back to a
|
|
69
|
-
known place.
|
|
70
|
-
- Check with the tree or `phone_apps` that the app is in front.
|
|
71
|
-
- An app may first show another app's screen (a sign-in or a permission prompt). Deal with that screen, then go
|
|
72
|
-
on.
|
|
28
|
+
**`computer_act` `{steps, state?, expect?, observe?}`** runs steps in order:
|
|
73
29
|
|
|
74
|
-
|
|
30
|
+
| Step | What it does |
|
|
31
|
+
|---|---|
|
|
32
|
+
| `{press: "@e9"}` | The element's own tap. The surest step. |
|
|
33
|
+
| `{set: "@e3", value: "wifi"}` | Sets a field's text, or a switch's `"on"` or `"off"`. |
|
|
34
|
+
| `{click: "@e9"}` or `{click: [x, y]}` | A tap; `button: "right"` is a long press. |
|
|
35
|
+
| `{type: "text", into?: "@e3"}` | Types, into the element when named, else into the field in focus. |
|
|
36
|
+
| `{nav: "back"}`, `{nav: "home"}`, `{nav: "app_switch"}` | The system's own navigation. |
|
|
37
|
+
| `{scroll: "@e1", dy: 600}` | Scrolls the element by points: `dy` above 0 shows what is below. |
|
|
38
|
+
| `{drag: [[x1, y1], [x2, y2]], ms?}` | One finger along the path. |
|
|
39
|
+
| `{key: "enter"}` | A key, where the phone has keys. |
|
|
40
|
+
|
|
41
|
+
Each step answers its route and whether a readback verified it; the answer ends with whether the screen changed and its
|
|
42
|
+
new state. `expect: {text: "Android version"}` waits after the steps until that text shows (`gone: true`: until it is
|
|
43
|
+
gone). `observe: true` adds the new outline: one call instead of two. The first refused step stops the rest.
|
|
44
|
+
|
|
45
|
+
Prefer refs. A step at a point is read against a state and refused as **stale** once the screen moved under it:
|
|
46
|
+
observe again and use the new state. Without the `ui` group, points are screenshot pixels and there are no refs,
|
|
47
|
+
states or expects.
|
|
48
|
+
|
|
49
|
+
**`computer_screenshot` `{region?}`** is the whole screen, or `region: [x, y, w, h]` of it, in pixels.
|
|
50
|
+
|
|
51
|
+
**`computer_script` `{code}`** runs JavaScript in an isolate whose only binding is `computer`. Its tool description
|
|
52
|
+
gives the `computer` object's types for this phone. The body is an async function: `await` the calls and `return` what
|
|
53
|
+
you need.
|
|
54
|
+
|
|
55
|
+
```js
|
|
56
|
+
await computer.apps.open("com.android.settings");
|
|
57
|
+
const settings = computer.app("com.android.settings");
|
|
58
|
+
await settings.observe();
|
|
59
|
+
const about = settings.find({ text: "About phone" })[0];
|
|
60
|
+
const page = await settings.press(about.ref, { expect: { text: "Android version" }, observe: true });
|
|
61
|
+
return { met: page.expect, lines: page.after.outline.split("\n").filter((line) => /version/i.test(line)) };
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
**Your harness's own code mode.** pi's `codemode` binds `computer` as computer_script does. Codex's `exec` does not:
|
|
65
|
+
there, call the tools, each answering its value as JSON text, or call `tools.computer_script` with the code above.
|
|
66
|
+
|
|
67
|
+
```js
|
|
68
|
+
const page = JSON.parse(await tools.computer_observe({ app: "com.android.settings" }));
|
|
69
|
+
const about = page.elements.find((node) => node.name === "About phone");
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
**The screen itself.** Prefer an app's steps. A script's `computer.input.act([...])` is the screen-level way out, at
|
|
73
|
+
screenshot pixels, for what the app's window can't reach: a swipe from the screen's top edge opens the notification
|
|
74
|
+
shade (`{ type: "swipe", path: [[540, 5], [540, 1200]] }`), and anything outside the app.
|
|
75
|
+
|
|
76
|
+
## How to work: observe, then act by ref, then check
|
|
77
|
+
|
|
78
|
+
1. **Observe** first. Find your target by its name, role or id, and note its ref. A list row is often an unnamed
|
|
79
|
+
button whose title sits on a child text: the outline shows it indented under the row.
|
|
80
|
+
2. **Act** by ref. A step that changes the screen (opening a page, a back) ends the call, unless you put an `expect`
|
|
81
|
+
on it for what the next screen shows.
|
|
82
|
+
3. **Check** the answer's routes, `changed` and the expect. When it doesn't settle it, observe again.
|
|
83
|
+
4. **Recover.** `stale`: observe again. Nothing changed: a dialog, the keyboard or a banner may cover the target.
|
|
84
|
+
`{nav: "back"}` closes what covers it; `computer.apps.open(id)` in a script starts an app afresh on its first
|
|
85
|
+
screen, the surest way back to a known place.
|
|
86
|
+
|
|
87
|
+
## When to write a script
|
|
88
|
+
|
|
89
|
+
- **Known steps**: open an app, press through a known path, read one value: one script, an `expect` on each page.
|
|
90
|
+
- **A few facts out of a long screen**: `find()` inside the script and return only those, never whole observations.
|
|
91
|
+
`find({ role, text, id })`: a role is the same name on every phone, a text matches the name, the value or what the
|
|
92
|
+
parentheses say, and an id is the app's own (an Android resource-id).
|
|
93
|
+
- **Loops**: scroll a list until a row shows.
|
|
94
|
+
|
|
95
|
+
When you are unsure what is on the screen, observe before you act, and decide from what it shows.
|
|
75
96
|
|
|
76
|
-
|
|
77
|
-
2. `phone_type` with the text. `phone_key` `enter` submits it, or a line break in the text does.
|
|
78
|
-
3. Look again to read what the field holds now.
|
|
97
|
+
## What the screen looks like
|
|
79
98
|
|
|
80
|
-
|
|
81
|
-
|
|
99
|
+
- **A page's title may not be an element.** On current Android the title is drawn in a header that shrinks as you
|
|
100
|
+
scroll. The page opened when its own items show and the list you pressed is gone.
|
|
101
|
+
- **The keyboard** covers the lower part of the screen while a field has focus; `{nav: "back"}` closes it.
|
|
102
|
+
- **The status bar** across the top (time, battery) is not the app.
|
|
82
103
|
|
|
83
104
|
## What a phone cannot do here
|
|
84
105
|
|
|
85
106
|
- No pinch or zoom, and no gesture with more than one finger.
|
|
86
|
-
- No keys beyond `back`, `home` and `enter`: no volume, no key combinations, no arrow keys.
|
|
87
107
|
- No shell, files or installs.
|
|
108
|
+
- Plain ASCII typing only: other characters are refused in words before anything is typed.
|
|
88
109
|
|
|
89
|
-
|
|
110
|
+
Say in your answer what the task needed that the phone could not do.
|
|
90
111
|
|
|
91
112
|
## When a tool answers an error
|
|
92
113
|
|
|
93
|
-
Errors come in words, and they say what was wrong. Read them,
|
|
114
|
+
Errors come in words, and they say what was wrong. Read them, act on what they say, and don't repeat the same call.
|
|
94
115
|
|
|
95
|
-
- **
|
|
96
|
-
|
|
97
|
-
- **
|
|
98
|
-
|
|
99
|
-
- **
|
|
100
|
-
|
|
101
|
-
- **The phone is gone or unreachable**: the run's phone ended (its time ran out, or it was released). Don't keep
|
|
102
|
-
calling. Say what you finished and what you could not.
|
|
116
|
+
- **"The person had this computer"**: a person took the phone over and has handed it back, and your act was not done.
|
|
117
|
+
The screen may have changed: observe again before you act.
|
|
118
|
+
- **A step refused as `unsupported`** names what this phone can't do (an element step without the `ui` group, a key
|
|
119
|
+
on a phone with no keys). Use another step.
|
|
120
|
+
- **The phone is gone or unreachable**: the run's phone ended. Don't keep calling. Say what you finished and what you
|
|
121
|
+
could not.
|
|
103
122
|
|
|
104
123
|
## Time and cost
|
|
105
124
|
|
|
106
|
-
The phone may be billed by the minute
|
|
107
|
-
|
|
108
|
-
- don't loop on screenshots or the tree just to wait;
|
|
109
|
-
- stop once the task is done, or once it can't be done.
|
|
110
|
-
|
|
111
|
-
A short plan before the first tap (which app, which screens, what will show success) saves more than fast tapping.
|
|
125
|
+
The phone may be billed by the minute and lives only for the run's lifetime. Plan first (which app, which screens,
|
|
126
|
+
what will show success), script what is certain, and stop once the task is done or can't be done.
|
|
112
127
|
|
|
113
128
|
## Finishing
|
|
114
129
|
|
|
115
|
-
Before you call the task done,
|
|
116
|
-
and name anything you could not finish or check.
|
|
130
|
+
Before you call the task done, check the result with an observe (or a screenshot when it is visual). Say what it shows
|
|
131
|
+
in your answer, and name anything you could not finish or check.
|
|
@@ -22,6 +22,9 @@ export type KindRegistry = {
|
|
|
22
22
|
readonly SETTING_KINDS: Readonly<Record<ComputerSettingKind, unknown>>;
|
|
23
23
|
servingRefusals(capabilities: KindCapabilities, kind: ComputerSettingKind): string[];
|
|
24
24
|
readonly PROVIDERS: readonly ProviderEntry[];
|
|
25
|
+
/** A provider's own words for why it gives no computer of `kind`, where they say more than servingRefusals' (a paired
|
|
26
|
+
* computer: its driver is what to update, attached-computers.ts withPaired); undefined, servingRefusals' words. */
|
|
27
|
+
readonly unservedWhy?: (entry: ProviderEntry, kind: ComputerSettingKind) => string | undefined;
|
|
25
28
|
};
|
|
26
29
|
/** A computer a provider started for the run: its ref, its computerd client and what it offers (sandbox, desktop,
|
|
27
30
|
* phone), the hello it answered when the claim connected it (a desktop's or a phone's ports read its groups), the
|
|
@@ -22,6 +22,7 @@ import { hostToolDefs } from "@parcha/agentrun-kernel/kernel";
|
|
|
22
22
|
import { configurationOf, imagesOf } from "@parcha/agentrun-computer";
|
|
23
23
|
import { noDockerWords } from "../docker-daemon.js";
|
|
24
24
|
import { gpuRefused } from "../gpu-words.js";
|
|
25
|
+
import { recordedClient } from "../computer-calls.js";
|
|
25
26
|
/** A provider's keys as the claim reads them: each key its registry entry declares, by `keyOf` (the server's reader:
|
|
26
27
|
* key-meta.ts keyReader, the environment's value, else the saved one); a key with no value is left out. */
|
|
27
28
|
export const providerKeys = (registry, keyOf) => async (provider) => {
|
|
@@ -191,6 +192,9 @@ export async function resolveComputer(given, mode, registry, side) {
|
|
|
191
192
|
// The configurations of the provider that serve the kind; none, and the registry says why, by its closest one.
|
|
192
193
|
const serving = servingOf(registry, entry, kind);
|
|
193
194
|
if (serving.length === 0) {
|
|
195
|
+
const own = registry.unservedWhy?.(entry, kind);
|
|
196
|
+
if (own !== undefined)
|
|
197
|
+
return { refused: `${own}, or pick ${pick}` };
|
|
194
198
|
const why = entry.capabilities.map((one) => registry.servingRefusals(one, kind)).sort((a, b) => a.length - b.length)[0] ?? [];
|
|
195
199
|
return { refused: `${entry.label} gives no ${kind} computer${why.length > 0 ? `: ${why.join("; ")}` : ""}. Pick ${pick}` };
|
|
196
200
|
}
|
|
@@ -277,9 +281,11 @@ function runComputerOf(kind, launched, check) {
|
|
|
277
281
|
// The run's browser tool opens a browser's sessions through its provider.
|
|
278
282
|
if (kind === "browser")
|
|
279
283
|
return launched.browser ? { kind, browser: launched.browser } : "it gave no CDP connection";
|
|
280
|
-
const {
|
|
281
|
-
if (!client)
|
|
284
|
+
const { hello } = launched;
|
|
285
|
+
if (!launched.client)
|
|
282
286
|
return "it gave no computer protocol client";
|
|
287
|
+
// Each call the agent's tools make is recorded on the tool call's row (computer-calls.ts): the run's one client.
|
|
288
|
+
const client = recordedClient(launched.client);
|
|
283
289
|
if (kind === "phone")
|
|
284
290
|
return hello ? { kind, computer: { client }, hello } : "it gave no hello";
|
|
285
291
|
if (check && !launched.readBack)
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import type { Context } from "@earendil-works/chord";
|
|
1
|
+
import type { Context } from "@earendil-works/chord/context";
|
|
2
2
|
import type { HostTool } from "@parcha/agentrun-kernel";
|
|
3
|
-
import { type CapabilityKind, type Registry } from "@parcha/agentrun-kernel/kernel";
|
|
3
|
+
import { type CapabilityKind, type ComputerPort, type Executor, type Registry } from "@parcha/agentrun-kernel/kernel";
|
|
4
4
|
import type { ComputerClient, HelloResult } from "@parcha/agentrun-computer";
|
|
5
|
+
import { type Card } from "@parcha/agentrun-computer/surface";
|
|
5
6
|
import type { AttachableComputer, MountCheck } from "./attach.js";
|
|
7
|
+
import { ScriptGuard } from "./computer-script.js";
|
|
6
8
|
import { type PiAnswer, type PiExecutor } from "./executors.js";
|
|
7
9
|
import { type Hands } from "./hands.js";
|
|
8
10
|
import { type ClaimBrowser, type ShellPlace } from "./resolve-computer.js";
|
|
@@ -11,12 +13,13 @@ import type { Workspace } from "./workspace.js";
|
|
|
11
13
|
* The run's computer, as runTools takes it, by its kind:
|
|
12
14
|
* - sandbox: the run's folder is mounted in it, always; `check` is the mount check attach runs (the claim's epoch bound
|
|
13
15
|
* in);
|
|
14
|
-
* - desktop:
|
|
15
|
-
* files and exec;
|
|
16
|
-
* - phone:
|
|
16
|
+
* - desktop: the computer's tools; the folder is attached only when its provider mounts it (`check` given) and it
|
|
17
|
+
* offers files and exec;
|
|
18
|
+
* - phone: the computer's tools; never attached;
|
|
17
19
|
* - browser: what the run's browser tool drives it by (its CDP URL through its provider); no tools of the registry's,
|
|
18
20
|
* never attached.
|
|
19
|
-
* `hello`: what a desktop or a phone said it is when the claim connected it; its groups
|
|
21
|
+
* `hello`: what a desktop or a phone said it is when the claim connected it; its groups say which of the computer's
|
|
22
|
+
* tools it has, and its surface is made from it.
|
|
20
23
|
*/
|
|
21
24
|
export type RunComputer = {
|
|
22
25
|
readonly kind: "sandbox";
|
|
@@ -37,10 +40,17 @@ export type RunComputer = {
|
|
|
37
40
|
readonly kind: "browser";
|
|
38
41
|
readonly browser: ClaimBrowser;
|
|
39
42
|
};
|
|
40
|
-
/** A desktop's or a phone's
|
|
41
|
-
* holds it waits for hand-back; a
|
|
42
|
-
* agent's ask for the person (`handoff`, computer_request_handoff's port), through the same hold. */
|
|
43
|
-
export type RunHold = (ports: Pick<Hands, "
|
|
43
|
+
/** 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
|
+
* 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
|
+
* the agent's ask for the person (`handoff`, computer_request_handoff's port), through the same hold. */
|
|
46
|
+
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, which the
|
|
48
|
+
* script prelude builds `computer` from, and the run's port, held by the person's take-over as the tools' is. */
|
|
49
|
+
export type ScriptComputer = {
|
|
50
|
+
readonly card: Card;
|
|
51
|
+
readonly port: ComputerPort; /** What the script's shell and files are held to (computer-script.ts ScriptGuard). */
|
|
52
|
+
readonly guard: ScriptGuard;
|
|
53
|
+
};
|
|
44
54
|
/** The run's scratch in its own folder: bash's TMPDIR. */
|
|
45
55
|
export declare const TMP_DIR = ".agentrun/tmp";
|
|
46
56
|
/** What runHands binds for a run. */
|
|
@@ -52,8 +62,8 @@ export type RunHands = {
|
|
|
52
62
|
readonly shell: ShellPlace;
|
|
53
63
|
/** The computer's kinds whose tools the run gets, past files and a shell. */
|
|
54
64
|
readonly kinds: readonly CapabilityKind[];
|
|
55
|
-
/**
|
|
56
|
-
readonly
|
|
65
|
+
/** What the computer offers (its groups): which of the computer's tools are listed to the model. */
|
|
66
|
+
readonly groups: readonly string[];
|
|
57
67
|
readonly maxExecS: number;
|
|
58
68
|
/** The name the model knows the run's folder by: /workspace in a computer, the folder's own path otherwise. */
|
|
59
69
|
readonly cwd: string;
|
|
@@ -65,8 +75,11 @@ export type RunHands = {
|
|
|
65
75
|
readonly read: PiExecutor;
|
|
66
76
|
readonly write: PiExecutor;
|
|
67
77
|
readonly edit: PiExecutor;
|
|
68
|
-
readonly bash?: PiExecutor;
|
|
78
|
+
readonly bash?: PiExecutor; /** computer_script's run in serve's isolate, with a desktop or a phone. */
|
|
79
|
+
readonly computer_script?: Executor;
|
|
69
80
|
};
|
|
81
|
+
/** A desktop's or a phone's surface for a harness's own script runtime; none for any other computer. */
|
|
82
|
+
readonly computer?: ScriptComputer;
|
|
70
83
|
/** The run's end, after its background processes are ended and before the computer is let go: bash's full outputs
|
|
71
84
|
* and its TMPDIR swept. */
|
|
72
85
|
sweep(): Promise<void>;
|
|
@@ -123,14 +136,18 @@ export type RunTools = {
|
|
|
123
136
|
readonly hands: Hands;
|
|
124
137
|
/** Where the run's shell is (runHands' shell): its gate reads its defaults by it (tool-gate.ts defaultPermission). */
|
|
125
138
|
readonly shell: ShellPlace;
|
|
126
|
-
/** The tools the claimed computer brings by its kind, as its groups offer them: a desktop's
|
|
127
|
-
*
|
|
139
|
+
/** The tools the claimed computer brings by its kind, as its groups offer them: a desktop's or a phone's
|
|
140
|
+
* (computer_observe, computer_act, computer_screenshot, computer_script, computer_request_handoff), by the kernel
|
|
141
|
+
* registry's own list. None with no computer, for
|
|
128
142
|
* a sandbox, or for a browser (its own binding lists its tools). An agent names its computer, never these tools
|
|
129
143
|
* (definition.tools refuses them), so a run binds them beside what it was granted (withKindTools). */
|
|
130
144
|
readonly kindTools: readonly string[];
|
|
131
145
|
/** The registry's tools `names` names, as the kernel's HostTool an adapter's session takes, each call through the
|
|
132
146
|
* run's gate decided before its intent, each answer kept in `results` (bindTools). */
|
|
133
147
|
hostTools(names: readonly string[], results?: ToolResults): HostTool[];
|
|
148
|
+
/** 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. */
|
|
150
|
+
readonly computer?: ScriptComputer;
|
|
134
151
|
/** The run's end, before the computer is let go: its background processes ended (TERM, then KILL 3 s later; none with
|
|
135
152
|
* no computer), then bash's full outputs and TMPDIR swept. */
|
|
136
153
|
end(): Promise<void>;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { COMPUTER_TOOLS, createRegistry, endBackground } from "@parcha/agentrun-kernel/kernel";
|
|
2
|
+
import { createSurface } from "@parcha/agentrun-computer/surface";
|
|
3
|
+
import { portOf } from "./computer-ports.js";
|
|
4
|
+
import { computerScriptExecutor, ScriptGuard } from "./computer-script.js";
|
|
3
5
|
import { answerText, piExecutor } from "./executors.js";
|
|
4
6
|
import { ARCHIL_MAX_EXEC_S, handsOf, MAX_EXEC_S, shellEnv } from "./hands.js";
|
|
5
7
|
import { policyEnv, policyPrelude } from "../bash-read-only.js";
|
|
@@ -15,26 +17,13 @@ function mountedIn(computer) {
|
|
|
15
17
|
return { computer: computer.computer, check: computer.check };
|
|
16
18
|
return undefined;
|
|
17
19
|
}
|
|
18
|
-
/**
|
|
19
|
-
*
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
const screen = groups.includes("screen");
|
|
26
|
-
const input = groups.includes("input.pointer") || groups.includes("input.keys");
|
|
27
|
-
return screen && input ? { ports: { screen: screenOf(client), input: inputOf(client) }, kinds: ["desktop"], without: [] } : { ports: {}, kinds: [], without: [] };
|
|
28
|
-
}
|
|
29
|
-
if (computer?.kind === "phone") {
|
|
30
|
-
const { groups } = computer.hello;
|
|
31
|
-
if (!groups.includes("screen") || !groups.includes("input.touch"))
|
|
32
|
-
return { ports: {}, kinds: [], without: [] };
|
|
33
|
-
const tree = groups.includes("apps.ui_tree");
|
|
34
|
-
const keys = groups.includes("input.keys");
|
|
35
|
-
return { ports: { phone: phoneOf(computer.computer.client, { tree, keys }) }, kinds: ["phone"], without: [...(tree ? [] : ["phone_tree"]), ...(keys ? [] : ["phone_key"])] };
|
|
36
|
-
}
|
|
37
|
-
return { ports: {}, kinds: [], without: [] };
|
|
20
|
+
/** A desktop's or a phone's port, over its surface, the kind whose tools the run gets, its groups, and the script's
|
|
21
|
+
* executor for its card; none for any other computer. */
|
|
22
|
+
async function portsOf(computer, guard) {
|
|
23
|
+
if (computer?.kind !== "desktop" && computer?.kind !== "phone")
|
|
24
|
+
return { ports: {}, kinds: [], groups: [] };
|
|
25
|
+
const surface = createSurface(computer.computer.client, computer.hello);
|
|
26
|
+
return { ports: { computer: portOf(surface) }, kinds: [computer.kind], groups: surface.card.groups, script: computerScriptExecutor(surface.card, guard), card: surface.card };
|
|
38
27
|
}
|
|
39
28
|
/** The run's scratch in its own folder: bash's TMPDIR. */
|
|
40
29
|
export const TMP_DIR = ".agentrun/tmp";
|
|
@@ -66,9 +55,9 @@ export async function runHands(workspace, computer, options) {
|
|
|
66
55
|
const tools = Object.fromEntries([...fileTools(), bashTool()].map((tool) => [tool.name, tool]));
|
|
67
56
|
const read = mounted === undefined ? tools.read : readAnywhereInComputer(tools.read, attached, names, env);
|
|
68
57
|
const executor = (tool) => piExecutor(tool, fileEnv, options.context);
|
|
69
|
-
const
|
|
70
|
-
const
|
|
71
|
-
const { ports, kinds,
|
|
58
|
+
const guard = new ScriptGuard({ env: policyEnv(options.bashPolicy), prelude });
|
|
59
|
+
const own = await portsOf(computer, guard);
|
|
60
|
+
const { ports, kinds, groups, script, card } = options.hold !== undefined && own.ports.computer ? { ...own, ports: options.hold(own.ports) } : own;
|
|
72
61
|
return {
|
|
73
62
|
workspace: attached,
|
|
74
63
|
// The computer's processes, for the five background tools: the attached Workspace's own; none when the folder is not
|
|
@@ -76,11 +65,12 @@ export async function runHands(workspace, computer, options) {
|
|
|
76
65
|
hands: { ...handsOf(attached, { maxExecS, env, ...(prelude ? { prelude } : {}), ...network, ...(mounted === undefined ? {} : { processes: attached.process }) }), ...ports },
|
|
77
66
|
shell,
|
|
78
67
|
kinds,
|
|
79
|
-
|
|
68
|
+
groups,
|
|
80
69
|
maxExecS,
|
|
81
70
|
cwd,
|
|
82
71
|
names,
|
|
83
|
-
executors: { read: executor(read), write: executor(tools.write), edit: executor(tools.edit), ...(shell === "none" ? {} : { bash: executor(tools.bash) }) },
|
|
72
|
+
executors: { read: executor(read), write: executor(tools.write), edit: executor(tools.edit), ...(shell === "none" ? {} : { bash: executor(tools.bash) }), ...(script ? { computer_script: script } : {}) },
|
|
73
|
+
...(card && ports.computer ? { computer: { card, port: ports.computer, guard } } : {}),
|
|
84
74
|
async sweep() {
|
|
85
75
|
// Through the run's own Workspace, not the computer's: the sweep holds whether or not the computer still answers.
|
|
86
76
|
for (const dir of [OUTPUT_DIR, TMP_DIR])
|
|
@@ -124,7 +114,9 @@ export function bindTools(run, registry, names, options = {}) {
|
|
|
124
114
|
const isError = given.isError === true || given.error !== undefined;
|
|
125
115
|
const answer = { text: isError || SAYS_PATH.has(name) ? workspaceRelative(said, works) : said, isError };
|
|
126
116
|
options.results?.set(callId, answer);
|
|
127
|
-
|
|
117
|
+
// A computer tool's value beside its words: what a script's nested call reads (Codex's code mode), and an MCP
|
|
118
|
+
// client's structuredContent.
|
|
119
|
+
return { ...answer, ...(given.images?.length ? { images: given.images } : {}), ...(given.structured !== undefined && !isError ? { structured: given.structured } : {}) };
|
|
128
120
|
},
|
|
129
121
|
}];
|
|
130
122
|
});
|
|
@@ -140,8 +132,8 @@ export function bindTools(run, registry, names, options = {}) {
|
|
|
140
132
|
*/
|
|
141
133
|
export async function runTools(workspace, computer, options) {
|
|
142
134
|
const run = await runHands(workspace, computer, options);
|
|
143
|
-
const registry = createRegistry({ maxExecS: run.maxExecS, shell: run.shell, kinds: run.kinds,
|
|
144
|
-
const brought = new Set(
|
|
135
|
+
const registry = createRegistry({ maxExecS: run.maxExecS, shell: run.shell, kinds: run.kinds, groups: run.groups, executors: run.executors });
|
|
136
|
+
const brought = new Set(COMPUTER_TOOLS);
|
|
145
137
|
return {
|
|
146
138
|
workspace: run.workspace,
|
|
147
139
|
registry,
|
|
@@ -149,6 +141,7 @@ export async function runTools(workspace, computer, options) {
|
|
|
149
141
|
shell: run.shell,
|
|
150
142
|
kindTools: registry.list().map((def) => def.name).filter((name) => brought.has(name)),
|
|
151
143
|
hostTools: (names, results) => bindTools(run, registry, names, results ? { results } : {}),
|
|
144
|
+
...(run.computer ? { computer: run.computer } : {}),
|
|
152
145
|
async end() {
|
|
153
146
|
await endBackground(run.hands);
|
|
154
147
|
await run.sweep();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@parcha/agentrun-serve",
|
|
3
|
-
"version": "0.1.0-beta.
|
|
3
|
+
"version": "0.1.0-beta.37",
|
|
4
4
|
"description": "The AgentRun server: the /v2 API and console over one store, with runners that run your agents; the deployable process of the AgentRun platform.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agentrun",
|
|
@@ -49,18 +49,19 @@
|
|
|
49
49
|
"test:pg": "node scripts/test-pg.mjs"
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@earendil-works/pi-agent-core": "1.5.
|
|
53
|
-
"@earendil-works/pi-
|
|
52
|
+
"@earendil-works/pi-agent-core": "1.5.2",
|
|
53
|
+
"@earendil-works/pi-codemode": "1.5.2",
|
|
54
|
+
"@earendil-works/pi-coding-agent": "1.5.2",
|
|
54
55
|
"@modelcontextprotocol/client": "2.4.0",
|
|
55
56
|
"@modelcontextprotocol/server": "2.4.0",
|
|
56
|
-
"@parcha/agentrun-computer": "0.1.0-beta.
|
|
57
|
-
"@parcha/agentrun-decisions": "0.1.0-beta.
|
|
58
|
-
"@parcha/agentrun-dsl": "0.1.0-beta.
|
|
59
|
-
"@parcha/agentrun-harness-claude": "0.1.0-beta.
|
|
60
|
-
"@parcha/agentrun-harness-codex": "0.1.0-beta.
|
|
61
|
-
"@parcha/agentrun-jev": "0.1.0-beta.
|
|
62
|
-
"@parcha/agentrun-kernel": "0.1.0-beta.
|
|
63
|
-
"@parcha/pi-browser": "0.1.0-beta.
|
|
57
|
+
"@parcha/agentrun-computer": "0.1.0-beta.37",
|
|
58
|
+
"@parcha/agentrun-decisions": "0.1.0-beta.37",
|
|
59
|
+
"@parcha/agentrun-dsl": "0.1.0-beta.37",
|
|
60
|
+
"@parcha/agentrun-harness-claude": "0.1.0-beta.37",
|
|
61
|
+
"@parcha/agentrun-harness-codex": "0.1.0-beta.37",
|
|
62
|
+
"@parcha/agentrun-jev": "0.1.0-beta.37",
|
|
63
|
+
"@parcha/agentrun-kernel": "0.1.0-beta.37",
|
|
64
|
+
"@parcha/pi-browser": "0.1.0-beta.37",
|
|
64
65
|
"@secretlint/core": "13.1.0",
|
|
65
66
|
"@secretlint/profiler": "13.1.0",
|
|
66
67
|
"@secretlint/secretlint-rule-preset-recommend": "13.1.0",
|
|
@@ -71,12 +72,13 @@
|
|
|
71
72
|
"proxy-addr": "2.0.8",
|
|
72
73
|
"typebox": "1.3.27",
|
|
73
74
|
"undici": "^8.12.2",
|
|
75
|
+
"ws": "8.21.0",
|
|
74
76
|
"yaml": "2.9.0"
|
|
75
77
|
},
|
|
76
78
|
"peerDependencies": {
|
|
77
|
-
"@earendil-works/chord": "1.5.
|
|
79
|
+
"@earendil-works/chord": "1.5.2",
|
|
78
80
|
"@earendil-works/pi-ai": "*",
|
|
79
|
-
"@earendil-works/pi-durable": "1.5.
|
|
81
|
+
"@earendil-works/pi-durable": "1.5.2",
|
|
80
82
|
"opencode-ai": "1.19.5"
|
|
81
83
|
},
|
|
82
84
|
"peerDependenciesMeta": {
|
|
@@ -85,11 +87,12 @@
|
|
|
85
87
|
}
|
|
86
88
|
},
|
|
87
89
|
"devDependencies": {
|
|
88
|
-
"@earendil-works/chord": "1.5.
|
|
89
|
-
"@earendil-works/pi-ai": "1.5.
|
|
90
|
-
"@earendil-works/pi-durable": "1.5.
|
|
90
|
+
"@earendil-works/chord": "1.5.2",
|
|
91
|
+
"@earendil-works/pi-ai": "1.5.2",
|
|
92
|
+
"@earendil-works/pi-durable": "1.5.2",
|
|
91
93
|
"@types/pg": "8.23.1",
|
|
92
94
|
"@types/proxy-addr": "2.0.3",
|
|
95
|
+
"@types/ws": "8.18.2",
|
|
93
96
|
"opencode-ai": "1.19.5"
|
|
94
97
|
},
|
|
95
98
|
"repository": {
|
|
@@ -25,7 +25,7 @@ parameters:
|
|
|
25
25
|
competitors: { type: string, required: true, pattern: "^[^\\n]{2,2000}$", description: "the companies to watch, comma-separated, each a name and its domain: \"Acme (acme.com), Globex (globex.io)\"" }
|
|
26
26
|
topics: { type: string, pattern: "^[^\\n]{0,500}$", description: "optional market keywords, comma-separated (\"payments orchestration, KYB\"): market news on them is in scope too" }
|
|
27
27
|
channel: { type: string, pattern: "^([CG][A-Z0-9]{8,12}|[^@\\s]+@[^@\\s]+\\.[^@\\s]+)$", description: "where the digest goes, the one destination it is ever posted to: a Slack channel's id (C0123ABCD: in Slack, the channel's details, at the bottom) or an email address. Not a #name. Leave it out to have the digest returned only" }
|
|
28
|
-
lookback_days: { type: integer, description: "how many days back a run looks; leave it out for 7
|
|
28
|
+
lookback_days: { type: integer, description: "how many days back a run looks for changes; leave it out for 7. Keep it equal to the gap between runs (7 for the weekly default, 1 for daily): longer and runs repeat each other's items, shorter and days between them are missed" }
|
|
29
29
|
cron: { type: string, format: cron, default: "0 8 * * 1", description: "when the digest runs, as a cron line (minute hour day-of-month month day-of-week): Monday 08:00 unless you set it; set lookback_days to its gap" }
|
|
30
30
|
timezone: { type: string, format: timezone, default: UTC, description: "the IANA time zone the cron line is read in (Europe/Madrid, America/New_York): UTC unless you set it" }
|
|
31
31
|
budget: { per_run_usd: 5.00 }
|