@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/starter.js
CHANGED
|
@@ -36,7 +36,7 @@ export function accountFiles(account) {
|
|
|
36
36
|
path: "AGENTS.md",
|
|
37
37
|
content: `---
|
|
38
38
|
foldrun_version: "0.1"
|
|
39
|
-
# Config here applies to every
|
|
39
|
+
# Config here applies to every project under this account, and a project
|
|
40
40
|
# that declares the same key replaces it *whole* — base_url and token never
|
|
41
41
|
# merge across scopes, so a provider block belongs entirely at one level.
|
|
42
42
|
#
|
|
@@ -77,9 +77,9 @@ foldrun_version: "0.1"
|
|
|
77
77
|
|
|
78
78
|
# ${account}
|
|
79
79
|
|
|
80
|
-
Context every agent in every
|
|
80
|
+
Context every agent in every project here shares.
|
|
81
81
|
|
|
82
|
-
Unlike the frontmatter above, this prose **accumulates**: a
|
|
82
|
+
Unlike the frontmatter above, this prose **accumulates**: a project's
|
|
83
83
|
AGENTS.md is added to it, not swapped for it, so a rule written here cannot be
|
|
84
84
|
dropped further down.
|
|
85
85
|
`,
|
|
@@ -126,7 +126,7 @@ export function starterFiles(workspace) {
|
|
|
126
126
|
path: "AGENTS.md",
|
|
127
127
|
content: `---
|
|
128
128
|
name: ${workspace}
|
|
129
|
-
description: A starter
|
|
129
|
+
description: A starter project — edit the agents, then run the flow.
|
|
130
130
|
foldrun_version: "0.1"
|
|
131
131
|
---
|
|
132
132
|
|
|
@@ -143,7 +143,7 @@ Context every agent here shares. Prices, rules, anything they should all know.
|
|
|
143
143
|
// every secret *inside the workspace*, and without this file the first
|
|
144
144
|
// `git add -A` after setting a secret commits it.
|
|
145
145
|
path: ".gitignore",
|
|
146
|
-
content: `# The key that decrypts every secret in this
|
|
146
|
+
content: `# The key that decrypts every secret in this project, plus the
|
|
147
147
|
# local run store. Never commit these.
|
|
148
148
|
.foldrun/
|
|
149
149
|
|
|
@@ -282,7 +282,7 @@ only when they asked for exactly that deletion.
|
|
|
282
282
|
|
|
283
283
|
| Path | What |
|
|
284
284
|
|---|---|
|
|
285
|
-
| \`AGENTS.md\` | shared context every agent in this
|
|
285
|
+
| \`AGENTS.md\` | shared context every agent in this project sees |
|
|
286
286
|
| \`agents/<name>/agent.md\` | one role: its persona, model, tools |
|
|
287
287
|
| \`flows/<name>.md\` | steps, in order, naming the agents that run them |
|
|
288
288
|
| \`knowledge/\` | reference material agents read |
|
|
@@ -301,10 +301,10 @@ Regenerated every run means a file; accumulated across runs means \`state/\`.
|
|
|
301
301
|
That last row is worth knowing: a subagent you write in Claude Code is imported
|
|
302
302
|
as \`agents/<name>/agent.md\` at deploy, no conversion. Write it either way.
|
|
303
303
|
|
|
304
|
-
## Paths inside a
|
|
304
|
+
## Paths inside a project
|
|
305
305
|
|
|
306
306
|
An agent's working directory is \`agents/<name>/\`. Write every path to the
|
|
307
|
-
|
|
307
|
+
project's own folders as \`workspace/…\` — \`workspace/storage/report.csv\`,
|
|
308
308
|
\`workspace/state/cursor.json\` — in an agent's prose, in flow options
|
|
309
309
|
(\`each: rows of\`, \`when: rows of\`, \`verify:\`, \`preview:\`, \`schema:\`) and in
|
|
310
310
|
script arguments. It resolves the same in the file tools, the shell, scripts
|
|
@@ -330,9 +330,9 @@ A step held to its list still searches the web through the proxy's search door;
|
|
|
330
330
|
at \`none\` or \`defaults: false\` write it out — \`web: {actions: [search, fetch]}\` —
|
|
331
331
|
because a query's words leave (\`foldrun docs network\`).
|
|
332
332
|
|
|
333
|
-
## Talking to a deployed
|
|
333
|
+
## Talking to a deployed project
|
|
334
334
|
|
|
335
|
-
The CLI is local except for \`deploy\`. To inspect or drive a
|
|
335
|
+
The CLI is local except for \`deploy\`. To inspect or drive a project running
|
|
336
336
|
on a server, use the HTTP API — every route takes the same API key
|
|
337
337
|
(\`Authorization: Bearer $FOLDRUN_TOKEN\`, from Settings → API keys) or a browser
|
|
338
338
|
session, and refuses without one.
|
|
@@ -351,7 +351,7 @@ All of it, \`/api/workspaces/<workspace>\` unless noted:
|
|
|
351
351
|
|
|
352
352
|
| Route | Methods | For |
|
|
353
353
|
|---|---|---|
|
|
354
|
-
| \`/\` | GET DELETE PATCH | the
|
|
354
|
+
| \`/\` | GET DELETE PATCH | the project itself |
|
|
355
355
|
| \`/deploy\` | POST | what \`foldrun deploy\` calls |
|
|
356
356
|
| \`/source\` | GET PUT PATCH DELETE | read and write single files |
|
|
357
357
|
| \`/runs\` | GET | list runs |
|
|
@@ -365,19 +365,19 @@ All of it, \`/api/workspaces/<workspace>\` unless noted:
|
|
|
365
365
|
| \`/flows\` · \`/flows/<f>\` | GET POST · POST DELETE PATCH | list, create, edit |
|
|
366
366
|
| \`/flows/<f>/run\` | POST | start a flow |
|
|
367
367
|
| \`/flows/<f>/filter\` | POST | would this delivery start it? its \`filter:\` against a payload — nothing starts |
|
|
368
|
-
| \`/agents\` · \`/agents/<a>/run\` · \`/agents/import\` | GET POST · POST · GET POST | list agents, run one, copy one in from another
|
|
368
|
+
| \`/agents\` · \`/agents/<a>/run\` · \`/agents/import\` | GET POST · POST · GET POST | list agents, run one, copy one in from another project |
|
|
369
369
|
| \`/evals\` · \`/evals/<e>/run\` | GET POST · POST | list evals, run one |
|
|
370
370
|
| \`/evals/<e>/compare\` | GET POST | its cases under two to four models, side by side — test runs, a spend limit |
|
|
371
371
|
| \`/evals/<e>/grades\` · \`/evals/<e>/grade\` | GET · POST | a grader's grades (\`trigger: runs\`); grade one finished run now |
|
|
372
372
|
| \`/evals/<e>/improve\` · \`/proposals\` · \`/proposals/<id>\` | POST · GET · GET POST | ask for a proposed fix; list them; apply or dismiss one |
|
|
373
373
|
| \`/tools/<t>/test\` | POST | exercise one tool alone |
|
|
374
|
-
| \`/storage\` · \`/storage/download\` · \`/storage/upload-url\` · \`/storage/preview\` | GET POST PUT DELETE · GET · POST · GET |
|
|
374
|
+
| \`/storage\` · \`/storage/download\` · \`/storage/upload-url\` · \`/storage/preview\` | GET POST PUT DELETE · GET · POST · GET | project files, any type; \`preview\` returns one parsed for reading |
|
|
375
375
|
| \`/assets\` | POST | upload an asset |
|
|
376
376
|
| \`/hooks/<f>/rotate\` | POST | new webhook token for a flow |
|
|
377
377
|
| \`/notify/deliveries\` · \`/notify/deliveries/<id>/redeliver\` | GET · POST | every notify: webhook sent and each attempt; send one again |
|
|
378
|
-
| \`/export\` · \`/import\` | GET · POST | the
|
|
379
|
-
| \`/restore\` | POST | the
|
|
380
|
-
| \`/vocabulary\` | GET | what this
|
|
378
|
+
| \`/export\` · \`/import\` | GET · POST | the project, a flow (\`?kind=flow&name=\`) or an agent as a .zip; take one in (\`?dryRun=1\` first, \`?overwrite=1\` to replace) |
|
|
379
|
+
| \`/restore\` | POST | the project's source back to a point in its history — \`dryRun\` first, then \`confirm\` |
|
|
380
|
+
| \`/vocabulary\` | GET | what this project's documents may say |
|
|
381
381
|
| \`/a2a\` | GET | what it serves to outside agents over A2A: flows that say \`a2a:\`, card URLs, recent tasks |
|
|
382
382
|
| \`/check\` | GET | what \`foldrun check\` says about the deployed copy, as findings with rule ids (\`?security=1\`) |
|
|
383
383
|
| \`/assistant\` | POST | ask the assistant, or have it write agents, flows, tools and skills — from the docs only; proposals come back, nothing is written |
|
|
@@ -522,7 +522,7 @@ Only \`name\` and the prose are required. Every other field widens or narrows
|
|
|
522
522
|
what the agent can reach, and the default is narrow.
|
|
523
523
|
|
|
524
524
|
\`timezone:\` is nearest-wins all the way down: the agent's own, else its
|
|
525
|
-
flow's, else the
|
|
525
|
+
flow's, else the project's AGENTS.md, else the account's, else UTC. It sets
|
|
526
526
|
\`TZ\` and the date the agent is told, so a Sydney desk stamps the Sydney date.
|
|
527
527
|
|
|
528
528
|
\`runtime:\` installs pip/npm packages in the sandbox each agent runs in. Pin
|
|
@@ -571,7 +571,7 @@ export function blankWorkspaceFiles(workspace) {
|
|
|
571
571
|
.map((f) => f.path === "AGENTS.md"
|
|
572
572
|
? {
|
|
573
573
|
...f,
|
|
574
|
-
content: f.content.replace("description: A starter
|
|
574
|
+
content: f.content.replace("description: A starter project — edit the agents, then run the flow.", "description: A new project — add an agent or import one from another project, then write a flow."),
|
|
575
575
|
}
|
|
576
576
|
: f);
|
|
577
577
|
}
|
package/dist/src/storage.js
CHANGED
|
@@ -93,7 +93,7 @@ function bytesOf(files) {
|
|
|
93
93
|
*/
|
|
94
94
|
export function requireWorkspace(tenant, workspace) {
|
|
95
95
|
if (!fs.existsSync(workspaceDir(tenant, workspace))) {
|
|
96
|
-
throw Object.assign(new Error(`
|
|
96
|
+
throw Object.assign(new Error(`project ${workspace} not found`), { status: 404 });
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
99
|
// ---------- paths ----------
|
|
@@ -976,7 +976,7 @@ async function putFileQuietly(tenant, workspace, rel, body, by) {
|
|
|
976
976
|
assertNoNameClash(seen.files, norm);
|
|
977
977
|
const before = seen.files.find((f) => f.path === norm);
|
|
978
978
|
if (before?.sha !== sha && usedBytes(tenant, workspace) - (before?.size ?? 0) + body.length > quotaBytes()) {
|
|
979
|
-
throw new Error(`
|
|
979
|
+
throw new Error(`project file quota exceeded (${quotaBytes() / 1e6}MB)`);
|
|
980
980
|
}
|
|
981
981
|
}
|
|
982
982
|
// The upload happens outside the lock: it can be long, and a blob is
|
|
@@ -995,7 +995,7 @@ async function putFileQuietly(tenant, workspace, rel, body, by) {
|
|
|
995
995
|
// Nothing names the blob we just put unless another record already does.
|
|
996
996
|
if (!index.files.some((f) => f.sha === sha))
|
|
997
997
|
await driver.remove(key).catch(() => { });
|
|
998
|
-
throw new Error(`
|
|
998
|
+
throw new Error(`project file quota exceeded (${quotaBytes() / 1e6}MB)`);
|
|
999
999
|
}
|
|
1000
1000
|
// A delete or replace that ran between our upload and now may have
|
|
1001
1001
|
// collected this very blob (it was unreferenced then). We hold the bytes,
|
|
@@ -1064,7 +1064,7 @@ export async function registerUpload(tenant, workspace, rel, sha, _claimed, by)
|
|
|
1064
1064
|
await refuse(`${norm} is ${Math.round(size / 1e6)}MB — the limit is ${maxBytes() / 1e6}MB`);
|
|
1065
1065
|
}
|
|
1066
1066
|
if (bytesOf(files) > quotaBytes() && bytesOf(files) > bytesOf(index.files)) {
|
|
1067
|
-
await refuse(`
|
|
1067
|
+
await refuse(`project file quota exceeded (${quotaBytes() / 1e6}MB)`);
|
|
1068
1068
|
}
|
|
1069
1069
|
indexPut(tenant, workspace, index, record);
|
|
1070
1070
|
if (previous && previous.sha !== sha)
|
|
@@ -1182,7 +1182,7 @@ export async function uploadUrl(tenant, workspace, rel, sha, size) {
|
|
|
1182
1182
|
const files = readIndex(tenant, workspace).files;
|
|
1183
1183
|
const next = [...files.filter((f) => f.path !== norm), { sha, size }];
|
|
1184
1184
|
if (bytesOf(next) > quotaBytes() && bytesOf(next) > bytesOf(files)) {
|
|
1185
|
-
throw new Error(`
|
|
1185
|
+
throw new Error(`project file quota exceeded (${quotaBytes() / 1e6}MB)`);
|
|
1186
1186
|
}
|
|
1187
1187
|
}
|
|
1188
1188
|
return driverFor(tenant, workspace).presignPut(blobKey(tenant, workspace, sha), mimeFor(norm), undefined, size);
|
|
@@ -1266,7 +1266,7 @@ async function moveUnlocked(tenant, from, to) {
|
|
|
1266
1266
|
const driver = driverFor(tenant, from);
|
|
1267
1267
|
const shas = driver.kind === "fs" ? [] : [...new Set(readIndex(tenant, from).files.map((f) => f.sha))];
|
|
1268
1268
|
if (shas.length && !driver.copy)
|
|
1269
|
-
throw new Error(`the ${driver.kind} store cannot move files to a new
|
|
1269
|
+
throw new Error(`the ${driver.kind} store cannot move files to a new project name`);
|
|
1270
1270
|
for (const sha of shas)
|
|
1271
1271
|
await driver.copy(blobKey(tenant, from, sha), blobKey(tenant, to, sha));
|
|
1272
1272
|
if (fs.existsSync(src)) {
|
package/dist/src/store.js
CHANGED
|
@@ -280,7 +280,7 @@ export function checkFormatVersion(declared) {
|
|
|
280
280
|
return {
|
|
281
281
|
declared: value,
|
|
282
282
|
supported: FORMAT_VERSION,
|
|
283
|
-
warning: `this
|
|
283
|
+
warning: `this project targets foldrun format ${value}, and this build understands ` +
|
|
284
284
|
`${FORMAT_VERSION}. A different major version may mean different behaviour — ` +
|
|
285
285
|
`read it as best-effort rather than correct.`,
|
|
286
286
|
};
|
|
@@ -289,7 +289,7 @@ export function checkFormatVersion(declared) {
|
|
|
289
289
|
return {
|
|
290
290
|
declared: value,
|
|
291
291
|
supported: FORMAT_VERSION,
|
|
292
|
-
warning: `this
|
|
292
|
+
warning: `this project targets foldrun format ${value}; this build understands ` +
|
|
293
293
|
`${FORMAT_VERSION}. Newer fields will be ignored rather than rejected.`,
|
|
294
294
|
};
|
|
295
295
|
}
|
|
@@ -381,7 +381,7 @@ meta = {}) {
|
|
|
381
381
|
}
|
|
382
382
|
assertCanonicalCase(norm);
|
|
383
383
|
if (!IN_WORKSPACE_DIR.test(norm) && norm !== "project.md" && norm !== "AGENTS.md") {
|
|
384
|
-
throw new Error(`unexpected file: ${f.path} — a
|
|
384
|
+
throw new Error(`unexpected file: ${f.path} — a project holds AGENTS.md plus ` +
|
|
385
385
|
`${WORKSPACE_DIRS.map((d) => `${d}/`).join(", ")}`);
|
|
386
386
|
}
|
|
387
387
|
}
|
|
@@ -1696,7 +1696,7 @@ export function parseFlow(file, raw) {
|
|
|
1696
1696
|
else if (!/\s/.test(value) && (/\.(json|ya?ml)$/i.test(value) || value.includes("/")))
|
|
1697
1697
|
step.schemaPath = value;
|
|
1698
1698
|
else
|
|
1699
|
-
problem("a JSON object, a path under the
|
|
1699
|
+
problem("a JSON object, a path under the project (schemas/lead.json), or a YAML block on the lines below");
|
|
1700
1700
|
}
|
|
1701
1701
|
}
|
|
1702
1702
|
}
|
|
@@ -2320,7 +2320,7 @@ export function accountFileSealed(rel) {
|
|
|
2320
2320
|
return "generated bookkeeping, not an authored file.";
|
|
2321
2321
|
}
|
|
2322
2322
|
if (/^workspaces\/[^/]+\/secrets\.json$/.test(norm)) {
|
|
2323
|
-
return "the
|
|
2323
|
+
return "the project vault — encrypted, and never served to a browser.";
|
|
2324
2324
|
}
|
|
2325
2325
|
return null;
|
|
2326
2326
|
}
|
|
@@ -2483,7 +2483,7 @@ export function landsInside(dir, full, followLast = true) {
|
|
|
2483
2483
|
}
|
|
2484
2484
|
export function assertLandsInside(dir, full, rel, followLast = true) {
|
|
2485
2485
|
if (!landsInside(dir, full, followLast))
|
|
2486
|
-
throw new Error(`illegal path: ${rel} leads out of the
|
|
2486
|
+
throw new Error(`illegal path: ${rel} leads out of the project through a symlink`);
|
|
2487
2487
|
}
|
|
2488
2488
|
export function readWorkspaceFile(tenant, workspace, rel) {
|
|
2489
2489
|
const dir = workspaceDir(tenant, workspace);
|
|
@@ -2500,7 +2500,7 @@ export function readWorkspaceFile(tenant, workspace, rel) {
|
|
|
2500
2500
|
}
|
|
2501
2501
|
catch (err) {
|
|
2502
2502
|
if (err instanceof UnsafeFileError)
|
|
2503
|
-
throw new Error(`illegal path: ${rel} leads out of the
|
|
2503
|
+
throw new Error(`illegal path: ${rel} leads out of the project through a symlink`);
|
|
2504
2504
|
throw err;
|
|
2505
2505
|
}
|
|
2506
2506
|
}
|
|
@@ -2518,7 +2518,7 @@ export function writeWorkspaceFile(tenant, workspace, rel, content, meta = {}) {
|
|
|
2518
2518
|
// /api/workspaces, deploy and import apply. Those create through
|
|
2519
2519
|
// saveWorkspace / applyImport, not through here.
|
|
2520
2520
|
if (!fs.existsSync(dir))
|
|
2521
|
-
throw Object.assign(new Error(`
|
|
2521
|
+
throw Object.assign(new Error(`project ${workspace} not found`), { status: 404 });
|
|
2522
2522
|
const p = path.join(dir, assertEditablePath(rel));
|
|
2523
2523
|
// Before anything is created: mkdir below would otherwise make folders
|
|
2524
2524
|
// through a linked directory too.
|
|
@@ -2603,7 +2603,7 @@ export function anchoredReason(rel) {
|
|
|
2603
2603
|
const norm = rel.replaceAll("\\", "/");
|
|
2604
2604
|
const base = norm.split("/").pop();
|
|
2605
2605
|
if (norm === "AGENTS.md" || norm === "project.md") {
|
|
2606
|
-
return `${base} is the
|
|
2606
|
+
return `${base} is the project's own identity — it cannot move; rename or delete the project instead`;
|
|
2607
2607
|
}
|
|
2608
2608
|
if (base === "agent.md") {
|
|
2609
2609
|
return "agent.md is the agent because of where it sits — to rename the agent, rename its folder";
|
|
@@ -2746,7 +2746,7 @@ export function deleteWorkspacePath(tenant, workspace, rel, meta = {}) {
|
|
|
2746
2746
|
export function deleteWorkspace(tenant, workspace) {
|
|
2747
2747
|
const dir = workspaceDir(tenant, workspace);
|
|
2748
2748
|
if (!fs.existsSync(dir))
|
|
2749
|
-
throw new Error(`
|
|
2749
|
+
throw new Error(`project ${workspace} not found`);
|
|
2750
2750
|
// Its records in the database (runs, trigger log, file index) go BEFORE the
|
|
2751
2751
|
// folder: if that throws, nothing was removed and the delete can be retried;
|
|
2752
2752
|
// after the folder is gone a retry would answer "not found" with rows left.
|
|
@@ -2778,7 +2778,7 @@ export async function deleteWorkspaceAsync(tenant, workspace) {
|
|
|
2778
2778
|
if (!lc)
|
|
2779
2779
|
return deleteWorkspace(tenant, workspace);
|
|
2780
2780
|
if (!fs.existsSync(workspaceDir(tenant, workspace)))
|
|
2781
|
-
throw new Error(`
|
|
2781
|
+
throw new Error(`project ${workspace} not found`);
|
|
2782
2782
|
await lc.drop(tenant, workspace, () => deleteWorkspace(tenant, workspace));
|
|
2783
2783
|
}
|
|
2784
2784
|
/**
|
|
@@ -2810,14 +2810,14 @@ export function renameWorkspace(tenant, from, to) {
|
|
|
2810
2810
|
return;
|
|
2811
2811
|
const src = workspaceDir(tenant, from);
|
|
2812
2812
|
if (!fs.existsSync(src))
|
|
2813
|
-
throw new Error(`
|
|
2813
|
+
throw new Error(`project ${from} not found`);
|
|
2814
2814
|
// Deliberately not workspaceDir(): that returns the *legacy* path when one
|
|
2815
2815
|
// exists, and renaming into `projects/` would resurrect the old layout.
|
|
2816
2816
|
const dest = singleWorkspace()
|
|
2817
2817
|
? (() => { throw new Error("cannot rename in single-workspace mode"); })()
|
|
2818
2818
|
: path.join(dataRoot(), tenant, WORKSPACES, to);
|
|
2819
2819
|
if (fs.existsSync(dest))
|
|
2820
|
-
throw new Error(`
|
|
2820
|
+
throw new Error(`project ${to} already exists`);
|
|
2821
2821
|
fs.mkdirSync(path.dirname(dest), { recursive: true });
|
|
2822
2822
|
fs.renameSync(src, dest);
|
|
2823
2823
|
// Its runs and trigger log in the database follow the name; if they cannot,
|
|
@@ -2850,13 +2850,13 @@ export async function renameWorkspaceAsync(tenant, from, to) {
|
|
|
2850
2850
|
return renameWorkspace(tenant, from, to);
|
|
2851
2851
|
assertSafeName(to, "workspace");
|
|
2852
2852
|
if (!fs.existsSync(workspaceDir(tenant, from)))
|
|
2853
|
-
throw new Error(`
|
|
2853
|
+
throw new Error(`project ${from} not found`);
|
|
2854
2854
|
// The checks renameWorkspace makes, BEFORE the history moves: a name that is
|
|
2855
2855
|
// taken must never have its history replaced by this one's.
|
|
2856
2856
|
if (singleWorkspace())
|
|
2857
2857
|
return renameWorkspace(tenant, from, to); // throws
|
|
2858
2858
|
if (fs.existsSync(workspaceDir(tenant, to)) || fs.existsSync(path.join(dataRoot(), tenant, WORKSPACES, to)))
|
|
2859
|
-
throw new Error(`
|
|
2859
|
+
throw new Error(`project ${to} already exists`);
|
|
2860
2860
|
await lc.move(tenant, from, to, () => renameWorkspace(tenant, from, to));
|
|
2861
2861
|
}
|
|
2862
2862
|
/** Set a workspace's description, in AGENTS.md, without touching anything else.
|
|
@@ -2871,7 +2871,7 @@ export async function renameWorkspaceAsync(tenant, from, to) {
|
|
|
2871
2871
|
export function setWorkspaceDescription(tenant, workspace, description, meta = {}) {
|
|
2872
2872
|
const file = path.join(workspaceDir(tenant, workspace), "AGENTS.md");
|
|
2873
2873
|
if (!fs.existsSync(file))
|
|
2874
|
-
throw new Error("this
|
|
2874
|
+
throw new Error("this project has no AGENTS.md");
|
|
2875
2875
|
const raw = fs.readFileSync(file, "utf8");
|
|
2876
2876
|
if (!/^---\r?\n[\s\S]*?\r?\n---/.test(raw))
|
|
2877
2877
|
throw new Error("AGENTS.md has no frontmatter");
|
package/dist/src/tool-test.js
CHANGED
|
@@ -345,7 +345,7 @@ export async function testTool(tenant, workspace, def, input = {}) {
|
|
|
345
345
|
: code === 0 ? "exited 0" : `exited ${code ?? "with an error"}`,
|
|
346
346
|
detail: clip((caller
|
|
347
347
|
? `ran from agents/${caller.name}/, where a run runs\n\n`
|
|
348
|
-
: `ran from the
|
|
348
|
+
: `ran from the project root — there is no agent to stand in for, so a script that reaches workspace/ or ../../ will not find the project there\n\n`) +
|
|
349
349
|
(out || "(no output)")),
|
|
350
350
|
});
|
|
351
351
|
}
|
package/dist/src/webhook.js
CHANGED
|
@@ -56,7 +56,7 @@ export function rotateWebhook(tenant, workspace, flow) {
|
|
|
56
56
|
// here turned a rotate under a mistyped name into a workspace holding only
|
|
57
57
|
// hooks.json, past the plan's workspace count.
|
|
58
58
|
if (!fs.existsSync(path.dirname(file)))
|
|
59
|
-
throw Object.assign(new Error(`
|
|
59
|
+
throw Object.assign(new Error(`project ${workspace} not found`), { status: 404 });
|
|
60
60
|
const rotatedAt = new Date().toISOString();
|
|
61
61
|
const store = docStore(tenant, workspace);
|
|
62
62
|
if (store) {
|
|
@@ -404,7 +404,7 @@ function permanent(err) {
|
|
|
404
404
|
if (err instanceof OpIdReused)
|
|
405
405
|
return true; // commitEntry asked again and it still is: see there
|
|
406
406
|
const m = err instanceof Error ? err.message : "";
|
|
407
|
-
return /^illegal manifest path|differ only by case|a manifest holds at most|is not
|
|
407
|
+
return /^illegal manifest path|differ only by case|a manifest holds at most|is not project content/.test(m);
|
|
408
408
|
}
|
|
409
409
|
/** Wait until every queued change (of one workspace, or all) is committed.
|
|
410
410
|
* A barrier for an edge that wants "committed" before it answers. Returns
|
|
@@ -1431,7 +1431,7 @@ async function reconcileNow(tenant, workspace, by = "reconcile") {
|
|
|
1431
1431
|
ws,
|
|
1432
1432
|
opId,
|
|
1433
1433
|
by,
|
|
1434
|
-
message: "
|
|
1434
|
+
message: "project content recorded",
|
|
1435
1435
|
changes,
|
|
1436
1436
|
// Read when asked, one file at a time; publish checks the bytes against
|
|
1437
1437
|
// the sha, so a file that changed since the scan fails this repair (the
|
package/package.json
CHANGED
package/src/account.ts
CHANGED
|
@@ -100,7 +100,7 @@ export function readAccountTree(accountRoot: string, only?: string): AccountTree
|
|
|
100
100
|
}
|
|
101
101
|
const names = listWorkspaceDirs(root).filter((n) => (only ? n === only : true));
|
|
102
102
|
if (only && names.length === 0) {
|
|
103
|
-
throw new Error(`no
|
|
103
|
+
throw new Error(`no project "${only}" in ${root} — have: ${listWorkspaceDirs(root).join(", ") || "none"}`);
|
|
104
104
|
}
|
|
105
105
|
const wsRoot = path.join(root, "workspaces");
|
|
106
106
|
const legacy = path.join(root, "projects");
|
|
@@ -130,7 +130,7 @@ export function accountTreeFrom(from: string, only?: string): { layout: Layout;
|
|
|
130
130
|
if (layout.kind === "flat" || layout.kind === "empty") {
|
|
131
131
|
const dir = layout.workspaceDir!;
|
|
132
132
|
const name = path.basename(dir);
|
|
133
|
-
if (only && only !== name) throw new Error(`${dir} is a single
|
|
133
|
+
if (only && only !== name) throw new Error(`${dir} is a single project called "${name}", not "${only}"`);
|
|
134
134
|
return {
|
|
135
135
|
layout,
|
|
136
136
|
tree: {
|
package/src/agent-import.ts
CHANGED
|
@@ -76,8 +76,8 @@ export function importAgent(
|
|
|
76
76
|
const name = opts.as?.trim() || agent;
|
|
77
77
|
assertSafeName(name, "agent");
|
|
78
78
|
const known = new Set(listWorkspaces(tenant).map((w) => w.name));
|
|
79
|
-
if (!known.has(from)) throw new AgentImportError(`no
|
|
80
|
-
if (!known.has(to)) throw new AgentImportError(`no
|
|
79
|
+
if (!known.has(from)) throw new AgentImportError(`no project called "${from}" in this account`, 404);
|
|
80
|
+
if (!known.has(to)) throw new AgentImportError(`no project called "${to}" in this account`, 404);
|
|
81
81
|
if (from === to && name === agent) {
|
|
82
82
|
throw new AgentImportError(`${agent} is already in ${to} — give the copy another name with "as"`, 409);
|
|
83
83
|
}
|
package/src/budget.ts
CHANGED
|
@@ -88,7 +88,7 @@ export function budgetProblem(raw: unknown, allowed: BudgetPeriod[]): string | n
|
|
|
88
88
|
if (!allowed.includes(period)) {
|
|
89
89
|
return period === "run"
|
|
90
90
|
? `budget: is per run here already — write the number alone`
|
|
91
|
-
: `budget: "${period}" does not apply here — this cap is per run; a cap over time belongs in the
|
|
91
|
+
: `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`;
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
94
|
return null;
|
package/src/copy-back.ts
CHANGED
|
@@ -81,7 +81,7 @@ export function refusedLine(refused: readonly RefusedPath[]): string {
|
|
|
81
81
|
const shown = refused.slice(0, 20).map((r) => `${r.path} (${r.kind})`).join(", ");
|
|
82
82
|
const more = refused.length > 20 ? ` and ${refused.length - 20} more` : "";
|
|
83
83
|
return (
|
|
84
|
-
`refused path: ${shown}${more} — a step cannot change the
|
|
85
|
-
`the
|
|
84
|
+
`refused path: ${shown}${more} — a step cannot change the project's configuration or code; ` +
|
|
85
|
+
`the project keeps its own copy. Propose the change instead (Proposed fixes), and a person applies it.`
|
|
86
86
|
);
|
|
87
87
|
}
|
package/src/data-import.ts
CHANGED
|
@@ -211,9 +211,9 @@ const PLATFORM_MARKERS: Record<string, string> = {
|
|
|
211
211
|
"trigger-log.jsonl.tmp": "trigger log temp file (not read here)",
|
|
212
212
|
"hooks.json": "webhook tokens (platform file; not mapped)",
|
|
213
213
|
"hook-deliveries.jsonl": "hook delivery log (not mapped)",
|
|
214
|
-
".repo.json": "platform file; not
|
|
214
|
+
".repo.json": "platform file; not project content",
|
|
215
215
|
once: "operation markers (the unique keys decide now; not imported)",
|
|
216
|
-
".foldrun": "platform folder; not
|
|
216
|
+
".foldrun": "platform folder; not project content",
|
|
217
217
|
storage: "workspace-local storage folder (the storage index moved in FOL-152; not read here)",
|
|
218
218
|
};
|
|
219
219
|
|
|
@@ -253,7 +253,7 @@ async function scanWorkspace(tenant: string, workspace: string, dir: string): Pr
|
|
|
253
253
|
try {
|
|
254
254
|
top = fs.readdirSync(dir, { withFileTypes: true });
|
|
255
255
|
} catch (err) {
|
|
256
|
-
ws.error = `
|
|
256
|
+
ws.error = `project folder unreadable (${(err as NodeJS.ErrnoException).code ?? "error"})`;
|
|
257
257
|
return ws;
|
|
258
258
|
}
|
|
259
259
|
for (const e of top.sort(byName)) {
|
|
@@ -289,7 +289,7 @@ async function scanWorkspace(tenant: string, workspace: string, dir: string): Pr
|
|
|
289
289
|
ws.unmapped.push({ path: name, reason: PLATFORM_MARKERS[name], ...t });
|
|
290
290
|
} else {
|
|
291
291
|
const t = st.isDirectory() ? tally(abs) : { files: 1, bytes: st.size };
|
|
292
|
-
ws.unmapped.push({ path: name, reason: "not part of a
|
|
292
|
+
ws.unmapped.push({ path: name, reason: "not part of a project manifest (in neither the authored nor the state list)", ...t });
|
|
293
293
|
}
|
|
294
294
|
}
|
|
295
295
|
|
|
@@ -297,7 +297,7 @@ async function scanWorkspace(tenant: string, workspace: string, dir: string): Pr
|
|
|
297
297
|
const mapped: { rel: string; abs: string; st: fs.Stats }[] = [];
|
|
298
298
|
for (const f of found) {
|
|
299
299
|
if (isPlatformPath(f.rel)) {
|
|
300
|
-
ws.unmapped.push({ path: f.rel, reason: "platform or engine file, not
|
|
300
|
+
ws.unmapped.push({ path: f.rel, reason: "platform or engine file, not project content", files: 1, bytes: f.st.size });
|
|
301
301
|
continue;
|
|
302
302
|
}
|
|
303
303
|
try {
|
|
@@ -571,7 +571,7 @@ export async function planImport(scan: SourceScan, deps?: Deps): Promise<PlanWor
|
|
|
571
571
|
const sides = new Set(Object.keys(want).filter((k) => !(all[k]?.sha === want[k].sha && all[k]?.mode === want[k].mode)).map((k) => w.files.find((f) => f.path === k)!.side));
|
|
572
572
|
p.revisionsToMake = sides.size;
|
|
573
573
|
const foreign = await foreignRevisions(deps, wsRef(w));
|
|
574
|
-
if (foreign.length) p.note = `${foreign.length} revision(s) by someone else (latest by ${foreign[0].by}): an import skips this
|
|
574
|
+
if (foreign.length) p.note = `${foreign.length} revision(s) by someone else (latest by ${foreign[0].by}): an import skips this project unless --force`;
|
|
575
575
|
} catch (err) {
|
|
576
576
|
p.note = `could not read the destination: ${(err as Error).message}`;
|
|
577
577
|
}
|
|
@@ -589,7 +589,7 @@ export function renderPlan(scan: SourceScan, plan: PlanWorkspace[]): string {
|
|
|
589
589
|
let files = 0;
|
|
590
590
|
let bytes = 0;
|
|
591
591
|
for (const t of scan.tenants) {
|
|
592
|
-
L.push(`account ${t.tenant} (${t.workspaces.length}
|
|
592
|
+
L.push(`account ${t.tenant} (${t.workspaces.length} project(s))`);
|
|
593
593
|
for (const u of t.unmapped) L.push(` can't map ${u.path}: ${u.reason} (${u.files ?? 0} files, ${kb(u.bytes ?? 0)})`);
|
|
594
594
|
for (const w of t.workspaces) {
|
|
595
595
|
const p = plan.find((x) => x.tenant === w.tenant && x.workspace === w.workspace)!;
|
|
@@ -602,7 +602,7 @@ export function renderPlan(scan: SourceScan, plan: PlanWorkspace[]): string {
|
|
|
602
602
|
for (const u of w.unmapped) L.push(` can't map ${u.path}: ${u.reason}${u.files ? ` (${u.files} files, ${kb(u.bytes ?? 0)})` : ""}`);
|
|
603
603
|
}
|
|
604
604
|
}
|
|
605
|
-
L.push("", `Total: ${files}
|
|
605
|
+
L.push("", `Total: ${files} project files, ${kb(bytes)}.`);
|
|
606
606
|
return L.join("\n") + "\n";
|
|
607
607
|
}
|
|
608
608
|
|
|
@@ -729,7 +729,7 @@ export function renderVerify(r: VerifyReport): string {
|
|
|
729
729
|
list("extra in head", w.extra);
|
|
730
730
|
for (const n of w.notes) L.push(` note: ${n}`);
|
|
731
731
|
}
|
|
732
|
-
L.push("", `${r.workspaces.filter((w) => w.pass).length} of ${r.workspaces.length}
|
|
732
|
+
L.push("", `${r.workspaces.filter((w) => w.pass).length} of ${r.workspaces.length} project(s) passed.`);
|
|
733
733
|
return L.join("\n") + "\n";
|
|
734
734
|
}
|
|
735
735
|
|
package/src/deploy.ts
CHANGED
|
@@ -181,7 +181,7 @@ export function readTree(dir: string, opts: ReadTreeOptions = {}): DeployFile[]
|
|
|
181
181
|
}
|
|
182
182
|
sourceBytes += bytes;
|
|
183
183
|
if (opts.maxSourceBytes !== undefined && sourceBytes > opts.maxSourceBytes) {
|
|
184
|
-
throw new TreeTooLarge(`the
|
|
184
|
+
throw new TreeTooLarge(`the project's files other than state/ and memory/ are over ${Math.round(opts.maxSourceBytes / 1048576)} MiB — not read`);
|
|
185
185
|
}
|
|
186
186
|
return true;
|
|
187
187
|
};
|
|
@@ -440,7 +440,7 @@ function structuralWarnings(files: DeployFile[], extraOutward: Iterable<string>
|
|
|
440
440
|
const agentNames: string[] = [];
|
|
441
441
|
const out: (DeployIssue & { kind?: string })[] = [];
|
|
442
442
|
if (!files.some((f) => /^agents\/[^/]+\/agent\.md$/.test(f.path)) && !files.some((f) => /^\.(claude|agents)\/agents\/[^/]+\.md$/.test(f.path))) {
|
|
443
|
-
out.push({ where: "agents/", message: "no agents yet — add one (agents/<name>/agent.md), or import one from another
|
|
443
|
+
out.push({ where: "agents/", message: "no agents yet — add one (agents/<name>/agent.md), or import one from another project" });
|
|
444
444
|
}
|
|
445
445
|
// The web: warnings check prints — the old session: key, and a pinned
|
|
446
446
|
// user agent behind the runner image's Chrome, which the platform knows
|
package/src/failure.ts
CHANGED
|
@@ -200,7 +200,7 @@ function tooBig(reason: string): FailureExplained | null {
|
|
|
200
200
|
const what = kind === "memory" ? "GiB of memory" : pool[2];
|
|
201
201
|
const fix =
|
|
202
202
|
scope === "run" ? "Ask for less with size: or resources: on the agent, or raise the flow's compute:."
|
|
203
|
-
: scope === "workspace" ? "Ask for less with size: or resources: on the agent, or raise the
|
|
203
|
+
: scope === "workspace" ? "Ask for less with size: or resources: on the agent, or raise the project's compute: (its AGENTS.md)."
|
|
204
204
|
: scope === "account" ? `Ask for less with size: or resources: on the agent, raise the account's compute: (Settings → Policies → Governance), ${UPGRADE}.`
|
|
205
205
|
: "Ask for less with size: or resources: on the agent: no machine here can hold a step this big.";
|
|
206
206
|
return {
|
package/src/flow-lint.ts
CHANGED
|
@@ -175,7 +175,7 @@ export function lintFlow(flow: FlowInfo, known?: KnownNames): FlowWarning[] {
|
|
|
175
175
|
message: zoneProblem,
|
|
176
176
|
detail:
|
|
177
177
|
"This is the zone the schedule fires in AND the calendar every step in this flow works " +
|
|
178
|
-
"to. Unreadable, the schedule falls back to UTC and each step inherits the
|
|
178
|
+
"to. Unreadable, the schedule falls back to UTC and each step inherits the project's " +
|
|
179
179
|
"zone instead of this one.",
|
|
180
180
|
});
|
|
181
181
|
}
|
|
@@ -237,7 +237,7 @@ export function lintFlow(flow: FlowInfo, known?: KnownNames): FlowWarning[] {
|
|
|
237
237
|
// Trigger shapes that can never fire, said at check time rather than
|
|
238
238
|
// discovered as a flow that "never runs".
|
|
239
239
|
if (flow.budgetProblem) {
|
|
240
|
-
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
|
|
240
|
+
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." });
|
|
241
241
|
}
|
|
242
242
|
if (flow.trigger === "once" && !flow.at) {
|
|
243
243
|
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." });
|
|
@@ -246,7 +246,7 @@ export function lintFlow(flow: FlowInfo, known?: KnownNames): FlowWarning[] {
|
|
|
246
246
|
warnings.push({ step: null, message: "trigger: watch needs an http(s) `url:`", detail: "The scheduler polls that URL and starts the flow when its content changes." });
|
|
247
247
|
}
|
|
248
248
|
if (flow.trigger === "flow") {
|
|
249
|
-
if (!flow.after) warnings.push({ step: null, message: "trigger: flow needs `after: <flow>`", detail: "Name the flow of this
|
|
249
|
+
if (!flow.after) warnings.push({ step: null, message: "trigger: flow needs `after: <flow>`", detail: "Name the flow of this project whose finishing starts this one." });
|
|
250
250
|
else if (flow.after === flow.name) 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." });
|
|
251
251
|
}
|
|
252
252
|
if (flow.signature && !flow.signingSecret) {
|
|
@@ -364,7 +364,7 @@ export function lintFlow(flow: FlowInfo, known?: KnownNames): FlowWarning[] {
|
|
|
364
364
|
line: step.line,
|
|
365
365
|
level: "error",
|
|
366
366
|
kind: "outward",
|
|
367
|
-
message: `[[${step.agent}]] can act outside this
|
|
367
|
+
message: `[[${step.agent}]] can act outside this project and this step has no verify: and no gate`,
|
|
368
368
|
detail:
|
|
369
369
|
"A step that sends, posts, buys or publishes needs one of two things: a `verify:` the " +
|
|
370
370
|
"runtime can fail the step on — a receipt file, a ledger row, the reply's own verdict " +
|
|
@@ -383,7 +383,7 @@ export function lintFlow(flow: FlowInfo, known?: KnownNames): FlowWarning[] {
|
|
|
383
383
|
step: i,
|
|
384
384
|
line: step.line,
|
|
385
385
|
kind: "outward",
|
|
386
|
-
message: `[[${step.agent}]] can act outside this
|
|
386
|
+
message: `[[${step.agent}]] can act outside this project and this step has retry: ${step.retry}`,
|
|
387
387
|
detail:
|
|
388
388
|
"A retry runs the whole step again, sends included. The runner does not retry a failure " +
|
|
389
389
|
"that came from the check after the step's tools ran, but an attempt that failed mid-way — " +
|
|
@@ -438,7 +438,7 @@ export function lintFlow(flow: FlowInfo, known?: KnownNames): FlowWarning[] {
|
|
|
438
438
|
step: i,
|
|
439
439
|
line: step.line,
|
|
440
440
|
level: "error",
|
|
441
|
-
message: `[[${step.agent}]] is not an agent in this
|
|
441
|
+
message: `[[${step.agent}]] is not an agent in this project`,
|
|
442
442
|
detail:
|
|
443
443
|
"This step has nothing to run. Every run of this flow fails here. Check the spelling " +
|
|
444
444
|
"against `agents/<name>/agent.md` — the name is the folder's, not the file's heading — " +
|
|
@@ -495,7 +495,7 @@ export function lintFlow(flow: FlowInfo, known?: KnownNames): FlowWarning[] {
|
|
|
495
495
|
warnings.push({
|
|
496
496
|
step: i,
|
|
497
497
|
line: step.line,
|
|
498
|
-
message: `delegate: "${name}" is not an agent in this
|
|
498
|
+
message: `delegate: "${name}" is not an agent in this project`,
|
|
499
499
|
detail:
|
|
500
500
|
"The runner only accepts picks from the declared set, so this name can never be " +
|
|
501
501
|
"chosen — the step silently has one fewer colleague to call on. Fix the spelling, " +
|
|
@@ -507,7 +507,7 @@ export function lintFlow(flow: FlowInfo, known?: KnownNames): FlowWarning[] {
|
|
|
507
507
|
warnings.push({
|
|
508
508
|
step: i,
|
|
509
509
|
line: step.line,
|
|
510
|
-
message: `on-fail: "${step.onFail}" is not an agent in this
|
|
510
|
+
message: `on-fail: "${step.onFail}" is not an agent in this project`,
|
|
511
511
|
detail:
|
|
512
512
|
"The recovery path is the one you cannot test by running the flow successfully. As " +
|
|
513
513
|
"written, a failure here has nowhere to go and the step just fails.",
|