foldrun 26.4.0 → 26.5.1

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/docs/runs.md CHANGED
@@ -680,11 +680,10 @@ What follows from it:
680
680
  `PUT /api/customers/<id>/block`). Its runs are refused at start (`403`,
681
681
  code `customer_blocked`), and a run of it already going stops at its next
682
682
  model call. Unblocking lets it through again.
683
- - **Told to the model provider.** On foldrun's models, the provider is sent
684
- the customer as its end-user id — hashed with your account, so your id never
685
- leaves foldrun and two accounts' `user-1` are never one identity there. A
686
- provider that acts on abuse acts on that customer, not on everyone. Runs on
687
- your own model keys are not changed.
683
+ - **Kept inside foldrun.** The customer id is not sent to the model provider,
684
+ on foldrun's models or your own keys: no end-user id of any kind goes
685
+ upstream. Attribution, the block list and the daily cap are applied by
686
+ foldrun itself. (Until 17 Nov 2026 the provider was sent a hashed id.)
688
687
  - **Found.** The run page shows **Customer**, linked to the runs list filtered
689
688
  to it; `foldrun runs --customer c-8812` and `GET …/runs?customer=c-8812` list
690
689
  them.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "foldrun",
3
- "version": "26.4.0",
3
+ "version": "26.5.1",
4
4
  "description": "Agents are just folders. Write them, check them, run them — on your machine.",
5
5
  "license": "FSL-1.1-ALv2",
6
6
  "type": "module",
@@ -22,7 +22,7 @@
22
22
  ],
23
23
  "scripts": {
24
24
  "e2e": "FOLDRUN_E2E=1 FOLDRUN_DATA=$(mktemp -d /tmp/foldrun-e2e-XXXXXX) node --test --test-timeout=300000 tests/e2e.test.ts",
25
- "test": "FOLDRUN_DATA=$(mktemp -d /tmp/foldrun-test-XXXXXX) node --test tests/cli-account.test.ts tests/model-credential.test.ts tests/cli-approvals.test.ts tests/cli-issues.test.ts tests/cli-capture.test.ts tests/cli-stop.test.ts tests/cli-account-settings.test.ts tests/cli-team-me.test.ts tests/cli-schedule.test.ts tests/cli-billing.test.ts tests/cli-storage.test.ts tests/cli-scaffold.test.ts tests/cli-secrets.test.ts tests/cli-site-login.test.ts tests/cli-check-library.test.ts tests/cli-check-timezone.test.ts tests/cli-check-frontmatter.test.ts tests/cli-agent-import.test.ts tests/cli-check-subagents.test.ts tests/cli-connect.test.ts tests/cli-accounts.test.ts tests/cli-remote.test.ts tests/cli-stream.test.ts tests/cli-doctor.test.ts tests/cli-tool-test.test.ts tests/cli-agent-run.test.ts tests/cli-check-remote.test.ts tests/cli-shares.test.ts tests/cli-triggers.test.ts tests/cli-providers.test.ts tests/cli-rerun-put.test.ts tests/cli-guide.test.ts tests/cli-runtimes.test.ts tests/cli-deploy-safety.test.ts tests/cli-operator.test.ts tests/cli-flow-patterns.test.ts tests/cli-flow-rm-step.test.ts tests/cli-flow-dup-step.test.ts tests/cli-flow-write-stale.test.ts tests/cli-agent-link-stale.test.ts tests/cli-agent-link-isolated.test.ts tests/cli-parity.test.ts tests/cli-invoke-inputs.test.ts tests/cli-audit-keys.test.ts tests/cli-version.test.ts tests/cli-check-web-warnings.test.ts tests/cli-report-image.test.ts tests/cli-report-cache.test.ts tests/cli-check-workspace-paths.test.ts tests/cli-parity-dashboard.test.ts tests/cli-api-standards.test.ts tests/cli-backups-onboarding.test.ts tests/cli-check-limits.test.ts tests/cli-gallery.test.ts tests/cli-status-platform.test.ts tests/cli-webhooks-notifications.test.ts tests/cli-flags.test.ts tests/cli-api-coverage.test.ts tests/cli-hooks.test.ts tests/cli-release.test.ts tests/cli-terminal.test.ts tests/cli-network.test.ts tests/cli-assistant.test.ts tests/cli-check-scan.test.ts tests/cli-published.test.ts tests/cli-init-target.test.ts tests/cli-flow-filter.test.ts tests/cli-eval-grades.test.ts tests/cli-eval-compare.test.ts tests/cli-proposals.test.ts tests/cli-inbox.test.ts tests/cli-usage-compute.test.ts tests/cli-usage-meters.test.ts tests/cli-fol105.test.ts tests/cli-key-renew.test.ts tests/cli-wait-failed.test.ts tests/cli-mcp.test.ts tests/cli-a2a.test.ts tests/cli-gateway.test.ts tests/cli-switches.test.ts tests/cli-parity-runs.test.ts tests/cli-parity-b.test.ts tests/cli-parity-clears.test.ts tests/cli-parity-c.test.ts tests/cli-runs-paging.test.ts tests/cli-budget-invoices.test.ts tests/cli-observe-analysis.test.ts tests/cli-failure-retention.test.ts tests/cli-snapshot.test.ts tests/cli-run-money.test.ts tests/cli-talk.test.ts tests/cli-text.test.ts tests/cli-browser.test.ts",
25
+ "test": "FOLDRUN_DATA=$(mktemp -d /tmp/foldrun-test-XXXXXX) node --test tests/cli-account.test.ts tests/model-credential.test.ts tests/cli-approvals.test.ts tests/cli-issues.test.ts tests/cli-capture.test.ts tests/cli-stop.test.ts tests/cli-account-settings.test.ts tests/cli-team-me.test.ts tests/cli-schedule.test.ts tests/cli-billing.test.ts tests/cli-storage.test.ts tests/cli-scaffold.test.ts tests/cli-secrets.test.ts tests/cli-site-login.test.ts tests/cli-check-library.test.ts tests/cli-check-timezone.test.ts tests/cli-check-frontmatter.test.ts tests/cli-agent-import.test.ts tests/cli-check-subagents.test.ts tests/cli-connect.test.ts tests/cli-accounts.test.ts tests/cli-remote.test.ts tests/cli-stream.test.ts tests/cli-doctor.test.ts tests/cli-tool-test.test.ts tests/cli-agent-run.test.ts tests/cli-check-remote.test.ts tests/cli-shares.test.ts tests/cli-triggers.test.ts tests/cli-providers.test.ts tests/cli-rerun-put.test.ts tests/cli-guide.test.ts tests/cli-runtimes.test.ts tests/cli-deploy-safety.test.ts tests/cli-operator.test.ts tests/cli-flow-patterns.test.ts tests/cli-flow-rm-step.test.ts tests/cli-flow-dup-step.test.ts tests/cli-flow-write-stale.test.ts tests/cli-agent-link-stale.test.ts tests/cli-agent-link-isolated.test.ts tests/cli-parity.test.ts tests/cli-invoke-inputs.test.ts tests/cli-audit-keys.test.ts tests/cli-version.test.ts tests/cli-check-web-warnings.test.ts tests/cli-report-image.test.ts tests/cli-report-cache.test.ts tests/cli-check-workspace-paths.test.ts tests/cli-parity-dashboard.test.ts tests/cli-api-standards.test.ts tests/cli-backups-onboarding.test.ts tests/cli-check-limits.test.ts tests/cli-gallery.test.ts tests/cli-status-platform.test.ts tests/cli-webhooks-notifications.test.ts tests/cli-flags.test.ts tests/cli-api-coverage.test.ts tests/cli-hooks.test.ts tests/cli-release.test.ts tests/cli-terminal.test.ts tests/cli-network.test.ts tests/cli-assistant.test.ts tests/cli-check-scan.test.ts tests/cli-published.test.ts tests/cli-init-target.test.ts tests/cli-flow-filter.test.ts tests/cli-eval-grades.test.ts tests/cli-eval-compare.test.ts tests/cli-proposals.test.ts tests/cli-inbox.test.ts tests/cli-usage-compute.test.ts tests/cli-usage-meters.test.ts tests/cli-fol105.test.ts tests/cli-key-renew.test.ts tests/cli-wait-failed.test.ts tests/cli-mcp.test.ts tests/cli-a2a.test.ts tests/cli-gateway.test.ts tests/cli-switches.test.ts tests/cli-parity-runs.test.ts tests/cli-parity-b.test.ts tests/cli-parity-clears.test.ts tests/cli-parity-c.test.ts tests/cli-runs-paging.test.ts tests/cli-budget-invoices.test.ts tests/cli-observe-analysis.test.ts tests/cli-failure-retention.test.ts tests/cli-snapshot.test.ts tests/cli-run-money.test.ts tests/cli-talk.test.ts tests/cli-text.test.ts tests/cli-browser.test.ts tests/cli-read-concurrency.test.ts",
26
26
  "release": "node scripts/release.mjs",
27
27
  "typecheck": "tsc -p tsconfig.json",
28
28
  "docs:sync": "node scripts/sync-docs.mjs",
package/src/commands.mjs CHANGED
@@ -5682,46 +5682,55 @@ const digest = (s) => crypto.createHash("sha256").update(s).digest("hex").slice(
5682
5682
  async function remoteWorkspaceFiles(url, flags, ws, isSourcePath) {
5683
5683
  const { files } = await remoteCall(url, flags, `/api/workspaces/${encodeURIComponent(ws)}/source`);
5684
5684
  const wanted = (files ?? []).filter(isSourcePath);
5685
- const out = new Map();
5686
- for (const rel of wanted) {
5685
+ // The API has no "every file with its text" read, so it is one request per
5686
+ // file — asked READ_WIDTH at a time rather than one after another (a
5687
+ // 60-file project took 60 round trips in a row).
5688
+ const bodies = await pool(wanted, READ_WIDTH, async (rel) => {
5687
5689
  const { content } = await remoteCall(
5688
5690
  url,
5689
5691
  flags,
5690
5692
  `/api/workspaces/${encodeURIComponent(ws)}/source?path=${encodeURIComponent(rel)}`,
5691
5693
  );
5692
- out.set(rel, content);
5693
- }
5694
- return out;
5694
+ return content;
5695
+ });
5696
+ return new Map(wanted.map((rel, i) => [rel, bodies[i]]));
5695
5697
  }
5696
5698
 
5699
+ /** How many reads of one listing go out at once: well under the API's per-credential window. */
5700
+ const READ_WIDTH = 8;
5701
+
5697
5702
  /** Every library file on the platform, as {kind, path, content}. */
5698
5703
  async function remoteLibrary(url, flags, kinds) {
5699
- const out = [];
5700
- for (const kind of kinds) {
5701
- let entries;
5702
- try {
5703
- ({ entries } = await remoteCall(url, flags, `/api/library/${kind}`));
5704
- } catch {
5705
- continue; // an older platform without this kind
5706
- }
5707
- for (const e of entries ?? []) {
5708
- const rel = e.path ?? (e.name ? `${e.name}.md` : null);
5709
- if (!rel) continue;
5710
- // The listing is a catalogue of tools and skills, not of files: a
5711
- // folder tool is deliberately one row, so its code is not a row of its
5712
- // own. `files` is what that row is actually made of. Without it a pull
5713
- // brought down tool.md and left run.mjs behind, and the next deploy
5714
- // would have shipped a library whose every script tool had lost its
5715
- // program. Older platforms do not send it — then the entry is its own
5716
- // whole, which is true for every single-file entry anyway.
5717
- const wanted = Array.isArray(e.files) && e.files.length ? e.files : [rel];
5718
- for (const one of wanted) {
5719
- const { content } = await remoteCall(url, flags, `/api/library/${kind}?path=${encodeURIComponent(one)}`);
5720
- out.push({ kind, path: one, content });
5704
+ const perKind = await Promise.all(
5705
+ kinds.map(async (kind) => {
5706
+ let entries;
5707
+ try {
5708
+ ({ entries } = await remoteCall(url, flags, `/api/library/${kind}`));
5709
+ } catch {
5710
+ return []; // an older platform without this kind
5721
5711
  }
5722
- }
5723
- }
5724
- return out;
5712
+ /** @type {{ kind: string, path: string }[]} */
5713
+ const todo = [];
5714
+ for (const e of entries ?? []) {
5715
+ const rel = e.path ?? (e.name ? `${e.name}.md` : null);
5716
+ if (!rel) continue;
5717
+ // The listing is a catalogue of tools and skills, not of files: a
5718
+ // folder tool is deliberately one row, so its code is not a row of its
5719
+ // own. `files` is what that row is actually made of. Without it a pull
5720
+ // brought down tool.md and left run.mjs behind, and the next deploy
5721
+ // would have shipped a library whose every script tool had lost its
5722
+ // program. Older platforms do not send it — then the entry is its own
5723
+ // whole, which is true for every single-file entry anyway.
5724
+ const wanted = Array.isArray(e.files) && e.files.length ? e.files : [rel];
5725
+ for (const one of wanted) todo.push({ kind, path: one });
5726
+ }
5727
+ return pool(todo, READ_WIDTH, async ({ kind, path: one }) => {
5728
+ const { content } = await remoteCall(url, flags, `/api/library/${kind}?path=${encodeURIComponent(one)}`);
5729
+ return { kind, path: one, content };
5730
+ });
5731
+ }),
5732
+ );
5733
+ return perKind.flat();
5725
5734
  }
5726
5735
 
5727
5736
  /** The workspaces the platform holds, by name. */
@@ -6221,15 +6230,23 @@ async function statusCmd(layout, flags, only) {
6221
6230
  if (!url) throw new Error("status compares this folder with a platform — pass --url, or `foldrun login` first");
6222
6231
  // The platform's own state first, one line: a diff read during an
6223
6232
  // incident should say so before it says anything else.
6233
+ // Asked together: the platform's own state, and the list of projects.
6234
+ const [{ report, error }, liveNames] = await Promise.all([fetchPlatformStatus(url, flags), remoteWorkspaceNames(url, flags)]);
6224
6235
  {
6225
- const { report, error } = await fetchPlatformStatus(url, flags);
6226
6236
  const paint = report ? (LEVEL_PAINT[report.status] ?? LEVEL_PAINT.unknown) : c.red;
6227
6237
  console.log(`\n ${paint("●")} ${report ? `platform: ${report.description}` : `platform status unavailable (${error})`}${report && report.status !== "operational" ? c.dim(" — foldrun status --platform") : ""}`);
6228
6238
  if (report) printIncidents(report);
6229
6239
  }
6230
6240
  const { tree } = accountTreeFrom(layout.kind === "account" ? layout.accountRoot : layout.workspaceDir, only);
6231
- const live = new Set(await remoteWorkspaceNames(url, flags));
6241
+ const live = new Set(liveNames);
6232
6242
  const stamps = readStamps(layout)[url] ?? {};
6243
+ // Every project's files are read before the first line prints, together —
6244
+ // not one project's after another's. Failures surface in the loop below,
6245
+ // in the order the projects print, as before.
6246
+ const reading = new Map(tree.workspaces.filter((w) => live.has(w.name)).map((w) => [w.name, remoteWorkspaceFiles(url, flags, w.name, isSourcePath)]));
6247
+ for (const p of reading.values()) p.catch(() => {});
6248
+ const accountMdReading = tree.agentsMd !== null ? remoteAccountAgentsMd(url, flags) : null;
6249
+ accountMdReading?.catch(() => {});
6233
6250
 
6234
6251
  console.log(`\n ${c.bold(url)} ${c.dim(`← ${tree.root}`)}\n`);
6235
6252
  for (const ws of tree.workspaces) {
@@ -6237,7 +6254,7 @@ async function statusCmd(layout, flags, only) {
6237
6254
  console.log(` ${c.green("+")} ${c.bold(ws.name)} ${c.dim(`${ws.files.length} files · not on the platform yet`)}`);
6238
6255
  continue;
6239
6256
  }
6240
- const there = await remoteWorkspaceFiles(url, flags, ws.name, isSourcePath);
6257
+ const there = /** @type {Map<string, string>} */ (await reading.get(ws.name));
6241
6258
  const here = new Map(ws.files.map((f) => [f.path, f.content]));
6242
6259
  const added = [...here.keys()].filter((p) => !there.has(p));
6243
6260
  const updated = [...here.keys()].filter((p) => there.has(p) && there.get(p) !== here.get(p));
@@ -6267,7 +6284,7 @@ async function statusCmd(layout, flags, only) {
6267
6284
  console.log(`\n ${c.dim(`on the platform but not here: ${gone.join(", ")} — \`foldrun pull\` brings them down`)}`);
6268
6285
  }
6269
6286
  if (tree.agentsMd !== null) {
6270
- const there = await remoteAccountAgentsMd(url, flags);
6287
+ const there = await accountMdReading;
6271
6288
  if (there === null) console.log(`\n ${c.dim(NO_ACCOUNT_FILE_API)}`);
6272
6289
  else if (there.refused) console.log(`\n ${c.dim("AGENTS.md (account): not readable with this key — an admin of every project sees it")}`);
6273
6290
  else console.log(`\n ${sameAccountMd(there.content, tree.agentsMd) ? `${c.green("✓")} AGENTS.md ${c.dim("(account) the same here and there")}` : `${c.dim("~")} AGENTS.md ${c.dim("(account) differs — `foldrun deploy` sends it")}`}`);
@@ -6301,9 +6318,11 @@ async function pullCmd(layout, flags, only) {
6301
6318
  const incoming = [];
6302
6319
  for (const name of names) {
6303
6320
  if (!SAFE_NAME.test(name)) throw new Error(`the platform named a project "${name}", which is not a project name — refusing to write it`);
6304
- const there = await remoteWorkspaceFiles(url, flags, name, isSourcePath);
6305
- for (const [rel, content] of there) incoming.push({ file: within(path.join(wsRoot, name), rel), content });
6306
6321
  }
6322
+ const fetched = await Promise.all(names.map((name) => remoteWorkspaceFiles(url, flags, name, isSourcePath)));
6323
+ names.forEach((name, i) => {
6324
+ for (const [rel, content] of fetched[i]) incoming.push({ file: within(path.join(wsRoot, name), rel), content });
6325
+ });
6307
6326
  for (const f of await remoteLibrary(url, flags, LIBRARY_KINDS)) {
6308
6327
  if (!LIBRARY_KINDS.includes(f.kind)) throw new Error(`the platform sent a library kind "${f.kind}" this CLI does not know — refusing to write it`);
6309
6328
  incoming.push({ file: within(path.join(root, "library", f.kind), f.path), content: f.content });
@@ -7857,9 +7876,12 @@ async function accountCmd(positional, flags) {
7857
7876
  const verb = positional[0];
7858
7877
 
7859
7878
  if (!verb) {
7879
+ // Both asked at once; the pause answer is read after the defaults print.
7880
+ const pausing = pauseState(remoteCall(url, flags, "/api/account/pause"));
7881
+ pausing.catch(() => {});
7860
7882
  const { defaults } = await remoteCall(url, flags, "/api/account");
7861
7883
  printDefaults(defaults ?? {});
7862
- const halt = await pauseState(remoteCall(url, flags, "/api/account/pause"));
7884
+ const halt = await pausing;
7863
7885
  const own = Object.keys(halt?.workspaces ?? {});
7864
7886
  if (halt) console.log(` paused ${halt.account ? c.red(pauseLine(halt.account)) : c.dim("no")}${own.length ? c.dim(` · on their own: ${own.join(", ")}`) : ""}`);
7865
7887
  console.log(`\n ${c.dim("foldrun account set timezone Australia/Sydney · set notify email you@example.com · set budget 60/month · clear budget")}\n`);