@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/src/store.ts
CHANGED
|
@@ -306,7 +306,7 @@ export function checkFormatVersion(declared: unknown): VersionCheck {
|
|
|
306
306
|
declared: value,
|
|
307
307
|
supported: FORMAT_VERSION,
|
|
308
308
|
warning:
|
|
309
|
-
`this
|
|
309
|
+
`this project targets foldrun format ${value}, and this build understands ` +
|
|
310
310
|
`${FORMAT_VERSION}. A different major version may mean different behaviour — ` +
|
|
311
311
|
`read it as best-effort rather than correct.`,
|
|
312
312
|
};
|
|
@@ -316,7 +316,7 @@ export function checkFormatVersion(declared: unknown): VersionCheck {
|
|
|
316
316
|
declared: value,
|
|
317
317
|
supported: FORMAT_VERSION,
|
|
318
318
|
warning:
|
|
319
|
-
`this
|
|
319
|
+
`this project targets foldrun format ${value}; this build understands ` +
|
|
320
320
|
`${FORMAT_VERSION}. Newer fields will be ignored rather than rejected.`,
|
|
321
321
|
};
|
|
322
322
|
}
|
|
@@ -422,7 +422,7 @@ export function saveWorkspace(
|
|
|
422
422
|
assertCanonicalCase(norm);
|
|
423
423
|
if (!IN_WORKSPACE_DIR.test(norm) && norm !== "project.md" && norm !== "AGENTS.md") {
|
|
424
424
|
throw new Error(
|
|
425
|
-
`unexpected file: ${f.path} — a
|
|
425
|
+
`unexpected file: ${f.path} — a project holds AGENTS.md plus ` +
|
|
426
426
|
`${WORKSPACE_DIRS.map((d) => `${d}/`).join(", ")}`,
|
|
427
427
|
);
|
|
428
428
|
}
|
|
@@ -2173,7 +2173,7 @@ export function parseFlow(file: string, raw: string): FlowInfo {
|
|
|
2173
2173
|
else step.schema = parsed.schema;
|
|
2174
2174
|
}
|
|
2175
2175
|
else if (!/\s/.test(value) && (/\.(json|ya?ml)$/i.test(value) || value.includes("/"))) step.schemaPath = value;
|
|
2176
|
-
else problem("a JSON object, a path under the
|
|
2176
|
+
else problem("a JSON object, a path under the project (schemas/lead.json), or a YAML block on the lines below");
|
|
2177
2177
|
}
|
|
2178
2178
|
}
|
|
2179
2179
|
}
|
|
@@ -2828,7 +2828,7 @@ export function accountFileSealed(rel: string): string | null {
|
|
|
2828
2828
|
return "generated bookkeeping, not an authored file.";
|
|
2829
2829
|
}
|
|
2830
2830
|
if (/^workspaces\/[^/]+\/secrets\.json$/.test(norm)) {
|
|
2831
|
-
return "the
|
|
2831
|
+
return "the project vault — encrypted, and never served to a browser.";
|
|
2832
2832
|
}
|
|
2833
2833
|
return null;
|
|
2834
2834
|
}
|
|
@@ -2975,7 +2975,7 @@ export function landsInside(dir: string, full: string, followLast = true): boole
|
|
|
2975
2975
|
}
|
|
2976
2976
|
|
|
2977
2977
|
export function assertLandsInside(dir: string, full: string, rel: string, followLast = true) {
|
|
2978
|
-
if (!landsInside(dir, full, followLast)) throw new Error(`illegal path: ${rel} leads out of the
|
|
2978
|
+
if (!landsInside(dir, full, followLast)) throw new Error(`illegal path: ${rel} leads out of the project through a symlink`);
|
|
2979
2979
|
}
|
|
2980
2980
|
|
|
2981
2981
|
export function readWorkspaceFile(tenant: string, workspace: string, rel: string): string {
|
|
@@ -2990,7 +2990,7 @@ export function readWorkspaceFile(tenant: string, workspace: string, rel: string
|
|
|
2990
2990
|
try {
|
|
2991
2991
|
return readPlainText(realLanding(p) ?? p, { root: dir });
|
|
2992
2992
|
} catch (err) {
|
|
2993
|
-
if (err instanceof UnsafeFileError) throw new Error(`illegal path: ${rel} leads out of the
|
|
2993
|
+
if (err instanceof UnsafeFileError) throw new Error(`illegal path: ${rel} leads out of the project through a symlink`);
|
|
2994
2994
|
throw err;
|
|
2995
2995
|
}
|
|
2996
2996
|
}
|
|
@@ -3019,7 +3019,7 @@ export function writeWorkspaceFile(
|
|
|
3019
3019
|
// workspace:manage role and the plan's workspace count that POST
|
|
3020
3020
|
// /api/workspaces, deploy and import apply. Those create through
|
|
3021
3021
|
// saveWorkspace / applyImport, not through here.
|
|
3022
|
-
if (!fs.existsSync(dir)) throw Object.assign(new Error(`
|
|
3022
|
+
if (!fs.existsSync(dir)) throw Object.assign(new Error(`project ${workspace} not found`), { status: 404 });
|
|
3023
3023
|
const p = path.join(dir, assertEditablePath(rel));
|
|
3024
3024
|
// Before anything is created: mkdir below would otherwise make folders
|
|
3025
3025
|
// through a linked directory too.
|
|
@@ -3105,7 +3105,7 @@ export function anchoredReason(rel: string): string | null {
|
|
|
3105
3105
|
const norm = rel.replaceAll("\\", "/");
|
|
3106
3106
|
const base = norm.split("/").pop()!;
|
|
3107
3107
|
if (norm === "AGENTS.md" || norm === "project.md") {
|
|
3108
|
-
return `${base} is the
|
|
3108
|
+
return `${base} is the project's own identity — it cannot move; rename or delete the project instead`;
|
|
3109
3109
|
}
|
|
3110
3110
|
if (base === "agent.md") {
|
|
3111
3111
|
return "agent.md is the agent because of where it sits — to rename the agent, rename its folder";
|
|
@@ -3251,7 +3251,7 @@ export function deleteWorkspacePath(tenant: string, workspace: string, rel: stri
|
|
|
3251
3251
|
|
|
3252
3252
|
export function deleteWorkspace(tenant: string, workspace: string) {
|
|
3253
3253
|
const dir = workspaceDir(tenant, workspace);
|
|
3254
|
-
if (!fs.existsSync(dir)) throw new Error(`
|
|
3254
|
+
if (!fs.existsSync(dir)) throw new Error(`project ${workspace} not found`);
|
|
3255
3255
|
// Its records in the database (runs, trigger log, file index) go BEFORE the
|
|
3256
3256
|
// folder: if that throws, nothing was removed and the delete can be retried;
|
|
3257
3257
|
// after the folder is gone a retry would answer "not found" with rows left.
|
|
@@ -3282,7 +3282,7 @@ export function deleteWorkspace(tenant: string, workspace: string) {
|
|
|
3282
3282
|
export async function deleteWorkspaceAsync(tenant: string, workspace: string): Promise<void> {
|
|
3283
3283
|
const lc = workspaceLifecycle();
|
|
3284
3284
|
if (!lc) return deleteWorkspace(tenant, workspace);
|
|
3285
|
-
if (!fs.existsSync(workspaceDir(tenant, workspace))) throw new Error(`
|
|
3285
|
+
if (!fs.existsSync(workspaceDir(tenant, workspace))) throw new Error(`project ${workspace} not found`);
|
|
3286
3286
|
await lc.drop(tenant, workspace, () => deleteWorkspace(tenant, workspace));
|
|
3287
3287
|
}
|
|
3288
3288
|
|
|
@@ -3315,14 +3315,14 @@ export function renameWorkspace(tenant: string, from: string, to: string) {
|
|
|
3315
3315
|
if (from === to) return;
|
|
3316
3316
|
|
|
3317
3317
|
const src = workspaceDir(tenant, from);
|
|
3318
|
-
if (!fs.existsSync(src)) throw new Error(`
|
|
3318
|
+
if (!fs.existsSync(src)) throw new Error(`project ${from} not found`);
|
|
3319
3319
|
|
|
3320
3320
|
// Deliberately not workspaceDir(): that returns the *legacy* path when one
|
|
3321
3321
|
// exists, and renaming into `projects/` would resurrect the old layout.
|
|
3322
3322
|
const dest = singleWorkspace()
|
|
3323
3323
|
? (() => { throw new Error("cannot rename in single-workspace mode"); })()
|
|
3324
3324
|
: path.join(dataRoot(), tenant, WORKSPACES, to);
|
|
3325
|
-
if (fs.existsSync(dest)) throw new Error(`
|
|
3325
|
+
if (fs.existsSync(dest)) throw new Error(`project ${to} already exists`);
|
|
3326
3326
|
|
|
3327
3327
|
fs.mkdirSync(path.dirname(dest), { recursive: true });
|
|
3328
3328
|
fs.renameSync(src, dest);
|
|
@@ -3355,11 +3355,11 @@ export async function renameWorkspaceAsync(tenant: string, from: string, to: str
|
|
|
3355
3355
|
const lc = workspaceLifecycle();
|
|
3356
3356
|
if (!lc || from === to) return renameWorkspace(tenant, from, to);
|
|
3357
3357
|
assertSafeName(to, "workspace");
|
|
3358
|
-
if (!fs.existsSync(workspaceDir(tenant, from))) throw new Error(`
|
|
3358
|
+
if (!fs.existsSync(workspaceDir(tenant, from))) throw new Error(`project ${from} not found`);
|
|
3359
3359
|
// The checks renameWorkspace makes, BEFORE the history moves: a name that is
|
|
3360
3360
|
// taken must never have its history replaced by this one's.
|
|
3361
3361
|
if (singleWorkspace()) return renameWorkspace(tenant, from, to); // throws
|
|
3362
|
-
if (fs.existsSync(workspaceDir(tenant, to)) || fs.existsSync(path.join(dataRoot(), tenant, WORKSPACES, to))) throw new Error(`
|
|
3362
|
+
if (fs.existsSync(workspaceDir(tenant, to)) || fs.existsSync(path.join(dataRoot(), tenant, WORKSPACES, to))) throw new Error(`project ${to} already exists`);
|
|
3363
3363
|
await lc.move(tenant, from, to, () => renameWorkspace(tenant, from, to));
|
|
3364
3364
|
}
|
|
3365
3365
|
|
|
@@ -3374,7 +3374,7 @@ export async function renameWorkspaceAsync(tenant: string, from: string, to: str
|
|
|
3374
3374
|
* through writeWorkspaceFile, as a revision. */
|
|
3375
3375
|
export function setWorkspaceDescription(tenant: string, workspace: string, description: string, meta: ChangeMeta = {}) {
|
|
3376
3376
|
const file = path.join(workspaceDir(tenant, workspace), "AGENTS.md");
|
|
3377
|
-
if (!fs.existsSync(file)) throw new Error("this
|
|
3377
|
+
if (!fs.existsSync(file)) throw new Error("this project has no AGENTS.md");
|
|
3378
3378
|
|
|
3379
3379
|
const raw = fs.readFileSync(file, "utf8");
|
|
3380
3380
|
if (!/^---\r?\n[\s\S]*?\r?\n---/.test(raw)) throw new Error("AGENTS.md has no frontmatter");
|
package/src/tool-test.ts
CHANGED
|
@@ -403,7 +403,7 @@ export async function testTool(
|
|
|
403
403
|
detail: clip(
|
|
404
404
|
(caller
|
|
405
405
|
? `ran from agents/${caller.name}/, where a run runs\n\n`
|
|
406
|
-
: `ran from the
|
|
406
|
+
: `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`) +
|
|
407
407
|
(out || "(no output)"),
|
|
408
408
|
),
|
|
409
409
|
});
|
package/src/webhook.ts
CHANGED
|
@@ -72,7 +72,7 @@ export function rotateWebhook(tenant: string, workspace: string, flow: string):
|
|
|
72
72
|
// Into a workspace that exists, never making one (30 Oct 2026): the mkdir
|
|
73
73
|
// here turned a rotate under a mistyped name into a workspace holding only
|
|
74
74
|
// hooks.json, past the plan's workspace count.
|
|
75
|
-
if (!fs.existsSync(path.dirname(file))) throw Object.assign(new Error(`
|
|
75
|
+
if (!fs.existsSync(path.dirname(file))) throw Object.assign(new Error(`project ${workspace} not found`), { status: 404 });
|
|
76
76
|
const rotatedAt = new Date().toISOString();
|
|
77
77
|
const store = docStore(tenant, workspace);
|
|
78
78
|
if (store) {
|
|
@@ -510,7 +510,7 @@ function permanent(err: unknown): boolean {
|
|
|
510
510
|
if (err instanceof PublishError) return err.code === "bad_change";
|
|
511
511
|
if (err instanceof OpIdReused) return true; // commitEntry asked again and it still is: see there
|
|
512
512
|
const m = err instanceof Error ? err.message : "";
|
|
513
|
-
return /^illegal manifest path|differ only by case|a manifest holds at most|is not
|
|
513
|
+
return /^illegal manifest path|differ only by case|a manifest holds at most|is not project content/.test(m);
|
|
514
514
|
}
|
|
515
515
|
|
|
516
516
|
/** Wait until every queued change (of one workspace, or all) is committed.
|
|
@@ -1486,7 +1486,7 @@ async function reconcileNow(tenant: string, workspace: string, by = "reconcile")
|
|
|
1486
1486
|
ws,
|
|
1487
1487
|
opId,
|
|
1488
1488
|
by,
|
|
1489
|
-
message: "
|
|
1489
|
+
message: "project content recorded",
|
|
1490
1490
|
changes,
|
|
1491
1491
|
// Read when asked, one file at a time; publish checks the bytes against
|
|
1492
1492
|
// the sha, so a file that changed since the scan fails this repair (the
|