@parcha/agentrun-serve 0.1.0-beta.52 → 0.1.0-beta.53
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 +122 -1
- package/README.md +213 -24
- package/dist/agent-delete.d.ts +5 -6
- package/dist/agent-delete.js +30 -67
- package/dist/agent-package.d.ts +71 -0
- package/dist/agent-package.js +345 -0
- package/dist/agents-store.d.ts +26 -20
- package/dist/agents-store.js +41 -33
- package/dist/api-only.d.ts +26 -6
- package/dist/api-only.js +35 -13
- package/dist/claude-login.d.ts +1 -0
- package/dist/claude-login.js +1 -1
- package/dist/cli-learning/cli.d.ts +3 -0
- package/dist/cli-learning/cli.js +17 -3
- package/dist/cli-learning/connections.js +3 -2
- package/dist/cli-learning/schema.js +2 -1
- package/dist/cli.js +70 -7
- package/dist/composio-preset.d.ts +2 -1
- package/dist/composio-preset.js +4 -3
- package/dist/composio-triggers.d.ts +4 -0
- package/dist/composio-triggers.js +4 -1
- package/dist/computer-needs.d.ts +32 -0
- package/dist/computer-needs.js +80 -0
- package/dist/computer-setting.d.ts +1 -0
- package/dist/computer-setting.js +8 -1
- package/dist/console/assets/index-BFgyZzF_.js +734 -0
- package/dist/console/assets/index-DbilxljH.css +1 -0
- package/dist/console/index.html +2 -2
- package/dist/console-links.d.ts +1 -0
- package/dist/console-links.js +2 -0
- package/dist/env-switch.d.ts +14 -0
- package/dist/env-switch.js +23 -0
- package/dist/errors.d.ts +1 -0
- package/dist/errors.js +3 -0
- package/dist/eval-previous.js +4 -3
- package/dist/fal-price.js +10 -13
- package/dist/handed-secret.d.ts +4 -0
- package/dist/handed-secret.js +10 -0
- package/dist/harness-archive.d.ts +15 -5
- package/dist/harness-archive.js +71 -34
- package/dist/harness-check.d.ts +2 -1
- package/dist/harness-check.js +36 -95
- package/dist/harness-egress.d.ts +23 -0
- package/dist/harness-egress.js +69 -0
- package/dist/harness-recipe-entry.d.ts +71 -0
- package/dist/harness-recipe-entry.js +184 -0
- package/dist/harness-recipe.d.ts +73 -6
- package/dist/harness-recipe.js +185 -31
- package/dist/harness-sign-in.d.ts +29 -0
- package/dist/harness-sign-in.js +122 -0
- package/dist/harness-table.d.ts +21 -0
- package/dist/harness-table.js +58 -3
- package/dist/harness-zip.d.ts +6 -0
- package/dist/harness-zip.js +203 -0
- package/dist/ids.d.ts +11 -0
- package/dist/ids.js +36 -0
- package/dist/learn/commit.d.ts +14 -1
- package/dist/learn/commit.js +156 -1
- package/dist/learn/compile.js +22 -8
- package/dist/learn/folder.d.ts +5 -0
- package/dist/learn/folder.js +10 -1
- package/dist/learn/learning.sh +15 -3
- package/dist/learn/promote.d.ts +2 -2
- package/dist/learn/secrets.js +30 -7
- package/dist/learning-routes.d.ts +23 -11
- package/dist/learning-routes.js +110 -20
- package/dist/learning.d.ts +9 -6
- package/dist/learning.js +9 -4
- package/dist/mcp-gateway.js +15 -2
- package/dist/mcp-probe.d.ts +3 -0
- package/dist/mcp-probe.js +7 -2
- package/dist/mcp-resources.d.ts +44 -0
- package/dist/mcp-resources.js +100 -0
- package/dist/mcp-servers-store.d.ts +16 -12
- package/dist/model.d.ts +4 -4
- package/dist/model.js +6 -6
- package/dist/native/cli.js +9 -2
- package/dist/native/connection.d.ts +2 -2
- package/dist/native/connection.js +5 -2
- package/dist/native/discovery.d.ts +2 -0
- package/dist/native/discovery.js +10 -6
- package/dist/native/remote-worker-bridge.js +36 -4
- package/dist/native/remote.d.ts +18 -1
- package/dist/native/remote.js +126 -37
- package/dist/native/schema.d.ts +6 -0
- package/dist/native/schema.js +31 -6
- package/dist/native/source-account.d.ts +13 -0
- package/dist/native/source-account.js +114 -0
- package/dist/native/source-capture-hooks.d.ts +5 -0
- package/dist/native/source-capture-hooks.js +102 -0
- package/dist/native/source-mcp-selection.d.ts +13 -0
- package/dist/native/source-mcp-selection.js +72 -0
- package/dist/native/source-runtime-tools.d.ts +19 -0
- package/dist/native/source-runtime-tools.js +103 -0
- package/dist/native/source-snapshot-types.d.ts +138 -0
- package/dist/native/source-snapshot-types.js +12 -0
- package/dist/native/source-snapshot.d.ts +8 -0
- package/dist/native/source-snapshot.js +1201 -0
- package/dist/observation/learning.js +3 -2
- package/dist/openapi.js +167 -36
- package/dist/print.js +1 -1
- package/dist/purged-workflow.d.ts +12 -0
- package/dist/purged-workflow.js +43 -0
- package/dist/run-keys.d.ts +46 -0
- package/dist/run-keys.js +109 -0
- package/dist/run-launch.d.ts +16 -1
- package/dist/run-launch.js +30 -1
- package/dist/run-learning-served.d.ts +2 -2
- package/dist/run-model-key.d.ts +2 -2
- package/dist/run-model-key.js +5 -5
- package/dist/run-secrets.d.ts +2 -0
- package/dist/run-secrets.js +7 -4
- package/dist/run-view.d.ts +17 -0
- package/dist/run-view.js +25 -1
- package/dist/runner/adapter-loop.d.ts +11 -3
- package/dist/runner/adapter-loop.js +138 -22
- package/dist/runner/adapter-run-spec.js +25 -12
- package/dist/runner/audit.d.ts +2 -0
- package/dist/runner/audit.js +9 -1
- package/dist/runner/beside.js +2 -1
- package/dist/runner/claim-secrets.d.ts +29 -3
- package/dist/runner/claim-secrets.js +38 -4
- package/dist/runner/cli-run-spec.js +23 -12
- package/dist/runner/harness-loops.d.ts +6 -0
- package/dist/runner/harness-loops.js +11 -1
- package/dist/runner/held.d.ts +4 -0
- package/dist/runner/journal-kinds.d.ts +2 -0
- package/dist/runner/learned-first.d.ts +2 -0
- package/dist/runner/learned-first.js +1 -1
- package/dist/runner/learning-end.d.ts +7 -2
- package/dist/runner/learning-end.js +22 -10
- package/dist/runner/learning-seed.d.ts +9 -3
- package/dist/runner/learning-seed.js +2 -2
- package/dist/runner/main.d.ts +1 -0
- package/dist/runner/main.js +20 -13
- package/dist/runner/mcp-claim.js +6 -1
- package/dist/runner/mcp-run.d.ts +10 -7
- package/dist/runner/mcp-run.js +3 -5
- package/dist/runner/monid-run.js +9 -11
- package/dist/runner/project-checkpoint.d.ts +35 -0
- package/dist/runner/project-checkpoint.js +116 -0
- package/dist/runner/project-drain.d.ts +8 -0
- package/dist/runner/project-drain.js +25 -0
- package/dist/runner/project-host.d.ts +10 -0
- package/dist/runner/project-host.js +52 -0
- package/dist/runner/promotion.d.ts +14 -6
- package/dist/runner/promotion.js +98 -41
- package/dist/runner/redact.d.ts +13 -0
- package/dist/runner/redact.js +67 -1
- package/dist/runner/run-channel.d.ts +9 -0
- package/dist/runner/run-channel.js +15 -2
- package/dist/runner/run-child-host.d.ts +8 -4
- package/dist/runner/run-child-host.js +171 -41
- package/dist/runner/run-errors.js +2 -2
- package/dist/runner/runner-check.js +5 -2
- package/dist/runner/runner.js +26 -9
- package/dist/runner/store-secrets.js +7 -3
- package/dist/runner/workflow-first.d.ts +4 -0
- package/dist/runner/workflow-first.js +13 -0
- package/dist/runner/workflow-loop.d.ts +2 -1
- package/dist/runner/workflow-loop.js +2 -1
- package/dist/runner/workflow-spec.js +1 -1
- package/dist/runs-over-store.d.ts +34 -6
- package/dist/runs-over-store.js +133 -25
- package/dist/sdk/runs.d.ts +11 -1
- package/dist/sdk/runs.js +117 -26
- package/dist/sdk/schema.js +12 -2
- package/dist/sdk/workflows.d.ts +1 -1
- package/dist/server.d.ts +68 -32
- package/dist/server.js +600 -110
- package/dist/skills/agentrun-serve/SKILL.md +2 -1
- package/dist/source-sync/adoption.d.ts +15 -0
- package/dist/source-sync/adoption.js +36 -0
- package/dist/source-sync/auxiliary.d.ts +23 -0
- package/dist/source-sync/auxiliary.js +64 -0
- package/dist/source-sync/capture-git.d.ts +5 -0
- package/dist/source-sync/capture-git.js +272 -0
- package/dist/source-sync/capture-project.d.ts +53 -0
- package/dist/source-sync/capture-project.js +206 -0
- package/dist/source-sync/capture-refusal.d.ts +7 -0
- package/dist/source-sync/capture-refusal.js +16 -0
- package/dist/source-sync/capture.d.ts +11 -0
- package/dist/source-sync/capture.js +22 -0
- package/dist/source-sync/checkpoint-gate.d.ts +21 -0
- package/dist/source-sync/checkpoint-gate.js +52 -0
- package/dist/source-sync/checkpoints.d.ts +66 -0
- package/dist/source-sync/checkpoints.js +168 -0
- package/dist/source-sync/claim.d.ts +11 -0
- package/dist/source-sync/claim.js +48 -0
- package/dist/source-sync/destination.d.ts +47 -0
- package/dist/source-sync/destination.js +239 -0
- package/dist/source-sync/io.d.ts +15 -0
- package/dist/source-sync/io.js +52 -0
- package/dist/source-sync/local.d.ts +43 -0
- package/dist/source-sync/local.js +229 -0
- package/dist/source-sync/prepare.d.ts +59 -0
- package/dist/source-sync/prepare.js +93 -0
- package/dist/source-sync/projects.d.ts +61 -0
- package/dist/source-sync/projects.js +130 -0
- package/dist/source-sync/registry.d.ts +95 -0
- package/dist/source-sync/registry.js +226 -0
- package/dist/source-sync/service.d.ts +33 -0
- package/dist/source-sync/service.js +118 -0
- package/dist/source-sync/skill-edits.d.ts +12 -0
- package/dist/source-sync/skill-edits.js +122 -0
- package/dist/source-sync/snapshots.d.ts +48 -0
- package/dist/source-sync/snapshots.js +448 -0
- package/dist/source-sync/types.d.ts +9 -0
- package/dist/source-sync/types.js +14 -0
- package/dist/source-sync/workspace.d.ts +66 -0
- package/dist/source-sync/workspace.js +273 -0
- package/dist/store/agent-body.d.ts +4 -0
- package/dist/store/agent-body.js +16 -5
- package/dist/store/index.d.ts +2 -2
- package/dist/store/index.js +1 -1
- package/dist/store/schema.d.ts +2 -1
- package/dist/store/schema.js +2 -1
- package/dist/store/seal.d.ts +5 -1
- package/dist/store/seal.js +12 -3
- package/dist/store/sqlite/project-checkpoints.d.ts +11 -0
- package/dist/store/sqlite/project-checkpoints.js +70 -0
- package/dist/store/sqlite/run-launch.d.ts +4 -12
- package/dist/store/sqlite/run-launch.js +5 -19
- package/dist/store/sqlite/store.js +224 -170
- package/dist/store/store.d.ts +116 -39
- package/dist/store/store.js +14 -1
- package/dist/store-reads/learning.d.ts +2 -2
- package/dist/store-view.d.ts +3 -1
- package/dist/store-view.js +17 -5
- package/dist/template-import.d.ts +10 -2
- package/dist/template-import.js +116 -13
- package/dist/templates.d.ts +26 -5
- package/dist/templates.js +62 -10
- package/dist/timeline/index.d.ts +1 -1
- package/dist/timeline/index.js +1 -1
- package/dist/timeline/timeline.d.ts +5 -0
- package/dist/timeline/timeline.js +8 -0
- package/dist/tool-plane.d.ts +12 -12
- package/dist/tools.d.ts +8 -8
- package/dist/trigger-launch-hook.d.ts +47 -0
- package/dist/trigger-launch-hook.js +90 -0
- package/dist/trigger-targets.d.ts +14 -1
- package/dist/trigger-targets.js +20 -0
- package/dist/triggers.d.ts +54 -5
- package/dist/triggers.js +143 -8
- package/dist/uploads-archil.js +1 -1
- package/dist/uploads.js +1 -1
- package/dist/validate.js +1 -2
- package/dist/workspace/computer-for-claim.d.ts +2 -0
- package/dist/workspace/computer-for-claim.js +43 -0
- package/dist/workspace/paths.d.ts +6 -0
- package/dist/workspace/paths.js +6 -0
- package/dist/workspace/resolve-computer.d.ts +1 -0
- package/dist/workspace/run-tools.d.ts +2 -0
- package/dist/workspace/run-tools.js +8 -0
- package/launcher/agentrun-serve +1 -1
- package/package.json +10 -10
- package/skills/agentrun-serve/SKILL.md +2 -1
- package/templates/README.md +5 -2
- package/dist/console/assets/index-B-D0EM3j.js +0 -733
- package/dist/console/assets/index-DlQepP2J.css +0 -1
package/dist/cli.js
CHANGED
|
@@ -14,8 +14,9 @@ import { REPEAT_MS, stopOnce, stopOnSignals } from "./stop-signals.js";
|
|
|
14
14
|
import { resetPassword } from "./owner.js";
|
|
15
15
|
import { banner } from "./print.js";
|
|
16
16
|
import { parseTokens } from "./api-token.js";
|
|
17
|
-
import {
|
|
18
|
-
import { harnessModulesOf } from "./harness-table.js";
|
|
17
|
+
import { API_ONLY_ENV, RUN_KEYS_ENV, switchFrom } from "./env-switch.js";
|
|
18
|
+
import { harnessModulesOf, harnessRecipesOf } from "./harness-table.js";
|
|
19
|
+
import { hookOrigin, LAUNCH_HOOK_SECRET_ENV, LAUNCH_HOOK_URL_ENV, launchHookFrom } from "./trigger-launch-hook.js";
|
|
19
20
|
import { surviveClosedPipes } from "./closed-pipes.js";
|
|
20
21
|
import { installEnvProxy } from "./env-proxy.js";
|
|
21
22
|
import { startTelemetry } from "./telemetry.js";
|
|
@@ -28,22 +29,23 @@ surviveClosedPipes();
|
|
|
28
29
|
// Every outbound call through the proxy HTTPS_PROXY or HTTP_PROXY names, NO_PROXY's hosts and loopback direct
|
|
29
30
|
// (env-proxy.ts): for every command, before anything calls out. Neither set, nothing changes.
|
|
30
31
|
installEnvProxy();
|
|
31
|
-
const USAGE = `usage: agentrun-serve [--data DIR] [--listen ADDR] [--port N] [--open] [--faux MODULE] [--faux-browser MODULE] [--faux-github] [--allow-host NAME ...] [--max-runs N] [--drain-timeout D] [--documents DIR] [--allow-code-nodes] [--learning on|off] [--no-runner] [--harness-module MODULE ...]
|
|
32
|
+
const USAGE = `usage: agentrun-serve [--data DIR] [--listen ADDR] [--port N] [--open] [--faux MODULE] [--faux-browser MODULE] [--faux-github] [--allow-host NAME ...] [--max-runs N] [--drain-timeout D] [--documents DIR] [--allow-code-nodes] [--learning on|off] [--no-runner] [--harness-module MODULE ...] [--harness-recipe FILE ...] [--harness-sign-in]
|
|
32
33
|
agentrun-serve reset-password [--data DIR]
|
|
33
34
|
agentrun-serve validate-template DIR
|
|
34
35
|
agentrun-serve install-harness goose|cursor [--data DIR]
|
|
35
36
|
agentrun-serve install-harness --recipe FILE [--data DIR]
|
|
37
|
+
agentrun-serve sign-in-harness --recipe FILE [--data DIR]
|
|
36
38
|
agentrun-serve check-harness --recipe FILE [--model PROVIDER/MODEL] [--data DIR] [--report FILE] [--cap USD]
|
|
37
39
|
agentrun-serve eval-template DIR [--case NAME ...] [--runs N] [--server URL | --on-data DIR] [--grader-model PROVIDER/MODEL] [--report FILE] [--faux MODULE]
|
|
38
40
|
agentrun-serve import [--data DIR] [--from claude-code,codex,pi] [--dry-run] [--include-deleted] [--all] [--verbose] [--port N]
|
|
39
|
-
agentrun-serve learning connect|status|disconnect|retry --project PATH --runtime codex|claude-code [--url URL] [--data DIR]
|
|
41
|
+
agentrun-serve learning connect|status|disconnect|retry --project PATH --runtime codex|claude-code [--url URL] [--data DIR] [--no-sync]
|
|
40
42
|
agentrun-serve runner --data DIR [--loops N] [--drain-timeout D] [--name NAME]
|
|
41
43
|
agentrun-serve runner --check --data DIR [--name NAME]
|
|
42
44
|
agentrun-serve runner --check --env [--data DIR]
|
|
43
45
|
agentrun-serve runner --check --heartbeat --data DIR [--name NAME]
|
|
44
46
|
agentrun-serve store-schema [--data DIR]
|
|
45
47
|
agentrun-serve store-schema --build
|
|
46
|
-
agentrun-serve native discover|connect --project PATH [--runtime claude-code|codex] [--agent NAME|--profile NAME] [--url URL] [--data DIR]
|
|
48
|
+
agentrun-serve native discover|connect --project PATH [--runtime claude-code|codex] [--agent NAME|--profile NAME] [--url URL] [--data DIR] [--no-sync]
|
|
47
49
|
|
|
48
50
|
--data DIR the agent store and its runs (default ~/.local/share/agentrun/agents); the token is DIR/.token, mode 0600
|
|
49
51
|
--listen ADDR the address to listen on (default 127.0.0.1); on any other, every Host name is served and the token
|
|
@@ -76,6 +78,16 @@ const USAGE = `usage: agentrun-serve [--data DIR] [--listen ADDR] [--port N] [--
|
|
|
76
78
|
separated): a path, or a package installed with npm install --prefix DIR/harnesses PACKAGE, whose
|
|
77
79
|
entries(builtins) export adds harnesses of its own to this server and its runner. It never replaces
|
|
78
80
|
a built-in harness (pi, claude-agent, codex, opencode); one that does, or is missing, refuses the start
|
|
81
|
+
--harness-recipe FILE
|
|
82
|
+
a harness recipe to add a harness from (repeatable; default AGENTRUN_SERVE_HARNESS_RECIPES, comma-
|
|
83
|
+
separated), installed into DIR with agentrun harness install --recipe FILE. Its harness runs once a
|
|
84
|
+
harness-check of it passed on DIR, through this server's model proxy (a plan-billed one's keys are
|
|
85
|
+
not saved on a server yet); a recipe the loader refuses, or whose id another harness has, refuses
|
|
86
|
+
the start
|
|
87
|
+
--harness-sign-in run a person's runs of a plan-billed recipe with a sign-in on your own sign-in (agentrun harness
|
|
88
|
+
sign-in), never a schedule's or a trigger's. One owner's own machine alone: the start is refused
|
|
89
|
+
unless the server listens on loopback with no public address, keeps its store in DIR (no
|
|
90
|
+
AGENTRUN_STORE_URL), runs its runs beside it as its own user, and takes one API token
|
|
79
91
|
--no-runner run the server alone, with no runner beside it (default: one runner beside the server); start one or
|
|
80
92
|
more \`agentrun-serve runner --data DIR\` processes on the same data directory to claim and run runs;
|
|
81
93
|
each holds at most --loops N runs (default AGENTRUN_MAX_RUNS, else as many pi runs as its host's
|
|
@@ -104,6 +116,10 @@ AGENTRUN_TELEMETRY=debug prints each event on stderr and sends none.
|
|
|
104
116
|
AGENTRUN_API_ONLY=1 serves the run API alone, for a server behind its caller's backend (the routes in api-only.ts; every
|
|
105
117
|
other address is a 404, and there are no accounts).
|
|
106
118
|
|
|
119
|
+
AGENTRUN_LAUNCH_HOOK_URL with AGENTRUN_LAUNCH_HOOK_SECRET (a whsec_ secret): each trigger firing that would start a run
|
|
120
|
+
is POSTed to that URL, signed as Standard Webhooks, and the host starts the run through the API; this server starts
|
|
121
|
+
none for it. A 2xx answer marks the firing sent; any other, or none in 10 s, skipped. Set both, or neither.
|
|
122
|
+
|
|
107
123
|
The page is for one person, who signs in with a password (AGENTRUN_ACCOUNTS=0 turns this off; the token works for
|
|
108
124
|
scripts and the CLI either way). With no AGENTRUN_PUBLIC_URL, listening on loopback, the first visit to the page sets the
|
|
109
125
|
password; with it, or on any other address, the setup link this server prints carries a code. Sign-in tries are limited
|
|
@@ -258,6 +274,32 @@ if (process.argv[2] === "install-harness") {
|
|
|
258
274
|
process.exit(1);
|
|
259
275
|
}
|
|
260
276
|
}
|
|
277
|
+
// The owner's own sign-in to a recipe's agent, by the agent itself on this terminal (harness-sign-in.ts): the agent prints
|
|
278
|
+
// the address and reads the code, this terminal its stdin, stdout and stderr. 0 once the agent's sign-in exits 0, 1 when
|
|
279
|
+
// it did not sign in (its code), 2 for usage. No key is read. `agentrun harness sign-in` runs it.
|
|
280
|
+
if (process.argv[2] === "sign-in-harness") {
|
|
281
|
+
const usage = (message) => (console.error(`agentrun-serve sign-in-harness: ${message}\n\n${USAGE}`), process.exit(2));
|
|
282
|
+
const read = () => {
|
|
283
|
+
try {
|
|
284
|
+
return parseArgs({ args: process.argv.slice(3), options: { recipe: { type: "string" }, data: { type: "string" } } });
|
|
285
|
+
}
|
|
286
|
+
catch (error) {
|
|
287
|
+
return usage(error.message);
|
|
288
|
+
}
|
|
289
|
+
};
|
|
290
|
+
const { values } = read();
|
|
291
|
+
if (!values.recipe)
|
|
292
|
+
usage("--recipe FILE names the recipe whose agent signs in.");
|
|
293
|
+
const { signInHarness } = await import("./harness-sign-in.js");
|
|
294
|
+
const data = resolve(values.data ?? defaultData());
|
|
295
|
+
const done = await signInHarness({ recipe: values.recipe, data, env: process.env, say: (line) => console.error(line) });
|
|
296
|
+
if (!done.ok) {
|
|
297
|
+
console.error(done.message);
|
|
298
|
+
process.exit(1);
|
|
299
|
+
}
|
|
300
|
+
console.log(`Signed in: the agent keeps its sign-in in ${done.home}, and a server you start with --harness-sign-in on this machine runs your own runs on it. AgentRun never reads it.`);
|
|
301
|
+
process.exit(0);
|
|
302
|
+
}
|
|
261
303
|
// A recipe's agent run for real and judged (harness-check.ts): its report written as JSON, its stages and the three facts
|
|
262
304
|
// (resume, tool_gate, billing) printed. 0 when every stage passed, 1 when the recipe was refused, its binary is not the
|
|
263
305
|
// installed and pinned one, or a stage failed, 2 for usage. It spends: four short turns on --model, under --cap.
|
|
@@ -428,6 +470,8 @@ try {
|
|
|
428
470
|
learning: { type: "string" },
|
|
429
471
|
"no-runner": { type: "boolean", default: false },
|
|
430
472
|
"harness-module": { type: "string", multiple: true, default: [] },
|
|
473
|
+
"harness-recipe": { type: "string", multiple: true, default: [] },
|
|
474
|
+
"harness-sign-in": { type: "boolean", default: false },
|
|
431
475
|
help: { type: "boolean", short: "h", default: false },
|
|
432
476
|
},
|
|
433
477
|
}));
|
|
@@ -494,14 +538,27 @@ const signalled = () => {
|
|
|
494
538
|
process.on("SIGINT", signalled);
|
|
495
539
|
process.on("SIGTERM", signalled);
|
|
496
540
|
// AGENTRUN_API_ONLY=1: the run routes alone (api-only.ts), and no owner; a value that is neither on nor off stops here.
|
|
541
|
+
// AGENTRUN_RUN_KEYS=1: each run brings the tool keys this server does not hold (run-keys.ts), read the same way.
|
|
497
542
|
let apiOnly;
|
|
543
|
+
let runKeys;
|
|
498
544
|
try {
|
|
499
|
-
apiOnly =
|
|
545
|
+
apiOnly = switchFrom(API_ONLY_ENV);
|
|
546
|
+
runKeys = switchFrom(RUN_KEYS_ENV);
|
|
500
547
|
}
|
|
501
548
|
catch (error) {
|
|
502
549
|
console.error(`${error.message}\n\n${USAGE}`);
|
|
503
550
|
process.exit(2);
|
|
504
551
|
}
|
|
552
|
+
// The launch hook: the URL from the environment, its secret as the server holds its own (by name, on the launcher's
|
|
553
|
+
// list); half set or malformed stops here, in words that never hold the secret.
|
|
554
|
+
let launchHook;
|
|
555
|
+
try {
|
|
556
|
+
launchHook = launchHookFrom({ url: process.env[LAUNCH_HOOK_URL_ENV], secret: secret(LAUNCH_HOOK_SECRET_ENV) });
|
|
557
|
+
}
|
|
558
|
+
catch (error) {
|
|
559
|
+
console.error(`agentrun-serve: ${error.message}`);
|
|
560
|
+
process.exit(2);
|
|
561
|
+
}
|
|
505
562
|
const accounts = !apiOnly && process.env.AGENTRUN_ACCOUNTS !== "0";
|
|
506
563
|
// The address first (listen-first.ts): the port bound and named before the rest of the server loads, then answering that
|
|
507
564
|
// the server is warming until it takes the socket over. A port already taken is left to the start's own listen below,
|
|
@@ -534,10 +591,14 @@ try {
|
|
|
534
591
|
...(values["max-runs"] !== undefined ? { maxRuns: Number(values["max-runs"]) } : {}),
|
|
535
592
|
// The owner's harness modules: --harness-module, else AGENTRUN_SERVE_HARNESS_MODULES (harness-table.ts).
|
|
536
593
|
...(harnessModulesOf(values["harness-module"], process.env).length ? { harnessModules: harnessModulesOf(values["harness-module"], process.env) } : {}),
|
|
594
|
+
// And its harness recipes: --harness-recipe, else AGENTRUN_SERVE_HARNESS_RECIPES (harness-table.ts).
|
|
595
|
+
...(harnessRecipesOf(values["harness-recipe"], process.env).length ? { harnessRecipes: harnessRecipesOf(values["harness-recipe"], process.env) } : {}),
|
|
596
|
+
// Their runs on the owner's own sign-in, only as the owner says it here (no setting names it) and the start proves.
|
|
597
|
+
...(values["harness-sign-in"] ? { harnessSignIn: true } : {}),
|
|
537
598
|
...(values["drain-timeout"] ? { drainTimeout: values["drain-timeout"] } : {}), ...(values.documents ? { documents: values.documents } : {}), ...(values["allow-code-nodes"] ? { allowCodeNodes: true } : {}), ...(values.learning !== undefined ? { learning: values.learning } : {}), log: (line) => void process.stdout.write(`${line}\n`),
|
|
538
599
|
// The public address is the server's with accounts on or off: the Host names it serves, the webhook URLs it gives.
|
|
539
600
|
...(publicUrl ? { publicUrl } : {}),
|
|
540
|
-
...(accounts ? { accounts, openSetup: !publicUrl, countSessions: true } : {}), ...(apiOnly ? { apiOnly } : {}),
|
|
601
|
+
...(accounts ? { accounts, openSetup: !publicUrl, countSessions: true } : {}), ...(apiOnly ? { apiOnly } : {}), ...(launchHook ? { launchHook } : {}), ...(runKeys ? { runKeys } : {}),
|
|
541
602
|
// The proxies whose X-Forwarded-For the sign-in limit reads (comma-separated); none unless set.
|
|
542
603
|
...(trustedProxies.length ? { trustedProxies } : {}),
|
|
543
604
|
// A local install only as its operator says, never inferred: an MCP server on loopback is refused without it.
|
|
@@ -594,6 +655,8 @@ if (!values["no-runner"] && askedAt === undefined) {
|
|
|
594
655
|
const source = given ? "env" : givenList ? "list" : serve.tokenMade ? "made" : "file";
|
|
595
656
|
for (const line of banner({ url: serve.url, baseUrl: serve.baseUrl, data, token: serve.token, source, tokenIds: serve.tokenIds, accounts, ...(apiOnly ? { apiOnly } : {}), ...(serve.launchCode ? { launchCode: serve.launchCode } : {}), boxes: serve.boxesLine, ...(values.listen ? { listen: values.listen } : {}), ...(publicUrl ? { publicUrl } : {}) }))
|
|
596
657
|
console.log(line);
|
|
658
|
+
if (launchHook)
|
|
659
|
+
console.log(`Launch hook (${LAUNCH_HOOK_URL_ENV}): trigger firings go to ${hookOrigin(launchHook)}, whose host starts their runs; this server starts none for them.`);
|
|
597
660
|
// Open setup (no public address, a loopback listener): the link that sets the password. Any other start printed the
|
|
598
661
|
// setup link with its code as the code was made (owner.ts).
|
|
599
662
|
if (serve.setupUrl && serve.setupOpen)
|
|
@@ -10,7 +10,8 @@ export type ComposioControl = {
|
|
|
10
10
|
export declare const COMPOSIO_USER = "agentrun";
|
|
11
11
|
/** A Composio toolkit's slug, as a save takes it once trimmed and lower-cased. */
|
|
12
12
|
export declare const COMPOSIO_TOOLKIT: RegExp;
|
|
13
|
-
/** A Composio user id, as a save's `user_id` and a run's binding (mcp_auth's composio_user_id) take it.
|
|
13
|
+
/** A Composio user id, as a save's `user_id` and a run's binding (mcp_auth's composio_user_id) take it. A `:` is taken:
|
|
14
|
+
* a host names a team's connected accounts by a user such as `team:<tenant>`. */
|
|
14
15
|
export declare const COMPOSIO_USER_ID: RegExp;
|
|
15
16
|
/** The `user_id` a save names for a per-run server, reserved for that and never a Composio user: the server keeps no user
|
|
16
17
|
* and no connected account, and each run names its own (mcp_auth.<server> = {composio_user_id, connected_account_id?}). */
|
package/dist/composio-preset.js
CHANGED
|
@@ -16,8 +16,9 @@ export const COMPOSIO_USER = "agentrun";
|
|
|
16
16
|
/** A Composio toolkit's slug, as a save takes it once trimmed and lower-cased. */
|
|
17
17
|
export const COMPOSIO_TOOLKIT = /^[a-z0-9][a-z0-9_-]{0,63}$/;
|
|
18
18
|
const TOOLKIT = COMPOSIO_TOOLKIT;
|
|
19
|
-
/** A Composio user id, as a save's `user_id` and a run's binding (mcp_auth's composio_user_id) take it.
|
|
20
|
-
|
|
19
|
+
/** A Composio user id, as a save's `user_id` and a run's binding (mcp_auth's composio_user_id) take it. A `:` is taken:
|
|
20
|
+
* a host names a team's connected accounts by a user such as `team:<tenant>`. */
|
|
21
|
+
export const COMPOSIO_USER_ID = /^[A-Za-z0-9._@:-]{1,128}$/;
|
|
21
22
|
const USER_ID = COMPOSIO_USER_ID;
|
|
22
23
|
/** The `user_id` a save names for a per-run server, reserved for that and never a Composio user: the server keeps no user
|
|
23
24
|
* and no connected account, and each run names its own (mcp_auth.<server> = {composio_user_id, connected_account_id?}). */
|
|
@@ -196,7 +197,7 @@ export async function composioSave(body, control, save, name, signal, savedUrl)
|
|
|
196
197
|
if (!tools.length || tools.length > MAX_TOOLS || !tools.every((t) => typeof t === "string" && t && t.length <= MAX_SLUG))
|
|
197
198
|
issues.push(issue("tools", "invalid", `Send the slugs of the actions to grant: 1 to ${MAX_TOOLS} of them, each at most ${MAX_SLUG} characters.`));
|
|
198
199
|
if (!USER_ID.test(user))
|
|
199
|
-
issues.push(issue("user_id", "invalid", `A user_id is letters, digits and . _ @ - (at most 128), or "${COMPOSIO_PER_RUN}" for a server each run names its own account for.`));
|
|
200
|
+
issues.push(issue("user_id", "invalid", `A user_id is letters, digits and . _ @ : - (at most 128), or "${COMPOSIO_PER_RUN}" for a server each run names its own account for.`));
|
|
200
201
|
if (price !== undefined && !priceValid(price))
|
|
201
202
|
issues.push(issue("price_usd", "invalid", "price_usd is what each call of the server's actions costs, in USD: a finite number, 0 or more."));
|
|
202
203
|
if (ownConfig !== undefined && !COMPOSIO_AUTH_CONFIG_ID.test(ownConfig))
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ApiError } from "./errors.js";
|
|
1
2
|
import { type ComposioControl } from "./composio-preset.js";
|
|
2
3
|
import type { Source } from "./trigger-adapter.js";
|
|
3
4
|
import type { TriggerUpstream } from "./triggers.js";
|
|
@@ -48,6 +49,9 @@ export type ComposioEvent = {
|
|
|
48
49
|
polled: boolean;
|
|
49
50
|
sealed: string[];
|
|
50
51
|
};
|
|
52
|
+
/** A Composio trigger's refusal on a server with no public URL: made by make, and read by an apply's plan, which asks
|
|
53
|
+
* Composio nothing. */
|
|
54
|
+
export declare const composioNoPublicUrl: () => ApiError;
|
|
51
55
|
export declare class ComposioTriggers implements TriggerUpstream {
|
|
52
56
|
private readonly deps;
|
|
53
57
|
/** Each project's last step queued (serial), by a digest of its key. */
|
|
@@ -80,6 +80,9 @@ function onField(error, field) {
|
|
|
80
80
|
const issue = error.extra.fields?.[0];
|
|
81
81
|
return issue && (issue.field === "body" || issue.field === "toolkit") ? invalid([{ ...issue, field }]) : error;
|
|
82
82
|
}
|
|
83
|
+
/** A Composio trigger's refusal on a server with no public URL: made by make, and read by an apply's plan, which asks
|
|
84
|
+
* Composio nothing. */
|
|
85
|
+
export const composioNoPublicUrl = () => new ApiError("composio_no_public_url", "Composio can't reach this server: set its public URL first (AGENTRUN_PUBLIC_URL, the https address Composio sends events to), then make the trigger.");
|
|
83
86
|
export class ComposioTriggers {
|
|
84
87
|
deps;
|
|
85
88
|
/** Each project's last step queued (serial), by a digest of its key. */
|
|
@@ -90,7 +93,7 @@ export class ComposioTriggers {
|
|
|
90
93
|
// ---- the trigger engine's (TriggerUpstream) ----------------------------------------------------------------------------
|
|
91
94
|
async make(source, id, enabled, keep) {
|
|
92
95
|
if (!this.deps.publicUrl)
|
|
93
|
-
throw
|
|
96
|
+
throw composioNoPublicUrl();
|
|
94
97
|
for (const field of ["instance_id", "hook", SEALED_FIELD])
|
|
95
98
|
if (source[field] !== undefined)
|
|
96
99
|
throw invalid([{ field: `source.${field}`, reason: "not_allowed", message: `${field} is set by this server when it makes the trigger on Composio: leave it out.` }]);
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { ComputerClient, ProviderEntry } from "@parcha/agentrun-computer";
|
|
2
|
+
import type { InputIssue } from "./errors.js";
|
|
3
|
+
/** A need as a setting says it: a program's name a shell finds on its PATH, or a library's pip or npm name; no path, no
|
|
4
|
+
* space and no leading dash, so a scoped npm package (`@scope/name`) can't be named. */
|
|
5
|
+
export declare const NEED_NAME: RegExp;
|
|
6
|
+
/** The most needs one setting names. */
|
|
7
|
+
export declare const MAX_NEEDS = 32;
|
|
8
|
+
/** How long the check in the box may take. */
|
|
9
|
+
export declare const NEEDS_CHECK_MS = 30000;
|
|
10
|
+
/** The media image's recipe in the computer package, as the words of a Docker box's fix name it. */
|
|
11
|
+
export declare const MEDIA_RECIPE_PATH = "packages/computer/media/Dockerfile";
|
|
12
|
+
/** The documents image's recipe folder in the computer package, as the words of a Docker box's fix name it. */
|
|
13
|
+
export declare const DOCUMENTS_RECIPE_DIR = "packages/computer/documents";
|
|
14
|
+
/** What is wrong with `value` as a sandbox's needs, at `field`. */
|
|
15
|
+
export declare function needsIssues(value: unknown, field: string): InputIssue[];
|
|
16
|
+
/** What the box answered: the needs it lacks (none: it has them all), or why it could not be asked. */
|
|
17
|
+
export type NeedsAnswer = {
|
|
18
|
+
readonly missing: readonly string[];
|
|
19
|
+
} | {
|
|
20
|
+
readonly unchecked: string;
|
|
21
|
+
};
|
|
22
|
+
/** Asks the box behind `client` which of `needs` it lacks, by one `sh` with the names as its arguments, under the agent's
|
|
23
|
+
* shell environment (shellEnv): its PATH, never the image's, so a program the check finds is one the agent's bash finds. */
|
|
24
|
+
export declare function missingNeeds(client: ComputerClient, needs: readonly string[], signal?: AbortSignal): Promise<NeedsAnswer>;
|
|
25
|
+
/** How to give the Docker box an image that has what a sandbox needs. */
|
|
26
|
+
export declare const DOCKER_IMAGE_FIX = "Set AGENTRUN_DOCKER_IMAGE to an image that has them and restart the server. For video (chrome, ffmpeg, ffprobe, hyperframes), build the media image: docker build -t agentrun-media:<first 12 hex of its sha256> - < packages/computer/media/Dockerfile, and name that tag. For decks, documents and sheets (python-pptx, python-docx, openpyxl, pptxgenjs, docx, exceljs), build the documents image: docker build -t agentrun-documents:<first 12 hex of the sha256 of its Dockerfile and documents.sh> packages/computer/documents, and name that tag.";
|
|
27
|
+
/** The words a run ends with when its setting needs programs but is no sandbox (`what`: "none", "a desktop on E2B"):
|
|
28
|
+
* only a sandbox's box is checked for them, so nothing ran. The validator keeps needs to a sandbox; a stored body and a
|
|
29
|
+
* launch's computer are read as given, so the claim refuses this too, never running without them. */
|
|
30
|
+
export declare function needsNoSandboxWords(needs: readonly string[], what: string): string;
|
|
31
|
+
/** The words a run ends with when its box lacks what its agent needs, or could not be asked: nothing ran. */
|
|
32
|
+
export declare function needsWords(answer: NeedsAnswer, needs: readonly string[], entry: Pick<ProviderEntry, "label" | "local" | "imageEnv"> | undefined): string;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { shellEnv } from "./workspace/hands.js";
|
|
2
|
+
/** A need as a setting says it: a program's name a shell finds on its PATH, or a library's pip or npm name; no path, no
|
|
3
|
+
* space and no leading dash, so a scoped npm package (`@scope/name`) can't be named. */
|
|
4
|
+
export const NEED_NAME = /^[A-Za-z0-9][A-Za-z0-9._+-]{0,63}$/;
|
|
5
|
+
/** The most needs one setting names. */
|
|
6
|
+
export const MAX_NEEDS = 32;
|
|
7
|
+
/** How long the check in the box may take. */
|
|
8
|
+
export const NEEDS_CHECK_MS = 30_000;
|
|
9
|
+
/** The media image's recipe in the computer package, as the words of a Docker box's fix name it. */
|
|
10
|
+
export const MEDIA_RECIPE_PATH = "packages/computer/media/Dockerfile";
|
|
11
|
+
/** The documents image's recipe folder in the computer package, as the words of a Docker box's fix name it. */
|
|
12
|
+
export const DOCUMENTS_RECIPE_DIR = "packages/computer/documents";
|
|
13
|
+
/** What is wrong with `value` as a sandbox's needs, at `field`. */
|
|
14
|
+
export function needsIssues(value, field) {
|
|
15
|
+
const rule = `${field} is a list of 1 to ${MAX_NEEDS} program names the box must have on its PATH (or libraries its python3 or node loads, by their pip or npm names), each once, such as ["ffmpeg", "ffprobe"]`;
|
|
16
|
+
if (!Array.isArray(value) || value.length === 0 || value.length > MAX_NEEDS || !value.every((name) => typeof name === "string"))
|
|
17
|
+
return [{ field, reason: "wrong_type", message: rule }];
|
|
18
|
+
const bad = value.find((name) => !NEED_NAME.test(name));
|
|
19
|
+
if (bad !== undefined)
|
|
20
|
+
return [{ field, reason: "bad_format", message: `${field} holds ${JSON.stringify(bad)}, not a need's name: letters, digits, dots, underscores, plus signs and dashes, starting with a letter or digit, no path` }];
|
|
21
|
+
if (new Set(value).size !== value.length)
|
|
22
|
+
return [{ field, reason: "duplicate", message: `${field} names one need twice` }];
|
|
23
|
+
return [];
|
|
24
|
+
}
|
|
25
|
+
/** Whether the box's python3 has the distribution `sys.argv[1]` installed, by the name pip installs it by (pip's own
|
|
26
|
+
* normalization: case, dots, dashes and underscores alike). */
|
|
27
|
+
const PYTHON_HAS = "import importlib.metadata, sys; importlib.metadata.distribution(sys.argv[1])";
|
|
28
|
+
/** Whether a script of the box's node requires the name it is given (its one argument, the last of process.argv), from the folder the check runs in: node_modules of
|
|
29
|
+
* that folder and of each folder above it, up to /node_modules (where the documents image links its libraries), and
|
|
30
|
+
* node's global folders. */
|
|
31
|
+
const NODE_HAS = 'require("module").createRequire(process.cwd() + "/").resolve(process.argv.at(-1))';
|
|
32
|
+
/** The script the box runs: each argument it finds neither as a program on its PATH, nor as a library its python3 has
|
|
33
|
+
* installed, nor as a package its node requires, one a line. A box with no python3 or no node lacks the libraries that
|
|
34
|
+
* would need it. The names are arguments, never text of the script. */
|
|
35
|
+
const CHECK = `for name do command -v "$name" >/dev/null 2>&1 || python3 -c '${PYTHON_HAS}' "$name" >/dev/null 2>&1 || node -e '${NODE_HAS}' "$name" >/dev/null 2>&1 || printf "%s\\n" "$name"; done`;
|
|
36
|
+
/** Asks the box behind `client` which of `needs` it lacks, by one `sh` with the names as its arguments, under the agent's
|
|
37
|
+
* shell environment (shellEnv): its PATH, never the image's, so a program the check finds is one the agent's bash finds. */
|
|
38
|
+
export async function missingNeeds(client, needs, signal) {
|
|
39
|
+
let ran;
|
|
40
|
+
try {
|
|
41
|
+
ran = await client.call("exec.run", { argv: ["sh", "-c", CHECK, "sh", ...needs], env: { ...shellEnv() }, timeoutMs: NEEDS_CHECK_MS }, signal ? { signal } : undefined);
|
|
42
|
+
}
|
|
43
|
+
catch (error) {
|
|
44
|
+
return { unchecked: error instanceof Error ? error.message : String(error) };
|
|
45
|
+
}
|
|
46
|
+
if (!ran.ok)
|
|
47
|
+
return { unchecked: ran.error.message };
|
|
48
|
+
if (ran.value.exitCode !== 0)
|
|
49
|
+
return { unchecked: ran.value.timedOut ? `the check ran past ${NEEDS_CHECK_MS / 1000} s` : `the check exited ${ran.value.exitCode ?? `on ${ran.value.signal ?? "a signal"}`}` };
|
|
50
|
+
const said = Buffer.from(ran.value.stdout, "base64").toString("utf8").split("\n").filter(Boolean);
|
|
51
|
+
// Only names it was asked about: anything else the box printed is not an answer.
|
|
52
|
+
const missing = needs.filter((name) => said.includes(name));
|
|
53
|
+
return { missing };
|
|
54
|
+
}
|
|
55
|
+
/** How to give the Docker box an image that has what a sandbox needs. */
|
|
56
|
+
export const DOCKER_IMAGE_FIX = `Set AGENTRUN_DOCKER_IMAGE to an image that has them and restart the server. For video (chrome, ffmpeg, ffprobe, hyperframes), build the media image: docker build -t agentrun-media:<first 12 hex of its sha256> - < ${MEDIA_RECIPE_PATH}, and name that tag. For decks, documents and sheets (python-pptx, python-docx, openpyxl, pptxgenjs, docx, exceljs), build the documents image: docker build -t agentrun-documents:<first 12 hex of the sha256 of its Dockerfile and documents.sh> ${DOCUMENTS_RECIPE_DIR}, and name that tag.`;
|
|
57
|
+
/** How to give `entry`'s box an image that has what it lacks: a Docker box's is AGENTRUN_DOCKER_IMAGE (the media or
|
|
58
|
+
* documents image), a provider that names its image by a setting (imageEnv) by that one, any other its own image. */
|
|
59
|
+
function fixFor(entry) {
|
|
60
|
+
if (entry?.local)
|
|
61
|
+
return DOCKER_IMAGE_FIX;
|
|
62
|
+
if (entry?.imageEnv)
|
|
63
|
+
return `Set ${entry.imageEnv} to an image of ${entry.label}'s that has them and restart the server, or run this agent on the Docker box with an image that has them (AGENTRUN_DOCKER_IMAGE).`;
|
|
64
|
+
return `Give this agent a computer whose image has them: on the Docker box, set AGENTRUN_DOCKER_IMAGE to such an image (the media image, ${MEDIA_RECIPE_PATH}, has chrome, ffmpeg, ffprobe and hyperframes).`;
|
|
65
|
+
}
|
|
66
|
+
/** The words a run ends with when its setting needs programs but is no sandbox (`what`: "none", "a desktop on E2B"):
|
|
67
|
+
* only a sandbox's box is checked for them, so nothing ran. The validator keeps needs to a sandbox; a stored body and a
|
|
68
|
+
* launch's computer are read as given, so the claim refuses this too, never running without them. */
|
|
69
|
+
export function needsNoSandboxWords(needs, what) {
|
|
70
|
+
const list = new Intl.ListFormat("en", { type: "conjunction" }).format(needs);
|
|
71
|
+
return `This agent needs ${list} in a sandbox (computer.needs), and its computer is ${what}, which is not checked for them, so nothing ran. Make its computer a sandbox on the Docker box. ${DOCKER_IMAGE_FIX}`;
|
|
72
|
+
}
|
|
73
|
+
/** The words a run ends with when its box lacks what its agent needs, or could not be asked: nothing ran. */
|
|
74
|
+
export function needsWords(answer, needs, entry) {
|
|
75
|
+
const box = `This agent's sandbox${entry ? ` on ${entry.label}` : ""}`;
|
|
76
|
+
if ("unchecked" in answer)
|
|
77
|
+
return `${box} could not be checked for what it needs (${needs.join(", ")}): ${answer.unchecked.replace(/[.!?]+$/, "")}. Nothing ran.`;
|
|
78
|
+
const list = new Intl.ListFormat("en", { type: "conjunction" }).format(answer.missing);
|
|
79
|
+
return `${box} lacks ${list}, which the agent needs (computer.needs), so nothing ran. ${fixFor(entry)}`;
|
|
80
|
+
}
|
package/dist/computer-setting.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// An agent's computer, its one setting for where its tools run (Settings → Computers): `computer: { kind, provider?,
|
|
2
|
-
// image?, gpu?, persistent?, surface?, exec?, record? }` on its revision. kind is none, sandbox, desktop, phone or browser;
|
|
2
|
+
// image?, gpu?, persistent?, surface?, exec?, record?, needs? }` on its revision. kind is none, sandbox, desktop, phone or browser;
|
|
3
3
|
// provider names one of the computer providers (the computer package's kind registry), and is absent for none; image
|
|
4
4
|
// names one the provider offers for the kind, and absent is the kind's default; a sandbox's gpu is { type, count };
|
|
5
5
|
// persistent: true keeps the agent's own computer between its runs, where the configuration declares persistence. A
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
// {kind: "sandbox", provider: X}. Writing either sets both. A desktop, phone or browser computer leaves the run's folder
|
|
11
11
|
// on the runner, so its place reads runner.
|
|
12
12
|
import { configurationOf, PROVIDERS, serves } from "@parcha/agentrun-computer";
|
|
13
|
+
import { needsIssues } from "./computer-needs.js";
|
|
13
14
|
import { recorderMissing } from "./computer-record.js";
|
|
14
15
|
const isObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
15
16
|
/** The kinds of computer an agent can be given. */
|
|
@@ -73,6 +74,12 @@ const OPTIONAL = {
|
|
|
73
74
|
return [];
|
|
74
75
|
},
|
|
75
76
|
},
|
|
77
|
+
// The programs the sandbox must have on its PATH (computer-needs.ts): checked in the box at each claim, before the
|
|
78
|
+
// run's first model request; a box that lacks one ends the run in words. It says what the box holds, never its image.
|
|
79
|
+
needs: {
|
|
80
|
+
kinds: ["sandbox"],
|
|
81
|
+
check: needsIssues,
|
|
82
|
+
},
|
|
76
83
|
};
|
|
77
84
|
/** The fields a computer of `kind` may set beside its kind and provider, in OPTIONAL's order: none for kind none. */
|
|
78
85
|
export const kindSettings = (kind) => kind === "none" ? [] : Object.entries(OPTIONAL).filter(([, { kinds }]) => kinds === undefined || kinds.includes(kind)).map(([key]) => key);
|