@odla-ai/cli 0.46.5 → 0.46.7

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.
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  runCli
4
- } from "./chunk-PTOBFRCO.js";
4
+ } from "./chunk-AVUBGTWE.js";
5
5
  import {
6
6
  exitCodeFor
7
7
  } from "./chunk-5MEO3BVF.js";
@@ -9,4 +9,4 @@ export {
9
9
  exitCodeFor,
10
10
  runCli
11
11
  };
12
- //# sourceMappingURL=cli-NXZIUCZT.js.map
12
+ //# sourceMappingURL=cli-IAA6SOCV.js.map
package/dist/index.cjs CHANGED
@@ -1476,7 +1476,8 @@ function surfacePaths(node = COMMAND_SURFACE, prefix = []) {
1476
1476
 
1477
1477
  // src/admin-spend.ts
1478
1478
  async function call(ctx, method, scope, payload) {
1479
- const url = `${ctx.platformUrl.replace(/\/$/, "")}/registry/platform/spend?scope=${encodeURIComponent(scope)}`;
1479
+ const base = `${ctx.platformUrl.replace(/\/$/, "")}/registry/platform/spend`;
1480
+ const url = scope === "default" ? `${base}/default` : `${base}?scope=${encodeURIComponent(scope)}`;
1480
1481
  const response2 = await ctx.doFetch(url, {
1481
1482
  method,
1482
1483
  headers: {
@@ -1530,7 +1531,7 @@ async function adminSpend(parsed, ctx) {
1530
1531
  if (action2 !== "show" && action2 !== "reset" && action2 !== "set") rejectWord(["admin", "spend"], action2);
1531
1532
  if (!scope) {
1532
1533
  throw new Error(
1533
- `"admin spend ${action2}" needs a scope, e.g. odla-ai admin spend ${action2} app:my-app:<incarnation>`
1534
+ `"admin spend ${action2}" needs a scope, e.g. odla-ai admin spend ${action2} app:my-app:<incarnation> (or "default" for the fleet-wide fallback)`
1534
1535
  );
1535
1536
  }
1536
1537
  if (action2 === "set") return adminSpendSet(ctx, parsed, scope);
@@ -1551,8 +1552,8 @@ async function adminSpendSet(ctx, parsed, scope) {
1551
1552
  ctx.out.log(JSON.stringify(result, null, 2));
1552
1553
  return;
1553
1554
  }
1554
- ctx.out.log(`${result.scope}: ${result.message}`);
1555
- ctx.out.log(` spent today ${money(result.spentUsd)}`);
1555
+ ctx.out.log(`${result.scope ?? scope}: ${result.message}`);
1556
+ if (typeof result.spentUsd === "number") ctx.out.log(` spent today ${money(result.spentUsd)}`);
1556
1557
  if (result.alreadyOverCap) {
1557
1558
  ctx.out.log(" today's spend already exceeds this cap \u2014 the next call will latch it.");
1558
1559
  }