@parcha/agentrun-serve 0.1.0-beta.46 → 0.1.0-beta.48
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 +211 -1
- package/NOTICE +4 -0
- package/README.md +350 -53
- package/dist/acp-package.d.ts +53 -6
- package/dist/acp-package.js +3 -3
- package/dist/adapter-facts.d.ts +3 -4
- package/dist/adapter-facts.js +4 -4
- package/dist/adapters.d.ts +3 -5
- package/dist/adapters.js +1 -31
- package/dist/agents-store.d.ts +5 -3
- package/dist/agents-store.js +13 -8
- package/dist/answer-json.d.ts +10 -0
- package/dist/answer-json.js +24 -0
- package/dist/api-only.d.ts +11 -11
- package/dist/api-only.js +16 -11
- package/dist/archil-routes.js +2 -1
- package/dist/browser-live.d.ts +9 -4
- package/dist/browser-live.js +18 -5
- package/dist/cap.js +10 -2
- package/dist/chatgpt-plan.js +2 -1
- package/dist/cli.js +109 -41
- package/dist/composio-made.d.ts +19 -2
- package/dist/composio-made.js +17 -5
- package/dist/composio-preset.d.ts +42 -7
- package/dist/composio-preset.js +106 -70
- package/dist/composio-triggers.d.ts +9 -4
- package/dist/composio-triggers.js +20 -13
- package/dist/computer-attach.d.ts +11 -10
- package/dist/computer-attach.js +13 -14
- package/dist/computer-commands.d.ts +3 -0
- package/dist/computer-commands.js +3 -2
- package/dist/computer-lost.d.ts +4 -0
- package/dist/computer-lost.js +8 -3
- package/dist/computer-routes.d.ts +8 -5
- package/dist/computer-routes.js +7 -5
- package/dist/computer-setting.d.ts +2 -0
- package/dist/computer-setting.js +2 -0
- package/dist/computers.d.ts +14 -76
- package/dist/computers.js +24 -68
- package/dist/conformance.d.ts +4 -0
- package/dist/conformance.js +6 -0
- package/dist/console/assets/index-CTGegcKt.css +1 -0
- package/dist/console/assets/index-D1Se6mgG.js +715 -0
- package/dist/console/index.html +2 -2
- package/dist/cost-heal.d.ts +13 -0
- package/dist/cost-heal.js +27 -0
- package/dist/dial-relay.d.ts +6 -2
- package/dist/dial-relay.js +9 -12
- package/dist/email/routes.js +2 -1
- package/dist/errors.d.ts +2 -0
- package/dist/errors.js +5 -0
- package/dist/exa-keyless.d.ts +1 -1
- package/dist/exa-keyless.js +1 -1
- package/dist/faux-computers.d.ts +2 -3
- package/dist/faux-computers.js +9 -31
- package/dist/github-connection.js +2 -1
- package/dist/harness-archive.d.ts +19 -2
- package/dist/harness-archive.js +49 -15
- package/dist/harness-check.d.ts +75 -0
- package/dist/harness-check.js +518 -0
- package/dist/harness-cursor.d.ts +28 -0
- package/dist/harness-cursor.js +42 -0
- package/dist/harness-goose.d.ts +4 -29
- package/dist/harness-goose.js +6 -86
- package/dist/harness-module.d.ts +4 -0
- package/dist/harness-module.js +1 -0
- package/dist/harness-owned.d.ts +52 -0
- package/dist/harness-owned.js +92 -0
- package/dist/harness-recipe.d.ts +127 -0
- package/dist/harness-recipe.js +335 -0
- package/dist/harness-table.d.ts +120 -5
- package/dist/harness-table.js +280 -6
- package/dist/harness.d.ts +2 -0
- package/dist/harness.js +5 -4
- package/dist/host-check.d.ts +6 -0
- package/dist/host-check.js +14 -0
- package/dist/host.d.ts +10 -3
- package/dist/host.js +17 -3
- package/dist/import-sources.d.ts +2 -0
- package/dist/import-sources.js +2 -0
- package/dist/import-summary.d.ts +15 -5
- package/dist/import-summary.js +24 -8
- package/dist/import.d.ts +24 -4
- package/dist/import.js +108 -26
- package/dist/key-refusal.d.ts +3 -1
- package/dist/key-refusal.js +26 -5
- package/dist/key-words.d.ts +1 -1
- package/dist/key-words.js +4 -4
- package/dist/learn/check.d.ts +3 -0
- package/dist/learn/check.js +31 -20
- package/dist/learn/compile.js +12 -5
- package/dist/learn/promote.d.ts +80 -2
- package/dist/learn/promote.js +95 -3
- package/dist/learn/secrets.d.ts +4 -0
- package/dist/learn/secrets.js +23 -0
- package/dist/learned-nodes.d.ts +4 -3
- package/dist/learned-workflow.js +4 -1
- package/dist/learning-cost.d.ts +6 -16
- package/dist/learning-cost.js +6 -12
- package/dist/learning-model.d.ts +18 -0
- package/dist/learning-model.js +77 -0
- package/dist/learning-words.d.ts +2 -0
- package/dist/learning-words.js +1 -1
- package/dist/listen-first.d.ts +10 -0
- package/dist/listen-first.js +25 -1
- package/dist/llms.txt +2 -1
- package/dist/mcp-gateway.d.ts +2 -1
- package/dist/mcp-gateway.js +31 -15
- package/dist/mcp-probe.d.ts +18 -6
- package/dist/mcp-probe.js +41 -8
- package/dist/mcp-secret-writes.d.ts +8 -0
- package/dist/mcp-secret-writes.js +104 -4
- package/dist/mcp-servers-store.d.ts +11 -5
- package/dist/mcp-servers-store.js +46 -20
- package/dist/model-form.d.ts +2 -1
- package/dist/model-form.js +30 -16
- package/dist/model-gateway.d.ts +113 -0
- package/dist/model-gateway.js +433 -0
- package/dist/model.d.ts +5 -3
- package/dist/model.js +26 -18
- package/dist/monid.js +1 -1
- package/dist/native/binding.d.ts +4 -0
- package/dist/native/binding.js +9 -0
- package/dist/native/cli.d.ts +3 -2
- package/dist/native/cli.js +6 -5
- package/dist/openapi.d.ts +2 -0
- package/dist/openapi.js +356 -43
- package/dist/owner.d.ts +4 -2
- package/dist/owner.js +10 -4
- package/dist/page.d.ts +9 -0
- package/dist/page.js +10 -2
- package/dist/port-models.js +17 -10
- package/dist/provider.d.ts +3 -3
- package/dist/provider.js +12 -3
- package/dist/public-address.d.ts +28 -0
- package/dist/public-address.js +62 -0
- package/dist/run-launch.d.ts +1 -1
- package/dist/run-launch.js +1 -1
- package/dist/run-secrets.d.ts +3 -2
- package/dist/run-secrets.js +7 -4
- package/dist/run-trace.js +6 -3
- package/dist/runner/adapter-loop.d.ts +14 -8
- package/dist/runner/adapter-loop.js +58 -24
- package/dist/runner/adapter-run-spec.d.ts +15 -2
- package/dist/runner/adapter-run-spec.js +48 -10
- package/dist/runner/adapters/index.d.ts +4 -2
- package/dist/runner/adapters/index.js +6 -26
- package/dist/runner/adapters/pi.d.ts +5 -2
- package/dist/runner/adapters/pi.js +7 -4
- package/dist/runner/audit.d.ts +7 -0
- package/dist/runner/audit.js +15 -6
- package/dist/runner/claim-secrets.js +5 -1
- package/dist/runner/cli-run-spec.js +22 -10
- package/dist/runner/compare-end.d.ts +43 -0
- package/dist/runner/compare-end.js +95 -0
- package/dist/runner/computer-journal.d.ts +3 -0
- package/dist/runner/computer-journal.js +22 -2
- package/dist/runner/conformance/host-tools.d.ts +4 -0
- package/dist/runner/conformance/host-tools.js +14 -0
- package/dist/runner/harness-loops.d.ts +6 -1
- package/dist/runner/harness-loops.js +94 -54
- package/dist/runner/held.d.ts +5 -4
- package/dist/runner/journal-kinds.d.ts +4 -1
- package/dist/runner/journal-kinds.js +3 -0
- package/dist/runner/loop-contract.d.ts +10 -0
- package/dist/runner/main.d.ts +5 -5
- package/dist/runner/main.js +62 -11
- package/dist/runner/mcp-claim.js +40 -12
- package/dist/runner/meta-tools.js +4 -2
- package/dist/runner/metrics.d.ts +26 -0
- package/dist/runner/metrics.js +44 -1
- package/dist/runner/presence.d.ts +44 -0
- package/dist/runner/presence.js +96 -0
- package/dist/runner/promotion.d.ts +70 -7
- package/dist/runner/promotion.js +178 -28
- package/dist/runner/run-child-host.js +40 -10
- package/dist/runner/runner.d.ts +5 -0
- package/dist/runner/runner.js +8 -0
- package/dist/runner/sdk-loop.js +25 -1
- package/dist/runner/store-port.d.ts +3 -0
- package/dist/runner/store-secrets.js +19 -7
- package/dist/runner/workflow-first.d.ts +5 -2
- package/dist/runner/workflow-first.js +6 -3
- package/dist/runner/workflow-spec.js +3 -2
- package/dist/runs-over-store.d.ts +7 -2
- package/dist/runs-over-store.js +12 -4
- package/dist/sdk/check.d.ts +31 -0
- package/dist/sdk/check.js +58 -0
- package/dist/sdk/runs.d.ts +11 -3
- package/dist/sdk/runs.js +90 -15
- package/dist/sdk/schema.js +12 -4
- package/dist/secret-writes.d.ts +16 -3
- package/dist/secret-writes.js +28 -3
- package/dist/server-secrets-store.js +5 -0
- package/dist/server.d.ts +34 -2
- package/dist/server.js +437 -90
- package/dist/sign-ins-secrets.js +4 -1
- package/dist/skills/agentrun-serve/SKILL.md +11 -0
- package/dist/slack-url.d.ts +5 -0
- package/dist/slack-url.js +11 -0
- package/dist/slack.d.ts +107 -0
- package/dist/slack.js +292 -0
- package/dist/start-switches.d.ts +28 -0
- package/dist/start-switches.js +37 -0
- package/dist/stats.d.ts +1 -1
- package/dist/stats.js +2 -1
- package/dist/stop-signals.d.ts +11 -0
- package/dist/stop-signals.js +22 -0
- package/dist/store/agent-body.d.ts +1 -1
- package/dist/store/agent-body.js +2 -2
- package/dist/store/index.d.ts +3 -3
- package/dist/store/index.js +1 -1
- package/dist/store/postgres/migrations/0020_runners.sql +18 -0
- package/dist/store/postgres/store.d.ts +1 -1
- package/dist/store/postgres/store.js +4 -2
- package/dist/store/schema.d.ts +13 -5
- package/dist/store/schema.js +20 -11
- package/dist/store/seal.d.ts +16 -4
- package/dist/store/sqlite/store.d.ts +1 -1
- package/dist/store/sqlite/store.js +112 -28
- package/dist/store/store.d.ts +78 -24
- package/dist/store/store.js +11 -0
- package/dist/store-reads/analytics.js +3 -2
- package/dist/store-reads/cap.d.ts +7 -0
- package/dist/store-reads/cap.js +11 -1
- package/dist/store-reads/journal.js +27 -1
- package/dist/store-reads/learning.d.ts +23 -2
- package/dist/store-reads/learning.js +29 -8
- package/dist/store-reads/runs.d.ts +9 -0
- package/dist/store-reads/runs.js +19 -6
- package/dist/store-reads/stats.d.ts +4 -1
- package/dist/store-reads/stats.js +15 -6
- package/dist/store-view.d.ts +125 -14
- package/dist/store-view.js +156 -21
- package/dist/telemetry.d.ts +7 -7
- package/dist/telemetry.js +38 -15
- package/dist/template-eval.js +5 -2
- package/dist/template-github-permissions.d.ts +5 -1
- package/dist/template-github-permissions.js +7 -3
- package/dist/timeline/index.d.ts +1 -1
- package/dist/timeline/index.js +1 -1
- package/dist/timeline/timeline.d.ts +8 -0
- package/dist/timeline/timeline.js +30 -0
- package/dist/tool-gate.d.ts +8 -4
- package/dist/tool-gate.js +6 -7
- package/dist/tool-keys-store.js +2 -2
- package/dist/tool-keys.js +2 -1
- package/dist/tool-plane.d.ts +4 -0
- package/dist/tool-plane.js +12 -12
- package/dist/trigger-adapter.d.ts +3 -4
- package/dist/trigger-adapter.js +2 -2
- package/dist/trigger-composio.js +3 -3
- package/dist/trigger-email.js +0 -2
- package/dist/trigger-feed.js +0 -2
- package/dist/trigger-schedule.js +3 -0
- package/dist/trigger-secrets-shown.d.ts +6 -3
- package/dist/trigger-secrets-shown.js +22 -13
- package/dist/trigger-targets.d.ts +12 -3
- package/dist/trigger-targets.js +90 -10
- package/dist/triggers.d.ts +2 -2
- package/dist/validate.js +5 -1
- package/dist/viewer-credential.d.ts +25 -0
- package/dist/viewer-credential.js +51 -0
- package/dist/webhooks.d.ts +82 -8
- package/dist/webhooks.js +128 -45
- package/dist/wires.d.ts +6 -1
- package/dist/wires.js +5 -0
- package/dist/workspace/attach.d.ts +3 -2
- package/dist/workspace/attach.js +2 -1
- package/dist/workspace/attached-computers.d.ts +6 -8
- package/dist/workspace/attached-computers.js +27 -24
- package/dist/workspace/computer-deps.d.ts +2 -3
- package/dist/workspace/computer-deps.js +3 -6
- package/dist/workspace/computer-for-claim.js +72 -96
- package/dist/workspace/computer-kept.d.ts +0 -7
- package/dist/workspace/computer-kept.js +0 -17
- package/dist/workspace/resolve-computer.d.ts +23 -14
- package/dist/workspace/resolve-computer.js +66 -61
- package/dist/workspace/synced-folder.d.ts +20 -15
- package/dist/workspace/synced-folder.js +33 -43
- package/launcher/agentrun-serve +4 -1
- package/package.json +18 -10
- package/skills/agentrun-serve/SKILL.md +11 -0
- package/templates/README.md +1 -1
- package/templates/code-review/agent.md +2 -3
- package/templates/code-review/evals/mentions-defused/case.yaml +0 -1
- package/templates/code-review/evals/mentions-defused/fixtures/github-mcp.json +0 -27
- package/templates/code-review/evals/other-repo/case.yaml +0 -1
- package/templates/code-review/evals/other-repo/fixtures/github-mcp.json +0 -18
- package/templates/code-review/evals/other-repo/graders/no-other-repo.md +1 -1
- package/dist/console/assets/index-C2MYaUBa.css +0 -1
- package/dist/console/assets/index-CZZeCReB.js +0 -701
|
@@ -20,11 +20,12 @@
|
|
|
20
20
|
// command there would run on the server itself. runShellOf reads it off a setting before anything starts (the tool
|
|
21
21
|
// plane shows bash unavailable by it), and the claim's runTools takes the same rule over the computer it started.
|
|
22
22
|
import { hostToolDefs } from "@parcha/agentrun-kernel/kernel";
|
|
23
|
-
import {
|
|
23
|
+
import { configurationOf, connectOf, imagesOf, mountsOf, syncingClient } from "@parcha/agentrun-computer";
|
|
24
24
|
import { noDockerWords } from "../docker-daemon.js";
|
|
25
25
|
import { gpuRefused } from "../gpu-words.js";
|
|
26
26
|
import { recordedClient } from "../computer-calls.js";
|
|
27
|
-
import {
|
|
27
|
+
import { emptyMeta, finalSyncWords, holdSynced, pullFolder, recordMeta, recordWords, storedFolder, syncOf } from "./synced-folder.js";
|
|
28
|
+
import { restartWith } from "../start-switches.js";
|
|
28
29
|
/** Whether a computer (or its setting) takes its agent's programs away: `exec: false`. Only a desktop or a phone takes
|
|
29
30
|
* `exec` (computer-setting.ts refuses it on any other kind at save), so a computer without programs is one of those. */
|
|
30
31
|
export const noPrograms = (computer) => computer?.exec === false;
|
|
@@ -45,34 +46,26 @@ export const providerKeys = (registry, keyOf) => async (provider) => {
|
|
|
45
46
|
* descriptor's imageEnv names its image here (Daytona's AGENTRUN_DAYTONA_SNAPSHOT). Any other entry as it is. Every
|
|
46
47
|
* reader of an entry's mounts (Settings → Computers, the claim, a run's start, its shell) reads this, so the
|
|
47
48
|
* provider made with those keys and the server agree on what it mounts. `options`: the create() options its server
|
|
48
|
-
* settings give (computer-keys.ts settingOptions): where its machines dial this server by them
|
|
49
|
-
* Archil mount
|
|
49
|
+
* settings give (computer-keys.ts settingOptions): where its machines dial this server by them, mountsOf leaves out
|
|
50
|
+
* the Archil mount, so its folder is synced where Archil's would be. */
|
|
50
51
|
export function entryHere(entry, set, options = {}) {
|
|
51
|
-
const keyed = entry.mountsWith === undefined ? undefined : mountsOf(entry, set);
|
|
52
52
|
const named = entry.imageEnv !== undefined && set(entry.imageEnv);
|
|
53
|
-
const
|
|
54
|
-
|
|
53
|
+
const dial = dials(entry, options);
|
|
54
|
+
if (entry.mountsWith === undefined && !named && !dial)
|
|
55
|
+
return entry;
|
|
56
|
+
return { ...entry, ...mountsOf(entry, set, dial), ...(named ? { imageNamed: true } : {}) };
|
|
55
57
|
}
|
|
56
58
|
/** Whether a computer of `entry` made with `options` dials this server (the computer package's connectOf). A connect it
|
|
57
|
-
* doesn't know
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
return false;
|
|
59
|
+
* doesn't know reads as exec here: the provider refuses it in its own words when it is made, and no other provider's
|
|
60
|
+
* listing or run fails on it. */
|
|
61
|
+
function dials(entry, options) {
|
|
61
62
|
try {
|
|
62
|
-
return connectOf(
|
|
63
|
+
return connectOf(entry, options) === "dial";
|
|
63
64
|
}
|
|
64
65
|
catch {
|
|
65
66
|
return false;
|
|
66
67
|
}
|
|
67
68
|
}
|
|
68
|
-
/** `entry` with no Archil mount, saying why: a machine that dials this server takes none (the computer package's
|
|
69
|
-
* HostedProvider drops it from its capabilities on dial and refuses one in check()). */
|
|
70
|
-
function withoutArchil(entry) {
|
|
71
|
-
if (!entry.mounts.includes("archil"))
|
|
72
|
-
return entry;
|
|
73
|
-
const archil = `${entry.label ?? "its provider"}'s machines dial this server, and a machine that dials takes no Archil mount`;
|
|
74
|
-
return { ...entry, mounts: entry.mounts.filter((kind) => kind !== "archil"), unmounted: { ...entry.unmounted, archil } };
|
|
75
|
-
}
|
|
76
69
|
/** The names entryHere reads of `entry`: the keys of its mountsWith, and its imageEnv. */
|
|
77
70
|
const hereNames = (entry) => [...Object.values(entry.mountsWith ?? {}).filter((name) => typeof name === "string"), ...(entry.imageEnv === undefined ? [] : [entry.imageEnv])];
|
|
78
71
|
/** `registry` with each provider as this server has it (entryHere), reading only the names an entry's mountsWith or
|
|
@@ -114,7 +107,7 @@ export const needsNetwork = (network) => network !== undefined && network.length
|
|
|
114
107
|
export const aLabel = (label, start = false) => `${start ? "A" : "a"}${/^[AEIOU]/i.test(label) ? "n" : ""} ${label}`;
|
|
115
108
|
/** Why a computer that needs a network is refused where this server's AGENTRUN_BOX_ALLOW is none, in words that name the
|
|
116
109
|
* fix: the operator said no network at all, and the computer can't run without one. */
|
|
117
|
-
export const noNetworkRefusal = (label, kind) => `This agent's computer is ${aLabel(label)} ${kind}, which needs a network (the vendor's own, or public addresses from this machine), and this server's AGENTRUN_BOX_ALLOW is none (no network): pick a computer that runs with no network in ${SETTINGS}, or set
|
|
110
|
+
export const noNetworkRefusal = (label, kind) => `This agent's computer is ${aLabel(label)} ${kind}, which needs a network (the vendor's own, or public addresses from this machine), and this server's AGENTRUN_BOX_ALLOW is none (no network): pick a computer that runs with no network in ${SETTINGS}, or ${restartWith("AGENTRUN_BOX_ALLOW set to a host list")}.`;
|
|
118
111
|
/** Whether an agent's computer `setting` can be had in `mode` now, by the answers the claim gives (resolveComputer: the
|
|
119
112
|
* kind, the provider and what it serves, the mode's mount, the provider's keys by `keyOf`): ok, or its refusal in words
|
|
120
113
|
* that name the fix. Nothing starts. A run's start asks it before the run is made (runnable.ts).
|
|
@@ -182,10 +175,10 @@ function folderOf(kind, entry, serving, mode, gpuMounts) {
|
|
|
182
175
|
const shell = serving.some((one) => one.groups.includes("files") && one.groups.includes("exec"));
|
|
183
176
|
if (!((kind === "sandbox" || kind === "desktop") && shell))
|
|
184
177
|
return undefined;
|
|
185
|
-
// Configurations made on dial by their own options
|
|
186
|
-
//
|
|
187
|
-
const dialed = serving.every((one) =>
|
|
188
|
-
return folderKindOf(dialed ?
|
|
178
|
+
// Configurations made on dial by their own options take no Archil mount either (mountsOf), as entryHere's settings'
|
|
179
|
+
// dial. `entry` holds its keyed mounts already: no key is read again.
|
|
180
|
+
const dialed = serving.every((one) => dials(entry, one.options ?? {}));
|
|
181
|
+
return folderKindOf(dialed ? { ...entry, ...mountsOf(entry, () => false, true) } : entry, mode, gpuMounts);
|
|
189
182
|
}
|
|
190
183
|
/** The configurations of `entry` that serve `kind`. */
|
|
191
184
|
const servingOf = (registry, entry, kind) => entry.capabilities.filter((one) => registry.servingRefusals(one, kind).length === 0);
|
|
@@ -194,6 +187,24 @@ const selectedOf = (serving, setting, entry, kind) => {
|
|
|
194
187
|
const one = configurationOf(serving, setting.image, entry.defaultImage?.[kind]);
|
|
195
188
|
return one ? [one] : [];
|
|
196
189
|
};
|
|
190
|
+
/** The kind of the run's folder a computer of `setting` on `entry`'s `configuration` holds in `mode` (folderOf), or
|
|
191
|
+
* undefined for none: none where the agent runs no programs of its own; of the kinds its GPU computers take, where a
|
|
192
|
+
* sandbox's setting asks for GPUs. resolveComputer's folder, and runFolderOf's. */
|
|
193
|
+
const settingFolderOf = (setting, kind, entry, configuration, mode) => noPrograms(setting) ? undefined : folderOf(kind, entry, [configuration], mode, kind === "sandbox" && setting.gpu ? configuration.gpu?.mounts : undefined);
|
|
194
|
+
/** The kind of the run's folder a run of an agent with computer `setting` holds in `mode`, read off the setting and the
|
|
195
|
+
* kind registry before anything starts, as the claim picks it (resolveComputer: the configuration the setting selects,
|
|
196
|
+
* settingFolderOf): a bind, an Archil mount or a synced folder, or undefined for none (kind none, a computer that holds
|
|
197
|
+
* no folder, or a setting the claim refuses). `registry` is as this server has it (registryHere, entryHere). */
|
|
198
|
+
export function runFolderOf(setting, mode, registry) {
|
|
199
|
+
const kind = setting.kind;
|
|
200
|
+
if (kind === "none" || !Object.hasOwn(registry.SETTING_KINDS, kind))
|
|
201
|
+
return undefined;
|
|
202
|
+
const entry = registry.PROVIDERS.find((one) => one.id === setting.provider);
|
|
203
|
+
if (!entry)
|
|
204
|
+
return undefined;
|
|
205
|
+
const [configuration] = selectedOf(servingOf(registry, entry, kind), setting, entry, kind);
|
|
206
|
+
return configuration ? settingFolderOf(setting, kind, entry, configuration, mode) : undefined;
|
|
207
|
+
}
|
|
197
208
|
/**
|
|
198
209
|
* Where a run of an agent with computer `setting` has its shell in `mode` (shellPlaceOf), read off the setting and the
|
|
199
210
|
* kind registry before anything starts: what the claim's runTools gives the run once its computer is started. "computer"
|
|
@@ -260,7 +271,7 @@ export async function resolveComputer(given, mode, registry, side) {
|
|
|
260
271
|
return { refused: `This agent's computer: ${why}. Set it in ${SETTINGS}.` };
|
|
261
272
|
}
|
|
262
273
|
if (kind === "none")
|
|
263
|
-
return { kind, provider: null,
|
|
274
|
+
return { kind, provider: null, ports: [], start: async () => ({ computer: undefined, release: nothing }) };
|
|
264
275
|
const offered = registry.PROVIDERS.filter((entry) => entry.kinds.includes(kind));
|
|
265
276
|
const pick = `one of ${offered.map((entry) => entry.label).join(", ")} for this agent's computer in ${SETTINGS}.`;
|
|
266
277
|
if (offered.length === 0)
|
|
@@ -272,13 +283,12 @@ export async function resolveComputer(given, mode, registry, side) {
|
|
|
272
283
|
const entry = registry.PROVIDERS.find((one) => one.id === setting.provider);
|
|
273
284
|
if (!entry)
|
|
274
285
|
return { refused: `${JSON.stringify(setting.provider)} is no computer provider this server knows: pick ${pick}` };
|
|
275
|
-
// The configurations of the provider that serve the kind; none, and
|
|
286
|
+
// The configurations of the provider that serve the kind; none, and its own why (unserved: its descriptor's, a paired
|
|
287
|
+
// computer's), else the registry's, by its closest one.
|
|
276
288
|
const serving = servingOf(registry, entry, kind);
|
|
277
289
|
if (serving.length === 0) {
|
|
278
|
-
const
|
|
279
|
-
|
|
280
|
-
return { refused: `${own}, or pick ${pick}` };
|
|
281
|
-
const why = entry.capabilities.map((one) => registry.servingRefusals(one, kind)).sort((a, b) => a.length - b.length)[0] ?? [];
|
|
290
|
+
const unserved = entry.unserved?.[kind];
|
|
291
|
+
const why = unserved !== undefined ? [unserved] : (entry.capabilities.map((one) => registry.servingRefusals(one, kind)).sort((a, b) => a.length - b.length)[0] ?? []);
|
|
282
292
|
return { refused: `${entry.label} gives no ${kind} computer${why.length > 0 ? `: ${why.join("; ")}` : ""}. Pick ${pick}` };
|
|
283
293
|
}
|
|
284
294
|
// The configuration the setting's image selects: one the provider does not offer for the kind is refused, naming those
|
|
@@ -297,7 +307,7 @@ export async function resolveComputer(given, mode, registry, side) {
|
|
|
297
307
|
// (of the kinds its GPU computers take, where the setting asks for GPUs), and the agent may run programs there (a
|
|
298
308
|
// folder is mounted for its shell).
|
|
299
309
|
const gpu = kind === "sandbox" && setting.gpu ? setting.gpu : undefined;
|
|
300
|
-
const folder =
|
|
310
|
+
const folder = settingFolderOf(setting, kind, entry, configuration, mode);
|
|
301
311
|
const mounts = folder !== undefined;
|
|
302
312
|
if (kind === "sandbox" && folder === undefined) {
|
|
303
313
|
if (mode === 1)
|
|
@@ -338,23 +348,28 @@ export async function resolveComputer(given, mode, registry, side) {
|
|
|
338
348
|
return {
|
|
339
349
|
kind,
|
|
340
350
|
provider: entry.id,
|
|
341
|
-
mounts,
|
|
342
351
|
...(folder ? { folder } : {}),
|
|
343
352
|
ports,
|
|
344
|
-
async start({ workspace, check,
|
|
353
|
+
async start({ workspace, check, store: disk, held, signal }) {
|
|
345
354
|
// A computer kept at the run's park, attached again: it mounts what it mounted, read back under its own epoch.
|
|
346
355
|
const again = await side.reattach?.(entry, { kind, keys, configuration, ...(folder ? { folder } : {}), ...(gpu ? { gpu: { type: gpu.type, count: gpu.count } } : {}), ...(persistent ? { persistent: true } : {}), ...(signal ? { signal } : {}) });
|
|
347
|
-
// The run's disk as the
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
};
|
|
352
|
-
// A synced folder's store: for a new computer, listed and held to the caps before it is rented.
|
|
353
|
-
const store = folder === "sync" ? diskOf() : undefined;
|
|
356
|
+
// The run's disk as the claim keeps the folder on it. A synced folder's store: for a new computer, listed and held
|
|
357
|
+
// to the caps before it is rented. Under an Archil mount, its sync.json emptied here and written again at the park
|
|
358
|
+
// and release.
|
|
359
|
+
const store = folder === "sync" ? disk : undefined;
|
|
354
360
|
if (folder === "sync" && store === undefined) {
|
|
355
361
|
await again?.release().catch(() => undefined);
|
|
356
362
|
throw unavailable(`${entry.label} could not start a ${kind} computer: this run's folder can't be synced into a computer here`);
|
|
357
363
|
}
|
|
364
|
+
if (folder === "archil" && disk) {
|
|
365
|
+
try {
|
|
366
|
+
await emptyMeta(disk);
|
|
367
|
+
}
|
|
368
|
+
catch (error) {
|
|
369
|
+
await again?.release().catch(() => undefined);
|
|
370
|
+
throw unavailable(`${entry.label} could not start a ${kind} computer: ${error instanceof Error ? error.message : String(error)}`);
|
|
371
|
+
}
|
|
372
|
+
}
|
|
358
373
|
let stored;
|
|
359
374
|
if (store && !again) {
|
|
360
375
|
try {
|
|
@@ -376,29 +391,19 @@ export async function resolveComputer(given, mode, registry, side) {
|
|
|
376
391
|
throw unavailable(noDockerWords(kind, registry.PROVIDERS, mode));
|
|
377
392
|
throw unavailable(`${entry.label} could not start a ${kind} computer: ${error instanceof Error ? error.message : String(error)}`);
|
|
378
393
|
}
|
|
379
|
-
// A folder synced on an earlier claim, now under a new Archil mount: the modes and links its sync.json keeps, which
|
|
380
|
-
// the mount never reads, put back (and the mount synced) before any tool runs. One that can't be lets the computer go.
|
|
381
|
-
const synced = folder === "archil" ? diskOf() : undefined;
|
|
382
|
-
if (synced && launched.client && !again) {
|
|
383
|
-
try {
|
|
384
|
-
await restoreMeta(synced, syncingClient(launched.client, archilSync(launched.client)), signal);
|
|
385
|
-
}
|
|
386
|
-
catch (error) {
|
|
387
|
-
await launched.release().catch(() => undefined);
|
|
388
|
-
throw unavailable(`${entry.label} could not start a ${kind} computer: ${error instanceof Error ? error.message : String(error)}`);
|
|
389
|
-
}
|
|
390
|
-
}
|
|
391
394
|
// A synced folder, before any tool runs there: pushed into a new computer, or pulled whole from a kept one (whose
|
|
392
|
-
// copy may be newer than the disk's). One that can't be had lets the computer go.
|
|
395
|
+
// copy may be newer than the disk's), through the machine's own client. One that can't be had lets the computer go.
|
|
393
396
|
let sync;
|
|
394
|
-
|
|
397
|
+
const own = launched.own ?? launched.client;
|
|
398
|
+
if (store && own) {
|
|
395
399
|
try {
|
|
396
|
-
|
|
400
|
+
held.folder = again ? await pullFolder(store, own, signal) : await holdSynced(store, own, stored, signal);
|
|
397
401
|
}
|
|
398
402
|
catch (error) {
|
|
399
403
|
await launched.release().catch(() => undefined);
|
|
400
404
|
throw unavailable(`${entry.label} could not start a ${kind} computer: ${error instanceof Error ? error.message : String(error)}`);
|
|
401
405
|
}
|
|
406
|
+
sync = syncOf(held);
|
|
402
407
|
}
|
|
403
408
|
const checked = mounts ? { ...check, ...(again ? { epoch: again.epoch } : {}), ...(folder === "sync" ? { sync: true } : {}) } : undefined;
|
|
404
409
|
const computer = runComputerOf(kind, launched, checked, { ...(setting.surface ? { surface: setting.surface } : {}), ...(noPrograms(setting) ? { exec: false } : {}) }, sync);
|
|
@@ -406,11 +411,11 @@ export async function resolveComputer(given, mode, registry, side) {
|
|
|
406
411
|
await launched.release();
|
|
407
412
|
throw unavailable(`${entry.label} could not start a ${kind} computer: ${computer}`);
|
|
408
413
|
}
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
//
|
|
412
|
-
// claim that syncs the folder; the computer goes whatever that answered, and a failed one is said.
|
|
413
|
-
const record = () => recordMeta(
|
|
414
|
+
if (folder === "archil" && disk && own) {
|
|
415
|
+
// An Archil mount's park and release: its modes and links recorded in sync.json first (recordMeta), read through
|
|
416
|
+
// the machine's own client as it is then (a lost one's replacement, never the lost one; asking it starts none),
|
|
417
|
+
// for a later claim that syncs the folder; the computer goes whatever that answered, and a failed one is said.
|
|
418
|
+
const record = () => recordMeta(disk, launched.own ?? own);
|
|
414
419
|
return {
|
|
415
420
|
computer,
|
|
416
421
|
sync: record,
|
|
@@ -30,26 +30,31 @@ export type StoredFolder = {
|
|
|
30
30
|
* path no sink takes, is not the folder's.
|
|
31
31
|
*/
|
|
32
32
|
export declare function storedFolder(store: FolderStore): Promise<StoredFolder>;
|
|
33
|
+
/** The claim's synced folder: the FolderSync of the computer that holds it now, which the claim's sync (syncOf) runs.
|
|
34
|
+
* Set at the claim's start (holdSynced, or pullFolder for a kept one), and again by each new sandbox the claim starts
|
|
35
|
+
* in place of a lost one (holdSynced). */
|
|
36
|
+
export type HeldFolder = {
|
|
37
|
+
folder?: FolderSync;
|
|
38
|
+
};
|
|
33
39
|
/**
|
|
34
40
|
* The stored folder pushed into the computer's empty /workspace through `client` (the computer's own, under no sync),
|
|
35
|
-
* one streaming tar, then the computer's listing read as the manifest: the
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
|
|
39
|
-
export declare function pushFolder(store: FolderStore, client: ComputerClient, stored: StoredFolder, signal?: AbortSignal): Promise<FolderSync>;
|
|
40
|
-
/**
|
|
41
|
-
* A folder synced on an earlier claim, now under a mount of the disk itself (Archil), which never reads sync.json: the
|
|
42
|
-
* modes and links it keeps put back in place through `client` (the files with a mode of their own pushed again, its
|
|
43
|
-
* links made), then sync.json emptied, as the mount holds them from here on. `client` syncs the mount before a push
|
|
44
|
-
* answers, so nothing is emptied that has not landed. A folder never synced, or whose sync.json holds nothing, is left
|
|
45
|
-
* as it is. Throws in words where it fails.
|
|
41
|
+
* one streaming tar, then the computer's listing read as the manifest: the sync the claim holds from then on (the
|
|
42
|
+
* caller sets HeldFolder.folder to it), at the claim's start and for a new sandbox in place of a lost one, whose fresh
|
|
43
|
+
* mtimes the old manifest would read as every file changed. The links an exec made on the disk (linkObjects), now links
|
|
44
|
+
* in the computer, are then removed from the disk. Throws in words where the push, the listing or a remove fails.
|
|
46
45
|
*/
|
|
47
|
-
export declare function
|
|
46
|
+
export declare function holdSynced(store: FolderStore, client: ComputerClient, stored: StoredFolder, signal?: AbortSignal): Promise<FolderSync>;
|
|
48
47
|
/**
|
|
49
48
|
* The folder of a kept computer attached again (no manifest), pulled whole through `client`: every file the computer
|
|
50
49
|
* holds put on the store, and what the store holds beyond them removed. Throws in words where it fails.
|
|
51
50
|
*/
|
|
52
51
|
export declare function pullFolder(store: FolderStore, client: ComputerClient, signal?: AbortSignal): Promise<FolderSync>;
|
|
52
|
+
/**
|
|
53
|
+
* The store's sync.json emptied where it records anything, at a claim on an Archil mount, which never reads it: else a
|
|
54
|
+
* link a synced claim recorded there would be pushed by a later synced claim over the file the mount wrote at its path
|
|
55
|
+
* (storedFolder). Throws in words where it fails.
|
|
56
|
+
*/
|
|
57
|
+
export declare function emptyMeta(store: FolderStore): Promise<void>;
|
|
53
58
|
/**
|
|
54
59
|
* An Archil computer's folder's modes and links, read through `client` (its computerd sees the mount), written to the
|
|
55
60
|
* store's sync.json (FolderSync.recordMeta), which the mount never reads: so a later claim that holds the folder as a
|
|
@@ -78,8 +83,8 @@ export declare const claimHolds: (run: (runId: string) => Promise<{
|
|
|
78
83
|
* a write sent before the other claim landed in the store: it lands, at most one write's flight per write in flight.
|
|
79
84
|
*/
|
|
80
85
|
export declare function fencedStore(store: FolderStore, holds: () => Promise<boolean>): FolderStore;
|
|
81
|
-
/**
|
|
82
|
-
* syncingClient takes it. */
|
|
83
|
-
export declare function syncOf(
|
|
86
|
+
/** The sync of the folder `held` holds when it runs, one at a time (syncingClient's after each change, and the final one
|
|
87
|
+
* at release), as syncingClient takes it. `held` is set before the first. */
|
|
88
|
+
export declare function syncOf(held: HeldFolder): () => Promise<Result<void>>;
|
|
84
89
|
/** A failed final sync at release, in archilRelease's words. */
|
|
85
90
|
export declare const finalSyncWords: (why: string) => string;
|
|
@@ -4,20 +4,23 @@
|
|
|
4
4
|
//
|
|
5
5
|
// - At the claim (resolve-computer.ts start), the store is listed and held to the caps (storedFolder) before anything is
|
|
6
6
|
// rented, so a folder over one is refused in words naming its size and the cap. Once the computer is up, the folder
|
|
7
|
-
// is pushed in (
|
|
7
|
+
// is pushed in (holdSynced): its files read 4 ahead into one streaming tar, its modes and links from sync.json beside
|
|
8
8
|
// it, into /workspace; then the computer's own listing is the manifest (FolderSync.baseline: extraction sets no
|
|
9
|
-
// mtimes, so it is read, never guessed).
|
|
9
|
+
// mtimes, so it is read, never guessed). A new sandbox in place of a lost one is held the same way, and the claim's
|
|
10
|
+
// sync goes on from its manifest (HeldFolder). Each FolderSync reads its own machine's client (LaunchedComputer.own):
|
|
11
|
+
// a sync that finds its machine lost fails, and the next call starts the new one before its own sync.
|
|
10
12
|
// - After each call that may change the folder, the delta lands on the disk before the call answers: syncingClient
|
|
11
|
-
// over syncOf(
|
|
13
|
+
// over syncOf(held), under the run's recordedClient.
|
|
12
14
|
// - A kept computer attached again by a new runner has no manifest: one full pull (pullFolder), every file the computer
|
|
13
15
|
// holds put and what the disk holds beyond them removed.
|
|
14
16
|
// - At release, a final delta (finalWords says a failed one).
|
|
15
|
-
// - A run
|
|
16
|
-
// sync.json
|
|
17
|
+
// - A run whose folder moves from a synced folder to an Archil mount keeps its files, not their modes or links: the
|
|
18
|
+
// mount never reads sync.json. A claim on the mount empties it first (emptyMeta), so no link a synced claim recorded
|
|
19
|
+
// there hides a file the mount writes at its path.
|
|
17
20
|
// - The reverse: an Archil computer's park and release record its folder's modes and links in sync.json (recordMeta),
|
|
18
|
-
// read through
|
|
19
|
-
// where sync.json names links as those links (an exec made them), and removes those from
|
|
20
|
-
//
|
|
21
|
+
// read through the machine's own client, whose computerd sees the mount; a later synced claim pushes them, takes the
|
|
22
|
+
// files the file API lists where sync.json names links as those links (an exec made them), and removes those from
|
|
23
|
+
// the disk (storedFolder, holdSynced).
|
|
21
24
|
// - Every write of a claim's goes through fencedStore: once a later claim has taken the run (the run's epoch and runner
|
|
22
25
|
// say so, held or not), it is refused, never sent.
|
|
23
26
|
import { fail, folderPathProblem, FolderSync, ok, pushTar, SYNC_MAX_BYTES, SYNC_MAX_ENTRIES, tarStream, WORKSPACE } from "@parcha/agentrun-computer";
|
|
@@ -89,11 +92,12 @@ async function* tarEntries(store, { entries, meta }) {
|
|
|
89
92
|
}
|
|
90
93
|
/**
|
|
91
94
|
* The stored folder pushed into the computer's empty /workspace through `client` (the computer's own, under no sync),
|
|
92
|
-
* one streaming tar, then the computer's listing read as the manifest: the
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
+
* one streaming tar, then the computer's listing read as the manifest: the sync the claim holds from then on (the
|
|
96
|
+
* caller sets HeldFolder.folder to it), at the claim's start and for a new sandbox in place of a lost one, whose fresh
|
|
97
|
+
* mtimes the old manifest would read as every file changed. The links an exec made on the disk (linkObjects), now links
|
|
98
|
+
* in the computer, are then removed from the disk. Throws in words where the push, the listing or a remove fails.
|
|
95
99
|
*/
|
|
96
|
-
export async function
|
|
100
|
+
export async function holdSynced(store, client, stored, signal) {
|
|
97
101
|
const options = signal ? { signal } : {};
|
|
98
102
|
if (stored.entries.length > 0 || Object.keys(stored.meta.links).length > 0) {
|
|
99
103
|
const pushed = await pushTar(client, WORKSPACE, tarStream(tarEntries(store, stored)), options);
|
|
@@ -111,33 +115,6 @@ export async function pushFolder(store, client, stored, signal) {
|
|
|
111
115
|
}
|
|
112
116
|
return folder;
|
|
113
117
|
}
|
|
114
|
-
/**
|
|
115
|
-
* A folder synced on an earlier claim, now under a mount of the disk itself (Archil), which never reads sync.json: the
|
|
116
|
-
* modes and links it keeps put back in place through `client` (the files with a mode of their own pushed again, its
|
|
117
|
-
* links made), then sync.json emptied, as the mount holds them from here on. `client` syncs the mount before a push
|
|
118
|
-
* answers, so nothing is emptied that has not landed. A folder never synced, or whose sync.json holds nothing, is left
|
|
119
|
-
* as it is. Throws in words where it fails.
|
|
120
|
-
*/
|
|
121
|
-
export async function restoreMeta(store, client, signal) {
|
|
122
|
-
const meta = await store.readMeta();
|
|
123
|
-
if (meta === undefined || (Object.keys(meta.modes).length === 0 && Object.keys(meta.links).length === 0))
|
|
124
|
-
return;
|
|
125
|
-
const entries = [];
|
|
126
|
-
const links = new Map(Object.entries(meta.links).filter(([path]) => folderPathProblem(path) === undefined));
|
|
127
|
-
for await (const entry of store.entries()) {
|
|
128
|
-
if (Object.hasOwn(meta.modes, entry.path))
|
|
129
|
-
entries.push(entry);
|
|
130
|
-
links.delete(entry.path);
|
|
131
|
-
}
|
|
132
|
-
if (entries.length > 0 || links.size > 0) {
|
|
133
|
-
const pushed = await pushTar(client, WORKSPACE, tarStream(tarEntries(store, { entries, meta: { modes: meta.modes, links: Object.fromEntries(links) } })), signal ? { signal } : {});
|
|
134
|
-
if (!pushed.ok)
|
|
135
|
-
throw new Error(`the run's folder's modes and links could not be put back: ${pushed.error.message}`);
|
|
136
|
-
}
|
|
137
|
-
const emptied = await store.meta({ modes: {}, links: {} });
|
|
138
|
-
if (!emptied.ok)
|
|
139
|
-
throw new Error(`the run's folder's sync.json could not be emptied: ${emptied.error.message}`);
|
|
140
|
-
}
|
|
141
118
|
/**
|
|
142
119
|
* The folder of a kept computer attached again (no manifest), pulled whole through `client`: every file the computer
|
|
143
120
|
* holds put on the store, and what the store holds beyond them removed. Throws in words where it fails.
|
|
@@ -156,6 +133,19 @@ export async function pullFolder(store, client, signal) {
|
|
|
156
133
|
throw new Error(`the run's folder in the kept computer could not be made durable: ${pulled.error.message}`);
|
|
157
134
|
return folder;
|
|
158
135
|
}
|
|
136
|
+
/**
|
|
137
|
+
* The store's sync.json emptied where it records anything, at a claim on an Archil mount, which never reads it: else a
|
|
138
|
+
* link a synced claim recorded there would be pushed by a later synced claim over the file the mount wrote at its path
|
|
139
|
+
* (storedFolder). Throws in words where it fails.
|
|
140
|
+
*/
|
|
141
|
+
export async function emptyMeta(store) {
|
|
142
|
+
const meta = await store.readMeta();
|
|
143
|
+
if (meta === undefined || (Object.keys(meta.modes).length === 0 && Object.keys(meta.links).length === 0))
|
|
144
|
+
return;
|
|
145
|
+
const emptied = await store.meta({ modes: {}, links: {} });
|
|
146
|
+
if (!emptied.ok)
|
|
147
|
+
throw new Error(`the run's folder's sync.json could not be emptied: ${emptied.error.message}`);
|
|
148
|
+
}
|
|
159
149
|
/**
|
|
160
150
|
* An Archil computer's folder's modes and links, read through `client` (its computerd sees the mount), written to the
|
|
161
151
|
* store's sync.json (FolderSync.recordMeta), which the mount never reads: so a later claim that holds the folder as a
|
|
@@ -214,13 +204,13 @@ export function fencedStore(store, holds) {
|
|
|
214
204
|
meta: (meta) => fenced(() => store.meta(meta)),
|
|
215
205
|
};
|
|
216
206
|
}
|
|
217
|
-
/**
|
|
218
|
-
* syncingClient takes it. */
|
|
219
|
-
export function syncOf(
|
|
207
|
+
/** The sync of the folder `held` holds when it runs, one at a time (syncingClient's after each change, and the final one
|
|
208
|
+
* at release), as syncingClient takes it. `held` is set before the first. */
|
|
209
|
+
export function syncOf(held) {
|
|
220
210
|
let last = Promise.resolve();
|
|
221
211
|
return () => {
|
|
222
212
|
const run = last
|
|
223
|
-
.then(() => folder.sync())
|
|
213
|
+
.then(() => held.folder.sync())
|
|
224
214
|
.then((synced) => (synced.ok ? ok(undefined) : fail(synced.error.code, synced.error.message)), (error) => fail("refused", message(error)));
|
|
225
215
|
last = run;
|
|
226
216
|
return run;
|
package/launcher/agentrun-serve
CHANGED
|
@@ -30,13 +30,16 @@
|
|
|
30
30
|
# (src/computer-keys.ts COMPUTER_KEY_NAMES): only the server's and the runner's own code reads one (the Archil claim,
|
|
31
31
|
# a computer's create), and no run is handed one.
|
|
32
32
|
#
|
|
33
|
+
# CURSOR_API_KEY, the owner's Cursor API key, is Cursor's alone (src/harness-cursor.ts): a run of Cursor is handed it,
|
|
34
|
+
# and no run of any other harness (src/run-secrets.ts keysFor, the table's ownKeys).
|
|
35
|
+
#
|
|
33
36
|
# After MODAL_TOKEN_SECRET, the keys of pi-ai's other providers, which a pi run's model may need (GEMINI_API_KEY,
|
|
34
37
|
# DEEPSEEK_API_KEY, Bedrock's AWS keys, ...): the server holds each, and a run's process gets one over its pipe only when
|
|
35
38
|
# its model is that provider's (../src/model.ts' PROVIDER_KEYS). The custody test checks every key pi-ai's table names is
|
|
36
39
|
# here. Any other variable named like a key (a KEY, TOKEN, SECRET, PASSWORD, PASSWD, PASS, PAT, CREDENTIAL, CREDENTIALS or
|
|
37
40
|
# DSN segment, or a last PWD after another) stays in the server's environment, as this list does not take it, and in no
|
|
38
41
|
# run's: name it here to keep it from the server's too.
|
|
39
|
-
SECRETS='AGENTRUN_TOKEN AGENTRUN_TOKENS AGENTRUN_API_KEY AGENTRUN_STORE_URL AGENT_MODEL_API_KEY OPENAI_API_KEY ANTHROPIC_API_KEY BROWSERBASE_API_KEY BROWSERBASE_PROJECT_ID KERNEL_API_KEY OPENROUTER_API_KEY PARTICLE_API_KEY TYPESAFE_API_KEY PARALLEL_API_KEY MONID_API_KEY AGENTRUN_SEAL_KEY ARCHIL_API_KEY E2B_API_KEY ORGO_API_KEY PHONE_HARNESS_API_KEY AGENT37_API_KEY AGENT37_SSH_KEY DAYTONA_API_KEY BOXD_API_KEY MORPH_API_KEY CLOUDFLARE_RELAY_TOKEN FLY_API_TOKEN MODAL_TOKEN_ID MODAL_TOKEN_SECRET ANTHROPIC_AUTH_TOKEN ANTHROPIC_OAUTH_TOKEN AI_GATEWAY_API_KEY ANT_LING_API_KEY AWS_ACCESS_KEY_ID AWS_BEARER_TOKEN_BEDROCK AWS_SECRET_ACCESS_KEY AWS_SESSION_TOKEN AZURE_OPENAI_API_KEY BASETEN_API_KEY CEREBRAS_API_KEY CLOUDFLARE_API_KEY COPILOT_GITHUB_TOKEN DEEPSEEK_API_KEY FIREWORKS_API_KEY GEMINI_API_KEY GOOGLE_CLOUD_API_KEY GROQ_API_KEY HF_TOKEN KIMI_API_KEY META_API_KEY MINIMAX_API_KEY MINIMAX_CN_API_KEY MISTRAL_API_KEY MOONSHOT_API_KEY NVIDIA_API_KEY OPENCODE_API_KEY QWEN_TOKEN_PLAN_API_KEY QWEN_TOKEN_PLAN_CN_API_KEY RADIUS_API_KEY TOGETHER_API_KEY XAI_API_KEY XIAOMI_API_KEY XIAOMI_TOKEN_PLAN_AMS_API_KEY XIAOMI_TOKEN_PLAN_CN_API_KEY XIAOMI_TOKEN_PLAN_SGP_API_KEY ZAI_API_KEY ZAI_CODING_CN_API_KEY'
|
|
42
|
+
SECRETS='AGENTRUN_TOKEN AGENTRUN_TOKENS AGENTRUN_API_KEY AGENTRUN_STORE_URL AGENT_MODEL_API_KEY OPENAI_API_KEY ANTHROPIC_API_KEY BROWSERBASE_API_KEY BROWSERBASE_PROJECT_ID KERNEL_API_KEY OPENROUTER_API_KEY PARTICLE_API_KEY TYPESAFE_API_KEY PARALLEL_API_KEY MONID_API_KEY CURSOR_API_KEY AGENTRUN_SEAL_KEY ARCHIL_API_KEY E2B_API_KEY ORGO_API_KEY PHONE_HARNESS_API_KEY AGENT37_API_KEY AGENT37_SSH_KEY DAYTONA_API_KEY BOXD_API_KEY MORPH_API_KEY SMOLCLOUD_API_KEY CLOUDFLARE_RELAY_TOKEN FLY_API_TOKEN MODAL_TOKEN_ID MODAL_TOKEN_SECRET ANTHROPIC_AUTH_TOKEN ANTHROPIC_OAUTH_TOKEN AI_GATEWAY_API_KEY ANT_LING_API_KEY AWS_ACCESS_KEY_ID AWS_BEARER_TOKEN_BEDROCK AWS_SECRET_ACCESS_KEY AWS_SESSION_TOKEN AZURE_OPENAI_API_KEY BASETEN_API_KEY CEREBRAS_API_KEY CLOUDFLARE_API_KEY COPILOT_GITHUB_TOKEN DEEPSEEK_API_KEY FIREWORKS_API_KEY GEMINI_API_KEY GOOGLE_CLOUD_API_KEY GROQ_API_KEY HF_TOKEN KIMI_API_KEY META_API_KEY MINIMAX_API_KEY MINIMAX_CN_API_KEY MISTRAL_API_KEY MOONSHOT_API_KEY NVIDIA_API_KEY OPENCODE_API_KEY QWEN_TOKEN_PLAN_API_KEY QWEN_TOKEN_PLAN_CN_API_KEY RADIUS_API_KEY TOGETHER_API_KEY XAI_API_KEY XIAOMI_API_KEY XIAOMI_TOKEN_PLAN_AMS_API_KEY XIAOMI_TOKEN_PLAN_CN_API_KEY XIAOMI_TOKEN_PLAN_SGP_API_KEY ZAI_API_KEY ZAI_CODING_CN_API_KEY'
|
|
40
43
|
set -eu
|
|
41
44
|
# Each secret out of the environment and into an unexported variable of this shell (agentrun_secret_<NAME>).
|
|
42
45
|
for name in $SECRETS; do
|
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.48",
|
|
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",
|
|
@@ -22,6 +22,14 @@
|
|
|
22
22
|
"types": "./dist/index.d.ts",
|
|
23
23
|
"default": "./dist/index.js"
|
|
24
24
|
},
|
|
25
|
+
"./harness": {
|
|
26
|
+
"types": "./dist/harness-module.d.ts",
|
|
27
|
+
"default": "./dist/harness-module.js"
|
|
28
|
+
},
|
|
29
|
+
"./conformance": {
|
|
30
|
+
"types": "./dist/conformance.d.ts",
|
|
31
|
+
"default": "./dist/conformance.js"
|
|
32
|
+
},
|
|
25
33
|
"./package.json": "./package.json"
|
|
26
34
|
},
|
|
27
35
|
"bin": {
|
|
@@ -54,14 +62,15 @@
|
|
|
54
62
|
"@earendil-works/pi-coding-agent": "1.5.2",
|
|
55
63
|
"@modelcontextprotocol/client": "2.4.0",
|
|
56
64
|
"@modelcontextprotocol/server": "2.4.0",
|
|
57
|
-
"@parcha/agentrun-computer": "0.1.0-beta.
|
|
58
|
-
"@parcha/agentrun-decisions": "0.1.0-beta.
|
|
59
|
-
"@parcha/agentrun-dsl": "0.1.0-beta.
|
|
60
|
-
"@parcha/agentrun-harness-
|
|
61
|
-
"@parcha/agentrun-harness-
|
|
62
|
-
"@parcha/agentrun-
|
|
63
|
-
"@parcha/agentrun-
|
|
64
|
-
"@parcha/
|
|
65
|
+
"@parcha/agentrun-computer": "0.1.0-beta.48",
|
|
66
|
+
"@parcha/agentrun-decisions": "0.1.0-beta.48",
|
|
67
|
+
"@parcha/agentrun-dsl": "0.1.0-beta.48",
|
|
68
|
+
"@parcha/agentrun-harness-acp": "0.1.0-beta.48",
|
|
69
|
+
"@parcha/agentrun-harness-claude": "0.1.0-beta.48",
|
|
70
|
+
"@parcha/agentrun-harness-codex": "0.1.0-beta.48",
|
|
71
|
+
"@parcha/agentrun-jev": "0.1.0-beta.48",
|
|
72
|
+
"@parcha/agentrun-kernel": "0.1.0-beta.48",
|
|
73
|
+
"@parcha/pi-browser": "0.1.0-beta.48",
|
|
65
74
|
"@secretlint/core": "13.1.0",
|
|
66
75
|
"@secretlint/profiler": "13.1.0",
|
|
67
76
|
"@secretlint/secretlint-rule-preset-recommend": "13.1.0",
|
|
@@ -96,7 +105,6 @@
|
|
|
96
105
|
"@earendil-works/chord": "1.5.2",
|
|
97
106
|
"@earendil-works/pi-ai": "1.5.2",
|
|
98
107
|
"@earendil-works/pi-durable": "1.5.2",
|
|
99
|
-
"@parcha/agentrun-harness-acp": "0.1.0-beta.46",
|
|
100
108
|
"@types/pg": "8.23.1",
|
|
101
109
|
"@types/proxy-addr": "2.0.3",
|
|
102
110
|
"@types/ws": "8.18.2",
|
|
@@ -13,6 +13,13 @@ Read this skill from the target server's `/skills/agentrun-serve/SKILL.md` when
|
|
|
13
13
|
build. Inspect `/v2/capabilities` and `/v2/openapi.json` before using an optional feature. A handoff naming an
|
|
14
14
|
existing instance is not permission to start a replacement or change its destination.
|
|
15
15
|
|
|
16
|
+
Secrets are saved by the person in the console, never with the API token: a model or tool key, an MCP server's token
|
|
17
|
+
or headers, the webhook's secret, Slack's incoming-webhook URL, GitHub. Prepare everything else through the API. A secret write answers `403
|
|
18
|
+
forbidden` with `error.details.console_url`, the console's form with the rest filled in (or build it:
|
|
19
|
+
`<console>/#/settings/mcp?add=<name>&auth=bearer`, adding `&url=<url>` only when no key or token is in the URL).
|
|
20
|
+
Open that link in the person's browser for them and tell them to paste the secret there and save. Never ask for a
|
|
21
|
+
secret in the chat.
|
|
22
|
+
|
|
16
23
|
## Choose the onboarding path
|
|
17
24
|
|
|
18
25
|
For general setup, establish whether the user wants to **start a new agent** or **bring an existing agent**.
|
|
@@ -360,9 +367,13 @@ For everything the MCP tools do not cover (tool keys, triggers, webhooks, files,
|
|
|
360
367
|
## Troubleshooting
|
|
361
368
|
|
|
362
369
|
- `401`: the token is not this server's. Read it again from the data directory the server was started with.
|
|
370
|
+
- `403 forbidden` with `error.details.console_url`: a secret write, which only the person's console makes. Open the link for them; they paste the secret there.
|
|
363
371
|
- `403` on `/v2/mcp`: the request carried a browser `Origin` that is not the server's own. Call it from your MCP client, not a web page.
|
|
364
372
|
- `405` on `/v2/mcp`: it takes POST only (no stream, no session).
|
|
365
373
|
- `409 agent_not_runnable`: this server cannot run that agent yet (a harness, tool or key it lacks); `error.details` and `whoami` say which.
|
|
366
374
|
- `422 input_invalid`: `error.fields` names each field to fix.
|
|
375
|
+
- A refusal that says `restart the server with AGENTRUN_...`: a start-time switch is off (an MCP server or a webhook
|
|
376
|
+
receiver on this machine, the hosts a computer may reach). No API call sets it. `/v2/capabilities` `switches` lists
|
|
377
|
+
each and its value; set the variable and start the server again, the `=1` ones only on a machine you alone use.
|
|
367
378
|
- `429 rate_limited` from `runs_start`: the server is at its most runs at once. Start it again when one ends.
|
|
368
379
|
- Keep the server on the loopback address. Started with `--listen` on another one, put TLS in front of it.
|
package/templates/README.md
CHANGED
|
@@ -347,7 +347,7 @@ package}`, and a line in the markdown).
|
|
|
347
347
|
| `inputs` | By name: each run's typed input, which apply compiles into the agent's `input_schema` (a closed JSON Schema object). Each is `{type: string \| number \| integer \| boolean \| array, required?, title?, description?, examples?, default?, enum?, pattern? and format? (strings), minLength?/maxLength? (strings), minimum?/maximum? (numbers), items? (an array's scalar, with that scalar's keys)}`, nothing else; an input is required unless it says `required: false`, and a `default` is for one that is not. `format` is `uri`, `email`, `hostname`, `date`, `date-time` or `uuid`, which the server checks, or `cron` or `timezone`, which a form reads. A default and each example are checked against their own input. `content` is the run's message: named, it is a string. Every path that starts a run (the API, the CLI, a trigger, the console) checks the input against it and refuses one that does not meet it with `422 input_invalid`, a path per field (`input.country`). The model is sent the input's `content`, then the other fields as one fenced `json` block under the line `Input:`, so the instructions read each field by its name. `GET /v2/templates` shows it as `input_schema`, and the console's run form is drawn from it. A trigger's `target.input` and an eval case's `input` are checked against it too. Absent: a run takes `{content}`, as before. |
|
|
348
348
|
| `secrets` | Variable names (never values) the server must hold: a model or tool key Settings saves (`OPENROUTER_API_KEY`, `PARALLEL_API_KEY`, ...), set where it starts or saved there. Any other name is refused: the server could neither save it nor hand it to a run. Apply refuses with `409 agent_not_runnable`, making nothing, when one is missing. |
|
|
349
349
|
| `budget` | `{per_run_usd}`: each run's cap (the agent's `max_cost_usd`), required when the package has triggers. A call count belongs in the instructions ("about 30 calls"); the cap is the hard stop. |
|
|
350
|
-
| `learning` | `true`, `false`, or an object (on, with the loop's settings), as an agent definition's `learning` takes it: whether the agent's runs learn. A package whose answer carries a decision names it in `agree_on`, dotted paths into the answer's JSON object (kyb's `{agree_on: [verdict.decision]}`, inbound-lead's `[next_step.action]`): a learned workflow's check and audit compare two answers on those alone, never on the rationale or prose two runs never repeat. Each path must be a required property at every level of the `output` schema (validate refuses one an answer may leave out: a path missing on both sides never agrees). Without it
|
|
350
|
+
| `learning` | `true`, `false`, or an object (on, with the loop's settings), as an agent definition's `learning` takes it: whether the agent's runs learn. A package whose answer carries a decision names it in `agree_on`, dotted paths into the answer's JSON object (kyb's `{agree_on: [verdict.decision]}`, inbound-lead's `[next_step.action]`): a learned workflow's check and audit compare two answers on those alone, never on the rationale or prose two runs never repeat. Each path must be a required property at every level of the `output` schema (validate refuses one an answer may leave out: a path missing on both sides never agrees). Without it, two answers that differ are compared by the agent's fast model, which says whether they reach the same decision (one request per pair, on the run's own cap), so a learning agent with no `agree_on` wants a fast tier: `model_tiers.fast`, or the host's AGENT_MODEL_FAST. With neither, the whole answer is compared, word for word. |
|
|
351
351
|
| `approvals` | `ask` (the default: the agent asks its person before a tool runs) or `never` (it runs unattended). The package's recommendation, shown as `approvals_default` for the apply screen; a template whose job runs on triggers says `never`. `never` only skips asking for the tools the agent was granted: an MCP tool the owner left unticked at apply is not one. Under `ask`, a ticked tool is granted but not allowed: it follows this server's tool settings, so a write asks unless the owner allowed it in Settings → Tools, and a read runs unasked only where the owner turned on Allow reads for its server. Deny settings and pins hold either way. |
|
|
352
352
|
| `triggers` | `POST /v2/triggers` bodies with no `agent_id` (the target is a `start_run`), each with a `name`, unique in the package: the key an upgrade will match triggers by. `enabled` is `true` (the default), `false`, or `"${parameters.<name>}"`, one placeholder alone naming a boolean parameter that has a default (validate refuses any other text there, a parameter of another type, or one with no default): apply makes the trigger enabled or disabled by the owner's answer, the default when it is left out, so a second schedule can be one the owner opts into (`weekly`, default `false`, turning on a `monday-brief` at `0 8 * * 1`). A trigger made off is off as any trigger is: the owner switches it on or off later with `PATCH /v2/triggers/{id}` or the console. A `composio` trigger's `source.server` is the toolkit of one of the package's `mcp` needs, one with `source: composio` and `required: true` (`server: github` for `{source: composio, toolkit: github}`), never a saved server's name: apply makes the trigger on the saved Composio server that need maps to, the one candidate or the owner's pick under `servers`. Its `config` values and its `accept` where `in` values may hold `${parameters.<name>}`, a parameter that is required or has a default (`config: {owner: "${parameters.owner}", repo: "${parameters.repo}"}`); its `server` and `event` can't. It can't carry `instance_id`, `hook` or `move_subscription`, which this server sets when it makes the trigger on Composio. A composio trigger this server can't set up yet (no public URL, the saved server's user with no connected account or several, the project's subscription at another address) is skipped with a `triggers.<i>` warning in the refusal's words, as a github one is with GitHub not connected: the agent stands, and the owner makes the trigger from Triggers → New app trigger once that's fixed. Any other refusal undoes the apply. A `feed` trigger's `urls` is a list of URLs, each of which may hold `${parameters.<name>}` (pr-alert's `https://api.github.com/repos/${parameters.owner}/${parameters.repo}/pulls?state=open&sort=created&direction=desc`), or one placeholder alone naming an array-of-strings parameter (vendor-outage-watch's `"${parameters.status_feeds}"`), filled whole; each parameter required or with a default, and each filled value an http(s) URL, which apply checks (`422` under `triggers.<i>.source.urls[<j>]`). An array parameter given empty (`[]`) reads no feed: apply skips that trigger with a `triggers.<i>` warning naming the parameter, as it skips a github one with GitHub not connected, and the agent stands. Its `every_s`, `items` and `id` take no placeholder, its `accept` where `in` values may, and it has no `key` in a package. |
|
|
353
353
|
| `output` | `{schema: <file>}`: the JSON Schema of the agent's answer, a file in the package. It becomes the agent's `output_schema`: the runner puts it in the instructions on every harness and asks once more when an answer misses it. A string property with `contentMediaType: "text/markdown"` is a report the console renders as Markdown. A skill that reads the schema itself keeps the file in its own folder. |
|
|
@@ -35,10 +35,10 @@ tool_policy: { bash: read-only }
|
|
|
35
35
|
mcp:
|
|
36
36
|
- source: github
|
|
37
37
|
toolkit: github
|
|
38
|
-
tools: [pull_request_read, get_file_contents,
|
|
38
|
+
tools: [pull_request_read, get_file_contents, pull_request_review_write, add_comment_to_pending_review]
|
|
39
39
|
required: false
|
|
40
40
|
reason: "Reads the pull request and the repo through GitHub, and posts one COMMENT review with the findings. Every call is held to this one repository. It never approves, requests changes or resolves a thread."
|
|
41
|
-
allow: [pull_request_read, get_file_contents
|
|
41
|
+
allow: [pull_request_read, get_file_contents]
|
|
42
42
|
# A pull request is text anyone can write: every tool, reads too, is pinned to the one repository, so a hostile
|
|
43
43
|
# one can't have a read reach another repository the token reaches and the review quote it. No free-text search
|
|
44
44
|
# (search_code reaches every repository the token does). The review write posts COMMENT reviews only: never
|
|
@@ -46,7 +46,6 @@ mcp:
|
|
|
46
46
|
pin:
|
|
47
47
|
pull_request_read: { owner: "${parameters.owner}", repo: "${parameters.repo}" }
|
|
48
48
|
get_file_contents: { owner: "${parameters.owner}", repo: "${parameters.repo}" }
|
|
49
|
-
get_repository_tree: { owner: "${parameters.owner}", repo: "${parameters.repo}" }
|
|
50
49
|
pull_request_review_write: { owner: "${parameters.owner}", repo: "${parameters.repo}", method: [create, submit_pending, delete_pending], event: [null, COMMENT] }
|
|
51
50
|
add_comment_to_pending_review: { owner: "${parameters.owner}", repo: "${parameters.repo}" }
|
|
52
51
|
parameters:
|
|
@@ -115,33 +115,6 @@
|
|
|
115
115
|
"isError": true
|
|
116
116
|
}
|
|
117
117
|
},
|
|
118
|
-
"get_repository_tree": {
|
|
119
|
-
"description": "List a repository's tree.",
|
|
120
|
-
"input": {
|
|
121
|
-
"type": "object",
|
|
122
|
-
"properties": {
|
|
123
|
-
"owner": {
|
|
124
|
-
"type": "string"
|
|
125
|
-
},
|
|
126
|
-
"repo": {
|
|
127
|
-
"type": "string"
|
|
128
|
-
}
|
|
129
|
-
},
|
|
130
|
-
"required": [
|
|
131
|
-
"owner",
|
|
132
|
-
"repo"
|
|
133
|
-
]
|
|
134
|
-
},
|
|
135
|
-
"answers": [],
|
|
136
|
-
"default": {
|
|
137
|
-
"content": [
|
|
138
|
-
{
|
|
139
|
-
"type": "text",
|
|
140
|
-
"text": "{\"tree\": [{\"path\": \"src/cart/total.ts\", \"type\": \"blob\"}]}"
|
|
141
|
-
}
|
|
142
|
-
]
|
|
143
|
-
}
|
|
144
|
-
},
|
|
145
118
|
"pull_request_review_write": {
|
|
146
119
|
"description": "Create, submit or delete a pull request review: method create, submit_pending or delete_pending.",
|
|
147
120
|
"input": {
|