@mtreeai/msapling-cli 2.3.6-beta.32 → 2.3.6-beta.34

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/index.js CHANGED
@@ -8680,72 +8680,12 @@ var init_TrustStore = __esm({
8680
8680
  }
8681
8681
  });
8682
8682
 
8683
- // ../../node_modules/.bun/keytar@7.9.0/node_modules/keytar/build/Release/keytar.node
8684
- var keytar_default;
8685
- var init_keytar = __esm({
8686
- "../../node_modules/.bun/keytar@7.9.0/node_modules/keytar/build/Release/keytar.node"() {
8687
- keytar_default = "./keytar-F4YAPN53.node";
8688
- }
8689
- });
8690
-
8691
- // node-file:<repo>\node_modules\.bun\keytar@7.9.0\node_modules\keytar\build\Release\keytar.node
8692
- var require_keytar = __commonJS({
8693
- "node-file:F:\\MForest\\projects\\MSapling_CLI\\node_modules\\.bun\\keytar@7.9.0\\node_modules\\keytar\\build\\Release\\keytar.node"(exports, module) {
8694
- "use strict";
8695
- init_esm_shims();
8696
- init_keytar();
8697
- try {
8698
- module.exports = __require(keytar_default);
8699
- } catch {
8700
- }
8701
- }
8702
- });
8703
-
8704
- // ../../node_modules/.bun/keytar@7.9.0/node_modules/keytar/lib/keytar.js
8705
- var require_keytar2 = __commonJS({
8706
- "../../node_modules/.bun/keytar@7.9.0/node_modules/keytar/lib/keytar.js"(exports, module) {
8707
- "use strict";
8708
- init_esm_shims();
8709
- var keytar2 = require_keytar();
8710
- function checkRequired(val, name) {
8711
- if (!val || val.length <= 0) {
8712
- throw new Error(name + " is required.");
8713
- }
8714
- }
8715
- module.exports = {
8716
- getPassword: function(service, account) {
8717
- checkRequired(service, "Service");
8718
- checkRequired(account, "Account");
8719
- return keytar2.getPassword(service, account);
8720
- },
8721
- setPassword: function(service, account, password) {
8722
- checkRequired(service, "Service");
8723
- checkRequired(account, "Account");
8724
- checkRequired(password, "Password");
8725
- return keytar2.setPassword(service, account, password);
8726
- },
8727
- deletePassword: function(service, account) {
8728
- checkRequired(service, "Service");
8729
- checkRequired(account, "Account");
8730
- return keytar2.deletePassword(service, account);
8731
- },
8732
- findPassword: function(service) {
8733
- checkRequired(service, "Service");
8734
- return keytar2.findPassword(service);
8735
- },
8736
- findCredentials: function(service) {
8737
- checkRequired(service, "Service");
8738
- return keytar2.findCredentials(service);
8739
- }
8740
- };
8741
- }
8742
- });
8743
-
8744
8683
  // ../core/src/Storage/vault.ts
8745
8684
  import { join as join17 } from "path";
8746
8685
  import { chmodSync, existsSync as existsSync13, renameSync as renameSync2, unlinkSync } from "fs";
8747
8686
  import { writeFile as writeFile6, readFile as readFile13 } from "fs/promises";
8748
8687
  import { createHash as createHash4 } from "crypto";
8688
+ import * as keytar from "keytar";
8749
8689
  async function saveToken(baseDir, token) {
8750
8690
  const filePath = join17(baseDir, "vault", "token");
8751
8691
  try {
@@ -8813,12 +8753,11 @@ async function readVaultRef(baseDir, label) {
8813
8753
  if (!existsSync13(objectPath)) return null;
8814
8754
  return readFile13(objectPath, "utf8");
8815
8755
  }
8816
- var keytar, KEYCHAIN_SERVICE, KEYCHAIN_ACCOUNT;
8756
+ var KEYCHAIN_SERVICE, KEYCHAIN_ACCOUNT;
8817
8757
  var init_vault = __esm({
8818
8758
  "../core/src/Storage/vault.ts"() {
8819
8759
  "use strict";
8820
8760
  init_esm_shims();
8821
- keytar = __toESM(require_keytar2(), 1);
8822
8761
  KEYCHAIN_SERVICE = "msapling-cli";
8823
8762
  KEYCHAIN_ACCOUNT = "auth_token";
8824
8763
  }
@@ -11340,15 +11279,18 @@ var init_usage = __esm({
11340
11279
  context.addMessage("system", JSON.stringify(user, null, 2));
11341
11280
  return;
11342
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();
11343
11285
  context.addMessage("system", "MSapling Usage Dashboard:");
11344
- context.addMessage("system", ` - Fuel Credits: $${user.fuel_credits.toFixed(4)}`);
11286
+ context.addMessage("system", ` - Fuel Credits: ${$(user.fuel_credits)}`);
11345
11287
  context.addMessage("system", ` - Daily Spending Limit: ${user.monthly_spending_limit ? "$" + user.monthly_spending_limit : "Unlimited"}`);
11346
11288
  context.addMessage("system", "\n[TRACK BREAKDOWN]");
11347
- context.addMessage("system", ` - BYOK: ${user.tokens_byok.toLocaleString()} tokens ($${user.cost_byok.toFixed(4)})`);
11348
- context.addMessage("system", ` - Ollama: ${user.tokens_ollama.toLocaleString()} tokens ($${user.cost_ollama.toFixed(4)})`);
11349
- context.addMessage("system", ` - Purchased: ${user.tokens_purchased.toLocaleString()} tokens ($${user.cost_purchased.toFixed(4)})`);
11350
- context.addMessage("system", ` - Subscription: ${user.tokens_subscription.toLocaleString()} tokens ($${user.cost_subscription.toFixed(4)})`);
11351
- 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)})`);
11352
11294
  } catch (e) {
11353
11295
  context.addMessage("error", `Failed to fetch usage: ${e.message}`);
11354
11296
  }
@@ -12428,7 +12370,7 @@ var init_version = __esm({
12428
12370
  description: "Show version information for CLI and core packages",
12429
12371
  category: "debug",
12430
12372
  handler: async (_args, context) => {
12431
- const cliVersion = true ? "2.3.6-beta.32" : "(dev)";
12373
+ const cliVersion = true ? "2.3.6-beta.34" : "(dev)";
12432
12374
  const coreVersion = true ? "2.3.2" : "(dev)";
12433
12375
  const runtime = process.version;
12434
12376
  context.addMessage("system", "MSapling Version Info");
@@ -12437,7 +12379,7 @@ var init_version = __esm({
12437
12379
  context.addMessage("system", row2("Core (@msapling/core)", coreVersion));
12438
12380
  context.addMessage("system", row2("Runtime (Node/Bun)", runtime));
12439
12381
  try {
12440
- const ts = "2026-06-02T15:01:04.780Z";
12382
+ const ts = "2026-06-02T15:12:47.326Z";
12441
12383
  if (ts && ts !== "__BUILD_TIMESTAMP__") {
12442
12384
  context.addMessage("system", row2("Build Timestamp", ts));
12443
12385
  }
@@ -17954,7 +17896,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
17954
17896
  var Header = () => /* @__PURE__ */ jsxs(Box, { borderStyle: "single", borderColor: "cyan", paddingX: 1, marginBottom: 1, children: [
17955
17897
  /* @__PURE__ */ jsxs(Text, { bold: true, color: "cyan", children: [
17956
17898
  "\u25CF MSapling CLI v",
17957
- "2.3.6-beta.32"
17899
+ "2.3.6-beta.34"
17958
17900
  ] }),
17959
17901
  /* @__PURE__ */ jsx(Box, { marginLeft: 2, children: /* @__PURE__ */ jsx(Text, { color: "gray", children: "Platinum Tier Architecture" }) })
17960
17902
  ] });
@@ -18962,11 +18904,13 @@ function handleCliArgs(args2) {
18962
18904
  (async () => {
18963
18905
  const { runExec: runExec2 } = await Promise.resolve().then(() => (init_exec(), exec_exports));
18964
18906
  const exitCode = await runExec2(cmdStr);
18965
- process.exit(exitCode);
18907
+ process.exitCode = exitCode;
18908
+ setTimeout(() => process.exit(exitCode), 50).unref();
18966
18909
  })().catch((e) => {
18967
18910
  process.stderr.write(`[msapling-exec] fatal: ${e?.message ?? e}
18968
18911
  `);
18969
- process.exit(1);
18912
+ process.exitCode = 1;
18913
+ setTimeout(() => process.exit(1), 50).unref();
18970
18914
  });
18971
18915
  return false;
18972
18916
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mtreeai/msapling-cli",
3
- "version": "2.3.6-beta.32",
3
+ "version": "2.3.6-beta.34",
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",
@@ -54,6 +54,9 @@
54
54
  "react": "^18.3.1",
55
55
  "yaml": "^2.8.3"
56
56
  },
57
+ "optionalDependencies": {
58
+ "keytar": "^7.9.0"
59
+ },
57
60
  "devDependencies": {
58
61
  "@msapling/api-client": "workspace:*",
59
62
  "@msapling/core": "workspace:*",
Binary file