foldrun 25.0.1 → 25.1.0

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/commands.mjs +10 -6
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "foldrun",
3
- "version": "25.0.1",
3
+ "version": "25.1.0",
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",
package/src/commands.mjs CHANGED
@@ -4727,7 +4727,8 @@ async function doctor(flags) {
4727
4727
  * keys create <label> --expires 90d it stops working in 90 days (30d, 365d, never)
4728
4728
  * keys create <label> --a2a --to <ws> --flows a,b [--max-tasks N] a key for an outside agent: /a2a only
4729
4729
  * keys create <label> --gateway --cap <usd> [--daily <usd>] a coding agent's key (Claude Code): the gateway only
4730
- * keys create <label> --gateway --login on the operator's Claude login (its own accounts): not metered
4730
+ * keys create <label> --gateway --login on the account's plan (where it has one): not billed per call
4731
+ * keys create <label> --gateway --login --plan max five times a pro key's usage limits (pro is the default)
4731
4732
  * keys create <label> --gateway --cap <usd> --claude-code …and write it into Claude Code's settings (its status line too)
4732
4733
  * keys set <id> --opus|--sonnet|--haiku <provider/model> which model each Claude Code tier runs on (a gateway key; `-` clears one, --clear all)
4733
4734
  * keys rotate <id> [--grace 1h] a new key, same label/role/scope; the old
@@ -4920,7 +4921,7 @@ function modelsLine(m) {
4920
4921
  function gatewayLine(g) {
4921
4922
  const map = modelsLine(g?.models);
4922
4923
  const tail = map ? ` · ${map}` : "";
4923
- if (g?.credential === "login") return `gateway · Claude Code · the operator's Claude login · not metered${tail}`;
4924
+ if (g?.credential === "login") return `gateway · Claude Code · ${g.plan === "max" ? "max" : "pro"} plan · not billed per call${tail}`;
4924
4925
  const usd = (n) => `$${Number(n ?? 0).toFixed(2)}`;
4925
4926
  const parts = ["gateway · Claude Code"];
4926
4927
  if (g?.capUsd != null) parts.push(`${usd(g.spentUsd)} of ${usd(g.capUsd)}`);
@@ -4950,15 +4951,18 @@ async function keysCreateGateway(url, label, flags) {
4950
4951
  }
4951
4952
  // --login: the operator's own Claude login, for an account the operator
4952
4953
  // allows it (its desks' accounts) — not metered, so it takes no limit.
4953
- if (flags.login === true && (flags.cap !== undefined || flags.daily !== undefined)) throw new Error("--login takes no --cap or --daily — the operator's Claude login is not metered, so a dollar limit could not hold it");
4954
+ if (flags.login === true && (flags.cap !== undefined || flags.daily !== undefined)) throw new Error("--login takes no --cap or --daily — a key on the account's plan is not billed per call, so a dollar limit could not hold it");
4954
4955
  const capUsd = flags.login === true ? undefined : usdFlag(flags.cap, "--cap");
4955
4956
  const dailyUsd = flags.login === true ? undefined : usdFlag(flags.daily, "--daily");
4956
- if (flags.login !== true && capUsd === undefined && dailyUsd === undefined) throw new Error("a gateway key needs a limit of its own: --cap <usd> in all, or --daily <usd> per UTC day (or both) — or --login, on an account the operator's Claude login is for");
4957
+ if (flags.login !== true && capUsd === undefined && dailyUsd === undefined) throw new Error("a gateway key needs a limit of its own: --cap <usd> in all, or --daily <usd> per UTC day (or both) — or --login, on an account that has a plan");
4957
4958
  // --claude-code: read Claude Code's settings BEFORE minting, so a file we
4958
4959
  // could not safely rewrite stops here with nothing made.
4959
4960
  const claude = flags["claude-code"] === true ? preflightClaudeSettings() : null;
4960
4961
  const body = { label, purpose: "gateway" };
4962
+ if (flags.plan !== undefined && flags.login !== true) throw new Error("--plan goes with --login: a key with --cap or --daily has those limits");
4963
+ if (flags.plan !== undefined && flags.plan !== "pro" && flags.plan !== "max") throw new Error(`--plan is pro or max — got ${JSON.stringify(flags.plan)}`);
4961
4964
  if (flags.login === true) body.credential = "login";
4965
+ if (flags.login === true && flags.plan !== undefined) body.plan = flags.plan;
4962
4966
  // --require-customer (FOL-168): every call must send x-foldrun-customer.
4963
4967
  if (flags["require-customer"] === true) body.requireCustomer = true;
4964
4968
  if (capUsd !== undefined) body.capUsd = capUsd;
@@ -4968,7 +4972,7 @@ async function keysCreateGateway(url, label, flags) {
4968
4972
  if (flags.expires !== undefined && typeof flags.expires !== "string") throw new Error("--expires needs a span: 30d, 90d, 365d or never");
4969
4973
  body.expires = flags.forever === true ? "never" : typeof flags.expires === "string" ? flags.expires : "90d";
4970
4974
  const made = await remoteCall(url, flags, "/api/keys", { method: "POST", body: JSON.stringify(body) });
4971
- console.log(`\n ${c.green("✓")} ${c.bold(label)} ${c.dim(made.id)} ${c.dim(gatewayLine({ capUsd: made.capUsd ?? null, dailyUsd: made.dailyUsd ?? null, spentUsd: 0, todayUsd: 0, credential: made.credential }))}${made.expiresAt ? c.dim(` expires ${made.expiresAt.slice(0, 10)}`) : ""}\n`);
4975
+ console.log(`\n ${c.green("✓")} ${c.bold(label)} ${c.dim(made.id)} ${c.dim(gatewayLine({ capUsd: made.capUsd ?? null, dailyUsd: made.dailyUsd ?? null, spentUsd: 0, todayUsd: 0, credential: made.credential, plan: made.plan }))}${made.expiresAt ? c.dim(` expires ${made.expiresAt.slice(0, 10)}`) : ""}\n`);
4972
4976
  if (made.key == null) return lostSecret(made.id);
4973
4977
  console.log(` ${made.key}\n`);
4974
4978
  const base = made.gatewayUrl ?? "<the gateway URL — not set on this platform yet>";
@@ -5001,7 +5005,7 @@ async function keysCreateGateway(url, label, flags) {
5001
5005
  }
5002
5006
  // A login key is not metered: there is no spend for `keys ls` to show.
5003
5007
  const after = made.credential === "login"
5004
- ? `It opens the gateway only and runs on the operator's Claude login, not metered — it shares that subscription's weekly cap with the desks. \`foldrun keys revoke ${made.id}\` ends it.`
5008
+ ? `It opens the gateway only and runs on this account's plan: not billed per call, the plan's usage limits apply. \`foldrun keys revoke ${made.id}\` ends it.`
5005
5009
  : `It opens the gateway only. \`foldrun keys ls\` shows what it has spent; \`foldrun keys revoke ${made.id}\` ends it.`;
5006
5010
  console.log(` ${c.dim(after)}\n`);
5007
5011
  return 0;