@mtreeai/msapling-cli 2.3.6-beta.33 → 2.3.6-beta.35

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/dist/index.js +21 -15
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -11279,15 +11279,18 @@ var init_usage = __esm({
11279
11279
  context.addMessage("system", JSON.stringify(user, null, 2));
11280
11280
  return;
11281
11281
  }
11282
+ const n = (v) => typeof v === "number" && Number.isFinite(v) ? v : 0;
11283
+ const $ = (v) => "$" + n(v).toFixed(4);
11284
+ const k = (v) => n(v).toLocaleString();
11282
11285
  context.addMessage("system", "MSapling Usage Dashboard:");
11283
- context.addMessage("system", ` - Fuel Credits: $${user.fuel_credits.toFixed(4)}`);
11286
+ context.addMessage("system", ` - Fuel Credits: ${$(user.fuel_credits)}`);
11284
11287
  context.addMessage("system", ` - Daily Spending Limit: ${user.monthly_spending_limit ? "$" + user.monthly_spending_limit : "Unlimited"}`);
11285
11288
  context.addMessage("system", "\n[TRACK BREAKDOWN]");
11286
- context.addMessage("system", ` - BYOK: ${user.tokens_byok.toLocaleString()} tokens ($${user.cost_byok.toFixed(4)})`);
11287
- context.addMessage("system", ` - Ollama: ${user.tokens_ollama.toLocaleString()} tokens ($${user.cost_ollama.toFixed(4)})`);
11288
- context.addMessage("system", ` - Purchased: ${user.tokens_purchased.toLocaleString()} tokens ($${user.cost_purchased.toFixed(4)})`);
11289
- context.addMessage("system", ` - Subscription: ${user.tokens_subscription.toLocaleString()} tokens ($${user.cost_subscription.toFixed(4)})`);
11290
- context.addMessage("system", ` - Free: ${user.tokens_free.toLocaleString()} tokens ($${user.cost_free.toFixed(4)})`);
11289
+ context.addMessage("system", ` - BYOK: ${k(user.tokens_byok)} tokens (${$(user.cost_byok)})`);
11290
+ context.addMessage("system", ` - Ollama: ${k(user.tokens_ollama)} tokens (${$(user.cost_ollama)})`);
11291
+ context.addMessage("system", ` - Purchased: ${k(user.tokens_purchased)} tokens (${$(user.cost_purchased)})`);
11292
+ context.addMessage("system", ` - Subscription: ${k(user.tokens_subscription)} tokens (${$(user.cost_subscription)})`);
11293
+ context.addMessage("system", ` - Free: ${k(user.tokens_free)} tokens (${$(user.cost_free)})`);
11291
11294
  } catch (e) {
11292
11295
  context.addMessage("error", `Failed to fetch usage: ${e.message}`);
11293
11296
  }
@@ -11933,8 +11936,8 @@ function formatTable(results) {
11933
11936
  const model = r.model.slice(0, 39).padEnd(40);
11934
11937
  const ttft = r.ttft_ms != null ? r.ttft_ms.toFixed(0).padStart(9) : " - ";
11935
11938
  const tps = r.tps != null ? r.tps.toFixed(1).padStart(7) : " - ";
11936
- const tok = r.total_tokens.toString().padStart(8);
11937
- const cost = r.cost_usd.toFixed(5).padStart(9);
11939
+ const tok = (r.total_tokens ?? 0).toString().padStart(8);
11940
+ const cost = (typeof r.cost_usd === "number" ? r.cost_usd : 0).toFixed(5).padStart(9);
11938
11941
  const err = r.error ? ` \u26A0 ${r.error}` : "";
11939
11942
  return `${model} ${ttft} ${tps} ${tok} ${cost}${err}`;
11940
11943
  });
@@ -12367,7 +12370,7 @@ var init_version = __esm({
12367
12370
  description: "Show version information for CLI and core packages",
12368
12371
  category: "debug",
12369
12372
  handler: async (_args, context) => {
12370
- const cliVersion = true ? "2.3.6-beta.33" : "(dev)";
12373
+ const cliVersion = true ? "2.3.6-beta.35" : "(dev)";
12371
12374
  const coreVersion = true ? "2.3.2" : "(dev)";
12372
12375
  const runtime = process.version;
12373
12376
  context.addMessage("system", "MSapling Version Info");
@@ -12376,7 +12379,7 @@ var init_version = __esm({
12376
12379
  context.addMessage("system", row2("Core (@msapling/core)", coreVersion));
12377
12380
  context.addMessage("system", row2("Runtime (Node/Bun)", runtime));
12378
12381
  try {
12379
- const ts = "2026-06-02T15:10:02.869Z";
12382
+ const ts = "2026-06-02T15:15:26.911Z";
12380
12383
  if (ts && ts !== "__BUILD_TIMESTAMP__") {
12381
12384
  context.addMessage("system", row2("Build Timestamp", ts));
12382
12385
  }
@@ -13108,11 +13111,12 @@ var init_budget = __esm({
13108
13111
  try {
13109
13112
  const data = await context.client.getBillingBuckets();
13110
13113
  context.addMessage("system", "Budget Buckets:");
13114
+ const n = (v) => typeof v === "number" && Number.isFinite(v) ? v : Number(v) || 0;
13111
13115
  if (data && typeof data === "object") {
13112
13116
  for (const [key, val] of Object.entries(data)) {
13113
13117
  const bucket = val;
13114
- const remaining = bucket.remaining ?? bucket.balance ?? 0;
13115
- const limit = bucket.limit ?? bucket.cap ?? 0;
13118
+ const remaining = n(bucket?.remaining ?? bucket?.balance);
13119
+ const limit = n(bucket?.limit ?? bucket?.cap);
13116
13120
  context.addMessage("system", ` - ${key}: $${remaining.toFixed(4)} / $${limit.toFixed(4)}`);
13117
13121
  }
13118
13122
  } else {
@@ -17893,7 +17897,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
17893
17897
  var Header = () => /* @__PURE__ */ jsxs(Box, { borderStyle: "single", borderColor: "cyan", paddingX: 1, marginBottom: 1, children: [
17894
17898
  /* @__PURE__ */ jsxs(Text, { bold: true, color: "cyan", children: [
17895
17899
  "\u25CF MSapling CLI v",
17896
- "2.3.6-beta.33"
17900
+ "2.3.6-beta.35"
17897
17901
  ] }),
17898
17902
  /* @__PURE__ */ jsx(Box, { marginLeft: 2, children: /* @__PURE__ */ jsx(Text, { color: "gray", children: "Platinum Tier Architecture" }) })
17899
17903
  ] });
@@ -18901,11 +18905,13 @@ function handleCliArgs(args2) {
18901
18905
  (async () => {
18902
18906
  const { runExec: runExec2 } = await Promise.resolve().then(() => (init_exec(), exec_exports));
18903
18907
  const exitCode = await runExec2(cmdStr);
18904
- process.exit(exitCode);
18908
+ process.exitCode = exitCode;
18909
+ setTimeout(() => process.exit(exitCode), 50).unref();
18905
18910
  })().catch((e) => {
18906
18911
  process.stderr.write(`[msapling-exec] fatal: ${e?.message ?? e}
18907
18912
  `);
18908
- process.exit(1);
18913
+ process.exitCode = 1;
18914
+ setTimeout(() => process.exit(1), 50).unref();
18909
18915
  });
18910
18916
  return false;
18911
18917
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mtreeai/msapling-cli",
3
- "version": "2.3.6-beta.33",
3
+ "version": "2.3.6-beta.35",
4
4
  "description": "MSapling CLI — React/Ink terminal client for the MSapling backend (chat, projects, MDrive, agent tools). Proprietary; redistribution prohibited.",
5
5
  "license": "UNLICENSED",
6
6
  "author": "MSapling Team",