@parcha/agentrun-serve 0.1.0-beta.59 → 0.1.0-beta.60
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 +77 -0
- package/README.md +188 -106
- package/dist/agent-delete.d.ts +6 -9
- package/dist/agent-delete.js +5 -3
- package/dist/agent-package.js +11 -1
- package/dist/api-only.d.ts +2 -2
- package/dist/api-only.js +3 -3
- package/dist/archil-routes.d.ts +4 -1
- package/dist/archil-routes.js +15 -12
- package/dist/archil-settings.d.ts +18 -8
- package/dist/archil-settings.js +35 -17
- package/dist/chatgpt-plan.d.ts +4 -2
- package/dist/chatgpt-plan.js +13 -3
- package/dist/claude-login-token.d.ts +5 -0
- package/dist/claude-login-token.js +8 -0
- package/dist/claude-login.d.ts +49 -3
- package/dist/claude-login.js +140 -10
- package/dist/cli-learning/connections.js +1 -1
- package/dist/console/assets/{backend-BztxEAvb.js → backend-QnwGVBeU.js} +1 -1
- package/dist/console/assets/index-DZi-muIj.js +629 -0
- package/dist/console/assets/{share-L84tlUDW.js → share-pz61zIn9.js} +2 -2
- package/dist/console/assets/{styles-CaRKlHke.js → styles-CcceGcu2.js} +31 -31
- package/dist/console/assets/styles-fjQBFfMv.css +1 -0
- package/dist/console/index.html +3 -3
- package/dist/console/share.html +3 -3
- package/dist/decisions.d.ts +1 -1
- package/dist/decisions.js +2 -2
- package/dist/factory-activity.d.ts +68 -0
- package/dist/factory-activity.js +153 -0
- package/dist/factory-runs.d.ts +11 -0
- package/dist/factory-runs.js +52 -0
- package/dist/filed-tool.d.ts +32 -0
- package/dist/filed-tool.js +122 -0
- package/dist/harness-keys.d.ts +1 -2
- package/dist/harness-keys.js +1 -2
- package/dist/harness-table.d.ts +4 -0
- package/dist/harness-table.js +4 -0
- package/dist/harness.js +6 -2
- package/dist/import-worker.js +2 -2
- package/dist/import.d.ts +9 -0
- package/dist/import.js +11 -1
- package/dist/key-refusal.d.ts +5 -0
- package/dist/key-refusal.js +25 -15
- package/dist/learn/audit.d.ts +20 -22
- package/dist/learn/audit.js +72 -55
- package/dist/learn/check.js +1 -1
- package/dist/learn/commit.d.ts +35 -43
- package/dist/learn/commit.js +62 -270
- package/dist/learn/compile.d.ts +4 -4
- package/dist/learn/compile.js +6 -7
- package/dist/learn/corrections.js +1 -1
- package/dist/learn/delete.d.ts +5 -12
- package/dist/learn/delete.js +17 -30
- package/dist/learn/forget-run.d.ts +16 -0
- package/dist/learn/forget-run.js +53 -0
- package/dist/learn/index.js +1 -1
- package/dist/learn/learning-of.d.ts +0 -4
- package/dist/learn/learning-of.js +0 -5
- package/dist/learn/{folder.d.ts → legacy/folder.d.ts} +2 -1
- package/dist/learn/{folder.js → legacy/folder.js} +4 -7
- package/dist/learn/legacy/place.d.ts +16 -0
- package/dist/{workspace/learning-workspace.js → learn/legacy/place.js} +12 -42
- package/dist/learn/legacy/scrub.d.ts +28 -0
- package/dist/learn/legacy/scrub.js +258 -0
- package/dist/learn/promote.d.ts +40 -66
- package/dist/learn/promote.js +69 -207
- package/dist/learn/reset-ledger.d.ts +18 -0
- package/dist/learn/reset-ledger.js +14 -0
- package/dist/learn/rows.d.ts +186 -0
- package/dist/learn/rows.js +376 -0
- package/dist/learn/workflow-draft.d.ts +4 -1
- package/dist/learn/workflow-draft.js +12 -2
- package/dist/learning-reset.d.ts +1 -1
- package/dist/learning-reset.js +9 -11
- package/dist/learning-routes.d.ts +60 -81
- package/dist/learning-routes.js +187 -360
- package/dist/learning-words.d.ts +2 -0
- package/dist/learning-words.js +2 -0
- package/dist/learning.d.ts +18 -24
- package/dist/learning.js +35 -66
- package/dist/mcp-gateway.d.ts +6 -0
- package/dist/mcp-gateway.js +44 -8
- package/dist/mcp-resources.d.ts +1 -1
- package/dist/native/discovery.d.ts +6 -0
- package/dist/native/discovery.js +14 -1
- package/dist/native/remote.d.ts +5 -0
- package/dist/native/remote.js +16 -0
- package/dist/native/runtime.js +3 -2
- package/dist/observation/observer.d.ts +6 -6
- package/dist/openapi.js +89 -29
- package/dist/place-offers.d.ts +3 -0
- package/dist/place-offers.js +3 -0
- package/dist/place.d.ts +33 -11
- package/dist/place.js +61 -26
- package/dist/purged-workflow.d.ts +0 -33
- package/dist/purged-workflow.js +3 -71
- package/dist/redact/match.d.ts +19 -4
- package/dist/redact/match.js +123 -30
- package/dist/run-launch.d.ts +3 -3
- package/dist/run-learning-served.d.ts +3 -3
- package/dist/run-learning-served.js +1 -1
- package/dist/run-listing.d.ts +1 -1
- package/dist/run-timeline-served.d.ts +1 -1
- package/dist/run-timeline-served.js +6 -5
- package/dist/runnable.js +25 -8
- package/dist/runner/adapter-run-spec.js +11 -20
- package/dist/runner/audit.d.ts +2 -4
- package/dist/runner/audit.js +28 -51
- package/dist/runner/cli-run-spec.js +8 -14
- package/dist/runner/compare-end.d.ts +0 -2
- package/dist/runner/compare-end.js +6 -2
- package/dist/runner/disk-free.d.ts +15 -4
- package/dist/runner/disk-free.js +25 -7
- package/dist/runner/feedback-round.d.ts +1 -1
- package/dist/runner/feedback-round.js +2 -2
- package/dist/runner/harness-loops.js +2 -3
- package/dist/runner/held.d.ts +0 -10
- package/dist/runner/held.js +0 -25
- package/dist/runner/journal-kinds.d.ts +4 -1
- package/dist/runner/journal-kinds.js +1 -1
- package/dist/runner/learned-first.d.ts +0 -2
- package/dist/runner/learned-first.js +3 -3
- package/dist/runner/learning-end.d.ts +12 -16
- package/dist/runner/learning-end.js +41 -75
- package/dist/runner/learning-seed.d.ts +13 -16
- package/dist/runner/learning-seed.js +13 -23
- package/dist/runner/main.js +1 -1
- package/dist/runner/mcp-run.d.ts +4 -0
- package/dist/runner/mcp-run.js +2 -0
- package/dist/runner/native-loop.js +2 -3
- package/dist/runner/promotion.d.ts +19 -28
- package/dist/runner/promotion.js +50 -69
- package/dist/runner/reflect-hook.d.ts +2 -2
- package/dist/runner/reflect-hook.js +4 -1
- package/dist/runner/run-child-host.d.ts +1 -9
- package/dist/runner/run-child-host.js +11 -67
- package/dist/runner/runner.d.ts +1 -1
- package/dist/runner/sdk-loop.js +2 -4
- package/dist/sdk/check.d.ts +1 -4
- package/dist/sdk/check.js +2 -3
- package/dist/sdk/runs.d.ts +20 -7
- package/dist/sdk/runs.js +105 -68
- package/dist/secrets.d.ts +4 -0
- package/dist/secrets.js +44 -10
- package/dist/server-fs.d.ts +1 -1
- package/dist/server-fs.js +1 -1
- package/dist/server-keys.d.ts +6 -0
- package/dist/server-keys.js +12 -0
- package/dist/server.d.ts +15 -15
- package/dist/server.js +214 -164
- package/dist/source-sync/auxiliary.js +2 -2
- package/dist/store/index.d.ts +1 -1
- package/dist/store/index.js +1 -1
- package/dist/store/postgres/migrations/0032_learning_rows.sql +65 -0
- package/dist/store/schema.d.ts +28 -2
- package/dist/store/schema.js +81 -5
- package/dist/store/sqlite/learning-rows.d.ts +23 -0
- package/dist/store/sqlite/learning-rows.js +559 -0
- package/dist/store/sqlite/store.d.ts +7 -1
- package/dist/store/sqlite/store.js +84 -18
- package/dist/store/store.d.ts +219 -6
- package/dist/store/store.js +13 -0
- package/dist/store-reads/journal.d.ts +33 -3
- package/dist/store-reads/journal.js +99 -4
- package/dist/store-reads/learning.d.ts +18 -22
- package/dist/store-reads/learning.js +35 -26
- package/dist/store-reads/loop.js +1 -1
- package/dist/store-view.d.ts +24 -2
- package/dist/store-view.js +40 -11
- package/dist/templates.d.ts +10 -2
- package/dist/templates.js +31 -4
- package/dist/tool-plane.d.ts +4 -2
- package/dist/tool-plane.js +9 -2
- package/dist/web-holds.d.ts +2 -0
- package/dist/web-holds.js +5 -2
- package/dist/web-run.js +2 -1
- package/dist/workspace/archil-exec.js +1 -1
- package/dist/workspace/archil.d.ts +1 -1
- package/dist/workspace/archil.js +1 -1
- package/dist/workspace/computer-deps.js +5 -3
- package/dist/workspace/computer-providers.d.ts +11 -1
- package/dist/workspace/computer-providers.js +29 -2
- package/dist/workspace/index.d.ts +1 -2
- package/dist/workspace/index.js +1 -2
- package/dist/workspace/paths.d.ts +0 -4
- package/dist/workspace/paths.js +0 -6
- package/dist/workspace/workspace.d.ts +1 -1
- package/dist/workspace/workspace.js +1 -1
- package/package.json +13 -13
- package/templates/TOOLS.md +46 -0
- package/dist/console/assets/index-LwNL4L9q.js +0 -619
- package/dist/console/assets/styles-DQo8rzY-.css +0 -1
- package/dist/workspace/learning-workspace.d.ts +0 -24
- /package/dist/learn/{learning.sh → legacy/learning.sh} +0 -0
package/dist/templates.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import type { GitHubConnectionView } from "./github-connection.js";
|
|
|
4
4
|
import { type Tier } from "./model.js";
|
|
5
5
|
import { type PinValue } from "./tool-gate.js";
|
|
6
6
|
import { type BashPolicy } from "./bash-read-only.js";
|
|
7
|
+
import { type FileSetting } from "./filed-tool.js";
|
|
7
8
|
import { type Json } from "./validate.js";
|
|
8
9
|
import { type Approvals } from "./approvals.js";
|
|
9
10
|
import { type LearningSetting } from "./learning-setting.js";
|
|
@@ -53,7 +54,10 @@ export declare const MAX_EVAL_FILE_BYTES: number;
|
|
|
53
54
|
* sets a permission: an apply's `grants`, the owner's ticks, grant the tools, and each call follows this server's tool settings
|
|
54
55
|
* (a write asks unless the owner allowed it there, a read follows the server's Allow reads, approvals never lifts an ask). `pin`, by tool: the arguments each of its calls must carry (a value, or
|
|
55
56
|
* `${parameters.<name>}`), which apply writes as the tool's pin in the agent's tool settings, so a send goes only to the
|
|
56
|
-
* destination the owner set.
|
|
57
|
+
* destination the owner set. `file`, by tool: where each of its answers is filed whole in the run's files and the paths of it
|
|
58
|
+
* the tool's result shows (filed-tool.ts), which apply writes as the tool's file setting in the agent's tool settings, so
|
|
59
|
+
* the tool's result is a summary, never the answer (the model's own file tools can still open the folder). Absent when
|
|
60
|
+
* the package files none. */
|
|
57
61
|
export type McpNeed = {
|
|
58
62
|
source: McpSource;
|
|
59
63
|
toolkit: string;
|
|
@@ -62,6 +66,7 @@ export type McpNeed = {
|
|
|
62
66
|
reason?: string;
|
|
63
67
|
allow: string[];
|
|
64
68
|
pin: Record<string, Record<string, PinValue>>;
|
|
69
|
+
file?: Record<string, FileSetting>;
|
|
65
70
|
};
|
|
66
71
|
/** One of a package's model choices (manifest `model.choices`): a model and the harness it runs on, which an owner picks
|
|
67
72
|
* by `id` at install (apply's overrides.choice) in place of the package's tier and preference. `label` names it on the
|
|
@@ -121,7 +126,8 @@ export type Package = {
|
|
|
121
126
|
choices?: ModelChoice[];
|
|
122
127
|
};
|
|
123
128
|
effort?: string;
|
|
124
|
-
/** Absent, the tools the server gives a new agent that names none
|
|
129
|
+
/** Absent, the tools the server gives a new agent that names none; with no `computer` list either, its apply is the
|
|
130
|
+
* create that gets Docker's box, refused where that box is not here and the runner has no shell (server.ts saveable). */
|
|
125
131
|
tools?: string[];
|
|
126
132
|
/** MCP servers by their source and toolkit, and the tools of each the agent is granted. One `required` refuses an apply
|
|
127
133
|
* on a server that has saved none that matches; any other is skipped there, with a warning. */
|
|
@@ -304,6 +310,7 @@ export declare function packageView(p: Package): {
|
|
|
304
310
|
required: boolean;
|
|
305
311
|
reason: string | null;
|
|
306
312
|
tools: {
|
|
313
|
+
file?: FileSetting | undefined;
|
|
307
314
|
pin?: Record<string, PinValue> | undefined;
|
|
308
315
|
name: string;
|
|
309
316
|
tool: string;
|
|
@@ -378,6 +385,7 @@ export declare function packageDetail<Pick>(p: Package, computerHere: (p: Packag
|
|
|
378
385
|
required: boolean;
|
|
379
386
|
reason: string | null;
|
|
380
387
|
tools: {
|
|
388
|
+
file?: FileSetting | undefined;
|
|
381
389
|
pin?: Record<string, PinValue> | undefined;
|
|
382
390
|
name: string;
|
|
383
391
|
tool: string;
|
package/dist/templates.js
CHANGED
|
@@ -23,6 +23,7 @@ import { isPinKeys } from "./tool-gate.js";
|
|
|
23
23
|
import { formatToolName, isMcpName, isMonidName, MCP_SERVER_NAME, MCP_TOOL_NAME, mcpToolName, MONID_NAME_WORDS, parseToolName } from "./tool-names.js";
|
|
24
24
|
import { pinIssues, sortedPin } from "./tool-plane.js";
|
|
25
25
|
import { BASH_POLICIES } from "./bash-read-only.js";
|
|
26
|
+
import { fileIssues } from "./filed-tool.js";
|
|
26
27
|
import { BOUND_TOOLS, toolOf } from "./tools.js";
|
|
27
28
|
import { TRIGGER_ADAPTERS } from "./trigger-adapters.js";
|
|
28
29
|
import { MOVE_FIELD } from "./trigger-composio.js";
|
|
@@ -311,6 +312,25 @@ function pinOf(pin, server, tools, at, bad) {
|
|
|
311
312
|
}
|
|
312
313
|
return out;
|
|
313
314
|
}
|
|
315
|
+
/** An mcp entry's `file` read: by tool, each one of the entry's `tools`, its setting checked by the one rule every file
|
|
316
|
+
* setting is (filed-tool.ts fileIssues). Each problem is told through `bad`; a tool whose setting reads is kept. */
|
|
317
|
+
function fileOf(file, tools, at, bad) {
|
|
318
|
+
const out = {};
|
|
319
|
+
if (!isObject(file))
|
|
320
|
+
return bad(`${at} is {<tool>: {folder, show}}, by the entry's tools: each answer of the tool is filed whole in that folder of the run's files, and the tool's result shows only the values at the show paths and the answer's shape`), out;
|
|
321
|
+
for (const [tool, setting] of Object.entries(file)) {
|
|
322
|
+
if (!tools.includes(tool)) {
|
|
323
|
+
bad(`${at}.${tool}: ${tool} is not one of this entry's tools (${tools.join(", ")}): a file setting files the answers of a tool the package lists`);
|
|
324
|
+
continue;
|
|
325
|
+
}
|
|
326
|
+
const issues = fileIssues(setting, `${at}.${tool}`);
|
|
327
|
+
for (const issue of issues)
|
|
328
|
+
bad(issue.message);
|
|
329
|
+
if (!issues.length)
|
|
330
|
+
out[tool] = { folder: setting.folder, show: [...setting.show] };
|
|
331
|
+
}
|
|
332
|
+
return out;
|
|
333
|
+
}
|
|
314
334
|
/** A pin's scalar filled from the apply's `given` parameters (typedFilled: an integer pins an integer), a list's items
|
|
315
335
|
* as text. `empty`: the parameters its placeholders name that were given no value (absent, or ""), so the pin cannot
|
|
316
336
|
* hold what the owner meant. */
|
|
@@ -645,8 +665,9 @@ export function readPackage(from, { evalFixtures = true } = {}) {
|
|
|
645
665
|
const names = isObject(need) && Array.isArray(need.tools) ? need.tools : [];
|
|
646
666
|
const allow = isObject(need) && need.allow !== undefined ? need.allow : [];
|
|
647
667
|
const pin = isObject(need) && need.pin !== undefined ? need.pin : {};
|
|
668
|
+
const file = isObject(need) && need.file !== undefined ? need.file : undefined;
|
|
648
669
|
const reason = isObject(need) ? need.reason : undefined;
|
|
649
|
-
const ok = isObject(need) && !unknownFields(need, ["source", "toolkit", "tools", "required", "reason", "allow", "pin"]).length && MCP_SOURCES.includes(need.source) && typeof need.toolkit === "string" && MCP_SERVER_NAME.test(need.toolkit)
|
|
670
|
+
const ok = isObject(need) && !unknownFields(need, ["source", "toolkit", "tools", "required", "reason", "allow", "pin", "file"]).length && MCP_SOURCES.includes(need.source) && typeof need.toolkit === "string" && MCP_SERVER_NAME.test(need.toolkit)
|
|
650
671
|
&& names.length > 0 && names.every((tool) => typeof tool === "string" && MCP_TOOL_NAME.test(tool)) && new Set(names).size === names.length && (need.required === undefined || typeof need.required === "boolean")
|
|
651
672
|
&& (reason === undefined || (typeof reason === "string" && reason.trim() !== "" && reason.length <= MAX_REASON && !/[\r\n]/.test(reason)))
|
|
652
673
|
&& Array.isArray(allow) && allow.every((tool) => names.includes(tool)) && new Set(allow).size === allow.length;
|
|
@@ -655,14 +676,15 @@ export function readPackage(from, { evalFixtures = true } = {}) {
|
|
|
655
676
|
if (isObject(need) && need.toolkit !== undefined && (typeof need.toolkit !== "string" || !MCP_SERVER_NAME.test(need.toolkit)))
|
|
656
677
|
bad(MANIFEST, `mcp[${i}].toolkit ${JSON.stringify(need.toolkit)} is not a toolkit name: ${MCP_SERVER_NAME.source}, the MCP server name rule, since the package names its tools mcp:<toolkit>/<tool>`);
|
|
657
678
|
else if (!ok)
|
|
658
|
-
bad(MANIFEST, `mcp[${i}] is {source: ${MCP_SOURCES.join(" | ")}, toolkit: the toolkit its tools come from, the name the package calls them by (mcp:<toolkit>/<tool>, ${MCP_SERVER_NAME.source}), tools: its tool names (${MCP_TOOL_NAME.source}), none twice, required?: true or false, reason?: one line of at most ${MAX_REASON} characters on why the agent needs them, allow?: the tools of its tools it asks the owner to allow, pin?: {<tool>: {<argument>: <value>}}}`);
|
|
679
|
+
bad(MANIFEST, `mcp[${i}] is {source: ${MCP_SOURCES.join(" | ")}, toolkit: the toolkit its tools come from, the name the package calls them by (mcp:<toolkit>/<tool>, ${MCP_SERVER_NAME.source}), tools: its tool names (${MCP_TOOL_NAME.source}), none twice, required?: true or false, reason?: one line of at most ${MAX_REASON} characters on why the agent needs them, allow?: the tools of its tools it asks the owner to allow, pin?: {<tool>: {<argument>: <value>}}, file?: {<tool>: {folder, show}}}`);
|
|
659
680
|
else if (need.source === "github" && need.toolkit !== "github")
|
|
660
681
|
bad(MANIFEST, `mcp[${i}]: a github source's toolkit is github (GitHub's MCP server), not ${need.toolkit}`);
|
|
661
682
|
else if (mcp.some((m) => m.toolkit === need.toolkit))
|
|
662
683
|
bad(MANIFEST, `mcp[${i}]: the toolkit ${need.toolkit} is listed twice: its tools are all mcp:${need.toolkit}/<tool>, so they are one entry`);
|
|
663
684
|
else {
|
|
664
685
|
const pinned = pinOf(pin, need.toolkit, names, `mcp[${i}].pin`, (message) => bad(MANIFEST, message));
|
|
665
|
-
|
|
686
|
+
const filed = file === undefined ? undefined : fileOf(file, names, `mcp[${i}].file`, (message) => bad(MANIFEST, message));
|
|
687
|
+
mcp.push({ source: need.source, toolkit: need.toolkit, tools: names, required: need.required === true, ...(typeof reason === "string" ? { reason } : {}), allow: allow, pin: pinned, ...(filed && Object.keys(filed).length ? { file: filed } : {}) });
|
|
666
688
|
}
|
|
667
689
|
}
|
|
668
690
|
// A policy by tool: bash's alone (bash-read-only.ts), on a package that grants bash or names no tools (a new agent's
|
|
@@ -1054,7 +1076,7 @@ export function packageView(p) {
|
|
|
1054
1076
|
category: p.category ?? null, tags: p.tags,
|
|
1055
1077
|
output: p.output ? { schema: p.output.schema, json_schema: p.outputSchema ?? null } : null,
|
|
1056
1078
|
harness: p.harness ?? null, model: modelView(p.model), effort: p.effort ?? null, tools: p.tools ?? null, tool_policy: p.toolPolicy ?? null, computer: p.computer ?? null, needs: p.needs ?? null, checkout: p.checkout ?? null,
|
|
1057
|
-
mcp: p.mcp.map(({ source, toolkit, tools, required, reason, allow, pin }) => ({ source, toolkit, required, reason: reason ?? null, tools: tools.map((name) => ({ name, tool: mcpToolName(toolkit, name), asks: allow.includes(name) ? "allow" : "ask", ...(Object.hasOwn(pin, name) ? { pin: pin[name] } : {}) })) })), parameters: p.parameters, input_schema: p.inputSchema ?? null, secrets: p.secrets,
|
|
1079
|
+
mcp: p.mcp.map(({ source, toolkit, tools, required, reason, allow, pin, file }) => ({ source, toolkit, required, reason: reason ?? null, tools: tools.map((name) => ({ name, tool: mcpToolName(toolkit, name), asks: allow.includes(name) ? "allow" : "ask", ...(Object.hasOwn(pin, name) ? { pin: pin[name] } : {}), ...(file && Object.hasOwn(file, name) ? { file: file[name] } : {}) })) })), parameters: p.parameters, input_schema: p.inputSchema ?? null, secrets: p.secrets,
|
|
1058
1080
|
budget: p.budget ?? null, learning: p.learning ?? false, approvals_default: p.approvals ?? "ask", triggers: p.triggers, skills: Object.keys(p.skills).filter((path) => /^[^/]+\/SKILL\.md$/.test(path)).map((path) => path.slice(0, -"/SKILL.md".length)), evals: p.evals,
|
|
1059
1081
|
};
|
|
1060
1082
|
}
|
|
@@ -1353,6 +1375,11 @@ export function compiled(p, parameters, chosen, _deps) {
|
|
|
1353
1375
|
else
|
|
1354
1376
|
settings[name] = { ...settings[name], pin: sortedPin(pin) };
|
|
1355
1377
|
}
|
|
1378
|
+
// A tool's file setting, written as the package states it, ticked or not (it holds once the tool is granted later), as
|
|
1379
|
+
// a pin is: the tool's result is a summary of each answer, never the answer.
|
|
1380
|
+
for (const { server, file } of chosen.mcp)
|
|
1381
|
+
for (const [tool, setting] of Object.entries(file ?? {}))
|
|
1382
|
+
settings[mcpToolName(server, tool)] = { ...settings[mcpToolName(server, tool)], file: { folder: setting.folder, show: [...setting.show] } };
|
|
1356
1383
|
const definition = {
|
|
1357
1384
|
name: p.displayName ? filled(p.displayName, parameters) : p.name, description: p.description, instructions: filled(p.instructions, parameters),
|
|
1358
1385
|
...(chosen.harness ? { harness: chosen.harness } : {}), ...(chosen.model ? { model: chosen.model } : {}), ...(chosen.modelTiers && Object.keys(chosen.modelTiers).length ? { model_tiers: chosen.modelTiers } : {}), ...(p.effort ? { thinking: p.effort } : {}),
|
package/dist/tool-plane.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ import { type ShellPlace } from "@parcha/agentrun-kernel/kernel";
|
|
|
6
6
|
import { type Permission, type Pin, type ToolEffect } from "./tool-gate.js";
|
|
7
7
|
import { type BashPolicy } from "./bash-read-only.js";
|
|
8
8
|
import { EMAIL_SCOPES } from "./email/names.js";
|
|
9
|
+
import { type FileSetting } from "./filed-tool.js";
|
|
9
10
|
/** An email read tool's scope (email/names.ts). */
|
|
10
11
|
type EmailScope = (typeof EMAIL_SCOPES)[number];
|
|
11
12
|
/**
|
|
@@ -72,7 +73,8 @@ export type ToolSetting = {
|
|
|
72
73
|
pin?: Pin; /** On an MCP server's wildcard (`mcp:<server>/*`) in the server's settings only: the tools its server marks read-only run with no approval (tool-gate.ts readsLift). Kept only when true. */
|
|
73
74
|
allow_reads?: true; /** bash's policy, an agent's own only (bash-read-only.ts). */
|
|
74
75
|
policy?: BashPolicy; /** An email read tool's scope, an agent's own only (email/tools.ts): its email run's thread (the default), or the whole account. */
|
|
75
|
-
scope?: EmailScope; /**
|
|
76
|
+
scope?: EmailScope; /** An MCP tool's file setting, an agent's own only, on the tool's own key (filed-tool.ts): its answers filed whole in the run's files, the model reading a summary. */
|
|
77
|
+
file?: FileSetting; /** Read as a stand-in for a value not offered (checkToolSettings); never shown or written. */
|
|
76
78
|
fallback?: true; /** The stand-in's value as written in the file, which a save that keeps the stand-in writes back (ToolSettings.put). Never shown. */
|
|
77
79
|
raw?: unknown; /** A pin in the file that does not read (readToolSettings): the gate refuses every call of the tool, and a save keeps it (ToolSettings.put) until the owner sets a valid pin or removes the tool's setting. Served as `pin_broken: true`. */
|
|
78
80
|
brokenPin?: true; /** The broken pin as written in the file, which a save that keeps it writes back. Never shown. */
|
|
@@ -269,7 +271,7 @@ export declare const handsJevWeb: (plane: Plane, env: NodeJS.ProcessEnv, harness
|
|
|
269
271
|
* table, a catalog tool, an MCP server's wildcard) to `{provider?, permission?}`, a provider only for a capability that
|
|
270
272
|
* has a choice and one offered for it, a permission one offered for the tool. */
|
|
271
273
|
export declare function settingsIssues(value: unknown, at?: string, layer?: "server" | "agent"): InputIssue[];
|
|
272
|
-
/** `map` as a revision body keeps it: each tool's provider, permission, pin and
|
|
274
|
+
/** `map` as a revision body keeps it: each tool's provider, permission, pin, policy, scope and file setting as written (never a stand-in's internal
|
|
273
275
|
* marks), tools, fields and a pin's arguments sorted, and a tool with none of them gone. The one form, so two
|
|
274
276
|
* revisions whose settings say the same (a pin's arguments in another order) are the same text, and so one revision
|
|
275
277
|
* where its id is the body's digest (the store keeps the body as given: store/sqlite/store.ts). */
|
package/dist/tool-plane.js
CHANGED
|
@@ -39,6 +39,7 @@ import { canonicalPin, defaultPermission, isPinKeys, MAX_PIN_ARGS, MAX_PIN_CHOIC
|
|
|
39
39
|
import { BASH_POLICIES } from "./bash-read-only.js";
|
|
40
40
|
import { EMAIL_SCOPES, SCOPED_TOOLS, SCOPED_WORDS } from "./email/names.js";
|
|
41
41
|
import { isCatalogName, isMcpName, mcpNameOf, parseToolName } from "./tool-names.js";
|
|
42
|
+
import { fileIssues } from "./filed-tool.js";
|
|
42
43
|
/**
|
|
43
44
|
* The capabilities a pack or a revision may grant, by name: the tools the kernel gives a run, bound from serve's closed
|
|
44
45
|
* table (tools.ts) and named the same on every harness that runs them. `web_search` and `web_fetch` resolve to a
|
|
@@ -500,6 +501,12 @@ export function settingsIssues(value, at = "", layer = "server") {
|
|
|
500
501
|
return [{ field: field(name, key), reason: "not_allowed", message: `A scope is set on ${SCOPED_WORDS} in an agent's own tool settings (definition.tool_settings.email_read.scope), never ${layer === "agent" ? `on ${name}` : "in the server's"}.` }];
|
|
501
502
|
return EMAIL_SCOPES.includes(given) ? [] : [{ field: field(name, key), reason: "not_an_option", message: `${field(name, key)} is one of ${EMAIL_SCOPES.join(", ")}: thread, an email's run reads its thread alone; mailbox, the whole account` }];
|
|
502
503
|
}
|
|
504
|
+
// An MCP tool's file setting (filed-tool.ts): an agent's own, on the tool's own key only, set as bash's policy is.
|
|
505
|
+
if (key === "file") {
|
|
506
|
+
if (layer !== "agent" || !mcpNameOf(name))
|
|
507
|
+
return [{ field: field(name, key), reason: "not_allowed", message: `A file setting is set on an MCP tool's own key (mcp:<server>/<tool>) in an agent's own tool settings (definition.tool_settings), never ${layer === "agent" ? `on ${name}` : "in the server's"}.` }];
|
|
508
|
+
return fileIssues(given, field(name, key));
|
|
509
|
+
}
|
|
503
510
|
// The server's own mark of a pin in its file that does not read (withDefaults serves it), which a whole-map save
|
|
504
511
|
// sends back: it keeps the broken pin, and nothing else. Never an agent's.
|
|
505
512
|
if (key === "pin_broken") {
|
|
@@ -525,7 +532,7 @@ export function settingsIssues(value, at = "", layer = "server") {
|
|
|
525
532
|
});
|
|
526
533
|
});
|
|
527
534
|
}
|
|
528
|
-
/** `map` as a revision body keeps it: each tool's provider, permission, pin and
|
|
535
|
+
/** `map` as a revision body keeps it: each tool's provider, permission, pin, policy, scope and file setting as written (never a stand-in's internal
|
|
529
536
|
* marks), tools, fields and a pin's arguments sorted, and a tool with none of them gone. The one form, so two
|
|
530
537
|
* revisions whose settings say the same (a pin's arguments in another order) are the same text, and so one revision
|
|
531
538
|
* where its id is the body's digest (the store keeps the body as given: store/sqlite/store.ts). */
|
|
@@ -534,7 +541,7 @@ export function canonicalToolSettings(map) {
|
|
|
534
541
|
return sorted(Object.fromEntries(Object.entries(map).flatMap(([name, setting]) => {
|
|
535
542
|
if (!setting)
|
|
536
543
|
return [];
|
|
537
|
-
const kept = sorted({ ...(setting.permission ? { permission: setting.permission } : {}), ...(setting.allow_reads === true ? { allow_reads: true } : {}), ...(setting.pin ? { pin: sortedPin(setting.pin) } : {}), ...(setting.policy ? { policy: setting.policy } : {}), ...(setting.scope ? { scope: setting.scope } : {}), ...(setting.provider ? { provider: setting.provider } : {}) });
|
|
544
|
+
const kept = sorted({ ...(setting.permission ? { permission: setting.permission } : {}), ...(setting.allow_reads === true ? { allow_reads: true } : {}), ...(setting.pin ? { pin: sortedPin(setting.pin) } : {}), ...(setting.policy ? { policy: setting.policy } : {}), ...(setting.scope ? { scope: setting.scope } : {}), ...(setting.file ? { file: { folder: setting.file.folder, show: [...setting.file.show] } } : {}), ...(setting.provider ? { provider: setting.provider } : {}) });
|
|
538
545
|
return Object.keys(kept).length ? [[name, kept]] : [];
|
|
539
546
|
})));
|
|
540
547
|
}
|
package/dist/web-holds.d.ts
CHANGED
|
@@ -4,6 +4,8 @@ export type WebHold = Hold;
|
|
|
4
4
|
/** How long the server holds a keyless provider whose limit named no end (out of quota for the rest of a run): the
|
|
5
5
|
* first run after it pays at most one more refusal to learn it again. */
|
|
6
6
|
export declare const ENDLESS_HOLD_MS: number;
|
|
7
|
+
/** The furthest a hold's end may be from `now`: a Retry-After or a reset weeks away holds the host 25 h at most. */
|
|
8
|
+
export declare const MAX_HOLD_MS: number;
|
|
7
9
|
/** The variable a run's own process gets the server's holds in: JSON, an array of WebHold. */
|
|
8
10
|
export declare const WEB_HOLDS_ENV = "AGENTRUN_SERVE_WEB_HOLDS";
|
|
9
11
|
/** Keeps `value` (holdOf) as the host's hold on its provider's tool, unless one held already ends no earlier: the hold
|
package/dist/web-holds.js
CHANGED
|
@@ -7,6 +7,8 @@ import { holdingWords, isProviderId, providerOf } from "@parcha/agentrun-web";
|
|
|
7
7
|
/** How long the server holds a keyless provider whose limit named no end (out of quota for the rest of a run): the
|
|
8
8
|
* first run after it pays at most one more refusal to learn it again. */
|
|
9
9
|
export const ENDLESS_HOLD_MS = 60 * 60_000;
|
|
10
|
+
/** The furthest a hold's end may be from `now`: a Retry-After or a reset weeks away holds the host 25 h at most. */
|
|
11
|
+
export const MAX_HOLD_MS = 25 * 60 * 60_000;
|
|
10
12
|
/** The variable a run's own process gets the server's holds in: JSON, an array of WebHold. */
|
|
11
13
|
export const WEB_HOLDS_ENV = "AGENTRUN_SERVE_WEB_HOLDS";
|
|
12
14
|
const TOOLS = new Set(["search", "fetch", "key"]);
|
|
@@ -17,7 +19,7 @@ const FIELDS = ["provider", "tool", "kind", "until"];
|
|
|
17
19
|
// them.
|
|
18
20
|
const holds = new Map();
|
|
19
21
|
/** `value` as a keyless provider's hold, its end `until` (epoch ms; null or Infinity: none named, read as ENDLESS_HOLD_MS
|
|
20
|
-
* from `now`), or undefined: a keyed or unknown provider, another field, or an end not after `now`. */
|
|
22
|
+
* from `now`; at most MAX_HOLD_MS from `now`), or undefined: a keyed or unknown provider, another field, or an end not after `now`. */
|
|
21
23
|
function holdOf(value, now) {
|
|
22
24
|
if (typeof value !== "object" || value === null || Array.isArray(value))
|
|
23
25
|
return undefined;
|
|
@@ -28,7 +30,8 @@ function holdOf(value, now) {
|
|
|
28
30
|
return undefined;
|
|
29
31
|
if (typeof tool !== "string" || !TOOLS.has(tool) || typeof kind !== "string" || !KINDS.has(kind))
|
|
30
32
|
return undefined;
|
|
31
|
-
const
|
|
33
|
+
const named = until === null || until === Number.POSITIVE_INFINITY ? now + ENDLESS_HOLD_MS : typeof until === "number" && Number.isFinite(until) ? until : Number.NaN;
|
|
34
|
+
const end = Math.min(named, now + MAX_HOLD_MS);
|
|
32
35
|
return end > now ? { provider, tool: tool, kind: kind, until: end } : undefined;
|
|
33
36
|
}
|
|
34
37
|
/** Keeps `value` (holdOf) as the host's hold on its provider's tool, unless one held already ends no earlier: the hold
|
package/dist/web-run.js
CHANGED
|
@@ -85,7 +85,8 @@ export function jevWebOf(env) {
|
|
|
85
85
|
const key = planeOf(env).jev === "off" || webJevOff(env) ? undefined : handedKeyOf(env, JEV_KEY_ENV);
|
|
86
86
|
if (key === undefined)
|
|
87
87
|
return jevWebDecider(null);
|
|
88
|
-
|
|
88
|
+
// Each request carries the key, so a redirect is an error and is never followed. The faux Jev gets the same init.
|
|
89
|
+
return jevWebDecider({ key, jevProvider, price: JEV_PUBLISHED_PRICING, fetch: async (input, init) => ((await fauxFetch(env, FAUX_JEV_ENV)) ?? fetch)(input, { ...init, redirect: "error" }) });
|
|
89
90
|
}
|
|
90
91
|
/** One Web for each environment a run's calls are given (main's run process hands process.env; the runner hands each
|
|
91
92
|
* claim its own), so one run's key, client, pages and breakers never serve another. */
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
// - /mnt/archil/work: the workspace's folder, where the program runs;
|
|
8
8
|
// - /mnt/archil/out: its spill folder, BESIDE it and never inside it (archil.ts spillFolderOf), which holds this call's
|
|
9
9
|
// stdin and output files. The workspace's file calls are rooted at the folder, so they never meet them.
|
|
10
|
-
// The rest of the owner's disk (other runs
|
|
10
|
+
// The rest of the owner's disk (other runs) is not in the container at all. Archil answers once
|
|
11
11
|
// the line ended, stdout and stderr as text, and cuts that answer somewhere below 14 MB (measured live), so the
|
|
12
12
|
// program's output never rides in it: the line spills it to files that are read back through the file API.
|
|
13
13
|
// The Workspace port wants argv, the whole environment, binary stdin and stdout, a deadline that kills everything the
|
|
@@ -8,7 +8,7 @@ export declare const APPEND_MAX: number;
|
|
|
8
8
|
export type ArchilWorkspaceOptions = {
|
|
9
9
|
/** How long a call waits for another client's hold on the folder (default 60 s). */
|
|
10
10
|
readonly queueMs?: number;
|
|
11
|
-
/** The image every exec runs in, the same for every workspace serve makes (a run's
|
|
11
|
+
/** The image every exec runs in, the same for every workspace serve makes (a run's), pinned by
|
|
12
12
|
* digest (an image given without one is refused): a public image `<name>@sha256:…`, or one built through Archil's
|
|
13
13
|
* images API with its digest. With none, Archil's default exec image, whose git (2.34.1, measured) is older than a
|
|
14
14
|
* bash policy's floor; serve's claim always names one (archil-settings.ts DEFAULT_ARCHIL_EXEC_IMAGE). */
|
package/dist/workspace/archil.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// ArchilWorkspace: a Workspace on a folder of the owner's Archil disk, through the disk's file API and its serverless
|
|
2
2
|
// exec (archil-disk.ts, archil-exec.ts). Nothing is mounted on the server or a runner, and no program runs here.
|
|
3
3
|
//
|
|
4
|
-
// Keys. The workspace's root is a folder of the disk (paths.ts runKey
|
|
4
|
+
// Keys. The workspace's root is a folder of the disk (paths.ts runKey); every key, prefix, directory
|
|
5
5
|
// and exec mount it sends is the root or under it, or its exec spill folder beside it (spillFolderOf: a run's
|
|
6
6
|
// "exec-out"), built from paths paths.ts has checked. An exec mounts those two folders alone (each a mount's
|
|
7
7
|
// subdirectory): the rest of the owner's disk is not in its container. The spill folder holds an exec's stdin and its
|
|
@@ -31,7 +31,7 @@ import { SERVER_NOTE_LABEL } from "@parcha/agentrun-kernel/kernel/cap";
|
|
|
31
31
|
import { computerForClaim } from "./computer-for-claim.js";
|
|
32
32
|
import { computerHeldWords, computerLapsedWords, computerLostWords, KEEP_WORDS } from "./computer-kept.js";
|
|
33
33
|
import { storeLedger } from "./computer-ledger.js";
|
|
34
|
-
import { computerProviderFactories, computerProviderMakers } from "./computer-providers.js";
|
|
34
|
+
import { computerProviderFactories, computerProviderMakers, providerSecretsOf } from "./computer-providers.js";
|
|
35
35
|
import { aLabel, needsNetwork, noNetworkRefusal, vendorNetworkOnly } from "./resolve-computer.js";
|
|
36
36
|
/** How long a run's computer lives whatever happens to the server: a bound on a leaked one, never its clean end (the old
|
|
37
37
|
* box's lifetime). The clean end is the run's release. */
|
|
@@ -316,12 +316,14 @@ export function computerDepsFrom(options) {
|
|
|
316
316
|
return { ...(volume ?? {}), ...(addresses.length > 0 ? { egress: { hostAddresses: addresses } } : {}) };
|
|
317
317
|
};
|
|
318
318
|
/** The options a provider takes beside its keys, by what its descriptor declares, never by its id: for a local one,
|
|
319
|
-
* its image source and its host options; for a remote one, the server's dial
|
|
320
|
-
*
|
|
319
|
+
* its image source and its host options; for a remote one, the server's dial; for one that makes secrets of its own
|
|
320
|
+
* (its `secrets`), the server's sealed store of them, with a seal key (without one, it keeps them for its process).
|
|
321
|
+
* The host environment it reads is the makers' (computerProviderMakers' `env`). */
|
|
321
322
|
const declaredOptions = async (id, boxAllow) => {
|
|
322
323
|
const entry = kinds.PROVIDERS.find((one) => one.id === id);
|
|
323
324
|
return {
|
|
324
325
|
...(entry?.local ? { image: preparedImage, ...(await localHostOptions(boxAllow)) } : options.dial ? { dial: options.dial } : {}),
|
|
326
|
+
...(entry?.secrets && sealKey ? { [entry.secrets.option]: providerSecretsOf(store, sealKey, id) } : {}),
|
|
325
327
|
};
|
|
326
328
|
};
|
|
327
329
|
const load = options.load ?? providerFor;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { type ComputerProvider, type ProviderEntry } from "@parcha/agentrun-computer";
|
|
1
|
+
import { type ComputerProvider, type ProviderEntry, type ProviderSecrets } from "@parcha/agentrun-computer";
|
|
2
2
|
import type { ProviderFactories } from "../computer-keys.js";
|
|
3
|
+
import type { SealedKeys } from "../store/index.js";
|
|
3
4
|
import type { ProviderMakers } from "./computer-for-claim.js";
|
|
4
5
|
/** How a provider is built from its id and options: the computer package's providerFor, or a test's stand-in. `claim`:
|
|
5
6
|
* what the claim that makes it lets its run's computer reach (the launch's box_allow), absent outside a claim; never a
|
|
@@ -10,6 +11,14 @@ export type ProviderLoad = (id: string, options: Record<string, unknown>, claim?
|
|
|
10
11
|
/** Settings → Computers' factories (createComputerRoutes' `factories`, its account test) from the same makers, so serve
|
|
11
12
|
* builds a provider in one place: each made with its options and `ledgerOf` its id's ledger. */
|
|
12
13
|
export declare function computerProviderFactories(makers: ProviderMakers, ledgerOf: (id: string) => unknown): ProviderFactories;
|
|
14
|
+
type SecretsStore = {
|
|
15
|
+
readonly sealedKeys: Pick<SealedKeys, "get" | "putIfAbsent" | "replaceIf">;
|
|
16
|
+
};
|
|
17
|
+
/** The server's store of the secrets provider `id` makes for itself (its descriptor's `secrets`: Agent37's SSH key),
|
|
18
|
+
* each sealed under `sealKey` in store.sealedKeys at its own row, computer.<id>.<name>, so it outlives a restart of the
|
|
19
|
+
* same store and is in no row in the clear. A value that does not open under this seal key reads as none; putIfAbsent
|
|
20
|
+
* keeps one writer's value of those racing (keepSealedKey). The same object for the same store, seal key and id. */
|
|
21
|
+
export declare function providerSecretsOf(store: SecretsStore, sealKey: Buffer, id: string): ProviderSecrets;
|
|
13
22
|
/** `env`'s values of `names` (a descriptor's hostEnv), and no other variable of it. */
|
|
14
23
|
export declare function hostEnvOf(env: NodeJS.ProcessEnv, names: readonly string[]): Record<string, string>;
|
|
15
24
|
/** Every provider in `entries` (the computer package's PROVIDERS, each from its descriptor), made through `load`
|
|
@@ -21,3 +30,4 @@ export declare function computerProviderMakers({ load, entries, env }?: {
|
|
|
21
30
|
readonly entries?: readonly Pick<ProviderEntry, "id" | "ledger" | "hostEnv">[];
|
|
22
31
|
readonly env?: NodeJS.ProcessEnv;
|
|
23
32
|
}): ProviderMakers;
|
|
33
|
+
export {};
|
|
@@ -1,15 +1,42 @@
|
|
|
1
1
|
// The provider makers computerForClaim is handed at the claim (its `providers`): each provider the computer package
|
|
2
2
|
// declares, built by its providerFor from the options its saved keys fill (computer-keys.ts providerOptions, by its
|
|
3
3
|
// descriptor's key names), and nothing else. A provider whose descriptor declares a ledger (its sessions carry no labels
|
|
4
|
-
// of their own) is given the store's computer ledger, as the option its descriptor names
|
|
5
|
-
//
|
|
4
|
+
// of their own) is given the store's computer ledger, as the option its descriptor names; one that declares secrets
|
|
5
|
+
// (a key it makes for itself) is given the server's sealed store of them (providerSecretsOf, by computerDepsFrom). No
|
|
6
|
+
// key reaches a provider any other way, and nothing here reads the environment or names a vendor: a provider whose descriptor names the host
|
|
6
7
|
// variables it reads (hostEnv) is given the caller's values of those names alone.
|
|
7
8
|
import { PROVIDERS, providerFor } from "@parcha/agentrun-computer";
|
|
9
|
+
import { getSealedKey, keepSealedKey } from "../server-keys.js";
|
|
8
10
|
/** Settings → Computers' factories (createComputerRoutes' `factories`, its account test) from the same makers, so serve
|
|
9
11
|
* builds a provider in one place: each made with its options and `ledgerOf` its id's ledger. */
|
|
10
12
|
export function computerProviderFactories(makers, ledgerOf) {
|
|
11
13
|
return Object.fromEntries(Object.entries(makers).map(([id, make]) => [id, (options) => make(options, { ledger: ledgerOf(id) })]));
|
|
12
14
|
}
|
|
15
|
+
/** Each store's ProviderSecrets, by seal key and provider id: one object for them all in this process, so a provider
|
|
16
|
+
* sharing its first use's work by its store (Agent37's key, made once) shares it with every other on the same one. */
|
|
17
|
+
const secretsByStore = new WeakMap();
|
|
18
|
+
/** The server's store of the secrets provider `id` makes for itself (its descriptor's `secrets`: Agent37's SSH key),
|
|
19
|
+
* each sealed under `sealKey` in store.sealedKeys at its own row, computer.<id>.<name>, so it outlives a restart of the
|
|
20
|
+
* same store and is in no row in the clear. A value that does not open under this seal key reads as none; putIfAbsent
|
|
21
|
+
* keeps one writer's value of those racing (keepSealedKey). The same object for the same store, seal key and id. */
|
|
22
|
+
export function providerSecretsOf(store, sealKey, id) {
|
|
23
|
+
let bySeal = secretsByStore.get(store);
|
|
24
|
+
if (bySeal === undefined)
|
|
25
|
+
secretsByStore.set(store, (bySeal = new WeakMap()));
|
|
26
|
+
let byId = bySeal.get(sealKey);
|
|
27
|
+
if (byId === undefined)
|
|
28
|
+
bySeal.set(sealKey, (byId = new Map()));
|
|
29
|
+
const known = byId.get(id);
|
|
30
|
+
if (known !== undefined)
|
|
31
|
+
return known;
|
|
32
|
+
const row = (name) => `computer.${id}.${name}`;
|
|
33
|
+
const made = {
|
|
34
|
+
get: (name) => getSealedKey(store, sealKey, row(name)),
|
|
35
|
+
putIfAbsent: (name, value) => keepSealedKey(store, sealKey, row(name), value),
|
|
36
|
+
};
|
|
37
|
+
byId.set(id, made);
|
|
38
|
+
return made;
|
|
39
|
+
}
|
|
13
40
|
/** `env`'s values of `names` (a descriptor's hostEnv), and no other variable of it. */
|
|
14
41
|
export function hostEnvOf(env, names) {
|
|
15
42
|
return Object.fromEntries(names.flatMap((name) => (env[name] === undefined ? [] : [[name, String(env[name])]])));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export * from "./workspace.js";
|
|
2
2
|
export { type AttachableComputer, attachedWorkspace, checkReadBack, COMPUTER_CHUNK, type MountCheck, NO_COMPUTER, noProcesses, type Processes, } from "./attach.js";
|
|
3
|
-
export { agentDirName, agentFolder, agentHomeFolder,
|
|
3
|
+
export { agentDirName, agentFolder, agentHomeFolder, COMPUTER_ROOT, DISK_DIR, homeKey, portPath, relativePath, relativeSegments, runFolder, runKey, scratchFolder, } from "./paths.js";
|
|
4
4
|
export type { Place } from "./place.js";
|
|
5
5
|
export { localWorkspace, workspaceAt } from "./local.js";
|
|
6
6
|
export { archilWorkspace, type ArchilWorkspaceOptions } from "./archil.js";
|
|
@@ -11,7 +11,6 @@ export { ARCHIL_API_KEY_ENV, archilApiKey, type ArchilKeyOptions } from "./archi
|
|
|
11
11
|
export { openRunWorkspace, type RunWorkspace, type RunWorkspaceOptions } from "./run-workspace.js";
|
|
12
12
|
export { readOnlyWorkspace, SERVER_READS_ONLY, serverRunWorkspace, type ServerRunWorkspaceOptions } from "./server-run-workspace.js";
|
|
13
13
|
export { type LedgerEntry, type ProviderLedger, storeLedger } from "./computer-ledger.js";
|
|
14
|
-
export { type LearningPlace, type LearningWorkspace, learningWorkspace, type LearningWorkspaceOptions } from "./learning-workspace.js";
|
|
15
14
|
export { ARCHIL_MAX_EXEC_S, handsOf, MAX_EXEC_S, processesOf, shellEnv } from "./hands.js";
|
|
16
15
|
export { type AgentComputer, type RunComputer, type RunHold, runTools, type RunTools, type ScriptComputer, withKindTools } from "./run-tools.js";
|
|
17
16
|
export { NO_PROGRAMS_WORDS, portOf } from "./computer-ports.js";
|
package/dist/workspace/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// tools run (place.ts), the local backend and the Archil one.
|
|
3
3
|
export * from "./workspace.js";
|
|
4
4
|
export { attachedWorkspace, checkReadBack, COMPUTER_CHUNK, NO_COMPUTER, noProcesses, } from "./attach.js";
|
|
5
|
-
export { agentDirName, agentFolder, agentHomeFolder,
|
|
5
|
+
export { agentDirName, agentFolder, agentHomeFolder, COMPUTER_ROOT, DISK_DIR, homeKey, portPath, relativePath, relativeSegments, runFolder, runKey, scratchFolder, } from "./paths.js";
|
|
6
6
|
export { localWorkspace, workspaceAt } from "./local.js";
|
|
7
7
|
export { archilWorkspace } from "./archil.js";
|
|
8
8
|
export { archilDisk } from "./archil-disk.js";
|
|
@@ -12,7 +12,6 @@ export { ARCHIL_API_KEY_ENV, archilApiKey } from "./archil-key.js";
|
|
|
12
12
|
export { openRunWorkspace } from "./run-workspace.js";
|
|
13
13
|
export { readOnlyWorkspace, SERVER_READS_ONLY, serverRunWorkspace } from "./server-run-workspace.js";
|
|
14
14
|
export { storeLedger } from "./computer-ledger.js";
|
|
15
|
-
export { learningWorkspace } from "./learning-workspace.js";
|
|
16
15
|
export { ARCHIL_MAX_EXEC_S, handsOf, MAX_EXEC_S, processesOf, shellEnv } from "./hands.js";
|
|
17
16
|
export { runTools, withKindTools } from "./run-tools.js";
|
|
18
17
|
export { NO_PROGRAMS_WORDS, portOf } from "./computer-ports.js";
|
|
@@ -6,16 +6,12 @@ export declare const agentDirName: (agentId: string) => string;
|
|
|
6
6
|
export declare const agentFolder: (dataDir: string, agentId: string) => string;
|
|
7
7
|
/** Run `runId`'s folder as a key from a disk's root: `agents/<agent>/runs/<run>/work` (an Archil workspace's root). */
|
|
8
8
|
export declare const runKey: (agentId: string, runId: string) => string;
|
|
9
|
-
/** Agent `agentId`'s learning folder as a key from a disk's root: `agents/<agent>/learning`. */
|
|
10
|
-
export declare const learningKey: (agentId: string) => string;
|
|
11
9
|
/** Run `runId`'s folder, the root of its Workspace: `<data>/disk/agents/<agent>/runs/<run>/work`. */
|
|
12
10
|
export declare const runFolder: (dataDir: string, agentId: string, runId: string) => string;
|
|
13
11
|
/** The recordings folder's name: beside a run's folder on this machine, and the run files route's path to it. */
|
|
14
12
|
export declare const RECORDINGS = "recordings";
|
|
15
13
|
/** Run `runId`'s recordings on this machine, beside its folder: `<data>/disk/agents/<agent>/runs/<run>/recordings`. */
|
|
16
14
|
export declare const recordingsFolder: (dataDir: string, agentId: string, runId: string) => string;
|
|
17
|
-
/** Agent `agentId`'s learning folder, the root of its learning Workspace: `<data>/disk/agents/<agent>/learning`. */
|
|
18
|
-
export declare const agentLearningFolder: (dataDir: string, agentId: string) => string;
|
|
19
15
|
/** Agent `agentId`'s home as a key from a disk's root: `agents/<agent>/home`. */
|
|
20
16
|
export declare const homeKey: (agentId: string) => string;
|
|
21
17
|
/** Agent `agentId`'s home, the root of its home Workspace: `<data>/disk/agents/<agent>/home`. */
|
package/dist/workspace/paths.js
CHANGED
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
//
|
|
3
3
|
// Layout, under a server's data directory, or from the root of an Archil disk (the same keys, without <data>/disk):
|
|
4
4
|
// <data>/disk/agents/<agent>/runs/<run>/work a run's folder (runFolder; runKey on a disk): its Workspace's root
|
|
5
|
-
// <data>/disk/agents/<agent>/learning an agent's learning folder (agentLearningFolder; learningKey): its git
|
|
6
|
-
// folder
|
|
7
5
|
// <data>/disk/agents/<agent>/home an agent's home (agentHomeFolder; homeKey): the files its owner keeps
|
|
8
6
|
// for it
|
|
9
7
|
// and on this machine alone:
|
|
@@ -41,16 +39,12 @@ export const agentDirName = (agentId) => `${checkId(agentId, "agent").toLowerCas
|
|
|
41
39
|
export const agentFolder = (dataDir, agentId) => join(dataDir, DISK_DIR, "agents", agentDirName(agentId));
|
|
42
40
|
/** Run `runId`'s folder as a key from a disk's root: `agents/<agent>/runs/<run>/work` (an Archil workspace's root). */
|
|
43
41
|
export const runKey = (agentId, runId) => `agents/${agentDirName(agentId)}/runs/${checkId(runId, "run")}/work`;
|
|
44
|
-
/** Agent `agentId`'s learning folder as a key from a disk's root: `agents/<agent>/learning`. */
|
|
45
|
-
export const learningKey = (agentId) => `agents/${agentDirName(agentId)}/learning`;
|
|
46
42
|
/** Run `runId`'s folder, the root of its Workspace: `<data>/disk/agents/<agent>/runs/<run>/work`. */
|
|
47
43
|
export const runFolder = (dataDir, agentId, runId) => join(dataDir, DISK_DIR, runKey(agentId, runId));
|
|
48
44
|
/** The recordings folder's name: beside a run's folder on this machine, and the run files route's path to it. */
|
|
49
45
|
export const RECORDINGS = "recordings";
|
|
50
46
|
/** Run `runId`'s recordings on this machine, beside its folder: `<data>/disk/agents/<agent>/runs/<run>/recordings`. */
|
|
51
47
|
export const recordingsFolder = (dataDir, agentId, runId) => join(dirname(runFolder(dataDir, agentId, runId)), RECORDINGS);
|
|
52
|
-
/** Agent `agentId`'s learning folder, the root of its learning Workspace: `<data>/disk/agents/<agent>/learning`. */
|
|
53
|
-
export const agentLearningFolder = (dataDir, agentId) => join(dataDir, DISK_DIR, learningKey(agentId));
|
|
54
48
|
/** Agent `agentId`'s home as a key from a disk's root: `agents/<agent>/home`. */
|
|
55
49
|
export const homeKey = (agentId) => `agents/${agentDirName(agentId)}/home`;
|
|
56
50
|
/** Agent `agentId`'s home, the root of its home Workspace: `<data>/disk/agents/<agent>/home`. */
|
|
@@ -130,7 +130,7 @@ export declare const GREP_FILE_MAX: number;
|
|
|
130
130
|
export declare const GREP_LINE_MAX = 500;
|
|
131
131
|
/** exec's default cap on stdout, and on stderr, each. */
|
|
132
132
|
export declare const EXEC_OUTPUT_MAX: number;
|
|
133
|
-
/** A run's folder
|
|
133
|
+
/** A run's folder: every path is relative to its root. */
|
|
134
134
|
export interface Workspace {
|
|
135
135
|
/** The bytes of file `path`, or `length` of them from `offset` (a range past the end gives what is there). */
|
|
136
136
|
read(path: string, range?: {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// The Workspace: the one way serve touches a run's files
|
|
1
|
+
// The Workspace: the one way serve touches a run's files. One Workspace is scoped to ONE
|
|
2
2
|
// root folder and takes paths relative to it only (paths.ts). Two backends answer it: Local (a folder on this machine,
|
|
3
3
|
// local.ts) and, next, Archil (the owner's disk through its file API and serverless exec). Nothing on main uses it yet:
|
|
4
4
|
// the writers move onto it in one cutover.
|
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.60",
|
|
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",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"build": "rm -rf dist && tsc -p tsconfig.json && node scripts/copy-page.mjs",
|
|
56
56
|
"prepack": "npm run build",
|
|
57
57
|
"typecheck": "tsc -p tsconfig.test.json",
|
|
58
|
-
"test": "node --test --test-concurrency=8 'test/*.test.mjs'",
|
|
58
|
+
"test": "node --test --test-concurrency=8 --import=./test/fixtures/sqlite-guard-register.mjs 'test/*.test.mjs'",
|
|
59
59
|
"test:pg:up": "docker compose -f test/pg/compose.yaml up -d --wait",
|
|
60
60
|
"test:pg:down": "docker compose -f test/pg/compose.yaml down",
|
|
61
61
|
"test:pg": "node scripts/test-pg.mjs"
|
|
@@ -70,17 +70,17 @@
|
|
|
70
70
|
"@opentelemetry/exporter-trace-otlp-http": "0.301.2",
|
|
71
71
|
"@opentelemetry/resources": "3.1.1",
|
|
72
72
|
"@opentelemetry/sdk-trace": "3.1.1",
|
|
73
|
-
"@parcha/agentrun-computer": "0.1.0-beta.
|
|
74
|
-
"@parcha/agentrun-decisions": "0.1.0-beta.
|
|
75
|
-
"@parcha/agentrun-dsl": "0.1.0-beta.
|
|
76
|
-
"@parcha/agentrun-harness-acp": "0.1.0-beta.
|
|
77
|
-
"@parcha/agentrun-harness-claude": "0.1.0-beta.
|
|
78
|
-
"@parcha/agentrun-harness-codex": "0.1.0-beta.
|
|
79
|
-
"@parcha/agentrun-import": "0.1.0-beta.
|
|
80
|
-
"@parcha/agentrun-jev": "0.1.0-beta.
|
|
81
|
-
"@parcha/agentrun-kernel": "0.1.0-beta.
|
|
82
|
-
"@parcha/agentrun-web": "0.1.0-beta.
|
|
83
|
-
"@parcha/pi-browser": "0.1.0-beta.
|
|
73
|
+
"@parcha/agentrun-computer": "0.1.0-beta.60",
|
|
74
|
+
"@parcha/agentrun-decisions": "0.1.0-beta.60",
|
|
75
|
+
"@parcha/agentrun-dsl": "0.1.0-beta.60",
|
|
76
|
+
"@parcha/agentrun-harness-acp": "0.1.0-beta.60",
|
|
77
|
+
"@parcha/agentrun-harness-claude": "0.1.0-beta.60",
|
|
78
|
+
"@parcha/agentrun-harness-codex": "0.1.0-beta.60",
|
|
79
|
+
"@parcha/agentrun-import": "0.1.0-beta.60",
|
|
80
|
+
"@parcha/agentrun-jev": "0.1.0-beta.60",
|
|
81
|
+
"@parcha/agentrun-kernel": "0.1.0-beta.60",
|
|
82
|
+
"@parcha/agentrun-web": "0.1.0-beta.60",
|
|
83
|
+
"@parcha/pi-browser": "0.1.0-beta.60",
|
|
84
84
|
"@secretlint/core": "14.1.0",
|
|
85
85
|
"@secretlint/profiler": "14.1.0",
|
|
86
86
|
"croner": "11.0.0",
|
package/templates/TOOLS.md
CHANGED
|
@@ -126,6 +126,52 @@ both every call is refused. A keys pin bounds one argument: pin `null` any other
|
|
|
126
126
|
same fields (HubSpot's `custom_properties` beside `properties`). Fence every other argument that reaches the same place
|
|
127
127
|
the same way: Gmail's `user_id` also picks the sender, so pin it to `[null, "me"]` beside `from_email: null`.
|
|
128
128
|
|
|
129
|
+
## File
|
|
130
|
+
|
|
131
|
+
Some answers hold text the model shouldn't read: a payments list carries each customer's description, and a page of
|
|
132
|
+
it can carry an instruction someone typed there. `file` sends a tool's answers to the run's files instead of back as the
|
|
133
|
+
tool's result. Your skill's code reads the files; the tool's result is a summary.
|
|
134
|
+
|
|
135
|
+
`file: {<tool>: {folder: <folder>, show: [<path>, ...]}}`, beside `pin`, for tools of the same entry:
|
|
136
|
+
|
|
137
|
+
- `folder`: where each answer goes in the run's files, 1 to 3 segments (`stripe`, `data/pages`). A segment never
|
|
138
|
+
starts with a dot, so `..` and hidden folders are refused.
|
|
139
|
+
- `show`: at most 8 paths into the answer's JSON, each 1 to 6 segments joined by `.`: a key, an index, or `-1` for
|
|
140
|
+
the last item (`data.data.-1.id`).
|
|
141
|
+
|
|
142
|
+
Each answer is written whole, as the server sent it (credentials scrubbed), at `<folder>/<tool>-<time>-<id>.json`
|
|
143
|
+
before the model gets its turn back. The names sort by time. The answer goes through neither the clip nor
|
|
144
|
+
`evidence/mcp/`. The tool's result is three lines: the size and path, the value at each `show` path, and the answer's
|
|
145
|
+
shape (its keys and types to depth 2, each array's length, never a value). The shape names a key only when it reads as
|
|
146
|
+
a short name (a letter or `_` first, at most 32 letters, digits or `_`) and counts the rest, so keys that are data, such
|
|
147
|
+
as emails, aren't shown:
|
|
148
|
+
|
|
149
|
+
```text
|
|
150
|
+
STRIPE_LIST_BALANCE_TRANSACTIONS answered 61,204 bytes, filed whole at stripe/STRIPE_LIST_BALANCE_TRANSACTIONS-2026-11-30T07-02-11-512Z-1a2b3c4d.json for the skill's code; its values are not shown here (the agent's setting files this tool's answers); only these are:
|
|
151
|
+
{"successful": true, "error": null, "data.has_more": true, "data.data.-1.id": "txn_1Q...", "data.data.-1.created": 1763337600}
|
|
152
|
+
Shape: {"data": {"object": string, "data": [100 objects], "has_more": boolean, "url": string}, "successful": boolean, "error": null}
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
A `show` path that reaches no scalar shows `null`, and a string is cut at 200 characters. Show only what the model
|
|
156
|
+
needs to go on: the next page's cursor, a done flag, a status. A path that names a free-text field (a description, a
|
|
157
|
+
name, a message body) shows that text to the model and defeats the option. An answer that is an error is filed the
|
|
158
|
+
same way, and the tool's result is its summary marked as an error, so the model can react through a shown field such as
|
|
159
|
+
`error.code`. If the file can't be written, the model gets an error and none of the answer, never the answer as a
|
|
160
|
+
fallback. An answer that is not JSON is filed the same way, every path showing `null`.
|
|
161
|
+
|
|
162
|
+
The setting keeps the answer out of the tool's result, not out of the model's reach. The model's own file tools
|
|
163
|
+
(`read`, `grep`, `ls`, and `bash` on a computer) can still open the folder, and the summary names the file. If the model
|
|
164
|
+
must not read the answer, don't grant those tools, or run your skill's code where the model can't read its output.
|
|
165
|
+
|
|
166
|
+
The setting is per tool. File every tool that returns the same data: a retrieve tool beside a filed list tool returns
|
|
167
|
+
the same objects, unfiled.
|
|
168
|
+
|
|
169
|
+
Apply writes the setting into the agent's own tool settings (`definition.tool_settings["mcp:<server>/<tool>"].file`),
|
|
170
|
+
ticked or not, as it writes a pin. It's the owner's setting: they can change it or remove it. With it removed, the
|
|
171
|
+
tool's answers go to the model whole again, as they do for any tool without it, so a skill that reads the filed pages
|
|
172
|
+
should say what it does when there are none. A stored setting that no longer reads refuses every call of its tool, with
|
|
173
|
+
an error naming the setting and nothing sent, until the owner sets it again or removes it.
|
|
174
|
+
|
|
129
175
|
## Ask
|
|
130
176
|
|
|
131
177
|
- Ticking grants a tool; it doesn't allow it. Apply writes no permission, so a ticked tool follows the server's own
|