@parcha/agentrun-serve 0.1.0-beta.43 → 0.1.0-beta.45
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 +231 -0
- package/README.md +580 -320
- package/dist/acp-package.d.ts +28 -0
- package/dist/acp-package.js +23 -0
- package/dist/adapter-facts.d.ts +8 -1
- package/dist/adapter-facts.js +9 -1
- package/dist/adapters.d.ts +5 -0
- package/dist/adapters.js +36 -3
- package/dist/agent-delete.d.ts +50 -0
- package/dist/agent-delete.js +125 -0
- package/dist/agents-store.d.ts +9 -3
- package/dist/agents-store.js +22 -8
- package/dist/agents.d.ts +5 -1
- package/dist/agents.js +8 -4
- package/dist/api-only.d.ts +8 -3
- package/dist/api-only.js +10 -4
- package/dist/archil-routes.d.ts +5 -1
- package/dist/archil-routes.js +57 -2
- package/dist/browser-wait-ended.d.ts +2 -0
- package/dist/browser-wait-ended.js +2 -0
- package/dist/calendar/ics-faux.d.ts +3 -1
- package/dist/calendar/ics-faux.js +12 -2
- package/dist/calendar/tools.js +5 -2
- package/dist/chatgpt-plan.js +3 -1
- package/dist/claude-login.d.ts +135 -0
- package/dist/claude-login.js +244 -0
- package/dist/cli.js +92 -22
- package/dist/composio-preset.d.ts +4 -3
- package/dist/composio-preset.js +81 -11
- package/dist/composio-triggers.d.ts +34 -2
- package/dist/composio-triggers.js +261 -31
- package/dist/computer-attach.d.ts +40 -5
- package/dist/computer-attach.js +130 -15
- package/dist/computer-keys.d.ts +3 -0
- package/dist/computer-keys.js +7 -1
- package/dist/computer-live.js +3 -2
- package/dist/computer-lost.d.ts +11 -0
- package/dist/computer-lost.js +19 -0
- package/dist/computer-record.d.ts +10 -2
- package/dist/computer-record.js +50 -18
- package/dist/computer-setting.d.ts +1 -0
- package/dist/computer-setting.js +2 -2
- package/dist/computers.d.ts +21 -10
- package/dist/computers.js +39 -28
- package/dist/console/assets/index-3O2Yl6hZ.js +701 -0
- package/dist/console/assets/index-DaFsZuzQ.css +1 -0
- package/dist/console/index.html +2 -2
- package/dist/decisions.d.ts +1 -1
- package/dist/dial-relay.d.ts +29 -0
- package/dist/dial-relay.js +94 -0
- package/dist/email/tools.js +10 -5
- package/dist/env-proxy.d.ts +2 -0
- package/dist/env-proxy.js +35 -0
- package/dist/errors.d.ts +4 -1
- package/dist/errors.js +10 -4
- package/dist/faux-computers.d.ts +8 -2
- package/dist/faux-computers.js +83 -6
- package/dist/harness-archive.d.ts +67 -0
- package/dist/harness-archive.js +177 -0
- package/dist/harness-goose.d.ts +34 -0
- package/dist/harness-goose.js +87 -0
- package/dist/harness-install.d.ts +21 -0
- package/dist/harness-install.js +24 -11
- package/dist/harness-opencode/adapter.js +1 -1
- package/dist/harness-table.d.ts +59 -3
- package/dist/harness-table.js +119 -14
- package/dist/harness.d.ts +17 -1
- package/dist/harness.js +22 -11
- package/dist/host.d.ts +12 -10
- package/dist/host.js +19 -16
- package/dist/import-worker.d.ts +3 -0
- package/dist/import-worker.js +7 -5
- package/dist/import.d.ts +22 -1
- package/dist/import.js +141 -28
- package/dist/key-check.js +3 -0
- package/dist/learn/audit.d.ts +6 -6
- package/dist/learn/audit.js +3 -7
- package/dist/learn/check.d.ts +26 -89
- package/dist/learn/check.js +58 -336
- package/dist/learn/commit.d.ts +63 -90
- package/dist/learn/commit.js +124 -316
- package/dist/learn/compile.d.ts +53 -50
- package/dist/learn/compile.js +88 -103
- package/dist/learn/corrections.d.ts +13 -0
- package/dist/learn/corrections.js +23 -0
- package/dist/learn/delete.d.ts +17 -0
- package/dist/learn/delete.js +42 -0
- package/dist/learn/folder.d.ts +35 -47
- package/dist/learn/folder.js +118 -134
- package/dist/learn/index.d.ts +3 -5
- package/dist/learn/index.js +6 -9
- package/dist/learn/learning.sh +45 -15
- package/dist/learn/promote.d.ts +20 -2
- package/dist/learn/promote.js +17 -4
- package/dist/learn/{skills.d.ts → workflow-draft.d.ts} +34 -38
- package/dist/learn/{skills.js → workflow-draft.js} +65 -59
- package/dist/learn/workflow-nodes.d.ts +22 -1
- package/dist/learn/workflow-nodes.js +29 -10
- package/dist/learned-workflow.js +2 -2
- package/dist/learning-cost.d.ts +127 -13
- package/dist/learning-cost.js +142 -10
- package/dist/learning-routes.d.ts +99 -170
- package/dist/learning-routes.js +199 -420
- package/dist/learning-run.d.ts +19 -40
- package/dist/learning-run.js +23 -93
- package/dist/learning-setting.d.ts +4 -4
- package/dist/learning-setting.js +6 -6
- package/dist/learning-words.d.ts +28 -74
- package/dist/learning-words.js +64 -162
- package/dist/learning.d.ts +62 -393
- package/dist/learning.js +101 -651
- package/dist/listen-first.d.ts +30 -0
- package/dist/listen-first.js +115 -0
- package/dist/live-reach.d.ts +25 -2
- package/dist/live-reach.js +46 -4
- package/dist/llms.txt +2 -1
- package/dist/local-models.d.ts +3 -11
- package/dist/local-models.js +5 -6
- package/dist/mcp-servers-store.d.ts +16 -16
- package/dist/model-form.js +6 -5
- package/dist/model.d.ts +12 -4
- package/dist/model.js +41 -16
- package/dist/native/binding.js +1 -1
- package/dist/native/connection.js +1 -1
- package/dist/native/discovery.js +1 -1
- package/dist/native/instructions.d.ts +3 -0
- package/dist/native/instructions.js +5 -3
- package/dist/native/remote-worker-bridge.js +9 -43
- package/dist/native/remote.d.ts +8 -15
- package/dist/native/remote.js +3 -3
- package/dist/native/schema.js +1 -1
- package/dist/native/types.d.ts +2 -2
- package/dist/openapi.js +375 -347
- package/dist/owner.d.ts +8 -0
- package/dist/owner.js +11 -0
- package/dist/paid-calls.d.ts +14 -0
- package/dist/paid-calls.js +31 -1
- package/dist/particle-provider.d.ts +11 -0
- package/dist/particle-provider.js +135 -0
- package/dist/place.d.ts +8 -3
- package/dist/place.js +13 -9
- package/dist/port-models.d.ts +12 -4
- package/dist/port-models.js +28 -11
- package/dist/print.d.ts +27 -0
- package/dist/print.js +21 -0
- package/dist/provider.d.ts +7 -0
- package/dist/provider.js +30 -2
- package/dist/reflect-range.js +2 -3
- package/dist/run-launch.d.ts +14 -28
- package/dist/run-launch.js +9 -12
- package/dist/run-learning-served.d.ts +16 -90
- package/dist/run-listing.d.ts +34 -0
- package/dist/run-listing.js +128 -0
- package/dist/run-model-key.d.ts +64 -0
- package/dist/run-model-key.js +147 -0
- package/dist/run-timeline-served.js +5 -3
- package/dist/run-trace.d.ts +97 -0
- package/dist/run-trace.js +253 -0
- package/dist/run-view.d.ts +15 -0
- package/dist/run-view.js +9 -0
- package/dist/runnable.js +2 -1
- package/dist/runner/adapter-loop.d.ts +14 -6
- package/dist/runner/adapter-loop.js +25 -14
- package/dist/runner/adapter-run-spec.d.ts +22 -7
- package/dist/runner/adapter-run-spec.js +130 -77
- package/dist/runner/adapters/index.d.ts +4 -2
- package/dist/runner/adapters/index.js +35 -4
- package/dist/runner/adapters/pi.d.ts +4 -12
- package/dist/runner/adapters/pi.js +2 -2
- package/dist/runner/audit.d.ts +5 -1
- package/dist/runner/audit.js +31 -12
- package/dist/runner/beside.d.ts +7 -2
- package/dist/runner/beside.js +41 -9
- package/dist/runner/claim-secrets.d.ts +66 -1
- package/dist/runner/claim-secrets.js +136 -3
- package/dist/runner/cli-run-spec.d.ts +2 -1
- package/dist/runner/cli-run-spec.js +82 -59
- package/dist/runner/commands.d.ts +3 -6
- package/dist/runner/conformance/harness.d.ts +6 -0
- package/dist/runner/conformance/harness.js +16 -5
- package/dist/runner/dispatch.d.ts +2 -2
- package/dist/runner/end-of-run.d.ts +6 -14
- package/dist/runner/end-of-run.js +8 -33
- package/dist/runner/feedback-round.d.ts +5 -4
- package/dist/runner/feedback-round.js +14 -10
- package/dist/runner/github-app.js +3 -1
- package/dist/runner/harness-loops.d.ts +0 -8
- package/dist/runner/harness-loops.js +30 -56
- package/dist/runner/held.d.ts +170 -0
- package/dist/runner/held.js +57 -0
- package/dist/runner/journal-kinds.d.ts +7 -3
- package/dist/runner/journal-kinds.js +2 -3
- package/dist/runner/learned-first.d.ts +40 -0
- package/dist/runner/learned-first.js +32 -0
- package/dist/runner/learning-end.d.ts +77 -66
- package/dist/runner/learning-end.js +250 -299
- package/dist/runner/learning-seed.d.ts +15 -33
- package/dist/runner/learning-seed.js +24 -45
- package/dist/runner/loop-contract.d.ts +8 -3
- package/dist/runner/loop-contract.js +4 -0
- package/dist/runner/loop.js +6 -2
- package/dist/runner/main.d.ts +18 -9
- package/dist/runner/main.js +82 -22
- package/dist/runner/mcp-run.d.ts +11 -0
- package/dist/runner/mcp-run.js +67 -0
- package/dist/runner/memory-claim.d.ts +14 -6
- package/dist/runner/memory-claim.js +18 -9
- package/dist/runner/model-route.d.ts +7 -4
- package/dist/runner/model-route.js +22 -10
- package/dist/runner/native-loop.d.ts +0 -7
- package/dist/runner/native-loop.js +9 -101
- package/dist/runner/promotion.d.ts +13 -6
- package/dist/runner/promotion.js +63 -17
- package/dist/runner/reflect-hook.d.ts +64 -91
- package/dist/runner/reflect-hook.js +112 -206
- package/dist/runner/run-channel.d.ts +43 -0
- package/dist/runner/run-channel.js +467 -0
- package/dist/runner/run-child-host.d.ts +169 -0
- package/dist/runner/run-child-host.js +1222 -0
- package/dist/runner/run-child.d.ts +1 -0
- package/dist/runner/run-child.js +254 -0
- package/dist/runner/run-errors.d.ts +2 -0
- package/dist/runner/run-errors.js +20 -0
- package/dist/runner/runner.js +58 -9
- package/dist/runner/sdk-ask.d.ts +78 -0
- package/dist/runner/sdk-ask.js +158 -0
- package/dist/runner/sdk-loop.d.ts +2 -4
- package/dist/runner/sdk-loop.js +29 -49
- package/dist/runner/store-secrets.d.ts +5 -3
- package/dist/runner/store-secrets.js +14 -6
- package/dist/runner/workflow-first.d.ts +5 -0
- package/dist/runner/workflow-first.js +4 -0
- package/dist/runner/workflow-spec.js +17 -4
- package/dist/runs-over-store.d.ts +21 -32
- package/dist/runs-over-store.js +44 -41
- package/dist/sdk/runs.d.ts +6 -11
- package/dist/sdk/runs.js +20 -41
- package/dist/sdk/schema.js +3 -4
- package/dist/sdk/workflows.d.ts +1 -1
- package/dist/seal-key.d.ts +5 -0
- package/dist/seal-key.js +7 -0
- package/dist/secrets.d.ts +3 -0
- package/dist/secrets.js +16 -3
- package/dist/server.d.ts +119 -83
- package/dist/server.js +1121 -419
- package/dist/sign-ins-store.d.ts +8 -0
- package/dist/sign-ins-store.js +36 -1
- package/dist/skills.js +1 -1
- package/dist/store/index.d.ts +3 -3
- package/dist/store/index.js +2 -2
- package/dist/store/journal/storage.js +3 -0
- package/dist/store/postgres/migrations/0017_run_listing.sql +83 -0
- package/dist/store/postgres/migrations/0018_trigger_template.sql +6 -0
- package/dist/store/postgres/migrations/0019_runner_relays.sql +28 -0
- package/dist/store/schema.d.ts +53 -4
- package/dist/store/schema.js +137 -6
- package/dist/store/seal.d.ts +20 -2
- package/dist/store/seal.js +24 -8
- package/dist/store/sqlite/connection.d.ts +2 -0
- package/dist/store/sqlite/connection.js +3 -1
- package/dist/store/sqlite/run-launch.d.ts +4 -1
- package/dist/store/sqlite/run-launch.js +12 -0
- package/dist/store/sqlite/run-patch.d.ts +0 -17
- package/dist/store/sqlite/run-patch.js +4 -33
- package/dist/store/sqlite/store.d.ts +3 -2
- package/dist/store/sqlite/store.js +360 -75
- package/dist/store/sqlite/worker.js +25 -0
- package/dist/store/store.d.ts +231 -39
- package/dist/store/store.js +25 -3
- package/dist/store-reads/analytics.js +11 -1
- package/dist/store-reads/learning.d.ts +131 -194
- package/dist/store-reads/learning.js +292 -301
- package/dist/store-reads/loop.d.ts +0 -1
- package/dist/store-reads/loop.js +1 -1
- package/dist/store-reads/stats.js +13 -3
- package/dist/store-view.d.ts +34 -2
- package/dist/store-view.js +108 -41
- package/dist/telemetry.d.ts +59 -0
- package/dist/telemetry.js +153 -0
- package/dist/template-eval.d.ts +3 -6
- package/dist/template-eval.js +22 -36
- package/dist/templates.d.ts +2 -1
- package/dist/templates.js +6 -3
- package/dist/timeline/index.d.ts +1 -1
- package/dist/timeline/index.js +1 -1
- package/dist/timeline/timeline.d.ts +5 -1
- package/dist/timeline/timeline.js +16 -0
- package/dist/tool-gate.d.ts +0 -7
- package/dist/tool-gate.js +1 -15
- package/dist/tool-keys-store.d.ts +1 -1
- package/dist/tool-keys.d.ts +6 -4
- package/dist/tool-keys.js +12 -6
- package/dist/tool-plane.d.ts +12 -12
- package/dist/tools.d.ts +13 -13
- package/dist/tools.js +29 -9
- package/dist/trigger-adapter.d.ts +3 -0
- package/dist/trigger-adapters.d.ts +4 -0
- package/dist/trigger-adapters.js +13 -0
- package/dist/trigger-composio.d.ts +58 -1
- package/dist/trigger-composio.js +160 -6
- package/dist/triggers.d.ts +64 -5
- package/dist/triggers.js +141 -17
- package/dist/validate.d.ts +11 -7
- package/dist/validate.js +9 -8
- package/dist/webhooks.d.ts +4 -1
- package/dist/webhooks.js +11 -4
- package/dist/workspace/agent-computer.d.ts +2 -0
- package/dist/workspace/agent-computer.js +2 -0
- package/dist/workspace/archil-claim.d.ts +7 -0
- package/dist/workspace/archil-claim.js +29 -0
- package/dist/workspace/archil.d.ts +9 -1
- package/dist/workspace/archil.js +165 -3
- package/dist/workspace/attach.d.ts +3 -1
- package/dist/workspace/attach.js +2 -0
- package/dist/workspace/attached-computers.d.ts +16 -5
- package/dist/workspace/attached-computers.js +25 -9
- package/dist/workspace/computer-deps.js +1 -1
- package/dist/workspace/computer-for-claim.d.ts +22 -8
- package/dist/workspace/computer-for-claim.js +339 -46
- package/dist/workspace/computer-hold.js +2 -1
- package/dist/workspace/computer-kept.d.ts +11 -1
- package/dist/workspace/computer-kept.js +24 -3
- package/dist/workspace/resolve-computer.d.ts +41 -21
- package/dist/workspace/resolve-computer.js +172 -64
- package/dist/workspace/revision-skills.d.ts +1 -2
- package/dist/workspace/revision-skills.js +3 -4
- package/dist/workspace/run-workspace.d.ts +1 -1
- package/dist/workspace/run-workspace.js +5 -0
- package/dist/workspace/synced-folder.d.ts +85 -0
- package/dist/workspace/synced-folder.js +230 -0
- package/dist/workspace/workspace.d.ts +4 -0
- package/launcher/agentrun-serve +1 -1
- package/package.json +10 -9
- package/templates/README.md +7 -7
- package/templates/inbound-lead/agent.md +3 -3
- package/templates/inbound-lead/evals/learned-correction/case.yaml +3 -3
- package/templates/inbound-lead/evals/learned-correction/fixtures/corrections.md +1 -0
- package/templates/inbound-lead/evals/learned-correction/graders/applies-correction.md +22 -0
- package/templates/inbound-lead/evals/learned-correction/graders/learned-origin.md +1 -1
- package/templates/inbound-lead/evals/learned-correction/prompt.md +1 -1
- package/templates/inbound-lead/lead.schema.json +6 -5
- package/templates/inbound-lead/rules/RUBRIC.md +4 -4
- package/templates/inbound-lead/skills/lead/SKILL.md +4 -4
- package/templates/market-monitor/evals/learned-preference/case.yaml +4 -4
- package/templates/market-monitor/evals/learned-preference/fixtures/corrections.md +1 -0
- package/templates/market-monitor/evals/learned-preference/graders/omits-junior-post.md +3 -3
- package/templates/market-monitor/evals/learned-preference/prompt.md +1 -1
- package/templates/release-notes/evals/learned-style/case.yaml +4 -4
- package/templates/release-notes/evals/learned-style/fixtures/corrections.md +1 -0
- package/templates/release-notes/evals/learned-style/graders/same-changes.md +2 -2
- package/templates/release-notes/evals/learned-style/prompt.md +1 -1
- package/dist/console/assets/index-BrcDSBD8.css +0 -1
- package/dist/console/assets/index-Bz6IWncl.js +0 -711
- package/dist/learn/grade.d.ts +0 -138
- package/dist/learn/grade.js +0 -682
- package/dist/learn/notes.d.ts +0 -81
- package/dist/learn/notes.js +0 -178
- package/dist/learn/reflect.d.ts +0 -77
- package/dist/learn/reflect.js +0 -228
- package/dist/learn/relevance.d.ts +0 -24
- package/dist/learn/relevance.js +0 -91
- package/dist/learn/seed-check.d.ts +0 -74
- package/dist/learn/seed-check.js +0 -103
- package/dist/learning-batch.d.ts +0 -291
- package/dist/learning-batch.js +0 -600
- package/dist/learning-evals.d.ts +0 -33
- package/dist/learning-evals.js +0 -98
- package/dist/native/context.d.ts +0 -6
- package/dist/native/context.js +0 -22
- package/dist/propose.d.ts +0 -52
- package/dist/propose.js +0 -224
- package/dist/runner/learning-ask.d.ts +0 -47
- package/dist/runner/learning-ask.js +0 -128
- package/dist/runner/learning-dispatch.d.ts +0 -45
- package/dist/runner/learning-dispatch.js +0 -99
- package/dist/runner/learning-factory.d.ts +0 -16
- package/dist/runner/learning-factory.js +0 -50
- package/dist/runner/learning-loop.d.ts +0 -273
- package/dist/runner/learning-loop.js +0 -521
- package/dist/usage.d.ts +0 -11
- package/dist/usage.js +0 -11
- package/templates/inbound-lead/evals/learned-correction/fixtures/learning/MEMORY.md +0 -1
- package/templates/inbound-lead/evals/learned-correction/fixtures/learning/no-agencies.md +0 -14
- package/templates/inbound-lead/evals/learned-correction/graders/applies-note.md +0 -21
- package/templates/market-monitor/evals/learned-preference/fixtures/learning/MEMORY.md +0 -1
- package/templates/market-monitor/evals/learned-preference/fixtures/learning/skip-junior-job-posts.md +0 -8
- package/templates/release-notes/evals/learned-style/fixtures/learning/MEMORY.md +0 -1
- package/templates/release-notes/evals/learned-style/fixtures/learning/say-agent-not-bot.md +0 -13
package/dist/workspace/archil.js
CHANGED
|
@@ -1,3 +1,55 @@
|
|
|
1
|
+
// ArchilWorkspace: a Workspace on a folder of the owner's Archil disk, through the disk's file API and its serverless
|
|
2
|
+
// exec (archil-disk.ts, archil-exec.ts). Nothing is mounted on the server or a runner, and no program runs here.
|
|
3
|
+
//
|
|
4
|
+
// Keys. The workspace's root is a folder of the disk (paths.ts runKey or learningKey); every key, prefix, directory
|
|
5
|
+
// and exec mount it sends is the root or under it, or its exec spill folder beside it (spillFolderOf: a run's
|
|
6
|
+
// "exec-out"), built from paths paths.ts has checked. An exec mounts those two folders alone (each a mount's
|
|
7
|
+
// subdirectory): the rest of the owner's disk is not in its container. The spill folder holds an exec's stdin and its
|
|
8
|
+
// output while the exec runs (archil-exec.ts); the workspace's own calls are rooted at the root, so they never meet it,
|
|
9
|
+
// each exec's files are deleted on every path, and sweep() clears what a killed exec left.
|
|
10
|
+
//
|
|
11
|
+
// An exec asked to run with no network (ExecOptions.network "deny", a bash policy's shell: run-tools.ts) is sent with
|
|
12
|
+
// its egress denied (DENY_EGRESS): the container reaches the two mounted folders and nothing else. Archil refuses a
|
|
13
|
+
// network policy on a plan without one (its Free plan). Then the command runs with the network open, as the owner's
|
|
14
|
+
// plan allows, and its stderr starts with one line saying so and why, Archil's words included. The workspace remembers
|
|
15
|
+
// the refusal, so its later execs are sent without the policy and say the same.
|
|
16
|
+
//
|
|
17
|
+
// Durability. Archil commits a put, an append or a delete before it answers 200, so each call returns once the API
|
|
18
|
+
// has answered. A write is one put. The API has no rename, so there is no temporary key; that a reader sees the old
|
|
19
|
+
// file or the new one, never a mix, rests on Archil's S3 gateway publishing an object when its put completes (a
|
|
20
|
+
// multipart one, above 16 MiB, when it is assembled). It was observed live (no read during a put over an 8 MiB file
|
|
21
|
+
// saw a mix) but Archil's docs do not promise it: a known limit. An append is cut into calls of at most 1 MiB, made in
|
|
22
|
+
// order, each after any exec of this workspace; a reader during it can see part of it (the port allows that), and
|
|
23
|
+
// once it returns all of it is there. One that fails says only what is known: the bytes appended, read back from the
|
|
24
|
+
// file's size, or else the bytes acknowledged and that the failed chunk's outcome is unknown (a chunk can commit and
|
|
25
|
+
// lose its answer), so the file must be re-read before a retry.
|
|
26
|
+
//
|
|
27
|
+
// Modes, a known limit. The port says an existing file keeps its mode on a write. The file API shows no mode, so this
|
|
28
|
+
// backend cannot read one to keep it, and a put does not keep it: measured live, a 0755 file is 0644 after a put.
|
|
29
|
+
//
|
|
30
|
+
// Links, as a live run on a dev disk showed. The file API cannot make a symbolic link, but an exec can, and the API
|
|
31
|
+
// never follows one: it lists a link as a file (it cannot tell them apart, so this backend lists it as one, and the
|
|
32
|
+
// port says so), a read of it answers 501 (UNAVAILABLE here), a read through a linked folder 404, a write through one
|
|
33
|
+
// 409 "an existing object blocks the path" (EXISTS here), and nothing is listed under one. A remove takes the link
|
|
34
|
+
// itself, never what it points at, and a recursive remove never walks into one. exec refuses a link on the way to its
|
|
35
|
+
// cwd (ESCAPE).
|
|
36
|
+
//
|
|
37
|
+
// The queue. While an exec runs it holds the folder, and Archil refuses a write under it (409). So this workspace runs
|
|
38
|
+
// its execs one at a time and makes its writes wait for them; a 409 from another client's hold is tried again for up
|
|
39
|
+
// to queueMs. Reads do not wait.
|
|
40
|
+
//
|
|
41
|
+
// In a computer. mountSpec() is the Archil mount a computer makes of the root: the disk's id, its region and the root as
|
|
42
|
+
// the folder (runKey), with the disk token from the function it was made with (the claim's, archil-claim.ts). attach()
|
|
43
|
+
// goes through the shared attach path (attach.ts checkReadBack, then attachedWorkspace) with the check the claim builds:
|
|
44
|
+
// the computer module's read-back of that mount under the claim's epoch. The read-back holds no token, so attach asks
|
|
45
|
+
// for none. Once attached, the computer syncs the mount after each changing call (the attach contract), so attach adds no
|
|
46
|
+
// sync of its own. Without a region and a token function, both are refused in words. Background programs need a
|
|
47
|
+
// computer: here `process` refuses every call, cause no-computer, as with any workspace that has none.
|
|
48
|
+
//
|
|
49
|
+
// A computer that takes no Archil mount holds the root as a synced folder (synced-folder.ts): syncStore() is the root
|
|
50
|
+
// through the file API as the runner keeps it, its files and `dir/` markers, and its modes and links in sync.json beside
|
|
51
|
+
// the root (syncMetaOf), and attach() with check.sync reads back a synced folder under the claim's epoch instead.
|
|
52
|
+
import { folderPathProblem } from "@parcha/agentrun-computer";
|
|
1
53
|
import { DENY_EGRESS, pinnedImage } from "./archil-disk.js";
|
|
2
54
|
import { ArchilEgressRefused, archilExec, COMMAND_MAX_MS, DEFAULT_QUEUE_MS, MAX_EXEC_MS, spillKeys, spillName } from "./archil-exec.js";
|
|
3
55
|
import { attachedWorkspace, checkReadBack, noProcesses } from "./attach.js";
|
|
@@ -686,11 +738,121 @@ class ArchilWorkspace {
|
|
|
686
738
|
return this.#mount(await this.#mountToken());
|
|
687
739
|
}
|
|
688
740
|
async attach(computer, check) {
|
|
689
|
-
// The computer module's read-back never holds the token, so the mount is compared without one.
|
|
690
|
-
|
|
691
|
-
|
|
741
|
+
// The computer module's read-back never holds the token, so the mount is compared without one. A synced folder
|
|
742
|
+
// reads back with no source: the runner pushed this folder into it (synced-folder.ts).
|
|
743
|
+
await checkReadBack(computer, check.sync ? { kind: "sync" } : this.#mount(""), check);
|
|
744
|
+
// The computer syncs the mount after each changing call (the attach contract), and a synced folder's client lands
|
|
745
|
+
// the delta here before each answers: nothing more to make durable here.
|
|
692
746
|
return attachedWorkspace(this, computer, { synced: async () => true });
|
|
693
747
|
}
|
|
748
|
+
/** The folder as a synced folder's runner keeps it (synced-folder.ts): its files and directories through the file
|
|
749
|
+
* API, each write after this workspace's execs; its modes and links, which the file API keeps no record of, in
|
|
750
|
+
* sync.json beside it (syncMetaOf). A failed write answers in words, kind limit where the disk took too much. */
|
|
751
|
+
syncStore() {
|
|
752
|
+
const meta = syncMetaOf(this.#root);
|
|
753
|
+
const wrote = async (path, what, call) => {
|
|
754
|
+
try {
|
|
755
|
+
const rel = relativeSegments(path).join("/");
|
|
756
|
+
await this.#write(rel, () => call(this.#key(rel)));
|
|
757
|
+
return { ok: true, value: undefined };
|
|
758
|
+
}
|
|
759
|
+
catch (error) {
|
|
760
|
+
const why = failed(error, path, what);
|
|
761
|
+
return { ok: false, error: { code: why.code === "TOO_LARGE" ? "limit" : "refused", message: why.message } };
|
|
762
|
+
}
|
|
763
|
+
};
|
|
764
|
+
return {
|
|
765
|
+
put: (path, body) => wrote(path, "put", (key) => this.#disk.putObject(key, body)),
|
|
766
|
+
mkdir: (path) => wrote(path, "mkdir", (key) => this.#disk.putObject(`${key}/`, new Uint8Array(0))),
|
|
767
|
+
remove: (path, type) => wrote(path, "remove", (key) => this.#disk.deleteObject(type === "dir" ? `${key}/` : key)),
|
|
768
|
+
meta: async (folder) => {
|
|
769
|
+
try {
|
|
770
|
+
await this.#write("", () => this.#disk.putObject(meta, Buffer.from(JSON.stringify(folder))));
|
|
771
|
+
return { ok: true, value: undefined };
|
|
772
|
+
}
|
|
773
|
+
catch (error) {
|
|
774
|
+
return { ok: false, error: { code: "refused", message: `the folder's sync.json: ${describe(error)}` } };
|
|
775
|
+
}
|
|
776
|
+
},
|
|
777
|
+
entries: () => this.#syncEntries(),
|
|
778
|
+
read: async (path, size) => {
|
|
779
|
+
if (size === 0)
|
|
780
|
+
return new Uint8Array(0);
|
|
781
|
+
try {
|
|
782
|
+
const got = await this.#disk.getRange(this.#key(relativeSegments(path).join("/")), `bytes=0-${size - 1}`);
|
|
783
|
+
return got.status === 416 ? new Uint8Array(0) : got.body;
|
|
784
|
+
}
|
|
785
|
+
catch (error) {
|
|
786
|
+
throw failed(error, path, "read");
|
|
787
|
+
}
|
|
788
|
+
},
|
|
789
|
+
readMeta: async () => {
|
|
790
|
+
let got;
|
|
791
|
+
try {
|
|
792
|
+
got = await this.#disk.getRange(meta, `bytes=0-${SYNC_META_MAX - 1}`);
|
|
793
|
+
}
|
|
794
|
+
catch (error) {
|
|
795
|
+
if (statusOf(error) === 404)
|
|
796
|
+
return undefined;
|
|
797
|
+
throw failed(error, "", "the folder's sync.json: read");
|
|
798
|
+
}
|
|
799
|
+
return got.status === 416 ? undefined : folderMetaOf(got.body);
|
|
800
|
+
},
|
|
801
|
+
};
|
|
802
|
+
}
|
|
803
|
+
/** Every file and directory under the root, each once, a directory before what is in it: a key the relative-path
|
|
804
|
+
* rule refuses throws in words. */
|
|
805
|
+
async *#syncEntries() {
|
|
806
|
+
const prefix = `${this.#root}/`;
|
|
807
|
+
const seen = new Set();
|
|
808
|
+
for await (const page of this.#pages(prefix, true)) {
|
|
809
|
+
for (const [key, size] of [...page.objects.map((object) => [object.key, object.size]), ...page.commonPrefixes.map((common) => [common, 0])]) {
|
|
810
|
+
if (!key.startsWith(prefix))
|
|
811
|
+
continue;
|
|
812
|
+
const dir = key.endsWith("/");
|
|
813
|
+
const path = key.slice(prefix.length, dir ? -1 : undefined);
|
|
814
|
+
if (path === "")
|
|
815
|
+
continue;
|
|
816
|
+
const problem = folderPathProblem(path);
|
|
817
|
+
if (problem !== undefined)
|
|
818
|
+
throw new WorkspaceError("REFUSED", `the run's folder on the disk holds ${JSON.stringify(path)}, which ${problem}, so it can't be synced: rename or remove it`, { path });
|
|
819
|
+
const parts = path.split("/");
|
|
820
|
+
for (let cut = 1; cut < parts.length; cut++) {
|
|
821
|
+
const up = parts.slice(0, cut).join("/");
|
|
822
|
+
if (seen.has(up))
|
|
823
|
+
continue;
|
|
824
|
+
seen.add(up);
|
|
825
|
+
yield { path: up, type: "dir", size: 0 };
|
|
826
|
+
}
|
|
827
|
+
if (seen.has(path))
|
|
828
|
+
continue;
|
|
829
|
+
seen.add(path);
|
|
830
|
+
yield { path, type: dir ? "dir" : "file", size: dir ? 0 : size };
|
|
831
|
+
}
|
|
832
|
+
}
|
|
833
|
+
}
|
|
834
|
+
}
|
|
835
|
+
/** The most bytes a folder's sync.json is read of. */
|
|
836
|
+
const SYNC_META_MAX = 32 * 1024 * 1024;
|
|
837
|
+
/** Where a synced folder's modes and links are kept: beside its root, never inside it, as its spill folder is. A run's
|
|
838
|
+
* ".../runs/<run>/work" keeps them in ".../runs/<run>/sync.json"; any other root in "<root>.sync.json". */
|
|
839
|
+
export const syncMetaOf = (root) => (root.endsWith("/work") ? `${root.slice(0, -"/work".length)}/sync.json` : `${root}.sync.json`);
|
|
840
|
+
/** sync.json's bytes as a FolderMeta: each mode a whole permission number, each link's target text; anything else in it
|
|
841
|
+
* is left out. Bytes that are no JSON object throw in words. */
|
|
842
|
+
function folderMetaOf(bytes) {
|
|
843
|
+
let read;
|
|
844
|
+
try {
|
|
845
|
+
read = JSON.parse(Buffer.from(bytes).toString("utf8"));
|
|
846
|
+
}
|
|
847
|
+
catch (error) {
|
|
848
|
+
throw new WorkspaceError("UNAVAILABLE", `the folder's sync.json is not JSON: ${describe(error)}`);
|
|
849
|
+
}
|
|
850
|
+
const record = (value) => (typeof value === "object" && value !== null && !Array.isArray(value) ? value : {});
|
|
851
|
+
const { modes, links } = record(read);
|
|
852
|
+
return {
|
|
853
|
+
modes: Object.fromEntries(Object.entries(record(modes)).filter((pair) => Number.isInteger(pair[1]) && pair[1] >= 0 && pair[1] <= 0o7777)),
|
|
854
|
+
links: Object.fromEntries(Object.entries(record(links)).filter((pair) => typeof pair[1] === "string" && !pair[1].includes("\0"))),
|
|
855
|
+
};
|
|
694
856
|
}
|
|
695
857
|
/** A Workspace on folder `root` of Archil disk `disk` (a relative key, e.g. agents/<agent>/runs/<run>/work). */
|
|
696
858
|
export const archilWorkspace = (disk, root, options) => new ArchilWorkspace(disk, root, options);
|
|
@@ -2,10 +2,12 @@ import type { ComputerClient, Empty, MountReadBack, MountSpec, ProcessExit, Proc
|
|
|
2
2
|
import { type Workspace } from "./workspace.js";
|
|
3
3
|
/** What attach runs of D, passed in (the cutover passes D's own): the read-back a mount made as `spec` asks gives, and
|
|
4
4
|
* the claim's epoch it is read back under (D reads an Archil mount back with the computer's claim epoch; a bind takes
|
|
5
|
-
* none).
|
|
5
|
+
* none). `sync`: the claim made the computer a synced folder of the Workspace (resolve-computer.ts), so it reads back
|
|
6
|
+
* as one, under the epoch. */
|
|
6
7
|
export type MountCheck = {
|
|
7
8
|
readonly readBackOf: (spec: MountSpec, epoch?: number) => MountReadBack;
|
|
8
9
|
readonly epoch?: number;
|
|
10
|
+
readonly sync?: true;
|
|
9
11
|
};
|
|
10
12
|
/** A computer as attach takes it: its ref, its computerd client, and D's read-back of what it mounts at /workspace. */
|
|
11
13
|
export interface AttachableComputer {
|
package/dist/workspace/attach.js
CHANGED
|
@@ -422,6 +422,8 @@ const shown = (back) => {
|
|
|
422
422
|
return back.other;
|
|
423
423
|
if (back.kind === "bind")
|
|
424
424
|
return `a bind of ${back.path}`;
|
|
425
|
+
if (back.kind === "sync")
|
|
426
|
+
return `a synced folder under epoch ${back.epoch}`;
|
|
425
427
|
const { exclusive, epoch } = held(back);
|
|
426
428
|
const hold = exclusive === undefined ? "" : exclusive === true ? ", exclusive" : ", not exclusive";
|
|
427
429
|
return `${back.disk}:/${back.folder} in ${back.region}${hold}${epoch === undefined ? "" : ` under epoch ${String(epoch)}`}`;
|
|
@@ -6,8 +6,18 @@ import type { ComputerSettingKind, KindRegistry, ProviderEntry } from "./resolve
|
|
|
6
6
|
export declare const PAIRED_ID_PREFIX = "cmp-";
|
|
7
7
|
/** The image a paired computer's spec names: none is made, so this only says what it is. */
|
|
8
8
|
export declare const ATTACHED_IMAGE = "attached";
|
|
9
|
+
/** How to start a server so its runs can use a paired computer, in one line: the same words wherever it is said. */
|
|
10
|
+
export declare const ONE_PROCESS_FIX = "start the image with the server options alone, without server-and-runner (outside the image: agentrun-serve without --no-runner)";
|
|
9
11
|
/** The words a run gets when its agent's computer is a paired computer and its runner is not in the server's process. */
|
|
10
|
-
export declare const ONE_PROCESS_WORDS = "a paired computer's socket is held by the
|
|
12
|
+
export declare const ONE_PROCESS_WORDS = "a paired computer's socket is held by the server process it dialed, and this runner runs in a process of its own: start the image with the server options alone, without server-and-runner (outside the image: agentrun-serve without --no-runner)";
|
|
13
|
+
/** What a pairing code, the pair answer and each paired computer say on a server whose runner runs in a process of its
|
|
14
|
+
* own (--no-runner; the image's server-and-runner): the computer pairs, and no run here can use it. */
|
|
15
|
+
export declare const RUNNER_APART_WORDS = "no run on this server can use a paired computer: its runner runs in a process of its own, and the computer's socket is held by the server's: start the image with the server options alone, without server-and-runner (outside the image: agentrun-serve without --no-runner)";
|
|
16
|
+
/** What a provider whose machines dial this server (the computer package's connectOf "dial": Fly Machines, Cloudflare,
|
|
17
|
+
* and E2B, Daytona or Modal set to dial) says on such a server: its row in GET /v2/computers and its test. Its
|
|
18
|
+
* machines' sockets are taken by the server's attach hub, and a runner of its own process has none, so its create
|
|
19
|
+
* refuses (the computer package's hosted/provider.ts, naming the same fix). */
|
|
20
|
+
export declare const dialApartWords: (label: string) => string;
|
|
11
21
|
/** What the claim reads of the paired computers: the store's rows (removed ones left out), and the server's hub where
|
|
12
22
|
* the runner shares its process (absent: a runner of its own process). */
|
|
13
23
|
export interface AttachedComputers {
|
|
@@ -25,13 +35,14 @@ export declare function helloLacks(hello: Partial<HelloResult>, kind: ComputerSe
|
|
|
25
35
|
* words that say what it lacks and to update the driver. Undefined when it serves one. */
|
|
26
36
|
export declare function servesNoKind(name: string, hello: Partial<HelloResult>): string | undefined;
|
|
27
37
|
/** A paired computer as a provider of `registry`: named by its name and its os, as an agent's computer picker lists it;
|
|
28
|
-
* the setting kinds its paired hello serves, no keys,
|
|
29
|
-
*
|
|
38
|
+
* the setting kinds its paired hello serves, no keys, the machine's own network ("open": a run never narrows a person's
|
|
39
|
+
* own machine), never metered. A sandbox (a Linux box with files and exec) takes the run's folder as a synced folder
|
|
40
|
+
* (the computer package's attachedProvider checks its /workspace); a desktop or a phone takes no mount. */
|
|
30
41
|
export declare function pairedEntry(row: PairedComputerRow, registry: Pick<KindRegistry, "SETTING_KINDS" | "servingRefusals">): ProviderEntry;
|
|
31
42
|
/** `registry` with each paired computer of `rows` as one more provider (pairedEntry), and the words for one that cannot
|
|
32
43
|
* serve a kind an agent asks of it: it is a computer of the person's own, and either the attach path carries no such
|
|
33
|
-
* kind (ATTACH_CANNOT: a
|
|
34
|
-
* kind it serves, or its driver lacks what the kind needs (helloLacks), so the driver is what to update. */
|
|
44
|
+
* kind (ATTACH_CANNOT: a browser), or it is a desktop or a phone asked to be a sandbox (PAIRED_SANDBOX), so the agent
|
|
45
|
+
* takes it as the kind it serves, or its driver lacks what the kind needs (helloLacks), so the driver is what to update. */
|
|
35
46
|
export declare function withPaired<R extends KindRegistry>(registry: R, rows: readonly PairedComputerRow[]): R;
|
|
36
47
|
/** The provider of the paired computer `row`: attachedProvider over the hub, or a refusal in ONE_PROCESS_WORDS where this
|
|
37
48
|
* process holds no hub. */
|
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
// configuration is the kind and groups it paired as. An agent's computer setting names it as its provider, {kind:
|
|
4
4
|
// "desktop", provider: "cmp-..."}, so a run resolves, checks and claims it on the one path every computer takes
|
|
5
5
|
// (resolve-computer.ts, computer-for-claim.ts), and the computer package's attachedProvider stands in for a vendor's.
|
|
6
|
+
// A Linux box with no display (computerd's hello says linux, with files and exec) is a sandbox: in Mode 2 it holds the
|
|
7
|
+
// run's folder as a synced folder in its own /workspace, as a hosted computer that dials does.
|
|
6
8
|
//
|
|
7
9
|
// Its socket is held by the AttachHub of the server's process: a runner in that process (the CLI's start, its runner
|
|
8
10
|
// beside the server) takes it; a runner of its own process cannot reach it and refuses it in ONE_PROCESS_WORDS.
|
|
@@ -12,8 +14,18 @@ import { attachedProvider, SETTING_KIND_NAMES, SETTING_KINDS } from "@parcha/age
|
|
|
12
14
|
export const PAIRED_ID_PREFIX = "cmp-";
|
|
13
15
|
/** The image a paired computer's spec names: none is made, so this only says what it is. */
|
|
14
16
|
export const ATTACHED_IMAGE = "attached";
|
|
17
|
+
/** How to start a server so its runs can use a paired computer, in one line: the same words wherever it is said. */
|
|
18
|
+
export const ONE_PROCESS_FIX = "start the image with the server options alone, without server-and-runner (outside the image: agentrun-serve without --no-runner)";
|
|
15
19
|
/** The words a run gets when its agent's computer is a paired computer and its runner is not in the server's process. */
|
|
16
|
-
export const ONE_PROCESS_WORDS =
|
|
20
|
+
export const ONE_PROCESS_WORDS = `a paired computer's socket is held by the server process it dialed, and this runner runs in a process of its own: ${ONE_PROCESS_FIX}`;
|
|
21
|
+
/** What a pairing code, the pair answer and each paired computer say on a server whose runner runs in a process of its
|
|
22
|
+
* own (--no-runner; the image's server-and-runner): the computer pairs, and no run here can use it. */
|
|
23
|
+
export const RUNNER_APART_WORDS = `no run on this server can use a paired computer: its runner runs in a process of its own, and the computer's socket is held by the server's: ${ONE_PROCESS_FIX}`;
|
|
24
|
+
/** What a provider whose machines dial this server (the computer package's connectOf "dial": Fly Machines, Cloudflare,
|
|
25
|
+
* and E2B, Daytona or Modal set to dial) says on such a server: its row in GET /v2/computers and its test. Its
|
|
26
|
+
* machines' sockets are taken by the server's attach hub, and a runner of its own process has none, so its create
|
|
27
|
+
* refuses (the computer package's hosted/provider.ts, naming the same fix). */
|
|
28
|
+
export const dialApartWords = (label) => `no run on this server can use ${label}: its machines dial this server, and its runner runs in a process of its own, with no attach hub to take their socket: ${ONE_PROCESS_FIX}`;
|
|
17
29
|
/** The store's row as the hub and attachedProvider take it. */
|
|
18
30
|
export const pairedOf = (row) => ({
|
|
19
31
|
id: row.id,
|
|
@@ -22,13 +34,13 @@ export const pairedOf = (row) => ({
|
|
|
22
34
|
labels: { ...row.labels },
|
|
23
35
|
});
|
|
24
36
|
/** The setting kinds the attach path cannot serve, with why and what to pair instead: a browser session needs a CDP
|
|
25
|
-
* connection, which the attach socket does not carry,
|
|
26
|
-
* computer has no mount for (resolve-computer.ts refuses a sandbox without one). Kind-based, never by OS: a driver whose hello serves one of
|
|
37
|
+
* connection, which the attach socket does not carry. Kind-based, never by OS: a driver whose hello serves one of
|
|
27
38
|
* these and no other kind is refused at pairing, and a paired row of one serves nothing. */
|
|
28
39
|
const ATTACH_CANNOT = {
|
|
29
40
|
browser: "a paired computer can't serve browser sessions yet, so pair a desktop or phone driver",
|
|
30
|
-
sandbox: "a paired computer can't mount a run's folder yet, so no agent could run a sandbox on it: pair a desktop or phone driver",
|
|
31
41
|
};
|
|
42
|
+
/** Which paired computer is a sandbox: a Linux box's computerd, its hello kind linux (no display), with files and exec. */
|
|
43
|
+
const PAIRED_SANDBOX = "only a Linux box paired with computerd and no display can be a sandbox computer";
|
|
32
44
|
/** What a driver's hello lacks to serve `kind`, by the kind registry's rule (the computer package's SETTING_KINDS, which
|
|
33
45
|
* servingRefusals reads): "it says desktop but declares no input.pointer, input.keys", "it says android, which no
|
|
34
46
|
* desktop computer is"; undefined when the hello serves the kind. The one source of a paired computer's words for a
|
|
@@ -58,8 +70,9 @@ export function servesNoKind(name, hello) {
|
|
|
58
70
|
return `${name}'s driver serves no kind: ${lack}: update the driver on ${name}`;
|
|
59
71
|
}
|
|
60
72
|
/** A paired computer as a provider of `registry`: named by its name and its os, as an agent's computer picker lists it;
|
|
61
|
-
* the setting kinds its paired hello serves, no keys,
|
|
62
|
-
*
|
|
73
|
+
* the setting kinds its paired hello serves, no keys, the machine's own network ("open": a run never narrows a person's
|
|
74
|
+
* own machine), never metered. A sandbox (a Linux box with files and exec) takes the run's folder as a synced folder
|
|
75
|
+
* (the computer package's attachedProvider checks its /workspace); a desktop or a phone takes no mount. */
|
|
63
76
|
export function pairedEntry(row, registry) {
|
|
64
77
|
const hello = row.hello;
|
|
65
78
|
const configuration = { kind: String(hello.kind ?? ""), groups: Array.isArray(hello.groups) ? [...hello.groups] : [] };
|
|
@@ -69,7 +82,7 @@ export function pairedEntry(row, registry) {
|
|
|
69
82
|
label: typeof hello.os === "string" ? `${row.name} (${hello.os})` : row.name,
|
|
70
83
|
kinds,
|
|
71
84
|
keys: [],
|
|
72
|
-
mounts: [],
|
|
85
|
+
mounts: kinds.includes("sandbox") ? ["sync"] : [],
|
|
73
86
|
network: ["open"],
|
|
74
87
|
metered: false,
|
|
75
88
|
capabilities: [configuration],
|
|
@@ -78,8 +91,8 @@ export function pairedEntry(row, registry) {
|
|
|
78
91
|
}
|
|
79
92
|
/** `registry` with each paired computer of `rows` as one more provider (pairedEntry), and the words for one that cannot
|
|
80
93
|
* serve a kind an agent asks of it: it is a computer of the person's own, and either the attach path carries no such
|
|
81
|
-
* kind (ATTACH_CANNOT: a
|
|
82
|
-
* kind it serves, or its driver lacks what the kind needs (helloLacks), so the driver is what to update. */
|
|
94
|
+
* kind (ATTACH_CANNOT: a browser), or it is a desktop or a phone asked to be a sandbox (PAIRED_SANDBOX), so the agent
|
|
95
|
+
* takes it as the kind it serves, or its driver lacks what the kind needs (helloLacks), so the driver is what to update. */
|
|
83
96
|
export function withPaired(registry, rows) {
|
|
84
97
|
if (rows.length === 0)
|
|
85
98
|
return registry;
|
|
@@ -89,6 +102,9 @@ export function withPaired(registry, rows) {
|
|
|
89
102
|
if (row !== undefined && kind in ATTACH_CANNOT && entry.kinds.length > 0) {
|
|
90
103
|
return `${row.name} is a computer of your own, and a paired computer can't be a ${kind} computer yet: give this agent ${row.name} as a ${entry.kinds.join(" or ")} computer`;
|
|
91
104
|
}
|
|
105
|
+
if (row !== undefined && kind === "sandbox" && entry.kinds.length > 0) {
|
|
106
|
+
return `${row.name} is a computer of your own, and ${PAIRED_SANDBOX}: give this agent ${row.name} as a ${entry.kinds.join(" or ")} computer`;
|
|
107
|
+
}
|
|
92
108
|
const lack = row === undefined ? undefined : helloLacks(row.hello, kind);
|
|
93
109
|
if (row === undefined || lack === undefined)
|
|
94
110
|
return registry.unservedWhy?.(entry, kind);
|
|
@@ -314,7 +314,7 @@ export function computerDepsFrom(options) {
|
|
|
314
314
|
// made as without it.
|
|
315
315
|
...(faux ? {
|
|
316
316
|
keyTable: { keys: { ...KEY_TABLE.keys, ...faux.keyTable.keys }, labels: { ...KEY_TABLE.labels, ...faux.keyTable.labels } },
|
|
317
|
-
launch: (entry, spec) => faux.launch(entry, spec),
|
|
317
|
+
launch: (entry, spec) => faux.launch(entry, spec, options.dial ? { dial: options.dial } : {}),
|
|
318
318
|
launches: (provider) => faux.owns(provider),
|
|
319
319
|
} : {}),
|
|
320
320
|
...(options.answers ? { answers: options.answers } : {}),
|
|
@@ -104,8 +104,11 @@ export interface ComputerForClaimDeps {
|
|
|
104
104
|
/** Its daemon's answer (docker-daemon.ts), asked when a launch on such a provider fails (ClaimSide.daemon). */
|
|
105
105
|
readonly daemon?: ClaimSide["daemon"];
|
|
106
106
|
/** A launch of the server's own in place of the providers' (--faux's desktop), for the providers `launches` takes (by
|
|
107
|
-
* id; absent, every one): any other is made by its provider, as with no launch.
|
|
108
|
-
|
|
107
|
+
* id; absent, every one): any other is made by its provider, as with no launch. Given the claim's run (`run`), as a
|
|
108
|
+
* provider's create is given it in its labels. */
|
|
109
|
+
readonly launch?: (entry: ProviderEntry, spec: Parameters<ClaimSide["launch"]>[1] & {
|
|
110
|
+
readonly run?: string;
|
|
111
|
+
}) => ReturnType<ClaimSide["launch"]>;
|
|
109
112
|
readonly launches?: (provider: string) => boolean;
|
|
110
113
|
/** The run's folder (mounted only where the provider mounts it) and the mount check attach runs. */
|
|
111
114
|
readonly workspace: Workspace;
|
|
@@ -115,11 +118,12 @@ export interface ComputerForClaimDeps {
|
|
|
115
118
|
readonly revokeMount?: () => Promise<void>;
|
|
116
119
|
/** The live view's registration for a desktop or a phone (proxy-only). Absent: no view is opened. */
|
|
117
120
|
readonly openComputerView?: OpenComputerView;
|
|
118
|
-
/** Where the agent's setting asks for a video of its
|
|
121
|
+
/** Where the agent's setting asks for a video of its computer's screen (computer.record): the run's
|
|
119
122
|
* recordings folder on this machine (paths.ts recordingsFolder) and where its lines on the run's timeline go
|
|
120
|
-
* (computer-record.ts startRecording; for tests, the program in ffmpeg's place and the bounds). The
|
|
121
|
-
* attaches is recorded through a watch of its own, with or without a viewer, until its release, the run's
|
|
122
|
-
* park
|
|
123
|
+
* (computer-record.ts startRecording; for tests, the program in ffmpeg's place and the bounds). The desktop or phone
|
|
124
|
+
* this claim attaches is recorded through a watch of its own, with or without a viewer, until its release, the run's
|
|
125
|
+
* end or its park; a browser's sessions each by the run's browser tool, through its ClaimBrowser's `record`. Absent:
|
|
126
|
+
* nothing is recorded. */
|
|
123
127
|
readonly recordings?: Pick<RecordInput, "folder" | "say" | "ffmpeg" | "limits">;
|
|
124
128
|
/** Told once, before the claim waits on its computer's image (a provider that makes its own: Docker's recipe built on
|
|
125
129
|
* a host that lacks it, or a named image pulled); never when the host has it. The run's caller says it on the run's
|
|
@@ -144,8 +148,17 @@ export interface ComputerForClaimDeps {
|
|
|
144
148
|
* it refuses is refused with code computer_unavailable before anything is made. Absent: every kind. */
|
|
145
149
|
readonly refuseKind?: (kind: Exclude<ComputerSettingKind, "none">) => string | undefined;
|
|
146
150
|
/** Told what became of the agent's own computer at the claim (a persistent setting): made, attached from an earlier
|
|
147
|
-
* run, or made again because the one this server kept is gone
|
|
151
|
+
* run, or made again because the one this server kept is gone; and when a sandbox the claim made was lost mid-run and
|
|
152
|
+
* a new one started in its place (computer-lost.ts lostRecreatedWords). The run's caller says it on the run's
|
|
153
|
+
* timeline. */
|
|
148
154
|
readonly onComputerNote?: (words: string) => void;
|
|
155
|
+
/** The most new sandboxes the claim starts in place of ones its provider lost mid-run (lostAware); the next loss past
|
|
156
|
+
* them ends the run, code computer_unavailable. Default LOST_RECREATES (2). */
|
|
157
|
+
readonly recreates?: number;
|
|
158
|
+
/** Stops the run for good in `words`, from any caller (paid-calls.ts stopRunWith over the run's ledger's pause): how a
|
|
159
|
+
* loss past `recreates` ends the run, whoever's call found it (the owner's computer channel too). Absent: the ledger
|
|
160
|
+
* of the tool call that found it (stopRun), and a loss found outside one stops nothing. */
|
|
161
|
+
readonly stopRun?: (words: string) => Promise<void>;
|
|
149
162
|
/** Whether the run's journal says an earlier claim made the run a computer of its own (ClaimComputer.made, recorded by
|
|
150
163
|
* the adapter loop: computer-journal.ts hadComputer): asked at a later claim that makes a fresh one, before anything
|
|
151
164
|
* is rented, so a claim that finds no older computer of the run to let go (the earlier claim let its own go at its
|
|
@@ -182,7 +195,8 @@ export interface ClaimComputer {
|
|
|
182
195
|
/** The claim's release at the run's park, for `cause`: a computer it `keeps` is kept for KEEP_MS (computer-kept.ts),
|
|
183
196
|
* its live view closed with the park's cause and the keep's time (ParkedEnd) and its hold ended, but the machine left
|
|
184
197
|
* running and its mount credential left in place, and true is answered; any other is released as `release` does, and
|
|
185
|
-
* false.
|
|
198
|
+
* false. A synced folder's delta lands first: one that does not keeps nothing, and the park throws as `release` does.
|
|
199
|
+
* Idempotent with `release`. */
|
|
186
200
|
park?(cause: ParkCause): Promise<boolean>;
|
|
187
201
|
}
|
|
188
202
|
/** The kinds of computer a claim makes the run fresh. */
|