@odla-ai/cli 0.46.5 → 0.46.6

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/bin.cjs CHANGED
@@ -1821,7 +1821,8 @@ var init_surface = __esm({
1821
1821
 
1822
1822
  // src/admin-spend.ts
1823
1823
  async function call(ctx, method, scope, payload) {
1824
- const url = `${ctx.platformUrl.replace(/\/$/, "")}/registry/platform/spend?scope=${encodeURIComponent(scope)}`;
1824
+ const base = `${ctx.platformUrl.replace(/\/$/, "")}/registry/platform/spend`;
1825
+ const url = scope === "default" ? `${base}/default` : `${base}?scope=${encodeURIComponent(scope)}`;
1825
1826
  const response2 = await ctx.doFetch(url, {
1826
1827
  method,
1827
1828
  headers: {
@@ -1874,7 +1875,7 @@ async function adminSpend(parsed, ctx) {
1874
1875
  if (action2 !== "show" && action2 !== "reset" && action2 !== "set") rejectWord(["admin", "spend"], action2);
1875
1876
  if (!scope) {
1876
1877
  throw new Error(
1877
- `"admin spend ${action2}" needs a scope, e.g. odla-ai admin spend ${action2} app:my-app:<incarnation>`
1878
+ `"admin spend ${action2}" needs a scope, e.g. odla-ai admin spend ${action2} app:my-app:<incarnation> (or "default" for the fleet-wide fallback)`
1878
1879
  );
1879
1880
  }
1880
1881
  if (action2 === "set") return adminSpendSet(ctx, parsed, scope);
@@ -1895,8 +1896,8 @@ async function adminSpendSet(ctx, parsed, scope) {
1895
1896
  ctx.out.log(JSON.stringify(result, null, 2));
1896
1897
  return;
1897
1898
  }
1898
- ctx.out.log(`${result.scope}: ${result.message}`);
1899
- ctx.out.log(` spent today ${money(result.spentUsd)}`);
1899
+ ctx.out.log(`${result.scope ?? scope}: ${result.message}`);
1900
+ if (typeof result.spentUsd === "number") ctx.out.log(` spent today ${money(result.spentUsd)}`);
1900
1901
  if (result.alreadyOverCap) {
1901
1902
  ctx.out.log(" today's spend already exceeds this cap \u2014 the next call will latch it.");
1902
1903
  }