@foldrun/core 24.2.2 → 24.2.3
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/dist/src/account.js +2 -2
- package/dist/src/agent-import.js +2 -2
- package/dist/src/budget.js +1 -1
- package/dist/src/copy-back.js +2 -2
- package/dist/src/data-import.js +9 -9
- package/dist/src/deploy.js +2 -2
- package/dist/src/failure.js +1 -1
- package/dist/src/flow-lint.js +8 -8
- package/dist/src/frontmatter-fields.js +8 -8
- package/dist/src/mail.js +1 -1
- package/dist/src/manifest.js +1 -1
- package/dist/src/notify.js +2 -2
- package/dist/src/oauth-capabilities.js +1 -1
- package/dist/src/openapi.js +3 -3
- package/dist/src/package.js +2 -2
- package/dist/src/providers.js +2 -2
- package/dist/src/publish.js +2 -2
- package/dist/src/run-container.js +3 -3
- package/dist/src/scan.js +7 -7
- package/dist/src/secrets.js +7 -7
- package/dist/src/starter.js +18 -18
- package/dist/src/storage.js +6 -6
- package/dist/src/store.js +16 -16
- package/dist/src/tool-test.js +1 -1
- package/dist/src/webhook.js +1 -1
- package/dist/src/workspace-revisions.js +2 -2
- package/package.json +1 -1
- package/src/account.ts +2 -2
- package/src/agent-import.ts +2 -2
- package/src/budget.ts +1 -1
- package/src/copy-back.ts +2 -2
- package/src/data-import.ts +9 -9
- package/src/deploy.ts +2 -2
- package/src/failure.ts +1 -1
- package/src/flow-lint.ts +8 -8
- package/src/frontmatter-fields.ts +8 -8
- package/src/mail.ts +1 -1
- package/src/manifest.ts +1 -1
- package/src/notify.ts +2 -2
- package/src/oauth-capabilities.ts +1 -1
- package/src/openapi.ts +3 -3
- package/src/package.ts +2 -2
- package/src/providers.ts +2 -2
- package/src/publish.ts +2 -2
- package/src/run-container.ts +3 -3
- package/src/scan.ts +7 -7
- package/src/secrets.ts +7 -7
- package/src/starter.ts +19 -19
- package/src/storage.ts +6 -6
- package/src/store.ts +16 -16
- package/src/tool-test.ts +1 -1
- package/src/webhook.ts +1 -1
- package/src/workspace-revisions.ts +2 -2
package/dist/src/account.js
CHANGED
|
@@ -81,7 +81,7 @@ export function readAccountTree(accountRoot, only) {
|
|
|
81
81
|
}
|
|
82
82
|
const names = listWorkspaceDirs(root).filter((n) => (only ? n === only : true));
|
|
83
83
|
if (only && names.length === 0) {
|
|
84
|
-
throw new Error(`no
|
|
84
|
+
throw new Error(`no project "${only}" in ${root} — have: ${listWorkspaceDirs(root).join(", ") || "none"}`);
|
|
85
85
|
}
|
|
86
86
|
const wsRoot = path.join(root, "workspaces");
|
|
87
87
|
const legacy = path.join(root, "projects");
|
|
@@ -111,7 +111,7 @@ export function accountTreeFrom(from, only) {
|
|
|
111
111
|
const dir = layout.workspaceDir;
|
|
112
112
|
const name = path.basename(dir);
|
|
113
113
|
if (only && only !== name)
|
|
114
|
-
throw new Error(`${dir} is a single
|
|
114
|
+
throw new Error(`${dir} is a single project called "${name}", not "${only}"`);
|
|
115
115
|
return {
|
|
116
116
|
layout,
|
|
117
117
|
tree: {
|
package/dist/src/agent-import.js
CHANGED
|
@@ -45,9 +45,9 @@ export function importAgent(tenant, from, agent, to, opts = {}) {
|
|
|
45
45
|
assertSafeName(name, "agent");
|
|
46
46
|
const known = new Set(listWorkspaces(tenant).map((w) => w.name));
|
|
47
47
|
if (!known.has(from))
|
|
48
|
-
throw new AgentImportError(`no
|
|
48
|
+
throw new AgentImportError(`no project called "${from}" in this account`, 404);
|
|
49
49
|
if (!known.has(to))
|
|
50
|
-
throw new AgentImportError(`no
|
|
50
|
+
throw new AgentImportError(`no project called "${to}" in this account`, 404);
|
|
51
51
|
if (from === to && name === agent) {
|
|
52
52
|
throw new AgentImportError(`${agent} is already in ${to} — give the copy another name with "as"`, 409);
|
|
53
53
|
}
|
package/dist/src/budget.js
CHANGED
|
@@ -89,7 +89,7 @@ export function budgetProblem(raw, allowed) {
|
|
|
89
89
|
if (!allowed.includes(period)) {
|
|
90
90
|
return period === "run"
|
|
91
91
|
? `budget: is per run here already — write the number alone`
|
|
92
|
-
: `budget: "${period}" does not apply here — this cap is per run; a cap over time belongs in the
|
|
92
|
+
: `budget: "${period}" does not apply here — this cap is per run; a cap over time belongs in the project's or the account's AGENTS.md`;
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
95
|
return null;
|
package/dist/src/copy-back.js
CHANGED
|
@@ -69,6 +69,6 @@ export function keptLine(kept) {
|
|
|
69
69
|
export function refusedLine(refused) {
|
|
70
70
|
const shown = refused.slice(0, 20).map((r) => `${r.path} (${r.kind})`).join(", ");
|
|
71
71
|
const more = refused.length > 20 ? ` and ${refused.length - 20} more` : "";
|
|
72
|
-
return (`refused path: ${shown}${more} — a step cannot change the
|
|
73
|
-
`the
|
|
72
|
+
return (`refused path: ${shown}${more} — a step cannot change the project's configuration or code; ` +
|
|
73
|
+
`the project keeps its own copy. Propose the change instead (Proposed fixes), and a person applies it.`);
|
|
74
74
|
}
|
package/dist/src/data-import.js
CHANGED
|
@@ -137,9 +137,9 @@ const PLATFORM_MARKERS = {
|
|
|
137
137
|
"trigger-log.jsonl.tmp": "trigger log temp file (not read here)",
|
|
138
138
|
"hooks.json": "webhook tokens (platform file; not mapped)",
|
|
139
139
|
"hook-deliveries.jsonl": "hook delivery log (not mapped)",
|
|
140
|
-
".repo.json": "platform file; not
|
|
140
|
+
".repo.json": "platform file; not project content",
|
|
141
141
|
once: "operation markers (the unique keys decide now; not imported)",
|
|
142
|
-
".foldrun": "platform folder; not
|
|
142
|
+
".foldrun": "platform folder; not project content",
|
|
143
143
|
storage: "workspace-local storage folder (the storage index moved in FOL-152; not read here)",
|
|
144
144
|
};
|
|
145
145
|
async function scanWorkspace(tenant, workspace, dir) {
|
|
@@ -183,7 +183,7 @@ async function scanWorkspace(tenant, workspace, dir) {
|
|
|
183
183
|
top = fs.readdirSync(dir, { withFileTypes: true });
|
|
184
184
|
}
|
|
185
185
|
catch (err) {
|
|
186
|
-
ws.error = `
|
|
186
|
+
ws.error = `project folder unreadable (${err.code ?? "error"})`;
|
|
187
187
|
return ws;
|
|
188
188
|
}
|
|
189
189
|
for (const e of top.sort(byName)) {
|
|
@@ -228,14 +228,14 @@ async function scanWorkspace(tenant, workspace, dir) {
|
|
|
228
228
|
}
|
|
229
229
|
else {
|
|
230
230
|
const t = st.isDirectory() ? tally(abs) : { files: 1, bytes: st.size };
|
|
231
|
-
ws.unmapped.push({ path: name, reason: "not part of a
|
|
231
|
+
ws.unmapped.push({ path: name, reason: "not part of a project manifest (in neither the authored nor the state list)", ...t });
|
|
232
232
|
}
|
|
233
233
|
}
|
|
234
234
|
// Which of the found files can be a manifest path; case collisions.
|
|
235
235
|
const mapped = [];
|
|
236
236
|
for (const f of found) {
|
|
237
237
|
if (isPlatformPath(f.rel)) {
|
|
238
|
-
ws.unmapped.push({ path: f.rel, reason: "platform or engine file, not
|
|
238
|
+
ws.unmapped.push({ path: f.rel, reason: "platform or engine file, not project content", files: 1, bytes: f.st.size });
|
|
239
239
|
continue;
|
|
240
240
|
}
|
|
241
241
|
try {
|
|
@@ -489,7 +489,7 @@ export async function planImport(scan, deps) {
|
|
|
489
489
|
p.revisionsToMake = sides.size;
|
|
490
490
|
const foreign = await foreignRevisions(deps, wsRef(w));
|
|
491
491
|
if (foreign.length)
|
|
492
|
-
p.note = `${foreign.length} revision(s) by someone else (latest by ${foreign[0].by}): an import skips this
|
|
492
|
+
p.note = `${foreign.length} revision(s) by someone else (latest by ${foreign[0].by}): an import skips this project unless --force`;
|
|
493
493
|
}
|
|
494
494
|
catch (err) {
|
|
495
495
|
p.note = `could not read the destination: ${err.message}`;
|
|
@@ -506,7 +506,7 @@ export function renderPlan(scan, plan) {
|
|
|
506
506
|
let files = 0;
|
|
507
507
|
let bytes = 0;
|
|
508
508
|
for (const t of scan.tenants) {
|
|
509
|
-
L.push(`account ${t.tenant} (${t.workspaces.length}
|
|
509
|
+
L.push(`account ${t.tenant} (${t.workspaces.length} project(s))`);
|
|
510
510
|
for (const u of t.unmapped)
|
|
511
511
|
L.push(` can't map ${u.path}: ${u.reason} (${u.files ?? 0} files, ${kb(u.bytes ?? 0)})`);
|
|
512
512
|
for (const w of t.workspaces) {
|
|
@@ -523,7 +523,7 @@ export function renderPlan(scan, plan) {
|
|
|
523
523
|
L.push(` can't map ${u.path}: ${u.reason}${u.files ? ` (${u.files} files, ${kb(u.bytes ?? 0)})` : ""}`);
|
|
524
524
|
}
|
|
525
525
|
}
|
|
526
|
-
L.push("", `Total: ${files}
|
|
526
|
+
L.push("", `Total: ${files} project files, ${kb(bytes)}.`);
|
|
527
527
|
return L.join("\n") + "\n";
|
|
528
528
|
}
|
|
529
529
|
/** Compare every workspace's heads with the folder, by path, sha256 and mode —
|
|
@@ -634,7 +634,7 @@ export function renderVerify(r) {
|
|
|
634
634
|
for (const n of w.notes)
|
|
635
635
|
L.push(` note: ${n}`);
|
|
636
636
|
}
|
|
637
|
-
L.push("", `${r.workspaces.filter((w) => w.pass).length} of ${r.workspaces.length}
|
|
637
|
+
L.push("", `${r.workspaces.filter((w) => w.pass).length} of ${r.workspaces.length} project(s) passed.`);
|
|
638
638
|
return L.join("\n") + "\n";
|
|
639
639
|
}
|
|
640
640
|
/** A path with every link resolved, for a folder that may not exist yet: the
|
package/dist/src/deploy.js
CHANGED
|
@@ -113,7 +113,7 @@ export function readTree(dir, opts = {}) {
|
|
|
113
113
|
}
|
|
114
114
|
sourceBytes += bytes;
|
|
115
115
|
if (opts.maxSourceBytes !== undefined && sourceBytes > opts.maxSourceBytes) {
|
|
116
|
-
throw new TreeTooLarge(`the
|
|
116
|
+
throw new TreeTooLarge(`the project's files other than state/ and memory/ are over ${Math.round(opts.maxSourceBytes / 1048576)} MiB — not read`);
|
|
117
117
|
}
|
|
118
118
|
return true;
|
|
119
119
|
};
|
|
@@ -383,7 +383,7 @@ function structuralWarnings(files, extraOutward = []) {
|
|
|
383
383
|
const agentNames = [];
|
|
384
384
|
const out = [];
|
|
385
385
|
if (!files.some((f) => /^agents\/[^/]+\/agent\.md$/.test(f.path)) && !files.some((f) => /^\.(claude|agents)\/agents\/[^/]+\.md$/.test(f.path))) {
|
|
386
|
-
out.push({ where: "agents/", message: "no agents yet — add one (agents/<name>/agent.md), or import one from another
|
|
386
|
+
out.push({ where: "agents/", message: "no agents yet — add one (agents/<name>/agent.md), or import one from another project" });
|
|
387
387
|
}
|
|
388
388
|
// The web: warnings check prints — the old session: key, and a pinned
|
|
389
389
|
// user agent behind the runner image's Chrome, which the platform knows
|
package/dist/src/failure.js
CHANGED
|
@@ -139,7 +139,7 @@ function tooBig(reason) {
|
|
|
139
139
|
const scope = SCOPES[pool[3]];
|
|
140
140
|
const what = kind === "memory" ? "GiB of memory" : pool[2];
|
|
141
141
|
const fix = scope === "run" ? "Ask for less with size: or resources: on the agent, or raise the flow's compute:."
|
|
142
|
-
: scope === "workspace" ? "Ask for less with size: or resources: on the agent, or raise the
|
|
142
|
+
: scope === "workspace" ? "Ask for less with size: or resources: on the agent, or raise the project's compute: (its AGENTS.md)."
|
|
143
143
|
: scope === "account" ? `Ask for less with size: or resources: on the agent, raise the account's compute: (Settings → Policies → Governance), ${UPGRADE}.`
|
|
144
144
|
: "Ask for less with size: or resources: on the agent: no machine here can hold a step this big.";
|
|
145
145
|
return {
|
package/dist/src/flow-lint.js
CHANGED
|
@@ -135,7 +135,7 @@ export function lintFlow(flow, known) {
|
|
|
135
135
|
level: "error",
|
|
136
136
|
message: zoneProblem,
|
|
137
137
|
detail: "This is the zone the schedule fires in AND the calendar every step in this flow works " +
|
|
138
|
-
"to. Unreadable, the schedule falls back to UTC and each step inherits the
|
|
138
|
+
"to. Unreadable, the schedule falls back to UTC and each step inherits the project's " +
|
|
139
139
|
"zone instead of this one.",
|
|
140
140
|
});
|
|
141
141
|
}
|
|
@@ -193,7 +193,7 @@ export function lintFlow(flow, known) {
|
|
|
193
193
|
// Trigger shapes that can never fire, said at check time rather than
|
|
194
194
|
// discovered as a flow that "never runs".
|
|
195
195
|
if (flow.budgetProblem) {
|
|
196
|
-
warnings.push({ step: null, message: flow.budgetProblem, detail: "A flow's `budget:` is the most one run may spend — a number in USD, or `unlimited`. A cap over a day, week or month belongs in the
|
|
196
|
+
warnings.push({ step: null, message: flow.budgetProblem, detail: "A flow's `budget:` is the most one run may spend — a number in USD, or `unlimited`. A cap over a day, week or month belongs in the project's or the account's AGENTS.md, where it means every run put together." });
|
|
197
197
|
}
|
|
198
198
|
if (flow.trigger === "once" && !flow.at) {
|
|
199
199
|
warnings.push({ step: null, message: "trigger: once needs an `at:` instant", detail: "Write `at: 2026-09-05T09:00:00+10:00` (ISO 8601). Without a readable instant this flow never fires." });
|
|
@@ -203,7 +203,7 @@ export function lintFlow(flow, known) {
|
|
|
203
203
|
}
|
|
204
204
|
if (flow.trigger === "flow") {
|
|
205
205
|
if (!flow.after)
|
|
206
|
-
warnings.push({ step: null, message: "trigger: flow needs `after: <flow>`", detail: "Name the flow of this
|
|
206
|
+
warnings.push({ step: null, message: "trigger: flow needs `after: <flow>`", detail: "Name the flow of this project whose finishing starts this one." });
|
|
207
207
|
else if (flow.after === flow.name)
|
|
208
208
|
warnings.push({ step: null, message: "trigger: flow — a flow cannot chain on itself", detail: "That is a loop with no bound. Chain on the flow that produces what this one needs." });
|
|
209
209
|
}
|
|
@@ -309,7 +309,7 @@ export function lintFlow(flow, known) {
|
|
|
309
309
|
line: step.line,
|
|
310
310
|
level: "error",
|
|
311
311
|
kind: "outward",
|
|
312
|
-
message: `[[${step.agent}]] can act outside this
|
|
312
|
+
message: `[[${step.agent}]] can act outside this project and this step has no verify: and no gate`,
|
|
313
313
|
detail: "A step that sends, posts, buys or publishes needs one of two things: a `verify:` the " +
|
|
314
314
|
"runtime can fail the step on — a receipt file, a ledger row, the reply's own verdict " +
|
|
315
315
|
"line — or a person, with `!` or `ask:`. Without either, a step that sent nothing and a " +
|
|
@@ -326,7 +326,7 @@ export function lintFlow(flow, known) {
|
|
|
326
326
|
step: i,
|
|
327
327
|
line: step.line,
|
|
328
328
|
kind: "outward",
|
|
329
|
-
message: `[[${step.agent}]] can act outside this
|
|
329
|
+
message: `[[${step.agent}]] can act outside this project and this step has retry: ${step.retry}`,
|
|
330
330
|
detail: "A retry runs the whole step again, sends included. The runner does not retry a failure " +
|
|
331
331
|
"that came from the check after the step's tools ran, but an attempt that failed mid-way — " +
|
|
332
332
|
"a timeout, a crash, a provider error after the first send — is retried and may repeat " +
|
|
@@ -376,7 +376,7 @@ export function lintFlow(flow, known) {
|
|
|
376
376
|
step: i,
|
|
377
377
|
line: step.line,
|
|
378
378
|
level: "error",
|
|
379
|
-
message: `[[${step.agent}]] is not an agent in this
|
|
379
|
+
message: `[[${step.agent}]] is not an agent in this project`,
|
|
380
380
|
detail: "This step has nothing to run. Every run of this flow fails here. Check the spelling " +
|
|
381
381
|
"against `agents/<name>/agent.md` — the name is the folder's, not the file's heading — " +
|
|
382
382
|
"or add the agent.",
|
|
@@ -428,7 +428,7 @@ export function lintFlow(flow, known) {
|
|
|
428
428
|
warnings.push({
|
|
429
429
|
step: i,
|
|
430
430
|
line: step.line,
|
|
431
|
-
message: `delegate: "${name}" is not an agent in this
|
|
431
|
+
message: `delegate: "${name}" is not an agent in this project`,
|
|
432
432
|
detail: "The runner only accepts picks from the declared set, so this name can never be " +
|
|
433
433
|
"chosen — the step silently has one fewer colleague to call on. Fix the spelling, " +
|
|
434
434
|
"or drop the name.",
|
|
@@ -439,7 +439,7 @@ export function lintFlow(flow, known) {
|
|
|
439
439
|
warnings.push({
|
|
440
440
|
step: i,
|
|
441
441
|
line: step.line,
|
|
442
|
-
message: `on-fail: "${step.onFail}" is not an agent in this
|
|
442
|
+
message: `on-fail: "${step.onFail}" is not an agent in this project`,
|
|
443
443
|
detail: "The recovery path is the one you cannot test by running the flow successfully. As " +
|
|
444
444
|
"written, a failure here has nowhere to go and the step just fails.",
|
|
445
445
|
});
|
|
@@ -30,7 +30,7 @@ const LOCALE = { validated: true };
|
|
|
30
30
|
const AGENT = [
|
|
31
31
|
{ key: "name", type: "string", help: "kebab-case; the folder is the identity" },
|
|
32
32
|
{ key: "description", type: "string", help: "what it does and when — other agents and people read it" },
|
|
33
|
-
{ key: "owner", type: "string", help: "the person accountable for it — an email or a name; else the
|
|
33
|
+
{ key: "owner", type: "string", help: "the person accountable for it — an email or a name; else the project's, else the account's" },
|
|
34
34
|
{ key: "model", type: "string", help: "fast | default | max, an alias, or a full model id" },
|
|
35
35
|
{ key: "effort", type: "string", values: EFFORT_LEVELS, help: "how long it thinks" },
|
|
36
36
|
{ key: "max_output_tokens", type: ["number", "string"], help: "the most tokens one model reply may have, 1 to 1048576; on foldrun's models the price list's ceiling applies too" },
|
|
@@ -68,8 +68,8 @@ const AGENT = [
|
|
|
68
68
|
const AGENTS_MD = [
|
|
69
69
|
{ key: "foldrun_version", type: ["string", "number"], help: "the format version this account targets" },
|
|
70
70
|
{ key: "mdagent_version", type: ["string", "number"], legacy: true, help: "older spelling of foldrun_version" },
|
|
71
|
-
{ key: "name", type: "string", help: "the
|
|
72
|
-
{ key: "description", type: "string", help: "shown in the
|
|
71
|
+
{ key: "name", type: "string", help: "the project's name" },
|
|
72
|
+
{ key: "description", type: "string", help: "shown in the project list" },
|
|
73
73
|
{ key: "owner", type: "string", help: "the person accountable for every agent and flow here that names none" },
|
|
74
74
|
{ key: "provider", type: "object", help: "the model endpoint every agent here uses unless it names its own" },
|
|
75
75
|
{ key: "runtime", type: "object", help: "packages for agents that declare none" },
|
|
@@ -87,10 +87,10 @@ const AGENTS_MD = [
|
|
|
87
87
|
{ key: "budget", type: ["number", "string"], help: "USD per month, or N/day | N/week | N/month" },
|
|
88
88
|
{ key: "priority", type: "string", values: ["high", "normal", "low"], help: "account: where its runs stand in the queue" },
|
|
89
89
|
{ key: "concurrency", type: ["number", "string"], help: "account: runs at once" },
|
|
90
|
-
{ key: "compute", type: "object", help: "{vcpu, memory, disk} the running steps here may hold together — the account's pool, or this
|
|
90
|
+
{ key: "compute", type: "object", help: "{vcpu, memory, disk} the running steps here may hold together — the account's pool, or this project's; only narrows the level above" },
|
|
91
91
|
{ key: "alerts", type: "object", validated: true, help: "thresholds that tell notify: — failure_rate (30%), min_runs, credits_day, run_minutes, stale_days, cost_spike, runs_per_hour, new_host" },
|
|
92
92
|
{ key: "capture", type: "string", values: ["full", "metadata"], help: "what runs record of each tool call: full (its input and output, secrets masked) or metadata (name, size and time only)" },
|
|
93
|
-
{ key: "network_enforce", type: "boolean", help: "true: a site off a step's network: list is refused, not only named in the trace. The account's or the
|
|
93
|
+
{ key: "network_enforce", type: "boolean", help: "true: a site off a step's network: list is refused, not only named in the trace. The account's or the project's true is enough" },
|
|
94
94
|
{ key: "telemetry", type: "object", validated: true, help: "send each run as an OpenTelemetry trace — otlp: <https …/v1/traces>, headers: { authorization: ${SECRET} }" },
|
|
95
95
|
{ key: "deploy_block", type: "string", values: ["none", "secrets", "security"], help: "refuse a deploy on scanner findings: secrets (a key written in) or security (any security warning)" },
|
|
96
96
|
{ key: "judge", type: "object", validated: true, help: "the model every judge: here grades with — {model: fast | default | max, effort}; an eval's own model: wins" },
|
|
@@ -99,7 +99,7 @@ const AGENTS_MD = [
|
|
|
99
99
|
const FLOW = [
|
|
100
100
|
{ key: "name", type: "string", help: "the flow's name" },
|
|
101
101
|
{ key: "description", type: "string", help: "what it is for" },
|
|
102
|
-
{ key: "owner", type: "string", help: "the person accountable for it — an email or a name; else the
|
|
102
|
+
{ key: "owner", type: "string", help: "the person accountable for it — an email or a name; else the project's, else the account's" },
|
|
103
103
|
{ key: "trigger", type: "string", values: FLOW_TRIGGERS, help: "what starts it; any other value never fires" },
|
|
104
104
|
{ key: "schedule", type: "string", help: "cron, when trigger: schedule" },
|
|
105
105
|
{ key: "timezone", type: "string", validated: true, help: "the zone its schedule reads in" },
|
|
@@ -128,7 +128,7 @@ const FLOW = [
|
|
|
128
128
|
{ key: "pause_when", type: "string", help: "a marker that pauses the flow when a run's result says it" },
|
|
129
129
|
{ key: "approvers", type: ["list", "string"], help: "who may approve its gates" },
|
|
130
130
|
{ key: "budget", type: ["number", "string"], help: "USD per run" },
|
|
131
|
-
{ key: "compute", type: "object", help: "{vcpu, memory, disk} one run's steps may hold together at once — only narrows the
|
|
131
|
+
{ key: "compute", type: "object", help: "{vcpu, memory, disk} one run's steps may hold together at once — only narrows the project's and account's" },
|
|
132
132
|
{ key: "live", type: "boolean", help: "true: steps may act for real in a test run" },
|
|
133
133
|
{ key: "a2a", type: "object", help: "serve this flow to outside agents over A2A 1.0 — {publish: true, name?, description?, examples?, public_card?, input?, accept_risk?: [agent]}; changing it needs workspace:manage" },
|
|
134
134
|
];
|
|
@@ -137,7 +137,7 @@ const TOOL = [
|
|
|
137
137
|
{ key: "description", type: "string", help: "what it does — the model chooses by it" },
|
|
138
138
|
{ key: "transport", type: "string", values: ["http", "script", "mcp"], help: "http | script | mcp" },
|
|
139
139
|
{ key: "type", type: "string", legacy: true, help: "older spelling of transport" },
|
|
140
|
-
{ key: "outward", type: "boolean", help: "true: it changes something outside the
|
|
140
|
+
{ key: "outward", type: "boolean", help: "true: it changes something outside the project" },
|
|
141
141
|
{ key: "base", type: "string", help: "http: the API's base URL" },
|
|
142
142
|
{ key: "headers", type: "object", help: "http or mcp: request headers; ${SECRET} is filled server-side" },
|
|
143
143
|
{ key: "query", type: "object", help: "http: query parameters on every call" },
|
package/dist/src/mail.js
CHANGED
|
@@ -65,7 +65,7 @@ export const MAIL_CATEGORIES = [
|
|
|
65
65
|
label: "Run alerts",
|
|
66
66
|
required: false,
|
|
67
67
|
perWorkspace: true,
|
|
68
|
-
description: "A run failed, finished, or was blocked; a flow was quarantined, a run passed its SLA, a budget is nearly spent — mail from a
|
|
68
|
+
description: "A run failed, finished, or was blocked; a flow was quarantined, a run passed its SLA, a budget is nearly spent — mail from a project's notify: email.",
|
|
69
69
|
},
|
|
70
70
|
{
|
|
71
71
|
id: "approvals",
|
package/dist/src/manifest.js
CHANGED
|
@@ -114,7 +114,7 @@ export function assertManifestPath(rel, kind) {
|
|
|
114
114
|
if (rel !== rel.normalize("NFC"))
|
|
115
115
|
throw new Error(`illegal manifest path (not NFC-normalised): ${rel}`);
|
|
116
116
|
if (kind !== "run-output" && sideOf(rel) === null)
|
|
117
|
-
throw new Error(`${rel} is not
|
|
117
|
+
throw new Error(`${rel} is not project content (authored: ${[...AUTHORED_DIRS, ...AUTHORED_ROOT_FILES].join(", ")}; state: state/)`);
|
|
118
118
|
return rel;
|
|
119
119
|
}
|
|
120
120
|
/** Two paths that differ only by case cannot both be extracted on a
|
package/dist/src/notify.js
CHANGED
|
@@ -282,7 +282,7 @@ export async function attemptWebhook(tenant, workspace, d) {
|
|
|
282
282
|
const config = notifyConfig(tenant, workspace);
|
|
283
283
|
const base = { n: d.attempt, at, ...(d.manual ? { manual: true } : {}) };
|
|
284
284
|
if (!config?.url) {
|
|
285
|
-
return { ...base, ok: false, statusCode: null, durationMs: 0, response: null, error: "this
|
|
285
|
+
return { ...base, ok: false, statusCode: null, durationMs: 0, response: null, error: "this project's notify: has no url any more" };
|
|
286
286
|
}
|
|
287
287
|
const { url, refused, filled } = webhookTarget(tenant, workspace, config);
|
|
288
288
|
if (!url) {
|
|
@@ -471,7 +471,7 @@ export async function sendTestNotification(tenant, workspace) {
|
|
|
471
471
|
return {
|
|
472
472
|
ok: false,
|
|
473
473
|
destination: "none",
|
|
474
|
-
detail: "no notify: in this
|
|
474
|
+
detail: "no notify: in this project's AGENTS.md or the account's — nothing would be sent for a failure or a gate either",
|
|
475
475
|
};
|
|
476
476
|
}
|
|
477
477
|
const sent = new Date().toISOString();
|
|
@@ -153,7 +153,7 @@ export const OAUTH_CAPABILITIES = [
|
|
|
153
153
|
},
|
|
154
154
|
{
|
|
155
155
|
id: "server.client-credentials", role: "server", title: "Client credentials for machine clients", spec: "RFC 6749 §4.4",
|
|
156
|
-
status: "supported", note: "An admin registers a machine client (Settings, or `foldrun mcp clients add`) with a role,
|
|
156
|
+
status: "supported", note: "An admin registers a machine client (Settings, or `foldrun mcp clients add`) with a role, projects and access; no refresh token; disconnecting it makes it `invalid_client`.",
|
|
157
157
|
proof: [web("tests/mcp-oauth.test.ts", "machine clients (client credentials, part G)"), web("tests/mcp-oauth.test.ts", "a machine client can sign in with private_key_jwt"), cli("tests/cli-mcp.test.ts", "mcp clients add")],
|
|
158
158
|
},
|
|
159
159
|
{
|
package/dist/src/openapi.js
CHANGED
|
@@ -250,7 +250,7 @@ export function loadOpenApiDocument(tenant, workspaceRoot, source) {
|
|
|
250
250
|
const abs = path.resolve(root, source);
|
|
251
251
|
const inside = (p, r) => p === r || p.startsWith(r + path.sep);
|
|
252
252
|
if (!inside(abs, root))
|
|
253
|
-
return { doc: null, error: `${source} escapes the
|
|
253
|
+
return { doc: null, error: `${source} escapes the project` };
|
|
254
254
|
let text;
|
|
255
255
|
try {
|
|
256
256
|
// The real path too: a symlink out of the workspace is still out. Both
|
|
@@ -258,12 +258,12 @@ export function loadOpenApiDocument(tenant, workspaceRoot, source) {
|
|
|
258
258
|
// macOS is /private/var).
|
|
259
259
|
const real = fs.realpathSync(abs);
|
|
260
260
|
if (!inside(real, fs.realpathSync(root)))
|
|
261
|
-
return { doc: null, error: `${source} escapes the
|
|
261
|
+
return { doc: null, error: `${source} escapes the project` };
|
|
262
262
|
text = fs.readFileSync(real, "utf8");
|
|
263
263
|
}
|
|
264
264
|
catch (err) {
|
|
265
265
|
const code = err.code;
|
|
266
|
-
return { doc: null, error: code === "ENOENT" ? `${source}: no such file in the
|
|
266
|
+
return { doc: null, error: code === "ENOENT" ? `${source}: no such file in the project` : `${source}: ${err.message}` };
|
|
267
267
|
}
|
|
268
268
|
try {
|
|
269
269
|
return { doc: parseDocumentText(text), error: null };
|
package/dist/src/package.js
CHANGED
|
@@ -69,7 +69,7 @@ const MAX_PACKAGE_FILE = 10 * 1024 * 1024;
|
|
|
69
69
|
export function packageOf(tenant, workspace, kind, name) {
|
|
70
70
|
assertSafeName(workspace, "workspace");
|
|
71
71
|
if (!listWorkspaces(tenant).some((w) => w.name === workspace)) {
|
|
72
|
-
throw new PackageError(`no
|
|
72
|
+
throw new PackageError(`no project called "${workspace}" in this account`, 404);
|
|
73
73
|
}
|
|
74
74
|
const all = listWorkspaceFiles(tenant, workspace).filter(isPackagedPath);
|
|
75
75
|
const read = (p) => readWorkspaceFile(tenant, workspace, p);
|
|
@@ -275,7 +275,7 @@ export function planImport(tenant, workspace, pkg) {
|
|
|
275
275
|
assertSafeName(workspace, "workspace");
|
|
276
276
|
const exists = listWorkspaces(tenant).some((w) => w.name === workspace);
|
|
277
277
|
if (!exists && pkg.manifest.kind !== "workspace") {
|
|
278
|
-
throw new PackageError(`no
|
|
278
|
+
throw new PackageError(`no project called "${workspace}" — a ${pkg.manifest.kind} imports into one that exists`, 404);
|
|
279
279
|
}
|
|
280
280
|
const dir = workspaceDir(tenant, workspace);
|
|
281
281
|
const added = [];
|
package/dist/src/providers.js
CHANGED
|
@@ -689,10 +689,10 @@ export function readBrowseSettings(raw) {
|
|
|
689
689
|
if (k === "init" || k === "extensions") {
|
|
690
690
|
const list = browseList(v);
|
|
691
691
|
if (!list)
|
|
692
|
-
return { settings, rest: left(rest), error: `web.browse.${k} is a list of
|
|
692
|
+
return { settings, rest: left(rest), error: `web.browse.${k} is a list of project paths, like [${k === "init" ? "scripts/stub.js" : "library/extensions/my-ext"}].` };
|
|
693
693
|
const bad = list.find((p) => p.startsWith("/") || p.split(/[\\/]/).includes("..") || p.includes(","));
|
|
694
694
|
if (bad)
|
|
695
|
-
return { settings, rest: left(rest), error: `web.browse.${k}: ${bad} must be a path inside the
|
|
695
|
+
return { settings, rest: left(rest), error: `web.browse.${k}: ${bad} must be a path inside the project (no leading /, no .., no comma).` };
|
|
696
696
|
if (list.length)
|
|
697
697
|
settings[k] = list;
|
|
698
698
|
continue;
|
package/dist/src/publish.js
CHANGED
|
@@ -329,7 +329,7 @@ async function publishScope(deps, input, scope, changes, opId) {
|
|
|
329
329
|
return { status: "duplicate", revision: res.revision, conflicts: [] };
|
|
330
330
|
// stale: the head moved. Fold again onto it.
|
|
331
331
|
}
|
|
332
|
-
throw new PublishError("the
|
|
332
|
+
throw new PublishError("the project changed too often while publishing; try again", "too_many_replays");
|
|
333
333
|
}
|
|
334
334
|
/** Combine the two heads' answers: the workspace revision is `revision`, the
|
|
335
335
|
* state one `stateRevision`; the status is the strongest of the two. */
|
|
@@ -412,7 +412,7 @@ async function restoreScope(deps, input, scope, toId, opId) {
|
|
|
412
412
|
if (res.status === "duplicate")
|
|
413
413
|
return { status: "duplicate", revision: res.revision, conflicts: [] };
|
|
414
414
|
}
|
|
415
|
-
throw new PublishError("the
|
|
415
|
+
throw new PublishError("the project changed too often while restoring; try again", "too_many_replays");
|
|
416
416
|
}
|
|
417
417
|
/** A new revision with an old one's content. History is untouched. Refuses,
|
|
418
418
|
* before committing anything, when a blob the old revision names is gone. */
|
|
@@ -479,8 +479,8 @@ export function applyContainerChanges(hostWs, containerWs, baseline, note, diver
|
|
|
479
479
|
fs.writeFileSync(conflictAbs, next);
|
|
480
480
|
applied.push(conflictRel);
|
|
481
481
|
written.push({ path: conflictRel.replaceAll("\\", "/"), base: null, after: next });
|
|
482
|
-
note?.(`write-back conflict on ${rel.replaceAll("\\", "/")}: it changed on the
|
|
483
|
-
`and not only by appending — kept the
|
|
482
|
+
note?.(`write-back conflict on ${rel.replaceAll("\\", "/")}: it changed on the project while this step ran, ` +
|
|
483
|
+
`and not only by appending — kept the project's version; this step's version is ${conflictRel.replaceAll("\\", "/")}`);
|
|
484
484
|
continue;
|
|
485
485
|
}
|
|
486
486
|
}
|
|
@@ -512,7 +512,7 @@ export function applyContainerChanges(hostWs, containerWs, baseline, note, diver
|
|
|
512
512
|
recordStepOutputs(opts.revision.tenant, path.basename(hostWs), written, { runId: opts.revision.runId, step: opts.revision.step, base: opts.revision.base });
|
|
513
513
|
}
|
|
514
514
|
catch (err) {
|
|
515
|
-
note?.(`the step's files were written to the
|
|
515
|
+
note?.(`the step's files were written to the project but not recorded as a revision yet: ${err instanceof Error ? err.message : String(err)}`);
|
|
516
516
|
}
|
|
517
517
|
}
|
|
518
518
|
return applied;
|
package/dist/src/scan.js
CHANGED
|
@@ -122,7 +122,7 @@ export const SCAN_RULES = [
|
|
|
122
122
|
id: "security/published-flow-ungated",
|
|
123
123
|
category: "security",
|
|
124
124
|
level: "warn",
|
|
125
|
-
title: "A flow published over A2A acts outside the
|
|
125
|
+
title: "A flow published over A2A acts outside the project with no person in the way",
|
|
126
126
|
help: "An outside caller can start a published flow as often as its key allows. A step that posts, sends, writes to an API or calls " +
|
|
127
127
|
"another outside agent, with no approval (`!`) or `ask:` before it or on it, does what any caller asked. Put a gate before the " +
|
|
128
128
|
"first such step — an approval is a person reading what it will do.",
|
|
@@ -152,7 +152,7 @@ export const SCAN_RULES = [
|
|
|
152
152
|
category: "supply-chain",
|
|
153
153
|
level: "warn",
|
|
154
154
|
title: "A download piped straight into a shell",
|
|
155
|
-
help: "`curl … | sh` runs whatever the server returns today, unreviewed, in the sandbox that holds this
|
|
155
|
+
help: "`curl … | sh` runs whatever the server returns today, unreviewed, in the sandbox that holds this project. " +
|
|
156
156
|
"Declare the package under `runtime: system:` or `packages:`, or download, verify a checksum, then run.",
|
|
157
157
|
owasp: ["ASI04", "ASI05"],
|
|
158
158
|
},
|
|
@@ -321,15 +321,15 @@ const OWN_RULES = "checks-own-rules";
|
|
|
321
321
|
export const CHECK_RULES = [
|
|
322
322
|
{ id: "agent/config", anchor: OWN_RULES, category: "config", title: "An agent's frontmatter or references are wrong", help: "A field foldrun cannot read, or a tool, skill, colleague or hook it names that does not exist. The message says which and what to write." },
|
|
323
323
|
{ id: "flow/config", anchor: OWN_RULES, category: "config", title: "A flow's steps or options are wrong", help: "A step naming no agent, an option value the parser cannot read, a verify: written as prose, or an arrangement that cannot have what its instruction asks for." },
|
|
324
|
-
{ id: "flow/outward-ungated", category: "security", title: "A step that acts outside the
|
|
324
|
+
{ id: "flow/outward-ungated", category: "security", title: "A step that acts outside the project with no check and no approval", help: "Give the step a verify: that reads what it did, or an approval (`!`), so a wrong post or send is caught before it repeats.", owasp: ["ASI02", "ASI09"] },
|
|
325
325
|
{ id: "tool/config", anchor: OWN_RULES, category: "config", title: "A tool's definition or program is wrong", help: "A run: program that does not exist, a package it imports that nothing declares, or a leftover type: field." },
|
|
326
326
|
{ id: "skill/config", anchor: OWN_RULES, category: "config", title: "A skill does not follow the skill format", help: "SKILL.md needs a name and a description the model can choose it by." },
|
|
327
327
|
{ id: "eval/config", anchor: OWN_RULES, category: "config", title: "An eval names nothing, or has no cases", help: "An eval names one agent or flow that exists and holds at least one case." },
|
|
328
328
|
{ id: "hook/config", anchor: OWN_RULES, category: "config", title: "A hook is not a valid hook, or a hooks: name resolves to nothing", help: "hooks/<name>/hook.md with on:, and run.mjs beside it; a run refuses a step whose hook is missing rather than run it unguarded." },
|
|
329
329
|
{ id: "knowledge/okf", anchor: OWN_RULES, category: "config", title: "A knowledge or memory document is not a conformant OKF bundle entry", help: "Each document needs a type:; dates are YYYY-MM-DD; stale documents are flagged so an agent does not treat them as current." },
|
|
330
|
-
{ id: "workspace/config", anchor: OWN_RULES, category: "config", title: "A
|
|
331
|
-
{ id: "library/config", anchor: OWN_RULES, category: "config", title: "A library entry is wrong", help: "The same rules as in a
|
|
332
|
-
{ id: "paths/workspace-spelling", anchor: OWN_RULES, category: "config", title: "An older spelling of a
|
|
330
|
+
{ id: "workspace/config", anchor: OWN_RULES, category: "config", title: "A project or account setting cannot be read", help: "AGENTS.md defaults — limits:, network:, foldrun_version: — that would leave every agent on the level above, and paths a deploy refuses." },
|
|
331
|
+
{ id: "library/config", anchor: OWN_RULES, category: "config", title: "A library entry is wrong", help: "The same rules as in a project, for the account's shared library." },
|
|
332
|
+
{ id: "paths/workspace-spelling", anchor: OWN_RULES, category: "config", title: "An older spelling of a project path", help: "`../../storage/x` still works; `workspace/storage/x` reads the same in every tool, script and check." },
|
|
333
333
|
];
|
|
334
334
|
/** The rule id of a check or deploy problem, from where it was found and
|
|
335
335
|
* the flow lint's tag when it has one. */
|
|
@@ -906,7 +906,7 @@ function scanPublishedFlows(flows, legs, tree, push) {
|
|
|
906
906
|
const writes = [...new Set(stepAgents(s).flatMap((n) => legs.get(n)?.writes ?? []))];
|
|
907
907
|
if (!writes.length)
|
|
908
908
|
continue;
|
|
909
|
-
push("security/published-flow-ungated", fl.file, s.line ?? at, `published ungated ${g} ${s.agent}`, `step ${g} ([[${s.agent}]]) can act outside the
|
|
909
|
+
push("security/published-flow-ungated", fl.file, s.line ?? at, `published ungated ${g} ${s.agent}`, `step ${g} ([[${s.agent}]]) can act outside the project (${writes.slice(0, 2).join(", ")}${writes.length > 2 ? ", …" : ""}) and ${info.name} is published over A2A, ` +
|
|
910
910
|
`with no approval or ask: before it — any caller with a key starts it. Put a gate (\`${g}!.\`) on it or before it`);
|
|
911
911
|
}
|
|
912
912
|
}
|
package/dist/src/secrets.js
CHANGED
|
@@ -129,7 +129,7 @@ function vaultAad(tenant, workspace, name, rec) {
|
|
|
129
129
|
throw new Error("malformed sites");
|
|
130
130
|
}
|
|
131
131
|
if (rec.workspaces !== undefined && (!Array.isArray(rec.workspaces) || rec.workspaces.some((x) => typeof x !== "string"))) {
|
|
132
|
-
throw new Error("malformed
|
|
132
|
+
throw new Error("malformed projects");
|
|
133
133
|
}
|
|
134
134
|
return Buffer.from(JSON.stringify([
|
|
135
135
|
"foldrun-vault/2",
|
|
@@ -335,7 +335,7 @@ function cleanWorkspaceList(workspaces) {
|
|
|
335
335
|
if (workspaces === null)
|
|
336
336
|
return null;
|
|
337
337
|
if (!Array.isArray(workspaces) || workspaces.some((w) => typeof w !== "string")) {
|
|
338
|
-
throw new Error("
|
|
338
|
+
throw new Error("projects is a list of project names, or null for every project");
|
|
339
339
|
}
|
|
340
340
|
const clean = [...new Set(workspaces.map((w) => w.trim()).filter(Boolean))].sort();
|
|
341
341
|
for (const w of clean)
|
|
@@ -347,7 +347,7 @@ function assertWorkspacesExist(list, exists) {
|
|
|
347
347
|
return;
|
|
348
348
|
const missing = list.filter((w) => !exists(w));
|
|
349
349
|
if (missing.length)
|
|
350
|
-
throw Object.assign(new Error(`no
|
|
350
|
+
throw Object.assign(new Error(`no project ${missing.join(", ")} in this account`), { status: 400 });
|
|
351
351
|
}
|
|
352
352
|
export function setSecret(tenant, name, value, workspace, kind, limit = {}) {
|
|
353
353
|
// A string, not anything that prints as one: RegExp.test and the vault's
|
|
@@ -384,7 +384,7 @@ function limitFor(workspace, limit) {
|
|
|
384
384
|
if (limit.workspaces === undefined)
|
|
385
385
|
return undefined;
|
|
386
386
|
if (workspace)
|
|
387
|
-
throw new Error("a
|
|
387
|
+
throw new Error("a project's own secret is that project's already — only an account secret is limited to projects");
|
|
388
388
|
return cleanWorkspaceList(limit.workspaces);
|
|
389
389
|
}
|
|
390
390
|
/**
|
|
@@ -436,7 +436,7 @@ export function setSecretSites(tenant, name, sites, workspace) {
|
|
|
436
436
|
return all;
|
|
437
437
|
});
|
|
438
438
|
if (!found)
|
|
439
|
-
throw new Error(`no secret ${name}${workspace ? ` in
|
|
439
|
+
throw new Error(`no secret ${name}${workspace ? ` in project ${workspace}` : " in the account"}`);
|
|
440
440
|
return clean;
|
|
441
441
|
}
|
|
442
442
|
/**
|
|
@@ -588,7 +588,7 @@ export function setSecretWorkspaces(tenant, name, workspaces, opts = {}) {
|
|
|
588
588
|
if (expected !== undefined) {
|
|
589
589
|
const now = Array.isArray(rec.workspaces) ? [...rec.workspaces].sort() : null;
|
|
590
590
|
if (JSON.stringify(now) !== JSON.stringify(expected)) {
|
|
591
|
-
throw Object.assign(new Error(`${name}'s
|
|
591
|
+
throw Object.assign(new Error(`${name}'s projects changed since you loaded them (now ${now === null ? "every project" : now.length ? now.join(", ") : "none"}) — reload and try again`), { status: 409 });
|
|
592
592
|
}
|
|
593
593
|
}
|
|
594
594
|
assertWorkspacesExist(clean, opts.exists);
|
|
@@ -605,7 +605,7 @@ export function setSecretWorkspaces(tenant, name, workspaces, opts = {}) {
|
|
|
605
605
|
function withWorkspaces(tenant, name, rec, workspaces) {
|
|
606
606
|
const value = openRecord(tenant, undefined, name, rec);
|
|
607
607
|
if (value === null)
|
|
608
|
-
throw new Error(`${name} cannot be read with this install's keys — set its value again before changing its
|
|
608
|
+
throw new Error(`${name} cannot be read with this install's keys — set its value again before changing its projects`);
|
|
609
609
|
return sealRecord(tenant, undefined, name, value, { kind: rec.kind, sites: rec.sites, workspaces: workspaces ?? undefined, updatedAt: rec.updatedAt }, true);
|
|
610
610
|
}
|
|
611
611
|
/**
|